# download assets
download:
    #!/usr/bin/env bash
    set -euxo pipefail

    # Bootstrap Datepicker Styles
    curl -fsSLo datepicker.zip https://github.com/uxsolutions/bootstrap-datepicker/releases/download/v1.6.4/bootstrap-datepicker-1.6.4-dist.zip
    unzip -p datepicker.zip css/bootstrap-datepicker.standalone.min.css \
        > bootstrap-datepicker.standalone.min.css

    # Shiny Server Client
    SSCLIENT_VERSION=1.2.0
    curl -fsSLo shiny-server-client.zip "https://github.com/rstudio/shiny-server-client/archive/v${SSCLIENT_VERSION}.zip"
    unzip -p shiny-server-client.zip "shiny-server-client-${SSCLIENT_VERSION}/dist/shiny-server-client.min.js" \
        > shiny-server-client.min.js

    # SockJS
    # Commented out until https://github.com/sockjs/sockjs-client/issues/563 is resolved.

    # NOTE: The ui sockjs-client dependency needs to be kept in sync
    # with the main sockjs-client repo and the assets/sockjs.min.js because
    # that is the JS served by the SockJsApiFilter for iframe requests.
    # https://github.com/posit-dev/connect/issues/20365

    # To create min.js and min.js.map files from the patched repo, clone the repo locally
    # and run `gulp browserify:min` in the directory. You may need to `npm install -g gulp`

    cat <<-EOF

    ****************************************
    SockJS needs to be manually installed from the branch:
      https://github.com/posit-dev/sockjs-client/tree/patch

    Resolves:
      https://github.com/sockjs/sockjs-client/issues/563

    Failing this task as a reminder to perform the manual SockJS install.
    ****************************************
    EOF

    rm -fv *.zip *.tar.gz

    # Remove after the SockJS update is released.
    exit 1
