"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[4034],{34034:(e,n,t)=>{t.r(n),t.d(n,{default:()=>d});var o=t(93150),a=t.n(o);const i=e=>/(?:\.([^.]+))?$/.exec(e)[1];function s(e,n){const t=JSON.parse(sessionStorage.getItem("rename-downloaded-files"))||{},o=t[e.id];if(!o)return!0;if(!i(o.filename)){const n=i(e.filename);o.filename+=`.${n}`}return o.waitForDownload||delete t[e.id],sessionStorage.setItem("rename-downloaded-files",JSON.stringify(t)),n({filename:o.filename,conflictAction:o.onConflict}),!1}const d=function({data:e,id:n}){const t=this.getBlockConnections(n),o=()=>JSON.parse(sessionStorage.getItem("rename-downloaded-files"))||{};return new Promise((n=>{if(!this.activeTab.id)throw new Error("no-tab");chrome.downloads.onDeterminingFilename.hasListeners((()=>{}))||chrome.downloads.onDeterminingFilename.addListener(s);let i=null;const d=({id:n})=>{if(i)return;const t=o();i=n,t[n]=e,sessionStorage.setItem("rename-downloaded-files",JSON.stringify(t)),a().downloads.onCreated.removeListener(d)};if(a().downloads.onCreated.addListener(d),!e.waitForDownload)return void n({nextBlockId:t,data:e.filename});let r=!1,l=e.filename;const m=setTimeout((()=>{r||(r=!0,n({nextBlockId:t,data:l}))}),e.timeout),c=a=>{e.saveData&&this.addDataToColumn(e.dataColumn,l),e.assignVariable&&this.setVariable(e.variableName,l),clearTimeout(m),r=!0;const i=o();delete i[a],sessionStorage.setItem("rename-downloaded-files",JSON.stringify(i)),chrome.downloads.onDeterminingFilename.removeListener(s),n({nextBlockId:t,data:l})},f=({state:e,id:n,filename:t})=>{this.engine.isDestroyed||r?a().downloads.onChanged.removeListener(f):i===n&&(t&&(l=t.current),e&&"complete"===e.current?c(n):a().downloads.search({id:n}).then((([e])=>{e&&e.endTime&&c(n)})))};a().downloads.onChanged.addListener(f)}))}}}]);