"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[2576],{42576:(t,n,a)=>{a.r(n),a.d(n,{default:()=>o});var e=a(93150),i=a.n(e);async function o({data:t,id:n,label:a}){if(!await i().permissions.contains({permissions:["downloads"]})){const t=new Error("no-permission");throw t.data={permission:"downloads"},t}let e=[t.url],o=0;const s=n=>{const a={url:n,conflictAction:t.onConflict};let e=t.filename||function(t){try{const n=new URL(t).pathname.split("/").pop();return/\.[0-9a-z]+$/i.test(n)?n:null}catch(t){return null}}(n);return e&&("overwrite"===t.onConflict&&0!==o&&(e=`(${o}) ${e}`),a.filename=e,o+=1),i().downloads.download(a)};return"element"===t.type?(e=await this._sendMessageToTab({id:n,data:t,label:a,tabId:this.activeTab.id}),await Promise.all(e.map((t=>s(t))))):"url"===t.type&&await s(t.url),{data:e,nextBlockId:this.getBlockConnections(n)}}}}]);