(() => {
	'use strict';

	const cfg = window.skynsmfaWishlist || null;
	if (!cfg || !cfg.ajax_url || !cfg.nonce) {
		return;
	}

	const settings = Object.assign(
		{
			notification_type: 'toast',
			display_mode: 'button',
			multiple_lists_enabled: false,
			add_target_mode: 'last_used',
		},
		(cfg.settings && typeof cfg.settings === 'object') ? cfg.settings : {}
	);

	const listPickerCache = {
		keys: (cfg.wishlist && Array.isArray(cfg.wishlist.keys) && cfg.wishlist.keys.length)
			? cfg.wishlist.keys.slice()
			: ['default'],
		names: (cfg.wishlist && cfg.wishlist.names && typeof cfg.wishlist.names === 'object')
			? Object.assign({}, cfg.wishlist.names)
			: {},
	};

	function pickerKeysFromData(data) {
		if (!data || typeof data !== 'object') {
			return ['default'];
		}
		let keys = Object.keys(data).filter((key) => typeof key === 'string' && key !== '');
		if (keys.indexOf('default') < 0) {
			keys.unshift('default');
		}
		keys.sort((a, b) => {
			if (a === 'default') return -1;
			if (b === 'default') return 1;
			return a.localeCompare(b);
		});
		if (keys.length === 0) {
			return ['default'];
		}
		return keys;
	}

	function syncListPickerCache(data, names) {
		if (data && typeof data === 'object') {
			listPickerCache.keys = pickerKeysFromData(data);
		}
		if (names && typeof names === 'object') {
			listPickerCache.names = Object.assign({}, names);
		}
	}

	function countWishlistItems(data) {
		if (!data || typeof data !== 'object') {
			return 0;
		}

		const ids = {};
		Object.keys(data).forEach((listKey) => {
			const list = data[listKey];
			if (!list || typeof list !== 'object') {
				return;
			}
			Object.keys(list).forEach((productId) => {
				const id = parseInt(productId, 10);
				if (Number.isFinite(id) && id > 0) {
					ids[id] = true;
				}
			});
		});

		return Object.keys(ids).length;
	}

	function formatMenuIconLabel(count) {
		const i = cfg.i18n || {};
		const safeCount = Number.isFinite(count) && count >= 0 ? count : 0;
		const template = safeCount === 1
			? (i.menu_icon_one || 'Favorites, %d item')
			: (i.menu_icon_many || 'Favorites, %d items');
		return template.replace('%d', String(safeCount));
	}

	function updateMenuIconBadge(count) {
		const safeCount = Number.isFinite(count) && count >= 0 ? count : 0;

		document.querySelectorAll('.skynsmfa-menu-icon').forEach((link) => {
			const badge = link.querySelector('.skynsmfa-menu-icon__badge');
			const visibility = link.getAttribute('data-count-visibility') || 'greater_than_zero';

			if (badge) {
				badge.textContent = String(safeCount);
				if (visibility === 'never') {
					badge.hidden = true;
				} else if (visibility === 'always') {
					badge.hidden = false;
				} else {
					badge.hidden = safeCount <= 0;
				}
			}

			link.setAttribute('aria-label', formatMenuIconLabel(safeCount));
		});
	}

	function syncMenuIconFromResponse(res) {
		if (!res || !res.success || !res.data) {
			return;
		}

		if (typeof res.data.item_count === 'number') {
			updateMenuIconBadge(res.data.item_count);
			return;
		}

		if (res.data.data) {
			updateMenuIconBadge(countWishlistItems(res.data.data));
		}
	}

	function toFormBody(obj) {
		const params = new URLSearchParams();
		Object.keys(obj).forEach((key) => {
			if (obj[key] === undefined || obj[key] === null) {
				return;
			}
			params.append(key, String(obj[key]));
		});
		return params.toString();
	}

	function post(action, data) {
		const body = toFormBody(
			Object.assign(
				{
					action,
					nonce: cfg.nonce,
				},
				data || {}
			)
		);

		return fetch(cfg.ajax_url, {
			method: 'POST',
			credentials: 'same-origin',
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
			},
			body,
		}).then((r) => r.json());
	}

	function setButtonLoading(btn, loading) {
		btn.disabled = !!loading;
		btn.classList.toggle('is-loading', !!loading);
	}

	/**
	 * Loading state for the "Choose a list" modal (Add to list + list radios).
	 *
	 * @param {HTMLElement} modalRoot Modal root element.
	 * @param {boolean} loading Whether a request is in progress.
	 */
	function setListModalLoading(modalRoot, loading) {
		if (!modalRoot) {
			return;
		}

		const panel = modalRoot.querySelector('.skynsmfa-list-modal__panel');
		const btnAdd = modalRoot.querySelector('.skynsmfa-list-modal__btn-add');
		const btnCancel = modalRoot.querySelector('.skynsmfa-list-modal__btn-cancel');
		const listWrap = modalRoot.querySelector('.skynsmfa-list-modal__lists');
		const i = cfg.i18n || {};

		if (panel) {
			panel.classList.toggle('is-loading', !!loading);
			panel.setAttribute('aria-busy', loading ? 'true' : 'false');
		}

		modalRoot.classList.toggle('skynsmfa-list-modal--busy', !!loading);

		if (btnAdd) {
			btnAdd.disabled = !!loading;
			btnAdd.classList.toggle('is-loading', !!loading);
			btnAdd.setAttribute('aria-busy', loading ? 'true' : 'false');
			if (loading) {
				if (!btnAdd.dataset.skynsmfaDefaultLabel) {
					btnAdd.dataset.skynsmfaDefaultLabel = btnAdd.textContent || '';
				}
				btnAdd.textContent = i.adding_to_list || 'Adding…';
			} else if (btnAdd.dataset.skynsmfaDefaultLabel) {
				btnAdd.textContent = btnAdd.dataset.skynsmfaDefaultLabel;
			}
		}

		if (btnCancel) {
			btnCancel.disabled = !!loading;
		}

		if (listWrap) {
			listWrap.querySelectorAll('input, label').forEach((el) => {
				if (el.tagName === 'INPUT') {
					el.disabled = !!loading;
				} else {
					el.classList.toggle('is-disabled', !!loading);
				}
			});
		}
	}

	function createToastContainer() {
		let container = document.querySelector('.skynsmfa-toast-container');
		if (!container) {
			container = document.createElement('div');
			container.className = 'skynsmfa-toast-container';
			document.body.appendChild(container);
		}
		return container;
	}

	function notify(message, target) {
		if (settings.notification_type === 'none') {
			return;
		}

		if (settings.notification_type === 'tooltip' && target) {
			const tooltip = document.createElement('span');
			tooltip.className = 'skynsmfa-tooltip';
			tooltip.textContent = message;
			target.appendChild(tooltip);
			setTimeout(() => {
				target.removeChild(tooltip);
			}, 1800);
			return;
		}

		const container = createToastContainer();
		const toast = document.createElement('div');
		toast.className = 'skynsmfa-toast';
		toast.textContent = message;
		container.appendChild(toast);
		setTimeout(() => {
			toast.classList.add('skynsmfa-toast-hidden');
			setTimeout(() => {
				if (toast.parentNode) {
					toast.parentNode.removeChild(toast);
				}
			}, 400);
		}, 2200);
	}

	function updateWishlistButton(btn, isAdded) {
		const i = cfg.i18n || {};
		const inText = i.in_wishlist || 'Already in wishlist';
		const addText = i.add_label || 'Add to wishlist';
		btn.classList.toggle('is-added', !!isAdded);
		if (!btn.classList.contains('skynsmfa-icon-button')) {
			var textTarget = btn.querySelector('.skynsmfa-btn-text');
			if (textTarget) {
				textTarget.textContent = isAdded ? inText : addText;
			} else {
				btn.textContent = isAdded ? inText : addText;
			}
		}
		const removeLbl = i.remove_label || 'Remove from wishlist';
		btn.setAttribute('aria-label', isAdded ? removeLbl : addText);
		if (isAdded) {
			btn.removeAttribute('data-skynsmfa-prompt-add');
		}
	}

	function getWishlistKey(btn) {
		return btn.getAttribute('data-wishlist-key') || (cfg.current_wishlist_key || 'default');
	}

	function getContextFromButton(btn) {
		return btn.getAttribute('data-context') || '';
	}

	function getVariationIdFromButton(btn) {
		const ctx = getContextFromButton(btn);
		if (ctx !== 'single') {
			return 0;
		}
		const wrap = btn.closest('.product') || document.querySelector('.product');
		if (!wrap) {
			return 0;
		}
		const input = wrap.querySelector('input.variation_id, input[name="variation_id"]');
		if (!input || !input.value) {
			return 0;
		}
		const v = parseInt(input.value, 10);
		return Number.isFinite(v) && v > 0 ? v : 0;
	}

	function getSelectVariationMessage() {
		const i = cfg.i18n || {};
		return i.select_variation || 'Please choose product options (color, size, etc.) before adding to your wishlist.';
	}

	function requireVariationForSingleAdd(btn, variationId) {
		if (getContextFromButton(btn) !== 'single') {
			return null;
		}
		if (!document.querySelector('form.variations_form')) {
			return null;
		}
		if (variationId > 0) {
			return null;
		}
		return getSelectVariationMessage();
	}

	function withWishlistContext(btn, payload) {
		const data = Object.assign({}, payload || {});
		const ctx = getContextFromButton(btn);
		if (ctx) {
			data.context = ctx;
		}
		return data;
	}

	function initVariableSingleProduct() {
		const wrap = document.querySelector('.skynsmfa-single-wishlist-wrap');
		if (!wrap) {
			return;
		}
		wrap.hidden = false;
		wrap.setAttribute('aria-hidden', 'false');

		const form = document.querySelector('form.variations_form');
		if (!form || !window.jQuery) {
			return;
		}

		const $form = window.jQuery(form);
		if (!$form || typeof $form.on !== 'function') {
			return;
		}

		function keepVisible() {
			wrap.hidden = false;
			wrap.setAttribute('aria-hidden', 'false');
		}

		$form.on('found_variation.skynsmfa reset_data.skynsmfa hide_variation.skynsmfa show_variation.skynsmfa', keepVisible);
		keepVisible();
	}

	function createWishlist(listName) {
		if (!listName || !listName.trim()) {
			return;
		}

		post('skynsmfa_create_wishlist', { list_name: listName.trim() })
			.then((res) => {
				if (res && res.success) {
					if (res.data) {
						syncListPickerCache(res.data.data, res.data.names);
					}
					window.location.reload();
					return;
				}
				alert((res && res.data && res.data.message) || (cfg.i18n && cfg.i18n.error) || 'Error');
			})
			.catch(() => alert((cfg.i18n && cfg.i18n.error) || 'Error'));
	}

	function formatListLabel(key, names) {
		const k = String(key || '');
		if (names && typeof names === 'object' && names[k]) {
			return names[k];
		}
		if (k === 'default') {
			return (cfg.i18n && cfg.i18n.my_favorites) ? cfg.i18n.my_favorites : 'My favorites';
		}
		return k.replace(/^custom:/, '').replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
	}

	function closeListPickerModal(root) {
		if (root && root.parentNode) {
			root.parentNode.removeChild(root);
		}
		document.body.classList.remove('skynsmfa-modal-open');
	}

	function openListPickerModal(btn, productId, variationId) {
		const i = cfg.i18n || {};
		document.body.classList.add('skynsmfa-modal-open');

		const root = document.createElement('div');
		root.className = 'skynsmfa-list-modal';
		root.setAttribute('role', 'dialog');
		root.setAttribute('aria-modal', 'true');

		const panel = document.createElement('div');
		panel.className = 'skynsmfa-list-modal__panel';

		const title = document.createElement('h3');
		title.className = 'skynsmfa-list-modal__title';
		title.textContent = i.choose_list || 'Choose a list';
		panel.appendChild(title);

		const listWrap = document.createElement('div');
		listWrap.className = 'skynsmfa-list-modal__lists';
		panel.appendChild(listWrap);

		const actions = document.createElement('div');
		actions.className = 'skynsmfa-list-modal__actions';

		const btnCancel = document.createElement('button');
		btnCancel.type = 'button';
		btnCancel.className = 'button skynsmfa-list-modal__btn-cancel';
		btnCancel.textContent = i.cancel || 'Cancel';

		const btnAdd = document.createElement('button');
		btnAdd.type = 'button';
		btnAdd.className = 'button button-primary skynsmfa-list-modal__btn-add';
		btnAdd.textContent = i.add_to_list || 'Add to list';

		actions.appendChild(btnCancel);
		actions.appendChild(btnAdd);
		panel.appendChild(actions);

		root.appendChild(panel);
		document.body.appendChild(root);

		function renderKeys(keys, forceSelectKey, names) {
			listWrap.textContent = '';
			const selected = forceSelectKey || btn.getAttribute('data-wishlist-key') || 'default';
			keys.forEach((key) => {
				const row = document.createElement('label');
				row.className = 'skynsmfa-list-modal__option';
				const radio = document.createElement('input');
				radio.type = 'radio';
				radio.name = 'skynsmfa_pick_list';
				radio.value = key;
				if (key === selected) {
					radio.checked = true;
				}
				const span = document.createElement('span');
				span.textContent = formatListLabel(key, names);
				row.appendChild(radio);
				row.appendChild(span);
				listWrap.appendChild(row);
			});
		}

		renderKeys(listPickerCache.keys, null, listPickerCache.names);

		btnCancel.addEventListener('click', () => {
			if (root.classList.contains('skynsmfa-list-modal--busy')) {
				return;
			}
			closeListPickerModal(root);
		});
		root.addEventListener('click', (ev) => {
			if (ev.target === root && !root.classList.contains('skynsmfa-list-modal--busy')) {
				closeListPickerModal(root);
			}
		});

		btnAdd.addEventListener('click', () => {
			if (root.classList.contains('skynsmfa-list-modal--busy')) {
				return;
			}

			const picked = listWrap.querySelector('input[name="skynsmfa_pick_list"]:checked');
			const wishlistKey = picked ? picked.value : 'default';
			const variationMsg = requireVariationForSingleAdd(btn, variationId);
			if (variationMsg) {
				alert(variationMsg);
				return;
			}

			setListModalLoading(root, true);
			setButtonLoading(btn, true);

			post('skynsmfa_add_to_wishlist', withWishlistContext(btn, {
				product_id: productId,
				qty: 1,
				wishlist_key: wishlistKey,
				variation_id: variationId,
			}))
				.then((res) => {
					if (res && res.success) {
						btn.setAttribute('data-wishlist-key', wishlistKey);
						updateWishlistButton(btn, true);
						syncMenuIconFromResponse(res);
						notify((i.added) || 'Added to wishlist.', btn);
						closeListPickerModal(root);
						return;
					}
					alert((res && res.data && res.data.message) || (cfg.i18n && cfg.i18n.error) || 'Error');
				})
				.catch(() => alert((cfg.i18n && cfg.i18n.error) || 'Error'))
				.finally(() => {
					setListModalLoading(root, false);
					setButtonLoading(btn, false);
				});
		});

		btnAdd.focus();
	}

	function onDocumentClick(e) {
		const target = e.target;

		// Handle generic add/remove wishlist button (loop/single)
		if (target && target.closest && target.closest('.skynsmfa-wishlist-button')) {
			const btn = target.closest('.skynsmfa-wishlist-button');
			e.preventDefault();

			const productId = parseInt(btn.getAttribute('data-product-id') || '0', 10) || 0;
			if (!productId) return;

			const wishlistKey = getWishlistKey(btn);
			const isAdded = btn.classList.contains('is-added');
			const promptAdd = btn.getAttribute('data-skynsmfa-prompt-add') === '1';
			const usePicker = !isAdded && promptAdd && settings.multiple_lists_enabled && settings.add_target_mode === 'ask';

			if (usePicker) {
				const variationId = getVariationIdFromButton(btn);
				const variationMsg = !isAdded ? requireVariationForSingleAdd(btn, variationId) : null;
				if (variationMsg) {
					alert(variationMsg);
					return;
				}
				openListPickerModal(btn, productId, variationId);
				return;
			}

			const variationId = getVariationIdFromButton(btn);
			if (!isAdded) {
				const variationMsg = requireVariationForSingleAdd(btn, variationId);
				if (variationMsg) {
					alert(variationMsg);
					return;
				}
			}

			const updateVariationOnSingle = isAdded
				&& getContextFromButton(btn) === 'single'
				&& variationId > 0
				&& document.querySelector('form.variations_form');

			const action = (isAdded && !updateVariationOnSingle)
				? 'skynsmfa_remove_from_wishlist'
				: 'skynsmfa_add_to_wishlist';
			const successMessage = (isAdded && !updateVariationOnSingle)
				? (cfg.i18n && cfg.i18n.removed ? cfg.i18n.removed : 'Removed from wishlist.')
				: (cfg.i18n && cfg.i18n.added ? cfg.i18n.added : 'Added to wishlist.');

			setButtonLoading(btn, true);

			post(action, withWishlistContext(btn, { product_id: productId, qty: 1, wishlist_key: wishlistKey, variation_id: variationId }))
				.then((res) => {
					if (res && res.success) {
						const nowAdded = action === 'skynsmfa_add_to_wishlist' || updateVariationOnSingle;
						if (nowAdded) {
							btn.setAttribute('data-wishlist-key', wishlistKey);
						}
						updateWishlistButton(btn, nowAdded);
						syncMenuIconFromResponse(res);
						notify(successMessage, btn);
						return;
					}
					alert((res && res.data && res.data.message) || (cfg.i18n && cfg.i18n.error) || 'Error');
				})
				.catch(() => alert((cfg.i18n && cfg.i18n.error) || 'Error'))
				.finally(() => setButtonLoading(btn, false));
			return;
		}

		// Handle create new wishlist button
		if (target && target.closest && target.closest('.skynsmfa-create-list-btn')) {
			const btn = target.closest('.skynsmfa-create-list-btn');
			e.preventDefault();

			const listName = window.prompt('Enter a name for your new wishlist:');
			if (!listName) {
				return;
			}

			createWishlist(listName);
			return;
		}

		// Handle rename wishlist list
		if (target && target.closest && target.closest('.skynsmfa-rename-list-btn')) {
			const btn = target.closest('.skynsmfa-rename-list-btn');
			e.preventDefault();

			const wishlistKey = btn.getAttribute('data-wishlist-key') || '';
			if (!wishlistKey) {
				return;
			}

			const i = cfg.i18n || {};
			const currentName = btn.getAttribute('data-list-name') || formatListLabel(wishlistKey);
			const promptMessage = i.rename_list_prompt || 'Enter a new name for this list:';
			const listName = window.prompt(promptMessage, currentName);
			if (!listName || !listName.trim() || listName.trim() === currentName.trim()) {
				return;
			}

			setButtonLoading(btn, true);
			post('skynsmfa_rename_wishlist', { wishlist_key: wishlistKey, list_name: listName.trim() })
				.then((res) => {
					if (res && res.success) {
						window.location.reload();
						return;
					}
					alert((res && res.data && res.data.message) || (i.error) || 'Error');
					setButtonLoading(btn, false);
				})
				.catch(() => {
					alert((i.error) || 'Error');
					setButtonLoading(btn, false);
				});
			return;
		}

		// Handle delete wishlist list
		if (target && target.closest && target.closest('.skynsmfa-delete-list-btn')) {
			const btn = target.closest('.skynsmfa-delete-list-btn');
			e.preventDefault();

			const wishlistKey = btn.getAttribute('data-wishlist-key') || '';
			if (!wishlistKey || wishlistKey === 'default') {
				return;
			}

			const i = cfg.i18n || {};
			const confirmMessage = i.delete_list_confirm || 'Delete this list and all items in it? This cannot be undone.';
			if (!window.confirm(confirmMessage)) {
				return;
			}

			setButtonLoading(btn, true);
			post('skynsmfa_delete_wishlist', { wishlist_key: wishlistKey })
				.then((res) => {
					if (res && res.success) {
						window.location.reload();
						return;
					}
					alert((res && res.data && res.data.message) || (i.error) || 'Error');
					setButtonLoading(btn, false);
				})
				.catch(() => {
					alert((i.error) || 'Error');
					setButtonLoading(btn, false);
				});
			return;
		}

		// Handle Remove from Wishlist (Table)
		if (target && target.closest && target.closest('.skynsmfa-remove-btn')) {
			const btn = target.closest('.skynsmfa-remove-btn');
			e.preventDefault();
			
			const productId = parseInt(btn.getAttribute('data-product-id') || '0', 10) || 0;
			const wishlistKey = btn.getAttribute('data-wishlist-key') || 'default';
			if (!productId) return;

			btn.style.opacity = '0.5';
			post('skynsmfa_remove_from_wishlist', { product_id: productId, wishlist_key: wishlistKey })
				.then((res) => {
					if (res && res.success) {
						window.location.reload();
					} else {
						alert((res && res.data && res.data.message) || 'Error removing item.');
					}
				})
				.catch(() => alert('Error removing item.'));
			return;
		}

		// Handle Single Move to Cart
		if (target && target.closest && target.closest('.skynsmfa-move-to-cart-btn')) {
			const btn = target.closest('.skynsmfa-move-to-cart-btn');
			e.preventDefault();

			const productId = parseInt(btn.getAttribute('data-product-id') || '0', 10) || 0;
			const wishlistKey = btn.getAttribute('data-wishlist-key') || 'default';
			if (!productId) return;

			setButtonLoading(btn, true);
			post('skynsmfa_move_to_cart', { product_id: productId, wishlist_key: wishlistKey })
				.then((res) => {
					if (res && res.success) {
						window.location.reload();
					} else {
						alert((res && res.data && res.data.message) || 'Error moving to cart.');
						setButtonLoading(btn, false);
					}
				})
				.catch(() => {
					alert('Error moving to cart.');
					setButtonLoading(btn, false);
				});
			return;
		}

		// Handle Bulk Move to Cart
		if (target && target.closest && target.closest('.skynsmfa-bulk-move-btn')) {
			const btn = target.closest('.skynsmfa-bulk-move-btn');
			e.preventDefault();

			const wishlistKey = btn.getAttribute('data-wishlist-key') || 'default';
			const table = btn.closest('.skynsmfa-wishlist-box').querySelector('table');
			
			const checkboxes = table.querySelectorAll('.skynsmfa-item-select:checked');
			const productIds = Array.from(checkboxes).map(cb => parseInt(cb.value, 10));

			if (productIds.length === 0) {
				alert('Please select at least one item.');
				return;
			}

			setButtonLoading(btn, true);
			
			// Custom post parser for arrays since URLSearchParams doesn't array map intuitively in native fetch sometimes, 
			// but we can pass them as multiple fields: product_ids[]=1&product_ids[]=2
			const params = new URLSearchParams();
			params.append('action', 'skynsmfa_move_multiple_to_cart');
			params.append('nonce', cfg.nonce);
			params.append('wishlist_key', wishlistKey);
			productIds.forEach(id => params.append('product_ids[]', id));

			fetch(cfg.ajax_url, {
				method: 'POST',
				credentials: 'same-origin',
				headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
				body: params.toString(),
			})
			.then(r => r.json())
			.then((res) => {
				if (res && res.success) {
					window.location.reload();
				} else {
					alert((res && res.data && res.data.message) || 'Error moving items to cart.');
					setButtonLoading(btn, false);
				}
			})
			.catch(() => {
				alert('Error moving items to cart.');
				setButtonLoading(btn, false);
			});
			return;
		}

		// Handle select all checkbox
		if (target && target.classList && target.classList.contains('skynsmfa-select-all')) {
			const table = target.closest('table');
			const checkboxes = table.querySelectorAll('.skynsmfa-item-select');
			checkboxes.forEach(cb => cb.checked = target.checked);
			return;
		}

		// Add all in list to cart
		if (target && target.closest && target.closest('.skynsmfa-add-all-cart-btn')) {
			const btn = target.closest('.skynsmfa-add-all-cart-btn');
			e.preventDefault();
			const wishlistKey = btn.getAttribute('data-wishlist-key') || 'default';
			setButtonLoading(btn, true);
			post('skynsmfa_add_all_to_cart', { wishlist_key: wishlistKey })
				.then((res) => {
					if (res && res.success) {
						window.location.reload();
					} else {
						alert((res && res.data && res.data.message) || (cfg.i18n && cfg.i18n.error) || 'Error');
						setButtonLoading(btn, false);
					}
				})
				.catch(() => {
					alert((cfg.i18n && cfg.i18n.error) || 'Error');
					setButtonLoading(btn, false);
				});
			return;
		}
	}

	document.addEventListener('click', onDocumentClick, false);

	if (document.readyState === 'loading') {
		document.addEventListener('DOMContentLoaded', initVariableSingleProduct);
	} else {
		initVariableSingleProduct();
	}
})();

