const prepareStaticDataConfigs = function prepareStaticDataConfigs(opts) {
  const {
    flatpackConfig = {},
    data = []
  } = opts;
  const {
    manifestUrl,
    pageConfigUrl,
    pageConfigInterval = 10000,
    baseFileUrl
  } = flatpackConfig;
  const allFiles = [
  // Flatpack manifest
  manifestUrl && {
    url: manifestUrl,
    type: 'pages-manifest'
  },
  // Flatpack page config
  pageConfigUrl && {
    url: pageConfigUrl,
    type: 'current-page',
    refreshRate: pageConfigInterval
  }, ...data];
  const dataFiles = allFiles.filter(Boolean).map(config => {
    const {
      key,
      url: fileUrl,
      data: staticData,
      ...restConfig
    } = config;
    const url = baseFileUrl ? new URL(fileUrl, baseFileUrl).href : fileUrl;
    const standard = {
      config: {
        url,
        key: key || url,
        ...restConfig
      }
    };
    if (staticData) {
      standard.data = staticData;
    }
    return standard;
  });
  return dataFiles;
};
export default prepareStaticDataConfigs;