@selvajs/selva 4.6.1 → 4.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/_app/immutable/chunks/{CpG0Drvc.js → 0lrM6Mba.js} +1 -1
- package/build/client/_app/immutable/chunks/0lrM6Mba.js.br +0 -0
- package/build/client/_app/immutable/chunks/0lrM6Mba.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{C78kFeb_.js → Cb6Kmy9P.js} +1 -1
- package/build/client/_app/immutable/chunks/Cb6Kmy9P.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cb6Kmy9P.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DratyCsz.js → D1rPdv8r.js} +1 -1
- package/build/client/_app/immutable/chunks/D1rPdv8r.js.br +0 -0
- package/build/client/_app/immutable/chunks/D1rPdv8r.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CkCtbFiD.js → DRNVpYJy.js} +1 -1
- package/build/client/_app/immutable/chunks/DRNVpYJy.js.br +0 -0
- package/build/client/_app/immutable/chunks/DRNVpYJy.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{C09zQKpt.js → FLBqkADw.js} +1 -1
- package/build/client/_app/immutable/chunks/FLBqkADw.js.br +0 -0
- package/build/client/_app/immutable/chunks/FLBqkADw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{oxLLzYjR.js → c2tvcOKZ.js} +2 -2
- package/build/client/_app/immutable/chunks/c2tvcOKZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/c2tvcOKZ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{9HY6WY44.js → j93hmZ-0.js} +1 -1
- package/build/client/_app/immutable/chunks/j93hmZ-0.js.br +0 -0
- package/build/client/_app/immutable/chunks/j93hmZ-0.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.BuRdIZOQ.js → app.IjBiMm9p.js} +2 -2
- package/build/client/_app/immutable/entry/app.IjBiMm9p.js.br +0 -0
- package/build/client/_app/immutable/entry/app.IjBiMm9p.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.Dm-nCkUQ.js +1 -0
- package/build/client/_app/immutable/entry/start.Dm-nCkUQ.js.br +2 -0
- package/build/client/_app/immutable/entry/start.Dm-nCkUQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.DOBPqhlR.js → 1.BgFhJKPe.js} +1 -1
- package/build/client/_app/immutable/nodes/1.BgFhJKPe.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.BgFhJKPe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{11.ujEuLS2O.js → 11.BSptERIn.js} +1 -1
- package/build/client/_app/immutable/nodes/11.BSptERIn.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.BSptERIn.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{13.B_xDd6Uy.js → 13.B4C6nFJe.js} +1 -1
- package/build/client/_app/immutable/nodes/13.B4C6nFJe.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.B4C6nFJe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{14.Chsd0OoI.js → 14.hOllBZyO.js} +1 -1
- package/build/client/_app/immutable/nodes/14.hOllBZyO.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.hOllBZyO.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{15.BblFO--0.js → 15.CGkCrbCe.js} +1 -1
- package/build/client/_app/immutable/nodes/15.CGkCrbCe.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.CGkCrbCe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{16.Viw6zmPA.js → 16.Cr7AW5PN.js} +1 -1
- package/build/client/_app/immutable/nodes/16.Cr7AW5PN.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.Cr7AW5PN.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{17.CDhTNsyV.js → 17.C2YwYTqu.js} +1 -1
- package/build/client/_app/immutable/nodes/17.C2YwYTqu.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.C2YwYTqu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{19.Cbp1paON.js → 19.DnKRNO0E.js} +1 -1
- package/build/client/_app/immutable/nodes/19.DnKRNO0E.js.br +0 -0
- package/build/client/_app/immutable/nodes/19.DnKRNO0E.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.C-gHZYwt.js → 2.BsBnDzDp.js} +1 -1
- package/build/client/_app/immutable/nodes/2.BsBnDzDp.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.BsBnDzDp.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.Z_-DinA0.js → 20.DIdtt_3-.js} +57 -57
- package/build/client/_app/immutable/nodes/20.DIdtt_3-.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.DIdtt_3-.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{21.BZHMTYK3.js → 21.Y17KMzb1.js} +1 -1
- package/build/client/_app/immutable/nodes/21.Y17KMzb1.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.Y17KMzb1.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{23.BQPxRSVN.js → 23.a1Dmm3Pr.js} +1 -1
- package/build/client/_app/immutable/nodes/23.a1Dmm3Pr.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.a1Dmm3Pr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{24.BcXB86Iq.js → 24.vneE4GRe.js} +1 -1
- package/build/client/_app/immutable/nodes/24.vneE4GRe.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.vneE4GRe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{27.CZFwtrmd.js → 27.BqE4M_8b.js} +1 -1
- package/build/client/_app/immutable/nodes/27.BqE4M_8b.js.br +0 -0
- package/build/client/_app/immutable/nodes/27.BqE4M_8b.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{28.CcCJ29U1.js → 28.Bm2mngao.js} +1 -1
- package/build/client/_app/immutable/nodes/28.Bm2mngao.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.Bm2mngao.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{29.BIRGR5YI.js → 29.oRB0IXGB.js} +1 -1
- package/build/client/_app/immutable/nodes/29.oRB0IXGB.js.br +0 -0
- package/build/client/_app/immutable/nodes/29.oRB0IXGB.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.DYxxVfIY.js → 3.C_92Rg4N.js} +1 -1
- package/build/client/_app/immutable/nodes/3.C_92Rg4N.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C_92Rg4N.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{30.DJKZS6xg.js → 30.D8ebFyQt.js} +1 -1
- package/build/client/_app/immutable/nodes/30.D8ebFyQt.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.D8ebFyQt.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{5.ydvn0DlC.js → 5.BWwZyD5N.js} +1 -1
- package/build/client/_app/immutable/nodes/5.BWwZyD5N.js.br +2 -0
- package/build/client/_app/immutable/nodes/5.BWwZyD5N.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.5b6WuEeg.js → 6.S-xzrYBX.js} +1 -1
- package/build/client/_app/immutable/nodes/6.S-xzrYBX.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.S-xzrYBX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{7.BePGtom3.js → 7.BVnTiBC6.js} +1 -1
- package/build/client/_app/immutable/nodes/7.BVnTiBC6.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.BVnTiBC6.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{8.DUhCMLQ8.js → 8.BU14Iv3_.js} +1 -1
- package/build/client/_app/immutable/nodes/8.BU14Iv3_.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.BU14Iv3_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{9.Io3h0BI-.js → 9.D8pR-5Cb.js} +1 -1
- package/build/client/_app/immutable/nodes/9.D8pR-5Cb.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.D8pR-5Cb.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +4 -4
- package/build/index.js +4 -4
- package/build/server/chunks/chunks/{internal.js-ygQzH1ZO.js → internal.js-Dcw2kdmH.js} +2 -2
- package/build/server/chunks/chunks/{internal.js-ygQzH1ZO.js.map → internal.js-Dcw2kdmH.js.map} +1 -1
- package/build/server/chunks/chunks/{package.js-BKafpnBH.js → package.js-BH4hEgM_.js} +2 -2
- package/build/server/chunks/chunks/{package.js-BKafpnBH.js.map → package.js-BH4hEgM_.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/compute/{_server.ts.js-D_9YzrC7.js → _server.ts.js-7u0huA7V.js} +18 -4
- package/build/server/chunks/entries/endpoints/api/compute/_server.ts.js-7u0huA7V.js.map +1 -0
- package/build/server/chunks/entries/pages/admin/{_page.server.ts.js-xV1aLIlx.js → _page.server.ts.js-vwLdirZz.js} +2 -2
- package/build/server/chunks/entries/pages/admin/{_page.server.ts.js-xV1aLIlx.js.map → _page.server.ts.js-vwLdirZz.js.map} +1 -1
- package/build/server/chunks/entries/pages/admin/system/{_page.server.ts.js-B1v99a9p.js → _page.server.ts.js-lJcimOGV.js} +2 -2
- package/build/server/chunks/entries/pages/admin/system/{_page.server.ts.js-B1v99a9p.js.map → _page.server.ts.js-lJcimOGV.js.map} +1 -1
- package/build/server/chunks/entries/pages/library/_guid_/{_page.svelte.js-BKgJcySA.js → _page.svelte.js-CuMVFfMV.js} +41 -3
- package/build/server/chunks/entries/pages/library/_guid_/{_page.svelte.js-BKgJcySA.js.map → _page.svelte.js-CuMVFfMV.js.map} +1 -1
- package/build/server/chunks/{handler-CIfYOlGM.js → handler-BgC_Dqcj.js} +3 -3
- package/build/server/chunks/{handler-CIfYOlGM.js.map → handler-BgC_Dqcj.js.map} +1 -1
- package/build/server/chunks/{index.js-DFJ2nKrZ.js → index.js-DUtBWxr2.js} +2 -2
- package/build/server/chunks/{index.js-DFJ2nKrZ.js.map → index.js-DUtBWxr2.js.map} +1 -1
- package/build/server/chunks/{manifest.js-6ZmE-R1H.js → manifest.js-BQ-f1DGc.js} +26 -26
- package/build/server/chunks/{manifest.js-6ZmE-R1H.js.map → manifest.js-BQ-f1DGc.js.map} +1 -1
- package/build/server/chunks/nodes/{1.js-DjN2qTfJ.js → 1.js-BKR2SXMe.js} +2 -2
- package/build/server/chunks/nodes/{1.js-DjN2qTfJ.js.map → 1.js-BKR2SXMe.js.map} +1 -1
- package/build/server/chunks/nodes/{11.js-DOXf13kE.js → 11.js-Cfn2qDrO.js} +2 -2
- package/build/server/chunks/nodes/{11.js-DOXf13kE.js.map → 11.js-Cfn2qDrO.js.map} +1 -1
- package/build/server/chunks/nodes/{13.js-Bt0Cb2qz.js → 13.js-TGkheX-Y.js} +2 -2
- package/build/server/chunks/nodes/{13.js-Bt0Cb2qz.js.map → 13.js-TGkheX-Y.js.map} +1 -1
- package/build/server/chunks/nodes/{14.js-jGowHFUf.js → 14.js-C9bI-V4v.js} +2 -2
- package/build/server/chunks/nodes/{14.js-jGowHFUf.js.map → 14.js-C9bI-V4v.js.map} +1 -1
- package/build/server/chunks/nodes/{15.js-BJm-NISR.js → 15.js-UnVLkp0T.js} +4 -4
- package/build/server/chunks/nodes/{15.js-BJm-NISR.js.map → 15.js-UnVLkp0T.js.map} +1 -1
- package/build/server/chunks/nodes/{16.js-BJRndz1J.js → 16.js-gKMJHzY8.js} +2 -2
- package/build/server/chunks/nodes/{16.js-BJRndz1J.js.map → 16.js-gKMJHzY8.js.map} +1 -1
- package/build/server/chunks/nodes/{17.js-D7alTcvy.js → 17.js-Ck_-DZkN.js} +2 -2
- package/build/server/chunks/nodes/{17.js-D7alTcvy.js.map → 17.js-Ck_-DZkN.js.map} +1 -1
- package/build/server/chunks/nodes/{19.js-DwxW0UEO.js → 19.js-D9DLAaDS.js} +2 -2
- package/build/server/chunks/nodes/{19.js-DwxW0UEO.js.map → 19.js-D9DLAaDS.js.map} +1 -1
- package/build/server/chunks/nodes/{2.js-DxeXJpRS.js → 2.js-DOSEejkQ.js} +2 -2
- package/build/server/chunks/nodes/{2.js-DxeXJpRS.js.map → 2.js-DOSEejkQ.js.map} +1 -1
- package/build/server/chunks/nodes/{20.js-CMDMUGWe.js → 20.js-DySdwsnp.js} +3 -3
- package/build/server/chunks/nodes/{20.js-CMDMUGWe.js.map → 20.js-DySdwsnp.js.map} +1 -1
- package/build/server/chunks/nodes/{21.js-DC8u0yyk.js → 21.js-Dhwwm5Hv.js} +2 -2
- package/build/server/chunks/nodes/{21.js-DC8u0yyk.js.map → 21.js-Dhwwm5Hv.js.map} +1 -1
- package/build/server/chunks/nodes/{23.js-zOI5F-YM.js → 23.js-Bdx9jUxD.js} +2 -2
- package/build/server/chunks/nodes/{23.js-zOI5F-YM.js.map → 23.js-Bdx9jUxD.js.map} +1 -1
- package/build/server/chunks/nodes/{24.js-Ci_eNef5.js → 24.js-CiL5buX4.js} +2 -2
- package/build/server/chunks/nodes/{24.js-Ci_eNef5.js.map → 24.js-CiL5buX4.js.map} +1 -1
- package/build/server/chunks/nodes/{27.js-B6hIXgA3.js → 27.js-DXGEbzS0.js} +2 -2
- package/build/server/chunks/nodes/{27.js-B6hIXgA3.js.map → 27.js-DXGEbzS0.js.map} +1 -1
- package/build/server/chunks/nodes/{28.js-DrQCyu0k.js → 28.js-CUHARruq.js} +2 -2
- package/build/server/chunks/nodes/{28.js-DrQCyu0k.js.map → 28.js-CUHARruq.js.map} +1 -1
- package/build/server/chunks/nodes/{29.js-BHx34EVq.js → 29.js-fVcWNusW.js} +2 -2
- package/build/server/chunks/nodes/{29.js-BHx34EVq.js.map → 29.js-fVcWNusW.js.map} +1 -1
- package/build/server/chunks/nodes/{3.js-Hp1wzbSo.js → 3.js-aS5tJ2va.js} +2 -2
- package/build/server/chunks/nodes/{3.js-Hp1wzbSo.js.map → 3.js-aS5tJ2va.js.map} +1 -1
- package/build/server/chunks/nodes/{30.js-Bx8s2RoG.js → 30.js-DhbxT527.js} +2 -2
- package/build/server/chunks/nodes/{30.js-Bx8s2RoG.js.map → 30.js-DhbxT527.js.map} +1 -1
- package/build/server/chunks/nodes/{5.js-Dpgmn_GA.js → 5.js-D9d_B-w3.js} +2 -2
- package/build/server/chunks/nodes/{5.js-Dpgmn_GA.js.map → 5.js-D9d_B-w3.js.map} +1 -1
- package/build/server/chunks/nodes/{6.js-CccYExp_.js → 6.js-DefCRSwS.js} +2 -2
- package/build/server/chunks/nodes/{6.js-CccYExp_.js.map → 6.js-DefCRSwS.js.map} +1 -1
- package/build/server/chunks/nodes/{7.js-Xdo3iRGi.js → 7.js-DxzbTr24.js} +2 -2
- package/build/server/chunks/nodes/{7.js-Xdo3iRGi.js.map → 7.js-DxzbTr24.js.map} +1 -1
- package/build/server/chunks/nodes/{8.js-DumYFD1j.js → 8.js-CpQ445IJ.js} +2 -2
- package/build/server/chunks/nodes/{8.js-DumYFD1j.js.map → 8.js-CpQ445IJ.js.map} +1 -1
- package/build/server/chunks/nodes/{9.js-VAZy_0K8.js → 9.js-BDmKqlg6.js} +4 -4
- package/build/server/chunks/nodes/{9.js-VAZy_0K8.js.map → 9.js-BDmKqlg6.js.map} +1 -1
- package/package.json +1 -1
- package/build/client/_app/immutable/chunks/9HY6WY44.js.br +0 -0
- package/build/client/_app/immutable/chunks/9HY6WY44.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C09zQKpt.js.br +0 -0
- package/build/client/_app/immutable/chunks/C09zQKpt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C78kFeb_.js.br +0 -0
- package/build/client/_app/immutable/chunks/C78kFeb_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CkCtbFiD.js.br +0 -0
- package/build/client/_app/immutable/chunks/CkCtbFiD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CpG0Drvc.js.br +0 -0
- package/build/client/_app/immutable/chunks/CpG0Drvc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DratyCsz.js.br +0 -0
- package/build/client/_app/immutable/chunks/DratyCsz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/oxLLzYjR.js.br +0 -0
- package/build/client/_app/immutable/chunks/oxLLzYjR.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.BuRdIZOQ.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BuRdIZOQ.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BWJhki94.js +0 -1
- package/build/client/_app/immutable/entry/start.BWJhki94.js.br +0 -2
- package/build/client/_app/immutable/entry/start.BWJhki94.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DOBPqhlR.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DOBPqhlR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/11.ujEuLS2O.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.ujEuLS2O.js.gz +0 -0
- package/build/client/_app/immutable/nodes/13.B_xDd6Uy.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.B_xDd6Uy.js.gz +0 -0
- package/build/client/_app/immutable/nodes/14.Chsd0OoI.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.Chsd0OoI.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.BblFO--0.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.BblFO--0.js.gz +0 -0
- package/build/client/_app/immutable/nodes/16.Viw6zmPA.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.Viw6zmPA.js.gz +0 -0
- package/build/client/_app/immutable/nodes/17.CDhTNsyV.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.CDhTNsyV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/19.Cbp1paON.js.br +0 -0
- package/build/client/_app/immutable/nodes/19.Cbp1paON.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.C-gHZYwt.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.C-gHZYwt.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.Z_-DinA0.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.Z_-DinA0.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BZHMTYK3.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BZHMTYK3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/23.BQPxRSVN.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.BQPxRSVN.js.gz +0 -0
- package/build/client/_app/immutable/nodes/24.BcXB86Iq.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.BcXB86Iq.js.gz +0 -0
- package/build/client/_app/immutable/nodes/27.CZFwtrmd.js.br +0 -0
- package/build/client/_app/immutable/nodes/27.CZFwtrmd.js.gz +0 -0
- package/build/client/_app/immutable/nodes/28.CcCJ29U1.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.CcCJ29U1.js.gz +0 -0
- package/build/client/_app/immutable/nodes/29.BIRGR5YI.js.br +0 -0
- package/build/client/_app/immutable/nodes/29.BIRGR5YI.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.DYxxVfIY.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.DYxxVfIY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/30.DJKZS6xg.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.DJKZS6xg.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.ydvn0DlC.js.br +0 -1
- package/build/client/_app/immutable/nodes/5.ydvn0DlC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.5b6WuEeg.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.5b6WuEeg.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.BePGtom3.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.BePGtom3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/8.DUhCMLQ8.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.DUhCMLQ8.js.gz +0 -0
- package/build/client/_app/immutable/nodes/9.Io3h0BI-.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.Io3h0BI-.js.gz +0 -0
- package/build/server/chunks/entries/endpoints/api/compute/_server.ts.js-D_9YzrC7.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{_ as gp}from"../chunks/BapAUJpM.js";import"../chunks/DsnmJJEf.js";import{b1 as Fg,bc as Og,bm as zg,P as Bg,O as Ms,Q as Cu,g as u,h as W,s as Fe,u as O,j as Pt,J as wn,p as st,f as Q,a as at,d as se,c as $,i as wt,r as j,aB as kg,t as Me,aj as Mr,n as yt,b as Ps,K as Vg,bn as vp,e as Hg,ax as th,bo as nh}from"../chunks/BtOVeLcI.js";import{o as dn,s as Ae,a as Xt,d as zi,k as Gg,e as Wg}from"../chunks/BNpXeuQ_.js";import{c as we,a as P,p as Tn,f as q,t as Et,d as Xg}from"../chunks/BoLtD6vo.js";import{i as xe}from"../chunks/DAQN5y4A.js";import{d as ma,u as Pu,o as jg,p as Nt,L as qg,l as Yg,a as us,D as mc,i as No,M as Kg,b as gc,f as _l,g as xl,A as Zg,U as $g}from"../chunks/CkCtbFiD.js";import{S as Jg}from"../chunks/BRHPfB44.js";import{M as Qg,l as ev,m as tv,q as _p,r as nv,s as iv,t as rv,v as sv,w as av,x as ov,A as lv,o as cv,f as xp,u as uv,g as dv,y as hv,a as fv,k as pv}from"../chunks/SM988pE-.js";import{f as Ft,r as Ru,e as Zt,a as Qt,c as Dt,d as Uo,k as bp,l as bl,j as Ii,s as mv}from"../chunks/22C0ZkpD.js";import{s as mt,r as ut,p as oe,c as Ne,b as ui}from"../chunks/ChEZL1UP.js";import{p as ih}from"../chunks/9HY6WY44.js";import{a as tl,o as yp}from"../chunks/C4cbQnXC.js";import{w as bo,F as rh}from"../chunks/aGXM-hZQ.js";import{b as Sp}from"../chunks/Bfsx6G_D.js";import{S as na}from"../chunks/CkeXmJE0.js";import{S as Fo}from"../chunks/BdIvVr5K.js";import{S as sh}from"../chunks/CitY1SZ1.js";import{C as Du}from"../chunks/Bj6y_fSA.js";import{I as fn,c as ci}from"../chunks/BuC_QZkR.js";import{X as gv}from"../chunks/Ca8xAcDY.js";import{R as wr,D as Er,b as dr,a as ms,c as gs}from"../chunks/jiMRToiE.js";import{s as pt}from"../chunks/8uBOzWQA.js";import{a as bi,e as Pr,h as Oo,x as vv,c as Lu,b as Vn,d as Qe,m as jt,s as vc,r as Iu,S as _v,y as xv}from"../chunks/Bf2Kb0d4.js";import{C as pr,w as fr,E as bv,S as yv,h as Mp,n as Un,d as wp,e as Ep,a as Tp,A as Ap,H as Cp,c as Pp,j as Rp}from"../chunks/MGblXd4C.js";import{i as Sv,H as Mv,F as Dp,P as Lp,c as Ip,g as zo,d as Np,o as Up,R as wv,S as Ev,a as Tv,b as Av}from"../chunks/DNdxyuBP.js";import{C as ia}from"../chunks/LZnjyP_x.js";import{B as Bn}from"../chunks/mlApEF2J.js";import{P as Cv,F as ah,D as yl,U as oh}from"../chunks/CFq1UfS7.js";import{h as Pv}from"../chunks/ClDgNAKE.js";import{T as Rv,a as Dv,b as Lv,d as Iv,c as Nv}from"../chunks/BVUbFuzT.js";import{C as Fp,a as vs}from"../chunks/BawNisij.js";import{C as Op}from"../chunks/Mn4D08zE.js";import{T as yo}from"../chunks/DllGpGf3.js";import{C as Uv,a as Fv}from"../chunks/CY6l1SkO.js";import{C as Ov}from"../chunks/C2PlvXZq.js";import{C as zv}from"../chunks/C0Xb3vka.js";import{L as or}from"../chunks/wegQDfR0.js";import{a as Bv}from"../chunks/CpG0Drvc.js";import{I as _s}from"../chunks/CJvX1bCR.js";import{M as kv,C as Vv,I as Hv}from"../chunks/C38beKZN.js";import{t as Gv}from"../chunks/ADO9qhNc.js";import{F as Wv}from"../chunks/k1GnUs7f.js";import{r as Xv}from"../chunks/Cbu9Tg11.js";import{C as jv}from"../chunks/3w4Rd2x8.js";import{inflateSync as qv}from"../chunks/BzBbrBKd.js";const Yv=[];function Nu(n,e=!1,t=!1){return So(n,new Map,"",Yv,null,t)}function So(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(Fg(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=So(c,e,t,i,null,s))}return o}if(Og(n)===zg){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=So(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return So(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class Kv{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return Bg(this.#t)}get(){const e=Ms(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=Ms(this.#t);return t===void 0?e:t}set(e){return Cu(this.#t,e)}}function lh(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];fn(n,mt({name:"box"},()=>t,{get iconNode(){return i}}))}function Zv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];fn(n,mt({name:"camera"},()=>t,{get iconNode(){return i}}))}function $v(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];fn(n,mt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function ch(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];fn(n,mt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function zp(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];fn(n,mt({name:"download"},()=>t,{get iconNode(){return i}}))}function Sl(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];fn(n,mt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ml(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];fn(n,mt({name:"eye"},()=>t,{get iconNode(){return i}}))}function Jv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];fn(n,mt({name:"file"},()=>t,{get iconNode(){return i}}))}function Qv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];fn(n,mt({name:"folder"},()=>t,{get iconNode(){return i}}))}function e_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["line",{x1:"22",x2:"2",y1:"6",y2:"6"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22"}]];fn(n,mt({name:"frame"},()=>t,{get iconNode(){return i}}))}function t_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];fn(n,mt({name:"grid-3x3"},()=>t,{get iconNode(){return i}}))}function n_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];fn(n,mt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function i_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];fn(n,mt({name:"layers"},()=>t,{get iconNode(){return i}}))}function r_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];fn(n,mt({name:"link"},()=>t,{get iconNode(){return i}}))}function Uu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];fn(n,mt({name:"loader"},()=>t,{get iconNode(){return i}}))}function Fu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];fn(n,mt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function Ou(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];fn(n,mt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function s_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"}],["path",{d:"m14.5 12.5 2-2"}],["path",{d:"m11.5 9.5 2-2"}],["path",{d:"m8.5 6.5 2-2"}],["path",{d:"m17.5 15.5 2-2"}]];fn(n,mt({name:"ruler"},()=>t,{get iconNode(){return i}}))}function a_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]];fn(n,mt({name:"settings-2"},()=>t,{get iconNode(){return i}}))}function o_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];fn(n,mt({name:"square"},()=>t,{get iconNode(){return i}}))}function l_(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];fn(n,mt({name:"zap"},()=>t,{get iconNode(){return i}}))}function c_(n,e){if(Sv(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function nl(n,e){let t=Fe(null);const i=O(()=>c_(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});W(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);W(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),W(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class zu{#e=Fe(!1);constructor(){Pt(()=>(wn(()=>W(this.#e,!0)),()=>{W(this.#e,!1)}))}get current(){return u(this.#e)}}const u_=Lu({component:"checkbox",parts:["root","group","group-label","input"]}),d_=new pr("Checkbox.Group"),Bp=new pr("Checkbox.Root");class Bu{static create(e,t=null){return Bp.set(new Bu(e,t))}opts;group;#e=O(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){W(this.#e,e)}#t=O(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){W(this.#t,e)}#n=O(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){W(this.#n,e)}#i=O(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){W(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=bi(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),fr.pre([()=>Nu(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),fr.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===bv){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===yv&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=O(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){W(this.#s,e)}#a=O(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":vv(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":Oo(this.trueRequired),"aria-readonly":Oo(this.trueReadonly),"data-disabled":Pr(this.trueDisabled),"data-readonly":Pr(this.trueReadonly),"data-state":h_(this.opts.checked.current,this.opts.indeterminate.current),[u_.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class ku{static create(){return new ku(Bp.get())}root;#e=O(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){W(this.#e,e)}#t=O(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){W(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Mp(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=O(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}function h_(n,e){return e?"indeterminate":n?"checked":"unchecked"}function f_(n,e){st(e,!0);const t=ku.create();var i=we(),r=Q(i);{var s=a=>{Mv(a,mt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}P(n,i),at()}var p_=q("<button><!></button>"),m_=q("<!> <!>",1);function g_(n,e){const t=Tn();st(e,!0);let i=oe(e,"checked",15,!1),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"required",3,!1),o=oe(e,"name",3,void 0),l=oe(e,"value",3,"on"),c=oe(e,"id",19,()=>Vn(t)),d=oe(e,"indeterminate",15,!1),f=oe(e,"type",3,"button"),h=ut(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=d_.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),fr.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const g=Bu.create({checked:Qe(()=>i(),E=>{i(E),e.onCheckedChange?.(E)}),disabled:Qe(()=>s()??!1),required:Qe(()=>a()),name:Qe(()=>o()),value:Qe(()=>l()),id:Qe(()=>c()),ref:Qe(()=>r(),E=>r(E)),indeterminate:Qe(()=>d(),E=>{d(E),e.onIndeterminateChange?.(E)}),type:Qe(()=>f()),readonly:Qe(()=>!!e.readonly)},p),x=O(()=>jt({...h},g.props));var m=m_(),v=Q(m);{var y=E=>{var S=we(),A=Q(S);{let _=O(()=>({props:u(x),...g.snippetProps}));pt(A,()=>e.child,()=>u(_))}P(E,S)},w=E=>{var S=p_();Ft(S,()=>({...u(x)}));var A=$(S);pt(A,()=>e.children??wt,()=>g.snippetProps),j(S),P(E,S)};xe(v,E=>{e.child?E(y):E(w,-1)})}var b=se(v,2);f_(b,{}),P(n,m),at()}function v_(n,e){st(e,!0);let t=oe(e,"open",15,!1),i=oe(e,"onOpenChange",3,Un),r=oe(e,"onOpenChangeComplete",3,Un);Qg.create({open:Qe(()=>t(),s=>{t(s),i()?.(s)}),onOpenChangeComplete:Qe(()=>r())}),Dp(n,{children:(s,a)=>{var o=we(),l=Q(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}),at()}var __=q("<div><!></div>");function Ji(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"disabled",3,!1),a=oe(e,"onSelect",3,Un),o=oe(e,"closeOnSelect",3,!0),l=ut(e,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const c=ev.create({id:Qe(()=>r()),disabled:Qe(()=>s()),onSelect:Qe(()=>a()),ref:Qe(()=>i(),x=>i(x)),closeOnSelect:Qe(()=>o())}),d=O(()=>jt(l,c.props));var f=we(),h=Q(f);{var p=x=>{var m=we(),v=Q(m);pt(v,()=>e.child,()=>({props:u(d)})),P(x,m)},g=x=>{var m=__();Ft(m,()=>({...u(d)}));var v=$(m);pt(v,()=>e.children??wt),j(m),P(x,m)};xe(h,x=>{e.child?x(p):x(g,-1)})}P(n,f),at()}var x_=q("<div><!></div>");function b_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children"]);const a=tv.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props));var l=we(),c=Q(l);{var d=h=>{var p=we(),g=Q(p);pt(g,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=x_();Ft(p,()=>({...u(o)}));var g=$(p);pt(g,()=>e.children??wt),j(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var y_=q("<div><div><!></div></div>"),S_=q("<div><div><!></div></div>");function M_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"loop",3,!0),a=oe(e,"onInteractOutside",3,Un),o=oe(e,"forceMount",3,!1),l=oe(e,"onEscapeKeydown",3,Un),c=oe(e,"interactOutsideBehavior",3,"defer-otherwise-close"),d=oe(e,"escapeKeydownBehavior",3,"defer-otherwise-close"),f=oe(e,"onOpenAutoFocus",3,Un),h=oe(e,"onCloseAutoFocus",3,Un),p=oe(e,"onFocusOutside",3,Un),g=oe(e,"side",3,"right"),x=oe(e,"trapFocus",3,!1),m=ut(e,["$$slots","$$events","$$legacy","id","ref","children","child","loop","onInteractOutside","forceMount","onEscapeKeydown","interactOutsideBehavior","escapeKeydownBehavior","onOpenAutoFocus","onCloseAutoFocus","onFocusOutside","side","trapFocus","style"]);const v=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),U=>r(U)),isSub:!0,onCloseAutoFocus:Qe(()=>S)});function y(U){const N=U.currentTarget.contains(U.target),R=iv[v.parentMenu.root.opts.dir.current].includes(U.key);N&&R&&(v.parentMenu.onClose(),v.parentMenu.triggerNode?.focus(),U.preventDefault())}const w=O(()=>v.parentMenu.root.getBitsAttr("sub-content")),b=O(()=>jt(m,v.props,{side:g(),onkeydown:y,[u(w)]:""}));function E(U){f()(U),!U.defaultPrevented&&(U.preventDefault(),v.parentMenu.root.isUsingKeyboard&&v.parentMenu.contentNode&&nv.dispatch(v.parentMenu.contentNode))}function S(U){h()(U),!U.defaultPrevented&&U.preventDefault()}function A(U){a()(U),!U.defaultPrevented&&v.parentMenu.onClose()}function _(U){l()(U),!U.defaultPrevented&&v.parentMenu.onClose()}function T(U){if(p()(U),U.defaultPrevented||!Mp(U.target)||U.target.id===v.parentMenu.triggerNode?.id)return;if(v.parentMenu.parentMenu?.contentNode?.contains(U.target)){v.parentMenu.onClose(),U.preventDefault();return}const R=`[${v.parentMenu.root.getBitsAttr("sub-content")}]`;if(U.target.closest(R)){U.preventDefault();return}v.parentMenu.onClose()}var D=we(),L=Q(D);{var F=U=>{Lp(U,mt(()=>u(b),{get ref(){return v.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onOpenAutoFocus:E,get enabled(){return v.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return v.shouldRender},popper:(R,z)=>{let Y=()=>(z?.()).props,K=()=>(z?.()).wrapperProps;const ne=O(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),V=Q(ce);{var ee=ve=>{var G=we(),ie=Q(G);{let Z=O(()=>({props:u(ne),wrapperProps:K(),...v.snippetProps}));pt(ie,()=>e.child,()=>u(Z))}P(ve,G)},me=ve=>{var G=y_();Ft(G,()=>({...K()}));var ie=$(G);Ft(ie,()=>({...u(ne)}));var Z=$(ie);pt(Z,()=>e.children??wt),j(ie),j(G),P(ve,G)};xe(V,ve=>{e.child?ve(ee):ve(me,-1)})}P(R,ce)},$$slots:{popper:!0}}))},B=U=>{Ip(U,mt(()=>u(b),{get ref(){return v.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onCloseAutoFocus:S,onOpenAutoFocus:E,get open(){return v.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return v.shouldRender},popper:(R,z)=>{let Y=()=>(z?.()).props,K=()=>(z?.()).wrapperProps;const ne=O(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),V=Q(ce);{var ee=ve=>{var G=we(),ie=Q(G);{let Z=O(()=>({props:u(ne),wrapperProps:K(),...v.snippetProps}));pt(ie,()=>e.child,()=>u(Z))}P(ve,G)},me=ve=>{var G=S_();Ft(G,()=>({...K()}));var ie=$(G);Ft(ie,()=>({...u(ne)}));var Z=$(ie);pt(Z,()=>e.children??wt),j(ie),j(G),P(ve,G)};xe(V,ve=>{e.child?ve(ee):ve(me,-1)})}P(R,ce)},$$slots:{popper:!0}}))};xe(L,U=>{o()?U(F):o()||U(B,1)})}P(n,D),at()}var w_=q("<div><!></div>");function E_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"disabled",3,!1),s=oe(e,"ref",15,null),a=oe(e,"onSelect",3,Un),o=oe(e,"openDelay",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","disabled","ref","children","child","onSelect","openDelay"]);const c=rv.create({disabled:Qe(()=>r()),onSelect:Qe(()=>a()),id:Qe(()=>i()),ref:Qe(()=>s(),f=>s(f)),openDelay:Qe(()=>o())}),d=O(()=>jt(l,c.props));Np(n,{get id(){return i()},get ref(){return c.opts.ref},children:(f,h)=>{var p=we(),g=Q(p);{var x=v=>{var y=we(),w=Q(y);pt(w,()=>e.child,()=>({props:u(d)})),P(v,y)},m=v=>{var y=w_();Ft(y,()=>({...u(d)}));var w=$(y);pt(w,()=>e.children??wt),j(y),P(v,y)};xe(g,v=>{e.child?v(x):v(m,-1)})}P(f,p)},$$slots:{default:!0}}),at()}function T_(n,e){st(e,!0);let t=oe(e,"open",15,!1),i=oe(e,"dir",3,"ltr"),r=oe(e,"onOpenChange",3,Un),s=oe(e,"onOpenChangeComplete",3,Un),a=oe(e,"_internal_variant",3,"dropdown-menu"),o=oe(e,"_internal_should_skip_exit_animation",3,void 0);const l=sv.create({variant:Qe(()=>a()),dir:Qe(()=>i()),onClose:()=>{t(!1),r()(!1)},shouldSkipExitAnimation:()=>o()?.()??!1});av.create({open:Qe(()=>t(),c=>{t(c),r()(c)}),onOpenChangeComplete:Qe(()=>s())},l),Dp(n,{children:(c,d)=>{var f=we(),h=Q(f);pt(h,()=>e.children??wt),P(c,f)},$$slots:{default:!0}}),at()}var A_=q("<div><div><!></div></div>"),C_=q("<div><div><!></div></div>");function P_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"loop",3,!0),a=oe(e,"onInteractOutside",3,Un),o=oe(e,"onEscapeKeydown",3,Un),l=oe(e,"onCloseAutoFocus",3,Un),c=oe(e,"forceMount",3,!1),d=oe(e,"trapFocus",3,!1),f=ut(e,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const h=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),b=>r(b)),onCloseAutoFocus:Qe(()=>l())}),p=O(()=>jt(f,h.props));function g(b){if(h.handleInteractOutside(b),!b.defaultPrevented&&(a()(b),!b.defaultPrevented)){if(b.target&&b.target instanceof Element){const E=`[${h.parentMenu.root.getBitsAttr("sub-content")}]`;if(b.target.closest(E))return}h.parentMenu.onClose()}}function x(b){o()(b),!b.defaultPrevented&&h.parentMenu.onClose()}var m=we(),v=Q(m);{var y=b=>{Lp(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get enabled(){return h.parentMenu.opts.open.current},onInteractOutside:g,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!0,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=O(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=Q(L);{var B=N=>{var R=we(),z=Q(R);{let Y=O(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(z,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=A_();Ft(R,()=>({...T()}));var z=$(R);Ft(z,()=>({...u(D)}));var Y=$(z);pt(Y,()=>e.children??wt),j(z),j(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))},w=b=>{Ip(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get open(){return h.parentMenu.opts.open.current},onInteractOutside:g,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!1,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=O(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=Q(L);{var B=N=>{var R=we(),z=Q(R);{let Y=O(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(z,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=C_();Ft(R,()=>({...T()}));var z=$(R);Ft(z,()=>({...u(D)}));var Y=$(z);pt(Y,()=>e.children??wt),j(z),j(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))};xe(v,b=>{c()?b(y):c()||b(w,1)})}P(n,m),at()}var R_=q("<button><!></button>");function D_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"type",3,"button"),o=ut(e,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const l=ov.create({id:Qe(()=>i()),disabled:Qe(()=>s()??!1),ref:Qe(()=>r(),d=>r(d))}),c=O(()=>jt(o,l.props,{type:a()}));Np(n,{get id(){return i()},get ref(){return l.opts.ref},children:(d,f)=>{var h=we(),p=Q(h);{var g=m=>{var v=we(),y=Q(v);pt(y,()=>e.child,()=>({props:u(c)})),P(m,v)},x=m=>{var v=R_();Ft(v,()=>({...u(c)}));var y=$(v);pt(y,()=>e.children??wt),j(v),P(m,v)};xe(p,m=>{e.child?m(g):m(x,-1)})}P(d,h)},$$slots:{default:!0}}),at()}class Rr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Pt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class L_{opts;present;#e;#t=Fe(!1);#n=!1;#i=Fe(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,W(this.#t,e.open.current,!0),this.#e=new lv({ref:this.opts.ref,afterTick:this.opts.open}),cv(()=>this.#a()),fr(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&W(this.#t,!0),W(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&W(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||W(this.#t,!1),W(this.#i,void 0))})})}#s=O(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){W(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function il(n,e){st(e,!0);const t=new L_({open:Qe(()=>e.open),ref:e.ref});var i=we(),r=Q(i);{var s=a=>{var o=we(),l=Q(o);pt(l,()=>e.presence??wt,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),P(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}P(n,i),at()}function I_(n,e,t){return Math.min(t,Math.max(e,n))}class N_{state;#e;constructor(e,t){this.state=vc(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ga=Lu({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),va=new pr("ScrollArea.Root"),_a=new pr("ScrollArea.Scrollbar"),rl=new pr("ScrollArea.ScrollbarVisible"),Vu=new pr("ScrollArea.ScrollbarAxis"),kp=new pr("ScrollArea.ScrollbarShared");class Hu{static create(e){return va.set(new Hu(e))}opts;attachment;#e=Fe(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){W(this.#e,e,!0)}#t=Fe(null);get viewportNode(){return u(this.#t)}set viewportNode(e){W(this.#t,e,!0)}#n=Fe(null);get contentNode(){return u(this.#n)}set contentNode(e){W(this.#n,e,!0)}#i=Fe(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){W(this.#i,e,!0)}#r=Fe(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){W(this.#r,e,!0)}#s=Fe(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){W(this.#s,e,!0)}#a=Fe(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){W(this.#a,e,!0)}#o=Fe(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){W(this.#o,e,!0)}#l=Fe(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){W(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref,t=>this.scrollAreaNode=t),this.domContext=new xp(e.ref)}#c=O(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ga.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){W(this.#c,e)}}class Gu{static create(e){return new Gu(e,va.get())}opts;root;attachment;#e=vc(uv());#t=vc(null);contentAttachment=bi(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref,i=>this.root.viewportNode=i)}#n=O(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ga.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}#i=O(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){W(this.#i,e)}}class Wu{static create(e){return _a.set(new Wu(e,va.get()))}opts;root;#e=O(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){W(this.#e,e)}#t=Fe(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){W(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,fr(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class Xu{static create(){return new Xu(_a.get())}scrollbar;root;#e=Fe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),wn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{wn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Iu(dn(t,"pointerenter",s),dn(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=O(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class ju{static create(){return new ju(_a.get())}scrollbar;root;machine=new N_("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=O(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){W(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>this.machine.dispatch("SCROLL_END"),100);Pt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Pt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return dn(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=O(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class sl{static create(){return new sl(_a.get())}scrollbar;root;#e=Fe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new Rr(()=>this.root.viewportNode,t),new Rr(()=>this.root.contentNode,t)}#t=O(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class qu{static create(){return rl.set(new qu(_a.get()))}scrollbar;root;#e=Fe(null);get thumbNode(){return u(this.#e)}set thumbNode(e){W(this.#e,e,!0)}#t=Fe(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){W(this.#t,e,!0)}#n=Fe({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){W(this.#n,e)}#i=O(()=>Vp(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){W(this.#i,e)}#r=O(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){W(this.#r,e)}#s=Fe("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){W(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Pt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return U_({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${uh({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${uh({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class Yu{static create(e){return Vu.set(new Yu(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Fe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),Gp(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:Bo(this.computedStyle.paddingLeft),paddingEnd:Bo(this.computedStyle.paddingRight)}})};#t=O(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=O(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Ku{static create(e){return Vu.set(new Ku(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Fe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),Gp(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:Bo(this.computedStyle.paddingTop),paddingEnd:Bo(this.computedStyle.paddingBottom)}})}#t=O(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=O(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Zu{static create(){return kp.set(new Zu(Vu.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Fe(null);get rect(){return u(this.#e)}set rect(e){W(this.#e,e)}#t=Fe("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){W(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=O(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){W(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=nl(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Pt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return dn(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),kg(()=>{this.scrollbarVis.sizes,wn(()=>this.handleThumbPositionChange())}),new Rr(()=>this.scrollbar.opts.ref.current,this.handleResize),new Rr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=O(()=>jt({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ga.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){W(this.#r,e)}}class $u{static create(e){return new $u(e,kp.get())}opts;scrollbarState;attachment;#e;#t=Fe();#n=nl(()=>{u(this.#t)&&(u(this.#t)(),W(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=bi(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Pt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=F_(i,this.scrollbarState.handleThumbPositionChange);W(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return wn(()=>this.scrollbarState.handleThumbPositionChange()),dn(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=O(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ga.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}class Ju{static create(e){return new Ju(e,va.get())}opts;root;attachment;#e=Fe(0);#t=Fe(0);#n=O(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){W(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(this.opts.ref),new Rr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,W(this.#t,i,!0)}),new Rr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,W(this.#e,i,!0)})}#i=O(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ga.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}function Bo(n){return n?Number.parseInt(n,10):0}function Vp(n,e){const t=n/e;return Number.isNaN(t)?0:t}function al(n){const e=Vp(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function U_({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=al(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,f=i==="ltr"?[0,d]:[d*-1,0];return Hp([l,c],f)(n)}function uh({scrollPos:n,sizes:e,dir:t="ltr"}){const i=al(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=I_(n,l[0],l[1]);return Hp([0,a],[0,o])(c)}function Hp(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function Gp(n,e){return n>0&&n<e}function F_(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=dv(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var O_=q("<div><!></div>");function z_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"type",3,"hover"),a=oe(e,"dir",3,"ltr"),o=oe(e,"scrollHideDelay",3,600),l=ut(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=Hu.create({type:Qe(()=>s()),dir:Qe(()=>a()),scrollHideDelay:Qe(()=>o()),id:Qe(()=>r()),ref:Qe(()=>i(),x=>i(x))}),d=O(()=>jt(l,c.props));var f=we(),h=Q(f);{var p=x=>{var m=we(),v=Q(m);pt(v,()=>e.child,()=>({props:u(d)})),P(x,m)},g=x=>{var m=O_();Ft(m,()=>({...u(d)}));var v=$(m);pt(v,()=>e.children??wt),j(m),P(x,m)};xe(h,x=>{e.child?x(p):x(g,-1)})}P(n,f),at()}var B_=q("<div><div><!></div></div>");function k_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Gu.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props)),l=O(()=>jt({},a.contentProps));var c=B_();Ft(c,()=>({...u(o)}));var d=$(c);Ft(d,()=>({...u(l)}));var f=$(d);pt(f,()=>e.children??wt),j(d),j(c),P(n,c),at()}var V_=q("<div><!></div>");function Wp(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy","child","children"]);const i=Zu.create(),r=O(()=>jt(t,i.props));var s=we(),a=Q(s);{var o=c=>{var d=we(),f=Q(d);pt(f,()=>e.child,()=>({props:u(r)})),P(c,d)},l=c=>{var d=V_();Ft(d,()=>({...u(r)}));var f=$(d);pt(f,()=>e.children??wt),j(d),P(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}P(n,s),at()}function H_(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Yu.create({mounted:Qe(()=>i.current)}),s=O(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function G_(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Ku.create({mounted:Qe(()=>i.current)}),s=O(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function ol(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=qu.create();var r=we(),s=Q(r);{var a=l=>{H_(l,mt(()=>t))},o=l=>{G_(l,mt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}P(n,r),at()}function W_(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=sl.create(),s=O(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=O(()=>t()||r.isVisible);il(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}at()}function X_(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=ju.create(),s=O(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=O(()=>t()||!r.isHidden);il(n,mt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}at()}function j_(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Xu.create(),s=sl.create(),a=O(()=>jt(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=O(()=>t()||r.isVisible&&s.isVisible);il(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{ol(c,mt(()=>u(a)))},$$slots:{presence:!0}}),at()}function q_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Wu.create({orientation:Qe(()=>e.orientation),id:Qe(()=>r()),ref:Qe(()=>i(),g=>i(g))}),o=O(()=>a.root.opts.type.current);var l=we(),c=Q(l);{var d=g=>{j_(g,mt(()=>s,{get id(){return r()}}))},f=g=>{X_(g,mt(()=>s,{get id(){return r()}}))},h=g=>{W_(g,mt(()=>s,{get id(){return r()}}))},p=g=>{ol(g,mt(()=>s,{get id(){return r()}}))};xe(c,g=>{u(o)==="hover"?g(d):u(o)==="scroll"?g(f,1):u(o)==="auto"?g(h,2):u(o)==="always"&&g(p,3)})}P(n,l),at()}var Y_=q("<div><!></div>");function K_(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new zu,s=$u.create({id:Qe(()=>e.id),ref:Qe(()=>t(),f=>t(f)),mounted:Qe(()=>r.current)}),a=O(()=>jt(i,s.props,{style:{hidden:!e.present}}));var o=we(),l=Q(o);{var c=f=>{var h=we(),p=Q(h);pt(p,()=>e.child,()=>({props:u(a)})),P(f,h)},d=f=>{var h=Y_();Ft(h,()=>({...u(a)}));var p=$(h);pt(p,()=>e.children??wt),j(h),P(f,h)};xe(l,f=>{e.child?f(c):f(d,-1)})}P(n,o),at()}function Z_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"forceMount",3,!1),a=ut(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=rl.get();{const l=(d,f)=>{let h=()=>(f?.()).present;K_(d,mt(()=>a,{get id(){return i()},get present(){return h()},get ref(){return r()},set ref(p){r(p)}}))};let c=O(()=>s()||o.hasThumb);il(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}at()}var $_=q("<div><!></div>");function J_(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=Ju.create({id:Qe(()=>e.id),ref:Qe(()=>t(),d=>t(d))}),s=O(()=>jt(i,r.props));var a=we(),o=Q(a);{var l=d=>{var f=we(),h=Q(f);pt(h,()=>e.child,()=>({props:u(s)})),P(d,f)},c=d=>{var f=$_();Ft(f,()=>({...u(s)}));var h=$(f);pt(h,()=>e.children??wt),j(f),P(d,f)};xe(o,d=>{e.child?d(l):d(c,-1)})}P(n,a),at()}function Q_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id"]);const a=va.get(),o=O(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=O(()=>a.opts.type.current!=="scroll"&&u(o));var c=we(),d=Q(c);{var f=h=>{J_(h,mt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,h=>{u(l)&&h(f)})}P(n,c),at()}function dh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function Xp(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function jp(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function e0(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function t0(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function Qu(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=e0(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const f=e+d*n,h=t0(f,s);c.push(h)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Tr(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Aa(n,e,t){const i=e.indexOf(n);return i===-1?Tr(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function n0(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const hr=Lu({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ed=new pr("Slider.Root");class qp{opts;attachment;#e=Fe(!1);get isActive(){return u(this.#e)}set isActive(e){W(this.#e,e,!0)}#t=Fe(0);#n=O(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){W(this.#n,e)}#i=O(()=>Qu(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){W(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref),this.domContext=new xp(this.opts.ref),new Rr(()=>this.opts.ref.current,this.#r)}#r=()=>{W(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=O(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return n0([this.opts.min.current,this.opts.max.current],t)(e)};#a=O(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":Pr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[hr.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class i0 extends qp{opts;isMulti=!1;constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Tr(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Tr(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};#e=O(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=Xp(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){W(this.#e,e)}#t=O(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){W(this.#t,e)}#n=O(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=i<=t;return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){W(this.#n,e)}#i=O(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){W(this.#i,e)}#r=O(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){W(this.#r,e)}#s=O(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){W(this.#s,e)}#a=O(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){W(this.#a,e)}}class r0 extends qp{opts;isMulti=!0;#e=Fe(null);get activeThumb(){return u(this.#e)}set activeThumb(e){W(this.#e,e,!0)}#t=Fe(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){W(this.#t,e,!0)}constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Tr(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!hv(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Tr(e,l),this.opts.value.current=s};#i=O(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=wn(()=>this.currentThumbIdx);r<e.length&&wn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=Xp(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){W(this.#i,e)}#r=O(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){W(this.#r,e)}#s=O(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){W(this.#s,e)}#a=O(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){W(this.#a,e)}#o=O(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){W(this.#o,e)}#l=O(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){W(this.#l,e)}#c=O(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){W(this.#c,e)}}class s0{static create(e){const{type:t,...i}=e,r=t==="single"?new i0(i):new r0(i);return ed.set(r)}}const a0=[wp,Ep,Tp,Ap,Cp,Pp];class td{static create(e){return new td(e,ed.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref)}#e=O(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...dh(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...dh(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){W(this.#e,e)}#t=O(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":Pr(this.root.opts.disabled.current),style:this.rangeStyles,[hr.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class nd{static create(e){return new nd(e,ed.get())}opts;root;attachment;#e=O(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!a0.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,f=this.root.normalizedSteps;switch(e.key){case Cp:this.#t(s);break;case Pp:this.#t(a);break;case wp:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"next":"prev");this.#t(p)}break;case Ep:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"prev":"next");this.#t(p)}break;case Tp:if(e.metaKey){const h=d==="tb"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"prev":"next");this.#t(p)}break;case Ap:if(e.metaKey){const h=d==="tb"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=O(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":Pr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}var o0=q("<span><!></span>");function l0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"value",15),a=oe(e,"onValueChange",3,Un),o=oe(e,"onValueCommit",3,Un),l=oe(e,"disabled",3,!1),c=oe(e,"step",3,1),d=oe(e,"dir",3,"ltr"),f=oe(e,"autoSort",3,!0),h=oe(e,"orientation",3,"horizontal"),p=oe(e,"thumbPositioning",3,"contain"),g=ut(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const x=O(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),m=O(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function v(){if(s()===void 0)return e.type==="single"?u(x):[]}v(),fr.pre(()=>s(),()=>{v()});const y=s0.create({id:Qe(()=>i()),ref:Qe(()=>r(),_=>r(_)),value:Qe(()=>s(),_=>{s(_),a()(_)}),onValueCommit:Qe(()=>o()),disabled:Qe(()=>l()),min:Qe(()=>u(x)),max:Qe(()=>u(m)),step:Qe(()=>c()),dir:Qe(()=>d()),autoSort:Qe(()=>f()),orientation:Qe(()=>h()),thumbPositioning:Qe(()=>p()),type:e.type,trackPadding:Qe(()=>e.trackPadding)}),w=O(()=>jt(g,y.props));var b=we(),E=Q(b);{var S=_=>{var T=we(),D=Q(T);{let L=O(()=>({props:u(w),...y.snippetProps}));pt(D,()=>e.child,()=>u(L))}P(_,T)},A=_=>{var T=o0();Ft(T,()=>({...u(w)}));var D=$(T);pt(D,()=>e.children??wt,()=>y.snippetProps),j(T),P(_,T)};xe(E,_=>{e.child?_(S):_(A,-1)})}P(n,b),at()}var c0=q("<span><!></span>");function u0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=td.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props));var l=we(),c=Q(l);{var d=h=>{var p=we(),g=Q(p);pt(g,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=c0();Ft(p,()=>({...u(o)}));var g=$(p);pt(g,()=>e.children??wt),j(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var d0=q("<span><!></span>");function h0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"disabled",3,!1),a=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=nd.create({id:Qe(()=>r()),ref:Qe(()=>i(),p=>i(p)),index:Qe(()=>e.index),disabled:Qe(()=>s())}),l=O(()=>jt(a,o.props));var c=we(),d=Q(c);{var f=p=>{var g=we(),x=Q(g);{let m=O(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));pt(x,()=>e.child,()=>u(m))}P(p,g)},h=p=>{var g=d0();Ft(g,()=>({...u(l)}));var x=$(g);{let m=O(()=>({active:o.root.isThumbActive(o.opts.index.current)}));pt(x,()=>e.children??wt,()=>u(m))}j(g),P(p,g)};xe(d,p=>{e.child?p(f):p(h,-1)})}P(n,c),at()}var Mo=new Map;function Yp(n,e){Mo.set(n,e)}Yp("Rhino.Geometry.Point3d",(n,e)=>{let t=e;return!t||typeof t.X!="number"?null:new n.Point([t.X,t.Y,t.Z])});Yp("Rhino.Geometry.Line",(n,e)=>{let t=e;return!t||!t.From||!t.To?null:new n.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function f0(n){if(Mo.has(n))return Mo.get(n);for(let[e,t]of Mo)if(n.startsWith(e))return t}function p0(n){return!n||typeof n!="object"?null:n.data??n.value??null}function m0(n,e,t){let i=f0(e);if(i)try{return i(t,n)}catch(r){Nt().warn(`Failed to decode Rhino type ${e}:`,r)}try{let r=p0(n);if(r)return t.CommonObject.decode(r)}catch(r){return Nt().warn(`Failed to decode ${e} with CommonObject:`,r),{__decodeError:!0,type:e,raw:n}}return n}var ds={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},g0="Rhino.Geometry.",v0=["WebDisplay"],_0="FileData";function Kp(n){return v0.some(e=>n.includes(e))}function Zp(n){if(typeof n!="string")return n;let e=n.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return n;try{let t=JSON.parse(e);if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}catch{return n}}function x0(n,e,t){switch(e){case ds.STRING:return typeof n!="string"?n:n.replace(/^"(.*)"$/,"$1");case ds.INT:return Number.parseInt(n,10);case ds.DOUBLE:return Number.parseFloat(n);case ds.BOOL:return String(n).toLowerCase()==="true";default:return t&&e.startsWith(g0)?m0(n,e,t):n}}function $p(n,e,t,i){if(typeof n!="string")return n;let r=t?Zp(n):n;return x0(r,e,i)}function b0(n){if(!n||typeof n!="object")return!1;let e=n;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function ko(n,e){for(let t of Object.values(n))if(Array.isArray(t))for(let i of t)e(i)}function y0(n,e=!1,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a={},o=new Set;for(let l of n.values)ko(l.InnerTree,c=>{if(Kp(c.type)||s&&c.type!==ds.STRING)return;let d=e?c.id:l.ParamName;if(!d)return;let f=$p(c.data,c.type,i,r);d in a?o.has(d)?a[d].push(f):(a[d]=[a[d],f],o.add(d)):a[d]=f});return{values:a}}function S0(n){let e=[];for(let t of n.values)ko(t.InnerTree,i=>{if(!i.type.includes(_0))return;let r=Zp(i.data);b0(r)&&e.push(r)});return e}function M0(n,e,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a;if("byName"in e?a=n.values.find(l=>l.ParamName===e.byName):a=n.values.find(l=>{let c=!1;return ko(l.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let o=[];if(ko(a.InnerTree,l=>{if("byId"in e&&l.id!==e.byId||Kp(l.type)||s&&l.type!==ds.STRING)return;let c=$p(l.data,l.type,i,r);o.push(c)}),o.length!==0)return o.length===1?o[0]:o}var w0=class{constructor(n,e=!1){this.response=n,this.debug=e}getValues(n=!1,e={}){return y0(this.response,n,e)}getValue(n,e){return M0(this.response,n,e)}async extractMeshesFromResponse(n){let e={debug:this.debug,...n},t;try{({getThreeMeshesFromComputeResponse:t}=await gp(()=>Promise.resolve().then(()=>UD),void 0,import.meta.url))}catch(i){throw new ma("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",Pu.INVALID_STATE,{context:{originalError:i instanceof Error?i.message:String(i)}})}return t(this.response,e)}getFileData(){return S0(this.response)}async getAndDownloadFiles(n,e){let t=this.getFileData();await jg(t,n,e)}},E0=/^\{(\d+(?:;\d+)*)?\}$/;function T0(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=Object.entries(n);return e.length>0&&e.every(([t,i])=>E0.test(t)&&Array.isArray(i))}function Rs(n,e,t){if(n==null)return n;if(Array.isArray(n)){let r=n.map(e).filter(s=>s!==null);return r.length>0?r:void 0}let i=e(n);return i!==null?i:t?void 0:n}var A0=n=>{if(typeof n=="number")return n;if(typeof n=="string"){let e=n.trim();if(e==="")return null;let t=Number(e);return Number.isNaN(t)?null:t}return null},C0=n=>{if(typeof n=="boolean")return n;if(typeof n=="string"){let e=n.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${n}"`)}return null},P0=n=>typeof n=="string"?n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n.startsWith('"')?n.slice(1):n:null,R0=n=>{if(typeof n=="string"){let e=n.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null};function Jp(n){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(Nt().warn(`Parsed value for input ${n} is not an object`),null)}catch(t){return Nt().warn(`Failed to parse object value "${e}" for input ${n}`,t),null}return null}}function hh(n,e,t){let i=Number(n.toFixed(e));return Math.abs(n-i)<t?i:n}function D0(n,e){if(!Number.isFinite(n)||n===0)return .1;let t=Math.abs(n);if(t>=1){let d=String(n).split(".")[1];if(d&&d.length>0){let f=Math.min(d.length,12),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return 1}let i=String(n),r=i.toLowerCase().match(/e(-?\d+)/);if(r){let d=Number(r[1]);if(d<0||i.toLowerCase().includes("e-")){let f=Math.abs(d),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return .1}let s=12,a=t.toFixed(s).replace(/0+$/,""),o=Math.min((a.split(".")[1]||"").length,s);if(o===0)return .1;let l=Math.pow(10,-o),c=Number(l.toFixed(o));return Math.abs(c-l)<e?c:l}function L0(n,e=1e-8){let t=n.paramType==="Integer";if(T0(n.default))return{default:n.default,stepSize:t?1:.1};let i=Rs(n.default,A0,!0);if(t)return Array.isArray(i)?i=i.map(d=>typeof d=="number"?Math.round(d):d):typeof i=="number"&&(i=Math.round(i)),{default:i,stepSize:1};let r=Array.isArray(i)?i[0]:i,s;typeof r=="number"&&Number.isFinite(r)&&r!==0?s=r:typeof n.minimum=="number"&&Number.isFinite(n.minimum)&&n.minimum!==0?s=n.minimum:typeof n.maximum=="number"&&Number.isFinite(n.maximum)&&n.maximum!==0&&(s=n.maximum);let a=s!==void 0?D0(s,e):.1,o=0,l=String(a),c=l.toLowerCase().match(/e(-?\d+)/);if(c?o=Math.abs(Number(c[1])):o=l.split(".")[1]?.length??0,o===0&&typeof r=="number"&&r!==0&&Math.abs(r)<1){let d=Math.ceil(-Math.log10(Math.abs(r)));Number.isFinite(d)&&d>0&&(o=d)}return o=Math.min(Math.max(o,0),12),Array.isArray(i)?i=i.map(d=>typeof d=="number"?hh(d,o,e):d):typeof i=="number"&&(i=hh(i,o,e)),{default:i,stepSize:a}}var I0={types:["Number","Integer"],parse(n,e){let{default:t,stepSize:i}=L0(n);return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,stepSize:i,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,default:t?[0]:0}}},N0={types:["Boolean"],parse(n,e){let t;try{t=Rs(n.default,C0,!1)}catch(i){throw i instanceof Error?new ma(i.message):i}return{...e,paramType:"Boolean",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Boolean",default:t?[!1]:!1}}},U0={types:["Text"],parse(n,e){let t=Rs(n.default,P0,!1);return{...e,paramType:"Text",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Text",default:t?[""]:""}}},F0={types:["ValueList"],parse(n,e){if(!n.values||typeof n.values!="object"||Object.keys(n.values).length===0)throw ma.missingValues(n.nickname||"unnamed","ValueList");if(n.default!==void 0&&n.default!==null){let t=String(n.default).toLowerCase();Object.keys(n.values).some(i=>i.toLowerCase()===t)||Nt().warn(`ValueList input "${n.nickname||"unnamed"}" default value "${n.default}" is not in available values`)}return{...e,paramType:"ValueList",values:n.values,default:n.default}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"ValueList",values:n.values??{},default:t?[n.default]:n.default}}},O0={types:["Geometry"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"Geometry",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Geometry",default:t?[null]:null}}},z0={types:["File"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"File",acceptedFormats:n.acceptedFormats,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"File",default:t?[null]:null}}},B0={types:["Color"],parse(n,e){let t=Rs(n.default,R0,!1);return{...e,paramType:"Color",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"}}},k0=[I0,N0,U0,F0,O0,z0,B0],V0=new Map(k0.flatMap(n=>n.types.map(e=>[e,n])));new Map([...V0.keys()].map(n=>[n.toLowerCase(),n]));const id="184",xs={ROTATE:0,DOLLY:1,PAN:2},hs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},H0=0,fh=1,G0=2,wo=1,W0=2,fs=3,Kn=0,Yn=1,Qn=2,Mn=0,bs=1,ph=2,mh=3,gh=4,Qp=5,gi=100,X0=101,j0=102,q0=103,Y0=104,Js=200,K0=201,Z0=202,$0=203,_c=204,xc=205,bc=206,J0=207,yc=208,Q0=209,ex=210,tx=211,nx=212,ix=213,rx=214,Sc=0,Mc=1,wc=2,ws=3,Ec=4,Tc=5,Ac=6,Cc=7,em=0,sx=1,ax=2,Fi=0,rd=1,sd=2,ad=3,od=4,ld=5,cd=6,xa=7,tm=300,Dr=301,Es=302,Eo=303,wl=304,ll=306,Lr=1e3,_i=1001,Pc=1002,xn=1003,ox=1004,Ca=1005,hn=1006,El=1007,lr=1008,qn=1009,nm=1010,im=1011,aa=1012,ud=1013,Oi=1014,ti=1015,Fn=1016,dd=1017,hd=1018,Ts=1020,rm=35902,sm=35899,am=1021,om=1022,li=1023,Yi=1026,cr=1027,lm=1028,fd=1029,Ir=1030,pd=1031,md=1033,To=33776,Ao=33777,Co=33778,Po=33779,Rc=35840,Dc=35841,Lc=35842,Ic=35843,Nc=36196,Uc=37492,Fc=37496,Oc=37488,zc=37489,Vo=37490,Bc=37491,kc=37808,Vc=37809,Hc=37810,Gc=37811,Wc=37812,Xc=37813,jc=37814,qc=37815,Yc=37816,Kc=37817,Zc=37818,$c=37819,Jc=37820,Qc=37821,eu=36492,tu=36494,nu=36495,iu=36283,ru=36284,Ho=36285,su=36286,lx=3200,Go=0,cx=1,ar="",Wn="srgb",oa="srgb-linear",Wo="linear",Ut="srgb",kr=7680,vh=519,ux=512,dx=513,hx=514,gd=515,fx=516,px=517,vd=518,mx=519,au=35044,_h="300 es",Ni=2e3,la=2001;function gx(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Xo(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vx(){const n=Xo("canvas");return n.style.display="block",n}const xh={};function jo(...n){const e="THREE."+n.shift();console.log(e,...n)}function cm(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ft(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Tt(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ou(...n){const e=n.join(" ");e in xh||(xh[e]=!0,ft(...n))}function _x(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const xx={[Sc]:Mc,[wc]:Ac,[Ec]:Cc,[ws]:Tc,[Mc]:Sc,[Ac]:wc,[Cc]:Ec,[Tc]:ws};class mr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const In=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let bh=1234567;const ys=Math.PI/180,ca=180/Math.PI;function ji(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function _d(n,e){return(n%e+e)%e}function bx(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function yx(n,e,t){return n!==e?(t-n)/(e-n):0}function ra(n,e,t){return(1-t)*n+t*e}function Sx(n,e,t,i){return ra(n,e,1-Math.exp(-t*i))}function Mx(n,e=1){return e-Math.abs(_d(n,e*2)-e)}function wx(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ex(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Tx(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ax(n,e){return n+Math.random()*(e-n)}function Cx(n){return n*(.5-Math.random())}function Px(n){n!==void 0&&(bh=n);let e=bh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Rx(n){return n*ys}function Dx(n){return n*ca}function Lx(n){return(n&n-1)===0&&n!==0}function Ix(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Nx(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ux(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),d=a((e+i)/2),f=s((e-i)/2),h=a((e-i)/2),p=s((i-e)/2),g=a((i-e)/2);switch(r){case"XYX":n.set(o*d,l*f,l*h,o*c);break;case"YZY":n.set(l*h,o*d,l*f,o*c);break;case"ZXZ":n.set(l*f,l*h,o*d,o*c);break;case"XZX":n.set(o*d,l*g,l*p,o*c);break;case"YXY":n.set(l*p,o*d,l*g,o*c);break;case"ZYZ":n.set(l*g,l*p,o*d,o*c);break;default:ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function vi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ot(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const um={DEG2RAD:ys,RAD2DEG:ca,generateUUID:ji,clamp:gt,euclideanModulo:_d,mapLinear:bx,inverseLerp:yx,lerp:ra,damp:Sx,pingpong:Mx,smoothstep:wx,smootherstep:Ex,randInt:Tx,randFloat:Ax,randFloatSpread:Cx,seededRandom:Px,degToRad:Rx,radToDeg:Dx,isPowerOfTwo:Lx,ceilPowerOfTwo:Ix,floorPowerOfTwo:Nx,setQuaternionFromProperEuler:Ux,normalize:Ot,denormalize:vi},Kd=class Kd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kd.prototype.isVector2=!0;let it=Kd;class xi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3],h=s[a+0],p=s[a+1],g=s[a+2],x=s[a+3];if(f!==x||l!==h||c!==p||d!==g){let m=l*h+c*p+d*g+f*x;m<0&&(h=-h,p=-p,g=-g,x=-x,m=-m);let v=1-o;if(m<.9995){const y=Math.acos(m),w=Math.sin(y);v=Math.sin(v*y)/w,o=Math.sin(o*y)/w,l=l*v+h*o,c=c*v+p*o,d=d*v+g*o,f=f*v+x*o}else{l=l*v+h*o,c=c*v+p*o,d=d*v+g*o,f=f*v+x*o;const y=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=y,c*=y,d*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=s[a],h=s[a+1],p=s[a+2],g=s[a+3];return e[t]=o*g+d*f+l*p-c*h,e[t+1]=l*g+d*h+c*f-o*p,e[t+2]=c*g+d*p+o*h-l*f,e[t+3]=d*g-o*f-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(s/2),h=l(i/2),p=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*d*f+c*p*g,this._y=c*p*f-h*d*g,this._z=c*d*g+h*p*f,this._w=c*d*f-h*p*g;break;case"YXZ":this._x=h*d*f+c*p*g,this._y=c*p*f-h*d*g,this._z=c*d*g-h*p*f,this._w=c*d*f+h*p*g;break;case"ZXY":this._x=h*d*f-c*p*g,this._y=c*p*f+h*d*g,this._z=c*d*g+h*p*f,this._w=c*d*f-h*p*g;break;case"ZYX":this._x=h*d*f-c*p*g,this._y=c*p*f+h*d*g,this._z=c*d*g-h*p*f,this._w=c*d*f+h*p*g;break;case"YZX":this._x=h*d*f+c*p*g,this._y=c*p*f+h*d*g,this._z=c*d*g-h*p*f,this._w=c*d*f-h*p*g;break;case"XZY":this._x=h*d*f-c*p*g,this._y=c*p*f-h*d*g,this._z=c*d*g+h*p*f,this._w=c*d*f+h*p*g;break;default:ft("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],f=t[10],h=i+o+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>f){const p=2*Math.sqrt(1+i-o-f);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>f){const p=2*Math.sqrt(1+o-i-f);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+f-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zd=class Zd{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(yh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(yh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),f=2*(s*i-a*t);return this.x=t+l*c+a*f-o*d,this.y=i+l*d+o*c-s*f,this.z=r+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Tl.copy(this).projectOnVector(e),this.sub(Tl)}reflect(e){return this.sub(Tl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zd.prototype.isVector3=!0;let X=Zd;const Tl=new X,yh=new xi,$d=class $d{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],h=i[2],p=i[5],g=i[8],x=r[0],m=r[3],v=r[6],y=r[1],w=r[4],b=r[7],E=r[2],S=r[5],A=r[8];return s[0]=a*x+o*y+l*E,s[3]=a*m+o*w+l*S,s[6]=a*v+o*b+l*A,s[1]=c*x+d*y+f*E,s[4]=c*m+d*w+f*S,s[7]=c*v+d*b+f*A,s[2]=h*x+p*y+g*E,s[5]=h*m+p*w+g*S,s[8]=h*v+p*b+g*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,h=o*l-d*s,p=c*s-a*l,g=t*f+i*h+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/g;return e[0]=f*x,e[1]=(r*c-d*i)*x,e[2]=(o*i-r*a)*x,e[3]=h*x,e[4]=(d*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Al.makeScale(e,t)),this}rotate(e){return this.premultiply(Al.makeRotation(-e)),this}translate(e,t){return this.premultiply(Al.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$d.prototype.isMatrix3=!0;let xt=$d;const Al=new xt,Sh=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mh=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Fx(){const n={enabled:!0,workingColorSpace:oa,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ut&&(r.r=qi(r.r),r.g=qi(r.g),r.b=qi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ut&&(r.r=Ss(r.r),r.g=Ss(r.g),r.b=Ss(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ar?Wo:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ou("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ou("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[oa]:{primaries:e,whitePoint:i,transfer:Wo,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wn},outputColorSpaceConfig:{drawingBufferColorSpace:Wn}},[Wn]:{primaries:e,whitePoint:i,transfer:Ut,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wn}}}),n}const At=Fx();function qi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ss(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Vr;class Ox{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Vr===void 0&&(Vr=Xo("canvas")),Vr.width=e.width,Vr.height=e.height;const r=Vr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Vr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xo("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=qi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(qi(t[i]/255)*255):t[i]=qi(t[i]);return{data:t,width:e.width,height:e.height}}else return ft("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let zx=0;class xd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zx++}),this.uuid=ji(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Cl(r[a].image)):s.push(Cl(r[a]))}else s=Cl(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Cl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ox.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ft("Texture: Unable to serialize Texture."),{})}let Bx=0;const Pl=new X;class En extends mr{constructor(e=En.DEFAULT_IMAGE,t=En.DEFAULT_MAPPING,i=_i,r=_i,s=hn,a=lr,o=li,l=qn,c=En.DEFAULT_ANISOTROPY,d=ar){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bx++}),this.uuid=ji(),this.name="",this.source=new xd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new it(0,0),this.repeat=new it(1,1),this.center=new it(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Pl).x}get height(){return this.source.getSize(Pl).y}get depth(){return this.source.getSize(Pl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==tm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Lr:e.x=e.x-Math.floor(e.x);break;case _i:e.x=e.x<0?0:1;break;case Pc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Lr:e.y=e.y-Math.floor(e.y);break;case _i:e.y=e.y<0?0:1;break;case Pc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}En.DEFAULT_IMAGE=null;En.DEFAULT_MAPPING=tm;En.DEFAULT_ANISOTROPY=1;const Jd=class Jd{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],f=l[8],h=l[1],p=l[5],g=l[9],x=l[2],m=l[6],v=l[10];if(Math.abs(d-h)<.01&&Math.abs(f-x)<.01&&Math.abs(g-m)<.01){if(Math.abs(d+h)<.1&&Math.abs(f+x)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,b=(p+1)/2,E=(v+1)/2,S=(d+h)/4,A=(f+x)/4,_=(g+m)/4;return w>b&&w>E?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=S/i,s=A/i):b>E?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=S/r,s=_/r):E<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(E),i=A/s,r=_/s),this.set(i,r,s,t),this}let y=Math.sqrt((m-g)*(m-g)+(f-x)*(f-x)+(h-d)*(h-d));return Math.abs(y)<.001&&(y=1),this.x=(m-g)/y,this.y=(f-x)/y,this.z=(h-d)/y,this.w=Math.acos((c+p+v-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jd.prototype.isVector4=!0;let kt=Jd;class kx extends mr{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new kt(0,0,e,t),this.scissorTest=!1,this.viewport=new kt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new En(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:hn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new xd(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ni extends kx{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class dm extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Vx extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const el=class el{constructor(e,t,i,r,s,a,o,l,c,d,f,h,p,g,x,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,f,h,p,g,x,m)}set(e,t,i,r,s,a,o,l,c,d,f,h,p,g,x,m){const v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=s,v[5]=a,v[9]=o,v[13]=l,v[2]=c,v[6]=d,v[10]=f,v[14]=h,v[3]=p,v[7]=g,v[11]=x,v[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new el().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Hr.setFromMatrixColumn(e,0).length(),s=1/Hr.setFromMatrixColumn(e,1).length(),a=1/Hr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*f,g=o*d,x=o*f;t[0]=l*d,t[4]=-l*f,t[8]=c,t[1]=p+g*c,t[5]=h-x*c,t[9]=-o*l,t[2]=x-h*c,t[6]=g+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*f,g=c*d,x=c*f;t[0]=h+x*o,t[4]=g*o-p,t[8]=a*c,t[1]=a*f,t[5]=a*d,t[9]=-o,t[2]=p*o-g,t[6]=x+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*f,g=c*d,x=c*f;t[0]=h-x*o,t[4]=-a*f,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*d,t[9]=x-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*f,g=o*d,x=o*f;t[0]=l*d,t[4]=g*c-p,t[8]=h*c+x,t[1]=l*f,t[5]=x*c+h,t[9]=p*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,g=o*l,x=o*c;t[0]=l*d,t[4]=x-h*f,t[8]=g*f+p,t[1]=f,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*f+g,t[10]=h-x*f}else if(e.order==="XZY"){const h=a*l,p=a*c,g=o*l,x=o*c;t[0]=l*d,t[4]=-f,t[8]=c*d,t[1]=h*f+x,t[5]=a*d,t[9]=p*f-g,t[2]=g*f-p,t[6]=o*d,t[10]=x*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hx,e,Gx)}lookAt(e,t,i){const r=this.elements;return $n.subVectors(e,t),$n.lengthSq()===0&&($n.z=1),$n.normalize(),Qi.crossVectors(i,$n),Qi.lengthSq()===0&&(Math.abs(i.z)===1?$n.x+=1e-4:$n.z+=1e-4,$n.normalize(),Qi.crossVectors(i,$n)),Qi.normalize(),Pa.crossVectors($n,Qi),r[0]=Qi.x,r[4]=Pa.x,r[8]=$n.x,r[1]=Qi.y,r[5]=Pa.y,r[9]=$n.y,r[2]=Qi.z,r[6]=Pa.z,r[10]=$n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],h=i[9],p=i[13],g=i[2],x=i[6],m=i[10],v=i[14],y=i[3],w=i[7],b=i[11],E=i[15],S=r[0],A=r[4],_=r[8],T=r[12],D=r[1],L=r[5],F=r[9],B=r[13],U=r[2],N=r[6],R=r[10],z=r[14],Y=r[3],K=r[7],ne=r[11],ce=r[15];return s[0]=a*S+o*D+l*U+c*Y,s[4]=a*A+o*L+l*N+c*K,s[8]=a*_+o*F+l*R+c*ne,s[12]=a*T+o*B+l*z+c*ce,s[1]=d*S+f*D+h*U+p*Y,s[5]=d*A+f*L+h*N+p*K,s[9]=d*_+f*F+h*R+p*ne,s[13]=d*T+f*B+h*z+p*ce,s[2]=g*S+x*D+m*U+v*Y,s[6]=g*A+x*L+m*N+v*K,s[10]=g*_+x*F+m*R+v*ne,s[14]=g*T+x*B+m*z+v*ce,s[3]=y*S+w*D+b*U+E*Y,s[7]=y*A+w*L+b*N+E*K,s[11]=y*_+w*F+b*R+E*ne,s[15]=y*T+w*B+b*z+E*ce,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],h=e[10],p=e[14],g=e[3],x=e[7],m=e[11],v=e[15],y=l*p-c*h,w=o*p-c*f,b=o*h-l*f,E=a*p-c*d,S=a*h-l*d,A=a*f-o*d;return t*(x*y-m*w+v*b)-i*(g*y-m*E+v*S)+r*(g*w-x*E+v*A)-s*(g*b-x*S+m*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],h=e[10],p=e[11],g=e[12],x=e[13],m=e[14],v=e[15],y=t*o-i*a,w=t*l-r*a,b=t*c-s*a,E=i*l-r*o,S=i*c-s*o,A=r*c-s*l,_=d*x-f*g,T=d*m-h*g,D=d*v-p*g,L=f*m-h*x,F=f*v-p*x,B=h*v-p*m,U=y*B-w*F+b*L+E*D-S*T+A*_;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/U;return e[0]=(o*B-l*F+c*L)*N,e[1]=(r*F-i*B-s*L)*N,e[2]=(x*A-m*S+v*E)*N,e[3]=(h*S-f*A-p*E)*N,e[4]=(l*D-a*B-c*T)*N,e[5]=(t*B-r*D+s*T)*N,e[6]=(m*b-g*A-v*w)*N,e[7]=(d*A-h*b+p*w)*N,e[8]=(a*F-o*D+c*_)*N,e[9]=(i*D-t*F-s*_)*N,e[10]=(g*S-x*b+v*y)*N,e[11]=(f*b-d*S-p*y)*N,e[12]=(o*T-a*L-l*_)*N,e[13]=(t*L-i*T+r*_)*N,e[14]=(x*w-g*E-m*y)*N,e[15]=(d*E-f*w+h*y)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,f=o+o,h=s*c,p=s*d,g=s*f,x=a*d,m=a*f,v=o*f,y=l*c,w=l*d,b=l*f,E=i.x,S=i.y,A=i.z;return r[0]=(1-(x+v))*E,r[1]=(p+b)*E,r[2]=(g-w)*E,r[3]=0,r[4]=(p-b)*S,r[5]=(1-(h+v))*S,r[6]=(m+y)*S,r[7]=0,r[8]=(g+w)*A,r[9]=(m-y)*A,r[10]=(1-(h+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=Hr.set(r[0],r[1],r[2]).length();const o=Hr.set(r[4],r[5],r[6]).length(),l=Hr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),hi.copy(this);const c=1/a,d=1/o,f=1/l;return hi.elements[0]*=c,hi.elements[1]*=c,hi.elements[2]*=c,hi.elements[4]*=d,hi.elements[5]*=d,hi.elements[6]*=d,hi.elements[8]*=f,hi.elements[9]*=f,hi.elements[10]*=f,t.setFromRotationMatrix(hi),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let g,x;if(l)g=s/(a-s),x=a*s/(a-s);else if(o===Ni)g=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===la)g=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2/(t-e),f=2/(i-r),h=-(t+e)/(t-e),p=-(i+r)/(i-r);let g,x;if(l)g=1/(a-s),x=a/(a-s);else if(o===Ni)g=-2/(a-s),x=-(a+s)/(a-s);else if(o===la)g=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=f,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=g,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};el.prototype.isMatrix4=!0;let Lt=el;const Hr=new X,hi=new Lt,Hx=new X(0,0,0),Gx=new X(1,1,1),Qi=new X,Pa=new X,$n=new X,wh=new Lt,Eh=new xi;class Xn{constructor(e=0,t=0,i=0,r=Xn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ft("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return wh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Eh.setFromEuler(this),this.setFromQuaternion(Eh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xn.DEFAULT_ORDER="XYZ";class bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Wx=0;const Th=new X,Gr=new xi,Bi=new Lt,Ra=new X,Fs=new X,Xx=new X,jx=new xi,Ah=new X(1,0,0),Ch=new X(0,1,0),Ph=new X(0,0,1),Rh={type:"added"},qx={type:"removed"},Wr={type:"childadded",child:null},Rl={type:"childremoved",child:null};class rn extends mr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wx++}),this.uuid=ji(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rn.DEFAULT_UP.clone();const e=new X,t=new Xn,i=new xi,r=new X(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Lt},normalMatrix:{value:new xt}}),this.matrix=new Lt,this.matrixWorld=new Lt,this.matrixAutoUpdate=rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.multiply(Gr),this}rotateOnWorldAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.premultiply(Gr),this}rotateX(e){return this.rotateOnAxis(Ah,e)}rotateY(e){return this.rotateOnAxis(Ch,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Th.copy(e).applyQuaternion(this.quaternion),this.position.add(Th.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ah,e)}translateY(e){return this.translateOnAxis(Ch,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ra.copy(e):Ra.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Fs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Fs,Ra,this.up):Bi.lookAt(Ra,Fs,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Gr.setFromRotationMatrix(Bi),this.quaternion.premultiply(Gr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Tt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null):Tt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(qx),Rl.child=e,this.dispatchEvent(Rl),Rl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,e,Xx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,jx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),f=a(e.shapes),h=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}rn.DEFAULT_UP=new X(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Qs=class extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Yx={type:"move"};class Dl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const m=t.getJointPose(x,i),v=this._getHandJoint(c,x);m!==null&&(v.matrix.fromArray(m.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=m.radius),v.visible=m!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=d.position.distanceTo(f.position),p=.02,g=.005;c.inputState.pinching&&h>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Yx)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Qs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},er={h:0,s:0,l:0},Da={h:0,s:0,l:0};function Ll(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class tt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=At.workingColorSpace){return this.r=e,this.g=t,this.b=i,At.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=At.workingColorSpace){if(e=_d(e,1),t=gt(t,0,1),i=gt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ll(a,s,e+1/3),this.g=Ll(a,s,e),this.b=Ll(a,s,e-1/3)}return At.colorSpaceToWorking(this,r),this}setStyle(e,t=Wn){function i(s){s!==void 0&&parseFloat(s)<1&&ft("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ft("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wn){const i=hm[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ft("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.b),this}copyLinearToSRGB(e){return this.r=Ss(e.r),this.g=Ss(e.g),this.b=Ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wn){return At.workingToColorSpace(Nn.copy(this),e),Math.round(gt(Nn.r*255,0,255))*65536+Math.round(gt(Nn.g*255,0,255))*256+Math.round(gt(Nn.b*255,0,255))}getHexString(e=Wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.workingToColorSpace(Nn.copy(this),t);const i=Nn.r,r=Nn.g,s=Nn.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case i:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-i)/f+2;break;case s:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=At.workingColorSpace){return At.workingToColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=Wn){At.workingToColorSpace(Nn.copy(this),e);const t=Nn.r,i=Nn.g,r=Nn.b;return e!==Wn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(er),this.setHSL(er.h+e,er.s+t,er.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(er),e.getHSL(Da);const i=ra(er.h,Da.h,t),r=ra(er.s,Da.s,t),s=ra(er.l,Da.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new tt;tt.NAMES=hm;class Kx extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const fi=new X,ki=new X,Il=new X,Vi=new X,Xr=new X,jr=new X,Dh=new X,Nl=new X,Ul=new X,Fl=new X,Ol=new kt,zl=new kt,Bl=new kt;class ei{constructor(e=new X,t=new X,i=new X){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),fi.subVectors(e,t),r.cross(fi);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){fi.subVectors(r,t),ki.subVectors(i,t),Il.subVectors(e,t);const a=fi.dot(fi),o=fi.dot(ki),l=fi.dot(Il),c=ki.dot(ki),d=ki.dot(Il),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-o*d)*h,g=(a*d-o*l)*h;return s.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Vi)===null?!1:Vi.x>=0&&Vi.y>=0&&Vi.x+Vi.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,Vi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Vi.x),l.addScaledVector(a,Vi.y),l.addScaledVector(o,Vi.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ol.setScalar(0),zl.setScalar(0),Bl.setScalar(0),Ol.fromBufferAttribute(e,t),zl.fromBufferAttribute(e,i),Bl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ol,s.x),a.addScaledVector(zl,s.y),a.addScaledVector(Bl,s.z),a}static isFrontFacing(e,t,i,r){return fi.subVectors(i,t),ki.subVectors(e,t),fi.cross(ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return fi.subVectors(this.c,this.b),ki.subVectors(this.a,this.b),fi.cross(ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Xr.subVectors(r,i),jr.subVectors(s,i),Nl.subVectors(e,i);const l=Xr.dot(Nl),c=jr.dot(Nl);if(l<=0&&c<=0)return t.copy(i);Ul.subVectors(e,r);const d=Xr.dot(Ul),f=jr.dot(Ul);if(d>=0&&f<=d)return t.copy(r);const h=l*f-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(Xr,a);Fl.subVectors(e,s);const p=Xr.dot(Fl),g=jr.dot(Fl);if(g>=0&&p<=g)return t.copy(s);const x=p*c-l*g;if(x<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(jr,o);const m=d*g-p*f;if(m<=0&&f-d>=0&&p-g>=0)return Dh.subVectors(s,r),o=(f-d)/(f-d+(p-g)),t.copy(r).addScaledVector(Dh,o);const v=1/(m+x+h);return a=x*v,o=h*v,t.copy(i).addScaledVector(Xr,a).addScaledVector(jr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class di{constructor(e=new X(1/0,1/0,1/0),t=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(pi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(pi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=pi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,pi):pi.fromBufferAttribute(s,a),pi.applyMatrix4(e.matrixWorld),this.expandByPoint(pi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),La.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),La.copy(i.boundingBox)),La.applyMatrix4(e.matrixWorld),this.union(La)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pi),pi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Os),Ia.subVectors(this.max,Os),qr.subVectors(e.a,Os),Yr.subVectors(e.b,Os),Kr.subVectors(e.c,Os),tr.subVectors(Yr,qr),nr.subVectors(Kr,Yr),vr.subVectors(qr,Kr);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-vr.z,vr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,vr.z,0,-vr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-vr.y,vr.x,0];return!kl(t,qr,Yr,Kr,Ia)||(t=[1,0,0,0,1,0,0,0,1],!kl(t,qr,Yr,Kr,Ia))?!1:(Na.crossVectors(tr,nr),t=[Na.x,Na.y,Na.z],kl(t,qr,Yr,Kr,Ia))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Hi=[new X,new X,new X,new X,new X,new X,new X,new X],pi=new X,La=new di,qr=new X,Yr=new X,Kr=new X,tr=new X,nr=new X,vr=new X,Os=new X,Ia=new X,Na=new X,_r=new X;function kl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_r.fromArray(n,s);const o=r.x*Math.abs(_r.x)+r.y*Math.abs(_r.y)+r.z*Math.abs(_r.z),l=e.dot(_r),c=t.dot(_r),d=i.dot(_r);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Xi=Zx();function Zx(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function $x(n){Math.abs(n)>65504&&ft("DataUtils.toHalfFloat(): Value out of range."),n=gt(n,-65504,65504),Xi.floatView[0]=n;const e=Xi.uint32View[0],t=e>>23&511;return Xi.baseTable[t]+((e&8388607)>>Xi.shiftTable[t])}function Jx(n){const e=n>>10;return Xi.uint32View[0]=Xi.mantissaTable[Xi.offsetTable[e]+(n&1023)]+Xi.exponentTable[e],Xi.floatView[0]}class Ua{static toHalfFloat(e){return $x(e)}static fromHalfFloat(e){return Jx(e)}}const mn=new X,Fa=new it;let Qx=0;class kn extends mr{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Qx++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=au,this.updateRanges=[],this.gpuType=ti,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Fa.fromBufferAttribute(this,t),Fa.applyMatrix3(e),this.setXY(t,Fa.x,Fa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix3(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==au&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class fm extends kn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class pm extends kn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class sn extends kn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const eb=new di,zs=new X,Vl=new X;class Ur{constructor(e=new X,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):eb.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zs.subVectors(e,this.center);const t=zs.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(zs,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Vl)),this.expandByPoint(zs.copy(e.center).sub(Vl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tb=0;const ai=new Lt,Hl=new rn,Zr=new X,Jn=new di,Bs=new di,Sn=new X;class on extends mr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tb++}),this.uuid=ji(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(gx(e)?pm:fm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,i){return ai.makeTranslation(e,t,i),this.applyMatrix4(ai),this}scale(e,t,i){return ai.makeScale(e,t,i),this.applyMatrix4(ai),this}lookAt(e){return Hl.lookAt(e),Hl.updateMatrix(),this.applyMatrix4(Hl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new sn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Jn.setFromBufferAttribute(s),this.morphTargetsRelative?(Sn.addVectors(this.boundingBox.min,Jn.min),this.boundingBox.expandByPoint(Sn),Sn.addVectors(this.boundingBox.max,Jn.max),this.boundingBox.expandByPoint(Sn)):(this.boundingBox.expandByPoint(Jn.min),this.boundingBox.expandByPoint(Jn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new X,1/0);return}if(e){const i=this.boundingSphere.center;if(Jn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Bs.setFromBufferAttribute(o),this.morphTargetsRelative?(Sn.addVectors(Jn.min,Bs.min),Jn.expandByPoint(Sn),Sn.addVectors(Jn.max,Bs.max),Jn.expandByPoint(Sn)):(Jn.expandByPoint(Bs.min),Jn.expandByPoint(Bs.max))}Jn.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Sn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Sn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)Sn.fromBufferAttribute(o,c),l&&(Zr.fromBufferAttribute(e,c),Sn.add(Zr)),r=Math.max(r,i.distanceToSquared(Sn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Tt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Tt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new X,l[_]=new X;const c=new X,d=new X,f=new X,h=new it,p=new it,g=new it,x=new X,m=new X;function v(_,T,D){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,T),f.fromBufferAttribute(i,D),h.fromBufferAttribute(s,_),p.fromBufferAttribute(s,T),g.fromBufferAttribute(s,D),d.sub(c),f.sub(c),p.sub(h),g.sub(h);const L=1/(p.x*g.y-g.x*p.y);isFinite(L)&&(x.copy(d).multiplyScalar(g.y).addScaledVector(f,-p.y).multiplyScalar(L),m.copy(f).multiplyScalar(p.x).addScaledVector(d,-g.x).multiplyScalar(L),o[_].add(x),o[T].add(x),o[D].add(x),l[_].add(m),l[T].add(m),l[D].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)v(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const w=new X,b=new X,E=new X,S=new X;function A(_){E.fromBufferAttribute(r,_),S.copy(E);const T=o[_];w.copy(T),w.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(S,T);const L=b.dot(l[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,L)}for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)A(e.getX(B+0)),A(e.getX(B+1)),A(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new kn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new X,s=new X,a=new X,o=new X,l=new X,c=new X,d=new X,f=new X;if(e)for(let h=0,p=e.count;h<p;h+=3){const g=e.getX(h+0),x=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,m),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,m),o.add(d),l.add(d),c.add(d),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),i.setXYZ(h+0,d.x,d.y,d.z),i.setXYZ(h+1,d.x,d.y,d.z),i.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Sn.fromBufferAttribute(e,t),Sn.normalize(),e.setXYZ(t,Sn.x,Sn.y,Sn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,h=new c.constructor(l.length*d);let p=0,g=0;for(let x=0,m=l.length;x<m;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*d;for(let v=0;v<d;v++)h[g++]=c[p++]}return new kn(h,d,f)}if(this.index===null)return ft("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const h=c[d],p=e(h,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,h=c.length;f<h;f++){const p=c[f];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let h=0,p=f.length;h<p;h++)d.push(f[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=au,this.updateRanges=[],this.version=0,this.uuid=ji()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const On=new X;class Ui{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyMatrix4(e),this.setXYZ(t,On.x,On.y,On.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyNormalMatrix(e),this.setXYZ(t,On.x,On.y,On.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.transformDirection(e),this.setXYZ(t,On.x,On.y,On.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=vi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=vi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=vi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=vi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){jo("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new kn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ui(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){jo("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let nb=0;class yi extends mr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nb++}),this.uuid=ji(),this.name="",this.type="Material",this.blending=bs,this.side=Kn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_c,this.blendDst=xc,this.blendEquation=gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tt(0,0,0),this.blendAlpha=0,this.depthFunc=ws,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=kr,this.stencilZFail=kr,this.stencilZPass=kr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ft(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bs&&(i.blending=this.blending),this.side!==Kn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==_c&&(i.blendSrc=this.blendSrc),this.blendDst!==xc&&(i.blendDst=this.blendDst),this.blendEquation!==gi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ws&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vh&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==kr&&(i.stencilFail=this.stencilFail),this.stencilZFail!==kr&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==kr&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gm extends yi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let $r;const ks=new X,Jr=new X,Qr=new X,es=new it,Vs=new it,vm=new Lt,Oa=new X,Hs=new X,za=new X,Lh=new it,Gl=new it,Ih=new it;class ts extends rn{constructor(e=new gm){if(super(),this.isSprite=!0,this.type="Sprite",$r===void 0){$r=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new mm(t,5);$r.setIndex([0,1,2,0,2,3]),$r.setAttribute("position",new Ui(i,3,0,!1)),$r.setAttribute("uv",new Ui(i,2,3,!1))}this.geometry=$r,this.material=e,this.center=new it(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Tt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jr.setFromMatrixScale(this.matrixWorld),vm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jr.multiplyScalar(-Qr.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;Ba(Oa.set(-.5,-.5,0),Qr,a,Jr,r,s),Ba(Hs.set(.5,-.5,0),Qr,a,Jr,r,s),Ba(za.set(.5,.5,0),Qr,a,Jr,r,s),Lh.set(0,0),Gl.set(1,0),Ih.set(1,1);let o=e.ray.intersectTriangle(Oa,Hs,za,!1,ks);if(o===null&&(Ba(Hs.set(-.5,.5,0),Qr,a,Jr,r,s),Gl.set(0,1),o=e.ray.intersectTriangle(Oa,za,Hs,!1,ks),o===null))return;const l=e.ray.origin.distanceTo(ks);l<e.near||l>e.far||t.push({distance:l,point:ks.clone(),uv:ei.getInterpolation(ks,Oa,Hs,za,Lh,Gl,Ih,new it),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ba(n,e,t,i,r,s){es.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Vs.x=s*es.x-r*es.y,Vs.y=r*es.x+s*es.y):Vs.copy(es),n.copy(e),n.x+=Vs.x,n.y+=Vs.y,n.applyMatrix4(vm)}const Gi=new X,Wl=new X,ka=new X,ir=new X,Xl=new X,Va=new X,jl=new X;class ba{constructor(e=new X,t=new X(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Gi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gi.copy(this.origin).addScaledVector(this.direction,t),Gi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Wl.copy(e).add(t).multiplyScalar(.5),ka.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(Wl);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ka),o=ir.dot(this.direction),l=-ir.dot(ka),c=ir.lengthSq(),d=Math.abs(1-a*a);let f,h,p,g;if(d>0)if(f=a*l-o,h=a*o-l,g=s*d,f>=0)if(h>=-g)if(h<=g){const x=1/d;f*=x,h*=x,p=f*(f+a*h+2*o)+h*(a*f+h+2*l)+c}else h=s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-a*s+o)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(a*s+o)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=a>0?-s:s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Wl).addScaledVector(ka,h),p}intersectSphere(e,t){Gi.subVectors(e.center,this.origin);const i=Gi.dot(this.direction),r=Gi.dot(Gi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gi)!==null}intersectTriangle(e,t,i,r,s){Xl.subVectors(t,e),Va.subVectors(i,e),jl.crossVectors(Xl,Va);let a=this.direction.dot(jl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ir.subVectors(this.origin,e);const l=o*this.direction.dot(Va.crossVectors(ir,Va));if(l<0)return null;const c=o*this.direction.dot(Xl.cross(ir));if(c<0||l+c>a)return null;const d=-o*ir.dot(jl);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yd extends yi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nh=new Lt,xr=new ba,Ha=new Ur,Uh=new X,Ga=new X,Wa=new X,Xa=new X,ql=new X,ja=new X,Fh=new X,qa=new X;class an extends rn{constructor(e=new on,t=new yd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){ja.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(ql.fromBufferAttribute(f,e),a?ja.addScaledVector(ql,d):ja.addScaledVector(ql.sub(t),d))}t.add(ja)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ha.copy(i.boundingSphere),Ha.applyMatrix4(s),xr.copy(e.ray).recast(e.near),!(Ha.containsPoint(xr.origin)===!1&&(xr.intersectSphere(Ha,Uh)===null||xr.origin.distanceToSquared(Uh)>(e.far-e.near)**2))&&(Nh.copy(s).invert(),xr.copy(e.ray).applyMatrix4(Nh),!(i.boundingBox!==null&&xr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,x=h.length;g<x;g++){const m=h[g],v=a[m.materialIndex],y=Math.max(m.start,p.start),w=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=o.getX(b),A=o.getX(b+1),_=o.getX(b+2);r=Ya(this,v,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let m=g,v=x;m<v;m+=3){const y=o.getX(m),w=o.getX(m+1),b=o.getX(m+2);r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,x=h.length;g<x;g++){const m=h[g],v=a[m.materialIndex],y=Math.max(m.start,p.start),w=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=b,A=b+1,_=b+2;r=Ya(this,v,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let m=g,v=x;m<v;m+=3){const y=m,w=m+1,b=m+2;r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function ib(n,e,t,i,r,s,a,o){let l;if(e.side===Yn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Kn,o),l===null)return null;qa.copy(o),qa.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(qa);return c<t.near||c>t.far?null:{distance:c,point:qa.clone(),object:n}}function Ya(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ga),n.getVertexPosition(l,Wa),n.getVertexPosition(c,Xa);const d=ib(n,e,t,i,Ga,Wa,Xa,Fh);if(d){const f=new X;ei.getBarycoord(Fh,Ga,Wa,Xa,f),r&&(d.uv=ei.getInterpolatedAttribute(r,o,l,c,f,new it)),s&&(d.uv1=ei.getInterpolatedAttribute(s,o,l,c,f,new it)),a&&(d.normal=ei.getInterpolatedAttribute(a,o,l,c,f,new X),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new X,materialIndex:0};ei.getNormal(Ga,Wa,Xa,h.normal),d.face=h,d.barycoord=f}return d}class cl extends En{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xn,d=xn,f,h){super(null,a,o,l,c,d,r,s,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Yl=new X,rb=new X,sb=new xt;class sr{constructor(e=new X(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Yl.subVectors(i,t).cross(rb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(Yl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||sb.getNormalMatrix(e),r=this.coplanarPoint(Yl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const br=new Ur,ab=new it(.5,.5),Ka=new X;class Sd{constructor(e=new sr,t=new sr,i=new sr,r=new sr,s=new sr,a=new sr){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ni,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],f=s[5],h=s[6],p=s[7],g=s[8],x=s[9],m=s[10],v=s[11],y=s[12],w=s[13],b=s[14],E=s[15];if(r[0].setComponents(c-a,p-d,v-g,E-y).normalize(),r[1].setComponents(c+a,p+d,v+g,E+y).normalize(),r[2].setComponents(c+o,p+f,v+x,E+w).normalize(),r[3].setComponents(c-o,p-f,v-x,E-w).normalize(),i)r[4].setComponents(l,h,m,b).normalize(),r[5].setComponents(c-l,p-h,v-m,E-b).normalize();else if(r[4].setComponents(c-l,p-h,v-m,E-b).normalize(),t===Ni)r[5].setComponents(c+l,p+h,v+m,E+b).normalize();else if(t===la)r[5].setComponents(l,h,m,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),br.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),br.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(br)}intersectsSprite(e){br.center.set(0,0,0);const t=ab.distanceTo(e.center);return br.radius=.7071067811865476+t,br.applyMatrix4(e.matrixWorld),this.intersectsSphere(br)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ka.x=r.normal.x>0?e.max.x:e.min.x,Ka.y=r.normal.y>0?e.max.y:e.min.y,Ka.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ka)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ob extends yi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qo=new X,Yo=new X,Oh=new Lt,Gs=new ba,Za=new Ur,Kl=new X,zh=new X;class lb extends rn{constructor(e=new on,t=new ob){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)qo.fromBufferAttribute(t,r-1),Yo.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=qo.distanceTo(Yo);e.setAttribute("lineDistance",new sn(i,1))}else ft("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Za.copy(i.boundingSphere),Za.applyMatrix4(r),Za.radius+=s,e.ray.intersectsSphere(Za)===!1)return;Oh.copy(r).invert(),Gs.copy(e.ray).applyMatrix4(Oh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,h=i.attributes.position;if(d!==null){const p=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let x=p,m=g-1;x<m;x+=c){const v=d.getX(x),y=d.getX(x+1),w=$a(this,e,Gs,l,v,y,x);w&&t.push(w)}if(this.isLineLoop){const x=d.getX(g-1),m=d.getX(p),v=$a(this,e,Gs,l,x,m,g-1);v&&t.push(v)}}else{const p=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let x=p,m=g-1;x<m;x+=c){const v=$a(this,e,Gs,l,x,x+1,x);v&&t.push(v)}if(this.isLineLoop){const x=$a(this,e,Gs,l,g-1,p,g-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $a(n,e,t,i,r,s,a){const o=n.geometry.attributes.position;if(qo.fromBufferAttribute(o,r),Yo.fromBufferAttribute(o,s),t.distanceSqToSegment(qo,Yo,Kl,zh)>i)return;Kl.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Kl);if(!(c<e.near||c>e.far))return{distance:c,point:zh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}class Ko extends yi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bh=new Lt,lu=new ba,Ja=new Ur,Qa=new X;class Zo extends rn{constructor(e=new on,t=new Ko){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ja.copy(i.boundingSphere),Ja.applyMatrix4(r),Ja.radius+=s,e.ray.intersectsSphere(Ja)===!1)return;Bh.copy(r).invert(),lu.copy(e.ray).applyMatrix4(Bh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,f=i.attributes.position;if(c!==null){const h=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let g=h,x=p;g<x;g++){const m=c.getX(g);Qa.fromBufferAttribute(f,m),kh(Qa,m,l,r,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(f.count,a.start+a.count);for(let g=h,x=p;g<x;g++)Qa.fromBufferAttribute(f,g),kh(Qa,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kh(n,e,t,i,r,s,a){const o=lu.distanceSqToPoint(n);if(o<t){const l=new X;lu.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class _m extends En{constructor(e=[],t=Dr,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class cb extends En{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nr extends En{constructor(e,t,i=Oi,r,s,a,o=xn,l=xn,c,d=Yi,f=1){if(d!==Yi&&d!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:f};super(h,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ub extends Nr{constructor(e,t=Oi,i=Dr,r,s,a=xn,o=xn,l,c=Yi){const d={width:e,height:e,depth:1},f=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class xm extends En{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ya extends on{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let h=0,p=0;g("z","y","x",-1,-1,i,t,e,a,s,0),g("z","y","x",1,-1,i,t,-e,a,s,1),g("x","z","y",1,1,e,i,t,r,a,2),g("x","z","y",1,-1,e,i,-t,r,a,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sn(c,3)),this.setAttribute("normal",new sn(d,3)),this.setAttribute("uv",new sn(f,2));function g(x,m,v,y,w,b,E,S,A,_,T){const D=b/A,L=E/_,F=b/2,B=E/2,U=S/2,N=A+1,R=_+1;let z=0,Y=0;const K=new X;for(let ne=0;ne<R;ne++){const ce=ne*L-B;for(let V=0;V<N;V++){const ee=V*D-F;K[x]=ee*y,K[m]=ce*w,K[v]=U,c.push(K.x,K.y,K.z),K[x]=0,K[m]=0,K[v]=S>0?1:-1,d.push(K.x,K.y,K.z),f.push(V/A),f.push(1-ne/_),z+=1}}for(let ne=0;ne<_;ne++)for(let ce=0;ce<A;ce++){const V=h+ce+N*ne,ee=h+ce+N*(ne+1),me=h+(ce+1)+N*(ne+1),ve=h+(ce+1)+N*ne;l.push(V,ee,ve),l.push(ee,me,ve),Y+=6}o.addGroup(p,Y,T),p+=Y,h+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Md extends on{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const d=[],f=[],h=[],p=[];let g=0;const x=[],m=i/2;let v=0;y(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new sn(f,3)),this.setAttribute("normal",new sn(h,3)),this.setAttribute("uv",new sn(p,2));function y(){const b=new X,E=new X;let S=0;const A=(t-e)/i;for(let _=0;_<=s;_++){const T=[],D=_/s,L=D*(t-e)+e;for(let F=0;F<=r;F++){const B=F/r,U=B*l+o,N=Math.sin(U),R=Math.cos(U);E.x=L*N,E.y=-D*i+m,E.z=L*R,f.push(E.x,E.y,E.z),b.set(N,A,R).normalize(),h.push(b.x,b.y,b.z),p.push(B,1-D),T.push(g++)}x.push(T)}for(let _=0;_<r;_++)for(let T=0;T<s;T++){const D=x[T][_],L=x[T+1][_],F=x[T+1][_+1],B=x[T][_+1];(e>0||T!==0)&&(d.push(D,L,B),S+=3),(t>0||T!==s-1)&&(d.push(L,F,B),S+=3)}c.addGroup(v,S,0),v+=S}function w(b){const E=g,S=new it,A=new X;let _=0;const T=b===!0?e:t,D=b===!0?1:-1;for(let F=1;F<=r;F++)f.push(0,m*D,0),h.push(0,D,0),p.push(.5,.5),g++;const L=g;for(let F=0;F<=r;F++){const U=F/r*l+o,N=Math.cos(U),R=Math.sin(U);A.x=T*R,A.y=m*D,A.z=T*N,f.push(A.x,A.y,A.z),h.push(0,D,0),S.x=N*.5+.5,S.y=R*.5*D+.5,p.push(S.x,S.y),g++}for(let F=0;F<r;F++){const B=E+F,U=L+F;b===!0?d.push(U,U+1,B):d.push(U+1,U,B),_+=3}c.addGroup(v,_,b===!0?1:2),v+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Md(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const eo=new X,to=new X,Zl=new X,no=new ei;class db extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ys*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),h={},p=[];for(let g=0;g<l;g+=3){a?(c[0]=a.getX(g),c[1]=a.getX(g+1),c[2]=a.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:x,b:m,c:v}=no;if(x.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),v.fromBufferAttribute(o,c[2]),no.getNormal(Zl),f[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,f[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,f[2]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let y=0;y<3;y++){const w=(y+1)%3,b=f[y],E=f[w],S=no[d[y]],A=no[d[w]],_=`${b}_${E}`,T=`${E}_${b}`;T in h&&h[T]?(Zl.dot(h[T].normal)<=s&&(p.push(S.x,S.y,S.z),p.push(A.x,A.y,A.z)),h[T]=null):_ in h||(h[_]={index0:c[y],index1:c[w],normal:Zl.clone()})}}for(const g in h)if(h[g]){const{index0:x,index1:m}=h[g];eo.fromBufferAttribute(o,x),to.fromBufferAttribute(o,m),p.push(eo.x,eo.y,eo.z),p.push(to.x,to.y,to.z)}this.setAttribute("position",new sn(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ds extends on{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,h=t/l,p=[],g=[],x=[],m=[];for(let v=0;v<d;v++){const y=v*h-a;for(let w=0;w<c;w++){const b=w*f-s;g.push(b,-y,0),x.push(0,0,1),m.push(w/o),m.push(1-v/l)}}for(let v=0;v<l;v++)for(let y=0;y<o;y++){const w=y+c*v,b=y+c*(v+1),E=y+1+c*(v+1),S=y+1+c*v;p.push(w,b,S),p.push(b,E,S)}this.setIndex(p),this.setAttribute("position",new sn(g,3)),this.setAttribute("normal",new sn(x,3)),this.setAttribute("uv",new sn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class hb extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new X,s=new X;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],h=f.start,p=f.count;for(let g=h,x=h+p;g<x;g+=3)for(let m=0;m<3;m++){const v=o.getX(g+m),y=o.getX(g+(m+1)%3);r.fromBufferAttribute(a,v),s.fromBufferAttribute(a,y),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new sn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Vh(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}function As(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Hh(r))r.isRenderTargetTexture?(ft("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Hh(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function zn(n){const e={};for(let t=0;t<n.length;t++){const i=As(n[t]);for(const r in i)e[r]=i[r]}return e}function Hh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function fb(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function bm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:At.workingColorSpace}const Di={clone:As,merge:zn};var pb=`void main() {
|
|
1
|
+
import{_ as gp}from"../chunks/BapAUJpM.js";import"../chunks/DsnmJJEf.js";import{b1 as Fg,bc as Og,bm as zg,P as Bg,O as Ms,Q as Cu,g as u,h as W,s as Fe,u as O,j as Pt,J as wn,p as st,f as Q,a as at,d as se,c as $,i as wt,r as j,aB as kg,t as Me,aj as Mr,n as yt,b as Ps,K as Vg,bn as vp,e as Hg,ax as th,bo as nh}from"../chunks/BtOVeLcI.js";import{o as dn,s as Ae,a as Xt,d as zi,k as Gg,e as Wg}from"../chunks/BNpXeuQ_.js";import{c as we,a as P,p as Tn,f as K,t as Et,d as Xg}from"../chunks/BoLtD6vo.js";import{i as xe}from"../chunks/DAQN5y4A.js";import{d as ma,u as Pu,o as jg,p as Nt,L as qg,l as Yg,a as us,D as mc,i as No,M as Kg,b as gc,f as _l,g as xl,A as Zg,U as $g}from"../chunks/DRNVpYJy.js";import{S as Jg}from"../chunks/BRHPfB44.js";import{M as Qg,l as ev,m as tv,q as _p,r as nv,s as iv,t as rv,v as sv,w as av,x as ov,A as lv,o as cv,f as xp,u as uv,g as dv,y as hv,a as fv,k as pv}from"../chunks/SM988pE-.js";import{f as Ft,r as Ru,e as Zt,a as Qt,c as Dt,d as Uo,k as bp,l as bl,j as Ii,s as mv}from"../chunks/22C0ZkpD.js";import{s as mt,r as ut,p as oe,c as Ne,b as ui}from"../chunks/ChEZL1UP.js";import{p as ih}from"../chunks/j93hmZ-0.js";import{a as tl,o as yp}from"../chunks/C4cbQnXC.js";import{w as bo,F as rh}from"../chunks/aGXM-hZQ.js";import{b as Sp}from"../chunks/Bfsx6G_D.js";import{S as na}from"../chunks/CkeXmJE0.js";import{S as Fo}from"../chunks/BdIvVr5K.js";import{S as sh}from"../chunks/CitY1SZ1.js";import{C as Du}from"../chunks/Bj6y_fSA.js";import{I as fn,c as ci}from"../chunks/BuC_QZkR.js";import{X as gv}from"../chunks/Ca8xAcDY.js";import{R as wr,D as Er,b as dr,a as ms,c as gs}from"../chunks/jiMRToiE.js";import{s as pt}from"../chunks/8uBOzWQA.js";import{a as bi,e as Pr,h as Oo,x as vv,c as Lu,b as Vn,d as Qe,m as jt,s as vc,r as Iu,S as _v,y as xv}from"../chunks/Bf2Kb0d4.js";import{C as pr,w as fr,E as bv,S as yv,h as Mp,n as Un,d as wp,e as Ep,a as Tp,A as Ap,H as Cp,c as Pp,j as Rp}from"../chunks/MGblXd4C.js";import{i as Sv,H as Mv,F as Dp,P as Lp,c as Ip,g as zo,d as Np,o as Up,R as wv,S as Ev,a as Tv,b as Av}from"../chunks/DNdxyuBP.js";import{C as ia}from"../chunks/LZnjyP_x.js";import{B as Bn}from"../chunks/mlApEF2J.js";import{P as Cv,F as ah,D as yl,U as oh}from"../chunks/CFq1UfS7.js";import{h as Pv}from"../chunks/ClDgNAKE.js";import{T as Rv,a as Dv,b as Lv,d as Iv,c as Nv}from"../chunks/BVUbFuzT.js";import{C as Fp,a as vs}from"../chunks/BawNisij.js";import{C as Op}from"../chunks/Mn4D08zE.js";import{T as yo}from"../chunks/DllGpGf3.js";import{C as Uv,a as Fv}from"../chunks/CY6l1SkO.js";import{C as Ov}from"../chunks/C2PlvXZq.js";import{C as zv}from"../chunks/C0Xb3vka.js";import{L as or}from"../chunks/wegQDfR0.js";import{a as Bv}from"../chunks/0lrM6Mba.js";import{I as _s}from"../chunks/CJvX1bCR.js";import{M as kv,C as Vv,I as Hv}from"../chunks/C38beKZN.js";import{t as Gv}from"../chunks/ADO9qhNc.js";import{F as Wv}from"../chunks/k1GnUs7f.js";import{r as Xv}from"../chunks/Cbu9Tg11.js";import{C as jv}from"../chunks/3w4Rd2x8.js";import{inflateSync as qv}from"../chunks/BzBbrBKd.js";const Yv=[];function Nu(n,e=!1,t=!1){return So(n,new Map,"",Yv,null,t)}function So(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(Fg(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=So(c,e,t,i,null,s))}return o}if(Og(n)===zg){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=So(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return So(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class Kv{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return Bg(this.#t)}get(){const e=Ms(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=Ms(this.#t);return t===void 0?e:t}set(e){return Cu(this.#t,e)}}function lh(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];fn(n,mt({name:"box"},()=>t,{get iconNode(){return i}}))}function Zv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];fn(n,mt({name:"camera"},()=>t,{get iconNode(){return i}}))}function $v(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];fn(n,mt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function ch(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];fn(n,mt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function zp(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];fn(n,mt({name:"download"},()=>t,{get iconNode(){return i}}))}function Sl(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];fn(n,mt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ml(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];fn(n,mt({name:"eye"},()=>t,{get iconNode(){return i}}))}function Jv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];fn(n,mt({name:"file"},()=>t,{get iconNode(){return i}}))}function Qv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];fn(n,mt({name:"folder"},()=>t,{get iconNode(){return i}}))}function e0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["line",{x1:"22",x2:"2",y1:"6",y2:"6"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22"}]];fn(n,mt({name:"frame"},()=>t,{get iconNode(){return i}}))}function t0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];fn(n,mt({name:"grid-3x3"},()=>t,{get iconNode(){return i}}))}function n0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];fn(n,mt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function i0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];fn(n,mt({name:"layers"},()=>t,{get iconNode(){return i}}))}function r0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];fn(n,mt({name:"link"},()=>t,{get iconNode(){return i}}))}function Uu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];fn(n,mt({name:"loader"},()=>t,{get iconNode(){return i}}))}function Fu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];fn(n,mt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function Ou(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];fn(n,mt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function s0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"}],["path",{d:"m14.5 12.5 2-2"}],["path",{d:"m11.5 9.5 2-2"}],["path",{d:"m8.5 6.5 2-2"}],["path",{d:"m17.5 15.5 2-2"}]];fn(n,mt({name:"ruler"},()=>t,{get iconNode(){return i}}))}function a0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]];fn(n,mt({name:"settings-2"},()=>t,{get iconNode(){return i}}))}function o0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];fn(n,mt({name:"square"},()=>t,{get iconNode(){return i}}))}function l0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];fn(n,mt({name:"zap"},()=>t,{get iconNode(){return i}}))}function c0(n,e){if(Sv(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function nl(n,e){let t=Fe(null);const i=O(()=>c0(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});W(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);W(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),W(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class zu{#e=Fe(!1);constructor(){Pt(()=>(wn(()=>W(this.#e,!0)),()=>{W(this.#e,!1)}))}get current(){return u(this.#e)}}const u0=Lu({component:"checkbox",parts:["root","group","group-label","input"]}),d0=new pr("Checkbox.Group"),Bp=new pr("Checkbox.Root");class Bu{static create(e,t=null){return Bp.set(new Bu(e,t))}opts;group;#e=O(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){W(this.#e,e)}#t=O(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){W(this.#t,e)}#n=O(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){W(this.#n,e)}#i=O(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){W(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=bi(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),fr.pre([()=>Nu(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),fr.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===bv){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===yv&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=O(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){W(this.#s,e)}#a=O(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":vv(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":Oo(this.trueRequired),"aria-readonly":Oo(this.trueReadonly),"data-disabled":Pr(this.trueDisabled),"data-readonly":Pr(this.trueReadonly),"data-state":h0(this.opts.checked.current,this.opts.indeterminate.current),[u0.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class ku{static create(){return new ku(Bp.get())}root;#e=O(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){W(this.#e,e)}#t=O(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){W(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Mp(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=O(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}function h0(n,e){return e?"indeterminate":n?"checked":"unchecked"}function f0(n,e){st(e,!0);const t=ku.create();var i=we(),r=Q(i);{var s=a=>{Mv(a,mt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}P(n,i),at()}var p0=K("<button><!></button>"),m0=K("<!> <!>",1);function g0(n,e){const t=Tn();st(e,!0);let i=oe(e,"checked",15,!1),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"required",3,!1),o=oe(e,"name",3,void 0),l=oe(e,"value",3,"on"),c=oe(e,"id",19,()=>Vn(t)),d=oe(e,"indeterminate",15,!1),f=oe(e,"type",3,"button"),h=ut(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=d0.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),fr.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const m=Bu.create({checked:Qe(()=>i(),E=>{i(E),e.onCheckedChange?.(E)}),disabled:Qe(()=>s()??!1),required:Qe(()=>a()),name:Qe(()=>o()),value:Qe(()=>l()),id:Qe(()=>c()),ref:Qe(()=>r(),E=>r(E)),indeterminate:Qe(()=>d(),E=>{d(E),e.onIndeterminateChange?.(E)}),type:Qe(()=>f()),readonly:Qe(()=>!!e.readonly)},p),x=O(()=>jt({...h},m.props));var g=m0(),v=Q(g);{var y=E=>{var S=we(),A=Q(S);{let _=O(()=>({props:u(x),...m.snippetProps}));pt(A,()=>e.child,()=>u(_))}P(E,S)},w=E=>{var S=p0();Ft(S,()=>({...u(x)}));var A=$(S);pt(A,()=>e.children??wt,()=>m.snippetProps),j(S),P(E,S)};xe(v,E=>{e.child?E(y):E(w,-1)})}var b=se(v,2);f0(b,{}),P(n,g),at()}function v0(n,e){st(e,!0);let t=oe(e,"open",15,!1),i=oe(e,"onOpenChange",3,Un),r=oe(e,"onOpenChangeComplete",3,Un);Qg.create({open:Qe(()=>t(),s=>{t(s),i()?.(s)}),onOpenChangeComplete:Qe(()=>r())}),Dp(n,{children:(s,a)=>{var o=we(),l=Q(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}),at()}var _0=K("<div><!></div>");function Ji(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"disabled",3,!1),a=oe(e,"onSelect",3,Un),o=oe(e,"closeOnSelect",3,!0),l=ut(e,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const c=ev.create({id:Qe(()=>r()),disabled:Qe(()=>s()),onSelect:Qe(()=>a()),ref:Qe(()=>i(),x=>i(x)),closeOnSelect:Qe(()=>o())}),d=O(()=>jt(l,c.props));var f=we(),h=Q(f);{var p=x=>{var g=we(),v=Q(g);pt(v,()=>e.child,()=>({props:u(d)})),P(x,g)},m=x=>{var g=_0();Ft(g,()=>({...u(d)}));var v=$(g);pt(v,()=>e.children??wt),j(g),P(x,g)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var x0=K("<div><!></div>");function b0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children"]);const a=tv.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props));var l=we(),c=Q(l);{var d=h=>{var p=we(),m=Q(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=x0();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),j(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var y0=K("<div><div><!></div></div>"),S0=K("<div><div><!></div></div>");function M0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"loop",3,!0),a=oe(e,"onInteractOutside",3,Un),o=oe(e,"forceMount",3,!1),l=oe(e,"onEscapeKeydown",3,Un),c=oe(e,"interactOutsideBehavior",3,"defer-otherwise-close"),d=oe(e,"escapeKeydownBehavior",3,"defer-otherwise-close"),f=oe(e,"onOpenAutoFocus",3,Un),h=oe(e,"onCloseAutoFocus",3,Un),p=oe(e,"onFocusOutside",3,Un),m=oe(e,"side",3,"right"),x=oe(e,"trapFocus",3,!1),g=ut(e,["$$slots","$$events","$$legacy","id","ref","children","child","loop","onInteractOutside","forceMount","onEscapeKeydown","interactOutsideBehavior","escapeKeydownBehavior","onOpenAutoFocus","onCloseAutoFocus","onFocusOutside","side","trapFocus","style"]);const v=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),U=>r(U)),isSub:!0,onCloseAutoFocus:Qe(()=>S)});function y(U){const N=U.currentTarget.contains(U.target),R=iv[v.parentMenu.root.opts.dir.current].includes(U.key);N&&R&&(v.parentMenu.onClose(),v.parentMenu.triggerNode?.focus(),U.preventDefault())}const w=O(()=>v.parentMenu.root.getBitsAttr("sub-content")),b=O(()=>jt(g,v.props,{side:m(),onkeydown:y,[u(w)]:""}));function E(U){f()(U),!U.defaultPrevented&&(U.preventDefault(),v.parentMenu.root.isUsingKeyboard&&v.parentMenu.contentNode&&nv.dispatch(v.parentMenu.contentNode))}function S(U){h()(U),!U.defaultPrevented&&U.preventDefault()}function A(U){a()(U),!U.defaultPrevented&&v.parentMenu.onClose()}function _(U){l()(U),!U.defaultPrevented&&v.parentMenu.onClose()}function T(U){if(p()(U),U.defaultPrevented||!Mp(U.target)||U.target.id===v.parentMenu.triggerNode?.id)return;if(v.parentMenu.parentMenu?.contentNode?.contains(U.target)){v.parentMenu.onClose(),U.preventDefault();return}const R=`[${v.parentMenu.root.getBitsAttr("sub-content")}]`;if(U.target.closest(R)){U.preventDefault();return}v.parentMenu.onClose()}var D=we(),L=Q(D);{var F=U=>{Lp(U,mt(()=>u(b),{get ref(){return v.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onOpenAutoFocus:E,get enabled(){return v.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return v.shouldRender},popper:(R,z)=>{let q=()=>(z?.()).props,Y=()=>(z?.()).wrapperProps;const te=O(()=>jt(q(),u(b),{style:zo("menu")},{style:e.style}));var le=we(),B=Q(le);{var ee=ve=>{var G=we(),ie=Q(G);{let Z=O(()=>({props:u(te),wrapperProps:Y(),...v.snippetProps}));pt(ie,()=>e.child,()=>u(Z))}P(ve,G)},de=ve=>{var G=y0();Ft(G,()=>({...Y()}));var ie=$(G);Ft(ie,()=>({...u(te)}));var Z=$(ie);pt(Z,()=>e.children??wt),j(ie),j(G),P(ve,G)};xe(B,ve=>{e.child?ve(ee):ve(de,-1)})}P(R,le)},$$slots:{popper:!0}}))},k=U=>{Ip(U,mt(()=>u(b),{get ref(){return v.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onCloseAutoFocus:S,onOpenAutoFocus:E,get open(){return v.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return v.shouldRender},popper:(R,z)=>{let q=()=>(z?.()).props,Y=()=>(z?.()).wrapperProps;const te=O(()=>jt(q(),u(b),{style:zo("menu")},{style:e.style}));var le=we(),B=Q(le);{var ee=ve=>{var G=we(),ie=Q(G);{let Z=O(()=>({props:u(te),wrapperProps:Y(),...v.snippetProps}));pt(ie,()=>e.child,()=>u(Z))}P(ve,G)},de=ve=>{var G=S0();Ft(G,()=>({...Y()}));var ie=$(G);Ft(ie,()=>({...u(te)}));var Z=$(ie);pt(Z,()=>e.children??wt),j(ie),j(G),P(ve,G)};xe(B,ve=>{e.child?ve(ee):ve(de,-1)})}P(R,le)},$$slots:{popper:!0}}))};xe(L,U=>{o()?U(F):o()||U(k,1)})}P(n,D),at()}var w0=K("<div><!></div>");function E0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"disabled",3,!1),s=oe(e,"ref",15,null),a=oe(e,"onSelect",3,Un),o=oe(e,"openDelay",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","disabled","ref","children","child","onSelect","openDelay"]);const c=rv.create({disabled:Qe(()=>r()),onSelect:Qe(()=>a()),id:Qe(()=>i()),ref:Qe(()=>s(),f=>s(f)),openDelay:Qe(()=>o())}),d=O(()=>jt(l,c.props));Np(n,{get id(){return i()},get ref(){return c.opts.ref},children:(f,h)=>{var p=we(),m=Q(p);{var x=v=>{var y=we(),w=Q(y);pt(w,()=>e.child,()=>({props:u(d)})),P(v,y)},g=v=>{var y=w0();Ft(y,()=>({...u(d)}));var w=$(y);pt(w,()=>e.children??wt),j(y),P(v,y)};xe(m,v=>{e.child?v(x):v(g,-1)})}P(f,p)},$$slots:{default:!0}}),at()}function T0(n,e){st(e,!0);let t=oe(e,"open",15,!1),i=oe(e,"dir",3,"ltr"),r=oe(e,"onOpenChange",3,Un),s=oe(e,"onOpenChangeComplete",3,Un),a=oe(e,"_internal_variant",3,"dropdown-menu"),o=oe(e,"_internal_should_skip_exit_animation",3,void 0);const l=sv.create({variant:Qe(()=>a()),dir:Qe(()=>i()),onClose:()=>{t(!1),r()(!1)},shouldSkipExitAnimation:()=>o()?.()??!1});av.create({open:Qe(()=>t(),c=>{t(c),r()(c)}),onOpenChangeComplete:Qe(()=>s())},l),Dp(n,{children:(c,d)=>{var f=we(),h=Q(f);pt(h,()=>e.children??wt),P(c,f)},$$slots:{default:!0}}),at()}var A0=K("<div><div><!></div></div>"),C0=K("<div><div><!></div></div>");function P0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"loop",3,!0),a=oe(e,"onInteractOutside",3,Un),o=oe(e,"onEscapeKeydown",3,Un),l=oe(e,"onCloseAutoFocus",3,Un),c=oe(e,"forceMount",3,!1),d=oe(e,"trapFocus",3,!1),f=ut(e,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const h=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),b=>r(b)),onCloseAutoFocus:Qe(()=>l())}),p=O(()=>jt(f,h.props));function m(b){if(h.handleInteractOutside(b),!b.defaultPrevented&&(a()(b),!b.defaultPrevented)){if(b.target&&b.target instanceof Element){const E=`[${h.parentMenu.root.getBitsAttr("sub-content")}]`;if(b.target.closest(E))return}h.parentMenu.onClose()}}function x(b){o()(b),!b.defaultPrevented&&h.parentMenu.onClose()}var g=we(),v=Q(g);{var y=b=>{Lp(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get enabled(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!0,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=O(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=Q(L);{var k=N=>{var R=we(),z=Q(R);{let q=O(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(z,()=>e.child,()=>u(q))}P(N,R)},U=N=>{var R=A0();Ft(R,()=>({...T()}));var z=$(R);Ft(z,()=>({...u(D)}));var q=$(z);pt(q,()=>e.children??wt),j(z),j(R),P(N,R)};xe(F,N=>{e.child?N(k):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))},w=b=>{Ip(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get open(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!1,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=O(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=Q(L);{var k=N=>{var R=we(),z=Q(R);{let q=O(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(z,()=>e.child,()=>u(q))}P(N,R)},U=N=>{var R=C0();Ft(R,()=>({...T()}));var z=$(R);Ft(z,()=>({...u(D)}));var q=$(z);pt(q,()=>e.children??wt),j(z),j(R),P(N,R)};xe(F,N=>{e.child?N(k):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))};xe(v,b=>{c()?b(y):c()||b(w,1)})}P(n,g),at()}var R0=K("<button><!></button>");function D0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"type",3,"button"),o=ut(e,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const l=ov.create({id:Qe(()=>i()),disabled:Qe(()=>s()??!1),ref:Qe(()=>r(),d=>r(d))}),c=O(()=>jt(o,l.props,{type:a()}));Np(n,{get id(){return i()},get ref(){return l.opts.ref},children:(d,f)=>{var h=we(),p=Q(h);{var m=g=>{var v=we(),y=Q(v);pt(y,()=>e.child,()=>({props:u(c)})),P(g,v)},x=g=>{var v=R0();Ft(v,()=>({...u(c)}));var y=$(v);pt(y,()=>e.children??wt),j(v),P(g,v)};xe(p,g=>{e.child?g(m):g(x,-1)})}P(d,h)},$$slots:{default:!0}}),at()}class Rr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Pt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class L0{opts;present;#e;#t=Fe(!1);#n=!1;#i=Fe(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,W(this.#t,e.open.current,!0),this.#e=new lv({ref:this.opts.ref,afterTick:this.opts.open}),cv(()=>this.#a()),fr(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&W(this.#t,!0),W(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&W(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||W(this.#t,!1),W(this.#i,void 0))})})}#s=O(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){W(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function il(n,e){st(e,!0);const t=new L0({open:Qe(()=>e.open),ref:e.ref});var i=we(),r=Q(i);{var s=a=>{var o=we(),l=Q(o);pt(l,()=>e.presence??wt,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),P(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}P(n,i),at()}function I0(n,e,t){return Math.min(t,Math.max(e,n))}class N0{state;#e;constructor(e,t){this.state=vc(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ga=Lu({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),va=new pr("ScrollArea.Root"),_a=new pr("ScrollArea.Scrollbar"),rl=new pr("ScrollArea.ScrollbarVisible"),Vu=new pr("ScrollArea.ScrollbarAxis"),kp=new pr("ScrollArea.ScrollbarShared");class Hu{static create(e){return va.set(new Hu(e))}opts;attachment;#e=Fe(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){W(this.#e,e,!0)}#t=Fe(null);get viewportNode(){return u(this.#t)}set viewportNode(e){W(this.#t,e,!0)}#n=Fe(null);get contentNode(){return u(this.#n)}set contentNode(e){W(this.#n,e,!0)}#i=Fe(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){W(this.#i,e,!0)}#r=Fe(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){W(this.#r,e,!0)}#s=Fe(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){W(this.#s,e,!0)}#a=Fe(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){W(this.#a,e,!0)}#o=Fe(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){W(this.#o,e,!0)}#l=Fe(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){W(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref,t=>this.scrollAreaNode=t),this.domContext=new xp(e.ref)}#c=O(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ga.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){W(this.#c,e)}}class Gu{static create(e){return new Gu(e,va.get())}opts;root;attachment;#e=vc(uv());#t=vc(null);contentAttachment=bi(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref,i=>this.root.viewportNode=i)}#n=O(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ga.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}#i=O(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){W(this.#i,e)}}class Wu{static create(e){return _a.set(new Wu(e,va.get()))}opts;root;#e=O(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){W(this.#e,e)}#t=Fe(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){W(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,fr(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class Xu{static create(){return new Xu(_a.get())}scrollbar;root;#e=Fe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),wn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{wn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Iu(dn(t,"pointerenter",s),dn(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=O(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class ju{static create(){return new ju(_a.get())}scrollbar;root;machine=new N0("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=O(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){W(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>this.machine.dispatch("SCROLL_END"),100);Pt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Pt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return dn(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=O(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class sl{static create(){return new sl(_a.get())}scrollbar;root;#e=Fe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new Rr(()=>this.root.viewportNode,t),new Rr(()=>this.root.contentNode,t)}#t=O(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class qu{static create(){return rl.set(new qu(_a.get()))}scrollbar;root;#e=Fe(null);get thumbNode(){return u(this.#e)}set thumbNode(e){W(this.#e,e,!0)}#t=Fe(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){W(this.#t,e,!0)}#n=Fe({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){W(this.#n,e)}#i=O(()=>Vp(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){W(this.#i,e)}#r=O(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){W(this.#r,e)}#s=Fe("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){W(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Pt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return U0({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${uh({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${uh({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class Yu{static create(e){return Vu.set(new Yu(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Fe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),Gp(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:Bo(this.computedStyle.paddingLeft),paddingEnd:Bo(this.computedStyle.paddingRight)}})};#t=O(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=O(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Ku{static create(e){return Vu.set(new Ku(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Fe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),Gp(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:Bo(this.computedStyle.paddingTop),paddingEnd:Bo(this.computedStyle.paddingBottom)}})}#t=O(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=O(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Zu{static create(){return kp.set(new Zu(Vu.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Fe(null);get rect(){return u(this.#e)}set rect(e){W(this.#e,e)}#t=Fe("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){W(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=O(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){W(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=nl(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Pt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return dn(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),kg(()=>{this.scrollbarVis.sizes,wn(()=>this.handleThumbPositionChange())}),new Rr(()=>this.scrollbar.opts.ref.current,this.handleResize),new Rr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=O(()=>jt({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ga.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){W(this.#r,e)}}class $u{static create(e){return new $u(e,kp.get())}opts;scrollbarState;attachment;#e;#t=Fe();#n=nl(()=>{u(this.#t)&&(u(this.#t)(),W(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=bi(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Pt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=F0(i,this.scrollbarState.handleThumbPositionChange);W(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return wn(()=>this.scrollbarState.handleThumbPositionChange()),dn(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=O(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ga.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}class Ju{static create(e){return new Ju(e,va.get())}opts;root;attachment;#e=Fe(0);#t=Fe(0);#n=O(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){W(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(this.opts.ref),new Rr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,W(this.#t,i,!0)}),new Rr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,W(this.#e,i,!0)})}#i=O(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ga.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}function Bo(n){return n?Number.parseInt(n,10):0}function Vp(n,e){const t=n/e;return Number.isNaN(t)?0:t}function al(n){const e=Vp(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function U0({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=al(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,f=i==="ltr"?[0,d]:[d*-1,0];return Hp([l,c],f)(n)}function uh({scrollPos:n,sizes:e,dir:t="ltr"}){const i=al(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=I0(n,l[0],l[1]);return Hp([0,a],[0,o])(c)}function Hp(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function Gp(n,e){return n>0&&n<e}function F0(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=dv(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var O0=K("<div><!></div>");function z0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"type",3,"hover"),a=oe(e,"dir",3,"ltr"),o=oe(e,"scrollHideDelay",3,600),l=ut(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=Hu.create({type:Qe(()=>s()),dir:Qe(()=>a()),scrollHideDelay:Qe(()=>o()),id:Qe(()=>r()),ref:Qe(()=>i(),x=>i(x))}),d=O(()=>jt(l,c.props));var f=we(),h=Q(f);{var p=x=>{var g=we(),v=Q(g);pt(v,()=>e.child,()=>({props:u(d)})),P(x,g)},m=x=>{var g=O0();Ft(g,()=>({...u(d)}));var v=$(g);pt(v,()=>e.children??wt),j(g),P(x,g)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var B0=K("<div><div><!></div></div>");function k0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Gu.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props)),l=O(()=>jt({},a.contentProps));var c=B0();Ft(c,()=>({...u(o)}));var d=$(c);Ft(d,()=>({...u(l)}));var f=$(d);pt(f,()=>e.children??wt),j(d),j(c),P(n,c),at()}var V0=K("<div><!></div>");function Wp(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy","child","children"]);const i=Zu.create(),r=O(()=>jt(t,i.props));var s=we(),a=Q(s);{var o=c=>{var d=we(),f=Q(d);pt(f,()=>e.child,()=>({props:u(r)})),P(c,d)},l=c=>{var d=V0();Ft(d,()=>({...u(r)}));var f=$(d);pt(f,()=>e.children??wt),j(d),P(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}P(n,s),at()}function H0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Yu.create({mounted:Qe(()=>i.current)}),s=O(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function G0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Ku.create({mounted:Qe(()=>i.current)}),s=O(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function ol(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=qu.create();var r=we(),s=Q(r);{var a=l=>{H0(l,mt(()=>t))},o=l=>{G0(l,mt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}P(n,r),at()}function W0(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=sl.create(),s=O(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=O(()=>t()||r.isVisible);il(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}at()}function X0(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=ju.create(),s=O(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=O(()=>t()||!r.isHidden);il(n,mt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}at()}function j0(n,e){st(e,!0);let t=oe(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Xu.create(),s=sl.create(),a=O(()=>jt(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=O(()=>t()||r.isVisible&&s.isVisible);il(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{ol(c,mt(()=>u(a)))},$$slots:{presence:!0}}),at()}function q0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Wu.create({orientation:Qe(()=>e.orientation),id:Qe(()=>r()),ref:Qe(()=>i(),m=>i(m))}),o=O(()=>a.root.opts.type.current);var l=we(),c=Q(l);{var d=m=>{j0(m,mt(()=>s,{get id(){return r()}}))},f=m=>{X0(m,mt(()=>s,{get id(){return r()}}))},h=m=>{W0(m,mt(()=>s,{get id(){return r()}}))},p=m=>{ol(m,mt(()=>s,{get id(){return r()}}))};xe(c,m=>{u(o)==="hover"?m(d):u(o)==="scroll"?m(f,1):u(o)==="auto"?m(h,2):u(o)==="always"&&m(p,3)})}P(n,l),at()}var Y0=K("<div><!></div>");function K0(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new zu,s=$u.create({id:Qe(()=>e.id),ref:Qe(()=>t(),f=>t(f)),mounted:Qe(()=>r.current)}),a=O(()=>jt(i,s.props,{style:{hidden:!e.present}}));var o=we(),l=Q(o);{var c=f=>{var h=we(),p=Q(h);pt(p,()=>e.child,()=>({props:u(a)})),P(f,h)},d=f=>{var h=Y0();Ft(h,()=>({...u(a)}));var p=$(h);pt(p,()=>e.children??wt),j(h),P(f,h)};xe(l,f=>{e.child?f(c):f(d,-1)})}P(n,o),at()}function Z0(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"forceMount",3,!1),a=ut(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=rl.get();{const l=(d,f)=>{let h=()=>(f?.()).present;K0(d,mt(()=>a,{get id(){return i()},get present(){return h()},get ref(){return r()},set ref(p){r(p)}}))};let c=O(()=>s()||o.hasThumb);il(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}at()}var $0=K("<div><!></div>");function J0(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=Ju.create({id:Qe(()=>e.id),ref:Qe(()=>t(),d=>t(d))}),s=O(()=>jt(i,r.props));var a=we(),o=Q(a);{var l=d=>{var f=we(),h=Q(f);pt(h,()=>e.child,()=>({props:u(s)})),P(d,f)},c=d=>{var f=$0();Ft(f,()=>({...u(s)}));var h=$(f);pt(h,()=>e.children??wt),j(f),P(d,f)};xe(o,d=>{e.child?d(l):d(c,-1)})}P(n,a),at()}function Q0(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id"]);const a=va.get(),o=O(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=O(()=>a.opts.type.current!=="scroll"&&u(o));var c=we(),d=Q(c);{var f=h=>{J0(h,mt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,h=>{u(l)&&h(f)})}P(n,c),at()}function dh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function Xp(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function jp(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function e_(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function t_(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function Qu(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=e_(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const f=e+d*n,h=t_(f,s);c.push(h)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Tr(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Aa(n,e,t){const i=e.indexOf(n);return i===-1?Tr(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function n_(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const hr=Lu({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ed=new pr("Slider.Root");class qp{opts;attachment;#e=Fe(!1);get isActive(){return u(this.#e)}set isActive(e){W(this.#e,e,!0)}#t=Fe(0);#n=O(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){W(this.#n,e)}#i=O(()=>Qu(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){W(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref),this.domContext=new xp(this.opts.ref),new Rr(()=>this.opts.ref.current,this.#r)}#r=()=>{W(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=O(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return n_([this.opts.min.current,this.opts.max.current],t)(e)};#a=O(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":Pr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[hr.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class i_ extends qp{opts;isMulti=!1;constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Tr(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Tr(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};#e=O(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=Xp(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){W(this.#e,e)}#t=O(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){W(this.#t,e)}#n=O(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=i<=t;return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){W(this.#n,e)}#i=O(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){W(this.#i,e)}#r=O(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){W(this.#r,e)}#s=O(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){W(this.#s,e)}#a=O(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){W(this.#a,e)}}class r_ extends qp{opts;isMulti=!0;#e=Fe(null);get activeThumb(){return u(this.#e)}set activeThumb(e){W(this.#e,e,!0)}#t=Fe(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){W(this.#t,e,!0)}constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Tr(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!hv(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Tr(e,l),this.opts.value.current=s};#i=O(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=wn(()=>this.currentThumbIdx);r<e.length&&wn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=Xp(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){W(this.#i,e)}#r=O(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){W(this.#r,e)}#s=O(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){W(this.#s,e)}#a=O(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){W(this.#a,e)}#o=O(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){W(this.#o,e)}#l=O(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){W(this.#l,e)}#c=O(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){W(this.#c,e)}}class s_{static create(e){const{type:t,...i}=e,r=t==="single"?new i_(i):new r_(i);return ed.set(r)}}const a_=[wp,Ep,Tp,Ap,Cp,Pp];class td{static create(e){return new td(e,ed.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref)}#e=O(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...dh(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...dh(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){W(this.#e,e)}#t=O(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":Pr(this.root.opts.disabled.current),style:this.rangeStyles,[hr.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class nd{static create(e){return new nd(e,ed.get())}opts;root;attachment;#e=O(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!a_.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,f=this.root.normalizedSteps;switch(e.key){case Cp:this.#t(s);break;case Pp:this.#t(a);break;case wp:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"next":"prev");this.#t(p)}break;case Ep:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"prev":"next");this.#t(p)}break;case Tp:if(e.metaKey){const h=d==="tb"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"prev":"next");this.#t(p)}break;case Ap:if(e.metaKey){const h=d==="tb"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=O(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":Pr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}var o_=K("<span><!></span>");function l_(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",19,()=>Vn(t)),r=oe(e,"ref",15,null),s=oe(e,"value",15),a=oe(e,"onValueChange",3,Un),o=oe(e,"onValueCommit",3,Un),l=oe(e,"disabled",3,!1),c=oe(e,"step",3,1),d=oe(e,"dir",3,"ltr"),f=oe(e,"autoSort",3,!0),h=oe(e,"orientation",3,"horizontal"),p=oe(e,"thumbPositioning",3,"contain"),m=ut(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const x=O(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),g=O(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function v(){if(s()===void 0)return e.type==="single"?u(x):[]}v(),fr.pre(()=>s(),()=>{v()});const y=s_.create({id:Qe(()=>i()),ref:Qe(()=>r(),_=>r(_)),value:Qe(()=>s(),_=>{s(_),a()(_)}),onValueCommit:Qe(()=>o()),disabled:Qe(()=>l()),min:Qe(()=>u(x)),max:Qe(()=>u(g)),step:Qe(()=>c()),dir:Qe(()=>d()),autoSort:Qe(()=>f()),orientation:Qe(()=>h()),thumbPositioning:Qe(()=>p()),type:e.type,trackPadding:Qe(()=>e.trackPadding)}),w=O(()=>jt(m,y.props));var b=we(),E=Q(b);{var S=_=>{var T=we(),D=Q(T);{let L=O(()=>({props:u(w),...y.snippetProps}));pt(D,()=>e.child,()=>u(L))}P(_,T)},A=_=>{var T=o_();Ft(T,()=>({...u(w)}));var D=$(T);pt(D,()=>e.children??wt,()=>y.snippetProps),j(T),P(_,T)};xe(E,_=>{e.child?_(S):_(A,-1)})}P(n,b),at()}var c_=K("<span><!></span>");function u_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=td.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=O(()=>jt(s,a.props));var l=we(),c=Q(l);{var d=h=>{var p=we(),m=Q(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=c_();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),j(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var d_=K("<span><!></span>");function h_(n,e){const t=Tn();st(e,!0);let i=oe(e,"ref",15,null),r=oe(e,"id",19,()=>Vn(t)),s=oe(e,"disabled",3,!1),a=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=nd.create({id:Qe(()=>r()),ref:Qe(()=>i(),p=>i(p)),index:Qe(()=>e.index),disabled:Qe(()=>s())}),l=O(()=>jt(a,o.props));var c=we(),d=Q(c);{var f=p=>{var m=we(),x=Q(m);{let g=O(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));pt(x,()=>e.child,()=>u(g))}P(p,m)},h=p=>{var m=d_();Ft(m,()=>({...u(l)}));var x=$(m);{let g=O(()=>({active:o.root.isThumbActive(o.opts.index.current)}));pt(x,()=>e.children??wt,()=>u(g))}j(m),P(p,m)};xe(d,p=>{e.child?p(f):p(h,-1)})}P(n,c),at()}var Mo=new Map;function Yp(n,e){Mo.set(n,e)}Yp("Rhino.Geometry.Point3d",(n,e)=>{let t=e;return!t||typeof t.X!="number"?null:new n.Point([t.X,t.Y,t.Z])});Yp("Rhino.Geometry.Line",(n,e)=>{let t=e;return!t||!t.From||!t.To?null:new n.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function f_(n){if(Mo.has(n))return Mo.get(n);for(let[e,t]of Mo)if(n.startsWith(e))return t}function p_(n){return!n||typeof n!="object"?null:n.data??n.value??null}function m_(n,e,t){let i=f_(e);if(i)try{return i(t,n)}catch(r){Nt().warn(`Failed to decode Rhino type ${e}:`,r)}try{let r=p_(n);if(r)return t.CommonObject.decode(r)}catch(r){return Nt().warn(`Failed to decode ${e} with CommonObject:`,r),{__decodeError:!0,type:e,raw:n}}return n}var ds={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},g_="Rhino.Geometry.",v_=["WebDisplay"],__="FileData";function Kp(n){return v_.some(e=>n.includes(e))}function Zp(n){if(typeof n!="string")return n;let e=n.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return n;try{let t=JSON.parse(e);if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}catch{return n}}function x_(n,e,t){switch(e){case ds.STRING:return typeof n!="string"?n:n.replace(/^"(.*)"$/,"$1");case ds.INT:return Number.parseInt(n,10);case ds.DOUBLE:return Number.parseFloat(n);case ds.BOOL:return String(n).toLowerCase()==="true";default:return t&&e.startsWith(g_)?m_(n,e,t):n}}function $p(n,e,t,i){if(typeof n!="string")return n;let r=t?Zp(n):n;return x_(r,e,i)}function b_(n){if(!n||typeof n!="object")return!1;let e=n;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function ko(n,e){for(let t of Object.values(n))if(Array.isArray(t))for(let i of t)e(i)}function y_(n,e=!1,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a={},o=new Set;for(let l of n.values)ko(l.InnerTree,c=>{if(Kp(c.type)||s&&c.type!==ds.STRING)return;let d=e?c.id:l.ParamName;if(!d)return;let f=$p(c.data,c.type,i,r);d in a?o.has(d)?a[d].push(f):(a[d]=[a[d],f],o.add(d)):a[d]=f});return{values:a}}function S_(n){let e=[];for(let t of n.values)ko(t.InnerTree,i=>{if(!i.type.includes(__))return;let r=Zp(i.data);b_(r)&&e.push(r)});return e}function M_(n,e,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a;if("byName"in e?a=n.values.find(l=>l.ParamName===e.byName):a=n.values.find(l=>{let c=!1;return ko(l.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let o=[];if(ko(a.InnerTree,l=>{if("byId"in e&&l.id!==e.byId||Kp(l.type)||s&&l.type!==ds.STRING)return;let c=$p(l.data,l.type,i,r);o.push(c)}),o.length!==0)return o.length===1?o[0]:o}var w_=class{constructor(n,e=!1){this.response=n,this.debug=e}getValues(n=!1,e={}){return y_(this.response,n,e)}getValue(n,e){return M_(this.response,n,e)}async extractMeshesFromResponse(n){let e={debug:this.debug,...n},t;try{({getThreeMeshesFromComputeResponse:t}=await gp(()=>Promise.resolve().then(()=>UD),void 0,import.meta.url))}catch(i){throw new ma("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",Pu.INVALID_STATE,{context:{originalError:i instanceof Error?i.message:String(i)}})}return t(this.response,e)}getFileData(){return S_(this.response)}async getAndDownloadFiles(n,e){let t=this.getFileData();await jg(t,n,e)}},E_=/^\{(\d+(?:;\d+)*)?\}$/;function T_(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=Object.entries(n);return e.length>0&&e.every(([t,i])=>E_.test(t)&&Array.isArray(i))}function Rs(n,e,t){if(n==null)return n;if(Array.isArray(n)){let r=n.map(e).filter(s=>s!==null);return r.length>0?r:void 0}let i=e(n);return i!==null?i:t?void 0:n}var A_=n=>{if(typeof n=="number")return n;if(typeof n=="string"){let e=n.trim();if(e==="")return null;let t=Number(e);return Number.isNaN(t)?null:t}return null},C_=n=>{if(typeof n=="boolean")return n;if(typeof n=="string"){let e=n.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${n}"`)}return null},P_=n=>typeof n=="string"?n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n.startsWith('"')?n.slice(1):n:null,R_=n=>{if(typeof n=="string"){let e=n.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null};function Jp(n){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(Nt().warn(`Parsed value for input ${n} is not an object`),null)}catch(t){return Nt().warn(`Failed to parse object value "${e}" for input ${n}`,t),null}return null}}function hh(n,e,t){let i=Number(n.toFixed(e));return Math.abs(n-i)<t?i:n}function D_(n,e){if(!Number.isFinite(n)||n===0)return .1;let t=Math.abs(n);if(t>=1){let d=String(n).split(".")[1];if(d&&d.length>0){let f=Math.min(d.length,12),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return 1}let i=String(n),r=i.toLowerCase().match(/e(-?\d+)/);if(r){let d=Number(r[1]);if(d<0||i.toLowerCase().includes("e-")){let f=Math.abs(d),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return .1}let s=12,a=t.toFixed(s).replace(/0+$/,""),o=Math.min((a.split(".")[1]||"").length,s);if(o===0)return .1;let l=Math.pow(10,-o),c=Number(l.toFixed(o));return Math.abs(c-l)<e?c:l}function L_(n,e=1e-8){let t=n.paramType==="Integer";if(T_(n.default))return{default:n.default,stepSize:t?1:.1};let i=Rs(n.default,A_,!0);if(t)return Array.isArray(i)?i=i.map(d=>typeof d=="number"?Math.round(d):d):typeof i=="number"&&(i=Math.round(i)),{default:i,stepSize:1};let r=Array.isArray(i)?i[0]:i,s;typeof r=="number"&&Number.isFinite(r)&&r!==0?s=r:typeof n.minimum=="number"&&Number.isFinite(n.minimum)&&n.minimum!==0?s=n.minimum:typeof n.maximum=="number"&&Number.isFinite(n.maximum)&&n.maximum!==0&&(s=n.maximum);let a=s!==void 0?D_(s,e):.1,o=0,l=String(a),c=l.toLowerCase().match(/e(-?\d+)/);if(c?o=Math.abs(Number(c[1])):o=l.split(".")[1]?.length??0,o===0&&typeof r=="number"&&r!==0&&Math.abs(r)<1){let d=Math.ceil(-Math.log10(Math.abs(r)));Number.isFinite(d)&&d>0&&(o=d)}return o=Math.min(Math.max(o,0),12),Array.isArray(i)?i=i.map(d=>typeof d=="number"?hh(d,o,e):d):typeof i=="number"&&(i=hh(i,o,e)),{default:i,stepSize:a}}var I_={types:["Number","Integer"],parse(n,e){let{default:t,stepSize:i}=L_(n);return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,stepSize:i,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,default:t?[0]:0}}},N_={types:["Boolean"],parse(n,e){let t;try{t=Rs(n.default,C_,!1)}catch(i){throw i instanceof Error?new ma(i.message):i}return{...e,paramType:"Boolean",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Boolean",default:t?[!1]:!1}}},U_={types:["Text"],parse(n,e){let t=Rs(n.default,P_,!1);return{...e,paramType:"Text",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Text",default:t?[""]:""}}},F_={types:["ValueList"],parse(n,e){if(!n.values||typeof n.values!="object"||Object.keys(n.values).length===0)throw ma.missingValues(n.nickname||"unnamed","ValueList");if(n.default!==void 0&&n.default!==null){let t=String(n.default).toLowerCase();Object.keys(n.values).some(i=>i.toLowerCase()===t)||Nt().warn(`ValueList input "${n.nickname||"unnamed"}" default value "${n.default}" is not in available values`)}return{...e,paramType:"ValueList",values:n.values,default:n.default}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"ValueList",values:n.values??{},default:t?[n.default]:n.default}}},O_={types:["Geometry"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"Geometry",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Geometry",default:t?[null]:null}}},z_={types:["File"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"File",acceptedFormats:n.acceptedFormats,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"File",default:t?[null]:null}}},B_={types:["Color"],parse(n,e){let t=Rs(n.default,R_,!1);return{...e,paramType:"Color",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"}}},k_=[I_,N_,U_,F_,O_,z_,B_],V_=new Map(k_.flatMap(n=>n.types.map(e=>[e,n])));new Map([...V_.keys()].map(n=>[n.toLowerCase(),n]));const id="184",xs={ROTATE:0,DOLLY:1,PAN:2},hs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},H_=0,fh=1,G_=2,wo=1,W_=2,fs=3,Kn=0,Yn=1,Qn=2,Mn=0,bs=1,ph=2,mh=3,gh=4,Qp=5,gi=100,X_=101,j_=102,q_=103,Y_=104,Js=200,K_=201,Z_=202,$_=203,_c=204,xc=205,bc=206,J_=207,yc=208,Q_=209,ex=210,tx=211,nx=212,ix=213,rx=214,Sc=0,Mc=1,wc=2,ws=3,Ec=4,Tc=5,Ac=6,Cc=7,em=0,sx=1,ax=2,Fi=0,rd=1,sd=2,ad=3,od=4,ld=5,cd=6,xa=7,tm=300,Dr=301,Es=302,Eo=303,wl=304,ll=306,Lr=1e3,_i=1001,Pc=1002,xn=1003,ox=1004,Ca=1005,hn=1006,El=1007,lr=1008,qn=1009,nm=1010,im=1011,aa=1012,ud=1013,Oi=1014,ti=1015,Fn=1016,dd=1017,hd=1018,Ts=1020,rm=35902,sm=35899,am=1021,om=1022,li=1023,Yi=1026,cr=1027,lm=1028,fd=1029,Ir=1030,pd=1031,md=1033,To=33776,Ao=33777,Co=33778,Po=33779,Rc=35840,Dc=35841,Lc=35842,Ic=35843,Nc=36196,Uc=37492,Fc=37496,Oc=37488,zc=37489,Vo=37490,Bc=37491,kc=37808,Vc=37809,Hc=37810,Gc=37811,Wc=37812,Xc=37813,jc=37814,qc=37815,Yc=37816,Kc=37817,Zc=37818,$c=37819,Jc=37820,Qc=37821,eu=36492,tu=36494,nu=36495,iu=36283,ru=36284,Ho=36285,su=36286,lx=3200,Go=0,cx=1,ar="",Wn="srgb",oa="srgb-linear",Wo="linear",Ut="srgb",kr=7680,vh=519,ux=512,dx=513,hx=514,gd=515,fx=516,px=517,vd=518,mx=519,au=35044,_h="300 es",Ni=2e3,la=2001;function gx(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Xo(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vx(){const n=Xo("canvas");return n.style.display="block",n}const xh={};function jo(...n){const e="THREE."+n.shift();console.log(e,...n)}function cm(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ft(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Tt(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ou(...n){const e=n.join(" ");e in xh||(xh[e]=!0,ft(...n))}function _x(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const xx={[Sc]:Mc,[wc]:Ac,[Ec]:Cc,[ws]:Tc,[Mc]:Sc,[Ac]:wc,[Cc]:Ec,[Tc]:ws};class mr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const In=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let bh=1234567;const ys=Math.PI/180,ca=180/Math.PI;function ji(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function _d(n,e){return(n%e+e)%e}function bx(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function yx(n,e,t){return n!==e?(t-n)/(e-n):0}function ra(n,e,t){return(1-t)*n+t*e}function Sx(n,e,t,i){return ra(n,e,1-Math.exp(-t*i))}function Mx(n,e=1){return e-Math.abs(_d(n,e*2)-e)}function wx(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ex(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Tx(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ax(n,e){return n+Math.random()*(e-n)}function Cx(n){return n*(.5-Math.random())}function Px(n){n!==void 0&&(bh=n);let e=bh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Rx(n){return n*ys}function Dx(n){return n*ca}function Lx(n){return(n&n-1)===0&&n!==0}function Ix(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Nx(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ux(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),d=a((e+i)/2),f=s((e-i)/2),h=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*d,l*f,l*h,o*c);break;case"YZY":n.set(l*h,o*d,l*f,o*c);break;case"ZXZ":n.set(l*f,l*h,o*d,o*c);break;case"XZX":n.set(o*d,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*d,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*d,o*c);break;default:ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function vi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ot(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const um={DEG2RAD:ys,RAD2DEG:ca,generateUUID:ji,clamp:gt,euclideanModulo:_d,mapLinear:bx,inverseLerp:yx,lerp:ra,damp:Sx,pingpong:Mx,smoothstep:wx,smootherstep:Ex,randInt:Tx,randFloat:Ax,randFloatSpread:Cx,seededRandom:Px,degToRad:Rx,radToDeg:Dx,isPowerOfTwo:Lx,ceilPowerOfTwo:Ix,floorPowerOfTwo:Nx,setQuaternionFromProperEuler:Ux,normalize:Ot,denormalize:vi},Kd=class Kd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kd.prototype.isVector2=!0;let it=Kd;class xi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3],h=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(f!==x||l!==h||c!==p||d!==m){let g=l*h+c*p+d*m+f*x;g<0&&(h=-h,p=-p,m=-m,x=-x,g=-g);let v=1-o;if(g<.9995){const y=Math.acos(g),w=Math.sin(y);v=Math.sin(v*y)/w,o=Math.sin(o*y)/w,l=l*v+h*o,c=c*v+p*o,d=d*v+m*o,f=f*v+x*o}else{l=l*v+h*o,c=c*v+p*o,d=d*v+m*o,f=f*v+x*o;const y=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=y,c*=y,d*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=s[a],h=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+d*f+l*p-c*h,e[t+1]=l*m+d*h+c*f-o*p,e[t+2]=c*m+d*p+o*h-l*f,e[t+3]=d*m-o*f-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(s/2),h=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"YXZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"ZXY":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"ZYX":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"YZX":this._x=h*d*f+c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f-h*p*m;break;case"XZY":this._x=h*d*f-c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f+h*p*m;break;default:ft("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],f=t[10],h=i+o+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>f){const p=2*Math.sqrt(1+i-o-f);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>f){const p=2*Math.sqrt(1+o-i-f);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+f-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zd=class Zd{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(yh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(yh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),f=2*(s*i-a*t);return this.x=t+l*c+a*f-o*d,this.y=i+l*d+o*c-s*f,this.z=r+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Tl.copy(this).projectOnVector(e),this.sub(Tl)}reflect(e){return this.sub(Tl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zd.prototype.isVector3=!0;let X=Zd;const Tl=new X,yh=new xi,$d=class $d{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],h=i[2],p=i[5],m=i[8],x=r[0],g=r[3],v=r[6],y=r[1],w=r[4],b=r[7],E=r[2],S=r[5],A=r[8];return s[0]=a*x+o*y+l*E,s[3]=a*g+o*w+l*S,s[6]=a*v+o*b+l*A,s[1]=c*x+d*y+f*E,s[4]=c*g+d*w+f*S,s[7]=c*v+d*b+f*A,s[2]=h*x+p*y+m*E,s[5]=h*g+p*w+m*S,s[8]=h*v+p*b+m*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,h=o*l-d*s,p=c*s-a*l,m=t*f+i*h+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(r*c-d*i)*x,e[2]=(o*i-r*a)*x,e[3]=h*x,e[4]=(d*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Al.makeScale(e,t)),this}rotate(e){return this.premultiply(Al.makeRotation(-e)),this}translate(e,t){return this.premultiply(Al.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$d.prototype.isMatrix3=!0;let xt=$d;const Al=new xt,Sh=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mh=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Fx(){const n={enabled:!0,workingColorSpace:oa,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ut&&(r.r=qi(r.r),r.g=qi(r.g),r.b=qi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ut&&(r.r=Ss(r.r),r.g=Ss(r.g),r.b=Ss(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ar?Wo:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ou("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ou("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[oa]:{primaries:e,whitePoint:i,transfer:Wo,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wn},outputColorSpaceConfig:{drawingBufferColorSpace:Wn}},[Wn]:{primaries:e,whitePoint:i,transfer:Ut,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wn}}}),n}const At=Fx();function qi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ss(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Vr;class Ox{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Vr===void 0&&(Vr=Xo("canvas")),Vr.width=e.width,Vr.height=e.height;const r=Vr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Vr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xo("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=qi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(qi(t[i]/255)*255):t[i]=qi(t[i]);return{data:t,width:e.width,height:e.height}}else return ft("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let zx=0;class xd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zx++}),this.uuid=ji(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Cl(r[a].image)):s.push(Cl(r[a]))}else s=Cl(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Cl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ox.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ft("Texture: Unable to serialize Texture."),{})}let Bx=0;const Pl=new X;class En extends mr{constructor(e=En.DEFAULT_IMAGE,t=En.DEFAULT_MAPPING,i=_i,r=_i,s=hn,a=lr,o=li,l=qn,c=En.DEFAULT_ANISOTROPY,d=ar){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bx++}),this.uuid=ji(),this.name="",this.source=new xd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new it(0,0),this.repeat=new it(1,1),this.center=new it(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Pl).x}get height(){return this.source.getSize(Pl).y}get depth(){return this.source.getSize(Pl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==tm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Lr:e.x=e.x-Math.floor(e.x);break;case _i:e.x=e.x<0?0:1;break;case Pc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Lr:e.y=e.y-Math.floor(e.y);break;case _i:e.y=e.y<0?0:1;break;case Pc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}En.DEFAULT_IMAGE=null;En.DEFAULT_MAPPING=tm;En.DEFAULT_ANISOTROPY=1;const Jd=class Jd{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],f=l[8],h=l[1],p=l[5],m=l[9],x=l[2],g=l[6],v=l[10];if(Math.abs(d-h)<.01&&Math.abs(f-x)<.01&&Math.abs(m-g)<.01){if(Math.abs(d+h)<.1&&Math.abs(f+x)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,b=(p+1)/2,E=(v+1)/2,S=(d+h)/4,A=(f+x)/4,_=(m+g)/4;return w>b&&w>E?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=S/i,s=A/i):b>E?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=S/r,s=_/r):E<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(E),i=A/s,r=_/s),this.set(i,r,s,t),this}let y=Math.sqrt((g-m)*(g-m)+(f-x)*(f-x)+(h-d)*(h-d));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(f-x)/y,this.z=(h-d)/y,this.w=Math.acos((c+p+v-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jd.prototype.isVector4=!0;let kt=Jd;class kx extends mr{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new kt(0,0,e,t),this.scissorTest=!1,this.viewport=new kt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new En(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:hn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new xd(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ni extends kx{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class dm extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Vx extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const el=class el{constructor(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,g)}set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,g){const v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=s,v[5]=a,v[9]=o,v[13]=l,v[2]=c,v[6]=d,v[10]=f,v[14]=h,v[3]=p,v[7]=m,v[11]=x,v[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new el().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Hr.setFromMatrixColumn(e,0).length(),s=1/Hr.setFromMatrixColumn(e,1).length(),a=1/Hr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=-l*f,t[8]=c,t[1]=p+m*c,t[5]=h-x*c,t[9]=-o*l,t[2]=x-h*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h+x*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*f,t[5]=a*d,t[9]=-o,t[2]=p*o-m,t[6]=x+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h-x*o,t[4]=-a*f,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*d,t[9]=x-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=m*c-p,t[8]=h*c+x,t[1]=l*f,t[5]=x*c+h,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=x-h*f,t[8]=m*f+p,t[1]=f,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*f+m,t[10]=h-x*f}else if(e.order==="XZY"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=-f,t[8]=c*d,t[1]=h*f+x,t[5]=a*d,t[9]=p*f-m,t[2]=m*f-p,t[6]=o*d,t[10]=x*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hx,e,Gx)}lookAt(e,t,i){const r=this.elements;return $n.subVectors(e,t),$n.lengthSq()===0&&($n.z=1),$n.normalize(),Qi.crossVectors(i,$n),Qi.lengthSq()===0&&(Math.abs(i.z)===1?$n.x+=1e-4:$n.z+=1e-4,$n.normalize(),Qi.crossVectors(i,$n)),Qi.normalize(),Pa.crossVectors($n,Qi),r[0]=Qi.x,r[4]=Pa.x,r[8]=$n.x,r[1]=Qi.y,r[5]=Pa.y,r[9]=$n.y,r[2]=Qi.z,r[6]=Pa.z,r[10]=$n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],h=i[9],p=i[13],m=i[2],x=i[6],g=i[10],v=i[14],y=i[3],w=i[7],b=i[11],E=i[15],S=r[0],A=r[4],_=r[8],T=r[12],D=r[1],L=r[5],F=r[9],k=r[13],U=r[2],N=r[6],R=r[10],z=r[14],q=r[3],Y=r[7],te=r[11],le=r[15];return s[0]=a*S+o*D+l*U+c*q,s[4]=a*A+o*L+l*N+c*Y,s[8]=a*_+o*F+l*R+c*te,s[12]=a*T+o*k+l*z+c*le,s[1]=d*S+f*D+h*U+p*q,s[5]=d*A+f*L+h*N+p*Y,s[9]=d*_+f*F+h*R+p*te,s[13]=d*T+f*k+h*z+p*le,s[2]=m*S+x*D+g*U+v*q,s[6]=m*A+x*L+g*N+v*Y,s[10]=m*_+x*F+g*R+v*te,s[14]=m*T+x*k+g*z+v*le,s[3]=y*S+w*D+b*U+E*q,s[7]=y*A+w*L+b*N+E*Y,s[11]=y*_+w*F+b*R+E*te,s[15]=y*T+w*k+b*z+E*le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],h=e[10],p=e[14],m=e[3],x=e[7],g=e[11],v=e[15],y=l*p-c*h,w=o*p-c*f,b=o*h-l*f,E=a*p-c*d,S=a*h-l*d,A=a*f-o*d;return t*(x*y-g*w+v*b)-i*(m*y-g*E+v*S)+r*(m*w-x*E+v*A)-s*(m*b-x*S+g*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],h=e[10],p=e[11],m=e[12],x=e[13],g=e[14],v=e[15],y=t*o-i*a,w=t*l-r*a,b=t*c-s*a,E=i*l-r*o,S=i*c-s*o,A=r*c-s*l,_=d*x-f*m,T=d*g-h*m,D=d*v-p*m,L=f*g-h*x,F=f*v-p*x,k=h*v-p*g,U=y*k-w*F+b*L+E*D-S*T+A*_;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/U;return e[0]=(o*k-l*F+c*L)*N,e[1]=(r*F-i*k-s*L)*N,e[2]=(x*A-g*S+v*E)*N,e[3]=(h*S-f*A-p*E)*N,e[4]=(l*D-a*k-c*T)*N,e[5]=(t*k-r*D+s*T)*N,e[6]=(g*b-m*A-v*w)*N,e[7]=(d*A-h*b+p*w)*N,e[8]=(a*F-o*D+c*_)*N,e[9]=(i*D-t*F-s*_)*N,e[10]=(m*S-x*b+v*y)*N,e[11]=(f*b-d*S-p*y)*N,e[12]=(o*T-a*L-l*_)*N,e[13]=(t*L-i*T+r*_)*N,e[14]=(x*w-m*E-g*y)*N,e[15]=(d*E-f*w+h*y)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,f=o+o,h=s*c,p=s*d,m=s*f,x=a*d,g=a*f,v=o*f,y=l*c,w=l*d,b=l*f,E=i.x,S=i.y,A=i.z;return r[0]=(1-(x+v))*E,r[1]=(p+b)*E,r[2]=(m-w)*E,r[3]=0,r[4]=(p-b)*S,r[5]=(1-(h+v))*S,r[6]=(g+y)*S,r[7]=0,r[8]=(m+w)*A,r[9]=(g-y)*A,r[10]=(1-(h+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=Hr.set(r[0],r[1],r[2]).length();const o=Hr.set(r[4],r[5],r[6]).length(),l=Hr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),hi.copy(this);const c=1/a,d=1/o,f=1/l;return hi.elements[0]*=c,hi.elements[1]*=c,hi.elements[2]*=c,hi.elements[4]*=d,hi.elements[5]*=d,hi.elements[6]*=d,hi.elements[8]*=f,hi.elements[9]*=f,hi.elements[10]*=f,t.setFromRotationMatrix(hi),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let m,x;if(l)m=s/(a-s),x=a*s/(a-s);else if(o===Ni)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===la)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2/(t-e),f=2/(i-r),h=-(t+e)/(t-e),p=-(i+r)/(i-r);let m,x;if(l)m=1/(a-s),x=a/(a-s);else if(o===Ni)m=-2/(a-s),x=-(a+s)/(a-s);else if(o===la)m=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=f,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};el.prototype.isMatrix4=!0;let Lt=el;const Hr=new X,hi=new Lt,Hx=new X(0,0,0),Gx=new X(1,1,1),Qi=new X,Pa=new X,$n=new X,wh=new Lt,Eh=new xi;class Xn{constructor(e=0,t=0,i=0,r=Xn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ft("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return wh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Eh.setFromEuler(this),this.setFromQuaternion(Eh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xn.DEFAULT_ORDER="XYZ";class bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Wx=0;const Th=new X,Gr=new xi,Bi=new Lt,Ra=new X,Fs=new X,Xx=new X,jx=new xi,Ah=new X(1,0,0),Ch=new X(0,1,0),Ph=new X(0,0,1),Rh={type:"added"},qx={type:"removed"},Wr={type:"childadded",child:null},Rl={type:"childremoved",child:null};class rn extends mr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wx++}),this.uuid=ji(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rn.DEFAULT_UP.clone();const e=new X,t=new Xn,i=new xi,r=new X(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Lt},normalMatrix:{value:new xt}}),this.matrix=new Lt,this.matrixWorld=new Lt,this.matrixAutoUpdate=rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.multiply(Gr),this}rotateOnWorldAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.premultiply(Gr),this}rotateX(e){return this.rotateOnAxis(Ah,e)}rotateY(e){return this.rotateOnAxis(Ch,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Th.copy(e).applyQuaternion(this.quaternion),this.position.add(Th.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ah,e)}translateY(e){return this.translateOnAxis(Ch,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ra.copy(e):Ra.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Fs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Fs,Ra,this.up):Bi.lookAt(Ra,Fs,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Gr.setFromRotationMatrix(Bi),this.quaternion.premultiply(Gr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Tt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null):Tt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(qx),Rl.child=e,this.dispatchEvent(Rl),Rl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,e,Xx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,jx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),f=a(e.shapes),h=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}rn.DEFAULT_UP=new X(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Qs=class extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Yx={type:"move"};class Dl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const g=t.getJointPose(x,i),v=this._getHandJoint(c,x);g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=g.radius),v.visible=g!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=d.position.distanceTo(f.position),p=.02,m=.005;c.inputState.pinching&&h>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Yx)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Qs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},er={h:0,s:0,l:0},Da={h:0,s:0,l:0};function Ll(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class tt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=At.workingColorSpace){return this.r=e,this.g=t,this.b=i,At.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=At.workingColorSpace){if(e=_d(e,1),t=gt(t,0,1),i=gt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ll(a,s,e+1/3),this.g=Ll(a,s,e),this.b=Ll(a,s,e-1/3)}return At.colorSpaceToWorking(this,r),this}setStyle(e,t=Wn){function i(s){s!==void 0&&parseFloat(s)<1&&ft("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ft("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wn){const i=hm[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ft("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.b),this}copyLinearToSRGB(e){return this.r=Ss(e.r),this.g=Ss(e.g),this.b=Ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wn){return At.workingToColorSpace(Nn.copy(this),e),Math.round(gt(Nn.r*255,0,255))*65536+Math.round(gt(Nn.g*255,0,255))*256+Math.round(gt(Nn.b*255,0,255))}getHexString(e=Wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.workingToColorSpace(Nn.copy(this),t);const i=Nn.r,r=Nn.g,s=Nn.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case i:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-i)/f+2;break;case s:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=At.workingColorSpace){return At.workingToColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=Wn){At.workingToColorSpace(Nn.copy(this),e);const t=Nn.r,i=Nn.g,r=Nn.b;return e!==Wn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(er),this.setHSL(er.h+e,er.s+t,er.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(er),e.getHSL(Da);const i=ra(er.h,Da.h,t),r=ra(er.s,Da.s,t),s=ra(er.l,Da.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new tt;tt.NAMES=hm;class Kx extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const fi=new X,ki=new X,Il=new X,Vi=new X,Xr=new X,jr=new X,Dh=new X,Nl=new X,Ul=new X,Fl=new X,Ol=new kt,zl=new kt,Bl=new kt;class ei{constructor(e=new X,t=new X,i=new X){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),fi.subVectors(e,t),r.cross(fi);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){fi.subVectors(r,t),ki.subVectors(i,t),Il.subVectors(e,t);const a=fi.dot(fi),o=fi.dot(ki),l=fi.dot(Il),c=ki.dot(ki),d=ki.dot(Il),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-o*d)*h,m=(a*d-o*l)*h;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Vi)===null?!1:Vi.x>=0&&Vi.y>=0&&Vi.x+Vi.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,Vi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Vi.x),l.addScaledVector(a,Vi.y),l.addScaledVector(o,Vi.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ol.setScalar(0),zl.setScalar(0),Bl.setScalar(0),Ol.fromBufferAttribute(e,t),zl.fromBufferAttribute(e,i),Bl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ol,s.x),a.addScaledVector(zl,s.y),a.addScaledVector(Bl,s.z),a}static isFrontFacing(e,t,i,r){return fi.subVectors(i,t),ki.subVectors(e,t),fi.cross(ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return fi.subVectors(this.c,this.b),ki.subVectors(this.a,this.b),fi.cross(ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Xr.subVectors(r,i),jr.subVectors(s,i),Nl.subVectors(e,i);const l=Xr.dot(Nl),c=jr.dot(Nl);if(l<=0&&c<=0)return t.copy(i);Ul.subVectors(e,r);const d=Xr.dot(Ul),f=jr.dot(Ul);if(d>=0&&f<=d)return t.copy(r);const h=l*f-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(Xr,a);Fl.subVectors(e,s);const p=Xr.dot(Fl),m=jr.dot(Fl);if(m>=0&&p<=m)return t.copy(s);const x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(jr,o);const g=d*m-p*f;if(g<=0&&f-d>=0&&p-m>=0)return Dh.subVectors(s,r),o=(f-d)/(f-d+(p-m)),t.copy(r).addScaledVector(Dh,o);const v=1/(g+x+h);return a=x*v,o=h*v,t.copy(i).addScaledVector(Xr,a).addScaledVector(jr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class di{constructor(e=new X(1/0,1/0,1/0),t=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(pi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(pi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=pi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,pi):pi.fromBufferAttribute(s,a),pi.applyMatrix4(e.matrixWorld),this.expandByPoint(pi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),La.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),La.copy(i.boundingBox)),La.applyMatrix4(e.matrixWorld),this.union(La)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pi),pi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Os),Ia.subVectors(this.max,Os),qr.subVectors(e.a,Os),Yr.subVectors(e.b,Os),Kr.subVectors(e.c,Os),tr.subVectors(Yr,qr),nr.subVectors(Kr,Yr),vr.subVectors(qr,Kr);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-vr.z,vr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,vr.z,0,-vr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-vr.y,vr.x,0];return!kl(t,qr,Yr,Kr,Ia)||(t=[1,0,0,0,1,0,0,0,1],!kl(t,qr,Yr,Kr,Ia))?!1:(Na.crossVectors(tr,nr),t=[Na.x,Na.y,Na.z],kl(t,qr,Yr,Kr,Ia))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Hi=[new X,new X,new X,new X,new X,new X,new X,new X],pi=new X,La=new di,qr=new X,Yr=new X,Kr=new X,tr=new X,nr=new X,vr=new X,Os=new X,Ia=new X,Na=new X,_r=new X;function kl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_r.fromArray(n,s);const o=r.x*Math.abs(_r.x)+r.y*Math.abs(_r.y)+r.z*Math.abs(_r.z),l=e.dot(_r),c=t.dot(_r),d=i.dot(_r);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Xi=Zx();function Zx(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function $x(n){Math.abs(n)>65504&&ft("DataUtils.toHalfFloat(): Value out of range."),n=gt(n,-65504,65504),Xi.floatView[0]=n;const e=Xi.uint32View[0],t=e>>23&511;return Xi.baseTable[t]+((e&8388607)>>Xi.shiftTable[t])}function Jx(n){const e=n>>10;return Xi.uint32View[0]=Xi.mantissaTable[Xi.offsetTable[e]+(n&1023)]+Xi.exponentTable[e],Xi.floatView[0]}class Ua{static toHalfFloat(e){return $x(e)}static fromHalfFloat(e){return Jx(e)}}const mn=new X,Fa=new it;let Qx=0;class kn extends mr{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Qx++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=au,this.updateRanges=[],this.gpuType=ti,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Fa.fromBufferAttribute(this,t),Fa.applyMatrix3(e),this.setXY(t,Fa.x,Fa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix3(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==au&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class fm extends kn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class pm extends kn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class sn extends kn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const eb=new di,zs=new X,Vl=new X;class Ur{constructor(e=new X,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):eb.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zs.subVectors(e,this.center);const t=zs.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(zs,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Vl)),this.expandByPoint(zs.copy(e.center).sub(Vl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tb=0;const ai=new Lt,Hl=new rn,Zr=new X,Jn=new di,Bs=new di,Sn=new X;class on extends mr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tb++}),this.uuid=ji(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(gx(e)?pm:fm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,i){return ai.makeTranslation(e,t,i),this.applyMatrix4(ai),this}scale(e,t,i){return ai.makeScale(e,t,i),this.applyMatrix4(ai),this}lookAt(e){return Hl.lookAt(e),Hl.updateMatrix(),this.applyMatrix4(Hl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new sn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Jn.setFromBufferAttribute(s),this.morphTargetsRelative?(Sn.addVectors(this.boundingBox.min,Jn.min),this.boundingBox.expandByPoint(Sn),Sn.addVectors(this.boundingBox.max,Jn.max),this.boundingBox.expandByPoint(Sn)):(this.boundingBox.expandByPoint(Jn.min),this.boundingBox.expandByPoint(Jn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new X,1/0);return}if(e){const i=this.boundingSphere.center;if(Jn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Bs.setFromBufferAttribute(o),this.morphTargetsRelative?(Sn.addVectors(Jn.min,Bs.min),Jn.expandByPoint(Sn),Sn.addVectors(Jn.max,Bs.max),Jn.expandByPoint(Sn)):(Jn.expandByPoint(Bs.min),Jn.expandByPoint(Bs.max))}Jn.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Sn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Sn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)Sn.fromBufferAttribute(o,c),l&&(Zr.fromBufferAttribute(e,c),Sn.add(Zr)),r=Math.max(r,i.distanceToSquared(Sn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Tt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Tt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new X,l[_]=new X;const c=new X,d=new X,f=new X,h=new it,p=new it,m=new it,x=new X,g=new X;function v(_,T,D){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,T),f.fromBufferAttribute(i,D),h.fromBufferAttribute(s,_),p.fromBufferAttribute(s,T),m.fromBufferAttribute(s,D),d.sub(c),f.sub(c),p.sub(h),m.sub(h);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(x.copy(d).multiplyScalar(m.y).addScaledVector(f,-p.y).multiplyScalar(L),g.copy(f).multiplyScalar(p.x).addScaledVector(d,-m.x).multiplyScalar(L),o[_].add(x),o[T].add(x),o[D].add(x),l[_].add(g),l[T].add(g),l[D].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let k=L,U=L+F;k<U;k+=3)v(e.getX(k+0),e.getX(k+1),e.getX(k+2))}const w=new X,b=new X,E=new X,S=new X;function A(_){E.fromBufferAttribute(r,_),S.copy(E);const T=o[_];w.copy(T),w.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(S,T);const L=b.dot(l[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,L)}for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let k=L,U=L+F;k<U;k+=3)A(e.getX(k+0)),A(e.getX(k+1)),A(e.getX(k+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new kn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new X,s=new X,a=new X,o=new X,l=new X,c=new X,d=new X,f=new X;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),x=e.getX(h+1),g=e.getX(h+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,g),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,g),o.add(d),l.add(d),c.add(d),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),i.setXYZ(h+0,d.x,d.y,d.z),i.setXYZ(h+1,d.x,d.y,d.z),i.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Sn.fromBufferAttribute(e,t),Sn.normalize(),e.setXYZ(t,Sn.x,Sn.y,Sn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,h=new c.constructor(l.length*d);let p=0,m=0;for(let x=0,g=l.length;x<g;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*d;for(let v=0;v<d;v++)h[m++]=c[p++]}return new kn(h,d,f)}if(this.index===null)return ft("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const h=c[d],p=e(h,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,h=c.length;f<h;f++){const p=c[f];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let h=0,p=f.length;h<p;h++)d.push(f[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=au,this.updateRanges=[],this.version=0,this.uuid=ji()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const On=new X;class Ui{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyMatrix4(e),this.setXYZ(t,On.x,On.y,On.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyNormalMatrix(e),this.setXYZ(t,On.x,On.y,On.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.transformDirection(e),this.setXYZ(t,On.x,On.y,On.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=vi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=vi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=vi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=vi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){jo("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new kn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ui(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){jo("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let nb=0;class yi extends mr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nb++}),this.uuid=ji(),this.name="",this.type="Material",this.blending=bs,this.side=Kn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_c,this.blendDst=xc,this.blendEquation=gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tt(0,0,0),this.blendAlpha=0,this.depthFunc=ws,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=kr,this.stencilZFail=kr,this.stencilZPass=kr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ft(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bs&&(i.blending=this.blending),this.side!==Kn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==_c&&(i.blendSrc=this.blendSrc),this.blendDst!==xc&&(i.blendDst=this.blendDst),this.blendEquation!==gi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ws&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vh&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==kr&&(i.stencilFail=this.stencilFail),this.stencilZFail!==kr&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==kr&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gm extends yi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let $r;const ks=new X,Jr=new X,Qr=new X,es=new it,Vs=new it,vm=new Lt,Oa=new X,Hs=new X,za=new X,Lh=new it,Gl=new it,Ih=new it;class ts extends rn{constructor(e=new gm){if(super(),this.isSprite=!0,this.type="Sprite",$r===void 0){$r=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new mm(t,5);$r.setIndex([0,1,2,0,2,3]),$r.setAttribute("position",new Ui(i,3,0,!1)),$r.setAttribute("uv",new Ui(i,2,3,!1))}this.geometry=$r,this.material=e,this.center=new it(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Tt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jr.setFromMatrixScale(this.matrixWorld),vm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jr.multiplyScalar(-Qr.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;Ba(Oa.set(-.5,-.5,0),Qr,a,Jr,r,s),Ba(Hs.set(.5,-.5,0),Qr,a,Jr,r,s),Ba(za.set(.5,.5,0),Qr,a,Jr,r,s),Lh.set(0,0),Gl.set(1,0),Ih.set(1,1);let o=e.ray.intersectTriangle(Oa,Hs,za,!1,ks);if(o===null&&(Ba(Hs.set(-.5,.5,0),Qr,a,Jr,r,s),Gl.set(0,1),o=e.ray.intersectTriangle(Oa,za,Hs,!1,ks),o===null))return;const l=e.ray.origin.distanceTo(ks);l<e.near||l>e.far||t.push({distance:l,point:ks.clone(),uv:ei.getInterpolation(ks,Oa,Hs,za,Lh,Gl,Ih,new it),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ba(n,e,t,i,r,s){es.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Vs.x=s*es.x-r*es.y,Vs.y=r*es.x+s*es.y):Vs.copy(es),n.copy(e),n.x+=Vs.x,n.y+=Vs.y,n.applyMatrix4(vm)}const Gi=new X,Wl=new X,ka=new X,ir=new X,Xl=new X,Va=new X,jl=new X;class ba{constructor(e=new X,t=new X(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Gi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gi.copy(this.origin).addScaledVector(this.direction,t),Gi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Wl.copy(e).add(t).multiplyScalar(.5),ka.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(Wl);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ka),o=ir.dot(this.direction),l=-ir.dot(ka),c=ir.lengthSq(),d=Math.abs(1-a*a);let f,h,p,m;if(d>0)if(f=a*l-o,h=a*o-l,m=s*d,f>=0)if(h>=-m)if(h<=m){const x=1/d;f*=x,h*=x,p=f*(f+a*h+2*o)+h*(a*f+h+2*l)+c}else h=s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h<=-m?(f=Math.max(0,-(-a*s+o)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=m?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(a*s+o)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=a>0?-s:s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Wl).addScaledVector(ka,h),p}intersectSphere(e,t){Gi.subVectors(e.center,this.origin);const i=Gi.dot(this.direction),r=Gi.dot(Gi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gi)!==null}intersectTriangle(e,t,i,r,s){Xl.subVectors(t,e),Va.subVectors(i,e),jl.crossVectors(Xl,Va);let a=this.direction.dot(jl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ir.subVectors(this.origin,e);const l=o*this.direction.dot(Va.crossVectors(ir,Va));if(l<0)return null;const c=o*this.direction.dot(Xl.cross(ir));if(c<0||l+c>a)return null;const d=-o*ir.dot(jl);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yd extends yi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nh=new Lt,xr=new ba,Ha=new Ur,Uh=new X,Ga=new X,Wa=new X,Xa=new X,ql=new X,ja=new X,Fh=new X,qa=new X;class an extends rn{constructor(e=new on,t=new yd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){ja.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(ql.fromBufferAttribute(f,e),a?ja.addScaledVector(ql,d):ja.addScaledVector(ql.sub(t),d))}t.add(ja)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ha.copy(i.boundingSphere),Ha.applyMatrix4(s),xr.copy(e.ray).recast(e.near),!(Ha.containsPoint(xr.origin)===!1&&(xr.intersectSphere(Ha,Uh)===null||xr.origin.distanceToSquared(Uh)>(e.far-e.near)**2))&&(Nh.copy(s).invert(),xr.copy(e.ray).applyMatrix4(Nh),!(i.boundingBox!==null&&xr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const g=h[m],v=a[g.materialIndex],y=Math.max(g.start,p.start),w=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=o.getX(b),A=o.getX(b+1),_=o.getX(b+2);r=Ya(this,v,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let g=m,v=x;g<v;g+=3){const y=o.getX(g),w=o.getX(g+1),b=o.getX(g+2);r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const g=h[m],v=a[g.materialIndex],y=Math.max(g.start,p.start),w=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=b,A=b+1,_=b+2;r=Ya(this,v,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let g=m,v=x;g<v;g+=3){const y=g,w=g+1,b=g+2;r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function ib(n,e,t,i,r,s,a,o){let l;if(e.side===Yn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Kn,o),l===null)return null;qa.copy(o),qa.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(qa);return c<t.near||c>t.far?null:{distance:c,point:qa.clone(),object:n}}function Ya(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ga),n.getVertexPosition(l,Wa),n.getVertexPosition(c,Xa);const d=ib(n,e,t,i,Ga,Wa,Xa,Fh);if(d){const f=new X;ei.getBarycoord(Fh,Ga,Wa,Xa,f),r&&(d.uv=ei.getInterpolatedAttribute(r,o,l,c,f,new it)),s&&(d.uv1=ei.getInterpolatedAttribute(s,o,l,c,f,new it)),a&&(d.normal=ei.getInterpolatedAttribute(a,o,l,c,f,new X),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new X,materialIndex:0};ei.getNormal(Ga,Wa,Xa,h.normal),d.face=h,d.barycoord=f}return d}class cl extends En{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xn,d=xn,f,h){super(null,a,o,l,c,d,r,s,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Yl=new X,rb=new X,sb=new xt;class sr{constructor(e=new X(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Yl.subVectors(i,t).cross(rb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(Yl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||sb.getNormalMatrix(e),r=this.coplanarPoint(Yl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const br=new Ur,ab=new it(.5,.5),Ka=new X;class Sd{constructor(e=new sr,t=new sr,i=new sr,r=new sr,s=new sr,a=new sr){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ni,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],f=s[5],h=s[6],p=s[7],m=s[8],x=s[9],g=s[10],v=s[11],y=s[12],w=s[13],b=s[14],E=s[15];if(r[0].setComponents(c-a,p-d,v-m,E-y).normalize(),r[1].setComponents(c+a,p+d,v+m,E+y).normalize(),r[2].setComponents(c+o,p+f,v+x,E+w).normalize(),r[3].setComponents(c-o,p-f,v-x,E-w).normalize(),i)r[4].setComponents(l,h,g,b).normalize(),r[5].setComponents(c-l,p-h,v-g,E-b).normalize();else if(r[4].setComponents(c-l,p-h,v-g,E-b).normalize(),t===Ni)r[5].setComponents(c+l,p+h,v+g,E+b).normalize();else if(t===la)r[5].setComponents(l,h,g,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),br.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),br.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(br)}intersectsSprite(e){br.center.set(0,0,0);const t=ab.distanceTo(e.center);return br.radius=.7071067811865476+t,br.applyMatrix4(e.matrixWorld),this.intersectsSphere(br)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ka.x=r.normal.x>0?e.max.x:e.min.x,Ka.y=r.normal.y>0?e.max.y:e.min.y,Ka.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ka)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ob extends yi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qo=new X,Yo=new X,Oh=new Lt,Gs=new ba,Za=new Ur,Kl=new X,zh=new X;class lb extends rn{constructor(e=new on,t=new ob){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)qo.fromBufferAttribute(t,r-1),Yo.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=qo.distanceTo(Yo);e.setAttribute("lineDistance",new sn(i,1))}else ft("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Za.copy(i.boundingSphere),Za.applyMatrix4(r),Za.radius+=s,e.ray.intersectsSphere(Za)===!1)return;Oh.copy(r).invert(),Gs.copy(e.ray).applyMatrix4(Oh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,h=i.attributes.position;if(d!==null){const p=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){const v=d.getX(x),y=d.getX(x+1),w=$a(this,e,Gs,l,v,y,x);w&&t.push(w)}if(this.isLineLoop){const x=d.getX(m-1),g=d.getX(p),v=$a(this,e,Gs,l,x,g,m-1);v&&t.push(v)}}else{const p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){const v=$a(this,e,Gs,l,x,x+1,x);v&&t.push(v)}if(this.isLineLoop){const x=$a(this,e,Gs,l,m-1,p,m-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $a(n,e,t,i,r,s,a){const o=n.geometry.attributes.position;if(qo.fromBufferAttribute(o,r),Yo.fromBufferAttribute(o,s),t.distanceSqToSegment(qo,Yo,Kl,zh)>i)return;Kl.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Kl);if(!(c<e.near||c>e.far))return{distance:c,point:zh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}class Ko extends yi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bh=new Lt,lu=new ba,Ja=new Ur,Qa=new X;class Zo extends rn{constructor(e=new on,t=new Ko){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ja.copy(i.boundingSphere),Ja.applyMatrix4(r),Ja.radius+=s,e.ray.intersectsSphere(Ja)===!1)return;Bh.copy(r).invert(),lu.copy(e.ray).applyMatrix4(Bh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,f=i.attributes.position;if(c!==null){const h=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let m=h,x=p;m<x;m++){const g=c.getX(m);Qa.fromBufferAttribute(f,g),kh(Qa,g,l,r,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(f.count,a.start+a.count);for(let m=h,x=p;m<x;m++)Qa.fromBufferAttribute(f,m),kh(Qa,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kh(n,e,t,i,r,s,a){const o=lu.distanceSqToPoint(n);if(o<t){const l=new X;lu.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class _m extends En{constructor(e=[],t=Dr,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class cb extends En{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nr extends En{constructor(e,t,i=Oi,r,s,a,o=xn,l=xn,c,d=Yi,f=1){if(d!==Yi&&d!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:f};super(h,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ub extends Nr{constructor(e,t=Oi,i=Dr,r,s,a=xn,o=xn,l,c=Yi){const d={width:e,height:e,depth:1},f=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class xm extends En{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ya extends on{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let h=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sn(c,3)),this.setAttribute("normal",new sn(d,3)),this.setAttribute("uv",new sn(f,2));function m(x,g,v,y,w,b,E,S,A,_,T){const D=b/A,L=E/_,F=b/2,k=E/2,U=S/2,N=A+1,R=_+1;let z=0,q=0;const Y=new X;for(let te=0;te<R;te++){const le=te*L-k;for(let B=0;B<N;B++){const ee=B*D-F;Y[x]=ee*y,Y[g]=le*w,Y[v]=U,c.push(Y.x,Y.y,Y.z),Y[x]=0,Y[g]=0,Y[v]=S>0?1:-1,d.push(Y.x,Y.y,Y.z),f.push(B/A),f.push(1-te/_),z+=1}}for(let te=0;te<_;te++)for(let le=0;le<A;le++){const B=h+le+N*te,ee=h+le+N*(te+1),de=h+(le+1)+N*(te+1),ve=h+(le+1)+N*te;l.push(B,ee,ve),l.push(ee,de,ve),q+=6}o.addGroup(p,q,T),p+=q,h+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Md extends on{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const d=[],f=[],h=[],p=[];let m=0;const x=[],g=i/2;let v=0;y(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new sn(f,3)),this.setAttribute("normal",new sn(h,3)),this.setAttribute("uv",new sn(p,2));function y(){const b=new X,E=new X;let S=0;const A=(t-e)/i;for(let _=0;_<=s;_++){const T=[],D=_/s,L=D*(t-e)+e;for(let F=0;F<=r;F++){const k=F/r,U=k*l+o,N=Math.sin(U),R=Math.cos(U);E.x=L*N,E.y=-D*i+g,E.z=L*R,f.push(E.x,E.y,E.z),b.set(N,A,R).normalize(),h.push(b.x,b.y,b.z),p.push(k,1-D),T.push(m++)}x.push(T)}for(let _=0;_<r;_++)for(let T=0;T<s;T++){const D=x[T][_],L=x[T+1][_],F=x[T+1][_+1],k=x[T][_+1];(e>0||T!==0)&&(d.push(D,L,k),S+=3),(t>0||T!==s-1)&&(d.push(L,F,k),S+=3)}c.addGroup(v,S,0),v+=S}function w(b){const E=m,S=new it,A=new X;let _=0;const T=b===!0?e:t,D=b===!0?1:-1;for(let F=1;F<=r;F++)f.push(0,g*D,0),h.push(0,D,0),p.push(.5,.5),m++;const L=m;for(let F=0;F<=r;F++){const U=F/r*l+o,N=Math.cos(U),R=Math.sin(U);A.x=T*R,A.y=g*D,A.z=T*N,f.push(A.x,A.y,A.z),h.push(0,D,0),S.x=N*.5+.5,S.y=R*.5*D+.5,p.push(S.x,S.y),m++}for(let F=0;F<r;F++){const k=E+F,U=L+F;b===!0?d.push(U,U+1,k):d.push(U+1,U,k),_+=3}c.addGroup(v,_,b===!0?1:2),v+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Md(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const eo=new X,to=new X,Zl=new X,no=new ei;class db extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ys*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),h={},p=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:g,c:v}=no;if(x.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),v.fromBufferAttribute(o,c[2]),no.getNormal(Zl),f[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,f[1]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,f[2]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let y=0;y<3;y++){const w=(y+1)%3,b=f[y],E=f[w],S=no[d[y]],A=no[d[w]],_=`${b}_${E}`,T=`${E}_${b}`;T in h&&h[T]?(Zl.dot(h[T].normal)<=s&&(p.push(S.x,S.y,S.z),p.push(A.x,A.y,A.z)),h[T]=null):_ in h||(h[_]={index0:c[y],index1:c[w],normal:Zl.clone()})}}for(const m in h)if(h[m]){const{index0:x,index1:g}=h[m];eo.fromBufferAttribute(o,x),to.fromBufferAttribute(o,g),p.push(eo.x,eo.y,eo.z),p.push(to.x,to.y,to.z)}this.setAttribute("position",new sn(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ds extends on{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,h=t/l,p=[],m=[],x=[],g=[];for(let v=0;v<d;v++){const y=v*h-a;for(let w=0;w<c;w++){const b=w*f-s;m.push(b,-y,0),x.push(0,0,1),g.push(w/o),g.push(1-v/l)}}for(let v=0;v<l;v++)for(let y=0;y<o;y++){const w=y+c*v,b=y+c*(v+1),E=y+1+c*(v+1),S=y+1+c*v;p.push(w,b,S),p.push(b,E,S)}this.setIndex(p),this.setAttribute("position",new sn(m,3)),this.setAttribute("normal",new sn(x,3)),this.setAttribute("uv",new sn(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class hb extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new X,s=new X;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],h=f.start,p=f.count;for(let m=h,x=h+p;m<x;m+=3)for(let g=0;g<3;g++){const v=o.getX(m+g),y=o.getX(m+(g+1)%3);r.fromBufferAttribute(a,v),s.fromBufferAttribute(a,y),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new sn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Vh(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}function As(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Hh(r))r.isRenderTargetTexture?(ft("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Hh(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function zn(n){const e={};for(let t=0;t<n.length;t++){const i=As(n[t]);for(const r in i)e[r]=i[r]}return e}function Hh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function fb(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function bm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:At.workingColorSpace}const Di={clone:As,merge:zn};var pb=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,mb=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
-
}`;class _n extends yi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=pb,this.fragmentShader=mb,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=As(e.uniforms),this.uniformsGroups=fb(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ym extends _n{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Sm extends yi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new tt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Go,this.normalScale=new it(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class gr extends Sm{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new it(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return gt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new tt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new tt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new tt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class gb extends yi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Go,this.normalScale=new it(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class vb extends yi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=lx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class _b extends yi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Gh={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(Wh(n)||(this.files[n]=e))},get:function(n){if(this.enabled!==!1&&!Wh(n))return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};function Wh(n){try{const e=n.slice(n.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class xb{constructor(e,t,i){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(d){o++,s===!1&&r.onStart!==void 0&&r.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,r.onProgress!==void 0&&r.onProgress(d,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,f){return c.push(d,f),this},this.removeHandler=function(d){const f=c.indexOf(d);return f!==-1&&c.splice(f,2),this},this.getHandler=function(d){for(let f=0,h=c.length;f<h;f+=2){const p=c[f],g=c[f+1];if(p.global&&(p.lastIndex=0),p.test(d))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const bb=new xb;class wd{constructor(e){this.manager=e!==void 0?e:bb,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}wd.DEFAULT_MATERIAL_NAME="__DEFAULT";const Wi={};class yb extends Error{constructor(e,t){super(e),this.response=t}}class Sb extends wd{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Gh.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0);return}if(Wi[e]!==void 0){Wi[e].push({onLoad:t,onProgress:i,onError:r});return}Wi[e]=[],Wi[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&ft("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Wi[e],f=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,g=p!==0;let x=0;const m=new ReadableStream({start(v){y();function y(){f.read().then(({done:w,value:b})=>{if(w)v.close();else{x+=b.byteLength;const E=new ProgressEvent("progress",{lengthComputable:g,loaded:x,total:p});for(let S=0,A=d.length;S<A;S++){const _=d[S];_.onProgress&&_.onProgress(E)}v.enqueue(b),y()}},w=>{v.error(w)})}}});return new Response(m)}else throw new yb(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,o));case"json":return c.json();default:if(o==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Gh.add(`file:${e}`,c);const d=Wi[e];delete Wi[e];for(let f=0,h=d.length;f<h;f++){const p=d[f];p.onLoad&&p.onLoad(c)}}).catch(c=>{const d=Wi[e];if(d===void 0)throw this.manager.itemError(e),c;delete Wi[e];for(let f=0,h=d.length;f<h;f++){const p=d[f];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Mb extends wd{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new cl,o=new Sb(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(d){r!==void 0?r(d):Tt(d);return}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:_i,a.wrapT=c.wrapT!==void 0?c.wrapT:_i,a.magFilter=c.magFilter!==void 0?c.magFilter:hn,a.minFilter=c.minFilter!==void 0?c.minFilter:hn,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=lr),c.mipmapCount===1&&(a.minFilter=hn),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},i,r),a}}class Ed extends rn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const $l=new Lt,Xh=new X,jh=new X;class wb{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new it(512,512),this.mapType=qn,this.map=null,this.mapPass=null,this.matrix=new Lt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Sd,this._frameExtents=new it(1,1),this._viewportCount=1,this._viewports=[new kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Xh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Xh),jh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(jh),t.updateMatrixWorld(),$l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($l,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===la||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply($l)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const io=new X,ro=new xi,Ei=new X;class Td extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Lt,this.projectionMatrix=new Lt,this.projectionMatrixInverse=new Lt,this.coordinateSystem=Ni,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(io,ro,Ei),Ei.x===1&&Ei.y===1&&Ei.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(io,ro,Ei.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(io,ro,Ei),Ei.x===1&&Ei.y===1&&Ei.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(io,ro,Ei.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const rr=new X,qh=new it,Yh=new it;class oi extends Td{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ca*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ys*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ca*2*Math.atan(Math.tan(ys*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){rr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(rr.x,rr.y).multiplyScalar(-e/rr.z),rr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(rr.x,rr.y).multiplyScalar(-e/rr.z)}getViewSize(e,t){return this.getViewBounds(e,qh,Yh),t.subVectors(Yh,qh)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ys*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Fr extends Td{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Eb extends wb{constructor(){super(new Fr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Tb extends Ed{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.shadow=new Eb}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Ab extends Ed{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Cb extends on{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}const ns=-90,is=1;class Pb extends rn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new oi(ns,is,e,t);r.layers=this.layers,this.add(r);const s=new oi(ns,is,e,t);s.layers=this.layers,this.add(s);const a=new oi(ns,is,e,t);a.layers=this.layers,this.add(a);const o=new oi(ns,is,e,t);o.layers=this.layers,this.add(o);const l=new oi(ns,is,e,t);l.layers=this.layers,this.add(l);const c=new oi(ns,is,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Ni)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===la)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(f,h,p),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class Rb extends oi{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Db{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Lb.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Lb(){this._document.hidden===!1&&this.reset()}class cu extends mm{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const Kh=new Lt;class ul{constructor(e,t,i=0,r=1/0){this.ray=new ba(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new bd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Tt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Kh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Kh),this}intersectObject(e,t=!0,i=[]){return uu(e,this,i,t),i.sort(Zh),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)uu(e[r],this,i,t);return i.sort(Zh),i}}function Zh(n,e){return n.distance-e.distance}function uu(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let a=0,o=s.length;a<o;a++)uu(s[a],e,t,!0)}}class $h{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=gt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(gt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Qd=class Qd{constructor(e,t,i,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}};Qd.prototype.isMatrix2=!0;let Jh=Qd;const Qh=new X,so=new X,rs=new X,ss=new X,Jl=new X,Ib=new X,Nb=new X;class Ub{constructor(e=new X,t=new X){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Qh.subVectors(e,this.start),so.subVectors(this.end,this.start);const i=so.dot(so);if(i===0)return 0;let s=so.dot(Qh)/i;return t&&(s=gt(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Ib,i=Nb){const r=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,d=e.end;rs.subVectors(c,o),ss.subVectors(d,l),Jl.subVectors(o,l);const f=rs.dot(rs),h=ss.dot(ss),p=ss.dot(Jl);if(f<=r&&h<=r)return t.copy(o),i.copy(l),t.sub(i),t.dot(t);if(f<=r)s=0,a=p/h,a=gt(a,0,1);else{const g=rs.dot(Jl);if(h<=r)a=0,s=gt(-g/f,0,1);else{const x=rs.dot(ss),m=f*h-x*x;m!==0?s=gt((x*p-g*h)/m,0,1):s=0,a=(x*s+p)/h,a<0?(a=0,s=gt(-g/f,0,1)):a>1&&(a=1,s=gt((x-g)/f,0,1))}}return t.copy(o).addScaledVector(rs,s),i.copy(l).addScaledVector(ss,a),t.distanceToSquared(i)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Fb extends mr{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){ft("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function ef(n,e,t,i){const r=Ob(i);switch(t){case am:return n*e;case lm:return n*e/r.components*r.byteLength;case fd:return n*e/r.components*r.byteLength;case Ir:return n*e*2/r.components*r.byteLength;case pd:return n*e*2/r.components*r.byteLength;case om:return n*e*3/r.components*r.byteLength;case li:return n*e*4/r.components*r.byteLength;case md:return n*e*4/r.components*r.byteLength;case To:case Ao:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Co:case Po:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Dc:case Ic:return Math.max(n,16)*Math.max(e,8)/4;case Rc:case Lc:return Math.max(n,8)*Math.max(e,8)/2;case Nc:case Uc:case Oc:case zc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Fc:case Vo:case Bc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case kc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Vc:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Hc:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Gc:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Wc:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Xc:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case jc:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case qc:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Yc:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Kc:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Zc:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case $c:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Jc:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Qc:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case eu:case tu:case nu:return Math.ceil(n/4)*Math.ceil(e/4)*16;case iu:case ru:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Ho:case su:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Ob(n){switch(n){case qn:case nm:return{byteLength:1,components:1};case aa:case im:case Fn:return{byteLength:2,components:1};case dd:case hd:return{byteLength:2,components:4};case Oi:case ud:case ti:return{byteLength:4,components:1};case rm:case sm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:id}}));typeof window<"u"&&(window.__THREE__?ft("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=id);function Mm(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&n!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function zb(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,d),o.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function i(o,l,c){const d=l.array,f=l.updateRanges;if(n.bindBuffer(c,o),f.length===0)n.bufferSubData(c,0,d);else{f.sort((p,g)=>p.start-g.start);let h=0;for(let p=1;p<f.length;p++){const g=f[h],x=f[p];x.start<=g.start+g.count+1?g.count=Math.max(g.count,x.start+x.count-g.start):(++h,f[h]=x)}f.length=h+1;for(let p=0,g=f.length;p<g;p++){const x=f[p];n.bufferSubData(c,x.start*d.BYTES_PER_ELEMENT,d,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Bb=`#ifdef USE_ALPHAHASH
|
|
5
|
+
}`;class _n extends yi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=pb,this.fragmentShader=mb,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=As(e.uniforms),this.uniformsGroups=fb(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ym extends _n{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Sm extends yi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new tt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Go,this.normalScale=new it(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class gr extends Sm{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new it(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return gt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new tt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new tt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new tt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class gb extends yi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Go,this.normalScale=new it(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class vb extends yi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=lx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class _b extends yi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Gh={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(Wh(n)||(this.files[n]=e))},get:function(n){if(this.enabled!==!1&&!Wh(n))return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};function Wh(n){try{const e=n.slice(n.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class xb{constructor(e,t,i){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(d){o++,s===!1&&r.onStart!==void 0&&r.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,r.onProgress!==void 0&&r.onProgress(d,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,f){return c.push(d,f),this},this.removeHandler=function(d){const f=c.indexOf(d);return f!==-1&&c.splice(f,2),this},this.getHandler=function(d){for(let f=0,h=c.length;f<h;f+=2){const p=c[f],m=c[f+1];if(p.global&&(p.lastIndex=0),p.test(d))return m}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const bb=new xb;class wd{constructor(e){this.manager=e!==void 0?e:bb,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}wd.DEFAULT_MATERIAL_NAME="__DEFAULT";const Wi={};class yb extends Error{constructor(e,t){super(e),this.response=t}}class Sb extends wd{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Gh.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0);return}if(Wi[e]!==void 0){Wi[e].push({onLoad:t,onProgress:i,onError:r});return}Wi[e]=[],Wi[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&ft("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Wi[e],f=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,m=p!==0;let x=0;const g=new ReadableStream({start(v){y();function y(){f.read().then(({done:w,value:b})=>{if(w)v.close();else{x+=b.byteLength;const E=new ProgressEvent("progress",{lengthComputable:m,loaded:x,total:p});for(let S=0,A=d.length;S<A;S++){const _=d[S];_.onProgress&&_.onProgress(E)}v.enqueue(b),y()}},w=>{v.error(w)})}}});return new Response(g)}else throw new yb(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,o));case"json":return c.json();default:if(o==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Gh.add(`file:${e}`,c);const d=Wi[e];delete Wi[e];for(let f=0,h=d.length;f<h;f++){const p=d[f];p.onLoad&&p.onLoad(c)}}).catch(c=>{const d=Wi[e];if(d===void 0)throw this.manager.itemError(e),c;delete Wi[e];for(let f=0,h=d.length;f<h;f++){const p=d[f];p.onError&&p.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Mb extends wd{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new cl,o=new Sb(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(d){r!==void 0?r(d):Tt(d);return}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:_i,a.wrapT=c.wrapT!==void 0?c.wrapT:_i,a.magFilter=c.magFilter!==void 0?c.magFilter:hn,a.minFilter=c.minFilter!==void 0?c.minFilter:hn,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=lr),c.mipmapCount===1&&(a.minFilter=hn),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},i,r),a}}class Ed extends rn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const $l=new Lt,Xh=new X,jh=new X;class wb{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new it(512,512),this.mapType=qn,this.map=null,this.mapPass=null,this.matrix=new Lt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Sd,this._frameExtents=new it(1,1),this._viewportCount=1,this._viewports=[new kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Xh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Xh),jh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(jh),t.updateMatrixWorld(),$l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($l,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===la||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply($l)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const io=new X,ro=new xi,Ei=new X;class Td extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Lt,this.projectionMatrix=new Lt,this.projectionMatrixInverse=new Lt,this.coordinateSystem=Ni,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(io,ro,Ei),Ei.x===1&&Ei.y===1&&Ei.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(io,ro,Ei.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(io,ro,Ei),Ei.x===1&&Ei.y===1&&Ei.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(io,ro,Ei.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const rr=new X,qh=new it,Yh=new it;class oi extends Td{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ca*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ys*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ca*2*Math.atan(Math.tan(ys*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){rr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(rr.x,rr.y).multiplyScalar(-e/rr.z),rr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(rr.x,rr.y).multiplyScalar(-e/rr.z)}getViewSize(e,t){return this.getViewBounds(e,qh,Yh),t.subVectors(Yh,qh)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ys*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Fr extends Td{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Eb extends wb{constructor(){super(new Fr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Tb extends Ed{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.shadow=new Eb}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Ab extends Ed{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Cb extends on{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}const ns=-90,is=1;class Pb extends rn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new oi(ns,is,e,t);r.layers=this.layers,this.add(r);const s=new oi(ns,is,e,t);s.layers=this.layers,this.add(s);const a=new oi(ns,is,e,t);a.layers=this.layers,this.add(a);const o=new oi(ns,is,e,t);o.layers=this.layers,this.add(o);const l=new oi(ns,is,e,t);l.layers=this.layers,this.add(l);const c=new oi(ns,is,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Ni)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===la)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(f,h,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class Rb extends oi{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Db{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Lb.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Lb(){this._document.hidden===!1&&this.reset()}class cu extends mm{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const Kh=new Lt;class ul{constructor(e,t,i=0,r=1/0){this.ray=new ba(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new bd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Tt("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Kh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Kh),this}intersectObject(e,t=!0,i=[]){return uu(e,this,i,t),i.sort(Zh),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)uu(e[r],this,i,t);return i.sort(Zh),i}}function Zh(n,e){return n.distance-e.distance}function uu(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){const s=n.children;for(let a=0,o=s.length;a<o;a++)uu(s[a],e,t,!0)}}class $h{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=gt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(gt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Qd=class Qd{constructor(e,t,i,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}};Qd.prototype.isMatrix2=!0;let Jh=Qd;const Qh=new X,so=new X,rs=new X,ss=new X,Jl=new X,Ib=new X,Nb=new X;class Ub{constructor(e=new X,t=new X){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Qh.subVectors(e,this.start),so.subVectors(this.end,this.start);const i=so.dot(so);if(i===0)return 0;let s=so.dot(Qh)/i;return t&&(s=gt(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Ib,i=Nb){const r=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,d=e.end;rs.subVectors(c,o),ss.subVectors(d,l),Jl.subVectors(o,l);const f=rs.dot(rs),h=ss.dot(ss),p=ss.dot(Jl);if(f<=r&&h<=r)return t.copy(o),i.copy(l),t.sub(i),t.dot(t);if(f<=r)s=0,a=p/h,a=gt(a,0,1);else{const m=rs.dot(Jl);if(h<=r)a=0,s=gt(-m/f,0,1);else{const x=rs.dot(ss),g=f*h-x*x;g!==0?s=gt((x*p-m*h)/g,0,1):s=0,a=(x*s+p)/h,a<0?(a=0,s=gt(-m/f,0,1)):a>1&&(a=1,s=gt((x-m)/f,0,1))}}return t.copy(o).addScaledVector(rs,s),i.copy(l).addScaledVector(ss,a),t.distanceToSquared(i)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Fb extends mr{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){ft("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function ef(n,e,t,i){const r=Ob(i);switch(t){case am:return n*e;case lm:return n*e/r.components*r.byteLength;case fd:return n*e/r.components*r.byteLength;case Ir:return n*e*2/r.components*r.byteLength;case pd:return n*e*2/r.components*r.byteLength;case om:return n*e*3/r.components*r.byteLength;case li:return n*e*4/r.components*r.byteLength;case md:return n*e*4/r.components*r.byteLength;case To:case Ao:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Co:case Po:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Dc:case Ic:return Math.max(n,16)*Math.max(e,8)/4;case Rc:case Lc:return Math.max(n,8)*Math.max(e,8)/2;case Nc:case Uc:case Oc:case zc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Fc:case Vo:case Bc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case kc:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Vc:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Hc:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Gc:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Wc:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Xc:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case jc:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case qc:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Yc:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Kc:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Zc:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case $c:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Jc:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Qc:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case eu:case tu:case nu:return Math.ceil(n/4)*Math.ceil(e/4)*16;case iu:case ru:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Ho:case su:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Ob(n){switch(n){case qn:case nm:return{byteLength:1,components:1};case aa:case im:case Fn:return{byteLength:2,components:1};case dd:case hd:return{byteLength:2,components:4};case Oi:case ud:case ti:return{byteLength:4,components:1};case rm:case sm:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:id}}));typeof window<"u"&&(window.__THREE__?ft("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=id);function Mm(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&n!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function zb(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,d),o.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function i(o,l,c){const d=l.array,f=l.updateRanges;if(n.bindBuffer(c,o),f.length===0)n.bufferSubData(c,0,d);else{f.sort((p,m)=>p.start-m.start);let h=0;for(let p=1;p<f.length;p++){const m=f[h],x=f[p];x.start<=m.start+m.count+1?m.count=Math.max(m.count,x.start+x.count-m.start):(++h,f[h]=x)}f.length=h+1;for(let p=0,m=f.length;p<m;p++){const x=f[p];n.bufferSubData(c,x.start*d.BYTES_PER_ELEMENT,d,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Bb=`#ifdef USE_ALPHAHASH
|
|
6
6
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
7
7
|
#endif`,kb=`#ifdef USE_ALPHAHASH
|
|
8
8
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -2885,7 +2885,7 @@ void main() {
|
|
|
2885
2885
|
#include <worldpos_vertex>
|
|
2886
2886
|
#include <envmap_vertex>
|
|
2887
2887
|
#include <fog_vertex>
|
|
2888
|
-
}`,
|
|
2888
|
+
}`,eM=`uniform vec3 diffuse;
|
|
2889
2889
|
uniform float opacity;
|
|
2890
2890
|
#ifndef FLAT_SHADED
|
|
2891
2891
|
varying vec3 vNormal;
|
|
@@ -2933,7 +2933,7 @@ void main() {
|
|
|
2933
2933
|
#include <fog_fragment>
|
|
2934
2934
|
#include <premultiplied_alpha_fragment>
|
|
2935
2935
|
#include <dithering_fragment>
|
|
2936
|
-
}`,
|
|
2936
|
+
}`,tM=`#define LAMBERT
|
|
2937
2937
|
varying vec3 vViewPosition;
|
|
2938
2938
|
#include <common>
|
|
2939
2939
|
#include <batching_pars_vertex>
|
|
@@ -2972,7 +2972,7 @@ void main() {
|
|
|
2972
2972
|
#include <envmap_vertex>
|
|
2973
2973
|
#include <shadowmap_vertex>
|
|
2974
2974
|
#include <fog_vertex>
|
|
2975
|
-
}`,
|
|
2975
|
+
}`,nM=`#define LAMBERT
|
|
2976
2976
|
uniform vec3 diffuse;
|
|
2977
2977
|
uniform vec3 emissive;
|
|
2978
2978
|
uniform float opacity;
|
|
@@ -3030,7 +3030,7 @@ void main() {
|
|
|
3030
3030
|
#include <fog_fragment>
|
|
3031
3031
|
#include <premultiplied_alpha_fragment>
|
|
3032
3032
|
#include <dithering_fragment>
|
|
3033
|
-
}`,
|
|
3033
|
+
}`,iM=`#define MATCAP
|
|
3034
3034
|
varying vec3 vViewPosition;
|
|
3035
3035
|
#include <common>
|
|
3036
3036
|
#include <batching_pars_vertex>
|
|
@@ -3064,7 +3064,7 @@ void main() {
|
|
|
3064
3064
|
#include <clipping_planes_vertex>
|
|
3065
3065
|
#include <fog_vertex>
|
|
3066
3066
|
vViewPosition = - mvPosition.xyz;
|
|
3067
|
-
}`,
|
|
3067
|
+
}`,rM=`#define MATCAP
|
|
3068
3068
|
uniform vec3 diffuse;
|
|
3069
3069
|
uniform float opacity;
|
|
3070
3070
|
uniform sampler2D matcap;
|
|
@@ -3110,7 +3110,7 @@ void main() {
|
|
|
3110
3110
|
#include <fog_fragment>
|
|
3111
3111
|
#include <premultiplied_alpha_fragment>
|
|
3112
3112
|
#include <dithering_fragment>
|
|
3113
|
-
}`,
|
|
3113
|
+
}`,sM=`#define NORMAL
|
|
3114
3114
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3115
3115
|
varying vec3 vViewPosition;
|
|
3116
3116
|
#endif
|
|
@@ -3143,7 +3143,7 @@ void main() {
|
|
|
3143
3143
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3144
3144
|
vViewPosition = - mvPosition.xyz;
|
|
3145
3145
|
#endif
|
|
3146
|
-
}`,
|
|
3146
|
+
}`,aM=`#define NORMAL
|
|
3147
3147
|
uniform float opacity;
|
|
3148
3148
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3149
3149
|
varying vec3 vViewPosition;
|
|
@@ -3164,7 +3164,7 @@ void main() {
|
|
|
3164
3164
|
#ifdef OPAQUE
|
|
3165
3165
|
gl_FragColor.a = 1.0;
|
|
3166
3166
|
#endif
|
|
3167
|
-
}`,
|
|
3167
|
+
}`,oM=`#define PHONG
|
|
3168
3168
|
varying vec3 vViewPosition;
|
|
3169
3169
|
#include <common>
|
|
3170
3170
|
#include <batching_pars_vertex>
|
|
@@ -3203,7 +3203,7 @@ void main() {
|
|
|
3203
3203
|
#include <envmap_vertex>
|
|
3204
3204
|
#include <shadowmap_vertex>
|
|
3205
3205
|
#include <fog_vertex>
|
|
3206
|
-
}`,
|
|
3206
|
+
}`,lM=`#define PHONG
|
|
3207
3207
|
uniform vec3 diffuse;
|
|
3208
3208
|
uniform vec3 emissive;
|
|
3209
3209
|
uniform vec3 specular;
|
|
@@ -3263,7 +3263,7 @@ void main() {
|
|
|
3263
3263
|
#include <fog_fragment>
|
|
3264
3264
|
#include <premultiplied_alpha_fragment>
|
|
3265
3265
|
#include <dithering_fragment>
|
|
3266
|
-
}`,
|
|
3266
|
+
}`,cM=`#define STANDARD
|
|
3267
3267
|
varying vec3 vViewPosition;
|
|
3268
3268
|
#ifdef USE_TRANSMISSION
|
|
3269
3269
|
varying vec3 vWorldPosition;
|
|
@@ -3306,7 +3306,7 @@ void main() {
|
|
|
3306
3306
|
#ifdef USE_TRANSMISSION
|
|
3307
3307
|
vWorldPosition = worldPosition.xyz;
|
|
3308
3308
|
#endif
|
|
3309
|
-
}`,
|
|
3309
|
+
}`,uM=`#define STANDARD
|
|
3310
3310
|
#ifdef PHYSICAL
|
|
3311
3311
|
#define IOR
|
|
3312
3312
|
#define USE_SPECULAR
|
|
@@ -3431,7 +3431,7 @@ void main() {
|
|
|
3431
3431
|
#include <fog_fragment>
|
|
3432
3432
|
#include <premultiplied_alpha_fragment>
|
|
3433
3433
|
#include <dithering_fragment>
|
|
3434
|
-
}`,
|
|
3434
|
+
}`,dM=`#define TOON
|
|
3435
3435
|
varying vec3 vViewPosition;
|
|
3436
3436
|
#include <common>
|
|
3437
3437
|
#include <batching_pars_vertex>
|
|
@@ -3468,7 +3468,7 @@ void main() {
|
|
|
3468
3468
|
#include <worldpos_vertex>
|
|
3469
3469
|
#include <shadowmap_vertex>
|
|
3470
3470
|
#include <fog_vertex>
|
|
3471
|
-
}`,
|
|
3471
|
+
}`,hM=`#define TOON
|
|
3472
3472
|
uniform vec3 diffuse;
|
|
3473
3473
|
uniform vec3 emissive;
|
|
3474
3474
|
uniform float opacity;
|
|
@@ -3520,7 +3520,7 @@ void main() {
|
|
|
3520
3520
|
#include <fog_fragment>
|
|
3521
3521
|
#include <premultiplied_alpha_fragment>
|
|
3522
3522
|
#include <dithering_fragment>
|
|
3523
|
-
}`,
|
|
3523
|
+
}`,fM=`uniform float size;
|
|
3524
3524
|
uniform float scale;
|
|
3525
3525
|
#include <common>
|
|
3526
3526
|
#include <color_pars_vertex>
|
|
@@ -3551,7 +3551,7 @@ void main() {
|
|
|
3551
3551
|
#include <clipping_planes_vertex>
|
|
3552
3552
|
#include <worldpos_vertex>
|
|
3553
3553
|
#include <fog_vertex>
|
|
3554
|
-
}`,
|
|
3554
|
+
}`,pM=`uniform vec3 diffuse;
|
|
3555
3555
|
uniform float opacity;
|
|
3556
3556
|
#include <common>
|
|
3557
3557
|
#include <color_pars_fragment>
|
|
@@ -3576,7 +3576,7 @@ void main() {
|
|
|
3576
3576
|
#include <colorspace_fragment>
|
|
3577
3577
|
#include <fog_fragment>
|
|
3578
3578
|
#include <premultiplied_alpha_fragment>
|
|
3579
|
-
}`,
|
|
3579
|
+
}`,mM=`#include <common>
|
|
3580
3580
|
#include <batching_pars_vertex>
|
|
3581
3581
|
#include <fog_pars_vertex>
|
|
3582
3582
|
#include <morphtarget_pars_vertex>
|
|
@@ -3599,7 +3599,7 @@ void main() {
|
|
|
3599
3599
|
#include <worldpos_vertex>
|
|
3600
3600
|
#include <shadowmap_vertex>
|
|
3601
3601
|
#include <fog_vertex>
|
|
3602
|
-
}`,
|
|
3602
|
+
}`,gM=`uniform vec3 color;
|
|
3603
3603
|
uniform float opacity;
|
|
3604
3604
|
#include <common>
|
|
3605
3605
|
#include <fog_pars_fragment>
|
|
@@ -3615,7 +3615,7 @@ void main() {
|
|
|
3615
3615
|
#include <colorspace_fragment>
|
|
3616
3616
|
#include <fog_fragment>
|
|
3617
3617
|
#include <premultiplied_alpha_fragment>
|
|
3618
|
-
}`,
|
|
3618
|
+
}`,vM=`uniform float rotation;
|
|
3619
3619
|
uniform vec2 center;
|
|
3620
3620
|
#include <common>
|
|
3621
3621
|
#include <uv_pars_vertex>
|
|
@@ -3639,7 +3639,7 @@ void main() {
|
|
|
3639
3639
|
#include <logdepthbuf_vertex>
|
|
3640
3640
|
#include <clipping_planes_vertex>
|
|
3641
3641
|
#include <fog_vertex>
|
|
3642
|
-
}`,
|
|
3642
|
+
}`,_M=`uniform vec3 diffuse;
|
|
3643
3643
|
uniform float opacity;
|
|
3644
3644
|
#include <common>
|
|
3645
3645
|
#include <uv_pars_fragment>
|
|
@@ -3664,7 +3664,7 @@ void main() {
|
|
|
3664
3664
|
#include <tonemapping_fragment>
|
|
3665
3665
|
#include <colorspace_fragment>
|
|
3666
3666
|
#include <fog_fragment>
|
|
3667
|
-
}`,St={alphahash_fragment:Bb,alphahash_pars_fragment:kb,alphamap_fragment:Vb,alphamap_pars_fragment:Hb,alphatest_fragment:Gb,alphatest_pars_fragment:Wb,aomap_fragment:Xb,aomap_pars_fragment:jb,batching_pars_vertex:qb,batching_vertex:Yb,begin_vertex:Kb,beginnormal_vertex:Zb,bsdfs:$b,iridescence_fragment:Jb,bumpmap_pars_fragment:Qb,clipping_planes_fragment:ey,clipping_planes_pars_fragment:ty,clipping_planes_pars_vertex:ny,clipping_planes_vertex:iy,color_fragment:ry,color_pars_fragment:sy,color_pars_vertex:ay,color_vertex:oy,common:ly,cube_uv_reflection_fragment:cy,defaultnormal_vertex:uy,displacementmap_pars_vertex:dy,displacementmap_vertex:hy,emissivemap_fragment:fy,emissivemap_pars_fragment:py,colorspace_fragment:my,colorspace_pars_fragment:gy,envmap_fragment:vy,envmap_common_pars_fragment:_y,envmap_pars_fragment:xy,envmap_pars_vertex:by,envmap_physical_pars_fragment:Dy,envmap_vertex:yy,fog_vertex:Sy,fog_pars_vertex:My,fog_fragment:wy,fog_pars_fragment:Ey,gradientmap_pars_fragment:Ty,lightmap_pars_fragment:Ay,lights_lambert_fragment:Cy,lights_lambert_pars_fragment:Py,lights_pars_begin:Ry,lights_toon_fragment:Ly,lights_toon_pars_fragment:Iy,lights_phong_fragment:Ny,lights_phong_pars_fragment:Uy,lights_physical_fragment:Fy,lights_physical_pars_fragment:Oy,lights_fragment_begin:zy,lights_fragment_maps:By,lights_fragment_end:ky,lightprobes_pars_fragment:Vy,logdepthbuf_fragment:Hy,logdepthbuf_pars_fragment:Gy,logdepthbuf_pars_vertex:Wy,logdepthbuf_vertex:Xy,map_fragment:jy,map_pars_fragment:qy,map_particle_fragment:Yy,map_particle_pars_fragment:Ky,metalnessmap_fragment:Zy,metalnessmap_pars_fragment:$y,morphinstance_vertex:Jy,morphcolor_vertex:Qy,morphnormal_vertex:eS,morphtarget_pars_vertex:tS,morphtarget_vertex:nS,normal_fragment_begin:iS,normal_fragment_maps:rS,normal_pars_fragment:sS,normal_pars_vertex:aS,normal_vertex:oS,normalmap_pars_fragment:lS,clearcoat_normal_fragment_begin:cS,clearcoat_normal_fragment_maps:uS,clearcoat_pars_fragment:dS,iridescence_pars_fragment:hS,opaque_fragment:fS,packing:pS,premultiplied_alpha_fragment:mS,project_vertex:gS,dithering_fragment:vS,dithering_pars_fragment:_S,roughnessmap_fragment:xS,roughnessmap_pars_fragment:bS,shadowmap_pars_fragment:yS,shadowmap_pars_vertex:SS,shadowmap_vertex:MS,shadowmask_pars_fragment:wS,skinbase_vertex:ES,skinning_pars_vertex:TS,skinning_vertex:AS,skinnormal_vertex:CS,specularmap_fragment:PS,specularmap_pars_fragment:RS,tonemapping_fragment:DS,tonemapping_pars_fragment:LS,transmission_fragment:IS,transmission_pars_fragment:NS,uv_pars_fragment:US,uv_pars_vertex:FS,uv_vertex:OS,worldpos_vertex:zS,background_vert:BS,background_frag:kS,backgroundCube_vert:VS,backgroundCube_frag:HS,cube_vert:GS,cube_frag:WS,depth_vert:XS,depth_frag:jS,distance_vert:qS,distance_frag:YS,equirect_vert:KS,equirect_frag:ZS,linedashed_vert:$S,linedashed_frag:JS,meshbasic_vert:QS,meshbasic_frag:e1,meshlambert_vert:t1,meshlambert_frag:n1,meshmatcap_vert:i1,meshmatcap_frag:r1,meshnormal_vert:s1,meshnormal_frag:a1,meshphong_vert:o1,meshphong_frag:l1,meshphysical_vert:c1,meshphysical_frag:u1,meshtoon_vert:d1,meshtoon_frag:h1,points_vert:f1,points_frag:p1,shadow_vert:m1,shadow_frag:g1,sprite_vert:v1,sprite_frag:_1},Ke={common:{diffuse:{value:new tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new it(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new X},probesMax:{value:new X},probesResolution:{value:new X}},points:{diffuse:{value:new tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new tt(16777215)},opacity:{value:1},center:{value:new it(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},jn={basic:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.fog]),vertexShader:St.meshbasic_vert,fragmentShader:St.meshbasic_frag},lambert:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},envMapIntensity:{value:1}}]),vertexShader:St.meshlambert_vert,fragmentShader:St.meshlambert_frag},phong:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:St.meshphong_vert,fragmentShader:St.meshphong_frag},standard:{uniforms:zn([Ke.common,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.roughnessmap,Ke.metalnessmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag},toon:{uniforms:zn([Ke.common,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.gradientmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)}}]),vertexShader:St.meshtoon_vert,fragmentShader:St.meshtoon_frag},matcap:{uniforms:zn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,{matcap:{value:null}}]),vertexShader:St.meshmatcap_vert,fragmentShader:St.meshmatcap_frag},points:{uniforms:zn([Ke.points,Ke.fog]),vertexShader:St.points_vert,fragmentShader:St.points_frag},dashed:{uniforms:zn([Ke.common,Ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:St.linedashed_vert,fragmentShader:St.linedashed_frag},depth:{uniforms:zn([Ke.common,Ke.displacementmap]),vertexShader:St.depth_vert,fragmentShader:St.depth_frag},normal:{uniforms:zn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,{opacity:{value:1}}]),vertexShader:St.meshnormal_vert,fragmentShader:St.meshnormal_frag},sprite:{uniforms:zn([Ke.sprite,Ke.fog]),vertexShader:St.sprite_vert,fragmentShader:St.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:St.background_vert,fragmentShader:St.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:St.backgroundCube_vert,fragmentShader:St.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:St.cube_vert,fragmentShader:St.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:St.equirect_vert,fragmentShader:St.equirect_frag},distance:{uniforms:zn([Ke.common,Ke.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:St.distance_vert,fragmentShader:St.distance_frag},shadow:{uniforms:zn([Ke.lights,Ke.fog,{color:{value:new tt(0)},opacity:{value:1}}]),vertexShader:St.shadow_vert,fragmentShader:St.shadow_frag}};jn.physical={uniforms:zn([jn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new it(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new it},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new tt(0)},specularColor:{value:new tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new it},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag};const ao={r:0,b:0,g:0},x1=new Lt,wm=new xt;wm.set(-1,0,0,0,1,0,0,0,1);function b1(n,e,t,i,r,s){const a=new tt(0);let o=r===!0?0:1,l,c,d=null,f=0,h=null;function p(y){let w=y.isScene===!0?y.background:null;if(w&&w.isTexture){const b=y.backgroundBlurriness>0;w=e.get(w,b)}return w}function g(y){let w=!1;const b=p(y);b===null?m(a,o):b&&b.isColor&&(m(b,1),w=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,s):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function x(y,w){const b=p(w);b&&(b.isCubeTexture||b.mapping===ll)?(c===void 0&&(c=new an(new ya(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:As(jn.backgroundCube.uniforms),vertexShader:jn.backgroundCube.vertexShader,fragmentShader:jn.backgroundCube.fragmentShader,side:Yn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(E,S,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(x1.makeRotationFromEuler(w.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(wm),c.material.toneMapped=At.getTransfer(b.colorSpace)!==Ut,(d!==b||f!==b.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=b,f=b.version,h=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new an(new Ds(2,2),new _n({name:"BackgroundMaterial",uniforms:As(jn.background.uniforms),vertexShader:jn.background.vertexShader,fragmentShader:jn.background.fragmentShader,side:Kn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=At.getTransfer(b.colorSpace)!==Ut,b.matrixAutoUpdate===!0&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),(d!==b||f!==b.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=b,f=b.version,h=n.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function m(y,w){y.getRGB(ao,bm(n)),t.buffers.color.setClear(ao.r,ao.g,ao.b,w,s)}function v(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(y,w=1){a.set(y),o=w,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(y){o=y,m(a,o)},render:g,addToRenderList:x,dispose:v}}function y1(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,a=!1;function o(L,F,B,U,N){let R=!1;const z=f(L,U,B,F);s!==z&&(s=z,c(s.object)),R=p(L,U,B,N),R&&g(L,U,B,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(R||a)&&(a=!1,b(L,F,B,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(L){return n.bindVertexArray(L)}function d(L){return n.deleteVertexArray(L)}function f(L,F,B,U){const N=U.wireframe===!0;let R=i[F.id];R===void 0&&(R={},i[F.id]=R);const z=L.isInstancedMesh===!0?L.id:0;let Y=R[z];Y===void 0&&(Y={},R[z]=Y);let K=Y[B.id];K===void 0&&(K={},Y[B.id]=K);let ne=K[N];return ne===void 0&&(ne=h(l()),K[N]=ne),ne}function h(L){const F=[],B=[],U=[];for(let N=0;N<t;N++)F[N]=0,B[N]=0,U[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:B,attributeDivisors:U,object:L,attributes:{},index:null}}function p(L,F,B,U){const N=s.attributes,R=F.attributes;let z=0;const Y=B.getAttributes();for(const K in Y)if(Y[K].location>=0){const ce=N[K];let V=R[K];if(V===void 0&&(K==="instanceMatrix"&&L.instanceMatrix&&(V=L.instanceMatrix),K==="instanceColor"&&L.instanceColor&&(V=L.instanceColor)),ce===void 0||ce.attribute!==V||V&&ce.data!==V.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function g(L,F,B,U){const N={},R=F.attributes;let z=0;const Y=B.getAttributes();for(const K in Y)if(Y[K].location>=0){let ce=R[K];ce===void 0&&(K==="instanceMatrix"&&L.instanceMatrix&&(ce=L.instanceMatrix),K==="instanceColor"&&L.instanceColor&&(ce=L.instanceColor));const V={};V.attribute=ce,ce&&ce.data&&(V.data=ce.data),N[K]=V,z++}s.attributes=N,s.attributesNum=z,s.index=U}function x(){const L=s.newAttributes;for(let F=0,B=L.length;F<B;F++)L[F]=0}function m(L){v(L,0)}function v(L,F){const B=s.newAttributes,U=s.enabledAttributes,N=s.attributeDivisors;B[L]=1,U[L]===0&&(n.enableVertexAttribArray(L),U[L]=1),N[L]!==F&&(n.vertexAttribDivisor(L,F),N[L]=F)}function y(){const L=s.newAttributes,F=s.enabledAttributes;for(let B=0,U=F.length;B<U;B++)F[B]!==L[B]&&(n.disableVertexAttribArray(B),F[B]=0)}function w(L,F,B,U,N,R,z){z===!0?n.vertexAttribIPointer(L,F,B,N,R):n.vertexAttribPointer(L,F,B,U,N,R)}function b(L,F,B,U){x();const N=U.attributes,R=B.getAttributes(),z=F.defaultAttributeValues;for(const Y in R){const K=R[Y];if(K.location>=0){let ne=N[Y];if(ne===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(ne=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(ne=L.instanceColor)),ne!==void 0){const ce=ne.normalized,V=ne.itemSize,ee=e.get(ne);if(ee===void 0)continue;const me=ee.buffer,ve=ee.type,G=ee.bytesPerElement,ie=ve===n.INT||ve===n.UNSIGNED_INT||ne.gpuType===ud;if(ne.isInterleavedBufferAttribute){const Z=ne.data,le=Z.stride,fe=ne.offset;if(Z.isInstancedInterleavedBuffer){for(let Se=0;Se<K.locationSize;Se++)v(K.location+Se,Z.meshPerAttribute);L.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let Se=0;Se<K.locationSize;Se++)m(K.location+Se);n.bindBuffer(n.ARRAY_BUFFER,me);for(let Se=0;Se<K.locationSize;Se++)w(K.location+Se,V/K.locationSize,ve,ce,le*G,(fe+V/K.locationSize*Se)*G,ie)}else{if(ne.isInstancedBufferAttribute){for(let Z=0;Z<K.locationSize;Z++)v(K.location+Z,ne.meshPerAttribute);L.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Z=0;Z<K.locationSize;Z++)m(K.location+Z);n.bindBuffer(n.ARRAY_BUFFER,me);for(let Z=0;Z<K.locationSize;Z++)w(K.location+Z,V/K.locationSize,ve,ce,V*G,V/K.locationSize*Z*G,ie)}}else if(z!==void 0){const ce=z[Y];if(ce!==void 0)switch(ce.length){case 2:n.vertexAttrib2fv(K.location,ce);break;case 3:n.vertexAttrib3fv(K.location,ce);break;case 4:n.vertexAttrib4fv(K.location,ce);break;default:n.vertexAttrib1fv(K.location,ce)}}}}y()}function E(){T();for(const L in i){const F=i[L];for(const B in F){const U=F[B];for(const N in U){const R=U[N];for(const z in R)d(R[z].object),delete R[z];delete U[N]}}delete i[L]}}function S(L){if(i[L.id]===void 0)return;const F=i[L.id];for(const B in F){const U=F[B];for(const N in U){const R=U[N];for(const z in R)d(R[z].object),delete R[z];delete U[N]}}delete i[L.id]}function A(L){for(const F in i){const B=i[F];for(const U in B){const N=B[U];if(N[L.id]===void 0)continue;const R=N[L.id];for(const z in R)d(R[z].object),delete R[z];delete N[L.id]}}}function _(L){for(const F in i){const B=i[F],U=L.isInstancedMesh===!0?L.id:0,N=B[U];if(N!==void 0){for(const R in N){const z=N[R];for(const Y in z)d(z[Y].object),delete z[Y];delete N[R]}delete B[U],Object.keys(B).length===0&&delete i[F]}}}function T(){D(),a=!0,s!==r&&(s=r,c(s.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:T,resetDefaultState:D,dispose:E,releaseStatesOfGeometry:S,releaseStatesOfObject:_,releaseStatesOfProgram:A,initAttributes:x,enableAttribute:m,disableUnusedAttributes:y}}function S1(n,e,t){let i;function r(l){i=l}function s(l,c){n.drawArrays(i,l,c),t.update(c,i,1)}function a(l,c,d){d!==0&&(n.drawArraysInstanced(i,l,c,d),t.update(c,i,d))}function o(l,c,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,d);let h=0;for(let p=0;p<d;p++)h+=c[p];t.update(h,i,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function M1(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){return!(A!==li&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const _=A===Fn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==qn&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==ti&&!_)}function l(A){if(A==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(ft("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&ft("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),v=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),E=n.getParameter(n.MAX_SAMPLES),S=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:x,maxCubemapSize:m,maxAttributes:v,maxVertexUniforms:y,maxVaryings:w,maxFragmentUniforms:b,maxSamples:E,samples:S}}function w1(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new sr,o=new xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=d(f,h,0)},this.setState=function(f,h,p){const g=f.clippingPlanes,x=f.clipIntersection,m=f.clipShadows,v=n.get(f);if(!r||g===null||g.length===0||s&&!m)s?d(null):c();else{const y=s?0:i,w=y*4;let b=v.clippingState||null;l.value=b,b=d(g,h,w,p);for(let E=0;E!==w;++E)b[E]=t[E];v.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(f,h,p,g){const x=f!==null?f.length:0;let m=null;if(x!==0){if(m=l.value,g!==!0||m===null){const v=p+x*4,y=h.matrixWorldInverse;o.getNormalMatrix(y),(m===null||m.length<v)&&(m=new Float32Array(v));for(let w=0,b=p;w!==x;++w,b+=4)a.copy(f[w]).applyMatrix4(y,o),a.normal.toArray(m,b),m[b+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,m}}const ur=4,tf=[.125,.215,.35,.446,.526,.582],yr=20,E1=256,Ws=new Fr,nf=new tt;let Ql=null,ec=0,tc=0,nc=!1;const T1=new X;class rf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){const{size:a=256,position:o=T1}=s;Ql=this._renderer.getRenderTarget(),ec=this._renderer.getActiveCubeFace(),tc=this._renderer.getActiveMipmapLevel(),nc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=of(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=af(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ql,ec,tc),this._renderer.xr.enabled=nc,e.scissorTest=!1,as(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Dr||e.mapping===Es?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ql=this._renderer.getRenderTarget(),ec=this._renderer.getActiveCubeFace(),tc=this._renderer.getActiveMipmapLevel(),nc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:hn,minFilter:hn,generateMipmaps:!1,type:Fn,format:li,colorSpace:oa,depthBuffer:!1},r=sf(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sf(e,t,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=A1(s)),this._blurMaterial=P1(s,e,t),this._ggxMaterial=C1(s,e,t)}return r}_compileMaterial(e){const t=new an(new on,e);this._renderer.compile(t,Ws)}_sceneToCubeUV(e,t,i,r,s){const l=new oi(90,1,t,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,p=f.toneMapping;f.getClearColor(nf),f.toneMapping=Fi,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new an(new ya,new yd({name:"PMREM.Background",side:Yn,depthWrite:!1,depthTest:!1})));const x=this._backgroundBox,m=x.material;let v=!1;const y=e.background;y?y.isColor&&(m.color.copy(y),e.background=null,v=!0):(m.color.copy(nf),v=!0);for(let w=0;w<6;w++){const b=w%3;b===0?(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[w],s.y,s.z)):b===1?(l.up.set(0,0,c[w]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[w],s.z)):(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[w]));const E=this._cubeSize;as(r,b*E,w>2?E:0,E,E),f.setRenderTarget(r),v&&f.render(x,l),f.render(e,l)}f.toneMapping=p,f.autoClear=h,e.background=y}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Dr||e.mapping===Es;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=of()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=af());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;as(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,Ws)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;const l=a.uniforms,c=i/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-d*d),h=0+c*1.25,p=f*h,{_lodMax:g}=this,x=this._sizeLods[i],m=3*x*(i>g-ur?i-g+ur:0),v=4*(this._cubeSize-x);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=g-t,as(s,m,v,3*x,2*x),r.setRenderTarget(s),r.render(o,Ws),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-i,as(e,m,v,3*x,2*x),r.setRenderTarget(e),r.render(o,Ws)}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Tt("blur direction must be either latitudinal or longitudinal!");const d=3,f=this._lodMeshes[r];f.material=c;const h=c.uniforms,p=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*yr-1),x=s/g,m=isFinite(s)?1+Math.floor(d*x):yr;m>yr&&ft(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${yr}`);const v=[];let y=0;for(let A=0;A<yr;++A){const _=A/x,T=Math.exp(-_*_/2);v.push(T),A===0?y+=T:A<m&&(y+=2*T)}for(let A=0;A<v.length;A++)v[A]=v[A]/y;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=v,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:w}=this;h.dTheta.value=g,h.mipInt.value=w-i;const b=this._sizeLods[r],E=3*b*(r>w-ur?r-w+ur:0),S=4*(this._cubeSize-b);as(t,E,S,3*b,2*b),l.setRenderTarget(t),l.render(f,Ws)}}function A1(n){const e=[],t=[],i=[];let r=n;const s=n-ur+1+tf.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>n-ur?l=tf[a-n+ur-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,f=1+c,h=[d,d,f,d,f,f,d,d,f,f,d,f],p=6,g=6,x=3,m=2,v=1,y=new Float32Array(x*g*p),w=new Float32Array(m*g*p),b=new Float32Array(v*g*p);for(let S=0;S<p;S++){const A=S%3*2/3-1,_=S>2?0:-1,T=[A,_,0,A+2/3,_,0,A+2/3,_+1,0,A,_,0,A+2/3,_+1,0,A,_+1,0];y.set(T,x*g*S),w.set(h,m*g*S);const D=[S,S,S,S,S,S];b.set(D,v*g*S)}const E=new on;E.setAttribute("position",new kn(y,x)),E.setAttribute("uv",new kn(w,m)),E.setAttribute("faceIndex",new kn(b,v)),i.push(new an(E,null)),r>ur&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function sf(n,e,t){const i=new ni(n,e,t);return i.texture.mapping=ll,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function as(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function C1(n,e,t){return new _n({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:E1,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:dl(),fragmentShader:`
|
|
3667
|
+
}`,St={alphahash_fragment:Bb,alphahash_pars_fragment:kb,alphamap_fragment:Vb,alphamap_pars_fragment:Hb,alphatest_fragment:Gb,alphatest_pars_fragment:Wb,aomap_fragment:Xb,aomap_pars_fragment:jb,batching_pars_vertex:qb,batching_vertex:Yb,begin_vertex:Kb,beginnormal_vertex:Zb,bsdfs:$b,iridescence_fragment:Jb,bumpmap_pars_fragment:Qb,clipping_planes_fragment:ey,clipping_planes_pars_fragment:ty,clipping_planes_pars_vertex:ny,clipping_planes_vertex:iy,color_fragment:ry,color_pars_fragment:sy,color_pars_vertex:ay,color_vertex:oy,common:ly,cube_uv_reflection_fragment:cy,defaultnormal_vertex:uy,displacementmap_pars_vertex:dy,displacementmap_vertex:hy,emissivemap_fragment:fy,emissivemap_pars_fragment:py,colorspace_fragment:my,colorspace_pars_fragment:gy,envmap_fragment:vy,envmap_common_pars_fragment:_y,envmap_pars_fragment:xy,envmap_pars_vertex:by,envmap_physical_pars_fragment:Dy,envmap_vertex:yy,fog_vertex:Sy,fog_pars_vertex:My,fog_fragment:wy,fog_pars_fragment:Ey,gradientmap_pars_fragment:Ty,lightmap_pars_fragment:Ay,lights_lambert_fragment:Cy,lights_lambert_pars_fragment:Py,lights_pars_begin:Ry,lights_toon_fragment:Ly,lights_toon_pars_fragment:Iy,lights_phong_fragment:Ny,lights_phong_pars_fragment:Uy,lights_physical_fragment:Fy,lights_physical_pars_fragment:Oy,lights_fragment_begin:zy,lights_fragment_maps:By,lights_fragment_end:ky,lightprobes_pars_fragment:Vy,logdepthbuf_fragment:Hy,logdepthbuf_pars_fragment:Gy,logdepthbuf_pars_vertex:Wy,logdepthbuf_vertex:Xy,map_fragment:jy,map_pars_fragment:qy,map_particle_fragment:Yy,map_particle_pars_fragment:Ky,metalnessmap_fragment:Zy,metalnessmap_pars_fragment:$y,morphinstance_vertex:Jy,morphcolor_vertex:Qy,morphnormal_vertex:eS,morphtarget_pars_vertex:tS,morphtarget_vertex:nS,normal_fragment_begin:iS,normal_fragment_maps:rS,normal_pars_fragment:sS,normal_pars_vertex:aS,normal_vertex:oS,normalmap_pars_fragment:lS,clearcoat_normal_fragment_begin:cS,clearcoat_normal_fragment_maps:uS,clearcoat_pars_fragment:dS,iridescence_pars_fragment:hS,opaque_fragment:fS,packing:pS,premultiplied_alpha_fragment:mS,project_vertex:gS,dithering_fragment:vS,dithering_pars_fragment:_S,roughnessmap_fragment:xS,roughnessmap_pars_fragment:bS,shadowmap_pars_fragment:yS,shadowmap_pars_vertex:SS,shadowmap_vertex:MS,shadowmask_pars_fragment:wS,skinbase_vertex:ES,skinning_pars_vertex:TS,skinning_vertex:AS,skinnormal_vertex:CS,specularmap_fragment:PS,specularmap_pars_fragment:RS,tonemapping_fragment:DS,tonemapping_pars_fragment:LS,transmission_fragment:IS,transmission_pars_fragment:NS,uv_pars_fragment:US,uv_pars_vertex:FS,uv_vertex:OS,worldpos_vertex:zS,background_vert:BS,background_frag:kS,backgroundCube_vert:VS,backgroundCube_frag:HS,cube_vert:GS,cube_frag:WS,depth_vert:XS,depth_frag:jS,distance_vert:qS,distance_frag:YS,equirect_vert:KS,equirect_frag:ZS,linedashed_vert:$S,linedashed_frag:JS,meshbasic_vert:QS,meshbasic_frag:eM,meshlambert_vert:tM,meshlambert_frag:nM,meshmatcap_vert:iM,meshmatcap_frag:rM,meshnormal_vert:sM,meshnormal_frag:aM,meshphong_vert:oM,meshphong_frag:lM,meshphysical_vert:cM,meshphysical_frag:uM,meshtoon_vert:dM,meshtoon_frag:hM,points_vert:fM,points_frag:pM,shadow_vert:mM,shadow_frag:gM,sprite_vert:vM,sprite_frag:_M},Ke={common:{diffuse:{value:new tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new it(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new X},probesMax:{value:new X},probesResolution:{value:new X}},points:{diffuse:{value:new tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new tt(16777215)},opacity:{value:1},center:{value:new it(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},jn={basic:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.fog]),vertexShader:St.meshbasic_vert,fragmentShader:St.meshbasic_frag},lambert:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},envMapIntensity:{value:1}}]),vertexShader:St.meshlambert_vert,fragmentShader:St.meshlambert_frag},phong:{uniforms:zn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:St.meshphong_vert,fragmentShader:St.meshphong_frag},standard:{uniforms:zn([Ke.common,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.roughnessmap,Ke.metalnessmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag},toon:{uniforms:zn([Ke.common,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.gradientmap,Ke.fog,Ke.lights,{emissive:{value:new tt(0)}}]),vertexShader:St.meshtoon_vert,fragmentShader:St.meshtoon_frag},matcap:{uniforms:zn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,{matcap:{value:null}}]),vertexShader:St.meshmatcap_vert,fragmentShader:St.meshmatcap_frag},points:{uniforms:zn([Ke.points,Ke.fog]),vertexShader:St.points_vert,fragmentShader:St.points_frag},dashed:{uniforms:zn([Ke.common,Ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:St.linedashed_vert,fragmentShader:St.linedashed_frag},depth:{uniforms:zn([Ke.common,Ke.displacementmap]),vertexShader:St.depth_vert,fragmentShader:St.depth_frag},normal:{uniforms:zn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,{opacity:{value:1}}]),vertexShader:St.meshnormal_vert,fragmentShader:St.meshnormal_frag},sprite:{uniforms:zn([Ke.sprite,Ke.fog]),vertexShader:St.sprite_vert,fragmentShader:St.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:St.background_vert,fragmentShader:St.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:St.backgroundCube_vert,fragmentShader:St.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:St.cube_vert,fragmentShader:St.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:St.equirect_vert,fragmentShader:St.equirect_frag},distance:{uniforms:zn([Ke.common,Ke.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:St.distance_vert,fragmentShader:St.distance_frag},shadow:{uniforms:zn([Ke.lights,Ke.fog,{color:{value:new tt(0)},opacity:{value:1}}]),vertexShader:St.shadow_vert,fragmentShader:St.shadow_frag}};jn.physical={uniforms:zn([jn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new it(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new it},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new tt(0)},specularColor:{value:new tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new it},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:St.meshphysical_vert,fragmentShader:St.meshphysical_frag};const ao={r:0,b:0,g:0},xM=new Lt,wm=new xt;wm.set(-1,0,0,0,1,0,0,0,1);function bM(n,e,t,i,r,s){const a=new tt(0);let o=r===!0?0:1,l,c,d=null,f=0,h=null;function p(y){let w=y.isScene===!0?y.background:null;if(w&&w.isTexture){const b=y.backgroundBlurriness>0;w=e.get(w,b)}return w}function m(y){let w=!1;const b=p(y);b===null?g(a,o):b&&b.isColor&&(g(b,1),w=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,s):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function x(y,w){const b=p(w);b&&(b.isCubeTexture||b.mapping===ll)?(c===void 0&&(c=new an(new ya(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:As(jn.backgroundCube.uniforms),vertexShader:jn.backgroundCube.vertexShader,fragmentShader:jn.backgroundCube.fragmentShader,side:Yn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(E,S,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(xM.makeRotationFromEuler(w.backgroundRotation)).transpose(),b.isCubeTexture&&b.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(wm),c.material.toneMapped=At.getTransfer(b.colorSpace)!==Ut,(d!==b||f!==b.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=b,f=b.version,h=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(l===void 0&&(l=new an(new Ds(2,2),new _n({name:"BackgroundMaterial",uniforms:As(jn.background.uniforms),vertexShader:jn.background.vertexShader,fragmentShader:jn.background.fragmentShader,side:Kn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=At.getTransfer(b.colorSpace)!==Ut,b.matrixAutoUpdate===!0&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),(d!==b||f!==b.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=b,f=b.version,h=n.toneMapping),l.layers.enableAll(),y.unshift(l,l.geometry,l.material,0,0,null))}function g(y,w){y.getRGB(ao,bm(n)),t.buffers.color.setClear(ao.r,ao.g,ao.b,w,s)}function v(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(y,w=1){a.set(y),o=w,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(y){o=y,g(a,o)},render:m,addToRenderList:x,dispose:v}}function yM(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,a=!1;function o(L,F,k,U,N){let R=!1;const z=f(L,U,k,F);s!==z&&(s=z,c(s.object)),R=p(L,U,k,N),R&&m(L,U,k,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(R||a)&&(a=!1,b(L,F,k,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(L){return n.bindVertexArray(L)}function d(L){return n.deleteVertexArray(L)}function f(L,F,k,U){const N=U.wireframe===!0;let R=i[F.id];R===void 0&&(R={},i[F.id]=R);const z=L.isInstancedMesh===!0?L.id:0;let q=R[z];q===void 0&&(q={},R[z]=q);let Y=q[k.id];Y===void 0&&(Y={},q[k.id]=Y);let te=Y[N];return te===void 0&&(te=h(l()),Y[N]=te),te}function h(L){const F=[],k=[],U=[];for(let N=0;N<t;N++)F[N]=0,k[N]=0,U[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:k,attributeDivisors:U,object:L,attributes:{},index:null}}function p(L,F,k,U){const N=s.attributes,R=F.attributes;let z=0;const q=k.getAttributes();for(const Y in q)if(q[Y].location>=0){const le=N[Y];let B=R[Y];if(B===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(B=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(B=L.instanceColor)),le===void 0||le.attribute!==B||B&&le.data!==B.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function m(L,F,k,U){const N={},R=F.attributes;let z=0;const q=k.getAttributes();for(const Y in q)if(q[Y].location>=0){let le=R[Y];le===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(le=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(le=L.instanceColor));const B={};B.attribute=le,le&&le.data&&(B.data=le.data),N[Y]=B,z++}s.attributes=N,s.attributesNum=z,s.index=U}function x(){const L=s.newAttributes;for(let F=0,k=L.length;F<k;F++)L[F]=0}function g(L){v(L,0)}function v(L,F){const k=s.newAttributes,U=s.enabledAttributes,N=s.attributeDivisors;k[L]=1,U[L]===0&&(n.enableVertexAttribArray(L),U[L]=1),N[L]!==F&&(n.vertexAttribDivisor(L,F),N[L]=F)}function y(){const L=s.newAttributes,F=s.enabledAttributes;for(let k=0,U=F.length;k<U;k++)F[k]!==L[k]&&(n.disableVertexAttribArray(k),F[k]=0)}function w(L,F,k,U,N,R,z){z===!0?n.vertexAttribIPointer(L,F,k,N,R):n.vertexAttribPointer(L,F,k,U,N,R)}function b(L,F,k,U){x();const N=U.attributes,R=k.getAttributes(),z=F.defaultAttributeValues;for(const q in R){const Y=R[q];if(Y.location>=0){let te=N[q];if(te===void 0&&(q==="instanceMatrix"&&L.instanceMatrix&&(te=L.instanceMatrix),q==="instanceColor"&&L.instanceColor&&(te=L.instanceColor)),te!==void 0){const le=te.normalized,B=te.itemSize,ee=e.get(te);if(ee===void 0)continue;const de=ee.buffer,ve=ee.type,G=ee.bytesPerElement,ie=ve===n.INT||ve===n.UNSIGNED_INT||te.gpuType===ud;if(te.isInterleavedBufferAttribute){const Z=te.data,ce=Z.stride,pe=te.offset;if(Z.isInstancedInterleavedBuffer){for(let Se=0;Se<Y.locationSize;Se++)v(Y.location+Se,Z.meshPerAttribute);L.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let Se=0;Se<Y.locationSize;Se++)g(Y.location+Se);n.bindBuffer(n.ARRAY_BUFFER,de);for(let Se=0;Se<Y.locationSize;Se++)w(Y.location+Se,B/Y.locationSize,ve,le,ce*G,(pe+B/Y.locationSize*Se)*G,ie)}else{if(te.isInstancedBufferAttribute){for(let Z=0;Z<Y.locationSize;Z++)v(Y.location+Z,te.meshPerAttribute);L.isInstancedMesh!==!0&&U._maxInstanceCount===void 0&&(U._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let Z=0;Z<Y.locationSize;Z++)g(Y.location+Z);n.bindBuffer(n.ARRAY_BUFFER,de);for(let Z=0;Z<Y.locationSize;Z++)w(Y.location+Z,B/Y.locationSize,ve,le,B*G,B/Y.locationSize*Z*G,ie)}}else if(z!==void 0){const le=z[q];if(le!==void 0)switch(le.length){case 2:n.vertexAttrib2fv(Y.location,le);break;case 3:n.vertexAttrib3fv(Y.location,le);break;case 4:n.vertexAttrib4fv(Y.location,le);break;default:n.vertexAttrib1fv(Y.location,le)}}}}y()}function E(){T();for(const L in i){const F=i[L];for(const k in F){const U=F[k];for(const N in U){const R=U[N];for(const z in R)d(R[z].object),delete R[z];delete U[N]}}delete i[L]}}function S(L){if(i[L.id]===void 0)return;const F=i[L.id];for(const k in F){const U=F[k];for(const N in U){const R=U[N];for(const z in R)d(R[z].object),delete R[z];delete U[N]}}delete i[L.id]}function A(L){for(const F in i){const k=i[F];for(const U in k){const N=k[U];if(N[L.id]===void 0)continue;const R=N[L.id];for(const z in R)d(R[z].object),delete R[z];delete N[L.id]}}}function _(L){for(const F in i){const k=i[F],U=L.isInstancedMesh===!0?L.id:0,N=k[U];if(N!==void 0){for(const R in N){const z=N[R];for(const q in z)d(z[q].object),delete z[q];delete N[R]}delete k[U],Object.keys(k).length===0&&delete i[F]}}}function T(){D(),a=!0,s!==r&&(s=r,c(s.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:T,resetDefaultState:D,dispose:E,releaseStatesOfGeometry:S,releaseStatesOfObject:_,releaseStatesOfProgram:A,initAttributes:x,enableAttribute:g,disableUnusedAttributes:y}}function SM(n,e,t){let i;function r(l){i=l}function s(l,c){n.drawArrays(i,l,c),t.update(c,i,1)}function a(l,c,d){d!==0&&(n.drawArraysInstanced(i,l,c,d),t.update(c,i,d))}function o(l,c,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,d);let h=0;for(let p=0;p<d;p++)h+=c[p];t.update(h,i,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function MM(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){return!(A!==li&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const _=A===Fn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==qn&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==ti&&!_)}function l(A){if(A==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(ft("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&ft("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),v=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),E=n.getParameter(n.MAX_SAMPLES),S=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:h,maxTextures:p,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:g,maxAttributes:v,maxVertexUniforms:y,maxVaryings:w,maxFragmentUniforms:b,maxSamples:E,samples:S}}function wM(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new sr,o=new xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=d(f,h,0)},this.setState=function(f,h,p){const m=f.clippingPlanes,x=f.clipIntersection,g=f.clipShadows,v=n.get(f);if(!r||m===null||m.length===0||s&&!g)s?d(null):c();else{const y=s?0:i,w=y*4;let b=v.clippingState||null;l.value=b,b=d(m,h,w,p);for(let E=0;E!==w;++E)b[E]=t[E];v.clippingState=b,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(f,h,p,m){const x=f!==null?f.length:0;let g=null;if(x!==0){if(g=l.value,m!==!0||g===null){const v=p+x*4,y=h.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length<v)&&(g=new Float32Array(v));for(let w=0,b=p;w!==x;++w,b+=4)a.copy(f[w]).applyMatrix4(y,o),a.normal.toArray(g,b),g[b+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,g}}const ur=4,tf=[.125,.215,.35,.446,.526,.582],yr=20,EM=256,Ws=new Fr,nf=new tt;let Ql=null,ec=0,tc=0,nc=!1;const TM=new X;class rf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){const{size:a=256,position:o=TM}=s;Ql=this._renderer.getRenderTarget(),ec=this._renderer.getActiveCubeFace(),tc=this._renderer.getActiveMipmapLevel(),nc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=of(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=af(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Ql,ec,tc),this._renderer.xr.enabled=nc,e.scissorTest=!1,as(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Dr||e.mapping===Es?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ql=this._renderer.getRenderTarget(),ec=this._renderer.getActiveCubeFace(),tc=this._renderer.getActiveMipmapLevel(),nc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:hn,minFilter:hn,generateMipmaps:!1,type:Fn,format:li,colorSpace:oa,depthBuffer:!1},r=sf(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sf(e,t,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=AM(s)),this._blurMaterial=PM(s,e,t),this._ggxMaterial=CM(s,e,t)}return r}_compileMaterial(e){const t=new an(new on,e);this._renderer.compile(t,Ws)}_sceneToCubeUV(e,t,i,r,s){const l=new oi(90,1,t,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,p=f.toneMapping;f.getClearColor(nf),f.toneMapping=Fi,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new an(new ya,new yd({name:"PMREM.Background",side:Yn,depthWrite:!1,depthTest:!1})));const x=this._backgroundBox,g=x.material;let v=!1;const y=e.background;y?y.isColor&&(g.color.copy(y),e.background=null,v=!0):(g.color.copy(nf),v=!0);for(let w=0;w<6;w++){const b=w%3;b===0?(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[w],s.y,s.z)):b===1?(l.up.set(0,0,c[w]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[w],s.z)):(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[w]));const E=this._cubeSize;as(r,b*E,w>2?E:0,E,E),f.setRenderTarget(r),v&&f.render(x,l),f.render(e,l)}f.toneMapping=p,f.autoClear=h,e.background=y}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Dr||e.mapping===Es;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=of()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=af());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;as(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,Ws)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;const l=a.uniforms,c=i/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-d*d),h=0+c*1.25,p=f*h,{_lodMax:m}=this,x=this._sizeLods[i],g=3*x*(i>m-ur?i-m+ur:0),v=4*(this._cubeSize-x);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=m-t,as(s,g,v,3*x,2*x),r.setRenderTarget(s),r.render(o,Ws),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=m-i,as(e,g,v,3*x,2*x),r.setRenderTarget(e),r.render(o,Ws)}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Tt("blur direction must be either latitudinal or longitudinal!");const d=3,f=this._lodMeshes[r];f.material=c;const h=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*yr-1),x=s/m,g=isFinite(s)?1+Math.floor(d*x):yr;g>yr&&ft(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${yr}`);const v=[];let y=0;for(let A=0;A<yr;++A){const _=A/x,T=Math.exp(-_*_/2);v.push(T),A===0?y+=T:A<g&&(y+=2*T)}for(let A=0;A<v.length;A++)v[A]=v[A]/y;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=v,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:w}=this;h.dTheta.value=m,h.mipInt.value=w-i;const b=this._sizeLods[r],E=3*b*(r>w-ur?r-w+ur:0),S=4*(this._cubeSize-b);as(t,E,S,3*b,2*b),l.setRenderTarget(t),l.render(f,Ws)}}function AM(n){const e=[],t=[],i=[];let r=n;const s=n-ur+1+tf.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>n-ur?l=tf[a-n+ur-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,f=1+c,h=[d,d,f,d,f,f,d,d,f,f,d,f],p=6,m=6,x=3,g=2,v=1,y=new Float32Array(x*m*p),w=new Float32Array(g*m*p),b=new Float32Array(v*m*p);for(let S=0;S<p;S++){const A=S%3*2/3-1,_=S>2?0:-1,T=[A,_,0,A+2/3,_,0,A+2/3,_+1,0,A,_,0,A+2/3,_+1,0,A,_+1,0];y.set(T,x*m*S),w.set(h,g*m*S);const D=[S,S,S,S,S,S];b.set(D,v*m*S)}const E=new on;E.setAttribute("position",new kn(y,x)),E.setAttribute("uv",new kn(w,g)),E.setAttribute("faceIndex",new kn(b,v)),i.push(new an(E,null)),r>ur&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function sf(n,e,t){const i=new ni(n,e,t);return i.texture.mapping=ll,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function as(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function CM(n,e,t){return new _n({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:EM,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:dl(),fragmentShader:`
|
|
3668
3668
|
|
|
3669
3669
|
precision highp float;
|
|
3670
3670
|
precision highp int;
|
|
@@ -3768,7 +3768,7 @@ void main() {
|
|
|
3768
3768
|
|
|
3769
3769
|
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
3770
3770
|
}
|
|
3771
|
-
`,blending:Mn,depthTest:!1,depthWrite:!1})}function
|
|
3771
|
+
`,blending:Mn,depthTest:!1,depthWrite:!1})}function PM(n,e,t){const i=new Float32Array(yr),r=new X(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:yr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:dl(),fragmentShader:`
|
|
3772
3772
|
|
|
3773
3773
|
precision mediump float;
|
|
3774
3774
|
precision mediump int;
|
|
@@ -3953,7 +3953,7 @@ void main() {
|
|
|
3953
3953
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
3954
3954
|
|
|
3955
3955
|
}
|
|
3956
|
-
`},r=new ya(5,5,5),s=new _n({name:"CubemapFromEquirect",uniforms:As(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Yn,blending:Mn});s.uniforms.tEquirect.value=t;const a=new an(r,s),o=t.minFilter;return t.minFilter===lr&&(t.minFilter=hn),new Pb(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function
|
|
3956
|
+
`},r=new ya(5,5,5),s=new _n({name:"CubemapFromEquirect",uniforms:As(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Yn,blending:Mn});s.uniforms.tEquirect.value=t;const a=new an(r,s),o=t.minFilter;return t.minFilter===lr&&(t.minFilter=hn),new Pb(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function RM(n){let e=new WeakMap,t=new WeakMap,i=null;function r(h,p=!1){return h==null?null:p?a(h):s(h)}function s(h){if(h&&h.isTexture){const p=h.mapping;if(p===Eo||p===wl)if(e.has(h)){const m=e.get(h).texture;return o(m,h.mapping)}else{const m=h.image;if(m&&m.height>0){const x=new Em(m.height);return x.fromEquirectangularTexture(n,h),e.set(h,x),h.addEventListener("dispose",c),o(x.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const p=h.mapping,m=p===Eo||p===wl,x=p===Dr||p===Es;if(m||x){let g=t.get(h);const v=g!==void 0?g.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==v)return i===null&&(i=new rf(n)),g=m?i.fromEquirectangular(h,g):i.fromCubemap(h,g),g.texture.pmremVersion=h.pmremVersion,t.set(h,g),g.texture;if(g!==void 0)return g.texture;{const y=h.image;return m&&y&&y.height>0||x&&y&&l(y)?(i===null&&(i=new rf(n)),g=m?i.fromEquirectangular(h):i.fromCubemap(h),g.texture.pmremVersion=h.pmremVersion,t.set(h,g),h.addEventListener("dispose",d),g.texture):null}}}return h}function o(h,p){return p===Eo?h.mapping=Dr:p===wl&&(h.mapping=Es),h}function l(h){let p=0;const m=6;for(let x=0;x<m;x++)h[x]!==void 0&&p++;return p===m}function c(h){const p=h.target;p.removeEventListener("dispose",c);const m=e.get(p);m!==void 0&&(e.delete(p),m.dispose())}function d(h){const p=h.target;p.removeEventListener("dispose",d);const m=t.get(p);m!==void 0&&(t.delete(p),m.dispose())}function f(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:f}}function DM(n){const e={};function t(i){if(e[i]!==void 0)return e[i];const r=n.getExtension(i);return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&ou("WebGLRenderer: "+i+" extension not supported."),r}}}function LM(n,e,t,i){const r={},s=new WeakMap;function a(f){const h=f.target;h.index!==null&&e.remove(h.index);for(const m in h.attributes)e.remove(h.attributes[m]);h.removeEventListener("dispose",a),delete r[h.id];const p=s.get(h);p&&(e.remove(p),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(f,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(f){const h=f.attributes;for(const p in h)e.update(h[p],n.ARRAY_BUFFER)}function c(f){const h=[],p=f.index,m=f.attributes.position;let x=0;if(m===void 0)return;if(p!==null){const y=p.array;x=p.version;for(let w=0,b=y.length;w<b;w+=3){const E=y[w+0],S=y[w+1],A=y[w+2];h.push(E,S,S,A,A,E)}}else{const y=m.array;x=m.version;for(let w=0,b=y.length/3-1;w<b;w+=3){const E=w+0,S=w+1,A=w+2;h.push(E,S,S,A,A,E)}}const g=new(m.count>=65535?pm:fm)(h,1);g.version=x;const v=s.get(f);v&&e.remove(v),s.set(f,g)}function d(f){const h=s.get(f);if(h){const p=f.index;p!==null&&h.version<p.version&&c(f)}else c(f);return s.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function IM(n,e,t){let i;function r(f){i=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,h){n.drawElements(i,h,s,f*a),t.update(h,i,1)}function c(f,h,p){p!==0&&(n.drawElementsInstanced(i,h,s,f*a,p),t.update(h,i,p))}function d(f,h,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,h,0,s,f,0,p);let x=0;for(let g=0;g<p;g++)x+=h[g];t.update(x,i,1)}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function NM(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.POINTS:t.points+=o*s;break;default:Tt("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function UM(n,e,t){const i=new WeakMap,r=new kt;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=d!==void 0?d.length:0;let h=i.get(o);if(h===void 0||h.count!==f){let T=function(){A.dispose(),i.delete(o),o.removeEventListener("dispose",T)};h!==void 0&&h.texture.dispose();const p=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,x=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],v=o.morphAttributes.normal||[],y=o.morphAttributes.color||[];let w=0;p===!0&&(w=1),m===!0&&(w=2),x===!0&&(w=3);let b=o.attributes.position.count*w,E=1;b>e.maxTextureSize&&(E=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const S=new Float32Array(b*E*4*f),A=new dm(S,b,E,f);A.type=ti,A.needsUpdate=!0;const _=w*4;for(let D=0;D<f;D++){const L=g[D],F=v[D],k=y[D],U=b*E*4*D;for(let N=0;N<L.count;N++){const R=N*_;p===!0&&(r.fromBufferAttribute(L,N),S[U+R+0]=r.x,S[U+R+1]=r.y,S[U+R+2]=r.z,S[U+R+3]=0),m===!0&&(r.fromBufferAttribute(F,N),S[U+R+4]=r.x,S[U+R+5]=r.y,S[U+R+6]=r.z,S[U+R+7]=0),x===!0&&(r.fromBufferAttribute(k,N),S[U+R+8]=r.x,S[U+R+9]=r.y,S[U+R+10]=r.z,S[U+R+11]=k.itemSize===4?r.w:1)}}h={count:f,texture:A,size:new it(b,E)},i.set(o,h),o.addEventListener("dispose",T)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let p=0;for(let x=0;x<c.length;x++)p+=c[x];const m=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:s}}function FM(n,e,t,i,r){let s=new WeakMap;function a(c){const d=r.render.frame,f=c.geometry,h=e.get(c,f);if(s.get(h)!==d&&(e.update(h),s.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const p=c.skeleton;s.get(p)!==d&&(p.update(),s.set(p,d))}return h}function o(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),i.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const OM={[rd]:"LINEAR_TONE_MAPPING",[sd]:"REINHARD_TONE_MAPPING",[ad]:"CINEON_TONE_MAPPING",[od]:"ACES_FILMIC_TONE_MAPPING",[cd]:"AGX_TONE_MAPPING",[xa]:"NEUTRAL_TONE_MAPPING",[ld]:"CUSTOM_TONE_MAPPING"};function zM(n,e,t,i,r){const s=new ni(e,t,{type:n,depthBuffer:i,stencilBuffer:r,depthTexture:i?new Nr(e,t):void 0}),a=new ni(e,t,{type:Fn,depthBuffer:!1,stencilBuffer:!1}),o=new on;o.setAttribute("position",new sn([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new sn([0,2,0,0,2,0],2));const l=new ym({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
3957
3957
|
precision highp float;
|
|
3958
3958
|
|
|
3959
3959
|
uniform mat4 modelViewMatrix;
|
|
@@ -3999,17 +3999,17 @@ void main() {
|
|
|
3999
3999
|
#ifdef SRGB_TRANSFER
|
|
4000
4000
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
4001
4001
|
#endif
|
|
4002
|
-
}`,depthTest:!1,depthWrite:!1}),c=new an(o,l),d=new Fr(-1,1,1,-1,0,1);let f=null,h=null,p=!1,
|
|
4002
|
+
}`,depthTest:!1,depthWrite:!1}),c=new an(o,l),d=new Fr(-1,1,1,-1,0,1);let f=null,h=null,p=!1,m,x=null,g=[],v=!1;this.setSize=function(y,w){s.setSize(y,w),a.setSize(y,w);for(let b=0;b<g.length;b++){const E=g[b];E.setSize&&E.setSize(y,w)}},this.setEffects=function(y){g=y,v=g.length>0&&g[0].isRenderPass===!0;const w=s.width,b=s.height;for(let E=0;E<g.length;E++){const S=g[E];S.setSize&&S.setSize(w,b)}},this.begin=function(y,w){if(p||y.toneMapping===Fi&&g.length===0)return!1;if(x=w,w!==null){const b=w.width,E=w.height;(s.width!==b||s.height!==E)&&this.setSize(b,E)}return v===!1&&y.setRenderTarget(s),m=y.toneMapping,y.toneMapping=Fi,!0},this.hasRenderPass=function(){return v},this.end=function(y,w){y.toneMapping=m,p=!0;let b=s,E=a;for(let S=0;S<g.length;S++){const A=g[S];if(A.enabled!==!1&&(A.render(y,E,b,w),A.needsSwap!==!1)){const _=b;b=E,E=_}}if(f!==y.outputColorSpace||h!==y.toneMapping){f=y.outputColorSpace,h=y.toneMapping,l.defines={},At.getTransfer(f)===Ut&&(l.defines.SRGB_TRANSFER="");const S=OM[h];S&&(l.defines[S]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=b.texture,y.setRenderTarget(x),y.render(c,d),x=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){s.depthTexture&&s.depthTexture.dispose(),s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Tm=new En,du=new Nr(1,1),Am=new dm,Cm=new Vx,Pm=new _m,lf=[],cf=[],uf=new Float32Array(16),df=new Float32Array(9),hf=new Float32Array(4);function Ls(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=lf[r];if(s===void 0&&(s=new Float32Array(r),lf[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function bn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function yn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function hl(n,e){let t=cf[e];t===void 0&&(t=new Int32Array(e),cf[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function BM(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function kM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bn(t,e))return;n.uniform2fv(this.addr,e),yn(t,e)}}function VM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(bn(t,e))return;n.uniform3fv(this.addr,e),yn(t,e)}}function HM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bn(t,e))return;n.uniform4fv(this.addr,e),yn(t,e)}}function GM(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(bn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),yn(t,e)}else{if(bn(t,i))return;hf.set(i),n.uniformMatrix2fv(this.addr,!1,hf),yn(t,i)}}function WM(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(bn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),yn(t,e)}else{if(bn(t,i))return;df.set(i),n.uniformMatrix3fv(this.addr,!1,df),yn(t,i)}}function XM(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(bn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),yn(t,e)}else{if(bn(t,i))return;uf.set(i),n.uniformMatrix4fv(this.addr,!1,uf),yn(t,i)}}function jM(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function qM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bn(t,e))return;n.uniform2iv(this.addr,e),yn(t,e)}}function YM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(bn(t,e))return;n.uniform3iv(this.addr,e),yn(t,e)}}function KM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bn(t,e))return;n.uniform4iv(this.addr,e),yn(t,e)}}function ZM(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function $M(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bn(t,e))return;n.uniform2uiv(this.addr,e),yn(t,e)}}function JM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(bn(t,e))return;n.uniform3uiv(this.addr,e),yn(t,e)}}function QM(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bn(t,e))return;n.uniform4uiv(this.addr,e),yn(t,e)}}function e1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(du.compareFunction=t.isReversedDepthBuffer()?vd:gd,s=du):s=Tm,t.setTexture2D(e||s,r)}function t1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||Cm,r)}function n1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||Pm,r)}function i1(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||Am,r)}function r1(n){switch(n){case 5126:return BM;case 35664:return kM;case 35665:return VM;case 35666:return HM;case 35674:return GM;case 35675:return WM;case 35676:return XM;case 5124:case 35670:return jM;case 35667:case 35671:return qM;case 35668:case 35672:return YM;case 35669:case 35673:return KM;case 5125:return ZM;case 36294:return $M;case 36295:return JM;case 36296:return QM;case 35678:case 36198:case 36298:case 36306:case 35682:return e1;case 35679:case 36299:case 36307:return t1;case 35680:case 36300:case 36308:case 36293:return n1;case 36289:case 36303:case 36311:case 36292:return i1}}function s1(n,e){n.uniform1fv(this.addr,e)}function a1(n,e){const t=Ls(e,this.size,2);n.uniform2fv(this.addr,t)}function o1(n,e){const t=Ls(e,this.size,3);n.uniform3fv(this.addr,t)}function l1(n,e){const t=Ls(e,this.size,4);n.uniform4fv(this.addr,t)}function c1(n,e){const t=Ls(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function u1(n,e){const t=Ls(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function d1(n,e){const t=Ls(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function h1(n,e){n.uniform1iv(this.addr,e)}function f1(n,e){n.uniform2iv(this.addr,e)}function p1(n,e){n.uniform3iv(this.addr,e)}function m1(n,e){n.uniform4iv(this.addr,e)}function g1(n,e){n.uniform1uiv(this.addr,e)}function v1(n,e){n.uniform2uiv(this.addr,e)}function _1(n,e){n.uniform3uiv(this.addr,e)}function x1(n,e){n.uniform4uiv(this.addr,e)}function b1(n,e,t){const i=this.cache,r=e.length,s=hl(t,r);bn(i,s)||(n.uniform1iv(this.addr,s),yn(i,s));let a;this.type===n.SAMPLER_2D_SHADOW?a=du:a=Tm;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function y1(n,e,t){const i=this.cache,r=e.length,s=hl(t,r);bn(i,s)||(n.uniform1iv(this.addr,s),yn(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Cm,s[a])}function S1(n,e,t){const i=this.cache,r=e.length,s=hl(t,r);bn(i,s)||(n.uniform1iv(this.addr,s),yn(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Pm,s[a])}function M1(n,e,t){const i=this.cache,r=e.length,s=hl(t,r);bn(i,s)||(n.uniform1iv(this.addr,s),yn(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Am,s[a])}function w1(n){switch(n){case 5126:return s1;case 35664:return a1;case 35665:return o1;case 35666:return l1;case 35674:return c1;case 35675:return u1;case 35676:return d1;case 5124:case 35670:return h1;case 35667:case 35671:return f1;case 35668:case 35672:return p1;case 35669:case 35673:return m1;case 5125:return g1;case 36294:return v1;case 36295:return _1;case 36296:return x1;case 35678:case 36198:case 36298:case 36306:case 35682:return b1;case 35679:case 36299:case 36307:return y1;case 35680:case 36300:case 36308:case 36293:return S1;case 36289:case 36303:case 36311:case 36292:return M1}}class E1{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=r1(t.type)}}class T1{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=w1(t.type)}}class A1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const ic=/(\w+)(\])?(\[|\.)?/g;function ff(n,e){n.seq.push(e),n.map[e.id]=e}function C1(n,e,t){const i=n.name,r=i.length;for(ic.lastIndex=0;;){const s=ic.exec(i),a=ic.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){ff(t,c===void 0?new E1(o,n,e):new T1(o,n,e));break}else{let f=t.map[o];f===void 0&&(f=new A1(o),ff(t,f)),t=f}}}class Ro{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);C1(o,l,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function pf(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const P1=37297;let R1=0;function D1(n,e){const t=n.split(`
|
|
4003
4003
|
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
|
|
4004
|
-
`)}const mf=new xt;function
|
|
4004
|
+
`)}const mf=new xt;function L1(n){At._getMatrix(mf,At.workingColorSpace,n);const e=`mat3( ${mf.elements.map(t=>t.toFixed(4))} )`;switch(At.getTransfer(n)){case Wo:return[e,"LinearTransferOETF"];case Ut:return[e,"sRGBTransferOETF"];default:return ft("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function gf(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
|
|
4005
4005
|
|
|
4006
4006
|
`+s+`
|
|
4007
4007
|
|
|
4008
|
-
`+
|
|
4009
|
-
`)}const
|
|
4010
|
-
`)}function
|
|
4011
|
-
`)}function
|
|
4012
|
-
`)}function
|
|
4008
|
+
`+D1(n.getShaderSource(e),o)}else return s}function I1(n,e){const t=L1(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
4009
|
+
`)}const N1={[rd]:"Linear",[sd]:"Reinhard",[ad]:"Cineon",[od]:"ACESFilmic",[cd]:"AgX",[xa]:"Neutral",[ld]:"Custom"};function U1(n,e){const t=N1[e];return t===void 0?(ft("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const oo=new X;function F1(){At.getLuminanceCoefficients(oo);const n=oo.x.toFixed(4),e=oo.y.toFixed(4),t=oo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
4010
|
+
`)}function O1(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ea).join(`
|
|
4011
|
+
`)}function z1(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
|
|
4012
|
+
`)}function B1(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function ea(n){return n!==""}function vf(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function _f(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const k1=/^[ \t]*#include +<([\w\d./]+)>/gm;function hu(n){return n.replace(k1,H1)}const V1=new Map;function H1(n,e){let t=St[e];if(t===void 0){const i=V1.get(e);if(i!==void 0)t=St[i],ft('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return hu(t)}const G1=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function xf(n){return n.replace(G1,W1)}function W1(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function bf(n){let e=`precision ${n.precision} float;
|
|
4013
4013
|
precision ${n.precision} int;
|
|
4014
4014
|
precision ${n.precision} sampler2D;
|
|
4015
4015
|
precision ${n.precision} samplerCube;
|
|
@@ -4029,28 +4029,28 @@ void main() {
|
|
|
4029
4029
|
`;return n.precision==="highp"?e+=`
|
|
4030
4030
|
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
|
|
4031
4031
|
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
|
|
4032
|
-
#define LOW_PRECISION`),e}const
|
|
4033
|
-
`:"";t.isRawShaderMaterial?(
|
|
4034
|
-
`),
|
|
4035
|
-
`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,
|
|
4032
|
+
#define LOW_PRECISION`),e}const X1={[wo]:"SHADOWMAP_TYPE_PCF",[fs]:"SHADOWMAP_TYPE_VSM"};function j1(n){return X1[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const q1={[Dr]:"ENVMAP_TYPE_CUBE",[Es]:"ENVMAP_TYPE_CUBE",[ll]:"ENVMAP_TYPE_CUBE_UV"};function Y1(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":q1[n.envMapMode]||"ENVMAP_TYPE_CUBE"}const K1={[Es]:"ENVMAP_MODE_REFRACTION"};function Z1(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":K1[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}const $1={[em]:"ENVMAP_BLENDING_MULTIPLY",[sx]:"ENVMAP_BLENDING_MIX",[ax]:"ENVMAP_BLENDING_ADD"};function J1(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":$1[n.combine]||"ENVMAP_BLENDING_NONE"}function Q1(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function ew(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=j1(t),c=Y1(t),d=Z1(t),f=J1(t),h=Q1(t),p=O1(t),m=z1(s),x=r.createProgram();let g,v,y=t.glslVersion?"#version "+t.glslVersion+`
|
|
4033
|
+
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(ea).join(`
|
|
4034
|
+
`),g.length>0&&(g+=`
|
|
4035
|
+
`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(ea).join(`
|
|
4036
4036
|
`),v.length>0&&(v+=`
|
|
4037
|
-
`)):(
|
|
4037
|
+
`)):(g=[bf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
4038
4038
|
`].filter(ea).join(`
|
|
4039
|
-
`),v=[bf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,
|
|
4039
|
+
`),v=[bf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Fi?"#define TONE_MAPPING":"",t.toneMapping!==Fi?St.tonemapping_pars_fragment:"",t.toneMapping!==Fi?U1("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",St.colorspace_pars_fragment,I1("linearToOutputTexel",t.outputColorSpace),F1(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
4040
4040
|
`].filter(ea).join(`
|
|
4041
4041
|
`)),a=hu(a),a=vf(a,t),a=_f(a,t),o=hu(o),o=vf(o,t),o=_f(o,t),a=xf(a),o=xf(o),t.isRawShaderMaterial!==!0&&(y=`#version 300 es
|
|
4042
|
-
`,
|
|
4042
|
+
`,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
4043
4043
|
`)+`
|
|
4044
|
-
`+
|
|
4044
|
+
`+g,v=["#define varying in",t.glslVersion===_h?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===_h?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
4045
4045
|
`)+`
|
|
4046
|
-
`+v);const w=y+
|
|
4046
|
+
`+v);const w=y+g+a,b=y+v+o,E=pf(r,r.VERTEX_SHADER,w),S=pf(r,r.FRAGMENT_SHADER,b);r.attachShader(x,E),r.attachShader(x,S),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function A(L){if(n.debug.checkShaderErrors){const F=r.getProgramInfoLog(x)||"",k=r.getShaderInfoLog(E)||"",U=r.getShaderInfoLog(S)||"",N=F.trim(),R=k.trim(),z=U.trim();let q=!0,Y=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,E,S);else{const te=gf(r,E,"vertex"),le=gf(r,S,"fragment");Tt("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
|
|
4047
4047
|
|
|
4048
4048
|
Material Name: `+L.name+`
|
|
4049
4049
|
Material Type: `+L.type+`
|
|
4050
4050
|
|
|
4051
4051
|
Program Info Log: `+N+`
|
|
4052
|
-
`+
|
|
4053
|
-
`+ce)}else N!==""?ft("WebGLProgram: Program Info Log:",N):(R===""||z==="")&&(K=!1);K&&(L.diagnostics={runnable:Y,programLog:N,vertexShader:{log:R,prefix:m},fragmentShader:{log:z,prefix:v}})}r.deleteShader(E),r.deleteShader(S),_=new Ro(r,x),T=BM(r,x)}let _;this.getUniforms=function(){return _===void 0&&A(this),_};let T;this.getAttributes=function(){return T===void 0&&A(this),T};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(x,PM)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=RM++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=E,this.fragmentShader=S,this}let tw=0;class nw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new iw(e),t.set(e,i)),i}}class iw{constructor(e){this.id=tw++,this.code=e,this.usedTimes=0}}function rw(n){return n===Ir||n===Vo||n===Ho}function sw(n,e,t,i,r,s){const a=new bd,o=new nw,l=new Set,c=[],d=new Map,f=i.logarithmicDepthBuffer;let h=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(_){return l.add(_),_===0?"uv":`uv${_}`}function x(_,T,D,L,F,B){const U=L.fog,N=F.geometry,R=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?L.environment:null,z=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,Y=e.get(_.envMap||R,z),K=Y&&Y.mapping===ll?Y.image.height:null,ne=p[_.type];_.precision!==null&&(h=i.getMaxPrecision(_.precision),h!==_.precision&&ft("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead."));const ce=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,V=ce!==void 0?ce.length:0;let ee=0;N.morphAttributes.position!==void 0&&(ee=1),N.morphAttributes.normal!==void 0&&(ee=2),N.morphAttributes.color!==void 0&&(ee=3);let me,ve,G,ie;if(ne){const vt=jn[ne];me=vt.vertexShader,ve=vt.fragmentShader}else me=_.vertexShader,ve=_.fragmentShader,o.update(_),G=o.getVertexShaderID(_),ie=o.getFragmentShaderID(_);const Z=n.getRenderTarget(),le=n.state.buffers.depth.getReversed(),fe=F.isInstancedMesh===!0,Se=F.isBatchedMesh===!0,ze=!!_.map,Ue=!!_.matcap,Pe=!!Y,ke=!!_.aoMap,Ie=!!_.lightMap,We=!!_.bumpMap,Oe=!!_.normalMap,He=!!_.displacementMap,k=!!_.emissiveMap,je=!!_.metalnessMap,Ve=!!_.roughnessMap,Xe=_.anisotropy>0,ye=_.clearcoat>0,Ce=_.dispersion>0,C=_.iridescence>0,M=_.sheen>0,H=_.transmission>0,re=Xe&&!!_.anisotropyMap,ue=ye&&!!_.clearcoatMap,be=ye&&!!_.clearcoatNormalMap,ge=ye&&!!_.clearcoatRoughnessMap,ae=C&&!!_.iridescenceMap,he=C&&!!_.iridescenceThicknessMap,Re=M&&!!_.sheenColorMap,Le=M&&!!_.sheenRoughnessMap,Ee=!!_.specularMap,De=!!_.specularColorMap,et=!!_.specularIntensityMap,Ye=H&&!!_.transmissionMap,ht=H&&!!_.thicknessMap,J=!!_.gradientMap,Ge=!!_.alphaMap,Te=_.alphaTest>0,Ze=!!_.alphaHash,qe=!!_.extensions;let Be=Fi;_.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Be=n.toneMapping);const lt={shaderID:ne,shaderType:_.type,shaderName:_.name,vertexShader:me,fragmentShader:ve,defines:_.defines,customVertexShaderID:G,customFragmentShaderID:ie,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Se,batchingColor:Se&&F._colorsTexture!==null,instancing:fe,instancingColor:fe&&F.instanceColor!==null,instancingMorph:fe&&F.morphTexture!==null,outputColorSpace:Z===null?n.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:At.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ze,matcap:Ue,envMap:Pe,envMapMode:Pe&&Y.mapping,envMapCubeUVHeight:K,aoMap:ke,lightMap:Ie,bumpMap:We,normalMap:Oe,displacementMap:He,emissiveMap:k,normalMapObjectSpace:Oe&&_.normalMapType===cx,normalMapTangentSpace:Oe&&_.normalMapType===Go,packedNormalMap:Oe&&_.normalMapType===Go&&rw(_.normalMap.format),metalnessMap:je,roughnessMap:Ve,anisotropy:Xe,anisotropyMap:re,clearcoat:ye,clearcoatMap:ue,clearcoatNormalMap:be,clearcoatRoughnessMap:ge,dispersion:Ce,iridescence:C,iridescenceMap:ae,iridescenceThicknessMap:he,sheen:M,sheenColorMap:Re,sheenRoughnessMap:Le,specularMap:Ee,specularColorMap:De,specularIntensityMap:et,transmission:H,transmissionMap:Ye,thicknessMap:ht,gradientMap:J,opaque:_.transparent===!1&&_.blending===bs&&_.alphaToCoverage===!1,alphaMap:Ge,alphaTest:Te,alphaHash:Ze,combine:_.combine,mapUv:ze&&g(_.map.channel),aoMapUv:ke&&g(_.aoMap.channel),lightMapUv:Ie&&g(_.lightMap.channel),bumpMapUv:We&&g(_.bumpMap.channel),normalMapUv:Oe&&g(_.normalMap.channel),displacementMapUv:He&&g(_.displacementMap.channel),emissiveMapUv:k&&g(_.emissiveMap.channel),metalnessMapUv:je&&g(_.metalnessMap.channel),roughnessMapUv:Ve&&g(_.roughnessMap.channel),anisotropyMapUv:re&&g(_.anisotropyMap.channel),clearcoatMapUv:ue&&g(_.clearcoatMap.channel),clearcoatNormalMapUv:be&&g(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ge&&g(_.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&g(_.iridescenceMap.channel),iridescenceThicknessMapUv:he&&g(_.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&g(_.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(_.sheenRoughnessMap.channel),specularMapUv:Ee&&g(_.specularMap.channel),specularColorMapUv:De&&g(_.specularColorMap.channel),specularIntensityMapUv:et&&g(_.specularIntensityMap.channel),transmissionMapUv:Ye&&g(_.transmissionMap.channel),thicknessMapUv:ht&&g(_.thicknessMap.channel),alphaMapUv:Ge&&g(_.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(Oe||Xe),vertexNormals:!!N.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!N.attributes.uv&&(ze||Ge),fog:!!U,useFog:_.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||N.attributes.normal===void 0&&Oe===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:le,skinning:F.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:ee,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:B.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Be,decodeVideoTexture:ze&&_.map.isVideoTexture===!0&&At.getTransfer(_.map.colorSpace)===Ut,decodeVideoTextureEmissive:k&&_.emissiveMap.isVideoTexture===!0&&At.getTransfer(_.emissiveMap.colorSpace)===Ut,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Qn,flipSided:_.side===Yn,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:qe&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(qe&&_.extensions.multiDraw===!0||Se)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return lt.vertexUv1s=l.has(1),lt.vertexUv2s=l.has(2),lt.vertexUv3s=l.has(3),l.clear(),lt}function m(_){const T=[];if(_.shaderID?T.push(_.shaderID):(T.push(_.customVertexShaderID),T.push(_.customFragmentShaderID)),_.defines!==void 0)for(const D in _.defines)T.push(D),T.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(v(T,_),y(T,_),T.push(n.outputColorSpace)),T.push(_.customProgramCacheKey),T.join()}function v(_,T){_.push(T.precision),_.push(T.outputColorSpace),_.push(T.envMapMode),_.push(T.envMapCubeUVHeight),_.push(T.mapUv),_.push(T.alphaMapUv),_.push(T.lightMapUv),_.push(T.aoMapUv),_.push(T.bumpMapUv),_.push(T.normalMapUv),_.push(T.displacementMapUv),_.push(T.emissiveMapUv),_.push(T.metalnessMapUv),_.push(T.roughnessMapUv),_.push(T.anisotropyMapUv),_.push(T.clearcoatMapUv),_.push(T.clearcoatNormalMapUv),_.push(T.clearcoatRoughnessMapUv),_.push(T.iridescenceMapUv),_.push(T.iridescenceThicknessMapUv),_.push(T.sheenColorMapUv),_.push(T.sheenRoughnessMapUv),_.push(T.specularMapUv),_.push(T.specularColorMapUv),_.push(T.specularIntensityMapUv),_.push(T.transmissionMapUv),_.push(T.thicknessMapUv),_.push(T.combine),_.push(T.fogExp2),_.push(T.sizeAttenuation),_.push(T.morphTargetsCount),_.push(T.morphAttributeCount),_.push(T.numDirLights),_.push(T.numPointLights),_.push(T.numSpotLights),_.push(T.numSpotLightMaps),_.push(T.numHemiLights),_.push(T.numRectAreaLights),_.push(T.numDirLightShadows),_.push(T.numPointLightShadows),_.push(T.numSpotLightShadows),_.push(T.numSpotLightShadowsWithMaps),_.push(T.numLightProbes),_.push(T.shadowMapType),_.push(T.toneMapping),_.push(T.numClippingPlanes),_.push(T.numClipIntersection),_.push(T.depthPacking)}function y(_,T){a.disableAll(),T.instancing&&a.enable(0),T.instancingColor&&a.enable(1),T.instancingMorph&&a.enable(2),T.matcap&&a.enable(3),T.envMap&&a.enable(4),T.normalMapObjectSpace&&a.enable(5),T.normalMapTangentSpace&&a.enable(6),T.clearcoat&&a.enable(7),T.iridescence&&a.enable(8),T.alphaTest&&a.enable(9),T.vertexColors&&a.enable(10),T.vertexAlphas&&a.enable(11),T.vertexUv1s&&a.enable(12),T.vertexUv2s&&a.enable(13),T.vertexUv3s&&a.enable(14),T.vertexTangents&&a.enable(15),T.anisotropy&&a.enable(16),T.alphaHash&&a.enable(17),T.batching&&a.enable(18),T.dispersion&&a.enable(19),T.batchingColor&&a.enable(20),T.gradientMap&&a.enable(21),T.packedNormalMap&&a.enable(22),T.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.reversedDepthBuffer&&a.enable(4),T.skinning&&a.enable(5),T.morphTargets&&a.enable(6),T.morphNormals&&a.enable(7),T.morphColors&&a.enable(8),T.premultipliedAlpha&&a.enable(9),T.shadowMapEnabled&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),T.decodeVideoTexture&&a.enable(19),T.decodeVideoTextureEmissive&&a.enable(20),T.alphaToCoverage&&a.enable(21),T.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function w(_){const T=p[_.type];let D;if(T){const L=jn[T];D=Di.clone(L.uniforms)}else D=_.uniforms;return D}function b(_,T){let D=d.get(T);return D!==void 0?++D.usedTimes:(D=new ew(n,T,_,r),c.push(D),d.set(T,D)),D}function E(_){if(--_.usedTimes===0){const T=c.indexOf(_);c[T]=c[c.length-1],c.pop(),d.delete(_.cacheKey),_.destroy()}}function S(_){o.remove(_)}function A(){o.dispose()}return{getParameters:x,getProgramCacheKey:m,getUniforms:w,acquireProgram:b,releaseProgram:E,releaseShaderCache:S,programs:c,dispose:A}}function aw(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function ow(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function yf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Sf(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h){let p=0;return h.isInstancedMesh&&(p+=2),h.isSkinnedMesh&&(p+=1),p}function o(h,p,g,x,m,v){let y=n[e];return y===void 0?(y={id:h.id,object:h,geometry:p,material:g,materialVariant:a(h),groupOrder:x,renderOrder:h.renderOrder,z:m,group:v},n[e]=y):(y.id=h.id,y.object=h,y.geometry=p,y.material=g,y.materialVariant=a(h),y.groupOrder=x,y.renderOrder=h.renderOrder,y.z=m,y.group=v),e++,y}function l(h,p,g,x,m,v){const y=o(h,p,g,x,m,v);g.transmission>0?i.push(y):g.transparent===!0?r.push(y):t.push(y)}function c(h,p,g,x,m,v){const y=o(h,p,g,x,m,v);g.transmission>0?i.unshift(y):g.transparent===!0?r.unshift(y):t.unshift(y)}function d(h,p){t.length>1&&t.sort(h||ow),i.length>1&&i.sort(p||yf),r.length>1&&r.sort(p||yf)}function f(){for(let h=e,p=n.length;h<p;h++){const g=n[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:f,sort:d}}function lw(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new Sf,n.set(i,[a])):r>=s.length?(a=new Sf,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function cw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new X,color:new tt};break;case"SpotLight":t={position:new X,direction:new X,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new X,color:new tt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new X,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":t={color:new tt,position:new X,halfWidth:new X,halfHeight:new X};break}return n[e.id]=t,t}}}function uw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let dw=0;function hw(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function fw(n){const e=new cw,t=uw(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new X);const r=new X,s=new Lt,a=new Lt;function o(c){let d=0,f=0,h=0;for(let T=0;T<9;T++)i.probe[T].set(0,0,0);let p=0,g=0,x=0,m=0,v=0,y=0,w=0,b=0,E=0,S=0,A=0;c.sort(hw);for(let T=0,D=c.length;T<D;T++){const L=c[T],F=L.color,B=L.intensity,U=L.distance;let N=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===Ir?N=L.shadow.map.texture:N=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)d+=F.r*B,f+=F.g*B,h+=F.b*B;else if(L.isLightProbe){for(let R=0;R<9;R++)i.probe[R].addScaledVector(L.sh.coefficients[R],B);A++}else if(L.isDirectionalLight){const R=e.get(L);if(R.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const z=L.shadow,Y=t.get(L);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,i.directionalShadow[p]=Y,i.directionalShadowMap[p]=N,i.directionalShadowMatrix[p]=L.shadow.matrix,y++}i.directional[p]=R,p++}else if(L.isSpotLight){const R=e.get(L);R.position.setFromMatrixPosition(L.matrixWorld),R.color.copy(F).multiplyScalar(B),R.distance=U,R.coneCos=Math.cos(L.angle),R.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),R.decay=L.decay,i.spot[x]=R;const z=L.shadow;if(L.map&&(i.spotLightMap[E]=L.map,E++,z.updateMatrices(L),L.castShadow&&S++),i.spotLightMatrix[x]=z.matrix,L.castShadow){const Y=t.get(L);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,i.spotShadow[x]=Y,i.spotShadowMap[x]=N,b++}x++}else if(L.isRectAreaLight){const R=e.get(L);R.color.copy(F).multiplyScalar(B),R.halfWidth.set(L.width*.5,0,0),R.halfHeight.set(0,L.height*.5,0),i.rectArea[m]=R,m++}else if(L.isPointLight){const R=e.get(L);if(R.color.copy(L.color).multiplyScalar(L.intensity),R.distance=L.distance,R.decay=L.decay,L.castShadow){const z=L.shadow,Y=t.get(L);Y.shadowIntensity=z.intensity,Y.shadowBias=z.bias,Y.shadowNormalBias=z.normalBias,Y.shadowRadius=z.radius,Y.shadowMapSize=z.mapSize,Y.shadowCameraNear=z.camera.near,Y.shadowCameraFar=z.camera.far,i.pointShadow[g]=Y,i.pointShadowMap[g]=N,i.pointShadowMatrix[g]=L.shadow.matrix,w++}i.point[g]=R,g++}else if(L.isHemisphereLight){const R=e.get(L);R.skyColor.copy(L.color).multiplyScalar(B),R.groundColor.copy(L.groundColor).multiplyScalar(B),i.hemi[v]=R,v++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ke.LTC_FLOAT_1,i.rectAreaLTC2=Ke.LTC_FLOAT_2):(i.rectAreaLTC1=Ke.LTC_HALF_1,i.rectAreaLTC2=Ke.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=h;const _=i.hash;(_.directionalLength!==p||_.pointLength!==g||_.spotLength!==x||_.rectAreaLength!==m||_.hemiLength!==v||_.numDirectionalShadows!==y||_.numPointShadows!==w||_.numSpotShadows!==b||_.numSpotMaps!==E||_.numLightProbes!==A)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=m,i.point.length=g,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=b+E-S,i.spotLightMap.length=E,i.numSpotLightShadowsWithMaps=S,i.numLightProbes=A,_.directionalLength=p,_.pointLength=g,_.spotLength=x,_.rectAreaLength=m,_.hemiLength=v,_.numDirectionalShadows=y,_.numPointShadows=w,_.numSpotShadows=b,_.numSpotMaps=E,_.numLightProbes=A,i.version=dw++)}function l(c,d){let f=0,h=0,p=0,g=0,x=0;const m=d.matrixWorldInverse;for(let v=0,y=c.length;v<y;v++){const w=c[v];if(w.isDirectionalLight){const b=i.directional[f];b.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),f++}else if(w.isSpotLight){const b=i.spot[p];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),p++}else if(w.isRectAreaLight){const b=i.rectArea[g];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(w.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(w.width*.5,0,0),b.halfHeight.set(0,w.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),g++}else if(w.isPointLight){const b=i.point[h];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(m),h++}else if(w.isHemisphereLight){const b=i.hemi[x];b.direction.setFromMatrixPosition(w.matrixWorld),b.direction.transformDirection(m),x++}}}return{setup:o,setupView:l,state:i}}function Mf(n){const e=new fw(n),t=[],i=[],r=[];function s(h){f.camera=h,t.length=0,i.length=0,r.length=0}function a(h){t.push(h)}function o(h){i.push(h)}function l(h){r.push(h)}function c(){e.setup(t)}function d(h){e.setupView(t,h)}const f={lightsArray:t,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function pw(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Mf(n),e.set(r,[o])):s>=a.length?(o=new Mf(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}const mw=`void main() {
|
|
4052
|
+
`+te+`
|
|
4053
|
+
`+le)}else N!==""?ft("WebGLProgram: Program Info Log:",N):(R===""||z==="")&&(Y=!1);Y&&(L.diagnostics={runnable:q,programLog:N,vertexShader:{log:R,prefix:g},fragmentShader:{log:z,prefix:v}})}r.deleteShader(E),r.deleteShader(S),_=new Ro(r,x),T=B1(r,x)}let _;this.getUniforms=function(){return _===void 0&&A(this),_};let T;this.getAttributes=function(){return T===void 0&&A(this),T};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(x,P1)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=R1++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=E,this.fragmentShader=S,this}let tw=0;class nw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new iw(e),t.set(e,i)),i}}class iw{constructor(e){this.id=tw++,this.code=e,this.usedTimes=0}}function rw(n){return n===Ir||n===Vo||n===Ho}function sw(n,e,t,i,r,s){const a=new bd,o=new nw,l=new Set,c=[],d=new Map,f=i.logarithmicDepthBuffer;let h=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(_){return l.add(_),_===0?"uv":`uv${_}`}function x(_,T,D,L,F,k){const U=L.fog,N=F.geometry,R=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?L.environment:null,z=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,q=e.get(_.envMap||R,z),Y=q&&q.mapping===ll?q.image.height:null,te=p[_.type];_.precision!==null&&(h=i.getMaxPrecision(_.precision),h!==_.precision&&ft("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead."));const le=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,B=le!==void 0?le.length:0;let ee=0;N.morphAttributes.position!==void 0&&(ee=1),N.morphAttributes.normal!==void 0&&(ee=2),N.morphAttributes.color!==void 0&&(ee=3);let de,ve,G,ie;if(te){const vt=jn[te];de=vt.vertexShader,ve=vt.fragmentShader}else de=_.vertexShader,ve=_.fragmentShader,o.update(_),G=o.getVertexShaderID(_),ie=o.getFragmentShaderID(_);const Z=n.getRenderTarget(),ce=n.state.buffers.depth.getReversed(),pe=F.isInstancedMesh===!0,Se=F.isBatchedMesh===!0,ze=!!_.map,Ue=!!_.matcap,Pe=!!q,ke=!!_.aoMap,Ie=!!_.lightMap,We=!!_.bumpMap,Oe=!!_.normalMap,He=!!_.displacementMap,V=!!_.emissiveMap,je=!!_.metalnessMap,Ve=!!_.roughnessMap,Xe=_.anisotropy>0,ye=_.clearcoat>0,Ce=_.dispersion>0,C=_.iridescence>0,M=_.sheen>0,H=_.transmission>0,re=Xe&&!!_.anisotropyMap,ue=ye&&!!_.clearcoatMap,be=ye&&!!_.clearcoatNormalMap,ge=ye&&!!_.clearcoatRoughnessMap,ae=C&&!!_.iridescenceMap,fe=C&&!!_.iridescenceThicknessMap,Re=M&&!!_.sheenColorMap,Le=M&&!!_.sheenRoughnessMap,Ee=!!_.specularMap,De=!!_.specularColorMap,et=!!_.specularIntensityMap,Ye=H&&!!_.transmissionMap,ht=H&&!!_.thicknessMap,J=!!_.gradientMap,Ge=!!_.alphaMap,Te=_.alphaTest>0,Ze=!!_.alphaHash,qe=!!_.extensions;let Be=Fi;_.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Be=n.toneMapping);const lt={shaderID:te,shaderType:_.type,shaderName:_.name,vertexShader:de,fragmentShader:ve,defines:_.defines,customVertexShaderID:G,customFragmentShaderID:ie,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Se,batchingColor:Se&&F._colorsTexture!==null,instancing:pe,instancingColor:pe&&F.instanceColor!==null,instancingMorph:pe&&F.morphTexture!==null,outputColorSpace:Z===null?n.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:At.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:ze,matcap:Ue,envMap:Pe,envMapMode:Pe&&q.mapping,envMapCubeUVHeight:Y,aoMap:ke,lightMap:Ie,bumpMap:We,normalMap:Oe,displacementMap:He,emissiveMap:V,normalMapObjectSpace:Oe&&_.normalMapType===cx,normalMapTangentSpace:Oe&&_.normalMapType===Go,packedNormalMap:Oe&&_.normalMapType===Go&&rw(_.normalMap.format),metalnessMap:je,roughnessMap:Ve,anisotropy:Xe,anisotropyMap:re,clearcoat:ye,clearcoatMap:ue,clearcoatNormalMap:be,clearcoatRoughnessMap:ge,dispersion:Ce,iridescence:C,iridescenceMap:ae,iridescenceThicknessMap:fe,sheen:M,sheenColorMap:Re,sheenRoughnessMap:Le,specularMap:Ee,specularColorMap:De,specularIntensityMap:et,transmission:H,transmissionMap:Ye,thicknessMap:ht,gradientMap:J,opaque:_.transparent===!1&&_.blending===bs&&_.alphaToCoverage===!1,alphaMap:Ge,alphaTest:Te,alphaHash:Ze,combine:_.combine,mapUv:ze&&m(_.map.channel),aoMapUv:ke&&m(_.aoMap.channel),lightMapUv:Ie&&m(_.lightMap.channel),bumpMapUv:We&&m(_.bumpMap.channel),normalMapUv:Oe&&m(_.normalMap.channel),displacementMapUv:He&&m(_.displacementMap.channel),emissiveMapUv:V&&m(_.emissiveMap.channel),metalnessMapUv:je&&m(_.metalnessMap.channel),roughnessMapUv:Ve&&m(_.roughnessMap.channel),anisotropyMapUv:re&&m(_.anisotropyMap.channel),clearcoatMapUv:ue&&m(_.clearcoatMap.channel),clearcoatNormalMapUv:be&&m(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ge&&m(_.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&m(_.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&m(_.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&m(_.sheenColorMap.channel),sheenRoughnessMapUv:Le&&m(_.sheenRoughnessMap.channel),specularMapUv:Ee&&m(_.specularMap.channel),specularColorMapUv:De&&m(_.specularColorMap.channel),specularIntensityMapUv:et&&m(_.specularIntensityMap.channel),transmissionMapUv:Ye&&m(_.transmissionMap.channel),thicknessMapUv:ht&&m(_.thicknessMap.channel),alphaMapUv:Ge&&m(_.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(Oe||Xe),vertexNormals:!!N.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!N.attributes.uv&&(ze||Ge),fog:!!U,useFog:_.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||N.attributes.normal===void 0&&Oe===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:ce,skinning:F.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:B,morphTextureStride:ee,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:k.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Be,decodeVideoTexture:ze&&_.map.isVideoTexture===!0&&At.getTransfer(_.map.colorSpace)===Ut,decodeVideoTextureEmissive:V&&_.emissiveMap.isVideoTexture===!0&&At.getTransfer(_.emissiveMap.colorSpace)===Ut,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Qn,flipSided:_.side===Yn,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:qe&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(qe&&_.extensions.multiDraw===!0||Se)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return lt.vertexUv1s=l.has(1),lt.vertexUv2s=l.has(2),lt.vertexUv3s=l.has(3),l.clear(),lt}function g(_){const T=[];if(_.shaderID?T.push(_.shaderID):(T.push(_.customVertexShaderID),T.push(_.customFragmentShaderID)),_.defines!==void 0)for(const D in _.defines)T.push(D),T.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(v(T,_),y(T,_),T.push(n.outputColorSpace)),T.push(_.customProgramCacheKey),T.join()}function v(_,T){_.push(T.precision),_.push(T.outputColorSpace),_.push(T.envMapMode),_.push(T.envMapCubeUVHeight),_.push(T.mapUv),_.push(T.alphaMapUv),_.push(T.lightMapUv),_.push(T.aoMapUv),_.push(T.bumpMapUv),_.push(T.normalMapUv),_.push(T.displacementMapUv),_.push(T.emissiveMapUv),_.push(T.metalnessMapUv),_.push(T.roughnessMapUv),_.push(T.anisotropyMapUv),_.push(T.clearcoatMapUv),_.push(T.clearcoatNormalMapUv),_.push(T.clearcoatRoughnessMapUv),_.push(T.iridescenceMapUv),_.push(T.iridescenceThicknessMapUv),_.push(T.sheenColorMapUv),_.push(T.sheenRoughnessMapUv),_.push(T.specularMapUv),_.push(T.specularColorMapUv),_.push(T.specularIntensityMapUv),_.push(T.transmissionMapUv),_.push(T.thicknessMapUv),_.push(T.combine),_.push(T.fogExp2),_.push(T.sizeAttenuation),_.push(T.morphTargetsCount),_.push(T.morphAttributeCount),_.push(T.numDirLights),_.push(T.numPointLights),_.push(T.numSpotLights),_.push(T.numSpotLightMaps),_.push(T.numHemiLights),_.push(T.numRectAreaLights),_.push(T.numDirLightShadows),_.push(T.numPointLightShadows),_.push(T.numSpotLightShadows),_.push(T.numSpotLightShadowsWithMaps),_.push(T.numLightProbes),_.push(T.shadowMapType),_.push(T.toneMapping),_.push(T.numClippingPlanes),_.push(T.numClipIntersection),_.push(T.depthPacking)}function y(_,T){a.disableAll(),T.instancing&&a.enable(0),T.instancingColor&&a.enable(1),T.instancingMorph&&a.enable(2),T.matcap&&a.enable(3),T.envMap&&a.enable(4),T.normalMapObjectSpace&&a.enable(5),T.normalMapTangentSpace&&a.enable(6),T.clearcoat&&a.enable(7),T.iridescence&&a.enable(8),T.alphaTest&&a.enable(9),T.vertexColors&&a.enable(10),T.vertexAlphas&&a.enable(11),T.vertexUv1s&&a.enable(12),T.vertexUv2s&&a.enable(13),T.vertexUv3s&&a.enable(14),T.vertexTangents&&a.enable(15),T.anisotropy&&a.enable(16),T.alphaHash&&a.enable(17),T.batching&&a.enable(18),T.dispersion&&a.enable(19),T.batchingColor&&a.enable(20),T.gradientMap&&a.enable(21),T.packedNormalMap&&a.enable(22),T.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.reversedDepthBuffer&&a.enable(4),T.skinning&&a.enable(5),T.morphTargets&&a.enable(6),T.morphNormals&&a.enable(7),T.morphColors&&a.enable(8),T.premultipliedAlpha&&a.enable(9),T.shadowMapEnabled&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),T.decodeVideoTexture&&a.enable(19),T.decodeVideoTextureEmissive&&a.enable(20),T.alphaToCoverage&&a.enable(21),T.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function w(_){const T=p[_.type];let D;if(T){const L=jn[T];D=Di.clone(L.uniforms)}else D=_.uniforms;return D}function b(_,T){let D=d.get(T);return D!==void 0?++D.usedTimes:(D=new ew(n,T,_,r),c.push(D),d.set(T,D)),D}function E(_){if(--_.usedTimes===0){const T=c.indexOf(_);c[T]=c[c.length-1],c.pop(),d.delete(_.cacheKey),_.destroy()}}function S(_){o.remove(_)}function A(){o.dispose()}return{getParameters:x,getProgramCacheKey:g,getUniforms:w,acquireProgram:b,releaseProgram:E,releaseShaderCache:S,programs:c,dispose:A}}function aw(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function ow(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function yf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Sf(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h){let p=0;return h.isInstancedMesh&&(p+=2),h.isSkinnedMesh&&(p+=1),p}function o(h,p,m,x,g,v){let y=n[e];return y===void 0?(y={id:h.id,object:h,geometry:p,material:m,materialVariant:a(h),groupOrder:x,renderOrder:h.renderOrder,z:g,group:v},n[e]=y):(y.id=h.id,y.object=h,y.geometry=p,y.material=m,y.materialVariant=a(h),y.groupOrder=x,y.renderOrder=h.renderOrder,y.z=g,y.group=v),e++,y}function l(h,p,m,x,g,v){const y=o(h,p,m,x,g,v);m.transmission>0?i.push(y):m.transparent===!0?r.push(y):t.push(y)}function c(h,p,m,x,g,v){const y=o(h,p,m,x,g,v);m.transmission>0?i.unshift(y):m.transparent===!0?r.unshift(y):t.unshift(y)}function d(h,p){t.length>1&&t.sort(h||ow),i.length>1&&i.sort(p||yf),r.length>1&&r.sort(p||yf)}function f(){for(let h=e,p=n.length;h<p;h++){const m=n[h];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:f,sort:d}}function lw(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new Sf,n.set(i,[a])):r>=s.length?(a=new Sf,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function cw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new X,color:new tt};break;case"SpotLight":t={position:new X,direction:new X,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new X,color:new tt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new X,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":t={color:new tt,position:new X,halfWidth:new X,halfHeight:new X};break}return n[e.id]=t,t}}}function uw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new it,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let dw=0;function hw(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function fw(n){const e=new cw,t=uw(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new X);const r=new X,s=new Lt,a=new Lt;function o(c){let d=0,f=0,h=0;for(let T=0;T<9;T++)i.probe[T].set(0,0,0);let p=0,m=0,x=0,g=0,v=0,y=0,w=0,b=0,E=0,S=0,A=0;c.sort(hw);for(let T=0,D=c.length;T<D;T++){const L=c[T],F=L.color,k=L.intensity,U=L.distance;let N=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===Ir?N=L.shadow.map.texture:N=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)d+=F.r*k,f+=F.g*k,h+=F.b*k;else if(L.isLightProbe){for(let R=0;R<9;R++)i.probe[R].addScaledVector(L.sh.coefficients[R],k);A++}else if(L.isDirectionalLight){const R=e.get(L);if(R.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const z=L.shadow,q=t.get(L);q.shadowIntensity=z.intensity,q.shadowBias=z.bias,q.shadowNormalBias=z.normalBias,q.shadowRadius=z.radius,q.shadowMapSize=z.mapSize,i.directionalShadow[p]=q,i.directionalShadowMap[p]=N,i.directionalShadowMatrix[p]=L.shadow.matrix,y++}i.directional[p]=R,p++}else if(L.isSpotLight){const R=e.get(L);R.position.setFromMatrixPosition(L.matrixWorld),R.color.copy(F).multiplyScalar(k),R.distance=U,R.coneCos=Math.cos(L.angle),R.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),R.decay=L.decay,i.spot[x]=R;const z=L.shadow;if(L.map&&(i.spotLightMap[E]=L.map,E++,z.updateMatrices(L),L.castShadow&&S++),i.spotLightMatrix[x]=z.matrix,L.castShadow){const q=t.get(L);q.shadowIntensity=z.intensity,q.shadowBias=z.bias,q.shadowNormalBias=z.normalBias,q.shadowRadius=z.radius,q.shadowMapSize=z.mapSize,i.spotShadow[x]=q,i.spotShadowMap[x]=N,b++}x++}else if(L.isRectAreaLight){const R=e.get(L);R.color.copy(F).multiplyScalar(k),R.halfWidth.set(L.width*.5,0,0),R.halfHeight.set(0,L.height*.5,0),i.rectArea[g]=R,g++}else if(L.isPointLight){const R=e.get(L);if(R.color.copy(L.color).multiplyScalar(L.intensity),R.distance=L.distance,R.decay=L.decay,L.castShadow){const z=L.shadow,q=t.get(L);q.shadowIntensity=z.intensity,q.shadowBias=z.bias,q.shadowNormalBias=z.normalBias,q.shadowRadius=z.radius,q.shadowMapSize=z.mapSize,q.shadowCameraNear=z.camera.near,q.shadowCameraFar=z.camera.far,i.pointShadow[m]=q,i.pointShadowMap[m]=N,i.pointShadowMatrix[m]=L.shadow.matrix,w++}i.point[m]=R,m++}else if(L.isHemisphereLight){const R=e.get(L);R.skyColor.copy(L.color).multiplyScalar(k),R.groundColor.copy(L.groundColor).multiplyScalar(k),i.hemi[v]=R,v++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ke.LTC_FLOAT_1,i.rectAreaLTC2=Ke.LTC_FLOAT_2):(i.rectAreaLTC1=Ke.LTC_HALF_1,i.rectAreaLTC2=Ke.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=h;const _=i.hash;(_.directionalLength!==p||_.pointLength!==m||_.spotLength!==x||_.rectAreaLength!==g||_.hemiLength!==v||_.numDirectionalShadows!==y||_.numPointShadows!==w||_.numSpotShadows!==b||_.numSpotMaps!==E||_.numLightProbes!==A)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=g,i.point.length=m,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=b+E-S,i.spotLightMap.length=E,i.numSpotLightShadowsWithMaps=S,i.numLightProbes=A,_.directionalLength=p,_.pointLength=m,_.spotLength=x,_.rectAreaLength=g,_.hemiLength=v,_.numDirectionalShadows=y,_.numPointShadows=w,_.numSpotShadows=b,_.numSpotMaps=E,_.numLightProbes=A,i.version=dw++)}function l(c,d){let f=0,h=0,p=0,m=0,x=0;const g=d.matrixWorldInverse;for(let v=0,y=c.length;v<y;v++){const w=c[v];if(w.isDirectionalLight){const b=i.directional[f];b.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),f++}else if(w.isSpotLight){const b=i.spot[p];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),p++}else if(w.isRectAreaLight){const b=i.rectArea[m];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(g),a.identity(),s.copy(w.matrixWorld),s.premultiply(g),a.extractRotation(s),b.halfWidth.set(w.width*.5,0,0),b.halfHeight.set(0,w.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),m++}else if(w.isPointLight){const b=i.point[h];b.position.setFromMatrixPosition(w.matrixWorld),b.position.applyMatrix4(g),h++}else if(w.isHemisphereLight){const b=i.hemi[x];b.direction.setFromMatrixPosition(w.matrixWorld),b.direction.transformDirection(g),x++}}}return{setup:o,setupView:l,state:i}}function Mf(n){const e=new fw(n),t=[],i=[],r=[];function s(h){f.camera=h,t.length=0,i.length=0,r.length=0}function a(h){t.push(h)}function o(h){i.push(h)}function l(h){r.push(h)}function c(){e.setup(t)}function d(h){e.setupView(t,h)}const f={lightsArray:t,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:d,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function pw(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Mf(n),e.set(r,[o])):s>=a.length?(o=new Mf(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}const mw=`void main() {
|
|
4054
4054
|
gl_Position = vec4( position, 1.0 );
|
|
4055
4055
|
}`,gw=`uniform sampler2D shadow_pass;
|
|
4056
4056
|
uniform vec2 resolution;
|
|
@@ -4077,7 +4077,7 @@ void main() {
|
|
|
4077
4077
|
squared_mean = squared_mean / samples;
|
|
4078
4078
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4079
4079
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4080
|
-
}`,vw=[new X(1,0,0),new X(-1,0,0),new X(0,1,0),new X(0,-1,0),new X(0,0,1),new X(0,0,-1)],_w=[new X(0,-1,0),new X(0,-1,0),new X(0,0,1),new X(0,0,-1),new X(0,-1,0),new X(0,-1,0)],wf=new Lt,Xs=new X,rc=new X;function xw(n,e,t){let i=new Sd;const r=new it,s=new it,a=new kt,o=new vb,l=new _b,c={},d=t.maxTextureSize,f={[Kn]:Yn,[Yn]:Kn,[Qn]:Qn},h=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new it},radius:{value:4}},vertexShader:mw,fragmentShader:gw}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const g=new on;g.setAttribute("position",new kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new an(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=wo;let v=this.type;this.render=function(S,A,_){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;this.type===W0&&(ft("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=wo);const T=n.getRenderTarget(),D=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Mn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=v!==this.type;B&&A.traverse(function(U){U.material&&(Array.isArray(U.material)?U.material.forEach(N=>N.needsUpdate=!0):U.material.needsUpdate=!0)});for(let U=0,N=S.length;U<N;U++){const R=S[U],z=R.shadow;if(z===void 0){ft("WebGLShadowMap:",R,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const Y=z.getFrameExtents();r.multiply(Y),s.copy(z.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/Y.x),r.x=s.x*Y.x,z.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/Y.y),r.y=s.y*Y.y,z.mapSize.y=s.y));const K=n.state.buffers.depth.getReversed();if(z.camera._reversedDepth=K,z.map===null||B===!0){if(z.map!==null&&(z.map.depthTexture!==null&&(z.map.depthTexture.dispose(),z.map.depthTexture=null),z.map.dispose()),this.type===fs){if(R.isPointLight){ft("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}z.map=new ni(r.x,r.y,{format:Ir,type:Fn,minFilter:hn,magFilter:hn,generateMipmaps:!1}),z.map.texture.name=R.name+".shadowMap",z.map.depthTexture=new Nr(r.x,r.y,ti),z.map.depthTexture.name=R.name+".shadowMapDepth",z.map.depthTexture.format=Yi,z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=xn,z.map.depthTexture.magFilter=xn}else R.isPointLight?(z.map=new Em(r.x),z.map.depthTexture=new ub(r.x,Oi)):(z.map=new ni(r.x,r.y),z.map.depthTexture=new Nr(r.x,r.y,Oi)),z.map.depthTexture.name=R.name+".shadowMap",z.map.depthTexture.format=Yi,this.type===wo?(z.map.depthTexture.compareFunction=K?vd:gd,z.map.depthTexture.minFilter=hn,z.map.depthTexture.magFilter=hn):(z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=xn,z.map.depthTexture.magFilter=xn);z.camera.updateProjectionMatrix()}const ne=z.map.isWebGLCubeRenderTarget?6:1;for(let ce=0;ce<ne;ce++){if(z.map.isWebGLCubeRenderTarget)n.setRenderTarget(z.map,ce),n.clear();else{ce===0&&(n.setRenderTarget(z.map),n.clear());const V=z.getViewport(ce);a.set(s.x*V.x,s.y*V.y,s.x*V.z,s.y*V.w),F.viewport(a)}if(R.isPointLight){const V=z.camera,ee=z.matrix,me=R.distance||V.far;me!==V.far&&(V.far=me,V.updateProjectionMatrix()),Xs.setFromMatrixPosition(R.matrixWorld),V.position.copy(Xs),rc.copy(V.position),rc.add(vw[ce]),V.up.copy(_w[ce]),V.lookAt(rc),V.updateMatrixWorld(),ee.makeTranslation(-Xs.x,-Xs.y,-Xs.z),wf.multiplyMatrices(V.projectionMatrix,V.matrixWorldInverse),z._frustum.setFromProjectionMatrix(wf,V.coordinateSystem,V.reversedDepth)}else z.updateMatrices(R);i=z.getFrustum(),b(A,_,z.camera,R,this.type)}z.isPointLightShadow!==!0&&this.type===fs&&y(z,_),z.needsUpdate=!1}v=this.type,m.needsUpdate=!1,n.setRenderTarget(T,D,L)};function y(S,A){const _=e.update(x);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new ni(r.x,r.y,{format:Ir,type:Fn})),h.uniforms.shadow_pass.value=S.map.depthTexture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,n.setRenderTarget(S.mapPass),n.clear(),n.renderBufferDirect(A,null,_,h,x,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,n.setRenderTarget(S.map),n.clear(),n.renderBufferDirect(A,null,_,p,x,null)}function w(S,A,_,T){let D=null;const L=_.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(L!==void 0)D=L;else if(D=_.isPointLight===!0?l:o,n.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){const F=D.uuid,B=A.uuid;let U=c[F];U===void 0&&(U={},c[F]=U);let N=U[B];N===void 0&&(N=D.clone(),U[B]=N,A.addEventListener("dispose",E)),D=N}if(D.visible=A.visible,D.wireframe=A.wireframe,T===fs?D.side=A.shadowSide!==null?A.shadowSide:A.side:D.side=A.shadowSide!==null?A.shadowSide:f[A.side],D.alphaMap=A.alphaMap,D.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,D.map=A.map,D.clipShadows=A.clipShadows,D.clippingPlanes=A.clippingPlanes,D.clipIntersection=A.clipIntersection,D.displacementMap=A.displacementMap,D.displacementScale=A.displacementScale,D.displacementBias=A.displacementBias,D.wireframeLinewidth=A.wireframeLinewidth,D.linewidth=A.linewidth,_.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const F=n.properties.get(D);F.light=_}return D}function b(S,A,_,T,D){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&D===fs)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,S.matrixWorld);const B=e.update(S),U=S.material;if(Array.isArray(U)){const N=B.groups;for(let R=0,z=N.length;R<z;R++){const Y=N[R],K=U[Y.materialIndex];if(K&&K.visible){const ne=w(S,K,T,D);S.onBeforeShadow(n,S,A,_,B,ne,Y),n.renderBufferDirect(_,null,B,ne,S,Y),S.onAfterShadow(n,S,A,_,B,ne,Y)}}}else if(U.visible){const N=w(S,U,T,D);S.onBeforeShadow(n,S,A,_,B,N,null),n.renderBufferDirect(_,null,B,N,S,null),S.onAfterShadow(n,S,A,_,B,N,null)}}const F=S.children;for(let B=0,U=F.length;B<U;B++)b(F[B],A,_,T,D)}function E(S){S.target.removeEventListener("dispose",E);for(const _ in c){const T=c[_],D=S.target.uuid;D in T&&(T[D].dispose(),delete T[D])}}}function bw(n,e){function t(){let J=!1;const Ge=new kt;let Te=null;const Ze=new kt(0,0,0,0);return{setMask:function(qe){Te!==qe&&!J&&(n.colorMask(qe,qe,qe,qe),Te=qe)},setLocked:function(qe){J=qe},setClear:function(qe,Be,lt,vt,$t){$t===!0&&(qe*=vt,Be*=vt,lt*=vt),Ge.set(qe,Be,lt,vt),Ze.equals(Ge)===!1&&(n.clearColor(qe,Be,lt,vt),Ze.copy(Ge))},reset:function(){J=!1,Te=null,Ze.set(-1,0,0,0)}}}function i(){let J=!1,Ge=!1,Te=null,Ze=null,qe=null;return{setReversed:function(Be){if(Ge!==Be){const lt=e.get("EXT_clip_control");Be?lt.clipControlEXT(lt.LOWER_LEFT_EXT,lt.ZERO_TO_ONE_EXT):lt.clipControlEXT(lt.LOWER_LEFT_EXT,lt.NEGATIVE_ONE_TO_ONE_EXT),Ge=Be;const vt=qe;qe=null,this.setClear(vt)}},getReversed:function(){return Ge},setTest:function(Be){Be?Z(n.DEPTH_TEST):le(n.DEPTH_TEST)},setMask:function(Be){Te!==Be&&!J&&(n.depthMask(Be),Te=Be)},setFunc:function(Be){if(Ge&&(Be=xx[Be]),Ze!==Be){switch(Be){case Sc:n.depthFunc(n.NEVER);break;case Mc:n.depthFunc(n.ALWAYS);break;case wc:n.depthFunc(n.LESS);break;case ws:n.depthFunc(n.LEQUAL);break;case Ec:n.depthFunc(n.EQUAL);break;case Tc:n.depthFunc(n.GEQUAL);break;case Ac:n.depthFunc(n.GREATER);break;case Cc:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ze=Be}},setLocked:function(Be){J=Be},setClear:function(Be){qe!==Be&&(qe=Be,Ge&&(Be=1-Be),n.clearDepth(Be))},reset:function(){J=!1,Te=null,Ze=null,qe=null,Ge=!1}}}function r(){let J=!1,Ge=null,Te=null,Ze=null,qe=null,Be=null,lt=null,vt=null,$t=null;return{setTest:function(It){J||(It?Z(n.STENCIL_TEST):le(n.STENCIL_TEST))},setMask:function(It){Ge!==It&&!J&&(n.stencilMask(It),Ge=It)},setFunc:function(It,ii,ri){(Te!==It||Ze!==ii||qe!==ri)&&(n.stencilFunc(It,ii,ri),Te=It,Ze=ii,qe=ri)},setOp:function(It,ii,ri){(Be!==It||lt!==ii||vt!==ri)&&(n.stencilOp(It,ii,ri),Be=It,lt=ii,vt=ri)},setLocked:function(It){J=It},setClear:function(It){$t!==It&&(n.clearStencil(It),$t=It)},reset:function(){J=!1,Ge=null,Te=null,Ze=null,qe=null,Be=null,lt=null,vt=null,$t=null}}}const s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},f={},h={},p=new WeakMap,g=[],x=null,m=!1,v=null,y=null,w=null,b=null,E=null,S=null,A=null,_=new tt(0,0,0),T=0,D=!1,L=null,F=null,B=null,U=null,N=null;const R=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let z=!1,Y=0;const K=n.getParameter(n.VERSION);K.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(K)[1]),z=Y>=1):K.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),z=Y>=2);let ne=null,ce={};const V=n.getParameter(n.SCISSOR_BOX),ee=n.getParameter(n.VIEWPORT),me=new kt().fromArray(V),ve=new kt().fromArray(ee);function G(J,Ge,Te,Ze){const qe=new Uint8Array(4),Be=n.createTexture();n.bindTexture(J,Be),n.texParameteri(J,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(J,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let lt=0;lt<Te;lt++)J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?n.texImage3D(Ge,0,n.RGBA,1,1,Ze,0,n.RGBA,n.UNSIGNED_BYTE,qe):n.texImage2D(Ge+lt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,qe);return Be}const ie={};ie[n.TEXTURE_2D]=G(n.TEXTURE_2D,n.TEXTURE_2D,1),ie[n.TEXTURE_CUBE_MAP]=G(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[n.TEXTURE_2D_ARRAY]=G(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ie[n.TEXTURE_3D]=G(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Z(n.DEPTH_TEST),a.setFunc(ws),We(!1),Oe(fh),Z(n.CULL_FACE),ke(Mn);function Z(J){d[J]!==!0&&(n.enable(J),d[J]=!0)}function le(J){d[J]!==!1&&(n.disable(J),d[J]=!1)}function fe(J,Ge){return h[J]!==Ge?(n.bindFramebuffer(J,Ge),h[J]=Ge,J===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=Ge),J===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=Ge),!0):!1}function Se(J,Ge){let Te=g,Ze=!1;if(J){Te=p.get(Ge),Te===void 0&&(Te=[],p.set(Ge,Te));const qe=J.textures;if(Te.length!==qe.length||Te[0]!==n.COLOR_ATTACHMENT0){for(let Be=0,lt=qe.length;Be<lt;Be++)Te[Be]=n.COLOR_ATTACHMENT0+Be;Te.length=qe.length,Ze=!0}}else Te[0]!==n.BACK&&(Te[0]=n.BACK,Ze=!0);Ze&&n.drawBuffers(Te)}function ze(J){return x!==J?(n.useProgram(J),x=J,!0):!1}const Ue={[gi]:n.FUNC_ADD,[X0]:n.FUNC_SUBTRACT,[j0]:n.FUNC_REVERSE_SUBTRACT};Ue[q0]=n.MIN,Ue[Y0]=n.MAX;const Pe={[Js]:n.ZERO,[K0]:n.ONE,[Z0]:n.SRC_COLOR,[_c]:n.SRC_ALPHA,[ex]:n.SRC_ALPHA_SATURATE,[yc]:n.DST_COLOR,[bc]:n.DST_ALPHA,[$0]:n.ONE_MINUS_SRC_COLOR,[xc]:n.ONE_MINUS_SRC_ALPHA,[Q0]:n.ONE_MINUS_DST_COLOR,[J0]:n.ONE_MINUS_DST_ALPHA,[tx]:n.CONSTANT_COLOR,[nx]:n.ONE_MINUS_CONSTANT_COLOR,[ix]:n.CONSTANT_ALPHA,[rx]:n.ONE_MINUS_CONSTANT_ALPHA};function ke(J,Ge,Te,Ze,qe,Be,lt,vt,$t,It){if(J===Mn){m===!0&&(le(n.BLEND),m=!1);return}if(m===!1&&(Z(n.BLEND),m=!0),J!==Qp){if(J!==v||It!==D){if((y!==gi||E!==gi)&&(n.blendEquation(n.FUNC_ADD),y=gi,E=gi),It)switch(J){case bs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ph:n.blendFunc(n.ONE,n.ONE);break;case mh:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case gh:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Tt("WebGLState: Invalid blending: ",J);break}else switch(J){case bs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ph:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case mh:Tt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case gh:Tt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Tt("WebGLState: Invalid blending: ",J);break}w=null,b=null,S=null,A=null,_.set(0,0,0),T=0,v=J,D=It}return}qe=qe||Ge,Be=Be||Te,lt=lt||Ze,(Ge!==y||qe!==E)&&(n.blendEquationSeparate(Ue[Ge],Ue[qe]),y=Ge,E=qe),(Te!==w||Ze!==b||Be!==S||lt!==A)&&(n.blendFuncSeparate(Pe[Te],Pe[Ze],Pe[Be],Pe[lt]),w=Te,b=Ze,S=Be,A=lt),(vt.equals(_)===!1||$t!==T)&&(n.blendColor(vt.r,vt.g,vt.b,$t),_.copy(vt),T=$t),v=J,D=!1}function Ie(J,Ge){J.side===Qn?le(n.CULL_FACE):Z(n.CULL_FACE);let Te=J.side===Yn;Ge&&(Te=!Te),We(Te),J.blending===bs&&J.transparent===!1?ke(Mn):ke(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.blendColor,J.blendAlpha,J.premultipliedAlpha),a.setFunc(J.depthFunc),a.setTest(J.depthTest),a.setMask(J.depthWrite),s.setMask(J.colorWrite);const Ze=J.stencilWrite;o.setTest(Ze),Ze&&(o.setMask(J.stencilWriteMask),o.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),o.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),k(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?Z(n.SAMPLE_ALPHA_TO_COVERAGE):le(n.SAMPLE_ALPHA_TO_COVERAGE)}function We(J){L!==J&&(J?n.frontFace(n.CW):n.frontFace(n.CCW),L=J)}function Oe(J){J!==H0?(Z(n.CULL_FACE),J!==F&&(J===fh?n.cullFace(n.BACK):J===G0?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):le(n.CULL_FACE),F=J}function He(J){J!==B&&(z&&n.lineWidth(J),B=J)}function k(J,Ge,Te){J?(Z(n.POLYGON_OFFSET_FILL),(U!==Ge||N!==Te)&&(U=Ge,N=Te,a.getReversed()&&(Ge=-Ge),n.polygonOffset(Ge,Te))):le(n.POLYGON_OFFSET_FILL)}function je(J){J?Z(n.SCISSOR_TEST):le(n.SCISSOR_TEST)}function Ve(J){J===void 0&&(J=n.TEXTURE0+R-1),ne!==J&&(n.activeTexture(J),ne=J)}function Xe(J,Ge,Te){Te===void 0&&(ne===null?Te=n.TEXTURE0+R-1:Te=ne);let Ze=ce[Te];Ze===void 0&&(Ze={type:void 0,texture:void 0},ce[Te]=Ze),(Ze.type!==J||Ze.texture!==Ge)&&(ne!==Te&&(n.activeTexture(Te),ne=Te),n.bindTexture(J,Ge||ie[J]),Ze.type=J,Ze.texture=Ge)}function ye(){const J=ce[ne];J!==void 0&&J.type!==void 0&&(n.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function Ce(){try{n.compressedTexImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function C(){try{n.compressedTexImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function M(){try{n.texSubImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function H(){try{n.texSubImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function re(){try{n.compressedTexSubImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ue(){try{n.compressedTexSubImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function be(){try{n.texStorage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ge(){try{n.texStorage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ae(){try{n.texImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function he(){try{n.texImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function Re(J){return f[J]!==void 0?f[J]:n.getParameter(J)}function Le(J,Ge){f[J]!==Ge&&(n.pixelStorei(J,Ge),f[J]=Ge)}function Ee(J){me.equals(J)===!1&&(n.scissor(J.x,J.y,J.z,J.w),me.copy(J))}function De(J){ve.equals(J)===!1&&(n.viewport(J.x,J.y,J.z,J.w),ve.copy(J))}function et(J,Ge){let Te=c.get(Ge);Te===void 0&&(Te=new WeakMap,c.set(Ge,Te));let Ze=Te.get(J);Ze===void 0&&(Ze=n.getUniformBlockIndex(Ge,J.name),Te.set(J,Ze))}function Ye(J,Ge){const Ze=c.get(Ge).get(J);l.get(Ge)!==Ze&&(n.uniformBlockBinding(Ge,Ze,J.__bindingPointIndex),l.set(Ge,Ze))}function ht(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),d={},f={},ne=null,ce={},h={},p=new WeakMap,g=[],x=null,m=!1,v=null,y=null,w=null,b=null,E=null,S=null,A=null,_=new tt(0,0,0),T=0,D=!1,L=null,F=null,B=null,U=null,N=null,me.set(0,0,n.canvas.width,n.canvas.height),ve.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:Z,disable:le,bindFramebuffer:fe,drawBuffers:Se,useProgram:ze,setBlending:ke,setMaterial:Ie,setFlipSided:We,setCullFace:Oe,setLineWidth:He,setPolygonOffset:k,setScissorTest:je,activeTexture:Ve,bindTexture:Xe,unbindTexture:ye,compressedTexImage2D:Ce,compressedTexImage3D:C,texImage2D:ae,texImage3D:he,pixelStorei:Le,getParameter:Re,updateUBOMapping:et,uniformBlockBinding:Ye,texStorage2D:be,texStorage3D:ge,texSubImage2D:M,texSubImage3D:H,compressedTexSubImage2D:re,compressedTexSubImage3D:ue,scissor:Ee,viewport:De,reset:ht}}function yw(n,e,t,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new it,d=new WeakMap,f=new Set;let h;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(C,M){return g?new OffscreenCanvas(C,M):Xo("canvas")}function m(C,M,H){let re=1;const ue=Ce(C);if((ue.width>H||ue.height>H)&&(re=H/Math.max(ue.width,ue.height)),re<1)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap||typeof VideoFrame<"u"&&C instanceof VideoFrame){const be=Math.floor(re*ue.width),ge=Math.floor(re*ue.height);h===void 0&&(h=x(be,ge));const ae=M?x(be,ge):h;return ae.width=be,ae.height=ge,ae.getContext("2d").drawImage(C,0,0,be,ge),ft("WebGLRenderer: Texture has been resized from ("+ue.width+"x"+ue.height+") to ("+be+"x"+ge+")."),ae}else return"data"in C&&ft("WebGLRenderer: Image in DataTexture is too big ("+ue.width+"x"+ue.height+")."),C;return C}function v(C){return C.generateMipmaps}function y(C){n.generateMipmap(C)}function w(C){return C.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:C.isWebGL3DRenderTarget?n.TEXTURE_3D:C.isWebGLArrayRenderTarget||C.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(C,M,H,re,ue,be=!1){if(C!==null){if(n[C]!==void 0)return n[C];ft("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let ge;re&&(ge=e.get("EXT_texture_norm16"),ge||ft("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ae=M;if(M===n.RED&&(H===n.FLOAT&&(ae=n.R32F),H===n.HALF_FLOAT&&(ae=n.R16F),H===n.UNSIGNED_BYTE&&(ae=n.R8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.R16_EXT),H===n.SHORT&&ge&&(ae=ge.R16_SNORM_EXT)),M===n.RED_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.R8UI),H===n.UNSIGNED_SHORT&&(ae=n.R16UI),H===n.UNSIGNED_INT&&(ae=n.R32UI),H===n.BYTE&&(ae=n.R8I),H===n.SHORT&&(ae=n.R16I),H===n.INT&&(ae=n.R32I)),M===n.RG&&(H===n.FLOAT&&(ae=n.RG32F),H===n.HALF_FLOAT&&(ae=n.RG16F),H===n.UNSIGNED_BYTE&&(ae=n.RG8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RG16_EXT),H===n.SHORT&&ge&&(ae=ge.RG16_SNORM_EXT)),M===n.RG_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RG8UI),H===n.UNSIGNED_SHORT&&(ae=n.RG16UI),H===n.UNSIGNED_INT&&(ae=n.RG32UI),H===n.BYTE&&(ae=n.RG8I),H===n.SHORT&&(ae=n.RG16I),H===n.INT&&(ae=n.RG32I)),M===n.RGB_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RGB8UI),H===n.UNSIGNED_SHORT&&(ae=n.RGB16UI),H===n.UNSIGNED_INT&&(ae=n.RGB32UI),H===n.BYTE&&(ae=n.RGB8I),H===n.SHORT&&(ae=n.RGB16I),H===n.INT&&(ae=n.RGB32I)),M===n.RGBA_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RGBA8UI),H===n.UNSIGNED_SHORT&&(ae=n.RGBA16UI),H===n.UNSIGNED_INT&&(ae=n.RGBA32UI),H===n.BYTE&&(ae=n.RGBA8I),H===n.SHORT&&(ae=n.RGBA16I),H===n.INT&&(ae=n.RGBA32I)),M===n.RGB&&(H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RGB16_EXT),H===n.SHORT&&ge&&(ae=ge.RGB16_SNORM_EXT),H===n.UNSIGNED_INT_5_9_9_9_REV&&(ae=n.RGB9_E5),H===n.UNSIGNED_INT_10F_11F_11F_REV&&(ae=n.R11F_G11F_B10F)),M===n.RGBA){const he=be?Wo:At.getTransfer(ue);H===n.FLOAT&&(ae=n.RGBA32F),H===n.HALF_FLOAT&&(ae=n.RGBA16F),H===n.UNSIGNED_BYTE&&(ae=he===Ut?n.SRGB8_ALPHA8:n.RGBA8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RGBA16_EXT),H===n.SHORT&&ge&&(ae=ge.RGBA16_SNORM_EXT),H===n.UNSIGNED_SHORT_4_4_4_4&&(ae=n.RGBA4),H===n.UNSIGNED_SHORT_5_5_5_1&&(ae=n.RGB5_A1)}return(ae===n.R16F||ae===n.R32F||ae===n.RG16F||ae===n.RG32F||ae===n.RGBA16F||ae===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function E(C,M){let H;return C?M===null||M===Oi||M===Ts?H=n.DEPTH24_STENCIL8:M===ti?H=n.DEPTH32F_STENCIL8:M===aa&&(H=n.DEPTH24_STENCIL8,ft("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===Oi||M===Ts?H=n.DEPTH_COMPONENT24:M===ti?H=n.DEPTH_COMPONENT32F:M===aa&&(H=n.DEPTH_COMPONENT16),H}function S(C,M){return v(C)===!0||C.isFramebufferTexture&&C.minFilter!==xn&&C.minFilter!==hn?Math.log2(Math.max(M.width,M.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?M.mipmaps.length:1}function A(C){const M=C.target;M.removeEventListener("dispose",A),T(M),M.isVideoTexture&&d.delete(M),M.isHTMLTexture&&f.delete(M)}function _(C){const M=C.target;M.removeEventListener("dispose",_),L(M)}function T(C){const M=i.get(C);if(M.__webglInit===void 0)return;const H=C.source,re=p.get(H);if(re){const ue=re[M.__cacheKey];ue.usedTimes--,ue.usedTimes===0&&D(C),Object.keys(re).length===0&&p.delete(H)}i.remove(C)}function D(C){const M=i.get(C);n.deleteTexture(M.__webglTexture);const H=C.source,re=p.get(H);delete re[M.__cacheKey],a.memory.textures--}function L(C){const M=i.get(C);if(C.depthTexture&&(C.depthTexture.dispose(),i.remove(C.depthTexture)),C.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(M.__webglFramebuffer[re]))for(let ue=0;ue<M.__webglFramebuffer[re].length;ue++)n.deleteFramebuffer(M.__webglFramebuffer[re][ue]);else n.deleteFramebuffer(M.__webglFramebuffer[re]);M.__webglDepthbuffer&&n.deleteRenderbuffer(M.__webglDepthbuffer[re])}else{if(Array.isArray(M.__webglFramebuffer))for(let re=0;re<M.__webglFramebuffer.length;re++)n.deleteFramebuffer(M.__webglFramebuffer[re]);else n.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&n.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&n.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let re=0;re<M.__webglColorRenderbuffer.length;re++)M.__webglColorRenderbuffer[re]&&n.deleteRenderbuffer(M.__webglColorRenderbuffer[re]);M.__webglDepthRenderbuffer&&n.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const H=C.textures;for(let re=0,ue=H.length;re<ue;re++){const be=i.get(H[re]);be.__webglTexture&&(n.deleteTexture(be.__webglTexture),a.memory.textures--),i.remove(H[re])}i.remove(C)}let F=0;function B(){F=0}function U(){return F}function N(C){F=C}function R(){const C=F;return C>=r.maxTextures&&ft("WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+r.maxTextures),F+=1,C}function z(C){const M=[];return M.push(C.wrapS),M.push(C.wrapT),M.push(C.wrapR||0),M.push(C.magFilter),M.push(C.minFilter),M.push(C.anisotropy),M.push(C.internalFormat),M.push(C.format),M.push(C.type),M.push(C.generateMipmaps),M.push(C.premultiplyAlpha),M.push(C.flipY),M.push(C.unpackAlignment),M.push(C.colorSpace),M.join()}function Y(C,M){const H=i.get(C);if(C.isVideoTexture&&Xe(C),C.isRenderTargetTexture===!1&&C.isExternalTexture!==!0&&C.version>0&&H.__version!==C.version){const re=C.image;if(re===null)ft("WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)ft("WebGLRenderer: Texture marked for update but image is incomplete");else{le(H,C,M);return}}else C.isExternalTexture&&(H.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,H.__webglTexture,n.TEXTURE0+M)}function K(C,M){const H=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&H.__version!==C.version){le(H,C,M);return}else C.isExternalTexture&&(H.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,H.__webglTexture,n.TEXTURE0+M)}function ne(C,M){const H=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&H.__version!==C.version){le(H,C,M);return}t.bindTexture(n.TEXTURE_3D,H.__webglTexture,n.TEXTURE0+M)}function ce(C,M){const H=i.get(C);if(C.isCubeDepthTexture!==!0&&C.version>0&&H.__version!==C.version){fe(H,C,M);return}t.bindTexture(n.TEXTURE_CUBE_MAP,H.__webglTexture,n.TEXTURE0+M)}const V={[Lr]:n.REPEAT,[_i]:n.CLAMP_TO_EDGE,[Pc]:n.MIRRORED_REPEAT},ee={[xn]:n.NEAREST,[ox]:n.NEAREST_MIPMAP_NEAREST,[Ca]:n.NEAREST_MIPMAP_LINEAR,[hn]:n.LINEAR,[El]:n.LINEAR_MIPMAP_NEAREST,[lr]:n.LINEAR_MIPMAP_LINEAR},me={[ux]:n.NEVER,[mx]:n.ALWAYS,[dx]:n.LESS,[gd]:n.LEQUAL,[hx]:n.EQUAL,[vd]:n.GEQUAL,[fx]:n.GREATER,[px]:n.NOTEQUAL};function ve(C,M){if(M.type===ti&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===hn||M.magFilter===El||M.magFilter===Ca||M.magFilter===lr||M.minFilter===hn||M.minFilter===El||M.minFilter===Ca||M.minFilter===lr)&&ft("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(C,n.TEXTURE_WRAP_S,V[M.wrapS]),n.texParameteri(C,n.TEXTURE_WRAP_T,V[M.wrapT]),(C===n.TEXTURE_3D||C===n.TEXTURE_2D_ARRAY)&&n.texParameteri(C,n.TEXTURE_WRAP_R,V[M.wrapR]),n.texParameteri(C,n.TEXTURE_MAG_FILTER,ee[M.magFilter]),n.texParameteri(C,n.TEXTURE_MIN_FILTER,ee[M.minFilter]),M.compareFunction&&(n.texParameteri(C,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(C,n.TEXTURE_COMPARE_FUNC,me[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===xn||M.minFilter!==Ca&&M.minFilter!==lr||M.type===ti&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||i.get(M).__currentAnisotropy){const H=e.get("EXT_texture_filter_anisotropic");n.texParameterf(C,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy}}}function G(C,M){let H=!1;C.__webglInit===void 0&&(C.__webglInit=!0,M.addEventListener("dispose",A));const re=M.source;let ue=p.get(re);ue===void 0&&(ue={},p.set(re,ue));const be=z(M);if(be!==C.__cacheKey){ue[be]===void 0&&(ue[be]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,H=!0),ue[be].usedTimes++;const ge=ue[C.__cacheKey];ge!==void 0&&(ue[C.__cacheKey].usedTimes--,ge.usedTimes===0&&D(M)),C.__cacheKey=be,C.__webglTexture=ue[be].texture}return H}function ie(C,M,H){return Math.floor(Math.floor(C/H)/M)}function Z(C,M,H,re){const be=C.updateRanges;if(be.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,M.width,M.height,H,re,M.data);else{be.sort((Le,Ee)=>Le.start-Ee.start);let ge=0;for(let Le=1;Le<be.length;Le++){const Ee=be[ge],De=be[Le],et=Ee.start+Ee.count,Ye=ie(De.start,M.width,4),ht=ie(Ee.start,M.width,4);De.start<=et+1&&Ye===ht&&ie(De.start+De.count-1,M.width,4)===Ye?Ee.count=Math.max(Ee.count,De.start+De.count-Ee.start):(++ge,be[ge]=De)}be.length=ge+1;const ae=t.getParameter(n.UNPACK_ROW_LENGTH),he=t.getParameter(n.UNPACK_SKIP_PIXELS),Re=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,M.width);for(let Le=0,Ee=be.length;Le<Ee;Le++){const De=be[Le],et=Math.floor(De.start/4),Ye=Math.ceil(De.count/4),ht=et%M.width,J=Math.floor(et/M.width),Ge=Ye,Te=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,ht),t.pixelStorei(n.UNPACK_SKIP_ROWS,J),t.texSubImage2D(n.TEXTURE_2D,0,ht,J,Ge,Te,H,re,M.data)}C.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,ae),t.pixelStorei(n.UNPACK_SKIP_PIXELS,he),t.pixelStorei(n.UNPACK_SKIP_ROWS,Re)}}function le(C,M,H){let re=n.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(re=n.TEXTURE_2D_ARRAY),M.isData3DTexture&&(re=n.TEXTURE_3D);const ue=G(C,M),be=M.source;t.bindTexture(re,C.__webglTexture,n.TEXTURE0+H);const ge=i.get(be);if(be.version!==ge.__version||ue===!0){if(t.activeTexture(n.TEXTURE0+H),(typeof ImageBitmap<"u"&&M.image instanceof ImageBitmap)===!1){const Te=At.getPrimaries(At.workingColorSpace),Ze=M.colorSpace===ar?null:At.getPrimaries(M.colorSpace),qe=M.colorSpace===ar||Te===Ze?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe)}t.pixelStorei(n.UNPACK_ALIGNMENT,M.unpackAlignment);let he=m(M.image,!1,r.maxTextureSize);he=ye(M,he);const Re=s.convert(M.format,M.colorSpace),Le=s.convert(M.type);let Ee=b(M.internalFormat,Re,Le,M.normalized,M.colorSpace,M.isVideoTexture);ve(re,M);let De;const et=M.mipmaps,Ye=M.isVideoTexture!==!0,ht=ge.__version===void 0||ue===!0,J=be.dataReady,Ge=S(M,he);if(M.isDepthTexture)Ee=E(M.format===cr,M.type),ht&&(Ye?t.texStorage2D(n.TEXTURE_2D,1,Ee,he.width,he.height):t.texImage2D(n.TEXTURE_2D,0,Ee,he.width,he.height,0,Re,Le,null));else if(M.isDataTexture)if(et.length>0){Ye&&ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,et[0].width,et[0].height);for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,Le,De.data):t.texImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,Re,Le,De.data);M.generateMipmaps=!1}else Ye?(ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,he.width,he.height),J&&Z(M,he,Re,Le)):t.texImage2D(n.TEXTURE_2D,0,Ee,he.width,he.height,0,Re,Le,he.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ye&&ht&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ge,Ee,et[0].width,et[0].height,he.depth);for(let Te=0,Ze=et.length;Te<Ze;Te++)if(De=et[Te],M.format!==li)if(Re!==null)if(Ye){if(J)if(M.layerUpdates.size>0){const qe=ef(De.width,De.height,M.format,M.type);for(const Be of M.layerUpdates){const lt=De.data.subarray(Be*qe/De.data.BYTES_PER_ELEMENT,(Be+1)*qe/De.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,Be,De.width,De.height,1,Re,lt)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,De.width,De.height,he.depth,Re,De.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Te,Ee,De.width,De.height,he.depth,0,De.data,0,0);else ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ye?J&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,De.width,De.height,he.depth,Re,Le,De.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Te,Ee,De.width,De.height,he.depth,0,Re,Le,De.data)}else{Ye&&ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,et[0].width,et[0].height);for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],M.format!==li?Re!==null?Ye?J&&t.compressedTexSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,De.data):t.compressedTexImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,De.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,Le,De.data):t.texImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,Re,Le,De.data)}else if(M.isDataArrayTexture)if(Ye){if(ht&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ge,Ee,he.width,he.height,he.depth),J)if(M.layerUpdates.size>0){const Te=ef(he.width,he.height,M.format,M.type);for(const Ze of M.layerUpdates){const qe=he.data.subarray(Ze*Te/he.data.BYTES_PER_ELEMENT,(Ze+1)*Te/he.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ze,he.width,he.height,1,Re,Le,qe)}M.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Re,Le,he.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ee,he.width,he.height,he.depth,0,Re,Le,he.data);else if(M.isData3DTexture)Ye?(ht&&t.texStorage3D(n.TEXTURE_3D,Ge,Ee,he.width,he.height,he.depth),J&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Re,Le,he.data)):t.texImage3D(n.TEXTURE_3D,0,Ee,he.width,he.height,he.depth,0,Re,Le,he.data);else if(M.isFramebufferTexture){if(ht)if(Ye)t.texStorage2D(n.TEXTURE_2D,Ge,Ee,he.width,he.height);else{let Te=he.width,Ze=he.height;for(let qe=0;qe<Ge;qe++)t.texImage2D(n.TEXTURE_2D,qe,Ee,Te,Ze,0,Re,Le,null),Te>>=1,Ze>>=1}}else if(M.isHTMLTexture){if("texElementImage2D"in n){const Te=n.canvas;if(Te.hasAttribute("layoutsubtree")||Te.setAttribute("layoutsubtree","true"),he.parentNode!==Te){Te.appendChild(he),f.add(M),Te.onpaint=vt=>{const $t=vt.changedElements;for(const It of f)$t.includes(It.image)&&(It.needsUpdate=!0)},Te.requestPaint();return}const Ze=0,qe=n.RGBA,Be=n.RGBA,lt=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,Ze,qe,Be,lt,he),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(et.length>0){if(Ye&&ht){const Te=Ce(et[0]);t.texStorage2D(n.TEXTURE_2D,Ge,Ee,Te.width,Te.height)}for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Re,Le,De):t.texImage2D(n.TEXTURE_2D,Te,Ee,Re,Le,De);M.generateMipmaps=!1}else if(Ye){if(ht){const Te=Ce(he);t.texStorage2D(n.TEXTURE_2D,Ge,Ee,Te.width,Te.height)}J&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Re,Le,he)}else t.texImage2D(n.TEXTURE_2D,0,Ee,Re,Le,he);v(M)&&y(re),ge.__version=be.version,M.onUpdate&&M.onUpdate(M)}C.__version=M.version}function fe(C,M,H){if(M.image.length!==6)return;const re=G(C,M),ue=M.source;t.bindTexture(n.TEXTURE_CUBE_MAP,C.__webglTexture,n.TEXTURE0+H);const be=i.get(ue);if(ue.version!==be.__version||re===!0){t.activeTexture(n.TEXTURE0+H);const ge=At.getPrimaries(At.workingColorSpace),ae=M.colorSpace===ar?null:At.getPrimaries(M.colorSpace),he=M.colorSpace===ar||ge===ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,he);const Re=M.isCompressedTexture||M.image[0].isCompressedTexture,Le=M.image[0]&&M.image[0].isDataTexture,Ee=[];for(let Be=0;Be<6;Be++)!Re&&!Le?Ee[Be]=m(M.image[Be],!0,r.maxCubemapSize):Ee[Be]=Le?M.image[Be].image:M.image[Be],Ee[Be]=ye(M,Ee[Be]);const De=Ee[0],et=s.convert(M.format,M.colorSpace),Ye=s.convert(M.type),ht=b(M.internalFormat,et,Ye,M.normalized,M.colorSpace),J=M.isVideoTexture!==!0,Ge=be.__version===void 0||re===!0,Te=ue.dataReady;let Ze=S(M,De);ve(n.TEXTURE_CUBE_MAP,M);let qe;if(Re){J&&Ge&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,ht,De.width,De.height);for(let Be=0;Be<6;Be++){qe=Ee[Be].mipmaps;for(let lt=0;lt<qe.length;lt++){const vt=qe[lt];M.format!==li?et!==null?J?Te&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,0,0,vt.width,vt.height,et,vt.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,ht,vt.width,vt.height,0,vt.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,0,0,vt.width,vt.height,et,Ye,vt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,ht,vt.width,vt.height,0,et,Ye,vt.data)}}}else{if(qe=M.mipmaps,J&&Ge){qe.length>0&&Ze++;const Be=Ce(Ee[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,ht,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Le){J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,Ee[Be].width,Ee[Be].height,et,Ye,Ee[Be].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,ht,Ee[Be].width,Ee[Be].height,0,et,Ye,Ee[Be].data);for(let lt=0;lt<qe.length;lt++){const $t=qe[lt].image[Be].image;J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,0,0,$t.width,$t.height,et,Ye,$t.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,ht,$t.width,$t.height,0,et,Ye,$t.data)}}else{J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,et,Ye,Ee[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,ht,et,Ye,Ee[Be]);for(let lt=0;lt<qe.length;lt++){const vt=qe[lt];J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,0,0,et,Ye,vt.image[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,ht,et,Ye,vt.image[Be])}}}v(M)&&y(n.TEXTURE_CUBE_MAP),be.__version=ue.version,M.onUpdate&&M.onUpdate(M)}C.__version=M.version}function Se(C,M,H,re,ue,be){const ge=s.convert(H.format,H.colorSpace),ae=s.convert(H.type),he=b(H.internalFormat,ge,ae,H.normalized,H.colorSpace),Re=i.get(M),Le=i.get(H);if(Le.__renderTarget=M,!Re.__hasExternalTextures){const Ee=Math.max(1,M.width>>be),De=Math.max(1,M.height>>be);ue===n.TEXTURE_3D||ue===n.TEXTURE_2D_ARRAY?t.texImage3D(ue,be,he,Ee,De,M.depth,0,ge,ae,null):t.texImage2D(ue,be,he,Ee,De,0,ge,ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,C),Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,re,ue,Le.__webglTexture,0,je(M)):(ue===n.TEXTURE_2D||ue>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ue<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,re,ue,Le.__webglTexture,be),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ze(C,M,H){if(n.bindRenderbuffer(n.RENDERBUFFER,C),M.depthBuffer){const re=M.depthTexture,ue=re&&re.isDepthTexture?re.type:null,be=E(M.stencilBuffer,ue),ge=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Ve(M)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je(M),be,M.width,M.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,je(M),be,M.width,M.height):n.renderbufferStorage(n.RENDERBUFFER,be,M.width,M.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ge,n.RENDERBUFFER,C)}else{const re=M.textures;for(let ue=0;ue<re.length;ue++){const be=re[ue],ge=s.convert(be.format,be.colorSpace),ae=s.convert(be.type),he=b(be.internalFormat,ge,ae,be.normalized,be.colorSpace);Ve(M)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je(M),he,M.width,M.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,je(M),he,M.width,M.height):n.renderbufferStorage(n.RENDERBUFFER,he,M.width,M.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ue(C,M,H){const re=M.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,C),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ue=i.get(M.depthTexture);if(ue.__renderTarget=M,(!ue.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),re){if(ue.__webglInit===void 0&&(ue.__webglInit=!0,M.depthTexture.addEventListener("dispose",A)),ue.__webglTexture===void 0){ue.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,ue.__webglTexture),ve(n.TEXTURE_CUBE_MAP,M.depthTexture);const Re=s.convert(M.depthTexture.format),Le=s.convert(M.depthTexture.type);let Ee;M.depthTexture.format===Yi?Ee=n.DEPTH_COMPONENT24:M.depthTexture.format===cr&&(Ee=n.DEPTH24_STENCIL8);for(let De=0;De<6;De++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Ee,M.width,M.height,0,Re,Le,null)}}else Y(M.depthTexture,0);const be=ue.__webglTexture,ge=je(M),ae=re?n.TEXTURE_CUBE_MAP_POSITIVE_X+H:n.TEXTURE_2D,he=M.depthTexture.format===cr?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(M.depthTexture.format===Yi)Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,ae,be,0,ge):n.framebufferTexture2D(n.FRAMEBUFFER,he,ae,be,0);else if(M.depthTexture.format===cr)Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,ae,be,0,ge):n.framebufferTexture2D(n.FRAMEBUFFER,he,ae,be,0);else throw new Error("Unknown depthTexture format")}function Pe(C){const M=i.get(C),H=C.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==C.depthTexture){const re=C.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),re){const ue=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,re.removeEventListener("dispose",ue)};re.addEventListener("dispose",ue),M.__depthDisposeCallback=ue}M.__boundDepthTexture=re}if(C.depthTexture&&!M.__autoAllocateDepthBuffer)if(H)for(let re=0;re<6;re++)Ue(M.__webglFramebuffer[re],C,re);else{const re=C.texture.mipmaps;re&&re.length>0?Ue(M.__webglFramebuffer[0],C,0):Ue(M.__webglFramebuffer,C,0)}else if(H){M.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer[re]),M.__webglDepthbuffer[re]===void 0)M.__webglDepthbuffer[re]=n.createRenderbuffer(),ze(M.__webglDepthbuffer[re],C,!1);else{const ue=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,be=M.__webglDepthbuffer[re];n.bindRenderbuffer(n.RENDERBUFFER,be),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,be)}}else{const re=C.texture.mipmaps;if(re&&re.length>0?t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=n.createRenderbuffer(),ze(M.__webglDepthbuffer,C,!1);else{const ue=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,be=M.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,be),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,be)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ke(C,M,H){const re=i.get(C);M!==void 0&&Se(re.__webglFramebuffer,C,C.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),H!==void 0&&Pe(C)}function Ie(C){const M=C.texture,H=i.get(C),re=i.get(M);C.addEventListener("dispose",_);const ue=C.textures,be=C.isWebGLCubeRenderTarget===!0,ge=ue.length>1;if(ge||(re.__webglTexture===void 0&&(re.__webglTexture=n.createTexture()),re.__version=M.version,a.memory.textures++),be){H.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0){H.__webglFramebuffer[ae]=[];for(let he=0;he<M.mipmaps.length;he++)H.__webglFramebuffer[ae][he]=n.createFramebuffer()}else H.__webglFramebuffer[ae]=n.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){H.__webglFramebuffer=[];for(let ae=0;ae<M.mipmaps.length;ae++)H.__webglFramebuffer[ae]=n.createFramebuffer()}else H.__webglFramebuffer=n.createFramebuffer();if(ge)for(let ae=0,he=ue.length;ae<he;ae++){const Re=i.get(ue[ae]);Re.__webglTexture===void 0&&(Re.__webglTexture=n.createTexture(),a.memory.textures++)}if(C.samples>0&&Ve(C)===!1){H.__webglMultisampledFramebuffer=n.createFramebuffer(),H.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let ae=0;ae<ue.length;ae++){const he=ue[ae];H.__webglColorRenderbuffer[ae]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,H.__webglColorRenderbuffer[ae]);const Re=s.convert(he.format,he.colorSpace),Le=s.convert(he.type),Ee=b(he.internalFormat,Re,Le,he.normalized,he.colorSpace,C.isXRRenderTarget===!0),De=je(C);n.renderbufferStorageMultisample(n.RENDERBUFFER,De,Ee,C.width,C.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ae,n.RENDERBUFFER,H.__webglColorRenderbuffer[ae])}n.bindRenderbuffer(n.RENDERBUFFER,null),C.depthBuffer&&(H.__webglDepthRenderbuffer=n.createRenderbuffer(),ze(H.__webglDepthRenderbuffer,C,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(be){t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),ve(n.TEXTURE_CUBE_MAP,M);for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0)for(let he=0;he<M.mipmaps.length;he++)Se(H.__webglFramebuffer[ae][he],C,M,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,he);else Se(H.__webglFramebuffer[ae],C,M,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);v(M)&&y(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ge){for(let ae=0,he=ue.length;ae<he;ae++){const Re=ue[ae],Le=i.get(Re);let Ee=n.TEXTURE_2D;(C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(Ee=C.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Ee,Le.__webglTexture),ve(Ee,Re),Se(H.__webglFramebuffer,C,Re,n.COLOR_ATTACHMENT0+ae,Ee,0),v(Re)&&y(Ee)}t.unbindTexture()}else{let ae=n.TEXTURE_2D;if((C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(ae=C.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ae,re.__webglTexture),ve(ae,M),M.mipmaps&&M.mipmaps.length>0)for(let he=0;he<M.mipmaps.length;he++)Se(H.__webglFramebuffer[he],C,M,n.COLOR_ATTACHMENT0,ae,he);else Se(H.__webglFramebuffer,C,M,n.COLOR_ATTACHMENT0,ae,0);v(M)&&y(ae),t.unbindTexture()}C.depthBuffer&&Pe(C)}function We(C){const M=C.textures;for(let H=0,re=M.length;H<re;H++){const ue=M[H];if(v(ue)){const be=w(C),ge=i.get(ue).__webglTexture;t.bindTexture(be,ge),y(be),t.unbindTexture()}}}const Oe=[],He=[];function k(C){if(C.samples>0){if(Ve(C)===!1){const M=C.textures,H=C.width,re=C.height;let ue=n.COLOR_BUFFER_BIT;const be=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ge=i.get(C),ae=M.length>1;if(ae)for(let Re=0;Re<M.length;Re++)t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer);const he=C.texture.mipmaps;he&&he.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Re=0;Re<M.length;Re++){if(C.resolveDepthBuffer&&(C.depthBuffer&&(ue|=n.DEPTH_BUFFER_BIT),C.stencilBuffer&&C.resolveStencilBuffer&&(ue|=n.STENCIL_BUFFER_BIT)),ae){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ge.__webglColorRenderbuffer[Re]);const Le=i.get(M[Re]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Le,0)}n.blitFramebuffer(0,0,H,re,0,0,H,re,ue,n.NEAREST),l===!0&&(Oe.length=0,He.length=0,Oe.push(n.COLOR_ATTACHMENT0+Re),C.depthBuffer&&C.resolveDepthBuffer===!1&&(Oe.push(be),He.push(be),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,He)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Oe))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ae)for(let Re=0;Re<M.length;Re++){t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,ge.__webglColorRenderbuffer[Re]);const Le=i.get(M[Re]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,Le,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(C.depthBuffer&&C.resolveDepthBuffer===!1&&l){const M=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[M])}}}function je(C){return Math.min(r.maxSamples,C.samples)}function Ve(C){const M=i.get(C);return C.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Xe(C){const M=a.render.frame;d.get(C)!==M&&(d.set(C,M),C.update())}function ye(C,M){const H=C.colorSpace,re=C.format,ue=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||H!==oa&&H!==ar&&(At.getTransfer(H)===Ut?(re!==li||ue!==qn)&&ft("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Tt("WebGLTextures: Unsupported texture color space:",H)),M}function Ce(C){return typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement?(c.width=C.naturalWidth||C.width,c.height=C.naturalHeight||C.height):typeof VideoFrame<"u"&&C instanceof VideoFrame?(c.width=C.displayWidth,c.height=C.displayHeight):(c.width=C.width,c.height=C.height),c}this.allocateTextureUnit=R,this.resetTextureUnits=B,this.getTextureUnits=U,this.setTextureUnits=N,this.setTexture2D=Y,this.setTexture2DArray=K,this.setTexture3D=ne,this.setTextureCube=ce,this.rebindTextures=ke,this.setupRenderTarget=Ie,this.updateRenderTargetMipmap=We,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=Pe,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=Ve,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Sw(n,e){function t(i,r=ar){let s;const a=At.getTransfer(r);if(i===qn)return n.UNSIGNED_BYTE;if(i===dd)return n.UNSIGNED_SHORT_4_4_4_4;if(i===hd)return n.UNSIGNED_SHORT_5_5_5_1;if(i===rm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===sm)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===nm)return n.BYTE;if(i===im)return n.SHORT;if(i===aa)return n.UNSIGNED_SHORT;if(i===ud)return n.INT;if(i===Oi)return n.UNSIGNED_INT;if(i===ti)return n.FLOAT;if(i===Fn)return n.HALF_FLOAT;if(i===am)return n.ALPHA;if(i===om)return n.RGB;if(i===li)return n.RGBA;if(i===Yi)return n.DEPTH_COMPONENT;if(i===cr)return n.DEPTH_STENCIL;if(i===lm)return n.RED;if(i===fd)return n.RED_INTEGER;if(i===Ir)return n.RG;if(i===pd)return n.RG_INTEGER;if(i===md)return n.RGBA_INTEGER;if(i===To||i===Ao||i===Co||i===Po)if(a===Ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===To)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ao)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Co)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Po)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===To)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ao)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Co)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Po)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Rc||i===Dc||i===Lc||i===Ic)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Rc)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Dc)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Lc)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Ic)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Nc||i===Uc||i===Fc||i===Oc||i===zc||i===Vo||i===Bc)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Nc||i===Uc)return a===Ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Fc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Oc)return s.COMPRESSED_R11_EAC;if(i===zc)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Vo)return s.COMPRESSED_RG11_EAC;if(i===Bc)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===kc||i===Vc||i===Hc||i===Gc||i===Wc||i===Xc||i===jc||i===qc||i===Yc||i===Kc||i===Zc||i===$c||i===Jc||i===Qc)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===kc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Vc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Hc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Gc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Wc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Xc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===jc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===qc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Yc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Kc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Zc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===$c)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Jc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Qc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===eu||i===tu||i===nu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===eu)return a===Ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===tu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===nu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===iu||i===ru||i===Ho||i===su)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===iu)return s.COMPRESSED_RED_RGTC1_EXT;if(i===ru)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ho)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===su)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ts?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const Mw=`
|
|
4080
|
+
}`,vw=[new X(1,0,0),new X(-1,0,0),new X(0,1,0),new X(0,-1,0),new X(0,0,1),new X(0,0,-1)],_w=[new X(0,-1,0),new X(0,-1,0),new X(0,0,1),new X(0,0,-1),new X(0,-1,0),new X(0,-1,0)],wf=new Lt,Xs=new X,rc=new X;function xw(n,e,t){let i=new Sd;const r=new it,s=new it,a=new kt,o=new vb,l=new _b,c={},d=t.maxTextureSize,f={[Kn]:Yn,[Yn]:Kn,[Qn]:Qn},h=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new it},radius:{value:4}},vertexShader:mw,fragmentShader:gw}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const m=new on;m.setAttribute("position",new kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new an(m,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=wo;let v=this.type;this.render=function(S,A,_){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===W_&&(ft("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=wo);const T=n.getRenderTarget(),D=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Mn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const k=v!==this.type;k&&A.traverse(function(U){U.material&&(Array.isArray(U.material)?U.material.forEach(N=>N.needsUpdate=!0):U.material.needsUpdate=!0)});for(let U=0,N=S.length;U<N;U++){const R=S[U],z=R.shadow;if(z===void 0){ft("WebGLShadowMap:",R,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const q=z.getFrameExtents();r.multiply(q),s.copy(z.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/q.x),r.x=s.x*q.x,z.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/q.y),r.y=s.y*q.y,z.mapSize.y=s.y));const Y=n.state.buffers.depth.getReversed();if(z.camera._reversedDepth=Y,z.map===null||k===!0){if(z.map!==null&&(z.map.depthTexture!==null&&(z.map.depthTexture.dispose(),z.map.depthTexture=null),z.map.dispose()),this.type===fs){if(R.isPointLight){ft("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}z.map=new ni(r.x,r.y,{format:Ir,type:Fn,minFilter:hn,magFilter:hn,generateMipmaps:!1}),z.map.texture.name=R.name+".shadowMap",z.map.depthTexture=new Nr(r.x,r.y,ti),z.map.depthTexture.name=R.name+".shadowMapDepth",z.map.depthTexture.format=Yi,z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=xn,z.map.depthTexture.magFilter=xn}else R.isPointLight?(z.map=new Em(r.x),z.map.depthTexture=new ub(r.x,Oi)):(z.map=new ni(r.x,r.y),z.map.depthTexture=new Nr(r.x,r.y,Oi)),z.map.depthTexture.name=R.name+".shadowMap",z.map.depthTexture.format=Yi,this.type===wo?(z.map.depthTexture.compareFunction=Y?vd:gd,z.map.depthTexture.minFilter=hn,z.map.depthTexture.magFilter=hn):(z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=xn,z.map.depthTexture.magFilter=xn);z.camera.updateProjectionMatrix()}const te=z.map.isWebGLCubeRenderTarget?6:1;for(let le=0;le<te;le++){if(z.map.isWebGLCubeRenderTarget)n.setRenderTarget(z.map,le),n.clear();else{le===0&&(n.setRenderTarget(z.map),n.clear());const B=z.getViewport(le);a.set(s.x*B.x,s.y*B.y,s.x*B.z,s.y*B.w),F.viewport(a)}if(R.isPointLight){const B=z.camera,ee=z.matrix,de=R.distance||B.far;de!==B.far&&(B.far=de,B.updateProjectionMatrix()),Xs.setFromMatrixPosition(R.matrixWorld),B.position.copy(Xs),rc.copy(B.position),rc.add(vw[le]),B.up.copy(_w[le]),B.lookAt(rc),B.updateMatrixWorld(),ee.makeTranslation(-Xs.x,-Xs.y,-Xs.z),wf.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),z._frustum.setFromProjectionMatrix(wf,B.coordinateSystem,B.reversedDepth)}else z.updateMatrices(R);i=z.getFrustum(),b(A,_,z.camera,R,this.type)}z.isPointLightShadow!==!0&&this.type===fs&&y(z,_),z.needsUpdate=!1}v=this.type,g.needsUpdate=!1,n.setRenderTarget(T,D,L)};function y(S,A){const _=e.update(x);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new ni(r.x,r.y,{format:Ir,type:Fn})),h.uniforms.shadow_pass.value=S.map.depthTexture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,n.setRenderTarget(S.mapPass),n.clear(),n.renderBufferDirect(A,null,_,h,x,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,n.setRenderTarget(S.map),n.clear(),n.renderBufferDirect(A,null,_,p,x,null)}function w(S,A,_,T){let D=null;const L=_.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(L!==void 0)D=L;else if(D=_.isPointLight===!0?l:o,n.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){const F=D.uuid,k=A.uuid;let U=c[F];U===void 0&&(U={},c[F]=U);let N=U[k];N===void 0&&(N=D.clone(),U[k]=N,A.addEventListener("dispose",E)),D=N}if(D.visible=A.visible,D.wireframe=A.wireframe,T===fs?D.side=A.shadowSide!==null?A.shadowSide:A.side:D.side=A.shadowSide!==null?A.shadowSide:f[A.side],D.alphaMap=A.alphaMap,D.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,D.map=A.map,D.clipShadows=A.clipShadows,D.clippingPlanes=A.clippingPlanes,D.clipIntersection=A.clipIntersection,D.displacementMap=A.displacementMap,D.displacementScale=A.displacementScale,D.displacementBias=A.displacementBias,D.wireframeLinewidth=A.wireframeLinewidth,D.linewidth=A.linewidth,_.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const F=n.properties.get(D);F.light=_}return D}function b(S,A,_,T,D){if(S.visible===!1)return;if(S.layers.test(A.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&D===fs)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,S.matrixWorld);const k=e.update(S),U=S.material;if(Array.isArray(U)){const N=k.groups;for(let R=0,z=N.length;R<z;R++){const q=N[R],Y=U[q.materialIndex];if(Y&&Y.visible){const te=w(S,Y,T,D);S.onBeforeShadow(n,S,A,_,k,te,q),n.renderBufferDirect(_,null,k,te,S,q),S.onAfterShadow(n,S,A,_,k,te,q)}}}else if(U.visible){const N=w(S,U,T,D);S.onBeforeShadow(n,S,A,_,k,N,null),n.renderBufferDirect(_,null,k,N,S,null),S.onAfterShadow(n,S,A,_,k,N,null)}}const F=S.children;for(let k=0,U=F.length;k<U;k++)b(F[k],A,_,T,D)}function E(S){S.target.removeEventListener("dispose",E);for(const _ in c){const T=c[_],D=S.target.uuid;D in T&&(T[D].dispose(),delete T[D])}}}function bw(n,e){function t(){let J=!1;const Ge=new kt;let Te=null;const Ze=new kt(0,0,0,0);return{setMask:function(qe){Te!==qe&&!J&&(n.colorMask(qe,qe,qe,qe),Te=qe)},setLocked:function(qe){J=qe},setClear:function(qe,Be,lt,vt,$t){$t===!0&&(qe*=vt,Be*=vt,lt*=vt),Ge.set(qe,Be,lt,vt),Ze.equals(Ge)===!1&&(n.clearColor(qe,Be,lt,vt),Ze.copy(Ge))},reset:function(){J=!1,Te=null,Ze.set(-1,0,0,0)}}}function i(){let J=!1,Ge=!1,Te=null,Ze=null,qe=null;return{setReversed:function(Be){if(Ge!==Be){const lt=e.get("EXT_clip_control");Be?lt.clipControlEXT(lt.LOWER_LEFT_EXT,lt.ZERO_TO_ONE_EXT):lt.clipControlEXT(lt.LOWER_LEFT_EXT,lt.NEGATIVE_ONE_TO_ONE_EXT),Ge=Be;const vt=qe;qe=null,this.setClear(vt)}},getReversed:function(){return Ge},setTest:function(Be){Be?Z(n.DEPTH_TEST):ce(n.DEPTH_TEST)},setMask:function(Be){Te!==Be&&!J&&(n.depthMask(Be),Te=Be)},setFunc:function(Be){if(Ge&&(Be=xx[Be]),Ze!==Be){switch(Be){case Sc:n.depthFunc(n.NEVER);break;case Mc:n.depthFunc(n.ALWAYS);break;case wc:n.depthFunc(n.LESS);break;case ws:n.depthFunc(n.LEQUAL);break;case Ec:n.depthFunc(n.EQUAL);break;case Tc:n.depthFunc(n.GEQUAL);break;case Ac:n.depthFunc(n.GREATER);break;case Cc:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ze=Be}},setLocked:function(Be){J=Be},setClear:function(Be){qe!==Be&&(qe=Be,Ge&&(Be=1-Be),n.clearDepth(Be))},reset:function(){J=!1,Te=null,Ze=null,qe=null,Ge=!1}}}function r(){let J=!1,Ge=null,Te=null,Ze=null,qe=null,Be=null,lt=null,vt=null,$t=null;return{setTest:function(It){J||(It?Z(n.STENCIL_TEST):ce(n.STENCIL_TEST))},setMask:function(It){Ge!==It&&!J&&(n.stencilMask(It),Ge=It)},setFunc:function(It,ii,ri){(Te!==It||Ze!==ii||qe!==ri)&&(n.stencilFunc(It,ii,ri),Te=It,Ze=ii,qe=ri)},setOp:function(It,ii,ri){(Be!==It||lt!==ii||vt!==ri)&&(n.stencilOp(It,ii,ri),Be=It,lt=ii,vt=ri)},setLocked:function(It){J=It},setClear:function(It){$t!==It&&(n.clearStencil(It),$t=It)},reset:function(){J=!1,Ge=null,Te=null,Ze=null,qe=null,Be=null,lt=null,vt=null,$t=null}}}const s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},f={},h={},p=new WeakMap,m=[],x=null,g=!1,v=null,y=null,w=null,b=null,E=null,S=null,A=null,_=new tt(0,0,0),T=0,D=!1,L=null,F=null,k=null,U=null,N=null;const R=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let z=!1,q=0;const Y=n.getParameter(n.VERSION);Y.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(Y)[1]),z=q>=1):Y.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),z=q>=2);let te=null,le={};const B=n.getParameter(n.SCISSOR_BOX),ee=n.getParameter(n.VIEWPORT),de=new kt().fromArray(B),ve=new kt().fromArray(ee);function G(J,Ge,Te,Ze){const qe=new Uint8Array(4),Be=n.createTexture();n.bindTexture(J,Be),n.texParameteri(J,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(J,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let lt=0;lt<Te;lt++)J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?n.texImage3D(Ge,0,n.RGBA,1,1,Ze,0,n.RGBA,n.UNSIGNED_BYTE,qe):n.texImage2D(Ge+lt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,qe);return Be}const ie={};ie[n.TEXTURE_2D]=G(n.TEXTURE_2D,n.TEXTURE_2D,1),ie[n.TEXTURE_CUBE_MAP]=G(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[n.TEXTURE_2D_ARRAY]=G(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),ie[n.TEXTURE_3D]=G(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Z(n.DEPTH_TEST),a.setFunc(ws),We(!1),Oe(fh),Z(n.CULL_FACE),ke(Mn);function Z(J){d[J]!==!0&&(n.enable(J),d[J]=!0)}function ce(J){d[J]!==!1&&(n.disable(J),d[J]=!1)}function pe(J,Ge){return h[J]!==Ge?(n.bindFramebuffer(J,Ge),h[J]=Ge,J===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=Ge),J===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=Ge),!0):!1}function Se(J,Ge){let Te=m,Ze=!1;if(J){Te=p.get(Ge),Te===void 0&&(Te=[],p.set(Ge,Te));const qe=J.textures;if(Te.length!==qe.length||Te[0]!==n.COLOR_ATTACHMENT0){for(let Be=0,lt=qe.length;Be<lt;Be++)Te[Be]=n.COLOR_ATTACHMENT0+Be;Te.length=qe.length,Ze=!0}}else Te[0]!==n.BACK&&(Te[0]=n.BACK,Ze=!0);Ze&&n.drawBuffers(Te)}function ze(J){return x!==J?(n.useProgram(J),x=J,!0):!1}const Ue={[gi]:n.FUNC_ADD,[X_]:n.FUNC_SUBTRACT,[j_]:n.FUNC_REVERSE_SUBTRACT};Ue[q_]=n.MIN,Ue[Y_]=n.MAX;const Pe={[Js]:n.ZERO,[K_]:n.ONE,[Z_]:n.SRC_COLOR,[_c]:n.SRC_ALPHA,[ex]:n.SRC_ALPHA_SATURATE,[yc]:n.DST_COLOR,[bc]:n.DST_ALPHA,[$_]:n.ONE_MINUS_SRC_COLOR,[xc]:n.ONE_MINUS_SRC_ALPHA,[Q_]:n.ONE_MINUS_DST_COLOR,[J_]:n.ONE_MINUS_DST_ALPHA,[tx]:n.CONSTANT_COLOR,[nx]:n.ONE_MINUS_CONSTANT_COLOR,[ix]:n.CONSTANT_ALPHA,[rx]:n.ONE_MINUS_CONSTANT_ALPHA};function ke(J,Ge,Te,Ze,qe,Be,lt,vt,$t,It){if(J===Mn){g===!0&&(ce(n.BLEND),g=!1);return}if(g===!1&&(Z(n.BLEND),g=!0),J!==Qp){if(J!==v||It!==D){if((y!==gi||E!==gi)&&(n.blendEquation(n.FUNC_ADD),y=gi,E=gi),It)switch(J){case bs:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ph:n.blendFunc(n.ONE,n.ONE);break;case mh:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case gh:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Tt("WebGLState: Invalid blending: ",J);break}else switch(J){case bs:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ph:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case mh:Tt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case gh:Tt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Tt("WebGLState: Invalid blending: ",J);break}w=null,b=null,S=null,A=null,_.set(0,0,0),T=0,v=J,D=It}return}qe=qe||Ge,Be=Be||Te,lt=lt||Ze,(Ge!==y||qe!==E)&&(n.blendEquationSeparate(Ue[Ge],Ue[qe]),y=Ge,E=qe),(Te!==w||Ze!==b||Be!==S||lt!==A)&&(n.blendFuncSeparate(Pe[Te],Pe[Ze],Pe[Be],Pe[lt]),w=Te,b=Ze,S=Be,A=lt),(vt.equals(_)===!1||$t!==T)&&(n.blendColor(vt.r,vt.g,vt.b,$t),_.copy(vt),T=$t),v=J,D=!1}function Ie(J,Ge){J.side===Qn?ce(n.CULL_FACE):Z(n.CULL_FACE);let Te=J.side===Yn;Ge&&(Te=!Te),We(Te),J.blending===bs&&J.transparent===!1?ke(Mn):ke(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.blendColor,J.blendAlpha,J.premultipliedAlpha),a.setFunc(J.depthFunc),a.setTest(J.depthTest),a.setMask(J.depthWrite),s.setMask(J.colorWrite);const Ze=J.stencilWrite;o.setTest(Ze),Ze&&(o.setMask(J.stencilWriteMask),o.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),o.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),V(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?Z(n.SAMPLE_ALPHA_TO_COVERAGE):ce(n.SAMPLE_ALPHA_TO_COVERAGE)}function We(J){L!==J&&(J?n.frontFace(n.CW):n.frontFace(n.CCW),L=J)}function Oe(J){J!==H_?(Z(n.CULL_FACE),J!==F&&(J===fh?n.cullFace(n.BACK):J===G_?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):ce(n.CULL_FACE),F=J}function He(J){J!==k&&(z&&n.lineWidth(J),k=J)}function V(J,Ge,Te){J?(Z(n.POLYGON_OFFSET_FILL),(U!==Ge||N!==Te)&&(U=Ge,N=Te,a.getReversed()&&(Ge=-Ge),n.polygonOffset(Ge,Te))):ce(n.POLYGON_OFFSET_FILL)}function je(J){J?Z(n.SCISSOR_TEST):ce(n.SCISSOR_TEST)}function Ve(J){J===void 0&&(J=n.TEXTURE0+R-1),te!==J&&(n.activeTexture(J),te=J)}function Xe(J,Ge,Te){Te===void 0&&(te===null?Te=n.TEXTURE0+R-1:Te=te);let Ze=le[Te];Ze===void 0&&(Ze={type:void 0,texture:void 0},le[Te]=Ze),(Ze.type!==J||Ze.texture!==Ge)&&(te!==Te&&(n.activeTexture(Te),te=Te),n.bindTexture(J,Ge||ie[J]),Ze.type=J,Ze.texture=Ge)}function ye(){const J=le[te];J!==void 0&&J.type!==void 0&&(n.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function Ce(){try{n.compressedTexImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function C(){try{n.compressedTexImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function M(){try{n.texSubImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function H(){try{n.texSubImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function re(){try{n.compressedTexSubImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ue(){try{n.compressedTexSubImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function be(){try{n.texStorage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ge(){try{n.texStorage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function ae(){try{n.texImage2D(...arguments)}catch(J){Tt("WebGLState:",J)}}function fe(){try{n.texImage3D(...arguments)}catch(J){Tt("WebGLState:",J)}}function Re(J){return f[J]!==void 0?f[J]:n.getParameter(J)}function Le(J,Ge){f[J]!==Ge&&(n.pixelStorei(J,Ge),f[J]=Ge)}function Ee(J){de.equals(J)===!1&&(n.scissor(J.x,J.y,J.z,J.w),de.copy(J))}function De(J){ve.equals(J)===!1&&(n.viewport(J.x,J.y,J.z,J.w),ve.copy(J))}function et(J,Ge){let Te=c.get(Ge);Te===void 0&&(Te=new WeakMap,c.set(Ge,Te));let Ze=Te.get(J);Ze===void 0&&(Ze=n.getUniformBlockIndex(Ge,J.name),Te.set(J,Ze))}function Ye(J,Ge){const Ze=c.get(Ge).get(J);l.get(Ge)!==Ze&&(n.uniformBlockBinding(Ge,Ze,J.__bindingPointIndex),l.set(Ge,Ze))}function ht(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),d={},f={},te=null,le={},h={},p=new WeakMap,m=[],x=null,g=!1,v=null,y=null,w=null,b=null,E=null,S=null,A=null,_=new tt(0,0,0),T=0,D=!1,L=null,F=null,k=null,U=null,N=null,de.set(0,0,n.canvas.width,n.canvas.height),ve.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:Z,disable:ce,bindFramebuffer:pe,drawBuffers:Se,useProgram:ze,setBlending:ke,setMaterial:Ie,setFlipSided:We,setCullFace:Oe,setLineWidth:He,setPolygonOffset:V,setScissorTest:je,activeTexture:Ve,bindTexture:Xe,unbindTexture:ye,compressedTexImage2D:Ce,compressedTexImage3D:C,texImage2D:ae,texImage3D:fe,pixelStorei:Le,getParameter:Re,updateUBOMapping:et,uniformBlockBinding:Ye,texStorage2D:be,texStorage3D:ge,texSubImage2D:M,texSubImage3D:H,compressedTexSubImage2D:re,compressedTexSubImage3D:ue,scissor:Ee,viewport:De,reset:ht}}function yw(n,e,t,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new it,d=new WeakMap,f=new Set;let h;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(C,M){return m?new OffscreenCanvas(C,M):Xo("canvas")}function g(C,M,H){let re=1;const ue=Ce(C);if((ue.width>H||ue.height>H)&&(re=H/Math.max(ue.width,ue.height)),re<1)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap||typeof VideoFrame<"u"&&C instanceof VideoFrame){const be=Math.floor(re*ue.width),ge=Math.floor(re*ue.height);h===void 0&&(h=x(be,ge));const ae=M?x(be,ge):h;return ae.width=be,ae.height=ge,ae.getContext("2d").drawImage(C,0,0,be,ge),ft("WebGLRenderer: Texture has been resized from ("+ue.width+"x"+ue.height+") to ("+be+"x"+ge+")."),ae}else return"data"in C&&ft("WebGLRenderer: Image in DataTexture is too big ("+ue.width+"x"+ue.height+")."),C;return C}function v(C){return C.generateMipmaps}function y(C){n.generateMipmap(C)}function w(C){return C.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:C.isWebGL3DRenderTarget?n.TEXTURE_3D:C.isWebGLArrayRenderTarget||C.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(C,M,H,re,ue,be=!1){if(C!==null){if(n[C]!==void 0)return n[C];ft("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let ge;re&&(ge=e.get("EXT_texture_norm16"),ge||ft("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ae=M;if(M===n.RED&&(H===n.FLOAT&&(ae=n.R32F),H===n.HALF_FLOAT&&(ae=n.R16F),H===n.UNSIGNED_BYTE&&(ae=n.R8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.R16_EXT),H===n.SHORT&&ge&&(ae=ge.R16_SNORM_EXT)),M===n.RED_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.R8UI),H===n.UNSIGNED_SHORT&&(ae=n.R16UI),H===n.UNSIGNED_INT&&(ae=n.R32UI),H===n.BYTE&&(ae=n.R8I),H===n.SHORT&&(ae=n.R16I),H===n.INT&&(ae=n.R32I)),M===n.RG&&(H===n.FLOAT&&(ae=n.RG32F),H===n.HALF_FLOAT&&(ae=n.RG16F),H===n.UNSIGNED_BYTE&&(ae=n.RG8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RG16_EXT),H===n.SHORT&&ge&&(ae=ge.RG16_SNORM_EXT)),M===n.RG_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RG8UI),H===n.UNSIGNED_SHORT&&(ae=n.RG16UI),H===n.UNSIGNED_INT&&(ae=n.RG32UI),H===n.BYTE&&(ae=n.RG8I),H===n.SHORT&&(ae=n.RG16I),H===n.INT&&(ae=n.RG32I)),M===n.RGB_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RGB8UI),H===n.UNSIGNED_SHORT&&(ae=n.RGB16UI),H===n.UNSIGNED_INT&&(ae=n.RGB32UI),H===n.BYTE&&(ae=n.RGB8I),H===n.SHORT&&(ae=n.RGB16I),H===n.INT&&(ae=n.RGB32I)),M===n.RGBA_INTEGER&&(H===n.UNSIGNED_BYTE&&(ae=n.RGBA8UI),H===n.UNSIGNED_SHORT&&(ae=n.RGBA16UI),H===n.UNSIGNED_INT&&(ae=n.RGBA32UI),H===n.BYTE&&(ae=n.RGBA8I),H===n.SHORT&&(ae=n.RGBA16I),H===n.INT&&(ae=n.RGBA32I)),M===n.RGB&&(H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RGB16_EXT),H===n.SHORT&&ge&&(ae=ge.RGB16_SNORM_EXT),H===n.UNSIGNED_INT_5_9_9_9_REV&&(ae=n.RGB9_E5),H===n.UNSIGNED_INT_10F_11F_11F_REV&&(ae=n.R11F_G11F_B10F)),M===n.RGBA){const fe=be?Wo:At.getTransfer(ue);H===n.FLOAT&&(ae=n.RGBA32F),H===n.HALF_FLOAT&&(ae=n.RGBA16F),H===n.UNSIGNED_BYTE&&(ae=fe===Ut?n.SRGB8_ALPHA8:n.RGBA8),H===n.UNSIGNED_SHORT&&ge&&(ae=ge.RGBA16_EXT),H===n.SHORT&&ge&&(ae=ge.RGBA16_SNORM_EXT),H===n.UNSIGNED_SHORT_4_4_4_4&&(ae=n.RGBA4),H===n.UNSIGNED_SHORT_5_5_5_1&&(ae=n.RGB5_A1)}return(ae===n.R16F||ae===n.R32F||ae===n.RG16F||ae===n.RG32F||ae===n.RGBA16F||ae===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function E(C,M){let H;return C?M===null||M===Oi||M===Ts?H=n.DEPTH24_STENCIL8:M===ti?H=n.DEPTH32F_STENCIL8:M===aa&&(H=n.DEPTH24_STENCIL8,ft("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===Oi||M===Ts?H=n.DEPTH_COMPONENT24:M===ti?H=n.DEPTH_COMPONENT32F:M===aa&&(H=n.DEPTH_COMPONENT16),H}function S(C,M){return v(C)===!0||C.isFramebufferTexture&&C.minFilter!==xn&&C.minFilter!==hn?Math.log2(Math.max(M.width,M.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?M.mipmaps.length:1}function A(C){const M=C.target;M.removeEventListener("dispose",A),T(M),M.isVideoTexture&&d.delete(M),M.isHTMLTexture&&f.delete(M)}function _(C){const M=C.target;M.removeEventListener("dispose",_),L(M)}function T(C){const M=i.get(C);if(M.__webglInit===void 0)return;const H=C.source,re=p.get(H);if(re){const ue=re[M.__cacheKey];ue.usedTimes--,ue.usedTimes===0&&D(C),Object.keys(re).length===0&&p.delete(H)}i.remove(C)}function D(C){const M=i.get(C);n.deleteTexture(M.__webglTexture);const H=C.source,re=p.get(H);delete re[M.__cacheKey],a.memory.textures--}function L(C){const M=i.get(C);if(C.depthTexture&&(C.depthTexture.dispose(),i.remove(C.depthTexture)),C.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(M.__webglFramebuffer[re]))for(let ue=0;ue<M.__webglFramebuffer[re].length;ue++)n.deleteFramebuffer(M.__webglFramebuffer[re][ue]);else n.deleteFramebuffer(M.__webglFramebuffer[re]);M.__webglDepthbuffer&&n.deleteRenderbuffer(M.__webglDepthbuffer[re])}else{if(Array.isArray(M.__webglFramebuffer))for(let re=0;re<M.__webglFramebuffer.length;re++)n.deleteFramebuffer(M.__webglFramebuffer[re]);else n.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&n.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&n.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let re=0;re<M.__webglColorRenderbuffer.length;re++)M.__webglColorRenderbuffer[re]&&n.deleteRenderbuffer(M.__webglColorRenderbuffer[re]);M.__webglDepthRenderbuffer&&n.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const H=C.textures;for(let re=0,ue=H.length;re<ue;re++){const be=i.get(H[re]);be.__webglTexture&&(n.deleteTexture(be.__webglTexture),a.memory.textures--),i.remove(H[re])}i.remove(C)}let F=0;function k(){F=0}function U(){return F}function N(C){F=C}function R(){const C=F;return C>=r.maxTextures&&ft("WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+r.maxTextures),F+=1,C}function z(C){const M=[];return M.push(C.wrapS),M.push(C.wrapT),M.push(C.wrapR||0),M.push(C.magFilter),M.push(C.minFilter),M.push(C.anisotropy),M.push(C.internalFormat),M.push(C.format),M.push(C.type),M.push(C.generateMipmaps),M.push(C.premultiplyAlpha),M.push(C.flipY),M.push(C.unpackAlignment),M.push(C.colorSpace),M.join()}function q(C,M){const H=i.get(C);if(C.isVideoTexture&&Xe(C),C.isRenderTargetTexture===!1&&C.isExternalTexture!==!0&&C.version>0&&H.__version!==C.version){const re=C.image;if(re===null)ft("WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)ft("WebGLRenderer: Texture marked for update but image is incomplete");else{ce(H,C,M);return}}else C.isExternalTexture&&(H.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,H.__webglTexture,n.TEXTURE0+M)}function Y(C,M){const H=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&H.__version!==C.version){ce(H,C,M);return}else C.isExternalTexture&&(H.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,H.__webglTexture,n.TEXTURE0+M)}function te(C,M){const H=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&H.__version!==C.version){ce(H,C,M);return}t.bindTexture(n.TEXTURE_3D,H.__webglTexture,n.TEXTURE0+M)}function le(C,M){const H=i.get(C);if(C.isCubeDepthTexture!==!0&&C.version>0&&H.__version!==C.version){pe(H,C,M);return}t.bindTexture(n.TEXTURE_CUBE_MAP,H.__webglTexture,n.TEXTURE0+M)}const B={[Lr]:n.REPEAT,[_i]:n.CLAMP_TO_EDGE,[Pc]:n.MIRRORED_REPEAT},ee={[xn]:n.NEAREST,[ox]:n.NEAREST_MIPMAP_NEAREST,[Ca]:n.NEAREST_MIPMAP_LINEAR,[hn]:n.LINEAR,[El]:n.LINEAR_MIPMAP_NEAREST,[lr]:n.LINEAR_MIPMAP_LINEAR},de={[ux]:n.NEVER,[mx]:n.ALWAYS,[dx]:n.LESS,[gd]:n.LEQUAL,[hx]:n.EQUAL,[vd]:n.GEQUAL,[fx]:n.GREATER,[px]:n.NOTEQUAL};function ve(C,M){if(M.type===ti&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===hn||M.magFilter===El||M.magFilter===Ca||M.magFilter===lr||M.minFilter===hn||M.minFilter===El||M.minFilter===Ca||M.minFilter===lr)&&ft("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(C,n.TEXTURE_WRAP_S,B[M.wrapS]),n.texParameteri(C,n.TEXTURE_WRAP_T,B[M.wrapT]),(C===n.TEXTURE_3D||C===n.TEXTURE_2D_ARRAY)&&n.texParameteri(C,n.TEXTURE_WRAP_R,B[M.wrapR]),n.texParameteri(C,n.TEXTURE_MAG_FILTER,ee[M.magFilter]),n.texParameteri(C,n.TEXTURE_MIN_FILTER,ee[M.minFilter]),M.compareFunction&&(n.texParameteri(C,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(C,n.TEXTURE_COMPARE_FUNC,de[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===xn||M.minFilter!==Ca&&M.minFilter!==lr||M.type===ti&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||i.get(M).__currentAnisotropy){const H=e.get("EXT_texture_filter_anisotropic");n.texParameterf(C,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy}}}function G(C,M){let H=!1;C.__webglInit===void 0&&(C.__webglInit=!0,M.addEventListener("dispose",A));const re=M.source;let ue=p.get(re);ue===void 0&&(ue={},p.set(re,ue));const be=z(M);if(be!==C.__cacheKey){ue[be]===void 0&&(ue[be]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,H=!0),ue[be].usedTimes++;const ge=ue[C.__cacheKey];ge!==void 0&&(ue[C.__cacheKey].usedTimes--,ge.usedTimes===0&&D(M)),C.__cacheKey=be,C.__webglTexture=ue[be].texture}return H}function ie(C,M,H){return Math.floor(Math.floor(C/H)/M)}function Z(C,M,H,re){const be=C.updateRanges;if(be.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,M.width,M.height,H,re,M.data);else{be.sort((Le,Ee)=>Le.start-Ee.start);let ge=0;for(let Le=1;Le<be.length;Le++){const Ee=be[ge],De=be[Le],et=Ee.start+Ee.count,Ye=ie(De.start,M.width,4),ht=ie(Ee.start,M.width,4);De.start<=et+1&&Ye===ht&&ie(De.start+De.count-1,M.width,4)===Ye?Ee.count=Math.max(Ee.count,De.start+De.count-Ee.start):(++ge,be[ge]=De)}be.length=ge+1;const ae=t.getParameter(n.UNPACK_ROW_LENGTH),fe=t.getParameter(n.UNPACK_SKIP_PIXELS),Re=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,M.width);for(let Le=0,Ee=be.length;Le<Ee;Le++){const De=be[Le],et=Math.floor(De.start/4),Ye=Math.ceil(De.count/4),ht=et%M.width,J=Math.floor(et/M.width),Ge=Ye,Te=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,ht),t.pixelStorei(n.UNPACK_SKIP_ROWS,J),t.texSubImage2D(n.TEXTURE_2D,0,ht,J,Ge,Te,H,re,M.data)}C.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,ae),t.pixelStorei(n.UNPACK_SKIP_PIXELS,fe),t.pixelStorei(n.UNPACK_SKIP_ROWS,Re)}}function ce(C,M,H){let re=n.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(re=n.TEXTURE_2D_ARRAY),M.isData3DTexture&&(re=n.TEXTURE_3D);const ue=G(C,M),be=M.source;t.bindTexture(re,C.__webglTexture,n.TEXTURE0+H);const ge=i.get(be);if(be.version!==ge.__version||ue===!0){if(t.activeTexture(n.TEXTURE0+H),(typeof ImageBitmap<"u"&&M.image instanceof ImageBitmap)===!1){const Te=At.getPrimaries(At.workingColorSpace),Ze=M.colorSpace===ar?null:At.getPrimaries(M.colorSpace),qe=M.colorSpace===ar||Te===Ze?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe)}t.pixelStorei(n.UNPACK_ALIGNMENT,M.unpackAlignment);let fe=g(M.image,!1,r.maxTextureSize);fe=ye(M,fe);const Re=s.convert(M.format,M.colorSpace),Le=s.convert(M.type);let Ee=b(M.internalFormat,Re,Le,M.normalized,M.colorSpace,M.isVideoTexture);ve(re,M);let De;const et=M.mipmaps,Ye=M.isVideoTexture!==!0,ht=ge.__version===void 0||ue===!0,J=be.dataReady,Ge=S(M,fe);if(M.isDepthTexture)Ee=E(M.format===cr,M.type),ht&&(Ye?t.texStorage2D(n.TEXTURE_2D,1,Ee,fe.width,fe.height):t.texImage2D(n.TEXTURE_2D,0,Ee,fe.width,fe.height,0,Re,Le,null));else if(M.isDataTexture)if(et.length>0){Ye&&ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,et[0].width,et[0].height);for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,Le,De.data):t.texImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,Re,Le,De.data);M.generateMipmaps=!1}else Ye?(ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,fe.width,fe.height),J&&Z(M,fe,Re,Le)):t.texImage2D(n.TEXTURE_2D,0,Ee,fe.width,fe.height,0,Re,Le,fe.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ye&&ht&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ge,Ee,et[0].width,et[0].height,fe.depth);for(let Te=0,Ze=et.length;Te<Ze;Te++)if(De=et[Te],M.format!==li)if(Re!==null)if(Ye){if(J)if(M.layerUpdates.size>0){const qe=ef(De.width,De.height,M.format,M.type);for(const Be of M.layerUpdates){const lt=De.data.subarray(Be*qe/De.data.BYTES_PER_ELEMENT,(Be+1)*qe/De.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,Be,De.width,De.height,1,Re,lt)}M.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,De.width,De.height,fe.depth,Re,De.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Te,Ee,De.width,De.height,fe.depth,0,De.data,0,0);else ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ye?J&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,De.width,De.height,fe.depth,Re,Le,De.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Te,Ee,De.width,De.height,fe.depth,0,Re,Le,De.data)}else{Ye&&ht&&t.texStorage2D(n.TEXTURE_2D,Ge,Ee,et[0].width,et[0].height);for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],M.format!==li?Re!==null?Ye?J&&t.compressedTexSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,De.data):t.compressedTexImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,De.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,De.width,De.height,Re,Le,De.data):t.texImage2D(n.TEXTURE_2D,Te,Ee,De.width,De.height,0,Re,Le,De.data)}else if(M.isDataArrayTexture)if(Ye){if(ht&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ge,Ee,fe.width,fe.height,fe.depth),J)if(M.layerUpdates.size>0){const Te=ef(fe.width,fe.height,M.format,M.type);for(const Ze of M.layerUpdates){const qe=fe.data.subarray(Ze*Te/fe.data.BYTES_PER_ELEMENT,(Ze+1)*Te/fe.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ze,fe.width,fe.height,1,Re,Le,qe)}M.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,fe.width,fe.height,fe.depth,Re,Le,fe.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ee,fe.width,fe.height,fe.depth,0,Re,Le,fe.data);else if(M.isData3DTexture)Ye?(ht&&t.texStorage3D(n.TEXTURE_3D,Ge,Ee,fe.width,fe.height,fe.depth),J&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,fe.width,fe.height,fe.depth,Re,Le,fe.data)):t.texImage3D(n.TEXTURE_3D,0,Ee,fe.width,fe.height,fe.depth,0,Re,Le,fe.data);else if(M.isFramebufferTexture){if(ht)if(Ye)t.texStorage2D(n.TEXTURE_2D,Ge,Ee,fe.width,fe.height);else{let Te=fe.width,Ze=fe.height;for(let qe=0;qe<Ge;qe++)t.texImage2D(n.TEXTURE_2D,qe,Ee,Te,Ze,0,Re,Le,null),Te>>=1,Ze>>=1}}else if(M.isHTMLTexture){if("texElementImage2D"in n){const Te=n.canvas;if(Te.hasAttribute("layoutsubtree")||Te.setAttribute("layoutsubtree","true"),fe.parentNode!==Te){Te.appendChild(fe),f.add(M),Te.onpaint=vt=>{const $t=vt.changedElements;for(const It of f)$t.includes(It.image)&&(It.needsUpdate=!0)},Te.requestPaint();return}const Ze=0,qe=n.RGBA,Be=n.RGBA,lt=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,Ze,qe,Be,lt,fe),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(et.length>0){if(Ye&&ht){const Te=Ce(et[0]);t.texStorage2D(n.TEXTURE_2D,Ge,Ee,Te.width,Te.height)}for(let Te=0,Ze=et.length;Te<Ze;Te++)De=et[Te],Ye?J&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Re,Le,De):t.texImage2D(n.TEXTURE_2D,Te,Ee,Re,Le,De);M.generateMipmaps=!1}else if(Ye){if(ht){const Te=Ce(fe);t.texStorage2D(n.TEXTURE_2D,Ge,Ee,Te.width,Te.height)}J&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Re,Le,fe)}else t.texImage2D(n.TEXTURE_2D,0,Ee,Re,Le,fe);v(M)&&y(re),ge.__version=be.version,M.onUpdate&&M.onUpdate(M)}C.__version=M.version}function pe(C,M,H){if(M.image.length!==6)return;const re=G(C,M),ue=M.source;t.bindTexture(n.TEXTURE_CUBE_MAP,C.__webglTexture,n.TEXTURE0+H);const be=i.get(ue);if(ue.version!==be.__version||re===!0){t.activeTexture(n.TEXTURE0+H);const ge=At.getPrimaries(At.workingColorSpace),ae=M.colorSpace===ar?null:At.getPrimaries(M.colorSpace),fe=M.colorSpace===ar||ge===ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,fe);const Re=M.isCompressedTexture||M.image[0].isCompressedTexture,Le=M.image[0]&&M.image[0].isDataTexture,Ee=[];for(let Be=0;Be<6;Be++)!Re&&!Le?Ee[Be]=g(M.image[Be],!0,r.maxCubemapSize):Ee[Be]=Le?M.image[Be].image:M.image[Be],Ee[Be]=ye(M,Ee[Be]);const De=Ee[0],et=s.convert(M.format,M.colorSpace),Ye=s.convert(M.type),ht=b(M.internalFormat,et,Ye,M.normalized,M.colorSpace),J=M.isVideoTexture!==!0,Ge=be.__version===void 0||re===!0,Te=ue.dataReady;let Ze=S(M,De);ve(n.TEXTURE_CUBE_MAP,M);let qe;if(Re){J&&Ge&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,ht,De.width,De.height);for(let Be=0;Be<6;Be++){qe=Ee[Be].mipmaps;for(let lt=0;lt<qe.length;lt++){const vt=qe[lt];M.format!==li?et!==null?J?Te&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,0,0,vt.width,vt.height,et,vt.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,ht,vt.width,vt.height,0,vt.data):ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,0,0,vt.width,vt.height,et,Ye,vt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt,ht,vt.width,vt.height,0,et,Ye,vt.data)}}}else{if(qe=M.mipmaps,J&&Ge){qe.length>0&&Ze++;const Be=Ce(Ee[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,ht,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Le){J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,Ee[Be].width,Ee[Be].height,et,Ye,Ee[Be].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,ht,Ee[Be].width,Ee[Be].height,0,et,Ye,Ee[Be].data);for(let lt=0;lt<qe.length;lt++){const $t=qe[lt].image[Be].image;J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,0,0,$t.width,$t.height,et,Ye,$t.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,ht,$t.width,$t.height,0,et,Ye,$t.data)}}else{J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,et,Ye,Ee[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,ht,et,Ye,Ee[Be]);for(let lt=0;lt<qe.length;lt++){const vt=qe[lt];J?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,0,0,et,Ye,vt.image[Be]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Be,lt+1,ht,et,Ye,vt.image[Be])}}}v(M)&&y(n.TEXTURE_CUBE_MAP),be.__version=ue.version,M.onUpdate&&M.onUpdate(M)}C.__version=M.version}function Se(C,M,H,re,ue,be){const ge=s.convert(H.format,H.colorSpace),ae=s.convert(H.type),fe=b(H.internalFormat,ge,ae,H.normalized,H.colorSpace),Re=i.get(M),Le=i.get(H);if(Le.__renderTarget=M,!Re.__hasExternalTextures){const Ee=Math.max(1,M.width>>be),De=Math.max(1,M.height>>be);ue===n.TEXTURE_3D||ue===n.TEXTURE_2D_ARRAY?t.texImage3D(ue,be,fe,Ee,De,M.depth,0,ge,ae,null):t.texImage2D(ue,be,fe,Ee,De,0,ge,ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,C),Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,re,ue,Le.__webglTexture,0,je(M)):(ue===n.TEXTURE_2D||ue>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&ue<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,re,ue,Le.__webglTexture,be),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ze(C,M,H){if(n.bindRenderbuffer(n.RENDERBUFFER,C),M.depthBuffer){const re=M.depthTexture,ue=re&&re.isDepthTexture?re.type:null,be=E(M.stencilBuffer,ue),ge=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Ve(M)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je(M),be,M.width,M.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,je(M),be,M.width,M.height):n.renderbufferStorage(n.RENDERBUFFER,be,M.width,M.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ge,n.RENDERBUFFER,C)}else{const re=M.textures;for(let ue=0;ue<re.length;ue++){const be=re[ue],ge=s.convert(be.format,be.colorSpace),ae=s.convert(be.type),fe=b(be.internalFormat,ge,ae,be.normalized,be.colorSpace);Ve(M)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je(M),fe,M.width,M.height):H?n.renderbufferStorageMultisample(n.RENDERBUFFER,je(M),fe,M.width,M.height):n.renderbufferStorage(n.RENDERBUFFER,fe,M.width,M.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ue(C,M,H){const re=M.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,C),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ue=i.get(M.depthTexture);if(ue.__renderTarget=M,(!ue.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),re){if(ue.__webglInit===void 0&&(ue.__webglInit=!0,M.depthTexture.addEventListener("dispose",A)),ue.__webglTexture===void 0){ue.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,ue.__webglTexture),ve(n.TEXTURE_CUBE_MAP,M.depthTexture);const Re=s.convert(M.depthTexture.format),Le=s.convert(M.depthTexture.type);let Ee;M.depthTexture.format===Yi?Ee=n.DEPTH_COMPONENT24:M.depthTexture.format===cr&&(Ee=n.DEPTH24_STENCIL8);for(let De=0;De<6;De++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Ee,M.width,M.height,0,Re,Le,null)}}else q(M.depthTexture,0);const be=ue.__webglTexture,ge=je(M),ae=re?n.TEXTURE_CUBE_MAP_POSITIVE_X+H:n.TEXTURE_2D,fe=M.depthTexture.format===cr?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(M.depthTexture.format===Yi)Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,fe,ae,be,0,ge):n.framebufferTexture2D(n.FRAMEBUFFER,fe,ae,be,0);else if(M.depthTexture.format===cr)Ve(M)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,fe,ae,be,0,ge):n.framebufferTexture2D(n.FRAMEBUFFER,fe,ae,be,0);else throw new Error("Unknown depthTexture format")}function Pe(C){const M=i.get(C),H=C.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==C.depthTexture){const re=C.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),re){const ue=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,re.removeEventListener("dispose",ue)};re.addEventListener("dispose",ue),M.__depthDisposeCallback=ue}M.__boundDepthTexture=re}if(C.depthTexture&&!M.__autoAllocateDepthBuffer)if(H)for(let re=0;re<6;re++)Ue(M.__webglFramebuffer[re],C,re);else{const re=C.texture.mipmaps;re&&re.length>0?Ue(M.__webglFramebuffer[0],C,0):Ue(M.__webglFramebuffer,C,0)}else if(H){M.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer[re]),M.__webglDepthbuffer[re]===void 0)M.__webglDepthbuffer[re]=n.createRenderbuffer(),ze(M.__webglDepthbuffer[re],C,!1);else{const ue=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,be=M.__webglDepthbuffer[re];n.bindRenderbuffer(n.RENDERBUFFER,be),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,be)}}else{const re=C.texture.mipmaps;if(re&&re.length>0?t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=n.createRenderbuffer(),ze(M.__webglDepthbuffer,C,!1);else{const ue=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,be=M.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,be),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,be)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ke(C,M,H){const re=i.get(C);M!==void 0&&Se(re.__webglFramebuffer,C,C.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),H!==void 0&&Pe(C)}function Ie(C){const M=C.texture,H=i.get(C),re=i.get(M);C.addEventListener("dispose",_);const ue=C.textures,be=C.isWebGLCubeRenderTarget===!0,ge=ue.length>1;if(ge||(re.__webglTexture===void 0&&(re.__webglTexture=n.createTexture()),re.__version=M.version,a.memory.textures++),be){H.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0){H.__webglFramebuffer[ae]=[];for(let fe=0;fe<M.mipmaps.length;fe++)H.__webglFramebuffer[ae][fe]=n.createFramebuffer()}else H.__webglFramebuffer[ae]=n.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){H.__webglFramebuffer=[];for(let ae=0;ae<M.mipmaps.length;ae++)H.__webglFramebuffer[ae]=n.createFramebuffer()}else H.__webglFramebuffer=n.createFramebuffer();if(ge)for(let ae=0,fe=ue.length;ae<fe;ae++){const Re=i.get(ue[ae]);Re.__webglTexture===void 0&&(Re.__webglTexture=n.createTexture(),a.memory.textures++)}if(C.samples>0&&Ve(C)===!1){H.__webglMultisampledFramebuffer=n.createFramebuffer(),H.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let ae=0;ae<ue.length;ae++){const fe=ue[ae];H.__webglColorRenderbuffer[ae]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,H.__webglColorRenderbuffer[ae]);const Re=s.convert(fe.format,fe.colorSpace),Le=s.convert(fe.type),Ee=b(fe.internalFormat,Re,Le,fe.normalized,fe.colorSpace,C.isXRRenderTarget===!0),De=je(C);n.renderbufferStorageMultisample(n.RENDERBUFFER,De,Ee,C.width,C.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ae,n.RENDERBUFFER,H.__webglColorRenderbuffer[ae])}n.bindRenderbuffer(n.RENDERBUFFER,null),C.depthBuffer&&(H.__webglDepthRenderbuffer=n.createRenderbuffer(),ze(H.__webglDepthRenderbuffer,C,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(be){t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),ve(n.TEXTURE_CUBE_MAP,M);for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)Se(H.__webglFramebuffer[ae][fe],C,M,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,fe);else Se(H.__webglFramebuffer[ae],C,M,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);v(M)&&y(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ge){for(let ae=0,fe=ue.length;ae<fe;ae++){const Re=ue[ae],Le=i.get(Re);let Ee=n.TEXTURE_2D;(C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(Ee=C.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Ee,Le.__webglTexture),ve(Ee,Re),Se(H.__webglFramebuffer,C,Re,n.COLOR_ATTACHMENT0+ae,Ee,0),v(Re)&&y(Ee)}t.unbindTexture()}else{let ae=n.TEXTURE_2D;if((C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(ae=C.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ae,re.__webglTexture),ve(ae,M),M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)Se(H.__webglFramebuffer[fe],C,M,n.COLOR_ATTACHMENT0,ae,fe);else Se(H.__webglFramebuffer,C,M,n.COLOR_ATTACHMENT0,ae,0);v(M)&&y(ae),t.unbindTexture()}C.depthBuffer&&Pe(C)}function We(C){const M=C.textures;for(let H=0,re=M.length;H<re;H++){const ue=M[H];if(v(ue)){const be=w(C),ge=i.get(ue).__webglTexture;t.bindTexture(be,ge),y(be),t.unbindTexture()}}}const Oe=[],He=[];function V(C){if(C.samples>0){if(Ve(C)===!1){const M=C.textures,H=C.width,re=C.height;let ue=n.COLOR_BUFFER_BIT;const be=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ge=i.get(C),ae=M.length>1;if(ae)for(let Re=0;Re<M.length;Re++)t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer);const fe=C.texture.mipmaps;fe&&fe.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Re=0;Re<M.length;Re++){if(C.resolveDepthBuffer&&(C.depthBuffer&&(ue|=n.DEPTH_BUFFER_BIT),C.stencilBuffer&&C.resolveStencilBuffer&&(ue|=n.STENCIL_BUFFER_BIT)),ae){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ge.__webglColorRenderbuffer[Re]);const Le=i.get(M[Re]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Le,0)}n.blitFramebuffer(0,0,H,re,0,0,H,re,ue,n.NEAREST),l===!0&&(Oe.length=0,He.length=0,Oe.push(n.COLOR_ATTACHMENT0+Re),C.depthBuffer&&C.resolveDepthBuffer===!1&&(Oe.push(be),He.push(be),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,He)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Oe))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ae)for(let Re=0;Re<M.length;Re++){t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.RENDERBUFFER,ge.__webglColorRenderbuffer[Re]);const Le=i.get(M[Re]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Re,n.TEXTURE_2D,Le,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(C.depthBuffer&&C.resolveDepthBuffer===!1&&l){const M=C.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[M])}}}function je(C){return Math.min(r.maxSamples,C.samples)}function Ve(C){const M=i.get(C);return C.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Xe(C){const M=a.render.frame;d.get(C)!==M&&(d.set(C,M),C.update())}function ye(C,M){const H=C.colorSpace,re=C.format,ue=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||H!==oa&&H!==ar&&(At.getTransfer(H)===Ut?(re!==li||ue!==qn)&&ft("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Tt("WebGLTextures: Unsupported texture color space:",H)),M}function Ce(C){return typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement?(c.width=C.naturalWidth||C.width,c.height=C.naturalHeight||C.height):typeof VideoFrame<"u"&&C instanceof VideoFrame?(c.width=C.displayWidth,c.height=C.displayHeight):(c.width=C.width,c.height=C.height),c}this.allocateTextureUnit=R,this.resetTextureUnits=k,this.getTextureUnits=U,this.setTextureUnits=N,this.setTexture2D=q,this.setTexture2DArray=Y,this.setTexture3D=te,this.setTextureCube=le,this.rebindTextures=ke,this.setupRenderTarget=Ie,this.updateRenderTargetMipmap=We,this.updateMultisampleRenderTarget=V,this.setupDepthRenderbuffer=Pe,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=Ve,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Sw(n,e){function t(i,r=ar){let s;const a=At.getTransfer(r);if(i===qn)return n.UNSIGNED_BYTE;if(i===dd)return n.UNSIGNED_SHORT_4_4_4_4;if(i===hd)return n.UNSIGNED_SHORT_5_5_5_1;if(i===rm)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===sm)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===nm)return n.BYTE;if(i===im)return n.SHORT;if(i===aa)return n.UNSIGNED_SHORT;if(i===ud)return n.INT;if(i===Oi)return n.UNSIGNED_INT;if(i===ti)return n.FLOAT;if(i===Fn)return n.HALF_FLOAT;if(i===am)return n.ALPHA;if(i===om)return n.RGB;if(i===li)return n.RGBA;if(i===Yi)return n.DEPTH_COMPONENT;if(i===cr)return n.DEPTH_STENCIL;if(i===lm)return n.RED;if(i===fd)return n.RED_INTEGER;if(i===Ir)return n.RG;if(i===pd)return n.RG_INTEGER;if(i===md)return n.RGBA_INTEGER;if(i===To||i===Ao||i===Co||i===Po)if(a===Ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===To)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ao)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Co)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Po)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===To)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ao)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Co)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Po)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Rc||i===Dc||i===Lc||i===Ic)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Rc)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Dc)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Lc)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Ic)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Nc||i===Uc||i===Fc||i===Oc||i===zc||i===Vo||i===Bc)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Nc||i===Uc)return a===Ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Fc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Oc)return s.COMPRESSED_R11_EAC;if(i===zc)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Vo)return s.COMPRESSED_RG11_EAC;if(i===Bc)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===kc||i===Vc||i===Hc||i===Gc||i===Wc||i===Xc||i===jc||i===qc||i===Yc||i===Kc||i===Zc||i===$c||i===Jc||i===Qc)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===kc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Vc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Hc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Gc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Wc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Xc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===jc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===qc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Yc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Kc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Zc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===$c)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Jc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Qc)return a===Ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===eu||i===tu||i===nu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===eu)return a===Ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===tu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===nu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===iu||i===ru||i===Ho||i===su)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===iu)return s.COMPRESSED_RED_RGTC1_EXT;if(i===ru)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ho)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===su)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ts?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const Mw=`
|
|
4081
4081
|
void main() {
|
|
4082
4082
|
|
|
4083
4083
|
gl_Position = vec4( position, 1.0 );
|
|
@@ -4101,7 +4101,7 @@ void main() {
|
|
|
4101
4101
|
|
|
4102
4102
|
}
|
|
4103
4103
|
|
|
4104
|
-
}`;class Ew{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new xm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new _n({vertexShader:Mw,fragmentShader:ww,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new an(new Ds(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Tw extends mr{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,f=null,h=null,p=null,g=null;const x=typeof XRWebGLBinding<"u",m=new Ew,v={},y=t.getContextAttributes();let w=null,b=null;const E=[],S=[],A=new it;let _=null;const T=new oi;T.viewport=new kt;const D=new oi;D.viewport=new kt;const L=[T,D],F=new Rb;let B=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getGripSpace()},this.getHand=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getHandSpace()};function N(G){const ie=S.indexOf(G.inputSource);if(ie===-1)return;const Z=E[ie];Z!==void 0&&(Z.update(G.inputSource,G.frame,c||a),Z.dispatchEvent({type:G.type,data:G.inputSource}))}function R(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",R),r.removeEventListener("inputsourceschange",z);for(let G=0;G<E.length;G++){const ie=S[G];ie!==null&&(S[G]=null,E[G].disconnect(ie))}B=null,U=null,m.reset();for(const G in v)delete v[G];e.setRenderTarget(w),p=null,h=null,f=null,r=null,b=null,ve.stop(),i.isPresenting=!1,e.setPixelRatio(_),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(G){s=G,i.isPresenting===!0&&ft("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(G){o=G,i.isPresenting===!0&&ft("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(G){c=G},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f===null&&x&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(G){if(r=G,r!==null){if(w=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",R),r.addEventListener("inputsourceschange",z),y.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(A),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let Z=null,le=null,fe=null;y.depth&&(fe=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Z=y.stencil?cr:Yi,le=y.stencil?Ts:Oi);const Se={colorFormat:t.RGBA8,depthFormat:fe,scaleFactor:s};f=this.getBinding(),h=f.createProjectionLayer(Se),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),b=new ni(h.textureWidth,h.textureHeight,{format:li,type:qn,depthTexture:new Nr(h.textureWidth,h.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,Z),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const Z={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Z),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new ni(p.framebufferWidth,p.framebufferHeight,{format:li,type:qn,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),ve.setContext(r),ve.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function z(G){for(let ie=0;ie<G.removed.length;ie++){const Z=G.removed[ie],le=S.indexOf(Z);le>=0&&(S[le]=null,E[le].disconnect(Z))}for(let ie=0;ie<G.added.length;ie++){const Z=G.added[ie];let le=S.indexOf(Z);if(le===-1){for(let Se=0;Se<E.length;Se++)if(Se>=S.length){S.push(Z),le=Se;break}else if(S[Se]===null){S[Se]=Z,le=Se;break}if(le===-1)break}const fe=E[le];fe&&fe.connect(Z)}}const Y=new X,K=new X;function ne(G,ie,Z){Y.setFromMatrixPosition(ie.matrixWorld),K.setFromMatrixPosition(Z.matrixWorld);const le=Y.distanceTo(K),fe=ie.projectionMatrix.elements,Se=Z.projectionMatrix.elements,ze=fe[14]/(fe[10]-1),Ue=fe[14]/(fe[10]+1),Pe=(fe[9]+1)/fe[5],ke=(fe[9]-1)/fe[5],Ie=(fe[8]-1)/fe[0],We=(Se[8]+1)/Se[0],Oe=ze*Ie,He=ze*We,k=le/(-Ie+We),je=k*-Ie;if(ie.matrixWorld.decompose(G.position,G.quaternion,G.scale),G.translateX(je),G.translateZ(k),G.matrixWorld.compose(G.position,G.quaternion,G.scale),G.matrixWorldInverse.copy(G.matrixWorld).invert(),fe[10]===-1)G.projectionMatrix.copy(ie.projectionMatrix),G.projectionMatrixInverse.copy(ie.projectionMatrixInverse);else{const Ve=ze+k,Xe=Ue+k,ye=Oe-je,Ce=He+(le-je),C=Pe*Ue/Xe*Ve,M=ke*Ue/Xe*Ve;G.projectionMatrix.makePerspective(ye,Ce,C,M,Ve,Xe),G.projectionMatrixInverse.copy(G.projectionMatrix).invert()}}function ce(G,ie){ie===null?G.matrixWorld.copy(G.matrix):G.matrixWorld.multiplyMatrices(ie.matrixWorld,G.matrix),G.matrixWorldInverse.copy(G.matrixWorld).invert()}this.updateCamera=function(G){if(r===null)return;let ie=G.near,Z=G.far;m.texture!==null&&(m.depthNear>0&&(ie=m.depthNear),m.depthFar>0&&(Z=m.depthFar)),F.near=D.near=T.near=ie,F.far=D.far=T.far=Z,(B!==F.near||U!==F.far)&&(r.updateRenderState({depthNear:F.near,depthFar:F.far}),B=F.near,U=F.far),F.layers.mask=G.layers.mask|6,T.layers.mask=F.layers.mask&-5,D.layers.mask=F.layers.mask&-3;const le=G.parent,fe=F.cameras;ce(F,le);for(let Se=0;Se<fe.length;Se++)ce(fe[Se],le);fe.length===2?ne(F,T,D):F.projectionMatrix.copy(T.projectionMatrix),V(G,F,le)};function V(G,ie,Z){Z===null?G.matrix.copy(ie.matrixWorld):(G.matrix.copy(Z.matrixWorld),G.matrix.invert(),G.matrix.multiply(ie.matrixWorld)),G.matrix.decompose(G.position,G.quaternion,G.scale),G.updateMatrixWorld(!0),G.projectionMatrix.copy(ie.projectionMatrix),G.projectionMatrixInverse.copy(ie.projectionMatrixInverse),G.isPerspectiveCamera&&(G.fov=ca*2*Math.atan(1/G.projectionMatrix.elements[5]),G.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(G){l=G,h!==null&&(h.fixedFoveation=G),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=G)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(F)},this.getCameraTexture=function(G){return v[G]};let ee=null;function me(G,ie){if(d=ie.getViewerPose(c||a),g=ie,d!==null){const Z=d.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let le=!1;Z.length!==F.cameras.length&&(F.cameras.length=0,le=!0);for(let Ue=0;Ue<Z.length;Ue++){const Pe=Z[Ue];let ke=null;if(p!==null)ke=p.getViewport(Pe);else{const We=f.getViewSubImage(h,Pe);ke=We.viewport,Ue===0&&(e.setRenderTargetTextures(b,We.colorTexture,We.depthStencilTexture),e.setRenderTarget(b))}let Ie=L[Ue];Ie===void 0&&(Ie=new oi,Ie.layers.enable(Ue),Ie.viewport=new kt,L[Ue]=Ie),Ie.matrix.fromArray(Pe.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(Pe.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(ke.x,ke.y,ke.width,ke.height),Ue===0&&(F.matrix.copy(Ie.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),le===!0&&F.cameras.push(Ie)}const fe=r.enabledFeatures;if(fe&&fe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){f=i.getBinding();const Ue=f.getDepthInformation(Z[0]);Ue&&Ue.isValid&&Ue.texture&&m.init(Ue,r.renderState)}if(fe&&fe.includes("camera-access")&&x){e.state.unbindTexture(),f=i.getBinding();for(let Ue=0;Ue<Z.length;Ue++){const Pe=Z[Ue].camera;if(Pe){let ke=v[Pe];ke||(ke=new xm,v[Pe]=ke);const Ie=f.getCameraImage(Pe);ke.sourceTexture=Ie}}}}for(let Z=0;Z<E.length;Z++){const le=S[Z],fe=E[Z];le!==null&&fe!==void 0&&fe.update(le,ie,c||a)}ee&&ee(G,ie),ie.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ie}),g=null}const ve=new Mm;ve.setAnimationLoop(me),this.setAnimationLoop=function(G){ee=G},this.dispose=function(){}}}const Aw=new Lt,Rm=new xt;Rm.set(-1,0,0,0,1,0,0,0,1);function Cw(n,e){function t(m,v){m.matrixAutoUpdate===!0&&m.updateMatrix(),v.value.copy(m.matrix)}function i(m,v){v.color.getRGB(m.fogColor.value,bm(n)),v.isFog?(m.fogNear.value=v.near,m.fogFar.value=v.far):v.isFogExp2&&(m.fogDensity.value=v.density)}function r(m,v,y,w,b){v.isNodeMaterial?v.uniformsNeedUpdate=!1:v.isMeshBasicMaterial?s(m,v):v.isMeshLambertMaterial?(s(m,v),v.envMap&&(m.envMapIntensity.value=v.envMapIntensity)):v.isMeshToonMaterial?(s(m,v),f(m,v)):v.isMeshPhongMaterial?(s(m,v),d(m,v),v.envMap&&(m.envMapIntensity.value=v.envMapIntensity)):v.isMeshStandardMaterial?(s(m,v),h(m,v),v.isMeshPhysicalMaterial&&p(m,v,b)):v.isMeshMatcapMaterial?(s(m,v),g(m,v)):v.isMeshDepthMaterial?s(m,v):v.isMeshDistanceMaterial?(s(m,v),x(m,v)):v.isMeshNormalMaterial?s(m,v):v.isLineBasicMaterial?(a(m,v),v.isLineDashedMaterial&&o(m,v)):v.isPointsMaterial?l(m,v,y,w):v.isSpriteMaterial?c(m,v):v.isShadowMaterial?(m.color.value.copy(v.color),m.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(m,v){m.opacity.value=v.opacity,v.color&&m.diffuse.value.copy(v.color),v.emissive&&m.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.bumpMap&&(m.bumpMap.value=v.bumpMap,t(v.bumpMap,m.bumpMapTransform),m.bumpScale.value=v.bumpScale,v.side===Yn&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===Yn&&m.normalScale.value.negate()),v.displacementMap&&(m.displacementMap.value=v.displacementMap,t(v.displacementMap,m.displacementMapTransform),m.displacementScale.value=v.displacementScale,m.displacementBias.value=v.displacementBias),v.emissiveMap&&(m.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,m.emissiveMapTransform)),v.specularMap&&(m.specularMap.value=v.specularMap,t(v.specularMap,m.specularMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest);const y=e.get(v),w=y.envMap,b=y.envMapRotation;w&&(m.envMap.value=w,m.envMapRotation.value.setFromMatrix4(Aw.makeRotationFromEuler(b)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(Rm),m.reflectivity.value=v.reflectivity,m.ior.value=v.ior,m.refractionRatio.value=v.refractionRatio),v.lightMap&&(m.lightMap.value=v.lightMap,m.lightMapIntensity.value=v.lightMapIntensity,t(v.lightMap,m.lightMapTransform)),v.aoMap&&(m.aoMap.value=v.aoMap,m.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,m.aoMapTransform))}function a(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform))}function o(m,v){m.dashSize.value=v.dashSize,m.totalSize.value=v.dashSize+v.gapSize,m.scale.value=v.scale}function l(m,v,y,w){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.size.value=v.size*y,m.scale.value=w*.5,v.map&&(m.map.value=v.map,t(v.map,m.uvTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function c(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.rotation.value=v.rotation,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function d(m,v){m.specular.value.copy(v.specular),m.shininess.value=Math.max(v.shininess,1e-4)}function f(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function h(m,v){m.metalness.value=v.metalness,v.metalnessMap&&(m.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,m.metalnessMapTransform)),m.roughness.value=v.roughness,v.roughnessMap&&(m.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,m.roughnessMapTransform)),v.envMap&&(m.envMapIntensity.value=v.envMapIntensity)}function p(m,v,y){m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Yn&&m.clearcoatNormalScale.value.negate())),v.dispersion>0&&(m.dispersion.value=v.dispersion),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,v){v.matcap&&(m.matcap.value=v.matcap)}function x(m,v){const y=e.get(v).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Pw(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,w){const b=w.program;i.uniformBlockBinding(y,b)}function c(y,w){let b=r[y.id];b===void 0&&(g(y),b=d(y),r[y.id]=b,y.addEventListener("dispose",m));const E=w.program;i.updateUBOMapping(y,E);const S=e.render.frame;s[y.id]!==S&&(h(y),s[y.id]=S)}function d(y){const w=f();y.__bindingPointIndex=w;const b=n.createBuffer(),E=y.__size,S=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,E,S),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,b),b}function f(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return Tt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(y){const w=r[y.id],b=y.uniforms,E=y.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let S=0,A=b.length;S<A;S++){const _=Array.isArray(b[S])?b[S]:[b[S]];for(let T=0,D=_.length;T<D;T++){const L=_[T];if(p(L,S,T,E)===!0){const F=L.__offset,B=Array.isArray(L.value)?L.value:[L.value];let U=0;for(let N=0;N<B.length;N++){const R=B[N],z=x(R);typeof R=="number"||typeof R=="boolean"?(L.__data[0]=R,n.bufferSubData(n.UNIFORM_BUFFER,F+U,L.__data)):R.isMatrix3?(L.__data[0]=R.elements[0],L.__data[1]=R.elements[1],L.__data[2]=R.elements[2],L.__data[3]=0,L.__data[4]=R.elements[3],L.__data[5]=R.elements[4],L.__data[6]=R.elements[5],L.__data[7]=0,L.__data[8]=R.elements[6],L.__data[9]=R.elements[7],L.__data[10]=R.elements[8],L.__data[11]=0):ArrayBuffer.isView(R)?L.__data.set(new R.constructor(R.buffer,R.byteOffset,L.__data.length)):(R.toArray(L.__data,U),U+=z.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,F,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(y,w,b,E){const S=y.value,A=w+"_"+b;if(E[A]===void 0)return typeof S=="number"||typeof S=="boolean"?E[A]=S:ArrayBuffer.isView(S)?E[A]=S.slice():E[A]=S.clone(),!0;{const _=E[A];if(typeof S=="number"||typeof S=="boolean"){if(_!==S)return E[A]=S,!0}else{if(ArrayBuffer.isView(S))return!0;if(_.equals(S)===!1)return _.copy(S),!0}}return!1}function g(y){const w=y.uniforms;let b=0;const E=16;for(let A=0,_=w.length;A<_;A++){const T=Array.isArray(w[A])?w[A]:[w[A]];for(let D=0,L=T.length;D<L;D++){const F=T[D],B=Array.isArray(F.value)?F.value:[F.value];for(let U=0,N=B.length;U<N;U++){const R=B[U],z=x(R),Y=b%E,K=Y%z.boundary,ne=Y+K;b+=K,ne!==0&&E-ne<z.storage&&(b+=E-ne),F.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=b,b+=z.storage}}}const S=b%E;return S>0&&(b+=E-S),y.__size=b,y.__cache={},this}function x(y){const w={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?ft("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(y)?(w.boundary=16,w.storage=y.byteLength):ft("WebGLRenderer: Unsupported uniform value type.",y),w}function m(y){const w=y.target;w.removeEventListener("dispose",m);const b=a.indexOf(w.__bindingPointIndex);a.splice(b,1),n.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function v(){for(const y in r)n.deleteBuffer(r[y]);a=[],r={},s={}}return{bind:l,update:c,dispose:v}}const Rw=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ti=null;function Dw(){return Ti===null&&(Ti=new cl(Rw,16,16,Ir,Fn),Ti.name="DFG_LUT",Ti.minFilter=hn,Ti.magFilter=hn,Ti.wrapS=_i,Ti.wrapT=_i,Ti.generateMipmaps=!1,Ti.needsUpdate=!0),Ti}class Lw{constructor(e={}){const{canvas:t=vx(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:h=!1,outputBufferType:p=qn}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=a;const x=p,m=new Set([md,pd,fd]),v=new Set([qn,Oi,aa,Ts,dd,hd]),y=new Uint32Array(4),w=new Int32Array(4),b=new X;let E=null,S=null;const A=[],_=[];let T=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const D=this;let L=!1,F=null;this._outputColorSpace=Wn;let B=0,U=0,N=null,R=-1,z=null;const Y=new kt,K=new kt;let ne=null;const ce=new tt(0);let V=0,ee=t.width,me=t.height,ve=1,G=null,ie=null;const Z=new kt(0,0,ee,me),le=new kt(0,0,ee,me);let fe=!1;const Se=new Sd;let ze=!1,Ue=!1;const Pe=new Lt,ke=new X,Ie=new kt,We={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Oe=!1;function He(){return N===null?ve:1}let k=i;function je(I,te){return t.getContext(I,te)}try{const I={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${id}`),t.addEventListener("webglcontextlost",Be,!1),t.addEventListener("webglcontextrestored",lt,!1),t.addEventListener("webglcontextcreationerror",vt,!1),k===null){const te="webgl2";if(k=je(te,I),k===null)throw je(te)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw Tt("WebGLRenderer: "+I.message),I}let Ve,Xe,ye,Ce,C,M,H,re,ue,be,ge,ae,he,Re,Le,Ee,De,et,Ye,ht,J,Ge,Te;function Ze(){Ve=new D1(k),Ve.init(),J=new Sw(k,Ve),Xe=new M1(k,Ve,e,J),ye=new bw(k,Ve),Xe.reversedDepthBuffer&&h&&ye.buffers.depth.setReversed(!0),Ce=new N1(k),C=new aw,M=new yw(k,Ve,ye,C,Xe,J,Ce),H=new R1(D),re=new zb(k),Ge=new y1(k,re),ue=new L1(k,re,Ce,Ge),be=new F1(k,ue,re,Ge,Ce),et=new U1(k,Xe,M),Le=new w1(C),ge=new sw(D,H,Ve,Xe,Ge,Le),ae=new Cw(D,C),he=new lw,Re=new pw(Ve),De=new b1(D,H,ye,be,g,l),Ee=new xw(D,be,Xe),Te=new Pw(k,Ce,Xe,ye),Ye=new S1(k,Ve,Ce),ht=new I1(k,Ve,Ce),Ce.programs=ge.programs,D.capabilities=Xe,D.extensions=Ve,D.properties=C,D.renderLists=he,D.shadowMap=Ee,D.state=ye,D.info=Ce}Ze(),x!==qn&&(T=new z1(x,t.width,t.height,r,s));const qe=new Tw(D,k);this.xr=qe,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const I=Ve.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=Ve.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return ve},this.setPixelRatio=function(I){I!==void 0&&(ve=I,this.setSize(ee,me,!1))},this.getSize=function(I){return I.set(ee,me)},this.setSize=function(I,te,de=!0){if(qe.isPresenting){ft("WebGLRenderer: Can't change size while VR device is presenting.");return}ee=I,me=te,t.width=Math.floor(I*ve),t.height=Math.floor(te*ve),de===!0&&(t.style.width=I+"px",t.style.height=te+"px"),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,I,te)},this.getDrawingBufferSize=function(I){return I.set(ee*ve,me*ve).floor()},this.setDrawingBufferSize=function(I,te,de){ee=I,me=te,ve=de,t.width=Math.floor(I*de),t.height=Math.floor(te*de),this.setViewport(0,0,I,te)},this.setEffects=function(I){if(x===qn){Tt("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let te=0;te<I.length;te++)if(I[te].isOutputPass===!0){ft("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(I||[])},this.getCurrentViewport=function(I){return I.copy(Y)},this.getViewport=function(I){return I.copy(Z)},this.setViewport=function(I,te,de,pe){I.isVector4?Z.set(I.x,I.y,I.z,I.w):Z.set(I,te,de,pe),ye.viewport(Y.copy(Z).multiplyScalar(ve).round())},this.getScissor=function(I){return I.copy(le)},this.setScissor=function(I,te,de,pe){I.isVector4?le.set(I.x,I.y,I.z,I.w):le.set(I,te,de,pe),ye.scissor(K.copy(le).multiplyScalar(ve).round())},this.getScissorTest=function(){return fe},this.setScissorTest=function(I){ye.setScissorTest(fe=I)},this.setOpaqueSort=function(I){G=I},this.setTransparentSort=function(I){ie=I},this.getClearColor=function(I){return I.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(I=!0,te=!0,de=!0){let pe=0;if(I){let _e=!1;if(N!==null){const $e=N.texture.format;_e=m.has($e)}if(_e){const $e=N.texture.type,nt=v.has($e),Je=De.getClearColor(),ot=De.getClearAlpha(),ct=Je.r,_t=Je.g,bt=Je.b;nt?(y[0]=ct,y[1]=_t,y[2]=bt,y[3]=ot,k.clearBufferuiv(k.COLOR,0,y)):(w[0]=ct,w[1]=_t,w[2]=bt,w[3]=ot,k.clearBufferiv(k.COLOR,0,w))}else pe|=k.COLOR_BUFFER_BIT}te&&(pe|=k.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),de&&(pe|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),pe!==0&&k.clear(pe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(I){I.setRenderer(this),F=I},this.dispose=function(){t.removeEventListener("webglcontextlost",Be,!1),t.removeEventListener("webglcontextrestored",lt,!1),t.removeEventListener("webglcontextcreationerror",vt,!1),De.dispose(),he.dispose(),Re.dispose(),C.dispose(),H.dispose(),be.dispose(),Ge.dispose(),Te.dispose(),ge.dispose(),qe.dispose(),qe.removeEventListener("sessionstart",Ns),qe.removeEventListener("sessionend",wa),Mi.stop()};function Be(I){I.preventDefault(),jo("WebGLRenderer: Context Lost."),L=!0}function lt(){jo("WebGLRenderer: Context Restored."),L=!1;const I=Ce.autoReset,te=Ee.enabled,de=Ee.autoUpdate,pe=Ee.needsUpdate,_e=Ee.type;Ze(),Ce.autoReset=I,Ee.enabled=te,Ee.autoUpdate=de,Ee.needsUpdate=pe,Ee.type=_e}function vt(I){Tt("WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function $t(I){const te=I.target;te.removeEventListener("dispose",$t),It(te)}function It(I){ii(I),C.remove(I)}function ii(I){const te=C.get(I).programs;te!==void 0&&(te.forEach(function(de){ge.releaseProgram(de)}),I.isShaderMaterial&&ge.releaseShaderCache(I))}this.renderBufferDirect=function(I,te,de,pe,_e,$e){te===null&&(te=We);const nt=_e.isMesh&&_e.matrixWorld.determinant()<0,Je=Dn(I,te,de,pe,_e);ye.setMaterial(pe,nt);let ot=de.index,ct=1;if(pe.wireframe===!0){if(ot=ue.getWireframeAttribute(de),ot===void 0)return;ct=2}const _t=de.drawRange,bt=de.attributes.position;let dt=_t.start*ct,zt=(_t.start+_t.count)*ct;$e!==null&&(dt=Math.max(dt,$e.start*ct),zt=Math.min(zt,($e.start+$e.count)*ct)),ot!==null?(dt=Math.max(dt,0),zt=Math.min(zt,ot.count)):bt!=null&&(dt=Math.max(dt,0),zt=Math.min(zt,bt.count));const cn=zt-dt;if(cn<0||cn===1/0)return;Ge.setup(_e,pe,Je,de,ot);let nn,Vt=Ye;if(ot!==null&&(nn=re.get(ot),Vt=ht,Vt.setIndex(nn)),_e.isMesh)pe.wireframe===!0?(ye.setLineWidth(pe.wireframeLinewidth*He()),Vt.setMode(k.LINES)):Vt.setMode(k.TRIANGLES);else if(_e.isLine){let Ln=pe.linewidth;Ln===void 0&&(Ln=1),ye.setLineWidth(Ln*He()),_e.isLineSegments?Vt.setMode(k.LINES):_e.isLineLoop?Vt.setMode(k.LINE_LOOP):Vt.setMode(k.LINE_STRIP)}else _e.isPoints?Vt.setMode(k.POINTS):_e.isSprite&&Vt.setMode(k.TRIANGLES);if(_e.isBatchedMesh)if(Ve.get("WEBGL_multi_draw"))Vt.renderMultiDraw(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount);else{const Ln=_e._multiDrawStarts,rt=_e._multiDrawCounts,Zn=_e._multiDrawCount,Ct=ot?re.get(ot).bytesPerElement:1,si=C.get(pe).currentProgram.getUniforms();for(let wi=0;wi<Zn;wi++)si.setValue(k,"_gl_DrawID",wi),Vt.render(Ln[wi]/Ct,rt[wi])}else if(_e.isInstancedMesh)Vt.renderInstances(dt,cn,_e.count);else if(de.isInstancedBufferGeometry){const Ln=de._maxInstanceCount!==void 0?de._maxInstanceCount:1/0,rt=Math.min(de.instanceCount,Ln);Vt.renderInstances(dt,cn,rt)}else Vt.render(dt,cn)};function ri(I,te,de){I.transparent===!0&&I.side===Qn&&I.forceSinglePass===!1?(I.side=Yn,I.needsUpdate=!0,en(I,te,de),I.side=Kn,I.needsUpdate=!0,en(I,te,de),I.side=Qn):en(I,te,de)}this.compile=function(I,te,de=null){de===null&&(de=I),S=Re.get(de),S.init(te),_.push(S),de.traverseVisible(function(_e){_e.isLight&&_e.layers.test(te.layers)&&(S.pushLight(_e),_e.castShadow&&S.pushShadow(_e))}),I!==de&&I.traverseVisible(function(_e){_e.isLight&&_e.layers.test(te.layers)&&(S.pushLight(_e),_e.castShadow&&S.pushShadow(_e))}),S.setupLights();const pe=new Set;return I.traverse(function(_e){if(!(_e.isMesh||_e.isPoints||_e.isLine||_e.isSprite))return;const $e=_e.material;if($e)if(Array.isArray($e))for(let nt=0;nt<$e.length;nt++){const Je=$e[nt];ri(Je,de,_e),pe.add(Je)}else ri($e,de,_e),pe.add($e)}),S=_.pop(),pe},this.compileAsync=function(I,te,de=null){const pe=this.compile(I,te,de);return new Promise(_e=>{function $e(){if(pe.forEach(function(nt){C.get(nt).currentProgram.isReady()&&pe.delete(nt)}),pe.size===0){_e(I);return}setTimeout($e,10)}Ve.get("KHR_parallel_shader_compile")!==null?$e():setTimeout($e,10)})};let Or=null;function vl(I){Or&&Or(I)}function Ns(){Mi.stop()}function wa(){Mi.start()}const Mi=new Mm;Mi.setAnimationLoop(vl),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(I){Or=I,qe.setAnimationLoop(I),I===null?Mi.stop():Mi.start()},qe.addEventListener("sessionstart",Ns),qe.addEventListener("sessionend",wa),this.render=function(I,te){if(te!==void 0&&te.isCamera!==!0){Tt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;F!==null&&F.renderStart(I,te);const de=qe.enabled===!0&&qe.isPresenting===!0,pe=T!==null&&(N===null||de)&&T.begin(D,N);if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),te.parent===null&&te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),qe.enabled===!0&&qe.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(qe.cameraAutoUpdate===!0&&qe.updateCamera(te),te=qe.getCamera()),I.isScene===!0&&I.onBeforeRender(D,I,te,N),S=Re.get(I,_.length),S.init(te),S.state.textureUnits=M.getTextureUnits(),_.push(S),Pe.multiplyMatrices(te.projectionMatrix,te.matrixWorldInverse),Se.setFromProjectionMatrix(Pe,Ni,te.reversedDepth),Ue=this.localClippingEnabled,ze=Le.init(this.clippingPlanes,Ue),E=he.get(I,A.length),E.init(),A.push(E),qe.enabled===!0&&qe.isPresenting===!0){const nt=D.xr.getDepthSensingMesh();nt!==null&&Us(nt,te,-1/0,D.sortObjects)}Us(I,te,0,D.sortObjects),E.finish(),D.sortObjects===!0&&E.sort(G,ie),Oe=qe.enabled===!1||qe.isPresenting===!1||qe.hasDepthSensing()===!1,Oe&&De.addToRenderList(E,I),this.info.render.frame++,ze===!0&&Le.beginShadows();const _e=S.state.shadowsArray;if(Ee.render(_e,I,te),ze===!0&&Le.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pe&&T.hasRenderPass())===!1){const nt=E.opaque,Je=E.transmissive;if(S.setupLights(),te.isArrayCamera){const ot=te.cameras;if(Je.length>0)for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct];Ta(nt,Je,I,bt)}Oe&&De.render(I);for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct];Ea(E,I,bt,bt.viewport)}}else Je.length>0&&Ta(nt,Je,I,te),Oe&&De.render(I),Ea(E,I,te)}N!==null&&U===0&&(M.updateMultisampleRenderTarget(N),M.updateRenderTargetMipmap(N)),pe&&T.end(D),I.isScene===!0&&I.onAfterRender(D,I,te),Ge.resetDefaultState(),R=-1,z=null,_.pop(),_.length>0?(S=_[_.length-1],M.setTextureUnits(S.state.textureUnits),ze===!0&&Le.setGlobalState(D.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?E=A[A.length-1]:E=null,F!==null&&F.renderEnd()};function Us(I,te,de,pe){if(I.visible===!1)return;if(I.layers.test(te.layers)){if(I.isGroup)de=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(te);else if(I.isLightProbeGrid)S.pushLightProbeGrid(I);else if(I.isLight)S.pushLight(I),I.castShadow&&S.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||Se.intersectsSprite(I)){pe&&Ie.setFromMatrixPosition(I.matrixWorld).applyMatrix4(Pe);const nt=be.update(I),Je=I.material;Je.visible&&E.push(I,nt,Je,de,Ie.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||Se.intersectsObject(I))){const nt=be.update(I),Je=I.material;if(pe&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),Ie.copy(I.boundingSphere.center)):(nt.boundingSphere===null&&nt.computeBoundingSphere(),Ie.copy(nt.boundingSphere.center)),Ie.applyMatrix4(I.matrixWorld).applyMatrix4(Pe)),Array.isArray(Je)){const ot=nt.groups;for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct],dt=Je[bt.materialIndex];dt&&dt.visible&&E.push(I,nt,dt,de,Ie.z,bt)}}else Je.visible&&E.push(I,nt,Je,de,Ie.z,null)}}const $e=I.children;for(let nt=0,Je=$e.length;nt<Je;nt++)Us($e[nt],te,de,pe)}function Ea(I,te,de,pe){const{opaque:_e,transmissive:$e,transparent:nt}=I;S.setupLightsView(de),ze===!0&&Le.setGlobalState(D.clippingPlanes,de),pe&&ye.viewport(Y.copy(pe)),_e.length>0&&Rt(_e,te,de),$e.length>0&&Rt($e,te,de),nt.length>0&&Rt(nt,te,de),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function Ta(I,te,de,pe){if((de.isScene===!0?de.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[pe.id]===void 0){const dt=Ve.has("EXT_color_buffer_half_float")||Ve.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[pe.id]=new ni(1,1,{generateMipmaps:!0,type:dt?Fn:qn,minFilter:lr,samples:Math.max(4,Xe.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:At.workingColorSpace})}const $e=S.state.transmissionRenderTarget[pe.id],nt=pe.viewport||Y;$e.setSize(nt.z*D.transmissionResolutionScale,nt.w*D.transmissionResolutionScale);const Je=D.getRenderTarget(),ot=D.getActiveCubeFace(),ct=D.getActiveMipmapLevel();D.setRenderTarget($e),D.getClearColor(ce),V=D.getClearAlpha(),V<1&&D.setClearColor(16777215,.5),D.clear(),Oe&&De.render(de);const _t=D.toneMapping;D.toneMapping=Fi;const bt=pe.viewport;if(pe.viewport!==void 0&&(pe.viewport=void 0),S.setupLightsView(pe),ze===!0&&Le.setGlobalState(D.clippingPlanes,pe),Rt(I,de,pe),M.updateMultisampleRenderTarget($e),M.updateRenderTargetMipmap($e),Ve.has("WEBGL_multisampled_render_to_texture")===!1){let dt=!1;for(let zt=0,cn=te.length;zt<cn;zt++){const nn=te[zt],{object:Vt,geometry:Ln,material:rt,group:Zn}=nn;if(rt.side===Qn&&Vt.layers.test(pe.layers)){const Ct=rt.side;rt.side=Yn,rt.needsUpdate=!0,qt(Vt,de,pe,Ln,rt,Zn),rt.side=Ct,rt.needsUpdate=!0,dt=!0}}dt===!0&&(M.updateMultisampleRenderTarget($e),M.updateRenderTargetMipmap($e))}D.setRenderTarget(Je,ot,ct),D.setClearColor(ce,V),bt!==void 0&&(pe.viewport=bt),D.toneMapping=_t}function Rt(I,te,de){const pe=te.isScene===!0?te.overrideMaterial:null;for(let _e=0,$e=I.length;_e<$e;_e++){const nt=I[_e],{object:Je,geometry:ot,group:ct}=nt;let _t=nt.material;_t.allowOverride===!0&&pe!==null&&(_t=pe),Je.layers.test(de.layers)&&qt(Je,te,de,ot,_t,ct)}}function qt(I,te,de,pe,_e,$e){I.onBeforeRender(D,te,de,pe,_e,$e),I.modelViewMatrix.multiplyMatrices(de.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),_e.onBeforeRender(D,te,de,pe,I,$e),_e.transparent===!0&&_e.side===Qn&&_e.forceSinglePass===!1?(_e.side=Yn,_e.needsUpdate=!0,D.renderBufferDirect(de,te,pe,_e,I,$e),_e.side=Kn,_e.needsUpdate=!0,D.renderBufferDirect(de,te,pe,_e,I,$e),_e.side=Qn):D.renderBufferDirect(de,te,pe,_e,I,$e),I.onAfterRender(D,te,de,pe,_e,$e)}function en(I,te,de){te.isScene!==!0&&(te=We);const pe=C.get(I),_e=S.state.lights,$e=S.state.shadowsArray,nt=_e.state.version,Je=ge.getParameters(I,_e.state,$e,te,de,S.state.lightProbeGridArray),ot=ge.getProgramCacheKey(Je);let ct=pe.programs;pe.environment=I.isMeshStandardMaterial||I.isMeshLambertMaterial||I.isMeshPhongMaterial?te.environment:null,pe.fog=te.fog;const _t=I.isMeshStandardMaterial||I.isMeshLambertMaterial&&!I.envMap||I.isMeshPhongMaterial&&!I.envMap;pe.envMap=H.get(I.envMap||pe.environment,_t),pe.envMapRotation=pe.environment!==null&&I.envMap===null?te.environmentRotation:I.envMapRotation,ct===void 0&&(I.addEventListener("dispose",$t),ct=new Map,pe.programs=ct);let bt=ct.get(ot);if(bt!==void 0){if(pe.currentProgram===bt&&pe.lightsStateVersion===nt)return tn(I,Je),bt}else Je.uniforms=ge.getUniforms(I),F!==null&&I.isNodeMaterial&&F.build(I,de,Je),I.onBeforeCompile(Je,D),bt=ge.acquireProgram(Je,ot),ct.set(ot,bt),pe.uniforms=Je.uniforms;const dt=pe.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(dt.clippingPlanes=Le.uniform),tn(I,Je),pe.needsLights=Yt(I),pe.lightsStateVersion=nt,pe.needsLights&&(dt.ambientLightColor.value=_e.state.ambient,dt.lightProbe.value=_e.state.probe,dt.directionalLights.value=_e.state.directional,dt.directionalLightShadows.value=_e.state.directionalShadow,dt.spotLights.value=_e.state.spot,dt.spotLightShadows.value=_e.state.spotShadow,dt.rectAreaLights.value=_e.state.rectArea,dt.ltc_1.value=_e.state.rectAreaLTC1,dt.ltc_2.value=_e.state.rectAreaLTC2,dt.pointLights.value=_e.state.point,dt.pointLightShadows.value=_e.state.pointShadow,dt.hemisphereLights.value=_e.state.hemi,dt.directionalShadowMatrix.value=_e.state.directionalShadowMatrix,dt.spotLightMatrix.value=_e.state.spotLightMatrix,dt.spotLightMap.value=_e.state.spotLightMap,dt.pointShadowMatrix.value=_e.state.pointShadowMatrix),pe.lightProbeGrid=S.state.lightProbeGridArray.length>0,pe.currentProgram=bt,pe.uniformsList=null,bt}function An(I){if(I.uniformsList===null){const te=I.currentProgram.getUniforms();I.uniformsList=Ro.seqWithValue(te.seq,I.uniforms)}return I.uniformsList}function tn(I,te){const de=C.get(I);de.outputColorSpace=te.outputColorSpace,de.batching=te.batching,de.batchingColor=te.batchingColor,de.instancing=te.instancing,de.instancingColor=te.instancingColor,de.instancingMorph=te.instancingMorph,de.skinning=te.skinning,de.morphTargets=te.morphTargets,de.morphNormals=te.morphNormals,de.morphColors=te.morphColors,de.morphTargetsCount=te.morphTargetsCount,de.numClippingPlanes=te.numClippingPlanes,de.numIntersection=te.numClipIntersection,de.vertexAlphas=te.vertexAlphas,de.vertexTangents=te.vertexTangents,de.toneMapping=te.toneMapping}function pn(I,te){if(I.length===0)return null;if(I.length===1)return I[0].texture!==null?I[0]:null;b.setFromMatrixPosition(te.matrixWorld);for(let de=0,pe=I.length;de<pe;de++){const _e=I[de];if(_e.texture!==null&&_e.boundingBox.containsPoint(b))return _e}return null}function Dn(I,te,de,pe,_e){te.isScene!==!0&&(te=We),M.resetTextureUnits();const $e=te.fog,nt=pe.isMeshStandardMaterial||pe.isMeshLambertMaterial||pe.isMeshPhongMaterial?te.environment:null,Je=N===null?D.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:At.workingColorSpace,ot=pe.isMeshStandardMaterial||pe.isMeshLambertMaterial&&!pe.envMap||pe.isMeshPhongMaterial&&!pe.envMap,ct=H.get(pe.envMap||nt,ot),_t=pe.vertexColors===!0&&!!de.attributes.color&&de.attributes.color.itemSize===4,bt=!!de.attributes.tangent&&(!!pe.normalMap||pe.anisotropy>0),dt=!!de.morphAttributes.position,zt=!!de.morphAttributes.normal,cn=!!de.morphAttributes.color;let nn=Fi;pe.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(nn=D.toneMapping);const Vt=de.morphAttributes.position||de.morphAttributes.normal||de.morphAttributes.color,Ln=Vt!==void 0?Vt.length:0,rt=C.get(pe),Zn=S.state.lights;if(ze===!0&&(Ue===!0||I!==z)){const Wt=I===z&&pe.id===R;Le.setState(pe,I,Wt)}let Ct=!1;pe.version===rt.__version?(rt.needsLights&&rt.lightsStateVersion!==Zn.state.version||rt.outputColorSpace!==Je||_e.isBatchedMesh&&rt.batching===!1||!_e.isBatchedMesh&&rt.batching===!0||_e.isBatchedMesh&&rt.batchingColor===!0&&_e.colorTexture===null||_e.isBatchedMesh&&rt.batchingColor===!1&&_e.colorTexture!==null||_e.isInstancedMesh&&rt.instancing===!1||!_e.isInstancedMesh&&rt.instancing===!0||_e.isSkinnedMesh&&rt.skinning===!1||!_e.isSkinnedMesh&&rt.skinning===!0||_e.isInstancedMesh&&rt.instancingColor===!0&&_e.instanceColor===null||_e.isInstancedMesh&&rt.instancingColor===!1&&_e.instanceColor!==null||_e.isInstancedMesh&&rt.instancingMorph===!0&&_e.morphTexture===null||_e.isInstancedMesh&&rt.instancingMorph===!1&&_e.morphTexture!==null||rt.envMap!==ct||pe.fog===!0&&rt.fog!==$e||rt.numClippingPlanes!==void 0&&(rt.numClippingPlanes!==Le.numPlanes||rt.numIntersection!==Le.numIntersection)||rt.vertexAlphas!==_t||rt.vertexTangents!==bt||rt.morphTargets!==dt||rt.morphNormals!==zt||rt.morphColors!==cn||rt.toneMapping!==nn||rt.morphTargetsCount!==Ln||!!rt.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(Ct=!0):(Ct=!0,rt.__version=pe.version);let si=rt.currentProgram;Ct===!0&&(si=en(pe,te,_e),F&&pe.isNodeMaterial&&F.onUpdateProgram(pe,si,rt));let wi=!1,Ki=!1,zr=!1;const Ht=si.getUniforms(),un=rt.uniforms;if(ye.useProgram(si.program)&&(wi=!0,Ki=!0,zr=!0),pe.id!==R&&(R=pe.id,Ki=!0),rt.needsLights){const Wt=pn(S.state.lightProbeGridArray,_e);rt.lightProbeGrid!==Wt&&(rt.lightProbeGrid=Wt,Ki=!0)}if(wi||z!==I){ye.buffers.depth.getReversed()&&I.reversedDepth!==!0&&(I._reversedDepth=!0,I.updateProjectionMatrix()),Ht.setValue(k,"projectionMatrix",I.projectionMatrix),Ht.setValue(k,"viewMatrix",I.matrixWorldInverse);const $i=Ht.map.cameraPosition;$i!==void 0&&$i.setValue(k,ke.setFromMatrixPosition(I.matrixWorld)),Xe.logarithmicDepthBuffer&&Ht.setValue(k,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(pe.isMeshPhongMaterial||pe.isMeshToonMaterial||pe.isMeshLambertMaterial||pe.isMeshBasicMaterial||pe.isMeshStandardMaterial||pe.isShaderMaterial)&&Ht.setValue(k,"isOrthographic",I.isOrthographicCamera===!0),z!==I&&(z=I,Ki=!0,zr=!0)}if(rt.needsLights&&(Zn.state.directionalShadowMap.length>0&&Ht.setValue(k,"directionalShadowMap",Zn.state.directionalShadowMap,M),Zn.state.spotShadowMap.length>0&&Ht.setValue(k,"spotShadowMap",Zn.state.spotShadowMap,M),Zn.state.pointShadowMap.length>0&&Ht.setValue(k,"pointShadowMap",Zn.state.pointShadowMap,M)),_e.isSkinnedMesh){Ht.setOptional(k,_e,"bindMatrix"),Ht.setOptional(k,_e,"bindMatrixInverse");const Wt=_e.skeleton;Wt&&(Wt.boneTexture===null&&Wt.computeBoneTexture(),Ht.setValue(k,"boneTexture",Wt.boneTexture,M))}_e.isBatchedMesh&&(Ht.setOptional(k,_e,"batchingTexture"),Ht.setValue(k,"batchingTexture",_e._matricesTexture,M),Ht.setOptional(k,_e,"batchingIdTexture"),Ht.setValue(k,"batchingIdTexture",_e._indirectTexture,M),Ht.setOptional(k,_e,"batchingColorTexture"),_e._colorsTexture!==null&&Ht.setValue(k,"batchingColorTexture",_e._colorsTexture,M));const Zi=de.morphAttributes;if((Zi.position!==void 0||Zi.normal!==void 0||Zi.color!==void 0)&&et.update(_e,de,si),(Ki||rt.receiveShadow!==_e.receiveShadow)&&(rt.receiveShadow=_e.receiveShadow,Ht.setValue(k,"receiveShadow",_e.receiveShadow)),(pe.isMeshStandardMaterial||pe.isMeshLambertMaterial||pe.isMeshPhongMaterial)&&pe.envMap===null&&te.environment!==null&&(un.envMapIntensity.value=te.environmentIntensity),un.dfgLUT!==void 0&&(un.dfgLUT.value=Dw()),Ki){if(Ht.setValue(k,"toneMappingExposure",D.toneMappingExposure),rt.needsLights&&gn(un,zr),$e&&pe.fog===!0&&ae.refreshFogUniforms(un,$e),ae.refreshMaterialUniforms(un,pe,ve,me,S.state.transmissionRenderTarget[I.id]),rt.needsLights&&rt.lightProbeGrid){const Wt=rt.lightProbeGrid;un.probesSH.value=Wt.texture,un.probesMin.value.copy(Wt.boundingBox.min),un.probesMax.value.copy(Wt.boundingBox.max),un.probesResolution.value.copy(Wt.resolution)}Ro.upload(k,An(rt),un,M)}if(pe.isShaderMaterial&&pe.uniformsNeedUpdate===!0&&(Ro.upload(k,An(rt),un,M),pe.uniformsNeedUpdate=!1),pe.isSpriteMaterial&&Ht.setValue(k,"center",_e.center),Ht.setValue(k,"modelViewMatrix",_e.modelViewMatrix),Ht.setValue(k,"normalMatrix",_e.normalMatrix),Ht.setValue(k,"modelMatrix",_e.matrixWorld),pe.uniformsGroups!==void 0){const Wt=pe.uniformsGroups;for(let $i=0,Br=Wt.length;$i<Br;$i++){const eh=Wt[$i];Te.update(eh,si),Te.bind(eh,si)}}return si}function gn(I,te){I.ambientLightColor.needsUpdate=te,I.lightProbe.needsUpdate=te,I.directionalLights.needsUpdate=te,I.directionalLightShadows.needsUpdate=te,I.pointLights.needsUpdate=te,I.pointLightShadows.needsUpdate=te,I.spotLights.needsUpdate=te,I.spotLightShadows.needsUpdate=te,I.rectAreaLights.needsUpdate=te,I.hemisphereLights.needsUpdate=te}function Yt(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(I,te,de){const pe=C.get(I);pe.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,pe.__autoAllocateDepthBuffer===!1&&(pe.__useRenderToTexture=!1),C.get(I.texture).__webglTexture=te,C.get(I.depthTexture).__webglTexture=pe.__autoAllocateDepthBuffer?void 0:de,pe.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,te){const de=C.get(I);de.__webglFramebuffer=te,de.__useDefaultFramebuffer=te===void 0};const Jt=k.createFramebuffer();this.setRenderTarget=function(I,te=0,de=0){N=I,B=te,U=de;let pe=null,_e=!1,$e=!1;if(I){const Je=C.get(I);if(Je.__useDefaultFramebuffer!==void 0){ye.bindFramebuffer(k.FRAMEBUFFER,Je.__webglFramebuffer),Y.copy(I.viewport),K.copy(I.scissor),ne=I.scissorTest,ye.viewport(Y),ye.scissor(K),ye.setScissorTest(ne),R=-1;return}else if(Je.__webglFramebuffer===void 0)M.setupRenderTarget(I);else if(Je.__hasExternalTextures)M.rebindTextures(I,C.get(I.texture).__webglTexture,C.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const _t=I.depthTexture;if(Je.__boundDepthTexture!==_t){if(_t!==null&&C.has(_t)&&(I.width!==_t.image.width||I.height!==_t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");M.setupDepthRenderbuffer(I)}}const ot=I.texture;(ot.isData3DTexture||ot.isDataArrayTexture||ot.isCompressedArrayTexture)&&($e=!0);const ct=C.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(ct[te])?pe=ct[te][de]:pe=ct[te],_e=!0):I.samples>0&&M.useMultisampledRTT(I)===!1?pe=C.get(I).__webglMultisampledFramebuffer:Array.isArray(ct)?pe=ct[de]:pe=ct,Y.copy(I.viewport),K.copy(I.scissor),ne=I.scissorTest}else Y.copy(Z).multiplyScalar(ve).floor(),K.copy(le).multiplyScalar(ve).floor(),ne=fe;if(de!==0&&(pe=Jt),ye.bindFramebuffer(k.FRAMEBUFFER,pe)&&ye.drawBuffers(I,pe),ye.viewport(Y),ye.scissor(K),ye.setScissorTest(ne),_e){const Je=C.get(I.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+te,Je.__webglTexture,de)}else if($e){const Je=te;for(let ot=0;ot<I.textures.length;ot++){const ct=C.get(I.textures[ot]);k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0+ot,ct.__webglTexture,de,Je)}}else if(I!==null&&de!==0){const Je=C.get(I.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,Je.__webglTexture,de)}R=-1},this.readRenderTargetPixels=function(I,te,de,pe,_e,$e,nt,Je=0){if(!(I&&I.isWebGLRenderTarget)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ot=C.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot){ye.bindFramebuffer(k.FRAMEBUFFER,ot);try{const ct=I.textures[Je],_t=ct.format,bt=ct.type;if(I.textures.length>1&&k.readBuffer(k.COLOR_ATTACHMENT0+Je),!Xe.textureFormatReadable(_t)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Xe.textureTypeReadable(bt)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}te>=0&&te<=I.width-pe&&de>=0&&de<=I.height-_e&&k.readPixels(te,de,pe,_e,J.convert(_t),J.convert(bt),$e)}finally{const ct=N!==null?C.get(N).__webglFramebuffer:null;ye.bindFramebuffer(k.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(I,te,de,pe,_e,$e,nt,Je=0){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ot=C.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot)if(te>=0&&te<=I.width-pe&&de>=0&&de<=I.height-_e){ye.bindFramebuffer(k.FRAMEBUFFER,ot);const ct=I.textures[Je],_t=ct.format,bt=ct.type;if(I.textures.length>1&&k.readBuffer(k.COLOR_ATTACHMENT0+Je),!Xe.textureFormatReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Xe.textureTypeReadable(bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const dt=k.createBuffer();k.bindBuffer(k.PIXEL_PACK_BUFFER,dt),k.bufferData(k.PIXEL_PACK_BUFFER,$e.byteLength,k.STREAM_READ),k.readPixels(te,de,pe,_e,J.convert(_t),J.convert(bt),0);const zt=N!==null?C.get(N).__webglFramebuffer:null;ye.bindFramebuffer(k.FRAMEBUFFER,zt);const cn=k.fenceSync(k.SYNC_GPU_COMMANDS_COMPLETE,0);return k.flush(),await _x(k,cn,4),k.bindBuffer(k.PIXEL_PACK_BUFFER,dt),k.getBufferSubData(k.PIXEL_PACK_BUFFER,0,$e),k.deleteBuffer(dt),k.deleteSync(cn),$e}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,te=null,de=0){const pe=Math.pow(2,-de),_e=Math.floor(I.image.width*pe),$e=Math.floor(I.image.height*pe),nt=te!==null?te.x:0,Je=te!==null?te.y:0;M.setTexture2D(I,0),k.copyTexSubImage2D(k.TEXTURE_2D,de,0,0,nt,Je,_e,$e),ye.unbindTexture()};const ln=k.createFramebuffer(),Gt=k.createFramebuffer();this.copyTextureToTexture=function(I,te,de=null,pe=null,_e=0,$e=0){let nt,Je,ot,ct,_t,bt,dt,zt,cn;const nn=I.isCompressedTexture?I.mipmaps[$e]:I.image;if(de!==null)nt=de.max.x-de.min.x,Je=de.max.y-de.min.y,ot=de.isBox3?de.max.z-de.min.z:1,ct=de.min.x,_t=de.min.y,bt=de.isBox3?de.min.z:0;else{const un=Math.pow(2,-_e);nt=Math.floor(nn.width*un),Je=Math.floor(nn.height*un),I.isDataArrayTexture?ot=nn.depth:I.isData3DTexture?ot=Math.floor(nn.depth*un):ot=1,ct=0,_t=0,bt=0}pe!==null?(dt=pe.x,zt=pe.y,cn=pe.z):(dt=0,zt=0,cn=0);const Vt=J.convert(te.format),Ln=J.convert(te.type);let rt;te.isData3DTexture?(M.setTexture3D(te,0),rt=k.TEXTURE_3D):te.isDataArrayTexture||te.isCompressedArrayTexture?(M.setTexture2DArray(te,0),rt=k.TEXTURE_2D_ARRAY):(M.setTexture2D(te,0),rt=k.TEXTURE_2D),ye.activeTexture(k.TEXTURE0),ye.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,te.flipY),ye.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),ye.pixelStorei(k.UNPACK_ALIGNMENT,te.unpackAlignment);const Zn=ye.getParameter(k.UNPACK_ROW_LENGTH),Ct=ye.getParameter(k.UNPACK_IMAGE_HEIGHT),si=ye.getParameter(k.UNPACK_SKIP_PIXELS),wi=ye.getParameter(k.UNPACK_SKIP_ROWS),Ki=ye.getParameter(k.UNPACK_SKIP_IMAGES);ye.pixelStorei(k.UNPACK_ROW_LENGTH,nn.width),ye.pixelStorei(k.UNPACK_IMAGE_HEIGHT,nn.height),ye.pixelStorei(k.UNPACK_SKIP_PIXELS,ct),ye.pixelStorei(k.UNPACK_SKIP_ROWS,_t),ye.pixelStorei(k.UNPACK_SKIP_IMAGES,bt);const zr=I.isDataArrayTexture||I.isData3DTexture,Ht=te.isDataArrayTexture||te.isData3DTexture;if(I.isDepthTexture){const un=C.get(I),Zi=C.get(te),Wt=C.get(un.__renderTarget),$i=C.get(Zi.__renderTarget);ye.bindFramebuffer(k.READ_FRAMEBUFFER,Wt.__webglFramebuffer),ye.bindFramebuffer(k.DRAW_FRAMEBUFFER,$i.__webglFramebuffer);for(let Br=0;Br<ot;Br++)zr&&(k.framebufferTextureLayer(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,C.get(I).__webglTexture,_e,bt+Br),k.framebufferTextureLayer(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,C.get(te).__webglTexture,$e,cn+Br)),k.blitFramebuffer(ct,_t,nt,Je,dt,zt,nt,Je,k.DEPTH_BUFFER_BIT,k.NEAREST);ye.bindFramebuffer(k.READ_FRAMEBUFFER,null),ye.bindFramebuffer(k.DRAW_FRAMEBUFFER,null)}else if(_e!==0||I.isRenderTargetTexture||C.has(I)){const un=C.get(I),Zi=C.get(te);ye.bindFramebuffer(k.READ_FRAMEBUFFER,ln),ye.bindFramebuffer(k.DRAW_FRAMEBUFFER,Gt);for(let Wt=0;Wt<ot;Wt++)zr?k.framebufferTextureLayer(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,un.__webglTexture,_e,bt+Wt):k.framebufferTexture2D(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,un.__webglTexture,_e),Ht?k.framebufferTextureLayer(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,Zi.__webglTexture,$e,cn+Wt):k.framebufferTexture2D(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,Zi.__webglTexture,$e),_e!==0?k.blitFramebuffer(ct,_t,nt,Je,dt,zt,nt,Je,k.COLOR_BUFFER_BIT,k.NEAREST):Ht?k.copyTexSubImage3D(rt,$e,dt,zt,cn+Wt,ct,_t,nt,Je):k.copyTexSubImage2D(rt,$e,dt,zt,ct,_t,nt,Je);ye.bindFramebuffer(k.READ_FRAMEBUFFER,null),ye.bindFramebuffer(k.DRAW_FRAMEBUFFER,null)}else Ht?I.isDataTexture||I.isData3DTexture?k.texSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,Ln,nn.data):te.isCompressedArrayTexture?k.compressedTexSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,nn.data):k.texSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,Ln,nn):I.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,$e,dt,zt,nt,Je,Vt,Ln,nn.data):I.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,$e,dt,zt,nn.width,nn.height,Vt,nn.data):k.texSubImage2D(k.TEXTURE_2D,$e,dt,zt,nt,Je,Vt,Ln,nn);ye.pixelStorei(k.UNPACK_ROW_LENGTH,Zn),ye.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Ct),ye.pixelStorei(k.UNPACK_SKIP_PIXELS,si),ye.pixelStorei(k.UNPACK_SKIP_ROWS,wi),ye.pixelStorei(k.UNPACK_SKIP_IMAGES,Ki),$e===0&&te.generateMipmaps&&k.generateMipmap(rt),ye.unbindTexture()},this.initRenderTarget=function(I){C.get(I).__webglFramebuffer===void 0&&M.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?M.setTextureCube(I,0):I.isData3DTexture?M.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?M.setTexture2DArray(I,0):M.setTexture2D(I,0),ye.unbindTexture()},this.resetState=function(){B=0,U=0,N=null,ye.reset(),Ge.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ni}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=At._getDrawingBufferColorSpace(e),t.unpackColorSpace=At._getUnpackColorSpace()}}class Iw extends rn{constructor(e,t){super(),this.isViewHelper=!0,this.animating=!1,this.center=new X,this.location={top:null,right:0,bottom:0,left:null};const i=new tt("#ff4466"),r=new tt("#88ff44"),s=new tt("#4488ff"),a=new tt("#000000"),o={},l=[],c=new ul,d=new it,f=new rn,h=new Fr(-2,2,2,-2,0,4);h.position.set(0,0,2);const p=new Md(.04,.04,.8,5).rotateZ(-Math.PI/2).translate(.4,0,0),g=new an(p,ce(i)),x=new an(p,ce(r)),m=new an(p,ce(s));x.rotation.z=Math.PI/2,m.rotation.y=-Math.PI/2,this.add(g),this.add(m),this.add(x);const v=me(i),y=me(r),w=me(s),b=me(a),E=new ts(v),S=new ts(y),A=new ts(w),_=new ts(b),T=new ts(b),D=new ts(b);E.position.x=1,S.position.y=1,A.position.z=1,_.position.x=-1,T.position.y=-1,D.position.z=-1,_.material.opacity=.2,T.material.opacity=.2,D.material.opacity=.2,E.userData.type="posX",S.userData.type="posY",A.userData.type="posZ",_.userData.type="negX",T.userData.type="negY",D.userData.type="negZ",this.add(E),this.add(S),this.add(A),this.add(_),this.add(T),this.add(D),l.push(E),l.push(S),l.push(A),l.push(_),l.push(T),l.push(D);const L=new X,F=128,B=2*Math.PI;this.render=function(G){this.quaternion.copy(e.quaternion).invert(),this.updateMatrixWorld(),L.set(0,0,1),L.applyQuaternion(e.quaternion);const ie=this.location;let Z,le;ie.left!==null?Z=ie.left:Z=t.offsetWidth-F-ie.right,ie.top!==null?le=G.isWebGPURenderer?ie.top:t.offsetHeight-F-ie.top:le=G.isWebGPURenderer?t.offsetHeight-F-ie.bottom:ie.bottom,G.clearDepth(),G.getViewport(Y),G.setViewport(Z,le,F,F),G.render(this,h),G.setViewport(Y.x,Y.y,Y.z,Y.w)};const U=new X,N=new xi,R=new xi,z=new xi,Y=new kt;let K=0;this.handleClick=function(G){if(this.animating===!0)return!1;const ie=t.getBoundingClientRect(),Z=this.location;let le,fe;Z.left!==null?le=ie.left+Z.left:le=ie.left+t.offsetWidth-F-Z.right,Z.top!==null?fe=ie.top+Z.top:fe=ie.top+t.offsetHeight-F-Z.bottom,d.x=(G.clientX-le)/F*2-1,d.y=-((G.clientY-fe)/F)*2+1,c.setFromCamera(d,h);const Se=c.intersectObjects(l);if(Se.length>0){const Ue=Se[0].object;return ne(Ue,this.center),this.animating=!0,!0}else return!1},this.setLabels=function(G,ie,Z){o.labelX=G,o.labelY=ie,o.labelZ=Z,ve()},this.setLabelStyle=function(G,ie,Z){o.font=G,o.color=ie,o.radius=Z,ve()},this.update=function(G){const ie=G*B;R.rotateTowards(z,ie),e.position.set(0,0,1).applyQuaternion(R).multiplyScalar(K).add(this.center),e.quaternion.rotateTowards(N,ie),R.angleTo(z)===0&&(this.animating=!1)},this.dispose=function(){p.dispose(),g.material.dispose(),x.material.dispose(),m.material.dispose(),E.material.map.dispose(),S.material.map.dispose(),A.material.map.dispose(),_.material.map.dispose(),T.material.map.dispose(),D.material.map.dispose(),E.material.dispose(),S.material.dispose(),A.material.dispose(),_.material.dispose(),T.material.dispose(),D.material.dispose()};function ne(G,ie){switch(G.userData.type){case"posX":U.set(1,0,0),N.setFromEuler(new Xn(0,Math.PI*.5,0));break;case"posY":U.set(0,1,0),N.setFromEuler(new Xn(-Math.PI*.5,0,0));break;case"posZ":U.set(0,0,1),N.setFromEuler(new Xn);break;case"negX":U.set(-1,0,0),N.setFromEuler(new Xn(0,-Math.PI*.5,0));break;case"negY":U.set(0,-1,0),N.setFromEuler(new Xn(Math.PI*.5,0,0));break;case"negZ":U.set(0,0,-1),N.setFromEuler(new Xn(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}K=e.position.distanceTo(ie),U.multiplyScalar(K).add(ie),f.position.copy(ie),f.lookAt(e.position),R.copy(f.quaternion),f.lookAt(U),z.copy(f.quaternion)}function ce(G){return new yd({color:G,toneMapped:!1})}function V(){let G=!1;try{G=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}return G}function ee(G,ie){let Z;return V()?Z=new OffscreenCanvas(G,ie):(Z=document.createElement("canvas"),Z.width=G,Z.height=ie),Z}function me(G,ie){const{font:Z="24px Arial",color:le="#000000",radius:fe=14}=o,Se=ee(64,64),ze=Se.getContext("2d");ze.beginPath(),ze.arc(32,32,fe,0,2*Math.PI),ze.closePath(),ze.fillStyle=G.getStyle(),ze.fill(),ie&&(ze.font=Z,ze.textAlign="center",ze.fillStyle=le,ze.fillText(ie,32,41));const Ue=new cb(Se);return Ue.colorSpace=Wn,new gm({map:Ue,toneMapped:!1})}function ve(){E.material.map.dispose(),S.material.map.dispose(),A.material.map.dispose(),E.material.dispose(),S.material.dispose(),A.material.dispose(),E.material=me(i,o.labelX),S.material=me(r,o.labelY),A.material=me(s,o.labelZ)}}}const Ef=new di,lo=new X;class Ad extends Cb{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new sn(e,3)),this.setAttribute("uv",new sn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new cu(t,6,1);return this.setAttribute("instanceStart",new Ui(i,3,0)),this.setAttribute("instanceEnd",new Ui(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new cu(t,6,1);return this.setAttribute("instanceColorStart",new Ui(i,3,0)),this.setAttribute("instanceColorEnd",new Ui(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new hb(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ef.setFromBufferAttribute(t),this.boundingBox.union(Ef))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)lo.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(lo)),lo.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(lo));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}Ke.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new it(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};jn.line={uniforms:Di.merge([Ke.common,Ke.fog,Ke.line]),vertexShader:`
|
|
4104
|
+
}`;class Ew{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new xm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new _n({vertexShader:Mw,fragmentShader:ww,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new an(new Ds(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Tw extends mr{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,f=null,h=null,p=null,m=null;const x=typeof XRWebGLBinding<"u",g=new Ew,v={},y=t.getContextAttributes();let w=null,b=null;const E=[],S=[],A=new it;let _=null;const T=new oi;T.viewport=new kt;const D=new oi;D.viewport=new kt;const L=[T,D],F=new Rb;let k=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getGripSpace()},this.getHand=function(G){let ie=E[G];return ie===void 0&&(ie=new Dl,E[G]=ie),ie.getHandSpace()};function N(G){const ie=S.indexOf(G.inputSource);if(ie===-1)return;const Z=E[ie];Z!==void 0&&(Z.update(G.inputSource,G.frame,c||a),Z.dispatchEvent({type:G.type,data:G.inputSource}))}function R(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",R),r.removeEventListener("inputsourceschange",z);for(let G=0;G<E.length;G++){const ie=S[G];ie!==null&&(S[G]=null,E[G].disconnect(ie))}k=null,U=null,g.reset();for(const G in v)delete v[G];e.setRenderTarget(w),p=null,h=null,f=null,r=null,b=null,ve.stop(),i.isPresenting=!1,e.setPixelRatio(_),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(G){s=G,i.isPresenting===!0&&ft("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(G){o=G,i.isPresenting===!0&&ft("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(G){c=G},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f===null&&x&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(G){if(r=G,r!==null){if(w=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",R),r.addEventListener("inputsourceschange",z),y.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(A),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let Z=null,ce=null,pe=null;y.depth&&(pe=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Z=y.stencil?cr:Yi,ce=y.stencil?Ts:Oi);const Se={colorFormat:t.RGBA8,depthFormat:pe,scaleFactor:s};f=this.getBinding(),h=f.createProjectionLayer(Se),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),b=new ni(h.textureWidth,h.textureHeight,{format:li,type:qn,depthTexture:new Nr(h.textureWidth,h.textureHeight,ce,void 0,void 0,void 0,void 0,void 0,void 0,Z),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const Z={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Z),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new ni(p.framebufferWidth,p.framebufferHeight,{format:li,type:qn,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),ve.setContext(r),ve.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function z(G){for(let ie=0;ie<G.removed.length;ie++){const Z=G.removed[ie],ce=S.indexOf(Z);ce>=0&&(S[ce]=null,E[ce].disconnect(Z))}for(let ie=0;ie<G.added.length;ie++){const Z=G.added[ie];let ce=S.indexOf(Z);if(ce===-1){for(let Se=0;Se<E.length;Se++)if(Se>=S.length){S.push(Z),ce=Se;break}else if(S[Se]===null){S[Se]=Z,ce=Se;break}if(ce===-1)break}const pe=E[ce];pe&&pe.connect(Z)}}const q=new X,Y=new X;function te(G,ie,Z){q.setFromMatrixPosition(ie.matrixWorld),Y.setFromMatrixPosition(Z.matrixWorld);const ce=q.distanceTo(Y),pe=ie.projectionMatrix.elements,Se=Z.projectionMatrix.elements,ze=pe[14]/(pe[10]-1),Ue=pe[14]/(pe[10]+1),Pe=(pe[9]+1)/pe[5],ke=(pe[9]-1)/pe[5],Ie=(pe[8]-1)/pe[0],We=(Se[8]+1)/Se[0],Oe=ze*Ie,He=ze*We,V=ce/(-Ie+We),je=V*-Ie;if(ie.matrixWorld.decompose(G.position,G.quaternion,G.scale),G.translateX(je),G.translateZ(V),G.matrixWorld.compose(G.position,G.quaternion,G.scale),G.matrixWorldInverse.copy(G.matrixWorld).invert(),pe[10]===-1)G.projectionMatrix.copy(ie.projectionMatrix),G.projectionMatrixInverse.copy(ie.projectionMatrixInverse);else{const Ve=ze+V,Xe=Ue+V,ye=Oe-je,Ce=He+(ce-je),C=Pe*Ue/Xe*Ve,M=ke*Ue/Xe*Ve;G.projectionMatrix.makePerspective(ye,Ce,C,M,Ve,Xe),G.projectionMatrixInverse.copy(G.projectionMatrix).invert()}}function le(G,ie){ie===null?G.matrixWorld.copy(G.matrix):G.matrixWorld.multiplyMatrices(ie.matrixWorld,G.matrix),G.matrixWorldInverse.copy(G.matrixWorld).invert()}this.updateCamera=function(G){if(r===null)return;let ie=G.near,Z=G.far;g.texture!==null&&(g.depthNear>0&&(ie=g.depthNear),g.depthFar>0&&(Z=g.depthFar)),F.near=D.near=T.near=ie,F.far=D.far=T.far=Z,(k!==F.near||U!==F.far)&&(r.updateRenderState({depthNear:F.near,depthFar:F.far}),k=F.near,U=F.far),F.layers.mask=G.layers.mask|6,T.layers.mask=F.layers.mask&-5,D.layers.mask=F.layers.mask&-3;const ce=G.parent,pe=F.cameras;le(F,ce);for(let Se=0;Se<pe.length;Se++)le(pe[Se],ce);pe.length===2?te(F,T,D):F.projectionMatrix.copy(T.projectionMatrix),B(G,F,ce)};function B(G,ie,Z){Z===null?G.matrix.copy(ie.matrixWorld):(G.matrix.copy(Z.matrixWorld),G.matrix.invert(),G.matrix.multiply(ie.matrixWorld)),G.matrix.decompose(G.position,G.quaternion,G.scale),G.updateMatrixWorld(!0),G.projectionMatrix.copy(ie.projectionMatrix),G.projectionMatrixInverse.copy(ie.projectionMatrixInverse),G.isPerspectiveCamera&&(G.fov=ca*2*Math.atan(1/G.projectionMatrix.elements[5]),G.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(G){l=G,h!==null&&(h.fixedFoveation=G),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=G)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(F)},this.getCameraTexture=function(G){return v[G]};let ee=null;function de(G,ie){if(d=ie.getViewerPose(c||a),m=ie,d!==null){const Z=d.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ce=!1;Z.length!==F.cameras.length&&(F.cameras.length=0,ce=!0);for(let Ue=0;Ue<Z.length;Ue++){const Pe=Z[Ue];let ke=null;if(p!==null)ke=p.getViewport(Pe);else{const We=f.getViewSubImage(h,Pe);ke=We.viewport,Ue===0&&(e.setRenderTargetTextures(b,We.colorTexture,We.depthStencilTexture),e.setRenderTarget(b))}let Ie=L[Ue];Ie===void 0&&(Ie=new oi,Ie.layers.enable(Ue),Ie.viewport=new kt,L[Ue]=Ie),Ie.matrix.fromArray(Pe.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(Pe.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(ke.x,ke.y,ke.width,ke.height),Ue===0&&(F.matrix.copy(Ie.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),ce===!0&&F.cameras.push(Ie)}const pe=r.enabledFeatures;if(pe&&pe.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){f=i.getBinding();const Ue=f.getDepthInformation(Z[0]);Ue&&Ue.isValid&&Ue.texture&&g.init(Ue,r.renderState)}if(pe&&pe.includes("camera-access")&&x){e.state.unbindTexture(),f=i.getBinding();for(let Ue=0;Ue<Z.length;Ue++){const Pe=Z[Ue].camera;if(Pe){let ke=v[Pe];ke||(ke=new xm,v[Pe]=ke);const Ie=f.getCameraImage(Pe);ke.sourceTexture=Ie}}}}for(let Z=0;Z<E.length;Z++){const ce=S[Z],pe=E[Z];ce!==null&&pe!==void 0&&pe.update(ce,ie,c||a)}ee&&ee(G,ie),ie.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ie}),m=null}const ve=new Mm;ve.setAnimationLoop(de),this.setAnimationLoop=function(G){ee=G},this.dispose=function(){}}}const Aw=new Lt,Rm=new xt;Rm.set(-1,0,0,0,1,0,0,0,1);function Cw(n,e){function t(g,v){g.matrixAutoUpdate===!0&&g.updateMatrix(),v.value.copy(g.matrix)}function i(g,v){v.color.getRGB(g.fogColor.value,bm(n)),v.isFog?(g.fogNear.value=v.near,g.fogFar.value=v.far):v.isFogExp2&&(g.fogDensity.value=v.density)}function r(g,v,y,w,b){v.isNodeMaterial?v.uniformsNeedUpdate=!1:v.isMeshBasicMaterial?s(g,v):v.isMeshLambertMaterial?(s(g,v),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)):v.isMeshToonMaterial?(s(g,v),f(g,v)):v.isMeshPhongMaterial?(s(g,v),d(g,v),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)):v.isMeshStandardMaterial?(s(g,v),h(g,v),v.isMeshPhysicalMaterial&&p(g,v,b)):v.isMeshMatcapMaterial?(s(g,v),m(g,v)):v.isMeshDepthMaterial?s(g,v):v.isMeshDistanceMaterial?(s(g,v),x(g,v)):v.isMeshNormalMaterial?s(g,v):v.isLineBasicMaterial?(a(g,v),v.isLineDashedMaterial&&o(g,v)):v.isPointsMaterial?l(g,v,y,w):v.isSpriteMaterial?c(g,v):v.isShadowMaterial?(g.color.value.copy(v.color),g.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(g,v){g.opacity.value=v.opacity,v.color&&g.diffuse.value.copy(v.color),v.emissive&&g.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(g.map.value=v.map,t(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.bumpMap&&(g.bumpMap.value=v.bumpMap,t(v.bumpMap,g.bumpMapTransform),g.bumpScale.value=v.bumpScale,v.side===Yn&&(g.bumpScale.value*=-1)),v.normalMap&&(g.normalMap.value=v.normalMap,t(v.normalMap,g.normalMapTransform),g.normalScale.value.copy(v.normalScale),v.side===Yn&&g.normalScale.value.negate()),v.displacementMap&&(g.displacementMap.value=v.displacementMap,t(v.displacementMap,g.displacementMapTransform),g.displacementScale.value=v.displacementScale,g.displacementBias.value=v.displacementBias),v.emissiveMap&&(g.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,g.emissiveMapTransform)),v.specularMap&&(g.specularMap.value=v.specularMap,t(v.specularMap,g.specularMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest);const y=e.get(v),w=y.envMap,b=y.envMapRotation;w&&(g.envMap.value=w,g.envMapRotation.value.setFromMatrix4(Aw.makeRotationFromEuler(b)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(Rm),g.reflectivity.value=v.reflectivity,g.ior.value=v.ior,g.refractionRatio.value=v.refractionRatio),v.lightMap&&(g.lightMap.value=v.lightMap,g.lightMapIntensity.value=v.lightMapIntensity,t(v.lightMap,g.lightMapTransform)),v.aoMap&&(g.aoMap.value=v.aoMap,g.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,g.aoMapTransform))}function a(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,v.map&&(g.map.value=v.map,t(v.map,g.mapTransform))}function o(g,v){g.dashSize.value=v.dashSize,g.totalSize.value=v.dashSize+v.gapSize,g.scale.value=v.scale}function l(g,v,y,w){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.size.value=v.size*y,g.scale.value=w*.5,v.map&&(g.map.value=v.map,t(v.map,g.uvTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function c(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.rotation.value=v.rotation,v.map&&(g.map.value=v.map,t(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function d(g,v){g.specular.value.copy(v.specular),g.shininess.value=Math.max(v.shininess,1e-4)}function f(g,v){v.gradientMap&&(g.gradientMap.value=v.gradientMap)}function h(g,v){g.metalness.value=v.metalness,v.metalnessMap&&(g.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,g.metalnessMapTransform)),g.roughness.value=v.roughness,v.roughnessMap&&(g.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,g.roughnessMapTransform)),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)}function p(g,v,y){g.ior.value=v.ior,v.sheen>0&&(g.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),g.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(g.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,g.sheenColorMapTransform)),v.sheenRoughnessMap&&(g.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,g.sheenRoughnessMapTransform))),v.clearcoat>0&&(g.clearcoat.value=v.clearcoat,g.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(g.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,g.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(g.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Yn&&g.clearcoatNormalScale.value.negate())),v.dispersion>0&&(g.dispersion.value=v.dispersion),v.iridescence>0&&(g.iridescence.value=v.iridescence,g.iridescenceIOR.value=v.iridescenceIOR,g.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(g.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,g.iridescenceMapTransform)),v.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),v.transmission>0&&(g.transmission.value=v.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),v.transmissionMap&&(g.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,g.transmissionMapTransform)),g.thickness.value=v.thickness,v.thicknessMap&&(g.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=v.attenuationDistance,g.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(g.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(g.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=v.specularIntensity,g.specularColor.value.copy(v.specularColor),v.specularColorMap&&(g.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,g.specularColorMapTransform)),v.specularIntensityMap&&(g.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,v){v.matcap&&(g.matcap.value=v.matcap)}function x(g,v){const y=e.get(v).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Pw(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,w){const b=w.program;i.uniformBlockBinding(y,b)}function c(y,w){let b=r[y.id];b===void 0&&(m(y),b=d(y),r[y.id]=b,y.addEventListener("dispose",g));const E=w.program;i.updateUBOMapping(y,E);const S=e.render.frame;s[y.id]!==S&&(h(y),s[y.id]=S)}function d(y){const w=f();y.__bindingPointIndex=w;const b=n.createBuffer(),E=y.__size,S=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,b),n.bufferData(n.UNIFORM_BUFFER,E,S),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,b),b}function f(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return Tt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(y){const w=r[y.id],b=y.uniforms,E=y.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let S=0,A=b.length;S<A;S++){const _=Array.isArray(b[S])?b[S]:[b[S]];for(let T=0,D=_.length;T<D;T++){const L=_[T];if(p(L,S,T,E)===!0){const F=L.__offset,k=Array.isArray(L.value)?L.value:[L.value];let U=0;for(let N=0;N<k.length;N++){const R=k[N],z=x(R);typeof R=="number"||typeof R=="boolean"?(L.__data[0]=R,n.bufferSubData(n.UNIFORM_BUFFER,F+U,L.__data)):R.isMatrix3?(L.__data[0]=R.elements[0],L.__data[1]=R.elements[1],L.__data[2]=R.elements[2],L.__data[3]=0,L.__data[4]=R.elements[3],L.__data[5]=R.elements[4],L.__data[6]=R.elements[5],L.__data[7]=0,L.__data[8]=R.elements[6],L.__data[9]=R.elements[7],L.__data[10]=R.elements[8],L.__data[11]=0):ArrayBuffer.isView(R)?L.__data.set(new R.constructor(R.buffer,R.byteOffset,L.__data.length)):(R.toArray(L.__data,U),U+=z.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,F,L.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(y,w,b,E){const S=y.value,A=w+"_"+b;if(E[A]===void 0)return typeof S=="number"||typeof S=="boolean"?E[A]=S:ArrayBuffer.isView(S)?E[A]=S.slice():E[A]=S.clone(),!0;{const _=E[A];if(typeof S=="number"||typeof S=="boolean"){if(_!==S)return E[A]=S,!0}else{if(ArrayBuffer.isView(S))return!0;if(_.equals(S)===!1)return _.copy(S),!0}}return!1}function m(y){const w=y.uniforms;let b=0;const E=16;for(let A=0,_=w.length;A<_;A++){const T=Array.isArray(w[A])?w[A]:[w[A]];for(let D=0,L=T.length;D<L;D++){const F=T[D],k=Array.isArray(F.value)?F.value:[F.value];for(let U=0,N=k.length;U<N;U++){const R=k[U],z=x(R),q=b%E,Y=q%z.boundary,te=q+Y;b+=Y,te!==0&&E-te<z.storage&&(b+=E-te),F.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=b,b+=z.storage}}}const S=b%E;return S>0&&(b+=E-S),y.__size=b,y.__cache={},this}function x(y){const w={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?ft("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(y)?(w.boundary=16,w.storage=y.byteLength):ft("WebGLRenderer: Unsupported uniform value type.",y),w}function g(y){const w=y.target;w.removeEventListener("dispose",g);const b=a.indexOf(w.__bindingPointIndex);a.splice(b,1),n.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function v(){for(const y in r)n.deleteBuffer(r[y]);a=[],r={},s={}}return{bind:l,update:c,dispose:v}}const Rw=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ti=null;function Dw(){return Ti===null&&(Ti=new cl(Rw,16,16,Ir,Fn),Ti.name="DFG_LUT",Ti.minFilter=hn,Ti.magFilter=hn,Ti.wrapS=_i,Ti.wrapT=_i,Ti.generateMipmaps=!1,Ti.needsUpdate=!0),Ti}class Lw{constructor(e={}){const{canvas:t=vx(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:h=!1,outputBufferType:p=qn}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=a;const x=p,g=new Set([md,pd,fd]),v=new Set([qn,Oi,aa,Ts,dd,hd]),y=new Uint32Array(4),w=new Int32Array(4),b=new X;let E=null,S=null;const A=[],_=[];let T=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const D=this;let L=!1,F=null;this._outputColorSpace=Wn;let k=0,U=0,N=null,R=-1,z=null;const q=new kt,Y=new kt;let te=null;const le=new tt(0);let B=0,ee=t.width,de=t.height,ve=1,G=null,ie=null;const Z=new kt(0,0,ee,de),ce=new kt(0,0,ee,de);let pe=!1;const Se=new Sd;let ze=!1,Ue=!1;const Pe=new Lt,ke=new X,Ie=new kt,We={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Oe=!1;function He(){return N===null?ve:1}let V=i;function je(I,ne){return t.getContext(I,ne)}try{const I={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${id}`),t.addEventListener("webglcontextlost",Be,!1),t.addEventListener("webglcontextrestored",lt,!1),t.addEventListener("webglcontextcreationerror",vt,!1),V===null){const ne="webgl2";if(V=je(ne,I),V===null)throw je(ne)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw Tt("WebGLRenderer: "+I.message),I}let Ve,Xe,ye,Ce,C,M,H,re,ue,be,ge,ae,fe,Re,Le,Ee,De,et,Ye,ht,J,Ge,Te;function Ze(){Ve=new DM(V),Ve.init(),J=new Sw(V,Ve),Xe=new MM(V,Ve,e,J),ye=new bw(V,Ve),Xe.reversedDepthBuffer&&h&&ye.buffers.depth.setReversed(!0),Ce=new NM(V),C=new aw,M=new yw(V,Ve,ye,C,Xe,J,Ce),H=new RM(D),re=new zb(V),Ge=new yM(V,re),ue=new LM(V,re,Ce,Ge),be=new FM(V,ue,re,Ge,Ce),et=new UM(V,Xe,M),Le=new wM(C),ge=new sw(D,H,Ve,Xe,Ge,Le),ae=new Cw(D,C),fe=new lw,Re=new pw(Ve),De=new bM(D,H,ye,be,m,l),Ee=new xw(D,be,Xe),Te=new Pw(V,Ce,Xe,ye),Ye=new SM(V,Ve,Ce),ht=new IM(V,Ve,Ce),Ce.programs=ge.programs,D.capabilities=Xe,D.extensions=Ve,D.properties=C,D.renderLists=fe,D.shadowMap=Ee,D.state=ye,D.info=Ce}Ze(),x!==qn&&(T=new zM(x,t.width,t.height,r,s));const qe=new Tw(D,V);this.xr=qe,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const I=Ve.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=Ve.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return ve},this.setPixelRatio=function(I){I!==void 0&&(ve=I,this.setSize(ee,de,!1))},this.getSize=function(I){return I.set(ee,de)},this.setSize=function(I,ne,he=!0){if(qe.isPresenting){ft("WebGLRenderer: Can't change size while VR device is presenting.");return}ee=I,de=ne,t.width=Math.floor(I*ve),t.height=Math.floor(ne*ve),he===!0&&(t.style.width=I+"px",t.style.height=ne+"px"),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,I,ne)},this.getDrawingBufferSize=function(I){return I.set(ee*ve,de*ve).floor()},this.setDrawingBufferSize=function(I,ne,he){ee=I,de=ne,ve=he,t.width=Math.floor(I*he),t.height=Math.floor(ne*he),this.setViewport(0,0,I,ne)},this.setEffects=function(I){if(x===qn){Tt("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let ne=0;ne<I.length;ne++)if(I[ne].isOutputPass===!0){ft("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}T.setEffects(I||[])},this.getCurrentViewport=function(I){return I.copy(q)},this.getViewport=function(I){return I.copy(Z)},this.setViewport=function(I,ne,he,me){I.isVector4?Z.set(I.x,I.y,I.z,I.w):Z.set(I,ne,he,me),ye.viewport(q.copy(Z).multiplyScalar(ve).round())},this.getScissor=function(I){return I.copy(ce)},this.setScissor=function(I,ne,he,me){I.isVector4?ce.set(I.x,I.y,I.z,I.w):ce.set(I,ne,he,me),ye.scissor(Y.copy(ce).multiplyScalar(ve).round())},this.getScissorTest=function(){return pe},this.setScissorTest=function(I){ye.setScissorTest(pe=I)},this.setOpaqueSort=function(I){G=I},this.setTransparentSort=function(I){ie=I},this.getClearColor=function(I){return I.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(I=!0,ne=!0,he=!0){let me=0;if(I){let _e=!1;if(N!==null){const $e=N.texture.format;_e=g.has($e)}if(_e){const $e=N.texture.type,nt=v.has($e),Je=De.getClearColor(),ot=De.getClearAlpha(),ct=Je.r,_t=Je.g,bt=Je.b;nt?(y[0]=ct,y[1]=_t,y[2]=bt,y[3]=ot,V.clearBufferuiv(V.COLOR,0,y)):(w[0]=ct,w[1]=_t,w[2]=bt,w[3]=ot,V.clearBufferiv(V.COLOR,0,w))}else me|=V.COLOR_BUFFER_BIT}ne&&(me|=V.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),he&&(me|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),me!==0&&V.clear(me)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(I){I.setRenderer(this),F=I},this.dispose=function(){t.removeEventListener("webglcontextlost",Be,!1),t.removeEventListener("webglcontextrestored",lt,!1),t.removeEventListener("webglcontextcreationerror",vt,!1),De.dispose(),fe.dispose(),Re.dispose(),C.dispose(),H.dispose(),be.dispose(),Ge.dispose(),Te.dispose(),ge.dispose(),qe.dispose(),qe.removeEventListener("sessionstart",Ns),qe.removeEventListener("sessionend",wa),Mi.stop()};function Be(I){I.preventDefault(),jo("WebGLRenderer: Context Lost."),L=!0}function lt(){jo("WebGLRenderer: Context Restored."),L=!1;const I=Ce.autoReset,ne=Ee.enabled,he=Ee.autoUpdate,me=Ee.needsUpdate,_e=Ee.type;Ze(),Ce.autoReset=I,Ee.enabled=ne,Ee.autoUpdate=he,Ee.needsUpdate=me,Ee.type=_e}function vt(I){Tt("WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function $t(I){const ne=I.target;ne.removeEventListener("dispose",$t),It(ne)}function It(I){ii(I),C.remove(I)}function ii(I){const ne=C.get(I).programs;ne!==void 0&&(ne.forEach(function(he){ge.releaseProgram(he)}),I.isShaderMaterial&&ge.releaseShaderCache(I))}this.renderBufferDirect=function(I,ne,he,me,_e,$e){ne===null&&(ne=We);const nt=_e.isMesh&&_e.matrixWorld.determinant()<0,Je=Dn(I,ne,he,me,_e);ye.setMaterial(me,nt);let ot=he.index,ct=1;if(me.wireframe===!0){if(ot=ue.getWireframeAttribute(he),ot===void 0)return;ct=2}const _t=he.drawRange,bt=he.attributes.position;let dt=_t.start*ct,zt=(_t.start+_t.count)*ct;$e!==null&&(dt=Math.max(dt,$e.start*ct),zt=Math.min(zt,($e.start+$e.count)*ct)),ot!==null?(dt=Math.max(dt,0),zt=Math.min(zt,ot.count)):bt!=null&&(dt=Math.max(dt,0),zt=Math.min(zt,bt.count));const cn=zt-dt;if(cn<0||cn===1/0)return;Ge.setup(_e,me,Je,he,ot);let nn,Vt=Ye;if(ot!==null&&(nn=re.get(ot),Vt=ht,Vt.setIndex(nn)),_e.isMesh)me.wireframe===!0?(ye.setLineWidth(me.wireframeLinewidth*He()),Vt.setMode(V.LINES)):Vt.setMode(V.TRIANGLES);else if(_e.isLine){let Ln=me.linewidth;Ln===void 0&&(Ln=1),ye.setLineWidth(Ln*He()),_e.isLineSegments?Vt.setMode(V.LINES):_e.isLineLoop?Vt.setMode(V.LINE_LOOP):Vt.setMode(V.LINE_STRIP)}else _e.isPoints?Vt.setMode(V.POINTS):_e.isSprite&&Vt.setMode(V.TRIANGLES);if(_e.isBatchedMesh)if(Ve.get("WEBGL_multi_draw"))Vt.renderMultiDraw(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount);else{const Ln=_e._multiDrawStarts,rt=_e._multiDrawCounts,Zn=_e._multiDrawCount,Ct=ot?re.get(ot).bytesPerElement:1,si=C.get(me).currentProgram.getUniforms();for(let wi=0;wi<Zn;wi++)si.setValue(V,"_gl_DrawID",wi),Vt.render(Ln[wi]/Ct,rt[wi])}else if(_e.isInstancedMesh)Vt.renderInstances(dt,cn,_e.count);else if(he.isInstancedBufferGeometry){const Ln=he._maxInstanceCount!==void 0?he._maxInstanceCount:1/0,rt=Math.min(he.instanceCount,Ln);Vt.renderInstances(dt,cn,rt)}else Vt.render(dt,cn)};function ri(I,ne,he){I.transparent===!0&&I.side===Qn&&I.forceSinglePass===!1?(I.side=Yn,I.needsUpdate=!0,en(I,ne,he),I.side=Kn,I.needsUpdate=!0,en(I,ne,he),I.side=Qn):en(I,ne,he)}this.compile=function(I,ne,he=null){he===null&&(he=I),S=Re.get(he),S.init(ne),_.push(S),he.traverseVisible(function(_e){_e.isLight&&_e.layers.test(ne.layers)&&(S.pushLight(_e),_e.castShadow&&S.pushShadow(_e))}),I!==he&&I.traverseVisible(function(_e){_e.isLight&&_e.layers.test(ne.layers)&&(S.pushLight(_e),_e.castShadow&&S.pushShadow(_e))}),S.setupLights();const me=new Set;return I.traverse(function(_e){if(!(_e.isMesh||_e.isPoints||_e.isLine||_e.isSprite))return;const $e=_e.material;if($e)if(Array.isArray($e))for(let nt=0;nt<$e.length;nt++){const Je=$e[nt];ri(Je,he,_e),me.add(Je)}else ri($e,he,_e),me.add($e)}),S=_.pop(),me},this.compileAsync=function(I,ne,he=null){const me=this.compile(I,ne,he);return new Promise(_e=>{function $e(){if(me.forEach(function(nt){C.get(nt).currentProgram.isReady()&&me.delete(nt)}),me.size===0){_e(I);return}setTimeout($e,10)}Ve.get("KHR_parallel_shader_compile")!==null?$e():setTimeout($e,10)})};let Or=null;function vl(I){Or&&Or(I)}function Ns(){Mi.stop()}function wa(){Mi.start()}const Mi=new Mm;Mi.setAnimationLoop(vl),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(I){Or=I,qe.setAnimationLoop(I),I===null?Mi.stop():Mi.start()},qe.addEventListener("sessionstart",Ns),qe.addEventListener("sessionend",wa),this.render=function(I,ne){if(ne!==void 0&&ne.isCamera!==!0){Tt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;F!==null&&F.renderStart(I,ne);const he=qe.enabled===!0&&qe.isPresenting===!0,me=T!==null&&(N===null||he)&&T.begin(D,N);if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),ne.parent===null&&ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),qe.enabled===!0&&qe.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(qe.cameraAutoUpdate===!0&&qe.updateCamera(ne),ne=qe.getCamera()),I.isScene===!0&&I.onBeforeRender(D,I,ne,N),S=Re.get(I,_.length),S.init(ne),S.state.textureUnits=M.getTextureUnits(),_.push(S),Pe.multiplyMatrices(ne.projectionMatrix,ne.matrixWorldInverse),Se.setFromProjectionMatrix(Pe,Ni,ne.reversedDepth),Ue=this.localClippingEnabled,ze=Le.init(this.clippingPlanes,Ue),E=fe.get(I,A.length),E.init(),A.push(E),qe.enabled===!0&&qe.isPresenting===!0){const nt=D.xr.getDepthSensingMesh();nt!==null&&Us(nt,ne,-1/0,D.sortObjects)}Us(I,ne,0,D.sortObjects),E.finish(),D.sortObjects===!0&&E.sort(G,ie),Oe=qe.enabled===!1||qe.isPresenting===!1||qe.hasDepthSensing()===!1,Oe&&De.addToRenderList(E,I),this.info.render.frame++,ze===!0&&Le.beginShadows();const _e=S.state.shadowsArray;if(Ee.render(_e,I,ne),ze===!0&&Le.endShadows(),this.info.autoReset===!0&&this.info.reset(),(me&&T.hasRenderPass())===!1){const nt=E.opaque,Je=E.transmissive;if(S.setupLights(),ne.isArrayCamera){const ot=ne.cameras;if(Je.length>0)for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct];Ta(nt,Je,I,bt)}Oe&&De.render(I);for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct];Ea(E,I,bt,bt.viewport)}}else Je.length>0&&Ta(nt,Je,I,ne),Oe&&De.render(I),Ea(E,I,ne)}N!==null&&U===0&&(M.updateMultisampleRenderTarget(N),M.updateRenderTargetMipmap(N)),me&&T.end(D),I.isScene===!0&&I.onAfterRender(D,I,ne),Ge.resetDefaultState(),R=-1,z=null,_.pop(),_.length>0?(S=_[_.length-1],M.setTextureUnits(S.state.textureUnits),ze===!0&&Le.setGlobalState(D.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?E=A[A.length-1]:E=null,F!==null&&F.renderEnd()};function Us(I,ne,he,me){if(I.visible===!1)return;if(I.layers.test(ne.layers)){if(I.isGroup)he=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(ne);else if(I.isLightProbeGrid)S.pushLightProbeGrid(I);else if(I.isLight)S.pushLight(I),I.castShadow&&S.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||Se.intersectsSprite(I)){me&&Ie.setFromMatrixPosition(I.matrixWorld).applyMatrix4(Pe);const nt=be.update(I),Je=I.material;Je.visible&&E.push(I,nt,Je,he,Ie.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||Se.intersectsObject(I))){const nt=be.update(I),Je=I.material;if(me&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),Ie.copy(I.boundingSphere.center)):(nt.boundingSphere===null&&nt.computeBoundingSphere(),Ie.copy(nt.boundingSphere.center)),Ie.applyMatrix4(I.matrixWorld).applyMatrix4(Pe)),Array.isArray(Je)){const ot=nt.groups;for(let ct=0,_t=ot.length;ct<_t;ct++){const bt=ot[ct],dt=Je[bt.materialIndex];dt&&dt.visible&&E.push(I,nt,dt,he,Ie.z,bt)}}else Je.visible&&E.push(I,nt,Je,he,Ie.z,null)}}const $e=I.children;for(let nt=0,Je=$e.length;nt<Je;nt++)Us($e[nt],ne,he,me)}function Ea(I,ne,he,me){const{opaque:_e,transmissive:$e,transparent:nt}=I;S.setupLightsView(he),ze===!0&&Le.setGlobalState(D.clippingPlanes,he),me&&ye.viewport(q.copy(me)),_e.length>0&&Rt(_e,ne,he),$e.length>0&&Rt($e,ne,he),nt.length>0&&Rt(nt,ne,he),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function Ta(I,ne,he,me){if((he.isScene===!0?he.overrideMaterial:null)!==null)return;if(S.state.transmissionRenderTarget[me.id]===void 0){const dt=Ve.has("EXT_color_buffer_half_float")||Ve.has("EXT_color_buffer_float");S.state.transmissionRenderTarget[me.id]=new ni(1,1,{generateMipmaps:!0,type:dt?Fn:qn,minFilter:lr,samples:Math.max(4,Xe.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:At.workingColorSpace})}const $e=S.state.transmissionRenderTarget[me.id],nt=me.viewport||q;$e.setSize(nt.z*D.transmissionResolutionScale,nt.w*D.transmissionResolutionScale);const Je=D.getRenderTarget(),ot=D.getActiveCubeFace(),ct=D.getActiveMipmapLevel();D.setRenderTarget($e),D.getClearColor(le),B=D.getClearAlpha(),B<1&&D.setClearColor(16777215,.5),D.clear(),Oe&&De.render(he);const _t=D.toneMapping;D.toneMapping=Fi;const bt=me.viewport;if(me.viewport!==void 0&&(me.viewport=void 0),S.setupLightsView(me),ze===!0&&Le.setGlobalState(D.clippingPlanes,me),Rt(I,he,me),M.updateMultisampleRenderTarget($e),M.updateRenderTargetMipmap($e),Ve.has("WEBGL_multisampled_render_to_texture")===!1){let dt=!1;for(let zt=0,cn=ne.length;zt<cn;zt++){const nn=ne[zt],{object:Vt,geometry:Ln,material:rt,group:Zn}=nn;if(rt.side===Qn&&Vt.layers.test(me.layers)){const Ct=rt.side;rt.side=Yn,rt.needsUpdate=!0,qt(Vt,he,me,Ln,rt,Zn),rt.side=Ct,rt.needsUpdate=!0,dt=!0}}dt===!0&&(M.updateMultisampleRenderTarget($e),M.updateRenderTargetMipmap($e))}D.setRenderTarget(Je,ot,ct),D.setClearColor(le,B),bt!==void 0&&(me.viewport=bt),D.toneMapping=_t}function Rt(I,ne,he){const me=ne.isScene===!0?ne.overrideMaterial:null;for(let _e=0,$e=I.length;_e<$e;_e++){const nt=I[_e],{object:Je,geometry:ot,group:ct}=nt;let _t=nt.material;_t.allowOverride===!0&&me!==null&&(_t=me),Je.layers.test(he.layers)&&qt(Je,ne,he,ot,_t,ct)}}function qt(I,ne,he,me,_e,$e){I.onBeforeRender(D,ne,he,me,_e,$e),I.modelViewMatrix.multiplyMatrices(he.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),_e.onBeforeRender(D,ne,he,me,I,$e),_e.transparent===!0&&_e.side===Qn&&_e.forceSinglePass===!1?(_e.side=Yn,_e.needsUpdate=!0,D.renderBufferDirect(he,ne,me,_e,I,$e),_e.side=Kn,_e.needsUpdate=!0,D.renderBufferDirect(he,ne,me,_e,I,$e),_e.side=Qn):D.renderBufferDirect(he,ne,me,_e,I,$e),I.onAfterRender(D,ne,he,me,_e,$e)}function en(I,ne,he){ne.isScene!==!0&&(ne=We);const me=C.get(I),_e=S.state.lights,$e=S.state.shadowsArray,nt=_e.state.version,Je=ge.getParameters(I,_e.state,$e,ne,he,S.state.lightProbeGridArray),ot=ge.getProgramCacheKey(Je);let ct=me.programs;me.environment=I.isMeshStandardMaterial||I.isMeshLambertMaterial||I.isMeshPhongMaterial?ne.environment:null,me.fog=ne.fog;const _t=I.isMeshStandardMaterial||I.isMeshLambertMaterial&&!I.envMap||I.isMeshPhongMaterial&&!I.envMap;me.envMap=H.get(I.envMap||me.environment,_t),me.envMapRotation=me.environment!==null&&I.envMap===null?ne.environmentRotation:I.envMapRotation,ct===void 0&&(I.addEventListener("dispose",$t),ct=new Map,me.programs=ct);let bt=ct.get(ot);if(bt!==void 0){if(me.currentProgram===bt&&me.lightsStateVersion===nt)return tn(I,Je),bt}else Je.uniforms=ge.getUniforms(I),F!==null&&I.isNodeMaterial&&F.build(I,he,Je),I.onBeforeCompile(Je,D),bt=ge.acquireProgram(Je,ot),ct.set(ot,bt),me.uniforms=Je.uniforms;const dt=me.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(dt.clippingPlanes=Le.uniform),tn(I,Je),me.needsLights=Yt(I),me.lightsStateVersion=nt,me.needsLights&&(dt.ambientLightColor.value=_e.state.ambient,dt.lightProbe.value=_e.state.probe,dt.directionalLights.value=_e.state.directional,dt.directionalLightShadows.value=_e.state.directionalShadow,dt.spotLights.value=_e.state.spot,dt.spotLightShadows.value=_e.state.spotShadow,dt.rectAreaLights.value=_e.state.rectArea,dt.ltc_1.value=_e.state.rectAreaLTC1,dt.ltc_2.value=_e.state.rectAreaLTC2,dt.pointLights.value=_e.state.point,dt.pointLightShadows.value=_e.state.pointShadow,dt.hemisphereLights.value=_e.state.hemi,dt.directionalShadowMatrix.value=_e.state.directionalShadowMatrix,dt.spotLightMatrix.value=_e.state.spotLightMatrix,dt.spotLightMap.value=_e.state.spotLightMap,dt.pointShadowMatrix.value=_e.state.pointShadowMatrix),me.lightProbeGrid=S.state.lightProbeGridArray.length>0,me.currentProgram=bt,me.uniformsList=null,bt}function An(I){if(I.uniformsList===null){const ne=I.currentProgram.getUniforms();I.uniformsList=Ro.seqWithValue(ne.seq,I.uniforms)}return I.uniformsList}function tn(I,ne){const he=C.get(I);he.outputColorSpace=ne.outputColorSpace,he.batching=ne.batching,he.batchingColor=ne.batchingColor,he.instancing=ne.instancing,he.instancingColor=ne.instancingColor,he.instancingMorph=ne.instancingMorph,he.skinning=ne.skinning,he.morphTargets=ne.morphTargets,he.morphNormals=ne.morphNormals,he.morphColors=ne.morphColors,he.morphTargetsCount=ne.morphTargetsCount,he.numClippingPlanes=ne.numClippingPlanes,he.numIntersection=ne.numClipIntersection,he.vertexAlphas=ne.vertexAlphas,he.vertexTangents=ne.vertexTangents,he.toneMapping=ne.toneMapping}function pn(I,ne){if(I.length===0)return null;if(I.length===1)return I[0].texture!==null?I[0]:null;b.setFromMatrixPosition(ne.matrixWorld);for(let he=0,me=I.length;he<me;he++){const _e=I[he];if(_e.texture!==null&&_e.boundingBox.containsPoint(b))return _e}return null}function Dn(I,ne,he,me,_e){ne.isScene!==!0&&(ne=We),M.resetTextureUnits();const $e=ne.fog,nt=me.isMeshStandardMaterial||me.isMeshLambertMaterial||me.isMeshPhongMaterial?ne.environment:null,Je=N===null?D.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:At.workingColorSpace,ot=me.isMeshStandardMaterial||me.isMeshLambertMaterial&&!me.envMap||me.isMeshPhongMaterial&&!me.envMap,ct=H.get(me.envMap||nt,ot),_t=me.vertexColors===!0&&!!he.attributes.color&&he.attributes.color.itemSize===4,bt=!!he.attributes.tangent&&(!!me.normalMap||me.anisotropy>0),dt=!!he.morphAttributes.position,zt=!!he.morphAttributes.normal,cn=!!he.morphAttributes.color;let nn=Fi;me.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(nn=D.toneMapping);const Vt=he.morphAttributes.position||he.morphAttributes.normal||he.morphAttributes.color,Ln=Vt!==void 0?Vt.length:0,rt=C.get(me),Zn=S.state.lights;if(ze===!0&&(Ue===!0||I!==z)){const Wt=I===z&&me.id===R;Le.setState(me,I,Wt)}let Ct=!1;me.version===rt.__version?(rt.needsLights&&rt.lightsStateVersion!==Zn.state.version||rt.outputColorSpace!==Je||_e.isBatchedMesh&&rt.batching===!1||!_e.isBatchedMesh&&rt.batching===!0||_e.isBatchedMesh&&rt.batchingColor===!0&&_e.colorTexture===null||_e.isBatchedMesh&&rt.batchingColor===!1&&_e.colorTexture!==null||_e.isInstancedMesh&&rt.instancing===!1||!_e.isInstancedMesh&&rt.instancing===!0||_e.isSkinnedMesh&&rt.skinning===!1||!_e.isSkinnedMesh&&rt.skinning===!0||_e.isInstancedMesh&&rt.instancingColor===!0&&_e.instanceColor===null||_e.isInstancedMesh&&rt.instancingColor===!1&&_e.instanceColor!==null||_e.isInstancedMesh&&rt.instancingMorph===!0&&_e.morphTexture===null||_e.isInstancedMesh&&rt.instancingMorph===!1&&_e.morphTexture!==null||rt.envMap!==ct||me.fog===!0&&rt.fog!==$e||rt.numClippingPlanes!==void 0&&(rt.numClippingPlanes!==Le.numPlanes||rt.numIntersection!==Le.numIntersection)||rt.vertexAlphas!==_t||rt.vertexTangents!==bt||rt.morphTargets!==dt||rt.morphNormals!==zt||rt.morphColors!==cn||rt.toneMapping!==nn||rt.morphTargetsCount!==Ln||!!rt.lightProbeGrid!=S.state.lightProbeGridArray.length>0)&&(Ct=!0):(Ct=!0,rt.__version=me.version);let si=rt.currentProgram;Ct===!0&&(si=en(me,ne,_e),F&&me.isNodeMaterial&&F.onUpdateProgram(me,si,rt));let wi=!1,Ki=!1,zr=!1;const Ht=si.getUniforms(),un=rt.uniforms;if(ye.useProgram(si.program)&&(wi=!0,Ki=!0,zr=!0),me.id!==R&&(R=me.id,Ki=!0),rt.needsLights){const Wt=pn(S.state.lightProbeGridArray,_e);rt.lightProbeGrid!==Wt&&(rt.lightProbeGrid=Wt,Ki=!0)}if(wi||z!==I){ye.buffers.depth.getReversed()&&I.reversedDepth!==!0&&(I._reversedDepth=!0,I.updateProjectionMatrix()),Ht.setValue(V,"projectionMatrix",I.projectionMatrix),Ht.setValue(V,"viewMatrix",I.matrixWorldInverse);const $i=Ht.map.cameraPosition;$i!==void 0&&$i.setValue(V,ke.setFromMatrixPosition(I.matrixWorld)),Xe.logarithmicDepthBuffer&&Ht.setValue(V,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(me.isMeshPhongMaterial||me.isMeshToonMaterial||me.isMeshLambertMaterial||me.isMeshBasicMaterial||me.isMeshStandardMaterial||me.isShaderMaterial)&&Ht.setValue(V,"isOrthographic",I.isOrthographicCamera===!0),z!==I&&(z=I,Ki=!0,zr=!0)}if(rt.needsLights&&(Zn.state.directionalShadowMap.length>0&&Ht.setValue(V,"directionalShadowMap",Zn.state.directionalShadowMap,M),Zn.state.spotShadowMap.length>0&&Ht.setValue(V,"spotShadowMap",Zn.state.spotShadowMap,M),Zn.state.pointShadowMap.length>0&&Ht.setValue(V,"pointShadowMap",Zn.state.pointShadowMap,M)),_e.isSkinnedMesh){Ht.setOptional(V,_e,"bindMatrix"),Ht.setOptional(V,_e,"bindMatrixInverse");const Wt=_e.skeleton;Wt&&(Wt.boneTexture===null&&Wt.computeBoneTexture(),Ht.setValue(V,"boneTexture",Wt.boneTexture,M))}_e.isBatchedMesh&&(Ht.setOptional(V,_e,"batchingTexture"),Ht.setValue(V,"batchingTexture",_e._matricesTexture,M),Ht.setOptional(V,_e,"batchingIdTexture"),Ht.setValue(V,"batchingIdTexture",_e._indirectTexture,M),Ht.setOptional(V,_e,"batchingColorTexture"),_e._colorsTexture!==null&&Ht.setValue(V,"batchingColorTexture",_e._colorsTexture,M));const Zi=he.morphAttributes;if((Zi.position!==void 0||Zi.normal!==void 0||Zi.color!==void 0)&&et.update(_e,he,si),(Ki||rt.receiveShadow!==_e.receiveShadow)&&(rt.receiveShadow=_e.receiveShadow,Ht.setValue(V,"receiveShadow",_e.receiveShadow)),(me.isMeshStandardMaterial||me.isMeshLambertMaterial||me.isMeshPhongMaterial)&&me.envMap===null&&ne.environment!==null&&(un.envMapIntensity.value=ne.environmentIntensity),un.dfgLUT!==void 0&&(un.dfgLUT.value=Dw()),Ki){if(Ht.setValue(V,"toneMappingExposure",D.toneMappingExposure),rt.needsLights&&gn(un,zr),$e&&me.fog===!0&&ae.refreshFogUniforms(un,$e),ae.refreshMaterialUniforms(un,me,ve,de,S.state.transmissionRenderTarget[I.id]),rt.needsLights&&rt.lightProbeGrid){const Wt=rt.lightProbeGrid;un.probesSH.value=Wt.texture,un.probesMin.value.copy(Wt.boundingBox.min),un.probesMax.value.copy(Wt.boundingBox.max),un.probesResolution.value.copy(Wt.resolution)}Ro.upload(V,An(rt),un,M)}if(me.isShaderMaterial&&me.uniformsNeedUpdate===!0&&(Ro.upload(V,An(rt),un,M),me.uniformsNeedUpdate=!1),me.isSpriteMaterial&&Ht.setValue(V,"center",_e.center),Ht.setValue(V,"modelViewMatrix",_e.modelViewMatrix),Ht.setValue(V,"normalMatrix",_e.normalMatrix),Ht.setValue(V,"modelMatrix",_e.matrixWorld),me.uniformsGroups!==void 0){const Wt=me.uniformsGroups;for(let $i=0,Br=Wt.length;$i<Br;$i++){const eh=Wt[$i];Te.update(eh,si),Te.bind(eh,si)}}return si}function gn(I,ne){I.ambientLightColor.needsUpdate=ne,I.lightProbe.needsUpdate=ne,I.directionalLights.needsUpdate=ne,I.directionalLightShadows.needsUpdate=ne,I.pointLights.needsUpdate=ne,I.pointLightShadows.needsUpdate=ne,I.spotLights.needsUpdate=ne,I.spotLightShadows.needsUpdate=ne,I.rectAreaLights.needsUpdate=ne,I.hemisphereLights.needsUpdate=ne}function Yt(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return k},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(I,ne,he){const me=C.get(I);me.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,me.__autoAllocateDepthBuffer===!1&&(me.__useRenderToTexture=!1),C.get(I.texture).__webglTexture=ne,C.get(I.depthTexture).__webglTexture=me.__autoAllocateDepthBuffer?void 0:he,me.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,ne){const he=C.get(I);he.__webglFramebuffer=ne,he.__useDefaultFramebuffer=ne===void 0};const Jt=V.createFramebuffer();this.setRenderTarget=function(I,ne=0,he=0){N=I,k=ne,U=he;let me=null,_e=!1,$e=!1;if(I){const Je=C.get(I);if(Je.__useDefaultFramebuffer!==void 0){ye.bindFramebuffer(V.FRAMEBUFFER,Je.__webglFramebuffer),q.copy(I.viewport),Y.copy(I.scissor),te=I.scissorTest,ye.viewport(q),ye.scissor(Y),ye.setScissorTest(te),R=-1;return}else if(Je.__webglFramebuffer===void 0)M.setupRenderTarget(I);else if(Je.__hasExternalTextures)M.rebindTextures(I,C.get(I.texture).__webglTexture,C.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const _t=I.depthTexture;if(Je.__boundDepthTexture!==_t){if(_t!==null&&C.has(_t)&&(I.width!==_t.image.width||I.height!==_t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");M.setupDepthRenderbuffer(I)}}const ot=I.texture;(ot.isData3DTexture||ot.isDataArrayTexture||ot.isCompressedArrayTexture)&&($e=!0);const ct=C.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(ct[ne])?me=ct[ne][he]:me=ct[ne],_e=!0):I.samples>0&&M.useMultisampledRTT(I)===!1?me=C.get(I).__webglMultisampledFramebuffer:Array.isArray(ct)?me=ct[he]:me=ct,q.copy(I.viewport),Y.copy(I.scissor),te=I.scissorTest}else q.copy(Z).multiplyScalar(ve).floor(),Y.copy(ce).multiplyScalar(ve).floor(),te=pe;if(he!==0&&(me=Jt),ye.bindFramebuffer(V.FRAMEBUFFER,me)&&ye.drawBuffers(I,me),ye.viewport(q),ye.scissor(Y),ye.setScissorTest(te),_e){const Je=C.get(I.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+ne,Je.__webglTexture,he)}else if($e){const Je=ne;for(let ot=0;ot<I.textures.length;ot++){const ct=C.get(I.textures[ot]);V.framebufferTextureLayer(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0+ot,ct.__webglTexture,he,Je)}}else if(I!==null&&he!==0){const Je=C.get(I.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,Je.__webglTexture,he)}R=-1},this.readRenderTargetPixels=function(I,ne,he,me,_e,$e,nt,Je=0){if(!(I&&I.isWebGLRenderTarget)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ot=C.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot){ye.bindFramebuffer(V.FRAMEBUFFER,ot);try{const ct=I.textures[Je],_t=ct.format,bt=ct.type;if(I.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+Je),!Xe.textureFormatReadable(_t)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Xe.textureTypeReadable(bt)){Tt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ne>=0&&ne<=I.width-me&&he>=0&&he<=I.height-_e&&V.readPixels(ne,he,me,_e,J.convert(_t),J.convert(bt),$e)}finally{const ct=N!==null?C.get(N).__webglFramebuffer:null;ye.bindFramebuffer(V.FRAMEBUFFER,ct)}}},this.readRenderTargetPixelsAsync=async function(I,ne,he,me,_e,$e,nt,Je=0){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ot=C.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot)if(ne>=0&&ne<=I.width-me&&he>=0&&he<=I.height-_e){ye.bindFramebuffer(V.FRAMEBUFFER,ot);const ct=I.textures[Je],_t=ct.format,bt=ct.type;if(I.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+Je),!Xe.textureFormatReadable(_t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Xe.textureTypeReadable(bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const dt=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,dt),V.bufferData(V.PIXEL_PACK_BUFFER,$e.byteLength,V.STREAM_READ),V.readPixels(ne,he,me,_e,J.convert(_t),J.convert(bt),0);const zt=N!==null?C.get(N).__webglFramebuffer:null;ye.bindFramebuffer(V.FRAMEBUFFER,zt);const cn=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await _x(V,cn,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,dt),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,$e),V.deleteBuffer(dt),V.deleteSync(cn),$e}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,ne=null,he=0){const me=Math.pow(2,-he),_e=Math.floor(I.image.width*me),$e=Math.floor(I.image.height*me),nt=ne!==null?ne.x:0,Je=ne!==null?ne.y:0;M.setTexture2D(I,0),V.copyTexSubImage2D(V.TEXTURE_2D,he,0,0,nt,Je,_e,$e),ye.unbindTexture()};const ln=V.createFramebuffer(),Gt=V.createFramebuffer();this.copyTextureToTexture=function(I,ne,he=null,me=null,_e=0,$e=0){let nt,Je,ot,ct,_t,bt,dt,zt,cn;const nn=I.isCompressedTexture?I.mipmaps[$e]:I.image;if(he!==null)nt=he.max.x-he.min.x,Je=he.max.y-he.min.y,ot=he.isBox3?he.max.z-he.min.z:1,ct=he.min.x,_t=he.min.y,bt=he.isBox3?he.min.z:0;else{const un=Math.pow(2,-_e);nt=Math.floor(nn.width*un),Je=Math.floor(nn.height*un),I.isDataArrayTexture?ot=nn.depth:I.isData3DTexture?ot=Math.floor(nn.depth*un):ot=1,ct=0,_t=0,bt=0}me!==null?(dt=me.x,zt=me.y,cn=me.z):(dt=0,zt=0,cn=0);const Vt=J.convert(ne.format),Ln=J.convert(ne.type);let rt;ne.isData3DTexture?(M.setTexture3D(ne,0),rt=V.TEXTURE_3D):ne.isDataArrayTexture||ne.isCompressedArrayTexture?(M.setTexture2DArray(ne,0),rt=V.TEXTURE_2D_ARRAY):(M.setTexture2D(ne,0),rt=V.TEXTURE_2D),ye.activeTexture(V.TEXTURE0),ye.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,ne.flipY),ye.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ne.premultiplyAlpha),ye.pixelStorei(V.UNPACK_ALIGNMENT,ne.unpackAlignment);const Zn=ye.getParameter(V.UNPACK_ROW_LENGTH),Ct=ye.getParameter(V.UNPACK_IMAGE_HEIGHT),si=ye.getParameter(V.UNPACK_SKIP_PIXELS),wi=ye.getParameter(V.UNPACK_SKIP_ROWS),Ki=ye.getParameter(V.UNPACK_SKIP_IMAGES);ye.pixelStorei(V.UNPACK_ROW_LENGTH,nn.width),ye.pixelStorei(V.UNPACK_IMAGE_HEIGHT,nn.height),ye.pixelStorei(V.UNPACK_SKIP_PIXELS,ct),ye.pixelStorei(V.UNPACK_SKIP_ROWS,_t),ye.pixelStorei(V.UNPACK_SKIP_IMAGES,bt);const zr=I.isDataArrayTexture||I.isData3DTexture,Ht=ne.isDataArrayTexture||ne.isData3DTexture;if(I.isDepthTexture){const un=C.get(I),Zi=C.get(ne),Wt=C.get(un.__renderTarget),$i=C.get(Zi.__renderTarget);ye.bindFramebuffer(V.READ_FRAMEBUFFER,Wt.__webglFramebuffer),ye.bindFramebuffer(V.DRAW_FRAMEBUFFER,$i.__webglFramebuffer);for(let Br=0;Br<ot;Br++)zr&&(V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,C.get(I).__webglTexture,_e,bt+Br),V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,C.get(ne).__webglTexture,$e,cn+Br)),V.blitFramebuffer(ct,_t,nt,Je,dt,zt,nt,Je,V.DEPTH_BUFFER_BIT,V.NEAREST);ye.bindFramebuffer(V.READ_FRAMEBUFFER,null),ye.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else if(_e!==0||I.isRenderTargetTexture||C.has(I)){const un=C.get(I),Zi=C.get(ne);ye.bindFramebuffer(V.READ_FRAMEBUFFER,ln),ye.bindFramebuffer(V.DRAW_FRAMEBUFFER,Gt);for(let Wt=0;Wt<ot;Wt++)zr?V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,un.__webglTexture,_e,bt+Wt):V.framebufferTexture2D(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,un.__webglTexture,_e),Ht?V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,Zi.__webglTexture,$e,cn+Wt):V.framebufferTexture2D(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,Zi.__webglTexture,$e),_e!==0?V.blitFramebuffer(ct,_t,nt,Je,dt,zt,nt,Je,V.COLOR_BUFFER_BIT,V.NEAREST):Ht?V.copyTexSubImage3D(rt,$e,dt,zt,cn+Wt,ct,_t,nt,Je):V.copyTexSubImage2D(rt,$e,dt,zt,ct,_t,nt,Je);ye.bindFramebuffer(V.READ_FRAMEBUFFER,null),ye.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else Ht?I.isDataTexture||I.isData3DTexture?V.texSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,Ln,nn.data):ne.isCompressedArrayTexture?V.compressedTexSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,nn.data):V.texSubImage3D(rt,$e,dt,zt,cn,nt,Je,ot,Vt,Ln,nn):I.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,$e,dt,zt,nt,Je,Vt,Ln,nn.data):I.isCompressedTexture?V.compressedTexSubImage2D(V.TEXTURE_2D,$e,dt,zt,nn.width,nn.height,Vt,nn.data):V.texSubImage2D(V.TEXTURE_2D,$e,dt,zt,nt,Je,Vt,Ln,nn);ye.pixelStorei(V.UNPACK_ROW_LENGTH,Zn),ye.pixelStorei(V.UNPACK_IMAGE_HEIGHT,Ct),ye.pixelStorei(V.UNPACK_SKIP_PIXELS,si),ye.pixelStorei(V.UNPACK_SKIP_ROWS,wi),ye.pixelStorei(V.UNPACK_SKIP_IMAGES,Ki),$e===0&&ne.generateMipmaps&&V.generateMipmap(rt),ye.unbindTexture()},this.initRenderTarget=function(I){C.get(I).__webglFramebuffer===void 0&&M.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?M.setTextureCube(I,0):I.isData3DTexture?M.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?M.setTexture2DArray(I,0):M.setTexture2D(I,0),ye.unbindTexture()},this.resetState=function(){k=0,U=0,N=null,ye.reset(),Ge.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ni}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=At._getDrawingBufferColorSpace(e),t.unpackColorSpace=At._getUnpackColorSpace()}}class Iw extends rn{constructor(e,t){super(),this.isViewHelper=!0,this.animating=!1,this.center=new X,this.location={top:null,right:0,bottom:0,left:null};const i=new tt("#ff4466"),r=new tt("#88ff44"),s=new tt("#4488ff"),a=new tt("#000000"),o={},l=[],c=new ul,d=new it,f=new rn,h=new Fr(-2,2,2,-2,0,4);h.position.set(0,0,2);const p=new Md(.04,.04,.8,5).rotateZ(-Math.PI/2).translate(.4,0,0),m=new an(p,le(i)),x=new an(p,le(r)),g=new an(p,le(s));x.rotation.z=Math.PI/2,g.rotation.y=-Math.PI/2,this.add(m),this.add(g),this.add(x);const v=de(i),y=de(r),w=de(s),b=de(a),E=new ts(v),S=new ts(y),A=new ts(w),_=new ts(b),T=new ts(b),D=new ts(b);E.position.x=1,S.position.y=1,A.position.z=1,_.position.x=-1,T.position.y=-1,D.position.z=-1,_.material.opacity=.2,T.material.opacity=.2,D.material.opacity=.2,E.userData.type="posX",S.userData.type="posY",A.userData.type="posZ",_.userData.type="negX",T.userData.type="negY",D.userData.type="negZ",this.add(E),this.add(S),this.add(A),this.add(_),this.add(T),this.add(D),l.push(E),l.push(S),l.push(A),l.push(_),l.push(T),l.push(D);const L=new X,F=128,k=2*Math.PI;this.render=function(G){this.quaternion.copy(e.quaternion).invert(),this.updateMatrixWorld(),L.set(0,0,1),L.applyQuaternion(e.quaternion);const ie=this.location;let Z,ce;ie.left!==null?Z=ie.left:Z=t.offsetWidth-F-ie.right,ie.top!==null?ce=G.isWebGPURenderer?ie.top:t.offsetHeight-F-ie.top:ce=G.isWebGPURenderer?t.offsetHeight-F-ie.bottom:ie.bottom,G.clearDepth(),G.getViewport(q),G.setViewport(Z,ce,F,F),G.render(this,h),G.setViewport(q.x,q.y,q.z,q.w)};const U=new X,N=new xi,R=new xi,z=new xi,q=new kt;let Y=0;this.handleClick=function(G){if(this.animating===!0)return!1;const ie=t.getBoundingClientRect(),Z=this.location;let ce,pe;Z.left!==null?ce=ie.left+Z.left:ce=ie.left+t.offsetWidth-F-Z.right,Z.top!==null?pe=ie.top+Z.top:pe=ie.top+t.offsetHeight-F-Z.bottom,d.x=(G.clientX-ce)/F*2-1,d.y=-((G.clientY-pe)/F)*2+1,c.setFromCamera(d,h);const Se=c.intersectObjects(l);if(Se.length>0){const Ue=Se[0].object;return te(Ue,this.center),this.animating=!0,!0}else return!1},this.setLabels=function(G,ie,Z){o.labelX=G,o.labelY=ie,o.labelZ=Z,ve()},this.setLabelStyle=function(G,ie,Z){o.font=G,o.color=ie,o.radius=Z,ve()},this.update=function(G){const ie=G*k;R.rotateTowards(z,ie),e.position.set(0,0,1).applyQuaternion(R).multiplyScalar(Y).add(this.center),e.quaternion.rotateTowards(N,ie),R.angleTo(z)===0&&(this.animating=!1)},this.dispose=function(){p.dispose(),m.material.dispose(),x.material.dispose(),g.material.dispose(),E.material.map.dispose(),S.material.map.dispose(),A.material.map.dispose(),_.material.map.dispose(),T.material.map.dispose(),D.material.map.dispose(),E.material.dispose(),S.material.dispose(),A.material.dispose(),_.material.dispose(),T.material.dispose(),D.material.dispose()};function te(G,ie){switch(G.userData.type){case"posX":U.set(1,0,0),N.setFromEuler(new Xn(0,Math.PI*.5,0));break;case"posY":U.set(0,1,0),N.setFromEuler(new Xn(-Math.PI*.5,0,0));break;case"posZ":U.set(0,0,1),N.setFromEuler(new Xn);break;case"negX":U.set(-1,0,0),N.setFromEuler(new Xn(0,-Math.PI*.5,0));break;case"negY":U.set(0,-1,0),N.setFromEuler(new Xn(Math.PI*.5,0,0));break;case"negZ":U.set(0,0,-1),N.setFromEuler(new Xn(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}Y=e.position.distanceTo(ie),U.multiplyScalar(Y).add(ie),f.position.copy(ie),f.lookAt(e.position),R.copy(f.quaternion),f.lookAt(U),z.copy(f.quaternion)}function le(G){return new yd({color:G,toneMapped:!1})}function B(){let G=!1;try{G=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}return G}function ee(G,ie){let Z;return B()?Z=new OffscreenCanvas(G,ie):(Z=document.createElement("canvas"),Z.width=G,Z.height=ie),Z}function de(G,ie){const{font:Z="24px Arial",color:ce="#000000",radius:pe=14}=o,Se=ee(64,64),ze=Se.getContext("2d");ze.beginPath(),ze.arc(32,32,pe,0,2*Math.PI),ze.closePath(),ze.fillStyle=G.getStyle(),ze.fill(),ie&&(ze.font=Z,ze.textAlign="center",ze.fillStyle=ce,ze.fillText(ie,32,41));const Ue=new cb(Se);return Ue.colorSpace=Wn,new gm({map:Ue,toneMapped:!1})}function ve(){E.material.map.dispose(),S.material.map.dispose(),A.material.map.dispose(),E.material.dispose(),S.material.dispose(),A.material.dispose(),E.material=de(i,o.labelX),S.material=de(r,o.labelY),A.material=de(s,o.labelZ)}}}const Ef=new di,lo=new X;class Ad extends Cb{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new sn(e,3)),this.setAttribute("uv",new sn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new cu(t,6,1);return this.setAttribute("instanceStart",new Ui(i,3,0)),this.setAttribute("instanceEnd",new Ui(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new cu(t,6,1);return this.setAttribute("instanceColorStart",new Ui(i,3,0)),this.setAttribute("instanceColorEnd",new Ui(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new hb(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Ef.setFromBufferAttribute(t),this.boundingBox.union(Ef))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)lo.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(lo)),lo.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(lo));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}Ke.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new it(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};jn.line={uniforms:Di.merge([Ke.common,Ke.fog,Ke.line]),vertexShader:`
|
|
4105
4105
|
#include <common>
|
|
4106
4106
|
#include <color_pars_vertex>
|
|
4107
4107
|
#include <fog_pars_vertex>
|
|
@@ -4470,7 +4470,7 @@ void main() {
|
|
|
4470
4470
|
#include <premultiplied_alpha_fragment>
|
|
4471
4471
|
|
|
4472
4472
|
}
|
|
4473
|
-
`};class Sa extends _n{constructor(e){super({type:"LineMaterial",uniforms:Di.clone(jn.line.uniforms),vertexShader:jn.line.vertexShader,fragmentShader:jn.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const sc=new kt,Tf=new X,Af=new X,Cn=new kt,Pn=new kt,Ai=new kt,ac=new X,oc=new Lt,Rn=new Ub,Cf=new X,co=new di,uo=new Ur,Ci=new kt;let Li,Ar;function Pf(n,e,t){return Ci.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),Ci.multiplyScalar(1/Ci.w),Ci.x=Ar/t.width,Ci.y=Ar/t.height,Ci.applyMatrix4(n.projectionMatrixInverse),Ci.multiplyScalar(1/Ci.w),Math.abs(Math.max(Ci.x,Ci.y))}function Nw(n,e){const t=n.matrixWorld,i=n.geometry,r=i.attributes.instanceStart,s=i.attributes.instanceEnd,a=Math.min(i.instanceCount,r.count);for(let o=0,l=a;o<l;o++){Rn.start.fromBufferAttribute(r,o),Rn.end.fromBufferAttribute(s,o),Rn.applyMatrix4(t);const c=new X,d=new X;Li.distanceSqToSegment(Rn.start,Rn.end,d,c),d.distanceTo(c)<Ar*.5&&e.push({point:d,pointOnLine:c,distance:Li.origin.distanceTo(d),object:n,face:null,faceIndex:o,uv:null,uv1:null})}}function Uw(n,e,t){const i=e.projectionMatrix,s=n.material.resolution,a=n.matrixWorld,o=n.geometry,l=o.attributes.instanceStart,c=o.attributes.instanceEnd,d=Math.min(o.instanceCount,l.count),f=-e.near;Li.at(1,Ai),Ai.w=1,Ai.applyMatrix4(e.matrixWorldInverse),Ai.applyMatrix4(i),Ai.multiplyScalar(1/Ai.w),Ai.x*=s.x/2,Ai.y*=s.y/2,Ai.z=0,ac.copy(Ai),oc.multiplyMatrices(e.matrixWorldInverse,a);for(let h=0,p=d;h<p;h++){if(Cn.fromBufferAttribute(l,h),Pn.fromBufferAttribute(c,h),Cn.w=1,Pn.w=1,Cn.applyMatrix4(oc),Pn.applyMatrix4(oc),Cn.z>f&&Pn.z>f)continue;if(Cn.z>f){const w=Cn.z-Pn.z,b=(Cn.z-f)/w;Cn.lerp(Pn,b)}else if(Pn.z>f){const w=Pn.z-Cn.z,b=(Pn.z-f)/w;Pn.lerp(Cn,b)}Cn.applyMatrix4(i),Pn.applyMatrix4(i),Cn.multiplyScalar(1/Cn.w),Pn.multiplyScalar(1/Pn.w),Cn.x*=s.x/2,Cn.y*=s.y/2,Pn.x*=s.x/2,Pn.y*=s.y/2,Rn.start.copy(Cn),Rn.start.z=0,Rn.end.copy(Pn),Rn.end.z=0;const x=Rn.closestPointToPointParameter(ac,!0);Rn.at(x,Cf);const
|
|
4473
|
+
`};class Sa extends _n{constructor(e){super({type:"LineMaterial",uniforms:Di.clone(jn.line.uniforms),vertexShader:jn.line.vertexShader,fragmentShader:jn.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const sc=new kt,Tf=new X,Af=new X,Cn=new kt,Pn=new kt,Ai=new kt,ac=new X,oc=new Lt,Rn=new Ub,Cf=new X,co=new di,uo=new Ur,Ci=new kt;let Li,Ar;function Pf(n,e,t){return Ci.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),Ci.multiplyScalar(1/Ci.w),Ci.x=Ar/t.width,Ci.y=Ar/t.height,Ci.applyMatrix4(n.projectionMatrixInverse),Ci.multiplyScalar(1/Ci.w),Math.abs(Math.max(Ci.x,Ci.y))}function Nw(n,e){const t=n.matrixWorld,i=n.geometry,r=i.attributes.instanceStart,s=i.attributes.instanceEnd,a=Math.min(i.instanceCount,r.count);for(let o=0,l=a;o<l;o++){Rn.start.fromBufferAttribute(r,o),Rn.end.fromBufferAttribute(s,o),Rn.applyMatrix4(t);const c=new X,d=new X;Li.distanceSqToSegment(Rn.start,Rn.end,d,c),d.distanceTo(c)<Ar*.5&&e.push({point:d,pointOnLine:c,distance:Li.origin.distanceTo(d),object:n,face:null,faceIndex:o,uv:null,uv1:null})}}function Uw(n,e,t){const i=e.projectionMatrix,s=n.material.resolution,a=n.matrixWorld,o=n.geometry,l=o.attributes.instanceStart,c=o.attributes.instanceEnd,d=Math.min(o.instanceCount,l.count),f=-e.near;Li.at(1,Ai),Ai.w=1,Ai.applyMatrix4(e.matrixWorldInverse),Ai.applyMatrix4(i),Ai.multiplyScalar(1/Ai.w),Ai.x*=s.x/2,Ai.y*=s.y/2,Ai.z=0,ac.copy(Ai),oc.multiplyMatrices(e.matrixWorldInverse,a);for(let h=0,p=d;h<p;h++){if(Cn.fromBufferAttribute(l,h),Pn.fromBufferAttribute(c,h),Cn.w=1,Pn.w=1,Cn.applyMatrix4(oc),Pn.applyMatrix4(oc),Cn.z>f&&Pn.z>f)continue;if(Cn.z>f){const w=Cn.z-Pn.z,b=(Cn.z-f)/w;Cn.lerp(Pn,b)}else if(Pn.z>f){const w=Pn.z-Cn.z,b=(Pn.z-f)/w;Pn.lerp(Cn,b)}Cn.applyMatrix4(i),Pn.applyMatrix4(i),Cn.multiplyScalar(1/Cn.w),Pn.multiplyScalar(1/Pn.w),Cn.x*=s.x/2,Cn.y*=s.y/2,Pn.x*=s.x/2,Pn.y*=s.y/2,Rn.start.copy(Cn),Rn.start.z=0,Rn.end.copy(Pn),Rn.end.z=0;const x=Rn.closestPointToPointParameter(ac,!0);Rn.at(x,Cf);const g=um.lerp(Cn.z,Pn.z,x),v=g>=-1&&g<=1,y=ac.distanceTo(Cf)<Ar*.5;if(v&&y){Rn.start.fromBufferAttribute(l,h),Rn.end.fromBufferAttribute(c,h),Rn.start.applyMatrix4(a),Rn.end.applyMatrix4(a);const w=new X,b=new X;Li.distanceSqToSegment(Rn.start,Rn.end,b,w),t.push({point:b,pointOnLine:w,distance:Li.origin.distanceTo(b),object:n,face:null,faceIndex:h,uv:null,uv1:null})}}}class Cd extends an{constructor(e=new Ad,t=new Sa({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)Tf.fromBufferAttribute(t,a),Af.fromBufferAttribute(i,a),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+Tf.distanceTo(Af);const s=new cu(r,2,1);return e.setAttribute("instanceDistanceStart",new Ui(s,1,0)),e.setAttribute("instanceDistanceEnd",new Ui(s,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Li=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;Ar=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),uo.copy(o.boundingSphere).applyMatrix4(a);let c;if(i)c=Ar*.5;else{const f=Math.max(r.near,uo.distanceToPoint(Li.origin));c=Pf(r,f,l.resolution)}if(uo.radius+=c,Li.intersectsSphere(uo)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),co.copy(o.boundingBox).applyMatrix4(a);let d;if(i)d=Ar*.5;else{const f=Math.max(r.near,co.distanceToPoint(Li.origin));d=Pf(r,f,l.resolution)}co.expandByScalar(d),Li.intersectsBox(co)!==!1&&(i?Nw(this,t):Uw(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(sc),this.material.uniforms.resolution.value.set(sc.z,sc.w))}}const Do={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
4474
4474
|
|
|
4475
4475
|
varying vec2 vUv;
|
|
4476
4476
|
|
|
@@ -4880,7 +4880,7 @@ void main() {
|
|
|
4880
4880
|
denoised /= totalWeight;
|
|
4881
4881
|
}
|
|
4882
4882
|
gl_FragColor = FRAGMENT_OUTPUT;
|
|
4883
|
-
}`};function Dm(n,e,t){const i=Xw(n,e,t);let r="vec3[SAMPLES](";for(let s=0;s<n;s++){const a=i[s];r+=`vec3(${a.x}, ${a.y}, ${a.z})${s<n-1?",":")"}`}return r}function Xw(n,e,t){const i=[];for(let r=0;r<n;r++){const s=2*Math.PI*e*r/n,a=Math.pow(r/(n-1),t);i.push(new X(Math.cos(s),Math.sin(s),a))}return i}class jw{constructor(e=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let t=0;t<256;t++)this.p[t]=Math.floor(e.random()*256);this.perm=[];for(let t=0;t<512;t++)this.perm[t]=this.p[t&255];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}noise(e,t){let i,r,s;const a=.5*(Math.sqrt(3)-1),o=(e+t)*a,l=Math.floor(e+o),c=Math.floor(t+o),d=(3-Math.sqrt(3))/6,f=(l+c)*d,h=l-f,p=c-f,g=e-h,x=t-p;let m,v;g>x?(m=1,v=0):(m=0,v=1);const y=g-m+d,w=x-v+d,b=g-1+2*d,E=x-1+2*d,S=l&255,A=c&255,_=this.perm[S+this.perm[A]]%12,T=this.perm[S+m+this.perm[A+v]]%12,D=this.perm[S+1+this.perm[A+1]]%12;let L=.5-g*g-x*x;L<0?i=0:(L*=L,i=L*L*this._dot(this.grad3[_],g,x));let F=.5-y*y-w*w;F<0?r=0:(F*=F,r=F*F*this._dot(this.grad3[T],y,w));let B=.5-b*b-E*E;return B<0?s=0:(B*=B,s=B*B*this._dot(this.grad3[D],b,E)),70*(i+r+s)}noise3d(e,t,i){let r,s,a,o;const c=(e+t+i)*.3333333333333333,d=Math.floor(e+c),f=Math.floor(t+c),h=Math.floor(i+c),p=1/6,g=(d+f+h)*p,x=d-g,m=f-g,v=h-g,y=e-x,w=t-m,b=i-v;let E,S,A,_,T,D;y>=w?w>=b?(E=1,S=0,A=0,_=1,T=1,D=0):y>=b?(E=1,S=0,A=0,_=1,T=0,D=1):(E=0,S=0,A=1,_=1,T=0,D=1):w<b?(E=0,S=0,A=1,_=0,T=1,D=1):y<b?(E=0,S=1,A=0,_=0,T=1,D=1):(E=0,S=1,A=0,_=1,T=1,D=0);const L=y-E+p,F=w-S+p,B=b-A+p,U=y-_+2*p,N=w-T+2*p,R=b-D+2*p,z=y-1+3*p,Y=w-1+3*p,K=b-1+3*p,ne=d&255,ce=f&255,V=h&255,ee=this.perm[ne+this.perm[ce+this.perm[V]]]%12,me=this.perm[ne+E+this.perm[ce+S+this.perm[V+A]]]%12,ve=this.perm[ne+_+this.perm[ce+T+this.perm[V+D]]]%12,G=this.perm[ne+1+this.perm[ce+1+this.perm[V+1]]]%12;let ie=.6-y*y-w*w-b*b;ie<0?r=0:(ie*=ie,r=ie*ie*this._dot3(this.grad3[ee],y,w,b));let Z=.6-L*L-F*F-B*B;Z<0?s=0:(Z*=Z,s=Z*Z*this._dot3(this.grad3[me],L,F,B));let le=.6-U*U-N*N-R*R;le<0?a=0:(le*=le,a=le*le*this._dot3(this.grad3[ve],U,N,R));let fe=.6-z*z-Y*Y-K*K;return fe<0?o=0:(fe*=fe,o=fe*fe*this._dot3(this.grad3[G],z,Y,K)),32*(r+s+a+o)}noise4d(e,t,i,r){const s=this.grad4,a=this.simplex,o=this.perm,l=(Math.sqrt(5)-1)/4,c=(5-Math.sqrt(5))/20;let d,f,h,p,g;const x=(e+t+i+r)*l,m=Math.floor(e+x),v=Math.floor(t+x),y=Math.floor(i+x),w=Math.floor(r+x),b=(m+v+y+w)*c,E=m-b,S=v-b,A=y-b,_=w-b,T=e-E,D=t-S,L=i-A,F=r-_,B=T>D?32:0,U=T>L?16:0,N=D>L?8:0,R=T>F?4:0,z=D>F?2:0,Y=L>F?1:0,K=B+U+N+R+z+Y,ne=a[K][0]>=3?1:0,ce=a[K][1]>=3?1:0,V=a[K][2]>=3?1:0,ee=a[K][3]>=3?1:0,me=a[K][0]>=2?1:0,ve=a[K][1]>=2?1:0,G=a[K][2]>=2?1:0,ie=a[K][3]>=2?1:0,Z=a[K][0]>=1?1:0,le=a[K][1]>=1?1:0,fe=a[K][2]>=1?1:0,Se=a[K][3]>=1?1:0,ze=T-ne+c,Ue=D-ce+c,Pe=L-V+c,ke=F-ee+c,Ie=T-me+2*c,We=D-ve+2*c,Oe=L-G+2*c,He=F-ie+2*c,k=T-Z+3*c,je=D-le+3*c,Ve=L-fe+3*c,Xe=F-Se+3*c,ye=T-1+4*c,Ce=D-1+4*c,C=L-1+4*c,M=F-1+4*c,H=m&255,re=v&255,ue=y&255,be=w&255,ge=o[H+o[re+o[ue+o[be]]]]%32,ae=o[H+ne+o[re+ce+o[ue+V+o[be+ee]]]]%32,he=o[H+me+o[re+ve+o[ue+G+o[be+ie]]]]%32,Re=o[H+Z+o[re+le+o[ue+fe+o[be+Se]]]]%32,Le=o[H+1+o[re+1+o[ue+1+o[be+1]]]]%32;let Ee=.6-T*T-D*D-L*L-F*F;Ee<0?d=0:(Ee*=Ee,d=Ee*Ee*this._dot4(s[ge],T,D,L,F));let De=.6-ze*ze-Ue*Ue-Pe*Pe-ke*ke;De<0?f=0:(De*=De,f=De*De*this._dot4(s[ae],ze,Ue,Pe,ke));let et=.6-Ie*Ie-We*We-Oe*Oe-He*He;et<0?h=0:(et*=et,h=et*et*this._dot4(s[he],Ie,We,Oe,He));let Ye=.6-k*k-je*je-Ve*Ve-Xe*Xe;Ye<0?p=0:(Ye*=Ye,p=Ye*Ye*this._dot4(s[Re],k,je,Ve,Xe));let ht=.6-ye*ye-Ce*Ce-C*C-M*M;return ht<0?g=0:(ht*=ht,g=ht*ht*this._dot4(s[Le],ye,Ce,C,M)),27*(d+f+h+p+g)}_dot(e,t,i){return e[0]*t+e[1]*i}_dot3(e,t,i,r){return e[0]*t+e[1]*i+e[2]*r}_dot4(e,t,i,r,s){return e[0]*t+e[1]*i+e[2]*r+e[3]*s}}class Ri extends Is{constructor(e,t,i=512,r=512,s,a,o){super(),this.width=i,this.height=r,this.clear=!0,this.camera=t,this.scene=e,this.output=0,this._renderGBuffer=!0,this._visibilityCache=[],this.blendIntensity=1,this.pdRings=2,this.pdRadiusExponent=2,this.pdSamples=16,this.gtaoNoiseTexture=Gw(),this.pdNoiseTexture=this._generateNoise(),this.gtaoRenderTarget=new ni(this.width,this.height,{type:Fn}),this.pdRenderTarget=this.gtaoRenderTarget.clone(),this.gtaoMaterial=new _n({defines:Object.assign({},ho.defines),uniforms:Di.clone(ho.uniforms),vertexShader:ho.vertexShader,fragmentShader:ho.fragmentShader,blending:Mn,depthTest:!1,depthWrite:!1}),this.gtaoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.gtaoMaterial.uniforms.tNoise.value=this.gtaoNoiseTexture,this.gtaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.normalMaterial=new gb,this.normalMaterial.blending=Mn,this.pdMaterial=new _n({defines:Object.assign({},po.defines),uniforms:Di.clone(po.uniforms),vertexShader:po.vertexShader,fragmentShader:po.fragmentShader,depthTest:!1,depthWrite:!1}),this.pdMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.pdMaterial.uniforms.tNoise.value=this.pdNoiseTexture,this.pdMaterial.uniforms.resolution.value.set(this.width,this.height),this.pdMaterial.uniforms.lumaPhi.value=10,this.pdMaterial.uniforms.depthPhi.value=2,this.pdMaterial.uniforms.normalPhi.value=3,this.pdMaterial.uniforms.radius.value=8,this.depthRenderMaterial=new _n({defines:Object.assign({},fo.defines),uniforms:Di.clone(fo.uniforms),vertexShader:fo.vertexShader,fragmentShader:fo.fragmentShader,blending:Mn}),this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new _n({uniforms:Di.clone(Do.uniforms),vertexShader:Do.vertexShader,fragmentShader:Do.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:yc,blendDst:Js,blendEquation:gi,blendSrcAlpha:bc,blendDstAlpha:Js,blendEquationAlpha:gi}),this.blendMaterial=new _n({uniforms:Di.clone(lc.uniforms),vertexShader:lc.vertexShader,fragmentShader:lc.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blending:Qp,blendSrc:yc,blendDst:Js,blendEquation:gi,blendSrcAlpha:bc,blendDstAlpha:Js,blendEquationAlpha:gi}),this._fsQuad=new Pd(null),this._originalClearColor=new tt,this.setGBuffer(s?s.depthTexture:void 0,s?s.normalTexture:void 0),a!==void 0&&this.updateGtaoMaterial(a),o!==void 0&&this.updatePdMaterial(o)}setSize(e,t){this.width=e,this.height=t,this.gtaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.pdRenderTarget.setSize(e,t),this.gtaoMaterial.uniforms.resolution.value.set(e,t),this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.pdMaterial.uniforms.resolution.value.set(e,t),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse)}dispose(){this.gtaoNoiseTexture.dispose(),this.pdNoiseTexture.dispose(),this.normalRenderTarget.dispose(),this.gtaoRenderTarget.dispose(),this.pdRenderTarget.dispose(),this.normalMaterial.dispose(),this.pdMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this._fsQuad.dispose()}get gtaoMap(){return this.pdRenderTarget.texture}setGBuffer(e,t){e!==void 0?(this.depthTexture=e,this.normalTexture=t,this._renderGBuffer=!1):(this.depthTexture=new Nr,this.depthTexture.format=cr,this.depthTexture.type=Ts,this.normalRenderTarget=new ni(this.width,this.height,{minFilter:xn,magFilter:xn,type:Fn,depthTexture:this.depthTexture}),this.normalTexture=this.normalRenderTarget.texture,this._renderGBuffer=!0);const i=this.normalTexture?1:0,r=this.depthTexture===this.normalTexture?"w":"x";this.gtaoMaterial.defines.NORMAL_VECTOR_TYPE=i,this.gtaoMaterial.defines.DEPTH_SWIZZLING=r,this.gtaoMaterial.uniforms.tNormal.value=this.normalTexture,this.gtaoMaterial.uniforms.tDepth.value=this.depthTexture,this.pdMaterial.defines.NORMAL_VECTOR_TYPE=i,this.pdMaterial.defines.DEPTH_SWIZZLING=r,this.pdMaterial.uniforms.tNormal.value=this.normalTexture,this.pdMaterial.uniforms.tDepth.value=this.depthTexture,this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture}setSceneClipBox(e){e?(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX!==1,this.gtaoMaterial.defines.SCENE_CLIP_BOX=1,this.gtaoMaterial.uniforms.sceneBoxMin.value.copy(e.min),this.gtaoMaterial.uniforms.sceneBoxMax.value.copy(e.max)):(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX===0,this.gtaoMaterial.defines.SCENE_CLIP_BOX=0)}updateGtaoMaterial(e){e.radius!==void 0&&(this.gtaoMaterial.uniforms.radius.value=e.radius),e.distanceExponent!==void 0&&(this.gtaoMaterial.uniforms.distanceExponent.value=e.distanceExponent),e.thickness!==void 0&&(this.gtaoMaterial.uniforms.thickness.value=e.thickness),e.distanceFallOff!==void 0&&(this.gtaoMaterial.uniforms.distanceFallOff.value=e.distanceFallOff,this.gtaoMaterial.needsUpdate=!0),e.scale!==void 0&&(this.gtaoMaterial.uniforms.scale.value=e.scale),e.samples!==void 0&&e.samples!==this.gtaoMaterial.defines.SAMPLES&&(this.gtaoMaterial.defines.SAMPLES=e.samples,this.gtaoMaterial.needsUpdate=!0),e.screenSpaceRadius!==void 0&&(e.screenSpaceRadius?1:0)!==this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS&&(this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS=e.screenSpaceRadius?1:0,this.gtaoMaterial.needsUpdate=!0)}updatePdMaterial(e){let t=!1;e.lumaPhi!==void 0&&(this.pdMaterial.uniforms.lumaPhi.value=e.lumaPhi),e.depthPhi!==void 0&&(this.pdMaterial.uniforms.depthPhi.value=e.depthPhi),e.normalPhi!==void 0&&(this.pdMaterial.uniforms.normalPhi.value=e.normalPhi),e.radius!==void 0&&e.radius!==this.radius&&(this.pdMaterial.uniforms.radius.value=e.radius),e.radiusExponent!==void 0&&e.radiusExponent!==this.pdRadiusExponent&&(this.pdRadiusExponent=e.radiusExponent,t=!0),e.rings!==void 0&&e.rings!==this.pdRings&&(this.pdRings=e.rings,t=!0),e.samples!==void 0&&e.samples!==this.pdSamples&&(this.pdSamples=e.samples,t=!0),t&&(this.pdMaterial.defines.SAMPLES=this.pdSamples,this.pdMaterial.defines.SAMPLE_VECTORS=Dm(this.pdSamples,this.pdRings,this.pdRadiusExponent),this.pdMaterial.needsUpdate=!0)}render(e,t,i){switch(this._renderGBuffer&&(this._overrideVisibility(),this._renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this._restoreVisibility()),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.gtaoMaterial.uniforms.cameraWorldMatrix.value.copy(this.camera.matrixWorld),this._renderPass(e,this.gtaoMaterial,this.gtaoRenderTarget,16777215,1),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this._renderPass(e,this.pdMaterial,this.pdRenderTarget,16777215,1),this.output){case Ri.OUTPUT.Off:break;case Ri.OUTPUT.Diffuse:this.copyMaterial.uniforms.tDiffuse.value=i.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.AO:this.copyMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Denoise:this.copyMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Depth:this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this._renderPass(e,this.depthRenderMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=i.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.blendMaterial.uniforms.intensity.value=this.blendIntensity,this.blendMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this._renderPass(e,this.blendMaterial,this.renderToScreen?null:t);break;default:console.warn("THREE.GTAOPass: Unknown output type.")}}_renderPass(e,t,i,r,s){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this._fsQuad.material=t,this._fsQuad.render(e),e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_renderOverride(e,t,i,r,s){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_overrideVisibility(){const e=this.scene,t=this._visibilityCache;e.traverse(function(i){(i.isPoints||i.isLine||i.isLine2)&&i.visible&&(i.visible=!1,t.push(i))})}_restoreVisibility(){const e=this._visibilityCache;for(let t=0;t<e.length;t++)e[t].visible=!0;e.length=0}_generateNoise(e=64){const t=new jw,i=e*e*4,r=new Uint8Array(i);for(let a=0;a<e;a++)for(let o=0;o<e;o++){const l=a,c=o;r[(a*e+o)*4]=(t.noise(l,c)*.5+.5)*255,r[(a*e+o)*4+1]=(t.noise(l+e,c)*.5+.5)*255,r[(a*e+o)*4+2]=(t.noise(l,c+e)*.5+.5)*255,r[(a*e+o)*4+3]=(t.noise(l+e,c+e)*.5+.5)*255}const s=new cl(r,e,e,li,qn);return s.wrapS=Lr,s.wrapT=Lr,s.needsUpdate=!0,s}}Ri.OUTPUT={Off:-1,Default:0,Diffuse:1,Depth:2,Normal:3,AO:4,Denoise:5};const mo={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
|
4883
|
+
}`};function Dm(n,e,t){const i=Xw(n,e,t);let r="vec3[SAMPLES](";for(let s=0;s<n;s++){const a=i[s];r+=`vec3(${a.x}, ${a.y}, ${a.z})${s<n-1?",":")"}`}return r}function Xw(n,e,t){const i=[];for(let r=0;r<n;r++){const s=2*Math.PI*e*r/n,a=Math.pow(r/(n-1),t);i.push(new X(Math.cos(s),Math.sin(s),a))}return i}class jw{constructor(e=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let t=0;t<256;t++)this.p[t]=Math.floor(e.random()*256);this.perm=[];for(let t=0;t<512;t++)this.perm[t]=this.p[t&255];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}noise(e,t){let i,r,s;const a=.5*(Math.sqrt(3)-1),o=(e+t)*a,l=Math.floor(e+o),c=Math.floor(t+o),d=(3-Math.sqrt(3))/6,f=(l+c)*d,h=l-f,p=c-f,m=e-h,x=t-p;let g,v;m>x?(g=1,v=0):(g=0,v=1);const y=m-g+d,w=x-v+d,b=m-1+2*d,E=x-1+2*d,S=l&255,A=c&255,_=this.perm[S+this.perm[A]]%12,T=this.perm[S+g+this.perm[A+v]]%12,D=this.perm[S+1+this.perm[A+1]]%12;let L=.5-m*m-x*x;L<0?i=0:(L*=L,i=L*L*this._dot(this.grad3[_],m,x));let F=.5-y*y-w*w;F<0?r=0:(F*=F,r=F*F*this._dot(this.grad3[T],y,w));let k=.5-b*b-E*E;return k<0?s=0:(k*=k,s=k*k*this._dot(this.grad3[D],b,E)),70*(i+r+s)}noise3d(e,t,i){let r,s,a,o;const c=(e+t+i)*.3333333333333333,d=Math.floor(e+c),f=Math.floor(t+c),h=Math.floor(i+c),p=1/6,m=(d+f+h)*p,x=d-m,g=f-m,v=h-m,y=e-x,w=t-g,b=i-v;let E,S,A,_,T,D;y>=w?w>=b?(E=1,S=0,A=0,_=1,T=1,D=0):y>=b?(E=1,S=0,A=0,_=1,T=0,D=1):(E=0,S=0,A=1,_=1,T=0,D=1):w<b?(E=0,S=0,A=1,_=0,T=1,D=1):y<b?(E=0,S=1,A=0,_=0,T=1,D=1):(E=0,S=1,A=0,_=1,T=1,D=0);const L=y-E+p,F=w-S+p,k=b-A+p,U=y-_+2*p,N=w-T+2*p,R=b-D+2*p,z=y-1+3*p,q=w-1+3*p,Y=b-1+3*p,te=d&255,le=f&255,B=h&255,ee=this.perm[te+this.perm[le+this.perm[B]]]%12,de=this.perm[te+E+this.perm[le+S+this.perm[B+A]]]%12,ve=this.perm[te+_+this.perm[le+T+this.perm[B+D]]]%12,G=this.perm[te+1+this.perm[le+1+this.perm[B+1]]]%12;let ie=.6-y*y-w*w-b*b;ie<0?r=0:(ie*=ie,r=ie*ie*this._dot3(this.grad3[ee],y,w,b));let Z=.6-L*L-F*F-k*k;Z<0?s=0:(Z*=Z,s=Z*Z*this._dot3(this.grad3[de],L,F,k));let ce=.6-U*U-N*N-R*R;ce<0?a=0:(ce*=ce,a=ce*ce*this._dot3(this.grad3[ve],U,N,R));let pe=.6-z*z-q*q-Y*Y;return pe<0?o=0:(pe*=pe,o=pe*pe*this._dot3(this.grad3[G],z,q,Y)),32*(r+s+a+o)}noise4d(e,t,i,r){const s=this.grad4,a=this.simplex,o=this.perm,l=(Math.sqrt(5)-1)/4,c=(5-Math.sqrt(5))/20;let d,f,h,p,m;const x=(e+t+i+r)*l,g=Math.floor(e+x),v=Math.floor(t+x),y=Math.floor(i+x),w=Math.floor(r+x),b=(g+v+y+w)*c,E=g-b,S=v-b,A=y-b,_=w-b,T=e-E,D=t-S,L=i-A,F=r-_,k=T>D?32:0,U=T>L?16:0,N=D>L?8:0,R=T>F?4:0,z=D>F?2:0,q=L>F?1:0,Y=k+U+N+R+z+q,te=a[Y][0]>=3?1:0,le=a[Y][1]>=3?1:0,B=a[Y][2]>=3?1:0,ee=a[Y][3]>=3?1:0,de=a[Y][0]>=2?1:0,ve=a[Y][1]>=2?1:0,G=a[Y][2]>=2?1:0,ie=a[Y][3]>=2?1:0,Z=a[Y][0]>=1?1:0,ce=a[Y][1]>=1?1:0,pe=a[Y][2]>=1?1:0,Se=a[Y][3]>=1?1:0,ze=T-te+c,Ue=D-le+c,Pe=L-B+c,ke=F-ee+c,Ie=T-de+2*c,We=D-ve+2*c,Oe=L-G+2*c,He=F-ie+2*c,V=T-Z+3*c,je=D-ce+3*c,Ve=L-pe+3*c,Xe=F-Se+3*c,ye=T-1+4*c,Ce=D-1+4*c,C=L-1+4*c,M=F-1+4*c,H=g&255,re=v&255,ue=y&255,be=w&255,ge=o[H+o[re+o[ue+o[be]]]]%32,ae=o[H+te+o[re+le+o[ue+B+o[be+ee]]]]%32,fe=o[H+de+o[re+ve+o[ue+G+o[be+ie]]]]%32,Re=o[H+Z+o[re+ce+o[ue+pe+o[be+Se]]]]%32,Le=o[H+1+o[re+1+o[ue+1+o[be+1]]]]%32;let Ee=.6-T*T-D*D-L*L-F*F;Ee<0?d=0:(Ee*=Ee,d=Ee*Ee*this._dot4(s[ge],T,D,L,F));let De=.6-ze*ze-Ue*Ue-Pe*Pe-ke*ke;De<0?f=0:(De*=De,f=De*De*this._dot4(s[ae],ze,Ue,Pe,ke));let et=.6-Ie*Ie-We*We-Oe*Oe-He*He;et<0?h=0:(et*=et,h=et*et*this._dot4(s[fe],Ie,We,Oe,He));let Ye=.6-V*V-je*je-Ve*Ve-Xe*Xe;Ye<0?p=0:(Ye*=Ye,p=Ye*Ye*this._dot4(s[Re],V,je,Ve,Xe));let ht=.6-ye*ye-Ce*Ce-C*C-M*M;return ht<0?m=0:(ht*=ht,m=ht*ht*this._dot4(s[Le],ye,Ce,C,M)),27*(d+f+h+p+m)}_dot(e,t,i){return e[0]*t+e[1]*i}_dot3(e,t,i,r){return e[0]*t+e[1]*i+e[2]*r}_dot4(e,t,i,r,s){return e[0]*t+e[1]*i+e[2]*r+e[3]*s}}class Ri extends Is{constructor(e,t,i=512,r=512,s,a,o){super(),this.width=i,this.height=r,this.clear=!0,this.camera=t,this.scene=e,this.output=0,this._renderGBuffer=!0,this._visibilityCache=[],this.blendIntensity=1,this.pdRings=2,this.pdRadiusExponent=2,this.pdSamples=16,this.gtaoNoiseTexture=Gw(),this.pdNoiseTexture=this._generateNoise(),this.gtaoRenderTarget=new ni(this.width,this.height,{type:Fn}),this.pdRenderTarget=this.gtaoRenderTarget.clone(),this.gtaoMaterial=new _n({defines:Object.assign({},ho.defines),uniforms:Di.clone(ho.uniforms),vertexShader:ho.vertexShader,fragmentShader:ho.fragmentShader,blending:Mn,depthTest:!1,depthWrite:!1}),this.gtaoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.gtaoMaterial.uniforms.tNoise.value=this.gtaoNoiseTexture,this.gtaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.normalMaterial=new gb,this.normalMaterial.blending=Mn,this.pdMaterial=new _n({defines:Object.assign({},po.defines),uniforms:Di.clone(po.uniforms),vertexShader:po.vertexShader,fragmentShader:po.fragmentShader,depthTest:!1,depthWrite:!1}),this.pdMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.pdMaterial.uniforms.tNoise.value=this.pdNoiseTexture,this.pdMaterial.uniforms.resolution.value.set(this.width,this.height),this.pdMaterial.uniforms.lumaPhi.value=10,this.pdMaterial.uniforms.depthPhi.value=2,this.pdMaterial.uniforms.normalPhi.value=3,this.pdMaterial.uniforms.radius.value=8,this.depthRenderMaterial=new _n({defines:Object.assign({},fo.defines),uniforms:Di.clone(fo.uniforms),vertexShader:fo.vertexShader,fragmentShader:fo.fragmentShader,blending:Mn}),this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new _n({uniforms:Di.clone(Do.uniforms),vertexShader:Do.vertexShader,fragmentShader:Do.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:yc,blendDst:Js,blendEquation:gi,blendSrcAlpha:bc,blendDstAlpha:Js,blendEquationAlpha:gi}),this.blendMaterial=new _n({uniforms:Di.clone(lc.uniforms),vertexShader:lc.vertexShader,fragmentShader:lc.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blending:Qp,blendSrc:yc,blendDst:Js,blendEquation:gi,blendSrcAlpha:bc,blendDstAlpha:Js,blendEquationAlpha:gi}),this._fsQuad=new Pd(null),this._originalClearColor=new tt,this.setGBuffer(s?s.depthTexture:void 0,s?s.normalTexture:void 0),a!==void 0&&this.updateGtaoMaterial(a),o!==void 0&&this.updatePdMaterial(o)}setSize(e,t){this.width=e,this.height=t,this.gtaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.pdRenderTarget.setSize(e,t),this.gtaoMaterial.uniforms.resolution.value.set(e,t),this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.pdMaterial.uniforms.resolution.value.set(e,t),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse)}dispose(){this.gtaoNoiseTexture.dispose(),this.pdNoiseTexture.dispose(),this.normalRenderTarget.dispose(),this.gtaoRenderTarget.dispose(),this.pdRenderTarget.dispose(),this.normalMaterial.dispose(),this.pdMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this._fsQuad.dispose()}get gtaoMap(){return this.pdRenderTarget.texture}setGBuffer(e,t){e!==void 0?(this.depthTexture=e,this.normalTexture=t,this._renderGBuffer=!1):(this.depthTexture=new Nr,this.depthTexture.format=cr,this.depthTexture.type=Ts,this.normalRenderTarget=new ni(this.width,this.height,{minFilter:xn,magFilter:xn,type:Fn,depthTexture:this.depthTexture}),this.normalTexture=this.normalRenderTarget.texture,this._renderGBuffer=!0);const i=this.normalTexture?1:0,r=this.depthTexture===this.normalTexture?"w":"x";this.gtaoMaterial.defines.NORMAL_VECTOR_TYPE=i,this.gtaoMaterial.defines.DEPTH_SWIZZLING=r,this.gtaoMaterial.uniforms.tNormal.value=this.normalTexture,this.gtaoMaterial.uniforms.tDepth.value=this.depthTexture,this.pdMaterial.defines.NORMAL_VECTOR_TYPE=i,this.pdMaterial.defines.DEPTH_SWIZZLING=r,this.pdMaterial.uniforms.tNormal.value=this.normalTexture,this.pdMaterial.uniforms.tDepth.value=this.depthTexture,this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture}setSceneClipBox(e){e?(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX!==1,this.gtaoMaterial.defines.SCENE_CLIP_BOX=1,this.gtaoMaterial.uniforms.sceneBoxMin.value.copy(e.min),this.gtaoMaterial.uniforms.sceneBoxMax.value.copy(e.max)):(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX===0,this.gtaoMaterial.defines.SCENE_CLIP_BOX=0)}updateGtaoMaterial(e){e.radius!==void 0&&(this.gtaoMaterial.uniforms.radius.value=e.radius),e.distanceExponent!==void 0&&(this.gtaoMaterial.uniforms.distanceExponent.value=e.distanceExponent),e.thickness!==void 0&&(this.gtaoMaterial.uniforms.thickness.value=e.thickness),e.distanceFallOff!==void 0&&(this.gtaoMaterial.uniforms.distanceFallOff.value=e.distanceFallOff,this.gtaoMaterial.needsUpdate=!0),e.scale!==void 0&&(this.gtaoMaterial.uniforms.scale.value=e.scale),e.samples!==void 0&&e.samples!==this.gtaoMaterial.defines.SAMPLES&&(this.gtaoMaterial.defines.SAMPLES=e.samples,this.gtaoMaterial.needsUpdate=!0),e.screenSpaceRadius!==void 0&&(e.screenSpaceRadius?1:0)!==this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS&&(this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS=e.screenSpaceRadius?1:0,this.gtaoMaterial.needsUpdate=!0)}updatePdMaterial(e){let t=!1;e.lumaPhi!==void 0&&(this.pdMaterial.uniforms.lumaPhi.value=e.lumaPhi),e.depthPhi!==void 0&&(this.pdMaterial.uniforms.depthPhi.value=e.depthPhi),e.normalPhi!==void 0&&(this.pdMaterial.uniforms.normalPhi.value=e.normalPhi),e.radius!==void 0&&e.radius!==this.radius&&(this.pdMaterial.uniforms.radius.value=e.radius),e.radiusExponent!==void 0&&e.radiusExponent!==this.pdRadiusExponent&&(this.pdRadiusExponent=e.radiusExponent,t=!0),e.rings!==void 0&&e.rings!==this.pdRings&&(this.pdRings=e.rings,t=!0),e.samples!==void 0&&e.samples!==this.pdSamples&&(this.pdSamples=e.samples,t=!0),t&&(this.pdMaterial.defines.SAMPLES=this.pdSamples,this.pdMaterial.defines.SAMPLE_VECTORS=Dm(this.pdSamples,this.pdRings,this.pdRadiusExponent),this.pdMaterial.needsUpdate=!0)}render(e,t,i){switch(this._renderGBuffer&&(this._overrideVisibility(),this._renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this._restoreVisibility()),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.gtaoMaterial.uniforms.cameraWorldMatrix.value.copy(this.camera.matrixWorld),this._renderPass(e,this.gtaoMaterial,this.gtaoRenderTarget,16777215,1),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this._renderPass(e,this.pdMaterial,this.pdRenderTarget,16777215,1),this.output){case Ri.OUTPUT.Off:break;case Ri.OUTPUT.Diffuse:this.copyMaterial.uniforms.tDiffuse.value=i.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.AO:this.copyMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Denoise:this.copyMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Depth:this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this._renderPass(e,this.depthRenderMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Ri.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=i.texture,this.copyMaterial.blending=Mn,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.blendMaterial.uniforms.intensity.value=this.blendIntensity,this.blendMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this._renderPass(e,this.blendMaterial,this.renderToScreen?null:t);break;default:console.warn("THREE.GTAOPass: Unknown output type.")}}_renderPass(e,t,i,r,s){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this._fsQuad.material=t,this._fsQuad.render(e),e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_renderOverride(e,t,i,r,s){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_overrideVisibility(){const e=this.scene,t=this._visibilityCache;e.traverse(function(i){(i.isPoints||i.isLine||i.isLine2)&&i.visible&&(i.visible=!1,t.push(i))})}_restoreVisibility(){const e=this._visibilityCache;for(let t=0;t<e.length;t++)e[t].visible=!0;e.length=0}_generateNoise(e=64){const t=new jw,i=e*e*4,r=new Uint8Array(i);for(let a=0;a<e;a++)for(let o=0;o<e;o++){const l=a,c=o;r[(a*e+o)*4]=(t.noise(l,c)*.5+.5)*255,r[(a*e+o)*4+1]=(t.noise(l+e,c)*.5+.5)*255,r[(a*e+o)*4+2]=(t.noise(l,c+e)*.5+.5)*255,r[(a*e+o)*4+3]=(t.noise(l+e,c+e)*.5+.5)*255}const s=new cl(r,e,e,li,qn);return s.wrapS=Lr,s.wrapT=Lr,s.needsUpdate=!0,s}}Ri.OUTPUT={Off:-1,Default:0,Diffuse:1,Depth:2,Normal:3,AO:4,Denoise:5};const mo={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
|
4884
4884
|
precision highp float;
|
|
4885
4885
|
|
|
4886
4886
|
uniform mat4 modelViewMatrix;
|
|
@@ -4951,11 +4951,11 @@ void main() {
|
|
|
4951
4951
|
|
|
4952
4952
|
#endif
|
|
4953
4953
|
|
|
4954
|
-
}`};class qw extends Is{constructor(){super(),this.isOutputPass=!0,this.uniforms=Di.clone(mo.uniforms),this.material=new ym({name:mo.name,uniforms:this.uniforms,vertexShader:mo.vertexShader,fragmentShader:mo.fragmentShader}),this._fsQuad=new Pd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,i){this.uniforms.tDiffuse.value=i.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},At.getTransfer(this._outputColorSpace)===Ut&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===rd?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===sd?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===ad?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===od?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===cd?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===xa?this.material.defines.NEUTRAL_TONE_MAPPING="":this._toneMapping===ld&&(this.material.defines.CUSTOM_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class Yw extends rn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new it(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const os=new X,Df=new Lt,Lf=new Lt,If=new X,Nf=new X;class Kw{constructor(e={}){const t=this;let i,r,s,a;const o={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:i,height:r}},this.render=function(g,x){g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),x.parent===null&&x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),Df.copy(x.matrixWorldInverse),Lf.multiplyMatrices(x.projectionMatrix,Df),d(g,g,x),this.sortObjects&&p(g)},this.setSize=function(g,x){i=g,r=x,s=i/2,a=r/2,l.style.width=g+"px",l.style.height=x+"px"};function c(g){g.isCSS2DObject&&(g.element.style.display="none");for(let x=0,m=g.children.length;x<m;x++)c(g.children[x])}function d(g,x,m){if(g.visible===!1){c(g);return}if(g.isCSS2DObject){os.setFromMatrixPosition(g.matrixWorld),os.applyMatrix4(Lf);const v=os.z>=-1&&os.z<=1&&g.layers.test(m.layers)===!0,y=g.element;y.style.display=v===!0?"":"none",v===!0&&(g.onBeforeRender(t,x,m),y.style.transform="translate("+-100*g.center.x+"%,"+-100*g.center.y+"%)translate("+(os.x*s+s)+"px,"+(-os.y*a+a)+"px)",y.parentNode!==l&&l.appendChild(y),g.onAfterRender(t,x,m));const w={distanceToCameraSquared:f(m,g)};o.objects.set(g,w)}for(let v=0,y=g.children.length;v<y;v++)d(g.children[v],x,m)}function f(g,x){return If.setFromMatrixPosition(g.matrixWorld),Nf.setFromMatrixPosition(x.matrixWorld),If.distanceToSquared(Nf)}function h(g){const x=[];return g.traverseVisible(function(m){m.isCSS2DObject&&x.push(m)}),x}function p(g){const x=h(g).sort(function(v,y){if(v.renderOrder!==y.renderOrder)return y.renderOrder-v.renderOrder;const w=o.objects.get(v).distanceToCameraSquared,b=o.objects.get(y).distanceToCameraSquared;return w-b}),m=x.length;for(let v=0,y=x.length;v<y;v++)x[v].element.style.zIndex=m-v}}}class Rd extends Ad{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setColors(i),this}setFromPoints(e){const t=e.length-1,i=new Float32Array(6*t);for(let r=0;r<t;r++)i[6*r]=e[r].x,i[6*r+1]=e[r].y,i[6*r+2]=e[r].z||0,i[6*r+3]=e[r+1].x,i[6*r+4]=e[r+1].y,i[6*r+5]=e[r+1].z||0;return super.setPositions(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Lm extends Cd{constructor(e=new Rd,t=new Sa({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Uf={type:"change"},Dd={type:"start"},Im={type:"end"},go=new ba,Ff=new sr,Zw=Math.cos(70*um.DEG2RAD),vn=new X,Hn=2*Math.PI,Bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},cc=1e-6;class $w extends Fb{constructor(e,t=null){super(e,t),this.state=Bt.NONE,this.target=new X,this.cursor=new X,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:xs.ROTATE,MIDDLE:xs.DOLLY,RIGHT:xs.PAN},this.touches={ONE:hs.ROTATE,TWO:hs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new X,this._lastQuaternion=new xi,this._lastTargetPosition=new X,this._quat=new xi().setFromUnitVectors(e.up,new X(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new $h,this._sphericalDelta=new $h,this._scale=1,this._panOffset=new X,this._rotateStart=new it,this._rotateEnd=new it,this._rotateDelta=new it,this._panStart=new it,this._panEnd=new it,this._panDelta=new it,this._dollyStart=new it,this._dollyEnd=new it,this._dollyDelta=new it,this._dollyDirection=new X,this._mouse=new it,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Qw.bind(this),this._onPointerDown=Jw.bind(this),this._onPointerUp=eE.bind(this),this._onContextMenu=oE.bind(this),this._onMouseWheel=iE.bind(this),this._onKeyDown=rE.bind(this),this._onTouchStart=sE.bind(this),this._onTouchMove=aE.bind(this),this._onMouseDown=tE.bind(this),this._onMouseMove=nE.bind(this),this._interceptControlDown=lE.bind(this),this._interceptControlUp=cE.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Uf),this.update(),this.state=Bt.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;vn.copy(t).sub(this.target),vn.applyQuaternion(this._quat),this._spherical.setFromVector3(vn),this.autoRotate&&this.state===Bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=Hn:i>Math.PI&&(i-=Hn),r<-Math.PI?r+=Hn:r>Math.PI&&(r-=Hn),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(vn.setFromSpherical(this._spherical),vn.applyQuaternion(this._quatInverse),t.copy(this.target).add(vn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=vn.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new X(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new X(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=vn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(go.origin.copy(this.object.position),go.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(go.direction))<Zw?this.object.lookAt(this.target):(Ff.setFromNormalAndCoplanarPoint(this.object.up,this.target),go.intersectPlane(Ff,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>cc||8*(1-this._lastQuaternion.dot(this.object.quaternion))>cc||this._lastTargetPosition.distanceToSquared(this.target)>cc?(this.dispatchEvent(Uf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Hn/60*this.autoRotateSpeed*e:Hn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){vn.setFromMatrixColumn(t,0),vn.multiplyScalar(-e),this._panOffset.add(vn)}_panUp(e,t){this.screenSpacePanning===!0?vn.setFromMatrixColumn(t,1):(vn.setFromMatrixColumn(t,0),vn.crossVectors(this.object.up,vn)),vn.multiplyScalar(e),this._panOffset.add(vn)}_pan(e,t){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;vn.copy(r).sub(this.target);let s=vn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,a=i.width,o=i.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new it,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function Jw(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function Qw(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function eE(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Im),this.state=Bt.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function tE(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case xs.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=Bt.DOLLY;break;case xs.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Bt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Bt.ROTATE}break;case xs.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Bt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Bt.PAN}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(Dd)}function nE(n){switch(this.state){case Bt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case Bt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case Bt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function iE(n){this.enabled===!1||this.enableZoom===!1||this.state!==Bt.NONE||(n.preventDefault(),this.dispatchEvent(Dd),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Im))}function rE(n){this.enabled!==!1&&this._handleKeyDown(n)}function sE(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case hs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=Bt.TOUCH_ROTATE;break;case hs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=Bt.TOUCH_PAN;break;default:this.state=Bt.NONE}break;case 2:switch(this.touches.TWO){case hs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=Bt.TOUCH_DOLLY_PAN;break;case hs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=Bt.TOUCH_DOLLY_ROTATE;break;default:this.state=Bt.NONE}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(Dd)}function aE(n){switch(this._trackPointer(n),this.state){case Bt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case Bt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case Bt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case Bt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=Bt.NONE}}function oE(n){this.enabled!==!1&&n.preventDefault()}function lE(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function cE(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class uE extends Mb{constructor(e){super(e),this.type=Fn}parse(e){const a=function(_,T){switch(_){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(T||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(T||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(T||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(T||""))}},f=function(_,T,D){T=T||1024;let F=_.pos,B=-1,U=0,N="",R=String.fromCharCode.apply(null,new Uint16Array(_.subarray(F,F+128)));for(;0>(B=R.indexOf(`
|
|
4955
|
-
`))&&U<T&&F<_.byteLength;)N+=R,U+=R.length,F+=128,R=String.fromCharCode.apply(null,new Uint16Array(_.subarray(F,F+128)));return-1<
|
|
4954
|
+
}`};class qw extends Is{constructor(){super(),this.isOutputPass=!0,this.uniforms=Di.clone(mo.uniforms),this.material=new ym({name:mo.name,uniforms:this.uniforms,vertexShader:mo.vertexShader,fragmentShader:mo.fragmentShader}),this._fsQuad=new Pd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,i){this.uniforms.tDiffuse.value=i.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},At.getTransfer(this._outputColorSpace)===Ut&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===rd?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===sd?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===ad?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===od?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===cd?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===xa?this.material.defines.NEUTRAL_TONE_MAPPING="":this._toneMapping===ld&&(this.material.defines.CUSTOM_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class Yw extends rn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new it(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const os=new X,Df=new Lt,Lf=new Lt,If=new X,Nf=new X;class Kw{constructor(e={}){const t=this;let i,r,s,a;const o={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:i,height:r}},this.render=function(m,x){m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),x.parent===null&&x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),Df.copy(x.matrixWorldInverse),Lf.multiplyMatrices(x.projectionMatrix,Df),d(m,m,x),this.sortObjects&&p(m)},this.setSize=function(m,x){i=m,r=x,s=i/2,a=r/2,l.style.width=m+"px",l.style.height=x+"px"};function c(m){m.isCSS2DObject&&(m.element.style.display="none");for(let x=0,g=m.children.length;x<g;x++)c(m.children[x])}function d(m,x,g){if(m.visible===!1){c(m);return}if(m.isCSS2DObject){os.setFromMatrixPosition(m.matrixWorld),os.applyMatrix4(Lf);const v=os.z>=-1&&os.z<=1&&m.layers.test(g.layers)===!0,y=m.element;y.style.display=v===!0?"":"none",v===!0&&(m.onBeforeRender(t,x,g),y.style.transform="translate("+-100*m.center.x+"%,"+-100*m.center.y+"%)translate("+(os.x*s+s)+"px,"+(-os.y*a+a)+"px)",y.parentNode!==l&&l.appendChild(y),m.onAfterRender(t,x,g));const w={distanceToCameraSquared:f(g,m)};o.objects.set(m,w)}for(let v=0,y=m.children.length;v<y;v++)d(m.children[v],x,g)}function f(m,x){return If.setFromMatrixPosition(m.matrixWorld),Nf.setFromMatrixPosition(x.matrixWorld),If.distanceToSquared(Nf)}function h(m){const x=[];return m.traverseVisible(function(g){g.isCSS2DObject&&x.push(g)}),x}function p(m){const x=h(m).sort(function(v,y){if(v.renderOrder!==y.renderOrder)return y.renderOrder-v.renderOrder;const w=o.objects.get(v).distanceToCameraSquared,b=o.objects.get(y).distanceToCameraSquared;return w-b}),g=x.length;for(let v=0,y=x.length;v<y;v++)x[v].element.style.zIndex=g-v}}}class Rd extends Ad{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setColors(i),this}setFromPoints(e){const t=e.length-1,i=new Float32Array(6*t);for(let r=0;r<t;r++)i[6*r]=e[r].x,i[6*r+1]=e[r].y,i[6*r+2]=e[r].z||0,i[6*r+3]=e[r+1].x,i[6*r+4]=e[r+1].y,i[6*r+5]=e[r+1].z||0;return super.setPositions(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Lm extends Cd{constructor(e=new Rd,t=new Sa({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Uf={type:"change"},Dd={type:"start"},Im={type:"end"},go=new ba,Ff=new sr,Zw=Math.cos(70*um.DEG2RAD),vn=new X,Hn=2*Math.PI,Bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},cc=1e-6;class $w extends Fb{constructor(e,t=null){super(e,t),this.state=Bt.NONE,this.target=new X,this.cursor=new X,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:xs.ROTATE,MIDDLE:xs.DOLLY,RIGHT:xs.PAN},this.touches={ONE:hs.ROTATE,TWO:hs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new X,this._lastQuaternion=new xi,this._lastTargetPosition=new X,this._quat=new xi().setFromUnitVectors(e.up,new X(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new $h,this._sphericalDelta=new $h,this._scale=1,this._panOffset=new X,this._rotateStart=new it,this._rotateEnd=new it,this._rotateDelta=new it,this._panStart=new it,this._panEnd=new it,this._panDelta=new it,this._dollyStart=new it,this._dollyEnd=new it,this._dollyDelta=new it,this._dollyDirection=new X,this._mouse=new it,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Qw.bind(this),this._onPointerDown=Jw.bind(this),this._onPointerUp=eE.bind(this),this._onContextMenu=oE.bind(this),this._onMouseWheel=iE.bind(this),this._onKeyDown=rE.bind(this),this._onTouchStart=sE.bind(this),this._onTouchMove=aE.bind(this),this._onMouseDown=tE.bind(this),this._onMouseMove=nE.bind(this),this._interceptControlDown=lE.bind(this),this._interceptControlUp=cE.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Uf),this.update(),this.state=Bt.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;vn.copy(t).sub(this.target),vn.applyQuaternion(this._quat),this._spherical.setFromVector3(vn),this.autoRotate&&this.state===Bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=Hn:i>Math.PI&&(i-=Hn),r<-Math.PI?r+=Hn:r>Math.PI&&(r-=Hn),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(vn.setFromSpherical(this._spherical),vn.applyQuaternion(this._quatInverse),t.copy(this.target).add(vn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=vn.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new X(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new X(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=vn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(go.origin.copy(this.object.position),go.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(go.direction))<Zw?this.object.lookAt(this.target):(Ff.setFromNormalAndCoplanarPoint(this.object.up,this.target),go.intersectPlane(Ff,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>cc||8*(1-this._lastQuaternion.dot(this.object.quaternion))>cc||this._lastTargetPosition.distanceToSquared(this.target)>cc?(this.dispatchEvent(Uf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Hn/60*this.autoRotateSpeed*e:Hn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){vn.setFromMatrixColumn(t,0),vn.multiplyScalar(-e),this._panOffset.add(vn)}_panUp(e,t){this.screenSpacePanning===!0?vn.setFromMatrixColumn(t,1):(vn.setFromMatrixColumn(t,0),vn.crossVectors(this.object.up,vn)),vn.multiplyScalar(e),this._panOffset.add(vn)}_pan(e,t){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;vn.copy(r).sub(this.target);let s=vn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,a=i.width,o=i.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(Hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new it,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function Jw(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function Qw(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function eE(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Im),this.state=Bt.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function tE(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case xs.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=Bt.DOLLY;break;case xs.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Bt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Bt.ROTATE}break;case xs.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=Bt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=Bt.PAN}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(Dd)}function nE(n){switch(this.state){case Bt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case Bt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case Bt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function iE(n){this.enabled===!1||this.enableZoom===!1||this.state!==Bt.NONE||(n.preventDefault(),this.dispatchEvent(Dd),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Im))}function rE(n){this.enabled!==!1&&this._handleKeyDown(n)}function sE(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case hs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=Bt.TOUCH_ROTATE;break;case hs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=Bt.TOUCH_PAN;break;default:this.state=Bt.NONE}break;case 2:switch(this.touches.TWO){case hs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=Bt.TOUCH_DOLLY_PAN;break;case hs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=Bt.TOUCH_DOLLY_ROTATE;break;default:this.state=Bt.NONE}break;default:this.state=Bt.NONE}this.state!==Bt.NONE&&this.dispatchEvent(Dd)}function aE(n){switch(this._trackPointer(n),this.state){case Bt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case Bt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case Bt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case Bt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=Bt.NONE}}function oE(n){this.enabled!==!1&&n.preventDefault()}function lE(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function cE(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class uE extends Mb{constructor(e){super(e),this.type=Fn}parse(e){const a=function(_,T){switch(_){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(T||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(T||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(T||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(T||""))}},f=function(_,T,D){T=T||1024;let F=_.pos,k=-1,U=0,N="",R=String.fromCharCode.apply(null,new Uint16Array(_.subarray(F,F+128)));for(;0>(k=R.indexOf(`
|
|
4955
|
+
`))&&U<T&&F<_.byteLength;)N+=R,U+=R.length,F+=128,R=String.fromCharCode.apply(null,new Uint16Array(_.subarray(F,F+128)));return-1<k?(_.pos+=U+k+1,N+R.slice(0,k)):!1},h=function(_){const T=/^#\?(\S+)/,D=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,F=/^\s*FORMAT=(\S+)\s*$/,k=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,U={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let N,R;for((_.pos>=_.byteLength||!(N=f(_)))&&a(1,"no header found"),(R=N.match(T))||a(3,"bad initial token"),U.valid|=1,U.programtype=R[1],U.string+=N+`
|
|
4956
4956
|
`;N=f(_),N!==!1;){if(U.string+=N+`
|
|
4957
4957
|
`,N.charAt(0)==="#"){U.comments+=N+`
|
|
4958
|
-
`;continue}if((R=N.match(D))&&(U.gamma=parseFloat(R[1])),(R=N.match(L))&&(U.exposure=parseFloat(R[1])),(R=N.match(F))&&(U.valid|=2,U.format=R[1]),(R=N.match(
|
|
4958
|
+
`;continue}if((R=N.match(D))&&(U.gamma=parseFloat(R[1])),(R=N.match(L))&&(U.exposure=parseFloat(R[1])),(R=N.match(F))&&(U.valid|=2,U.format=R[1]),(R=N.match(k))&&(U.valid|=4,U.height=parseInt(R[1],10),U.width=parseInt(R[2],10)),U.valid&2&&U.valid&4)break}return U.valid&2||a(3,"missing format specifier"),U.valid&4||a(3,"missing image size specifier"),U},p=function(_,T,D){const L=T;if(L<8||L>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);L!==(_[2]<<8|_[3])&&a(3,"wrong scanline width");const F=new Uint8Array(4*T*D);F.length||a(4,"unable to allocate buffer space");let k=0,U=0;const N=4*L,R=new Uint8Array(4),z=new Uint8Array(N);let q=D;for(;q>0&&U<_.byteLength;){U+4>_.byteLength&&a(1),R[0]=_[U++],R[1]=_[U++],R[2]=_[U++],R[3]=_[U++],(R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=L)&&a(3,"bad rgbe scanline format");let Y=0,te;for(;Y<N&&U<_.byteLength;){te=_[U++];const B=te>128;if(B&&(te-=128),(te===0||Y+te>N)&&a(3,"bad scanline data"),B){const ee=_[U++];for(let de=0;de<te;de++)z[Y++]=ee}else z.set(_.subarray(U,U+te),Y),Y+=te,U+=te}const le=L;for(let B=0;B<le;B++){let ee=0;F[k]=z[B+ee],ee+=L,F[k+1]=z[B+ee],ee+=L,F[k+2]=z[B+ee],ee+=L,F[k+3]=z[B+ee],k+=4}q--}return F},m=function(_,T,D,L){const F=_[T+3],k=Math.pow(2,F-128)/255;D[L+0]=_[T+0]*k,D[L+1]=_[T+1]*k,D[L+2]=_[T+2]*k,D[L+3]=1},x=function(_,T,D,L){const F=_[T+3],k=Math.pow(2,F-128)/255;D[L+0]=Ua.toHalfFloat(Math.min(_[T+0]*k,65504)),D[L+1]=Ua.toHalfFloat(Math.min(_[T+1]*k,65504)),D[L+2]=Ua.toHalfFloat(Math.min(_[T+2]*k,65504)),D[L+3]=Ua.toHalfFloat(1)},g=new Uint8Array(e);g.pos=0;const v=h(g),y=v.width,w=v.height,b=p(g.subarray(g.pos),y,w);let E,S,A;switch(this.type){case ti:A=b.length/4;const _=new Float32Array(A*4);for(let D=0;D<A;D++)m(b,D*4,_,D*4);E=_,S=ti;break;case Fn:A=b.length/4;const T=new Uint16Array(A*4);for(let D=0;D<A;D++)x(b,D*4,T,D*4);E=T,S=Fn;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:y,height:w,data:E,header:v.string,gamma:v.gamma,exposure:v.exposure,type:S}}setDataType(e){return this.type=e,this}load(e,t,i,r){function s(a,o){switch(a.type){case ti:case Fn:a.colorSpace=oa,a.minFilter=hn,a.magFilter=hn,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,s,i,r)}}var Pi={HUGE_THRESHOLD:1e4,LARGE_THRESHOLD:1e3,SCALE_RATIO_THRESHOLD:100,NEAR_PLANE_FACTOR:{TINY:1e-4,SMALL:.001,NORMAL:.01},FAR_PLANE_FACTOR:{HUGE:100,LARGE:50,NORMAL:20},INITIAL_DISTANCE_MULTIPLIER:4};function Nm(n,e,t,i,r){if(hE(n),e.length===0)return;e.forEach(c=>{n.add(c)});let s=fl(e),a=s.getCenter(new X),o=s.getSize(new X),l=Math.max(o.x,o.y,o.z);if(l/Math.min(o.x||1,o.y||1,o.z||1)>Pi.SCALE_RATIO_THRESHOLD||l>Pi.HUGE_THRESHOLD?(t.near=l*Pi.NEAR_PLANE_FACTOR.TINY,t.far=l*Pi.FAR_PLANE_FACTOR.HUGE):l>Pi.LARGE_THRESHOLD?(t.near=l*Pi.NEAR_PLANE_FACTOR.SMALL,t.far=l*Pi.FAR_PLANE_FACTOR.LARGE):(t.near=Math.max(.01,l*Pi.NEAR_PLANE_FACTOR.NORMAL),t.far=Math.max(2e3,l*Pi.FAR_PLANE_FACTOR.NORMAL)),t.updateProjectionMatrix(),r)i.minDistance=t.near*2,i.maxDistance=t.far*.9;else{let c=l*Pi.INITIAL_DISTANCE_MULTIPLIER;t.position.set(a.x+c*.8,a.y+c,a.z+c*1.2),i.target.copy(a),i.minDistance=t.near*2,i.maxDistance=t.far*.9,i.update()}}function Um(n){if(!n||typeof n!="string")return Nt().warn(`Invalid color input: ${n}, using white`),new tt(16777215);let e=n.trim();if(/^#?[0-9A-Fa-f]{6}$/.test(e))try{let t=e.startsWith("#")?e:`#${e}`;return new tt(t)}catch{return Nt().warn(`Invalid hex color: ${n}, using white`),new tt(16777215)}if(e.includes(",")){let t=e.split(",").map(i=>parseInt(i.trim(),10));if(t.length===3&&t.every(i=>!isNaN(i)&&i>=0&&i<=255))return new tt(t[0]/255,t[1]/255,t[2]/255)}try{return new tt(e.toLowerCase())}catch{return Nt().warn(`Invalid color string: ${n}, using white`),new tt(16777215)}}function Fm(n,e,t="z"){n.forEach(i=>{i.position[t]-=e})}function fl(n){let e=new di;return n.length===0||n.forEach(t=>{t.updateMatrixWorld(!0);let i=new di().setFromObject(t);e.union(i)}),e}var dE=new Set(["floor","grid","label-layer"]);function hE(n){[...n.children].forEach(e=>{dE.has(e.userData.id)||e.userData.source!=="user"&&(e.traverse(t=>{let i=t;if(!i.geometry&&!i.material)return;i.geometry?.dispose();let r=i.material;r&&(Array.isArray(r)?r:[r]).forEach(s=>{for(let a of Object.values(s))a instanceof En&&a.dispose();s.dispose()})}),e.removeFromParent())})}function fE(n){let e=n.clone().normalize(),t=new X(0,0,1),i=new X(0,1,0),r=Math.abs(e.dot(t))>.9?i:t,s=new X().crossVectors(e,r).normalize(),a=new X().crossVectors(s,e).normalize();return{top:e.clone(),bottom:e.clone().negate(),front:a.clone(),back:a.clone().negate(),right:s.clone(),left:s.clone().negate(),iso:a.clone().multiplyScalar(1.2).add(s.clone()).add(e.clone()).normalize()}}function Om(n){let{scene:e,perspective:t,controls:i,onActiveCameraChange:r}=n,s=(n.up??t.up).clone().normalize(),a=fE(s),o=new Fr(-1,1,1,-1,t.near,t.far);o.up.copy(s);let l="perspective",c=t.aspect,d=()=>l==="perspective"?t:o,f=()=>{let m=t.position.distanceTo(i.target)*Math.tan(t.fov*Math.PI/360),x=m*c;o.left=-x,o.right=x,o.top=m,o.bottom=-m,o.near=t.near,o.far=t.far,o.updateProjectionMatrix()},h=m=>{m!==l&&(m==="orthographic"?(o.position.copy(t.position),o.up.copy(t.up),o.lookAt(i.target),f()):t.position.copy(o.position),l=m,i.object=d(),i.update(),r(d()))},p=(m,x=!0)=>{let g=gE(e),v=g.isEmpty()?i.target.clone():g.getCenter(new X),y=g.isEmpty()?new X(1,1,1):g.getSize(new X),w=Math.max(y.x,y.y,y.z)||1,b=t.fov*(Math.PI/180),E=w/(2*Math.tan(b/2))*1.5,S=vE(m,s),A=v.clone().add(S.clone().multiplyScalar(E)),_=d();x?xE(_,i,A,v,()=>{l==="orthographic"&&f()}):(_.position.copy(A),i.target.copy(v),l==="orthographic"&&f(),i.update())};return{getActiveCamera:d,getProjection:()=>l,setProjection:h,toggleProjection:()=>(h(l==="perspective"?"orthographic":"perspective"),l),setView:(m,x=!0)=>{p(a[m],x)},setViewDirection:p,setRotateEnabled:m=>{i.enableRotate=m},isRotateEnabled:()=>i.enableRotate,updateAspect:(m,x)=>{c=x===0?c:m/x,l==="orthographic"&&f()}}}var pE=new Set(["grid","floor","label-layer","measure"]);function mE(n){let e=n;for(;e;){if(typeof e.userData.id=="string"&&pE.has(e.userData.id))return!0;e=e.parent}return!1}function gE(n){let e=[];return n.traverse(t=>{let i=t;t.visible&&!mE(t)&&i.geometry&&e.push(t)}),fl(e)}function vE(n,e){let t=e.clone().normalize(),i=n.clone().normalize();if(Math.abs(i.dot(t))<.9999)return n;let r=Math.abs(t.dot(new X(0,0,1)))>.9?new X(0,1,0):new X(0,0,1),s=new X().crossVectors(t,r).normalize(),a=.5*Math.PI/180;return i.multiplyScalar(Math.cos(a)).add(s.multiplyScalar(Math.sin(a))).normalize()}var _E=n=>1-Math.pow(1-n,3);function xE(n,e,t,i,r,s=250){let a=n.position.clone(),o=e.target.clone(),l=performance.now(),c=()=>{let d=_E(Math.min((performance.now()-l)/s,1));n.position.lerpVectors(a,t,d),e.target.lerpVectors(o,i,d),r(),e.update(),d<1&&requestAnimationFrame(c)};requestAnimationFrame(c)}var bE=`
|
|
4959
4959
|
varying vec3 vWorldPos;
|
|
4960
4960
|
void main() {
|
|
4961
4961
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
@@ -5007,15 +5007,15 @@ void main() {
|
|
|
5007
5007
|
if (alpha < 0.001) discard;
|
|
5008
5008
|
gl_FragColor = vec4(color, alpha);
|
|
5009
5009
|
}
|
|
5010
|
-
`;function zm(n={}){let{cellSize:e=1,majorEvery:t=10,cellColor:i=8947848,majorColor:r=4473924,fadeDistance:s=100,plane:a="y"}=n,o=a==="y"?new it(0,2):a==="z"?new it(0,1):new it(1,2),l=s*2.5,c=new Ds(l,l);a==="y"?c.rotateX(-Math.PI/2):a==="x"&&c.rotateY(Math.PI/2);let d=new _n({vertexShader:bE,fragmentShader:yE,transparent:!0,depthWrite:!1,side:Qn,uniforms:{uAxes:{value:o},uCell:{value:e},uMajor:{value:t},uCellColor:{value:new tt(i)},uMajorColor:{value:new tt(r)},uCenter:{value:new X},uFade:{value:s}}}),f=new an(c,d);f.name="grid",f.userData.id="grid",f.renderOrder=-1;let h=new X;return{object:f,update:p=>{a==="y"?(f.position.set(p.x,0,p.z),h.set(p.x,0,p.z)):a==="z"?(f.position.set(p.x,p.y,0),h.set(p.x,p.y,0)):(f.position.set(0,p.y,p.z),h.set(0,p.y,p.z)),d.uniforms.uCenter.value.copy(h)},setVisible:p=>{f.visible=p},dispose:()=>{c.dispose(),d.dispose()}}}function Bm(n){let{camera:e,domElement:t,controller:i}=n,r=new Iw(e,t);r.setLabels("X","Y","Z");let s=!0,a=128,o=new ul,l=new Fr(-2,2,2,-2,0,4);l.position.set(0,0,2);let c={posX:new X(1,0,0),negX:new X(-1,0,0),posY:new X(0,1,0),negY:new X(0,-1,0),posZ:new X(0,0,1),negZ:new X(0,0,-1)},d=f=>{let h=t.getBoundingClientRect(),p=h.left+t.offsetWidth-a-r.location.right,
|
|
5011
|
-
Δx ${l(L.x)} Δy ${l(L.y)} Δz ${l(L.z)}`,d=s.format??c,f=new ul,h=new it,p=!1,g=[],x=[],m=null,v=null,y=new Ko({color:o,size:8,sizeAttenuation:!1,depthTest:!1}),w=new Ko({color:o,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),b=null,E=D=>{if(!D){b&&(b.visible=!1);return}if(!b){let L=new on;L.setAttribute("position",new sn([0,0,0],3)),b=new Zo(L,w),b.renderOrder=1e3,b.userData.id="measure",b.raycast=()=>{},t.add(b)}b.position.copy(D),b.visible=!0},S=D=>{let L=new on;L.setAttribute("position",new sn([D.x,D.y,D.z],3));let F=new Zo(L,y);return F.renderOrder=999,F.userData.id="measure",F.raycast=()=>{},t.add(F),F},A=()=>{g.length=0,x.forEach(D=>{D.geometry.dispose(),D.removeFromParent()}),x.length=0,m&&(m.geometry.dispose(),m.material.dispose(),m.removeFromParent(),m=null),v?.remove(),v=null},_=()=>{if(g.length!==2)return;let[D,L]=g,F=new Rd;F.setPositions([D.x,D.y,D.z,L.x,L.y,L.z]);let B=new Sa({color:o});B.linewidth=2,B.depthTest=!1,m=new Lm(F,B),m.renderOrder=998,m.userData.id="measure",m.raycast=()=>{},t.add(m);let U=D.clone().add(L).multiplyScalar(.5),N=new X(Math.abs(L.x-D.x),Math.abs(L.y-D.y),Math.abs(L.z-D.z));v=r.addLabel(d(D.distanceTo(L),N),U,s.labelClassName)},T=D=>{let L=e.getBoundingClientRect();h.x=(D.clientX-L.left)/L.width*2-1,h.y=-((D.clientY-L.top)/L.height)*2+1;let F=i();f.setFromCamera(h,F);let B=F.position.length()*PE;f.params.Line.threshold=B,f.params.Points.threshold=B;let U=f.intersectObjects(t.children,!0).filter(N=>N.object.userData.id!=="measure"&&N.object.userData.id!=="grid");return U.length===0?null:Wm(U[0],F,{width:L.width,height:L.height},a)};return{setEnabled:D=>{p=D,D||(A(),E(null))},isEnabled:()=>p,handleClick:D=>{if(!p)return!1;g.length===2&&A();let L=T(D);return L===null||(g.push(L),x.push(S(L)),g.length===2&&_()),!0},handleMove:D=>{p&&E(T(D))},clear:A,dispose:()=>{A(),b&&(b.geometry.dispose(),b.removeFromParent(),b=null),y.dispose(),w.dispose()}}}var $o=new X(0,0,1);function LE(n){let e=Math.abs(n.x),t=Math.abs(n.y),i=Math.abs(n.z);return i>=e&&i>=t?"z":t>=e&&t>=i?"y":"x"}var jm=function(n,e){let t=IE(e||{}),i=t.environment?.sceneUp||$o,r=OE(t),s=GE(t,n);s.up.copy(i);let a=WE(n,t),o=jE(s,n,t),l=Om({scene:r,perspective:s,controls:o,onActiveCameraChange:()=>{},up:i}),c=()=>l.getActiveCamera();kE(r,t);let d=VE(r,t),f=()=>{d&&FE(d,fu(r))};t.floor?.enabled&&HE(r,t);let h=t.grid.enabled?zm({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;h&&r.add(h.object);let p=t.gizmo.enabled?Bm({camera:s,domElement:n,controller:l}):null,g=n.parentElement??n,x=t.measure.enabled?Gm(g,r):null,m=t.measure.enabled&&x?Xm({canvas:n,scene:r,getActiveCamera:c,labelLayer:x,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,v=t.events.enableEventHandlers!==!1?XE(n,r,c,s,o,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},y=5,w=0,b=0,E=ce=>{w=ce.clientX,b=ce.clientY},S=ce=>Math.hypot(ce.clientX-w,ce.clientY-b)>y,A=ce=>{if(!S(ce)){if(m?.handleClick(ce)){ce.stopImmediatePropagation();return}p?.handleClick(ce)&&ce.stopImmediatePropagation()}};(p||m)&&(n.addEventListener("mousedown",E,{capture:!0}),n.addEventListener("click",A,{capture:!0}));let _=ce=>m?.handleMove(ce);m&&n.addEventListener("mousemove",_,{passive:!0});let T=ce=>{km(ce,{color:t.edges.color,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle})},D=n.parentElement,L=()=>D?{width:D.clientWidth,height:D.clientHeight}:{width:window.innerWidth,height:window.innerHeight},F=null,B=()=>{let{width:ce,height:V}=L(),ee=Math.min(window.devicePixelRatio,2),me=Hm(a,r,c(),Math.max(1,ce),Math.max(1,V),{toneMapping:t.render.toneMapping??xa,toneMappingExposure:t.render.toneMappingExposure??1,aoIntensity:t.render.aoIntensity});return me.setSize(Math.max(1,ce),Math.max(1,V),ee),me},U=ce=>{ce&&!F?F=B():!ce&&F&&(F.dispose(),F=null)};t.render.ambientOcclusion&&(F=B());let{animate:N,dispose:R}=BE(a,r,s,c,l,o,L,t.events.onFrame,h,p,()=>F,x);N(),r.up.set(i.x,i.y,i.z),f();let z=ce=>{ce.traverse(V=>{let ee=V;!ee.geometry&&!ee.material||(ee.geometry?.dispose(),Array.isArray(ee.material)?ee.material.forEach(me=>me.dispose()):ee.material?.dispose())})},Y=ce=>{ce.userData.source="user",r.add(ce)},K=ce=>{ce.removeFromParent(),z(ce)},ne=()=>{r.children.filter(ce=>ce.userData.source==="user").forEach(ce=>{ce.removeFromParent(),z(ce)})};return{scene:r,camera:s,controls:o,renderer:a,cameraController:l,grid:h,gizmo:p,measureTool:m,applyEdges:T,setAmbientOcclusion:U,updateShadowBounds:f,dispose:()=>{R(),v.dispose(),(p||m)&&(n.removeEventListener("mousedown",E,{capture:!0}),n.removeEventListener("click",A,{capture:!0})),m&&n.removeEventListener("mousemove",_),m?.dispose(),x?.dispose(),p?.dispose(),h?.dispose(),F?.dispose(),o.dispose(),a.dispose(),r.traverse(ce=>{let V=ce;!V.geometry&&!V.material||(V.geometry?.dispose(),Array.isArray(V.material)?V.material.forEach(ee=>ee.dispose()):V.material?.dispose())}),r.environment?.dispose(),r.background instanceof En&&r.background.dispose()},fitToView:v.fitToView,clearSelection:v.clearSelection,addUserGeometry:Y,removeUserGeometry:K,clearUserGeometry:ne}};function IE(n){let e=n.sceneScale||"m",t={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[e];return{sceneScale:e,camera:{position:n.camera?.position||new X(-t.cameraDistance,-t.cameraDistance,t.cameraDistance),fov:n.camera?.fov||20,near:n.camera?.near||t.near,far:n.camera?.far||t.far,target:n.camera?.target||new X(0,0,0)},lighting:{enableSunlight:n.lighting?.enableSunlight??!0,sunlightIntensity:n.lighting?.sunlightIntensity??1,sunlightPosition:n.lighting?.sunlightPosition||new X(t.lightDistance,t.lightDistance,t.lightHeight),ambientLightColor:n.lighting?.ambientLightColor||new tt(4210752),ambientLightIntensity:n.lighting?.ambientLightIntensity??1,sunlightColor:n.lighting?.sunlightColor||16777215},environment:{hdrPath:n.environment?.hdrPath||"/baseHDR.hdr",backgroundColor:n.environment?.backgroundColor||new tt(15790320),enableEnvironmentLighting:n.environment?.enableEnvironmentLighting??!0,sceneUp:n.environment?.sceneUp||$o,showEnvironment:n.environment?.showEnvironment??!1},floor:{enabled:n.floor?.enabled??!1,size:n.floor?.size||t.floorSize,color:n.floor?.color||new tt(8421504),roughness:n.floor?.roughness??.7,metalness:n.floor?.metalness??0,receiveShadow:n.floor?.receiveShadow??!0},render:{enableShadows:n.render?.enableShadows??!0,shadowMapSize:n.render?.shadowMapSize||2048,antialias:n.render?.antialias??!0,pixelRatio:n.render?.pixelRatio||Math.min(window.devicePixelRatio,2),toneMapping:n.render?.toneMapping||xa,toneMappingExposure:n.render?.toneMappingExposure??1,preserveDrawingBuffer:n.render?.preserveDrawingBuffer??!1,ambientOcclusion:n.render?.ambientOcclusion??!1,aoIntensity:n.render?.aoIntensity??1},controls:{enableDamping:n.controls?.enableDamping??!1,dampingFactor:n.controls?.dampingFactor||.05,autoRotate:n.controls?.autoRotate??!1,autoRotateSpeed:n.controls?.autoRotateSpeed||.5,enableZoom:n.controls?.enableZoom??!0,enablePan:n.controls?.enablePan??!0,minDistance:n.controls?.minDistance||t.minDistance,maxDistance:n.controls?.maxDistance||1/0},grid:{enabled:n.grid?.enabled??!1,cellSize:n.grid?.cellSize??1,majorEvery:n.grid?.majorEvery??10,cellColor:n.grid?.cellColor??8947848,majorColor:n.grid?.majorColor??4473924,fadeDistance:n.grid?.fadeDistance??100,plane:n.grid?.plane??LE(n.environment?.sceneUp??$o)},gizmo:{enabled:n.gizmo?.enabled??!1},edges:{enabled:n.edges?.enabled??!1,color:n.edges?.color??2236962,width:n.edges?.width??1.5,thresholdAngle:n.edges?.thresholdAngle??30},measure:{enabled:n.measure?.enabled??!1,snapPixels:n.measure?.snapPixels,color:n.measure?.color,labelClassName:n.measure?.labelClassName,displayUnit:n.measure?.displayUnit,format:n.measure?.format},events:{onBackgroundClicked:n.events?.onBackgroundClicked,onObjectSelected:n.events?.onObjectSelected,onMeshMetadataClicked:n.events?.onMeshMetadataClicked,onMeshDoubleClicked:n.events?.onMeshDoubleClicked,selectionColor:n.events?.selectionColor||"#ff0000",enableEventHandlers:n.events?.enableEventHandlers??!0,enableKeyboardControls:n.events?.enableKeyboardControls??!0,enableClickToFocus:n.events?.enableClickToFocus??!0,enableDoubleClickZoom:n.events?.enableDoubleClickZoom??!0,onReady:n.events?.onReady,onFrame:n.events?.onFrame}}}var NE=new Set(["grid","floor","label-layer","measure"]);function UE(n){let e=n;for(;e;){if(typeof e.userData.id=="string"&&NE.has(e.userData.id))return!0;e=e.parent}return!1}function fu(n){let e=new di;return n.traverse(t=>{let i=t;t.visible&&!UE(t)&&i.geometry&&e.expandByObject(t)}),e}function FE(n,e){if(e.isEmpty())return;let t=e.getCenter(new X),i=e.getSize(new X).length()*.5*1.2,r=n.shadow.camera;r.left=-i,r.right=i,r.top=i,r.bottom=-i,n.target.position.copy(t),n.target.updateMatrixWorld();let s=n.position.distanceTo(t);r.near=Math.max(i*.01,s-i),r.far=s+i,r.updateProjectionMatrix()}function OE(n){let e=new Kx,t=typeof n.environment.backgroundColor=="string"?new tt(n.environment.backgroundColor):n.environment.backgroundColor;return e.background=t||null,e}function zE(n,e,t,i,r=200){let s=n.position.clone(),a=e.target.clone(),o=performance.now(),l=d=>1-Math.pow(1-d,3),c=()=>{let d=performance.now()-o,f=l(Math.min(d/r,1));n.position.lerpVectors(s,t,f),e.target.lerpVectors(a,i,f),e.update(),f<1&&requestAnimationFrame(c)};requestAnimationFrame(c)}function BE(n,e,t,i,r,s,a,o,l,c,d,f){let h=null,p=performance.now(),g=()=>{let{width:m,height:v}=a();if(m===0||v===0)return;let y=Math.min(window.devicePixelRatio,2),w=Math.round(m*y),b=Math.round(v*y);(n.domElement.width!==w||n.domElement.height!==b)&&(n.setPixelRatio(y),n.setSize(m,v,!1),t.aspect=m/v,t.updateProjectionMatrix(),r.updateAspect(m,v),d?.()?.setSize(m,v,y),f?.setSize(m,v))},x=function(){h=requestAnimationFrame(x);let m=performance.now(),v=(m-p)/1e3;p=m,g(),(s.enableDamping||s.autoRotate)&&s.update(),l&&l.update(i().position),c&&c.update(v),o?.(v);let y=i(),w=d?.();w?(w.setCamera(y),w.render(v)):n.render(e,y),f&&f.render(e,y),c&&c.render(n)};return{animate:x,dispose:()=>{h!==null&&(cancelAnimationFrame(h),h=null)}}}function kE(n,e){e.environment.enableEnvironmentLighting?new uE().load(e.environment.hdrPath||"/baseHDR.hdr",function(t){if(!t?.image){Nt().warn("HDR loaded without image data; skipping environment map."),e.events.onReady?.();return}t.mapping=Eo,n.environment=t,e.environment.showEnvironment&&(n.background=t),e.events.onReady?.()},void 0,function(t){Nt().warn("HDR texture could not be loaded, falling back to basic lighting:",t),e.events.onReady?.()}):e.events.onReady?.()}function VE(n,e){let t=new Ab(e.lighting.ambientLightColor,e.lighting.ambientLightIntensity);if(n.add(t),!e.lighting.enableSunlight)return null;let i=new Tb(e.lighting.sunlightColor??16777215,e.lighting.sunlightIntensity),r=e.lighting.sunlightPosition;return r&&i.position.set(r.x,r.y,r.z),e.render.enableShadows?(i.castShadow=!0,i.shadow.mapSize.width=e.render.shadowMapSize||2048,i.shadow.mapSize.height=e.render.shadowMapSize||2048,i.shadow.bias=-1e-4,i.shadow.normalBias=.02,i.shadow.radius=4,n.add(i),n.add(i.target),i):(n.add(i),null)}function HE(n,e){let t=e.floor.size,i=new Ds(t,t),r=typeof e.floor.color=="string"?new tt(e.floor.color):e.floor.color,s=new Sm({color:r,roughness:e.floor.roughness,metalness:e.floor.metalness,side:Qn}),a=new an(i,s);a.userData.id="floor",a.name="floor";let o=(e.environment?.sceneUp||$o).clone().normalize();a.quaternion.setFromUnitVectors(new X(0,0,1),o),a.position.set(0,0,0),e.floor.receiveShadow&&e.render.enableShadows&&(a.receiveShadow=!0),n.add(a)}function GE(n,e){let t=e.parentElement,i=t?t.clientWidth:window.innerWidth,r=t?t.clientHeight:window.innerHeight,s=new oi(n.camera.fov,i/r,n.camera.near,n.camera.far),a=n.camera.position;return a&&s.position.set(a.x,a.y,a.z),s}function WE(n,e){let t=new Lw({antialias:e.render.antialias,canvas:n,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:e.render.preserveDrawingBuffer,logarithmicDepthBuffer:!0}),i=n.parentElement,r=i?i.clientWidth:window.innerWidth,s=i?i.clientHeight:window.innerHeight;return i&&(n.style.width="100%",n.style.height="100%",n.style.display="block"),t.setSize(r,s,!1),t.setPixelRatio(e.render.pixelRatio||Math.min(window.devicePixelRatio,2)),e.render.enableShadows&&(t.shadowMap.enabled=!0,t.shadowMap.type=fs),t.toneMapping=e.render.toneMapping,t.toneMappingExposure=e.render.toneMappingExposure??1,t.outputColorSpace=Wn,t.sortObjects=!0,t}function XE(n,e,t,i,r,s){let a=new Set,o=new Map,l=new ul,c=new it,d=new it,f=E=>{let S=E;for(;S;){if(!S.visible)return!1;S=S.parent}return!0},h=()=>{let E=fu(e);if(E.isEmpty()){Nt().warn("No objects to fit to view");return}let S=E.getCenter(new X),A=E.getSize(new X),_=Math.max(A.x,A.y,A.z),T=i.fov*(Math.PI/180),D=_/(2*Math.tan(T/2));D*=1.5;let L=i.position.clone().sub(r.target);L.lengthSq()<1e-12&&L.set(.8,1,1.2),L.normalize(),i.position.copy(S.clone().add(L.multiplyScalar(D))),r.target.copy(S),r.update()},p=typeof s.events.selectionColor=="string"?new tt(s.events.selectionColor):s.events.selectionColor instanceof tt?s.events.selectionColor:new tt("#ff0000"),g=()=>{a.forEach(E=>{let S=E;if(o.has(E)){let A=o.get(E),_=S.material;_ instanceof yi?_.dispose():Array.isArray(_)&&_.forEach(T=>T.dispose()),S.material=A,o.delete(E)}}),a.clear()},x=E=>{let S=E;if(!(S.material instanceof yi))return!1;o.set(E,S.material);let A=S.material.clone();return E instanceof an&&"emissive"in A?A.emissive=p.clone():"color"in A&&(A.color=p.clone()),S.material=A,!0},m=()=>{let E=fu(e),S=E.isEmpty()?1:E.getSize(new X).length();l.params.Points.threshold=S*.01},v=E=>{d.set(E.clientX,E.clientY)},y=E=>{let S=new it(E.clientX,E.clientY);if(d.distanceTo(S)>5)return;let A=n.getBoundingClientRect();c.x=(E.clientX-A.left)/A.width*2-1,c.y=-((E.clientY-A.top)/A.height)*2+1,m(),l.setFromCamera(c,t());let _=l.intersectObjects(e.children,!0).filter(T=>f(T.object));if(_.length>0){let T=_[0].object;a.has(T)||(g(),a.add(T),x(T),s.events?.onObjectSelected?.(T),T instanceof an&&Object.keys(T.userData).length>0&&s.events?.onMeshMetadataClicked?.(T.userData))}else g(),s.events?.onBackgroundClicked?.({x:c.x,y:c.y})},w=E=>{let S=n.getBoundingClientRect();c.x=(E.clientX-S.left)/S.width*2-1,c.y=-((E.clientY-S.top)/S.height)*2+1,m(),l.setFromCamera(c,t());let A=l.intersectObjects(e.children,!0).filter(z=>f(z.object));if(A.length===0)return;let _=A[0].object;if(s.events?.onMeshDoubleClicked?.(_),!s.events?.enableDoubleClickZoom)return;let T=new di().setFromObject(_);if(T.isEmpty())return;let D=T.getCenter(new X),L=T.getSize(new X),F=Math.max(L.x,L.y,L.z),B=i.fov*(Math.PI/180),U=F/(2*Math.tan(B/2))*1.5,N=i.position.clone().sub(r.target).normalize(),R=D.clone().add(N.multiplyScalar(U));zE(i,r,R,D)},b=E=>{if(s.events?.enableKeyboardControls)switch(E.key.toLowerCase()){case"f":E.preventDefault(),h();break;case"escape":E.preventDefault(),g();break;case" ":E.preventDefault(),h();break}};return s.events?.enableClickToFocus&&(n.addEventListener("mousedown",v),n.addEventListener("click",y),n.addEventListener("dblclick",w)),s.events?.enableKeyboardControls&&(n.setAttribute("tabindex","0"),n.addEventListener("keydown",b)),{dispose:()=>{n.removeEventListener("mousedown",v),n.removeEventListener("click",y),n.removeEventListener("dblclick",w),n.removeEventListener("keydown",b),g()},fitToView:h,clearSelection:g}}function jE(n,e,t){let i=new $w(n,e),r=t.camera.target;return r&&i.target.set(r.x,r.y,r.z),i.enableDamping=t.controls.enableDamping||!1,i.dampingFactor=t.controls.dampingFactor||.05,i.autoRotate=t.controls.autoRotate||!1,i.autoRotateSpeed=t.controls.autoRotateSpeed||.5,i.enableZoom=t.controls.enableZoom??!0,i.enablePan=t.controls.enablePan??!0,i.minDistance=t.controls.minDistance||.001,i.maxDistance=t.controls.maxDistance||1/0,i.screenSpacePanning=!1,i.maxPolarAngle=Math.PI,i.update(),i}var qm={};Yg(qm,{CONCRETE_MATERIAL:()=>KE,EMISSIVE_MATERIAL:()=>qE,GLASS_MATERIAL:()=>$E,METAL_MATERIAL:()=>YE,PLASTIC_MATERIAL:()=>ZE,RUBBER_MATERIAL:()=>JE,WOOD_MATERIAL:()=>QE});var qE=new gr({color:0,emissive:new tt(16777215),emissiveIntensity:5,metalness:0,roughness:.2,clearcoat:.3,clearcoatRoughness:.2,depthWrite:!0,depthTest:!0,transparent:!1,alphaTest:0,polygonOffset:!0,side:Kn,dithering:!0}),YE=new gr({color:new tt(0),metalness:.9,roughness:.3,envMapIntensity:1.2,clearcoat:.3,clearcoatRoughness:.2,reflectivity:1,ior:2.5,thickness:1,depthWrite:!0,transparent:!1,alphaTest:0,depthTest:!0,polygonOffset:!0,side:Kn,dithering:!0}),KE=new gr({color:new tt(13421772),metalness:0,roughness:.92,envMapIntensity:.15,clearcoat:.05,clearcoatRoughness:.9,reflectivity:.15,transmission:0,ior:1.45,thickness:0,depthWrite:!0,transparent:!1,alphaTest:.5,depthTest:!0,polygonOffset:!0,side:Kn,dithering:!0}),ZE=new gr({color:new tt(16777215),metalness:0,roughness:.3,envMapIntensity:.5,clearcoat:.5,clearcoatRoughness:.1,reflectivity:.5,ior:1.4,transmission:0,transparent:!1,depthWrite:!0,side:Kn,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),$E=new gr({color:new tt(16777215),metalness:0,roughness:0,transmission:.95,transparent:!0,opacity:.3,envMapIntensity:1,clearcoat:1,clearcoatRoughness:0,ior:1.52,reflectivity:.9,thickness:1,side:Qn,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),JE=new gr({color:new tt(1710618),metalness:0,roughness:.9,envMapIntensity:.2,clearcoat:.1,clearcoatRoughness:.8,reflectivity:.2,ior:1.3,transmission:0,depthWrite:!0,side:Kn,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),QE=new gr({color:new tt(8934707),metalness:0,roughness:.7,envMapIntensity:.3,clearcoat:.3,clearcoatRoughness:.4,reflectivity:.3,ior:1.3,transmission:0,depthWrite:!0,side:Kn,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});function Ld(n,e,t,i=!0){return{x:n,y:e,z:t}}var eT="#ffffff",zf=12,tT=4e-4,nT=12,iT=.05;function Ym(n,e={}){if(!n||n.length===0)return[];let{rhino:t,applyTransforms:i=!0}=e,r=[];for(let s of n)switch(s.kind){case"curve":{let a=sT(s,t,i);a&&r.push(a);break}case"point":{r.push(aT(s,i));break}default:{let a=s;Nt().warn(`Skipping unknown display item kind: ${String(a.kind)}`);break}}return r}var rT=2;function sT(n,e,t){if(!e)return Nt().warn("No rhino3dm instance provided; skipping curve display item."),null;let i=oT(n.json,e);if(!i)return null;let r=lT(i,t);if(r.length<2)return null;let s=[];for(let f of r)s.push(f.x,f.y,f.z);let a=new Rd;a.setPositions(s);let o=Km(n.color,n.opacity),l=new Sa({color:o.color}),c=l;c.linewidth=n.width??rT,c.transparent=o.transparent,c.opacity=o.opacity;let d=new Lm(a,l);return d.computeLineDistances(),d.name=n.name,d.userData={source:"compute",id:n.id,layer:n.layer,kind:"curve",metadata:n.metadata},d}function aT(n,e){let{x:t,y:i,z:r}=Ld(n.position.X,n.position.Y,n.position.Z,e),s=new on;s.setAttribute("position",new sn([t,i,r],3));let a=new Ko({...Km(n.color,n.opacity),size:6,sizeAttenuation:!1}),o=new Zo(s,a);return o.name=n.name,o.userData={source:"compute",id:n.id,layer:n.layer,kind:"point",metadata:n.metadata},o}function oT(n,e){try{let t=JSON.parse(n),i=e.CommonObject.decode(t);return i&&typeof i.pointAt=="function"?i:(Nt().warn("Decoded display-item JSON is not a curve; skipping."),null)}catch(t){return Nt().warn("Failed to decode curve display item JSON:",t),null}}function lT(n,e){return cT(n,e)||uT(n,e)}function cT(n,e){if(!n.isPolyline())return null;let t=n.tryGetPolyline(),i=Array.isArray(t)?t[1]:t;if(!i||typeof i.count!="number"||i.count<2)return null;let r=[];for(let s=0;s<i.count;s++){let a=i.get(s),{x:o,y:l,z:c}=Ld(a[0],a[1],a[2],e);r.push(new X(o,l,c))}return r}function uT(n,e){let t=n.domain,i=t[0],r=t[1]-i,s=d=>{let f=n.pointAt(d),{x:h,y:p,z:g}=Ld(f[0],f[1],f[2],e);return new X(h,p,g)},a=dT(n),o=i,l=s(i),c=[l];for(let d=0;d<zf;d++){let f=i+r*(d+1)/zf,h=s(f);pu(o,l,f,h,s,a,nT,c),c.push(h),o=f,l=h}return c}function pu(n,e,t,i,r,s,a,o){if(a<=0)return;let l=(n+t)/2,c=r(l),d=fT(c,e,i),f=hT(e,c,i);d<=s&&f<=iT||(pu(n,e,l,c,r,s,a-1,o),o.push(c),pu(l,c,t,i,r,s,a-1,o))}function dT(n){let e=n.getBoundingBox(),t=e.min,i=e.max,r=Math.hypot(i[0]-t[0],i[1]-t[1],i[2]-t[2]);return Math.max(r*tT,1e-6)}function hT(n,e,t){let i=e.clone().sub(n),r=t.clone().sub(e),s=i.length(),a=r.length();if(s===0||a===0)return 0;let o=Math.max(-1,Math.min(1,i.dot(r)/(s*a)));return Math.acos(o)}function fT(n,e,t){let i=t.clone().sub(e),r=i.lengthSq();if(r===0)return n.distanceTo(e);let s=Math.max(0,Math.min(1,n.clone().sub(e).dot(i)/r)),a=e.clone().addScaledVector(i,s);return n.distanceTo(a)}function Km(n,e){let t=e??1;return{color:new tt(n??eT),transparent:t<1,opacity:t}}var mu=1096174675,pT=1515605075,gu=2,Bf=1,Id=1,mT=2,kf=12,Vf=56;function Nd(n){let e=vT(gT(n)),t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<kf)throw mi("Blob too small to contain SLVA header.",{expectedBytes:kf,availableBytes:e.byteLength});let i=0,r=t.getUint32(i,!0);if(i+=4,r!==mu)throw mi(`Invalid SLVA magic: 0x${r.toString(16)}`,{expectedMagic:`0x${mu.toString(16)}`,actualMagic:`0x${r.toString(16)}`});let s=t.getUint32(i,!0);if(i+=4,s<Bf||s>gu)throw mi(`Unsupported SLVA version: ${s}`,{minSupportedVersion:Bf,maxSupportedVersion:gu,actualVersion:s});let a=t.getUint32(i,!0);if(i+=4,i+a>e.byteLength)throw mi("Insufficient data to read metadata JSON.",{expectedBytes:a,availableBytes:e.byteLength-i,offset:i});let o=e.subarray(i,i+a);i+=a;let l;try{l=JSON.parse(_T(o))}catch(D){throw mi(`Failed to parse metadata JSON: ${D instanceof Error?D.message:String(D)}`,{metadataLen:a})}if(i+Vf>e.byteLength)throw mi("Insufficient data to read geometry header.",{expectedBytes:Vf,availableBytes:e.byteLength-i,offset:i});let c=t.getUint32(i,!0);i+=4;let d=t.getFloat64(i,!0);i+=8;let f=t.getFloat64(i,!0);i+=8;let h=t.getFloat64(i,!0);i+=8;let p=t.getFloat64(i,!0);i+=8;let g=t.getFloat64(i,!0);i+=8;let x=t.getFloat64(i,!0);i+=8;let m=t.getUint32(i,!0);i+=4;let v=(c&Id)!==0,y=m*3,w=y*(v?4:2);if(i+w>e.byteLength)throw mi("Insufficient data to read vertices.",{expectedBytes:w,availableBytes:e.byteLength-i,offset:i,useFloat32:v,vertexCount:m});let b=e.byteOffset+i,E=v?bT(e.buffer,b,y):xT(e.buffer,b,y);if(i+=w,i+4>e.byteLength)throw mi("Insufficient data to read index count.",{expectedBytes:4,availableBytes:e.byteLength-i,offset:i});let S=t.getUint32(i,!0);i+=4;let A=(c&mT)!==0,_=S*(A?2:4);if(i+_>e.byteLength)throw mi("Insufficient data to read indices.",{expectedBytes:_,availableBytes:e.byteLength-i,offset:i,indexCount:S,useUint16Indices:A});let T=A?yT(e.buffer,e.byteOffset+i,S):ST(e.buffer,e.byteOffset+i,S);return{metadata:l,flags:c,vertices:E,indices:T,origin:[d,f,h],scale:[p,g,x]}}function gT(n){return typeof n=="string"?qg(n):n instanceof Uint8Array?n:new Uint8Array(n)}function vT(n){if(n.byteLength<8)return n;let e=new DataView(n.buffer,n.byteOffset,n.byteLength);if(e.getUint32(0,!0)!==pT)return n;let t=e.getUint32(4,!0),i=n.subarray(8),r=Math.max(i.byteLength*1032+1024,1<<20);if(t>r)throw mi("SLVZ header declares an implausible uncompressed length",{uncompressedLen:t,deflatedBytes:i.byteLength,maxPlausibleLen:r});try{return qv(i,{out:new Uint8Array(t)})}catch(s){throw mi(`Failed to inflate SLVZ blob: ${s instanceof Error?s.message:String(s)}`,{uncompressedLen:t,deflatedBytes:i.byteLength})}}function _T(n){if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(n);if(typeof globalThis.Buffer<"u")return globalThis.Buffer.from(n).toString("utf-8");throw new ma("No UTF-8 decoder available in this environment.",Pu.INVALID_STATE)}function xT(n,e,t){if(t===0)return new Int16Array(0);if(e%2===0)return new Int16Array(n,e,t);let i=new Uint8Array(t*2);return i.set(new Uint8Array(n,e,t*2)),new Int16Array(i.buffer)}function bT(n,e,t){if(t===0)return new Float32Array(0);if(e%4===0)return new Float32Array(n,e,t);let i=new Uint8Array(t*4);return i.set(new Uint8Array(n,e,t*4)),new Float32Array(i.buffer)}function yT(n,e,t){if(t===0)return new Uint16Array(0);if(e%2===0)return new Uint16Array(n,e,t);let i=new Uint8Array(t*2);return i.set(new Uint8Array(n,e,t*2)),new Uint16Array(i.buffer)}function ST(n,e,t){if(t===0)return new Uint32Array(0);if(e%4===0)return new Uint32Array(n,e,t);let i=new Uint8Array(t*4);return i.set(new Uint8Array(n,e,t*4)),new Uint32Array(i.buffer)}function mi(n,e){return new ma(n,Pu.VALIDATION_ERROR,{context:e})}async function Zm(n,e){let{debug:t=!1}=e??{},i=t?performance.now():0;try{let r=performance.now(),s=JSON.parse(n),a=performance.now()-r;return await $m(s,e,{parseTime:a,perfStart:i})}catch(r){return Nt().error("Error parsing mesh batch:",r),[]}}async function $m(n,e,t){let{mergeByMaterial:i=!0,applyTransforms:r=!0,debug:s=!1}=e??{},{parseTime:a=0,perfStart:o=s?performance.now():0}=t??{};try{let l=performance.now(),c=Nd(n.compressedData),d=performance.now()-l,f=s?PT(n.compressedData):0;return Jm(c,{mergeByMaterial:i,applyTransforms:r,debug:s,parseTime:a,decodeTime:d,perfStart:o,blobBytes:f,fallback:{materials:n.materials,groups:n.groups,sourceComponentId:n.sourceComponentId}})}catch(l){return Nt().error("Error parsing mesh batch object:",l),[]}}async function MT(n,e){let{mergeByMaterial:t=!0,applyTransforms:i=!0,debug:r=!1}=e??{},s=r?performance.now():0;try{let a=performance.now(),o=Nd(n),l=performance.now()-a,c=n.byteLength;return Jm(o,{mergeByMaterial:t,applyTransforms:i,debug:r,parseTime:0,decodeTime:l,perfStart:s,blobBytes:c})}catch(a){return Nt().error("Error parsing mesh batch blob:",a),[]}}function Jm(n,e){let{mergeByMaterial:t,applyTransforms:i,debug:r,parseTime:s,decodeTime:a,perfStart:o,blobBytes:l,fallback:c}=e,d=n.metadata.materials??c?.materials??[],f=n.metadata.groups??c?.groups??[],h=c?.sourceComponentId??n.metadata.sourceComponentId,p=(n.flags&Id)!==0,g=p?ET(n.vertices):wT(n.vertices,n.origin,n.scale);if(r){let w=n.vertices.byteLength+n.indices.byteLength;Nt().debug("Mesh Batch Stats:"),Nt().debug(` Materials: ${d.length} | Groups: ${f.length}`),Nt().debug(` Vertices: ${n.vertices.length/3} | Indices: ${n.indices.length}`),Nt().debug(` Format: ${p?"float32":"int16 quantized"}`),Nt().debug(` Blob: ${(l/1024/1024).toFixed(2)} MB | Geometry on wire: ${(w/1024/1024).toFixed(2)} MB`)}let x=performance.now(),m=d.map(TT),v=[];for(let w of f)if(t)for(let b of AT(w))if(b.meshes.length>1){let E=CT(b,g,n.indices,m);E.userData.sourceComponentId=h??null,v.push(E)}else{let E=Hf(b,g,n.indices,m);for(let S of E)S.userData.sourceComponentId=h??null;v.push(...E)}else{let b=Hf(w,g,n.indices,m);for(let E of b)E.userData.sourceComponentId=h??null;v.push(...b)}let y=performance.now()-x;if(r){let w=performance.now()-o;Nt().debug("Performance:"),s>0&&Nt().debug(` Parse JSON: ${s.toFixed(2)}ms`),Nt().debug(` Decode binary: ${a.toFixed(2)}ms`),Nt().debug(` Create Meshes: ${y.toFixed(2)}ms`),Nt().debug(` Total: ${w.toFixed(2)}ms`)}return Promise.resolve(v)}function wT(n,e,t,i){let r=new Float32Array(n.length),s=e[0],a=e[1],o=e[2],l=t[0],c=t[1],d=t[2];for(let f=0;f<n.length;f+=3)r[f]=s+(n[f]+32767)*l,r[f+1]=a+(n[f+1]+32767)*c,r[f+2]=o+(n[f+2]+32767)*d;return r}function ET(n,e){return n}function TT(n){let e=Um(n.color);return new gr({color:e,metalness:n.metalness,roughness:n.roughness,opacity:n.opacity,transparent:n.transparent,side:Qn,polygonOffset:!0,polygonOffsetFactor:.5,polygonOffsetUnits:.5,depthWrite:!0,depthTest:!0})}function AT(n){let e=new Map;for(let t of n.meshes){let i=t.layer??"",r=e.get(i);r?r.push(t):e.set(i,[t])}return e.size<=1?[n]:Array.from(e.values(),t=>({materialId:n.materialId,meshes:t}))}function CT(n,e,t,i){let r=0,s=0;for(let g of n.meshes)r+=g.vertexCount,s+=g.indexCount;let a=new Float32Array(r*3),o=new Uint32Array(s),l=0,c=0;for(let g of n.meshes){let x=g.vertexStart*3,m=g.vertexCount*3;a.set(e.subarray(x,x+m),l*3);let v=t.subarray(g.indexStart,g.indexStart+g.indexCount),y=l-g.vertexStart;if(y===0)o.set(v,c);else for(let w=0;w<v.length;w++)o[c+w]=v[w]+y;l+=g.vertexCount,c+=g.indexCount}let d=new on;d.setAttribute("position",new kn(a,3)),d.setIndex(new kn(o,1)),d.computeVertexNormals();let f=new an(d,i[n.materialId]),h=n.meshes[0],p=n.meshes.map(g=>g.name).filter(g=>g&&g.length>0);return f.name=p.length>0?p[0]:`merged_material_${n.materialId}`,f.castShadow=!0,f.receiveShadow=!0,f.userData={source:"compute",name:f.name,layer:h?.layer??"",originalIndex:h?.originalIndex??0,metadata:h?.metadata??{},mergedFrom:n.meshes.slice(1).map(g=>({name:g.name,layer:g.layer,originalIndex:g.originalIndex}))},f}function Hf(n,e,t,i){let r=[];for(let s of n.meshes){let a=s.vertexStart*3,o=s.vertexCount*3,l=e.slice(a,a+o),c=t.subarray(s.indexStart,s.indexStart+s.indexCount),d=new Uint32Array(c.length),f=s.vertexStart;for(let g=0;g<c.length;g++)d[g]=c[g]-f;let h=new on;h.setAttribute("position",new kn(l,3)),h.setIndex(new kn(d,1)),h.computeVertexNormals();let p=new an(h,i[n.materialId]);p.name=s.name,p.userData={source:"compute",name:s.name,layer:s.layer??"",originalIndex:s.originalIndex,metadata:s.metadata??{}},p.castShadow=!0,p.receiveShadow=!0,r.push(p)}return r}function PT(n){return Math.floor(n.length*3/4)}var Qm={Millimeters:1/1e3,Centimeters:1/100,Meters:1,Inches:1/39.37,Feet:1/3.28084},RT="Display";async function DT(n,e){let t=performance.now(),i=[],{allowScaling:r=!0,allowAutoPosition:s=!0,rhino:a,debug:o=!1,parsing:l={}}=e??{};try{let c=r?LT(n.modelunits):1;return await IT(n,i,c,l,a,o),s&&OT(i),i}catch(c){throw zT(c,i),c}finally{o&&kT(t)}}function LT(n){return Qm[n]??1}async function IT(n,e,t,i,r,s){for(let a of n.values){let o=a.InnerTree;for(let l in o){let c=o[l];c&&await NT(c,e,t,i,r,s)}}}async function NT(n,e,t,i,r,s){for(let a of n){if(!a.type.includes(RT))continue;let o={mergeByMaterial:!0,applyTransforms:!0,debug:!1,...i},l=await Zm(a.data,o),c=Ym(UT(a.data),{rhino:r,applyTransforms:o.applyTransforms}),d=[...l,...c];if(t!==1)for(let f of d)f.scale.set(t,t,t);e.push(...d),s&&Nt().debug(`Extracted ${l.length} meshes and ${c.length} items from batch`)}}function UT(n){return(typeof n=="string"?FT(n):n)?.items}function FT(n){try{return JSON.parse(n)}catch{return}}function OT(n){if(n.length===0)return;let e=fl(n);Fm(n,e.min.z,"z")}function zT(n,e){Nt().error("An unexpected error occurred:",n),BT(e)}function BT(n){for(let e of n){let t=e;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(i=>i.dispose()):t.material.dispose())}}function kT(n){let e=performance.now()-n;Nt().info("Time to process meshes:",`${e.toFixed(2)}ms`)}const VT={toolsMenu:"Viewer tools",switchTo2D:"Switch to 2D",switchTo3D:"Switch to 3D",fitToView:"Fit to view",views:"Views",measure:"Measure",grid:"Grid",sceneManager:"Scene manager",screenshot:"Screenshot",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",viewTop:"Top",viewFront:"Front",viewRight:"Right",viewBack:"Back",viewLeft:"Left",viewBottom:"Bottom",viewIso:"Isometric",searchObjects:"Search objects...",clearSearch:"Clear search",expandLayer:"Expand layer",collapseLayer:"Collapse layer",showLayer:"Show layer",hideLayer:"Hide layer",showObject:"Show object",hideObject:"Hide object",noObjects:"No objects",noResultsFor:'No results for "{query}"',objectFallbackName:"Object",noMetadata:"No metadata",loadingSchema:"Loading schema...",parametersTab:"Parameters",moreTab:"More",expandPanel:"Expand panel",collapsePanel:"Collapse panel",expandSidePanel:"Expand {side} panel",panelSideLeft:"left",panelSideRight:"right",tabNoGroups:"This tab has no groups configured.",solving:"Solving",solvingEllipsis:"Solving...",solvingSubtitle:"Grasshopper is calculating...",pressToCalculate:"Press to calculate",calculate:"Calculate",upToDate:"Up to date"},HT={toolsMenu:"Viewer-Werkzeuge",switchTo2D:"Zu 2D wechseln",switchTo3D:"Zu 3D wechseln",fitToView:"Ansicht anpassen",views:"Ansichten",measure:"Messen",grid:"Raster",sceneManager:"Szenen-Manager",screenshot:"Screenshot",fullscreen:"Vollbild",exitFullscreen:"Vollbild beenden",viewTop:"Oben",viewFront:"Vorne",viewRight:"Rechts",viewBack:"Hinten",viewLeft:"Links",viewBottom:"Unten",viewIso:"Isometrisch",searchObjects:"Objekte suchen...",clearSearch:"Suche löschen",expandLayer:"Ebene aufklappen",collapseLayer:"Ebene zuklappen",showLayer:"Ebene einblenden",hideLayer:"Ebene ausblenden",showObject:"Objekt einblenden",hideObject:"Objekt ausblenden",noObjects:"Keine Objekte",noResultsFor:"Keine Ergebnisse für „{query}“",objectFallbackName:"Objekt",noMetadata:"Keine Metadaten",loadingSchema:"Schema wird geladen...",parametersTab:"Parameter",moreTab:"Mehr",expandPanel:"Bereich aufklappen",collapsePanel:"Bereich zuklappen",expandSidePanel:"{side} Bereich aufklappen",panelSideLeft:"Linken",panelSideRight:"Rechten",tabNoGroups:"Für diesen Tab sind keine Gruppen konfiguriert.",solving:"Berechnung läuft",solvingEllipsis:"Berechnung läuft...",solvingSubtitle:"Grasshopper berechnet...",pressToCalculate:"Zum Berechnen klicken",calculate:"Berechnen",upToDate:"Aktuell"},Gf={en:VT,de:HT},da="en";function eg(n){return Gf[n??da]??Gf[da]}const tg=Symbol("viewer-locale-context");function ng(n){Cu(tg,{get locale(){return n()??da},get messages(){return eg(n())}})}function Si(){return Ms(tg)??{get locale(){return da},get messages(){return eg(da)}}}var GT=q("<button><!></button>"),WT=q('<div role="option" tabindex="-1"><button class="rounded p-1 shrink-0 transition-colors hover:bg-muted"><!></button> <span> </span> <span class="rounded px-1 py-0.5 font-medium shrink-0 bg-muted text-[9px] text-muted-foreground/70"> </span></div>'),XT=q('<div role="listbox" aria-multiselectable="true" class="ml-3 border-l border-border svelte-vc2vi3"></div>'),jT=q('<div class="gap-1 pl-1 pr-2 py-1 group flex items-center transition-colors hover:bg-muted svelte-vc2vi3"><button class="rounded p-0.5 shrink-0 text-muted-foreground transition-colors hover:text-muted-foreground"><!></button> <button class="rounded p-1 shrink-0 transition-colors hover:bg-muted"><!></button> <span> </span> <span class="shrink-0 text-[10px] text-muted-foreground/50 tabular-nums"> </span></div> <!>',1),qT=q('<div class="py-12 flex flex-col items-center justify-center text-center svelte-vc2vi3"><!> <p class="text-xs text-muted-foreground"> </p></div>'),YT=q('<div class="py-12 flex flex-col items-center justify-center text-center svelte-vc2vi3"><!> <p class="text-xs text-muted-foreground"> </p></div>'),KT=q('<div class="flex h-full flex-col bg-card text-card-foreground svelte-vc2vi3"><div class="px-3 py-2 gap-2 flex items-center border-b border-border svelte-vc2vi3"><!> <input class="min-w-0 text-xs flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground/50"/> <!></div> <div class="py-1 flex-1 overflow-y-auto svelte-vc2vi3"><!> <!></div></div>');function ZT(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);let r=oe(e,"sceneVersion",3,0);const s=new Set(["grid","floor","label-layer","measure"]),a=()=>(r(),e.scene.children.filter(V=>!(V instanceof Td)&&!(V instanceof Ed)&&!s.has(V.userData?.id))),o=()=>{const V=a(),ee=new Fo;for(const me of V){const ve=me.userData?.layer||me.userData?.category||"Default";ee.has(ve)||ee.set(ve,[]),ee.get(ve).push(me)}return ee};let l=new na,c=new na;const d=(V,ee)=>{V.visible=ee,V.traverse(me=>{me.visible=ee}),ee?l.delete(V.uuid):l.add(V.uuid)},f=V=>{if(S.has(V.uuid)&&S.size>1){const me=a().filter(G=>S.has(G.uuid)),ve=me.every(G=>l.has(G.uuid));for(const G of me)d(G,ve)}else d(V,l.has(V.uuid))},h=V=>V.every(ee=>l.has(ee.uuid)),p=V=>{const ee=V.filter(me=>l.has(me.uuid)).length;return ee>0&&ee<V.length},g=(V,ee)=>{const me=h(ee);for(const ve of ee)d(ve,me)},x=V=>{c.has(V)?c.delete(V):c.add(V)},m=V=>V.replace(/^Line(Segments)?2$/,"Curve").replace("Mesh","").replace("Object3D","Obj")||V,v=V=>V.userData?.name||V.userData?.fileName||V.name||m(V.type),y=V=>m(V.type);let w=Fe("");const b=()=>{const V=o();if(!u(w).trim())return V;const ee=u(w).toLowerCase(),me=new Fo;for(const[ve,G]of V){const ie=ve.toLowerCase().includes(ee)?G:G.filter(Z=>v(Z).toLowerCase().includes(ee));ie.length>0&&me.set(ve,ie)}return me},E=()=>{const V=[];for(const[ee,me]of b())if(!c.has(ee))for(const ve of me)V.push(ve.uuid);return V};let S=new na,A=Fe(null);const _=(V,ee)=>{if(ee.shiftKey&&u(A)){const me=E(),ve=me.indexOf(u(A)),G=me.indexOf(V);if(ve!==-1&&G!==-1){const[ie,Z]=ve<G?[ve,G]:[G,ve];!ee.ctrlKey&&!ee.metaKey&&S.clear();for(let le=ie;le<=Z;le++)S.add(me[le])}}else ee.ctrlKey||ee.metaKey?S.has(V)?S.delete(V):(S.add(V),W(A,V,!0)):(S.clear(),S.add(V),W(A,V,!0));ee.shiftKey||W(A,V,!0)};var T=KT(),D=$(T),L=$(D);sh(L,{class:"h-3.5 w-3.5 shrink-0 text-muted-foreground/50"});var F=se(L,2);Ru(F);var B=se(F,2);{var U=V=>{var ee=GT(),me=$(ee);gv(me,{class:"h-3.5 w-3.5 text-muted-foreground/50 transition-colors hover:text-muted-foreground"}),j(ee),Me(()=>Qt(ee,"aria-label",u(i).clearSearch)),Xt("click",ee,()=>W(w,"")),P(V,ee)};xe(B,V=>{u(w)&&V(U)})}j(D);var N=se(D,2),R=$(N);Zt(R,17,()=>[...b()],([V,ee])=>V,(V,ee)=>{var me=O(()=>Mr(u(ee),2));let ve=()=>u(me)[0],G=()=>u(me)[1];const ie=O(()=>h(G())),Z=O(()=>p(G())),le=O(()=>c.has(ve()));var fe=jT(),Se=Q(fe),ze=$(Se),Ue=$(ze);{let Ce=O(()=>u(le)?"":"rotate-90");Du(Ue,{get class(){return`h-3.5 w-3.5 transition-transform duration-150 ${u(Ce)??""}`}})}j(ze);var Pe=se(ze,2),ke=$(Pe);{var Ie=Ce=>{Sl(Ce,{class:"h-3.5 w-3.5 text-muted-foreground/40"})},We=Ce=>{Ml(Ce,{class:"h-3.5 w-3.5 text-muted-foreground/60"})},Oe=Ce=>{Ml(Ce,{class:"h-3.5 w-3.5 text-muted-foreground"})};xe(ke,Ce=>{u(ie)?Ce(Ie):u(Z)?Ce(We,1):Ce(Oe,-1)})}j(Pe);var He=se(Pe,2),k=$(He,!0);j(He);var je=se(He,2),Ve=$(je,!0);j(je),j(Se);var Xe=se(Se,2);{var ye=Ce=>{var C=XT();Zt(C,21,G,M=>M.uuid,(M,H)=>{const re=O(()=>l.has(u(H).uuid)),ue=O(()=>S.has(u(H).uuid));var be=WT(),ge=$(be),ae=$(ge);{var he=Ye=>{Sl(Ye,{class:"h-3 w-3 text-muted-foreground/60"})},Re=Ye=>{Ml(Ye,{class:"h-3 w-3 text-muted-foreground"})};xe(ae,Ye=>{u(re)?Ye(he):Ye(Re,-1)})}j(ge);var Le=se(ge,2),Ee=$(Le,!0);j(Le);var De=se(Le,2),et=$(De,!0);j(De),j(be),Me((Ye,ht)=>{Qt(be,"aria-selected",u(ue)),Dt(be,1,`gap-1.5 pl-5 pr-2 py-0.5 flex cursor-pointer items-center transition-colors
|
|
5010
|
+
`;function zm(n={}){let{cellSize:e=1,majorEvery:t=10,cellColor:i=8947848,majorColor:r=4473924,fadeDistance:s=100,plane:a="y"}=n,o=a==="y"?new it(0,2):a==="z"?new it(0,1):new it(1,2),l=s*2.5,c=new Ds(l,l);a==="y"?c.rotateX(-Math.PI/2):a==="x"&&c.rotateY(Math.PI/2);let d=new _n({vertexShader:bE,fragmentShader:yE,transparent:!0,depthWrite:!1,side:Qn,uniforms:{uAxes:{value:o},uCell:{value:e},uMajor:{value:t},uCellColor:{value:new tt(i)},uMajorColor:{value:new tt(r)},uCenter:{value:new X},uFade:{value:s}}}),f=new an(c,d);f.name="grid",f.userData.id="grid",f.renderOrder=-1;let h=new X;return{object:f,update:p=>{a==="y"?(f.position.set(p.x,0,p.z),h.set(p.x,0,p.z)):a==="z"?(f.position.set(p.x,p.y,0),h.set(p.x,p.y,0)):(f.position.set(0,p.y,p.z),h.set(0,p.y,p.z)),d.uniforms.uCenter.value.copy(h)},setVisible:p=>{f.visible=p},dispose:()=>{c.dispose(),d.dispose()}}}function Bm(n){let{camera:e,domElement:t,controller:i}=n,r=new Iw(e,t);r.setLabels("X","Y","Z");let s=!0,a=128,o=new ul,l=new Fr(-2,2,2,-2,0,4);l.position.set(0,0,2);let c={posX:new X(1,0,0),negX:new X(-1,0,0),posY:new X(0,1,0),negY:new X(0,-1,0),posZ:new X(0,0,1),negZ:new X(0,0,-1)},d=f=>{let h=t.getBoundingClientRect(),p=h.left+t.offsetWidth-a-r.location.right,m=h.top+t.offsetHeight-a-r.location.bottom,x=new it((f.clientX-p)/a*2-1,-((f.clientY-m)/a)*2+1);if(Math.abs(x.x)>1||Math.abs(x.y)>1)return null;r.quaternion.copy(e.quaternion).invert(),r.updateMatrixWorld(),o.setFromCamera(x,l);let g=o.intersectObjects(r.children,!1);for(let v of g){let y=v.object.userData?.type;if(typeof y=="string"&&y in c)return y}return null};return{render:f=>{if(!s)return;let h=f.autoClear;f.autoClear=!1,r.render(f),f.autoClear=h},update:f=>{r.animating&&r.update(f)},handleClick:f=>{if(!s)return!1;let h=d(f);return h?(i.getProjection()==="orthographic"&&i.setProjection("perspective"),i.setViewDirection(c[h],!1),!0):!1},get isAnimating(){return r.animating},setVisible:f=>{s=f},isVisible:()=>s,dispose:()=>r.dispose()}}var ua="edge-overlay",SE=2236962,ME=1.5,wE=30;function km(n,e={}){let t=new tt(e.color??SE),i=e.width??ME,r=e.thresholdAngle??wE,s=[];return n.traverse(a=>{if(!(a instanceof an)||a.userData.id==="floor"||a.userData.id==="grid"||a.userData.kind===ua||a.children.some(l=>l.userData?.kind===ua)||!a.geometry)return;let o=EE(a.geometry,t,i,r);a.add(o),s.push(o)}),s}function EE(n,e,t,i){let r=new db(n,i),s=new Ad;s.setPositions(Array.from(r.attributes.position.array)),r.dispose();let a=new Sa({color:e});a.linewidth=t,a.polygonOffset=!0,a.polygonOffsetFactor=-1,a.polygonOffsetUnits=-1;let o=new Cd(s,a);return o.userData.kind=ua,o.raycast=()=>{},o}function Vm(n){return n.userData?.kind===ua}function TE(n){let e=[];n.traverse(t=>{t instanceof Cd&&Vm(t)&&e.push(t)});for(let t of e)t.geometry.dispose(),t.material.dispose(),t.removeFromParent();return e.length}function Hm(n,e,t,i,r,s){let a=new Vw(n),o=new Hw(e,t);a.addPass(o);let l=new Ri(e,t,i,r);l.blendIntensity=s.aoIntensity??1,l.updateGtaoMaterial({screenSpaceRadius:!0}),a.addPass(l);let c=new qw;return a.addPass(c),n.toneMapping=s.toneMapping,n.toneMappingExposure=s.toneMappingExposure,a.setSize(i,r),{render:d=>a.render(d),setSize:(d,f,h)=>{a.setPixelRatio(h),a.setSize(d,f),l.setSize(d,f)},setCamera:d=>{o.camera=d,l.camera=d},dispose:()=>{a.dispose(),l.dispose(),c.dispose()}}}function Gm(n,e){let t=new Kw,i=t.domElement;i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.height="100%",i.style.overflow="hidden",i.style.pointerEvents="none",i.style.zIndex="30",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(i);let r={width:n.clientWidth||1,height:n.clientHeight||1};t.setSize(r.width,r.height);let s=new Qs;s.name="label-layer",s.userData.id="label-layer",e.add(s);let a=new Set;return{addLabel:(o,l,c)=>{let d=document.createElement("div");d.textContent=o,c?d.className=c:Object.assign(d.style,{padding:"2px 6px",borderRadius:"4px",background:"rgba(20, 20, 20, 0.78)",color:"#fff",font:"12px/1.3 system-ui, sans-serif",whiteSpace:"pre",textAlign:"center",userSelect:"none"}),d.style.pointerEvents="none";let f=new Yw(d);return f.position.copy(l),s.add(f),a.add(f),{object:f,setPosition:h=>f.position.copy(h),setText:h=>{d.textContent=h},remove:()=>{f.removeFromParent(),d.remove(),a.delete(f)}}},render:(o,l)=>t.render(o,l),setSize:(o,l)=>t.setSize(o,l),dispose:()=>{a.forEach(o=>{o.removeFromParent(),o.element.remove()}),a.clear(),s.removeFromParent(),i.remove()}}}var AE=12,CE=16763904,PE=.015,Of={Millimeters:{metersPerUnit:1/1e3,suffix:"mm"},Centimeters:{metersPerUnit:1/100,suffix:"cm"},Meters:{metersPerUnit:1,suffix:"m"},Inches:{metersPerUnit:1/39.37,suffix:"in"},Feet:{metersPerUnit:1/3.28084,suffix:"ft"}};function RE(n){let e=n&&Of[n]||Of.Meters;return t=>`${(t/e.metersPerUnit).toPrecision(3)} ${e.suffix}`}function DE(n){let e=n.object;return e instanceof an?n.face?[n.face.a,n.face.b,n.face.c]:null:e instanceof Zo?n.index!=null?[n.index]:null:e instanceof lb&&n.index!=null?[n.index,n.index+1]:null}function Wm(n,e,t,i){let r=n.point.clone(),s=n.object,a=DE(n);if(!a||!s.geometry)return r;let o=s.geometry.attributes.position;if(!o)return r;let l=h=>{let p=h.clone().project(e);return new it((p.x+1)/2*t.width,(1-p.y)/2*t.height)},c=l(r),d=r,f=i;for(let h of a){if(h>=o.count)continue;let p=new X().fromBufferAttribute(o,h).applyMatrix4(s.matrixWorld),m=l(p).distanceTo(c);m<f&&(f=m,d=p)}return d}function Xm(n){let{canvas:e,scene:t,getActiveCamera:i,labelLayer:r,options:s={}}=n,a=s.snapPixels??AE,o=new tt(s.color??CE),l=RE(s.displayUnit),c=(D,L)=>`${l(D)}
|
|
5011
|
+
Δx ${l(L.x)} Δy ${l(L.y)} Δz ${l(L.z)}`,d=s.format??c,f=new ul,h=new it,p=!1,m=[],x=[],g=null,v=null,y=new Ko({color:o,size:8,sizeAttenuation:!1,depthTest:!1}),w=new Ko({color:o,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),b=null,E=D=>{if(!D){b&&(b.visible=!1);return}if(!b){let L=new on;L.setAttribute("position",new sn([0,0,0],3)),b=new Zo(L,w),b.renderOrder=1e3,b.userData.id="measure",b.raycast=()=>{},t.add(b)}b.position.copy(D),b.visible=!0},S=D=>{let L=new on;L.setAttribute("position",new sn([D.x,D.y,D.z],3));let F=new Zo(L,y);return F.renderOrder=999,F.userData.id="measure",F.raycast=()=>{},t.add(F),F},A=()=>{m.length=0,x.forEach(D=>{D.geometry.dispose(),D.removeFromParent()}),x.length=0,g&&(g.geometry.dispose(),g.material.dispose(),g.removeFromParent(),g=null),v?.remove(),v=null},_=()=>{if(m.length!==2)return;let[D,L]=m,F=new Rd;F.setPositions([D.x,D.y,D.z,L.x,L.y,L.z]);let k=new Sa({color:o});k.linewidth=2,k.depthTest=!1,g=new Lm(F,k),g.renderOrder=998,g.userData.id="measure",g.raycast=()=>{},t.add(g);let U=D.clone().add(L).multiplyScalar(.5),N=new X(Math.abs(L.x-D.x),Math.abs(L.y-D.y),Math.abs(L.z-D.z));v=r.addLabel(d(D.distanceTo(L),N),U,s.labelClassName)},T=D=>{let L=e.getBoundingClientRect();h.x=(D.clientX-L.left)/L.width*2-1,h.y=-((D.clientY-L.top)/L.height)*2+1;let F=i();f.setFromCamera(h,F);let k=F.position.length()*PE;f.params.Line.threshold=k,f.params.Points.threshold=k;let U=f.intersectObjects(t.children,!0).filter(N=>N.object.userData.id!=="measure"&&N.object.userData.id!=="grid");return U.length===0?null:Wm(U[0],F,{width:L.width,height:L.height},a)};return{setEnabled:D=>{p=D,D||(A(),E(null))},isEnabled:()=>p,handleClick:D=>{if(!p)return!1;m.length===2&&A();let L=T(D);return L===null||(m.push(L),x.push(S(L)),m.length===2&&_()),!0},handleMove:D=>{p&&E(T(D))},clear:A,dispose:()=>{A(),b&&(b.geometry.dispose(),b.removeFromParent(),b=null),y.dispose(),w.dispose()}}}var $o=new X(0,0,1);function LE(n){let e=Math.abs(n.x),t=Math.abs(n.y),i=Math.abs(n.z);return i>=e&&i>=t?"z":t>=e&&t>=i?"y":"x"}var jm=function(n,e){let t=IE(e||{}),i=t.environment?.sceneUp||$o,r=OE(t),s=GE(t,n);s.up.copy(i);let a=WE(n,t),o=jE(s,n,t),l=Om({scene:r,perspective:s,controls:o,onActiveCameraChange:()=>{},up:i}),c=()=>l.getActiveCamera();kE(r,t);let d=VE(r,t),f=()=>{d&&FE(d,fu(r))};t.floor?.enabled&&HE(r,t);let h=t.grid.enabled?zm({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;h&&r.add(h.object);let p=t.gizmo.enabled?Bm({camera:s,domElement:n,controller:l}):null,m=n.parentElement??n,x=t.measure.enabled?Gm(m,r):null,g=t.measure.enabled&&x?Xm({canvas:n,scene:r,getActiveCamera:c,labelLayer:x,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,v=t.events.enableEventHandlers!==!1?XE(n,r,c,s,o,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},y=5,w=0,b=0,E=le=>{w=le.clientX,b=le.clientY},S=le=>Math.hypot(le.clientX-w,le.clientY-b)>y,A=le=>{if(!S(le)){if(g?.handleClick(le)){le.stopImmediatePropagation();return}p?.handleClick(le)&&le.stopImmediatePropagation()}};(p||g)&&(n.addEventListener("mousedown",E,{capture:!0}),n.addEventListener("click",A,{capture:!0}));let _=le=>g?.handleMove(le);g&&n.addEventListener("mousemove",_,{passive:!0});let T=le=>{km(le,{color:t.edges.color,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle})},D=n.parentElement,L=()=>D?{width:D.clientWidth,height:D.clientHeight}:{width:window.innerWidth,height:window.innerHeight},F=null,k=()=>{let{width:le,height:B}=L(),ee=Math.min(window.devicePixelRatio,2),de=Hm(a,r,c(),Math.max(1,le),Math.max(1,B),{toneMapping:t.render.toneMapping??xa,toneMappingExposure:t.render.toneMappingExposure??1,aoIntensity:t.render.aoIntensity});return de.setSize(Math.max(1,le),Math.max(1,B),ee),de},U=le=>{le&&!F?F=k():!le&&F&&(F.dispose(),F=null)};t.render.ambientOcclusion&&(F=k());let{animate:N,dispose:R}=BE(a,r,s,c,l,o,L,t.events.onFrame,h,p,()=>F,x);N(),r.up.set(i.x,i.y,i.z),f();let z=le=>{le.traverse(B=>{let ee=B;!ee.geometry&&!ee.material||(ee.geometry?.dispose(),Array.isArray(ee.material)?ee.material.forEach(de=>de.dispose()):ee.material?.dispose())})},q=le=>{le.userData.source="user",r.add(le)},Y=le=>{le.removeFromParent(),z(le)},te=()=>{r.children.filter(le=>le.userData.source==="user").forEach(le=>{le.removeFromParent(),z(le)})};return{scene:r,camera:s,controls:o,renderer:a,cameraController:l,grid:h,gizmo:p,measureTool:g,applyEdges:T,setAmbientOcclusion:U,updateShadowBounds:f,dispose:()=>{R(),v.dispose(),(p||g)&&(n.removeEventListener("mousedown",E,{capture:!0}),n.removeEventListener("click",A,{capture:!0})),g&&n.removeEventListener("mousemove",_),g?.dispose(),x?.dispose(),p?.dispose(),h?.dispose(),F?.dispose(),o.dispose(),a.dispose(),r.traverse(le=>{let B=le;!B.geometry&&!B.material||(B.geometry?.dispose(),Array.isArray(B.material)?B.material.forEach(ee=>ee.dispose()):B.material?.dispose())}),r.environment?.dispose(),r.background instanceof En&&r.background.dispose()},fitToView:v.fitToView,clearSelection:v.clearSelection,addUserGeometry:q,removeUserGeometry:Y,clearUserGeometry:te}};function IE(n){let e=n.sceneScale||"m",t={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[e];return{sceneScale:e,camera:{position:n.camera?.position||new X(-t.cameraDistance,-t.cameraDistance,t.cameraDistance),fov:n.camera?.fov||20,near:n.camera?.near||t.near,far:n.camera?.far||t.far,target:n.camera?.target||new X(0,0,0)},lighting:{enableSunlight:n.lighting?.enableSunlight??!0,sunlightIntensity:n.lighting?.sunlightIntensity??1,sunlightPosition:n.lighting?.sunlightPosition||new X(t.lightDistance,t.lightDistance,t.lightHeight),ambientLightColor:n.lighting?.ambientLightColor||new tt(4210752),ambientLightIntensity:n.lighting?.ambientLightIntensity??1,sunlightColor:n.lighting?.sunlightColor||16777215},environment:{hdrPath:n.environment?.hdrPath||"/baseHDR.hdr",backgroundColor:n.environment?.backgroundColor||new tt(15790320),enableEnvironmentLighting:n.environment?.enableEnvironmentLighting??!0,sceneUp:n.environment?.sceneUp||$o,showEnvironment:n.environment?.showEnvironment??!1},floor:{enabled:n.floor?.enabled??!1,size:n.floor?.size||t.floorSize,color:n.floor?.color||new tt(8421504),roughness:n.floor?.roughness??.7,metalness:n.floor?.metalness??0,receiveShadow:n.floor?.receiveShadow??!0},render:{enableShadows:n.render?.enableShadows??!0,shadowMapSize:n.render?.shadowMapSize||2048,antialias:n.render?.antialias??!0,pixelRatio:n.render?.pixelRatio||Math.min(window.devicePixelRatio,2),toneMapping:n.render?.toneMapping||xa,toneMappingExposure:n.render?.toneMappingExposure??1,preserveDrawingBuffer:n.render?.preserveDrawingBuffer??!1,ambientOcclusion:n.render?.ambientOcclusion??!1,aoIntensity:n.render?.aoIntensity??1},controls:{enableDamping:n.controls?.enableDamping??!1,dampingFactor:n.controls?.dampingFactor||.05,autoRotate:n.controls?.autoRotate??!1,autoRotateSpeed:n.controls?.autoRotateSpeed||.5,enableZoom:n.controls?.enableZoom??!0,enablePan:n.controls?.enablePan??!0,minDistance:n.controls?.minDistance||t.minDistance,maxDistance:n.controls?.maxDistance||1/0},grid:{enabled:n.grid?.enabled??!1,cellSize:n.grid?.cellSize??1,majorEvery:n.grid?.majorEvery??10,cellColor:n.grid?.cellColor??8947848,majorColor:n.grid?.majorColor??4473924,fadeDistance:n.grid?.fadeDistance??100,plane:n.grid?.plane??LE(n.environment?.sceneUp??$o)},gizmo:{enabled:n.gizmo?.enabled??!1},edges:{enabled:n.edges?.enabled??!1,color:n.edges?.color??2236962,width:n.edges?.width??1.5,thresholdAngle:n.edges?.thresholdAngle??30},measure:{enabled:n.measure?.enabled??!1,snapPixels:n.measure?.snapPixels,color:n.measure?.color,labelClassName:n.measure?.labelClassName,displayUnit:n.measure?.displayUnit,format:n.measure?.format},events:{onBackgroundClicked:n.events?.onBackgroundClicked,onObjectSelected:n.events?.onObjectSelected,onMeshMetadataClicked:n.events?.onMeshMetadataClicked,onMeshDoubleClicked:n.events?.onMeshDoubleClicked,selectionColor:n.events?.selectionColor||"#ff0000",enableEventHandlers:n.events?.enableEventHandlers??!0,enableKeyboardControls:n.events?.enableKeyboardControls??!0,enableClickToFocus:n.events?.enableClickToFocus??!0,enableDoubleClickZoom:n.events?.enableDoubleClickZoom??!0,onReady:n.events?.onReady,onFrame:n.events?.onFrame}}}var NE=new Set(["grid","floor","label-layer","measure"]);function UE(n){let e=n;for(;e;){if(typeof e.userData.id=="string"&&NE.has(e.userData.id))return!0;e=e.parent}return!1}function fu(n){let e=new di;return n.traverse(t=>{let i=t;t.visible&&!UE(t)&&i.geometry&&e.expandByObject(t)}),e}function FE(n,e){if(e.isEmpty())return;let t=e.getCenter(new X),i=e.getSize(new X).length()*.5*1.2,r=n.shadow.camera;r.left=-i,r.right=i,r.top=i,r.bottom=-i,n.target.position.copy(t),n.target.updateMatrixWorld();let s=n.position.distanceTo(t);r.near=Math.max(i*.01,s-i),r.far=s+i,r.updateProjectionMatrix()}function OE(n){let e=new Kx,t=typeof n.environment.backgroundColor=="string"?new tt(n.environment.backgroundColor):n.environment.backgroundColor;return e.background=t||null,e}function zE(n,e,t,i,r=200){let s=n.position.clone(),a=e.target.clone(),o=performance.now(),l=d=>1-Math.pow(1-d,3),c=()=>{let d=performance.now()-o,f=l(Math.min(d/r,1));n.position.lerpVectors(s,t,f),e.target.lerpVectors(a,i,f),e.update(),f<1&&requestAnimationFrame(c)};requestAnimationFrame(c)}function BE(n,e,t,i,r,s,a,o,l,c,d,f){let h=null,p=performance.now(),m=()=>{let{width:g,height:v}=a();if(g===0||v===0)return;let y=Math.min(window.devicePixelRatio,2),w=Math.round(g*y),b=Math.round(v*y);(n.domElement.width!==w||n.domElement.height!==b)&&(n.setPixelRatio(y),n.setSize(g,v,!1),t.aspect=g/v,t.updateProjectionMatrix(),r.updateAspect(g,v),d?.()?.setSize(g,v,y),f?.setSize(g,v))},x=function(){h=requestAnimationFrame(x);let g=performance.now(),v=(g-p)/1e3;p=g,m(),(s.enableDamping||s.autoRotate)&&s.update(),l&&l.update(i().position),c&&c.update(v),o?.(v);let y=i(),w=d?.();w?(w.setCamera(y),w.render(v)):n.render(e,y),f&&f.render(e,y),c&&c.render(n)};return{animate:x,dispose:()=>{h!==null&&(cancelAnimationFrame(h),h=null)}}}function kE(n,e){e.environment.enableEnvironmentLighting?new uE().load(e.environment.hdrPath||"/baseHDR.hdr",function(t){if(!t?.image){Nt().warn("HDR loaded without image data; skipping environment map."),e.events.onReady?.();return}t.mapping=Eo,n.environment=t,e.environment.showEnvironment&&(n.background=t),e.events.onReady?.()},void 0,function(t){Nt().warn("HDR texture could not be loaded, falling back to basic lighting:",t),e.events.onReady?.()}):e.events.onReady?.()}function VE(n,e){let t=new Ab(e.lighting.ambientLightColor,e.lighting.ambientLightIntensity);if(n.add(t),!e.lighting.enableSunlight)return null;let i=new Tb(e.lighting.sunlightColor??16777215,e.lighting.sunlightIntensity),r=e.lighting.sunlightPosition;return r&&i.position.set(r.x,r.y,r.z),e.render.enableShadows?(i.castShadow=!0,i.shadow.mapSize.width=e.render.shadowMapSize||2048,i.shadow.mapSize.height=e.render.shadowMapSize||2048,i.shadow.bias=-1e-4,i.shadow.normalBias=.02,i.shadow.radius=4,n.add(i),n.add(i.target),i):(n.add(i),null)}function HE(n,e){let t=e.floor.size,i=new Ds(t,t),r=typeof e.floor.color=="string"?new tt(e.floor.color):e.floor.color,s=new Sm({color:r,roughness:e.floor.roughness,metalness:e.floor.metalness,side:Qn}),a=new an(i,s);a.userData.id="floor",a.name="floor";let o=(e.environment?.sceneUp||$o).clone().normalize();a.quaternion.setFromUnitVectors(new X(0,0,1),o),a.position.set(0,0,0),e.floor.receiveShadow&&e.render.enableShadows&&(a.receiveShadow=!0),n.add(a)}function GE(n,e){let t=e.parentElement,i=t?t.clientWidth:window.innerWidth,r=t?t.clientHeight:window.innerHeight,s=new oi(n.camera.fov,i/r,n.camera.near,n.camera.far),a=n.camera.position;return a&&s.position.set(a.x,a.y,a.z),s}function WE(n,e){let t=new Lw({antialias:e.render.antialias,canvas:n,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:e.render.preserveDrawingBuffer,logarithmicDepthBuffer:!0}),i=n.parentElement,r=i?i.clientWidth:window.innerWidth,s=i?i.clientHeight:window.innerHeight;return i&&(n.style.width="100%",n.style.height="100%",n.style.display="block"),t.setSize(r,s,!1),t.setPixelRatio(e.render.pixelRatio||Math.min(window.devicePixelRatio,2)),e.render.enableShadows&&(t.shadowMap.enabled=!0,t.shadowMap.type=fs),t.toneMapping=e.render.toneMapping,t.toneMappingExposure=e.render.toneMappingExposure??1,t.outputColorSpace=Wn,t.sortObjects=!0,t}function XE(n,e,t,i,r,s){let a=new Set,o=new Map,l=new ul,c=new it,d=new it,f=E=>{let S=E;for(;S;){if(!S.visible)return!1;S=S.parent}return!0},h=()=>{let E=fu(e);if(E.isEmpty()){Nt().warn("No objects to fit to view");return}let S=E.getCenter(new X),A=E.getSize(new X),_=Math.max(A.x,A.y,A.z),T=i.fov*(Math.PI/180),D=_/(2*Math.tan(T/2));D*=1.5;let L=i.position.clone().sub(r.target);L.lengthSq()<1e-12&&L.set(.8,1,1.2),L.normalize(),i.position.copy(S.clone().add(L.multiplyScalar(D))),r.target.copy(S),r.update()},p=typeof s.events.selectionColor=="string"?new tt(s.events.selectionColor):s.events.selectionColor instanceof tt?s.events.selectionColor:new tt("#ff0000"),m=()=>{a.forEach(E=>{let S=E;if(o.has(E)){let A=o.get(E),_=S.material;_ instanceof yi?_.dispose():Array.isArray(_)&&_.forEach(T=>T.dispose()),S.material=A,o.delete(E)}}),a.clear()},x=E=>{let S=E;if(!(S.material instanceof yi))return!1;o.set(E,S.material);let A=S.material.clone();return E instanceof an&&"emissive"in A?A.emissive=p.clone():"color"in A&&(A.color=p.clone()),S.material=A,!0},g=()=>{let E=fu(e),S=E.isEmpty()?1:E.getSize(new X).length();l.params.Points.threshold=S*.01},v=E=>{d.set(E.clientX,E.clientY)},y=E=>{let S=new it(E.clientX,E.clientY);if(d.distanceTo(S)>5)return;let A=n.getBoundingClientRect();c.x=(E.clientX-A.left)/A.width*2-1,c.y=-((E.clientY-A.top)/A.height)*2+1,g(),l.setFromCamera(c,t());let _=l.intersectObjects(e.children,!0).filter(T=>f(T.object));if(_.length>0){let T=_[0].object;a.has(T)||(m(),a.add(T),x(T),s.events?.onObjectSelected?.(T),T instanceof an&&Object.keys(T.userData).length>0&&s.events?.onMeshMetadataClicked?.(T.userData))}else m(),s.events?.onBackgroundClicked?.({x:c.x,y:c.y})},w=E=>{let S=n.getBoundingClientRect();c.x=(E.clientX-S.left)/S.width*2-1,c.y=-((E.clientY-S.top)/S.height)*2+1,g(),l.setFromCamera(c,t());let A=l.intersectObjects(e.children,!0).filter(z=>f(z.object));if(A.length===0)return;let _=A[0].object;if(s.events?.onMeshDoubleClicked?.(_),!s.events?.enableDoubleClickZoom)return;let T=new di().setFromObject(_);if(T.isEmpty())return;let D=T.getCenter(new X),L=T.getSize(new X),F=Math.max(L.x,L.y,L.z),k=i.fov*(Math.PI/180),U=F/(2*Math.tan(k/2))*1.5,N=i.position.clone().sub(r.target).normalize(),R=D.clone().add(N.multiplyScalar(U));zE(i,r,R,D)},b=E=>{if(s.events?.enableKeyboardControls)switch(E.key.toLowerCase()){case"f":E.preventDefault(),h();break;case"escape":E.preventDefault(),m();break;case" ":E.preventDefault(),h();break}};return s.events?.enableClickToFocus&&(n.addEventListener("mousedown",v),n.addEventListener("click",y),n.addEventListener("dblclick",w)),s.events?.enableKeyboardControls&&(n.setAttribute("tabindex","0"),n.addEventListener("keydown",b)),{dispose:()=>{n.removeEventListener("mousedown",v),n.removeEventListener("click",y),n.removeEventListener("dblclick",w),n.removeEventListener("keydown",b),m()},fitToView:h,clearSelection:m}}function jE(n,e,t){let i=new $w(n,e),r=t.camera.target;return r&&i.target.set(r.x,r.y,r.z),i.enableDamping=t.controls.enableDamping||!1,i.dampingFactor=t.controls.dampingFactor||.05,i.autoRotate=t.controls.autoRotate||!1,i.autoRotateSpeed=t.controls.autoRotateSpeed||.5,i.enableZoom=t.controls.enableZoom??!0,i.enablePan=t.controls.enablePan??!0,i.minDistance=t.controls.minDistance||.001,i.maxDistance=t.controls.maxDistance||1/0,i.screenSpacePanning=!1,i.maxPolarAngle=Math.PI,i.update(),i}var qm={};Yg(qm,{CONCRETE_MATERIAL:()=>KE,EMISSIVE_MATERIAL:()=>qE,GLASS_MATERIAL:()=>$E,METAL_MATERIAL:()=>YE,PLASTIC_MATERIAL:()=>ZE,RUBBER_MATERIAL:()=>JE,WOOD_MATERIAL:()=>QE});var qE=new gr({color:0,emissive:new tt(16777215),emissiveIntensity:5,metalness:0,roughness:.2,clearcoat:.3,clearcoatRoughness:.2,depthWrite:!0,depthTest:!0,transparent:!1,alphaTest:0,polygonOffset:!0,side:Kn,dithering:!0}),YE=new gr({color:new tt(0),metalness:.9,roughness:.3,envMapIntensity:1.2,clearcoat:.3,clearcoatRoughness:.2,reflectivity:1,ior:2.5,thickness:1,depthWrite:!0,transparent:!1,alphaTest:0,depthTest:!0,polygonOffset:!0,side:Kn,dithering:!0}),KE=new gr({color:new tt(13421772),metalness:0,roughness:.92,envMapIntensity:.15,clearcoat:.05,clearcoatRoughness:.9,reflectivity:.15,transmission:0,ior:1.45,thickness:0,depthWrite:!0,transparent:!1,alphaTest:.5,depthTest:!0,polygonOffset:!0,side:Kn,dithering:!0}),ZE=new gr({color:new tt(16777215),metalness:0,roughness:.3,envMapIntensity:.5,clearcoat:.5,clearcoatRoughness:.1,reflectivity:.5,ior:1.4,transmission:0,transparent:!1,depthWrite:!0,side:Kn,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),$E=new gr({color:new tt(16777215),metalness:0,roughness:0,transmission:.95,transparent:!0,opacity:.3,envMapIntensity:1,clearcoat:1,clearcoatRoughness:0,ior:1.52,reflectivity:.9,thickness:1,side:Qn,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),JE=new gr({color:new tt(1710618),metalness:0,roughness:.9,envMapIntensity:.2,clearcoat:.1,clearcoatRoughness:.8,reflectivity:.2,ior:1.3,transmission:0,depthWrite:!0,side:Kn,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),QE=new gr({color:new tt(8934707),metalness:0,roughness:.7,envMapIntensity:.3,clearcoat:.3,clearcoatRoughness:.4,reflectivity:.3,ior:1.3,transmission:0,depthWrite:!0,side:Kn,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});function Ld(n,e,t,i=!0){return{x:n,y:e,z:t}}var eT="#ffffff",zf=12,tT=4e-4,nT=12,iT=.05;function Ym(n,e={}){if(!n||n.length===0)return[];let{rhino:t,applyTransforms:i=!0}=e,r=[];for(let s of n)switch(s.kind){case"curve":{let a=sT(s,t,i);a&&r.push(a);break}case"point":{r.push(aT(s,i));break}default:{let a=s;Nt().warn(`Skipping unknown display item kind: ${String(a.kind)}`);break}}return r}var rT=2;function sT(n,e,t){if(!e)return Nt().warn("No rhino3dm instance provided; skipping curve display item."),null;let i=oT(n.json,e);if(!i)return null;let r=lT(i,t);if(r.length<2)return null;let s=[];for(let f of r)s.push(f.x,f.y,f.z);let a=new Rd;a.setPositions(s);let o=Km(n.color,n.opacity),l=new Sa({color:o.color}),c=l;c.linewidth=n.width??rT,c.transparent=o.transparent,c.opacity=o.opacity;let d=new Lm(a,l);return d.computeLineDistances(),d.name=n.name,d.userData={source:"compute",id:n.id,layer:n.layer,kind:"curve",metadata:n.metadata},d}function aT(n,e){let{x:t,y:i,z:r}=Ld(n.position.X,n.position.Y,n.position.Z,e),s=new on;s.setAttribute("position",new sn([t,i,r],3));let a=new Ko({...Km(n.color,n.opacity),size:6,sizeAttenuation:!1}),o=new Zo(s,a);return o.name=n.name,o.userData={source:"compute",id:n.id,layer:n.layer,kind:"point",metadata:n.metadata},o}function oT(n,e){try{let t=JSON.parse(n),i=e.CommonObject.decode(t);return i&&typeof i.pointAt=="function"?i:(Nt().warn("Decoded display-item JSON is not a curve; skipping."),null)}catch(t){return Nt().warn("Failed to decode curve display item JSON:",t),null}}function lT(n,e){return cT(n,e)||uT(n,e)}function cT(n,e){if(!n.isPolyline())return null;let t=n.tryGetPolyline(),i=Array.isArray(t)?t[1]:t;if(!i||typeof i.count!="number"||i.count<2)return null;let r=[];for(let s=0;s<i.count;s++){let a=i.get(s),{x:o,y:l,z:c}=Ld(a[0],a[1],a[2],e);r.push(new X(o,l,c))}return r}function uT(n,e){let t=n.domain,i=t[0],r=t[1]-i,s=d=>{let f=n.pointAt(d),{x:h,y:p,z:m}=Ld(f[0],f[1],f[2],e);return new X(h,p,m)},a=dT(n),o=i,l=s(i),c=[l];for(let d=0;d<zf;d++){let f=i+r*(d+1)/zf,h=s(f);pu(o,l,f,h,s,a,nT,c),c.push(h),o=f,l=h}return c}function pu(n,e,t,i,r,s,a,o){if(a<=0)return;let l=(n+t)/2,c=r(l),d=fT(c,e,i),f=hT(e,c,i);d<=s&&f<=iT||(pu(n,e,l,c,r,s,a-1,o),o.push(c),pu(l,c,t,i,r,s,a-1,o))}function dT(n){let e=n.getBoundingBox(),t=e.min,i=e.max,r=Math.hypot(i[0]-t[0],i[1]-t[1],i[2]-t[2]);return Math.max(r*tT,1e-6)}function hT(n,e,t){let i=e.clone().sub(n),r=t.clone().sub(e),s=i.length(),a=r.length();if(s===0||a===0)return 0;let o=Math.max(-1,Math.min(1,i.dot(r)/(s*a)));return Math.acos(o)}function fT(n,e,t){let i=t.clone().sub(e),r=i.lengthSq();if(r===0)return n.distanceTo(e);let s=Math.max(0,Math.min(1,n.clone().sub(e).dot(i)/r)),a=e.clone().addScaledVector(i,s);return n.distanceTo(a)}function Km(n,e){let t=e??1;return{color:new tt(n??eT),transparent:t<1,opacity:t}}var mu=1096174675,pT=1515605075,gu=2,Bf=1,Id=1,mT=2,kf=12,Vf=56;function Nd(n){let e=vT(gT(n)),t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<kf)throw mi("Blob too small to contain SLVA header.",{expectedBytes:kf,availableBytes:e.byteLength});let i=0,r=t.getUint32(i,!0);if(i+=4,r!==mu)throw mi(`Invalid SLVA magic: 0x${r.toString(16)}`,{expectedMagic:`0x${mu.toString(16)}`,actualMagic:`0x${r.toString(16)}`});let s=t.getUint32(i,!0);if(i+=4,s<Bf||s>gu)throw mi(`Unsupported SLVA version: ${s}`,{minSupportedVersion:Bf,maxSupportedVersion:gu,actualVersion:s});let a=t.getUint32(i,!0);if(i+=4,i+a>e.byteLength)throw mi("Insufficient data to read metadata JSON.",{expectedBytes:a,availableBytes:e.byteLength-i,offset:i});let o=e.subarray(i,i+a);i+=a;let l;try{l=JSON.parse(_T(o))}catch(D){throw mi(`Failed to parse metadata JSON: ${D instanceof Error?D.message:String(D)}`,{metadataLen:a})}if(i+Vf>e.byteLength)throw mi("Insufficient data to read geometry header.",{expectedBytes:Vf,availableBytes:e.byteLength-i,offset:i});let c=t.getUint32(i,!0);i+=4;let d=t.getFloat64(i,!0);i+=8;let f=t.getFloat64(i,!0);i+=8;let h=t.getFloat64(i,!0);i+=8;let p=t.getFloat64(i,!0);i+=8;let m=t.getFloat64(i,!0);i+=8;let x=t.getFloat64(i,!0);i+=8;let g=t.getUint32(i,!0);i+=4;let v=(c&Id)!==0,y=g*3,w=y*(v?4:2);if(i+w>e.byteLength)throw mi("Insufficient data to read vertices.",{expectedBytes:w,availableBytes:e.byteLength-i,offset:i,useFloat32:v,vertexCount:g});let b=e.byteOffset+i,E=v?bT(e.buffer,b,y):xT(e.buffer,b,y);if(i+=w,i+4>e.byteLength)throw mi("Insufficient data to read index count.",{expectedBytes:4,availableBytes:e.byteLength-i,offset:i});let S=t.getUint32(i,!0);i+=4;let A=(c&mT)!==0,_=S*(A?2:4);if(i+_>e.byteLength)throw mi("Insufficient data to read indices.",{expectedBytes:_,availableBytes:e.byteLength-i,offset:i,indexCount:S,useUint16Indices:A});let T=A?yT(e.buffer,e.byteOffset+i,S):ST(e.buffer,e.byteOffset+i,S);return{metadata:l,flags:c,vertices:E,indices:T,origin:[d,f,h],scale:[p,m,x]}}function gT(n){return typeof n=="string"?qg(n):n instanceof Uint8Array?n:new Uint8Array(n)}function vT(n){if(n.byteLength<8)return n;let e=new DataView(n.buffer,n.byteOffset,n.byteLength);if(e.getUint32(0,!0)!==pT)return n;let t=e.getUint32(4,!0),i=n.subarray(8),r=Math.max(i.byteLength*1032+1024,1<<20);if(t>r)throw mi("SLVZ header declares an implausible uncompressed length",{uncompressedLen:t,deflatedBytes:i.byteLength,maxPlausibleLen:r});try{return qv(i,{out:new Uint8Array(t)})}catch(s){throw mi(`Failed to inflate SLVZ blob: ${s instanceof Error?s.message:String(s)}`,{uncompressedLen:t,deflatedBytes:i.byteLength})}}function _T(n){if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(n);if(typeof globalThis.Buffer<"u")return globalThis.Buffer.from(n).toString("utf-8");throw new ma("No UTF-8 decoder available in this environment.",Pu.INVALID_STATE)}function xT(n,e,t){if(t===0)return new Int16Array(0);if(e%2===0)return new Int16Array(n,e,t);let i=new Uint8Array(t*2);return i.set(new Uint8Array(n,e,t*2)),new Int16Array(i.buffer)}function bT(n,e,t){if(t===0)return new Float32Array(0);if(e%4===0)return new Float32Array(n,e,t);let i=new Uint8Array(t*4);return i.set(new Uint8Array(n,e,t*4)),new Float32Array(i.buffer)}function yT(n,e,t){if(t===0)return new Uint16Array(0);if(e%2===0)return new Uint16Array(n,e,t);let i=new Uint8Array(t*2);return i.set(new Uint8Array(n,e,t*2)),new Uint16Array(i.buffer)}function ST(n,e,t){if(t===0)return new Uint32Array(0);if(e%4===0)return new Uint32Array(n,e,t);let i=new Uint8Array(t*4);return i.set(new Uint8Array(n,e,t*4)),new Uint32Array(i.buffer)}function mi(n,e){return new ma(n,Pu.VALIDATION_ERROR,{context:e})}async function Zm(n,e){let{debug:t=!1}=e??{},i=t?performance.now():0;try{let r=performance.now(),s=JSON.parse(n),a=performance.now()-r;return await $m(s,e,{parseTime:a,perfStart:i})}catch(r){return Nt().error("Error parsing mesh batch:",r),[]}}async function $m(n,e,t){let{mergeByMaterial:i=!0,applyTransforms:r=!0,debug:s=!1}=e??{},{parseTime:a=0,perfStart:o=s?performance.now():0}=t??{};try{let l=performance.now(),c=Nd(n.compressedData),d=performance.now()-l,f=s?PT(n.compressedData):0;return Jm(c,{mergeByMaterial:i,applyTransforms:r,debug:s,parseTime:a,decodeTime:d,perfStart:o,blobBytes:f,fallback:{materials:n.materials,groups:n.groups,sourceComponentId:n.sourceComponentId}})}catch(l){return Nt().error("Error parsing mesh batch object:",l),[]}}async function MT(n,e){let{mergeByMaterial:t=!0,applyTransforms:i=!0,debug:r=!1}=e??{},s=r?performance.now():0;try{let a=performance.now(),o=Nd(n),l=performance.now()-a,c=n.byteLength;return Jm(o,{mergeByMaterial:t,applyTransforms:i,debug:r,parseTime:0,decodeTime:l,perfStart:s,blobBytes:c})}catch(a){return Nt().error("Error parsing mesh batch blob:",a),[]}}function Jm(n,e){let{mergeByMaterial:t,applyTransforms:i,debug:r,parseTime:s,decodeTime:a,perfStart:o,blobBytes:l,fallback:c}=e,d=n.metadata.materials??c?.materials??[],f=n.metadata.groups??c?.groups??[],h=c?.sourceComponentId??n.metadata.sourceComponentId,p=(n.flags&Id)!==0,m=p?ET(n.vertices):wT(n.vertices,n.origin,n.scale);if(r){let w=n.vertices.byteLength+n.indices.byteLength;Nt().debug("Mesh Batch Stats:"),Nt().debug(` Materials: ${d.length} | Groups: ${f.length}`),Nt().debug(` Vertices: ${n.vertices.length/3} | Indices: ${n.indices.length}`),Nt().debug(` Format: ${p?"float32":"int16 quantized"}`),Nt().debug(` Blob: ${(l/1024/1024).toFixed(2)} MB | Geometry on wire: ${(w/1024/1024).toFixed(2)} MB`)}let x=performance.now(),g=d.map(TT),v=[];for(let w of f)if(t)for(let b of AT(w))if(b.meshes.length>1){let E=CT(b,m,n.indices,g);E.userData.sourceComponentId=h??null,v.push(E)}else{let E=Hf(b,m,n.indices,g);for(let S of E)S.userData.sourceComponentId=h??null;v.push(...E)}else{let b=Hf(w,m,n.indices,g);for(let E of b)E.userData.sourceComponentId=h??null;v.push(...b)}let y=performance.now()-x;if(r){let w=performance.now()-o;Nt().debug("Performance:"),s>0&&Nt().debug(` Parse JSON: ${s.toFixed(2)}ms`),Nt().debug(` Decode binary: ${a.toFixed(2)}ms`),Nt().debug(` Create Meshes: ${y.toFixed(2)}ms`),Nt().debug(` Total: ${w.toFixed(2)}ms`)}return Promise.resolve(v)}function wT(n,e,t,i){let r=new Float32Array(n.length),s=e[0],a=e[1],o=e[2],l=t[0],c=t[1],d=t[2];for(let f=0;f<n.length;f+=3)r[f]=s+(n[f]+32767)*l,r[f+1]=a+(n[f+1]+32767)*c,r[f+2]=o+(n[f+2]+32767)*d;return r}function ET(n,e){return n}function TT(n){let e=Um(n.color);return new gr({color:e,metalness:n.metalness,roughness:n.roughness,opacity:n.opacity,transparent:n.transparent,side:Qn,polygonOffset:!0,polygonOffsetFactor:.5,polygonOffsetUnits:.5,depthWrite:!0,depthTest:!0})}function AT(n){let e=new Map;for(let t of n.meshes){let i=t.layer??"",r=e.get(i);r?r.push(t):e.set(i,[t])}return e.size<=1?[n]:Array.from(e.values(),t=>({materialId:n.materialId,meshes:t}))}function CT(n,e,t,i){let r=0,s=0;for(let m of n.meshes)r+=m.vertexCount,s+=m.indexCount;let a=new Float32Array(r*3),o=new Uint32Array(s),l=0,c=0;for(let m of n.meshes){let x=m.vertexStart*3,g=m.vertexCount*3;a.set(e.subarray(x,x+g),l*3);let v=t.subarray(m.indexStart,m.indexStart+m.indexCount),y=l-m.vertexStart;if(y===0)o.set(v,c);else for(let w=0;w<v.length;w++)o[c+w]=v[w]+y;l+=m.vertexCount,c+=m.indexCount}let d=new on;d.setAttribute("position",new kn(a,3)),d.setIndex(new kn(o,1)),d.computeVertexNormals();let f=new an(d,i[n.materialId]),h=n.meshes[0],p=n.meshes.map(m=>m.name).filter(m=>m&&m.length>0);return f.name=p.length>0?p[0]:`merged_material_${n.materialId}`,f.castShadow=!0,f.receiveShadow=!0,f.userData={source:"compute",name:f.name,layer:h?.layer??"",originalIndex:h?.originalIndex??0,metadata:h?.metadata??{},mergedFrom:n.meshes.slice(1).map(m=>({name:m.name,layer:m.layer,originalIndex:m.originalIndex}))},f}function Hf(n,e,t,i){let r=[];for(let s of n.meshes){let a=s.vertexStart*3,o=s.vertexCount*3,l=e.slice(a,a+o),c=t.subarray(s.indexStart,s.indexStart+s.indexCount),d=new Uint32Array(c.length),f=s.vertexStart;for(let m=0;m<c.length;m++)d[m]=c[m]-f;let h=new on;h.setAttribute("position",new kn(l,3)),h.setIndex(new kn(d,1)),h.computeVertexNormals();let p=new an(h,i[n.materialId]);p.name=s.name,p.userData={source:"compute",name:s.name,layer:s.layer??"",originalIndex:s.originalIndex,metadata:s.metadata??{}},p.castShadow=!0,p.receiveShadow=!0,r.push(p)}return r}function PT(n){return Math.floor(n.length*3/4)}var Qm={Millimeters:1/1e3,Centimeters:1/100,Meters:1,Inches:1/39.37,Feet:1/3.28084},RT="Display";async function DT(n,e){let t=performance.now(),i=[],{allowScaling:r=!0,allowAutoPosition:s=!0,rhino:a,debug:o=!1,parsing:l={}}=e??{};try{let c=r?LT(n.modelunits):1;return await IT(n,i,c,l,a,o),s&&OT(i),i}catch(c){throw zT(c,i),c}finally{o&&kT(t)}}function LT(n){return Qm[n]??1}async function IT(n,e,t,i,r,s){for(let a of n.values){let o=a.InnerTree;for(let l in o){let c=o[l];c&&await NT(c,e,t,i,r,s)}}}async function NT(n,e,t,i,r,s){for(let a of n){if(!a.type.includes(RT))continue;let o={mergeByMaterial:!0,applyTransforms:!0,debug:!1,...i},l=await Zm(a.data,o),c=Ym(UT(a.data),{rhino:r,applyTransforms:o.applyTransforms}),d=[...l,...c];if(t!==1)for(let f of d)f.scale.set(t,t,t);e.push(...d),s&&Nt().debug(`Extracted ${l.length} meshes and ${c.length} items from batch`)}}function UT(n){return(typeof n=="string"?FT(n):n)?.items}function FT(n){try{return JSON.parse(n)}catch{return}}function OT(n){if(n.length===0)return;let e=fl(n);Fm(n,e.min.z,"z")}function zT(n,e){Nt().error("An unexpected error occurred:",n),BT(e)}function BT(n){for(let e of n){let t=e;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(i=>i.dispose()):t.material.dispose())}}function kT(n){let e=performance.now()-n;Nt().info("Time to process meshes:",`${e.toFixed(2)}ms`)}const VT={toolsMenu:"Viewer tools",switchTo2D:"Switch to 2D",switchTo3D:"Switch to 3D",fitToView:"Fit to view",views:"Views",measure:"Measure",grid:"Grid",sceneManager:"Scene manager",screenshot:"Screenshot",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",viewTop:"Top",viewFront:"Front",viewRight:"Right",viewBack:"Back",viewLeft:"Left",viewBottom:"Bottom",viewIso:"Isometric",searchObjects:"Search objects...",clearSearch:"Clear search",expandLayer:"Expand layer",collapseLayer:"Collapse layer",showLayer:"Show layer",hideLayer:"Hide layer",showObject:"Show object",hideObject:"Hide object",noObjects:"No objects",noResultsFor:'No results for "{query}"',objectFallbackName:"Object",noMetadata:"No metadata",loadingSchema:"Loading schema...",parametersTab:"Parameters",moreTab:"More",expandPanel:"Expand panel",collapsePanel:"Collapse panel",expandSidePanel:"Expand {side} panel",panelSideLeft:"left",panelSideRight:"right",tabNoGroups:"This tab has no groups configured.",solving:"Solving",solvingEllipsis:"Solving...",solvingSubtitle:"Grasshopper is calculating...",pressToCalculate:"Press to calculate",calculate:"Calculate",upToDate:"Up to date"},HT={toolsMenu:"Viewer-Werkzeuge",switchTo2D:"Zu 2D wechseln",switchTo3D:"Zu 3D wechseln",fitToView:"Ansicht anpassen",views:"Ansichten",measure:"Messen",grid:"Raster",sceneManager:"Szenen-Manager",screenshot:"Screenshot",fullscreen:"Vollbild",exitFullscreen:"Vollbild beenden",viewTop:"Oben",viewFront:"Vorne",viewRight:"Rechts",viewBack:"Hinten",viewLeft:"Links",viewBottom:"Unten",viewIso:"Isometrisch",searchObjects:"Objekte suchen...",clearSearch:"Suche löschen",expandLayer:"Ebene aufklappen",collapseLayer:"Ebene zuklappen",showLayer:"Ebene einblenden",hideLayer:"Ebene ausblenden",showObject:"Objekt einblenden",hideObject:"Objekt ausblenden",noObjects:"Keine Objekte",noResultsFor:"Keine Ergebnisse für „{query}“",objectFallbackName:"Objekt",noMetadata:"Keine Metadaten",loadingSchema:"Schema wird geladen...",parametersTab:"Parameter",moreTab:"Mehr",expandPanel:"Bereich aufklappen",collapsePanel:"Bereich zuklappen",expandSidePanel:"{side} Bereich aufklappen",panelSideLeft:"Linken",panelSideRight:"Rechten",tabNoGroups:"Für diesen Tab sind keine Gruppen konfiguriert.",solving:"Berechnung läuft",solvingEllipsis:"Berechnung läuft...",solvingSubtitle:"Grasshopper berechnet...",pressToCalculate:"Zum Berechnen klicken",calculate:"Berechnen",upToDate:"Aktuell"},Gf={en:VT,de:HT},da="en";function eg(n){return Gf[n??da]??Gf[da]}const tg=Symbol("viewer-locale-context");function ng(n){Cu(tg,{get locale(){return n()??da},get messages(){return eg(n())}})}function Si(){return Ms(tg)??{get locale(){return da},get messages(){return eg(da)}}}var GT=K("<button><!></button>"),WT=K('<div role="option" tabindex="-1"><button class="rounded p-1 shrink-0 transition-colors hover:bg-muted"><!></button> <span> </span> <span class="rounded px-1 py-0.5 font-medium shrink-0 bg-muted text-[9px] text-muted-foreground/70"> </span></div>'),XT=K('<div role="listbox" aria-multiselectable="true" class="ml-3 border-l border-border svelte-vc2vi3"></div>'),jT=K('<div class="gap-1 pl-1 pr-2 py-1 group flex items-center transition-colors hover:bg-muted svelte-vc2vi3"><button class="rounded p-0.5 shrink-0 text-muted-foreground transition-colors hover:text-muted-foreground"><!></button> <button class="rounded p-1 shrink-0 transition-colors hover:bg-muted"><!></button> <span> </span> <span class="shrink-0 text-[10px] text-muted-foreground/50 tabular-nums"> </span></div> <!>',1),qT=K('<div class="py-12 flex flex-col items-center justify-center text-center svelte-vc2vi3"><!> <p class="text-xs text-muted-foreground"> </p></div>'),YT=K('<div class="py-12 flex flex-col items-center justify-center text-center svelte-vc2vi3"><!> <p class="text-xs text-muted-foreground"> </p></div>'),KT=K('<div class="flex h-full flex-col bg-card text-card-foreground svelte-vc2vi3"><div class="px-3 py-2 gap-2 flex items-center border-b border-border svelte-vc2vi3"><!> <input class="min-w-0 text-xs flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground/50"/> <!></div> <div class="py-1 flex-1 overflow-y-auto svelte-vc2vi3"><!> <!></div></div>');function ZT(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);let r=oe(e,"sceneVersion",3,0);const s=new Set(["grid","floor","label-layer","measure"]),a=()=>(r(),e.scene.children.filter(B=>!(B instanceof Td)&&!(B instanceof Ed)&&!s.has(B.userData?.id))),o=()=>{const B=a(),ee=new Fo;for(const de of B){const ve=de.userData?.layer||de.userData?.category||"Default";ee.has(ve)||ee.set(ve,[]),ee.get(ve).push(de)}return ee};let l=new na,c=new na;const d=(B,ee)=>{B.visible=ee,B.traverse(de=>{de.visible=ee}),ee?l.delete(B.uuid):l.add(B.uuid)},f=B=>{if(S.has(B.uuid)&&S.size>1){const de=a().filter(G=>S.has(G.uuid)),ve=de.every(G=>l.has(G.uuid));for(const G of de)d(G,ve)}else d(B,l.has(B.uuid))},h=B=>B.every(ee=>l.has(ee.uuid)),p=B=>{const ee=B.filter(de=>l.has(de.uuid)).length;return ee>0&&ee<B.length},m=(B,ee)=>{const de=h(ee);for(const ve of ee)d(ve,de)},x=B=>{c.has(B)?c.delete(B):c.add(B)},g=B=>B.replace(/^Line(Segments)?2$/,"Curve").replace("Mesh","").replace("Object3D","Obj")||B,v=B=>B.userData?.name||B.userData?.fileName||B.name||g(B.type),y=B=>g(B.type);let w=Fe("");const b=()=>{const B=o();if(!u(w).trim())return B;const ee=u(w).toLowerCase(),de=new Fo;for(const[ve,G]of B){const ie=ve.toLowerCase().includes(ee)?G:G.filter(Z=>v(Z).toLowerCase().includes(ee));ie.length>0&&de.set(ve,ie)}return de},E=()=>{const B=[];for(const[ee,de]of b())if(!c.has(ee))for(const ve of de)B.push(ve.uuid);return B};let S=new na,A=Fe(null);const _=(B,ee)=>{if(ee.shiftKey&&u(A)){const de=E(),ve=de.indexOf(u(A)),G=de.indexOf(B);if(ve!==-1&&G!==-1){const[ie,Z]=ve<G?[ve,G]:[G,ve];!ee.ctrlKey&&!ee.metaKey&&S.clear();for(let ce=ie;ce<=Z;ce++)S.add(de[ce])}}else ee.ctrlKey||ee.metaKey?S.has(B)?S.delete(B):(S.add(B),W(A,B,!0)):(S.clear(),S.add(B),W(A,B,!0));ee.shiftKey||W(A,B,!0)};var T=KT(),D=$(T),L=$(D);sh(L,{class:"h-3.5 w-3.5 shrink-0 text-muted-foreground/50"});var F=se(L,2);Ru(F);var k=se(F,2);{var U=B=>{var ee=GT(),de=$(ee);gv(de,{class:"h-3.5 w-3.5 text-muted-foreground/50 transition-colors hover:text-muted-foreground"}),j(ee),Me(()=>Qt(ee,"aria-label",u(i).clearSearch)),Xt("click",ee,()=>W(w,"")),P(B,ee)};xe(k,B=>{u(w)&&B(U)})}j(D);var N=se(D,2),R=$(N);Zt(R,17,()=>[...b()],([B,ee])=>B,(B,ee)=>{var de=O(()=>Mr(u(ee),2));let ve=()=>u(de)[0],G=()=>u(de)[1];const ie=O(()=>h(G())),Z=O(()=>p(G())),ce=O(()=>c.has(ve()));var pe=jT(),Se=Q(pe),ze=$(Se),Ue=$(ze);{let Ce=O(()=>u(ce)?"":"rotate-90");Du(Ue,{get class(){return`h-3.5 w-3.5 transition-transform duration-150 ${u(Ce)??""}`}})}j(ze);var Pe=se(ze,2),ke=$(Pe);{var Ie=Ce=>{Sl(Ce,{class:"h-3.5 w-3.5 text-muted-foreground/40"})},We=Ce=>{Ml(Ce,{class:"h-3.5 w-3.5 text-muted-foreground/60"})},Oe=Ce=>{Ml(Ce,{class:"h-3.5 w-3.5 text-muted-foreground"})};xe(ke,Ce=>{u(ie)?Ce(Ie):u(Z)?Ce(We,1):Ce(Oe,-1)})}j(Pe);var He=se(Pe,2),V=$(He,!0);j(He);var je=se(He,2),Ve=$(je,!0);j(je),j(Se);var Xe=se(Se,2);{var ye=Ce=>{var C=XT();Zt(C,21,G,M=>M.uuid,(M,H)=>{const re=O(()=>l.has(u(H).uuid)),ue=O(()=>S.has(u(H).uuid));var be=WT(),ge=$(be),ae=$(ge);{var fe=Ye=>{Sl(Ye,{class:"h-3 w-3 text-muted-foreground/60"})},Re=Ye=>{Ml(Ye,{class:"h-3 w-3 text-muted-foreground"})};xe(ae,Ye=>{u(re)?Ye(fe):Ye(Re,-1)})}j(ge);var Le=se(ge,2),Ee=$(Le,!0);j(Le);var De=se(Le,2),et=$(De,!0);j(De),j(be),Me((Ye,ht)=>{Qt(be,"aria-selected",u(ue)),Dt(be,1,`gap-1.5 pl-5 pr-2 py-0.5 flex cursor-pointer items-center transition-colors
|
|
5012
5012
|
${u(ue)?"bg-primary/10 hover:bg-primary/15":"hover:bg-muted"}
|
|
5013
|
-
${u(re)?"opacity-40":""}`,"svelte-vc2vi3"),Qt(ge,"title",u(re)?u(i).showObject:u(i).hideObject),Qt(ge,"aria-label",u(re)?u(i).showObject:u(i).hideObject),Dt(Le,1,`min-w-0 text-xs flex-1 truncate ${u(re)?"text-muted-foreground line-through":"text-foreground/80"}`),Ae(Ee,Ye),Ae(et,ht)},[()=>v(u(H)),()=>y(u(H))]),Xt("mousedown",be,Ye=>{Ye.stopPropagation(),Ye.shiftKey&&Ye.preventDefault()}),Xt("click",be,Ye=>_(u(H).uuid,Ye)),Xt("keydown",be,Ye=>Ye.key==="Enter"&&_(u(H).uuid,Ye)),Xt("click",ge,Ye=>{Ye.stopPropagation(),f(u(H))}),P(M,be)}),j(C),P(Ce,C)};xe(Xe,Ce=>{u(
|
|
5013
|
+
${u(re)?"opacity-40":""}`,"svelte-vc2vi3"),Qt(ge,"title",u(re)?u(i).showObject:u(i).hideObject),Qt(ge,"aria-label",u(re)?u(i).showObject:u(i).hideObject),Dt(Le,1,`min-w-0 text-xs flex-1 truncate ${u(re)?"text-muted-foreground line-through":"text-foreground/80"}`),Ae(Ee,Ye),Ae(et,ht)},[()=>v(u(H)),()=>y(u(H))]),Xt("mousedown",be,Ye=>{Ye.stopPropagation(),Ye.shiftKey&&Ye.preventDefault()}),Xt("click",be,Ye=>_(u(H).uuid,Ye)),Xt("keydown",be,Ye=>Ye.key==="Enter"&&_(u(H).uuid,Ye)),Xt("click",ge,Ye=>{Ye.stopPropagation(),f(u(H))}),P(M,be)}),j(C),P(Ce,C)};xe(Xe,Ce=>{u(ce)||Ce(ye)})}Me(()=>{Qt(ze,"aria-label",u(ce)?u(i).expandLayer:u(i).collapseLayer),Qt(Pe,"title",u(ie)?u(i).showLayer:u(i).hideLayer),Qt(Pe,"aria-label",u(ie)?u(i).showLayer:u(i).hideLayer),Dt(He,1,`min-w-0 text-xs font-medium flex-1 truncate ${u(ie)?"text-muted-foreground/40 line-through":"text-foreground"}`),Ae(V,ve()),Ae(Ve,G().length)}),Xt("click",ze,()=>x(ve())),Xt("click",Pe,()=>m(ve(),G())),P(B,pe)});var z=se(R,2);{var q=B=>{var ee=qT(),de=$(ee);Sl(de,{class:"mb-2 h-5 w-5 text-muted-foreground/30"});var ve=se(de,2),G=$(ve,!0);j(ve),j(ee),Me(()=>Ae(G,u(i).noObjects)),P(B,ee)},Y=O(()=>a().length===0),te=B=>{var ee=YT(),de=$(ee);sh(de,{class:"mb-2 h-5 w-5 text-muted-foreground/30"});var ve=se(de,2),G=$(ve,!0);j(ve),j(ee),Me(ie=>Ae(G,ie),[()=>u(i).noResultsFor.replace("{query}",u(w))]),P(B,ee)},le=O(()=>b().size===0);xe(z,B=>{u(Y)?B(q):u(le)&&B(te,1)})}j(N),j(T),Me(()=>Qt(F,"placeholder",u(i).searchObjects)),Xt("mousedown",T,()=>{S.clear(),W(A,null)}),Sp(F,()=>u(w),B=>W(w,B)),P(n,T),at()}zi(["mousedown","click","keydown"]);var $T=K('<div class="px-4 pt-3 pb-2 border-b"><!></div>'),JT=K('<p class="px-4 py-3 text-xs text-muted-foreground"> </p>'),QT=K('<div class="gap-2 flex"><span class="shrink-0 text-muted-foreground"> </span> <span> </span></div>'),eA=K('<div class="space-y-0.5"></div>'),tA=K("<div> </div>"),nA=K('<div class="space-y-1 text-left"></div>'),iA=K('<div class="gap-2 flex"><span class="shrink-0 text-muted-foreground"> </span> <span> </span></div>'),rA=K('<div class="space-y-0.5 text-left"></div>'),sA=K('<span class="font-mono"> </span>'),aA=K("<span> </span>"),oA=K('<span class="break-all"> </span>'),lA=K('<tr class="border-b border-border/60 transition-colors hover:bg-muted/40"><th scope="row" class="px-4 py-2 font-normal text-left align-top whitespace-nowrap text-muted-foreground"> </th><td class="px-4 py-2 text-right align-top text-foreground"><!></td></tr>'),cA=K('<table class="text-xs w-full border-collapse"><tbody></tbody></table>'),uA=K('<!> <div class="max-h-80 overflow-y-auto"><!></div>',1);function dA(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages),r=new Set(["name","layer","originalIndex","sourceComponentId"]);let s=oe(e,"open",15),a=oe(e,"isFullscreen",3,!1);Pt(()=>{document.body.toggleAttribute("data-viewer-fullscreen",a())});const o=()=>{if(!e.metadata)return{};const d=Object.entries(e.metadata).filter(([h])=>!r.has(h)),f={};for(const[h,p]of d)h==="metadata"&&typeof p=="object"&&p!==null&&!Array.isArray(p)?Object.assign(f,p):f[h]=p;return f};var l=we(),c=Q(l);Ne(c,()=>wr,(d,f)=>{f(d,{get onOpenChange(){return e.onOpenChange},get open(){return s()},set open(h){s(h)},children:(h,p)=>{var m=we(),x=Q(m);Ne(x,()=>Er,(g,v)=>{v(g,{class:"min-w-60 max-w-xs p-0 gap-0 w-auto overflow-hidden",children:(y,w)=>{var b=uA(),E=Q(b);{var S=k=>{var U=$T(),N=$(U);Ne(N,()=>dr,(R,z)=>{z(R,{class:"text-sm font-semibold",children:(q,Y)=>{yt();var te=Et();Me(()=>Ae(te,e.meshName)),P(q,te)},$$slots:{default:!0}})}),j(U),P(k,U)},A=k=>{var U=we(),N=Q(U);Ne(N,()=>dr,(R,z)=>{z(R,{class:"sr-only",children:(q,Y)=>{yt();var te=Et();Me(()=>Ae(te,u(i).objectFallbackName)),P(q,te)},$$slots:{default:!0}})}),P(k,U)};xe(E,k=>{e.meshName?k(S):k(A,-1)})}var _=se(E,2),T=$(_);{var D=k=>{var U=JT(),N=$(U,!0);j(U),Me(()=>Ae(N,u(i).noMetadata)),P(k,U)},L=O(()=>!e.metadata||Object.keys(o()).length===0),F=k=>{var U=cA(),N=$(U);Zt(N,21,()=>Object.entries(o()),([R,z])=>R,(R,z)=>{var q=O(()=>Mr(u(z),2));let Y=()=>u(q)[0],te=()=>u(q)[1];var le=lA(),B=$(le),ee=$(B,!0);j(B);var de=se(B),ve=$(de);{var G=pe=>{var Se=we(),ze=Q(Se);{var Ue=Ie=>{var We=nA();Zt(We,21,te,bp,(Oe,He)=>{var V=we(),je=Q(V);{var Ve=ye=>{var Ce=eA();Zt(Ce,21,()=>Object.entries(u(He)),([C,M])=>C,(C,M)=>{var H=O(()=>Mr(u(M),2));let re=()=>u(H)[0],ue=()=>u(H)[1];var be=QT(),ge=$(be),ae=$(ge);j(ge);var fe=se(ge,2),Re=$(fe,!0);j(fe),j(be),Me(()=>{Ae(ae,`${re()??""}:`),Ae(Re,ue())}),P(C,be)}),j(Ce),P(ye,Ce)},Xe=ye=>{var Ce=tA(),C=$(Ce,!0);j(Ce),Me(()=>Ae(C,u(He))),P(ye,Ce)};xe(je,ye=>{typeof u(He)=="object"?ye(Ve):ye(Xe,-1)})}P(Oe,V)}),j(We),P(Ie,We)},Pe=O(()=>Array.isArray(te())),ke=Ie=>{var We=rA();Zt(We,21,()=>Object.entries(te()),([Oe,He])=>Oe,(Oe,He)=>{var V=O(()=>Mr(u(He),2));let je=()=>u(V)[0],Ve=()=>u(V)[1];var Xe=iA(),ye=$(Xe),Ce=$(ye);j(ye);var C=se(ye,2),M=$(C,!0);j(C),j(Xe),Me(()=>{Ae(Ce,`${je()??""}:`),Ae(M,Ve())}),P(Oe,Xe)}),j(We),P(Ie,We)};xe(ze,Ie=>{u(Pe)?Ie(Ue):Ie(ke,-1)})}P(pe,Se)},ie=pe=>{var Se=sA(),ze=$(Se,!0);j(Se),Me(()=>Ae(ze,te())),P(pe,Se)},Z=pe=>{var Se=aA(),ze=$(Se,!0);j(Se),Me(()=>{Dt(Se,1,Uo(te()?"text-green-500":"text-muted-foreground")),Ae(ze,te()?"true":"false")}),P(pe,Se)},ce=pe=>{var Se=oA(),ze=$(Se,!0);j(Se),Me(()=>Ae(ze,te())),P(pe,Se)};xe(ve,pe=>{typeof te()=="object"&&te()!==null?pe(G):typeof te()=="number"?pe(ie,1):typeof te()=="boolean"?pe(Z,2):pe(ce,-1)})}j(de),j(le),Me(()=>Ae(ee,Y())),P(R,le)}),j(N),j(U),P(k,U)};xe(T,k=>{u(L)?k(D):k(F,-1)})}j(_),P(y,b)},$$slots:{default:!0}})}),P(h,m)},$$slots:{default:!0}})}),P(n,l),at()}function hA(n){return typeof n=="function"}function Ud(n){return n!==null&&typeof n=="object"}const fA=["string","number","bigint","boolean"];function vu(n){return n==null||fA.includes(typeof n)?!0:Array.isArray(n)?n.every(e=>vu(e)):typeof n=="object"?Object.getPrototypeOf(n)===Object.prototype:!1}const ha=Symbol("box"),Fd=Symbol("is-writable");function pA(n){return Ud(n)&&ha in n}function mA(n){return Mt.isBox(n)&&Fd in n}function Mt(n){let e=Fe(Ps(n));return{[ha]:!0,[Fd]:!0,get current(){return u(e)},set current(t){W(e,t,!0)}}}function gA(n,e){const t=O(n);return e?{[ha]:!0,[Fd]:!0,get current(){return u(t)},set current(i){e(i)}}:{[ha]:!0,get current(){return n()}}}function vA(n){return Mt.isBox(n)?n:hA(n)?Mt.with(n):Mt(n)}function _A(n){return Object.entries(n).reduce((e,[t,i])=>Mt.isBox(i)?(Mt.isWritableBox(i)?Object.defineProperty(e,t,{get(){return i.current},set(r){i.current=r}}):Object.defineProperty(e,t,{get(){return i.current}}),e):Object.assign(e,{[t]:i}),{})}function xA(n){return Mt.isWritableBox(n)?{[ha]:!0,get current(){return n.current}}:n}Mt.from=vA;Mt.with=gA;Mt.flatten=_A;Mt.readonly=xA;Mt.isBox=pA;Mt.isWritableBox=mA;function bA(...n){return function(e){for(const t of n)if(t){if(e.defaultPrevented)return;typeof t=="function"?t.call(this,e):t.current?.call(this,e)}}}const yA=/\d/,SA=["-","_","/","."];function MA(n=""){if(!yA.test(n))return n!==n.toLowerCase()}function wA(n){const e=[];let t="",i,r;for(const s of n){const a=SA.includes(s);if(a===!0){e.push(t),t="",i=void 0;continue}const o=MA(s);if(r===!1){if(i===!1&&o===!0){e.push(t),t=s,i=o;continue}if(i===!0&&o===!1&&t.length>1){const l=t.at(-1);e.push(t.slice(0,Math.max(0,t.length-1))),t=l+s,i=o;continue}}t+=s,i=o,r=a}return e.push(t),e}function ig(n){return n?wA(n).map(e=>TA(e)).join(""):""}function EA(n){return AA(ig(n||""))}function TA(n){return n?n[0].toUpperCase()+n.slice(1):""}function AA(n){return n?n[0].toLowerCase()+n.slice(1):""}function vo(n){if(!n)return{};const e={};function t(i,r){if(i.startsWith("-moz-")||i.startsWith("-webkit-")||i.startsWith("-ms-")||i.startsWith("-o-")){e[ig(i)]=r;return}if(i.startsWith("--")){e[i]=r;return}e[EA(i)]=r}return _v(n,t),e}function rg(...n){return(...e)=>{for(const t of n)typeof t=="function"&&t(...e)}}function CA(n,e,t,i){const r=Array.isArray(e)?e:[e];return r.forEach(s=>n.addEventListener(s,t,i)),()=>{r.forEach(s=>n.removeEventListener(s,t,i))}}function PA(n,e){const t=RegExp(n,"g");return i=>{if(typeof i!="string")throw new TypeError(`expected an argument of type string, but got ${typeof i}`);return i.match(t)?i.replace(t,e):i}}const RA=PA(/[A-Z]/,n=>`-${n.toLowerCase()}`);function DA(n){if(!n||typeof n!="object"||Array.isArray(n))throw new TypeError(`expected an argument of type object, but got ${typeof n}`);return Object.keys(n).map(e=>`${RA(e)}: ${n[e]};`).join(`
|
|
5014
5014
|
`)}function sg(n={}){return DA(n).replace(`
|
|
5015
|
-
`," ")}const LA={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",transform:"translateX(-100%)"};sg(LA);const IA=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],NA=new Set(IA);function UA(n){return NA.has(n)}function Od(...n){const e={...n[0]};for(let t=1;t<n.length;t++){const i=n[t];if(i){for(const r of Object.keys(i)){const s=e[r],a=i[r],o=typeof s=="function",l=typeof a=="function";if(o&&UA(r)){const c=s,d=a;e[r]=bA(c,d)}else if(o&&l)e[r]=rg(s,a);else if(r==="class"){const c=vu(s),d=vu(a);c&&d?e[r]=bl(s,a):c?e[r]=bl(s):d&&(e[r]=bl(a))}else if(r==="style"){const c=typeof s=="object",d=typeof a=="object",f=typeof s=="string",h=typeof a=="string";if(c&&d)e[r]={...s,...a};else if(c&&h){const p=vo(a);e[r]={...s,...p}}else if(f&&d){const p=vo(s);e[r]={...p,...a}}else if(f&&h){const p=vo(s),
|
|
5016
|
-
`," ")),e.hidden!==!0&&(e.hidden=void 0,delete e.hidden),e.disabled!==!0&&(e.disabled=void 0,delete e.disabled),e}const FA=typeof window<"u"?window:void 0;function OA(n){let e=n.activeElement;for(;e?.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}class zA{#e;#t;constructor(e={}){const{window:t=FA,document:i=t?.document}=e;t!==void 0&&(this.#e=i,this.#t=Gg(r=>{const s=dn(t,"focusin",r),a=dn(t,"focusout",r);return()=>{s(),a()}}))}get current(){return this.#t?.(),this.#e?OA(this.#e):null}}new zA;function BA(n){Vg().then(n)}const kA=9;function VA(n){return Ud(n)&&n.nodeType===kA}function HA(n){return Ud(n)&&n.constructor?.name==="VisualViewport"}function GA(n){return VA(n)?n:HA(n)?n.document:n?.ownerDocument??document}function WA(n){let e=n.activeElement;for(;e?.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}class zd{element;#e=O(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return u(this.#e)}set root(e){W(this.#e,e)}constructor(e){typeof e=="function"?this.element=Mt.with(e):this.element=e}getDocument=()=>GA(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>WA(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)}function Bd(n,e){return{[xv()]:t=>Mt.isBox(n)?(n.current=t,wn(()=>e?.(t)),()=>{"isConnected"in t&&t.isConnected||(n.current=null)}):(n(t),wn(()=>e?.(t)),()=>{"isConnected"in t&&t.isConnected||n(null)})}}function XA({layout:n,panesArray:e,pivotIndices:t}){let i=0,r=100,s=0,a=0;const o=t[0];for(let f=0;f<e.length;f++){const h=e[f].constraints,{maxSize:p=100,minSize:g=0}=h;f===o?(i=g,r=p):(s+=g,a+=p)}const l=Math.min(r,100-s),c=Math.max(i,100-a),d=n[o];return{valueMax:l,valueMin:c,valueNow:d}}function Kt(n,e="Assertion failed!"){if(!n)throw console.error(e),new Error(e)}const jA=100,kd=10;function Gn(n,e,t=kd){return fa(n,e,t)===0}function fa(n,e,t=kd){const i=Wf(n,t),r=Wf(e,t);return Math.sign(i-r)}function js(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Wf(n,e){return Number.parseFloat(n.toFixed(e))}const pl=typeof document<"u";function qA(n){return n instanceof HTMLElement}function ag(n){return n.type==="keydown"}function og(n){return n.type.startsWith("mouse")}function lg(n){return n.type.startsWith("touch")}function ps({paneConstraints:n,paneIndex:e,initialSize:t}){const i=n[e];Kt(i!=null,"Pane constraints should not be null.");const{collapsedSize:r=0,collapsible:s,maxSize:a=100,minSize:o=0}=i;let l=t;return fa(l,o)<0&&(l=YA(l,s,r,o)),l=Math.min(a,l),Number.parseFloat(l.toFixed(kd))}function YA(n,e,t,i){if(!e)return i;const r=(t+i)/2;return fa(n,r)<0?t:i}function Cr(){}function KA({groupId:n,layout:e,panesArray:t,domContext:i}){const r=Ma(n,i);for(let s=0;s<t.length-1;s++){const{valueMax:a,valueMin:o,valueNow:l}=XA({layout:e,panesArray:t,pivotIndices:[s,s+1]}),c=r[s];if(qA(c)){const d=t[s];c.setAttribute("aria-controls",d.opts.id.current),c.setAttribute("aria-valuemax",`${Math.round(a)}`),c.setAttribute("aria-valuemin",`${Math.round(o)}`),c.setAttribute("aria-valuenow",l!=null?`${Math.round(l)}`:"")}}return()=>{for(const s of r)s.removeAttribute("aria-controls"),s.removeAttribute("aria-valuemax"),s.removeAttribute("aria-valuemin"),s.removeAttribute("aria-valuenow")}}function Ma(n,e){return pl?Array.from(e.querySelectorAll(`[data-pane-resizer-id][data-pane-group-id="${n}"]`)):[]}function cg({groupId:n,id:e,domContext:t}){return pl?Ma(n,t).findIndex(s=>s.getAttribute("data-pane-resizer-id")===e)??null:null}function Xf({groupId:n,dragHandleId:e,domContext:t}){const i=cg({groupId:n,id:e,domContext:t});return i!=null?[i,i+1]:[-1,-1]}function ls(n,e,t){const i=n.map(c=>c.constraints),r=cs(n,e),s=i[r],o=r===n.length-1?[r-1,r]:[r,r+1],l=t[r];return{...s,paneSize:l,pivotIndices:o}}function cs(n,e){return n.findIndex(t=>t.opts.id.current===e.opts.id.current)}function qs(n,e,t){for(let i=0;i<e.length;i++){const r=e[i],s=n[i];Kt(s);const{collapsedSize:a=0,collapsible:o}=s.constraints,l=t[s.opts.id.current];if(!(l==null||r!==l))continue;t[s.opts.id.current]=r;const{onCollapse:c,onExpand:d,onResize:f}=s.callbacks;f?.(r,l),o&&(c||d)&&(d&&(l==null||l===a)&&r!==a&&d(),c&&(l==null||l!==a)&&r===a&&c())}}function ZA({panesArray:n}){const e=Array(n.length),t=n.map(s=>s.constraints);let i=0,r=100;for(let s=0;s<n.length;s++){const a=t[s];Kt(a);const{defaultSize:o}=a;o!=null&&(i++,e[s]=o,r-=o)}for(let s=0;s<n.length;s++){const a=t[s];Kt(a);const{defaultSize:o}=a;if(o!=null)continue;const l=n.length-i,c=r/l;i++,e[s]=c,r-=c}return e}function $A({layout:n,paneConstraints:e}){const t=[...n],i=t.reduce((s,a)=>s+a,0);if(t.length!==e.length)throw new Error(`Invalid ${e.length} pane layout: ${t.map(s=>`${s}%`).join(", ")}`);if(!Gn(i,100))for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=100/i*a;t[s]=o}let r=0;for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=ps({paneConstraints:e,paneIndex:s,initialSize:a});a!==o&&(r+=a-o,t[s]=o)}if(!Gn(r,0))for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=a+r,l=ps({paneConstraints:e,paneIndex:s,initialSize:o});if(a!==l&&(r-=l-a,t[s]=l,Gn(r,0)))break}return t}function JA(n,e){if(!pl)return null;const t=e.querySelector(`[data-pane-group][data-pane-group-id="${n}"]`);return t||null}function Vd(n,e){if(!pl)return null;const t=e.querySelector(`[data-pane-resizer-id="${n}"]`);return t||null}function QA({event:n,dragHandleId:e,dir:t,initialDragState:i,domContext:r}){const s=t==="horizontal",a=Vd(e,r);Kt(a);const o=a.getAttribute("data-pane-group-id");Kt(o);const{initialCursorPosition:l}=i,c=ug(t,n),d=JA(o,r);Kt(d);const f=d.getBoundingClientRect(),h=s?f.width:f.height;return(c-l)/h*100}function e2({event:n,dragHandleId:e,dir:t,initialDragState:i,keyboardResizeBy:r,domContext:s}){if(ag(n)){const a=t==="horizontal";let o=0;n.shiftKey?o=100:r!=null?o=r:o=10;let l=0;switch(n.key){case"ArrowDown":l=a?0:o;break;case"ArrowLeft":l=a?-o:0;break;case"ArrowRight":l=a?o:0;break;case"ArrowUp":l=a?0:-o;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return i==null?0:QA({event:n,dragHandleId:e,dir:t,initialDragState:i,domContext:s})}function ug(n,e){const t=n==="horizontal";if(og(e))return t?e.clientX:e.clientY;if(lg(e)){const i=e.touches[0];return Kt(i),t?i.screenX:i.screenY}else throw new Error(`Unsupported event type "${e.type}"`)}function t2({groupId:n,handleId:e,panesArray:t,domContext:i}){const r=Vd(e,i),s=Ma(n,i),a=r?s.indexOf(r):-1,o=t[a]?.opts.id.current??null,l=t[a+1]?.opts.id.current??null;return[o,l]}function Ys({delta:n,layout:e,paneConstraints:t,pivotIndices:i,trigger:r}){if(Gn(n,0))return e;const s=[...e],[a,o]=i;let l=0;if(r==="keyboard"){{const d=n<0?o:a,f=t[d];if(Kt(f),f.collapsible){const h=e[d];Kt(h!=null);const p=t[d];Kt(p);const{collapsedSize:g=0,minSize:x=0}=p;if(Gn(h,g)){const m=x-h;fa(m,Math.abs(n))>0&&(n=n<0?0-m:m)}}}{const d=n<0?a:o,f=t[d];Kt(f);const{collapsible:h}=f;if(h){const p=e[d];Kt(p!=null);const g=t[d];Kt(g);const{collapsedSize:x=0,minSize:m=0}=g;if(Gn(p,m)){const v=p-x;fa(v,Math.abs(n))>0&&(n=n<0?0-v:v)}}}}{const d=n<0?1:-1;let f=n<0?o:a,h=0;for(;;){const g=e[f];Kt(g!=null);const m=ps({paneConstraints:t,paneIndex:f,initialSize:100})-g;if(h+=m,f+=d,f<0||f>=t.length)break}const p=Math.min(Math.abs(n),Math.abs(h));n=n<0?0-p:p}{let f=n<0?a:o;for(;f>=0&&f<t.length;){const h=Math.abs(n)-Math.abs(l),p=e[f];Kt(p!=null);const g=p-h,x=ps({paneConstraints:t,paneIndex:f,initialSize:g});if(!Gn(p,x)&&(l+=p-x,s[f]=x,l.toPrecision(3).localeCompare(Math.abs(n).toPrecision(3),void 0,{numeric:!0})>=0))break;n<0?f--:f++}}if(Gn(l,0))return e;{const d=n<0?o:a,f=e[d];Kt(f!=null);const h=f+l,p=ps({paneConstraints:t,paneIndex:d,initialSize:h});if(s[d]=p,!Gn(p,h)){let g=h-p,m=n<0?o:a;for(;m>=0&&m<t.length;){const v=s[m];Kt(v!=null);const y=v+g,w=ps({paneConstraints:t,paneIndex:m,initialSize:y});if(Gn(v,w)||(g-=w-v,s[m]=w),Gn(g,0))break;n>0?m--:m++}}}const c=s.reduce((d,f)=>f+d,0);return Gn(c,100)?s:e}let _u=null,Sr=null;function dg(n){switch(n){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function n2(){Sr!==null&&(document.head.removeChild(Sr),_u=null,Sr=null)}function uc(n,e){if(_u===n)return;_u=n;const t=dg(n);Sr===null&&(Sr=e.createElement("style"),e.head.appendChild(Sr)),Sr.innerHTML=`*{cursor: ${t}!important;}`}function i2({defaultSize:n,dragState:e,layout:t,panesArray:i,paneIndex:r,precision:s=3}){const a=t[r];let o;return a==null?o=n??"1":i.length===1?o="1":o=a.toPrecision(s),{flexBasis:0,flexGrow:o,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function jf(n){try{if(typeof localStorage>"u")throw new TypeError("localStorage is not supported in this environment");n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>localStorage.setItem(e,t)}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function hg(n){return`paneforge:${n}`}function fg(n){return n.map(t=>t.opts.order.current?`${t.opts.order.current}:${JSON.stringify(t.constraints)}`:JSON.stringify(t.constraints)).sort().join(",")}function pg(n,e){try{const t=hg(n),i=e.getItem(t),r=JSON.parse(i||"");if(typeof r=="object"&&r!==null)return r}catch{}return null}function r2(n,e,t){const i=pg(n,t)||{},r=fg(e);return i[r]||null}function s2(n,e,t,i,r){const s=hg(n),a=fg(e),o=pg(n,r)||{};o[a]={expandToSizes:Object.fromEntries(t.entries()),layout:i};try{r.setItem(s,JSON.stringify(o))}catch(l){console.error(l)}}const qf={};function a2(n,e=10){let t=null;return(...r)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...r)},e)}}function o2({autoSaveId:n,layout:e,storage:t,panesArray:i,paneSizeBeforeCollapse:r}){if(e.length===0||e.length!==i.length)return;let s=qf[n];s==null&&(s=a2(s2,jA),qf[n]=s);const a=[...i],o=new Map(r);s(n,a,o,e,t)}const ta={getItem:n=>(jf(ta),ta.getItem(n)),setItem:(n,e)=>{jf(ta),ta.setItem(n,e)}},Hd=new Kv("PaneGroup");class Gd{static create(e){return Hd.set(new Gd(e))}opts;attachment;domContext;#e=Fe(null);get dragState(){return u(this.#e)}set dragState(e){W(this.#e,e)}#t=Fe([]);get layout(){return u(this.#t)}set layout(e){W(this.#t,e)}#n=Fe([]);get panesArray(){return u(this.#n)}set panesArray(e){W(this.#n,e)}#i=Fe(!1);get panesArrayChanged(){return u(this.#i)}set panesArrayChanged(e){W(this.#i,e,!0)}#r=Fe(Ps({}));get paneIdToLastNotifiedSizeMap(){return u(this.#r)}set paneIdToLastNotifiedSizeMap(e){W(this.#r,e,!0)}paneSizeBeforeCollapseMap=new Map;prevDelta=0;constructor(e){this.opts=e,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),bo([()=>this.opts.id.current,()=>this.layout,()=>this.panesArray],()=>KA({groupId:this.opts.id.current,layout:this.layout,panesArray:this.panesArray,domContext:this.domContext})),Pt(()=>wn(()=>this.#s())),bo([()=>this.opts.autoSaveId.current,()=>this.layout,()=>this.opts.storage.current],()=>{this.opts.autoSaveId.current&&o2({autoSaveId:this.opts.autoSaveId.current,layout:this.layout,storage:this.opts.storage.current,panesArray:this.panesArray,paneSizeBeforeCollapse:this.paneSizeBeforeCollapseMap})}),bo(()=>this.panesArrayChanged,()=>{if(!this.panesArrayChanged)return;this.panesArrayChanged=!1;const t=this.layout;let i=null;if(this.opts.autoSaveId.current){const s=r2(this.opts.autoSaveId.current,this.panesArray,this.opts.storage.current);s&&(this.paneSizeBeforeCollapseMap=new Map(Object.entries(s.expandToSizes)),i=s.layout)}i==null&&(i=ZA({panesArray:this.panesArray}));const r=$A({layout:i,paneConstraints:this.panesArray.map(s=>s.constraints)});js(t,r)||(this.layout=r,this.opts.onLayout.current?.(r),qs(this.panesArray,r,this.paneIdToLastNotifiedSizeMap))})}setLayout=e=>{this.layout=e};registerResizeHandle=e=>t=>{t.preventDefault();const i=this.opts.direction.current,r=this.dragState,s=this.opts.id.current,a=this.opts.keyboardResizeBy.current,o=this.layout,l=this.panesArray,{initialLayout:c}=r??{},d=this.domContext.getDocument(),f=Xf({groupId:s,dragHandleId:e,domContext:this.domContext});let h=e2({event:t,dragHandleId:e,dir:i,initialDragState:r,keyboardResizeBy:a,domContext:this.domContext});if(h===0)return;const p=i==="horizontal";d.dir==="rtl"&&p&&(h=-h);const g=l.map(v=>v.constraints),x=Ys({delta:h,layout:c??o,paneConstraints:g,pivotIndices:f,trigger:ag(t)?"keyboard":"mouse-or-touch"}),m=!js(o,x);(og(t)||lg(t))&&this.prevDelta!==h&&(this.prevDelta=h,uc(m?p?"horizontal":"vertical":p?h<0?"horizontal-min":"horizontal-max":h<0?"vertical-min":"vertical-max",d)),m&&(this.setLayout(x),this.opts.onLayout.current?.(x),qs(l,x,this.paneIdToLastNotifiedSizeMap))};resizePane=(e,t)=>{const i=this.layout,r=this.panesArray,s=r.map(f=>f.constraints),{paneSize:a,pivotIndices:o}=ls(r,e,i);Kt(a!=null);const c=cs(r,e)===r.length-1?a-t:t-a,d=Ys({delta:c,layout:i,paneConstraints:s,pivotIndices:o,trigger:"imperative-api"});js(i,d)||(this.setLayout(d),this.opts.onLayout.current?.(d),qs(r,d,this.paneIdToLastNotifiedSizeMap))};startDragging=(e,t)=>{const i=this.opts.direction.current,r=this.layout,s=Vd(e,this.domContext);Kt(s);const a=ug(i,t);this.dragState={dragHandleId:e,dragHandleRect:s.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r}};stopDragging=()=>{n2(),this.dragState=null};isPaneCollapsed=e=>{const t=this.panesArray,i=this.layout,{collapsedSize:r=0,collapsible:s,paneSize:a}=ls(t,e,i);return typeof a!="number"||typeof r!="number"?!1:s===!0&&Gn(a,r)};expandPane=e=>{const t=this.layout,i=this.panesArray;if(!e.constraints.collapsible)return;const r=i.map(g=>g.constraints),{collapsedSize:s=0,paneSize:a,minSize:o=0,pivotIndices:l}=ls(i,e,t);if(a!==s)return;const c=this.paneSizeBeforeCollapseMap.get(e.opts.id.current),d=c!=null&&c>=o?c:o,h=cs(i,e)===i.length-1?a-d:d-a,p=Ys({delta:h,layout:t,paneConstraints:r,pivotIndices:l,trigger:"imperative-api"});js(t,p)||(this.setLayout(p),this.opts.onLayout.current?.(p),qs(i,p,this.paneIdToLastNotifiedSizeMap))};collapsePane=e=>{const t=this.layout,i=this.panesArray;if(!e.constraints.collapsible)return;const r=i.map(f=>f.constraints),{collapsedSize:s=0,paneSize:a,pivotIndices:o}=ls(i,e,t);if(Kt(a!=null),a===s)return;this.paneSizeBeforeCollapseMap.set(e.opts.id.current,a);const c=cs(i,e)===i.length-1?a-s:s-a,d=Ys({delta:c,layout:t,paneConstraints:r,pivotIndices:o,trigger:"imperative-api"});js(t,d)||(this.layout=d,this.opts.onLayout.current?.(d),qs(i,d,this.paneIdToLastNotifiedSizeMap))};getPaneSize=e=>ls(this.panesArray,e,this.layout).paneSize;getPaneStyle=(e,t)=>{const i=this.panesArray,r=this.layout,s=this.dragState,a=cs(i,e);return i2({defaultSize:t,dragState:s,layout:r,panesArray:i,paneIndex:a})};isPaneExpanded=e=>{const{collapsedSize:t=0,collapsible:i,paneSize:r}=ls(this.panesArray,e,this.layout);return!i||r>t};registerPane=e=>{const t=[...this.panesArray,e];return t.sort((i,r)=>{const s=i.opts.order.current,a=r.opts.order.current;return s==null&&a==null?0:s==null?-1:a==null?1:s-a}),this.panesArray=t,this.panesArrayChanged=!0,()=>{const i=[...this.panesArray],r=cs(this.panesArray,e);r<0||(i.splice(r,1),this.panesArray=i,delete this.paneIdToLastNotifiedSizeMap[e.opts.id.current],this.panesArrayChanged=!0)}};#s=()=>{const e=this.opts.id.current,t=Ma(e,this.domContext),i=this.panesArray,r=t.map(s=>{const a=s.getAttribute("data-pane-resizer-id");if(!a)return Cr;const[o,l]=t2({groupId:e,handleId:a,panesArray:i,domContext:this.domContext});if(o==null||l==null)return Cr;const d=CA(s,"keydown",f=>{if(f.defaultPrevented||f.key!=="Enter")return;f.preventDefault();const h=this.panesArray,p=h.findIndex(E=>E.opts.id.current===o);if(p<0)return;const g=h[p];Kt(g);const x=this.layout,m=x[p],{collapsedSize:v=0,collapsible:y,minSize:w=0}=g.constraints;if(!(m!=null&&y))return;const b=Ys({delta:Gn(m,v)?w-m:v-m,layout:x,paneConstraints:h.map(E=>E.constraints),pivotIndices:Xf({groupId:e,dragHandleId:a,domContext:this.domContext}),trigger:"keyboard"});x!==b&&(this.layout=b)});return()=>{d()}});return()=>{for(const s of r)s()}};#a=O(()=>({id:this.opts.id.current,"data-pane-group":"","data-direction":this.opts.direction.current,"data-pane-group-id":this.opts.id.current,style:{display:"flex",flexDirection:this.opts.direction.current==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}const l2=["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home"];class Wd{static create(e){return new Wd(e,Hd.get())}opts;#e;attachment;domContext;#t=O(()=>this.#e.dragState?.dragHandleId===this.opts.id.current);#n=Fe(!1);resizeHandler=null;constructor(e,t){this.opts=e,this.#e=t,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),Pt(()=>{this.opts.disabled.current?this.resizeHandler=null:this.resizeHandler=this.#e.registerResizeHandle(this.opts.id.current)}),Pt(()=>{const i=this.opts.ref.current;if(!i)return;const r=this.opts.disabled.current,s=this.resizeHandler,a=u(this.#t);if(r||s===null||!a)return;const o=h=>{s(h)},l=h=>{s(h)},c=()=>{i.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1)},d=this.domContext.getDocument().body,f=this.domContext.getWindow();return rg(dn(d,"contextmenu",c),dn(d,"mousemove",o),dn(d,"touchmove",o,{passive:!1}),dn(d,"mouseleave",l),dn(f,"mouseup",c),dn(f,"touchend",c))})}#i=e=>{e.preventDefault(),!this.opts.disabled.current&&(this.#e.startDragging(this.opts.id.current,e),this.opts.onDraggingChange.current(!0))};#r=()=>{const e=this.opts.ref.current;e&&(e.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1))};#s=e=>{if(this.opts.disabled.current||!this.resizeHandler||e.defaultPrevented)return;if(l2.includes(e.key)){e.preventDefault(),this.resizeHandler(e);return}if(e.key!=="F6")return;e.preventDefault();const t=Ma(this.#e.opts.id.current,this.domContext),i=cg({groupId:this.#e.opts.id.current,id:this.opts.id.current,domContext:this.domContext});if(i===null)return;let r=0;e.shiftKey?i>0?r=i-1:r=t.length-1:i+1<t.length?r=i+1:r=0,t[r].focus()};#a=()=>{W(this.#n,!1)};#o=()=>{W(this.#n,!0)};#l=e=>{this.#i(e)};#c=()=>{this.#r()};#d=()=>{this.#r()};#h=()=>{this.#r()};#f=e=>{this.#i(e)};#u=O(()=>({id:this.opts.id.current,role:"separator","data-direction":this.#e.opts.direction.current,"data-pane-group-id":this.#e.opts.id.current,"data-active":u(this.#t)?"pointer":u(this.#n)?"keyboard":void 0,"data-enabled":!this.opts.disabled.current,"data-pane-resizer-id":this.opts.id.current,"data-pane-resizer":"",tabIndex:this.opts.tabIndex.current,style:{cursor:dg(this.#e.opts.direction.current),touchAction:"none",userSelect:"none","-webkit-user-select":"none","-webkit-touch-callout":"none"},onkeydown:this.#s,onblur:this.#a,onfocus:this.#o,onmousedown:this.#l,onmouseup:this.#c,ontouchcancel:this.#d,ontouchend:this.#h,ontouchstart:this.#f,...this.attachment}));get props(){return u(this.#u)}set props(e){W(this.#u,e)}}class Xd{static create(e){return new Xd(e,Hd.get())}opts;group;attachment;domContext;#e=Fe("");#t=O(()=>({onCollapse:this.opts.onCollapse.current,onExpand:this.opts.onExpand.current,onResize:this.opts.onResize.current}));get callbacks(){return u(this.#t)}set callbacks(e){W(this.#t,e)}#n=O(()=>({collapsedSize:this.opts.collapsedSize.current,collapsible:this.opts.collapsible.current,defaultSize:this.opts.defaultSize.current,maxSize:this.opts.maxSize.current,minSize:this.opts.minSize.current}));get constraints(){return u(this.#n)}set constraints(e){W(this.#n,e)}#i=e=>{W(this.#e,e,!0),BA(()=>{if(this.opts.ref.current){const t=this.opts.ref.current;if(!(getComputedStyle(t).transitionDuration!=="0s")){W(this.#e,"");return}const s=a=>{a.propertyName==="flex-grow"&&(W(this.#e,""),t.removeEventListener("transitionend",s))};t.addEventListener("transitionend",s)}else W(this.#e,"")})};pane={collapse:()=>{this.#i("collapsing"),this.group.collapsePane(this)},expand:()=>{this.#i("expanding"),this.group.expandPane(this)},getSize:()=>this.group.getPaneSize(this),isCollapsed:()=>this.group.isPaneCollapsed(this),isExpanded:()=>this.group.isPaneExpanded(this),resize:e=>this.group.resizePane(this,e),getId:()=>this.opts.id.current};constructor(e,t){this.opts=e,this.group=t,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),tl(()=>this.group.registerPane(this)),bo(()=>Nu(this.constraints),()=>{this.group.panesArrayChanged=!0})}#r=O(()=>this.group.isPaneCollapsed(this));#s=O(()=>u(this.#e)!==""?u(this.#e):u(this.#r)?"collapsed":"expanded");#a=O(()=>({id:this.opts.id.current,style:this.group.getPaneStyle(this,this.opts.defaultSize.current),"data-pane":"","data-pane-id":this.opts.id.current,"data-pane-group-id":this.group.opts.id.current,"data-collapsed":u(this.#r)?"":void 0,"data-expanded":u(this.#r)?void 0:"","data-pane-state":u(this.#s),...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}var c2=q("<div><!></div>");function u2(n,e){const t=Tn();st(e,!0);let i=oe(e,"autoSaveId",3,null),r=oe(e,"id",3,t),s=oe(e,"keyboardResizeBy",3,null),a=oe(e,"onLayoutChange",3,Cr),o=oe(e,"storage",3,ta),l=oe(e,"ref",15,null),c=ut(e,["$$slots","$$events","$$legacy","autoSaveId","direction","id","keyboardResizeBy","onLayoutChange","storage","ref","child","children"]);const d=Gd.create({id:Mt.with(()=>r()??t),ref:Mt.with(()=>l(),b=>l(b)),autoSaveId:Mt.with(()=>i()),direction:Mt.with(()=>e.direction),keyboardResizeBy:Mt.with(()=>s()),onLayout:Mt.with(()=>a()),storage:Mt.with(()=>o())}),f=()=>d.layout,h=d.setLayout,p=()=>d.opts.id.current,g=O(()=>Od(c,d.props));var x={getLayout:f,setLayout:h,getId:p},m=we(),v=Q(m);{var y=b=>{var E=we(),S=Q(E);pt(S,()=>e.child,()=>({props:u(g)})),P(b,E)},w=b=>{var E=c2();Ft(E,()=>({...u(g)}));var S=$(E);pt(S,()=>e.children??wt),j(E),P(b,E)};xe(v,b=>{e.child?b(y):b(w,-1)})}return P(n,m),at(x)}var d2=q("<div><!></div>");function sa(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",3,t),r=oe(e,"ref",15,null),s=oe(e,"onCollapse",3,Cr),a=oe(e,"onExpand",3,Cr),o=oe(e,"onResize",3,Cr),l=ut(e,["$$slots","$$events","$$legacy","id","ref","collapsedSize","collapsible","defaultSize","maxSize","minSize","onCollapse","onExpand","onResize","order","child","children"]);const c=Xd.create({id:Mt.with(()=>i()),ref:Mt.with(()=>r(),A=>r(A)),collapsedSize:Mt.with(()=>e.collapsedSize),collapsible:Mt.with(()=>e.collapsible),defaultSize:Mt.with(()=>e.defaultSize),maxSize:Mt.with(()=>e.maxSize),minSize:Mt.with(()=>e.minSize),onCollapse:Mt.with(()=>s()),onExpand:Mt.with(()=>a()),onResize:Mt.with(()=>o()),order:Mt.with(()=>e.order)}),d=c.pane.collapse,f=c.pane.expand,h=c.pane.getSize,p=c.pane.isCollapsed,g=c.pane.isExpanded,x=c.pane.resize,m=c.pane.getId,v=O(()=>Od(l,c.props));var y={collapse:d,expand:f,getSize:h,isCollapsed:p,isExpanded:g,resize:x,getId:m},w=we(),b=Q(w);{var E=A=>{var _=we(),T=Q(_);pt(T,()=>e.child,()=>({props:u(v)})),P(A,_)},S=A=>{var _=d2();Ft(_,()=>({...u(v)}));var T=$(_);pt(T,()=>e.children??wt),j(_),P(A,_)};xe(b,A=>{e.child?A(E):A(S,-1)})}return P(n,w),at(y)}var h2=q("<div><!></div>");function f2(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",3,t),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"onDraggingChange",3,Cr),o=oe(e,"tabindex",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","ref","disabled","onDraggingChange","tabindex","child","children"]);const c=Wd.create({id:Mt.with(()=>i()),ref:Mt.with(()=>r(),x=>r(x)),disabled:Mt.with(()=>s()),onDraggingChange:Mt.with(()=>a()),tabIndex:Mt.with(()=>o())}),d=O(()=>Od(l,c.props));var f=we(),h=Q(f);{var p=x=>{var m=we(),v=Q(m);pt(v,()=>e.child,()=>({props:u(d)})),P(x,m)},g=x=>{var m=h2();Ft(m,()=>({...u(d)}));var v=$(m);pt(v,()=>e.children??wt),j(m),P(x,m)};xe(h,x=>{e.child?x(p):x(g,-1)})}P(n,f),at()}var p2=q('<div class="h-10 w-1 z-10 flex shrink-0 rounded-lg bg-border transition-[background-color,transform] duration-150 group-hover/handle:scale-y-110 group-hover/handle:bg-foreground/40 group-active/handle:bg-foreground/60"></div>');function xu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"withHandle",3,!1),r=ut(e,["$$slots","$$events","$$legacy","ref","class","withHandle"]);var s=we(),a=Q(s);{let o=O(()=>ci("cn-resizable-handle group/handle after:inset-y-0 after:w-1 data-[direction=vertical]:after:left-0 data-[direction=vertical]:after:h-1 data-[direction=vertical]:after:translate-x-0 relative flex w-px items-center justify-center bg-border after:absolute after:left-1/2 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden data-[direction=vertical]:h-px data-[direction=vertical]:w-full data-[direction=vertical]:after:w-full data-[direction=vertical]:after:-translate-y-1/2 [&[data-direction=vertical]>div]:rotate-90",e.class));Ne(a,()=>f2,(l,c)=>{c(l,mt({"data-slot":"resizable-handle",get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)},children:(d,f)=>{var h=we(),p=Q(h);{var g=x=>{var m=p2();P(x,m)};xe(p,x=>{i()&&x(g)})}P(d,h)},$$slots:{default:!0}}))})}P(n,s),at()}function mg(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"this",15),r=ut(e,["$$slots","$$events","$$legacy","ref","this","class"]);var s=we(),a=Q(s);{let o=O(()=>ci("cn-resizable-panel-group flex h-full w-full data-[direction=vertical]:flex-col",e.class));Ne(a,()=>u2,(l,c)=>{ui(c(l,mt({"data-slot":"resizable-pane-group",get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)}})),d=>i(d),()=>i())})}P(n,s),at()}var m2=q('<div class="inset-0 absolute z-10 animate-[selva-viewer-fade-in_0.2s_ease-out] backdrop-blur-[2px] transition-all duration-300"></div>'),g2=q('<div><img alt="" class="h-8 max-w-32 drop-shadow-sm sm:h-10 w-auto object-contain opacity-80"/></div>'),v2=q("<!> ",1),_2=q("<!> ",1),x2=q("<!> ",1),b2=q('<!> <span class="flex-1"> </span> <!>',1),y2=q("<!> <!>",1),S2=q('<!> <span class="flex-1"> </span> <!>',1),M2=q('<!> <span class="flex-1"> </span> <!>',1),w2=q('<!> <span class="flex-1"> </span> <!>',1),E2=q("<!> ",1),T2=q("<!> ",1),A2=q("<!> ",1),C2=q("<!> <!> <!> <!> <!> <!> <!> <!> <!>",1),P2=q("<!> <!>",1),R2=q("<div><!></div>"),D2=q('<div class="relative h-full w-full" style="touch-action: none;"><canvas class="block h-full w-full"></canvas> <div></div> <!> <!> <!></div>'),L2=q("<!> <!>",1),I2=q("<!> <!>",1),N2=q("<div><!></div> <!>",1);function Yf(n,e){st(e,!0);const t={showScreenshotButton:!0,showFullscreenButton:!0,showSceneManager:!0,showToolsMenu:!0,showGridToggle:!0,enableMeshClick:!0,backgroundColor:"#E6E6E6"};let i=oe(e,"isFullscreen",15,!1),r=oe(e,"isSolving",3,!1),s=oe(e,"isBlurred",3,!1),a=oe(e,"drawerOpen",3,!1),o=oe(e,"viewerConfig",19,()=>({}));const l=O(()=>({...t,...o()})),c=Si();ng(()=>e.lang??c.locale);const d=Si(),f=O(()=>d.messages);let h,p=Fe(null),g=null,x=null,m=null,v=null,y=null,w=null,b=!1,E=Fe(0),S=Fe(!1),A=Fe(!1),_=Fe("perspective"),T=Fe(!1),D=Fe(!1),L=Fe(null),F=Fe(null);const B=[{preset:"top",label:()=>u(f).viewTop},{preset:"front",label:()=>u(f).viewFront},{preset:"right",label:()=>u(f).viewRight},{preset:"back",label:()=>u(f).viewBack},{preset:"left",label:()=>u(f).viewLeft},{preset:"bottom",label:()=>u(f).viewBottom},{preset:"iso",label:()=>u(f).viewIso}];Pt(()=>{if(a())W(S,!0);else{const ve=setTimeout(()=>{W(S,!1)},us.TIMEOUTS.DRAWER_ANIMATION_MS);return()=>clearTimeout(ve)}}),tl(()=>{if(!h)return;const ve={environment:{backgroundColor:u(l).backgroundColor},controls:{},grid:{enabled:u(l).showToolsMenu&&u(l).showGridToggle},gizmo:{enabled:!1},measure:{enabled:u(l).showToolsMenu},events:{onMeshMetadataClicked:u(l).enableMeshClick?ie=>{K(ie)&&(W(L,ie,!0),W(F,ie?.name||u(f).objectFallbackName,!0))}:void 0}},G=jm(h,ve);return W(p,G.scene,!0),g=G.camera,x=G.controls,m=G.cameraController,v=G.measureTool,y=G.grid,y?.setVisible(u(D)),w=G.fitToView,W(_,G.cameraController.getProjection(),!0),()=>{G.dispose()}});function U(){m&&W(_,m.toggleProjection(),!0)}function N(ve){m?.setView(ve)}function R(){v&&(W(T,!u(T)),v.setEnabled(u(T)))}function z(){y&&(W(D,!u(D)),y.setVisible(u(D)))}Pt(()=>{u(p)&&g&&x&&(Nm(u(p),e.meshes,g,x,b),wn(()=>vp(E)),!b&&e.meshes.length>0&&(b=!0))});function Y(){i(!i())}function K(ve){if(!ve)return!1;if(ve.metadata&&typeof ve.metadata=="object"){const Z=ve.metadata;return Object.keys(Z).length>0}const G=new Set(["name","layer","originalIndex","sourceComponentId","vertexCount","faceCount","vertexOffset","faceOffset"]);return Object.entries(ve).filter(([Z])=>!G.has(Z)).length>0}function ne(){h&&requestAnimationFrame(()=>{h.toBlob(ve=>{if(!ve)return;const G=URL.createObjectURL(ve),ie=document.createElement("a"),Z=new Date().toISOString().slice(0,19).replace(/:/g,"-");ie.href=G,ie.download=`viewer-${Z}.png`,document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(G)})})}var ce=N2(),V=Q(ce),ee=$(V);Ne(ee,()=>mg,(ve,G)=>{G(ve,{direction:"horizontal",class:"h-full w-full",children:(ie,Z)=>{var le=I2(),fe=Q(le);Ne(fe,()=>sa,(Ue,Pe)=>{Pe(Ue,{defaultSize:100,minSize:40,children:(ke,Ie)=>{var We=D2(),Oe=$(We);ui(Oe,C=>h=C,()=>h);var He=se(Oe,2),k=se(He,2);{var je=C=>{var M=m2();P(C,M)};xe(k,C=>{r()&&C(je)})}var Ve=se(k,2);{var Xe=C=>{var M=g2(),H=$(M);j(M),Me(()=>{Dt(M,1,`right-4 ${i()?"bottom-4":"bottom-16 sm:bottom-4"} absolute z-20`),Ii(M,u(S)?"opacity: 0; pointer-events: none;":"opacity: 1; pointer-events: none;"),Qt(H,"src",e.logoUrl)}),P(C,M)};xe(Ve,C=>{e.logoUrl&&C(Xe)})}var ye=se(Ve,2);{var Ce=C=>{const M=O(()=>"gap-2 px-2 py-1.5 text-sm flex cursor-pointer select-none items-center rounded-sm outline-none transition-colors hover:bg-muted focus:bg-muted");var H=R2(),re=$(H);Ne(re,()=>T_,(ue,be)=>{be(ue,{children:(ge,ae)=>{var he=P2(),Re=Q(he);Ne(Re,()=>D_,(Ee,De)=>{De(Ee,{class:"h-10 w-10 shadow-lg hover:shadow-xl flex items-center justify-center rounded-lg border border-border bg-card/90 transition-all hover:bg-card active:scale-95 data-[state=open]:bg-secondary/60",get title(){return u(f).toolsMenu},get"aria-label"(){return u(f).toolsMenu},children:(et,Ye)=>{a_(et,{class:"h-5 w-5 text-card-foreground"})},$$slots:{default:!0}})});var Le=se(Re,2);Ne(Le,()=>fv,(Ee,De)=>{De(Ee,{children:(et,Ye)=>{var ht=we(),J=Q(ht);Ne(J,()=>P_,(Ge,Te)=>{Te(Ge,{sideOffset:6,align:"start",class:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 min-w-44 p-1 shadow-md z-10001 rounded-md border bg-popover text-popover-foreground",children:(Ze,qe)=>{var Be=C2(),lt=Q(Be);Ne(lt,()=>Ji,(Rt,qt)=>{qt(Rt,{class:u(M),onSelect:U,children:(en,An)=>{var tn=we(),pn=Q(tn);{var Dn=Yt=>{var Jt=v2(),ln=Q(Jt);o_(ln,{class:"h-4 w-4"});var Gt=se(ln);Me(()=>Ae(Gt,` ${u(f).switchTo2D??""}`)),P(Yt,Jt)},gn=Yt=>{var Jt=_2(),ln=Q(Jt);lh(ln,{class:"h-4 w-4"});var Gt=se(ln);Me(()=>Ae(Gt,` ${u(f).switchTo3D??""}`)),P(Yt,Jt)};xe(pn,Yt=>{u(_)==="perspective"?Yt(Dn):Yt(gn,-1)})}P(en,tn)},$$slots:{default:!0}})});var vt=se(lt,2);Ne(vt,()=>Ji,(Rt,qt)=>{qt(Rt,{class:u(M),onSelect:()=>w?.(),children:(en,An)=>{var tn=x2(),pn=Q(tn);e_(pn,{class:"h-4 w-4"});var Dn=se(pn);Me(()=>Ae(Dn,` ${u(f).fitToView??""}`)),P(en,tn)},$$slots:{default:!0}})});var $t=se(vt,2);Ne($t,()=>v_,(Rt,qt)=>{qt(Rt,{children:(en,An)=>{var tn=y2(),pn=Q(tn);Ne(pn,()=>E_,(gn,Yt)=>{Yt(gn,{class:`${u(M)??""} data-[state=open]:bg-muted`,children:(Jt,ln)=>{var Gt=b2(),I=Q(Gt);lh(I,{class:"h-4 w-4"});var te=se(I,2),de=$(te,!0);j(te);var pe=se(te,2);Du(pe,{class:"h-4 w-4 text-muted-foreground"}),Me(()=>Ae(de,u(f).views)),P(Jt,Gt)},$$slots:{default:!0}})});var Dn=se(pn,2);Ne(Dn,()=>M_,(gn,Yt)=>{Yt(gn,{sideOffset:4,class:"min-w-32 p-1 shadow-md z-10001 rounded-md border bg-popover text-popover-foreground",children:(Jt,ln)=>{var Gt=we(),I=Q(Gt);Zt(I,17,()=>B,({preset:te,label:de})=>te,(te,de)=>{let pe=()=>u(de).preset,_e=()=>u(de).label;var $e=we(),nt=Q($e);Ne(nt,()=>Ji,(Je,ot)=>{ot(Je,{class:"px-2 py-1.5 text-sm flex cursor-pointer items-center rounded-sm transition-colors outline-none select-none hover:bg-muted focus:bg-muted",onSelect:()=>N(pe()),children:(ct,_t)=>{yt();var bt=Et();Me(dt=>Ae(bt,dt),[()=>_e()()]),P(ct,bt)},$$slots:{default:!0}})}),P(te,$e)}),P(Jt,Gt)},$$slots:{default:!0}})}),P(en,tn)},$$slots:{default:!0}})});var It=se($t,2);{let Rt=O(()=>u(T)?"text-primary":"");Ne(It,()=>Ji,(qt,en)=>{en(qt,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(Rt)??""}`},onSelect:R,children:(An,tn)=>{var pn=S2(),Dn=Q(pn);s_(Dn,{class:"h-4 w-4"});var gn=se(Dn,2),Yt=$(gn,!0);j(gn);var Jt=se(gn,2);{var ln=Gt=>{ia(Gt,{class:"h-4 w-4"})};xe(Jt,Gt=>{u(T)&&Gt(ln)})}Me(()=>Ae(Yt,u(f).measure)),P(An,pn)},$$slots:{default:!0}})})}var ii=se(It,2);{var ri=Rt=>{var qt=we(),en=Q(qt);{let An=O(()=>u(D)?"text-primary":"");Ne(en,()=>Ji,(tn,pn)=>{pn(tn,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(An)??""}`},onSelect:z,children:(Dn,gn)=>{var Yt=M2(),Jt=Q(Yt);t_(Jt,{class:"h-4 w-4"});var ln=se(Jt,2),Gt=$(ln,!0);j(ln);var I=se(ln,2);{var te=de=>{ia(de,{class:"h-4 w-4"})};xe(I,de=>{u(D)&&de(te)})}Me(()=>Ae(Gt,u(f).grid)),P(Dn,Yt)},$$slots:{default:!0}})})}P(Rt,qt)};xe(ii,Rt=>{u(l).showGridToggle&&Rt(ri)})}var Or=se(ii,2);{var vl=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>b_,(An,tn)=>{tn(An,{class:"my-1 h-px bg-border"})}),P(Rt,qt)};xe(Or,Rt=>{(u(l).showSceneManager||u(l).showScreenshotButton||u(l).showFullscreenButton)&&Rt(vl)})}var Ns=se(Or,2);{var wa=Rt=>{var qt=we(),en=Q(qt);{let An=O(()=>u(A)?"text-primary":"");Ne(en,()=>Ji,(tn,pn)=>{pn(tn,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(An)??""}`},onSelect:()=>W(A,!u(A)),children:(Dn,gn)=>{var Yt=w2(),Jt=Q(Yt);i_(Jt,{class:"h-4 w-4"});var ln=se(Jt,2),Gt=$(ln,!0);j(ln);var I=se(ln,2);{var te=de=>{ia(de,{class:"h-4 w-4"})};xe(I,de=>{u(A)&&de(te)})}Me(()=>Ae(Gt,u(f).sceneManager)),P(Dn,Yt)},$$slots:{default:!0}})})}P(Rt,qt)};xe(Ns,Rt=>{u(l).showSceneManager&&Rt(wa)})}var Mi=se(Ns,2);{var Us=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>Ji,(An,tn)=>{tn(An,{class:u(M),onSelect:ne,children:(pn,Dn)=>{var gn=E2(),Yt=Q(gn);Zv(Yt,{class:"h-4 w-4"});var Jt=se(Yt);Me(()=>Ae(Jt,` ${u(f).screenshot??""}`)),P(pn,gn)},$$slots:{default:!0}})}),P(Rt,qt)};xe(Mi,Rt=>{u(l).showScreenshotButton&&Rt(Us)})}var Ea=se(Mi,2);{var Ta=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>Ji,(An,tn)=>{tn(An,{class:u(M),onSelect:Y,children:(pn,Dn)=>{var gn=we(),Yt=Q(gn);{var Jt=Gt=>{var I=T2(),te=Q(I);Ou(te,{class:"h-4 w-4"});var de=se(te);Me(()=>Ae(de,` ${u(f).exitFullscreen??""}`)),P(Gt,I)},ln=Gt=>{var I=A2(),te=Q(I);Fu(te,{class:"h-4 w-4"});var de=se(te);Me(()=>Ae(de,` ${u(f).fullscreen??""}`)),P(Gt,I)};xe(Yt,Gt=>{i()?Gt(Jt):Gt(ln,-1)})}P(pn,gn)},$$slots:{default:!0}})}),P(Rt,qt)};xe(Ea,Rt=>{u(l).showFullscreenButton&&Rt(Ta)})}P(Ze,Be)},$$slots:{default:!0}})}),P(et,ht)},$$slots:{default:!0}})}),P(ge,he)},$$slots:{default:!0}})}),j(H),Me(()=>{Dt(H,1,`left-4 ${i()?"bottom-4":"bottom-16 sm:bottom-4"} absolute z-50 flex items-center`),Ii(H,u(S)?"opacity: 0; pointer-events: none;":"opacity: 1; pointer-events: auto;")}),P(C,H)};xe(ye,C=>{u(l).showToolsMenu&&C(Ce)})}j(We),Me(()=>Dt(He,1,`inset-0 blur-overlay absolute z-20 ${s()?"blur-overlay-active":"blur-overlay-inactive"}`,"svelte-13y0czs")),P(ke,We)},$$slots:{default:!0}})});var Se=se(fe,2);{var ze=Ue=>{var Pe=L2(),ke=Q(Pe);Ne(ke,()=>xu,(We,Oe)=>{Oe(We,{withHandle:!0})});var Ie=se(ke,2);Ne(Ie,()=>sa,(We,Oe)=>{Oe(We,{defaultSize:15,minSize:8,maxSize:30,children:(He,k)=>{ZT(He,{get scene(){return u(p)},get sceneVersion(){return u(E)}})},$$slots:{default:!0}})}),P(Ue,Pe)};xe(Se,Ue=>{u(A)&&u(p)&&Ue(ze)})}P(ie,le)},$$slots:{default:!0}})}),j(V);var me=se(V,2);{let ve=O(()=>u(L)!==null);dA(me,{get open(){return u(ve)},get metadata(){return u(L)},get meshName(){return u(F)},get isFullscreen(){return i()},onOpenChange:G=>{G||setTimeout(()=>{W(L,null),W(F,null)},200)}})}Me(()=>Dt(V,1,`min-h-64 sm:min-h-96 lg:min-h-125 relative h-full flex-1 border ${i()?"fullscreen-viewer":"overflow-hidden rounded-[0.625rem]"}`,"svelte-13y0czs")),P(n,ce),at()}var U2=q("<!> ",1),F2=q("<!> ",1),O2=q("<!> ",1),z2=q("<!> ",1),B2=q('<div class="bottom-0 mt-3 pb-3 pt-2 backdrop-blur-sm px-2 sticky border-t border-border/50"><!></div>');function dc(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);let r=oe(e,"hasNeverSolved",3,!1);var s=B2(),a=$(s);{let o=O(()=>e.hasPendingChanges?"default":"ghost"),l=O(()=>!e.hasPendingChanges&&!e.isSolving),c=O(()=>e.hasPendingChanges&&!e.isSolving?"selva-pending-pulse shadow-md":""),d=O(()=>!e.hasPendingChanges&&!e.isSolving?"text-muted-foreground":"");Bn(a,{get variant(){return u(o)},size:"lg",onclick:()=>!e.isSolving&&e.oncalculate(),get disabled(){return u(l)},get"aria-busy"(){return e.isSolving},get class(){return`gap-2 font-medium w-full transition-all duration-200
|
|
5015
|
+
`," ")}const LA={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",transform:"translateX(-100%)"};sg(LA);const IA=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],NA=new Set(IA);function UA(n){return NA.has(n)}function Od(...n){const e={...n[0]};for(let t=1;t<n.length;t++){const i=n[t];if(i){for(const r of Object.keys(i)){const s=e[r],a=i[r],o=typeof s=="function",l=typeof a=="function";if(o&&UA(r)){const c=s,d=a;e[r]=bA(c,d)}else if(o&&l)e[r]=rg(s,a);else if(r==="class"){const c=vu(s),d=vu(a);c&&d?e[r]=bl(s,a):c?e[r]=bl(s):d&&(e[r]=bl(a))}else if(r==="style"){const c=typeof s=="object",d=typeof a=="object",f=typeof s=="string",h=typeof a=="string";if(c&&d)e[r]={...s,...a};else if(c&&h){const p=vo(a);e[r]={...s,...p}}else if(f&&d){const p=vo(s);e[r]={...p,...a}}else if(f&&h){const p=vo(s),m=vo(a);e[r]={...p,...m}}else c?e[r]=s:d?e[r]=a:f?e[r]=s:h&&(e[r]=a)}else e[r]=a!==void 0?a:s}for(const r of Object.getOwnPropertySymbols(i)){const s=e[r],a=i[r];e[r]=a!==void 0?a:s}}}return typeof e.style=="object"&&(e.style=sg(e.style).replaceAll(`
|
|
5016
|
+
`," ")),e.hidden!==!0&&(e.hidden=void 0,delete e.hidden),e.disabled!==!0&&(e.disabled=void 0,delete e.disabled),e}const FA=typeof window<"u"?window:void 0;function OA(n){let e=n.activeElement;for(;e?.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}class zA{#e;#t;constructor(e={}){const{window:t=FA,document:i=t?.document}=e;t!==void 0&&(this.#e=i,this.#t=Gg(r=>{const s=dn(t,"focusin",r),a=dn(t,"focusout",r);return()=>{s(),a()}}))}get current(){return this.#t?.(),this.#e?OA(this.#e):null}}new zA;function BA(n){Vg().then(n)}const kA=9;function VA(n){return Ud(n)&&n.nodeType===kA}function HA(n){return Ud(n)&&n.constructor?.name==="VisualViewport"}function GA(n){return VA(n)?n:HA(n)?n.document:n?.ownerDocument??document}function WA(n){let e=n.activeElement;for(;e?.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}class zd{element;#e=O(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return u(this.#e)}set root(e){W(this.#e,e)}constructor(e){typeof e=="function"?this.element=Mt.with(e):this.element=e}getDocument=()=>GA(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>WA(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)}function Bd(n,e){return{[xv()]:t=>Mt.isBox(n)?(n.current=t,wn(()=>e?.(t)),()=>{"isConnected"in t&&t.isConnected||(n.current=null)}):(n(t),wn(()=>e?.(t)),()=>{"isConnected"in t&&t.isConnected||n(null)})}}function XA({layout:n,panesArray:e,pivotIndices:t}){let i=0,r=100,s=0,a=0;const o=t[0];for(let f=0;f<e.length;f++){const h=e[f].constraints,{maxSize:p=100,minSize:m=0}=h;f===o?(i=m,r=p):(s+=m,a+=p)}const l=Math.min(r,100-s),c=Math.max(i,100-a),d=n[o];return{valueMax:l,valueMin:c,valueNow:d}}function Kt(n,e="Assertion failed!"){if(!n)throw console.error(e),new Error(e)}const jA=100,kd=10;function Gn(n,e,t=kd){return fa(n,e,t)===0}function fa(n,e,t=kd){const i=Wf(n,t),r=Wf(e,t);return Math.sign(i-r)}function js(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Wf(n,e){return Number.parseFloat(n.toFixed(e))}const pl=typeof document<"u";function qA(n){return n instanceof HTMLElement}function ag(n){return n.type==="keydown"}function og(n){return n.type.startsWith("mouse")}function lg(n){return n.type.startsWith("touch")}function ps({paneConstraints:n,paneIndex:e,initialSize:t}){const i=n[e];Kt(i!=null,"Pane constraints should not be null.");const{collapsedSize:r=0,collapsible:s,maxSize:a=100,minSize:o=0}=i;let l=t;return fa(l,o)<0&&(l=YA(l,s,r,o)),l=Math.min(a,l),Number.parseFloat(l.toFixed(kd))}function YA(n,e,t,i){if(!e)return i;const r=(t+i)/2;return fa(n,r)<0?t:i}function Cr(){}function KA({groupId:n,layout:e,panesArray:t,domContext:i}){const r=Ma(n,i);for(let s=0;s<t.length-1;s++){const{valueMax:a,valueMin:o,valueNow:l}=XA({layout:e,panesArray:t,pivotIndices:[s,s+1]}),c=r[s];if(qA(c)){const d=t[s];c.setAttribute("aria-controls",d.opts.id.current),c.setAttribute("aria-valuemax",`${Math.round(a)}`),c.setAttribute("aria-valuemin",`${Math.round(o)}`),c.setAttribute("aria-valuenow",l!=null?`${Math.round(l)}`:"")}}return()=>{for(const s of r)s.removeAttribute("aria-controls"),s.removeAttribute("aria-valuemax"),s.removeAttribute("aria-valuemin"),s.removeAttribute("aria-valuenow")}}function Ma(n,e){return pl?Array.from(e.querySelectorAll(`[data-pane-resizer-id][data-pane-group-id="${n}"]`)):[]}function cg({groupId:n,id:e,domContext:t}){return pl?Ma(n,t).findIndex(s=>s.getAttribute("data-pane-resizer-id")===e)??null:null}function Xf({groupId:n,dragHandleId:e,domContext:t}){const i=cg({groupId:n,id:e,domContext:t});return i!=null?[i,i+1]:[-1,-1]}function ls(n,e,t){const i=n.map(c=>c.constraints),r=cs(n,e),s=i[r],o=r===n.length-1?[r-1,r]:[r,r+1],l=t[r];return{...s,paneSize:l,pivotIndices:o}}function cs(n,e){return n.findIndex(t=>t.opts.id.current===e.opts.id.current)}function qs(n,e,t){for(let i=0;i<e.length;i++){const r=e[i],s=n[i];Kt(s);const{collapsedSize:a=0,collapsible:o}=s.constraints,l=t[s.opts.id.current];if(!(l==null||r!==l))continue;t[s.opts.id.current]=r;const{onCollapse:c,onExpand:d,onResize:f}=s.callbacks;f?.(r,l),o&&(c||d)&&(d&&(l==null||l===a)&&r!==a&&d(),c&&(l==null||l!==a)&&r===a&&c())}}function ZA({panesArray:n}){const e=Array(n.length),t=n.map(s=>s.constraints);let i=0,r=100;for(let s=0;s<n.length;s++){const a=t[s];Kt(a);const{defaultSize:o}=a;o!=null&&(i++,e[s]=o,r-=o)}for(let s=0;s<n.length;s++){const a=t[s];Kt(a);const{defaultSize:o}=a;if(o!=null)continue;const l=n.length-i,c=r/l;i++,e[s]=c,r-=c}return e}function $A({layout:n,paneConstraints:e}){const t=[...n],i=t.reduce((s,a)=>s+a,0);if(t.length!==e.length)throw new Error(`Invalid ${e.length} pane layout: ${t.map(s=>`${s}%`).join(", ")}`);if(!Gn(i,100))for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=100/i*a;t[s]=o}let r=0;for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=ps({paneConstraints:e,paneIndex:s,initialSize:a});a!==o&&(r+=a-o,t[s]=o)}if(!Gn(r,0))for(let s=0;s<e.length;s++){const a=t[s];Kt(a!=null);const o=a+r,l=ps({paneConstraints:e,paneIndex:s,initialSize:o});if(a!==l&&(r-=l-a,t[s]=l,Gn(r,0)))break}return t}function JA(n,e){if(!pl)return null;const t=e.querySelector(`[data-pane-group][data-pane-group-id="${n}"]`);return t||null}function Vd(n,e){if(!pl)return null;const t=e.querySelector(`[data-pane-resizer-id="${n}"]`);return t||null}function QA({event:n,dragHandleId:e,dir:t,initialDragState:i,domContext:r}){const s=t==="horizontal",a=Vd(e,r);Kt(a);const o=a.getAttribute("data-pane-group-id");Kt(o);const{initialCursorPosition:l}=i,c=ug(t,n),d=JA(o,r);Kt(d);const f=d.getBoundingClientRect(),h=s?f.width:f.height;return(c-l)/h*100}function e2({event:n,dragHandleId:e,dir:t,initialDragState:i,keyboardResizeBy:r,domContext:s}){if(ag(n)){const a=t==="horizontal";let o=0;n.shiftKey?o=100:r!=null?o=r:o=10;let l=0;switch(n.key){case"ArrowDown":l=a?0:o;break;case"ArrowLeft":l=a?-o:0;break;case"ArrowRight":l=a?o:0;break;case"ArrowUp":l=a?0:-o;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return i==null?0:QA({event:n,dragHandleId:e,dir:t,initialDragState:i,domContext:s})}function ug(n,e){const t=n==="horizontal";if(og(e))return t?e.clientX:e.clientY;if(lg(e)){const i=e.touches[0];return Kt(i),t?i.screenX:i.screenY}else throw new Error(`Unsupported event type "${e.type}"`)}function t2({groupId:n,handleId:e,panesArray:t,domContext:i}){const r=Vd(e,i),s=Ma(n,i),a=r?s.indexOf(r):-1,o=t[a]?.opts.id.current??null,l=t[a+1]?.opts.id.current??null;return[o,l]}function Ys({delta:n,layout:e,paneConstraints:t,pivotIndices:i,trigger:r}){if(Gn(n,0))return e;const s=[...e],[a,o]=i;let l=0;if(r==="keyboard"){{const d=n<0?o:a,f=t[d];if(Kt(f),f.collapsible){const h=e[d];Kt(h!=null);const p=t[d];Kt(p);const{collapsedSize:m=0,minSize:x=0}=p;if(Gn(h,m)){const g=x-h;fa(g,Math.abs(n))>0&&(n=n<0?0-g:g)}}}{const d=n<0?a:o,f=t[d];Kt(f);const{collapsible:h}=f;if(h){const p=e[d];Kt(p!=null);const m=t[d];Kt(m);const{collapsedSize:x=0,minSize:g=0}=m;if(Gn(p,g)){const v=p-x;fa(v,Math.abs(n))>0&&(n=n<0?0-v:v)}}}}{const d=n<0?1:-1;let f=n<0?o:a,h=0;for(;;){const m=e[f];Kt(m!=null);const g=ps({paneConstraints:t,paneIndex:f,initialSize:100})-m;if(h+=g,f+=d,f<0||f>=t.length)break}const p=Math.min(Math.abs(n),Math.abs(h));n=n<0?0-p:p}{let f=n<0?a:o;for(;f>=0&&f<t.length;){const h=Math.abs(n)-Math.abs(l),p=e[f];Kt(p!=null);const m=p-h,x=ps({paneConstraints:t,paneIndex:f,initialSize:m});if(!Gn(p,x)&&(l+=p-x,s[f]=x,l.toPrecision(3).localeCompare(Math.abs(n).toPrecision(3),void 0,{numeric:!0})>=0))break;n<0?f--:f++}}if(Gn(l,0))return e;{const d=n<0?o:a,f=e[d];Kt(f!=null);const h=f+l,p=ps({paneConstraints:t,paneIndex:d,initialSize:h});if(s[d]=p,!Gn(p,h)){let m=h-p,g=n<0?o:a;for(;g>=0&&g<t.length;){const v=s[g];Kt(v!=null);const y=v+m,w=ps({paneConstraints:t,paneIndex:g,initialSize:y});if(Gn(v,w)||(m-=w-v,s[g]=w),Gn(m,0))break;n>0?g--:g++}}}const c=s.reduce((d,f)=>f+d,0);return Gn(c,100)?s:e}let _u=null,Sr=null;function dg(n){switch(n){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function n2(){Sr!==null&&(document.head.removeChild(Sr),_u=null,Sr=null)}function uc(n,e){if(_u===n)return;_u=n;const t=dg(n);Sr===null&&(Sr=e.createElement("style"),e.head.appendChild(Sr)),Sr.innerHTML=`*{cursor: ${t}!important;}`}function i2({defaultSize:n,dragState:e,layout:t,panesArray:i,paneIndex:r,precision:s=3}){const a=t[r];let o;return a==null?o=n??"1":i.length===1?o="1":o=a.toPrecision(s),{flexBasis:0,flexGrow:o,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function jf(n){try{if(typeof localStorage>"u")throw new TypeError("localStorage is not supported in this environment");n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>localStorage.setItem(e,t)}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function hg(n){return`paneforge:${n}`}function fg(n){return n.map(t=>t.opts.order.current?`${t.opts.order.current}:${JSON.stringify(t.constraints)}`:JSON.stringify(t.constraints)).sort().join(",")}function pg(n,e){try{const t=hg(n),i=e.getItem(t),r=JSON.parse(i||"");if(typeof r=="object"&&r!==null)return r}catch{}return null}function r2(n,e,t){const i=pg(n,t)||{},r=fg(e);return i[r]||null}function s2(n,e,t,i,r){const s=hg(n),a=fg(e),o=pg(n,r)||{};o[a]={expandToSizes:Object.fromEntries(t.entries()),layout:i};try{r.setItem(s,JSON.stringify(o))}catch(l){console.error(l)}}const qf={};function a2(n,e=10){let t=null;return(...r)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...r)},e)}}function o2({autoSaveId:n,layout:e,storage:t,panesArray:i,paneSizeBeforeCollapse:r}){if(e.length===0||e.length!==i.length)return;let s=qf[n];s==null&&(s=a2(s2,jA),qf[n]=s);const a=[...i],o=new Map(r);s(n,a,o,e,t)}const ta={getItem:n=>(jf(ta),ta.getItem(n)),setItem:(n,e)=>{jf(ta),ta.setItem(n,e)}},Hd=new Kv("PaneGroup");class Gd{static create(e){return Hd.set(new Gd(e))}opts;attachment;domContext;#e=Fe(null);get dragState(){return u(this.#e)}set dragState(e){W(this.#e,e)}#t=Fe([]);get layout(){return u(this.#t)}set layout(e){W(this.#t,e)}#n=Fe([]);get panesArray(){return u(this.#n)}set panesArray(e){W(this.#n,e)}#i=Fe(!1);get panesArrayChanged(){return u(this.#i)}set panesArrayChanged(e){W(this.#i,e,!0)}#r=Fe(Ps({}));get paneIdToLastNotifiedSizeMap(){return u(this.#r)}set paneIdToLastNotifiedSizeMap(e){W(this.#r,e,!0)}paneSizeBeforeCollapseMap=new Map;prevDelta=0;constructor(e){this.opts=e,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),bo([()=>this.opts.id.current,()=>this.layout,()=>this.panesArray],()=>KA({groupId:this.opts.id.current,layout:this.layout,panesArray:this.panesArray,domContext:this.domContext})),Pt(()=>wn(()=>this.#s())),bo([()=>this.opts.autoSaveId.current,()=>this.layout,()=>this.opts.storage.current],()=>{this.opts.autoSaveId.current&&o2({autoSaveId:this.opts.autoSaveId.current,layout:this.layout,storage:this.opts.storage.current,panesArray:this.panesArray,paneSizeBeforeCollapse:this.paneSizeBeforeCollapseMap})}),bo(()=>this.panesArrayChanged,()=>{if(!this.panesArrayChanged)return;this.panesArrayChanged=!1;const t=this.layout;let i=null;if(this.opts.autoSaveId.current){const s=r2(this.opts.autoSaveId.current,this.panesArray,this.opts.storage.current);s&&(this.paneSizeBeforeCollapseMap=new Map(Object.entries(s.expandToSizes)),i=s.layout)}i==null&&(i=ZA({panesArray:this.panesArray}));const r=$A({layout:i,paneConstraints:this.panesArray.map(s=>s.constraints)});js(t,r)||(this.layout=r,this.opts.onLayout.current?.(r),qs(this.panesArray,r,this.paneIdToLastNotifiedSizeMap))})}setLayout=e=>{this.layout=e};registerResizeHandle=e=>t=>{t.preventDefault();const i=this.opts.direction.current,r=this.dragState,s=this.opts.id.current,a=this.opts.keyboardResizeBy.current,o=this.layout,l=this.panesArray,{initialLayout:c}=r??{},d=this.domContext.getDocument(),f=Xf({groupId:s,dragHandleId:e,domContext:this.domContext});let h=e2({event:t,dragHandleId:e,dir:i,initialDragState:r,keyboardResizeBy:a,domContext:this.domContext});if(h===0)return;const p=i==="horizontal";d.dir==="rtl"&&p&&(h=-h);const m=l.map(v=>v.constraints),x=Ys({delta:h,layout:c??o,paneConstraints:m,pivotIndices:f,trigger:ag(t)?"keyboard":"mouse-or-touch"}),g=!js(o,x);(og(t)||lg(t))&&this.prevDelta!==h&&(this.prevDelta=h,uc(g?p?"horizontal":"vertical":p?h<0?"horizontal-min":"horizontal-max":h<0?"vertical-min":"vertical-max",d)),g&&(this.setLayout(x),this.opts.onLayout.current?.(x),qs(l,x,this.paneIdToLastNotifiedSizeMap))};resizePane=(e,t)=>{const i=this.layout,r=this.panesArray,s=r.map(f=>f.constraints),{paneSize:a,pivotIndices:o}=ls(r,e,i);Kt(a!=null);const c=cs(r,e)===r.length-1?a-t:t-a,d=Ys({delta:c,layout:i,paneConstraints:s,pivotIndices:o,trigger:"imperative-api"});js(i,d)||(this.setLayout(d),this.opts.onLayout.current?.(d),qs(r,d,this.paneIdToLastNotifiedSizeMap))};startDragging=(e,t)=>{const i=this.opts.direction.current,r=this.layout,s=Vd(e,this.domContext);Kt(s);const a=ug(i,t);this.dragState={dragHandleId:e,dragHandleRect:s.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r}};stopDragging=()=>{n2(),this.dragState=null};isPaneCollapsed=e=>{const t=this.panesArray,i=this.layout,{collapsedSize:r=0,collapsible:s,paneSize:a}=ls(t,e,i);return typeof a!="number"||typeof r!="number"?!1:s===!0&&Gn(a,r)};expandPane=e=>{const t=this.layout,i=this.panesArray;if(!e.constraints.collapsible)return;const r=i.map(m=>m.constraints),{collapsedSize:s=0,paneSize:a,minSize:o=0,pivotIndices:l}=ls(i,e,t);if(a!==s)return;const c=this.paneSizeBeforeCollapseMap.get(e.opts.id.current),d=c!=null&&c>=o?c:o,h=cs(i,e)===i.length-1?a-d:d-a,p=Ys({delta:h,layout:t,paneConstraints:r,pivotIndices:l,trigger:"imperative-api"});js(t,p)||(this.setLayout(p),this.opts.onLayout.current?.(p),qs(i,p,this.paneIdToLastNotifiedSizeMap))};collapsePane=e=>{const t=this.layout,i=this.panesArray;if(!e.constraints.collapsible)return;const r=i.map(f=>f.constraints),{collapsedSize:s=0,paneSize:a,pivotIndices:o}=ls(i,e,t);if(Kt(a!=null),a===s)return;this.paneSizeBeforeCollapseMap.set(e.opts.id.current,a);const c=cs(i,e)===i.length-1?a-s:s-a,d=Ys({delta:c,layout:t,paneConstraints:r,pivotIndices:o,trigger:"imperative-api"});js(t,d)||(this.layout=d,this.opts.onLayout.current?.(d),qs(i,d,this.paneIdToLastNotifiedSizeMap))};getPaneSize=e=>ls(this.panesArray,e,this.layout).paneSize;getPaneStyle=(e,t)=>{const i=this.panesArray,r=this.layout,s=this.dragState,a=cs(i,e);return i2({defaultSize:t,dragState:s,layout:r,panesArray:i,paneIndex:a})};isPaneExpanded=e=>{const{collapsedSize:t=0,collapsible:i,paneSize:r}=ls(this.panesArray,e,this.layout);return!i||r>t};registerPane=e=>{const t=[...this.panesArray,e];return t.sort((i,r)=>{const s=i.opts.order.current,a=r.opts.order.current;return s==null&&a==null?0:s==null?-1:a==null?1:s-a}),this.panesArray=t,this.panesArrayChanged=!0,()=>{const i=[...this.panesArray],r=cs(this.panesArray,e);r<0||(i.splice(r,1),this.panesArray=i,delete this.paneIdToLastNotifiedSizeMap[e.opts.id.current],this.panesArrayChanged=!0)}};#s=()=>{const e=this.opts.id.current,t=Ma(e,this.domContext),i=this.panesArray,r=t.map(s=>{const a=s.getAttribute("data-pane-resizer-id");if(!a)return Cr;const[o,l]=t2({groupId:e,handleId:a,panesArray:i,domContext:this.domContext});if(o==null||l==null)return Cr;const d=CA(s,"keydown",f=>{if(f.defaultPrevented||f.key!=="Enter")return;f.preventDefault();const h=this.panesArray,p=h.findIndex(E=>E.opts.id.current===o);if(p<0)return;const m=h[p];Kt(m);const x=this.layout,g=x[p],{collapsedSize:v=0,collapsible:y,minSize:w=0}=m.constraints;if(!(g!=null&&y))return;const b=Ys({delta:Gn(g,v)?w-g:v-g,layout:x,paneConstraints:h.map(E=>E.constraints),pivotIndices:Xf({groupId:e,dragHandleId:a,domContext:this.domContext}),trigger:"keyboard"});x!==b&&(this.layout=b)});return()=>{d()}});return()=>{for(const s of r)s()}};#a=O(()=>({id:this.opts.id.current,"data-pane-group":"","data-direction":this.opts.direction.current,"data-pane-group-id":this.opts.id.current,style:{display:"flex",flexDirection:this.opts.direction.current==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}const l2=["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home"];class Wd{static create(e){return new Wd(e,Hd.get())}opts;#e;attachment;domContext;#t=O(()=>this.#e.dragState?.dragHandleId===this.opts.id.current);#n=Fe(!1);resizeHandler=null;constructor(e,t){this.opts=e,this.#e=t,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),Pt(()=>{this.opts.disabled.current?this.resizeHandler=null:this.resizeHandler=this.#e.registerResizeHandle(this.opts.id.current)}),Pt(()=>{const i=this.opts.ref.current;if(!i)return;const r=this.opts.disabled.current,s=this.resizeHandler,a=u(this.#t);if(r||s===null||!a)return;const o=h=>{s(h)},l=h=>{s(h)},c=()=>{i.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1)},d=this.domContext.getDocument().body,f=this.domContext.getWindow();return rg(dn(d,"contextmenu",c),dn(d,"mousemove",o),dn(d,"touchmove",o,{passive:!1}),dn(d,"mouseleave",l),dn(f,"mouseup",c),dn(f,"touchend",c))})}#i=e=>{e.preventDefault(),!this.opts.disabled.current&&(this.#e.startDragging(this.opts.id.current,e),this.opts.onDraggingChange.current(!0))};#r=()=>{const e=this.opts.ref.current;e&&(e.blur(),this.#e.stopDragging(),this.opts.onDraggingChange.current(!1))};#s=e=>{if(this.opts.disabled.current||!this.resizeHandler||e.defaultPrevented)return;if(l2.includes(e.key)){e.preventDefault(),this.resizeHandler(e);return}if(e.key!=="F6")return;e.preventDefault();const t=Ma(this.#e.opts.id.current,this.domContext),i=cg({groupId:this.#e.opts.id.current,id:this.opts.id.current,domContext:this.domContext});if(i===null)return;let r=0;e.shiftKey?i>0?r=i-1:r=t.length-1:i+1<t.length?r=i+1:r=0,t[r].focus()};#a=()=>{W(this.#n,!1)};#o=()=>{W(this.#n,!0)};#l=e=>{this.#i(e)};#c=()=>{this.#r()};#d=()=>{this.#r()};#h=()=>{this.#r()};#f=e=>{this.#i(e)};#u=O(()=>({id:this.opts.id.current,role:"separator","data-direction":this.#e.opts.direction.current,"data-pane-group-id":this.#e.opts.id.current,"data-active":u(this.#t)?"pointer":u(this.#n)?"keyboard":void 0,"data-enabled":!this.opts.disabled.current,"data-pane-resizer-id":this.opts.id.current,"data-pane-resizer":"",tabIndex:this.opts.tabIndex.current,style:{cursor:dg(this.#e.opts.direction.current),touchAction:"none",userSelect:"none","-webkit-user-select":"none","-webkit-touch-callout":"none"},onkeydown:this.#s,onblur:this.#a,onfocus:this.#o,onmousedown:this.#l,onmouseup:this.#c,ontouchcancel:this.#d,ontouchend:this.#h,ontouchstart:this.#f,...this.attachment}));get props(){return u(this.#u)}set props(e){W(this.#u,e)}}class Xd{static create(e){return new Xd(e,Hd.get())}opts;group;attachment;domContext;#e=Fe("");#t=O(()=>({onCollapse:this.opts.onCollapse.current,onExpand:this.opts.onExpand.current,onResize:this.opts.onResize.current}));get callbacks(){return u(this.#t)}set callbacks(e){W(this.#t,e)}#n=O(()=>({collapsedSize:this.opts.collapsedSize.current,collapsible:this.opts.collapsible.current,defaultSize:this.opts.defaultSize.current,maxSize:this.opts.maxSize.current,minSize:this.opts.minSize.current}));get constraints(){return u(this.#n)}set constraints(e){W(this.#n,e)}#i=e=>{W(this.#e,e,!0),BA(()=>{if(this.opts.ref.current){const t=this.opts.ref.current;if(!(getComputedStyle(t).transitionDuration!=="0s")){W(this.#e,"");return}const s=a=>{a.propertyName==="flex-grow"&&(W(this.#e,""),t.removeEventListener("transitionend",s))};t.addEventListener("transitionend",s)}else W(this.#e,"")})};pane={collapse:()=>{this.#i("collapsing"),this.group.collapsePane(this)},expand:()=>{this.#i("expanding"),this.group.expandPane(this)},getSize:()=>this.group.getPaneSize(this),isCollapsed:()=>this.group.isPaneCollapsed(this),isExpanded:()=>this.group.isPaneExpanded(this),resize:e=>this.group.resizePane(this,e),getId:()=>this.opts.id.current};constructor(e,t){this.opts=e,this.group=t,this.attachment=Bd(this.opts.ref),this.domContext=new zd(this.opts.ref),tl(()=>this.group.registerPane(this)),bo(()=>Nu(this.constraints),()=>{this.group.panesArrayChanged=!0})}#r=O(()=>this.group.isPaneCollapsed(this));#s=O(()=>u(this.#e)!==""?u(this.#e):u(this.#r)?"collapsed":"expanded");#a=O(()=>({id:this.opts.id.current,style:this.group.getPaneStyle(this,this.opts.defaultSize.current),"data-pane":"","data-pane-id":this.opts.id.current,"data-pane-group-id":this.group.opts.id.current,"data-collapsed":u(this.#r)?"":void 0,"data-expanded":u(this.#r)?void 0:"","data-pane-state":u(this.#s),...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}var c2=K("<div><!></div>");function u2(n,e){const t=Tn();st(e,!0);let i=oe(e,"autoSaveId",3,null),r=oe(e,"id",3,t),s=oe(e,"keyboardResizeBy",3,null),a=oe(e,"onLayoutChange",3,Cr),o=oe(e,"storage",3,ta),l=oe(e,"ref",15,null),c=ut(e,["$$slots","$$events","$$legacy","autoSaveId","direction","id","keyboardResizeBy","onLayoutChange","storage","ref","child","children"]);const d=Gd.create({id:Mt.with(()=>r()??t),ref:Mt.with(()=>l(),b=>l(b)),autoSaveId:Mt.with(()=>i()),direction:Mt.with(()=>e.direction),keyboardResizeBy:Mt.with(()=>s()),onLayout:Mt.with(()=>a()),storage:Mt.with(()=>o())}),f=()=>d.layout,h=d.setLayout,p=()=>d.opts.id.current,m=O(()=>Od(c,d.props));var x={getLayout:f,setLayout:h,getId:p},g=we(),v=Q(g);{var y=b=>{var E=we(),S=Q(E);pt(S,()=>e.child,()=>({props:u(m)})),P(b,E)},w=b=>{var E=c2();Ft(E,()=>({...u(m)}));var S=$(E);pt(S,()=>e.children??wt),j(E),P(b,E)};xe(v,b=>{e.child?b(y):b(w,-1)})}return P(n,g),at(x)}var d2=K("<div><!></div>");function sa(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",3,t),r=oe(e,"ref",15,null),s=oe(e,"onCollapse",3,Cr),a=oe(e,"onExpand",3,Cr),o=oe(e,"onResize",3,Cr),l=ut(e,["$$slots","$$events","$$legacy","id","ref","collapsedSize","collapsible","defaultSize","maxSize","minSize","onCollapse","onExpand","onResize","order","child","children"]);const c=Xd.create({id:Mt.with(()=>i()),ref:Mt.with(()=>r(),A=>r(A)),collapsedSize:Mt.with(()=>e.collapsedSize),collapsible:Mt.with(()=>e.collapsible),defaultSize:Mt.with(()=>e.defaultSize),maxSize:Mt.with(()=>e.maxSize),minSize:Mt.with(()=>e.minSize),onCollapse:Mt.with(()=>s()),onExpand:Mt.with(()=>a()),onResize:Mt.with(()=>o()),order:Mt.with(()=>e.order)}),d=c.pane.collapse,f=c.pane.expand,h=c.pane.getSize,p=c.pane.isCollapsed,m=c.pane.isExpanded,x=c.pane.resize,g=c.pane.getId,v=O(()=>Od(l,c.props));var y={collapse:d,expand:f,getSize:h,isCollapsed:p,isExpanded:m,resize:x,getId:g},w=we(),b=Q(w);{var E=A=>{var _=we(),T=Q(_);pt(T,()=>e.child,()=>({props:u(v)})),P(A,_)},S=A=>{var _=d2();Ft(_,()=>({...u(v)}));var T=$(_);pt(T,()=>e.children??wt),j(_),P(A,_)};xe(b,A=>{e.child?A(E):A(S,-1)})}return P(n,w),at(y)}var h2=K("<div><!></div>");function f2(n,e){const t=Tn();st(e,!0);let i=oe(e,"id",3,t),r=oe(e,"ref",15,null),s=oe(e,"disabled",3,!1),a=oe(e,"onDraggingChange",3,Cr),o=oe(e,"tabindex",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","ref","disabled","onDraggingChange","tabindex","child","children"]);const c=Wd.create({id:Mt.with(()=>i()),ref:Mt.with(()=>r(),x=>r(x)),disabled:Mt.with(()=>s()),onDraggingChange:Mt.with(()=>a()),tabIndex:Mt.with(()=>o())}),d=O(()=>Od(l,c.props));var f=we(),h=Q(f);{var p=x=>{var g=we(),v=Q(g);pt(v,()=>e.child,()=>({props:u(d)})),P(x,g)},m=x=>{var g=h2();Ft(g,()=>({...u(d)}));var v=$(g);pt(v,()=>e.children??wt),j(g),P(x,g)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var p2=K('<div class="h-10 w-1 z-10 flex shrink-0 rounded-lg bg-border transition-[background-color,transform] duration-150 group-hover/handle:scale-y-110 group-hover/handle:bg-foreground/40 group-active/handle:bg-foreground/60"></div>');function xu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"withHandle",3,!1),r=ut(e,["$$slots","$$events","$$legacy","ref","class","withHandle"]);var s=we(),a=Q(s);{let o=O(()=>ci("cn-resizable-handle group/handle after:inset-y-0 after:w-1 data-[direction=vertical]:after:left-0 data-[direction=vertical]:after:h-1 data-[direction=vertical]:after:translate-x-0 relative flex w-px items-center justify-center bg-border after:absolute after:left-1/2 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden data-[direction=vertical]:h-px data-[direction=vertical]:w-full data-[direction=vertical]:after:w-full data-[direction=vertical]:after:-translate-y-1/2 [&[data-direction=vertical]>div]:rotate-90",e.class));Ne(a,()=>f2,(l,c)=>{c(l,mt({"data-slot":"resizable-handle",get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)},children:(d,f)=>{var h=we(),p=Q(h);{var m=x=>{var g=p2();P(x,g)};xe(p,x=>{i()&&x(m)})}P(d,h)},$$slots:{default:!0}}))})}P(n,s),at()}function mg(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"this",15),r=ut(e,["$$slots","$$events","$$legacy","ref","this","class"]);var s=we(),a=Q(s);{let o=O(()=>ci("cn-resizable-panel-group flex h-full w-full data-[direction=vertical]:flex-col",e.class));Ne(a,()=>u2,(l,c)=>{ui(c(l,mt({"data-slot":"resizable-pane-group",get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)}})),d=>i(d),()=>i())})}P(n,s),at()}var m2=K('<div class="inset-0 absolute z-10 animate-[selva-viewer-fade-in_0.2s_ease-out] backdrop-blur-[2px] transition-all duration-300"></div>'),g2=K('<div><img alt="" class="h-8 max-w-32 drop-shadow-sm sm:h-10 w-auto object-contain opacity-80"/></div>'),v2=K("<!> ",1),_2=K("<!> ",1),x2=K("<!> ",1),b2=K('<!> <span class="flex-1"> </span> <!>',1),y2=K("<!> <!>",1),S2=K('<!> <span class="flex-1"> </span> <!>',1),M2=K('<!> <span class="flex-1"> </span> <!>',1),w2=K('<!> <span class="flex-1"> </span> <!>',1),E2=K("<!> ",1),T2=K("<!> ",1),A2=K("<!> ",1),C2=K("<!> <!> <!> <!> <!> <!> <!> <!> <!>",1),P2=K("<!> <!>",1),R2=K("<div><!></div>"),D2=K('<div class="relative h-full w-full" style="touch-action: none;"><canvas class="block h-full w-full"></canvas> <div></div> <!> <!> <!></div>'),L2=K("<!> <!>",1),I2=K("<!> <!>",1),N2=K("<div><!></div> <!>",1);function Yf(n,e){st(e,!0);const t={showScreenshotButton:!0,showFullscreenButton:!0,showSceneManager:!0,showToolsMenu:!0,showGridToggle:!0,enableMeshClick:!0,backgroundColor:"#E6E6E6"};let i=oe(e,"isFullscreen",15,!1),r=oe(e,"isSolving",3,!1),s=oe(e,"isBlurred",3,!1),a=oe(e,"drawerOpen",3,!1),o=oe(e,"viewerConfig",19,()=>({}));const l=O(()=>({...t,...o()})),c=Si();ng(()=>e.lang??c.locale);const d=Si(),f=O(()=>d.messages);let h,p=Fe(null),m=null,x=null,g=null,v=null,y=null,w=null,b=!1,E=Fe(0),S=Fe(!1),A=Fe(!1),_=Fe("perspective"),T=Fe(!1),D=Fe(!1),L=Fe(null),F=Fe(null);const k=[{preset:"top",label:()=>u(f).viewTop},{preset:"front",label:()=>u(f).viewFront},{preset:"right",label:()=>u(f).viewRight},{preset:"back",label:()=>u(f).viewBack},{preset:"left",label:()=>u(f).viewLeft},{preset:"bottom",label:()=>u(f).viewBottom},{preset:"iso",label:()=>u(f).viewIso}];Pt(()=>{if(a())W(S,!0);else{const ve=setTimeout(()=>{W(S,!1)},us.TIMEOUTS.DRAWER_ANIMATION_MS);return()=>clearTimeout(ve)}}),tl(()=>{if(!h)return;const ve={environment:{backgroundColor:u(l).backgroundColor},controls:{},grid:{enabled:u(l).showToolsMenu&&u(l).showGridToggle},gizmo:{enabled:!1},measure:{enabled:u(l).showToolsMenu},events:{onMeshMetadataClicked:u(l).enableMeshClick?ie=>{Y(ie)&&(W(L,ie,!0),W(F,ie?.name||u(f).objectFallbackName,!0))}:void 0}},G=jm(h,ve);return W(p,G.scene,!0),m=G.camera,x=G.controls,g=G.cameraController,v=G.measureTool,y=G.grid,y?.setVisible(u(D)),w=G.fitToView,W(_,G.cameraController.getProjection(),!0),()=>{G.dispose()}});function U(){g&&W(_,g.toggleProjection(),!0)}function N(ve){g?.setView(ve)}function R(){v&&(W(T,!u(T)),v.setEnabled(u(T)))}function z(){y&&(W(D,!u(D)),y.setVisible(u(D)))}Pt(()=>{u(p)&&m&&x&&(Nm(u(p),e.meshes,m,x,b),wn(()=>vp(E)),!b&&e.meshes.length>0&&(b=!0))});function q(){i(!i())}function Y(ve){if(!ve)return!1;if(ve.metadata&&typeof ve.metadata=="object"){const Z=ve.metadata;return Object.keys(Z).length>0}const G=new Set(["name","layer","originalIndex","sourceComponentId","vertexCount","faceCount","vertexOffset","faceOffset"]);return Object.entries(ve).filter(([Z])=>!G.has(Z)).length>0}function te(){h&&requestAnimationFrame(()=>{h.toBlob(ve=>{if(!ve)return;const G=URL.createObjectURL(ve),ie=document.createElement("a"),Z=new Date().toISOString().slice(0,19).replace(/:/g,"-");ie.href=G,ie.download=`viewer-${Z}.png`,document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(G)})})}var le=N2(),B=Q(le),ee=$(B);Ne(ee,()=>mg,(ve,G)=>{G(ve,{direction:"horizontal",class:"h-full w-full",children:(ie,Z)=>{var ce=I2(),pe=Q(ce);Ne(pe,()=>sa,(Ue,Pe)=>{Pe(Ue,{defaultSize:100,minSize:40,children:(ke,Ie)=>{var We=D2(),Oe=$(We);ui(Oe,C=>h=C,()=>h);var He=se(Oe,2),V=se(He,2);{var je=C=>{var M=m2();P(C,M)};xe(V,C=>{r()&&C(je)})}var Ve=se(V,2);{var Xe=C=>{var M=g2(),H=$(M);j(M),Me(()=>{Dt(M,1,`right-4 ${i()?"bottom-4":"bottom-16 sm:bottom-4"} absolute z-20`),Ii(M,u(S)?"opacity: 0; pointer-events: none;":"opacity: 1; pointer-events: none;"),Qt(H,"src",e.logoUrl)}),P(C,M)};xe(Ve,C=>{e.logoUrl&&C(Xe)})}var ye=se(Ve,2);{var Ce=C=>{const M=O(()=>"gap-2 px-2 py-1.5 text-sm flex cursor-pointer select-none items-center rounded-sm outline-none transition-colors hover:bg-muted focus:bg-muted");var H=R2(),re=$(H);Ne(re,()=>T0,(ue,be)=>{be(ue,{children:(ge,ae)=>{var fe=P2(),Re=Q(fe);Ne(Re,()=>D0,(Ee,De)=>{De(Ee,{class:"h-10 w-10 shadow-lg hover:shadow-xl flex items-center justify-center rounded-lg border border-border bg-card/90 transition-all hover:bg-card active:scale-95 data-[state=open]:bg-secondary/60",get title(){return u(f).toolsMenu},get"aria-label"(){return u(f).toolsMenu},children:(et,Ye)=>{a0(et,{class:"h-5 w-5 text-card-foreground"})},$$slots:{default:!0}})});var Le=se(Re,2);Ne(Le,()=>fv,(Ee,De)=>{De(Ee,{children:(et,Ye)=>{var ht=we(),J=Q(ht);Ne(J,()=>P0,(Ge,Te)=>{Te(Ge,{sideOffset:6,align:"start",class:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 min-w-44 p-1 shadow-md z-10001 rounded-md border bg-popover text-popover-foreground",children:(Ze,qe)=>{var Be=C2(),lt=Q(Be);Ne(lt,()=>Ji,(Rt,qt)=>{qt(Rt,{class:u(M),onSelect:U,children:(en,An)=>{var tn=we(),pn=Q(tn);{var Dn=Yt=>{var Jt=v2(),ln=Q(Jt);o0(ln,{class:"h-4 w-4"});var Gt=se(ln);Me(()=>Ae(Gt,` ${u(f).switchTo2D??""}`)),P(Yt,Jt)},gn=Yt=>{var Jt=_2(),ln=Q(Jt);lh(ln,{class:"h-4 w-4"});var Gt=se(ln);Me(()=>Ae(Gt,` ${u(f).switchTo3D??""}`)),P(Yt,Jt)};xe(pn,Yt=>{u(_)==="perspective"?Yt(Dn):Yt(gn,-1)})}P(en,tn)},$$slots:{default:!0}})});var vt=se(lt,2);Ne(vt,()=>Ji,(Rt,qt)=>{qt(Rt,{class:u(M),onSelect:()=>w?.(),children:(en,An)=>{var tn=x2(),pn=Q(tn);e0(pn,{class:"h-4 w-4"});var Dn=se(pn);Me(()=>Ae(Dn,` ${u(f).fitToView??""}`)),P(en,tn)},$$slots:{default:!0}})});var $t=se(vt,2);Ne($t,()=>v0,(Rt,qt)=>{qt(Rt,{children:(en,An)=>{var tn=y2(),pn=Q(tn);Ne(pn,()=>E0,(gn,Yt)=>{Yt(gn,{class:`${u(M)??""} data-[state=open]:bg-muted`,children:(Jt,ln)=>{var Gt=b2(),I=Q(Gt);lh(I,{class:"h-4 w-4"});var ne=se(I,2),he=$(ne,!0);j(ne);var me=se(ne,2);Du(me,{class:"h-4 w-4 text-muted-foreground"}),Me(()=>Ae(he,u(f).views)),P(Jt,Gt)},$$slots:{default:!0}})});var Dn=se(pn,2);Ne(Dn,()=>M0,(gn,Yt)=>{Yt(gn,{sideOffset:4,class:"min-w-32 p-1 shadow-md z-10001 rounded-md border bg-popover text-popover-foreground",children:(Jt,ln)=>{var Gt=we(),I=Q(Gt);Zt(I,17,()=>k,({preset:ne,label:he})=>ne,(ne,he)=>{let me=()=>u(he).preset,_e=()=>u(he).label;var $e=we(),nt=Q($e);Ne(nt,()=>Ji,(Je,ot)=>{ot(Je,{class:"px-2 py-1.5 text-sm flex cursor-pointer items-center rounded-sm transition-colors outline-none select-none hover:bg-muted focus:bg-muted",onSelect:()=>N(me()),children:(ct,_t)=>{yt();var bt=Et();Me(dt=>Ae(bt,dt),[()=>_e()()]),P(ct,bt)},$$slots:{default:!0}})}),P(ne,$e)}),P(Jt,Gt)},$$slots:{default:!0}})}),P(en,tn)},$$slots:{default:!0}})});var It=se($t,2);{let Rt=O(()=>u(T)?"text-primary":"");Ne(It,()=>Ji,(qt,en)=>{en(qt,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(Rt)??""}`},onSelect:R,children:(An,tn)=>{var pn=S2(),Dn=Q(pn);s0(Dn,{class:"h-4 w-4"});var gn=se(Dn,2),Yt=$(gn,!0);j(gn);var Jt=se(gn,2);{var ln=Gt=>{ia(Gt,{class:"h-4 w-4"})};xe(Jt,Gt=>{u(T)&&Gt(ln)})}Me(()=>Ae(Yt,u(f).measure)),P(An,pn)},$$slots:{default:!0}})})}var ii=se(It,2);{var ri=Rt=>{var qt=we(),en=Q(qt);{let An=O(()=>u(D)?"text-primary":"");Ne(en,()=>Ji,(tn,pn)=>{pn(tn,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(An)??""}`},onSelect:z,children:(Dn,gn)=>{var Yt=M2(),Jt=Q(Yt);t0(Jt,{class:"h-4 w-4"});var ln=se(Jt,2),Gt=$(ln,!0);j(ln);var I=se(ln,2);{var ne=he=>{ia(he,{class:"h-4 w-4"})};xe(I,he=>{u(D)&&he(ne)})}Me(()=>Ae(Gt,u(f).grid)),P(Dn,Yt)},$$slots:{default:!0}})})}P(Rt,qt)};xe(ii,Rt=>{u(l).showGridToggle&&Rt(ri)})}var Or=se(ii,2);{var vl=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>b0,(An,tn)=>{tn(An,{class:"my-1 h-px bg-border"})}),P(Rt,qt)};xe(Or,Rt=>{(u(l).showSceneManager||u(l).showScreenshotButton||u(l).showFullscreenButton)&&Rt(vl)})}var Ns=se(Or,2);{var wa=Rt=>{var qt=we(),en=Q(qt);{let An=O(()=>u(A)?"text-primary":"");Ne(en,()=>Ji,(tn,pn)=>{pn(tn,{closeOnSelect:!1,get class(){return`${u(M)??""} ${u(An)??""}`},onSelect:()=>W(A,!u(A)),children:(Dn,gn)=>{var Yt=w2(),Jt=Q(Yt);i0(Jt,{class:"h-4 w-4"});var ln=se(Jt,2),Gt=$(ln,!0);j(ln);var I=se(ln,2);{var ne=he=>{ia(he,{class:"h-4 w-4"})};xe(I,he=>{u(A)&&he(ne)})}Me(()=>Ae(Gt,u(f).sceneManager)),P(Dn,Yt)},$$slots:{default:!0}})})}P(Rt,qt)};xe(Ns,Rt=>{u(l).showSceneManager&&Rt(wa)})}var Mi=se(Ns,2);{var Us=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>Ji,(An,tn)=>{tn(An,{class:u(M),onSelect:te,children:(pn,Dn)=>{var gn=E2(),Yt=Q(gn);Zv(Yt,{class:"h-4 w-4"});var Jt=se(Yt);Me(()=>Ae(Jt,` ${u(f).screenshot??""}`)),P(pn,gn)},$$slots:{default:!0}})}),P(Rt,qt)};xe(Mi,Rt=>{u(l).showScreenshotButton&&Rt(Us)})}var Ea=se(Mi,2);{var Ta=Rt=>{var qt=we(),en=Q(qt);Ne(en,()=>Ji,(An,tn)=>{tn(An,{class:u(M),onSelect:q,children:(pn,Dn)=>{var gn=we(),Yt=Q(gn);{var Jt=Gt=>{var I=T2(),ne=Q(I);Ou(ne,{class:"h-4 w-4"});var he=se(ne);Me(()=>Ae(he,` ${u(f).exitFullscreen??""}`)),P(Gt,I)},ln=Gt=>{var I=A2(),ne=Q(I);Fu(ne,{class:"h-4 w-4"});var he=se(ne);Me(()=>Ae(he,` ${u(f).fullscreen??""}`)),P(Gt,I)};xe(Yt,Gt=>{i()?Gt(Jt):Gt(ln,-1)})}P(pn,gn)},$$slots:{default:!0}})}),P(Rt,qt)};xe(Ea,Rt=>{u(l).showFullscreenButton&&Rt(Ta)})}P(Ze,Be)},$$slots:{default:!0}})}),P(et,ht)},$$slots:{default:!0}})}),P(ge,fe)},$$slots:{default:!0}})}),j(H),Me(()=>{Dt(H,1,`left-4 ${i()?"bottom-4":"bottom-16 sm:bottom-4"} absolute z-50 flex items-center`),Ii(H,u(S)?"opacity: 0; pointer-events: none;":"opacity: 1; pointer-events: auto;")}),P(C,H)};xe(ye,C=>{u(l).showToolsMenu&&C(Ce)})}j(We),Me(()=>Dt(He,1,`inset-0 blur-overlay absolute z-20 ${s()?"blur-overlay-active":"blur-overlay-inactive"}`,"svelte-13y0czs")),P(ke,We)},$$slots:{default:!0}})});var Se=se(pe,2);{var ze=Ue=>{var Pe=L2(),ke=Q(Pe);Ne(ke,()=>xu,(We,Oe)=>{Oe(We,{withHandle:!0})});var Ie=se(ke,2);Ne(Ie,()=>sa,(We,Oe)=>{Oe(We,{defaultSize:15,minSize:8,maxSize:30,children:(He,V)=>{ZT(He,{get scene(){return u(p)},get sceneVersion(){return u(E)}})},$$slots:{default:!0}})}),P(Ue,Pe)};xe(Se,Ue=>{u(A)&&u(p)&&Ue(ze)})}P(ie,ce)},$$slots:{default:!0}})}),j(B);var de=se(B,2);{let ve=O(()=>u(L)!==null);dA(de,{get open(){return u(ve)},get metadata(){return u(L)},get meshName(){return u(F)},get isFullscreen(){return i()},onOpenChange:G=>{G||setTimeout(()=>{W(L,null),W(F,null)},200)}})}Me(()=>Dt(B,1,`min-h-64 sm:min-h-96 lg:min-h-125 relative h-full flex-1 border ${i()?"fullscreen-viewer":"overflow-hidden rounded-[0.625rem]"}`,"svelte-13y0czs")),P(n,le),at()}var U2=K("<!> ",1),F2=K("<!> ",1),O2=K("<!> ",1),z2=K("<!> ",1),B2=K('<div class="bottom-0 mt-3 pb-3 pt-2 backdrop-blur-sm px-2 sticky border-t border-border/50"><!></div>');function dc(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);let r=oe(e,"hasNeverSolved",3,!1);var s=B2(),a=$(s);{let o=O(()=>e.hasPendingChanges?"default":"ghost"),l=O(()=>!e.hasPendingChanges&&!e.isSolving),c=O(()=>e.hasPendingChanges&&!e.isSolving?"selva-pending-pulse shadow-md":""),d=O(()=>!e.hasPendingChanges&&!e.isSolving?"text-muted-foreground":"");Bn(a,{get variant(){return u(o)},size:"lg",onclick:()=>!e.isSolving&&e.oncalculate(),get disabled(){return u(l)},get"aria-busy"(){return e.isSolving},get class(){return`gap-2 font-medium w-full transition-all duration-200
|
|
5017
5017
|
${u(c)??""}
|
|
5018
|
-
${u(d)??""}`},children:(f,h)=>{var p=we(),g=Q(p);{var x=w=>{var b=U2(),E=Q(b);Uu(E,{class:"h-4 w-4 animate-spin"});var S=se(E);Me(()=>Ae(S,` ${u(i).solvingEllipsis??""}`)),P(w,b)},m=w=>{var b=F2(),E=Q(b);Cv(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).pressToCalculate??""}`)),P(w,b)},v=w=>{var b=O2(),E=Q(b);l_(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).calculate??""}`)),P(w,b)},y=w=>{var b=z2(),E=Q(b);ia(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).upToDate??""}`)),P(w,b)};xe(g,w=>{e.isSolving?w(x):r()?w(m,1):e.hasPendingChanges?w(v,2):w(y,-1)})}P(f,p)},$$slots:{default:!0}})}j(s),P(n,s),at()}var k2=q('<div class="bottom-6 left-6 gap-3 px-5 py-3 shadow-xl fixed z-50 flex animate-[selva-slideInLeft_0.2s_ease-out] items-center rounded-lg border border-primary/20 bg-primary text-primary-foreground svelte-g866ul"><div class="h-5 w-5 relative flex shrink-0 items-center justify-center svelte-g866ul"><div class="animate-ping absolute h-full w-full rounded-full bg-primary-foreground opacity-30 svelte-g866ul"></div> <div class="h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent svelte-g866ul"></div></div> <div class="leading-tight flex flex-col svelte-g866ul"><span class="text-sm font-semibold svelte-g866ul"> </span> <span class="text-xs opacity-70 svelte-g866ul"> </span></div></div>');function V2(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);var r=we(),s=Q(r);{var a=o=>{var l=k2(),c=se($(l),2),d=$(c),f=$(d,!0);j(d);var h=se(d,2),p=$(h,!0);j(h),j(c),j(l),Me(()=>{Ae(f,u(i).solving),Ae(p,u(i).solvingSubtitle)}),P(o,l)};xe(s,o=>{e.show&&o(a)})}P(n,r),at()}var H2=q("<div><!></div>");function G2(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);var r=H2();Ft(r,a=>({"data-slot":"card-action",class:a,...i}),[()=>ci("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e.class)]);var s=$(r);pt(s,()=>e.children??wt),j(r),ui(r,a=>t(a),()=>t()),P(n,r),at()}var W2=q("<!> <!>",1);function Kf(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=we(),a=Q(s);{let o=O(()=>ci("flex touch-none p-px transition-colors select-none",i()==="vertical"&&"w-2.5 h-full border-s border-s-transparent",i()==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e.class));Ne(a,()=>q_,(l,c)=>{c(l,mt({"data-slot":"scroll-area-scrollbar",get orientation(){return i()},get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)},children:(d,f)=>{var h=W2(),p=Q(h);pt(p,()=>e.children??wt);var g=se(p,2);Ne(g,()=>Z_,(x,m)=>{m(x,{"data-slot":"scroll-area-thumb",class:"relative flex-1 rounded-full bg-border"})}),P(d,h)},$$slots:{default:!0}}))})}P(n,s),at()}var X2=q("<!> <!> <!> <!>",1);function gg(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"viewportRef",15,null),r=oe(e,"orientation",3,"vertical"),s=oe(e,"scrollbarXClasses",3,""),a=oe(e,"scrollbarYClasses",3,""),o=ut(e,["$$slots","$$events","$$legacy","ref","viewportRef","class","orientation","scrollbarXClasses","scrollbarYClasses","children"]);var l=we(),c=Q(l);{let d=O(()=>ci("relative",e.class));Ne(c,()=>z_,(f,h)=>{h(f,mt({"data-slot":"scroll-area",get class(){return u(d)}},()=>o,{get ref(){return t()},set ref(p){t(p)},children:(p,g)=>{var x=X2(),m=Q(x);Ne(m,()=>k_,(S,A)=>{A(S,{"data-slot":"scroll-area-viewport",class:"size-full rounded-[inherit] ring-ring/10 outline-ring/50 transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 dark:ring-ring/20 dark:outline-ring/40",get ref(){return i()},set ref(_){i(_)},children:(_,T)=>{var D=we(),L=Q(D);pt(L,()=>e.children??wt),P(_,D)},$$slots:{default:!0}})});var v=se(m,2);{var y=S=>{Kf(S,{orientation:"vertical",get class(){return a()}})};xe(v,S=>{(r()==="vertical"||r()==="both")&&S(y)})}var w=se(v,2);{var b=S=>{Kf(S,{orientation:"horizontal",get class(){return s()}})};xe(w,S=>{(r()==="horizontal"||r()==="both")&&S(b)})}var E=se(w,2);Ne(E,()=>Q_,(S,A)=>{A(S,{})}),P(p,x)},$$slots:{default:!0}}))})}P(n,l),at()}const vg=/^[a-z0-9]+(-[a-z0-9]+)*$/,ml=(n,e,t,i="")=>{const r=n.split(":");if(n.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;i=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),l=r.pop(),c={provider:r.length>0?r[0]:i,prefix:l,name:o};return e&&!Lo(c)?null:c}const s=r[0],a=s.split("-");if(a.length>1){const o={provider:i,prefix:a.shift(),name:a.join("-")};return e&&!Lo(o)?null:o}if(t&&i===""){const o={provider:i,prefix:"",name:s};return e&&!Lo(o,t)?null:o}return null},Lo=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;function j2(n,e){const t=n.icons,i=n.aliases||Object.create(null),r=Object.create(null);function s(a){if(t[a])return r[a]=[];if(!(a in r)){r[a]=null;const o=i[a]&&i[a].parent,l=o&&s(o);l&&(r[a]=[o].concat(l))}return r[a]}return Object.keys(t).concat(Object.keys(i)).forEach(s),r}const _g=Object.freeze({left:0,top:0,width:16,height:16}),Jo=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),gl=Object.freeze({..._g,...Jo}),bu=Object.freeze({...gl,body:"",hidden:!1});function q2(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Zf(n,e){const t=q2(n,e);for(const i in bu)i in Jo?i in n&&!(i in t)&&(t[i]=Jo[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function Y2(n,e,t){const i=n.icons,r=n.aliases||Object.create(null);let s={};function a(o){s=Zf(i[o]||r[o],s)}return a(e),t.forEach(a),Zf(n,s)}function xg(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(r=>{e(r,null),t.push(r)});const i=j2(n);for(const r in i){const s=i[r];s&&(e(r,Y2(n,r,s)),t.push(r))}return t}const K2={provider:"",aliases:{},not_found:{},..._g};function hc(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function bg(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!hc(n,K2))return null;const t=e.icons;for(const r in t){const s=t[r];if(!r||typeof s.body!="string"||!hc(s,bu))return null}const i=e.aliases||Object.create(null);for(const r in i){const s=i[r],a=s.parent;if(!r||typeof a!="string"||!t[a]&&!i[a]||!hc(s,bu))return null}return e}const $f=Object.create(null);function Z2(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Cs(n,e){const t=$f[n]||($f[n]=Object.create(null));return t[e]||(t[e]=Z2(n,e))}function yg(n,e){return bg(e)?xg(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function $2(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}let pa=!1;function Sg(n){return typeof n=="boolean"&&(pa=n),pa}function J2(n){const e=typeof n=="string"?ml(n,!0,pa):n;if(e){const t=Cs(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Q2(n,e){const t=ml(n,!0,pa);if(!t)return!1;const i=Cs(t.provider,t.prefix);return e?$2(i,t.name,e):(i.missing.add(t.name),!0)}function eC(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),pa&&!e&&!n.prefix){let i=!1;return bg(n)&&(n.prefix="",xg(n,(r,s)=>{Q2(r,s)&&(i=!0)})),i}const t=n.prefix;return Lo({prefix:t,name:"a"})?!!yg(Cs(e,t),n):!1}const Mg=Object.freeze({width:null,height:null}),wg=Object.freeze({...Mg,...Jo}),tC=/(-?[0-9.]*[0-9]+[0-9.]*)/g,nC=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Jf(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(tC);if(i===null||!i.length)return n;const r=[];let s=i.shift(),a=nC.test(s);for(;;){if(a){const o=parseFloat(s);isNaN(o)?r.push(s):r.push(Math.ceil(o*e*t)/t)}else r.push(s);if(s=i.shift(),s===void 0)return r.join("");a=!a}}function iC(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const r=n.indexOf(">",i),s=n.indexOf("</"+e);if(r===-1||s===-1)break;const a=n.indexOf(">",s);if(a===-1)break;t+=n.slice(r+1,s).trim(),n=n.slice(0,i).trim()+n.slice(a+1)}return{defs:t,content:n}}function rC(n,e){return n?"<defs>"+n+"</defs>"+e:e}function sC(n,e,t){const i=iC(n);return rC(i.defs,e+i.content+t)}const aC=n=>n==="unset"||n==="undefined"||n==="none";function oC(n,e){const t={...gl,...n},i={...wg,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let s=t.body;[t,i].forEach(x=>{const m=[],v=x.hFlip,y=x.vFlip;let w=x.rotate;v?y?w+=2:(m.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),m.push("scale(-1 1)"),r.top=r.left=0):y&&(m.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),m.push("scale(1 -1)"),r.top=r.left=0);let b;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:b=r.height/2+r.top,m.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:m.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:b=r.width/2+r.left,m.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}w%2===1&&(r.left!==r.top&&(b=r.left,r.left=r.top,r.top=b),r.width!==r.height&&(b=r.width,r.width=r.height,r.height=b)),m.length&&(s=sC(s,'<g transform="'+m.join(" ")+'">',"</g>"))});const a=i.width,o=i.height,l=r.width,c=r.height;let d,f;a===null?(f=o===null?"1em":o==="auto"?c:o,d=Jf(f,l/c)):(d=a==="auto"?l:a,f=o===null?Jf(d,c/l):o==="auto"?c:o);const h={},p=(x,m)=>{aC(m)||(h[x]=m.toString())};p("width",d),p("height",f);const g=[r.left,r.top,l,c];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:s}}const lC=/\sid="(\S+)"/g,Qf=new Map;function cC(n){n=n.replace(/[0-9]+$/,"")||"a";const e=Qf.get(n)||0;return Qf.set(n,e+1),e?`${n}${e}`:n}function uC(n){const e=[];let t;for(;t=lC.exec(n);)e.push(t[1]);if(!e.length)return n;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(r=>{const s=cC(r),a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),n=n.replace(new RegExp(i,"g"),""),n}const yu=Object.create(null);function dC(n,e){yu[n]=e}function Su(n){return yu[n]||yu[""]}function jd(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const qd=Object.create(null),Ks=["https://api.simplesvg.com","https://api.unisvg.com"],Io=[];for(;Ks.length>0;)Ks.length===1||Math.random()>.5?Io.push(Ks.shift()):Io.push(Ks.pop());qd[""]=jd({resources:["https://api.iconify.design"].concat(Io)});function hC(n,e){const t=jd(e);return t===null?!1:(qd[n]=t,!0)}function Yd(n){return qd[n]}const fC=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let ep=fC();function pC(n,e){const t=Yd(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let r=0;t.resources.forEach(a=>{r=Math.max(r,a.length)});const s=e+".json?icons=";i=t.maxURL-r-t.path.length-s.length}return i}function mC(n){return n===404}const gC=(n,e,t)=>{const i=[],r=pC(n,e),s="icons";let a={type:s,provider:n,prefix:e,icons:[]},o=0;return t.forEach((l,c)=>{o+=l.length+1,o>=r&&c>0&&(i.push(a),a={type:s,provider:n,prefix:e,icons:[]},o=l.length),a.icons.push(l)}),i.push(a),i};function vC(n){if(typeof n=="string"){const e=Yd(n);if(e)return e.path}return"/"}const _C=(n,e,t)=>{if(!ep){t("abort",424);return}let i=vC(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),o=new URLSearchParams({icons:a});i+=s+".json?"+o.toString();break}case"custom":{const s=e.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:t("abort",400);return}let r=503;ep(n+i).then(s=>{const a=s.status;if(a!==200){setTimeout(()=>{t(mC(a)?"abort":"next",a)});return}return r=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?t("abort",s):t("next",r)});return}setTimeout(()=>{t("success",s)})}).catch(()=>{t("next",r)})},xC={prepare:gC,send:_C};function Eg(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(r=>r.id!==e))})}function bC(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,r=n.prefix;e.forEach(s=>{const a=s.icons,o=a.pending.length;a.pending=a.pending.filter(l=>{if(l.prefix!==r)return!0;const c=l.name;if(n.icons[c])a.loaded.push({provider:i,prefix:r,name:c});else if(n.missing.has(c))a.missing.push({provider:i,prefix:r,name:c});else return t=!0,!0;return!1}),a.pending.length!==o&&(t||Eg([n],s.id),s.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),s.abort))})}))}let yC=0;function SC(n,e,t){const i=yC++,r=Eg.bind(null,t,i);if(!e.pending.length)return r;const s={id:i,icons:e,callback:n,abort:r};return t.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(s)}),r}function MC(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((r,s)=>r.provider!==s.provider?r.provider.localeCompare(s.provider):r.prefix!==s.prefix?r.prefix.localeCompare(s.prefix):r.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return n.forEach(r=>{if(i.name===r.name&&i.prefix===r.prefix&&i.provider===r.provider)return;i=r;const s=r.provider,a=r.prefix,o=r.name,l=t[s]||(t[s]=Object.create(null)),c=l[a]||(l[a]=Cs(s,a));let d;o in c.icons?d=e.loaded:a===""||c.missing.has(o)?d=e.missing:d=e.pending;const f={provider:s,prefix:a,name:o};d.push(f)}),e}function wC(n,e=!0,t=!1){const i=[];return n.forEach(r=>{const s=typeof r=="string"?ml(r,e,t):r;s&&i.push(s)}),i}const EC={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function TC(n,e,t,i){const r=n.resources.length,s=n.random?Math.floor(Math.random()*r):n.index;let a;if(n.random){let S=n.resources.slice(0);for(a=[];S.length>1;){const A=Math.floor(Math.random()*S.length);a.push(S[A]),S=S.slice(0,A).concat(S.slice(A+1))}a=a.concat(S)}else a=n.resources.slice(s).concat(n.resources.slice(0,s));const o=Date.now();let l="pending",c=0,d,f=null,h=[],p=[];typeof i=="function"&&p.push(i);function g(){f&&(clearTimeout(f),f=null)}function x(){l==="pending"&&(l="aborted"),g(),h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function m(S,A){A&&(p=[]),typeof S=="function"&&p.push(S)}function v(){return{startTime:o,payload:e,status:l,queriesSent:c,queriesPending:h.length,subscribe:m,abort:x}}function y(){l="failed",p.forEach(S=>{S(void 0,d)})}function w(){h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function b(S,A,_){const T=A!=="success";switch(h=h.filter(D=>D!==S),l){case"pending":break;case"failed":if(T||!n.dataAfterTimeout)return;break;default:return}if(A==="abort"){d=_,y();return}if(T){d=_,h.length||(a.length?E():y());return}if(g(),w(),!n.random){const D=n.resources.indexOf(S.resource);D!==-1&&D!==n.index&&(n.index=D)}l="completed",p.forEach(D=>{D(_)})}function E(){if(l!=="pending")return;g();const S=a.shift();if(S===void 0){if(h.length){f=setTimeout(()=>{g(),l==="pending"&&(w(),y())},n.timeout);return}y();return}const A={status:"pending",resource:S,callback:(_,T)=>{b(A,_,T)}};h.push(A),c++,f=setTimeout(E,n.rotate),t(S,e,A.callback)}return setTimeout(E),v}function Tg(n){const e={...EC,...n};let t=[];function i(){t=t.filter(a=>a().status==="pending")}function r(a,o,l){const c=TC(e,a,o,(d,f)=>{i(),l&&l(d,f)});return t.push(c),c}function s(a){return t.find(o=>a(o))||null}return{query:r,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:i}}function tp(){}const fc=Object.create(null);function AC(n){if(!fc[n]){const e=Yd(n);if(!e)return;fc[n]={config:e,redundancy:Tg(e)}}return fc[n]}function CC(n,e,t){let i,r;if(typeof n=="string"){const s=Su(n);if(!s)return t(void 0,424),tp;r=s.send;const a=AC(n);a&&(i=a.redundancy)}else{const s=jd(n);if(s){i=Tg(s);const a=Su(n.resources?n.resources[0]:"");a&&(r=a.send)}}return!i||!r?(t(void 0,424),tp):i.query(e,r,t)().abort}function np(){}function PC(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,bC(n)}))}function RC(n){const e=[],t=[];return n.forEach(i=>{(i.match(vg)?e:t).push(i)}),{valid:e,invalid:t}}function Zs(n,e,t){function i(){const r=n.pendingIcons;e.forEach(s=>{r&&r.delete(s),n.icons[s]||n.missing.add(s)})}if(t&&typeof t=="object")try{if(!yg(n,t).length){i();return}}catch(r){console.error(r)}i(),PC(n)}function ip(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function DC(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,r=n.iconsToLoad;if(delete n.iconsToLoad,!r||!r.length)return;const s=n.loadIcon;if(n.loadIcons&&(r.length>1||!s)){ip(n.loadIcons(r,i,t),c=>{Zs(n,r,c)});return}if(s){r.forEach(c=>{ip(s(c,i,t),d=>{Zs(n,[c],d?{prefix:i,icons:{[c]:d}}:null)})});return}const{valid:a,invalid:o}=RC(r);if(o.length&&Zs(n,o,null),!a.length)return;const l=i.match(vg)?Su(t):null;if(!l){Zs(n,a,null);return}l.prepare(t,i,a).forEach(c=>{CC(t,c,d=>{Zs(n,c.icons,d)})})}))}const LC=(n,e)=>{const t=MC(wC(n,!0,Sg()));if(!t.pending.length){let o=!0;return e&&setTimeout(()=>{o&&e(t.loaded,t.missing,t.pending,np)}),()=>{o=!1}}const i=Object.create(null),r=[];let s,a;return t.pending.forEach(o=>{const{provider:l,prefix:c}=o;if(c===a&&l===s)return;s=l,a=c,r.push(Cs(l,c));const d=i[l]||(i[l]=Object.create(null));d[c]||(d[c]=[])}),t.pending.forEach(o=>{const{provider:l,prefix:c,name:d}=o,f=Cs(l,c),h=f.pendingIcons||(f.pendingIcons=new Set);h.has(d)||(h.add(d),i[l][c].push(d))}),r.forEach(o=>{const l=i[o.provider][o.prefix];l.length&&DC(o,l)}),e?SC(e,t,r):np};function IC(n,e){const t={...n};for(const i in e){const r=e[i],s=typeof r;i in Mg?(r===null||r&&(s==="string"||s==="number"))&&(t[i]=r):s===typeof t[i]&&(t[i]=i==="rotate"?r%4:r)}return t}const NC=/[\s,]+/;function UC(n,e){e.split(NC).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function FC(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(n);return isNaN(r)?0:i(r)}else if(t!==n){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let s=parseFloat(n.slice(0,n.length-t.length));return isNaN(s)?0:(s=s/r,s%1===0?i(s):0)}}return e}function OC(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function zC(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function BC(n){return"data:image/svg+xml,"+zC(n)}function kC(n){return'url("'+BC(n)+'")'}const rp={...wg,inline:!1},VC={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},HC={display:"inline-block"},Mu={"background-color":"currentColor"},Ag={"background-color":"transparent"},sp={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},ap={"-webkit-mask":Mu,mask:Mu,background:Ag};for(const n in ap){const e=ap[n];for(const t in sp)e[n+"-"+t]=sp[t]}function GC(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}function WC(n,e){const t=IC(rp,e),i=e.mode||"svg",r=i==="svg"?{...VC}:{};n.body.indexOf("xlink:")===-1&&delete r["xmlns:xlink"];let s=typeof e.style=="string"?e.style:"";for(let v in e){const y=e[v];if(y!==void 0)switch(v){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":t[v]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&UC(t,y);break;case"color":s=s+(s.length>0&&s.trim().slice(-1)!==";"?";":"")+"color: "+y+"; ";break;case"rotate":typeof y=="string"?t[v]=FC(y):typeof y=="number"&&(t[v]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete r["aria-hidden"];break;default:if(v.slice(0,3)==="on:")break;rp[v]===void 0&&(r[v]=y)}}const a=oC(n,t),o=a.attributes;if(t.inline&&(s="vertical-align: -0.125em; "+s),i==="svg")return Object.assign(r,o),s!==""&&(r.style=s),{svg:!0,attributes:r,body:uC(a.body)};const{body:l,width:c,height:d}=n,f=i==="mask"||(i==="bg"?!1:l.indexOf("currentColor")!==-1),h=OC(l,{...o,width:c+"",height:d+""}),g={"--svg":kC(h)},x=v=>{const y=o[v];y&&(g[v]=GC(y))};x("width"),x("height"),Object.assign(g,HC,f?Mu:Ag);let m="";for(const v in g)m+=v+": "+g[v]+";";return r.style=m+s,{svg:!1,attributes:r}}Sg(!0);dC("",xC);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!eC(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const i="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;hC(t,r)||console.error(i)}catch{console.error(i)}}}}function XC(){try{return typeof window!="object"}catch{return!0}}function jC(n,e,t,i){function r(){e.loading&&(e.loading.abort(),e.loading=null)}if(typeof n=="object"&&n!==null&&typeof n.body=="string")return e.name="",r(),{data:{...gl,...n}};let s;if(typeof n!="string"||(s=ml(n,!1,!0))===null)return r(),null;const a=J2(s);if(!a)return!XC()&&(!e.loading||e.loading.name!==n)&&(r(),e.name="",e.loading={name:n,abort:LC([s],t)}),null;r(),e.name!==n&&(e.name=n,i&&!e.destroyed&&setTimeout(()=>{i(n)}));const o=["iconify"];return s.prefix!==""&&o.push("iconify--"+s.prefix),s.provider!==""&&o.push("iconify--"+s.provider),{data:a,classes:o}}function qC(n,e){return n?WC({...gl,...n},e):null}var YC=Xg("<svg></svg>"),KC=q("<span></span>");function Cg(n,e){st(e,!0);const t={name:"",loading:null,destroyed:!1},i=ut(e,["$$slots","$$events","$$legacy"]);let r=Fe(0),s=O(()=>(u(r),jC(e.icon,t,o,e.onload))),a=O(()=>{const f=u(s)?qC(u(s).data,i):null;return f&&u(s).classes&&i.class===void 0&&(f.attributes.class=(typeof i.class=="string"?i.class+" ":"")+u(s).classes.join(" ")),f});function o(){vp(r)}yp(()=>{t.destroyed=!0,t.loading&&(t.loading.abort(),t.loading=null)});var l=we(),c=Q(l);{var d=f=>{var h=we(),p=Q(h);{var g=m=>{var v=YC();Ft(v,()=>({...u(a).attributes})),Pv(v,()=>u(a).body,!0),j(v),P(m,v)},x=m=>{var v=KC();Ft(v,()=>({...u(a).attributes})),P(m,v)};xe(p,m=>{u(a).svg?m(g):m(x,-1)})}P(f,h)};xe(c,f=>{u(a)&&f(d)})}P(n,l),at()}var ZC=q("<span> </span>"),$C=q("<!> ",1);function JC(n,e){st(e,!0);let t=Fe(null);function i(r){!u(t)||Math.abs(r.deltaX)>Math.abs(r.deltaY)||!(u(t).scrollWidth>u(t).clientWidth)||(r.preventDefault(),u(t).scrollLeft+=r.deltaY)}gg(n,{class:"w-full shrink-0 border-b border-border",orientation:"horizontal",onwheel:i,get viewportRef(){return u(t)},set viewportRef(r){W(t,r,!0)},children:(r,s)=>{var a=we(),o=Q(a);Ne(o,()=>Rv,(l,c)=>{c(l,{class:"px-2 py-2 gap-0 inline-flex h-auto w-max justify-start rounded-none bg-transparent",children:(d,f)=>{var h=we(),p=Q(h);Zt(p,17,()=>e.tabs,g=>g.id,(g,x)=>{var m=we(),v=Q(m);Ne(v,()=>Dv,(y,w)=>{w(y,{get value(){return u(x).id},onclick:()=>e.onTabChange(u(x).id),class:"group/tab gap-1.5 px-3 py-1 text-sm font-medium relative h-auto flex-none shrink-0 rounded-none border-0 transition-colors not-last:border-r not-last:border-border hover:bg-accent data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none data-[state=inactive]:text-muted-foreground dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-transparent",children:(b,E)=>{var S=$C(),A=Q(S);{var _=D=>{var L=we(),F=Q(L);{var B=R=>{Cg(R,{get icon(){return u(x).icon},class:"h-4 w-4"})},U=O(()=>u(x).icon.includes(":")),N=R=>{var z=ZC(),Y=$(z,!0);j(z),Me(()=>Ae(Y,u(x).icon)),P(R,z)};xe(F,R=>{u(U)?R(B):R(N,-1)})}P(D,L)};xe(A,D=>{u(x).icon&&D(_)})}var T=se(A);Me(()=>Ae(T,` ${u(x).label??""}`)),P(b,S)},$$slots:{default:!0}})}),P(g,m)}),P(d,h)},$$slots:{default:!0}})}),P(r,a)},$$slots:{default:!0}}),at()}var QC=q("<h3> </h3>"),eP=q("<p> </p>"),tP=q("<div><!></div> <!> <!>",1);function wu(n,e){let t=oe(e,"message",3,""),i=oe(e,"size",3,"medium"),r=oe(e,"class",3,"");const s={small:{container:"p-6 gap-3",icon:"w-8 h-8",title:"text-sm font-semibold",message:"text-xs"},medium:{container:"p-12 gap-4",icon:"w-12 h-12",title:"text-lg font-semibold",message:"text-sm"},large:{container:"p-16 gap-6",icon:"w-16 h-16",title:"text-2xl font-bold",message:"text-base"}},a={loading:{icon:"text-primary",title:"text-primary-foreground",message:"text-primary-foreground/80",border:"border-primary",background:"bg-primary/15"},error:{icon:"text-destructive",title:"text-destructive-foreground",message:"text-destructive-foreground/80",border:"border-destructive",background:"bg-destructive/15"},warning:{icon:"text-accent",title:"text-accent-foreground",message:"text-accent-foreground/80",border:"border-accent",background:"bg-accent/15"},empty:{icon:"text-neutral",title:"text-neutral-foreground",message:"text-neutral-foreground/80",border:"border-neutral",background:"bg-neutral/15"}},o=O(()=>s[i()]),l=O(()=>a[e.type]);var c=we(),d=Q(c);Ne(d,()=>vs,(f,h)=>{h(f,{get class(){return`rounded-lg border-2 ${u(l).border??""} ${u(l).background??""} ${r()??""}`},children:(p,g)=>{var x=we(),m=Q(x);Ne(m,()=>Fp,(v,y)=>{y(v,{get class(){return`flex flex-col items-center justify-center text-center ${u(o).container??""}`},children:(w,b)=>{var E=tP(),S=Q(E),A=$(S);{var _=R=>{Uu(R,{class:"animate-spin h-full w-full"})},T=R=>{Op(R,{class:"h-full w-full"})},D=R=>{yo(R,{class:"h-full w-full"})},L=R=>{n_(R,{class:"h-full w-full"})};xe(A,R=>{e.type==="loading"?R(_):e.type==="error"?R(T,1):e.type==="warning"?R(D,2):e.type==="empty"&&R(L,3)})}j(S);var F=se(S,2);{var B=R=>{var z=QC(),Y=$(z,!0);j(z),Me(()=>{Dt(z,1,`${u(o).title??""} ${u(l).title??""} mt-1`),Ae(Y,e.title)}),P(R,z)};xe(F,R=>{e.title&&R(B)})}var U=se(F,2);{var N=R=>{var z=eP(),Y=$(z,!0);j(z),Me(()=>{Dt(z,1,`${u(o).message??""} ${u(l).message??""} max-w-md leading-relaxed`),Ae(Y,t())}),P(R,z)};xe(U,R=>{t()&&R(N)})}Me(()=>Dt(S,1,`${u(o).icon??""} ${u(l).icon??""}`)),P(w,E)},$$slots:{default:!0}})}),P(p,x)},$$slots:{default:!0}})}),P(n,c)}const _o=n=>Array.isArray(n)?n.map(String):n==null||n===""?[]:[String(n)],nP={equals:(n,e)=>n===e,notEquals:(n,e)=>n!==e,greaterThan:(n,e)=>Number(n)>Number(e),lessThan:(n,e)=>Number(n)<Number(e),greaterThanOrEqual:(n,e)=>Number(n)>=Number(e),lessThanOrEqual:(n,e)=>Number(n)<=Number(e),between:(n,e,t)=>t?.length===2&&Number(n)>=Number(t[0])&&Number(n)<=Number(t[1]),in:(n,e,t)=>t?.includes(String(n))??!1,notIn:(n,e,t)=>!(t?.includes(String(n))??!1),matches:(n,e)=>{try{return new RegExp(String(e)).test(String(n))}catch{return!1}},contains:(n,e)=>_o(n).includes(String(e)),containsAny:(n,e,t)=>{const i=_o(n);return t?.some(r=>i.includes(String(r)))??!1},isEmpty:n=>_o(n).length===0,isNotEmpty:n=>_o(n).length>0};function iP(n,e){const t=nP[n.operator];return t?t(e[n.paramId],n.value,n.values):!1}function Pg(n,e){const t=n.rules.map(i=>iP(i,e));return n.mode==="any"?t.some(Boolean):t.every(Boolean)}const op={show:n=>({visible:n,disabled:!1}),hide:(n,e)=>({visible:!n,disabled:!1,defaultValue:e}),disable:(n,e)=>({visible:!0,disabled:n,defaultValue:n?e:void 0})};function rP(n,e){if(n.type==="linebreak")return{visible:!0,disabled:!1};if("visible"in n&&n.visible===!1)return{visible:!1,disabled:!1};if(!n.visibilityCondition?.rules)return{visible:!0,disabled:!1};const{action:t="show",defaultValue:i}=n.visibilityCondition,r=Pg(n.visibilityCondition,e);return(op[t]??op.show)(r,i)}function Qo(n){return n.type==="linebreak"?n.id:n.paramId}function Rg(n,e){const t={};for(const i of n)t[Qo(i)]=rP(i,e);return t}function sP(n,e){if(!n.visibilityCondition?.rules)return!0;const{action:t="show"}=n.visibilityCondition,i=Pg(n.visibilityCondition,e);return t==="hide"?!i:i}var aP=q('<div style="grid-column: 1 / -1" class="h-px bg-border" aria-hidden="true"></div>'),oP=q("<div><!></div>"),lP=q("<div><!></div>"),cP=q('<div class="p-6"><div class="schema-grid gap-6 grid svelte-1mpk06z"></div></div>'),uP=q("<!> <!> <!>",1),dP=q('<div class="schema-grid gap-6 grid svelte-1mpk06z"></div>'),hP=q('<!> <div><div class="content-inner svelte-1mpk06z"><!></div></div>',1);function fP(n,e){st(e,!0);const t=(f,h=wt,p=wt,g=wt)=>{var x=we(),m=Q(x);{var v=w=>{var b=aP();P(w,b)},y=w=>{const b=O(()=>u(s)[Qo(h())]),E=O(()=>Math.min(Math.max(1,h().span??1),p()));var S=we(),A=Q(S);{var _=T=>{var D=we(),L=Q(D);{var F=U=>{var N=oP();let R;var z=$(N);pt(z,()=>e.inputSnippet,h,()=>u(b)),j(N),Me(()=>{R=Dt(N,1,"grid-cell min-w-0 flex items-center svelte-1mpk06z",null,R,{"opacity-50":u(b).disabled,"col-divider":!g()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)},B=U=>{var N=lP();let R;var z=$(N);pt(z,()=>e.outputSnippet,h),j(N),Me(()=>{R=Dt(N,1,"grid-cell svelte-1mpk06z",null,R,{"col-divider":!g()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)};xe(L,U=>{h().type==="input"?U(F):h().type==="output"&&U(B,1)})}P(T,D)};xe(A,T=>{u(b).visible&&T(_)})}P(w,S)};xe(m,w=>{h().type==="linebreak"?w(v):w(y,-1)})}P(f,x)};let i=oe(e,"flat",3,!1);function r(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e.onToggle())}const s=O(()=>Rg(e.items,e.values)),a=O(()=>{const f=[];let h=0;for(const p of e.items){if(p.type==="linebreak"){f.push(0),h=0;continue}if(!u(s)[Qo(p)].visible){f.push(0);continue}const x=Math.min(Math.max(1,p.span??1),e.columns);h+x>e.columns&&(h=0),f.push(h),h=(h+x)%e.columns}return f});var o=we(),l=Q(o);{var c=f=>{var h=cP(),p=$(h);Zt(p,23,()=>e.items,g=>g.type==="linebreak"?g.id:g.paramId,(g,x,m)=>{t(g,()=>u(x),()=>e.columns,()=>u(a)[u(m)]===0)}),j(p),j(h),Me(()=>Ii(p,`--schema-cols: ${e.columns??""};`)),P(f,h)},d=f=>{var h=we(),p=Q(h);Ne(p,()=>vs,(g,x)=>{x(g,{class:"gap-0 py-0 pt-0 overflow-hidden",children:(m,v)=>{var y=hP(),w=Q(y);{let _=O(()=>!e.collapsed);Ne(w,()=>Uv,(T,D)=>{D(T,{class:"pt-4 pb-4! cursor-pointer border-b border-border bg-muted transition-colors select-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none",role:"button",tabindex:0,get"aria-expanded"(){return u(_)},get onclick(){return e.onToggle},onkeydown:r,children:(L,F)=>{var B=uP(),U=Q(B);Ne(U,()=>Fv,(Y,K)=>{K(Y,{children:(ne,ce)=>{yt();var V=Et();Me(()=>Ae(V,e.label)),P(ne,V)},$$slots:{default:!0}})});var N=se(U,2);{var R=Y=>{var K=we(),ne=Q(K);Ne(ne,()=>zv,(ce,V)=>{V(ce,{children:(ee,me)=>{yt();var ve=Et();Me(()=>Ae(ve,e.description)),P(ee,ve)},$$slots:{default:!0}})}),P(Y,K)};xe(N,Y=>{e.description&&Y(R)})}var z=se(N,2);Ne(z,()=>G2,(Y,K)=>{K(Y,{children:(ne,ce)=>{{let V=O(()=>e.collapsed?"":"rotate-180");Ov(ne,{get class(){return`h-4 w-4 text-muted-foreground transition-transform duration-200 ${u(V)??""}`}})}},$$slots:{default:!0}})}),P(L,B)},$$slots:{default:!0}})})}var b=se(w,2);let E;var S=$(b),A=$(S);Ne(A,()=>Fp,(_,T)=>{T(_,{class:"p-6",children:(D,L)=>{var F=dP();Zt(F,23,()=>e.items,B=>B.type==="linebreak"?B.id:B.paramId,(B,U,N)=>{t(B,()=>u(U),()=>e.columns,()=>u(a)[u(N)]===0)}),j(F),Me(()=>Ii(F,`--schema-cols: ${e.columns??""};`)),P(D,F)},$$slots:{default:!0}})}),j(S),j(b),Me(()=>E=Dt(b,1,"content-wrapper svelte-1mpk06z",null,E,{collapsed:e.collapsed})),P(m,y)},$$slots:{default:!0}})}),P(f,h)};xe(l,f=>{i()?f(c):f(d,-1)})}P(n,o),at()}function pc(n){return n.type==="input"&&n.widgetType==="number"}function pP(n){return n.type==="input"&&n.widgetType==="text"}function mP(n){return n.type==="input"&&n.widgetType==="dropdown"}function xo(n){return n.type==="input"&&n.widgetType==="dynamicValueList"}function gP(n){return n.type==="input"&&n.widgetType==="checkbox"}function vP(n){return n.type==="input"&&n.widgetType==="file"}function _P(n){return n.type==="input"&&n.widgetType==="color"}function Dg(n){return n?.layout?n.layout.type==="tabbed"?n.layout.tabs?.flatMap(e=>e.groups??[])??[]:n.layout.type==="flat"?n.layout.groups??[]:[]:[]}function Lg(n){return Dg(n).flatMap(e=>e.items??[])}function xP(n){return Lg(n).filter(e=>e.type==="input")}const bP=Gv({base:"group/field data-[invalid=true]:text-destructive flex w-full gap-3",variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});var yP=q("<div><!></div>");function Eu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=yP();Ft(s,o=>({role:"group","data-slot":"field","data-orientation":i(),class:o,...r}),[()=>ci(bP({orientation:i()}),e.class)]);var a=$(s);pt(a,()=>e.children??wt),j(s),ui(s,o=>t(o),()=>t()),P(n,s),at()}function Tu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);{let r=O(()=>ci("group/field-label peer/field-label gap-2 leading-snug flex w-fit group-data-[disabled=true]/field:opacity-50","[&>*]:data-[slot=field]:p-4 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border","has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",e.class));or(n,mt({"data-slot":"field-label",get class(){return u(r)}},()=>i,{get ref(){return t()},set ref(s){t(s)},children:(s,a)=>{var o=we(),l=Q(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}))}at()}var SP=q("<li> </li>"),MP=q('<ul class="ms-4 gap-1 flex list-disc flex-col"></ul>'),wP=q("<div><!></div>");function Ig(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children","errors"]);const r=O(()=>e.children?!0:!(!e.errors||e.errors.length===0||e.errors.length===1&&!e.errors[0]?.message)),s=O(()=>e.errors&&e.errors.length>1),a=O(()=>e.errors&&e.errors.length===1&&e.errors[0]?.message);var o=we(),l=Q(o);{var c=d=>{var f=wP();Ft(f,m=>({role:"alert","data-slot":"field-error",class:m,...i}),[()=>ci("text-sm font-normal text-destructive",e.class)]);var h=$(f);{var p=m=>{var v=we(),y=Q(v);pt(y,()=>e.children),P(m,v)},g=m=>{var v=Et();Me(()=>Ae(v,u(a))),P(m,v)},x=m=>{var v=MP();Zt(v,21,()=>e.errors??[],bp,(y,w)=>{var b=we(),E=Q(b);{var S=A=>{var _=SP(),T=$(_,!0);j(_),Me(()=>Ae(T,u(w).message)),P(A,_)};xe(E,A=>{u(w)?.message&&A(S)})}P(y,b)}),j(v),P(m,v)};xe(h,m=>{e.children?m(p):u(a)?m(g,1):u(s)&&m(x,2)})}j(f),ui(f,m=>t(m),()=>t()),P(d,f)};xe(l,d=>{u(r)&&d(c)})}P(n,o),at()}var EP=q('<div data-slot="checkbox-indicator" class="text-current transition-none"><!></div>');function Ng(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"checked",15,!1),r=oe(e,"indeterminate",15,!1),s=ut(e,["$$slots","$$events","$$legacy","ref","checked","indeterminate","class"]);var a=we(),o=Q(a);{const l=(d,f)=>{let h=()=>(f?.()).checked,p=()=>(f?.()).indeterminate;var g=EP(),x=$(g);{var m=y=>{ia(y,{class:"size-3.5"})},v=y=>{kv(y,{class:"size-3.5"})};xe(x,y=>{h()?y(m):p()&&y(v,1)})}j(g),P(d,g)};let c=O(()=>ci("peer size-4 shadow-xs flex shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",e.class));Ne(o,()=>g_,(d,f)=>{f(d,mt({"data-slot":"checkbox",get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get checked(){return i()},set checked(h){i(h)},get indeterminate(){return r()},set indeterminate(h){r(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var TP=q("<!> <!>",1);function AP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1);var r=we(),s=Q(r);Ne(s,()=>Eu,(a,o)=>{o(a,{orientation:"horizontal",children:(l,c)=>{var d=TP(),f=Q(d);{let p=O(()=>typeof t()=="boolean"?t():!1);Ng(f,{get id(){return e.inputId},get checked(){return u(p)},onCheckedChange:g=>{t(g===!0),e.onChange(g===!0)},get disabled(){return i()}})}var h=se(f,2);Ne(h,()=>Tu,(p,g)=>{g(p,{get for(){return e.inputId},class:"font-normal cursor-pointer text-muted-foreground",children:(x,m)=>{yt();var v=Et("Enabled");P(x,v)},$$slots:{default:!0}})}),P(l,d)},$$slots:{default:!0}})}),P(n,r),at()}var CP=q("<label><!> <span> </span></label>"),PP=q('<div class="divide-y divide-border/60 overflow-hidden rounded-md border border-input"></div>');function lp(n,e){st(e,!0);let t=oe(e,"disabled",3,!1);const i=O(()=>e.config?.options??{}),r=O(()=>new Set(e.value??[]));function s(o,l){const c=new na(u(r));l?c.add(o):c.delete(o),e.onChange([...c])}var a=PP();Zt(a,21,()=>Object.entries(u(i)),([o,l])=>o,(o,l)=>{var c=O(()=>Mr(u(l),2));let d=()=>u(c)[0],f=()=>u(c)[1];const h=O(()=>f()??d()),p=O(()=>`${e.inputId}-${u(h)}`),g=O(()=>u(r).has(u(h)));var x=CP(),m=$(x);Ng(m,{get id(){return u(p)},get checked(){return u(g)},onCheckedChange:b=>s(u(h),b===!0),get disabled(){return t()}});var v=se(m,2);let y;var w=$(v,!0);j(v),j(x),Me(()=>{Qt(x,"for",u(p)),Dt(x,1,`gap-3 px-3 py-2 text-sm flex items-center transition-colors select-none hover:bg-accent/50 ${u(g)?"bg-accent/30":""} ${t()?"cursor-not-allowed opacity-50":"cursor-pointer"}`),y=Dt(v,1,"flex-1",null,y,{"font-medium":u(g)}),Ae(w,d())}),P(o,x)}),j(a),P(n,a),at()}var RP=q('<div class="gap-2 flex items-center"><input type="color" class="h-9 w-12 rounded p-1 cursor-pointer border border-input bg-background"/> <span class="font-mono text-sm text-muted-foreground"> </span></div>');function DP(n,e){st(e,!0);let t=oe(e,"value",3,"#000000");var i=RP(),r=$(i);Ru(r);var s=se(r,2),a=$(s,!0);j(s),j(i),Me(()=>{mv(r,t()||"#000000"),Ae(a,t()||"#000000")}),Xt("change",r,o=>{const l=o.currentTarget.value;e.onChange(l)}),P(n,i),at()}zi(["change"]);var LP=q("<!> <!>",1);function cp(n,e){st(e,!0);let t=oe(e,"value",7),i=oe(e,"disabled",3,!1);const r=O(()=>e.config?.options||{}),s=O(()=>t()||""),a=O(()=>Object.entries(u(r)).find(([c,d])=>d===u(s))?.[0]??u(s));var o=we(),l=Q(o);Ne(l,()=>wv,(c,d)=>{d(c,{type:"single",get value(){return u(s)},onValueChange:f=>{f&&(t(f),e.onChange(f))},get disabled(){return i()},children:(f,h)=>{var p=LP(),g=Q(p);Ne(g,()=>Ev,(m,v)=>{v(m,{class:"w-full",get disabled(){return i()},children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(a)||"Select an option...")),P(y,b)},$$slots:{default:!0}})});var x=se(g,2);Ne(x,()=>Tv,(m,v)=>{v(m,{children:(y,w)=>{var b=we(),E=Q(b);Zt(E,17,()=>Object.entries(u(r)),([S,A])=>S,(S,A)=>{var _=O(()=>Mr(u(A),2));let T=()=>u(_)[0],D=()=>u(_)[1];var L=we(),F=Q(L);{let B=O(()=>D()??T());Ne(F,()=>Av,(U,N)=>{N(U,{get value(){return u(B)},get label(){return T()}})})}P(S,L)}),P(y,b)},$$slots:{default:!0}})}),P(f,p)},$$slots:{default:!0}})}),P(n,o),at()}var IP=q('<button type="button"> </button>'),NP=q('<div class="rounded text-xs flex overflow-hidden border"></div>'),UP=q("<!> File URL",1),FP=q('<div class="gap-1.5 text-xs flex items-center text-success"><!> </div>'),OP=q('<p class="text-xs leading-snug pl-5 text-muted-foreground"> </p>'),zP=q('<div class="p-2.5 gap-1.5 flex flex-col rounded-md border border-destructive/40 bg-destructive/5"><div class="gap-1.5 flex items-start"><!> <p class="text-xs leading-snug text-destructive"> </p></div> <!></div>'),BP=q('<p class="text-xs text-muted-foreground">URL must be publicly accessible (no login required).</p>'),kP=q('<div class="gap-2 flex flex-col"><!> <div class="gap-2 flex"><!> <!></div> <!> <!> <!></div>'),VP=q("<!> Upload File",1),HP=q("<!> ",1),GP=q('<p class="text-xs text-muted-foreground"> </p>'),WP=q('<div class="gap-2 flex flex-col"><!> <!> <!></div>'),XP=q('<div class="gap-4 flex w-full flex-col"><input type="file" class="hidden"/> <!> <!></div>');function jP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"acceptedFormats",19,()=>[]),r=oe(e,"defaultInputMode",3,"upload"),s=O(()=>e.allowedInputModes&&e.allowedInputModes.length>0?e.allowedInputModes:["upload","url"]),a=O(()=>u(s).length>1),o=Fe("upload");Pt(()=>{const R=r()??"upload";W(o,u(s).includes(R)?R:u(s)[0],!0)});let l=Fe(null),c=Fe(""),d=Fe(""),f=Fe(!1),h=Fe(!1),p=Fe(null),g=Fe("");Pt(()=>{if(t())try{const R=typeof t()=="string"?JSON.parse(t()):t();if(R.type==="base64")if(R._isMetadata&&R._fileSize){const z=(R._fileSize/1024/1024).toFixed(2);W(c,`Uploaded file (${R.fileEnding}, ${z}MB)`)}else W(c,`Uploaded file (${R.fileEnding})`);else R.type==="url"&&W(d,R.file,!0)}catch{}});function x(R){const z=R.split("?")[0];return(z.includes(".")?"."+z.split(".").pop():".tmp").toLowerCase()}function m(R){return i().length===0?!0:i().includes(R.toLowerCase())}function v(R){return R instanceof TypeError&&R.message==="Failed to fetch"}async function y(){if(u(d).trim()){W(h,!0),W(p,null),W(g,""),W(c,"");try{let R;try{R=new URL(u(d))}catch{W(p,{message:"Invalid URL — make sure it starts with https://",isCors:!1},!0);return}if(R.protocol!=="https:"&&R.protocol!=="http:"){W(p,{message:"Only http:// and https:// URLs are supported.",isCors:!1},!0);return}const z=await fetch(u(d));if(!z.ok){W(p,{message:`Server returned ${z.status} ${z.statusText}. Check the URL is correct and publicly accessible.`,isCors:!1},!0);return}const Y=await z.blob(),K=x(u(d));if(!m(K)){W(p,{message:`File format "${K}" is not accepted. Allowed: ${i().join(", ")}`,isCors:!1},!0);return}const ne=us.FILE_UPLOAD.MAX_SIZE_BYTES;if(Y.size>ne){W(p,{message:`File too large: ${(Y.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB). Download it and use Upload instead.`,isCors:!1},!0);return}const ce=await new Promise((ee,me)=>{const ve=new FileReader;ve.onload=G=>{const ie=G.target?.result;ee(ie.includes(",")?ie.split(",")[1]:ie)},ve.onerror=()=>me(new Error("Failed to read the downloaded file.")),ve.readAsDataURL(Y)}),V=JSON.stringify({file:ce,type:"base64",fileEnding:K});t(V),W(g,`Loaded ${K} (${(Y.size/1024).toFixed(0)} KB)`),e.onChange(V)}catch(R){if(v(R)){const z=(()=>{try{return new URL(u(d)).hostname}catch{return""}})();let Y="Check that the URL is correct and the file is publicly accessible. If the server requires login, download the file and use the Upload option instead.";z.includes("sharepoint.com")||z.includes("onedrive.com")?Y='SharePoint/OneDrive blocks browser access. Open the file in SharePoint, use "Download" to save it locally, then upload it here.':z.includes("drive.google.com")?Y='Google Drive blocks browser access. Use "Download" in Google Drive to save the file locally, then upload it here.':z.includes("dropbox.com")&&(Y='Dropbox links may block browser access. Try changing "?dl=0" to "?dl=1" in the URL, or download and upload instead.'),W(p,{message:`Could not reach "${z}" — the file may not exist, or the server does not allow browser access.`,isCors:!0,hint:Y},!0)}else W(p,{message:R instanceof Error?R.message:"Unknown error",isCors:!1},!0)}finally{W(h,!1)}}}function w(R){const Y=R.target.files?.[0];if(!Y)return;const K=x(Y.name);if(!m(K)){alert(`File format not accepted: ${K}`);return}if(Y.size>us.FILE_UPLOAD.MAX_SIZE_BYTES){alert(`File too large: ${(Y.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB).`);return}W(c,Y.name,!0);const ne=new FileReader;ne.onload=ce=>{const V=ce.target?.result,ee=V.includes(",")?V.split(",")[1]:V,me=JSON.stringify({file:ee,type:"base64",fileEnding:K});t(me),e.onChange(me)},ne.readAsDataURL(Y)}function b(){u(l)?.click()}function E(R){R.preventDefault(),W(f,!0)}function S(){W(f,!1)}function A(R){R.preventDefault(),W(f,!1);const z=R.dataTransfer?.files;if(z?.[0]){const Y=new Event("change");Object.defineProperty(Y,"target",{value:{files:z}}),w(Y)}}const _=O(()=>i().length>0?i().join(","):"*");var T=XP(),D=$(T);ui(D,R=>W(l,R),()=>u(l));var L=se(D,2);{var F=R=>{var z=NP();Zt(z,20,()=>u(s),Y=>Y,(Y,K)=>{var ne=IP(),ce=$(ne,!0);j(ne),Me(()=>{Dt(ne,1,`px-3 py-1 flex-1 transition-colors ${u(o)===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`),Ae(ce,K==="upload"?"Upload":"URL")}),Xt("click",ne,()=>W(o,K,!0)),P(Y,ne)}),j(z),P(R,z)};xe(L,R=>{u(a)&&R(F)})}var B=se(L,2);{var U=R=>{var z=kP(),Y=$(z);or(Y,{for:"url-input",class:"gap-2 flex items-center",children:(Z,le)=>{var fe=UP(),Se=Q(fe);r_(Se,{size:16}),yt(),P(Z,fe)},$$slots:{default:!0}});var K=se(Y,2),ne=$(K);{let Z=O(()=>u(p)?"border-destructive focus-visible:ring-destructive":"");_s(ne,{id:"url-input",type:"url",placeholder:"https://example.com/model.3dm",get disabled(){return u(h)},get class(){return u(Z)},oninput:()=>{W(p,null),W(g,"")},get value(){return u(d)},set value(le){W(d,le,!0)}})}var ce=se(ne,2);{let Z=O(()=>u(h)||!u(d).trim());Bn(ce,{type:"button",variant:"outline",get disabled(){return u(Z)},onclick:y,children:(le,fe)=>{yt();var Se=Et();Me(()=>Ae(Se,u(h)?"Fetching...":"Fetch")),P(le,Se)},$$slots:{default:!0}})}j(K);var V=se(K,2);{var ee=Z=>{var le=FP(),fe=$(le);Vv(fe,{size:13});var Se=se(fe);j(le),Me(()=>Ae(Se,` ${u(g)??""}`)),P(Z,le)};xe(V,Z=>{u(g)&&Z(ee)})}var me=se(V,2);{var ve=Z=>{var le=zP(),fe=$(le),Se=$(fe);Op(Se,{size:13,class:"mt-0.5 shrink-0 text-destructive"});var ze=se(Se,2),Ue=$(ze,!0);j(ze),j(fe);var Pe=se(fe,2);{var ke=Ie=>{var We=OP(),Oe=$(We,!0);j(We),Me(()=>Ae(Oe,u(p).hint)),P(Ie,We)};xe(Pe,Ie=>{u(p).isCors&&u(p).hint&&Ie(ke)})}j(le),Me(()=>Ae(Ue,u(p).message)),P(Z,le)};xe(me,Z=>{u(p)&&Z(ve)})}var G=se(me,2);{var ie=Z=>{var le=BP();P(Z,le)};xe(G,Z=>{!u(p)&&!u(g)&&Z(ie)})}j(z),P(R,z)},N=R=>{var z=WP(),Y=$(z);or(Y,{for:"file-upload",class:"gap-2 flex items-center",children:(V,ee)=>{var me=VP(),ve=Q(me);ah(ve,{size:16}),yt(),P(V,me)},$$slots:{default:!0}});var K=se(Y,2);{let V=O(()=>u(f)?"border-primary":"");Bn(K,{type:"button",variant:"outline",get class(){return`gap-2 w-full ${u(V)??""}`},onclick:b,ondragover:E,ondragleave:S,ondrop:A,children:(ee,me)=>{var ve=HP(),G=Q(ve);ah(G,{size:16});var ie=se(G);Me(()=>Ae(ie,` ${(u(c)||"Choose File or Drag & Drop")??""}`)),P(ee,ve)},$$slots:{default:!0}})}var ne=se(K,2);{var ce=V=>{var ee=GP(),me=$(ee);j(ee),Me(ve=>Ae(me,`Accepted formats: ${ve??""}`),[()=>i().join(", ")]),P(V,ee)};xe(ne,V=>{i().length>0&&V(ce)})}j(z),P(R,z)};xe(B,R=>{u(o)==="url"?R(U):R(N,-1)})}j(T),Me(()=>Qt(D,"accept",u(_))),Xt("change",D,w),P(n,T),at()}zi(["change","click"]);function Au(n,e){let t=null;function i(...r){t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...r),t=null},e)}return i.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},i}var qP=q('<span data-slot="slider-track"><!></span> <!>',1);function YP(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"value",15),r=oe(e,"orientation",3,"horizontal"),s=ut(e,["$$slots","$$events","$$legacy","ref","value","orientation","class"]);var a=we(),o=Q(a);{const l=(d,f)=>{let h=()=>(f?.()).thumbs;var p=qP(),g=Q(p),x=$(g);{let v=O(()=>ci("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"));Ne(x,()=>u0,(y,w)=>{w(y,{"data-slot":"slider-range",get class(){return u(v)}})})}j(g);var m=se(g,2);Zt(m,16,h,v=>v,(v,y)=>{var w=we(),b=Q(w);Ne(b,()=>h0,(E,S)=>{S(E,{"data-slot":"slider-thumb",get index(){return y},class:"size-4 shadow-sm block shrink-0 rounded-full border border-primary bg-background ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"})}),P(v,w)}),Me(v=>{Qt(g,"data-orientation",r()),Dt(g,1,v)},[()=>Uo(ci("bg-neutral-200 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full dark:bg-muted"))]),P(d,p)};let c=O(()=>ci("data-[orientation=vertical]:min-h-44 relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e.class));Ne(o,()=>l0,(d,f)=>{f(d,mt({"data-slot":"slider",get orientation(){return r()},get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get value(){return i()},set value(h){i(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var KP=q('<input type="number" class="min-w-12 w-16 text-sm border-b border-border bg-transparent text-right outline-none focus:border-foreground"/>'),ZP=q('<span role="button" class="min-w-12 text-sm cursor-text text-right text-muted-foreground select-none" title="Double-click to edit"> </span>'),$P=q('<div class="gap-4 flex items-center"><!> <!></div>'),JP=q("<!> <!>",1);function QP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1),r=Fe(null),s=Fe(!1),a=Fe("");const o=O(()=>e.config?.minimum??0),l=O(()=>e.config?.maximum??100),c=O(()=>e.config?.stepSize??1),d=O(()=>typeof t()=="number"?t():u(o)),f=Au(_=>e.onChange(_),400),h=Au(_=>e.onChange(_),150);function p(_){return e.config?.minimum!==void 0&&_<e.config.minimum?`Minimum value is ${e.config.minimum}`:e.config?.maximum!==void 0&&_>e.config.maximum?`Maximum value is ${e.config.maximum}`:null}function g(_){const T=p(_);W(r,T,!0),T||(t(_),f(_))}function x(_){t(_),h(_)}function m(_){_.focus(),_.select()}function v(_){return Math.max(0,-Math.floor(Math.log10(_)))}var y=JP(),w=Q(y);{var b=_=>{const T=O(()=>v(u(c)));var D=$P(),L=$(D);YP(L,{type:"single",get value(){return u(d)},get min(){return u(o)},get max(){return u(l)},get step(){return u(c)},class:"flex-1",onValueChange:x,get disabled(){return i()}});var F=se(L,2);{var B=N=>{var R=KP();Ru(R),Bv(R,z=>m?.(z)),Hg(()=>Sp(R,()=>u(a),z=>W(a,z))),Me(()=>Qt(R,"step",u(c))),Wg("blur",R,()=>{const z=parseFloat(u(a));isNaN(z)||x(Math.min(u(l),Math.max(u(o),z))),W(s,!1)}),Xt("keydown",R,z=>{if(z.key==="Enter"){const Y=parseFloat(u(a));isNaN(Y)||x(Math.min(u(l),Math.max(u(o),Y))),W(s,!1)}else z.key==="Escape"&&W(s,!1)}),P(N,R)},U=N=>{var R=ZP();Qt(R,"tabindex",0);var z=$(R,!0);j(R),Me(Y=>Ae(z,Y),[()=>u(d).toFixed(u(T))]),Xt("dblclick",R,()=>{W(a,u(d).toFixed(u(T)),!0),W(s,!0)}),Xt("keydown",R,Y=>{(Y.key==="Enter"||Y.key===" ")&&(W(a,u(d).toFixed(u(T)),!0),W(s,!0))}),P(N,R)};xe(F,N=>{u(s)?N(B):N(U,-1)})}j(D),P(_,D)},E=_=>{{let T=O(()=>e.config?.minimum),D=O(()=>e.config?.maximum),L=O(()=>e.config?.placeholder),F=O(()=>u(r)?!0:void 0),B=O(()=>u(r)?!0:void 0),U=O(()=>u(r)?"border-destructive":"");_s(_,{get id(){return e.inputId},type:"number",get value(){return u(d)},get min(){return u(T)},get max(){return u(D)},get step(){return u(c)},get placeholder(){return u(L)},get"data-invalid"(){return u(F)},get"aria-invalid"(){return u(B)},get class(){return u(U)},get disabled(){return i()},oninput:()=>W(r,null),onchange:N=>{const R=parseFloat(N.currentTarget.value);isNaN(R)||g(R)},onblur:N=>{const R=parseFloat(N.currentTarget.value);if(!isNaN(R)){const z=p(R);W(r,z,!0),z||(t(R),e.onChange(R))}}})}};xe(w,_=>{e.config?.renderAsSlider?_(b):_(E,-1)})}var S=se(w,2);{var A=_=>{var T=we(),D=Q(T);Ne(D,()=>Ig,(L,F)=>{F(L,{children:(B,U)=>{yt();var N=Et();Me(()=>Ae(N,u(r))),P(B,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{u(r)&&_(A)})}P(n,y),at()}zi(["keydown","dblclick"]);var eR=q("<!> <!>",1);function tR(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1),r=Fe(null),s=Fe(Ps(t()||""));const a=Au(p=>e.onChange(p),400);function o(p){if(e.config?.maxLength&&p.length>e.config.maxLength)return`Maximum ${e.config.maxLength} characters allowed`;if(e.config?.pattern)try{if(!new RegExp(e.config.pattern).test(p))return e.config.customErrorMessage||"Invalid format"}catch{return"Invalid validation pattern configured"}return null}function l(){const p=o(u(s));W(r,p,!0),p||(t(u(s)),a(u(s)))}var c=eR(),d=Q(c);{let p=O(()=>e.config?.placeholder),g=O(()=>e.config?.maxLength),x=O(()=>u(r)?!0:void 0),m=O(()=>u(r)?!0:void 0),v=O(()=>u(r)?"border-destructive":"");_s(d,{get id(){return e.inputId},type:"text",get placeholder(){return u(p)},get maxlength(){return u(g)},get"data-invalid"(){return u(x)},get"aria-invalid"(){return u(m)},get class(){return u(v)},get disabled(){return i()},oninput:()=>{W(r,null),l()},onblur:y=>{const w=y.currentTarget.value,b=o(w);W(r,b,!0),b||(W(s,w,!0),t(w),e.onChange(w))},get value(){return u(s)},set value(y){W(s,y,!0)}})}var f=se(d,2);{var h=p=>{var g=we(),x=Q(g);Ne(x,()=>Ig,(m,v)=>{v(m,{children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(r))),P(y,b)},$$slots:{default:!0}})}),P(p,g)};xe(f,p=>{u(r)&&p(h)})}P(n,c),at()}const Ug=Symbol("client-slot-context");function nR(n){Cu(Ug,n)}function iR(){return Ms(Ug)}var rR=q("<!> <!>",1),sR=q("<!> <!>",1),aR=q(" <!>",1),oR=q("<!> <!>",1),lR=q("<!> <!>",1),cR=q("<!> <!>",1),uR=q('<span class="text-xs font-normal text-muted-foreground"> </span>'),dR=q(" <!> <!>",1),hR=q('<p class="text-sm text-muted-foreground">No options available yet.</p>'),fR=q("<!> <!>",1);function pR(n,e){st(e,!0);let t=oe(e,"value",15,void 0),i=oe(e,"disabled",3,!1);const r=O(()=>`input-${e.item.paramId}`),s=O(()=>e.displayName||e.item.displayName||e.item.paramId),a=O(()=>{const b=e.item.source;return b?.kind==="client"&&b.client?.presentation==="slot"}),o=iR(),l=O(()=>{if(!pc(e.item))return null;const b=e.item.config;if(b?.hideRange)return null;const E=typeof b?.minimum=="number",S=typeof b?.maximum=="number";return!E&&!S?null:E&&S?`${b.minimum} to ${b.maximum}`:E?`≥ ${b.minimum}`:`≤ ${b.maximum}`}),c=O(()=>pc(e.item)&&u(l)!==null),d=O(()=>xo(e.item)?e.item.config:void 0),f=O(()=>e.dynamicOptions&&Object.keys(e.dynamicOptions).length>0?e.dynamicOptions:Object.fromEntries(Object.entries(u(d)?.defaultOptions??{}).filter(b=>b[1]!==void 0))),h=O(()=>Object.keys(u(f)).length>0),p=O(()=>({options:u(f),displayAs:u(d)?.displayAs??"dropdown"})),g=O(()=>xo(e.item)&&!u(h)&&(u(d)?.emptyBehavior??"hide")==="hide");Pt(()=>{if(!xo(e.item)||!u(h))return;const b=new Set(Object.values(u(f)));if(Array.isArray(t())){const E=t().filter(S=>typeof S=="string"&&b.has(S));E.length!==t().length&&e.onChange(e.item.paramId,E.length>0?E:[Object.values(u(f))[0]],!0)}else typeof t()=="string"&&t()&&!b.has(t())&&e.onChange(e.item.paramId,Object.values(u(f))[0],!0)});function x(b){t(b),e.onChange(e.item.paramId,b)}var m=we(),v=Q(m);{var y=b=>{var E=we(),S=Q(E);{var A=_=>{var T=we(),D=Q(T);Ne(D,()=>Eu,(L,F)=>{F(L,{children:(B,U)=>{var N=oR(),R=Q(N);Ne(R,()=>Tu,(Y,K)=>{K(Y,{class:"gap-2 flex items-center",children:(ne,ce)=>{yt();var V=aR(),ee=Q(V),me=se(ee);{var ve=G=>{var ie=we(),Z=Q(ie);Ne(Z,()=>wr,(le,fe)=>{fe(le,{children:(Se,ze)=>{var Ue=sR(),Pe=Q(Ue);Ne(Pe,()=>mc,(Ie,We)=>{We(Ie,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(Oe,He)=>{ch(Oe,{size:16})},$$slots:{default:!0}})});var ke=se(Pe,2);Ne(ke,()=>Er,(Ie,We)=>{We(Ie,{class:"sm:max-w-md",children:(Oe,He)=>{var k=we(),je=Q(k);Ne(je,()=>ms,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{var C=rR(),M=Q(C);Ne(M,()=>dr,(re,ue)=>{ue(re,{children:(be,ge)=>{yt();var ae=Et();Me(()=>Ae(ae,u(s))),P(be,ae)},$$slots:{default:!0}})});var H=se(M,2);Ne(H,()=>gs,(re,ue)=>{ue(re,{children:(be,ge)=>{yt();var ae=Et();Me(()=>Ae(ae,e.item.description)),P(be,ae)},$$slots:{default:!0}})}),P(ye,C)},$$slots:{default:!0}})}),P(Oe,k)},$$slots:{default:!0}})}),P(Se,Ue)},$$slots:{default:!0}})}),P(G,ie)};xe(me,G=>{e.item.description&&G(ve)})}Me(()=>Ae(ee,`${u(s)??""} `)),P(ne,V)},$$slots:{default:!0}})});var z=se(R,2);o(z,()=>({inputId:e.item.paramId,displayName:u(s),value:t(),onValueChange:x})),P(B,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{o&&_(A)})}P(b,E)},w=b=>{var E=we(),S=Q(E);Ne(S,()=>Eu,(A,_)=>{_(A,{children:(T,D)=>{var L=fR(),F=Q(L);Ne(F,()=>Tu,(Z,le)=>{le(Z,{get for(){return u(r)},class:"gap-2 flex items-center",children:(fe,Se)=>{yt();var ze=dR(),Ue=Q(ze),Pe=se(Ue);{var ke=Oe=>{var He=we(),k=Q(He);Ne(k,()=>wr,(je,Ve)=>{Ve(je,{children:(Xe,ye)=>{var Ce=cR(),C=Q(Ce);Ne(C,()=>mc,(H,re)=>{re(H,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(ue,be)=>{ch(ue,{size:16})},$$slots:{default:!0}})});var M=se(C,2);Ne(M,()=>Er,(H,re)=>{re(H,{class:"sm:max-w-md",children:(ue,be)=>{var ge=we(),ae=Q(ge);Ne(ae,()=>ms,(he,Re)=>{Re(he,{children:(Le,Ee)=>{var De=lR(),et=Q(De);Ne(et,()=>dr,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,u(s))),P(Ge,Ze)},$$slots:{default:!0}})});var Ye=se(et,2);Ne(Ye,()=>gs,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,e.item.description)),P(Ge,Ze)},$$slots:{default:!0}})}),P(Le,De)},$$slots:{default:!0}})}),P(ue,ge)},$$slots:{default:!0}})}),P(Xe,Ce)},$$slots:{default:!0}})}),P(Oe,He)};xe(Pe,Oe=>{e.item.description&&Oe(ke)})}var Ie=se(Pe,2);{var We=Oe=>{var He=uR(),k=$(He,!0);j(He),Me(()=>Ae(k,u(l))),P(Oe,He)};xe(Ie,Oe=>{u(c)&&Oe(We)})}Me(()=>Ae(Ue,`${u(s)??""} `)),P(fe,ze)},$$slots:{default:!0}})});var B=se(F,2);{var U=Z=>{const le=O(()=>e.item.config);{let fe=O(()=>typeof t()=="number"?t():void 0);QP(Z,{get inputId(){return u(r)},get value(){return u(fe)},get config(){return u(le)},onChange:x,get disabled(){return i()}})}},N=O(()=>pc(e.item)),R=Z=>{{let le=O(()=>typeof t()=="boolean"?t():void 0);AP(Z,{get inputId(){return u(r)},get value(){return u(le)},onChange:x,get disabled(){return i()}})}},z=O(()=>gP(e.item)),Y=Z=>{const le=O(()=>e.item.config);{let fe=O(()=>typeof t()=="string"?t():"");tR(Z,{get inputId(){return u(r)},get value(){return u(fe)},get config(){return u(le)},onChange:x,get disabled(){return i()}})}},K=O(()=>pP(e.item)),ne=Z=>{const le=O(()=>e.item.config);var fe=we(),Se=Q(fe);{var ze=Pe=>{{let ke=O(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(Pe,{get inputId(){return u(r)},get value(){return u(ke)},get config(){return u(le)},onChange:x,get disabled(){return i()}})}},Ue=Pe=>{{let ke=O(()=>typeof t()=="string"?t():"");cp(Pe,{get value(){return u(ke)},get config(){return u(le)},onChange:x,get disabled(){return i()}})}};xe(Se,Pe=>{u(le).displayAs==="checklist"?Pe(ze):Pe(Ue,-1)})}P(Z,fe)},ce=O(()=>mP(e.item)),V=Z=>{var le=we(),fe=Q(le);{var Se=Ue=>{var Pe=we(),ke=Q(Pe);{var Ie=Oe=>{{let He=O(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(Oe,{get inputId(){return u(r)},get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}},We=Oe=>{{let He=O(()=>typeof t()=="string"?t():"");cp(Oe,{get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}};xe(ke,Oe=>{u(p).displayAs==="checklist"?Oe(Ie):Oe(We,-1)})}P(Ue,Pe)},ze=Ue=>{var Pe=hR();P(Ue,Pe)};xe(fe,Ue=>{u(h)?Ue(Se):Ue(ze,-1)})}P(Z,le)},ee=O(()=>xo(e.item)),me=Z=>{const le=O(()=>e.item.config);{let fe=O(()=>typeof t()=="string"?t():""),Se=O(()=>u(le)?.acceptedFormats??[]),ze=O(()=>u(le)?.defaultInputMode),Ue=O(()=>u(le)?.allowedInputModes);jP(Z,{get value(){return u(fe)},get acceptedFormats(){return u(Se)},onChange:Pe=>x(Pe),get defaultInputMode(){return u(ze)},get allowedInputModes(){return u(Ue)}})}},ve=O(()=>vP(e.item)),G=Z=>{{let le=O(()=>typeof t()=="string"?t():"#000000");DP(Z,{get value(){return u(le)},onChange:fe=>x(fe)})}},ie=O(()=>_P(e.item));xe(B,Z=>{u(N)?Z(U):u(z)?Z(R,1):u(K)?Z(Y,2):u(ce)?Z(ne,3):u(ee)?Z(V,4):u(ve)?Z(me,5):u(ie)&&Z(G,6)})}P(T,L)},$$slots:{default:!0}})}),P(b,E)};xe(v,b=>{u(a)?b(y):u(g)||b(w,1)})}P(n,m),at()}const $s=new Map;function mR(n,e){if($s.has(n))return $s.get(n);if(document.querySelector(`script[src="${n}"]`)){const i=Promise.resolve();return $s.set(n,i),i}const t=new Promise((i,r)=>{const s=document.createElement("script");s.src=n,e?.crossOrigin&&(s.crossOrigin=e.crossOrigin),e?.async!==void 0&&(s.async=e.async),e?.defer!==void 0&&(s.defer=e.defer),s.onload=()=>i(),s.onerror=()=>{$s.delete(n),r(new Error(`Failed to load script: ${n}`))},document.head.appendChild(s)});return $s.set(n,t),t}var gR=q('<div class="px-4 py-3 text-sm text-destructive"> </div>'),vR=q('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Receiving chart data...</div>'),_R=q('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for chart data...</div>'),xR=q('<div class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-muted-foreground"><!></div>'),bR=q('<div class="w-full"></div> <div><!> <button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button></div>',1),yR=q("<div><!></div>");function SR(n,e){st(e,!0);const t=new Set(["scattermap","scattermapbox","choropleth","scattergeo"]),i=O(()=>{if(!e.value)return null;try{return JSON.parse(e.value)}catch{return null}});let r=Fe(null),s=Fe(null),a=Fe(!1),o=Fe(null),l=Fe(!1),c=!1;async function d(){return window.Plotly||await mR("https://cdn.plot.ly/plotly-3.4.0.min.js",{crossOrigin:"anonymous"}),window.Plotly}function f(){u(s)&&(document.fullscreenElement?document.exitFullscreen().catch(E=>{W(o,`Exit fullscreen failed: ${E.message}`)}):u(s).requestFullscreen().catch(E=>{W(o,`Fullscreen unavailable: ${E.message}`)}))}Pt(()=>{function E(){W(l,!!document.fullscreenElement),Promise.resolve().then(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r))})}return document.addEventListener("fullscreenchange",E),()=>document.removeEventListener("fullscreenchange",E)});function h(){if(!u(r))return{textColor:"#333",gridColor:"#eee"};const E=getComputedStyle(u(r)),S=E.getPropertyValue("color").trim()||"#333",A=E.getPropertyValue("--border")?.trim()||E.getPropertyValue("--color-border")?.trim()||"rgba(128,128,128,0.2)";return{textColor:S,gridColor:A}}async function p(){if(!(!u(r)||!u(i))){W(o,null),W(a,!0);try{const E=await d(),{textColor:S,gridColor:A}=h(),_=u(i).data?.some(N=>t.has(N.type)),{title:T,template:D,height:L,width:F,...B}=u(i).layout,U={...B,autosize:!0,margin:{t:24,r:8,b:40,l:60,pad:0},font:{color:S},paper_bgcolor:B.paper_bgcolor??"transparent",plot_bgcolor:B.plot_bgcolor??"transparent",...!_&&B.xaxis?{xaxis:{...B.xaxis,gridcolor:A,color:S}}:{},...!_&&B.yaxis?{yaxis:{...B.yaxis,gridcolor:A,color:S}}:{}};E.react(u(r),u(i).data,U,{responsive:!0,displayModeBar:"hover",displaylogo:!1,modeBarButtonsToRemove:["sendDataToCloud","lasso2d","select2d"],...u(i).config})}catch(E){W(o,E instanceof Error?E.message:"Failed to render chart",!0)}finally{W(a,!1)}}}tl(()=>{c=!0;let E=null;const S=new ResizeObserver(()=>{E&&clearTimeout(E),E=setTimeout(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r)),E=null},150)});return u(s)&&S.observe(u(s)),()=>{S.disconnect(),E&&clearTimeout(E),u(r)&&window.Plotly&&window.Plotly.purge(u(r))}});let g=null;Pt(()=>{if(!(!e.value||!c||!u(r)))return g&&clearTimeout(g),g=setTimeout(()=>{p(),g=null},150),()=>{g&&clearTimeout(g)}});var x=yR(),m=$(x);{var v=E=>{var S=gR(),A=$(S,!0);j(S),Me(()=>Ae(A,u(o))),P(E,S)},y=E=>{var S=vR();P(E,S)},w=E=>{var S=_R();P(E,S)},b=E=>{var S=bR(),A=Q(S);ui(A,N=>W(r,N),()=>u(r));var _=se(A,2),T=$(_);{var D=N=>{var R=xR(),z=$(R);Uu(z,{size:14,class:"animate-spin"}),j(R),P(N,R)};xe(T,N=>{u(a)&&N(D)})}var L=se(T,2),F=$(L);{var B=N=>{Ou(N,{size:14})},U=N=>{Fu(N,{size:14})};xe(F,N=>{u(l)?N(B):N(U,-1)})}j(L),j(_),Me(()=>{Ii(A,`height: ${u(l)?"100vh":"380px"};`),Dt(_,1,`gap-1 left-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(l)?"opacity-100":""}`),L.disabled=u(a),Qt(L,"title",u(l)?"Exit fullscreen":"Fullscreen")}),Xt("click",L,f),P(E,S)};xe(m,E=>{u(o)?E(v):!u(i)&&e.value?E(y,1):u(i)?E(b,-1):E(w,2)})}j(x),ui(x,E=>W(s,E),()=>u(s)),Me(()=>Dt(x,1,`group rounded relative overflow-hidden border border-border ${u(l)?"bg-background":""}`)),P(n,x),at()}zi(["click"]);var MR=q('<div class="px-4 py-3 text-sm text-destructive"> </div>'),wR=q('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for image...</div>'),ER=q(`<div class="px-4 py-3 text-sm text-destructive">Unsupported image format: <span class="font-mono"> </span>. Supported:
|
|
5019
|
-
.png, .jpg, .jpeg, .webp, .gif, .svg</div>`),TR=q('<button title="Download image" class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button>'),AR=q('<button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background"><!></button>'),CR=q("<div><!> <!></div>"),PR=q('<div class="w-full"><img class="h-full w-full object-contain"/></div> <!>',1),RR=q("<div><!></div>");function DR(n,e){st(e,!0);const t=new Set([".png",".jpg",".jpeg",".webp",".gif",".svg"]),i=O(()=>Array.isArray(e.value)?e.value.find(No)??null:No(e.value)?e.value:null),r=O(()=>u(i)?(u(i).fileType??"").toLowerCase():""),s=O(()=>t.has(u(r))),a=O(()=>{if(!u(i)||!u(s))return null;const A=Kg[u(r)]??"application/octet-stream";return u(i).isBase64Encoded?`data:${A};base64,${u(i).data}`:`data:${A};utf8,${encodeURIComponent(u(i).data)}`}),o=O(()=>e.item.config??{}),l=O(()=>u(o).allowDownload??!0),c=O(()=>u(o).allowFullscreen??!0),d=O(()=>u(o).backgroundColor);let f=Fe(null),h=Fe(!1),p=Fe(!1),g=Fe(null);function x(){u(f)&&(document.fullscreenElement?document.exitFullscreen().catch(A=>{W(g,`Exit fullscreen failed: ${A.message}`)}):u(f).requestFullscreen().catch(A=>{W(g,`Fullscreen unavailable: ${A.message}`)}))}Pt(()=>{function A(){W(h,!!document.fullscreenElement)}return document.addEventListener("fullscreenchange",A),()=>document.removeEventListener("fullscreenchange",A)});async function m(){if(u(i)){W(p,!0),W(g,null);try{await gc(u(i),u(i).fileName)}catch(A){W(g,A instanceof Error?A.message:"Download failed",!0)}finally{W(p,!1)}}}var v=RR(),y=$(v);{var w=A=>{var _=MR(),T=$(_,!0);j(_),Me(()=>Ae(T,u(g))),P(A,_)},b=A=>{var _=wR();P(A,_)},E=A=>{var _=ER(),T=se($(_)),D=$(T,!0);j(T),yt(),j(_),Me(()=>Ae(D,u(r)||"(unknown)")),P(A,_)},S=A=>{var _=PR(),T=Q(_),D=$(T);j(T);var L=se(T,2);{var F=B=>{var U=CR(),N=$(U);{var R=K=>{var ne=TR(),ce=$(ne);zp(ce,{size:14}),j(ne),Me(()=>ne.disabled=u(p)),Xt("click",ne,m),P(K,ne)};xe(N,K=>{u(l)&&u(i)&&K(R)})}var z=se(N,2);{var Y=K=>{var ne=AR(),ce=$(ne);{var V=me=>{Ou(me,{size:14})},ee=me=>{Fu(me,{size:14})};xe(ce,me=>{u(h)?me(V):me(ee,-1)})}j(ne),Me(()=>Qt(ne,"title",u(h)?"Exit fullscreen":"Fullscreen")),Xt("click",ne,x),P(K,ne)};xe(z,K=>{u(c)&&K(Y)})}j(U),Me(()=>Dt(U,1,`gap-1 right-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(h)?"opacity-100":""}`)),P(B,U)};xe(L,B=>{(u(l)||u(c))&&B(F)})}Me(()=>{Ii(T,`height: ${u(h)?"100vh":"380px"}; ${u(d)?`background-color: ${u(d)};`:""}`),Qt(D,"src",u(a)),Qt(D,"alt",e.item.displayName??u(i).fileName)}),P(A,_)};xe(y,A=>{u(g)?A(w):u(i)?u(s)?A(S,-1):A(E,2):A(b,1)})}j(v),ui(v,A=>W(f,A),()=>u(f)),Me(()=>Dt(v,1,`group rounded relative overflow-hidden border border-border ${u(h)?"bg-background":""}`)),P(n,v),at()}zi(["click"]);const up=n=>{var e=UR();P(n,e)};var LR=q("<!> <!>",1),IR=q("<!> <!>",1),NR=q('<div class="gap-2 flex items-center"><!> <!></div>'),UR=q('<span class="text-muted-foreground not-italic">Waiting for data...</span>'),FR=q('<div class="ml-4 pl-2 border-l border-border/50"><!></div>'),OR=q('<div><button class="gap-1.5 py-0.5 text-xs flex w-full items-center text-muted-foreground transition-colors hover:text-foreground"><!> <!> <span class="font-medium"> </span></button> <!></div>'),zR=q('<div class="gap-1.5 py-0.5 flex items-center justify-between"><div class="gap-1.5 min-w-0 flex items-center"><!> <span class="text-xs truncate text-foreground"> </span></div> <span class="text-xs shrink-0 text-muted-foreground"> </span></div>'),BR=q('<div class="rounded px-3 py-3 text-sm border border-border bg-muted text-muted-foreground">Waiting for file data...</div>'),kR=q('<div class="gap-2 text-xs flex items-center justify-between text-muted-foreground"><span class="min-w-0 truncate"> </span> <span class="shrink-0"> </span></div>'),VR=q('<div class="gap-1 flex flex-col"></div>'),HR=q('<div class="mt-2"><!></div>'),GR=q('<li class="truncate"><span class="font-mono"> </span></li>'),WR=q('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"><div class="font-medium">Duplicate file names detected</div> <div class="mt-1 text-xs"> </div> <ul class="mt-1 ml-4 text-xs list-disc"></ul> <div class="mt-1 text-xs">Rename outputs in your Grasshopper definition so each file has a unique name.</div></div>'),XR=q('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"> </div>'),jR=q('<div class="gap-2 flex flex-col"><div class="rounded px-3 py-2 border border-border bg-muted"><div class="gap-2 flex items-center justify-between"><span class="min-w-0 text-sm font-medium truncate text-foreground"> </span> <span class="text-xs shrink-0 text-muted-foreground"> </span></div> <!></div> <!> <!> <!></div>'),qR=q('<span class="font-bold text-primary"> </span>'),YR=q("<div><!></div>"),KR=q("<pre> </pre>"),ZR=q("<div><!></div>"),$R=q('<div class="group relative"><!> <!></div>'),JR=q('<div class="gap-2 flex flex-col"><!> <!></div>');function QR(n,e){st(e,!0);const t=U=>{var N=NR(),R=$(N);or(R,{children:(K,ne)=>{yt();var ce=Et();Me(()=>Ae(ce,u(o))),P(K,ce)},$$slots:{default:!0}});var z=se(R,2);{var Y=K=>{var ne=we(),ce=Q(ne);Ne(ce,()=>wr,(V,ee)=>{ee(V,{children:(me,ve)=>{var G=IR(),ie=Q(G);Ne(ie,()=>mc,(le,fe)=>{fe(le,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(Se,ze)=>{Hv(Se,{size:16})},$$slots:{default:!0}})});var Z=se(ie,2);Ne(Z,()=>Er,(le,fe)=>{fe(le,{class:"sm:max-w-md",children:(Se,ze)=>{var Ue=we(),Pe=Q(Ue);Ne(Pe,()=>ms,(ke,Ie)=>{Ie(ke,{children:(We,Oe)=>{var He=LR(),k=Q(He);Ne(k,()=>dr,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{yt();var C=Et();Me(()=>Ae(C,u(o))),P(ye,C)},$$slots:{default:!0}})});var je=se(k,2);Ne(je,()=>gs,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{yt();var C=Et();Me(()=>Ae(C,e.item.description)),P(ye,C)},$$slots:{default:!0}})}),P(We,He)},$$slots:{default:!0}})}),P(Se,Ue)},$$slots:{default:!0}})}),P(me,G)},$$slots:{default:!0}})}),P(K,ne)};xe(z,K=>{e.item.description&&K(Y)})}j(N),P(U,N)},i=(U,N=wt,R=wt)=>{var z=we(),Y=Q(z);Zt(Y,17,N,([K,ne])=>K,(K,ne)=>{var ce=O(()=>Mr(u(ne),2));let V=()=>u(ce)[1];var ee=we(),me=Q(ee);{var ve=ie=>{const Z=O(()=>R()?`${R()}/${V().name}`:V().name),le=O(()=>_.has(u(Z)));var fe=OR(),Se=$(fe),ze=$(Se);{let k=O(()=>u(le)?"rotate-90":"");Du(ze,{size:12,get class(){return`shrink-0 transition-transform duration-150 ${u(k)??""}`}})}var Ue=se(ze,2);{var Pe=k=>{Wv(k,{size:13,class:"shrink-0 text-primary/70"})},ke=k=>{Qv(k,{size:13,class:"shrink-0 text-primary/70"})};xe(Ue,k=>{u(le)?k(Pe):k(ke,-1)})}var Ie=se(Ue,2),We=$(Ie,!0);j(Ie),j(Se);var Oe=se(Se,2);{var He=k=>{var je=FR(),Ve=$(je);i(Ve,()=>V().children,()=>u(Z)),j(je),P(k,je)};xe(Oe,k=>{u(le)&&k(He)})}j(fe),Me(()=>Ae(We,V().name)),Xt("click",Se,()=>T(u(Z))),P(ie,fe)},G=ie=>{var Z=zR(),le=$(Z),fe=$(le);Jv(fe,{size:12,class:"shrink-0 text-muted-foreground"});var Se=se(fe,2),ze=$(Se);j(Se),j(le);var Ue=se(le,2),Pe=$(Ue,!0);j(Ue),j(Z),Me(ke=>{Ae(ze,`${V().file.fileName??""}${V().file.fileType??""}`),Ae(Pe,ke)},[()=>_l(xl(V().file.data))]),P(ie,Z)};xe(me,ie=>{V().type==="folder"?ie(ve):ie(G,-1)})}P(K,ee)}),P(U,z)},r=U=>{var N=we(),R=Q(N);{var z=K=>{var ne=BR();P(K,ne)},Y=K=>{var ne=jR(),ce=$(ne),V=$(ce),ee=$(V),me=$(ee,!0);j(ee);var ve=se(ee,2),G=$(ve,!0);j(ve),j(V);var ie=se(V,2);{var Z=Pe=>{var ke=HR(),Ie=$(ke);{var We=He=>{i(He,()=>u(b),()=>"")},Oe=He=>{var k=VR();Zt(k,23,()=>u(g),(je,Ve)=>E(je)+"#"+Ve,(je,Ve)=>{var Xe=kR(),ye=$(Xe),Ce=$(ye);j(ye);var C=se(ye,2),M=$(C,!0);j(C),j(Xe),Me(H=>{Ae(Ce,`${u(Ve).fileName??""}${u(Ve).fileType??""}`),Ae(M,H)},[()=>_l(xl(u(Ve).data))]),P(je,Xe)}),j(k),P(He,k)};xe(Ie,He=>{u(b)?He(We):He(Oe,-1)})}j(ke),P(Pe,ke)};xe(ie,Pe=>{u(x)>1&&Pe(Z)})}j(ce);var le=se(ce,2);{var fe=Pe=>{var ke=WR(),Ie=se($(ke),2),We=$(Ie);j(Ie);var Oe=se(Ie,2);Zt(Oe,20,()=>u(S),He=>He,(He,k)=>{var je=GR(),Ve=$(je),Xe=$(Ve,!0);j(Ve),j(je),Me(()=>Ae(Xe,k)),P(He,je)}),j(Oe),yt(2),j(ke),Me(()=>Ae(We,`The following ${u(S).length===1?"path appears":"paths appear"} more than once:`)),P(Pe,ke)};xe(le,Pe=>{u(A)&&Pe(fe)})}var Se=se(le,2);{var ze=Pe=>{var ke=XR(),Ie=$(ke,!0);j(ke),Me(()=>Ae(Ie,u(p))),P(Pe,ke)};xe(Se,Pe=>{u(p)&&Pe(ze)})}var Ue=se(Se,2);{let Pe=O(()=>u(h)||u(A));Bn(Ue,{onclick:D,get disabled(){return u(Pe)},class:"w-full",children:(ke,Ie)=>{yt();var We=Et();Me(()=>Ae(We,u(h)?"Downloading...":`Download ${u(x)===1?"File":`${u(x)} Files`}`)),P(ke,We)},$$slots:{default:!0}})}j(ne),Me(Pe=>{Ae(me,u(x)===1?`${u(g)[0].fileName}${u(g)[0].fileType}`:`${u(x)} files`),Ae(G,Pe)},[()=>_l(u(m))]),P(K,ne)};xe(R,K=>{u(x)===0?K(z):K(Y,-1)})}P(U,N)};let s=Fe(!1),a;const o=O(()=>e.displayName||e.item.displayName||e.item.paramId),l=O(()=>typeof e.value=="object"&&e.value!==null),c=O(()=>e.value==null?"":u(l)?JSON.stringify(e.value,null,2):String(e.value)),d=O(()=>e.value!=null);async function f(){try{await navigator.clipboard.writeText(u(c)),W(s,!0),clearTimeout(a),a=setTimeout(()=>W(s,!1),2e3)}catch(U){console.error("Failed to copy:",U)}}let h=Fe(!1),p=Fe(null);const g=O(()=>e.value?Array.isArray(e.value)?e.value.filter(No):No(e.value)?[e.value]:[]:[]),x=O(()=>u(g).length),m=O(()=>u(g).reduce((U,N)=>U+xl(N.data),0));function v(U){const N=new Fo;for(let R=0;R<U.length;R++){const z=U[R],Y=(z.subFolder||"").split("/").filter(Boolean);let K=N;for(const V of Y){K.has(V)||K.set(V,{type:"folder",name:V,children:new Fo});const ee=K.get(V);ee.type==="folder"&&(K=ee.children)}const ne=`${z.fileName}${z.fileType??""}`,ce=K.has(ne)?`${ne}#${R}`:ne;K.set(ce,{type:"file",file:z})}return N}function y(U,N=""){const R=[];for(const[z,Y]of U)if(Y.type==="folder"){const K=N?`${N}/${z}`:z;R.push(K),R.push(...y(Y.children,K))}return R}const w=O(()=>u(g).some(U=>U.subFolder&&U.subFolder.length>0)),b=O(()=>u(w)?v(u(g)):null);function E(U){const N=(U.subFolder||"").replace(/^\/+|\/+$/g,""),R=`${U.fileName}${U.fileType??""}`;return N?`${N}/${R}`:R}const S=O(()=>{const U={};for(const N of u(g)){const R=E(N);U[R]=(U[R]??0)+1}return Object.entries(U).filter(([,N])=>N>1).map(([N])=>N)}),A=O(()=>u(S).length>0);let _=new na;Pt(()=>{if(u(b)){_.clear();for(const U of y(u(b)))_.add(U)}});function T(U){_.has(U)?_.delete(U):_.add(U)}async function D(){if(u(x)!==0){W(h,!0),W(p,null);try{if(u(x)===1)await gc(u(g)[0],u(g)[0].fileName);else{const U=e.displayName?e.displayName.replace(/[^a-z0-9]/gi,"_").toLowerCase():"download";await gc(u(g),U)}}catch(U){W(p,U instanceof Error?U.message:"Failed to download files",!0),console.error("[OutputDisplayWidget] Download error:",U)}finally{W(h,!1)}}}var L=we(),F=Q(L);{var B=U=>{var N=JR(),R=$(N);t(R);var z=se(R,2);{var Y=ee=>{{let me=O(()=>typeof e.value=="string"?e.value:e.value!=null?JSON.stringify(e.value):"");SR(ee,{get item(){return e.item},get value(){return u(me)}})}},K=ee=>{DR(ee,{get item(){return e.item},get value(){return e.value}})},ne=ee=>{r(ee)},ce=ee=>{var me=YR();Dt(me,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border flex items-center bg-muted/50 wrap-break-word");var ve=$(me);{var G=Z=>{var le=qR(),fe=$(le,!0);j(le),Me(()=>Ae(fe,u(c))),P(Z,le)},ie=Z=>{up(Z)};xe(ve,Z=>{u(d)?Z(G):Z(ie,-1)})}j(me),P(ee,me)},V=ee=>{var me=$R(),ve=$(me);{var G=fe=>{var Se=KR();Dt(Se,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere max-h-96 overflow-auto bg-muted/10 text-foreground");var ze=$(Se,!0);j(Se),Me(()=>Ae(ze,u(c))),P(fe,Se)},ie=fe=>{var Se=ZR();Dt(Se,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere bg-muted/10 wrap-break-word whitespace-pre-wrap text-foreground");var ze=$(Se);{var Ue=ke=>{var Ie=Et();Me(()=>Ae(Ie,e.value)),P(ke,Ie)},Pe=ke=>{up(ke)};xe(ze,ke=>{u(d)?ke(Ue):ke(Pe,-1)})}j(Se),P(fe,Se)};xe(ve,fe=>{u(l)?fe(G):fe(ie,-1)})}var Z=se(ve,2);{var le=fe=>{{let Se=O(()=>u(s)?"opacity-100":"opacity-0 group-hover:opacity-100");Bn(fe,{onclick:f,get class(){return`right-2 top-2 absolute transition-opacity ${u(Se)??""}`},size:"sm",children:(ze,Ue)=>{yt();var Pe=Et();Me(()=>Ae(Pe,u(s)?"Copied!":"Copy")),P(ze,Pe)},$$slots:{default:!0}})}};xe(Z,fe=>{u(d)&&fe(le)})}j(me),P(ee,me)};xe(z,ee=>{e.item.widgetType==="chart"?ee(Y):e.item.widgetType==="image"?ee(K,1):e.item.widgetType==="file"?ee(ne,2):e.item.widgetType==="number"?ee(ce,3):e.item.widgetType==="text"&&ee(V,4)})}j(N),P(U,N)};xe(F,U=>{e.item.widgetType!=="dynamicValueList"&&U(B)})}P(n,L),at()}zi(["click"]);var e3=q('<div class="gap-8 flex flex-col"></div>'),t3=q('<div class="p-4 tab-content-container svelte-jdukda"><!></div>');function n3(n,e){st(e,!0);const t=(f,h=wt,p=wt)=>{const g=O(()=>o(h().paramId));var x=we(),m=Q(x);{var v=y=>{pR(y,{get item(){return h()},get value(){return e.values[u(g).id]},get displayName(){return h().displayName},get onChange(){return e.onValueChange},get disabled(){return p().disabled},get dynamicOptions(){return a()[u(g).id]}})};xe(m,y=>{u(g)&&y(v)})}P(f,x)},i=(f,h=wt)=>{const p=O(()=>l(h().paramId));var g=we(),x=Q(g);{var m=v=>{QR(v,{get item(){return h()},get value(){return e.values[h().paramId]},get displayName(){return h().displayName}})};xe(x,v=>{u(p)&&v(m)})}P(f,g)},r=Si(),s=O(()=>r.messages);let a=oe(e,"dynamicOptions",19,()=>({}));function o(f){return e.inputs.find(h=>h.id===f)}function l(f){return e.outputs.find(h=>h.id===f)}var c=we(),d=Q(c);Ne(d,()=>Lv,(f,h)=>{h(f,{get value(){return e.tab.id},class:"min-h-0 p-0 flex-1",children:(p,g)=>{gg(p,{class:"h-full",orientation:"vertical",children:(x,m)=>{var v=t3(),y=$(v);{var w=E=>{wu(E,{type:"empty",size:"medium",get message(){return u(s).tabNoGroups}})},b=E=>{var S=e3();Zt(S,21,()=>e.tab.groups,A=>A.id,(A,_)=>{var T=we(),D=Q(T);{var L=B=>{{let U=O(()=>u(_).columns??1),N=O(()=>e.collapsedGroups[u(_).id]??!1),R=O(()=>e.tab.groups.length===1);fP(B,{get label(){return u(_).label},get description(){return u(_).description},get items(){return u(_).items},get columns(){return u(U)},get collapsed(){return u(N)},get values(){return e.values},onToggle:()=>e.onToggleGroup(u(_).id),get inputSnippet(){return t},get outputSnippet(){return i},get flat(){return u(R)}})}},F=O(()=>sP(u(_),e.values));xe(D,B=>{u(F)&&B(L)})}P(A,T)}),j(S),P(E,S)};xe(y,E=>{e.tab.groups.length===0?E(w):E(b,-1)})}j(v),P(x,v)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(n,c),at()}function dp(n){return typeof n=="object"&&n!==null&&("targetInputId"in n||"options"in n)}function i3(n){if(dp(n))return n;let e=n;for(let t=0;t<2&&typeof e=="string";t++){try{e=JSON.parse(e)}catch{return null}if(dp(e))return e}return null}function r3(n){const e=new Map;for(const t of Lg(n)){if(t.type!=="output"||t.widgetType!=="dynamicValueList")continue;const i=t;typeof i.paramId=="string"&&e.set(i.paramId,{id:i.paramId,targetInputId:i.config?.targetInputId})}for(const t of n.outputs??[])t.type==="dynamicValueList"&&e.set(t.id,{id:t.id,targetInputId:t.targetInputId});return[...e.values()]}function s3(n,e){const t={};for(const i of r3(n)){const r=i3(e[i.id]);if(!r)continue;const s=r.targetInputId??i.targetInputId;s&&r.options&&typeof r.options=="object"&&(t[s]=r.options)}return t}var a3=q("<!> <!>",1);function o3(n,e){st(e,!0);let t=oe(e,"requestedTabId",3,null),i=Fe(""),r=Ps({});const s=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(h=>e.panelFilter?e.panelFilter==="right"?h.position==="right":h.position!=="right":!0):[]),a=O(()=>u(s).length>1),o=O(()=>s3(e.schema,e.values));Pt(()=>{t()&&u(s).some(h=>h.id===t())?W(i,t()):u(s).length>0&&!u(i)&&W(i,u(s)[0].id,!0)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};e.schema.layout.tabs.forEach(p=>p.groups.forEach(g=>{g.id in r||(h[g.id]=g.collapsed??!1)})),Object.keys(h).length>0&&Object.assign(r,h)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};u(s).forEach(p=>p.groups.forEach(g=>{const x=Rg(g.items,e.values);g.items.forEach(m=>{if(m.type==="linebreak")return;const{visible:v,disabled:y,defaultValue:w}=x[Qo(m)],b=e.schema.inputs.find(E=>E.id===m.paramId);!b||w===void 0||(!v||y)&&e.values[b.id]!==w&&(h[b.id]=w)})})),Object.keys(h).length>0&&Object.assign(e.values,h)});function l(h){r[h]=!r[h]}function c(h){W(i,h,!0)}var d=we(),f=Q(d);Ne(f,()=>vs,(h,p)=>{p(h,{class:"pt-1 min-h-0 mx-1 flex flex-1 flex-col overflow-hidden",children:(g,x)=>{var m=we(),v=Q(m);Ne(v,()=>Iv,(y,w)=>{w(y,{get value(){return u(i)},class:"gap-0 min-h-0 flex flex-1 flex-col",children:(b,E)=>{var S=a3(),A=Q(S);{var _=D=>{JC(D,{get tabs(){return u(s)},onTabChange:c})};xe(A,D=>{u(a)&&D(_)})}var T=se(A,2);Zt(T,17,()=>u(s),D=>D.id,(D,L)=>{n3(D,{get tab(){return u(L)},get values(){return e.values},get collapsedGroups(){return r},onToggleGroup:l,get onValueChange(){return e.onValueChange},get inputs(){return e.schema.inputs},get outputs(){return e.schema.outputs},get dynamicOptions(){return u(o)}})}),P(b,S)},$$slots:{default:!0}})}),P(g,m)},$$slots:{default:!0}})}),P(n,d),at()}var l3=q('<span class="text-xs font-semibold"> </span>'),c3=q('<span class="text-xs font-semibold"> </span>'),u3=q('<button type="button"><!></button>'),d3=q('<div role="button" tabindex="0"></div>');function hp(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages),r=O(()=>["gap-1 py-2 lg:py-3 lg:flex-col lg:w-auto px-2 lg:px-0","flex w-full shrink-0 flex-row items-center","backdrop-blur-sm bg-background/90 cursor-pointer"].join(" ")),s="w-8 h-8 rounded cursor-pointer flex shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground";var a=d3();Zt(a,21,()=>e.tabs,o=>o.id,(o,l)=>{var c=u3();Dt(c,1,Uo(s));var d=$(c);{var f=p=>{var g=we(),x=Q(g);{var m=w=>{Cg(w,{get icon(){return u(l).icon},class:"h-4 w-4"})},v=O(()=>u(l).icon.includes(":")),y=w=>{var b=l3(),E=$(b,!0);j(b),Me(()=>Ae(E,u(l).icon)),P(w,b)};xe(x,w=>{u(v)?w(m):w(y,-1)})}P(p,g)},h=p=>{var g=c3(),x=$(g,!0);j(g),Me(m=>Ae(x,m),[()=>u(l).label[0]?.toUpperCase()??"?"]),P(p,g)};xe(d,p=>{u(l).icon?p(f):p(h,-1)})}j(c),Me(()=>{Qt(c,"title",u(l).label),Qt(c,"aria-label",u(l).label)}),Xt("click",c,p=>{p.stopPropagation(),e.onTabClick(u(l).id)}),P(o,c)}),j(a),Me(o=>{Dt(a,1,Uo(u(r)),"svelte-17r9ylq"),Ii(a,`--collapsed-w: ${e.collapsedWidth??""}px;`),Qt(a,"aria-label",o)},[()=>u(i).expandSidePanel.replace("{side}",e.side==="left"?u(i).panelSideLeft:u(i).panelSideRight)]),Xt("click",a,function(...o){e.onExpand?.apply(this,o)}),Xt("keydown",a,o=>(o.key==="Enter"||o.key===" ")&&e.onExpand()),P(n,a),at()}zi(["click","keydown"]);function h3(n,e,t){const i=[];for(const r of Dg(n))for(const s of r.items??[]){if(s.type!=="input")continue;const a=e[s.paramId],o=n.inputs.find(l=>l.id===s.paramId);a!==void 0&&o&&i.push({paramId:s.paramId,nickname:o.nickname,displayName:s.displayName||o.nickname,paramType:o.paramType,value:a,groupName:r.label})}return{id:Xv(),name:t.name,description:t.description,timestamp:new Date().toISOString(),schemaId:n.id,documentId:n.documentId??"",projectFileName:n.projectFileName??"",pluginVersion:n.pluginVersion??"",author:t.author,tags:t.tags??[],parameters:i}}function f3(n,e){const t=[];n.documentId!==(e.documentId??"")&&t.push({paramId:"__document__",severity:"error",message:"Document ID mismatch - this state was saved for a different document",details:{expected:e.documentId??"",actual:n.documentId}}),n.schemaId!==e.id&&t.push({paramId:"__schema__",severity:"warning",message:"Schema has changed since this state was saved",details:{expected:e.id,actual:n.schemaId}});for(const r of n.parameters){const s=e.inputs.find(a=>a.id===r.paramId);if(!s){t.push({paramId:r.paramId,severity:"error",message:`Parameter "${r.nickname}" no longer exists in the schema`});continue}s.nickname!==r.nickname&&t.push({paramId:r.paramId,severity:"warning",message:"Parameter nickname changed",details:{expected:r.nickname,actual:s.nickname}})}const i=t.some(r=>r.severity==="error");return{isValid:t.length===0,issues:t,canLoad:!i}}function p3(n,e){const t={};for(const i of n.parameters)e.inputs.some(s=>s.id===i.paramId)&&(t[i.paramId]=i.value);return t}function m3(n,e){const t=f3(n,e);return{values:p3(n,e),issues:t.issues,isValid:t.isValid,canLoad:t.canLoad}}function g3(n){const e=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),t=n.name.replace(/[^a-z0-9]/gi,"_"),i=n.timestamp.split("T")[0].replace(/-/g,"_"),r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=`${t}_${i}.sps`,r.click(),URL.revokeObjectURL(r.href)}async function v3(n){const e=JSON.parse(await n.text());if(!e.id||!e.name||!e.documentId||!e.parameters)throw new Error("Invalid saved state file format");return e}const _3={saveButton:"Save State",loadButton:"Load State",saveDialogTitle:"Save Parameter State",saveDialogDescription:"Save the current parameter values as a .sps file",saveNameLabel:"State Name *",saveNamePlaceholder:"e.g., Design Option A",saveDescriptionLabel:"Description",saveDescriptionPlaceholder:"Optional description of this state",saveAuthorLabel:"Author",saveAuthorPlaceholder:"Your name or email",saveTagsLabel:"Tags",saveTagsPlaceholder:"facade, option-a, client-approved (comma-separated)",saveNameRequired:"Please enter a name for this state",loadDialogTitle:"Load Parameter State",loadDialogDescription:"Select a .sps state file from your drive to load",loadFromFileButton:"Select .sps File",loadEmptyList:"No saved states found",loadImportError:"Failed to import state: ",validationTitle:"State Validation Report",validationValidatingPrefix:"Validating state: ",validationNoIssuesTitle:"No Issues Found",validationNoIssuesBody:"This state can be loaded safely.",validationWarningsTitle:"Warnings Detected",validationWarningsBody:"{count} warning(s) found, but state can still be loaded.",validationErrorsTitle:"Critical Errors",validationErrorsBody:"Cannot load this state due to critical incompatibilities.",validationIssuesHeading:"Issues:",validationExpected:"Expected:",validationActual:"Actual:",cancelButton:"Cancel",loadAnywayButton:"Load Anyway"};var x3=q("<!> ",1),b3=q("<!> ",1),y3=q("<!> ",1),S3=q("<!> <!>",1),M3=q("<!> <!>",1),w3=q('<!> <div class="gap-4 py-4 grid"><div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div></div> <!>',1),E3=q("<!> <!>",1),T3=q('<p class="text-sm py-8 text-center text-muted-foreground">…</p>'),A3=q('<p class="text-sm py-8 text-center text-destructive"> </p>'),C3=q('<p class="text-sm py-8 text-center text-muted-foreground"> </p>'),P3=q('<div class="text-xs mt-0.5 text-muted-foreground"> </div>'),R3=q('<button type="button" class="p-3 w-full rounded-lg border text-left transition-colors hover:bg-muted"><div class="text-sm font-medium"> </div> <!> <div class="text-xs mt-1 text-muted-foreground"> </div></button>'),D3=q('<div class="space-y-2"></div>'),L3=q('<div class="py-4 max-h-[60vh] overflow-y-auto"><!></div>'),I3=q("<!> ",1),N3=q('<div class="py-8"><!></div>'),U3=q("<!> <!> <!>",1),F3=q("<!> <!>",1),O3=q('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-success-foreground"> </h4> <p class="text-sm mt-1 text-success-foreground/80"> </p></div></div>'),z3=q('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-warning-foreground"> </h4> <p class="text-sm mt-1 text-warning-foreground/80"> </p></div></div>'),B3=q('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-destructive"> </h4> <p class="text-sm mt-1 text-destructive/80"> </p></div></div>'),k3=q('<p class="text-xs mt-1 text-muted-foreground"> </p>'),V3=q('<div><div class="gap-2 flex items-start"><!> <div class="flex-1"><p class="text-sm font-medium"> </p> <!></div></div></div>'),H3=q('<div class="space-y-2"><h4 class="text-sm font-medium"> </h4> <!></div>'),G3=q('<div class="gap-4 py-4 grid"><!> <!></div>'),W3=q("<!> <!>",1),X3=q("<!> <!> <!>",1),j3=q('<!> <!> <!> <input type="file" accept=".sps" class="hidden"/> <!> <!> <!>',1);function q3(n,e){st(e,!0);let t=oe(e,"showSaveButton",3,!0),i=oe(e,"showLoadButton",3,!0),r=oe(e,"actions",19,()=>[]);const s=O(()=>({..._3,...e.labels}));let a=Fe(!1),o=Fe(""),l=Fe(""),c=Fe(""),d=Fe(""),f=Fe(!1),h=Fe(!1),p=Fe(null),g=Fe(""),x=Fe(null),m=Fe(Ps([])),v=Fe(!1),y=Fe("");function w(){W(o,`State ${new Date().toLocaleDateString()}`),W(l,""),W(c,e.schema.author||"",!0),W(d,""),W(a,!0)}async function b(){if(!u(o).trim()){alert(u(s).saveNameRequired);return}const V=h3(e.schema,e.currentValues,{name:u(o).trim(),description:u(l).trim()||void 0,author:u(c).trim()||void 0,tags:u(d).split(",").map(ee=>ee.trim()).filter(ee=>ee.length>0)});e.onSaveState?await e.onSaveState(V):g3(V),W(a,!1)}function E(V){const ee=m3(V,e.schema);ee.isValid?e.onLoadValues(ee.values):(W(p,ee,!0),W(g,V.name,!0),W(f,!0))}async function S(V){const ee=V.target;if(!(!ee.files||ee.files.length===0)){try{const me=await v3(ee.files[0]);E(me)}catch(me){alert(u(s).loadImportError+me.message)}ee.value=""}}function A(){!u(p)||!u(p).canLoad||(e.onLoadValues(u(p).values),W(f,!1),W(p,null))}function _(){W(f,!1),W(p,null)}async function T(){if(W(h,!0),!!e.onListStates){W(v,!0),W(y,""),W(m,[],!0);try{W(m,await e.onListStates(),!0)}catch(V){W(y,V.message,!0)}finally{W(v,!1)}}}function D(){u(x)?.click(),W(h,!1)}function L(V){E(V),W(h,!1)}var F=j3(),B=Q(F);{var U=V=>{Bn(V,{variant:"default",size:"sm",onclick:w,children:(ee,me)=>{var ve=x3(),G=Q(ve);zp(G,{class:"mr-2 h-4 w-4"});var ie=se(G);Me(()=>Ae(ie,` ${u(s).saveButton??""}`)),P(ee,ve)},$$slots:{default:!0}})};xe(B,V=>{t()&&V(U)})}var N=se(B,2);{var R=V=>{Bn(V,{variant:"outline",size:"sm",onclick:T,children:(ee,me)=>{var ve=b3(),G=Q(ve);oh(G,{class:"mr-2 h-4 w-4"});var ie=se(G);Me(()=>Ae(ie,` ${u(s).loadButton??""}`)),P(ee,ve)},$$slots:{default:!0}})};xe(N,V=>{i()&&V(R)})}var z=se(N,2);Zt(z,17,r,V=>V.id,(V,ee)=>{{let me=O(()=>u(ee).variant??"outline"),ve=O(()=>u(ee).size??"sm");Bn(V,{get variant(){return u(me)},get size(){return u(ve)},get onclick(){return u(ee).onclick},children:(G,ie)=>{var Z=y3(),le=Q(Z);{var fe=ze=>{const Ue=O(()=>u(ee).icon);var Pe=we(),ke=Q(Pe);Ne(ke,()=>u(Ue),(Ie,We)=>{We(Ie,{class:"mr-2 h-4 w-4"})}),P(ze,Pe)};xe(le,ze=>{u(ee).icon&&ze(fe)})}var Se=se(le);Me(()=>Ae(Se,` ${u(ee).label??""}`)),P(G,Z)},$$slots:{default:!0}})}});var Y=se(z,2);ui(Y,V=>W(x,V),()=>u(x));var K=se(Y,2);Ne(K,()=>wr,(V,ee)=>{ee(V,{get open(){return u(a)},set open(me){W(a,me,!0)},children:(me,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,le)=>{le(Z,{children:(fe,Se)=>{var ze=w3(),Ue=Q(ze);Ne(Ue,()=>ms,(H,re)=>{re(H,{children:(ue,be)=>{var ge=S3(),ae=Q(ge);Ne(ae,()=>dr,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogTitle)),P(Ee,et)},$$slots:{default:!0}})});var he=se(ae,2);Ne(he,()=>gs,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogDescription)),P(Ee,et)},$$slots:{default:!0}})}),P(ue,ge)},$$slots:{default:!0}})});var Pe=se(Ue,2),ke=$(Pe),Ie=$(ke);or(Ie,{for:"export-name",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveNameLabel)),P(H,ue)},$$slots:{default:!0}});var We=se(Ie,2);_s(We,{id:"export-name",get placeholder(){return u(s).saveNamePlaceholder},get value(){return u(o)},set value(H){W(o,H,!0)}}),j(ke);var Oe=se(ke,2),He=$(Oe);or(He,{for:"export-description",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveDescriptionLabel)),P(H,ue)},$$slots:{default:!0}});var k=se(He,2);Nv(k,{id:"export-description",get placeholder(){return u(s).saveDescriptionPlaceholder},rows:3,get value(){return u(l)},set value(H){W(l,H,!0)}}),j(Oe);var je=se(Oe,2),Ve=$(je);or(Ve,{for:"export-author",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveAuthorLabel)),P(H,ue)},$$slots:{default:!0}});var Xe=se(Ve,2);_s(Xe,{id:"export-author",get placeholder(){return u(s).saveAuthorPlaceholder},get value(){return u(c)},set value(H){W(c,H,!0)}}),j(je);var ye=se(je,2),Ce=$(ye);or(Ce,{for:"export-tags",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveTagsLabel)),P(H,ue)},$$slots:{default:!0}});var C=se(Ce,2);_s(C,{id:"export-tags",get placeholder(){return u(s).saveTagsPlaceholder},get value(){return u(d)},set value(H){W(d,H,!0)}}),j(ye),j(Pe);var M=se(Pe,2);Ne(M,()=>yl,(H,re)=>{re(H,{children:(ue,be)=>{var ge=M3(),ae=Q(ge);Bn(ae,{variant:"outline",onclick:()=>W(a,!1),children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).cancelButton)),P(Re,Ee)},$$slots:{default:!0}});var he=se(ae,2);Bn(he,{onclick:b,children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).saveButton)),P(Re,Ee)},$$slots:{default:!0}}),P(ue,ge)},$$slots:{default:!0}})}),P(fe,ze)},$$slots:{default:!0}})}),P(me,G)},$$slots:{default:!0}})});var ne=se(K,2);Ne(ne,()=>wr,(V,ee)=>{ee(V,{get open(){return u(h)},set open(me){W(h,me,!0)},children:(me,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,le)=>{le(Z,{children:(fe,Se)=>{var ze=U3(),Ue=Q(ze);Ne(Ue,()=>ms,(Oe,He)=>{He(Oe,{children:(k,je)=>{var Ve=E3(),Xe=Q(Ve);Ne(Xe,()=>dr,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogTitle)),P(M,re)},$$slots:{default:!0}})});var ye=se(Xe,2);Ne(ye,()=>gs,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogDescription)),P(M,re)},$$slots:{default:!0}})}),P(k,Ve)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=Oe=>{var He=L3(),k=$(He);{var je=Ce=>{var C=T3();P(Ce,C)},Ve=Ce=>{var C=A3(),M=$(C,!0);j(C),Me(()=>Ae(M,u(y))),P(Ce,C)},Xe=Ce=>{var C=C3(),M=$(C,!0);j(C),Me(()=>Ae(M,u(s).loadEmptyList)),P(Ce,C)},ye=Ce=>{var C=D3();Zt(C,21,()=>u(m),M=>M.id,(M,H)=>{var re=R3(),ue=$(re),be=$(ue,!0);j(ue);var ge=se(ue,2);{var ae=Le=>{var Ee=P3(),De=$(Ee,!0);j(Ee),Me(()=>Ae(De,u(H).description)),P(Le,Ee)};xe(ge,Le=>{u(H).description&&Le(ae)})}var he=se(ge,2),Re=$(he,!0);j(he),j(re),Me(Le=>{Ae(be,u(H).name),Ae(Re,Le)},[()=>new Date(u(H).timestamp).toLocaleString()]),Xt("click",re,()=>L(u(H))),P(M,re)}),j(C),P(Ce,C)};xe(k,Ce=>{u(v)?Ce(je):u(y)?Ce(Ve,1):u(m).length===0?Ce(Xe,2):Ce(ye,-1)})}j(He),P(Oe,He)},Ie=Oe=>{var He=N3(),k=$(He);Bn(k,{onclick:D,class:"w-full",size:"lg",children:(je,Ve)=>{var Xe=I3(),ye=Q(Xe);oh(ye,{class:"mr-2 h-4 w-4"});var Ce=se(ye);Me(()=>Ae(Ce,` ${u(s).loadFromFileButton??""}`)),P(je,Xe)},$$slots:{default:!0}}),j(He),P(Oe,He)};xe(Pe,Oe=>{e.onListStates?Oe(ke):Oe(Ie,-1)})}var We=se(Pe,2);Ne(We,()=>yl,(Oe,He)=>{He(Oe,{children:(k,je)=>{Bn(k,{variant:"outline",onclick:()=>W(h,!1),children:(Ve,Xe)=>{yt();var ye=Et();Me(()=>Ae(ye,u(s).cancelButton)),P(Ve,ye)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(fe,ze)},$$slots:{default:!0}})}),P(me,G)},$$slots:{default:!0}})});var ce=se(ne,2);Ne(ce,()=>wr,(V,ee)=>{ee(V,{get open(){return u(f)},set open(me){W(f,me,!0)},children:(me,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,le)=>{le(Z,{class:"max-w-2xl max-h-[80vh] overflow-y-auto",children:(fe,Se)=>{var ze=X3(),Ue=Q(ze);Ne(Ue,()=>ms,(We,Oe)=>{Oe(We,{children:(He,k)=>{var je=F3(),Ve=Q(je);Ne(Ve,()=>dr,(ye,Ce)=>{Ce(ye,{children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).validationTitle)),P(C,H)},$$slots:{default:!0}})});var Xe=se(Ve,2);Ne(Xe,()=>gs,(ye,Ce)=>{Ce(ye,{children:(C,M)=>{var H=we(),re=Q(H);{var ue=be=>{var ge=Et();Me(()=>Ae(ge,`${u(s).validationValidatingPrefix??""}${u(g)??""}`)),P(be,ge)};xe(re,be=>{u(g)&&be(ue)})}P(C,H)},$$slots:{default:!0}})}),P(He,je)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=We=>{var Oe=G3(),He=$(Oe);{var k=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-success/30 bg-success/5",children:(ue,be)=>{var ge=O3(),ae=$(ge);$v(ae,{class:"h-5 w-5 text-success"});var he=se(ae,2),Re=$(he),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(he),j(ge),Me(()=>{Ae(Le,u(s).validationNoIssuesTitle),Ae(De,u(s).validationNoIssuesBody)}),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)},je=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-warning/30 bg-warning/5",children:(ue,be)=>{var ge=z3(),ae=$(ge);yo(ae,{class:"h-5 w-5 text-warning"});var he=se(ae,2),Re=$(he),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(he),j(ge),Me(et=>{Ae(Le,u(s).validationWarningsTitle),Ae(De,et)},[()=>u(s).validationWarningsBody.replace("{count}",String(u(p).issues.length))]),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)},Ve=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-destructive/30 bg-destructive/5",children:(ue,be)=>{var ge=B3(),ae=$(ge);yo(ae,{class:"h-5 w-5 text-destructive"});var he=se(ae,2),Re=$(he),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(he),j(ge),Me(()=>{Ae(Le,u(s).validationErrorsTitle),Ae(De,u(s).validationErrorsBody)}),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)};xe(He,Ce=>{u(p).isValid?Ce(k):u(p).canLoad?Ce(je,1):Ce(Ve,-1)})}var Xe=se(He,2);{var ye=Ce=>{var C=H3(),M=$(C),H=$(M,!0);j(M);var re=se(M,2);Zt(re,17,()=>u(p).issues,ue=>ue.message,(ue,be)=>{var ge=V3(),ae=$(ge),he=$(ae);{let Ye=O(()=>u(be).severity==="error"?"text-destructive":"text-warning");yo(he,{get class(){return`h-4 w-4 mt-0.5 ${u(Ye)??""}`}})}var Re=se(he,2),Le=$(Re),Ee=$(Le,!0);j(Le);var De=se(Le,2);{var et=Ye=>{var ht=k3(),J=$(ht);j(ht),Me(()=>Ae(J,`${u(s).validationExpected??""}
|
|
5018
|
+
${u(d)??""}`},children:(f,h)=>{var p=we(),m=Q(p);{var x=w=>{var b=U2(),E=Q(b);Uu(E,{class:"h-4 w-4 animate-spin"});var S=se(E);Me(()=>Ae(S,` ${u(i).solvingEllipsis??""}`)),P(w,b)},g=w=>{var b=F2(),E=Q(b);Cv(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).pressToCalculate??""}`)),P(w,b)},v=w=>{var b=O2(),E=Q(b);l0(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).calculate??""}`)),P(w,b)},y=w=>{var b=z2(),E=Q(b);ia(E,{class:"h-4 w-4"});var S=se(E);Me(()=>Ae(S,` ${u(i).upToDate??""}`)),P(w,b)};xe(m,w=>{e.isSolving?w(x):r()?w(g,1):e.hasPendingChanges?w(v,2):w(y,-1)})}P(f,p)},$$slots:{default:!0}})}j(s),P(n,s),at()}var k2=K('<div class="bottom-6 left-6 gap-3 px-5 py-3 shadow-xl fixed z-50 flex animate-[selva-slideInLeft_0.2s_ease-out] items-center rounded-lg border border-primary/20 bg-primary text-primary-foreground svelte-g866ul"><div class="h-5 w-5 relative flex shrink-0 items-center justify-center svelte-g866ul"><div class="animate-ping absolute h-full w-full rounded-full bg-primary-foreground opacity-30 svelte-g866ul"></div> <div class="h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent svelte-g866ul"></div></div> <div class="leading-tight flex flex-col svelte-g866ul"><span class="text-sm font-semibold svelte-g866ul"> </span> <span class="text-xs opacity-70 svelte-g866ul"> </span></div></div>');function V2(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages);var r=we(),s=Q(r);{var a=o=>{var l=k2(),c=se($(l),2),d=$(c),f=$(d,!0);j(d);var h=se(d,2),p=$(h,!0);j(h),j(c),j(l),Me(()=>{Ae(f,u(i).solving),Ae(p,u(i).solvingSubtitle)}),P(o,l)};xe(s,o=>{e.show&&o(a)})}P(n,r),at()}var H2=K("<div><!></div>");function G2(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);var r=H2();Ft(r,a=>({"data-slot":"card-action",class:a,...i}),[()=>ci("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e.class)]);var s=$(r);pt(s,()=>e.children??wt),j(r),ui(r,a=>t(a),()=>t()),P(n,r),at()}var W2=K("<!> <!>",1);function Kf(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=we(),a=Q(s);{let o=O(()=>ci("flex touch-none p-px transition-colors select-none",i()==="vertical"&&"w-2.5 h-full border-s border-s-transparent",i()==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e.class));Ne(a,()=>q0,(l,c)=>{c(l,mt({"data-slot":"scroll-area-scrollbar",get orientation(){return i()},get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)},children:(d,f)=>{var h=W2(),p=Q(h);pt(p,()=>e.children??wt);var m=se(p,2);Ne(m,()=>Z0,(x,g)=>{g(x,{"data-slot":"scroll-area-thumb",class:"relative flex-1 rounded-full bg-border"})}),P(d,h)},$$slots:{default:!0}}))})}P(n,s),at()}var X2=K("<!> <!> <!> <!>",1);function gg(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"viewportRef",15,null),r=oe(e,"orientation",3,"vertical"),s=oe(e,"scrollbarXClasses",3,""),a=oe(e,"scrollbarYClasses",3,""),o=ut(e,["$$slots","$$events","$$legacy","ref","viewportRef","class","orientation","scrollbarXClasses","scrollbarYClasses","children"]);var l=we(),c=Q(l);{let d=O(()=>ci("relative",e.class));Ne(c,()=>z0,(f,h)=>{h(f,mt({"data-slot":"scroll-area",get class(){return u(d)}},()=>o,{get ref(){return t()},set ref(p){t(p)},children:(p,m)=>{var x=X2(),g=Q(x);Ne(g,()=>k0,(S,A)=>{A(S,{"data-slot":"scroll-area-viewport",class:"size-full rounded-[inherit] ring-ring/10 outline-ring/50 transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 dark:ring-ring/20 dark:outline-ring/40",get ref(){return i()},set ref(_){i(_)},children:(_,T)=>{var D=we(),L=Q(D);pt(L,()=>e.children??wt),P(_,D)},$$slots:{default:!0}})});var v=se(g,2);{var y=S=>{Kf(S,{orientation:"vertical",get class(){return a()}})};xe(v,S=>{(r()==="vertical"||r()==="both")&&S(y)})}var w=se(v,2);{var b=S=>{Kf(S,{orientation:"horizontal",get class(){return s()}})};xe(w,S=>{(r()==="horizontal"||r()==="both")&&S(b)})}var E=se(w,2);Ne(E,()=>Q0,(S,A)=>{A(S,{})}),P(p,x)},$$slots:{default:!0}}))})}P(n,l),at()}const vg=/^[a-z0-9]+(-[a-z0-9]+)*$/,ml=(n,e,t,i="")=>{const r=n.split(":");if(n.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;i=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),l=r.pop(),c={provider:r.length>0?r[0]:i,prefix:l,name:o};return e&&!Lo(c)?null:c}const s=r[0],a=s.split("-");if(a.length>1){const o={provider:i,prefix:a.shift(),name:a.join("-")};return e&&!Lo(o)?null:o}if(t&&i===""){const o={provider:i,prefix:"",name:s};return e&&!Lo(o,t)?null:o}return null},Lo=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;function j2(n,e){const t=n.icons,i=n.aliases||Object.create(null),r=Object.create(null);function s(a){if(t[a])return r[a]=[];if(!(a in r)){r[a]=null;const o=i[a]&&i[a].parent,l=o&&s(o);l&&(r[a]=[o].concat(l))}return r[a]}return Object.keys(t).concat(Object.keys(i)).forEach(s),r}const _g=Object.freeze({left:0,top:0,width:16,height:16}),Jo=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),gl=Object.freeze({..._g,...Jo}),bu=Object.freeze({...gl,body:"",hidden:!1});function q2(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Zf(n,e){const t=q2(n,e);for(const i in bu)i in Jo?i in n&&!(i in t)&&(t[i]=Jo[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function Y2(n,e,t){const i=n.icons,r=n.aliases||Object.create(null);let s={};function a(o){s=Zf(i[o]||r[o],s)}return a(e),t.forEach(a),Zf(n,s)}function xg(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(r=>{e(r,null),t.push(r)});const i=j2(n);for(const r in i){const s=i[r];s&&(e(r,Y2(n,r,s)),t.push(r))}return t}const K2={provider:"",aliases:{},not_found:{},..._g};function hc(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function bg(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!hc(n,K2))return null;const t=e.icons;for(const r in t){const s=t[r];if(!r||typeof s.body!="string"||!hc(s,bu))return null}const i=e.aliases||Object.create(null);for(const r in i){const s=i[r],a=s.parent;if(!r||typeof a!="string"||!t[a]&&!i[a]||!hc(s,bu))return null}return e}const $f=Object.create(null);function Z2(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Cs(n,e){const t=$f[n]||($f[n]=Object.create(null));return t[e]||(t[e]=Z2(n,e))}function yg(n,e){return bg(e)?xg(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function $2(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}let pa=!1;function Sg(n){return typeof n=="boolean"&&(pa=n),pa}function J2(n){const e=typeof n=="string"?ml(n,!0,pa):n;if(e){const t=Cs(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Q2(n,e){const t=ml(n,!0,pa);if(!t)return!1;const i=Cs(t.provider,t.prefix);return e?$2(i,t.name,e):(i.missing.add(t.name),!0)}function eC(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),pa&&!e&&!n.prefix){let i=!1;return bg(n)&&(n.prefix="",xg(n,(r,s)=>{Q2(r,s)&&(i=!0)})),i}const t=n.prefix;return Lo({prefix:t,name:"a"})?!!yg(Cs(e,t),n):!1}const Mg=Object.freeze({width:null,height:null}),wg=Object.freeze({...Mg,...Jo}),tC=/(-?[0-9.]*[0-9]+[0-9.]*)/g,nC=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Jf(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(tC);if(i===null||!i.length)return n;const r=[];let s=i.shift(),a=nC.test(s);for(;;){if(a){const o=parseFloat(s);isNaN(o)?r.push(s):r.push(Math.ceil(o*e*t)/t)}else r.push(s);if(s=i.shift(),s===void 0)return r.join("");a=!a}}function iC(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const r=n.indexOf(">",i),s=n.indexOf("</"+e);if(r===-1||s===-1)break;const a=n.indexOf(">",s);if(a===-1)break;t+=n.slice(r+1,s).trim(),n=n.slice(0,i).trim()+n.slice(a+1)}return{defs:t,content:n}}function rC(n,e){return n?"<defs>"+n+"</defs>"+e:e}function sC(n,e,t){const i=iC(n);return rC(i.defs,e+i.content+t)}const aC=n=>n==="unset"||n==="undefined"||n==="none";function oC(n,e){const t={...gl,...n},i={...wg,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let s=t.body;[t,i].forEach(x=>{const g=[],v=x.hFlip,y=x.vFlip;let w=x.rotate;v?y?w+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):y&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let b;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:b=r.height/2+r.top,g.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:b=r.width/2+r.left,g.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}w%2===1&&(r.left!==r.top&&(b=r.left,r.left=r.top,r.top=b),r.width!==r.height&&(b=r.width,r.width=r.height,r.height=b)),g.length&&(s=sC(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const a=i.width,o=i.height,l=r.width,c=r.height;let d,f;a===null?(f=o===null?"1em":o==="auto"?c:o,d=Jf(f,l/c)):(d=a==="auto"?l:a,f=o===null?Jf(d,c/l):o==="auto"?c:o);const h={},p=(x,g)=>{aC(g)||(h[x]=g.toString())};p("width",d),p("height",f);const m=[r.left,r.top,l,c];return h.viewBox=m.join(" "),{attributes:h,viewBox:m,body:s}}const lC=/\sid="(\S+)"/g,Qf=new Map;function cC(n){n=n.replace(/[0-9]+$/,"")||"a";const e=Qf.get(n)||0;return Qf.set(n,e+1),e?`${n}${e}`:n}function uC(n){const e=[];let t;for(;t=lC.exec(n);)e.push(t[1]);if(!e.length)return n;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(r=>{const s=cC(r),a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),n=n.replace(new RegExp(i,"g"),""),n}const yu=Object.create(null);function dC(n,e){yu[n]=e}function Su(n){return yu[n]||yu[""]}function jd(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const qd=Object.create(null),Ks=["https://api.simplesvg.com","https://api.unisvg.com"],Io=[];for(;Ks.length>0;)Ks.length===1||Math.random()>.5?Io.push(Ks.shift()):Io.push(Ks.pop());qd[""]=jd({resources:["https://api.iconify.design"].concat(Io)});function hC(n,e){const t=jd(e);return t===null?!1:(qd[n]=t,!0)}function Yd(n){return qd[n]}const fC=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let ep=fC();function pC(n,e){const t=Yd(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let r=0;t.resources.forEach(a=>{r=Math.max(r,a.length)});const s=e+".json?icons=";i=t.maxURL-r-t.path.length-s.length}return i}function mC(n){return n===404}const gC=(n,e,t)=>{const i=[],r=pC(n,e),s="icons";let a={type:s,provider:n,prefix:e,icons:[]},o=0;return t.forEach((l,c)=>{o+=l.length+1,o>=r&&c>0&&(i.push(a),a={type:s,provider:n,prefix:e,icons:[]},o=l.length),a.icons.push(l)}),i.push(a),i};function vC(n){if(typeof n=="string"){const e=Yd(n);if(e)return e.path}return"/"}const _C=(n,e,t)=>{if(!ep){t("abort",424);return}let i=vC(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),o=new URLSearchParams({icons:a});i+=s+".json?"+o.toString();break}case"custom":{const s=e.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:t("abort",400);return}let r=503;ep(n+i).then(s=>{const a=s.status;if(a!==200){setTimeout(()=>{t(mC(a)?"abort":"next",a)});return}return r=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?t("abort",s):t("next",r)});return}setTimeout(()=>{t("success",s)})}).catch(()=>{t("next",r)})},xC={prepare:gC,send:_C};function Eg(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(r=>r.id!==e))})}function bC(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,r=n.prefix;e.forEach(s=>{const a=s.icons,o=a.pending.length;a.pending=a.pending.filter(l=>{if(l.prefix!==r)return!0;const c=l.name;if(n.icons[c])a.loaded.push({provider:i,prefix:r,name:c});else if(n.missing.has(c))a.missing.push({provider:i,prefix:r,name:c});else return t=!0,!0;return!1}),a.pending.length!==o&&(t||Eg([n],s.id),s.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),s.abort))})}))}let yC=0;function SC(n,e,t){const i=yC++,r=Eg.bind(null,t,i);if(!e.pending.length)return r;const s={id:i,icons:e,callback:n,abort:r};return t.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(s)}),r}function MC(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((r,s)=>r.provider!==s.provider?r.provider.localeCompare(s.provider):r.prefix!==s.prefix?r.prefix.localeCompare(s.prefix):r.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return n.forEach(r=>{if(i.name===r.name&&i.prefix===r.prefix&&i.provider===r.provider)return;i=r;const s=r.provider,a=r.prefix,o=r.name,l=t[s]||(t[s]=Object.create(null)),c=l[a]||(l[a]=Cs(s,a));let d;o in c.icons?d=e.loaded:a===""||c.missing.has(o)?d=e.missing:d=e.pending;const f={provider:s,prefix:a,name:o};d.push(f)}),e}function wC(n,e=!0,t=!1){const i=[];return n.forEach(r=>{const s=typeof r=="string"?ml(r,e,t):r;s&&i.push(s)}),i}const EC={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function TC(n,e,t,i){const r=n.resources.length,s=n.random?Math.floor(Math.random()*r):n.index;let a;if(n.random){let S=n.resources.slice(0);for(a=[];S.length>1;){const A=Math.floor(Math.random()*S.length);a.push(S[A]),S=S.slice(0,A).concat(S.slice(A+1))}a=a.concat(S)}else a=n.resources.slice(s).concat(n.resources.slice(0,s));const o=Date.now();let l="pending",c=0,d,f=null,h=[],p=[];typeof i=="function"&&p.push(i);function m(){f&&(clearTimeout(f),f=null)}function x(){l==="pending"&&(l="aborted"),m(),h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function g(S,A){A&&(p=[]),typeof S=="function"&&p.push(S)}function v(){return{startTime:o,payload:e,status:l,queriesSent:c,queriesPending:h.length,subscribe:g,abort:x}}function y(){l="failed",p.forEach(S=>{S(void 0,d)})}function w(){h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function b(S,A,_){const T=A!=="success";switch(h=h.filter(D=>D!==S),l){case"pending":break;case"failed":if(T||!n.dataAfterTimeout)return;break;default:return}if(A==="abort"){d=_,y();return}if(T){d=_,h.length||(a.length?E():y());return}if(m(),w(),!n.random){const D=n.resources.indexOf(S.resource);D!==-1&&D!==n.index&&(n.index=D)}l="completed",p.forEach(D=>{D(_)})}function E(){if(l!=="pending")return;m();const S=a.shift();if(S===void 0){if(h.length){f=setTimeout(()=>{m(),l==="pending"&&(w(),y())},n.timeout);return}y();return}const A={status:"pending",resource:S,callback:(_,T)=>{b(A,_,T)}};h.push(A),c++,f=setTimeout(E,n.rotate),t(S,e,A.callback)}return setTimeout(E),v}function Tg(n){const e={...EC,...n};let t=[];function i(){t=t.filter(a=>a().status==="pending")}function r(a,o,l){const c=TC(e,a,o,(d,f)=>{i(),l&&l(d,f)});return t.push(c),c}function s(a){return t.find(o=>a(o))||null}return{query:r,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:i}}function tp(){}const fc=Object.create(null);function AC(n){if(!fc[n]){const e=Yd(n);if(!e)return;fc[n]={config:e,redundancy:Tg(e)}}return fc[n]}function CC(n,e,t){let i,r;if(typeof n=="string"){const s=Su(n);if(!s)return t(void 0,424),tp;r=s.send;const a=AC(n);a&&(i=a.redundancy)}else{const s=jd(n);if(s){i=Tg(s);const a=Su(n.resources?n.resources[0]:"");a&&(r=a.send)}}return!i||!r?(t(void 0,424),tp):i.query(e,r,t)().abort}function np(){}function PC(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,bC(n)}))}function RC(n){const e=[],t=[];return n.forEach(i=>{(i.match(vg)?e:t).push(i)}),{valid:e,invalid:t}}function Zs(n,e,t){function i(){const r=n.pendingIcons;e.forEach(s=>{r&&r.delete(s),n.icons[s]||n.missing.add(s)})}if(t&&typeof t=="object")try{if(!yg(n,t).length){i();return}}catch(r){console.error(r)}i(),PC(n)}function ip(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function DC(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,r=n.iconsToLoad;if(delete n.iconsToLoad,!r||!r.length)return;const s=n.loadIcon;if(n.loadIcons&&(r.length>1||!s)){ip(n.loadIcons(r,i,t),c=>{Zs(n,r,c)});return}if(s){r.forEach(c=>{ip(s(c,i,t),d=>{Zs(n,[c],d?{prefix:i,icons:{[c]:d}}:null)})});return}const{valid:a,invalid:o}=RC(r);if(o.length&&Zs(n,o,null),!a.length)return;const l=i.match(vg)?Su(t):null;if(!l){Zs(n,a,null);return}l.prepare(t,i,a).forEach(c=>{CC(t,c,d=>{Zs(n,c.icons,d)})})}))}const LC=(n,e)=>{const t=MC(wC(n,!0,Sg()));if(!t.pending.length){let o=!0;return e&&setTimeout(()=>{o&&e(t.loaded,t.missing,t.pending,np)}),()=>{o=!1}}const i=Object.create(null),r=[];let s,a;return t.pending.forEach(o=>{const{provider:l,prefix:c}=o;if(c===a&&l===s)return;s=l,a=c,r.push(Cs(l,c));const d=i[l]||(i[l]=Object.create(null));d[c]||(d[c]=[])}),t.pending.forEach(o=>{const{provider:l,prefix:c,name:d}=o,f=Cs(l,c),h=f.pendingIcons||(f.pendingIcons=new Set);h.has(d)||(h.add(d),i[l][c].push(d))}),r.forEach(o=>{const l=i[o.provider][o.prefix];l.length&&DC(o,l)}),e?SC(e,t,r):np};function IC(n,e){const t={...n};for(const i in e){const r=e[i],s=typeof r;i in Mg?(r===null||r&&(s==="string"||s==="number"))&&(t[i]=r):s===typeof t[i]&&(t[i]=i==="rotate"?r%4:r)}return t}const NC=/[\s,]+/;function UC(n,e){e.split(NC).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function FC(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(n);return isNaN(r)?0:i(r)}else if(t!==n){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let s=parseFloat(n.slice(0,n.length-t.length));return isNaN(s)?0:(s=s/r,s%1===0?i(s):0)}}return e}function OC(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function zC(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function BC(n){return"data:image/svg+xml,"+zC(n)}function kC(n){return'url("'+BC(n)+'")'}const rp={...wg,inline:!1},VC={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},HC={display:"inline-block"},Mu={"background-color":"currentColor"},Ag={"background-color":"transparent"},sp={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},ap={"-webkit-mask":Mu,mask:Mu,background:Ag};for(const n in ap){const e=ap[n];for(const t in sp)e[n+"-"+t]=sp[t]}function GC(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}function WC(n,e){const t=IC(rp,e),i=e.mode||"svg",r=i==="svg"?{...VC}:{};n.body.indexOf("xlink:")===-1&&delete r["xmlns:xlink"];let s=typeof e.style=="string"?e.style:"";for(let v in e){const y=e[v];if(y!==void 0)switch(v){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":t[v]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&UC(t,y);break;case"color":s=s+(s.length>0&&s.trim().slice(-1)!==";"?";":"")+"color: "+y+"; ";break;case"rotate":typeof y=="string"?t[v]=FC(y):typeof y=="number"&&(t[v]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete r["aria-hidden"];break;default:if(v.slice(0,3)==="on:")break;rp[v]===void 0&&(r[v]=y)}}const a=oC(n,t),o=a.attributes;if(t.inline&&(s="vertical-align: -0.125em; "+s),i==="svg")return Object.assign(r,o),s!==""&&(r.style=s),{svg:!0,attributes:r,body:uC(a.body)};const{body:l,width:c,height:d}=n,f=i==="mask"||(i==="bg"?!1:l.indexOf("currentColor")!==-1),h=OC(l,{...o,width:c+"",height:d+""}),m={"--svg":kC(h)},x=v=>{const y=o[v];y&&(m[v]=GC(y))};x("width"),x("height"),Object.assign(m,HC,f?Mu:Ag);let g="";for(const v in m)g+=v+": "+m[v]+";";return r.style=g+s,{svg:!1,attributes:r}}Sg(!0);dC("",xC);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!eC(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const i="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;hC(t,r)||console.error(i)}catch{console.error(i)}}}}function XC(){try{return typeof window!="object"}catch{return!0}}function jC(n,e,t,i){function r(){e.loading&&(e.loading.abort(),e.loading=null)}if(typeof n=="object"&&n!==null&&typeof n.body=="string")return e.name="",r(),{data:{...gl,...n}};let s;if(typeof n!="string"||(s=ml(n,!1,!0))===null)return r(),null;const a=J2(s);if(!a)return!XC()&&(!e.loading||e.loading.name!==n)&&(r(),e.name="",e.loading={name:n,abort:LC([s],t)}),null;r(),e.name!==n&&(e.name=n,i&&!e.destroyed&&setTimeout(()=>{i(n)}));const o=["iconify"];return s.prefix!==""&&o.push("iconify--"+s.prefix),s.provider!==""&&o.push("iconify--"+s.provider),{data:a,classes:o}}function qC(n,e){return n?WC({...gl,...n},e):null}var YC=Xg("<svg></svg>"),KC=K("<span></span>");function Cg(n,e){st(e,!0);const t={name:"",loading:null,destroyed:!1},i=ut(e,["$$slots","$$events","$$legacy"]);let r=Fe(0),s=O(()=>(u(r),jC(e.icon,t,o,e.onload))),a=O(()=>{const f=u(s)?qC(u(s).data,i):null;return f&&u(s).classes&&i.class===void 0&&(f.attributes.class=(typeof i.class=="string"?i.class+" ":"")+u(s).classes.join(" ")),f});function o(){vp(r)}yp(()=>{t.destroyed=!0,t.loading&&(t.loading.abort(),t.loading=null)});var l=we(),c=Q(l);{var d=f=>{var h=we(),p=Q(h);{var m=g=>{var v=YC();Ft(v,()=>({...u(a).attributes})),Pv(v,()=>u(a).body,!0),j(v),P(g,v)},x=g=>{var v=KC();Ft(v,()=>({...u(a).attributes})),P(g,v)};xe(p,g=>{u(a).svg?g(m):g(x,-1)})}P(f,h)};xe(c,f=>{u(a)&&f(d)})}P(n,l),at()}var ZC=K("<span> </span>"),$C=K("<!> ",1);function JC(n,e){st(e,!0);let t=Fe(null);function i(r){!u(t)||Math.abs(r.deltaX)>Math.abs(r.deltaY)||!(u(t).scrollWidth>u(t).clientWidth)||(r.preventDefault(),u(t).scrollLeft+=r.deltaY)}gg(n,{class:"w-full shrink-0 border-b border-border",orientation:"horizontal",onwheel:i,get viewportRef(){return u(t)},set viewportRef(r){W(t,r,!0)},children:(r,s)=>{var a=we(),o=Q(a);Ne(o,()=>Rv,(l,c)=>{c(l,{class:"px-2 py-2 gap-0 inline-flex h-auto w-max justify-start rounded-none bg-transparent",children:(d,f)=>{var h=we(),p=Q(h);Zt(p,17,()=>e.tabs,m=>m.id,(m,x)=>{var g=we(),v=Q(g);Ne(v,()=>Dv,(y,w)=>{w(y,{get value(){return u(x).id},onclick:()=>e.onTabChange(u(x).id),class:"group/tab gap-1.5 px-3 py-1 text-sm font-medium relative h-auto flex-none shrink-0 rounded-none border-0 transition-colors not-last:border-r not-last:border-border hover:bg-accent data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none data-[state=inactive]:text-muted-foreground dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-transparent",children:(b,E)=>{var S=$C(),A=Q(S);{var _=D=>{var L=we(),F=Q(L);{var k=R=>{Cg(R,{get icon(){return u(x).icon},class:"h-4 w-4"})},U=O(()=>u(x).icon.includes(":")),N=R=>{var z=ZC(),q=$(z,!0);j(z),Me(()=>Ae(q,u(x).icon)),P(R,z)};xe(F,R=>{u(U)?R(k):R(N,-1)})}P(D,L)};xe(A,D=>{u(x).icon&&D(_)})}var T=se(A);Me(()=>Ae(T,` ${u(x).label??""}`)),P(b,S)},$$slots:{default:!0}})}),P(m,g)}),P(d,h)},$$slots:{default:!0}})}),P(r,a)},$$slots:{default:!0}}),at()}var QC=K("<h3> </h3>"),eP=K("<p> </p>"),tP=K("<div><!></div> <!> <!>",1);function wu(n,e){let t=oe(e,"message",3,""),i=oe(e,"size",3,"medium"),r=oe(e,"class",3,"");const s={small:{container:"p-6 gap-3",icon:"w-8 h-8",title:"text-sm font-semibold",message:"text-xs"},medium:{container:"p-12 gap-4",icon:"w-12 h-12",title:"text-lg font-semibold",message:"text-sm"},large:{container:"p-16 gap-6",icon:"w-16 h-16",title:"text-2xl font-bold",message:"text-base"}},a={loading:{icon:"text-primary",title:"text-primary-foreground",message:"text-primary-foreground/80",border:"border-primary",background:"bg-primary/15"},error:{icon:"text-destructive",title:"text-destructive-foreground",message:"text-destructive-foreground/80",border:"border-destructive",background:"bg-destructive/15"},warning:{icon:"text-accent",title:"text-accent-foreground",message:"text-accent-foreground/80",border:"border-accent",background:"bg-accent/15"},empty:{icon:"text-neutral",title:"text-neutral-foreground",message:"text-neutral-foreground/80",border:"border-neutral",background:"bg-neutral/15"}},o=O(()=>s[i()]),l=O(()=>a[e.type]);var c=we(),d=Q(c);Ne(d,()=>vs,(f,h)=>{h(f,{get class(){return`rounded-lg border-2 ${u(l).border??""} ${u(l).background??""} ${r()??""}`},children:(p,m)=>{var x=we(),g=Q(x);Ne(g,()=>Fp,(v,y)=>{y(v,{get class(){return`flex flex-col items-center justify-center text-center ${u(o).container??""}`},children:(w,b)=>{var E=tP(),S=Q(E),A=$(S);{var _=R=>{Uu(R,{class:"animate-spin h-full w-full"})},T=R=>{Op(R,{class:"h-full w-full"})},D=R=>{yo(R,{class:"h-full w-full"})},L=R=>{n0(R,{class:"h-full w-full"})};xe(A,R=>{e.type==="loading"?R(_):e.type==="error"?R(T,1):e.type==="warning"?R(D,2):e.type==="empty"&&R(L,3)})}j(S);var F=se(S,2);{var k=R=>{var z=QC(),q=$(z,!0);j(z),Me(()=>{Dt(z,1,`${u(o).title??""} ${u(l).title??""} mt-1`),Ae(q,e.title)}),P(R,z)};xe(F,R=>{e.title&&R(k)})}var U=se(F,2);{var N=R=>{var z=eP(),q=$(z,!0);j(z),Me(()=>{Dt(z,1,`${u(o).message??""} ${u(l).message??""} max-w-md leading-relaxed`),Ae(q,t())}),P(R,z)};xe(U,R=>{t()&&R(N)})}Me(()=>Dt(S,1,`${u(o).icon??""} ${u(l).icon??""}`)),P(w,E)},$$slots:{default:!0}})}),P(p,x)},$$slots:{default:!0}})}),P(n,c)}const _o=n=>Array.isArray(n)?n.map(String):n==null||n===""?[]:[String(n)],nP={equals:(n,e)=>n===e,notEquals:(n,e)=>n!==e,greaterThan:(n,e)=>Number(n)>Number(e),lessThan:(n,e)=>Number(n)<Number(e),greaterThanOrEqual:(n,e)=>Number(n)>=Number(e),lessThanOrEqual:(n,e)=>Number(n)<=Number(e),between:(n,e,t)=>t?.length===2&&Number(n)>=Number(t[0])&&Number(n)<=Number(t[1]),in:(n,e,t)=>t?.includes(String(n))??!1,notIn:(n,e,t)=>!(t?.includes(String(n))??!1),matches:(n,e)=>{try{return new RegExp(String(e)).test(String(n))}catch{return!1}},contains:(n,e)=>_o(n).includes(String(e)),containsAny:(n,e,t)=>{const i=_o(n);return t?.some(r=>i.includes(String(r)))??!1},isEmpty:n=>_o(n).length===0,isNotEmpty:n=>_o(n).length>0};function iP(n,e){const t=nP[n.operator];return t?t(e[n.paramId],n.value,n.values):!1}function Pg(n,e){const t=n.rules.map(i=>iP(i,e));return n.mode==="any"?t.some(Boolean):t.every(Boolean)}const op={show:n=>({visible:n,disabled:!1}),hide:(n,e)=>({visible:!n,disabled:!1,defaultValue:e}),disable:(n,e)=>({visible:!0,disabled:n,defaultValue:n?e:void 0})};function rP(n,e){if(n.type==="linebreak")return{visible:!0,disabled:!1};if("visible"in n&&n.visible===!1)return{visible:!1,disabled:!1};if(!n.visibilityCondition?.rules)return{visible:!0,disabled:!1};const{action:t="show",defaultValue:i}=n.visibilityCondition,r=Pg(n.visibilityCondition,e);return(op[t]??op.show)(r,i)}function Qo(n){return n.type==="linebreak"?n.id:n.paramId}function Rg(n,e){const t={};for(const i of n)t[Qo(i)]=rP(i,e);return t}function sP(n,e){if(!n.visibilityCondition?.rules)return!0;const{action:t="show"}=n.visibilityCondition,i=Pg(n.visibilityCondition,e);return t==="hide"?!i:i}var aP=K('<div style="grid-column: 1 / -1" class="h-px bg-border" aria-hidden="true"></div>'),oP=K("<div><!></div>"),lP=K("<div><!></div>"),cP=K('<div class="p-6"><div class="schema-grid gap-6 grid svelte-1mpk06z"></div></div>'),uP=K("<!> <!> <!>",1),dP=K('<div class="schema-grid gap-6 grid svelte-1mpk06z"></div>'),hP=K('<!> <div><div class="content-inner svelte-1mpk06z"><!></div></div>',1);function fP(n,e){st(e,!0);const t=(f,h=wt,p=wt,m=wt)=>{var x=we(),g=Q(x);{var v=w=>{var b=aP();P(w,b)},y=w=>{const b=O(()=>u(s)[Qo(h())]),E=O(()=>Math.min(Math.max(1,h().span??1),p()));var S=we(),A=Q(S);{var _=T=>{var D=we(),L=Q(D);{var F=U=>{var N=oP();let R;var z=$(N);pt(z,()=>e.inputSnippet,h,()=>u(b)),j(N),Me(()=>{R=Dt(N,1,"grid-cell min-w-0 flex items-center svelte-1mpk06z",null,R,{"opacity-50":u(b).disabled,"col-divider":!m()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)},k=U=>{var N=lP();let R;var z=$(N);pt(z,()=>e.outputSnippet,h),j(N),Me(()=>{R=Dt(N,1,"grid-cell svelte-1mpk06z",null,R,{"col-divider":!m()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)};xe(L,U=>{h().type==="input"?U(F):h().type==="output"&&U(k,1)})}P(T,D)};xe(A,T=>{u(b).visible&&T(_)})}P(w,S)};xe(g,w=>{h().type==="linebreak"?w(v):w(y,-1)})}P(f,x)};let i=oe(e,"flat",3,!1);function r(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e.onToggle())}const s=O(()=>Rg(e.items,e.values)),a=O(()=>{const f=[];let h=0;for(const p of e.items){if(p.type==="linebreak"){f.push(0),h=0;continue}if(!u(s)[Qo(p)].visible){f.push(0);continue}const x=Math.min(Math.max(1,p.span??1),e.columns);h+x>e.columns&&(h=0),f.push(h),h=(h+x)%e.columns}return f});var o=we(),l=Q(o);{var c=f=>{var h=cP(),p=$(h);Zt(p,23,()=>e.items,m=>m.type==="linebreak"?m.id:m.paramId,(m,x,g)=>{t(m,()=>u(x),()=>e.columns,()=>u(a)[u(g)]===0)}),j(p),j(h),Me(()=>Ii(p,`--schema-cols: ${e.columns??""};`)),P(f,h)},d=f=>{var h=we(),p=Q(h);Ne(p,()=>vs,(m,x)=>{x(m,{class:"gap-0 py-0 pt-0 overflow-hidden",children:(g,v)=>{var y=hP(),w=Q(y);{let _=O(()=>!e.collapsed);Ne(w,()=>Uv,(T,D)=>{D(T,{class:"pt-4 pb-4! cursor-pointer border-b border-border bg-muted transition-colors select-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none",role:"button",tabindex:0,get"aria-expanded"(){return u(_)},get onclick(){return e.onToggle},onkeydown:r,children:(L,F)=>{var k=uP(),U=Q(k);Ne(U,()=>Fv,(q,Y)=>{Y(q,{children:(te,le)=>{yt();var B=Et();Me(()=>Ae(B,e.label)),P(te,B)},$$slots:{default:!0}})});var N=se(U,2);{var R=q=>{var Y=we(),te=Q(Y);Ne(te,()=>zv,(le,B)=>{B(le,{children:(ee,de)=>{yt();var ve=Et();Me(()=>Ae(ve,e.description)),P(ee,ve)},$$slots:{default:!0}})}),P(q,Y)};xe(N,q=>{e.description&&q(R)})}var z=se(N,2);Ne(z,()=>G2,(q,Y)=>{Y(q,{children:(te,le)=>{{let B=O(()=>e.collapsed?"":"rotate-180");Ov(te,{get class(){return`h-4 w-4 text-muted-foreground transition-transform duration-200 ${u(B)??""}`}})}},$$slots:{default:!0}})}),P(L,k)},$$slots:{default:!0}})})}var b=se(w,2);let E;var S=$(b),A=$(S);Ne(A,()=>Fp,(_,T)=>{T(_,{class:"p-6",children:(D,L)=>{var F=dP();Zt(F,23,()=>e.items,k=>k.type==="linebreak"?k.id:k.paramId,(k,U,N)=>{t(k,()=>u(U),()=>e.columns,()=>u(a)[u(N)]===0)}),j(F),Me(()=>Ii(F,`--schema-cols: ${e.columns??""};`)),P(D,F)},$$slots:{default:!0}})}),j(S),j(b),Me(()=>E=Dt(b,1,"content-wrapper svelte-1mpk06z",null,E,{collapsed:e.collapsed})),P(g,y)},$$slots:{default:!0}})}),P(f,h)};xe(l,f=>{i()?f(c):f(d,-1)})}P(n,o),at()}function pc(n){return n.type==="input"&&n.widgetType==="number"}function pP(n){return n.type==="input"&&n.widgetType==="text"}function mP(n){return n.type==="input"&&n.widgetType==="dropdown"}function xo(n){return n.type==="input"&&n.widgetType==="dynamicValueList"}function gP(n){return n.type==="input"&&n.widgetType==="checkbox"}function vP(n){return n.type==="input"&&n.widgetType==="file"}function _P(n){return n.type==="input"&&n.widgetType==="color"}function Dg(n){return n?.layout?n.layout.type==="tabbed"?n.layout.tabs?.flatMap(e=>e.groups??[])??[]:n.layout.type==="flat"?n.layout.groups??[]:[]:[]}function Lg(n){return Dg(n).flatMap(e=>e.items??[])}function xP(n){return Lg(n).filter(e=>e.type==="input")}const bP=Gv({base:"group/field data-[invalid=true]:text-destructive flex w-full gap-3",variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});var yP=K("<div><!></div>");function Eu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=yP();Ft(s,o=>({role:"group","data-slot":"field","data-orientation":i(),class:o,...r}),[()=>ci(bP({orientation:i()}),e.class)]);var a=$(s);pt(a,()=>e.children??wt),j(s),ui(s,o=>t(o),()=>t()),P(n,s),at()}function Tu(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);{let r=O(()=>ci("group/field-label peer/field-label gap-2 leading-snug flex w-fit group-data-[disabled=true]/field:opacity-50","[&>*]:data-[slot=field]:p-4 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border","has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",e.class));or(n,mt({"data-slot":"field-label",get class(){return u(r)}},()=>i,{get ref(){return t()},set ref(s){t(s)},children:(s,a)=>{var o=we(),l=Q(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}))}at()}var SP=K("<li> </li>"),MP=K('<ul class="ms-4 gap-1 flex list-disc flex-col"></ul>'),wP=K("<div><!></div>");function Ig(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children","errors"]);const r=O(()=>e.children?!0:!(!e.errors||e.errors.length===0||e.errors.length===1&&!e.errors[0]?.message)),s=O(()=>e.errors&&e.errors.length>1),a=O(()=>e.errors&&e.errors.length===1&&e.errors[0]?.message);var o=we(),l=Q(o);{var c=d=>{var f=wP();Ft(f,g=>({role:"alert","data-slot":"field-error",class:g,...i}),[()=>ci("text-sm font-normal text-destructive",e.class)]);var h=$(f);{var p=g=>{var v=we(),y=Q(v);pt(y,()=>e.children),P(g,v)},m=g=>{var v=Et();Me(()=>Ae(v,u(a))),P(g,v)},x=g=>{var v=MP();Zt(v,21,()=>e.errors??[],bp,(y,w)=>{var b=we(),E=Q(b);{var S=A=>{var _=SP(),T=$(_,!0);j(_),Me(()=>Ae(T,u(w).message)),P(A,_)};xe(E,A=>{u(w)?.message&&A(S)})}P(y,b)}),j(v),P(g,v)};xe(h,g=>{e.children?g(p):u(a)?g(m,1):u(s)&&g(x,2)})}j(f),ui(f,g=>t(g),()=>t()),P(d,f)};xe(l,d=>{u(r)&&d(c)})}P(n,o),at()}var EP=K('<div data-slot="checkbox-indicator" class="text-current transition-none"><!></div>');function Ng(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"checked",15,!1),r=oe(e,"indeterminate",15,!1),s=ut(e,["$$slots","$$events","$$legacy","ref","checked","indeterminate","class"]);var a=we(),o=Q(a);{const l=(d,f)=>{let h=()=>(f?.()).checked,p=()=>(f?.()).indeterminate;var m=EP(),x=$(m);{var g=y=>{ia(y,{class:"size-3.5"})},v=y=>{kv(y,{class:"size-3.5"})};xe(x,y=>{h()?y(g):p()&&y(v,1)})}j(m),P(d,m)};let c=O(()=>ci("peer size-4 shadow-xs flex shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",e.class));Ne(o,()=>g0,(d,f)=>{f(d,mt({"data-slot":"checkbox",get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get checked(){return i()},set checked(h){i(h)},get indeterminate(){return r()},set indeterminate(h){r(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var TP=K("<!> <!>",1);function AP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1);var r=we(),s=Q(r);Ne(s,()=>Eu,(a,o)=>{o(a,{orientation:"horizontal",children:(l,c)=>{var d=TP(),f=Q(d);{let p=O(()=>typeof t()=="boolean"?t():!1);Ng(f,{get id(){return e.inputId},get checked(){return u(p)},onCheckedChange:m=>{t(m===!0),e.onChange(m===!0)},get disabled(){return i()}})}var h=se(f,2);Ne(h,()=>Tu,(p,m)=>{m(p,{get for(){return e.inputId},class:"font-normal cursor-pointer text-muted-foreground",children:(x,g)=>{yt();var v=Et("Enabled");P(x,v)},$$slots:{default:!0}})}),P(l,d)},$$slots:{default:!0}})}),P(n,r),at()}var CP=K("<label><!> <span> </span></label>"),PP=K('<div class="divide-y divide-border/60 overflow-hidden rounded-md border border-input"></div>');function lp(n,e){st(e,!0);let t=oe(e,"disabled",3,!1);const i=O(()=>e.config?.options??{}),r=O(()=>new Set(e.value??[]));function s(o,l){const c=new na(u(r));l?c.add(o):c.delete(o),e.onChange([...c])}var a=PP();Zt(a,21,()=>Object.entries(u(i)),([o,l])=>o,(o,l)=>{var c=O(()=>Mr(u(l),2));let d=()=>u(c)[0],f=()=>u(c)[1];const h=O(()=>f()??d()),p=O(()=>`${e.inputId}-${u(h)}`),m=O(()=>u(r).has(u(h)));var x=CP(),g=$(x);Ng(g,{get id(){return u(p)},get checked(){return u(m)},onCheckedChange:b=>s(u(h),b===!0),get disabled(){return t()}});var v=se(g,2);let y;var w=$(v,!0);j(v),j(x),Me(()=>{Qt(x,"for",u(p)),Dt(x,1,`gap-3 px-3 py-2 text-sm flex items-center transition-colors select-none hover:bg-accent/50 ${u(m)?"bg-accent/30":""} ${t()?"cursor-not-allowed opacity-50":"cursor-pointer"}`),y=Dt(v,1,"flex-1",null,y,{"font-medium":u(m)}),Ae(w,d())}),P(o,x)}),j(a),P(n,a),at()}var RP=K('<div class="gap-2 flex items-center"><input type="color" class="h-9 w-12 rounded p-1 cursor-pointer border border-input bg-background"/> <span class="font-mono text-sm text-muted-foreground"> </span></div>');function DP(n,e){st(e,!0);let t=oe(e,"value",3,"#000000");var i=RP(),r=$(i);Ru(r);var s=se(r,2),a=$(s,!0);j(s),j(i),Me(()=>{mv(r,t()||"#000000"),Ae(a,t()||"#000000")}),Xt("change",r,o=>{const l=o.currentTarget.value;e.onChange(l)}),P(n,i),at()}zi(["change"]);var LP=K("<!> <!>",1);function cp(n,e){st(e,!0);let t=oe(e,"value",7),i=oe(e,"disabled",3,!1);const r=O(()=>e.config?.options||{}),s=O(()=>t()||""),a=O(()=>Object.entries(u(r)).find(([c,d])=>d===u(s))?.[0]??u(s));var o=we(),l=Q(o);Ne(l,()=>wv,(c,d)=>{d(c,{type:"single",get value(){return u(s)},onValueChange:f=>{f&&(t(f),e.onChange(f))},get disabled(){return i()},children:(f,h)=>{var p=LP(),m=Q(p);Ne(m,()=>Ev,(g,v)=>{v(g,{class:"w-full",get disabled(){return i()},children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(a)||"Select an option...")),P(y,b)},$$slots:{default:!0}})});var x=se(m,2);Ne(x,()=>Tv,(g,v)=>{v(g,{children:(y,w)=>{var b=we(),E=Q(b);Zt(E,17,()=>Object.entries(u(r)),([S,A])=>S,(S,A)=>{var _=O(()=>Mr(u(A),2));let T=()=>u(_)[0],D=()=>u(_)[1];var L=we(),F=Q(L);{let k=O(()=>D()??T());Ne(F,()=>Av,(U,N)=>{N(U,{get value(){return u(k)},get label(){return T()}})})}P(S,L)}),P(y,b)},$$slots:{default:!0}})}),P(f,p)},$$slots:{default:!0}})}),P(n,o),at()}var IP=K('<button type="button"> </button>'),NP=K('<div class="rounded text-xs flex overflow-hidden border"></div>'),UP=K("<!> File URL",1),FP=K('<div class="gap-1.5 text-xs flex items-center text-success"><!> </div>'),OP=K('<p class="text-xs leading-snug pl-5 text-muted-foreground"> </p>'),zP=K('<div class="p-2.5 gap-1.5 flex flex-col rounded-md border border-destructive/40 bg-destructive/5"><div class="gap-1.5 flex items-start"><!> <p class="text-xs leading-snug text-destructive"> </p></div> <!></div>'),BP=K('<p class="text-xs text-muted-foreground">URL must be publicly accessible (no login required).</p>'),kP=K('<div class="gap-2 flex flex-col"><!> <div class="gap-2 flex"><!> <!></div> <!> <!> <!></div>'),VP=K("<!> Upload File",1),HP=K("<!> ",1),GP=K('<p class="text-xs text-muted-foreground"> </p>'),WP=K('<div class="gap-2 flex flex-col"><!> <!> <!></div>'),XP=K('<div class="gap-4 flex w-full flex-col"><input type="file" class="hidden"/> <!> <!></div>');function jP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"acceptedFormats",19,()=>[]),r=oe(e,"defaultInputMode",3,"upload"),s=O(()=>e.allowedInputModes&&e.allowedInputModes.length>0?e.allowedInputModes:["upload","url"]),a=O(()=>u(s).length>1),o=Fe("upload");Pt(()=>{const R=r()??"upload";W(o,u(s).includes(R)?R:u(s)[0],!0)});let l=Fe(null),c=Fe(""),d=Fe(""),f=Fe(!1),h=Fe(!1),p=Fe(null),m=Fe("");Pt(()=>{if(t())try{const R=typeof t()=="string"?JSON.parse(t()):t();if(R.type==="base64")if(R._isMetadata&&R._fileSize){const z=(R._fileSize/1024/1024).toFixed(2);W(c,`Uploaded file (${R.fileEnding}, ${z}MB)`)}else W(c,`Uploaded file (${R.fileEnding})`);else R.type==="url"&&W(d,R.file,!0)}catch{}});function x(R){const z=R.split("?")[0];return(z.includes(".")?"."+z.split(".").pop():".tmp").toLowerCase()}function g(R){return i().length===0?!0:i().includes(R.toLowerCase())}function v(R){return R instanceof TypeError&&R.message==="Failed to fetch"}async function y(){if(u(d).trim()){W(h,!0),W(p,null),W(m,""),W(c,"");try{let R;try{R=new URL(u(d))}catch{W(p,{message:"Invalid URL — make sure it starts with https://",isCors:!1},!0);return}if(R.protocol!=="https:"&&R.protocol!=="http:"){W(p,{message:"Only http:// and https:// URLs are supported.",isCors:!1},!0);return}const z=await fetch(u(d));if(!z.ok){W(p,{message:`Server returned ${z.status} ${z.statusText}. Check the URL is correct and publicly accessible.`,isCors:!1},!0);return}const q=await z.blob(),Y=x(u(d));if(!g(Y)){W(p,{message:`File format "${Y}" is not accepted. Allowed: ${i().join(", ")}`,isCors:!1},!0);return}const te=us.FILE_UPLOAD.MAX_SIZE_BYTES;if(q.size>te){W(p,{message:`File too large: ${(q.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB). Download it and use Upload instead.`,isCors:!1},!0);return}const le=await new Promise((ee,de)=>{const ve=new FileReader;ve.onload=G=>{const ie=G.target?.result;ee(ie.includes(",")?ie.split(",")[1]:ie)},ve.onerror=()=>de(new Error("Failed to read the downloaded file.")),ve.readAsDataURL(q)}),B=JSON.stringify({file:le,type:"base64",fileEnding:Y});t(B),W(m,`Loaded ${Y} (${(q.size/1024).toFixed(0)} KB)`),e.onChange(B)}catch(R){if(v(R)){const z=(()=>{try{return new URL(u(d)).hostname}catch{return""}})();let q="Check that the URL is correct and the file is publicly accessible. If the server requires login, download the file and use the Upload option instead.";z.includes("sharepoint.com")||z.includes("onedrive.com")?q='SharePoint/OneDrive blocks browser access. Open the file in SharePoint, use "Download" to save it locally, then upload it here.':z.includes("drive.google.com")?q='Google Drive blocks browser access. Use "Download" in Google Drive to save the file locally, then upload it here.':z.includes("dropbox.com")&&(q='Dropbox links may block browser access. Try changing "?dl=0" to "?dl=1" in the URL, or download and upload instead.'),W(p,{message:`Could not reach "${z}" — the file may not exist, or the server does not allow browser access.`,isCors:!0,hint:q},!0)}else W(p,{message:R instanceof Error?R.message:"Unknown error",isCors:!1},!0)}finally{W(h,!1)}}}function w(R){const q=R.target.files?.[0];if(!q)return;const Y=x(q.name);if(!g(Y)){alert(`File format not accepted: ${Y}`);return}if(q.size>us.FILE_UPLOAD.MAX_SIZE_BYTES){alert(`File too large: ${(q.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB).`);return}W(c,q.name,!0);const te=new FileReader;te.onload=le=>{const B=le.target?.result,ee=B.includes(",")?B.split(",")[1]:B,de=JSON.stringify({file:ee,type:"base64",fileEnding:Y});t(de),e.onChange(de)},te.readAsDataURL(q)}function b(){u(l)?.click()}function E(R){R.preventDefault(),W(f,!0)}function S(){W(f,!1)}function A(R){R.preventDefault(),W(f,!1);const z=R.dataTransfer?.files;if(z?.[0]){const q=new Event("change");Object.defineProperty(q,"target",{value:{files:z}}),w(q)}}const _=O(()=>i().length>0?i().join(","):"*");var T=XP(),D=$(T);ui(D,R=>W(l,R),()=>u(l));var L=se(D,2);{var F=R=>{var z=NP();Zt(z,20,()=>u(s),q=>q,(q,Y)=>{var te=IP(),le=$(te,!0);j(te),Me(()=>{Dt(te,1,`px-3 py-1 flex-1 transition-colors ${u(o)===Y?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`),Ae(le,Y==="upload"?"Upload":"URL")}),Xt("click",te,()=>W(o,Y,!0)),P(q,te)}),j(z),P(R,z)};xe(L,R=>{u(a)&&R(F)})}var k=se(L,2);{var U=R=>{var z=kP(),q=$(z);or(q,{for:"url-input",class:"gap-2 flex items-center",children:(Z,ce)=>{var pe=UP(),Se=Q(pe);r0(Se,{size:16}),yt(),P(Z,pe)},$$slots:{default:!0}});var Y=se(q,2),te=$(Y);{let Z=O(()=>u(p)?"border-destructive focus-visible:ring-destructive":"");_s(te,{id:"url-input",type:"url",placeholder:"https://example.com/model.3dm",get disabled(){return u(h)},get class(){return u(Z)},oninput:()=>{W(p,null),W(m,"")},get value(){return u(d)},set value(ce){W(d,ce,!0)}})}var le=se(te,2);{let Z=O(()=>u(h)||!u(d).trim());Bn(le,{type:"button",variant:"outline",get disabled(){return u(Z)},onclick:y,children:(ce,pe)=>{yt();var Se=Et();Me(()=>Ae(Se,u(h)?"Fetching...":"Fetch")),P(ce,Se)},$$slots:{default:!0}})}j(Y);var B=se(Y,2);{var ee=Z=>{var ce=FP(),pe=$(ce);Vv(pe,{size:13});var Se=se(pe);j(ce),Me(()=>Ae(Se,` ${u(m)??""}`)),P(Z,ce)};xe(B,Z=>{u(m)&&Z(ee)})}var de=se(B,2);{var ve=Z=>{var ce=zP(),pe=$(ce),Se=$(pe);Op(Se,{size:13,class:"mt-0.5 shrink-0 text-destructive"});var ze=se(Se,2),Ue=$(ze,!0);j(ze),j(pe);var Pe=se(pe,2);{var ke=Ie=>{var We=OP(),Oe=$(We,!0);j(We),Me(()=>Ae(Oe,u(p).hint)),P(Ie,We)};xe(Pe,Ie=>{u(p).isCors&&u(p).hint&&Ie(ke)})}j(ce),Me(()=>Ae(Ue,u(p).message)),P(Z,ce)};xe(de,Z=>{u(p)&&Z(ve)})}var G=se(de,2);{var ie=Z=>{var ce=BP();P(Z,ce)};xe(G,Z=>{!u(p)&&!u(m)&&Z(ie)})}j(z),P(R,z)},N=R=>{var z=WP(),q=$(z);or(q,{for:"file-upload",class:"gap-2 flex items-center",children:(B,ee)=>{var de=VP(),ve=Q(de);ah(ve,{size:16}),yt(),P(B,de)},$$slots:{default:!0}});var Y=se(q,2);{let B=O(()=>u(f)?"border-primary":"");Bn(Y,{type:"button",variant:"outline",get class(){return`gap-2 w-full ${u(B)??""}`},onclick:b,ondragover:E,ondragleave:S,ondrop:A,children:(ee,de)=>{var ve=HP(),G=Q(ve);ah(G,{size:16});var ie=se(G);Me(()=>Ae(ie,` ${(u(c)||"Choose File or Drag & Drop")??""}`)),P(ee,ve)},$$slots:{default:!0}})}var te=se(Y,2);{var le=B=>{var ee=GP(),de=$(ee);j(ee),Me(ve=>Ae(de,`Accepted formats: ${ve??""}`),[()=>i().join(", ")]),P(B,ee)};xe(te,B=>{i().length>0&&B(le)})}j(z),P(R,z)};xe(k,R=>{u(o)==="url"?R(U):R(N,-1)})}j(T),Me(()=>Qt(D,"accept",u(_))),Xt("change",D,w),P(n,T),at()}zi(["change","click"]);function Au(n,e){let t=null;function i(...r){t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...r),t=null},e)}return i.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},i}var qP=K('<span data-slot="slider-track"><!></span> <!>',1);function YP(n,e){st(e,!0);let t=oe(e,"ref",15,null),i=oe(e,"value",15),r=oe(e,"orientation",3,"horizontal"),s=ut(e,["$$slots","$$events","$$legacy","ref","value","orientation","class"]);var a=we(),o=Q(a);{const l=(d,f)=>{let h=()=>(f?.()).thumbs;var p=qP(),m=Q(p),x=$(m);{let v=O(()=>ci("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"));Ne(x,()=>u_,(y,w)=>{w(y,{"data-slot":"slider-range",get class(){return u(v)}})})}j(m);var g=se(m,2);Zt(g,16,h,v=>v,(v,y)=>{var w=we(),b=Q(w);Ne(b,()=>h_,(E,S)=>{S(E,{"data-slot":"slider-thumb",get index(){return y},class:"size-4 shadow-sm block shrink-0 rounded-full border border-primary bg-background ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"})}),P(v,w)}),Me(v=>{Qt(m,"data-orientation",r()),Dt(m,1,v)},[()=>Uo(ci("bg-neutral-200 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full dark:bg-muted"))]),P(d,p)};let c=O(()=>ci("data-[orientation=vertical]:min-h-44 relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e.class));Ne(o,()=>l_,(d,f)=>{f(d,mt({"data-slot":"slider",get orientation(){return r()},get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get value(){return i()},set value(h){i(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var KP=K('<input type="number" class="min-w-12 w-16 text-sm border-b border-border bg-transparent text-right outline-none focus:border-foreground"/>'),ZP=K('<span role="button" class="min-w-12 text-sm cursor-text text-right text-muted-foreground select-none" title="Double-click to edit"> </span>'),$P=K('<div class="gap-4 flex items-center"><!> <!></div>'),JP=K("<!> <!>",1);function QP(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1),r=Fe(null),s=Fe(!1),a=Fe("");const o=O(()=>e.config?.minimum??0),l=O(()=>e.config?.maximum??100),c=O(()=>e.config?.stepSize??1),d=O(()=>typeof t()=="number"?t():u(o)),f=Au(_=>e.onChange(_),400),h=Au(_=>e.onChange(_),150);function p(_){return e.config?.minimum!==void 0&&_<e.config.minimum?`Minimum value is ${e.config.minimum}`:e.config?.maximum!==void 0&&_>e.config.maximum?`Maximum value is ${e.config.maximum}`:null}function m(_){const T=p(_);W(r,T,!0),T||(t(_),f(_))}function x(_){t(_),h(_)}function g(_){_.focus(),_.select()}function v(_){return Math.max(0,-Math.floor(Math.log10(_)))}var y=JP(),w=Q(y);{var b=_=>{const T=O(()=>v(u(c)));var D=$P(),L=$(D);YP(L,{type:"single",get value(){return u(d)},get min(){return u(o)},get max(){return u(l)},get step(){return u(c)},class:"flex-1",onValueChange:x,get disabled(){return i()}});var F=se(L,2);{var k=N=>{var R=KP();Ru(R),Bv(R,z=>g?.(z)),Hg(()=>Sp(R,()=>u(a),z=>W(a,z))),Me(()=>Qt(R,"step",u(c))),Wg("blur",R,()=>{const z=parseFloat(u(a));isNaN(z)||x(Math.min(u(l),Math.max(u(o),z))),W(s,!1)}),Xt("keydown",R,z=>{if(z.key==="Enter"){const q=parseFloat(u(a));isNaN(q)||x(Math.min(u(l),Math.max(u(o),q))),W(s,!1)}else z.key==="Escape"&&W(s,!1)}),P(N,R)},U=N=>{var R=ZP();Qt(R,"tabindex",0);var z=$(R,!0);j(R),Me(q=>Ae(z,q),[()=>u(d).toFixed(u(T))]),Xt("dblclick",R,()=>{W(a,u(d).toFixed(u(T)),!0),W(s,!0)}),Xt("keydown",R,q=>{(q.key==="Enter"||q.key===" ")&&(W(a,u(d).toFixed(u(T)),!0),W(s,!0))}),P(N,R)};xe(F,N=>{u(s)?N(k):N(U,-1)})}j(D),P(_,D)},E=_=>{{let T=O(()=>e.config?.minimum),D=O(()=>e.config?.maximum),L=O(()=>e.config?.placeholder),F=O(()=>u(r)?!0:void 0),k=O(()=>u(r)?!0:void 0),U=O(()=>u(r)?"border-destructive":"");_s(_,{get id(){return e.inputId},type:"number",get value(){return u(d)},get min(){return u(T)},get max(){return u(D)},get step(){return u(c)},get placeholder(){return u(L)},get"data-invalid"(){return u(F)},get"aria-invalid"(){return u(k)},get class(){return u(U)},get disabled(){return i()},oninput:()=>W(r,null),onchange:N=>{const R=parseFloat(N.currentTarget.value);isNaN(R)||m(R)},onblur:N=>{const R=parseFloat(N.currentTarget.value);if(!isNaN(R)){const z=p(R);W(r,z,!0),z||(t(R),e.onChange(R))}}})}};xe(w,_=>{e.config?.renderAsSlider?_(b):_(E,-1)})}var S=se(w,2);{var A=_=>{var T=we(),D=Q(T);Ne(D,()=>Ig,(L,F)=>{F(L,{children:(k,U)=>{yt();var N=Et();Me(()=>Ae(N,u(r))),P(k,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{u(r)&&_(A)})}P(n,y),at()}zi(["keydown","dblclick"]);var eR=K("<!> <!>",1);function tR(n,e){st(e,!0);let t=oe(e,"value",15),i=oe(e,"disabled",3,!1),r=Fe(null),s=Fe(Ps(t()||""));const a=Au(p=>e.onChange(p),400);function o(p){if(e.config?.maxLength&&p.length>e.config.maxLength)return`Maximum ${e.config.maxLength} characters allowed`;if(e.config?.pattern)try{if(!new RegExp(e.config.pattern).test(p))return e.config.customErrorMessage||"Invalid format"}catch{return"Invalid validation pattern configured"}return null}function l(){const p=o(u(s));W(r,p,!0),p||(t(u(s)),a(u(s)))}var c=eR(),d=Q(c);{let p=O(()=>e.config?.placeholder),m=O(()=>e.config?.maxLength),x=O(()=>u(r)?!0:void 0),g=O(()=>u(r)?!0:void 0),v=O(()=>u(r)?"border-destructive":"");_s(d,{get id(){return e.inputId},type:"text",get placeholder(){return u(p)},get maxlength(){return u(m)},get"data-invalid"(){return u(x)},get"aria-invalid"(){return u(g)},get class(){return u(v)},get disabled(){return i()},oninput:()=>{W(r,null),l()},onblur:y=>{const w=y.currentTarget.value,b=o(w);W(r,b,!0),b||(W(s,w,!0),t(w),e.onChange(w))},get value(){return u(s)},set value(y){W(s,y,!0)}})}var f=se(d,2);{var h=p=>{var m=we(),x=Q(m);Ne(x,()=>Ig,(g,v)=>{v(g,{children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(r))),P(y,b)},$$slots:{default:!0}})}),P(p,m)};xe(f,p=>{u(r)&&p(h)})}P(n,c),at()}const Ug=Symbol("client-slot-context");function nR(n){Cu(Ug,n)}function iR(){return Ms(Ug)}var rR=K("<!> <!>",1),sR=K("<!> <!>",1),aR=K(" <!>",1),oR=K("<!> <!>",1),lR=K("<!> <!>",1),cR=K("<!> <!>",1),uR=K('<span class="text-xs font-normal text-muted-foreground"> </span>'),dR=K(" <!> <!>",1),hR=K('<p class="text-sm text-muted-foreground">No options available yet.</p>'),fR=K("<!> <!>",1);function pR(n,e){st(e,!0);let t=oe(e,"value",15,void 0),i=oe(e,"disabled",3,!1);const r=O(()=>`input-${e.item.paramId}`),s=O(()=>e.displayName||e.item.displayName||e.item.paramId),a=O(()=>{const b=e.item.source;return b?.kind==="client"&&b.client?.presentation==="slot"}),o=iR(),l=O(()=>{if(!pc(e.item))return null;const b=e.item.config;if(b?.hideRange)return null;const E=typeof b?.minimum=="number",S=typeof b?.maximum=="number";return!E&&!S?null:E&&S?`${b.minimum} to ${b.maximum}`:E?`≥ ${b.minimum}`:`≤ ${b.maximum}`}),c=O(()=>pc(e.item)&&u(l)!==null),d=O(()=>xo(e.item)?e.item.config:void 0),f=O(()=>e.dynamicOptions&&Object.keys(e.dynamicOptions).length>0?e.dynamicOptions:Object.fromEntries(Object.entries(u(d)?.defaultOptions??{}).filter(b=>b[1]!==void 0))),h=O(()=>Object.keys(u(f)).length>0),p=O(()=>({options:u(f),displayAs:u(d)?.displayAs??"dropdown"})),m=O(()=>xo(e.item)&&!u(h)&&(u(d)?.emptyBehavior??"hide")==="hide");Pt(()=>{if(!xo(e.item)||!u(h))return;const b=new Set(Object.values(u(f)));if(Array.isArray(t())){const E=t().filter(S=>typeof S=="string"&&b.has(S));E.length!==t().length&&e.onChange(e.item.paramId,E.length>0?E:[Object.values(u(f))[0]],!0)}else typeof t()=="string"&&t()&&!b.has(t())&&e.onChange(e.item.paramId,Object.values(u(f))[0],!0)});function x(b){t(b),e.onChange(e.item.paramId,b)}var g=we(),v=Q(g);{var y=b=>{var E=we(),S=Q(E);{var A=_=>{var T=we(),D=Q(T);Ne(D,()=>Eu,(L,F)=>{F(L,{children:(k,U)=>{var N=oR(),R=Q(N);Ne(R,()=>Tu,(q,Y)=>{Y(q,{class:"gap-2 flex items-center",children:(te,le)=>{yt();var B=aR(),ee=Q(B),de=se(ee);{var ve=G=>{var ie=we(),Z=Q(ie);Ne(Z,()=>wr,(ce,pe)=>{pe(ce,{children:(Se,ze)=>{var Ue=sR(),Pe=Q(Ue);Ne(Pe,()=>mc,(Ie,We)=>{We(Ie,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(Oe,He)=>{ch(Oe,{size:16})},$$slots:{default:!0}})});var ke=se(Pe,2);Ne(ke,()=>Er,(Ie,We)=>{We(Ie,{class:"sm:max-w-md",children:(Oe,He)=>{var V=we(),je=Q(V);Ne(je,()=>ms,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{var C=rR(),M=Q(C);Ne(M,()=>dr,(re,ue)=>{ue(re,{children:(be,ge)=>{yt();var ae=Et();Me(()=>Ae(ae,u(s))),P(be,ae)},$$slots:{default:!0}})});var H=se(M,2);Ne(H,()=>gs,(re,ue)=>{ue(re,{children:(be,ge)=>{yt();var ae=Et();Me(()=>Ae(ae,e.item.description)),P(be,ae)},$$slots:{default:!0}})}),P(ye,C)},$$slots:{default:!0}})}),P(Oe,V)},$$slots:{default:!0}})}),P(Se,Ue)},$$slots:{default:!0}})}),P(G,ie)};xe(de,G=>{e.item.description&&G(ve)})}Me(()=>Ae(ee,`${u(s)??""} `)),P(te,B)},$$slots:{default:!0}})});var z=se(R,2);o(z,()=>({inputId:e.item.paramId,displayName:u(s),value:t(),onValueChange:x})),P(k,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{o&&_(A)})}P(b,E)},w=b=>{var E=we(),S=Q(E);Ne(S,()=>Eu,(A,_)=>{_(A,{children:(T,D)=>{var L=fR(),F=Q(L);Ne(F,()=>Tu,(Z,ce)=>{ce(Z,{get for(){return u(r)},class:"gap-2 flex items-center",children:(pe,Se)=>{yt();var ze=dR(),Ue=Q(ze),Pe=se(Ue);{var ke=Oe=>{var He=we(),V=Q(He);Ne(V,()=>wr,(je,Ve)=>{Ve(je,{children:(Xe,ye)=>{var Ce=cR(),C=Q(Ce);Ne(C,()=>mc,(H,re)=>{re(H,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(ue,be)=>{ch(ue,{size:16})},$$slots:{default:!0}})});var M=se(C,2);Ne(M,()=>Er,(H,re)=>{re(H,{class:"sm:max-w-md",children:(ue,be)=>{var ge=we(),ae=Q(ge);Ne(ae,()=>ms,(fe,Re)=>{Re(fe,{children:(Le,Ee)=>{var De=lR(),et=Q(De);Ne(et,()=>dr,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,u(s))),P(Ge,Ze)},$$slots:{default:!0}})});var Ye=se(et,2);Ne(Ye,()=>gs,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,e.item.description)),P(Ge,Ze)},$$slots:{default:!0}})}),P(Le,De)},$$slots:{default:!0}})}),P(ue,ge)},$$slots:{default:!0}})}),P(Xe,Ce)},$$slots:{default:!0}})}),P(Oe,He)};xe(Pe,Oe=>{e.item.description&&Oe(ke)})}var Ie=se(Pe,2);{var We=Oe=>{var He=uR(),V=$(He,!0);j(He),Me(()=>Ae(V,u(l))),P(Oe,He)};xe(Ie,Oe=>{u(c)&&Oe(We)})}Me(()=>Ae(Ue,`${u(s)??""} `)),P(pe,ze)},$$slots:{default:!0}})});var k=se(F,2);{var U=Z=>{const ce=O(()=>e.item.config);{let pe=O(()=>typeof t()=="number"?t():void 0);QP(Z,{get inputId(){return u(r)},get value(){return u(pe)},get config(){return u(ce)},onChange:x,get disabled(){return i()}})}},N=O(()=>pc(e.item)),R=Z=>{{let ce=O(()=>typeof t()=="boolean"?t():void 0);AP(Z,{get inputId(){return u(r)},get value(){return u(ce)},onChange:x,get disabled(){return i()}})}},z=O(()=>gP(e.item)),q=Z=>{const ce=O(()=>e.item.config);{let pe=O(()=>typeof t()=="string"?t():"");tR(Z,{get inputId(){return u(r)},get value(){return u(pe)},get config(){return u(ce)},onChange:x,get disabled(){return i()}})}},Y=O(()=>pP(e.item)),te=Z=>{const ce=O(()=>e.item.config);var pe=we(),Se=Q(pe);{var ze=Pe=>{{let ke=O(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(Pe,{get inputId(){return u(r)},get value(){return u(ke)},get config(){return u(ce)},onChange:x,get disabled(){return i()}})}},Ue=Pe=>{{let ke=O(()=>typeof t()=="string"?t():"");cp(Pe,{get value(){return u(ke)},get config(){return u(ce)},onChange:x,get disabled(){return i()}})}};xe(Se,Pe=>{u(ce).displayAs==="checklist"?Pe(ze):Pe(Ue,-1)})}P(Z,pe)},le=O(()=>mP(e.item)),B=Z=>{var ce=we(),pe=Q(ce);{var Se=Ue=>{var Pe=we(),ke=Q(Pe);{var Ie=Oe=>{{let He=O(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(Oe,{get inputId(){return u(r)},get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}},We=Oe=>{{let He=O(()=>typeof t()=="string"?t():"");cp(Oe,{get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}};xe(ke,Oe=>{u(p).displayAs==="checklist"?Oe(Ie):Oe(We,-1)})}P(Ue,Pe)},ze=Ue=>{var Pe=hR();P(Ue,Pe)};xe(pe,Ue=>{u(h)?Ue(Se):Ue(ze,-1)})}P(Z,ce)},ee=O(()=>xo(e.item)),de=Z=>{const ce=O(()=>e.item.config);{let pe=O(()=>typeof t()=="string"?t():""),Se=O(()=>u(ce)?.acceptedFormats??[]),ze=O(()=>u(ce)?.defaultInputMode),Ue=O(()=>u(ce)?.allowedInputModes);jP(Z,{get value(){return u(pe)},get acceptedFormats(){return u(Se)},onChange:Pe=>x(Pe),get defaultInputMode(){return u(ze)},get allowedInputModes(){return u(Ue)}})}},ve=O(()=>vP(e.item)),G=Z=>{{let ce=O(()=>typeof t()=="string"?t():"#000000");DP(Z,{get value(){return u(ce)},onChange:pe=>x(pe)})}},ie=O(()=>_P(e.item));xe(k,Z=>{u(N)?Z(U):u(z)?Z(R,1):u(Y)?Z(q,2):u(le)?Z(te,3):u(ee)?Z(B,4):u(ve)?Z(de,5):u(ie)&&Z(G,6)})}P(T,L)},$$slots:{default:!0}})}),P(b,E)};xe(v,b=>{u(a)?b(y):u(m)||b(w,1)})}P(n,g),at()}const $s=new Map;function mR(n,e){if($s.has(n))return $s.get(n);if(document.querySelector(`script[src="${n}"]`)){const i=Promise.resolve();return $s.set(n,i),i}const t=new Promise((i,r)=>{const s=document.createElement("script");s.src=n,e?.crossOrigin&&(s.crossOrigin=e.crossOrigin),e?.async!==void 0&&(s.async=e.async),e?.defer!==void 0&&(s.defer=e.defer),s.onload=()=>i(),s.onerror=()=>{$s.delete(n),r(new Error(`Failed to load script: ${n}`))},document.head.appendChild(s)});return $s.set(n,t),t}var gR=K('<div class="px-4 py-3 text-sm text-destructive"> </div>'),vR=K('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Receiving chart data...</div>'),_R=K('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for chart data...</div>'),xR=K('<div class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-muted-foreground"><!></div>'),bR=K('<div class="w-full"></div> <div><!> <button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button></div>',1),yR=K("<div><!></div>");function SR(n,e){st(e,!0);const t=new Set(["scattermap","scattermapbox","choropleth","scattergeo"]),i=O(()=>{if(!e.value)return null;try{return JSON.parse(e.value)}catch{return null}});let r=Fe(null),s=Fe(null),a=Fe(!1),o=Fe(null),l=Fe(!1),c=!1;async function d(){return window.Plotly||await mR("https://cdn.plot.ly/plotly-3.4.0.min.js",{crossOrigin:"anonymous"}),window.Plotly}function f(){u(s)&&(document.fullscreenElement?document.exitFullscreen().catch(E=>{W(o,`Exit fullscreen failed: ${E.message}`)}):u(s).requestFullscreen().catch(E=>{W(o,`Fullscreen unavailable: ${E.message}`)}))}Pt(()=>{function E(){W(l,!!document.fullscreenElement),Promise.resolve().then(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r))})}return document.addEventListener("fullscreenchange",E),()=>document.removeEventListener("fullscreenchange",E)});function h(){if(!u(r))return{textColor:"#333",gridColor:"#eee"};const E=getComputedStyle(u(r)),S=E.getPropertyValue("color").trim()||"#333",A=E.getPropertyValue("--border")?.trim()||E.getPropertyValue("--color-border")?.trim()||"rgba(128,128,128,0.2)";return{textColor:S,gridColor:A}}async function p(){if(!(!u(r)||!u(i))){W(o,null),W(a,!0);try{const E=await d(),{textColor:S,gridColor:A}=h(),_=u(i).data?.some(N=>t.has(N.type)),{title:T,template:D,height:L,width:F,...k}=u(i).layout,U={...k,autosize:!0,margin:{t:24,r:8,b:40,l:60,pad:0},font:{color:S},paper_bgcolor:k.paper_bgcolor??"transparent",plot_bgcolor:k.plot_bgcolor??"transparent",...!_&&k.xaxis?{xaxis:{...k.xaxis,gridcolor:A,color:S}}:{},...!_&&k.yaxis?{yaxis:{...k.yaxis,gridcolor:A,color:S}}:{}};E.react(u(r),u(i).data,U,{responsive:!0,displayModeBar:"hover",displaylogo:!1,modeBarButtonsToRemove:["sendDataToCloud","lasso2d","select2d"],...u(i).config})}catch(E){W(o,E instanceof Error?E.message:"Failed to render chart",!0)}finally{W(a,!1)}}}tl(()=>{c=!0;let E=null;const S=new ResizeObserver(()=>{E&&clearTimeout(E),E=setTimeout(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r)),E=null},150)});return u(s)&&S.observe(u(s)),()=>{S.disconnect(),E&&clearTimeout(E),u(r)&&window.Plotly&&window.Plotly.purge(u(r))}});let m=null;Pt(()=>{if(!(!e.value||!c||!u(r)))return m&&clearTimeout(m),m=setTimeout(()=>{p(),m=null},150),()=>{m&&clearTimeout(m)}});var x=yR(),g=$(x);{var v=E=>{var S=gR(),A=$(S,!0);j(S),Me(()=>Ae(A,u(o))),P(E,S)},y=E=>{var S=vR();P(E,S)},w=E=>{var S=_R();P(E,S)},b=E=>{var S=bR(),A=Q(S);ui(A,N=>W(r,N),()=>u(r));var _=se(A,2),T=$(_);{var D=N=>{var R=xR(),z=$(R);Uu(z,{size:14,class:"animate-spin"}),j(R),P(N,R)};xe(T,N=>{u(a)&&N(D)})}var L=se(T,2),F=$(L);{var k=N=>{Ou(N,{size:14})},U=N=>{Fu(N,{size:14})};xe(F,N=>{u(l)?N(k):N(U,-1)})}j(L),j(_),Me(()=>{Ii(A,`height: ${u(l)?"100vh":"380px"};`),Dt(_,1,`gap-1 left-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(l)?"opacity-100":""}`),L.disabled=u(a),Qt(L,"title",u(l)?"Exit fullscreen":"Fullscreen")}),Xt("click",L,f),P(E,S)};xe(g,E=>{u(o)?E(v):!u(i)&&e.value?E(y,1):u(i)?E(b,-1):E(w,2)})}j(x),ui(x,E=>W(s,E),()=>u(s)),Me(()=>Dt(x,1,`group rounded relative overflow-hidden border border-border ${u(l)?"bg-background":""}`)),P(n,x),at()}zi(["click"]);var MR=K('<div class="px-4 py-3 text-sm text-destructive"> </div>'),wR=K('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for image...</div>'),ER=K(`<div class="px-4 py-3 text-sm text-destructive">Unsupported image format: <span class="font-mono"> </span>. Supported:
|
|
5019
|
+
.png, .jpg, .jpeg, .webp, .gif, .svg</div>`),TR=K('<button title="Download image" class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button>'),AR=K('<button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background"><!></button>'),CR=K("<div><!> <!></div>"),PR=K('<div class="w-full"><img class="h-full w-full object-contain"/></div> <!>',1),RR=K("<div><!></div>");function DR(n,e){st(e,!0);const t=new Set([".png",".jpg",".jpeg",".webp",".gif",".svg"]),i=O(()=>Array.isArray(e.value)?e.value.find(No)??null:No(e.value)?e.value:null),r=O(()=>u(i)?(u(i).fileType??"").toLowerCase():""),s=O(()=>t.has(u(r))),a=O(()=>{if(!u(i)||!u(s))return null;const A=Kg[u(r)]??"application/octet-stream";return u(i).isBase64Encoded?`data:${A};base64,${u(i).data}`:`data:${A};utf8,${encodeURIComponent(u(i).data)}`}),o=O(()=>e.item.config??{}),l=O(()=>u(o).allowDownload??!0),c=O(()=>u(o).allowFullscreen??!0),d=O(()=>u(o).backgroundColor);let f=Fe(null),h=Fe(!1),p=Fe(!1),m=Fe(null);function x(){u(f)&&(document.fullscreenElement?document.exitFullscreen().catch(A=>{W(m,`Exit fullscreen failed: ${A.message}`)}):u(f).requestFullscreen().catch(A=>{W(m,`Fullscreen unavailable: ${A.message}`)}))}Pt(()=>{function A(){W(h,!!document.fullscreenElement)}return document.addEventListener("fullscreenchange",A),()=>document.removeEventListener("fullscreenchange",A)});async function g(){if(u(i)){W(p,!0),W(m,null);try{await gc(u(i),u(i).fileName)}catch(A){W(m,A instanceof Error?A.message:"Download failed",!0)}finally{W(p,!1)}}}var v=RR(),y=$(v);{var w=A=>{var _=MR(),T=$(_,!0);j(_),Me(()=>Ae(T,u(m))),P(A,_)},b=A=>{var _=wR();P(A,_)},E=A=>{var _=ER(),T=se($(_)),D=$(T,!0);j(T),yt(),j(_),Me(()=>Ae(D,u(r)||"(unknown)")),P(A,_)},S=A=>{var _=PR(),T=Q(_),D=$(T);j(T);var L=se(T,2);{var F=k=>{var U=CR(),N=$(U);{var R=Y=>{var te=TR(),le=$(te);zp(le,{size:14}),j(te),Me(()=>te.disabled=u(p)),Xt("click",te,g),P(Y,te)};xe(N,Y=>{u(l)&&u(i)&&Y(R)})}var z=se(N,2);{var q=Y=>{var te=AR(),le=$(te);{var B=de=>{Ou(de,{size:14})},ee=de=>{Fu(de,{size:14})};xe(le,de=>{u(h)?de(B):de(ee,-1)})}j(te),Me(()=>Qt(te,"title",u(h)?"Exit fullscreen":"Fullscreen")),Xt("click",te,x),P(Y,te)};xe(z,Y=>{u(c)&&Y(q)})}j(U),Me(()=>Dt(U,1,`gap-1 right-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(h)?"opacity-100":""}`)),P(k,U)};xe(L,k=>{(u(l)||u(c))&&k(F)})}Me(()=>{Ii(T,`height: ${u(h)?"100vh":"380px"}; ${u(d)?`background-color: ${u(d)};`:""}`),Qt(D,"src",u(a)),Qt(D,"alt",e.item.displayName??u(i).fileName)}),P(A,_)};xe(y,A=>{u(m)?A(w):u(i)?u(s)?A(S,-1):A(E,2):A(b,1)})}j(v),ui(v,A=>W(f,A),()=>u(f)),Me(()=>Dt(v,1,`group rounded relative overflow-hidden border border-border ${u(h)?"bg-background":""}`)),P(n,v),at()}zi(["click"]);const up=n=>{var e=UR();P(n,e)};var LR=K("<!> <!>",1),IR=K("<!> <!>",1),NR=K('<div class="gap-2 flex items-center"><!> <!></div>'),UR=K('<span class="text-muted-foreground not-italic">Waiting for data...</span>'),FR=K('<div class="ml-4 pl-2 border-l border-border/50"><!></div>'),OR=K('<div><button class="gap-1.5 py-0.5 text-xs flex w-full items-center text-muted-foreground transition-colors hover:text-foreground"><!> <!> <span class="font-medium"> </span></button> <!></div>'),zR=K('<div class="gap-1.5 py-0.5 flex items-center justify-between"><div class="gap-1.5 min-w-0 flex items-center"><!> <span class="text-xs truncate text-foreground"> </span></div> <span class="text-xs shrink-0 text-muted-foreground"> </span></div>'),BR=K('<div class="rounded px-3 py-3 text-sm border border-border bg-muted text-muted-foreground">Waiting for file data...</div>'),kR=K('<div class="gap-2 text-xs flex items-center justify-between text-muted-foreground"><span class="min-w-0 truncate"> </span> <span class="shrink-0"> </span></div>'),VR=K('<div class="gap-1 flex flex-col"></div>'),HR=K('<div class="mt-2"><!></div>'),GR=K('<li class="truncate"><span class="font-mono"> </span></li>'),WR=K('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"><div class="font-medium">Duplicate file names detected</div> <div class="mt-1 text-xs"> </div> <ul class="mt-1 ml-4 text-xs list-disc"></ul> <div class="mt-1 text-xs">Rename outputs in your Grasshopper definition so each file has a unique name.</div></div>'),XR=K('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"> </div>'),jR=K('<div class="gap-2 flex flex-col"><div class="rounded px-3 py-2 border border-border bg-muted"><div class="gap-2 flex items-center justify-between"><span class="min-w-0 text-sm font-medium truncate text-foreground"> </span> <span class="text-xs shrink-0 text-muted-foreground"> </span></div> <!></div> <!> <!> <!></div>'),qR=K('<span class="font-bold text-primary"> </span>'),YR=K("<div><!></div>"),KR=K("<pre> </pre>"),ZR=K("<div><!></div>"),$R=K('<div class="group relative"><!> <!></div>'),JR=K('<div class="gap-2 flex flex-col"><!> <!></div>');function QR(n,e){st(e,!0);const t=U=>{var N=NR(),R=$(N);or(R,{children:(Y,te)=>{yt();var le=Et();Me(()=>Ae(le,u(o))),P(Y,le)},$$slots:{default:!0}});var z=se(R,2);{var q=Y=>{var te=we(),le=Q(te);Ne(le,()=>wr,(B,ee)=>{ee(B,{children:(de,ve)=>{var G=IR(),ie=Q(G);Ne(ie,()=>mc,(ce,pe)=>{pe(ce,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(Se,ze)=>{Hv(Se,{size:16})},$$slots:{default:!0}})});var Z=se(ie,2);Ne(Z,()=>Er,(ce,pe)=>{pe(ce,{class:"sm:max-w-md",children:(Se,ze)=>{var Ue=we(),Pe=Q(Ue);Ne(Pe,()=>ms,(ke,Ie)=>{Ie(ke,{children:(We,Oe)=>{var He=LR(),V=Q(He);Ne(V,()=>dr,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{yt();var C=Et();Me(()=>Ae(C,u(o))),P(ye,C)},$$slots:{default:!0}})});var je=se(V,2);Ne(je,()=>gs,(Ve,Xe)=>{Xe(Ve,{children:(ye,Ce)=>{yt();var C=Et();Me(()=>Ae(C,e.item.description)),P(ye,C)},$$slots:{default:!0}})}),P(We,He)},$$slots:{default:!0}})}),P(Se,Ue)},$$slots:{default:!0}})}),P(de,G)},$$slots:{default:!0}})}),P(Y,te)};xe(z,Y=>{e.item.description&&Y(q)})}j(N),P(U,N)},i=(U,N=wt,R=wt)=>{var z=we(),q=Q(z);Zt(q,17,N,([Y,te])=>Y,(Y,te)=>{var le=O(()=>Mr(u(te),2));let B=()=>u(le)[1];var ee=we(),de=Q(ee);{var ve=ie=>{const Z=O(()=>R()?`${R()}/${B().name}`:B().name),ce=O(()=>_.has(u(Z)));var pe=OR(),Se=$(pe),ze=$(Se);{let V=O(()=>u(ce)?"rotate-90":"");Du(ze,{size:12,get class(){return`shrink-0 transition-transform duration-150 ${u(V)??""}`}})}var Ue=se(ze,2);{var Pe=V=>{Wv(V,{size:13,class:"shrink-0 text-primary/70"})},ke=V=>{Qv(V,{size:13,class:"shrink-0 text-primary/70"})};xe(Ue,V=>{u(ce)?V(Pe):V(ke,-1)})}var Ie=se(Ue,2),We=$(Ie,!0);j(Ie),j(Se);var Oe=se(Se,2);{var He=V=>{var je=FR(),Ve=$(je);i(Ve,()=>B().children,()=>u(Z)),j(je),P(V,je)};xe(Oe,V=>{u(ce)&&V(He)})}j(pe),Me(()=>Ae(We,B().name)),Xt("click",Se,()=>T(u(Z))),P(ie,pe)},G=ie=>{var Z=zR(),ce=$(Z),pe=$(ce);Jv(pe,{size:12,class:"shrink-0 text-muted-foreground"});var Se=se(pe,2),ze=$(Se);j(Se),j(ce);var Ue=se(ce,2),Pe=$(Ue,!0);j(Ue),j(Z),Me(ke=>{Ae(ze,`${B().file.fileName??""}${B().file.fileType??""}`),Ae(Pe,ke)},[()=>_l(xl(B().file.data))]),P(ie,Z)};xe(de,ie=>{B().type==="folder"?ie(ve):ie(G,-1)})}P(Y,ee)}),P(U,z)},r=U=>{var N=we(),R=Q(N);{var z=Y=>{var te=BR();P(Y,te)},q=Y=>{var te=jR(),le=$(te),B=$(le),ee=$(B),de=$(ee,!0);j(ee);var ve=se(ee,2),G=$(ve,!0);j(ve),j(B);var ie=se(B,2);{var Z=Pe=>{var ke=HR(),Ie=$(ke);{var We=He=>{i(He,()=>u(b),()=>"")},Oe=He=>{var V=VR();Zt(V,23,()=>u(m),(je,Ve)=>E(je)+"#"+Ve,(je,Ve)=>{var Xe=kR(),ye=$(Xe),Ce=$(ye);j(ye);var C=se(ye,2),M=$(C,!0);j(C),j(Xe),Me(H=>{Ae(Ce,`${u(Ve).fileName??""}${u(Ve).fileType??""}`),Ae(M,H)},[()=>_l(xl(u(Ve).data))]),P(je,Xe)}),j(V),P(He,V)};xe(Ie,He=>{u(b)?He(We):He(Oe,-1)})}j(ke),P(Pe,ke)};xe(ie,Pe=>{u(x)>1&&Pe(Z)})}j(le);var ce=se(le,2);{var pe=Pe=>{var ke=WR(),Ie=se($(ke),2),We=$(Ie);j(Ie);var Oe=se(Ie,2);Zt(Oe,20,()=>u(S),He=>He,(He,V)=>{var je=GR(),Ve=$(je),Xe=$(Ve,!0);j(Ve),j(je),Me(()=>Ae(Xe,V)),P(He,je)}),j(Oe),yt(2),j(ke),Me(()=>Ae(We,`The following ${u(S).length===1?"path appears":"paths appear"} more than once:`)),P(Pe,ke)};xe(ce,Pe=>{u(A)&&Pe(pe)})}var Se=se(ce,2);{var ze=Pe=>{var ke=XR(),Ie=$(ke,!0);j(ke),Me(()=>Ae(Ie,u(p))),P(Pe,ke)};xe(Se,Pe=>{u(p)&&Pe(ze)})}var Ue=se(Se,2);{let Pe=O(()=>u(h)||u(A));Bn(Ue,{onclick:D,get disabled(){return u(Pe)},class:"w-full",children:(ke,Ie)=>{yt();var We=Et();Me(()=>Ae(We,u(h)?"Downloading...":`Download ${u(x)===1?"File":`${u(x)} Files`}`)),P(ke,We)},$$slots:{default:!0}})}j(te),Me(Pe=>{Ae(de,u(x)===1?`${u(m)[0].fileName}${u(m)[0].fileType}`:`${u(x)} files`),Ae(G,Pe)},[()=>_l(u(g))]),P(Y,te)};xe(R,Y=>{u(x)===0?Y(z):Y(q,-1)})}P(U,N)};let s=Fe(!1),a;const o=O(()=>e.displayName||e.item.displayName||e.item.paramId),l=O(()=>typeof e.value=="object"&&e.value!==null),c=O(()=>e.value==null?"":u(l)?JSON.stringify(e.value,null,2):String(e.value)),d=O(()=>e.value!=null);async function f(){try{await navigator.clipboard.writeText(u(c)),W(s,!0),clearTimeout(a),a=setTimeout(()=>W(s,!1),2e3)}catch(U){console.error("Failed to copy:",U)}}let h=Fe(!1),p=Fe(null);const m=O(()=>e.value?Array.isArray(e.value)?e.value.filter(No):No(e.value)?[e.value]:[]:[]),x=O(()=>u(m).length),g=O(()=>u(m).reduce((U,N)=>U+xl(N.data),0));function v(U){const N=new Fo;for(let R=0;R<U.length;R++){const z=U[R],q=(z.subFolder||"").split("/").filter(Boolean);let Y=N;for(const B of q){Y.has(B)||Y.set(B,{type:"folder",name:B,children:new Fo});const ee=Y.get(B);ee.type==="folder"&&(Y=ee.children)}const te=`${z.fileName}${z.fileType??""}`,le=Y.has(te)?`${te}#${R}`:te;Y.set(le,{type:"file",file:z})}return N}function y(U,N=""){const R=[];for(const[z,q]of U)if(q.type==="folder"){const Y=N?`${N}/${z}`:z;R.push(Y),R.push(...y(q.children,Y))}return R}const w=O(()=>u(m).some(U=>U.subFolder&&U.subFolder.length>0)),b=O(()=>u(w)?v(u(m)):null);function E(U){const N=(U.subFolder||"").replace(/^\/+|\/+$/g,""),R=`${U.fileName}${U.fileType??""}`;return N?`${N}/${R}`:R}const S=O(()=>{const U={};for(const N of u(m)){const R=E(N);U[R]=(U[R]??0)+1}return Object.entries(U).filter(([,N])=>N>1).map(([N])=>N)}),A=O(()=>u(S).length>0);let _=new na;Pt(()=>{if(u(b)){_.clear();for(const U of y(u(b)))_.add(U)}});function T(U){_.has(U)?_.delete(U):_.add(U)}async function D(){if(u(x)!==0){W(h,!0),W(p,null);try{if(u(x)===1)await gc(u(m)[0],u(m)[0].fileName);else{const U=e.displayName?e.displayName.replace(/[^a-z0-9]/gi,"_").toLowerCase():"download";await gc(u(m),U)}}catch(U){W(p,U instanceof Error?U.message:"Failed to download files",!0),console.error("[OutputDisplayWidget] Download error:",U)}finally{W(h,!1)}}}var L=we(),F=Q(L);{var k=U=>{var N=JR(),R=$(N);t(R);var z=se(R,2);{var q=ee=>{{let de=O(()=>typeof e.value=="string"?e.value:e.value!=null?JSON.stringify(e.value):"");SR(ee,{get item(){return e.item},get value(){return u(de)}})}},Y=ee=>{DR(ee,{get item(){return e.item},get value(){return e.value}})},te=ee=>{r(ee)},le=ee=>{var de=YR();Dt(de,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border flex items-center bg-muted/50 wrap-break-word");var ve=$(de);{var G=Z=>{var ce=qR(),pe=$(ce,!0);j(ce),Me(()=>Ae(pe,u(c))),P(Z,ce)},ie=Z=>{up(Z)};xe(ve,Z=>{u(d)?Z(G):Z(ie,-1)})}j(de),P(ee,de)},B=ee=>{var de=$R(),ve=$(de);{var G=pe=>{var Se=KR();Dt(Se,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere max-h-96 overflow-auto bg-muted/10 text-foreground");var ze=$(Se,!0);j(Se),Me(()=>Ae(ze,u(c))),P(pe,Se)},ie=pe=>{var Se=ZR();Dt(Se,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere bg-muted/10 wrap-break-word whitespace-pre-wrap text-foreground");var ze=$(Se);{var Ue=ke=>{var Ie=Et();Me(()=>Ae(Ie,e.value)),P(ke,Ie)},Pe=ke=>{up(ke)};xe(ze,ke=>{u(d)?ke(Ue):ke(Pe,-1)})}j(Se),P(pe,Se)};xe(ve,pe=>{u(l)?pe(G):pe(ie,-1)})}var Z=se(ve,2);{var ce=pe=>{{let Se=O(()=>u(s)?"opacity-100":"opacity-0 group-hover:opacity-100");Bn(pe,{onclick:f,get class(){return`right-2 top-2 absolute transition-opacity ${u(Se)??""}`},size:"sm",children:(ze,Ue)=>{yt();var Pe=Et();Me(()=>Ae(Pe,u(s)?"Copied!":"Copy")),P(ze,Pe)},$$slots:{default:!0}})}};xe(Z,pe=>{u(d)&&pe(ce)})}j(de),P(ee,de)};xe(z,ee=>{e.item.widgetType==="chart"?ee(q):e.item.widgetType==="image"?ee(Y,1):e.item.widgetType==="file"?ee(te,2):e.item.widgetType==="number"?ee(le,3):e.item.widgetType==="text"&&ee(B,4)})}j(N),P(U,N)};xe(F,U=>{e.item.widgetType!=="dynamicValueList"&&U(k)})}P(n,L),at()}zi(["click"]);var e3=K('<div class="gap-8 flex flex-col"></div>'),t3=K('<div class="p-4 tab-content-container svelte-jdukda"><!></div>');function n3(n,e){st(e,!0);const t=(f,h=wt,p=wt)=>{const m=O(()=>o(h().paramId));var x=we(),g=Q(x);{var v=y=>{pR(y,{get item(){return h()},get value(){return e.values[u(m).id]},get displayName(){return h().displayName},get onChange(){return e.onValueChange},get disabled(){return p().disabled},get dynamicOptions(){return a()[u(m).id]}})};xe(g,y=>{u(m)&&y(v)})}P(f,x)},i=(f,h=wt)=>{const p=O(()=>l(h().paramId));var m=we(),x=Q(m);{var g=v=>{QR(v,{get item(){return h()},get value(){return e.values[h().paramId]},get displayName(){return h().displayName}})};xe(x,v=>{u(p)&&v(g)})}P(f,m)},r=Si(),s=O(()=>r.messages);let a=oe(e,"dynamicOptions",19,()=>({}));function o(f){return e.inputs.find(h=>h.id===f)}function l(f){return e.outputs.find(h=>h.id===f)}var c=we(),d=Q(c);Ne(d,()=>Lv,(f,h)=>{h(f,{get value(){return e.tab.id},class:"min-h-0 p-0 flex-1",children:(p,m)=>{gg(p,{class:"h-full",orientation:"vertical",children:(x,g)=>{var v=t3(),y=$(v);{var w=E=>{wu(E,{type:"empty",size:"medium",get message(){return u(s).tabNoGroups}})},b=E=>{var S=e3();Zt(S,21,()=>e.tab.groups,A=>A.id,(A,_)=>{var T=we(),D=Q(T);{var L=k=>{{let U=O(()=>u(_).columns??1),N=O(()=>e.collapsedGroups[u(_).id]??!1),R=O(()=>e.tab.groups.length===1);fP(k,{get label(){return u(_).label},get description(){return u(_).description},get items(){return u(_).items},get columns(){return u(U)},get collapsed(){return u(N)},get values(){return e.values},onToggle:()=>e.onToggleGroup(u(_).id),get inputSnippet(){return t},get outputSnippet(){return i},get flat(){return u(R)}})}},F=O(()=>sP(u(_),e.values));xe(D,k=>{u(F)&&k(L)})}P(A,T)}),j(S),P(E,S)};xe(y,E=>{e.tab.groups.length===0?E(w):E(b,-1)})}j(v),P(x,v)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(n,c),at()}function dp(n){return typeof n=="object"&&n!==null&&("targetInputId"in n||"options"in n)}function i3(n){if(dp(n))return n;let e=n;for(let t=0;t<2&&typeof e=="string";t++){try{e=JSON.parse(e)}catch{return null}if(dp(e))return e}return null}function r3(n){const e=new Map;for(const t of Lg(n)){if(t.type!=="output"||t.widgetType!=="dynamicValueList")continue;const i=t;typeof i.paramId=="string"&&e.set(i.paramId,{id:i.paramId,targetInputId:i.config?.targetInputId})}for(const t of n.outputs??[])t.type==="dynamicValueList"&&e.set(t.id,{id:t.id,targetInputId:t.targetInputId});return[...e.values()]}function s3(n,e){const t={};for(const i of r3(n)){const r=i3(e[i.id]);if(!r)continue;const s=r.targetInputId??i.targetInputId;s&&r.options&&typeof r.options=="object"&&(t[s]=r.options)}return t}var a3=K("<!> <!>",1);function o3(n,e){st(e,!0);let t=oe(e,"requestedTabId",3,null),i=Fe(""),r=Ps({});const s=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(h=>e.panelFilter?e.panelFilter==="right"?h.position==="right":h.position!=="right":!0):[]),a=O(()=>u(s).length>1),o=O(()=>s3(e.schema,e.values));Pt(()=>{t()&&u(s).some(h=>h.id===t())?W(i,t()):u(s).length>0&&!u(i)&&W(i,u(s)[0].id,!0)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};e.schema.layout.tabs.forEach(p=>p.groups.forEach(m=>{m.id in r||(h[m.id]=m.collapsed??!1)})),Object.keys(h).length>0&&Object.assign(r,h)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};u(s).forEach(p=>p.groups.forEach(m=>{const x=Rg(m.items,e.values);m.items.forEach(g=>{if(g.type==="linebreak")return;const{visible:v,disabled:y,defaultValue:w}=x[Qo(g)],b=e.schema.inputs.find(E=>E.id===g.paramId);!b||w===void 0||(!v||y)&&e.values[b.id]!==w&&(h[b.id]=w)})})),Object.keys(h).length>0&&Object.assign(e.values,h)});function l(h){r[h]=!r[h]}function c(h){W(i,h,!0)}var d=we(),f=Q(d);Ne(f,()=>vs,(h,p)=>{p(h,{class:"pt-1 min-h-0 mx-1 flex flex-1 flex-col overflow-hidden",children:(m,x)=>{var g=we(),v=Q(g);Ne(v,()=>Iv,(y,w)=>{w(y,{get value(){return u(i)},class:"gap-0 min-h-0 flex flex-1 flex-col",children:(b,E)=>{var S=a3(),A=Q(S);{var _=D=>{JC(D,{get tabs(){return u(s)},onTabChange:c})};xe(A,D=>{u(a)&&D(_)})}var T=se(A,2);Zt(T,17,()=>u(s),D=>D.id,(D,L)=>{n3(D,{get tab(){return u(L)},get values(){return e.values},get collapsedGroups(){return r},onToggleGroup:l,get onValueChange(){return e.onValueChange},get inputs(){return e.schema.inputs},get outputs(){return e.schema.outputs},get dynamicOptions(){return u(o)}})}),P(b,S)},$$slots:{default:!0}})}),P(m,g)},$$slots:{default:!0}})}),P(n,d),at()}var l3=K('<span class="text-xs font-semibold"> </span>'),c3=K('<span class="text-xs font-semibold"> </span>'),u3=K('<button type="button"><!></button>'),d3=K('<div role="button" tabindex="0"></div>');function hp(n,e){st(e,!0);const t=Si(),i=O(()=>t.messages),r=O(()=>["gap-1 py-2 lg:py-3 lg:flex-col lg:w-auto px-2 lg:px-0","flex w-full shrink-0 flex-row items-center","backdrop-blur-sm bg-background/90 cursor-pointer"].join(" ")),s="w-8 h-8 rounded cursor-pointer flex shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground";var a=d3();Zt(a,21,()=>e.tabs,o=>o.id,(o,l)=>{var c=u3();Dt(c,1,Uo(s));var d=$(c);{var f=p=>{var m=we(),x=Q(m);{var g=w=>{Cg(w,{get icon(){return u(l).icon},class:"h-4 w-4"})},v=O(()=>u(l).icon.includes(":")),y=w=>{var b=l3(),E=$(b,!0);j(b),Me(()=>Ae(E,u(l).icon)),P(w,b)};xe(x,w=>{u(v)?w(g):w(y,-1)})}P(p,m)},h=p=>{var m=c3(),x=$(m,!0);j(m),Me(g=>Ae(x,g),[()=>u(l).label[0]?.toUpperCase()??"?"]),P(p,m)};xe(d,p=>{u(l).icon?p(f):p(h,-1)})}j(c),Me(()=>{Qt(c,"title",u(l).label),Qt(c,"aria-label",u(l).label)}),Xt("click",c,p=>{p.stopPropagation(),e.onTabClick(u(l).id)}),P(o,c)}),j(a),Me(o=>{Dt(a,1,Uo(u(r)),"svelte-17r9ylq"),Ii(a,`--collapsed-w: ${e.collapsedWidth??""}px;`),Qt(a,"aria-label",o)},[()=>u(i).expandSidePanel.replace("{side}",e.side==="left"?u(i).panelSideLeft:u(i).panelSideRight)]),Xt("click",a,function(...o){e.onExpand?.apply(this,o)}),Xt("keydown",a,o=>(o.key==="Enter"||o.key===" ")&&e.onExpand()),P(n,a),at()}zi(["click","keydown"]);function h3(n,e,t){const i=[];for(const r of Dg(n))for(const s of r.items??[]){if(s.type!=="input")continue;const a=e[s.paramId],o=n.inputs.find(l=>l.id===s.paramId);a!==void 0&&o&&i.push({paramId:s.paramId,nickname:o.nickname,displayName:s.displayName||o.nickname,paramType:o.paramType,value:a,groupName:r.label})}return{id:Xv(),name:t.name,description:t.description,timestamp:new Date().toISOString(),schemaId:n.id,documentId:n.documentId??"",projectFileName:n.projectFileName??"",pluginVersion:n.pluginVersion??"",author:t.author,tags:t.tags??[],parameters:i}}function f3(n,e){const t=[];n.documentId!==(e.documentId??"")&&t.push({paramId:"__document__",severity:"error",message:"Document ID mismatch - this state was saved for a different document",details:{expected:e.documentId??"",actual:n.documentId}}),n.schemaId!==e.id&&t.push({paramId:"__schema__",severity:"warning",message:"Schema has changed since this state was saved",details:{expected:e.id,actual:n.schemaId}});for(const r of n.parameters){const s=e.inputs.find(a=>a.id===r.paramId);if(!s){t.push({paramId:r.paramId,severity:"error",message:`Parameter "${r.nickname}" no longer exists in the schema`});continue}s.nickname!==r.nickname&&t.push({paramId:r.paramId,severity:"warning",message:"Parameter nickname changed",details:{expected:r.nickname,actual:s.nickname}})}const i=t.some(r=>r.severity==="error");return{isValid:t.length===0,issues:t,canLoad:!i}}function p3(n,e){const t={};for(const i of n.parameters)e.inputs.some(s=>s.id===i.paramId)&&(t[i.paramId]=i.value);return t}function m3(n,e){const t=f3(n,e);return{values:p3(n,e),issues:t.issues,isValid:t.isValid,canLoad:t.canLoad}}function g3(n){const e=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),t=n.name.replace(/[^a-z0-9]/gi,"_"),i=n.timestamp.split("T")[0].replace(/-/g,"_"),r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=`${t}_${i}.sps`,r.click(),URL.revokeObjectURL(r.href)}async function v3(n){const e=JSON.parse(await n.text());if(!e.id||!e.name||!e.documentId||!e.parameters)throw new Error("Invalid saved state file format");return e}const _3={saveButton:"Save State",loadButton:"Load State",saveDialogTitle:"Save Parameter State",saveDialogDescription:"Save the current parameter values as a .sps file",saveNameLabel:"State Name *",saveNamePlaceholder:"e.g., Design Option A",saveDescriptionLabel:"Description",saveDescriptionPlaceholder:"Optional description of this state",saveAuthorLabel:"Author",saveAuthorPlaceholder:"Your name or email",saveTagsLabel:"Tags",saveTagsPlaceholder:"facade, option-a, client-approved (comma-separated)",saveNameRequired:"Please enter a name for this state",loadDialogTitle:"Load Parameter State",loadDialogDescription:"Select a .sps state file from your drive to load",loadFromFileButton:"Select .sps File",loadEmptyList:"No saved states found",loadImportError:"Failed to import state: ",validationTitle:"State Validation Report",validationValidatingPrefix:"Validating state: ",validationNoIssuesTitle:"No Issues Found",validationNoIssuesBody:"This state can be loaded safely.",validationWarningsTitle:"Warnings Detected",validationWarningsBody:"{count} warning(s) found, but state can still be loaded.",validationErrorsTitle:"Critical Errors",validationErrorsBody:"Cannot load this state due to critical incompatibilities.",validationIssuesHeading:"Issues:",validationExpected:"Expected:",validationActual:"Actual:",cancelButton:"Cancel",loadAnywayButton:"Load Anyway"};var x3=K("<!> ",1),b3=K("<!> ",1),y3=K("<!> ",1),S3=K("<!> <!>",1),M3=K("<!> <!>",1),w3=K('<!> <div class="gap-4 py-4 grid"><div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div></div> <!>',1),E3=K("<!> <!>",1),T3=K('<p class="text-sm py-8 text-center text-muted-foreground">…</p>'),A3=K('<p class="text-sm py-8 text-center text-destructive"> </p>'),C3=K('<p class="text-sm py-8 text-center text-muted-foreground"> </p>'),P3=K('<div class="text-xs mt-0.5 text-muted-foreground"> </div>'),R3=K('<button type="button" class="p-3 w-full rounded-lg border text-left transition-colors hover:bg-muted"><div class="text-sm font-medium"> </div> <!> <div class="text-xs mt-1 text-muted-foreground"> </div></button>'),D3=K('<div class="space-y-2"></div>'),L3=K('<div class="py-4 max-h-[60vh] overflow-y-auto"><!></div>'),I3=K("<!> ",1),N3=K('<div class="py-8"><!></div>'),U3=K("<!> <!> <!>",1),F3=K("<!> <!>",1),O3=K('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-success-foreground"> </h4> <p class="text-sm mt-1 text-success-foreground/80"> </p></div></div>'),z3=K('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-warning-foreground"> </h4> <p class="text-sm mt-1 text-warning-foreground/80"> </p></div></div>'),B3=K('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-destructive"> </h4> <p class="text-sm mt-1 text-destructive/80"> </p></div></div>'),k3=K('<p class="text-xs mt-1 text-muted-foreground"> </p>'),V3=K('<div><div class="gap-2 flex items-start"><!> <div class="flex-1"><p class="text-sm font-medium"> </p> <!></div></div></div>'),H3=K('<div class="space-y-2"><h4 class="text-sm font-medium"> </h4> <!></div>'),G3=K('<div class="gap-4 py-4 grid"><!> <!></div>'),W3=K("<!> <!>",1),X3=K("<!> <!> <!>",1),j3=K('<!> <!> <!> <input type="file" accept=".sps" class="hidden"/> <!> <!> <!>',1);function q3(n,e){st(e,!0);let t=oe(e,"showSaveButton",3,!0),i=oe(e,"showLoadButton",3,!0),r=oe(e,"actions",19,()=>[]);const s=O(()=>({..._3,...e.labels}));let a=Fe(!1),o=Fe(""),l=Fe(""),c=Fe(""),d=Fe(""),f=Fe(!1),h=Fe(!1),p=Fe(null),m=Fe(""),x=Fe(null),g=Fe(Ps([])),v=Fe(!1),y=Fe("");function w(){W(o,`State ${new Date().toLocaleDateString()}`),W(l,""),W(c,e.schema.author||"",!0),W(d,""),W(a,!0)}async function b(){if(!u(o).trim()){alert(u(s).saveNameRequired);return}const B=h3(e.schema,e.currentValues,{name:u(o).trim(),description:u(l).trim()||void 0,author:u(c).trim()||void 0,tags:u(d).split(",").map(ee=>ee.trim()).filter(ee=>ee.length>0)});e.onSaveState?await e.onSaveState(B):g3(B),W(a,!1)}function E(B){const ee=m3(B,e.schema);ee.isValid?e.onLoadValues(ee.values):(W(p,ee,!0),W(m,B.name,!0),W(f,!0))}async function S(B){const ee=B.target;if(!(!ee.files||ee.files.length===0)){try{const de=await v3(ee.files[0]);E(de)}catch(de){alert(u(s).loadImportError+de.message)}ee.value=""}}function A(){!u(p)||!u(p).canLoad||(e.onLoadValues(u(p).values),W(f,!1),W(p,null))}function _(){W(f,!1),W(p,null)}async function T(){if(W(h,!0),!!e.onListStates){W(v,!0),W(y,""),W(g,[],!0);try{W(g,await e.onListStates(),!0)}catch(B){W(y,B.message,!0)}finally{W(v,!1)}}}function D(){u(x)?.click(),W(h,!1)}function L(B){E(B),W(h,!1)}var F=j3(),k=Q(F);{var U=B=>{Bn(B,{variant:"default",size:"sm",onclick:w,children:(ee,de)=>{var ve=x3(),G=Q(ve);zp(G,{class:"mr-2 h-4 w-4"});var ie=se(G);Me(()=>Ae(ie,` ${u(s).saveButton??""}`)),P(ee,ve)},$$slots:{default:!0}})};xe(k,B=>{t()&&B(U)})}var N=se(k,2);{var R=B=>{Bn(B,{variant:"outline",size:"sm",onclick:T,children:(ee,de)=>{var ve=b3(),G=Q(ve);oh(G,{class:"mr-2 h-4 w-4"});var ie=se(G);Me(()=>Ae(ie,` ${u(s).loadButton??""}`)),P(ee,ve)},$$slots:{default:!0}})};xe(N,B=>{i()&&B(R)})}var z=se(N,2);Zt(z,17,r,B=>B.id,(B,ee)=>{{let de=O(()=>u(ee).variant??"outline"),ve=O(()=>u(ee).size??"sm");Bn(B,{get variant(){return u(de)},get size(){return u(ve)},get onclick(){return u(ee).onclick},children:(G,ie)=>{var Z=y3(),ce=Q(Z);{var pe=ze=>{const Ue=O(()=>u(ee).icon);var Pe=we(),ke=Q(Pe);Ne(ke,()=>u(Ue),(Ie,We)=>{We(Ie,{class:"mr-2 h-4 w-4"})}),P(ze,Pe)};xe(ce,ze=>{u(ee).icon&&ze(pe)})}var Se=se(ce);Me(()=>Ae(Se,` ${u(ee).label??""}`)),P(G,Z)},$$slots:{default:!0}})}});var q=se(z,2);ui(q,B=>W(x,B),()=>u(x));var Y=se(q,2);Ne(Y,()=>wr,(B,ee)=>{ee(B,{get open(){return u(a)},set open(de){W(a,de,!0)},children:(de,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,ce)=>{ce(Z,{children:(pe,Se)=>{var ze=w3(),Ue=Q(ze);Ne(Ue,()=>ms,(H,re)=>{re(H,{children:(ue,be)=>{var ge=S3(),ae=Q(ge);Ne(ae,()=>dr,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogTitle)),P(Ee,et)},$$slots:{default:!0}})});var fe=se(ae,2);Ne(fe,()=>gs,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogDescription)),P(Ee,et)},$$slots:{default:!0}})}),P(ue,ge)},$$slots:{default:!0}})});var Pe=se(Ue,2),ke=$(Pe),Ie=$(ke);or(Ie,{for:"export-name",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveNameLabel)),P(H,ue)},$$slots:{default:!0}});var We=se(Ie,2);_s(We,{id:"export-name",get placeholder(){return u(s).saveNamePlaceholder},get value(){return u(o)},set value(H){W(o,H,!0)}}),j(ke);var Oe=se(ke,2),He=$(Oe);or(He,{for:"export-description",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveDescriptionLabel)),P(H,ue)},$$slots:{default:!0}});var V=se(He,2);Nv(V,{id:"export-description",get placeholder(){return u(s).saveDescriptionPlaceholder},rows:3,get value(){return u(l)},set value(H){W(l,H,!0)}}),j(Oe);var je=se(Oe,2),Ve=$(je);or(Ve,{for:"export-author",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveAuthorLabel)),P(H,ue)},$$slots:{default:!0}});var Xe=se(Ve,2);_s(Xe,{id:"export-author",get placeholder(){return u(s).saveAuthorPlaceholder},get value(){return u(c)},set value(H){W(c,H,!0)}}),j(je);var ye=se(je,2),Ce=$(ye);or(Ce,{for:"export-tags",children:(H,re)=>{yt();var ue=Et();Me(()=>Ae(ue,u(s).saveTagsLabel)),P(H,ue)},$$slots:{default:!0}});var C=se(Ce,2);_s(C,{id:"export-tags",get placeholder(){return u(s).saveTagsPlaceholder},get value(){return u(d)},set value(H){W(d,H,!0)}}),j(ye),j(Pe);var M=se(Pe,2);Ne(M,()=>yl,(H,re)=>{re(H,{children:(ue,be)=>{var ge=M3(),ae=Q(ge);Bn(ae,{variant:"outline",onclick:()=>W(a,!1),children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).cancelButton)),P(Re,Ee)},$$slots:{default:!0}});var fe=se(ae,2);Bn(fe,{onclick:b,children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).saveButton)),P(Re,Ee)},$$slots:{default:!0}}),P(ue,ge)},$$slots:{default:!0}})}),P(pe,ze)},$$slots:{default:!0}})}),P(de,G)},$$slots:{default:!0}})});var te=se(Y,2);Ne(te,()=>wr,(B,ee)=>{ee(B,{get open(){return u(h)},set open(de){W(h,de,!0)},children:(de,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,ce)=>{ce(Z,{children:(pe,Se)=>{var ze=U3(),Ue=Q(ze);Ne(Ue,()=>ms,(Oe,He)=>{He(Oe,{children:(V,je)=>{var Ve=E3(),Xe=Q(Ve);Ne(Xe,()=>dr,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogTitle)),P(M,re)},$$slots:{default:!0}})});var ye=se(Xe,2);Ne(ye,()=>gs,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogDescription)),P(M,re)},$$slots:{default:!0}})}),P(V,Ve)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=Oe=>{var He=L3(),V=$(He);{var je=Ce=>{var C=T3();P(Ce,C)},Ve=Ce=>{var C=A3(),M=$(C,!0);j(C),Me(()=>Ae(M,u(y))),P(Ce,C)},Xe=Ce=>{var C=C3(),M=$(C,!0);j(C),Me(()=>Ae(M,u(s).loadEmptyList)),P(Ce,C)},ye=Ce=>{var C=D3();Zt(C,21,()=>u(g),M=>M.id,(M,H)=>{var re=R3(),ue=$(re),be=$(ue,!0);j(ue);var ge=se(ue,2);{var ae=Le=>{var Ee=P3(),De=$(Ee,!0);j(Ee),Me(()=>Ae(De,u(H).description)),P(Le,Ee)};xe(ge,Le=>{u(H).description&&Le(ae)})}var fe=se(ge,2),Re=$(fe,!0);j(fe),j(re),Me(Le=>{Ae(be,u(H).name),Ae(Re,Le)},[()=>new Date(u(H).timestamp).toLocaleString()]),Xt("click",re,()=>L(u(H))),P(M,re)}),j(C),P(Ce,C)};xe(V,Ce=>{u(v)?Ce(je):u(y)?Ce(Ve,1):u(g).length===0?Ce(Xe,2):Ce(ye,-1)})}j(He),P(Oe,He)},Ie=Oe=>{var He=N3(),V=$(He);Bn(V,{onclick:D,class:"w-full",size:"lg",children:(je,Ve)=>{var Xe=I3(),ye=Q(Xe);oh(ye,{class:"mr-2 h-4 w-4"});var Ce=se(ye);Me(()=>Ae(Ce,` ${u(s).loadFromFileButton??""}`)),P(je,Xe)},$$slots:{default:!0}}),j(He),P(Oe,He)};xe(Pe,Oe=>{e.onListStates?Oe(ke):Oe(Ie,-1)})}var We=se(Pe,2);Ne(We,()=>yl,(Oe,He)=>{He(Oe,{children:(V,je)=>{Bn(V,{variant:"outline",onclick:()=>W(h,!1),children:(Ve,Xe)=>{yt();var ye=Et();Me(()=>Ae(ye,u(s).cancelButton)),P(Ve,ye)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(pe,ze)},$$slots:{default:!0}})}),P(de,G)},$$slots:{default:!0}})});var le=se(te,2);Ne(le,()=>wr,(B,ee)=>{ee(B,{get open(){return u(f)},set open(de){W(f,de,!0)},children:(de,ve)=>{var G=we(),ie=Q(G);Ne(ie,()=>Er,(Z,ce)=>{ce(Z,{class:"max-w-2xl max-h-[80vh] overflow-y-auto",children:(pe,Se)=>{var ze=X3(),Ue=Q(ze);Ne(Ue,()=>ms,(We,Oe)=>{Oe(We,{children:(He,V)=>{var je=F3(),Ve=Q(je);Ne(Ve,()=>dr,(ye,Ce)=>{Ce(ye,{children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).validationTitle)),P(C,H)},$$slots:{default:!0}})});var Xe=se(Ve,2);Ne(Xe,()=>gs,(ye,Ce)=>{Ce(ye,{children:(C,M)=>{var H=we(),re=Q(H);{var ue=be=>{var ge=Et();Me(()=>Ae(ge,`${u(s).validationValidatingPrefix??""}${u(m)??""}`)),P(be,ge)};xe(re,be=>{u(m)&&be(ue)})}P(C,H)},$$slots:{default:!0}})}),P(He,je)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=We=>{var Oe=G3(),He=$(Oe);{var V=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-success/30 bg-success/5",children:(ue,be)=>{var ge=O3(),ae=$(ge);$v(ae,{class:"h-5 w-5 text-success"});var fe=se(ae,2),Re=$(fe),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(fe),j(ge),Me(()=>{Ae(Le,u(s).validationNoIssuesTitle),Ae(De,u(s).validationNoIssuesBody)}),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)},je=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-warning/30 bg-warning/5",children:(ue,be)=>{var ge=z3(),ae=$(ge);yo(ae,{class:"h-5 w-5 text-warning"});var fe=se(ae,2),Re=$(fe),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(fe),j(ge),Me(et=>{Ae(Le,u(s).validationWarningsTitle),Ae(De,et)},[()=>u(s).validationWarningsBody.replace("{count}",String(u(p).issues.length))]),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)},Ve=Ce=>{var C=we(),M=Q(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-destructive/30 bg-destructive/5",children:(ue,be)=>{var ge=B3(),ae=$(ge);yo(ae,{class:"h-5 w-5 text-destructive"});var fe=se(ae,2),Re=$(fe),Le=$(Re,!0);j(Re);var Ee=se(Re,2),De=$(Ee,!0);j(Ee),j(fe),j(ge),Me(()=>{Ae(Le,u(s).validationErrorsTitle),Ae(De,u(s).validationErrorsBody)}),P(ue,ge)},$$slots:{default:!0}})}),P(Ce,C)};xe(He,Ce=>{u(p).isValid?Ce(V):u(p).canLoad?Ce(je,1):Ce(Ve,-1)})}var Xe=se(He,2);{var ye=Ce=>{var C=H3(),M=$(C),H=$(M,!0);j(M);var re=se(M,2);Zt(re,17,()=>u(p).issues,ue=>ue.message,(ue,be)=>{var ge=V3(),ae=$(ge),fe=$(ae);{let Ye=O(()=>u(be).severity==="error"?"text-destructive":"text-warning");yo(fe,{get class(){return`h-4 w-4 mt-0.5 ${u(Ye)??""}`}})}var Re=se(fe,2),Le=$(Re),Ee=$(Le,!0);j(Le);var De=se(Le,2);{var et=Ye=>{var ht=k3(),J=$(ht);j(ht),Me(()=>Ae(J,`${u(s).validationExpected??""}
|
|
5020
5020
|
${u(be).details.expected??""} → ${u(s).validationActual??""}
|
|
5021
|
-
${u(be).details.actual??""}`)),P(Ye,ht)};xe(De,Ye=>{u(be).details&&Ye(et)})}j(Re),j(ae),j(ge),Me(()=>{Dt(ge,1,`p-3 rounded-lg border ${u(be).severity==="error"?"border-destructive/30 bg-destructive/5":"border-warning/30 bg-warning/5"}`),Ae(Ee,u(be).message)}),P(ue,ge)}),j(C),Me(()=>Ae(H,u(s).validationIssuesHeading)),P(Ce,C)};xe(Xe,Ce=>{u(p).isValid||Ce(ye)})}j(Oe),P(We,Oe)};xe(Pe,We=>{u(p)&&We(ke)})}var Ie=se(Pe,2);Ne(Ie,()=>yl,(We,Oe)=>{Oe(We,{children:(He,k)=>{var je=W3(),Ve=Q(je);Bn(Ve,{variant:"outline",onclick:_,children:(Ce,C)=>{yt();var M=Et();Me(()=>Ae(M,u(s).cancelButton)),P(Ce,M)},$$slots:{default:!0}});var Xe=se(Ve,2);{var ye=Ce=>{Bn(Ce,{onclick:A,children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).loadAnywayButton)),P(C,H)},$$slots:{default:!0}})};xe(Xe,Ce=>{u(p)?.canLoad&&Ce(ye)})}P(He,je)},$$slots:{default:!0}})}),P(fe,ze)},$$slots:{default:!0}})}),P(me,G)},$$slots:{default:!0}})}),Xt("change",Y,S),P(n,F),at()}zi(["change","click"]);var Y3=q("<!> ",1),K3=q('<div class="panel-footer px-3 svelte-1txzu1i"><div class="gap-2 flex flex-wrap items-center justify-center"><!> <!></div> <!></div>'),Z3=q('<div class="panel-content-wrapper svelte-1txzu1i"><!> <!></div>'),$3=q('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),J3=q('<div class="drawer-footer svelte-1txzu1i"><!></div>'),Q3=q('<div class="min-h-0 flex flex-1 flex-col"><!></div> <div style="z-index: 40;"><button class="drawer-handle-bar svelte-1txzu1i"><div class="drawer-pill svelte-1txzu1i"></div> <span class="text-sm font-medium ml-2 text-foreground"> </span> <!></button> <div class="drawer-content svelte-1txzu1i"><div class="px-3 pb-6"><!> <!></div></div> <!></div>',1),eD=q('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),tD=q('<div class="drawer-footer svelte-1txzu1i"><!></div>'),nD=q('<div class="flex flex-1 flex-col overflow-hidden"><div class="px-3 pt-3 flex-1 overflow-y-auto"><!> <!></div> <!></div>'),iD=q('<div class="min-h-0 flex h-full flex-1 justify-center"><div class="min-h-0 flex h-full w-4/5 flex-col"><!></div></div>'),rD=q("<div><!></div>"),sD=q("<!> <!>",1),aD=q("<div><!></div>"),oD=q("<!> <!>",1),lD=q("<!> <!> <!>",1),cD=q('<div class="min-h-0 flex h-full flex-1"><!> <!> <!></div>'),uD=q('<div data-layout-root=""><!></div> <!>',1);function dD(n,e){st(e,!0);const t=(le,fe=wt,Se=wt,ze,Ue)=>{let Pe=th(()=>nh(ze?.(),!0)),ke=th(()=>nh(Ue?.(),!0));var Ie=Z3(),We=$(Ie);{var Oe=je=>{o3(je,{get schema(){return e.schema},get values(){return e.values},get onValueChange(){return e.onValueChange},get panelFilter(){return fe()},get requestedTabId(){return Se()}})};xe(We,je=>{e.schema.layout.type==="tabbed"&&je(Oe)})}var He=se(We,2);{var k=je=>{var Ve=K3(),Xe=$(Ve),ye=$(Xe);{var Ce=re=>{q3(re,{get schema(){return e.schema},get currentValues(){return e.values},onLoadValues:z,get showSaveButton(){return p()},get showLoadButton(){return g()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get labels(){return e.presetLabels}})};xe(ye,re=>{u(Pe)&&re(Ce)})}var C=se(ye,2);Zt(C,17,h,re=>re.id,(re,ue)=>{{let be=O(()=>u(ue).variant??"outline"),ge=O(()=>u(ue).size??"sm");Bn(re,{get variant(){return u(be)},get size(){return u(ge)},get onclick(){return u(ue).onclick},children:(ae,he)=>{var Re=Y3(),Le=Q(Re);{var Ee=et=>{const Ye=O(()=>u(ue).icon);var ht=we(),J=Q(ht);Ne(J,()=>u(Ye),(Ge,Te)=>{Te(Ge,{class:"mr-2 h-4 w-4"})}),P(et,ht)};xe(Le,et=>{u(ue).icon&&et(Ee)})}var De=se(Le);Me(()=>Ae(De,` ${u(ue).label??""}`)),P(ae,Re)},$$slots:{default:!0}})}}),j(Xe);var M=se(Xe,2);{var H=re=>{dc(re,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}})};xe(M,re=>{!u(A)&&u(ke)&&e.schema.instanceSolve===!1&&re(H)})}j(Ve),P(je,Ve)};xe(He,je=>{(u(Pe)||!u(A)&&u(ke)&&e.schema.instanceSolve===!1)&&je(k)})}j(Ie),P(le,Ie)},i=Si(),r=O(()=>i.messages),s=48;let a=oe(e,"meshes",19,()=>[]),o=oe(e,"showSolvingIndicator",3,!1),l=oe(e,"hasPendingChanges",3,!1),c=oe(e,"hasNeverSolved",3,!1),d=oe(e,"isViewerFullscreen",15,!1),f=oe(e,"oncalculate",3,()=>{}),h=oe(e,"panelActions",19,()=>[]),p=oe(e,"showSaveButton",3,!0),g=oe(e,"showLoadButton",3,!0),x=oe(e,"viewerConfig",19,()=>({}));const m=O(()=>!!(e.schema?.viewerOptions?.enableLocal||e.schema?.viewerOptions?.enableRemote)),v=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(le=>le.position!=="right"):[]),y=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(le=>le.position==="right"):[]),w=O(()=>u(v).length>0),b=O(()=>u(y).length>0),E=O(()=>u(m)||u(b)),S=O(()=>!u(m)&&u(w)&&u(b));let A=Fe(!1),_=Fe(!1);const T=O(()=>u(v)[0]?.label??u(r).parametersTab);Pt(()=>{const le=window.matchMedia("(max-width: 639px)");function fe(){W(A,le.matches,!0)}return fe(),le.addEventListener("change",fe),()=>le.removeEventListener("change",fe)});let D=Fe(!1),L=Fe(!1),F=Fe(null),B=Fe(null),U=Fe(null),N=Fe(null);const R=O(()=>`${u(w)?"L":""}${u(m)?"V":""}${u(b)?"R":""}`);async function z(le){Object.assign(e.values,le),await e.onLoadValues?.(le)}let Y=0;function K(le){Y=le.touches[0].clientY}function ne(le){const fe=le.changedTouches[0].clientY-Y;Math.abs(fe)>40&&W(_,fe<0)}var ce=uD(),V=Q(ce);let ee;var me=$(V);{var ve=le=>{var fe=we(),Se=Q(fe);{var ze=Pe=>{var ke=Q3(),Ie=Q(ke),We=$(Ie);{let ge=O(()=>({...x(),backgroundColor:e.schema?.viewerOptions?.backgroundColor,showSceneManager:!1}));Yf(We,{get meshes(){return a()},get isSolving(){return e.isSolving},get isBlurred(){return u(_)},get drawerOpen(){return u(_)},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(ge)},get isFullscreen(){return d()},set isFullscreen(ae){d(ae)}})}j(Ie);var Oe=se(Ie,2);let He;var k=$(Oe),je=se($(k),2),Ve=$(je,!0);j(je);var Xe=se(je,2);{let ge=O(()=>u(_)?"":"rotate-180");jv(Xe,{size:16,get class(){return`ml-auto text-muted-foreground transition-transform duration-300 ${u(ge)??""}`}})}j(k);var ye=se(k,2),Ce=$(ye),C=$(Ce);{var M=ge=>{t(ge,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(C,ge=>{u(w)&&ge(M)})}var H=se(C,2);{var re=ge=>{var ae=$3(),he=Q(ae),Re=se($(he),2),Le=$(Re,!0);j(Re),yt(2),j(he);var Ee=se(he,2);t(Ee,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(Le,u(y)[0]?.label??u(r).moreTab)),P(ge,ae)};xe(H,ge=>{u(b)&&ge(re)})}j(Ce),j(ye);var ue=se(ye,2);{var be=ge=>{var ae=J3(),he=$(ae);dc(he,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),j(ae),P(ge,ae)};xe(ue,ge=>{e.schema.instanceSolve===!1&&ge(be)})}j(Oe),Me(()=>{He=Dt(Oe,1,"drawer-container svelte-1txzu1i",null,He,{"drawer-open":u(_),"drawer-closed":!u(_)}),Qt(k,"aria-label",u(_)?u(r).collapsePanel:u(r).expandPanel),Qt(k,"aria-expanded",u(_)),Ae(Ve,u(T))}),Xt("click",k,()=>W(_,!u(_))),Xt("touchstart",k,K),Xt("touchend",k,ne),P(Pe,ke)},Ue=Pe=>{var ke=nD(),Ie=$(ke),We=$(Ie);{var Oe=Xe=>{t(Xe,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(We,Xe=>{u(w)&&Xe(Oe)})}var He=se(We,2);{var k=Xe=>{var ye=eD(),Ce=Q(ye),C=se($(Ce),2),M=$(C,!0);j(C),yt(2),j(Ce);var H=se(Ce,2);t(H,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(M,u(y)[0]?.label??u(r).moreTab)),P(Xe,ye)};xe(He,Xe=>{u(b)&&Xe(k)})}j(Ie);var je=se(Ie,2);{var Ve=Xe=>{var ye=tD(),Ce=$(ye);dc(Ce,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),j(ye),P(Xe,ye)};xe(je,Xe=>{e.schema.instanceSolve===!1&&Xe(Ve)})}j(ke),P(Pe,ke)};xe(Se,Pe=>{u(m)?Pe(ze):Pe(Ue,-1)})}P(le,fe)},G=le=>{var fe=iD(),Se=$(fe),ze=$(Se);t(ze,()=>u(b)?"right":void 0,()=>u(b)?u(N):u(U),()=>!u(b),()=>!u(b)),j(Se),j(fe),P(le,fe)},ie=le=>{var fe=cD(),Se=$(fe);{var ze=Ie=>{hp(Ie,{side:"left",get tabs(){return u(v)},collapsedWidth:s,onExpand:()=>u(F)?.expand(),onTabClick:We=>{W(U,We,!0),u(F)?.expand()}})};xe(Se,Ie=>{u(D)&&u(E)&&u(w)&&Ie(ze)})}var Ue=se(Se,2);Ne(Ue,()=>mg,(Ie,We)=>{We(Ie,{direction:"horizontal",get autoSaveId(){return`selva-layout-${u(R)??""}`},class:"min-h-0 flex-1",children:(Oe,He)=>{var k=lD(),je=Q(k);{var Ve=M=>{var H=sD(),re=Q(H);{let be=O(()=>u(S)?50:u(m)&&u(b)?22:30);Ne(re,()=>sa,(ge,ae)=>{ui(ae(ge,{order:1,get defaultSize(){return u(be)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(D,!0),onExpand:()=>W(D,!1),class:"ml-1",children:(he,Re)=>{var Le=rD(),Ee=$(Le);t(Ee,()=>u(b)?"left":void 0,()=>u(U)),j(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(D)?"hidden":""}`)),P(he,Le)},$$slots:{default:!0}}),he=>W(F,he,!0),()=>u(F))})}var ue=se(re,2);Ne(ue,()=>xu,(be,ge)=>{ge(be,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(D)},onclick:()=>{u(D)&&u(F)?.expand()}})}),P(M,H)};xe(je,M=>{u(w)&&M(Ve)})}var Xe=se(je,2);{var ye=M=>{var H=we(),re=Q(H);Ne(re,()=>sa,(ue,be)=>{be(ue,{order:2,minSize:20,class:"min-h-0 mx-1 flex flex-col",children:(ge,ae)=>{{let he=O(()=>({backgroundColor:e.schema?.viewerOptions?.backgroundColor}));Yf(ge,{get meshes(){return a()},get isSolving(){return e.isSolving},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(he)},get isFullscreen(){return d()},set isFullscreen(Re){d(Re)}})}},$$slots:{default:!0}})}),P(M,H)};xe(Xe,M=>{u(m)&&M(ye)})}var Ce=se(Xe,2);{var C=M=>{var H=oD(),re=Q(H);Ne(re,()=>xu,(be,ge)=>{ge(be,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(L)},onclick:()=>{u(L)&&u(B)?.expand()}})});var ue=se(re,2);{let be=O(()=>u(S)?50:25);Ne(ue,()=>sa,(ge,ae)=>{ui(ae(ge,{order:3,get defaultSize(){return u(be)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(L,!0),onExpand:()=>W(L,!1),class:"mr-1",children:(he,Re)=>{var Le=aD(),Ee=$(Le);t(Ee,()=>"right",()=>u(N),()=>!u(w),()=>!u(w)),j(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(L)?"hidden":""}`)),P(he,Le)},$$slots:{default:!0}}),he=>W(B,he,!0),()=>u(B))})}P(M,H)};xe(Ce,M=>{u(b)&&M(C)})}P(Oe,k)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=Ie=>{hp(Ie,{side:"right",get tabs(){return u(y)},collapsedWidth:s,onExpand:()=>u(B)?.expand(),onTabClick:We=>{W(N,We,!0),u(B)?.expand()}})};xe(Pe,Ie=>{u(L)&&u(b)&&Ie(ke)})}j(fe),P(le,fe)};xe(me,le=>{u(A)?le(ve):!u(m)&&!u(S)&&u(w)!==u(b)?le(G,1):le(ie,-1)})}j(V);var Z=se(V,2);V2(Z,{get show(){return o()}}),Me(()=>ee=Dt(V,1,`min-h-0 sm:flex-row sm:py-(--page-py) flex flex-1 flex-col overflow-hidden ${u(D)?"sm:pl-0":"sm:pl-(--page-px)"} ${u(L)?"sm:pr-0":"sm:pr-(--page-px)"}`,"svelte-1txzu1i",ee,{"fullscreen-layout":d(),relative:u(A)})),P(n,ce),at()}zi(["click","touchstart","touchend"]);function hD(n){const{FAST_THRESHOLD_MS:e,SLOW_THRESHOLD_MS:t,HISTORY_SIZE:i,ANIMATION_DELAY:r}=us.SOLVING_INDICATOR;let s=Fe(!1),a=null,o=null;const l=[];return Pt(()=>{const c=n();return wn(()=>{if(c){o=performance.now();const d=l.length===0?1/0:l.reduce((h,p)=>h+p,0)/l.length;if(l.length>0&&d<e)return;const f=d===1/0||d>=t?0:(d-e)/(t-e)*r;a||(f===0?W(s,!0):a=setTimeout(()=>{W(s,!0),a=null},f))}else o!==null&&(l.push(performance.now()-o),l.length>i&&l.shift(),o=null),a&&(clearTimeout(a),a=null),W(s,!1)}),()=>{a&&clearTimeout(a)}}),{get show(){return u(s)}}}const fD="external";function pD(n,e){return`${fD}:${n}:${e}`}function fp(n){const{scopeKey:e,inputId:t}=n;if(!e||!t||typeof sessionStorage>"u")return;const i=sessionStorage.getItem(pD(e,t));if(i!==null)try{return JSON.parse(i)}catch{return}}function mD(n){return xP(n).filter(e=>e.source?.kind==="client").map(e=>({paramId:e.paramId,displayName:e.displayName??e.paramId}))}const gD=6e4;function vD(n,e={}){const{timeout:t=gD}=e;let i=Fe(!1),r=Fe(null),s=null;function a(){s?.abort(),s=null}async function o(d){a(),s=new AbortController;const{signal:f}=s,h=setTimeout(()=>s?.abort(),t);W(i,!0);try{await n(d,f)}catch(p){(!(p instanceof Error)||p.name!=="AbortError"&&p.name!=="TimeoutError")&&console.error("[computeThrottle] unhandled error in computeFn:",p)}finally{if(clearTimeout(h),W(i,!1),s=null,u(r)!==null){const p=u(r);W(r,null),o(p)}}}function l(d){u(i)?W(r,d,!0):o(d)}function c(){W(r,null),a()}return{trigger:l,get isComputing(){return u(i)},get hasPending(){return u(r)!==null},cancel:c}}function _D(n){switch(n){case"number":case"integer":return 0;case"boolean":return!1;case"text":return"";default:return null}}function pp(n,e,t){const i=new Set(mD(n).map(s=>s.paramId)),r={};for(const s of n.inputs){if(i.has(s.id)){const a=t({scopeKey:e,inputId:s.id});a!==void 0&&(r[s.id]=a);continue}r[s.id]=s.default??_D(s.paramType)}for(const s of n.outputs)r[s.id]=null;return r}function mp(n){const e=n===!1;return{hasPendingChanges:e,hasNeverSolved:e}}function xD(n,e,t,i){return n.values[e]=t,i===!1?(n.pendingValues[e]=t,n.hasPendingChanges=!0,{state:n,shouldSolve:!1}):{state:n,shouldSolve:!0}}function bD(n,e){return n.error="",n.computeErrors=e.errors??[],n.computeWarnings=e.warnings??[],n.meshes=e.meshes??[],Object.assign(n.values,e.outputs),n.pendingValues={},n.hasPendingChanges=!1,n.hasNeverSolved=!1,n}function yD(n){let e=n.schema;const t=mp(e?.instanceSolve),i=Ps({values:pp(e,n.scopeKey,fp),error:"",computeErrors:[],computeWarnings:[],meshes:[],pendingValues:{},hasPendingChanges:t.hasPendingChanges,hasNeverSolved:t.hasNeverSolved});function r(){n.driver.solve(Nu(i.values))}return{get values(){return i.values},get error(){return i.error},get computeErrors(){return i.computeErrors},get computeWarnings(){return i.computeWarnings},get meshes(){return i.meshes},get hasPendingChanges(){return i.hasPendingChanges},get hasNeverSolved(){return i.hasNeverSolved},get isSolving(){return n.driver.isSolving},setValue(s,a,o=!1){const{shouldSolve:l}=xD(i,s,a,e?.instanceSolve);(l||o)&&(o&&!l&&(i.pendingValues={},i.hasPendingChanges=!1),r())},solve(){r()},loadValues(s){Object.assign(i.values,s),e?.instanceSolve!==!1?r():i.hasPendingChanges=!0},rebuild(s,a){e=s,i.meshes=[],i.error="",i.computeErrors=[],i.computeWarnings=[],i.pendingValues={},i.values=pp(s,a,fp);const o=mp(s?.instanceSolve);i.hasPendingChanges=o.hasPendingChanges,i.hasNeverSolved=o.hasNeverSolved,s&&Object.keys(i.values).length>0&&s.instanceSolve!==!1&&r()},report(s){bD(i,s)},reportError(s){i.error=s}}}function SD(n,e,t={}){const i=vD(async(r,s)=>{try{const a=await n(r,s);if(s.aborted)return;e().report(a)}catch(a){if(s.aborted)return;e().reportError(a instanceof Error?a.message:String(a))}},t);return{solve(r){i.trigger(r)},cancel(){i.cancel()},get isSolving(){return i.isComputing}}}function MD(n){tl(()=>{const e=Ms(rh);!e||!n.component||e.register(n)}),yp(()=>{try{Ms(rh)?.unregister(n.id)}catch{}})}const wD=n=>{if(!n)return"";const e=n.replace(/^#/,"");if(!/^[0-9A-Fa-f]{6}$/.test(e))return n;const t=parseInt(e.slice(0,2),16)/255,i=parseInt(e.slice(2,4),16)/255,r=parseInt(e.slice(4,6),16)/255,s=b=>b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4),a=s(t),o=s(i),l=s(r),c=a*.4124564+o*.3575761+l*.1804375,d=a*.2126729+o*.7151522+l*.072175,f=a*.0193339+o*.119192+l*.9503041,h=Math.cbrt(.8189330101*c+.3618667424*d-.1288597137*f),p=Math.cbrt(.0329845436*c+.9293118715*d+.0361456387*f),g=Math.cbrt(.0482003018*c+.2643662691*d+.633851707*f),x=.2104542553*h+.793617785*p-.0040720468*g,m=1.9779984951*h-2.428592205*p+.4505937099*g,v=.0259040371*h+.7827717662*p-.808675766*g,y=Math.sqrt(m*m+v*v);let w=Math.atan2(v,m)*180/Math.PI;return w<0&&(w+=360),`oklch(${x.toFixed(3)} ${y.toFixed(3)} ${w.toFixed(1)})`};var ED=q('<div class="min-h-100 p-8 flex items-center justify-center"><!></div>'),TD=q('<div class="min-h-100 flex items-center justify-center"><!></div>'),AD=q("<div><!></div>");function CD(n,e){st(e,!0);let t=oe(e,"definitionKey",3,""),i=oe(e,"showModeToggle",3,!1),r=oe(e,"panelActions",19,()=>[]),s=oe(e,"showSaveButton",3,!0),a=oe(e,"showLoadButton",3,!0),o=oe(e,"footerItemId",3,"footer-item"),l=oe(e,"footerItemPriority",3,0);nR(e.clientSlot);const c=Si();ng(()=>e.lang??c.locale);const d=O(()=>Si().messages),f=O(()=>e.externalScopeKey||t()||e.schema?.id||""),h=SD(e.onSolve,()=>p,{timeout:e.solveTimeoutMs}),p=yD({schema:e.schema,scopeKey:e.externalScopeKey||t()||e.schema?.id||"",driver:h});let g=Fe(!1);const x=hD(()=>p.isSolving);Pt(()=>{e.onReady?.({loadValues:L=>p.loadValues(L)})});let m=Fe(""),v=Fe(!0);Pt(()=>{t(),wn(()=>{u(v)?(W(v,!1),W(m,t()),e.schema?.instanceSolve!==!1&&p.solve()):u(m)!==t()&&(p.rebuild(e.schema,u(f)),W(m,t()))})});function y(L,F,B=!1){p.setValue(L,F,B)}function w(){p.solve()}MD({id:wn(()=>o()),component:wn(()=>e.footerComponent),getProps:()=>e.footerComponentProps?.()??{},position:"left",priority:wn(()=>l())});let b=O(()=>e.isEmbedded??ih.url.searchParams.get("embed")==="true"),E=O(()=>e.primaryColor??ih.url.searchParams.get("primary")),S=O(()=>u(E)?`--primary: ${wD(u(E))}`:""),A=O(()=>e.title??(e.schema?.description||e.schema.name));var _=AD();let T;var D=$(_);{let L=O(()=>!u(b));Zg(D,{mode:"fixed",get showHeader(){return u(L)},showFooter:!0,get title(){return u(A)},get showModeToggle(){return i()},get copyrightName(){return e.copyrightName},get footerText(){return e.footerText},get header(){return e.header},get rightContent(){return e.headerRight},get errors(){return p.computeErrors},get warnings(){return p.computeWarnings},children:(F,B)=>{var U=we(),N=Q(U);{var R=K=>{var ne=ED(),ce=$(ne);wu(ce,{type:"error",size:"medium",get message(){return p.error}}),j(ne),P(K,ne)},z=K=>{var ne=TD(),ce=$(ne);wu(ce,{type:"loading",size:"large",get message(){return u(d).loadingSchema}}),j(ne),P(K,ne)},Y=K=>{var ne=we(),ce=Q(ne);pv(ce,t,V=>{{let ee=O(()=>e.schema.instanceSolve!==!1&&x.show);dD(V,{get schema(){return e.schema},get meshes(){return p.meshes},get isSolving(){return p.isSolving},get showSolvingIndicator(){return u(ee)},get hasPendingChanges(){return p.hasPendingChanges},get hasNeverSolved(){return p.hasNeverSolved},get values(){return p.values},get logoUrl(){return e.logo},get panelActions(){return r()},get showSaveButton(){return s()},get showLoadButton(){return a()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get presetLabels(){return e.presetLabels},onValueChange:y,oncalculate:w,onLoadValues:()=>p.loadValues({}),get isViewerFullscreen(){return u(g)},set isViewerFullscreen(me){W(g,me,!0)}})}}),P(K,ne)};xe(N,K=>{p.error?K(R):e.schema?K(Y,-1):K(z,1)})}P(F,U)},$$slots:{default:!0}})}j(_),Me(()=>T=Ii(_,u(S),T,{display:"contents"})),P(n,_),at()}var PD=q('<div class="text-muted-foreground flex items-center gap-1.5 text-xs"><!> <span> </span></div>');function RD(n,e){var t=we(),i=Q(t);{var r=s=>{var a=PD(),o=$(a);Jg(o,{class:"h-3 w-3"});var l=se(o,2),c=$(l,!0);j(l),j(a),Me(()=>Ae(c,e.label)),P(s,a)};xe(i,s=>{e.label&&s(r)})}P(n,t)}const DD=""+new URL("../assets/rhino3dm.BI8ESrUA.wasm",import.meta.url).href;var LD=q('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase"> </span>'),ID=q('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase">Draft preview</span>'),ND=q("<!> <!>",1);function PL(n,e){st(e,!0);let t=null;function i(){return t||(t=gp(()=>import("../chunks/-xEd7dwr.js").then(a=>a.r),[],import.meta.url).then(a=>{const o=a.default;return o({locateFile:()=>DD})})),t}let r=0;const s=async(a,o)=>{const l=r-Date.now();if(l>0)throw new Error(`Rate limit reached. Try again in ${Math.ceil(l/1e3)}s.`);const c=await fetch("/api/compute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({inputs:e.data.schema.inputs,values:a,definitionUrl:e.data.ghDefinition,...e.data.versionId?{versionId:e.data.versionId}:e.data.channel==="draft"&&{channel:"draft"}}),signal:o});if(o.aborted)return{outputs:{}};if(!c.ok){if(c.status===503)throw new Error("Compute server is offline or unreachable. Please try again later.");if(c.status===429){const m=await c.json().catch(()=>({})),v=Number(c.headers.get("Retry-After"))||Number(m.retryAfter)||5;throw r=Date.now()+v*1e3,new Error(m.message||`Rate limit reached. Try again in ${v}s.`)}const x=await c.json().catch(()=>({}));throw new Error(x.message||"Compute error")}const d=await c.json();if(o.aborted)return{outputs:{}};const f=new w0(d,!1),p=e.data.schema.viewerOptions?.enableLocal||e.data.schema.viewerOptions?.enableRemote?await f.extractMeshesFromResponse({rhino:await i()}):[],g={};for(const x of e.data.schema.outputs){const m=f.getValue({byId:x.id},{parseValues:!0}),v=x.nickname;g[x.id]=m??(v?f.getValue({byName:v},{parseValues:!0}):void 0)}return{outputs:g,meshes:p,errors:d.errors??[],warnings:d.warnings??[]}};{const a=c=>{var d=ND(),f=Q(d);{var h=x=>{var m=LD(),v=$(m);j(m),Me(()=>Ae(v,`v${e.data.versionNumber??""} preview`)),P(x,m)},p=x=>{var m=ID();P(x,m)};xe(f,x=>{e.data.versionId?x(h):e.data.channel==="draft"&&x(p,1)})}var g=se(f,2);$g(g,{}),P(c,d)};let o=O(()=>e.data.schema?.description||e.data.schema.name),l=O(()=>e.data.orgLogoUrl??void 0);CD(n,{get schema(){return e.data.schema},onSolve:s,get definitionKey(){return e.data.currentDefinition},get title(){return u(o)},get logo(){return u(l)},showModeToggle:!0,get solveTimeoutMs(){return e.data.solveTimeoutMs},get footerComponent(){return RD},footerComponentProps:()=>({label:e.data.serverLabel}),headerRight:a,$$slots:{headerRight:!0}})}at()}const UD=Object.freeze(Object.defineProperty({__proto__:null,BINARY_MESH_MAGIC:mu,BINARY_MESH_VERSION:gu,EDGE_USERDATA_KIND:ua,FLAG_FLOAT32:Id,Materials:qm,SCALE_FACTORS:Qm,addEdges:km,applyOffset:Fm,computeCombinedBoundingBox:fl,createCameraController:Om,createGrid:zm,createLabelLayer:Gm,createMeasureTool:Xm,createRenderPipeline:Hm,createViewGizmo:Bm,getThreeMeshesFromComputeResponse:DT,initThree:jm,isEdgeOverlay:Vm,parseBinaryMeshBatch:Nd,parseColor:Um,parseDisplayItems:Ym,parseMeshBatch:Zm,parseMeshBatchBlob:MT,parseMeshBatchObject:$m,removeEdges:TE,snapToVertex:Wm,updateScene:Nm},Symbol.toStringTag,{value:"Module"}));export{PL as component};
|
|
5021
|
+
${u(be).details.actual??""}`)),P(Ye,ht)};xe(De,Ye=>{u(be).details&&Ye(et)})}j(Re),j(ae),j(ge),Me(()=>{Dt(ge,1,`p-3 rounded-lg border ${u(be).severity==="error"?"border-destructive/30 bg-destructive/5":"border-warning/30 bg-warning/5"}`),Ae(Ee,u(be).message)}),P(ue,ge)}),j(C),Me(()=>Ae(H,u(s).validationIssuesHeading)),P(Ce,C)};xe(Xe,Ce=>{u(p).isValid||Ce(ye)})}j(Oe),P(We,Oe)};xe(Pe,We=>{u(p)&&We(ke)})}var Ie=se(Pe,2);Ne(Ie,()=>yl,(We,Oe)=>{Oe(We,{children:(He,V)=>{var je=W3(),Ve=Q(je);Bn(Ve,{variant:"outline",onclick:_,children:(Ce,C)=>{yt();var M=Et();Me(()=>Ae(M,u(s).cancelButton)),P(Ce,M)},$$slots:{default:!0}});var Xe=se(Ve,2);{var ye=Ce=>{Bn(Ce,{onclick:A,children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).loadAnywayButton)),P(C,H)},$$slots:{default:!0}})};xe(Xe,Ce=>{u(p)?.canLoad&&Ce(ye)})}P(He,je)},$$slots:{default:!0}})}),P(pe,ze)},$$slots:{default:!0}})}),P(de,G)},$$slots:{default:!0}})}),Xt("change",q,S),P(n,F),at()}zi(["change","click"]);var Y3=K("<!> ",1),K3=K('<div class="panel-footer px-3 svelte-1txzu1i"><div class="gap-2 flex flex-wrap items-center justify-center"><!> <!></div> <!></div>'),Z3=K('<div class="panel-content-wrapper svelte-1txzu1i"><!> <!></div>'),$3=K('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),J3=K('<div class="drawer-footer svelte-1txzu1i"><!></div>'),Q3=K('<div class="min-h-0 flex flex-1 flex-col"><!></div> <div style="z-index: 40;"><button class="drawer-handle-bar svelte-1txzu1i"><div class="drawer-pill svelte-1txzu1i"></div> <span class="text-sm font-medium ml-2 text-foreground"> </span> <!></button> <div class="drawer-content svelte-1txzu1i"><div class="px-3 pb-6"><!> <!></div></div> <!></div>',1),eD=K('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),tD=K('<div class="drawer-footer svelte-1txzu1i"><!></div>'),nD=K('<div class="flex flex-1 flex-col overflow-hidden"><div class="px-3 pt-3 flex-1 overflow-y-auto"><!> <!></div> <!></div>'),iD=K('<div class="min-h-0 flex h-full flex-1 justify-center"><div class="min-h-0 flex h-full w-4/5 flex-col"><!></div></div>'),rD=K("<div><!></div>"),sD=K("<!> <!>",1),aD=K("<div><!></div>"),oD=K("<!> <!>",1),lD=K("<!> <!> <!>",1),cD=K('<div class="min-h-0 flex h-full flex-1"><!> <!> <!></div>'),uD=K('<div data-layout-root=""><!></div> <!>',1);function dD(n,e){st(e,!0);const t=(ce,pe=wt,Se=wt,ze,Ue)=>{let Pe=th(()=>nh(ze?.(),!0)),ke=th(()=>nh(Ue?.(),!0));var Ie=Z3(),We=$(Ie);{var Oe=je=>{o3(je,{get schema(){return e.schema},get values(){return e.values},get onValueChange(){return e.onValueChange},get panelFilter(){return pe()},get requestedTabId(){return Se()}})};xe(We,je=>{e.schema.layout.type==="tabbed"&&je(Oe)})}var He=se(We,2);{var V=je=>{var Ve=K3(),Xe=$(Ve),ye=$(Xe);{var Ce=re=>{q3(re,{get schema(){return e.schema},get currentValues(){return e.values},onLoadValues:z,get showSaveButton(){return p()},get showLoadButton(){return m()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get labels(){return e.presetLabels}})};xe(ye,re=>{u(Pe)&&re(Ce)})}var C=se(ye,2);Zt(C,17,h,re=>re.id,(re,ue)=>{{let be=O(()=>u(ue).variant??"outline"),ge=O(()=>u(ue).size??"sm");Bn(re,{get variant(){return u(be)},get size(){return u(ge)},get onclick(){return u(ue).onclick},children:(ae,fe)=>{var Re=Y3(),Le=Q(Re);{var Ee=et=>{const Ye=O(()=>u(ue).icon);var ht=we(),J=Q(ht);Ne(J,()=>u(Ye),(Ge,Te)=>{Te(Ge,{class:"mr-2 h-4 w-4"})}),P(et,ht)};xe(Le,et=>{u(ue).icon&&et(Ee)})}var De=se(Le);Me(()=>Ae(De,` ${u(ue).label??""}`)),P(ae,Re)},$$slots:{default:!0}})}}),j(Xe);var M=se(Xe,2);{var H=re=>{dc(re,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}})};xe(M,re=>{!u(A)&&u(ke)&&e.schema.instanceSolve===!1&&re(H)})}j(Ve),P(je,Ve)};xe(He,je=>{(u(Pe)||!u(A)&&u(ke)&&e.schema.instanceSolve===!1)&&je(V)})}j(Ie),P(ce,Ie)},i=Si(),r=O(()=>i.messages),s=48;let a=oe(e,"meshes",19,()=>[]),o=oe(e,"showSolvingIndicator",3,!1),l=oe(e,"hasPendingChanges",3,!1),c=oe(e,"hasNeverSolved",3,!1),d=oe(e,"isViewerFullscreen",15,!1),f=oe(e,"oncalculate",3,()=>{}),h=oe(e,"panelActions",19,()=>[]),p=oe(e,"showSaveButton",3,!0),m=oe(e,"showLoadButton",3,!0),x=oe(e,"viewerConfig",19,()=>({}));const g=O(()=>!!(e.schema?.viewerOptions?.enableLocal||e.schema?.viewerOptions?.enableRemote)),v=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(ce=>ce.position!=="right"):[]),y=O(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(ce=>ce.position==="right"):[]),w=O(()=>u(v).length>0),b=O(()=>u(y).length>0),E=O(()=>u(g)||u(b)),S=O(()=>!u(g)&&u(w)&&u(b));let A=Fe(!1),_=Fe(!1);const T=O(()=>u(v)[0]?.label??u(r).parametersTab);Pt(()=>{const ce=window.matchMedia("(max-width: 639px)");function pe(){W(A,ce.matches,!0)}return pe(),ce.addEventListener("change",pe),()=>ce.removeEventListener("change",pe)});let D=Fe(!1),L=Fe(!1),F=Fe(null),k=Fe(null),U=Fe(null),N=Fe(null);const R=O(()=>`${u(w)?"L":""}${u(g)?"V":""}${u(b)?"R":""}`);async function z(ce){Object.assign(e.values,ce),await e.onLoadValues?.(ce)}let q=0;function Y(ce){q=ce.touches[0].clientY}function te(ce){const pe=ce.changedTouches[0].clientY-q;Math.abs(pe)>40&&W(_,pe<0)}var le=uD(),B=Q(le);let ee;var de=$(B);{var ve=ce=>{var pe=we(),Se=Q(pe);{var ze=Pe=>{var ke=Q3(),Ie=Q(ke),We=$(Ie);{let ge=O(()=>({...x(),backgroundColor:e.schema?.viewerOptions?.backgroundColor,showSceneManager:!1}));Yf(We,{get meshes(){return a()},get isSolving(){return e.isSolving},get isBlurred(){return u(_)},get drawerOpen(){return u(_)},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(ge)},get isFullscreen(){return d()},set isFullscreen(ae){d(ae)}})}j(Ie);var Oe=se(Ie,2);let He;var V=$(Oe),je=se($(V),2),Ve=$(je,!0);j(je);var Xe=se(je,2);{let ge=O(()=>u(_)?"":"rotate-180");jv(Xe,{size:16,get class(){return`ml-auto text-muted-foreground transition-transform duration-300 ${u(ge)??""}`}})}j(V);var ye=se(V,2),Ce=$(ye),C=$(Ce);{var M=ge=>{t(ge,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(C,ge=>{u(w)&&ge(M)})}var H=se(C,2);{var re=ge=>{var ae=$3(),fe=Q(ae),Re=se($(fe),2),Le=$(Re,!0);j(Re),yt(2),j(fe);var Ee=se(fe,2);t(Ee,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(Le,u(y)[0]?.label??u(r).moreTab)),P(ge,ae)};xe(H,ge=>{u(b)&&ge(re)})}j(Ce),j(ye);var ue=se(ye,2);{var be=ge=>{var ae=J3(),fe=$(ae);dc(fe,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),j(ae),P(ge,ae)};xe(ue,ge=>{e.schema.instanceSolve===!1&&ge(be)})}j(Oe),Me(()=>{He=Dt(Oe,1,"drawer-container svelte-1txzu1i",null,He,{"drawer-open":u(_),"drawer-closed":!u(_)}),Qt(V,"aria-label",u(_)?u(r).collapsePanel:u(r).expandPanel),Qt(V,"aria-expanded",u(_)),Ae(Ve,u(T))}),Xt("click",V,()=>W(_,!u(_))),Xt("touchstart",V,Y),Xt("touchend",V,te),P(Pe,ke)},Ue=Pe=>{var ke=nD(),Ie=$(ke),We=$(Ie);{var Oe=Xe=>{t(Xe,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(We,Xe=>{u(w)&&Xe(Oe)})}var He=se(We,2);{var V=Xe=>{var ye=eD(),Ce=Q(ye),C=se($(Ce),2),M=$(C,!0);j(C),yt(2),j(Ce);var H=se(Ce,2);t(H,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(M,u(y)[0]?.label??u(r).moreTab)),P(Xe,ye)};xe(He,Xe=>{u(b)&&Xe(V)})}j(Ie);var je=se(Ie,2);{var Ve=Xe=>{var ye=tD(),Ce=$(ye);dc(Ce,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),j(ye),P(Xe,ye)};xe(je,Xe=>{e.schema.instanceSolve===!1&&Xe(Ve)})}j(ke),P(Pe,ke)};xe(Se,Pe=>{u(g)?Pe(ze):Pe(Ue,-1)})}P(ce,pe)},G=ce=>{var pe=iD(),Se=$(pe),ze=$(Se);t(ze,()=>u(b)?"right":void 0,()=>u(b)?u(N):u(U),()=>!u(b),()=>!u(b)),j(Se),j(pe),P(ce,pe)},ie=ce=>{var pe=cD(),Se=$(pe);{var ze=Ie=>{hp(Ie,{side:"left",get tabs(){return u(v)},collapsedWidth:s,onExpand:()=>u(F)?.expand(),onTabClick:We=>{W(U,We,!0),u(F)?.expand()}})};xe(Se,Ie=>{u(D)&&u(E)&&u(w)&&Ie(ze)})}var Ue=se(Se,2);Ne(Ue,()=>mg,(Ie,We)=>{We(Ie,{direction:"horizontal",get autoSaveId(){return`selva-layout-${u(R)??""}`},class:"min-h-0 flex-1",children:(Oe,He)=>{var V=lD(),je=Q(V);{var Ve=M=>{var H=sD(),re=Q(H);{let be=O(()=>u(S)?50:u(g)&&u(b)?22:30);Ne(re,()=>sa,(ge,ae)=>{ui(ae(ge,{order:1,get defaultSize(){return u(be)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(D,!0),onExpand:()=>W(D,!1),class:"ml-1",children:(fe,Re)=>{var Le=rD(),Ee=$(Le);t(Ee,()=>u(b)?"left":void 0,()=>u(U)),j(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(D)?"hidden":""}`)),P(fe,Le)},$$slots:{default:!0}}),fe=>W(F,fe,!0),()=>u(F))})}var ue=se(re,2);Ne(ue,()=>xu,(be,ge)=>{ge(be,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(D)},onclick:()=>{u(D)&&u(F)?.expand()}})}),P(M,H)};xe(je,M=>{u(w)&&M(Ve)})}var Xe=se(je,2);{var ye=M=>{var H=we(),re=Q(H);Ne(re,()=>sa,(ue,be)=>{be(ue,{order:2,minSize:20,class:"min-h-0 mx-1 flex flex-col",children:(ge,ae)=>{{let fe=O(()=>({backgroundColor:e.schema?.viewerOptions?.backgroundColor}));Yf(ge,{get meshes(){return a()},get isSolving(){return e.isSolving},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(fe)},get isFullscreen(){return d()},set isFullscreen(Re){d(Re)}})}},$$slots:{default:!0}})}),P(M,H)};xe(Xe,M=>{u(g)&&M(ye)})}var Ce=se(Xe,2);{var C=M=>{var H=oD(),re=Q(H);Ne(re,()=>xu,(be,ge)=>{ge(be,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(L)},onclick:()=>{u(L)&&u(k)?.expand()}})});var ue=se(re,2);{let be=O(()=>u(S)?50:25);Ne(ue,()=>sa,(ge,ae)=>{ui(ae(ge,{order:3,get defaultSize(){return u(be)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(L,!0),onExpand:()=>W(L,!1),class:"mr-1",children:(fe,Re)=>{var Le=aD(),Ee=$(Le);t(Ee,()=>"right",()=>u(N),()=>!u(w),()=>!u(w)),j(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(L)?"hidden":""}`)),P(fe,Le)},$$slots:{default:!0}}),fe=>W(k,fe,!0),()=>u(k))})}P(M,H)};xe(Ce,M=>{u(b)&&M(C)})}P(Oe,V)},$$slots:{default:!0}})});var Pe=se(Ue,2);{var ke=Ie=>{hp(Ie,{side:"right",get tabs(){return u(y)},collapsedWidth:s,onExpand:()=>u(k)?.expand(),onTabClick:We=>{W(N,We,!0),u(k)?.expand()}})};xe(Pe,Ie=>{u(L)&&u(b)&&Ie(ke)})}j(pe),P(ce,pe)};xe(de,ce=>{u(A)?ce(ve):!u(g)&&!u(S)&&u(w)!==u(b)?ce(G,1):ce(ie,-1)})}j(B);var Z=se(B,2);V2(Z,{get show(){return o()}}),Me(()=>ee=Dt(B,1,`min-h-0 sm:flex-row sm:py-(--page-py) flex flex-1 flex-col overflow-hidden ${u(D)?"sm:pl-0":"sm:pl-(--page-px)"} ${u(L)?"sm:pr-0":"sm:pr-(--page-px)"}`,"svelte-1txzu1i",ee,{"fullscreen-layout":d(),relative:u(A)})),P(n,le),at()}zi(["click","touchstart","touchend"]);function hD(n){const{FAST_THRESHOLD_MS:e,SLOW_THRESHOLD_MS:t,HISTORY_SIZE:i,ANIMATION_DELAY:r}=us.SOLVING_INDICATOR;let s=Fe(!1),a=null,o=null;const l=[];return Pt(()=>{const c=n();return wn(()=>{if(c){o=performance.now();const d=l.length===0?1/0:l.reduce((h,p)=>h+p,0)/l.length;if(l.length>0&&d<e)return;const f=d===1/0||d>=t?0:(d-e)/(t-e)*r;a||(f===0?W(s,!0):a=setTimeout(()=>{W(s,!0),a=null},f))}else o!==null&&(l.push(performance.now()-o),l.length>i&&l.shift(),o=null),a&&(clearTimeout(a),a=null),W(s,!1)}),()=>{a&&clearTimeout(a)}}),{get show(){return u(s)}}}const fD="external";function pD(n,e){return`${fD}:${n}:${e}`}function fp(n){const{scopeKey:e,inputId:t}=n;if(!e||!t||typeof sessionStorage>"u")return;const i=sessionStorage.getItem(pD(e,t));if(i!==null)try{return JSON.parse(i)}catch{return}}function mD(n){return xP(n).filter(e=>e.source?.kind==="client").map(e=>({paramId:e.paramId,displayName:e.displayName??e.paramId}))}const gD=6e4;function vD(n,e={}){const{timeout:t=gD}=e;let i=Fe(!1),r=Fe(null),s=null;function a(){s?.abort(),s=null}async function o(d){a(),s=new AbortController;const{signal:f}=s,h=setTimeout(()=>s?.abort(),t);W(i,!0);try{await n(d,f)}catch(p){(!(p instanceof Error)||p.name!=="AbortError"&&p.name!=="TimeoutError")&&console.error("[computeThrottle] unhandled error in computeFn:",p)}finally{if(clearTimeout(h),W(i,!1),s=null,u(r)!==null){const p=u(r);W(r,null),o(p)}}}function l(d){u(i)?W(r,d,!0):o(d)}function c(){W(r,null),a()}return{trigger:l,get isComputing(){return u(i)},get hasPending(){return u(r)!==null},cancel:c}}function _D(n){switch(n){case"number":case"integer":return 0;case"boolean":return!1;case"text":return"";default:return null}}function pp(n,e,t){const i=new Set(mD(n).map(s=>s.paramId)),r={};for(const s of n.inputs){if(i.has(s.id)){const a=t({scopeKey:e,inputId:s.id});a!==void 0&&(r[s.id]=a);continue}r[s.id]=s.default??_D(s.paramType)}for(const s of n.outputs)r[s.id]=null;return r}function mp(n){const e=n===!1;return{hasPendingChanges:e,hasNeverSolved:e}}function xD(n,e,t,i){return n.values[e]=t,i===!1?(n.pendingValues[e]=t,n.hasPendingChanges=!0,{state:n,shouldSolve:!1}):{state:n,shouldSolve:!0}}function bD(n,e){return n.error="",n.computeErrors=e.errors??[],n.computeWarnings=e.warnings??[],n.meshes=e.meshes??[],Object.assign(n.values,e.outputs),n.pendingValues={},n.hasPendingChanges=!1,n.hasNeverSolved=!1,n}function yD(n){let e=n.schema;const t=mp(e?.instanceSolve),i=Ps({values:pp(e,n.scopeKey,fp),error:"",computeErrors:[],computeWarnings:[],meshes:[],pendingValues:{},hasPendingChanges:t.hasPendingChanges,hasNeverSolved:t.hasNeverSolved});function r(){n.driver.solve(Nu(i.values))}return{get values(){return i.values},get error(){return i.error},get computeErrors(){return i.computeErrors},get computeWarnings(){return i.computeWarnings},get meshes(){return i.meshes},get hasPendingChanges(){return i.hasPendingChanges},get hasNeverSolved(){return i.hasNeverSolved},get isSolving(){return n.driver.isSolving},setValue(s,a,o=!1){const{shouldSolve:l}=xD(i,s,a,e?.instanceSolve);(l||o)&&(o&&!l&&(i.pendingValues={},i.hasPendingChanges=!1),r())},solve(){r()},loadValues(s){Object.assign(i.values,s),e?.instanceSolve!==!1?r():i.hasPendingChanges=!0},rebuild(s,a){e=s,i.meshes=[],i.error="",i.computeErrors=[],i.computeWarnings=[],i.pendingValues={},i.values=pp(s,a,fp);const o=mp(s?.instanceSolve);i.hasPendingChanges=o.hasPendingChanges,i.hasNeverSolved=o.hasNeverSolved,s&&Object.keys(i.values).length>0&&s.instanceSolve!==!1&&r()},report(s){bD(i,s)},reportError(s){i.error=s}}}function SD(n,e,t={}){const i=vD(async(r,s)=>{try{const a=await n(r,s);if(s.aborted)return;e().report(a)}catch(a){if(s.aborted)return;e().reportError(a instanceof Error?a.message:String(a))}},t);return{solve(r){i.trigger(r)},cancel(){i.cancel()},get isSolving(){return i.isComputing}}}function MD(n){tl(()=>{const e=Ms(rh);!e||!n.component||e.register(n)}),yp(()=>{try{Ms(rh)?.unregister(n.id)}catch{}})}const wD=n=>{if(!n)return"";const e=n.replace(/^#/,"");if(!/^[0-9A-Fa-f]{6}$/.test(e))return n;const t=parseInt(e.slice(0,2),16)/255,i=parseInt(e.slice(2,4),16)/255,r=parseInt(e.slice(4,6),16)/255,s=b=>b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4),a=s(t),o=s(i),l=s(r),c=a*.4124564+o*.3575761+l*.1804375,d=a*.2126729+o*.7151522+l*.072175,f=a*.0193339+o*.119192+l*.9503041,h=Math.cbrt(.8189330101*c+.3618667424*d-.1288597137*f),p=Math.cbrt(.0329845436*c+.9293118715*d+.0361456387*f),m=Math.cbrt(.0482003018*c+.2643662691*d+.633851707*f),x=.2104542553*h+.793617785*p-.0040720468*m,g=1.9779984951*h-2.428592205*p+.4505937099*m,v=.0259040371*h+.7827717662*p-.808675766*m,y=Math.sqrt(g*g+v*v);let w=Math.atan2(v,g)*180/Math.PI;return w<0&&(w+=360),`oklch(${x.toFixed(3)} ${y.toFixed(3)} ${w.toFixed(1)})`};var ED=K('<div class="min-h-100 p-8 flex items-center justify-center"><!></div>'),TD=K('<div class="min-h-100 flex items-center justify-center"><!></div>'),AD=K("<div><!></div>");function CD(n,e){st(e,!0);let t=oe(e,"definitionKey",3,""),i=oe(e,"showModeToggle",3,!1),r=oe(e,"panelActions",19,()=>[]),s=oe(e,"showSaveButton",3,!0),a=oe(e,"showLoadButton",3,!0),o=oe(e,"footerItemId",3,"footer-item"),l=oe(e,"footerItemPriority",3,0);nR(e.clientSlot);const c=Si();ng(()=>e.lang??c.locale);const d=O(()=>Si().messages),f=O(()=>e.externalScopeKey||t()||e.schema?.id||""),h=SD(e.onSolve,()=>p,{timeout:e.solveTimeoutMs}),p=yD({schema:e.schema,scopeKey:e.externalScopeKey||t()||e.schema?.id||"",driver:h});let m=Fe(!1);const x=hD(()=>p.isSolving);Pt(()=>{e.onReady?.({loadValues:L=>p.loadValues(L)})});let g=Fe(""),v=Fe(!0);Pt(()=>{t(),wn(()=>{u(v)?(W(v,!1),W(g,t()),e.schema?.instanceSolve!==!1&&p.solve()):u(g)!==t()&&(p.rebuild(e.schema,u(f)),W(g,t()))})});function y(L,F,k=!1){p.setValue(L,F,k)}function w(){p.solve()}MD({id:wn(()=>o()),component:wn(()=>e.footerComponent),getProps:()=>e.footerComponentProps?.()??{},position:"left",priority:wn(()=>l())});let b=O(()=>e.isEmbedded??ih.url.searchParams.get("embed")==="true"),E=O(()=>e.primaryColor??ih.url.searchParams.get("primary")),S=O(()=>u(E)?`--primary: ${wD(u(E))}`:""),A=O(()=>e.title??(e.schema?.description||e.schema.name));var _=AD();let T;var D=$(_);{let L=O(()=>!u(b));Zg(D,{mode:"fixed",get showHeader(){return u(L)},showFooter:!0,get title(){return u(A)},get showModeToggle(){return i()},get copyrightName(){return e.copyrightName},get footerText(){return e.footerText},get header(){return e.header},get rightContent(){return e.headerRight},get errors(){return p.computeErrors},get warnings(){return p.computeWarnings},children:(F,k)=>{var U=we(),N=Q(U);{var R=Y=>{var te=ED(),le=$(te);wu(le,{type:"error",size:"medium",get message(){return p.error}}),j(te),P(Y,te)},z=Y=>{var te=TD(),le=$(te);wu(le,{type:"loading",size:"large",get message(){return u(d).loadingSchema}}),j(te),P(Y,te)},q=Y=>{var te=we(),le=Q(te);pv(le,t,B=>{{let ee=O(()=>e.schema.instanceSolve!==!1&&x.show);dD(B,{get schema(){return e.schema},get meshes(){return p.meshes},get isSolving(){return p.isSolving},get showSolvingIndicator(){return u(ee)},get hasPendingChanges(){return p.hasPendingChanges},get hasNeverSolved(){return p.hasNeverSolved},get values(){return p.values},get logoUrl(){return e.logo},get panelActions(){return r()},get showSaveButton(){return s()},get showLoadButton(){return a()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get presetLabels(){return e.presetLabels},onValueChange:y,oncalculate:w,onLoadValues:()=>p.loadValues({}),get isViewerFullscreen(){return u(m)},set isViewerFullscreen(de){W(m,de,!0)}})}}),P(Y,te)};xe(N,Y=>{p.error?Y(R):e.schema?Y(q,-1):Y(z,1)})}P(F,U)},$$slots:{default:!0}})}j(_),Me(()=>T=Ii(_,u(S),T,{display:"contents"})),P(n,_),at()}var PD=K('<div class="text-muted-foreground flex items-center gap-1.5 text-xs"><!> <span> </span></div>');function RD(n,e){var t=we(),i=Q(t);{var r=s=>{var a=PD(),o=$(a);Jg(o,{class:"h-3 w-3"});var l=se(o,2),c=$(l,!0);j(l),j(a),Me(()=>Ae(c,e.label)),P(s,a)};xe(i,s=>{e.label&&s(r)})}P(n,t)}const DD=""+new URL("../assets/rhino3dm.BI8ESrUA.wasm",import.meta.url).href;var LD=K('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase"> </span>'),ID=K('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase">Draft preview</span>'),ND=K("<!> <!>",1);function PL(n,e){st(e,!0);let t=null;function i(){return t||(t=gp(()=>import("../chunks/-xEd7dwr.js").then(o=>o.r),[],import.meta.url).then(o=>{const l=o.default;return l({locateFile:()=>DD})})),t}let r=0;function s(o){const l={};if(!o)return l;for(const c of o.split(",")){const[d,...f]=c.split(";").map(m=>m.trim()),h=f.find(m=>m.startsWith("dur="));if(!d||!h)continue;const p=Number(h.slice(4));Number.isFinite(p)&&(l[d]=p)}return l}const a=async(o,l)=>{const c=r-Date.now();if(c>0)throw new Error(`Rate limit reached. Try again in ${Math.ceil(c/1e3)}s.`);const d=performance.now(),f=await fetch("/api/compute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({inputs:e.data.schema.inputs,values:o,definitionUrl:e.data.ghDefinition,...e.data.versionId?{versionId:e.data.versionId}:e.data.channel==="draft"&&{channel:"draft"}}),signal:l});if(l.aborted)return{outputs:{}};if(!f.ok){if(f.status===503)throw new Error("Compute server is offline or unreachable. Please try again later.");if(f.status===429){const ee=await f.json().catch(()=>({})),de=Number(f.headers.get("Retry-After"))||Number(ee.retryAfter)||5;throw r=Date.now()+de*1e3,new Error(ee.message||`Rate limit reached. Try again in ${de}s.`)}const B=await f.json().catch(()=>({}));throw new Error(B.message||"Compute error")}const h=performance.now()-d,p=performance.now(),m=await f.text();if(l.aborted)return{outputs:{}};const x=performance.now()-p,g=m.length,v=performance.now(),y=JSON.parse(m),w=new w_(y,!1),b=performance.now()-v,E=e.data.schema.viewerOptions?.enableLocal||e.data.schema.viewerOptions?.enableRemote,S=performance.now(),A=E?await i():null,_=performance.now()-S,T=performance.now(),D=A?await w.extractMeshesFromResponse({rhino:A}):[],L=performance.now()-T,F=performance.now(),k={};for(const B of e.data.schema.outputs){const ee=w.getValue({byId:B.id},{parseValues:!0}),de=B.nickname;k[B.id]=ee??(de?w.getValue({byName:de},{parseValues:!0}):void 0)}const U=performance.now()-F,N=s(f.headers.get("Server-Timing")),R=N.total??0,z=Math.max(0,h-R),q=g/(1024*1024),Y=q>=1?`${q.toFixed(2)} MB`:`${(g/1024).toFixed(0)} KB`,te=x>0?(q/(x/1e3)).toFixed(1):"∞",le=h+x+b+_+L+U;return console.log(`[Compute/browser] total=${le.toFixed(0)}ms | ttfb=${h.toFixed(0)}ms (network≈${z.toFixed(0)} + server ${R.toFixed(0)}) | download=${x.toFixed(0)}ms (${Y} @ ${te} MB/s) | json=${b.toFixed(0)}ms | rhinoInit=${_.toFixed(0)}ms | mesh=${L.toFixed(0)}ms (${D.length}) | outputs=${U.toFixed(0)}ms`),N.total!==void 0&&console.log(`[Compute/browser] └─ server: load=${(N.load??0).toFixed(0)}ms tree=${(N.tree??0).toFixed(0)}ms solve=${(N.solve??0).toFixed(0)}ms serialize=${(N.serialize??0).toFixed(0)}ms`),{outputs:k,meshes:D,errors:y.errors??[],warnings:y.warnings??[]}};{const o=d=>{var f=ND(),h=Q(f);{var p=g=>{var v=LD(),y=$(v);j(v),Me(()=>Ae(y,`v${e.data.versionNumber??""} preview`)),P(g,v)},m=g=>{var v=ID();P(g,v)};xe(h,g=>{e.data.versionId?g(p):e.data.channel==="draft"&&g(m,1)})}var x=se(h,2);$g(x,{}),P(d,f)};let l=O(()=>e.data.schema?.description||e.data.schema.name),c=O(()=>e.data.orgLogoUrl??void 0);CD(n,{get schema(){return e.data.schema},onSolve:a,get definitionKey(){return e.data.currentDefinition},get title(){return u(l)},get logo(){return u(c)},showModeToggle:!0,get solveTimeoutMs(){return e.data.solveTimeoutMs},get footerComponent(){return RD},footerComponentProps:()=>({label:e.data.serverLabel}),headerRight:o,$$slots:{headerRight:!0}})}at()}const UD=Object.freeze(Object.defineProperty({__proto__:null,BINARY_MESH_MAGIC:mu,BINARY_MESH_VERSION:gu,EDGE_USERDATA_KIND:ua,FLAG_FLOAT32:Id,Materials:qm,SCALE_FACTORS:Qm,addEdges:km,applyOffset:Fm,computeCombinedBoundingBox:fl,createCameraController:Om,createGrid:zm,createLabelLayer:Gm,createMeasureTool:Xm,createRenderPipeline:Hm,createViewGizmo:Bm,getThreeMeshesFromComputeResponse:DT,initThree:jm,isEdgeOverlay:Vm,parseBinaryMeshBatch:Nd,parseColor:Um,parseDisplayItems:Ym,parseMeshBatch:Zm,parseMeshBatchBlob:MT,parseMeshBatchObject:$m,removeEdges:TE,snapToVertex:Wm,updateScene:Nm},Symbol.toStringTag,{value:"Module"}));export{PL as component};
|