<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script authoringTool="Packages" authoringToolVersion="1.2.11" authoringToolBuild="765" minSpecVersion="1.0">
    <options hostArchitectures="x86_64"/>
    <volume-check script="volume_check()"/>
    <!--+==========================+
        |       Presentation       |
        +==========================+-->
    <title>DISTRIBUTION_TITLE</title>
    <background-darkAqua file="background-darkAqua" uti="public.png" scaling="proportional" alignment="bottomleft"/>
    <background file="background" uti="public.png" scaling="proportional" alignment="bottomleft"/>
    <license file="license.rtf"/>
    <!--+==========================+
        |         Installer        |
        +==========================+-->
    <choices-outline>
        <line choice="installer_choice_1"/>
        <line choice="installer_choice_2"/>
        <line choice="installer_choice_3"/>
        <line choice="installer_choice_4"/>
        <line choice="installer_choice_5"/>
        <line choice="installer_choice_6"/>
    </choices-outline>
    <choice id="installer_choice_1" start_visible="installer_choice_1_requirement(true,false)" start_enabled="installer_choice_1_requirement(false,true)" start_selected="installer_choice_1_requirement(false,false)" title="INSTALLER_CHOICE_1_TITLE" description="INSTALLER_CHOICE_1_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2027"/>
    </choice>
    <choice id="installer_choice_2" start_visible="installer_choice_2_requirement(true,false)" start_enabled="installer_choice_2_requirement(false,true)" start_selected="installer_choice_2_requirement(false,false)" title="INSTALLER_CHOICE_2_TITLE" description="INSTALLER_CHOICE_2_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2027.scripting"/>
    </choice>
    <choice id="installer_choice_3" start_visible="installer_choice_3_requirement(true,false)" start_enabled="installer_choice_3_requirement(false,true)" start_selected="installer_choice_3_requirement(false,false)" title="INSTALLER_CHOICE_3_TITLE" description="INSTALLER_CHOICE_3_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2026"/>
    </choice>
    <choice id="installer_choice_4" start_visible="installer_choice_4_requirement(true,false)" start_enabled="installer_choice_4_requirement(false,true)" start_selected="installer_choice_4_requirement(false,false)" title="INSTALLER_CHOICE_4_TITLE" description="INSTALLER_CHOICE_4_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2026.scripting"/>
    </choice>
    <choice id="installer_choice_5" start_visible="installer_choice_5_requirement(true,false)" start_enabled="installer_choice_5_requirement(false,true)" start_selected="installer_choice_5_requirement(false,false)" title="INSTALLER_CHOICE_5_TITLE" description="INSTALLER_CHOICE_5_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2025"/>
    </choice>
    <choice id="installer_choice_6" start_visible="installer_choice_6_requirement(true,false)" start_enabled="installer_choice_6_requirement(false,true)" start_selected="installer_choice_6_requirement(false,false)" title="INSTALLER_CHOICE_6_TITLE" description="INSTALLER_CHOICE_6_DESCRIPTION">
        <pkg-ref id="com.typefi.typefitter.cc2025.scripting"/>
    </choice>
    <!--+==========================+
        |    Package References    |
        +==========================+-->
    <pkg-ref id="com.typefi.typefitter.cc2025.scripting" version="5.0" auth="Root" installKBytes="23573">#Typefitter_5_Scripting_for_InDesign_2025.pkg</pkg-ref>
    <pkg-ref id="com.typefi.typefitter.cc2025" version="5.0" auth="Root" installKBytes="25280">#Typefitter_5_for_InDesign_2025.pkg</pkg-ref>
    <pkg-ref id="com.typefi.typefitter.cc2027.scripting" version="5.0" auth="Root" installKBytes="23658">#Typefitter_5_Scripting_for_InDesign_2027.pkg</pkg-ref>
    <pkg-ref id="com.typefi.typefitter.cc2026.scripting" version="5.0" auth="Root" installKBytes="23491">#Typefitter_5_Scripting_for_InDesign_2026.pkg</pkg-ref>
    <pkg-ref id="com.typefi.typefitter.cc2026" version="5.0" auth="Root" installKBytes="25227">#Typefitter_5_for_InDesign_2026.pkg</pkg-ref>
    <pkg-ref id="com.typefi.typefitter.cc2027" version="5.0" auth="Root" installKBytes="25390">#Typefitter_5_for_InDesign_2027.pkg</pkg-ref>
    <!--+==========================+
        |    JavaScript Scripts    |
        +==========================+-->
    <script>

	const __IC_FLAT_DISTRIBUTION__=true;
	const IC_OS_DISTRIBUTION_TYPE_ANY=0;
	const IC_OS_DISTRIBUTION_TYPE_CLIENT=1;
	const IC_DISK_TYPE_DESTINATION=0;
	const IC_OS_DISTRIBUTION_TYPE_SERVER=2;
	const IC_DISK_TYPE_STARTUP_DISK=1;

	const IC_CONDITION_EXIST=0;
	const IC_CONDITION_DOES_NOT_EXIST=1;
	const IC_SELECTOR_ANY=0;
	const IC_SELECTOR_ALL=1;

	function IC_CheckOS(inDiskType,inMustBeInstalled,inMinimumVersion,inMaximumVersion,inDistributionType)
	{
		var tOSVersion=undefined;
		
		/* Check Version Constraints */
		
		if (inDiskType==IC_DISK_TYPE_DESTINATION)
		{
			if (my.target.systemVersion!=undefined)
			{
				tOSVersion=my.target.systemVersion.ProductVersion;
			}
			
			/* Check if no OS is installed on the potential target */
			
			if (tOSVersion==undefined)
			{
				return (inMustBeInstalled==false);
			}
			
			if (inMustBeInstalled==false)
			{
				return false;
			}
		}
		else
		{
			tOSVersion=system.version.ProductVersion;
		}
		
		if (system.compareVersions(tOSVersion,inMinimumVersion)==-1)
			return false;
			
		if (inMaximumVersion!=undefined &amp;&amp;
			system.compareVersions(tOSVersion,inMaximumVersion)==1)
			return false;
		
		/* Check Distribution Type */
		
		if (inDistributionType!=IC_OS_DISTRIBUTION_TYPE_ANY)
		{
			var tIsServer;
			
			if (system.compareVersions(tOSVersion,'10.8.0')==-1)
			{
				if (inDiskType==IC_DISK_TYPE_DESTINATION)
				{
					tIsServer=system.files.fileExistsAtPath(my.target.mountpoint+'/System/Library/CoreServices/ServerVersion.plist');
				}
				else
				{
					tIsServer=system.files.fileExistsAtPath('/System/Library/CoreServices/ServerVersion.plist');
				}
			}
			else
			{
				if (inDiskType==IC_DISK_TYPE_DESTINATION)
				{
					tIsServer=system.files.fileExistsAtPath(my.target.mountpoint+'/Applications/Server.app');
				}
				else
				{
					tIsServer=system.files.fileExistsAtPath('/Applications/Server.app');
				}
			}
			
			if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_CLIENT &amp;&amp; tIsServer==true)
			{
				return false;
			}
			
			if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_SERVER &amp;&amp; tIsServer==false)
			{
				return false;
			}
		}
		
		return true;
	}

	function volume_check()
	{
		var tResult;

		tResult=IC_CheckOS(IC_DISK_TYPE_DESTINATION,true,'10.7.3',undefined,IC_OS_DISTRIBUTION_TYPE_ANY);

		if (tResult==false)
		{
			my.result.message = system.localizedString('REQUIREMENT_FAILED_MESSAGE_VOLUME_CHECK_1');
			my.result.type = 'Fatal';
		}

		return tResult;
	}

	function IC_CheckFiles(inSelector,inCondition,inDiskType,inFiles)
	{
		var tCount;
		
		tCount=inFiles.length;
		
		if (tCount&gt;0)
		{
			var tIndex;
			var tExists;
			var tPath;
			var atLeastOneTrue=false;
			
			for(tIndex=0;tIndex&lt;tCount;tIndex++)
			{
				tPath=inFiles[tIndex];
			
				if (inDiskType==IC_DISK_TYPE_DESTINATION)
				{
					tPath=my.target.mountpoint+tPath;
				}
			
				if (system.files.fileExistsAtPath(tPath)==true)
				{
					if (inCondition==IC_CONDITION_EXIST)
					{
						atLeastOneTrue=true;
						
						if (inSelector==IC_SELECTOR_ANY)
						{
							return true;
						}
					}
					else if (inCondition==IC_CONDITION_DOES_NOT_EXIST &amp;&amp; inSelector==IC_SELECTOR_ALL)
					{
						return false;
					}
				}
				else
				{
					if (inCondition==IC_CONDITION_EXIST &amp;&amp; inSelector==IC_SELECTOR_ALL)
					{
						return false;
					}
					else if (inCondition==IC_CONDITION_DOES_NOT_EXIST)
					{
						atLeastOneTrue=true;
						
						if (inSelector==IC_SELECTOR_ANY)
						{
							return true;
						}
					}
				}
			}
		
			return atLeastOneTrue;
		}
		
		return true;
	}

	function installer_choice_1_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2027/Adobe InDesign 2027.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

	function installer_choice_2_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2027/Adobe InDesign 2027.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

	function installer_choice_3_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2026/Adobe InDesign 2026.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

	function installer_choice_4_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2026/Adobe InDesign 2026.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

	function installer_choice_5_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2025/Adobe InDesign 2025.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

	function installer_choice_6_requirement(inCheckVisibilityOnly,inShowFailedToolTip)
	{
		var tResult;

		var tFilesToCheck0=new Array('/Applications/Adobe InDesign 2025/Adobe InDesign 2025.app/Contents/Info.plist');

		tResult=IC_CheckFiles(IC_SELECTOR_ANY,IC_CONDITION_EXIST,IC_DISK_TYPE_DESTINATION,tFilesToCheck0);


		return tResult;
	}

    </script>
</installer-gui-script>