{#snippet fileItem(file: VertFile, index: number)} {@const currentConverter = file.findConverter()} {@const isImage = currentConverter?.name === "imagemagick"} {@const isAudio = currentConverter?.name === "ffmpeg"} {@const isVideo = currentConverter?.name === "vertd"} {@const isDocument = currentConverter?.name === "pandoc"}
{#if !converters.length} {:else if isAudio} {:else if isVideo} {:else if isDocument} {:else} {/if}
{#if file.processing} {:else}

{file.name}

{/if}
{#if !currentConverter} {#if file.name.startsWith("vertd")}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.vertd_server"]()}

{:else}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.unsupported_format"]()}

{/if} {:else} {@const formatInfo = currentConverter.supportedFormats.find( (f) => f.name === file.from, )} {@const isLarge = file.isLarge()} {#if formatInfo && !formatInfo.fromSupported}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.format_output_only"]()}

{:else if isLarge && !file.supportsStreaming()}

{m["convert.errors.cant_convert"]()}

{m["workers.errors.file_too_large"]({ limit: (MAX_ARRAY_BUFFER_SIZE / GB).toFixed(2), })}

{:else if currentConverter.status === "downloading"}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.worker_downloading"]({ type: isAudio ? m["convert.errors.audio"]() : isVideo ? "Video" : isDocument ? m["convert.errors.doc"]() : m["convert.errors.image"](), })}

{:else if currentConverter.status === "error"}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.worker_error"]({ type: isAudio ? m["convert.errors.audio"]() : isVideo ? "Video" : isDocument ? m["convert.errors.doc"]() : m["convert.errors.image"](), })}

{:else if currentConverter.status === "not-ready"}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.worker_timeout"]({ type: isAudio ? m["convert.errors.audio"]() : isVideo ? "Video" : isDocument ? m["convert.errors.doc"]() : m["convert.errors.image"](), })}

{:else if isVideo && !$vertdLoaded && !isAudio && !isImage && !isDocument}

{m["convert.errors.cant_convert"]()}

{m["convert.errors.vertd_not_found"]()}

{:else}
{#if file.blobUrl} {file.name} {:else}
{#if isAudio} {:else if isVideo} {:else if isDocument} {:else} {/if}
{/if}
handleSelect(option, file)} {file} />
{/if} {/if}
{/snippet}
{#each files.files as file, i (file.id)} {#if files.files.length >= 2 && i === 1} {/if} {@render fileItem(file, i)} {#if files.files.length < 2} {/if} {/each} {#if files.files.length === 0} {/if}