function openDialog({ files, config, handleInsert, settings = {} }) {
  if (settings.defaultOperations && !settings.defaultOperations.startsWith('/')) {
    console.warn(
      'Uploadcare default operations should start with `/`. Example: `/preview/-/resize/100x100/image.png`',
    );
  }

  function buildUrl(fileInfo) {
    const { cdnUrl, name, isImage } = fileInfo;

    let url =
      isImage && settings.defaultOperations ? `${cdnUrl}-${settings.defaultOperations}` : cdnUrl;
    const filenameDefined = !url.endsWith('/');

    if (!filenameDefined && settings.autoFilename) {
      url = url + name;
    }

    return url;
  }

  uploadcare.openDialog(files, config).done(({ promise, files }) => {
    const isGroup = Boolean(files);

    return promise().then(info => {
      if (isGroup) {
        return Promise.all(
          files().map(promise => promise.then(fileInfo => buildUrl(fileInfo))),
        ).then(urls => handleInsert(urls));
      } else {
        handleInsert(buildUrl(info));
      }
    });
  });
}
Open the standalone dialog. A single instance is created and destroyed for
each use.