<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--
  The macOS package's wizard. build-pkg.sh replaces 0.3.18.
  Apple silicon only: the encoder is an arm64 plugin that needs VideoToolbox's
  hardware HEVC (beta plan Q13).
-->
<installer-gui-script minSpecVersion="2">
    <title>Moonshine Server 0.3.18</title>
    <license file="EULA.txt"/>
    <conclusion file="conclusion.html" mime-type="text/html"/>
    <options customize="never" require-scripts="true" hostArchitectures="arm64"/>
    <domains enable_localSystem="true" enable_anywhere="false" enable_currentUserHome="false"/>
    <allowed-os-versions>
        <os-version min="13.0"/>
    </allowed-os-versions>
    <installation-check script="engineCheck()"/>
    <script><![CDATA[
// Mirrors the launcher's choice (tools/moonshine-launch.sh) as far as the
// installer can see: it cannot list /Applications, so it checks the names
// Derivative's installers use. The pinned build is 2025.33230.
function buildOf(path) {
  var info = system.files.bundleAtPath(path);
  return info ? info.CFBundleVersion : null;
}
function engineCheck() {
  var player = buildOf('/Applications/TouchPlayer.app');
  var designer = buildOf('/Applications/TouchDesigner.app');
  if (!player && !designer) {
    my.result.type = 'Fatal';
    my.result.title = 'TouchDesigner is not installed';
    my.result.message = 'Moonshine Server runs on TouchDesigner or TouchPlayer 2025.33230, '
      + 'which is Derivative\'s product and installed separately. Install it from '
      + 'derivative.ca/download, then run this installer again.';
    return false;
  }
  if (player !== '2025.33230' && designer !== '2025.33230') {
    my.result.type = 'Warning';
    my.result.title = 'A different TouchDesigner build';
    my.result.message = 'This version of Moonshine was tested with build 2025.33230, and this Mac has '
      + (player || designer) + '. It will run on that build, but a newer build can change how a '
      + 'show looks or behaves. The tested build is at derivative.ca/download.';
    return false;
  }
  return true;
}
  ]]></script>
    <choices-outline>
        <line choice="software.moonshine.server"/>
    </choices-outline>
    <choice id="software.moonshine.server" visible="false" title="Moonshine Server">
        <pkg-ref id="software.moonshine.server"/>
    </choice>
    <pkg-ref id="software.moonshine.server" version="0.3.18" onConclusion="none" installKBytes="26019" updateKBytes="0">#MoonshineServer.pkg</pkg-ref>
    <pkg-ref id="software.moonshine.server">
        <bundle-version>
            <bundle CFBundleShortVersionString="1.3" CFBundleVersion="1" id="io.tridant.moonbeam.out" path="data/plugins/Moonbeamout.plugin"/>
        </bundle-version>
    </pkg-ref>
</installer-gui-script>