async function create_starter({ details, preview, site_data = null }) {

	let starter_data
	if (site_data) {
		site_data.site.name = details.name
		site_data.site.description = details.description
		const scrambled = scramble_ids(site_data)
		starter_data = prepare_data(scrambled)
	} else {
		const site_id = uuidv4()
		const page_type_id = uuidv4()
		const home_page_id = uuidv4()
		const master_palette_id = uuidv4()
		const empty_starter = {
			site: {
				id: site_id,
				name: details.name,
				code: {
					head: '',
					foot: ''
				},
				design: {
						heading_font: 'Open Sans',
						body_font: 'Open Sans',
						primary_color: '#864040',
						radius: '0px',
						shadow: "0.3px 0.5px 0.7px hsl(0deg 36% 56% / 0.34),0.4px 0.8px 1px -1.2px hsl(0deg 36% 56% / 0.34), 1px 2px 2.5px -2.5px hsl(0deg 36% 56% / 0.34)",
				},
				entries: [],
				fields: []
			},
			pages: [
				factories.Page({
					id: home_page_id,
					index: 0,
					name: "Home Page",
					page_type: page_type_id,
					owner_site: site_id
				})
			],
			page_types: [
				factories.Page_Type({
					id: page_type_id,
					name: "Default",
					owner_site: site_id
				})
			],
			sections: [
				factories.Section({
					id: master_palette_id,
					page_type: page_type_id,
					owner_site: site_id
				}),
				factories.Section({
					page: home_page_id,
					master: master_palette_id,
					owner_site: site_id
				})
			],
			symbols: []
		}
		starter_data = prepare_data(empty_starter)
	}

	const { site, page_types, pages, symbols, sections, entries, fields } = starter_data

	site.is_starter = true

	try {
		// Step 1: Insert starter
		let res = await supabase.from('sites').insert({ ...site, owner: get(page).data.user.id })
		if (res.error) {
			console.log('Failed to insert site', { res, site })
			throw new Error('Failed to insert site')
		}

		// Step 2: Insert page_types and symbols
		res = await Promise.all([
			supabase.from('page_types').insert(page_types),
			supabase.from('symbols').insert(symbols)
		])
		if (res.some(r => r.error)) {
			console.log('Failed to insert page_types or symbols', { res, page_types, symbols })
			throw new Error('Failed to insert page_types or symbols')
		}

		// Step 3: Insert pages
		res = await supabase.from('pages').insert(pages)
		if (res.error) {
			console.log('Failed to insert pages', { res, pages })
			throw new Error('Failed to insert pages')
		}

		// Step 4: Insert sections
		res = await supabase.from('sections').insert(sections)
		if (res.error) {
			console.log('Failed to insert sections', { res, sections })
			throw new Error('Failed to insert sections')
		}

		// Step 5: Insert fields
		res = await supabase.from('fields').insert(fields)
		if (res.error) {
			console.log('Failed to insert fields', { res, fields })
			throw new Error('Failed to insert fields')
		}

		// Step 6: Insert entries
		res = await supabase.from('entries').insert(entries)
		if (res.error) {
			console.log('Failed to insert entries', { res, entries })
			throw new Error('Failed to insert entries')
		}

		// Handle preview upload
		await supabase.storage.from('sites').upload(`${site.id}/preview.html`, preview)

		console.log('Site created successfully')
	} catch (e) {
		console.error('SOMETHING WENT WRONG', e)
			// TODO: Implement rollback logic to delete inserted items if an error occurs
	}
}
Creates a new starter site
@param {Object} options - The starter options
@param {Object} options.details - Basic site details
@param {string} options.details.name - Name of the site
@param {string} options.details.description - Description of the site
@param {string} options.preview - Preview HTML content
@param {Object} [options.site_data] - Optional existing site data to use as template
@returns {Promise<void>}