1import{s as p}from"./index-DMraBsI-.js";import"./ui-vendor-C-1KqH15.js";import"./react-vendor-ByDWXJvr.js";import"./three-vendor-CfDQ9C4v.js";import"./pdf-vendor-BLM9xNEA.js";import"./stream-vendor-CoRm0Xqa.js";const d="https://smmggpsqmtmlzcgyjulx.supabase.co",h=`${d}/functions/v1/proxy-export-video`;async function f(t){try{if(!t.startsWith(d))return t;const e=t.match(/\/storage\/v1\/object\/(?:public|sign|authenticated)\/([^/]+)\/([^?]+)/);if(!e)return t;const n=e[1],s=decodeURIComponent(e[2]),{data:r,error:i}=await p.storage.from(n).createSignedUrl(s,3600);return i||!(r!=null&&r.signedUrl)?t:r.signedUrl}catch{return t}}const w=["playgrounds-storage-public.runcomfy.net","playgrounds-storage.runcomfy.net","runcomfy.net","replicate.delivery"];function l(t){try{const e=new URL(t);return w.some(n=>e.hostname===n||e.hostname.endsWith(`.${n}`))}catch{return!1}}function u(t,e){const n=new URLSearchParams({url:t});return e&&n.set("videoId",e),`${h}?${n.toString()}`}const m=t=>new Promise(e=>setTimeout(e,t));async function P(t,e={}){const n=e.maxAttempts??3;let s=l(t)?u(t,e.videoId):t,r=s!==t,i;for(let a=1;a<=n;a++)try{const o=await fetch(s,{method:"GET",headers:{Accept:"video/mp4,video/*,*/*"},cache:"no-store"});if(o.ok)return await o.blob();if((o.status===401||o.status===403)&&!r){const c=await f(t);if(c!==s){s=c;continue}}if(o.status===429||o.status>=500){i=new Error(`HTTP ${o.status}`),await m(500*a);continue}if(!r&&o.status>=400&&o.status<500){s=u(t,e.videoId),r=!0;continue}throw new Error(`HTTP ${o.status}`)}catch(o){if(i=o,!r){s=u(t,e.videoId),r=!0;continue}if(a===1){const c=await f(t);if(c!==t&&s!==c){s=c,r=!1;continue}}if(a<n){await m(500*a);continue}}throw i instanceof Error?i:new Error("Failed to download video")}export{P as fetchVideoBlob};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.