<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  =============================================================================
  B27 English — Office JS Add-in manifest.xml
  B27 英文版 — Office JS 加载项 manifest.xml
  =============================================================================
  How to use:
  1. Replace <Id> with your own GUID (search "GUID generator").
  2. Default dev port is 3000; if you change it, update all URLs in <Resources>.
  3. Sideload: Excel → Insert → Add-ins → My Add-ins → Upload My Add-in → pick this file.
  =============================================================================
-->
<OfficeApp
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xsi:type="TaskPaneApp">
  <Id>626fad87-8dc1-4a6a-98f8-5864bf21eafa</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Cheng Xiao Tutorial Sample</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <!-- Display name -->
  <DisplayName DefaultValue="My Custom Functions Sample" />
  <!-- Add-in description -->
  <Description DefaultValue="An Office JS custom-functions add-in scaffolded by AI." />

  <!--
    ========================================================================
    Requirements: capability sets required by this add-in.
    ========================================================================
    CustomFunctionsRuntime 1.1 is REQUIRED for custom functions.
    Without it, =TUTORIAL.ADD(1,2) returns #NAME?.
  -->
  <Requirements>
    <Sets>
      <Set Name="CustomFunctionsRuntime" MinVersion="1.1" />
    </Sets>
  </Requirements>

  <!-- Hosts: only Excel workbook here -->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>

  <!-- DefaultSettings: default landing page when the add-in opens -->
  <DefaultSettings>
    <SourceLocation DefaultValue="https://localhost:3000/taskpane.html" />
  </DefaultSettings>

  <!-- Permissions: ReadWriteDocument = can read/write document -->
  <Permissions>ReadWriteDocument</Permissions>

  <!--
    ========================================================================
    VersionOverrides: extension configuration.
    Key points:
      - <Namespace resid="..." />: namespace prefix used in cell calls (prefix.functionName)
      - <Script> + <Page> + <Metadata>: point to functions.js / functions.html / functions.json
      - All three <SourceLocation> use CHILD ELEMENT syntax (NOT DefaultValue attribute)
    ========================================================================
  -->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Workbook">

        <!-- All form factors (desktop + web) -->
        <AllFormFactors>
          <ExtensionPoint xsi:type="CustomFunctions">
            <Script>
              <SourceLocation resid="Functions.Script.Url" />
            </Script>
            <Page>
              <SourceLocation resid="Functions.Page.Url" />
            </Page>
            <Metadata>
              <SourceLocation resid="Functions.Metadata.Url" />
            </Metadata>
            <!-- Namespace uses resid reference; actual value lives in <bt:ShortStrings> below -->
            <Namespace resid="Functions.Namespace" />
          </ExtensionPoint>
        </AllFormFactors>

        <!-- Desktop-only: taskpane button -->
        <DesktopFormFactor>
          <FunctionFile resid="Commands.Url" />
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <OfficeTab id="TabHome">
              <Group id="CommandsGroup">
                <Label resid="CommandsGroup.Label" />
                <Control xsi:type="Button" id="TaskPaneButton">
                  <Label resid="TaskPaneButton.Label" />
                  <Supertip>
                    <Title resid="TaskPaneButton.Label" />
                    <Description resid="TaskPaneButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16" />
                    <bt:Image size="32" resid="Icon.32x32" />
                    <bt:Image size="80" resid="Icon.80x80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <TaskpaneId>TaskPaneId1</TaskpaneId>
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>

      </Host>
    </Hosts>

    <!--
      ======================================================================
      Resources: all resid values defined here.
      Key point: icon files must physically exist under https://localhost:3000/assets/
      ======================================================================
    -->
    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png" />
        <bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png" />
        <bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Commands.Url"             DefaultValue="https://localhost:3000/commands.html" />
        <bt:Url id="Taskpane.Url"            DefaultValue="https://localhost:3000/taskpane.html" />
        <bt:Url id="Functions.Script.Url"    DefaultValue="https://localhost:3000/functions.js" />
        <bt:Url id="Functions.Page.Url"      DefaultValue="https://localhost:3000/functions.html" />
        <bt:Url id="Functions.Metadata.Url"  DefaultValue="https://localhost:3000/functions.json" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="CommandsGroup.Label"   DefaultValue="My Add-in" />
        <bt:String id="TaskPaneButton.Label"  DefaultValue="Open Help Pane" />
        <!-- Actual namespace value — determines the call prefix in Excel (prefix.functionName) -->
        <bt:String id="Functions.Namespace"   DefaultValue="TUTORIAL" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="TaskPaneButton.Tooltip" DefaultValue="Click to learn how to use the custom functions" />
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>