<script lang="ts">
	import type { Snippet } from 'svelte'

	import { provideHierarchy, provideWorldMatrix } from '../ecs'
	import { provide3DModels } from '../hooks/use3DModels.svelte'
	import { provideArmClient } from '../hooks/useArmClient.svelte'
	import { provideArmKinematics } from '../hooks/useArmKinematics.svelte'
	import { provideConfigFrames } from '../hooks/useConfigFrames.svelte'
	import { provideTransformControls } from '../hooks/useControls.svelte'
	import { provideFrameEditSession } from '../hooks/useFrameEditSession.svelte'
	import { provideFramelessComponents } from '../hooks/useFramelessComponents.svelte'
	import { provideFrames } from '../hooks/useFrames.svelte'
	import { provideGeometries } from '../hooks/useGeometries.svelte'
	import { provideInheritedInvisible } from '../hooks/useInheritedInvisible.svelte'
	import { provideLinkedEntities } from '../hooks/useLinked.svelte'
	import { provideLogs } from '../hooks/useLogs.svelte'
	import { usePartID } from '../hooks/usePartID.svelte'
	import { providePointcloudObjects } from '../hooks/usePointcloudObjects.svelte'
	import { providePointclouds } from '../hooks/usePointclouds.svelte'
	import { provideRelationships } from '../hooks/useRelationships.svelte'
	import { provideResourceByName } from '../hooks/useResourceByName.svelte'
	import { provideWorldStates } from '../hooks/useWorldState.svelte'

	interface Props {
		children: Snippet
	}

	let { children }: Props = $props()

	const partID = usePartID()

	provideTransformControls()
	provideLogs()

	provideHierarchy()
	provideWorldMatrix()
	provideInheritedInvisible()

	provideRelationships()

	provideResourceByName(() => partID.current)
	provideConfigFrames()
	provideFrameEditSession(() => partID.current)
	provideFrames(() => partID.current)
	provideGeometries(() => partID.current)
	provide3DModels(() => partID.current)
	providePointclouds(() => partID.current)
	providePointcloudObjects(() => partID.current)
	provideArmClient(() => partID.current)
	provideArmKinematics(() => partID.current)
	provideWorldStates()
	provideFramelessComponents()

	provideLinkedEntities()
</script>

{@render children()}
