clipoox-render 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/scripts/render-local.mjs +2367 -1534
- package/shared/photocraft/LICENSE.txt +206 -0
- package/shared/photocraft/clipoox_photo.js +396 -0
- package/shared/photocraft/clipoox_photo_bg.wasm +0 -0
- package/web/assets/{FxEmbed-B-D-tbgP.js → FxEmbed-adbxHEBi.js} +1 -1
- package/web/assets/ImageStudio-CMxiT1jp.js +3 -0
- package/web/assets/ImageStudio-De_DCTrz.css +1 -0
- package/web/assets/{MotionEmbed-eB-zRpv9.js → MotionEmbed-CDUIyjk0.js} +1 -1
- package/web/assets/{PluginStore-D6UvvVXA.js → PluginStore-By_pdOOg.js} +2 -2
- package/web/assets/ShotComposer-DcwWZ-eP.css +1 -0
- package/web/assets/ShotComposer-XIbJ4nNm.js +287 -0
- package/web/assets/{TemplateEmbed-DZNaQAJ-.js → TemplateEmbed-a01nKECT.js} +1 -1
- package/web/assets/{TimelinePlugins-zhB9Uqav.js → TimelinePlugins-CqLMVjuh.js} +4 -4
- package/web/assets/TimelineShotFx-QmkyCg31.js +2 -0
- package/web/assets/{TransitionEmbed-r_B0toRr.js → TransitionEmbed-Cbwlxfl2.js} +1 -1
- package/web/assets/{Whiteboard-f6owS-ne.js → Whiteboard-ChYqIr3v.js} +1 -1
- package/web/assets/{aerial-DIj143Yz.js → aerial-CZeCeacv.js} +2 -2
- package/web/assets/{agentTools-CoNs1wCQ.js → agentTools-DW2ETnxE.js} +2 -2
- package/web/assets/{aiInbetween-ZFNHEXdI.js → aiInbetween-De98iM4m.js} +2 -2
- package/web/assets/analyzerRun-D5-g-Vxe.js +1 -0
- package/web/assets/{analyzerSandbox-C2rd6s8U.js → analyzerSandbox-E3CdovIk.js} +1 -1
- package/web/assets/{api-DJC95K48.js → api-CZoVJ9Fy.js} +87 -87
- package/web/assets/auraTrack-ClhHuqlf.js +1 -0
- package/web/assets/{breakthrough-DiHiElqL.js → breakthrough-DTpiUIZd.js} +2 -2
- package/web/assets/{cameraPresets-DfKERP1j.js → cameraPresets-DD0WmxiI.js} +1 -1
- package/web/assets/{cameraTracker-DFjnZ7tw.js → cameraTracker-Df9jWmz6.js} +2 -2
- package/web/assets/{captionLayout-CAuhUiW9.js → captionLayout-eiu9QPJu.js} +1 -1
- package/web/assets/{clientExport-DyqpYM6h.js → clientExport-BXegTdNc.js} +1 -1
- package/web/assets/{clientJobs-BqkjV5Ld.js → clientJobs-eB-lNyin.js} +2 -2
- package/web/assets/clipoox_photo_bg-BQ0aVNY0.wasm +0 -0
- package/web/assets/depthEstimate-CfwX-tXP.js +1 -0
- package/web/assets/{directorTools-CLn4xt6m.js → directorTools-ABbI8m0e.js} +1 -1
- package/web/assets/distortFrames-DMnZ8OYh.js +2 -0
- package/web/assets/distortGL-DQu0Df2c.js +18 -0
- package/web/assets/{domino-BDKBYrNQ.js → domino-trmDBvfH.js} +1 -1
- package/web/assets/{editTools-BqKU-ucA.js → editTools-DEFo9Ahv.js} +1 -1
- package/web/assets/{engine-B2YPWQZ2.js → engine-Y-GotDIy.js} +1 -1
- package/web/assets/exportGlb-BeLpJKJT.js +2 -0
- package/web/assets/{faceTracker-DsmLlUZ1.js → faceTracker-BeSFnLM8.js} +1 -1
- package/web/assets/{fightDirector-BIVLGhAP.js → fightDirector-Dfz3vu5-.js} +1 -1
- package/web/assets/{fightDrama-B_jDQ-cW.js → fightDrama-CNVn69s0.js} +2 -2
- package/web/assets/{focusTool-mWs2Eikj.js → focusTool-Dd2UDkiO.js} +1 -1
- package/web/assets/{frameSink-DWkHUnvV.js → frameSink-Rj02YES5.js} +3 -3
- package/web/assets/{glTransitionSources.generated-BJuEUz3E.js → glTransitionSources.generated-Cs8lVRqs.js} +438 -2
- package/web/assets/{gpuCompose-Fi0sIUI9.js → gpuCompose-DkkKH1Ab.js} +1 -1
- package/web/assets/gpuExport-DwrXpVGF.js +199 -0
- package/web/assets/{handMatte-CvFkZKTL.js → handMatte-B5sUeqKi.js} +1 -1
- package/web/assets/{handTracker-CF1hqh09.js → handTracker-CQV-D7va.js} +2 -2
- package/web/assets/i18n-ClNt3LKg.js +3 -0
- package/web/assets/{index-EegUntr6.js → index-D2u6mD-8.js} +1 -1
- package/web/assets/layer-worker-DP0N05Ua.js +5 -0
- package/web/assets/library-cb43ZEmy.js +1 -0
- package/web/assets/{lottieLayer-Dp_vGTy8.js → lottieLayer-DEw0c3to.js} +4 -4
- package/web/assets/main-C_XcvNyC.js +311 -0
- package/web/assets/{main-B_MAOvi6.css → main-DlzdW5C4.css} +1 -1
- package/web/assets/{mapBake-CEmw-e9Y.js → mapBake-BUWz0cSx.js} +1 -1
- package/web/assets/{maskTrack-CADMBJDf.js → maskTrack-GYpJyKFw.js} +1 -1
- package/web/assets/matteFixRun-BCVsuSxf.js +1 -0
- package/web/assets/{objectLocate-DWsEG8eK.js → objectLocate-CjIlo_u0.js} +1 -1
- package/web/assets/{objectSegmenter-oGv8YQbI.js → objectSegmenter-C4T9qgUL.js} +1 -1
- package/web/assets/{objectTrack.worker-B6RVfsq4.js → objectTrack.worker-BVvsDmR0.js} +1161 -770
- package/web/assets/{pathTracer-DxqKEvC7.js → pathTracer-DgL1_83l.js} +2 -2
- package/web/assets/{pendingMatte-Taa0BlLI.js → pendingMatte-DPTe6xoZ.js} +2 -2
- package/web/assets/peopleMatte-C1hruEM6.js +1 -0
- package/web/assets/{personAi-BebqXrqD.js → personAi-Cjg9KKeH.js} +2 -2
- package/web/assets/{personHq-Cyq9HWnW.js → personHq-CBP8v_cw.js} +2 -2
- package/web/assets/photo.worker-DK_ulTzR.js +1 -0
- package/web/assets/photoRun-lZ2BdSEk.js +2 -0
- package/web/assets/photoTools-DmUh69Qk.js +1 -0
- package/web/assets/plateCamera-DLqlXhMp.js +1 -0
- package/web/assets/{plateCameraMatch-1_DuZ0LV.js → plateCameraMatch-4VUlUMi-.js} +2 -2
- package/web/assets/{plateFollow-Ztxwpq5v.js → plateFollow-D2rjnmZA.js} +2 -2
- package/web/assets/plateMatte-0tTG7oeO.js +2 -0
- package/web/assets/{pluginAutomation-D73Az7HS.js → pluginAutomation-ClFdpcCR.js} +1 -1
- package/web/assets/popTools-B38V4wub.js +1 -0
- package/web/assets/{poseTracker-b1h08oRY.js → poseTracker-qtuytI-L.js} +1 -1
- package/web/assets/{productTools-CoJ_Fnfc.js → productTools-DlC5vWjx.js} +2 -2
- package/web/assets/remote-CpkPQOQH.js +989 -0
- package/web/assets/{rigTrack-B9r9wrdV.js → rigTrack-BbKqZGs7.js} +1 -1
- package/web/assets/{rotoMaskStore-RmW40Pcn.js → rotoMaskStore-BZBJLcCp.js} +1 -1
- package/web/assets/{rotoMatte-DisQplSv.js → rotoMatte-BI-vjjrv.js} +1 -1
- package/web/assets/rotoscope-DuNcCxQy.js +1 -0
- package/web/assets/{sceneTrack-DyVxpl7i.js → sceneTrack-CO4fTjft.js} +1 -1
- package/web/assets/sceneTrack-_n6WKKQv.js +1 -0
- package/web/assets/{sceneTrack.worker-DKVLLgf9.js → sceneTrack.worker-f2d-WOzw.js} +1207 -816
- package/web/assets/{shot-worker-DM5PUQ6g.js → shot-worker-BSmfIXHO.js} +1 -1
- package/web/assets/{shotFxAgent-CsW0MAiG.js → shotFxAgent-L2GG88W3.js} +1 -1
- package/web/assets/{skin-CXvqtCZI.js → skin-CirUiqcr.js} +1 -1
- package/web/assets/{spark.module-B341moK0.js → spark.module-3Q8DniuL.js} +1 -1
- package/web/assets/{spellDuel-KCMEFHLA.js → spellDuel-2CDLbiLQ.js} +2 -2
- package/web/assets/{store-xR02oY0m.js → store-D3Y663py.js} +1 -1
- package/web/assets/{surfaceLight-DBfJxggM.js → surfaceLight--HQj7xhO.js} +1 -1
- package/web/assets/{surfacePin-i-X1Dz68.js → surfacePin-BCmgw-40.js} +2 -2
- package/web/assets/{textAnimators-CeMuG34D.js → textAnimators-C4eMnVRD.js} +1 -1
- package/web/assets/{thumb-DzNl15MN.js → thumb-M9B_goj-.js} +1 -1
- package/web/assets/{timeline3d-D0Ws4lcp.js → timeline3d-BcW68fQr.js} +2 -2
- package/web/assets/{timeline3dExport-BO--SpAn.js → timeline3dExport-DgnorHLm.js} +1 -1
- package/web/assets/timelineComp-Ciu9JCWJ.js +1 -0
- package/web/assets/timelineOps-f1WsVbgS.js +526 -0
- package/web/assets/{timelineProps-Cm_Irino.js → timelineProps-CE1R11Hx.js} +1 -1
- package/web/assets/{timelineText-DjPW2-dd.js → timelineText-Cppd4KB7.js} +1 -1
- package/web/assets/{titleArt-BSu80bfN.js → titleArt-D0YI5xT2.js} +3 -3
- package/web/assets/{titleFrameBudget-BW-N1-cw.js → titleFrameBudget-h4nOQ5u9.js} +1382 -991
- package/web/assets/titleFrames-DnCzi_AI.js +1 -0
- package/web/assets/{tool-Bboi3NDg.js → tool-tp6gat1J.js} +1 -1
- package/web/assets/{tools-kgYkohv8.js → tools-C07G9KUM.js} +1 -1
- package/web/assets/{toonTools-Bxz_HSqT.js → toonTools-Cazx2CL7.js} +2 -2
- package/web/assets/{trackAnchor-DK9cEMCf.js → trackAnchor-DoqFDcJB.js} +1 -1
- package/web/assets/{userFonts-DSkZHfmh.js → userFonts-BlVEJfDk.js} +1 -1
- package/web/assets/{vfxAlpha-B0rNpKZN.js → vfxAlpha-Bp6VgIGN.js} +1 -1
- package/web/assets/vfxBackground-BFq44Srn.js +2 -0
- package/web/assets/{videoExport-Cu0vw-dL.js → videoExport-Cz02XKtX.js} +1 -1
- package/web/assets/{views-CmulxRJP.js → views-CNF3Afse.js} +1 -1
- package/web/assets/{weaponDuel-DuuMMfzY.js → weaponDuel-ChqBQo_b.js} +1 -1
- package/web/assets/{windowFrames-BP2oDn-n.js → windowFrames-dBMXwGek.js} +1 -1
- package/web/layer-worker.html +3 -3
- package/web/shot-worker.html +24 -24
- package/web/assets/ShotComposer-CoxtWL6A.js +0 -287
- package/web/assets/ShotComposer-deLi4grZ.css +0 -1
- package/web/assets/TimelineShotFx-muTN__gf.js +0 -2
- package/web/assets/analyzerRun-BswbLsRF.js +0 -1
- package/web/assets/auraTrack-C9diszRB.js +0 -1
- package/web/assets/depthEstimate-HrGq0Ffx.js +0 -1
- package/web/assets/distortFrames-D-DK2HlN.js +0 -2
- package/web/assets/distortGL-waTJhiOf.js +0 -12
- package/web/assets/exportGlb-Cm07JQXt.js +0 -2
- package/web/assets/gpuExport-Dlf6YjLs.js +0 -198
- package/web/assets/i18n-C9zFX25m.js +0 -3
- package/web/assets/layer-worker-Drj-NLVj.js +0 -5
- package/web/assets/library-BhH-xsMR.js +0 -1
- package/web/assets/main-DAk1Tv1E.js +0 -309
- package/web/assets/matteFixRun-BHD3Qnta.js +0 -1
- package/web/assets/plateCamera-D1A1iEpf.js +0 -1
- package/web/assets/plateMatte-CWT1ymGj.js +0 -2
- package/web/assets/remote-kxNNhmis.js +0 -974
- package/web/assets/rotoscope-Z8bn-jRs.js +0 -1
- package/web/assets/sceneTrack-BKknn180.js +0 -1
- package/web/assets/timelineComp-D8PHGHgQ.js +0 -1
- package/web/assets/timelineOps-CEGk2t4h.js +0 -525
- package/web/assets/titleFrames-BHFaInux.js +0 -1
- package/web/assets/vfxBackground-CBTDl1xA.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as a,g as u}from"./i18n-C9zFX25m.js";import{a as m}from"./api-DJC95K48.js";import{cJ as p}from"./timelineOps-CEGk2t4h.js";import"./index-CKtv7gGE.js";import"./titleFrameBudget-BW-N1-cw.js";import"./sceneTrack-DyVxpl7i.js";import"./cameraTracker-DFjnZ7tw.js";import"./textAnimators-CeMuG34D.js";import"./timelineComp-D8PHGHgQ.js";import"./store-xR02oY0m.js";import"./rigTrack-B9r9wrdV.js";import"./clientJobs-CuuUyhEy.js";const e=new Map,c=n=>new Promise(r=>setTimeout(r,n));async function h(n){for(let r=0;r<100;r++){const o=await m(n,!0).catch(t=>{if(r<20)return null;throw t});if(!o){await c(3e3);continue}if(o.status==="failed")throw Error(a("Vẽ Animation không thành công (credit đã được hoàn)"));if(o.status==="succeeded"&&o.output?.url){const t=await fetch(o.output.url);if(!t.ok)throw Error(a("Không tải được hình vẽ"));return t.json()}await c(3e3)}throw Error(a("Vẽ Animation quá lâu — thử lại sau"))}async function J(n,r){const o=r.params??{},t=o.job;if(!t)throw Error(a("Thiếu job Vẽ Animation"));let i=e.get(t);i||(i=h(t),e.set(t,i),i.catch(()=>e.delete(t)));const s=await i;return p(s,o,{en:u()==="en"})}export{J as runRotoscope};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{kp as B,kq as K,kr as N,ks as Q,kt as q,ku as U,kv as j,bh as G,kl as J,kw as V}from"./titleFrameBudget-BW-N1-cw.js";import{J as X,K as Y,L as Z,M as tt}from"./sceneTrack-DyVxpl7i.js";import{t as O}from"./i18n-C9zFX25m.js";import{l as et}from"./cameraTracker-DFjnZ7tw.js";function nt(t,e,n,a,r,u){const[h]=B(K({w:n,h:a,data:t}),K({w:n,h:a,data:e}),[[r,u]]);return h?{x:h[0],y:h[1]}:null}function ot(t,e=3){const n=t.length;if(n<5)return[...t];const a=new Array(n);for(let r=0;r<n;r++){const u=Math.min(e,r,n-1-r);if(u<1){a[r]=t[r];continue}let h=0,i=0;for(let s=-u;s<=u;s++){const l=3*u*u+3*u-1-5*s*s;h+=l*t[r+s],i+=l}a[r]=h/i}return a}function D(t,e=3,{cols:n=null,digits:a=5}={}){if(t.length<5)return t.map(i=>[...i]);const r=n??Array.from({length:t[0].length-2},(i,s)=>s+1),u=t.map(i=>[...i]),h=10**a;for(const i of r)ot(t.map(l=>l[i]),e).forEach((l,p)=>{u[p][i]=Math.round(l*h)/h});return u}function at(t,e,n,a,r,u,{max:h=60}={}){const i=N(t[n],r,u,a,{...Q(a),max:h}),s=i.map(o=>[[e[n],o.x,o.y]]),l=t.map(()=>null),p=o=>l[o]??=K({w:r,h:u,data:t[o]});for(const o of[1,-1]){let c=i.map((x,b)=>({k:b,x:x.x,y:x.y}));for(let x=n+o;x>=0&&x<t.length&&c.length;x+=o){const b=B(p(x-o),p(x),c.map(y=>[y.x,y.y])),d=[];b.forEach((y,w)=>{if(y){const M=c[w];d.push({k:M.k,x:y[0],y:y[1]}),s[M.k][o>0?"push":"unshift"]([e[x],y[0],y[1]])}}),c=d}}return s.filter(o=>o.length>=4&&q(a,o.find(c=>c[0]===e[n])[1],o.find(c=>c[0]===e[n])[2]))}const T=Object.freeze({tol:.06,lightWeight:.35,minPx:12,maxShare:.04,sizeBand:[.3,3],lostFrames:10,maxWiden:4}),I=(t,e)=>{const n=t[e]+t[e+1]+t[e+2]+1;return[(t[e]-t[e+1])/n,(t[e+1]-t[e+2])/n,n/765]},rt=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1],(t[2]-e[2])*T.lightWeight)<T.tol;function _(t,e,n,a,r,u,h,i=T.maxShare*e*n*2){const s=Math.max(0,Math.floor(r-h)),l=Math.min(e-1,Math.ceil(r+h)),p=Math.max(0,Math.floor(u-h)),o=Math.min(n-1,Math.ceil(u+h));if(l<s||o<p)return[];const c=new Uint8Array(e*n),x=y=>(c[y]===0?c[y]=rt(I(t,y*4),a)?1:2:c[y])===1,b=[],d=[];for(let y=p;y<=o;y++)for(let w=s;w<=l;w++){const M=y*e+w;if(!x(M))continue;c[M]=3,d.push(M);let g=0,k=0,f=0;for(;d.length;){const m=d.pop(),v=m%e,F=m/e|0;if(g++,k+=v,f+=F,g>=i){d.length=0;break}v>0&&x(m-1)&&(c[m-1]=3,d.push(m-1)),v<e-1&&x(m+1)&&(c[m+1]=3,d.push(m+1)),F>0&&x(m-e)&&(c[m-e]=3,d.push(m-e)),F<n-1&&x(m+e)&&(c[m+e]=3,d.push(m+e))}b.push({x:k/g,y:f/g,n:g})}return b}function st(t,e,n,a,r){const u=[];for(let p=-2;p<=2;p++)for(let o=-2;o<=2;o++){const c=Math.min(e-1,Math.max(0,Math.round(a+o))),x=Math.min(n-1,Math.max(0,Math.round(r+p)));u.push(I(t,(x*e+c)*4))}const h=[0,1,2].map(p=>u.map(o=>o[p]).sort((o,c)=>o-c)[12]),i=Math.max(12,.2*Math.min(e,n)),s=_(t,e,n,h,a,r,i).sort((p,o)=>Math.hypot(p.x-a,p.y-r)-Math.hypot(o.x-a,o.y-r))[0],l=(e/270)**2;return!s||s.n<T.minPx*l||s.n>T.maxShare*e*n||Math.hypot(s.x-a,s.y-r)>Math.sqrt(s.n)?null:{ref:h,x:s.x,y:s.y,n:s.n,vx:0,vy:0,lost:0,steps:0}}function it(t,e,n,a){const r=t.x+t.vx,u=t.y+t.vy,h=Math.max(t.steps?.067*n:.15*n,2.5*Math.hypot(t.vx,t.vy))*Math.min(T.maxWiden,1+.5*t.lost),[i,s]=T.sizeBand,l=_(e,n,a,t.ref,r,u,h).filter(c=>c.n>t.n*i&&c.n<t.n*s&&Math.hypot(c.x-r,c.y-u)<=h).sort((c,x)=>Math.hypot(c.x-r,c.y-u)-Math.hypot(x.x-r,x.y-u))[0];if(!l)return t.lost+1>T.lostFrames?null:{state:{...t,x:r,y:u,lost:t.lost+1,steps:t.steps+1},x:r,y:u,found:!1};const p=l.x-t.x,o=l.y-t.y;return{state:{...t,x:l.x,y:l.y,vx:p,vy:o,n:t.n*.8+l.n*.2,lost:0,steps:t.steps+1},x:l.x,y:l.y,found:!0}}function ct(t,e){if(!t||!e||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=28)if(Math.abs(t[n]-e[n])>2||Math.abs(t[n+1]-e[n+1])>2||Math.abs(t[n+2]-e[n+2])>2)return!1;return!0}const lt=480;async function W(t,e,n,a,{smooth:r=!1,exact:u=!1}={}){const h=a??lt;if(t.kind!=="video")throw Error(O("Chỉ track được trên clip video"));const i=Object.assign(document.createElement("video"),{muted:!0,playsInline:!0,preload:"auto",crossOrigin:"anonymous"});i.src=e,await new Promise((f,m)=>{i.onloadeddata=()=>f(),i.onerror=()=>m(Error(O("Không đọc được video để track (CORS / định dạng)")))});const s=i.videoWidth,l=i.videoHeight,p=Math.max(2,Math.round(h*l/s)),o=t.crop||{left:0,right:0,top:0,bottom:0},c=1-o.left-o.right,x=1-o.top-o.bottom,b=Object.assign(document.createElement("canvas"),{width:h,height:p}),d=b.getContext("2d",{willReadFrequently:!0});r&&(d.imageSmoothingQuality="high");const y=f=>G(t,f)+(u?.001:0),w=async f=>{if(n?.aborted)throw new DOMException("Đã huỷ","AbortError");const m=Math.min(i.duration-1/60,y(f));return Math.abs(i.currentTime-m)>1e-4&&await new Promise((v,F)=>{const A=window.setTimeout(()=>F(Error(O("Seek video quá lâu"))),8e3);i.onseeked=()=>{window.clearTimeout(A),v()},i.currentTime=m}),d.drawImage(i,0,0,h,p),d.getImageData(0,0,h,p).data};return{w:h,h:p,mw:s,mh:l,grab:async f=>{const m=await w(f),v=new Float32Array(h*p);for(let F=0,A=0;F<v.length;F++,A+=4)v[F]=.299*m[A]+.587*m[A+1]+.114*m[A+2];return v},grabRgba:w,toPx:(f,m)=>({x:(o.left+f*c)*h,y:(o.top+m*x)*p}),toUv:(f,m)=>({u:(f/h-o.left)/c,v:(m/p-o.top)/x}),close:()=>{i.removeAttribute("src"),i.load()}}}async function Mt({clip:t,url:e,u:n,v:a,from:r,to:u,onProgress:h,signal:i}){const{w:s,h:l,mw:p,mh:o,grab:c,toPx:x,toUv:b,close:d}=await W(t,e,i),y=1/j,w=Math.max(1,Math.floor((u-r)/y+1e-6));let M=await c(r),g=x(n,a),k=g,f=M,m=null;const v=[[+r.toFixed(4),n,a,1]];try{for(let F=1;F<=w;F++){const A=r+F*y,S=await c(A);let P=U(M,S,s,l,g.x,g.y,{near:k});if(!P||P.score<.6){const E=U(f,S,s,l,k.x,k.y);if(E&&E.score>=.7)M=f,g=k,P=E;else{const L=nt(f,S,s,l,k.x,k.y);if(!L){m=+A.toFixed(4);break}M=S,g=L,P={x:L.x,y:L.y,score:.6}}}else P.score<.85&&(M=S,g={x:P.x,y:P.y});k={x:P.x,y:P.y},f=S;const R=b(P.x,P.y);v.push([+A.toFixed(4),+R.u.toFixed(5),+R.v.toFixed(5),+P.score.toFixed(3)]),h?.({done:F,total:w,score:P.score}),F%6===0&&await new Promise(E=>setTimeout(E,0))}}finally{d()}return{track:{v:1,mw:p,mh:o,points:D(v)},lostAt:m}}async function wt({clip:t,url:e,u:n,v:a,from:r,to:u,signal:h}){const{w:i,h:s,mw:l,mh:p,grabRgba:o,toPx:c,toUv:x,close:b}=await W(t,e,h),d=1/j,y=Math.max(1,Math.floor((u-r)/d+1e-6));try{const w=c(n,a);let M=await o(r),g=st(M,i,s,w.x,w.y);if(!g)return null;const k=x(g.x,g.y),f=[[+r.toFixed(4),+k.u.toFixed(5),+k.v.toFixed(5),1]];let m=null;for(let v=1;v<=y;v++){const F=r+v*d,A=await o(F);if(ct(A,M))continue;M=A;const S=it(g,A,i,s);if(!S){m=+F.toFixed(4);break}if(g=S.state,S.found){const P=x(S.x,S.y);f.push([+F.toFixed(4),+P.u.toFixed(5),+P.v.toFixed(5),1])}v%6===0&&await new Promise(P=>setTimeout(P,0))}return{track:{v:1,mw:l,mh:p,points:f},lostAt:m}}finally{b()}}async function vt({clip:t,url:e,quad:n,mode:a,from:r,to:u,onProgress:h,signal:i,scene:s=null}){if(s?.mode==="free"&&Array.isArray(s.frames))return ht({clip:t,url:e,quad:n,from:r,to:u,onProgress:h,signal:i,scene:s});const l=await W(t,e,i),p=u>=r?1:-1,o=1/j,c=Math.max(1,Math.floor(Math.abs(u-r)/o+1e-6));let x=[],b=null;try{let d=await l.grab(r),y=J(d,l.w,l.h,n.map(([w,M])=>{const g=l.toPx(w,M);return[g.x,g.y]}),a);if(y.features.length<6)throw Error("FLAT");for(let w=1;w<=c;w++){const M=r+p*w*o,g=await l.grab(M),k=V(y,d,g,l.w,l.h);if(!k){b=+M.toFixed(4);break}y=k.state,d=g,x.push([+M.toFixed(4),...k.quad.flatMap(([f,m])=>{const v=l.toUv(f,m);return[+v.u.toFixed(5),+v.v.toFixed(5)]}),k.score]),h?.({done:w,total:c,score:k.score}),w%4===0&&await new Promise(f=>setTimeout(f,0))}}finally{l.close()}return x=D([[r,...n.flat(),1],...x]).slice(1),{frames:x,lostAt:b,mw:l.mw,mh:l.mh}}async function ht({clip:t,url:e,quad:n,from:a,to:r,onProgress:u,signal:h,scene:i}){const s=await W(t,e,h);try{const o=[];for(let f=Math.max(0,a-1.5);f<=Math.min(t.duration,a+1.5)+1e-6;f+=1/15)o.push(+f.toFixed(4));let c=o.findIndex(f=>Math.abs(f-a)<.001);c<0&&(o.push(a),o.sort((f,m)=>f-m),c=o.indexOf(a));const x=[];for(let f=0;f<o.length;f++)x.push(await s.grab(o[f])),u?.({done:f+1,total:o.length,score:1}),f%6===0&&await new Promise(m=>setTimeout(m,0));const b=n.map(([f,m])=>{const v=s.toPx(f,m);return[v.x,v.y]}),d=X(i,at(x,o,c,b,s.w,s.h)),y=Y(i,b,a,{extra:d});if(!y)throw Error("FLAT");const w=r>=a?1:-1,M=1/j,g=Math.max(1,Math.floor(Math.abs(r-a)/M+1e-6));return{frames:Z(i,t,y.corners,Array.from({length:g},(f,m)=>a+w*(m+1)*M)),lostAt:null,mw:s.mw,mh:s.mh,scene:!0}}finally{s.close()}}const ut=30,ft=20,H=(t,e)=>[t.id,e,t.inPoint??0,t.duration,t.playbackRate??1,t.reverse?1:0].join("|"),z=(t,e,n={})=>H(t,e)+(n.from||n.duration||n.lens?`|${n.from??0}|${n.duration??""}|${n.lens??""}`:"");function mt(t,e,n={}){const a=t.sceneTrack;if(!a?.frames||!a.key)return null;const r=n.from||n.duration||n.lens;return a.key===z(t,e,n)||!r&&a.key.startsWith(H(t,e))?a:null}const C=new Map,$=()=>new DOMException("Đã huỷ","AbortError");function pt(t,e,n,a,r,u,h){const i=()=>new Promise((l,p)=>setTimeout(()=>{try{l(tt(t,e,{mw:n,mh:a,focal:r,onProgress:u}))}catch(o){p(o)}},0));if(typeof Worker>"u")return i();let s;try{s=new Worker(new URL("/assets/sceneTrack.worker-DKVLLgf9.js",import.meta.url),{type:"module"})}catch{return i()}return new Promise((l,p)=>{const o=()=>{s.terminate(),p($())};h?.addEventListener("abort",o,{once:!0}),s.onmessage=c=>{if(c.data.type==="progress"){u?.(c.data.u??0);return}h?.removeEventListener("abort",o),s.terminate(),c.data.type==="done"?l(c.data.result):p(Error(c.data.message||"FLAT"))},s.onerror=c=>{c.preventDefault?.(),h?.removeEventListener("abort",o),s.terminate(),i().then(l,p)},s.postMessage({frames:t,times:e,mw:n,mh:a,focal:r},t.map(c=>c.data.buffer))})}function kt(t,e,n){const a=n instanceof AbortSignal?{signal:n}:n??{},r=mt(t,e,a);if(r)return Promise.resolve(r);const u=z(t,e,a);let h=C.get(u);return h||(h=(async()=>{const i=await W(t,e,a.signal,void 0,{smooth:!0,exact:!0});try{const s=Math.max(0,Math.min(t.duration,a.from??0)),l=Math.max(0,Math.min(t.duration-s,a.duration??t.duration-s)),p=l>ft?15:ut,o=Math.max(3,Math.floor(l*p)+1),c=[],x=[];for(let d=0;d<o;d++){if(a.signal?.aborted)throw $();const y=Math.min(s+l,s+d/p),w=await i.grab(y),M=new Float32Array(w.length);for(let g=0;g<w.length;g++)M[g]=w[g]/255;c.push({w:i.w,h:i.h,data:M}),x.push(+y.toFixed(4)),a.onProgress?.(.4*(d+1)/o)}return{...await pt(c,x,i.mw,i.mh,et(a.lens,i.w,i.h),a.onProgress&&(d=>a.onProgress(.4+.6*d)),a.signal),key:u}}finally{i.close()}})(),C.set(u,h),h.finally(()=>C.delete(u)).catch(()=>{})),h}export{Mt as a,H as b,wt as c,W as o,kt as s,vt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as R,au as b,ib as C,ez as nt,eA as ot,eB as Mt,l8 as bt,h$ as T,F as vt,f8 as _t,gF as it,dY as L,gN as rt,gR as St,gG as Pt,gI as $t,fd as tt,lc as at,m as O,l as A,gE as st,eZ as G,n1 as ut,n2 as z,ih as et,dW as J,c_ as dt,n3 as lt,h as U,s as pt,hT as Et,hU as Ot}from"./titleFrameBudget-BW-N1-cw.js";const $=1/vt,w=1e-6,B=t=>typeof t=="number"&&Number.isFinite(t);function jt(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(i=>i!=="in"&&i!=="out")||!B(t.in)||!B(t.out))throw Error("Invalid export range");const n=b(t.in),e=b(t.out);if(n<0||e>R||e-n<$-w)throw Error("Invalid export range");return{in:n,out:e}}function X(t,n){if(t==null&&n==null)return null;const e=jt({in:t??0,out:n??R});return e.in<=w&&e.out>=R-w?null:e}function Zt(t,n,e){const i=Math.max(0,Math.min(R,b(e))),o=t?.in??0,s=t?.out??R;try{return n==="in"?i>=R-$+w?void 0:X(i,i>=s-w?null:s):i<$-w?void 0:X(i<=o+w?null:o,i)}catch{return}}function qt(t,n,e,i){if(!(i>=$))return t??null;const o=t?.in??0,s=t?.out??R;try{if(n==="in")return X(Math.max(0,Math.min(b(e),b(Math.min(s,i)-$))),s>=R-w?null:s);const f=Math.max(b(o+$),Math.min(b(e),i));return X(o,f>=i-w?null:f)}catch{return t??null}}function Qt(t,n){if(!t||!B(t.in)||!B(t.out)||!(n>0))return null;const e=Math.max(0,Math.min(n,t.in)),i=Math.max(0,Math.min(n,t.out));return i-e<$-w||e<=w&&i>=n-w?null:{in:e,out:i}}function Rt(t,n,e){if(!t||!Array.isArray(t.motionKeys)||!t.motionKeys.length)return t;let i={...t,motionKeys:[]};for(const o of St){const s=Pt(t,o);if(!s.length)continue;const f=s.some(r=>r.time<n-w),l=s.some(r=>r.time>e+w),p=[...s].reverse().find(r=>r.time<=n+w);i=$t(i,o,[...f?[{time:0,value:tt(t,o,n),...p?.ease!==void 0?{ease:p.ease}:{}}]:[],...s.filter(r=>(f?r.time>n+w:r.time>=n-w)&&(l?r.time<e-w:r.time<=e+w)).map(r=>({...r,time:Math.max(0,b(r.time-n))})),...l?[{time:b(e-n),value:tt(t,o,e)}]:[]])}return i}const At=t=>[...t.parentId?[t.parentId]:[],...Array.isArray(t.shape?.items)?t.shape.items.flatMap(n=>n?.pins&&typeof n.pins=="object"?Object.values(n.pins):[]):[]];function Ft(t,n,e,i,o,s){const f=n.find(I=>I.id===t.id)??t,l=t.start+t.duration<=e+w?t.duration:0,p=_t(f,l,o,s),r=p.sx??1,a=p.sy??1,v=it("image",t.track)?t.track:0;return{...rt({id:t.id,track:v,start:0,duration:i,label:String(t.label||"Null").slice(0,160)}),posX:p.x,posY:p.y,scale:p.zoom,rotation:p.rot,anchorX:L(t,"ax",l),anchorY:L(t,"ay",l),...r!==1||a!==1?{motionKeys:[{time:0,sx:r,sy:a}]}:{}}}function Z({clips:t,camera:n=null},e,{W:i=1280,H:o=720}={}){if(!e||!Array.isArray(t))return{clips:t,camera:n};const s=e.in,f=e.out,l=b(f-s),p=[];for(const m of t){if(m.start+m.duration<=s+w||m.start>=f-w)continue;let k=m;if(k.start<s-w){const x=b(s-k.start);if(k.duration-x<$-w)continue;if(x>=$-w){const _=C(k,s,`${m.id}~in`);_.length===2&&(k={..._[1],id:m.id})}}if(k.start+k.duration>f+w){const x=b(f-k.start);if(x<$-w)continue;k.duration-x>=$-w&&(k=C(k,f,`${m.id}~out`)[0])}p.push({...k,start:Math.max(0,b(k.start-s))})}const r=new Set(p.map(m=>m.id)),a=new Map(t.map(m=>[m.id,m])),v=[...new Set(p.flatMap(At))].filter(m=>!r.has(m)&&a.get(m)&&!a.get(m).disabled&&a.get(m).kind!=="audio");let I=[];if(v.length){const m=nt(ot(t.filter(k=>!k.disabled)));Mt(m),I=v.map(k=>Ft(a.get(k),m,s,l,i,o))}const y=new Set([...r,...I.map(m=>m.id)]);return{clips:[...p.map(m=>{const k=a.get(m.id),x=[];let _=m;if(m.parentId&&!y.has(m.parentId)&&x.push("parentId"),m.matte&&!r.has(m.matte.source)&&(x.push("matte"),m.matte.mode?.endsWith("-inverted")||(_={...m,opacity:0,motionKeys:bt(m,"opacity",[])})),m.transition&&k&&T(t,k)&&!T(p,m)&&x.push("transition"),m.join&&k&&T(t,k)&&!T(p,m)&&x.push("join"),!x.length)return _;_={..._};for(const F of x)delete _[F];return _}),...I],camera:Rt(n,s,f)}}const j=t=>!!t&&!!t.comp&&Array.isArray(t.comp.clips),D=">",q=t=>j(t)?1+Math.max(0,...t.comp.clips.map(q)):0,mt=t=>j(t)?t.comp.clips.reduce((n,e)=>n+1+mt(e),0):0,Tt=t=>j(t)?Math.max(0,...t.comp.clips.map(n=>n.start+n.duration)):0,ft=t=>{let n=1;for(;t.some(e=>e.label===`Comp ${n}`);)n++;return`Comp ${n}`},N=t=>String(t).padStart(3,"0"),V=["x","y","zoom","rot","ax","ay"],zt={x:0,y:0,zoom:1,rot:0,ax:0,ay:0};function Q(t){return t.parentId||V.some(n=>J(t,n).length||Math.abs(L(t,n,0)-zt[n])>1e-9)?!0:["enter","exit"].some(n=>t[n]&&t[n].type!=="fade")}const ct=t=>J(t,"opacity").length>0||["enter","exit"].some(n=>t[n]&&(t[n].type==="fade"||t[n].fade!==!1));function ht(t,n){const e=[];for(const o of t.motionKeys||[]){const s={time:o.time};for(const l of V)Number.isFinite(o[l])&&(s[l]=o[l]);if(Object.keys(s).length===1)continue;const f=o.ease&&Object.fromEntries(Object.entries(o.ease).filter(([l])=>V.includes(l)));f&&Object.keys(f).length&&(s.ease=f),e.push(s)}const i=Object.fromEntries(["posX","posY","scale","rotation","anchorX","anchorY","parentId","zIndex","enter","exit"].filter(o=>t[o]!==void 0).map(o=>[o,t[o]]));return{...rt({id:n,track:t.track,start:t.start,duration:t.duration,label:t.label}),...i,motionKeys:e,_comp:t.id}}function Nt(t,n){if(Math.abs(n-1)<1e-9)return t;const e=J(t,"opacity"),i={...t,opacity:(t.opacity??1)*n};return e.length?{...i,...dt(i,"opacity",e.map(o=>({...o,value:o.value*n})))}:i}function Kt(t,n){const e=Math.max(1,Math.ceil(t.duration*60-1e-6)),i=[];for(let o=0;o<=e;o++){const s=Math.min(t.duration,o/60);i.push({time:+s.toFixed(6),value:Math.max(0,Math.min(1,L(t,"opacity",s)*n(s)))})}return{...t,...dt(t,"opacity",i)}}function W(t,n){const e={...t},i=o=>n(o);if(e.parentId!==void 0){const o=i(e.parentId);o?e.parentId=o:delete e.parentId}if(e.matte?.source!==void 0){const o=i(e.matte.source);o?e.matte={...e.matte,source:o}:delete e.matte}e._virtual!==void 0&&(e._virtual=i(e._virtual)??e._virtual),typeof e.space=="string"&&(e.space=i(e.space)??e.space);for(const o of["bend","vfx"])typeof e[o]?.source=="string"&&(e[o]={...e[o],source:i(e[o].source)??e[o].source});return Array.isArray(e.shape?.items)&&e.shape.items.some(o=>o?.pins)&&(e.shape={...e.shape,items:e.shape.items.map(o=>o?.pins&&typeof o.pins=="object"?{...o,pins:Object.fromEntries(Object.entries(o.pins).map(([s,f])=>[s,i(f)??f]))}:o)}),e}const Dt=t=>{if(t.transition===void 0&&t.join===void 0)return t;const{transition:n,join:e,...i}=t;return i};function H(t){const n=t.comp.tracks||{};return t.comp.clips.filter(e=>!e.disabled&&!(e.kind!=="audio"&&n[e.track]?.hidden)).map(e=>n[e.track]?.muted?{...e,volume:0}:e)}function kt(t,n,e,i){const o=t.inPoint||0,s=t.start-o;return Z({clips:n},{in:o,out:o+t.duration},{W:e,H:i}).clips.map(l=>{const p={...l,start:b(t.start+l.start)};for(const r of["_txIn","_txOut"])p[r]&&(p[r]={...p[r],t0:p[r].t0+s});return p})}function Lt(t,n){const e=t.inPoint||0;if(U(t)&&!t.reverse)return e+pt(t,Math.max(0,Math.min(t.duration,n)));const i=t.playbackRate||1,o=Math.max(0,Math.min(t.duration,n));return e+(t.reverse?Math.max(0,t.duration-o-1/30):o)*i}function yt(t){const n=t.inPoint||0,e=U(t)&&!t.reverse?pt(t,t.duration):t.duration*(t.playbackRate||1);return{from:n,to:n+e}}function wt(t){const n=H(t),e=new Set(n.map(o=>o.id)),i=`${t.id}${D}`;return n.map(o=>({...W(o,s=>e.has(s)?i+s:null),id:i+o.id}))}function It(t,{W:n=1280,H:e=720}={}){const{from:i,to:o}=yt(t);return Z({clips:wt(t)},{in:i,out:o},{W:n,H:e}).clips.map(s=>({...s,volume:0}))}function Ut(t,{W:n=1280,H:e=720}={}){const i=[],o=(s,f)=>{for(const l of s)if(l?._group&&j(l)&&f<z){const p=K(It(l,{W:n,H:e}),{W:n,H:e});i.push(p),o(p,f+1)}};return o(K(t||[],{W:n,H:e}),0),i}function Bt(t,n,e,i){if(t.reverse||U(t))return[];const o=t.playbackRate||1,s=t.inPoint||0,f=`${t.id}${D}`,l=K(H(t),{W:e,H:i,depth:n+1}).filter(r=>r.url&&(r.volume??1)>0&&(r.kind==="audio"||r.kind==="video"&&!r.freeze&&!r.reverse));return Z({clips:l},{in:s,out:s+t.duration*o},{W:e,H:i}).clips.flatMap(r=>{const a=(r.playbackRate||1)*o;return a>8||U(r)&&o!==1?[]:[{...Object.fromEntries(["nodeId","url","gcsUri","label","inPoint","sourceDuration","audioFx","duck","muffle"].filter(I=>r[I]!==void 0).map(I=>[I,r[I]])),id:`${f}${r.id}~a`,kind:"audio",track:r.kind==="audio"?r.track:st[0],start:b(t.start+r.start/o),duration:Math.max(1/30,b(r.duration/o)),volume:(r.volume??1)*(t.volume??1),...a!==1?{playbackRate:a}:{},...r.speedRamp&&o===1?{speedRamp:r.speedRamp}:{},...r.audioFadeIn?{audioFadeIn:r.audioFadeIn/o}:{},...r.audioFadeOut?{audioFadeOut:r.audioFadeOut/o}:{},_comp:t.id,_slot:`§a${f}${r.id}`}]})}function gt(t,n,e){let i=n;return n.kind!=="audio"&&!n.nullLayer&&(i=e!==null?Nt(i,e):Kt(i,o=>G(t,i.start-t.start+o).opacity)),t.volume!==void 0&&t.volume!==1&&(n.kind==="video"||n.kind==="audio")&&(i={...i,volume:(i.volume??1)*t.volume}),t.lookBypass&&(i={...i,lookBypass:!0}),i}function Xt(t,n,e,i,o){if(n>=z)return[];t={...t,...at(t)};let s=nt(ot(H(t))).map(Dt);s=K(s,{W:e,H:i,depth:n+1});const f=kt(t,s,e,i),l=new Set(f.map(y=>y.id)),p=`${t.id}${D}`,r=o?`${p}~comp`:null,a=ct(t)?null:G(t,0).opacity,v=[...new Set(f.filter(y=>y.kind!=="audio").map(y=>`${N((y.zIndex??0)+200)}:${N(O(y.track)+1)}`))].sort(),I=f.map(y=>{let g=W(y,m=>l.has(m)?p+m:null);return g={...gt(t,g,a),id:p+y.id,_comp:t.id,...g.parentId===void 0&&r&&y.kind!=="audio"?{parentId:r}:{}},y.kind!=="audio"?(g.track=t.track,g._slot=`§${N(v.indexOf(`${N((y.zIndex??0)+200)}:${N(O(y.track)+1)}`))}${y._slot??""}`,t.zIndex!==void 0?g.zIndex=t.zIndex:delete g.zIndex):g._slot=`§${y._slot??""}${y.id}`,g});return I.sort((y,g)=>y._slot<g._slot?-1:y._slot>g._slot?1:0),r?[ht(t,r),...I]:I}function K(t,{W:n=1280,H:e=720,depth:i=0}={}){if(!Array.isArray(t)||!t.some(a=>j(a)&&!a._group))return t;const o=new Set(t.filter(a=>a.transition).map(a=>T(t,a)?.id).filter(Boolean)),s=a=>lt(a)||o.has(a.id),f=new Set(t.filter(a=>a.parentId).map(a=>a.parentId)),l=new Set(t.filter(a=>j(a)&&!s(a)).map(a=>a.id)),p=new Map,r=[];for(const a of t){if(!j(a)||a._group){r.push(a);continue}if(a.disabled)continue;if(s(a)){i<z&&r.push({...a,_group:!0},...Bt(a,i,n,e));continue}const v=Q(a)||f.has(a.id);v&&p.set(a.id,`${a.id}${D}~comp`),r.push(...Xt(a,i,n,e,v))}return r.map(a=>{if(a.parentId&&p.has(a.parentId))return{...a,parentId:p.get(a.parentId)};if(a.matte&&l.has(a.matte.source)){const{matte:v,...I}=a;return I}return a})}function Yt(t,n,{id:e,label:i,tracks:o={},W:s=1280,H:f=720}={}){const l=new Set(n||[]),p=t.filter(u=>l.has(u.id));if(!p.length)throw Error("Precompose: select at least one layer");if(!p.some(u=>u.kind!=="audio"))throw Error("Precompose needs at least one picture layer");if(p.some(u=>o[u.track]?.locked))throw Error("Track đã khóa");if(1+Math.max(0,...p.map(q))>z)throw Error(`Comps nest at most ${z} deep`);const r=t.filter(u=>!l.has(u.id)),a=[...p.filter(u=>u.matte&&!l.has(u.matte.source)),...r.filter(u=>u.matte&&l.has(u.matte.source))];if(a.length)throw Error(`Precompose: the track matte of "${a[0].label||a[0].id}" crosses the comp's edge — take the matte layer in too, or remove the matte`);const v=b(Math.min(...p.map(u=>u.start))),I=b(Math.max(...p.map(u=>u.start+u.duration))),y=Math.max(1/30,b(I-v)),g=u=>r.some(c=>c.track===u&&c.kind!=="audio"&&c.start<I-1e-6&&c.start+c.duration>v+1e-6)||o[u]?.locked,m=[...new Set(p.filter(u=>u.kind!=="audio").map(u=>u.track))].sort((u,c)=>O(c)-O(u));let k=m.find(u=>!g(u));for(let u=O(m[0])+1;k===void 0;u++)g(A(u))||(k=A(u));const x=u=>T(t,u),_=p.map(u=>{let c={...u};return c.parentId&&!l.has(c.parentId)&&(c={...c,...et(t,u,null,0,s,f)}),c.transition&&!l.has(x(u)?.id)&&delete c.transition,c.join&&!l.has(x(u)?.id)&&delete c.join,c.parentId===void 0&&delete c.parentId,{...c,start:b(u.start-v)}}),F=r.map(u=>{let c=u;return u.parentId&&l.has(u.parentId)&&(c={...c,...et(t,u,null,0,s,f)},c.parentId===void 0&&(c={...c},delete c.parentId)),(c.transition||c.join)&&l.has(x(u)?.id)&&(c={...c},delete c.transition,delete c.join),c}),E=[...new Set(p.map(u=>u.track))].filter(u=>o[u]?.hidden||o[u]?.muted),Y=Object.fromEntries(E.map(u=>[u,{...o[u].hidden?{hidden:!0}:{},...o[u].muted?{muted:!0}:{}}])),P={id:e||`comp-${Date.now().toString(36)}`,nodeId:"",kind:"image",url:"",label:i||ft(t),track:k,start:v,duration:y,inPoint:0,sourceDuration:y,motionV:2,comp:{clips:_,...E.length?{tracks:Y}:{}}};return{clips:[...F,P],id:P.id,track:k}}function Vt(t,n,{tracks:e={},W:i=1280,H:o=720,newId:s=()=>`null-${Math.random().toString(36).slice(2,9)}`}={}){const f=t.find(d=>d.id===n);if(!j(f))throw Error("Uncompose needs a comp layer");if(e[f.track]?.locked)throw Error("Track đã khóa");const l={...f,...at(f)},p=t.filter(d=>d.id!==n),r=new Set(p.map(d=>d.id)),a=l.comp.tracks||{},v=l.comp.clips.map(d=>({...d,...a[d.track]?.hidden&&d.kind!=="audio"?{disabled:!0}:{},...a[d.track]?.muted?{volume:0}:{}})),I=kt(l,v,i,o),y=new Map;for(const d of I){let h=d.id,M=2;for(;r.has(h)||[...y.values()].includes(h);)h=`${d.id}-${M++}`;y.set(d.id,h)}const g=[...p],m=(d,h)=>!e[d]?.locked&&!g.some(M=>M.track===d&&h.some(S=>M.start<S.start+S.duration-1e-6&&M.start+M.duration>S.start+1e-6)),k=new Map,x=[...new Set(I.filter(d=>d.kind!=="audio").map(d=>d.track))].sort((d,h)=>O(d)-O(h)),_=d=>I.filter(h=>h.kind!=="audio"&&h.track===d),F=x.every(d=>m(d,_(d)));let E=F?O(x.at(-1)??l.track)+1:O(l.track);for(const d of x){const h=_(d);if(F){k.set(d,d),g.push(...h);continue}for(;!m(A(E),h);)E++;k.set(d,A(E)),g.push(...h.map(M=>({...M,track:A(E)}))),E++}for(const d of[...new Set(I.filter(h=>h.kind==="audio").map(h=>h.track))]){const h=I.filter(S=>S.kind==="audio"&&S.track===d),M=[d,...st.filter(S=>S!==d)].find(S=>m(S,h));if(M===void 0)throw Error("Uncompose: no free audio row for the comp's sounds");k.set(d,M),g.push(...h.map(S=>({...S,track:M})))}const Y=Q(l)||p.some(d=>d.parentId===n);let P=null;if(Y){let d=E;const h=[{start:l.start,duration:l.duration}];for(;!m(A(d),h);)d++;let M=s();for(;r.has(M);)M=s();const{_comp:S,...xt}=ht(l,M);P={...xt,track:A(d),label:l.label||"Null"}}const u=ct(l)?null:G(l,0).opacity,c=I.map(d=>{let h=W(d,M=>y.get(M)??null);if(h={...gt(l,h,u),id:y.get(d.id),track:k.get(d.track)??d.track},h.parentId===void 0&&P&&d.kind!=="audio"&&(h.parentId=P.id),!it(h.kind,h.track))throw Error("Uncompose: no free row");return h});return{clips:[...p.map(d=>d.parentId===n?P?{...d,parentId:P.id}:(({parentId:h,...M})=>M)(d):d),...P?[P]:[],...c],ids:c.map(d=>d.id),nullId:P?.id??null,dropped:ut(f)}}const Wt=Object.freeze(Object.defineProperty({__proto__:null,COMP_DEPTH:z,COMP_SEP:D,compBlockers:Et,compClipCount:mt,compContentEnd:Tt,compDepth:q,compGrouped:lt,compInner:wt,compLabel:ft,compMoves:Q,compPictureFields:ut,compRange:yt,compRenderLevel:It,compTime:Lt,expandComps:K,groupedLevels:Ut,isComp:j,precompose:Yt,stripComp:Ot,uncompose:Vt},Symbol.toStringTag,{value:"Module"}));export{wt as a,Lt as b,Tt as c,Qt as d,K as e,ft as f,mt as g,qt as h,j as i,Zt as j,X as m,Yt as p,Z as s,Wt as t,Vt as u};
|