@bylqwjc/media-editor-image 1.0.34 → 1.0.35
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/node_modules/@media-editor/core/dist/browser.cjs +1 -1
- package/node_modules/@media-editor/core/dist/browser.js +1 -1
- package/node_modules/@media-editor/core/dist/{chunk-VDEZTXEA.js → chunk-EABJNGSW.js} +1 -1
- package/node_modules/@media-editor/core/dist/chunk-YFCBSEKB.js +1 -0
- package/node_modules/@media-editor/core/dist/filerobot.cjs +1 -1
- package/node_modules/@media-editor/core/dist/filerobot.js +1 -1
- package/node_modules/@media-editor/core/dist/index.cjs +1 -1
- package/node_modules/@media-editor/core/dist/index.js +1 -1
- package/package.json +1 -1
- package/node_modules/@media-editor/core/dist/chunk-FAFKY4LX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var zod=require("zod"),DEG2RAD=Math.PI/180,TEXT_FONT_STACK='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';function isDrawableOverlay(e){return"adjust"!==e.type}function isOverlayHidden(e){return Boolean(e.hidden)}function isOverlayLocked(e){return Boolean(e.locked)}function overlayTrack(e,t){const o=Number(e.timelineTrack);return Number.isFinite(o)?Math.max(0,Math.round(o)):t}function overlayLayerRenderOrder(e){return e.map((e,t)=>({overlay:e,index:t,track:overlayTrack(e,t)})).sort((e,t)=>t.track-e.track||e.index-t.index).map(e=>e.overlay)}function strokeStyle(e,t,o){e.strokeStyle=t,e.lineWidth=o,e.lineCap="round",e.lineJoin="round"}function drawArrowHead(e,t,o,n,r,a){const i=Math.atan2(r-o,n-t),s=Math.max(12,3.5*a);e.beginPath(),e.moveTo(n,r),e.lineTo(n-s*Math.cos(i-Math.PI/7),r-s*Math.sin(i-Math.PI/7)),e.moveTo(n,r),e.lineTo(n-s*Math.cos(i+Math.PI/7),r-s*Math.sin(i+Math.PI/7)),e.stroke()}function normalizeOverlayRotation(e){if(!Number.isFinite(e))return 0;let t=e%360;return t>180&&(t-=360),t<-180&&(t+=360),Math.abs(t)<.001?0:t}function getOverlayRotation(e){return normalizeOverlayRotation(e.rotation??0)}function overlayBBox(e){switch(e.type){case"pen":{let t=1/0,o=1/0,n=-1/0,r=-1/0;for(let a=0;a<e.points.length;a+=2)t=Math.min(t,e.points[a]),n=Math.max(n,e.points[a]),o=Math.min(o,e.points[a+1]),r=Math.max(r,e.points[a+1]);return{x:t,y:o,w:n-t,h:r-o}}case"line":case"arrow":return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)};case"rect":case"ellipse":case"sticker":case"adjust":return{x:e.x,y:e.y,w:e.w,h:e.h};case"text":return textBBox(e)}}function textLines(e){return String(e.text||"").split(/\r?\n/)}function textLineHeight(e){return e.fontSize*(e.lineHeight??1.15)}function textPaddingX(e){return e.paddingX??0}function textPaddingY(e){return e.paddingY??0}function textContentWidth(e){const t=Math.max(.6*e.fontSize,...textLines(e).map(t=>Math.max(1,t.length)*e.fontSize*.6));return Math.max(1,e.width??t+2*textPaddingX(e))}function textBBox(e){const t=textLines(e);return{x:e.x,y:e.y,w:textContentWidth(e),h:Math.max(e.fontSize,t.length*textLineHeight(e))+2*textPaddingY(e)}}function textFont(e){const t=e.fontWeight??"700",o=e.italic?"italic ":"",n=e.fontFamily?`"${e.fontFamily}", ${TEXT_FONT_STACK}`:TEXT_FONT_STACK;return`${o}${t} ${e.fontSize}px ${n}`}function textLineX(e,t,o,n){const r=textPaddingX(t),a=t.align??"left",i=e.measureText(o||" ").width;return"center"===a?t.x+n/2-i/2:"right"===a?t.x+n-r-i:t.x+r}function overlayCenter(e){const t=overlayBBox(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function rotatePoint(e,t,o,n,r){const a=r*DEG2RAD,i=Math.cos(a),s=Math.sin(a),l=e-o,d=t-n;return{x:o+l*i-d*s,y:n+l*s+d*i}}function scalePoint(e,t,o,n,r){return{x:o+(e-o)*r,y:n+(t-n)*r}}function overlayTimeRange(e){const t=e,o=Number.isFinite(t.startAt)?Math.max(0,Number(t.startAt)):null,n=Number.isFinite(t.endAt)?Math.max(o??0,Number(t.endAt)):null;if(null==o&&null==n)return null;const r=o??0;return{start:r,end:Math.max(r,n??r)}}function isOverlayActiveAt(e,t){const o=overlayTimeRange(e);return!o||Number.isFinite(t)&&t>=o.start&&t<=o.end}function filterOverlaysAtTime(e,t){if(!e?.length)return[];const o=e.filter(e=>!isOverlayHidden(e));return Number.isFinite(t)?o.filter(e=>isOverlayActiveAt(e,t)):o}function drawOverlay(e,t,o){if(isOverlayHidden(t))return;if(!isDrawableOverlay(t))return;const n=getOverlayRotation(t);if(n){const r=overlayCenter(t);return e.save(),e.translate(r.x,r.y),e.rotate(n*DEG2RAD),e.translate(-r.x,-r.y),drawOverlayBase(e,t,o),void e.restore()}drawOverlayBase(e,t,o)}function drawOverlayBase(e,t,o){switch(t.type){case"pen":strokeStyle(e,t.color,t.width),e.beginPath(),e.moveTo(t.points[0],t.points[1]);for(let o=2;o<t.points.length;o+=2)e.lineTo(t.points[o],t.points[o+1]);e.stroke();break;case"line":case"arrow":strokeStyle(e,t.color,t.width),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),"arrow"===t.type&&drawArrowHead(e,t.x1,t.y1,t.x2,t.y2,t.width);break;case"rect":strokeStyle(e,t.color,t.width),e.strokeRect(t.x,t.y,t.w,t.h);break;case"ellipse":strokeStyle(e,t.color,t.width),e.beginPath(),e.ellipse(t.x+t.w/2,t.y+t.h/2,Math.abs(t.w/2),Math.abs(t.h/2),0,0,2*Math.PI),e.stroke();break;case"text":{const o=textBBox(t),n=textLines(t),r=Number.isFinite(t.opacity)?Math.min(1,Math.max(0,(t.opacity??100)/100)):1;e.save(),e.globalAlpha*=r,t.backgroundColor&&"transparent"!==t.backgroundColor&&(e.fillStyle=t.backgroundColor,e.fillRect(t.x,t.y,o.w,o.h)),e.fillStyle=t.color,e.font=textFont(t),e.textBaseline="top",e.strokeStyle=t.strokeColor??"rgba(0,0,0,0.45)",e.lineWidth=t.borderWidth??Math.max(2,t.fontSize/16),e.lineJoin="round",n.forEach((n,r)=>{const a=textLineX(e,t,n,o.w),i=t.y+textPaddingY(t)+r*textLineHeight(t),s=e.measureText(n||" ").width;if(e.lineWidth>0&&e.strokeText(n,a,i),e.fillText(n,a,i),(t.underline||t.strikethrough)&&s>0){const o=Math.max(1,t.fontSize/18);e.fillStyle=t.color,t.underline&&e.fillRect(a,i+.92*t.fontSize,s,o),t.strikethrough&&e.fillRect(a,i+.52*t.fontSize,s,o)}}),e.restore();break}case"sticker":if(t.emoji)e.save(),e.font=.86*Math.min(t.w,t.h)+'px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif',e.textAlign="center",e.textBaseline="middle",e.fillText(t.emoji,t.x+t.w/2,t.y+t.h/2),e.restore();else if(t.src){const n=o?.get(t.src);n&&e.drawImage(n,t.x,t.y,t.w,t.h)}}}function drawOverlays(e,t,o,n){const r="number"==typeof n?filterOverlaysAtTime(t,n):t;for(const t of r)!isOverlayHidden(t)&&isDrawableOverlay(t)&&drawOverlay(e,t,o)}async function loadOverlayImages(e){const t=new Map,o=[...new Set(e.filter(e=>"sticker"===e.type&&e.src).map(e=>e.src))];return await Promise.all(o.map(e=>new Promise(o=>{const n=new Image;n.onload=()=>{t.set(e,n),o()},n.onerror=()=>o(),n.src=e}))),t}async function renderOverlaysToPng(e,t,o){const n=e?.filter(e=>!isOverlayHidden(e)&&isDrawableOverlay(e))??[];if(!n.length)return null;const r=document.createElement("canvas");r.width=t,r.height=o;const a=r.getContext("2d");return a?(drawOverlays(a,n,await loadOverlayImages(n)),new Promise(e=>r.toBlob(t=>e(t),"image/png"))):null}function hitTestOverlay(e,t,o,n=12){for(let r=e.length-1;r>=0;r--){const a=e[r];if(!isOverlayHidden(a)&&hitOne(a,t,o,n))return r}return-1}function near(e,t,o,n,r){return Math.abs(e-o)<=r&&Math.abs(t-n)<=r}function nearSegment(e,t,o,n,r,a,i){const s=r-o,l=a-n,d=s*s+l*l||1,m=Math.max(0,Math.min(1,((e-o)*s+(t-n)*l)/d));return(e-(o+m*s))**2+(t-(n+m*l))**2<=i*i}function hitOne(e,t,o,n){const r=getOverlayRotation(e);if(r){const a=overlayCenter(e),i=rotatePoint(t,o,a.x,a.y,-r);return hitOneBase(e,i.x,i.y,n)}return hitOneBase(e,t,o,n)}function hitOneBase(e,t,o,n){switch(e.type){case"pen":for(let r=0;r+3<e.points.length;r+=2)if(nearSegment(t,o,e.points[r],e.points[r+1],e.points[r+2],e.points[r+3],n+e.width/2))return!0;return!1;case"line":case"arrow":return nearSegment(t,o,e.x1,e.y1,e.x2,e.y2,n+e.width/2);case"rect":case"ellipse":return t>=e.x-n&&t<=e.x+e.w+n&&o>=e.y-n&&o<=e.y+e.h+n;case"text":{const r=textBBox(e);return t>=r.x-n&&t<=r.x+r.w+n&&o>=r.y-n&&o<=r.y+r.h+n}case"sticker":return near(t,o,e.x+e.w/2,e.y+e.h/2,Math.max(e.w,e.h)/2+n);case"adjust":return!1}}function fitStickerBox(e,t,o){const n=Math.max(8,o);if(!(e>0&&t>0))return{w:n,h:n};const r=n/Math.max(e,t);return{w:Math.max(8,Math.round(e*r)),h:Math.max(8,Math.round(t*r))}}function scaleOverlay(e,t){const o=Math.max(.05,t),n=overlayCenter(e);switch(e.type){case"pen":return{...e,points:e.points.map((e,t)=>t%2==0?n.x+(e-n.x)*o:n.y+(e-n.y)*o)};case"line":case"arrow":{const t=scalePoint(e.x1,e.y1,n.x,n.y,o),r=scalePoint(e.x2,e.y2,n.x,n.y,o);return{...e,x1:t.x,y1:t.y,x2:r.x,y2:r.y}}case"rect":case"ellipse":case"sticker":case"adjust":return{...e,w:Math.max(8,e.w*o),h:Math.max(8,e.h*o)};case"text":return{...e,fontSize:Math.min(512,Math.max(8,e.fontSize*o)),width:e.width?Math.max(16,e.width*o):e.width,paddingX:e.paddingX?Math.max(0,e.paddingX*o):e.paddingX,paddingY:e.paddingY?Math.max(0,e.paddingY*o):e.paddingY,borderWidth:e.borderWidth?Math.max(0,e.borderWidth*o):e.borderWidth};default:return e}}function rotateOverlay(e,t){return{...e,rotation:normalizeOverlayRotation(t)}}function translateOverlay(e,t,o){switch(e.type){case"pen":{const n=e.points.map((e,n)=>n%2==0?e+t:e+o);return{...e,points:n}}case"line":case"arrow":return{...e,x1:e.x1+t,y1:e.y1+o,x2:e.x2+t,y2:e.y2+o};case"rect":case"ellipse":case"sticker":case"adjust":case"text":return{...e,x:e.x+t,y:e.y+o}}}var DEG2RAD2=Math.PI/180;function rotatedSize(e,t,o){const n=normalizeDeg(o);if(0===n||180===n)return{w:e,h:t};if(90===n||270===n)return{w:t,h:e};const r=n*DEG2RAD2;return{w:Math.round(Math.abs(e*Math.cos(r))+Math.abs(t*Math.sin(r))),h:Math.round(Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)))}}function normalizeDeg(e){return(e%360+360)%360}function evenize(e){const t=Math.round(e);return t-t%2}function centeredMaxRect(e,t){let o=e.w,n=o/t;return n>e.h&&(n=e.h,o=n*t),{x:Math.round((e.w-o)/2),y:Math.round((e.h-n)/2),width:Math.round(o),height:Math.round(n)}}function fitRects(e,t,o){const n={x:0,y:0,width:e.width,height:e.height},r={x:0,y:0,width:t.w,height:t.h};return"cover"===o?{src:centeredMaxRect({w:e.width,h:e.height},t.w/t.h),dst:r}:"contain"===o?{src:n,dst:centeredMaxRect({w:t.w,h:t.h},e.width/e.height)}:{src:n,dst:r}}function outputSize(e,t){if(t.scale)return{w:evenize(t.scale.width),h:evenize(t.scale.height)};if(t.crop)return{w:evenize(t.crop.width),h:evenize(t.crop.height)};const o=rotatedSize(e.w,e.h,t.rotation);return{w:evenize(o.w),h:evenize(o.h)}}function dataUrlToBlob(e){const t=e.match(/^data:(image\/(?:png|jpe?g));base64,([a-z0-9+/=]+)$/i);if(!t)return null;const o=atob(t[2]),n=new Uint8Array(o.length);for(let e=0;e<o.length;e++)n[e]=o.charCodeAt(e);return new Blob([n],{type:t[1].toLowerCase()})}async function buildVideoExportFormData(e,t,o=[]){const n=e.getExportPlan(),r=new FormData;n.videoSrcOrder.forEach((e,o)=>{const n=t[e];n&&("undefined"!=typeof File&&n instanceof File?r.append(`video_${o}`,n,n.name||`video_${o}.mp4`):"url"in n&&"string"==typeof n.url&&n.url&&(r.append(`videoUrl_${o}`,n.url),n.name&&r.append(`videoName_${o}`,n.name),n.type&&r.append(`videoType_${o}`,n.type),null!=n.size&&r.append(`videoSize_${o}`,String(n.size))))}),n.audioSrcOrder.forEach((e,t)=>{const n=o[e];n&&r.append(`audio_${t}`,n,n.name||`audio_${t}`)});const a=overlayLayerRenderOrder(n.state.overlays??[]).filter(e=>!isOverlayHidden(e)&&isDrawableOverlay(e)),i=outputSize(n.state.canvas,n.state);(await Promise.all(a.map(e=>renderOverlaysToPng([e],i.w,i.h)))).forEach((e,t)=>{e&&r.append(`textOverlay_${t}`,e,`textOverlay_${t}.png`)});const s=n.state.poster?.useAsVideoCover?n.state.poster.preview||n.state.poster.src:"",l=s?dataUrlToBlob(s):null;if(l){const e="image/png"===l.type?"video-cover.png":"video-cover.jpg";r.append("videoCover",l,e)}const d=n.state.poster?.preview||n.state.poster?.src?{...n.state,poster:{...n.state.poster,preview:void 0,src:void 0}}:n.state;return r.append("editState",JSON.stringify(d)),r}var StrokeCommon={color:zod.z.string().max(32),width:zod.z.number().positive().max(200)},RotationCommon={rotation:zod.z.number().min(-180).max(180).optional()},TimelineCommon={startAt:zod.z.number().min(0).optional(),endAt:zod.z.number().min(0).optional(),timelineTrack:zod.z.number().int().min(0).max(99).optional(),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()},FilterCommon={brightness:zod.z.number().min(-1).max(1).default(0),contrast:zod.z.number().min(-1).max(1).default(0),saturation:zod.z.number().min(-1).max(1).default(0),temperature:zod.z.number().min(-1).max(1).default(0),tint:zod.z.number().min(-1).max(1).default(0),vibrance:zod.z.number().min(-1).max(1).default(0),gamma:zod.z.number().min(-1).max(1).default(0),highlights:zod.z.number().min(-1).max(1).default(0),shadows:zod.z.number().min(-1).max(1).default(0),whites:zod.z.number().min(-1).max(1).default(0),blacks:zod.z.number().min(-1).max(1).default(0),lightSense:zod.z.number().min(-1).max(1).default(0),sharpen:zod.z.number().min(0).max(1).default(0),clarity:zod.z.number().min(0).max(1).default(0),grain:zod.z.number().min(0).max(1).default(0),fade:zod.z.number().min(0).max(1).default(0),vignette:zod.z.number().min(0).max(1).default(0)},Overlay=zod.z.discriminatedUnion("type",[zod.z.object({type:zod.z.literal("pen"),points:zod.z.array(zod.z.number()).min(4),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("line"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("arrow"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("rect"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("ellipse"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("text"),x:zod.z.number(),y:zod.z.number(),text:zod.z.string().max(500),color:zod.z.string().max(32),fontSize:zod.z.number().positive().max(512),fontFamily:zod.z.string().max(120).optional(),fontWeight:zod.z.string().max(20).optional(),italic:zod.z.boolean().optional(),underline:zod.z.boolean().optional(),strikethrough:zod.z.boolean().optional(),align:zod.z.enum(["left","center","right"]).optional(),width:zod.z.number().positive().max(8192).optional(),backgroundColor:zod.z.string().max(32).optional(),strokeColor:zod.z.string().max(32).optional(),borderWidth:zod.z.number().min(0).max(64).optional(),paddingX:zod.z.number().min(0).max(256).optional(),paddingY:zod.z.number().min(0).max(256).optional(),lineHeight:zod.z.number().positive().max(4).optional(),opacity:zod.z.number().min(0).max(100).optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("sticker"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),emoji:zod.z.string().max(16).optional(),src:zod.z.string().optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("adjust"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),layerKind:zod.z.enum(["adjust","filter"]).optional(),filterPreset:zod.z.string().max(32).optional(),...FilterCommon,...TimelineCommon,...RotationCommon})]),Clip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(7),in:zod.z.number().min(0),out:zod.z.number().min(0),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()}),AudioClip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(2),track:zod.z.number().int().min(0).default(0),startAt:zod.z.number().min(0),in:zod.z.number().min(0),out:zod.z.number().min(0),speed:zod.z.number().min(.5).max(2).default(1),volume:zod.z.number().min(0).max(10),muted:zod.z.boolean().optional(),locked:zod.z.boolean().optional(),fadeIn:zod.z.number().min(0).default(0),fadeOut:zod.z.number().min(0).default(0)}),Transition=zod.z.object({type:zod.z.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:zod.z.number().min(0).max(2).default(.4)}),ExportSettings=zod.z.object({fileName:zod.z.string().max(120).optional(),format:zod.z.enum(["mp4","mov","mxf"]).default("mp4"),width:zod.z.number().int().min(2).max(8192).optional(),height:zod.z.number().int().min(2).max(8192).optional(),frameRate:zod.z.number().int().min(12).max(120).default(30),bitrateMode:zod.z.enum(["auto","custom"]).optional(),videoBitrateKbps:zod.z.number().int().min(100).max(5e4).optional(),audioBitrateKbps:zod.z.number().int().min(32).max(1024).optional(),audioCodec:zod.z.enum(["aac","mp3"]).default("aac")}).optional(),DEFAULT_FILTERS={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0};zod.z.object({clips:zod.z.array(Clip).min(1).max(50),audioClips:zod.z.array(AudioClip).max(8).default([]),canvas:zod.z.object({w:zod.z.number().int().min(2).max(4096),h:zod.z.number().int().min(2).max(4096)}),crop:zod.z.object({x:zod.z.number().min(0),y:zod.z.number().min(0),width:zod.z.number().positive(),height:zod.z.number().positive()}).optional(),scale:zod.z.object({width:zod.z.number().positive(),height:zod.z.number().positive(),fit:zod.z.enum(["contain","cover","force"]),backgroundColor:zod.z.string().max(32).optional()}).optional(),rotation:zod.z.number().min(-180).max(180).default(0),flipX:zod.z.boolean().default(!1),flipY:zod.z.boolean().default(!1),filters:zod.z.object(FilterCommon).default(DEFAULT_FILTERS),filterPreset:zod.z.string().max(32).optional(),overlays:zod.z.array(Overlay).max(200).optional(),transitions:zod.z.array(Transition).max(49).default([]),keepAudio:zod.z.boolean().default(!0),poster:zod.z.object({time:zod.z.number().min(0),src:zod.z.string().optional(),useAsVideoCover:zod.z.boolean().optional(),preview:zod.z.string().optional()}).optional(),exportSettings:ExportSettings}).superRefine((e,t)=>{e.clips.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`clips[${o}].out 必须大于 in`,path:["clips",o,"out"]})}),e.audioClips?.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`audioClips[${o}].out 必须大于 in`,path:["audioClips",o,"out"]})}),e.canvas.w%2==0&&e.canvas.h%2==0||t.addIssue({code:zod.z.ZodIssueCode.custom,message:"canvas 宽高必须为偶数",path:["canvas"]}),null!=e.exportSettings?.width&&e.exportSettings.width%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.width must be even",path:["exportSettings","width"]}),null!=e.exportSettings?.height&&e.exportSettings.height%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.height must be even",path:["exportSettings","height"]})});var FILTER_PRESETS=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function findFilterPreset(e){return e?FILTER_PRESETS.find(t=>t.id===e):void 0}function buildFilterCss(e,t){const o=findFilterPreset(t)?.css??"",n=e.temperature??0,r=e.tint??0,a=e.vibrance??0,i=e.gamma??0,s=e.sharpen??0,l=e.clarity??0;return[`brightness(${1+e.brightness})`,`contrast(${1+e.contrast})`,`saturate(${1+e.saturation})`,o,a?`saturate(${(1+.65*a).toFixed(3)})`:"",n>0?`sepia(${Math.min(.36,.28*n).toFixed(3)})`:"",n?`hue-rotate(${(14*-n).toFixed(2)}deg)`:"",r?`hue-rotate(${(10*r).toFixed(2)}deg)`:"",i?`brightness(${(1+.08*i).toFixed(3)})`:"",l||s?`contrast(${(1+.16*l+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}var DEFAULT_SCALE_BACKGROUND="#000000";function normalizeScaleBackgroundColor(e){if("string"!=typeof e)return DEFAULT_SCALE_BACKGROUND;const t=e.trim(),o=t.match(/^#?([0-9a-fA-F]{3})$/);if(o)return`#${o[1].split("").map(e=>e+e).join("").toLowerCase()}`;const n=t.match(/^#?([0-9a-fA-F]{6})$/);return n?`#${n[1].toLowerCase()}`:DEFAULT_SCALE_BACKGROUND}function hasAdjustmentEffect(e){return Boolean(e.filterPreset)||Object.keys(DEFAULT_FILTERS).some(t=>Math.abs(Number(e[t])||0)>1e-4)}function applyAdjustmentOverlay(e,t,o,n){if(!hasAdjustmentEffect(o))return;const r=Math.max(0,Math.round(o.x*n)),a=Math.max(0,Math.round(o.y*n)),i=Math.min(t.width-r,Math.max(1,Math.round(o.w*n))),s=Math.min(t.height-a,Math.max(1,Math.round(o.h*n)));if(i<=0||s<=0)return;const l=document.createElement("canvas");l.width=i,l.height=s;const d=l.getContext("2d");d&&(d.drawImage(t,r,a,i,s,0,0,i,s),e.save(),e.filter=buildFilterCss({...DEFAULT_FILTERS,...o},o.filterPreset),e.drawImage(l,r,a,i,s),e.restore(),e.filter="none")}function drawLayeredOverlays(e,t,o,n,r,a=1){if(o?.length){e.setTransform(a,0,0,a,0,0);for(const i of overlayLayerRenderOrder(o))isOverlayHidden(i)||("number"!=typeof r||isOverlayActiveAt(i,r))&&("adjust"===i.type?(e.setTransform(1,0,0,1,0,0),applyAdjustmentOverlay(e,t,i,a),e.setTransform(a,0,0,a,0,0)):drawOverlay(e,i,n));e.setTransform(1,0,0,1,0,0)}}function drawVideoFrame(e,t,o,n,r,a=1,i,s=!0){const l=outputSize(n,r);e.width=Math.max(2,Math.round(l.w*a)),e.height=Math.max(2,Math.round(l.h*a));const d=e.getContext("2d");if(!d)return;if(Boolean(r.__mePreviewVideoHidden)){d.fillStyle="#000000",d.fillRect(0,0,e.width,e.height);const t=Number.isFinite(r.__mePreviewTimelineTime)?Number(r.__mePreviewTimelineTime):void 0;return void(s&&r.overlays?.length&&drawLayeredOverlays(d,e,r.overlays,i,t,a))}const m=rotatedSize(n.w,n.h,r.rotation),u=r.crop??{x:0,y:0,width:m.w,height:m.h},c=r.scale?.fit??"force",{src:h,dst:z}=fitRects({width:u.width,height:u.height},l,c);"contain"===c&&(d.fillStyle=normalizeScaleBackgroundColor(r.scale?.backgroundColor),d.fillRect(0,0,e.width,e.height)),d.filter=buildFilterCss(r.filters,r.filterPreset),d.save(),"contain"===c&&(d.beginPath(),d.rect(a*z.x,a*z.y,a*z.width,a*z.height),d.clip()),d.translate(a*z.x,a*z.y),d.scale(a*z.width/h.width,a*z.height/h.height),d.translate(-(u.x+h.x),-(u.y+h.y)),d.translate(m.w/2,m.h/2),d.rotate(r.rotation*DEG2RAD2),d.scale(r.flipX?-1:1,r.flipY?-1:1);const p=fitRects({width:o.w,height:o.h},{w:n.w,h:n.h},"cover");d.drawImage(t,p.src.x,p.src.y,p.src.width,p.src.height,-n.w/2,-n.h/2,n.w,n.h),d.restore(),d.filter="none";const x=Number.isFinite(r.__mePreviewTimelineTime)?Number(r.__mePreviewTimelineTime):void 0;s&&r.overlays?.length&&drawLayeredOverlays(d,e,r.overlays,i,x,a)}function seekVideo(e,t){return new Promise(o=>{const n=()=>{e.removeEventListener("seeked",n),o()};e.addEventListener("seeked",n),e.currentTime=Math.min(Math.max(0,t),e.duration||t)})}async function generateThumbnails(e,t,o=160){const n=e.duration;if(!n||!isFinite(n)||t<=0)return[];const r=e.videoWidth||16,a=e.videoHeight||9,i=Math.min(o,r),s=Math.max(1,Math.round(i*a/r)),l=document.createElement("canvas");l.width=i,l.height=s;const d=l.getContext("2d");if(!d)return[];const m=[];for(let o=0;o<t;o++)await seekVideo(e,n*(o+.5)/t),d.drawImage(e,0,0,i,s),m.push(l.toDataURL("image/jpeg",.6));return m}function createFullscreenToggle(e,t={}){const o=t.mode??"overlay",n=document.createElement("button");n.type="button",n.className=["me-fullscreen-toggle",t.className].filter(Boolean).join(" "),n.dataset.meFullscreenToggle="true",n.dataset.mode=o,n.title="全屏 / 退出全屏",n.style.cssText=["overlay"===o?"position:absolute;left:8px;bottom:8px;z-index:30;":"position:static;","width:32px;height:32px;padding:0;","display:inline-flex;align-items:center;justify-content:center;","border:1px solid var(--me-border,#26262b);border-radius:6px;","background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);","cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;"].join(""),e.classList.add("me-fullscreen-host");const r=()=>{const t=document.fullscreenElement===e;n.textContent=t?"×":"⛶",n.setAttribute("aria-label",t?"退出全屏":"全屏"),e.classList.toggle("me-is-fullscreen",t),e.dataset.meFullscreen=t?"true":"false"};r();const a=()=>r(),i=()=>{const t=document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.();t?.catch?.(()=>{})};return n.addEventListener("click",i),document.addEventListener("fullscreenchange",a),{button:n,dispose:()=>{document.removeEventListener("fullscreenchange",a),n.removeEventListener("click",i),n.remove(),e.classList.remove("me-fullscreen-host","me-is-fullscreen"),delete e.dataset.meFullscreen}}}exports.buildVideoExportFormData=buildVideoExportFormData,exports.createFullscreenToggle=createFullscreenToggle,exports.drawLayeredOverlays=drawLayeredOverlays,exports.drawOverlay=drawOverlay,exports.drawOverlays=drawOverlays,exports.drawVideoFrame=drawVideoFrame,exports.filterOverlaysAtTime=filterOverlaysAtTime,exports.fitStickerBox=fitStickerBox,exports.generateThumbnails=generateThumbnails,exports.getOverlayRotation=getOverlayRotation,exports.hitTestOverlay=hitTestOverlay,exports.isDrawableOverlay=isDrawableOverlay,exports.isOverlayActiveAt=isOverlayActiveAt,exports.isOverlayHidden=isOverlayHidden,exports.isOverlayLocked=isOverlayLocked,exports.loadOverlayImages=loadOverlayImages,exports.overlayBBox=overlayBBox,exports.overlayLayerRenderOrder=overlayLayerRenderOrder,exports.overlayTimeRange=overlayTimeRange,exports.renderOverlaysToPng=renderOverlaysToPng,exports.rotateOverlay=rotateOverlay,exports.scaleOverlay=scaleOverlay,exports.translateOverlay=translateOverlay;
|
|
1
|
+
"use strict";var zod=require("zod"),DEG2RAD=Math.PI/180,TEXT_FONT_STACK='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';function isDrawableOverlay(e){return"adjust"!==e.type}function isOverlayHidden(e){return Boolean(e.hidden)}function isOverlayLocked(e){return Boolean(e.locked)}function overlayTrack(e,t){const o=Number(e.timelineTrack);return Number.isFinite(o)?Math.max(0,Math.round(o)):t}function overlayLayerRenderOrder(e){return e.map((e,t)=>({overlay:e,index:t,track:overlayTrack(e,t)})).sort((e,t)=>t.track-e.track||e.index-t.index).map(e=>e.overlay)}function strokeStyle(e,t,o){e.strokeStyle=t,e.lineWidth=o,e.lineCap="round",e.lineJoin="round"}function drawArrowHead(e,t,o,n,r,a){const i=Math.atan2(r-o,n-t),s=Math.max(12,3.5*a);e.beginPath(),e.moveTo(n,r),e.lineTo(n-s*Math.cos(i-Math.PI/7),r-s*Math.sin(i-Math.PI/7)),e.moveTo(n,r),e.lineTo(n-s*Math.cos(i+Math.PI/7),r-s*Math.sin(i+Math.PI/7)),e.stroke()}function normalizeOverlayRotation(e){if(!Number.isFinite(e))return 0;let t=e%360;return t>180&&(t-=360),t<-180&&(t+=360),Math.abs(t)<.001?0:t}function getOverlayRotation(e){return normalizeOverlayRotation(e.rotation??0)}function overlayBBox(e){switch(e.type){case"pen":{let t=1/0,o=1/0,n=-1/0,r=-1/0;for(let a=0;a<e.points.length;a+=2)t=Math.min(t,e.points[a]),n=Math.max(n,e.points[a]),o=Math.min(o,e.points[a+1]),r=Math.max(r,e.points[a+1]);return{x:t,y:o,w:n-t,h:r-o}}case"line":case"arrow":return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)};case"rect":case"ellipse":case"sticker":case"adjust":return{x:e.x,y:e.y,w:e.w,h:e.h};case"text":return textBBox(e)}}function textLines(e){return String(e.text||"").split(/\r?\n/)}function textLineHeight(e){return e.fontSize*(e.lineHeight??1.15)}function textPaddingX(e){return e.paddingX??0}function textPaddingY(e){return e.paddingY??0}function textContentWidth(e){const t=Math.max(.6*e.fontSize,...textLines(e).map(t=>Math.max(1,t.length)*e.fontSize*.6));return Math.max(1,e.width??t+2*textPaddingX(e))}function textBBox(e){const t=textLines(e);return{x:e.x,y:e.y,w:textContentWidth(e),h:Math.max(e.fontSize,t.length*textLineHeight(e))+2*textPaddingY(e)}}function textFont(e){const t=e.fontWeight??"700",o=e.italic?"italic ":"",n=e.fontFamily?`"${e.fontFamily}", ${TEXT_FONT_STACK}`:TEXT_FONT_STACK;return`${o}${t} ${e.fontSize}px ${n}`}function textLineX(e,t,o,n){const r=textPaddingX(t),a=t.align??"left",i=e.measureText(o||" ").width;return"center"===a?t.x+n/2-i/2:"right"===a?t.x+n-r-i:t.x+r}function overlayCenter(e){const t=overlayBBox(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function rotatePoint(e,t,o,n,r){const a=r*DEG2RAD,i=Math.cos(a),s=Math.sin(a),l=e-o,d=t-n;return{x:o+l*i-d*s,y:n+l*s+d*i}}function scalePoint(e,t,o,n,r){return{x:o+(e-o)*r,y:n+(t-n)*r}}function overlayTimeRange(e){const t=e,o=Number.isFinite(t.startAt)?Math.max(0,Number(t.startAt)):null,n=Number.isFinite(t.endAt)?Math.max(o??0,Number(t.endAt)):null;if(null==o&&null==n)return null;const r=o??0;return{start:r,end:Math.max(r,n??r)}}function isOverlayActiveAt(e,t){const o=overlayTimeRange(e);return!o||Number.isFinite(t)&&t>=o.start&&t<=o.end}function filterOverlaysAtTime(e,t){if(!e?.length)return[];const o=e.filter(e=>!isOverlayHidden(e));return Number.isFinite(t)?o.filter(e=>isOverlayActiveAt(e,t)):o}function drawOverlay(e,t,o){if(isOverlayHidden(t))return;if(!isDrawableOverlay(t))return;const n=getOverlayRotation(t);if(n){const r=overlayCenter(t);return e.save(),e.translate(r.x,r.y),e.rotate(n*DEG2RAD),e.translate(-r.x,-r.y),drawOverlayBase(e,t,o),void e.restore()}drawOverlayBase(e,t,o)}function drawOverlayBase(e,t,o){switch(t.type){case"pen":strokeStyle(e,t.color,t.width),e.beginPath(),e.moveTo(t.points[0],t.points[1]);for(let o=2;o<t.points.length;o+=2)e.lineTo(t.points[o],t.points[o+1]);e.stroke();break;case"line":case"arrow":strokeStyle(e,t.color,t.width),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),"arrow"===t.type&&drawArrowHead(e,t.x1,t.y1,t.x2,t.y2,t.width);break;case"rect":strokeStyle(e,t.color,t.width),e.strokeRect(t.x,t.y,t.w,t.h);break;case"ellipse":strokeStyle(e,t.color,t.width),e.beginPath(),e.ellipse(t.x+t.w/2,t.y+t.h/2,Math.abs(t.w/2),Math.abs(t.h/2),0,0,2*Math.PI),e.stroke();break;case"text":{const o=textBBox(t),n=textLines(t),r=Number.isFinite(t.opacity)?Math.min(1,Math.max(0,(t.opacity??100)/100)):1;e.save(),e.globalAlpha*=r,t.backgroundColor&&"transparent"!==t.backgroundColor&&(e.fillStyle=t.backgroundColor,e.fillRect(t.x,t.y,o.w,o.h)),e.fillStyle=t.color,e.font=textFont(t),e.textBaseline="top",e.strokeStyle=t.strokeColor??"rgba(0,0,0,0.45)",e.lineWidth=t.borderWidth??Math.max(2,t.fontSize/16),e.lineJoin="round",n.forEach((n,r)=>{const a=textLineX(e,t,n,o.w),i=t.y+textPaddingY(t)+r*textLineHeight(t),s=e.measureText(n||" ").width;if(e.lineWidth>0&&e.strokeText(n,a,i),e.fillText(n,a,i),(t.underline||t.strikethrough)&&s>0){const o=Math.max(1,t.fontSize/18);e.fillStyle=t.color,t.underline&&e.fillRect(a,i+.92*t.fontSize,s,o),t.strikethrough&&e.fillRect(a,i+.52*t.fontSize,s,o)}}),e.restore();break}case"sticker":if(t.emoji)e.save(),e.font=.86*Math.min(t.w,t.h)+'px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif',e.textAlign="center",e.textBaseline="middle",e.fillText(t.emoji,t.x+t.w/2,t.y+t.h/2),e.restore();else if(t.src){const n=o?.get(t.src);n&&e.drawImage(n,t.x,t.y,t.w,t.h)}}}function drawOverlays(e,t,o,n){const r="number"==typeof n?filterOverlaysAtTime(t,n):t;for(const t of r)!isOverlayHidden(t)&&isDrawableOverlay(t)&&drawOverlay(e,t,o)}async function loadOverlayImages(e){const t=new Map,o=[...new Set(e.filter(e=>"sticker"===e.type&&e.src).map(e=>e.src))];return await Promise.all(o.map(e=>new Promise(o=>{const n=new Image;/^(?:https?:)?\/\//i.test(e)&&(n.crossOrigin="anonymous"),n.onload=()=>{t.set(e,n),o()},n.onerror=()=>o(),n.src=e}))),t}async function renderOverlaysToPng(e,t,o){const n=e?.filter(e=>!isOverlayHidden(e)&&isDrawableOverlay(e))??[];if(!n.length)return null;const r=document.createElement("canvas");r.width=t,r.height=o;const a=r.getContext("2d");return a?(drawOverlays(a,n,await loadOverlayImages(n)),new Promise(e=>r.toBlob(t=>e(t),"image/png"))):null}function hitTestOverlay(e,t,o,n=12){for(let r=e.length-1;r>=0;r--){const a=e[r];if(!isOverlayHidden(a)&&hitOne(a,t,o,n))return r}return-1}function near(e,t,o,n,r){return Math.abs(e-o)<=r&&Math.abs(t-n)<=r}function nearSegment(e,t,o,n,r,a,i){const s=r-o,l=a-n,d=s*s+l*l||1,m=Math.max(0,Math.min(1,((e-o)*s+(t-n)*l)/d));return(e-(o+m*s))**2+(t-(n+m*l))**2<=i*i}function hitOne(e,t,o,n){const r=getOverlayRotation(e);if(r){const a=overlayCenter(e),i=rotatePoint(t,o,a.x,a.y,-r);return hitOneBase(e,i.x,i.y,n)}return hitOneBase(e,t,o,n)}function hitOneBase(e,t,o,n){switch(e.type){case"pen":for(let r=0;r+3<e.points.length;r+=2)if(nearSegment(t,o,e.points[r],e.points[r+1],e.points[r+2],e.points[r+3],n+e.width/2))return!0;return!1;case"line":case"arrow":return nearSegment(t,o,e.x1,e.y1,e.x2,e.y2,n+e.width/2);case"rect":case"ellipse":return t>=e.x-n&&t<=e.x+e.w+n&&o>=e.y-n&&o<=e.y+e.h+n;case"text":{const r=textBBox(e);return t>=r.x-n&&t<=r.x+r.w+n&&o>=r.y-n&&o<=r.y+r.h+n}case"sticker":return near(t,o,e.x+e.w/2,e.y+e.h/2,Math.max(e.w,e.h)/2+n);case"adjust":return!1}}function fitStickerBox(e,t,o){const n=Math.max(8,o);if(!(e>0&&t>0))return{w:n,h:n};const r=n/Math.max(e,t);return{w:Math.max(8,Math.round(e*r)),h:Math.max(8,Math.round(t*r))}}function scaleOverlay(e,t){const o=Math.max(.05,t),n=overlayCenter(e);switch(e.type){case"pen":return{...e,points:e.points.map((e,t)=>t%2==0?n.x+(e-n.x)*o:n.y+(e-n.y)*o)};case"line":case"arrow":{const t=scalePoint(e.x1,e.y1,n.x,n.y,o),r=scalePoint(e.x2,e.y2,n.x,n.y,o);return{...e,x1:t.x,y1:t.y,x2:r.x,y2:r.y}}case"rect":case"ellipse":case"sticker":case"adjust":return{...e,w:Math.max(8,e.w*o),h:Math.max(8,e.h*o)};case"text":return{...e,fontSize:Math.min(512,Math.max(8,e.fontSize*o)),width:e.width?Math.max(16,e.width*o):e.width,paddingX:e.paddingX?Math.max(0,e.paddingX*o):e.paddingX,paddingY:e.paddingY?Math.max(0,e.paddingY*o):e.paddingY,borderWidth:e.borderWidth?Math.max(0,e.borderWidth*o):e.borderWidth};default:return e}}function rotateOverlay(e,t){return{...e,rotation:normalizeOverlayRotation(t)}}function translateOverlay(e,t,o){switch(e.type){case"pen":{const n=e.points.map((e,n)=>n%2==0?e+t:e+o);return{...e,points:n}}case"line":case"arrow":return{...e,x1:e.x1+t,y1:e.y1+o,x2:e.x2+t,y2:e.y2+o};case"rect":case"ellipse":case"sticker":case"adjust":case"text":return{...e,x:e.x+t,y:e.y+o}}}var DEG2RAD2=Math.PI/180;function rotatedSize(e,t,o){const n=normalizeDeg(o);if(0===n||180===n)return{w:e,h:t};if(90===n||270===n)return{w:t,h:e};const r=n*DEG2RAD2;return{w:Math.round(Math.abs(e*Math.cos(r))+Math.abs(t*Math.sin(r))),h:Math.round(Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)))}}function normalizeDeg(e){return(e%360+360)%360}function evenize(e){const t=Math.round(e);return t-t%2}function centeredMaxRect(e,t){let o=e.w,n=o/t;return n>e.h&&(n=e.h,o=n*t),{x:Math.round((e.w-o)/2),y:Math.round((e.h-n)/2),width:Math.round(o),height:Math.round(n)}}function fitRects(e,t,o){const n={x:0,y:0,width:e.width,height:e.height},r={x:0,y:0,width:t.w,height:t.h};return"cover"===o?{src:centeredMaxRect({w:e.width,h:e.height},t.w/t.h),dst:r}:"contain"===o?{src:n,dst:centeredMaxRect({w:t.w,h:t.h},e.width/e.height)}:{src:n,dst:r}}function outputSize(e,t){if(t.scale)return{w:evenize(t.scale.width),h:evenize(t.scale.height)};if(t.crop)return{w:evenize(t.crop.width),h:evenize(t.crop.height)};const o=rotatedSize(e.w,e.h,t.rotation);return{w:evenize(o.w),h:evenize(o.h)}}function dataUrlToBlob(e){const t=e.match(/^data:(image\/(?:png|jpe?g));base64,([a-z0-9+/=]+)$/i);if(!t)return null;const o=atob(t[2]),n=new Uint8Array(o.length);for(let e=0;e<o.length;e++)n[e]=o.charCodeAt(e);return new Blob([n],{type:t[1].toLowerCase()})}async function buildVideoExportFormData(e,t,o=[]){const n=e.getExportPlan(),r=new FormData;n.videoSrcOrder.forEach((e,o)=>{const n=t[e];n&&("undefined"!=typeof File&&n instanceof File?r.append(`video_${o}`,n,n.name||`video_${o}.mp4`):"url"in n&&"string"==typeof n.url&&n.url&&(r.append(`videoUrl_${o}`,n.url),n.name&&r.append(`videoName_${o}`,n.name),n.type&&r.append(`videoType_${o}`,n.type),null!=n.size&&r.append(`videoSize_${o}`,String(n.size))))}),n.audioSrcOrder.forEach((e,t)=>{const n=o[e];n&&r.append(`audio_${t}`,n,n.name||`audio_${t}`)});const a=overlayLayerRenderOrder(n.state.overlays??[]).filter(e=>!isOverlayHidden(e)&&isDrawableOverlay(e)),i=outputSize(n.state.canvas,n.state);(await Promise.all(a.map(e=>renderOverlaysToPng([e],i.w,i.h)))).forEach((e,t)=>{e&&r.append(`textOverlay_${t}`,e,`textOverlay_${t}.png`)});const s=n.state.poster?.useAsVideoCover?n.state.poster.preview||n.state.poster.src:"",l=s?dataUrlToBlob(s):null;if(l){const e="image/png"===l.type?"video-cover.png":"video-cover.jpg";r.append("videoCover",l,e)}const d=n.state.poster?.preview||n.state.poster?.src?{...n.state,poster:{...n.state.poster,preview:void 0,src:void 0}}:n.state;return r.append("editState",JSON.stringify(d)),r}var StrokeCommon={color:zod.z.string().max(32),width:zod.z.number().positive().max(200)},RotationCommon={rotation:zod.z.number().min(-180).max(180).optional()},TimelineCommon={startAt:zod.z.number().min(0).optional(),endAt:zod.z.number().min(0).optional(),timelineTrack:zod.z.number().int().min(0).max(99).optional(),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()},FilterCommon={brightness:zod.z.number().min(-1).max(1).default(0),contrast:zod.z.number().min(-1).max(1).default(0),saturation:zod.z.number().min(-1).max(1).default(0),temperature:zod.z.number().min(-1).max(1).default(0),tint:zod.z.number().min(-1).max(1).default(0),vibrance:zod.z.number().min(-1).max(1).default(0),gamma:zod.z.number().min(-1).max(1).default(0),highlights:zod.z.number().min(-1).max(1).default(0),shadows:zod.z.number().min(-1).max(1).default(0),whites:zod.z.number().min(-1).max(1).default(0),blacks:zod.z.number().min(-1).max(1).default(0),lightSense:zod.z.number().min(-1).max(1).default(0),sharpen:zod.z.number().min(0).max(1).default(0),clarity:zod.z.number().min(0).max(1).default(0),grain:zod.z.number().min(0).max(1).default(0),fade:zod.z.number().min(0).max(1).default(0),vignette:zod.z.number().min(0).max(1).default(0)},Overlay=zod.z.discriminatedUnion("type",[zod.z.object({type:zod.z.literal("pen"),points:zod.z.array(zod.z.number()).min(4),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("line"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("arrow"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("rect"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("ellipse"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("text"),x:zod.z.number(),y:zod.z.number(),text:zod.z.string().max(500),color:zod.z.string().max(32),fontSize:zod.z.number().positive().max(512),fontFamily:zod.z.string().max(120).optional(),fontWeight:zod.z.string().max(20).optional(),italic:zod.z.boolean().optional(),underline:zod.z.boolean().optional(),strikethrough:zod.z.boolean().optional(),align:zod.z.enum(["left","center","right"]).optional(),width:zod.z.number().positive().max(8192).optional(),backgroundColor:zod.z.string().max(32).optional(),strokeColor:zod.z.string().max(32).optional(),borderWidth:zod.z.number().min(0).max(64).optional(),paddingX:zod.z.number().min(0).max(256).optional(),paddingY:zod.z.number().min(0).max(256).optional(),lineHeight:zod.z.number().positive().max(4).optional(),opacity:zod.z.number().min(0).max(100).optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("sticker"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),emoji:zod.z.string().max(16).optional(),src:zod.z.string().optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("adjust"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),layerKind:zod.z.enum(["adjust","filter"]).optional(),filterPreset:zod.z.string().max(32).optional(),...FilterCommon,...TimelineCommon,...RotationCommon})]),Clip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(7),in:zod.z.number().min(0),out:zod.z.number().min(0),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()}),AudioClip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(2),track:zod.z.number().int().min(0).default(0),startAt:zod.z.number().min(0),in:zod.z.number().min(0),out:zod.z.number().min(0),speed:zod.z.number().min(.5).max(2).default(1),volume:zod.z.number().min(0).max(10),muted:zod.z.boolean().optional(),locked:zod.z.boolean().optional(),fadeIn:zod.z.number().min(0).default(0),fadeOut:zod.z.number().min(0).default(0)}),Transition=zod.z.object({type:zod.z.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:zod.z.number().min(0).max(2).default(.4)}),ExportSettings=zod.z.object({fileName:zod.z.string().max(120).optional(),format:zod.z.enum(["mp4","mov","mxf"]).default("mp4"),width:zod.z.number().int().min(2).max(8192).optional(),height:zod.z.number().int().min(2).max(8192).optional(),frameRate:zod.z.number().int().min(12).max(120).default(30),bitrateMode:zod.z.enum(["auto","custom"]).optional(),videoBitrateKbps:zod.z.number().int().min(100).max(5e4).optional(),audioBitrateKbps:zod.z.number().int().min(32).max(1024).optional(),audioCodec:zod.z.enum(["aac","mp3"]).default("aac")}).optional(),DEFAULT_FILTERS={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0};zod.z.object({clips:zod.z.array(Clip).min(1).max(50),audioClips:zod.z.array(AudioClip).max(8).default([]),canvas:zod.z.object({w:zod.z.number().int().min(2).max(4096),h:zod.z.number().int().min(2).max(4096)}),crop:zod.z.object({x:zod.z.number().min(0),y:zod.z.number().min(0),width:zod.z.number().positive(),height:zod.z.number().positive()}).optional(),scale:zod.z.object({width:zod.z.number().positive(),height:zod.z.number().positive(),fit:zod.z.enum(["contain","cover","force"]),backgroundColor:zod.z.string().max(32).optional()}).optional(),rotation:zod.z.number().min(-180).max(180).default(0),flipX:zod.z.boolean().default(!1),flipY:zod.z.boolean().default(!1),filters:zod.z.object(FilterCommon).default(DEFAULT_FILTERS),filterPreset:zod.z.string().max(32).optional(),overlays:zod.z.array(Overlay).max(200).optional(),transitions:zod.z.array(Transition).max(49).default([]),keepAudio:zod.z.boolean().default(!0),poster:zod.z.object({time:zod.z.number().min(0),src:zod.z.string().optional(),useAsVideoCover:zod.z.boolean().optional(),preview:zod.z.string().optional()}).optional(),exportSettings:ExportSettings}).superRefine((e,t)=>{e.clips.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`clips[${o}].out 必须大于 in`,path:["clips",o,"out"]})}),e.audioClips?.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`audioClips[${o}].out 必须大于 in`,path:["audioClips",o,"out"]})}),e.canvas.w%2==0&&e.canvas.h%2==0||t.addIssue({code:zod.z.ZodIssueCode.custom,message:"canvas 宽高必须为偶数",path:["canvas"]}),null!=e.exportSettings?.width&&e.exportSettings.width%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.width must be even",path:["exportSettings","width"]}),null!=e.exportSettings?.height&&e.exportSettings.height%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.height must be even",path:["exportSettings","height"]})});var FILTER_PRESETS=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function findFilterPreset(e){return e?FILTER_PRESETS.find(t=>t.id===e):void 0}function buildFilterCss(e,t){const o=findFilterPreset(t)?.css??"",n=e.temperature??0,r=e.tint??0,a=e.vibrance??0,i=e.gamma??0,s=e.sharpen??0,l=e.clarity??0;return[`brightness(${1+e.brightness})`,`contrast(${1+e.contrast})`,`saturate(${1+e.saturation})`,o,a?`saturate(${(1+.65*a).toFixed(3)})`:"",n>0?`sepia(${Math.min(.36,.28*n).toFixed(3)})`:"",n?`hue-rotate(${(14*-n).toFixed(2)}deg)`:"",r?`hue-rotate(${(10*r).toFixed(2)}deg)`:"",i?`brightness(${(1+.08*i).toFixed(3)})`:"",l||s?`contrast(${(1+.16*l+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}var DEFAULT_SCALE_BACKGROUND="#000000";function normalizeScaleBackgroundColor(e){if("string"!=typeof e)return DEFAULT_SCALE_BACKGROUND;const t=e.trim(),o=t.match(/^#?([0-9a-fA-F]{3})$/);if(o)return`#${o[1].split("").map(e=>e+e).join("").toLowerCase()}`;const n=t.match(/^#?([0-9a-fA-F]{6})$/);return n?`#${n[1].toLowerCase()}`:DEFAULT_SCALE_BACKGROUND}function hasAdjustmentEffect(e){return Boolean(e.filterPreset)||Object.keys(DEFAULT_FILTERS).some(t=>Math.abs(Number(e[t])||0)>1e-4)}function applyAdjustmentOverlay(e,t,o,n){if(!hasAdjustmentEffect(o))return;const r=Math.max(0,Math.round(o.x*n)),a=Math.max(0,Math.round(o.y*n)),i=Math.min(t.width-r,Math.max(1,Math.round(o.w*n))),s=Math.min(t.height-a,Math.max(1,Math.round(o.h*n)));if(i<=0||s<=0)return;const l=document.createElement("canvas");l.width=i,l.height=s;const d=l.getContext("2d");d&&(d.drawImage(t,r,a,i,s,0,0,i,s),e.save(),e.filter=buildFilterCss({...DEFAULT_FILTERS,...o},o.filterPreset),e.drawImage(l,r,a,i,s),e.restore(),e.filter="none")}function drawLayeredOverlays(e,t,o,n,r,a=1){if(o?.length){e.setTransform(a,0,0,a,0,0);for(const i of overlayLayerRenderOrder(o))isOverlayHidden(i)||("number"!=typeof r||isOverlayActiveAt(i,r))&&("adjust"===i.type?(e.setTransform(1,0,0,1,0,0),applyAdjustmentOverlay(e,t,i,a),e.setTransform(a,0,0,a,0,0)):drawOverlay(e,i,n));e.setTransform(1,0,0,1,0,0)}}function drawVideoFrame(e,t,o,n,r,a=1,i,s=!0){const l=outputSize(n,r);e.width=Math.max(2,Math.round(l.w*a)),e.height=Math.max(2,Math.round(l.h*a));const d=e.getContext("2d");if(!d)return;if(Boolean(r.__mePreviewVideoHidden)){d.fillStyle="#000000",d.fillRect(0,0,e.width,e.height);const t=Number.isFinite(r.__mePreviewTimelineTime)?Number(r.__mePreviewTimelineTime):void 0;return void(s&&r.overlays?.length&&drawLayeredOverlays(d,e,r.overlays,i,t,a))}const m=rotatedSize(n.w,n.h,r.rotation),u=r.crop??{x:0,y:0,width:m.w,height:m.h},c=r.scale?.fit??"force",{src:h,dst:z}=fitRects({width:u.width,height:u.height},l,c);"contain"===c&&(d.fillStyle=normalizeScaleBackgroundColor(r.scale?.backgroundColor),d.fillRect(0,0,e.width,e.height)),d.filter=buildFilterCss(r.filters,r.filterPreset),d.save(),"contain"===c&&(d.beginPath(),d.rect(a*z.x,a*z.y,a*z.width,a*z.height),d.clip()),d.translate(a*z.x,a*z.y),d.scale(a*z.width/h.width,a*z.height/h.height),d.translate(-(u.x+h.x),-(u.y+h.y)),d.translate(m.w/2,m.h/2),d.rotate(r.rotation*DEG2RAD2),d.scale(r.flipX?-1:1,r.flipY?-1:1);const p=fitRects({width:o.w,height:o.h},{w:n.w,h:n.h},"cover");d.drawImage(t,p.src.x,p.src.y,p.src.width,p.src.height,-n.w/2,-n.h/2,n.w,n.h),d.restore(),d.filter="none";const x=Number.isFinite(r.__mePreviewTimelineTime)?Number(r.__mePreviewTimelineTime):void 0;s&&r.overlays?.length&&drawLayeredOverlays(d,e,r.overlays,i,x,a)}function seekVideo(e,t){return new Promise(o=>{const n=()=>{e.removeEventListener("seeked",n),o()};e.addEventListener("seeked",n),e.currentTime=Math.min(Math.max(0,t),e.duration||t)})}async function generateThumbnails(e,t,o=160){const n=e.duration;if(!n||!isFinite(n)||t<=0)return[];const r=e.videoWidth||16,a=e.videoHeight||9,i=Math.min(o,r),s=Math.max(1,Math.round(i*a/r)),l=document.createElement("canvas");l.width=i,l.height=s;const d=l.getContext("2d");if(!d)return[];const m=[];for(let o=0;o<t;o++)await seekVideo(e,n*(o+.5)/t),d.drawImage(e,0,0,i,s),m.push(l.toDataURL("image/jpeg",.6));return m}function createFullscreenToggle(e,t={}){const o=t.mode??"overlay",n=document.createElement("button");n.type="button",n.className=["me-fullscreen-toggle",t.className].filter(Boolean).join(" "),n.dataset.meFullscreenToggle="true",n.dataset.mode=o,n.title="全屏 / 退出全屏",n.style.cssText=["overlay"===o?"position:absolute;left:8px;bottom:8px;z-index:30;":"position:static;","width:32px;height:32px;padding:0;","display:inline-flex;align-items:center;justify-content:center;","border:1px solid var(--me-border,#26262b);border-radius:6px;","background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);","cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;"].join(""),e.classList.add("me-fullscreen-host");const r=()=>{const t=document.fullscreenElement===e;n.textContent=t?"×":"⛶",n.setAttribute("aria-label",t?"退出全屏":"全屏"),e.classList.toggle("me-is-fullscreen",t),e.dataset.meFullscreen=t?"true":"false"};r();const a=()=>r(),i=()=>{const t=document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.();t?.catch?.(()=>{})};return n.addEventListener("click",i),document.addEventListener("fullscreenchange",a),{button:n,dispose:()=>{document.removeEventListener("fullscreenchange",a),n.removeEventListener("click",i),n.remove(),e.classList.remove("me-fullscreen-host","me-is-fullscreen"),delete e.dataset.meFullscreen}}}exports.buildVideoExportFormData=buildVideoExportFormData,exports.createFullscreenToggle=createFullscreenToggle,exports.drawLayeredOverlays=drawLayeredOverlays,exports.drawOverlay=drawOverlay,exports.drawOverlays=drawOverlays,exports.drawVideoFrame=drawVideoFrame,exports.filterOverlaysAtTime=filterOverlaysAtTime,exports.fitStickerBox=fitStickerBox,exports.generateThumbnails=generateThumbnails,exports.getOverlayRotation=getOverlayRotation,exports.hitTestOverlay=hitTestOverlay,exports.isDrawableOverlay=isDrawableOverlay,exports.isOverlayActiveAt=isOverlayActiveAt,exports.isOverlayHidden=isOverlayHidden,exports.isOverlayLocked=isOverlayLocked,exports.loadOverlayImages=loadOverlayImages,exports.overlayBBox=overlayBBox,exports.overlayLayerRenderOrder=overlayLayerRenderOrder,exports.overlayTimeRange=overlayTimeRange,exports.renderOverlaysToPng=renderOverlaysToPng,exports.rotateOverlay=rotateOverlay,exports.scaleOverlay=scaleOverlay,exports.translateOverlay=translateOverlay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{overlayLayerRenderOrder as e,isOverlayHidden as t,isDrawableOverlay as r,outputSize as n,renderOverlaysToPng as a,isOverlayActiveAt as i,drawOverlay as o,rotatedSize as s,fitRects as l,buildFilterCss as c,DEG2RAD as d}from"./chunk-
|
|
1
|
+
import{overlayLayerRenderOrder as e,isOverlayHidden as t,isDrawableOverlay as r,outputSize as n,renderOverlaysToPng as a,isOverlayActiveAt as i,drawOverlay as o,rotatedSize as s,fitRects as l,buildFilterCss as c,DEG2RAD as d}from"./chunk-EABJNGSW.js";export{drawOverlay,drawOverlays,filterOverlaysAtTime,fitStickerBox,getOverlayRotation,hitTestOverlay,isDrawableOverlay,isOverlayActiveAt,isOverlayHidden,isOverlayLocked,loadOverlayImages,overlayBBox,overlayLayerRenderOrder,overlayTimeRange,renderOverlaysToPng,rotateOverlay,scaleOverlay,translateOverlay}from"./chunk-EABJNGSW.js";import{DEFAULT_FILTERS as h}from"./chunk-7PSQLYXL.js";async function m(i,o,s=[]){const l=i.getExportPlan(),c=new FormData;l.videoSrcOrder.forEach((e,t)=>{const r=o[e];r&&("undefined"!=typeof File&&r instanceof File?c.append(`video_${t}`,r,r.name||`video_${t}.mp4`):"url"in r&&"string"==typeof r.url&&r.url&&(c.append(`videoUrl_${t}`,r.url),r.name&&c.append(`videoName_${t}`,r.name),r.type&&c.append(`videoType_${t}`,r.type),null!=r.size&&c.append(`videoSize_${t}`,String(r.size))))}),l.audioSrcOrder.forEach((e,t)=>{const r=s[e];r&&c.append(`audio_${t}`,r,r.name||`audio_${t}`)});const d=l.state.overlays??[],h=e(d).filter(e=>!t(e)&&r(e)),m=n(l.state.canvas,l.state);(await Promise.all(h.map(e=>a([e],m.w,m.h)))).forEach((e,t)=>{e&&c.append(`textOverlay_${t}`,e,`textOverlay_${t}.png`)});const u=l.state.poster?.useAsVideoCover?l.state.poster.preview||l.state.poster.src:"",f=u?function(e){const t=e.match(/^data:(image\/(?:png|jpe?g));base64,([a-z0-9+/=]+)$/i);if(!t)return null;const r=atob(t[2]),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return new Blob([n],{type:t[1].toLowerCase()})}(u):null;if(f){const e="image/png"===f.type?"video-cover.png":"video-cover.jpg";c.append("videoCover",f,e)}const v=l.state.poster?.preview||l.state.poster?.src?{...l.state,poster:{...l.state.poster,preview:void 0,src:void 0}}:l.state;return c.append("editState",JSON.stringify(v)),c}var u="#000000";function f(e,t,r,n){if(a=r,!Boolean(a.filterPreset)&&!Object.keys(h).some(e=>Math.abs(Number(a[e])||0)>1e-4))return;var a;const i=Math.max(0,Math.round(r.x*n)),o=Math.max(0,Math.round(r.y*n)),s=Math.min(t.width-i,Math.max(1,Math.round(r.w*n))),l=Math.min(t.height-o,Math.max(1,Math.round(r.h*n)));if(s<=0||l<=0)return;const d=document.createElement("canvas");d.width=s,d.height=l;const m=d.getContext("2d");m&&(m.drawImage(t,i,o,s,l,0,0,s,l),e.save(),e.filter=c({...h,...r},r.filterPreset),e.drawImage(d,i,o,s,l),e.restore(),e.filter="none")}function v(r,n,a,s,l,c=1){if(a?.length){r.setTransform(c,0,0,c,0,0);for(const d of e(a))t(d)||("number"!=typeof l||i(d,l))&&("adjust"===d.type?(r.setTransform(1,0,0,1,0,0),f(r,n,d,c),r.setTransform(c,0,0,c,0,0)):o(r,d,s));r.setTransform(1,0,0,1,0,0)}}function p(e,t,r,a,i,o=1,h,m=!0){const f=n(a,i);e.width=Math.max(2,Math.round(f.w*o)),e.height=Math.max(2,Math.round(f.h*o));const p=e.getContext("2d");if(!p)return;if(Boolean(i.__mePreviewVideoHidden)){p.fillStyle="#000000",p.fillRect(0,0,e.width,e.height);const t=Number.isFinite(i.__mePreviewTimelineTime)?Number(i.__mePreviewTimelineTime):void 0;return void(m&&i.overlays?.length&&v(p,e,i.overlays,h,t,o))}const g=s(a.w,a.h,i.rotation),y=i.crop??{x:0,y:0,width:g.w,height:g.h},w=i.scale?.fit??"force",{src:x,dst:b}=l({width:y.width,height:y.height},f,w);"contain"===w&&(p.fillStyle=function(e){if("string"!=typeof e)return u;const t=e.trim(),r=t.match(/^#?([0-9a-fA-F]{3})$/);if(r)return`#${r[1].split("").map(e=>e+e).join("").toLowerCase()}`;const n=t.match(/^#?([0-9a-fA-F]{6})$/);return n?`#${n[1].toLowerCase()}`:u}(i.scale?.backgroundColor),p.fillRect(0,0,e.width,e.height)),p.filter=c(i.filters,i.filterPreset),p.save(),"contain"===w&&(p.beginPath(),p.rect(o*b.x,o*b.y,o*b.width,o*b.height),p.clip()),p.translate(o*b.x,o*b.y),p.scale(o*b.width/x.width,o*b.height/x.height),p.translate(-(y.x+x.x),-(y.y+x.y)),p.translate(g.w/2,g.h/2),p.rotate(i.rotation*d),p.scale(i.flipX?-1:1,i.flipY?-1:1);const O=l({width:r.w,height:r.h},{w:a.w,h:a.h},"cover");p.drawImage(t,O.src.x,O.src.y,O.src.width,O.src.height,-a.w/2,-a.h/2,a.w,a.h),p.restore(),p.filter="none";const M=Number.isFinite(i.__mePreviewTimelineTime)?Number(i.__mePreviewTimelineTime):void 0;m&&i.overlays?.length&&v(p,e,i.overlays,h,M,o)}function g(e,t){return new Promise(r=>{const n=()=>{e.removeEventListener("seeked",n),r()};e.addEventListener("seeked",n),e.currentTime=Math.min(Math.max(0,t),e.duration||t)})}async function y(e,t,r=160){const n=e.duration;if(!n||!isFinite(n)||t<=0)return[];const a=e.videoWidth||16,i=e.videoHeight||9,o=Math.min(r,a),s=Math.max(1,Math.round(o*i/a)),l=document.createElement("canvas");l.width=o,l.height=s;const c=l.getContext("2d");if(!c)return[];const d=[];for(let r=0;r<t;r++)await g(e,n*(r+.5)/t),c.drawImage(e,0,0,o,s),d.push(l.toDataURL("image/jpeg",.6));return d}function w(e,t={}){const r=t.mode??"overlay",n=document.createElement("button");n.type="button",n.className=["me-fullscreen-toggle",t.className].filter(Boolean).join(" "),n.dataset.meFullscreenToggle="true",n.dataset.mode=r,n.title="全屏 / 退出全屏",n.style.cssText=["overlay"===r?"position:absolute;left:8px;bottom:8px;z-index:30;":"position:static;","width:32px;height:32px;padding:0;","display:inline-flex;align-items:center;justify-content:center;","border:1px solid var(--me-border,#26262b);border-radius:6px;","background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);","cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;"].join(""),e.classList.add("me-fullscreen-host");const a=()=>{const t=document.fullscreenElement===e;n.textContent=t?"×":"⛶",n.setAttribute("aria-label",t?"退出全屏":"全屏"),e.classList.toggle("me-is-fullscreen",t),e.dataset.meFullscreen=t?"true":"false"};a();const i=()=>a(),o=()=>{const t=document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.();t?.catch?.(()=>{})};return n.addEventListener("click",o),document.addEventListener("fullscreenchange",i),{button:n,dispose:()=>{document.removeEventListener("fullscreenchange",i),n.removeEventListener("click",o),n.remove(),e.classList.remove("me-fullscreen-host","me-is-fullscreen"),delete e.dataset.meFullscreen}}}export{m as buildVideoExportFormData,w as createFullscreenToggle,v as drawLayeredOverlays,p as drawVideoFrame,y as generateThumbnails};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Math.PI/180;function n(n,r,a){const i=e(a);if(0===i||180===i)return{w:n,h:r};if(90===i||270===i)return{w:r,h:n};const o=i*t;return{w:Math.round(Math.abs(n*Math.cos(o))+Math.abs(r*Math.sin(o))),h:Math.round(Math.abs(n*Math.sin(o))+Math.abs(r*Math.cos(o)))}}function e(t){return(t%360+360)%360}function r(t){const n=Math.round(t);return n-n%2}function a(t,n,e=40){const r=Math.min(Math.max(e,t.width),n.w),a=Math.min(Math.max(e,t.height),n.h),i=Math.min(Math.max(0,t.x),n.w-r),o=Math.min(Math.max(0,t.y),n.h-a);return{x:Math.round(i),y:Math.round(o),width:Math.round(r),height:Math.round(a)}}function i(t,n){let e=t.w,r=e/n;return r>t.h&&(r=t.h,e=r*n),{x:Math.round((t.w-e)/2),y:Math.round((t.h-r)/2),width:Math.round(e),height:Math.round(r)}}function o(t,n,e){const r={x:0,y:0,width:t.width,height:t.height},a={x:0,y:0,width:n.w,height:n.h};return"cover"===e?{src:i({w:t.width,h:t.height},n.w/n.h),dst:a}:"contain"===e?{src:r,dst:i({w:n.w,h:n.h},t.width/t.height)}:{src:r,dst:a}}function s(t,e){if(e.scale)return{w:r(e.scale.width),h:r(e.scale.height)};if(e.crop)return{w:r(e.crop.width),h:r(e.crop.height)};const a=n(t.w,t.h,e.rotation);return{w:r(a.w),h:r(a.h)}}var h=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function c(t){return t?h.find(n=>n.id===t):void 0}function u(t,n){const e=c(n)?.css??"",r=t.temperature??0,a=t.tint??0,i=t.vibrance??0,o=t.gamma??0,s=t.sharpen??0,h=t.clarity??0;return[`brightness(${1+t.brightness})`,`contrast(${1+t.contrast})`,`saturate(${1+t.saturation})`,e,i?`saturate(${(1+.65*i).toFixed(3)})`:"",r>0?`sepia(${Math.min(.36,.28*r).toFixed(3)})`:"",r?`hue-rotate(${(14*-r).toFixed(2)}deg)`:"",a?`hue-rotate(${(10*a).toFixed(2)}deg)`:"",o?`brightness(${(1+.08*o).toFixed(3)})`:"",h||s?`contrast(${(1+.16*h+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}var l=Math.PI/180,d='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';function x(t){return"adjust"!==t.type}function f(t){return Boolean(t.hidden)}function m(t){return Boolean(t.locked)}function M(t,n){const e=Number(t.timelineTrack);return Number.isFinite(e)?Math.max(0,Math.round(e)):n}function w(t){return t.map((t,n)=>({overlay:t,index:n,track:M(t,n)})).sort((t,n)=>n.track-t.track||t.index-n.index).map(t=>t.overlay)}function p(t,n,e){t.strokeStyle=n,t.lineWidth=e,t.lineCap="round",t.lineJoin="round"}function y(t){if(!Number.isFinite(t))return 0;let n=t%360;return n>180&&(n-=360),n<-180&&(n+=360),Math.abs(n)<.001?0:n}function g(t){return y(t.rotation??0)}function b(t){switch(t.type){case"pen":{let n=1/0,e=1/0,r=-1/0,a=-1/0;for(let i=0;i<t.points.length;i+=2)n=Math.min(n,t.points[i]),r=Math.max(r,t.points[i]),e=Math.min(e,t.points[i+1]),a=Math.max(a,t.points[i+1]);return{x:n,y:e,w:r-n,h:a-e}}case"line":case"arrow":return{x:Math.min(t.x1,t.x2),y:Math.min(t.y1,t.y2),w:Math.abs(t.x2-t.x1),h:Math.abs(t.y2-t.y1)};case"rect":case"ellipse":case"sticker":case"adjust":return{x:t.x,y:t.y,w:t.w,h:t.h};case"text":return $(t)}}function k(t){return String(t.text||"").split(/\r?\n/)}function v(t){return t.fontSize*(t.lineHeight??1.15)}function S(t){return t.paddingX??0}function F(t){return t.paddingY??0}function P(t){const n=Math.max(.6*t.fontSize,...k(t).map(n=>Math.max(1,n.length)*t.fontSize*.6));return Math.max(1,t.width??n+2*S(t))}function $(t){const n=k(t);return{x:t.x,y:t.y,w:P(t),h:Math.max(t.fontSize,n.length*v(t))+2*F(t)}}function T(t){const n=b(t);return{x:n.x+n.w/2,y:n.y+n.h/2}}function z(t,n,e,r,a){return{x:e+(t-e)*a,y:r+(n-r)*a}}function j(t){const n=t,e=Number.isFinite(n.startAt)?Math.max(0,Number(n.startAt)):null,r=Number.isFinite(n.endAt)?Math.max(e??0,Number(n.endAt)):null;if(null==e&&null==r)return null;const a=e??0;return{start:a,end:Math.max(a,r??a)}}function I(t,n){const e=j(t);return!e||Number.isFinite(n)&&n>=e.start&&n<=e.end}function N(t,n){if(!t?.length)return[];const e=t.filter(t=>!f(t));return Number.isFinite(n)?e.filter(t=>I(t,n)):e}function W(t,n,e){if(f(n))return;if(!x(n))return;const r=g(n);if(r){const a=T(n);return t.save(),t.translate(a.x,a.y),t.rotate(r*l),t.translate(-a.x,-a.y),C(t,n,e),void t.restore()}C(t,n,e)}function C(t,n,e){switch(n.type){case"pen":p(t,n.color,n.width),t.beginPath(),t.moveTo(n.points[0],n.points[1]);for(let e=2;e<n.points.length;e+=2)t.lineTo(n.points[e],n.points[e+1]);t.stroke();break;case"line":case"arrow":p(t,n.color,n.width),t.beginPath(),t.moveTo(n.x1,n.y1),t.lineTo(n.x2,n.y2),t.stroke(),"arrow"===n.type&&function(t,n,e,r,a,i){const o=Math.atan2(a-e,r-n),s=Math.max(12,3.5*i);t.beginPath(),t.moveTo(r,a),t.lineTo(r-s*Math.cos(o-Math.PI/7),a-s*Math.sin(o-Math.PI/7)),t.moveTo(r,a),t.lineTo(r-s*Math.cos(o+Math.PI/7),a-s*Math.sin(o+Math.PI/7)),t.stroke()}(t,n.x1,n.y1,n.x2,n.y2,n.width);break;case"rect":p(t,n.color,n.width),t.strokeRect(n.x,n.y,n.w,n.h);break;case"ellipse":p(t,n.color,n.width),t.beginPath(),t.ellipse(n.x+n.w/2,n.y+n.h/2,Math.abs(n.w/2),Math.abs(n.h/2),0,0,2*Math.PI),t.stroke();break;case"text":{const e=$(n),r=k(n),a=Number.isFinite(n.opacity)?Math.min(1,Math.max(0,(n.opacity??100)/100)):1;t.save(),t.globalAlpha*=a,n.backgroundColor&&"transparent"!==n.backgroundColor&&(t.fillStyle=n.backgroundColor,t.fillRect(n.x,n.y,e.w,e.h)),t.fillStyle=n.color,t.font=function(t){const n=t.fontWeight??"700",e=t.italic?"italic ":"",r=t.fontFamily?`"${t.fontFamily}", ${d}`:d;return`${e}${n} ${t.fontSize}px ${r}`}(n),t.textBaseline="top",t.strokeStyle=n.strokeColor??"rgba(0,0,0,0.45)",t.lineWidth=n.borderWidth??Math.max(2,n.fontSize/16),t.lineJoin="round",r.forEach((r,a)=>{const i=function(t,n,e,r){const a=S(n),i=n.align??"left",o=t.measureText(e||" ").width;return"center"===i?n.x+r/2-o/2:"right"===i?n.x+r-a-o:n.x+a}(t,n,r,e.w),o=n.y+F(n)+a*v(n),s=t.measureText(r||" ").width;if(t.lineWidth>0&&t.strokeText(r,i,o),t.fillText(r,i,o),(n.underline||n.strikethrough)&&s>0){const e=Math.max(1,n.fontSize/18);t.fillStyle=n.color,n.underline&&t.fillRect(i,o+.92*n.fontSize,s,e),n.strikethrough&&t.fillRect(i,o+.52*n.fontSize,s,e)}}),t.restore();break}case"sticker":if(n.emoji)t.save(),t.font=.86*Math.min(n.w,n.h)+'px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif',t.textAlign="center",t.textBaseline="middle",t.fillText(n.emoji,n.x+n.w/2,n.y+n.h/2),t.restore();else if(n.src){const r=e?.get(n.src);r&&t.drawImage(r,n.x,n.y,n.w,n.h)}}}function A(t,n,e,r){const a="number"==typeof r?N(n,r):n;for(const n of a)!f(n)&&x(n)&&W(t,n,e)}async function B(t){const n=new Map,e=[...new Set(t.filter(t=>"sticker"===t.type&&t.src).map(t=>t.src))];return await Promise.all(e.map(t=>new Promise(e=>{const r=new Image;r.onload=()=>{n.set(t,r),e()},r.onerror=()=>e(),r.src=t}))),n}async function Y(t,n,e){const r=t?.filter(t=>!f(t)&&x(t))??[];if(!r.length)return null;const a=document.createElement("canvas");a.width=n,a.height=e;const i=a.getContext("2d");return i?(A(i,r,await B(r)),new Promise(t=>a.toBlob(n=>t(n),"image/png"))):null}function X(t,n,e,r=12){for(let a=t.length-1;a>=0;a--){const i=t[a];if(!f(i)&&R(i,n,e,r))return a}return-1}function E(t,n,e,r,a,i,o){const s=a-e,h=i-r,c=s*s+h*h||1,u=Math.max(0,Math.min(1,((t-e)*s+(n-r)*h)/c));return(t-(e+u*s))**2+(n-(r+u*h))**2<=o*o}function R(t,n,e,r){const a=g(t);if(a){const i=T(t),o=function(t,n,e,r,a){const i=a*l,o=Math.cos(i),s=Math.sin(i),h=t-e,c=n-r;return{x:e+h*o-c*s,y:r+h*s+c*o}}(n,e,i.x,i.y,-a);return H(t,o.x,o.y,r)}return H(t,n,e,r)}function H(t,n,e,r){switch(t.type){case"pen":for(let a=0;a+3<t.points.length;a+=2)if(E(n,e,t.points[a],t.points[a+1],t.points[a+2],t.points[a+3],r+t.width/2))return!0;return!1;case"line":case"arrow":return E(n,e,t.x1,t.y1,t.x2,t.y2,r+t.width/2);case"rect":case"ellipse":return n>=t.x-r&&n<=t.x+t.w+r&&e>=t.y-r&&e<=t.y+t.h+r;case"text":{const a=$(t);return n>=a.x-r&&n<=a.x+a.w+r&&e>=a.y-r&&e<=a.y+a.h+r}case"sticker":return function(t,n,e,r,a){return Math.abs(t-e)<=a&&Math.abs(n-r)<=a}(n,e,t.x+t.w/2,t.y+t.h/2,Math.max(t.w,t.h)/2+r);case"adjust":return!1}}function J(t,n,e){const r=Math.max(8,e);if(!(t>0&&n>0))return{w:r,h:r};const a=r/Math.max(t,n);return{w:Math.max(8,Math.round(t*a)),h:Math.max(8,Math.round(n*a))}}function q(t,n){const e=Math.max(.05,n),r=T(t);switch(t.type){case"pen":return{...t,points:t.points.map((t,n)=>n%2==0?r.x+(t-r.x)*e:r.y+(t-r.y)*e)};case"line":case"arrow":{const n=z(t.x1,t.y1,r.x,r.y,e),a=z(t.x2,t.y2,r.x,r.y,e);return{...t,x1:n.x,y1:n.y,x2:a.x,y2:a.y}}case"rect":case"ellipse":case"sticker":case"adjust":return{...t,w:Math.max(8,t.w*e),h:Math.max(8,t.h*e)};case"text":return{...t,fontSize:Math.min(512,Math.max(8,t.fontSize*e)),width:t.width?Math.max(16,t.width*e):t.width,paddingX:t.paddingX?Math.max(0,t.paddingX*e):t.paddingX,paddingY:t.paddingY?Math.max(0,t.paddingY*e):t.paddingY,borderWidth:t.borderWidth?Math.max(0,t.borderWidth*e):t.borderWidth};default:return t}}function U(t,n){return{...t,rotation:y(n)}}function D(t,n,e){switch(t.type){case"pen":{const r=t.points.map((t,r)=>r%2==0?t+n:t+e);return{...t,points:r}}case"line":case"arrow":return{...t,x1:t.x1+n,y1:t.y1+e,x2:t.x2+n,y2:t.y2+e};case"rect":case"ellipse":case"sticker":case"adjust":case"text":return{...t,x:t.x+n,y:t.y+e}}}export{t as DEG2RAD,h as FILTER_PRESETS,u as buildFilterCss,i as centeredMaxRect,a as clampRect,W as drawOverlay,A as drawOverlays,r as evenize,N as filterOverlaysAtTime,c as findFilterPreset,o as fitRects,J as fitStickerBox,g as getOverlayRotation,X as hitTestOverlay,x as isDrawableOverlay,I as isOverlayActiveAt,f as isOverlayHidden,m as isOverlayLocked,B as loadOverlayImages,e as normalizeDeg,s as outputSize,b as overlayBBox,w as overlayLayerRenderOrder,j as overlayTimeRange,Y as renderOverlaysToPng,U as rotateOverlay,n as rotatedSize,q as scaleOverlay,D as translateOverlay};
|
|
1
|
+
var t=Math.PI/180;function n(n,r,a){const i=e(a);if(0===i||180===i)return{w:n,h:r};if(90===i||270===i)return{w:r,h:n};const o=i*t;return{w:Math.round(Math.abs(n*Math.cos(o))+Math.abs(r*Math.sin(o))),h:Math.round(Math.abs(n*Math.sin(o))+Math.abs(r*Math.cos(o)))}}function e(t){return(t%360+360)%360}function r(t){const n=Math.round(t);return n-n%2}function a(t,n,e=40){const r=Math.min(Math.max(e,t.width),n.w),a=Math.min(Math.max(e,t.height),n.h),i=Math.min(Math.max(0,t.x),n.w-r),o=Math.min(Math.max(0,t.y),n.h-a);return{x:Math.round(i),y:Math.round(o),width:Math.round(r),height:Math.round(a)}}function i(t,n){let e=t.w,r=e/n;return r>t.h&&(r=t.h,e=r*n),{x:Math.round((t.w-e)/2),y:Math.round((t.h-r)/2),width:Math.round(e),height:Math.round(r)}}function o(t,n,e){const r={x:0,y:0,width:t.width,height:t.height},a={x:0,y:0,width:n.w,height:n.h};return"cover"===e?{src:i({w:t.width,h:t.height},n.w/n.h),dst:a}:"contain"===e?{src:r,dst:i({w:n.w,h:n.h},t.width/t.height)}:{src:r,dst:a}}function s(t,e){if(e.scale)return{w:r(e.scale.width),h:r(e.scale.height)};if(e.crop)return{w:r(e.crop.width),h:r(e.crop.height)};const a=n(t.w,t.h,e.rotation);return{w:r(a.w),h:r(a.h)}}var h=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function c(t){return t?h.find(n=>n.id===t):void 0}function u(t,n){const e=c(n)?.css??"",r=t.temperature??0,a=t.tint??0,i=t.vibrance??0,o=t.gamma??0,s=t.sharpen??0,h=t.clarity??0;return[`brightness(${1+t.brightness})`,`contrast(${1+t.contrast})`,`saturate(${1+t.saturation})`,e,i?`saturate(${(1+.65*i).toFixed(3)})`:"",r>0?`sepia(${Math.min(.36,.28*r).toFixed(3)})`:"",r?`hue-rotate(${(14*-r).toFixed(2)}deg)`:"",a?`hue-rotate(${(10*a).toFixed(2)}deg)`:"",o?`brightness(${(1+.08*o).toFixed(3)})`:"",h||s?`contrast(${(1+.16*h+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}var l=Math.PI/180,d='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';function x(t){return"adjust"!==t.type}function f(t){return Boolean(t.hidden)}function m(t){return Boolean(t.locked)}function M(t,n){const e=Number(t.timelineTrack);return Number.isFinite(e)?Math.max(0,Math.round(e)):n}function w(t){return t.map((t,n)=>({overlay:t,index:n,track:M(t,n)})).sort((t,n)=>n.track-t.track||t.index-n.index).map(t=>t.overlay)}function p(t,n,e){t.strokeStyle=n,t.lineWidth=e,t.lineCap="round",t.lineJoin="round"}function y(t){if(!Number.isFinite(t))return 0;let n=t%360;return n>180&&(n-=360),n<-180&&(n+=360),Math.abs(n)<.001?0:n}function g(t){return y(t.rotation??0)}function b(t){switch(t.type){case"pen":{let n=1/0,e=1/0,r=-1/0,a=-1/0;for(let i=0;i<t.points.length;i+=2)n=Math.min(n,t.points[i]),r=Math.max(r,t.points[i]),e=Math.min(e,t.points[i+1]),a=Math.max(a,t.points[i+1]);return{x:n,y:e,w:r-n,h:a-e}}case"line":case"arrow":return{x:Math.min(t.x1,t.x2),y:Math.min(t.y1,t.y2),w:Math.abs(t.x2-t.x1),h:Math.abs(t.y2-t.y1)};case"rect":case"ellipse":case"sticker":case"adjust":return{x:t.x,y:t.y,w:t.w,h:t.h};case"text":return $(t)}}function k(t){return String(t.text||"").split(/\r?\n/)}function v(t){return t.fontSize*(t.lineHeight??1.15)}function S(t){return t.paddingX??0}function F(t){return t.paddingY??0}function P(t){const n=Math.max(.6*t.fontSize,...k(t).map(n=>Math.max(1,n.length)*t.fontSize*.6));return Math.max(1,t.width??n+2*S(t))}function $(t){const n=k(t);return{x:t.x,y:t.y,w:P(t),h:Math.max(t.fontSize,n.length*v(t))+2*F(t)}}function T(t){const n=b(t);return{x:n.x+n.w/2,y:n.y+n.h/2}}function z(t,n,e,r,a){return{x:e+(t-e)*a,y:r+(n-r)*a}}function j(t){const n=t,e=Number.isFinite(n.startAt)?Math.max(0,Number(n.startAt)):null,r=Number.isFinite(n.endAt)?Math.max(e??0,Number(n.endAt)):null;if(null==e&&null==r)return null;const a=e??0;return{start:a,end:Math.max(a,r??a)}}function I(t,n){const e=j(t);return!e||Number.isFinite(n)&&n>=e.start&&n<=e.end}function N(t,n){if(!t?.length)return[];const e=t.filter(t=>!f(t));return Number.isFinite(n)?e.filter(t=>I(t,n)):e}function W(t,n,e){if(f(n))return;if(!x(n))return;const r=g(n);if(r){const a=T(n);return t.save(),t.translate(a.x,a.y),t.rotate(r*l),t.translate(-a.x,-a.y),C(t,n,e),void t.restore()}C(t,n,e)}function C(t,n,e){switch(n.type){case"pen":p(t,n.color,n.width),t.beginPath(),t.moveTo(n.points[0],n.points[1]);for(let e=2;e<n.points.length;e+=2)t.lineTo(n.points[e],n.points[e+1]);t.stroke();break;case"line":case"arrow":p(t,n.color,n.width),t.beginPath(),t.moveTo(n.x1,n.y1),t.lineTo(n.x2,n.y2),t.stroke(),"arrow"===n.type&&function(t,n,e,r,a,i){const o=Math.atan2(a-e,r-n),s=Math.max(12,3.5*i);t.beginPath(),t.moveTo(r,a),t.lineTo(r-s*Math.cos(o-Math.PI/7),a-s*Math.sin(o-Math.PI/7)),t.moveTo(r,a),t.lineTo(r-s*Math.cos(o+Math.PI/7),a-s*Math.sin(o+Math.PI/7)),t.stroke()}(t,n.x1,n.y1,n.x2,n.y2,n.width);break;case"rect":p(t,n.color,n.width),t.strokeRect(n.x,n.y,n.w,n.h);break;case"ellipse":p(t,n.color,n.width),t.beginPath(),t.ellipse(n.x+n.w/2,n.y+n.h/2,Math.abs(n.w/2),Math.abs(n.h/2),0,0,2*Math.PI),t.stroke();break;case"text":{const e=$(n),r=k(n),a=Number.isFinite(n.opacity)?Math.min(1,Math.max(0,(n.opacity??100)/100)):1;t.save(),t.globalAlpha*=a,n.backgroundColor&&"transparent"!==n.backgroundColor&&(t.fillStyle=n.backgroundColor,t.fillRect(n.x,n.y,e.w,e.h)),t.fillStyle=n.color,t.font=function(t){const n=t.fontWeight??"700",e=t.italic?"italic ":"",r=t.fontFamily?`"${t.fontFamily}", ${d}`:d;return`${e}${n} ${t.fontSize}px ${r}`}(n),t.textBaseline="top",t.strokeStyle=n.strokeColor??"rgba(0,0,0,0.45)",t.lineWidth=n.borderWidth??Math.max(2,n.fontSize/16),t.lineJoin="round",r.forEach((r,a)=>{const i=function(t,n,e,r){const a=S(n),i=n.align??"left",o=t.measureText(e||" ").width;return"center"===i?n.x+r/2-o/2:"right"===i?n.x+r-a-o:n.x+a}(t,n,r,e.w),o=n.y+F(n)+a*v(n),s=t.measureText(r||" ").width;if(t.lineWidth>0&&t.strokeText(r,i,o),t.fillText(r,i,o),(n.underline||n.strikethrough)&&s>0){const e=Math.max(1,n.fontSize/18);t.fillStyle=n.color,n.underline&&t.fillRect(i,o+.92*n.fontSize,s,e),n.strikethrough&&t.fillRect(i,o+.52*n.fontSize,s,e)}}),t.restore();break}case"sticker":if(n.emoji)t.save(),t.font=.86*Math.min(n.w,n.h)+'px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif',t.textAlign="center",t.textBaseline="middle",t.fillText(n.emoji,n.x+n.w/2,n.y+n.h/2),t.restore();else if(n.src){const r=e?.get(n.src);r&&t.drawImage(r,n.x,n.y,n.w,n.h)}}}function A(t,n,e,r){const a="number"==typeof r?N(n,r):n;for(const n of a)!f(n)&&x(n)&&W(t,n,e)}async function B(t){const n=new Map,e=[...new Set(t.filter(t=>"sticker"===t.type&&t.src).map(t=>t.src))];return await Promise.all(e.map(t=>new Promise(e=>{const r=new Image;/^(?:https?:)?\/\//i.test(t)&&(r.crossOrigin="anonymous"),r.onload=()=>{n.set(t,r),e()},r.onerror=()=>e(),r.src=t}))),n}async function Y(t,n,e){const r=t?.filter(t=>!f(t)&&x(t))??[];if(!r.length)return null;const a=document.createElement("canvas");a.width=n,a.height=e;const i=a.getContext("2d");return i?(A(i,r,await B(r)),new Promise(t=>a.toBlob(n=>t(n),"image/png"))):null}function X(t,n,e,r=12){for(let a=t.length-1;a>=0;a--){const i=t[a];if(!f(i)&&R(i,n,e,r))return a}return-1}function E(t,n,e,r,a,i,o){const s=a-e,h=i-r,c=s*s+h*h||1,u=Math.max(0,Math.min(1,((t-e)*s+(n-r)*h)/c));return(t-(e+u*s))**2+(n-(r+u*h))**2<=o*o}function R(t,n,e,r){const a=g(t);if(a){const i=T(t),o=function(t,n,e,r,a){const i=a*l,o=Math.cos(i),s=Math.sin(i),h=t-e,c=n-r;return{x:e+h*o-c*s,y:r+h*s+c*o}}(n,e,i.x,i.y,-a);return H(t,o.x,o.y,r)}return H(t,n,e,r)}function H(t,n,e,r){switch(t.type){case"pen":for(let a=0;a+3<t.points.length;a+=2)if(E(n,e,t.points[a],t.points[a+1],t.points[a+2],t.points[a+3],r+t.width/2))return!0;return!1;case"line":case"arrow":return E(n,e,t.x1,t.y1,t.x2,t.y2,r+t.width/2);case"rect":case"ellipse":return n>=t.x-r&&n<=t.x+t.w+r&&e>=t.y-r&&e<=t.y+t.h+r;case"text":{const a=$(t);return n>=a.x-r&&n<=a.x+a.w+r&&e>=a.y-r&&e<=a.y+a.h+r}case"sticker":return function(t,n,e,r,a){return Math.abs(t-e)<=a&&Math.abs(n-r)<=a}(n,e,t.x+t.w/2,t.y+t.h/2,Math.max(t.w,t.h)/2+r);case"adjust":return!1}}function J(t,n,e){const r=Math.max(8,e);if(!(t>0&&n>0))return{w:r,h:r};const a=r/Math.max(t,n);return{w:Math.max(8,Math.round(t*a)),h:Math.max(8,Math.round(n*a))}}function q(t,n){const e=Math.max(.05,n),r=T(t);switch(t.type){case"pen":return{...t,points:t.points.map((t,n)=>n%2==0?r.x+(t-r.x)*e:r.y+(t-r.y)*e)};case"line":case"arrow":{const n=z(t.x1,t.y1,r.x,r.y,e),a=z(t.x2,t.y2,r.x,r.y,e);return{...t,x1:n.x,y1:n.y,x2:a.x,y2:a.y}}case"rect":case"ellipse":case"sticker":case"adjust":return{...t,w:Math.max(8,t.w*e),h:Math.max(8,t.h*e)};case"text":return{...t,fontSize:Math.min(512,Math.max(8,t.fontSize*e)),width:t.width?Math.max(16,t.width*e):t.width,paddingX:t.paddingX?Math.max(0,t.paddingX*e):t.paddingX,paddingY:t.paddingY?Math.max(0,t.paddingY*e):t.paddingY,borderWidth:t.borderWidth?Math.max(0,t.borderWidth*e):t.borderWidth};default:return t}}function O(t,n){return{...t,rotation:y(n)}}function U(t,n,e){switch(t.type){case"pen":{const r=t.points.map((t,r)=>r%2==0?t+n:t+e);return{...t,points:r}}case"line":case"arrow":return{...t,x1:t.x1+n,y1:t.y1+e,x2:t.x2+n,y2:t.y2+e};case"rect":case"ellipse":case"sticker":case"adjust":case"text":return{...t,x:t.x+n,y:t.y+e}}}export{t as DEG2RAD,h as FILTER_PRESETS,u as buildFilterCss,i as centeredMaxRect,a as clampRect,W as drawOverlay,A as drawOverlays,r as evenize,N as filterOverlaysAtTime,c as findFilterPreset,o as fitRects,J as fitStickerBox,g as getOverlayRotation,X as hitTestOverlay,x as isDrawableOverlay,I as isOverlayActiveAt,f as isOverlayHidden,m as isOverlayLocked,B as loadOverlayImages,e as normalizeDeg,s as outputSize,b as overlayBBox,w as overlayLayerRenderOrder,j as overlayTimeRange,Y as renderOverlaysToPng,O as rotateOverlay,n as rotatedSize,q as scaleOverlay,U as translateOverlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.posterCors":"封面渲染失败:视频或贴纸服务器未允许跨域读取(CORS)","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},o={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},t=e=>{let t=e;for(const[e,a]of Object.entries(o).sort((e,o)=>o[0].length-e[0].length))t=t.replaceAll(e,a);return t},a={zh:e,en:{"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","tune.temperature":"Temperature","tune.tint":"Tint","tune.vibrance":"Vibrance","tune.highlights":"Highlights","tune.shadows":"Shadows","tune.whites":"Whites","tune.blacks":"Blacks","tune.lightSense":"Light","tune.sharpen":"Sharpen","tune.clarity":"Clarity","tune.grain":"Grain","tune.fade":"Fade","tune.vignette":"Vignette","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.fontSize":"Size","overlay.font":"Font","overlay.align":"Align","overlay.background":"Background","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add → drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Wide 1.91:1","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting…","act.poster":"🖼 Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"← Change image","act.changeVideo":"← Change file","crop.rotateLeft":"↺ Rotate left","crop.flipX":"⇋ Flip horizontal","crop.flipY":"⇵ Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.posterCors":"Failed to render cover: the video or sticker server does not allow cross-origin access (CORS)","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting…","msg.exportPrepare":"Preparing media…","msg.exportUpload":"Uploading media…","msg.exportEncode":"Encoding video…","msg.exportDownload":"Receiving result…","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done ✓","msg.loading":"Loading media…","msg.exported":"Exported: ","msg.saving":"Saving…","msg.saved":"Saved to drive ✓","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"↔ Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"· center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"♪ Audio track (+ on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"⇧ F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video — crop · filters · text · export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot · videos: trim/mute/cover"},es:{"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporción","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturación","tune.gamma":"Gamma","tune.temperature":"Temperatura","tune.tint":"Tinte","tune.vibrance":"Intensidad","tune.highlights":"Altas luces","tune.shadows":"Sombras","tune.whites":"Blancos","tune.blacks":"Negros","tune.lightSense":"Luz","tune.sharpen":"Enfoque","tune.clarity":"Claridad","tune.grain":"Grano","tune.fade":"Desvanecer","tune.vignette":"Viñeta","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"Línea","overlay.arrow":"Flecha","overlay.rect":"Rectángulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.fontSize":"Tamaño","overlay.font":"Fuente","overlay.align":"Alinear","overlay.background":"Fondo","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para añadirlo → arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"Cálido","filter.cool":"Frío","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Panorámico 1.91:1","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar música","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando…","act.poster":"🖼 Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"← Cambiar imagen","act.changeVideo":"← Cambiar archivo","crop.rotateLeft":"↺ Girar a la izquierda","crop.flipX":"⇋ Voltear horizontal","crop.flipY":"⇵ Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con música; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir línea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar línea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"Añadir clip de vídeo","tip.addAudio":"Añadir música (archivo de audio o vídeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar después)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporción","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de vídeo","err.maxVideo":"Máximo {max} vídeos","err.videoLoad":"No se pudo cargar el vídeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un vídeo con sonido (se extrae automáticamente)","err.maxAudio":"Máximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.posterCors":"No se pudo renderizar la portada: el servidor de vídeo o stickers no permite el acceso entre orígenes (CORS)","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o vídeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando…","msg.exportPrepare":"Preparando medios…","msg.exportUpload":"Subiendo medios…","msg.exportEncode":"Codificando video…","msg.exportDownload":"Recibiendo resultado…","msg.exportingHint":"Espera un momento. El resultado se devolverá automáticamente al finalizar.","msg.done":"Listo ✓","msg.loading":"Cargando medios…","msg.exported":"Exportado: ","msg.saving":"Guardando…","msg.saved":"Guardado en disco ✓","lbl.ratioSection":"Proporción de imagen (recorte, sin deformar)","lbl.dragToReposition":"↔ Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tamaño de exportación (px; recorte cover centrado si la proporción difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tamaño","lbl.noScale":"(sin escala)","lbl.coverNote":"· recorte centrado (cover) cuando la proporción difiere, sin deformar","lbl.audioTrackHint":"♪ Pista de audio (+ a la derecha para añadir música, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportación usa el valor definido)","lbl.music":"Música","kbd.fit":"⇧ F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / vídeo — recorta · filtros · texto · exporta","panel.pick":"Haz clic para elegir una imagen o vídeo","panel.pickHint":"Imágenes con Filerobot · vídeos: cortar/silenciar/portada"},"zh-Hant":Object.fromEntries(Object.entries(e).map(([e,o])=>[e,t(o)]))};function r(e,o,t){let r=a[e]?.[o]??a.zh[o]??o;if(t)for(const[e,o]of Object.entries(t))r=r.replaceAll(`{${e}}`,String(o));return r}var i=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],l={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function n(e){const[o,t]=e.split(":").map(Number);return o&&t?o/t:1}function p(e){const o=new Set,t=[];for(const a of e)a&&!o.has(a)&&(o.add(a),t.push({ratio:a,value:n(a),label:l[a]??a}));return t}var s=p(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),c=p(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]);function d(e=i){const o=new Set,t=[];for(const a of e){if(!a.videoRatio)continue;const e=`${a.platform}:${a.postType}:${a.videoRatio}`;if(o.has(e))continue;o.add(e);const r=a.label.split(" ").slice(0,-1).join(" ")||a.label;t.push({platform:a.platform,postType:a.postType,label:`${r} ${a.videoRatio}`,ratio:a.videoRatio,value:n(a.videoRatio)})}return t}var m=d();function u(e=i){const o=new Map;for(const t of e){const e=o.get(t.platform);(!e||"post"!==e.postType&&"post"===t.postType)&&o.set(t.platform,t)}return Array.from(o.values()).map(e=>{const[o,t]=e.imageSize.split("x").map(Number),a=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${a} ${e.ratio}`,ratio:e.ratio,value:n(e.ratio),w:o,h:t}})}var v=u();function g(e,o){return e>=1?{w:2*Math.round(o*e/2),h:o}:{w:o,h:2*Math.round(o/e/2)}}function f(e=i){const o=new Set,t=[];for(const a of e){if(!a.videoRatio||!a.videoResolution)continue;const e="1080p"===a.videoResolution?1080:720,{w:r,h:i}=g(n(a.videoRatio),e),l=`${r}x${i}`;o.has(l)||(o.add(l),t.push({label:`${a.shortLabel} ${r}×${i}`,w:r,h:i}))}return t}var h=f();function b(e,o){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const t=o.adjustments?.rotation??0;return t?{rotation:-t}:{}}export{i as DEFAULT_PLATFORM_TARGETS,a as EDITOR_MESSAGES,v as IMAGE_PLATFORM_PRESETS,s as IMAGE_RATIO_PRESETS,m as VIDEO_PLATFORM_RATIO_PRESETS,c as VIDEO_RATIO_PRESETS,h as VIDEO_SIZE_PRESETS,u as buildImagePlatformPresets,d as buildVideoPlatformRatioPresets,f as buildVideoSizePresets,b as compensateAnnotationRotation,n as parseRatio,r as tEditor,t as toHant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var zh={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},ZH_HANT_MAP={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},toHant=e=>{let o=e;for(const[e,a]of Object.entries(ZH_HANT_MAP).sort((e,o)=>o[0].length-e[0].length))o=o.replaceAll(e,a);return o};Object.fromEntries(Object.entries(zh).map(([e,o])=>[e,toHant(o)]));var DEFAULT_PLATFORM_TARGETS=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],RATIO_LABEL={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function parseRatio(e){const[o,a]=e.split(":").map(Number);return o&&a?o/a:1}function dedupePresets(e){const o=new Set,a=[];for(const t of e)t&&!o.has(t)&&(o.add(t),a.push({ratio:t,value:parseRatio(t),label:RATIO_LABEL[t]??t}));return a}function buildVideoPlatformRatioPresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Set,a=[];for(const t of e){if(!t.videoRatio)continue;const e=`${t.platform}:${t.postType}:${t.videoRatio}`;if(o.has(e))continue;o.add(e);const i=t.label.split(" ").slice(0,-1).join(" ")||t.label;a.push({platform:t.platform,postType:t.postType,label:`${i} ${t.videoRatio}`,ratio:t.videoRatio,value:parseRatio(t.videoRatio)})}return a}function buildImagePlatformPresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Map;for(const a of e){const e=o.get(a.platform);(!e||"post"!==e.postType&&"post"===a.postType)&&o.set(a.platform,a)}return Array.from(o.values()).map(e=>{const[o,a]=e.imageSize.split("x").map(Number),t=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${t} ${e.ratio}`,ratio:e.ratio,value:parseRatio(e.ratio),w:o,h:a}})}dedupePresets(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),dedupePresets(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]),buildVideoPlatformRatioPresets();var IMAGE_PLATFORM_PRESETS=buildImagePlatformPresets();function sizeOf(e,o){return e>=1?{w:2*Math.round(o*e/2),h:o}:{w:o,h:2*Math.round(o/e/2)}}function buildVideoSizePresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Set,a=[];for(const t of e){if(!t.videoRatio||!t.videoResolution)continue;const e="1080p"===t.videoResolution?1080:720,{w:i,h:r}=sizeOf(parseRatio(t.videoRatio),e),l=`${i}x${r}`;o.has(l)||(o.add(l),a.push({label:`${t.shortLabel} ${i}×${r}`,w:i,h:r}))}return a}function compensateAnnotationRotation(e,o){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const a=o.adjustments?.rotation??0;return a?{rotation:-a}:{}}buildVideoSizePresets();var IMAGE_EDITOR_DARK_PALETTE={"txt-primary":"#f1f1f4","txt-secondary":"#b6bac4","txt-secondary-invert":"#14141a","txt-placeholder":"#7c818c","txt-warning":"#fbbf24","txt-error":"#f87171","txt-info":"#7cc4f5","icon-primary":"#d6d8e0","icons-secondary":"#9aa0ac","icons-muted":"#7c818c","icons-placeholder":"#3a3a44","icons-invert":"#14141a","icons-primary-hover":"#ffffff","icons-secondary-hover":"#d6d8e0","bg-primary":"#14141a","bg-primary-light":"#1a1a22","bg-primary-hover":"#20202a","bg-primary-active":"#2a2a38","bg-primary-stateless":"#20202a","bg-secondary":"#1a1a22","bg-stateless":"#1a1a22","bg-active":"#262633","bg-hover":"#20202a","bg-grey":"#23232e","bg-base-light":"#23232e","bg-base-medium":"#2a2a38","bg-tooltip":"#2a2a33","accent-primary":"#7C7CF0","accent-primary-hover":"#8F8FF5","accent-primary-active":"#6A6AE8","accent-stateless":"#7C7CF0","btn-primary-text":"#ffffff","btn-secondary-text":"#f1f1f4","btn-disabled-text":"#6a6a72","link-primary":"#c4c4cc","link-stateless":"#c4c4cc","link-hover":"#ffffff","link-active":"#ffffff","borders-primary":"#2e2e3a","borders-primary-hover":"#4a4a58","borders-secondary":"#26262f","borders-strong":"#3a3a46","borders-invert":"#d6d8e0","borders-item":"#26262f","borders-button":"#3a3a46","active-secondary":"#1f1f29","active-secondary-hover":"rgba(124,124,240,0.16)",tag:"#9aa0ac","light-shadow":"rgba(0,0,0,0.4)","medium-shadow":"rgba(0,0,0,0.5)"},IMAGE_EDITOR_LIGHT_PALETTE={"txt-primary":"#0a0a0a","txt-secondary":"#52525b","txt-secondary-invert":"#ffffff","txt-placeholder":"#a1a1aa","txt-warning":"#b45309","txt-error":"#dc2626","txt-info":"#2563eb","icon-primary":"#3f3f46","icons-secondary":"#71717a","icons-muted":"#a1a1aa","icons-placeholder":"#d4d4d8","icons-invert":"#ffffff","icons-primary-hover":"#0a0a0a","icons-secondary-hover":"#3f3f46","bg-primary":"#ffffff","bg-primary-light":"#fafafa","bg-primary-hover":"#f4f4f5","bg-primary-active":"#e4e4e7","bg-primary-stateless":"#f4f4f5","bg-secondary":"#fafafa","bg-stateless":"#fafafa","bg-active":"#ededfb","bg-hover":"#f4f4f5","bg-grey":"#f1f1f3","bg-base-light":"#f4f4f5","bg-base-medium":"#e4e4e7","bg-tooltip":"#18181b","accent-primary":"#5B5BD6","accent-primary-hover":"#4F4FC9","accent-primary-active":"#4444B8","accent-stateless":"#5B5BD6","btn-primary-text":"#ffffff","btn-secondary-text":"#0a0a0a","btn-disabled-text":"#a1a1aa","link-primary":"#5B5BD6","link-stateless":"#5B5BD6","link-hover":"#4444B8","link-active":"#4444B8","borders-primary":"#e6e6e8","borders-primary-hover":"#d4d4d8","borders-secondary":"#ededf0","borders-strong":"#d4d4d8","borders-invert":"#3f3f46","borders-item":"#ededf0","borders-button":"#d4d4d8","active-secondary":"#ededfb","active-secondary-hover":"rgba(91,91,214,0.10)",tag:"#71717a","light-shadow":"rgba(0,0,0,0.06)","medium-shadow":"rgba(0,0,0,0.12)"},FIE_ZH={name:"名称",save:"保存",saveAs:"另存为",back:"返回",loading:"加载中…",resetOperations:"重置/清除全部操作",changesLoseWarningHint:"按下「重置」将丢失所有修改,确定继续吗?",discardChangesWarningHint:"关闭弹窗后,最后的修改将不会保存。",cancel:"取消",apply:"应用",warning:"警告",confirm:"确认",discardChanges:"放弃修改",undoTitle:"撤销上一步",redoTitle:"重做上一步",showImageTitle:"显示原图",zoomInTitle:"放大",fitTitle:"适应",zoomOutTitle:"缩小",toggleZoomMenuTitle:"缩放菜单",pointerToolTitle:"指针工具",panToolTitle:"手工具:拖动画面",adjustTab:"调整",finetuneTab:"微调",filtersTab:"滤镜",watermarkTab:"水印",annotateTabLabel:"标注",resize:"调整尺寸",resizeTab:"尺寸",imageName:"图片名称",invalidImageError:"提供的图片无效。",uploadImageError:"上传图片出错。",areNotImages:"不是图片",isNotImage:"不是图片",toBeUploaded:"待上传",cropTool:"裁剪",original:"原始",custom:"自定义",square:"方形",landscape:"横向",portrait:"纵向",ellipse:"椭圆",classicTv:"经典电视",cinemascope:"宽银幕",arrowTool:"箭头",blurTool:"模糊",brightnessTool:"亮度",contrastTool:"对比度",ellipseTool:"椭圆",unFlipX:"取消水平翻转",flipX:"水平翻转",unFlipY:"取消垂直翻转",flipY:"垂直翻转",hsvTool:"HSV",hue:"色相",brightness:"亮度",saturation:"饱和度",value:"明度",imageTool:"图片",importing:"导入中…",addImage:"添加图片",uploadImage:"上传图片",fromGallery:"从图库",lineTool:"直线",penTool:"画笔",polygonTool:"多边形",sides:"边数",rectangleTool:"矩形",cornerRadius:"圆角",resizeWidthTitle:"宽度(像素)",resizeHeightTitle:"高度(像素)",toggleRatioLockTitle:"锁定/解锁比例",resetSize:"重置为原图尺寸",rotateTool:"旋转",textTool:"文字",textSpacings:"文字间距",textAlignment:"文字对齐",fontFamily:"字体",size:"大小",letterSpacing:"字间距",lineHeight:"行高",warmthTool:"色温",addWatermark:"添加水印",addTextWatermark:"添加文字水印",addWatermarkTitle:"选择水印类型",uploadWatermark:"上传水印",addWatermarkAsText:"以文字添加",padding:"内边距",paddings:"内边距",shadow:"阴影",horizontal:"水平",vertical:"垂直",blur:"模糊",opacity:"不透明度",transparency:"透明度",position:"位置",stroke:"描边",saveAsModalTitle:"另存为",extension:"扩展名",format:"格式",nameIsRequired:"名称必填。",quality:"质量",imageDimensionsHoverTitle:"保存图片尺寸(宽 × 高)",cropSizeLowerThanResizedWarning:"注意:所选裁剪区域小于已应用的调整尺寸,可能导致画质下降",actualSize:"实际大小(100%)",fitSize:"适应大小",zoomFit:"缩放至适当大小",zoomTo:"缩放至",addImageTitle:"选择要添加的图片…",mutualizedFailedToLoadImg:"图片加载失败。",tabsMenu:"菜单",download:"下载",width:"宽度",height:"高度",cropItemNoEffect:"该裁剪项无预览",px:"px",invalidTextContent:"文字内容无效",baselineShift:"基线偏移",aiTab:"AI 工具",objectRemovalTool:"对象移除",objectRemovalBrushSize:"画笔大小(px)",objectRemovalApplyButton:"应用",objectRemovalBrushMode:"画笔模式",objectRemovalBrushCircleType:"圆形画笔",objectRemovalBrushSquareType:"方形画笔",objectRemovalApplyingText:"正在移除所选区域",objectRemovalMarkModeTooltip:"标记模式",objectRemovalUnMarkModeTooltip:"取消标记模式",objectRemovalCancelConfirmationTitle:"取消处理",objectRemovalCancelConfirmationHint:"确定要取消移除以下素材中的对象:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"该"},FIE_ES={name:"Nombre",save:"Guardar",saveAs:"Guardar como",back:"Volver",loading:"Cargando…",resetOperations:"Restablecer / borrar cambios",changesLoseWarningHint:"Al pulsar “Restablecer” se perderán todos los cambios. ¿Continuar?",discardChangesWarningHint:"Al cerrar el cuadro, los últimos cambios no se guardarán.",cancel:"Cancelar",apply:"Aplicar",warning:"Advertencia",confirm:"Confirmar",discardChanges:"Descartar cambios",undoTitle:"Deshacer",redoTitle:"Rehacer",showImageTitle:"Mostrar original",zoomInTitle:"Ampliar",fitTitle:"Ajustar",zoomOutTitle:"Reducir",toggleZoomMenuTitle:"Menú de zoom",pointerToolTitle:"Herramienta de puntero",panToolTitle:"Mano: desplazar lienzo",adjustTab:"Ajustar",finetuneTab:"Ajustes finos",filtersTab:"Filtros",watermarkTab:"Marca de agua",annotateTabLabel:"Anotar",resize:"Redimensionar",resizeTab:"Tamaño",imageName:"Nombre de imagen",invalidImageError:"La imagen proporcionada no es válida.",uploadImageError:"Error al subir la imagen.",areNotImages:"No son imágenes",isNotImage:"No es una imagen",toBeUploaded:"Pendiente de subir",cropTool:"Recortar",original:"Original",custom:"Personalizado",square:"Cuadrado",landscape:"Horizontal",portrait:"Vertical",ellipse:"Elipse",classicTv:"TV clásica",cinemascope:"Cinemascope",arrowTool:"Flecha",blurTool:"Desenfoque",brightnessTool:"Brillo",contrastTool:"Contraste",ellipseTool:"Elipse",unFlipX:"Quitar volteo horizontal",flipX:"Voltear horizontal",unFlipY:"Quitar volteo vertical",flipY:"Voltear vertical",hsvTool:"HSV",hue:"Matiz",brightness:"Brillo",saturation:"Saturación",value:"Valor",imageTool:"Imagen",importing:"Importando…",addImage:"Añadir imagen",uploadImage:"Subir imagen",fromGallery:"Desde galería",lineTool:"Línea",penTool:"Pincel",polygonTool:"Polígono",sides:"Lados",rectangleTool:"Rectángulo",cornerRadius:"Radio de esquina",resizeWidthTitle:"Ancho (px)",resizeHeightTitle:"Alto (px)",toggleRatioLockTitle:"Bloquear/desbloquear proporción",resetSize:"Restablecer tamaño original",rotateTool:"Rotar",textTool:"Texto",textSpacings:"Espaciado de texto",textAlignment:"Alineación de texto",fontFamily:"Fuente",size:"Tamaño",letterSpacing:"Espaciado",lineHeight:"Altura de línea",warmthTool:"Temperatura",addWatermark:"Añadir marca de agua",addTextWatermark:"Añadir marca de texto",addWatermarkTitle:"Elegir tipo de marca",uploadWatermark:"Subir marca de agua",addWatermarkAsText:"Añadir como texto",padding:"Relleno",paddings:"Relleno",shadow:"Sombra",horizontal:"Horizontal",vertical:"Vertical",blur:"Desenfoque",opacity:"Opacidad",transparency:"Transparencia",position:"Posición",stroke:"Trazo",saveAsModalTitle:"Guardar como",extension:"Extensión",format:"Formato",nameIsRequired:"El nombre es obligatorio.",quality:"Calidad",imageDimensionsHoverTitle:"Tamaño guardado (ancho × alto)",cropSizeLowerThanResizedWarning:"Nota: el área recortada es menor que el tamaño ajustado y puede reducir la calidad",actualSize:"Tamaño real (100%)",fitSize:"Ajustar tamaño",zoomFit:"Ajustar al area",zoomTo:"Zoom a",addImageTitle:"Elegir imagen para añadir…",mutualizedFailedToLoadImg:"No se pudo cargar la imagen.",tabsMenu:"Menú",download:"Descargar",width:"Ancho",height:"Alto",cropItemNoEffect:"Este recorte no tiene vista previa",px:"px",invalidTextContent:"Contenido de texto no válido",baselineShift:"Desplazamiento de línea base",aiTab:"Herramientas IA",objectRemovalTool:"Eliminar objeto",objectRemovalBrushSize:"Tamaño de pincel (px)",objectRemovalApplyButton:"Aplicar",objectRemovalBrushMode:"Modo pincel",objectRemovalBrushCircleType:"Pincel circular",objectRemovalBrushSquareType:"Pincel cuadrado",objectRemovalApplyingText:"Eliminando el área seleccionada",objectRemovalMarkModeTooltip:"Modo marcar",objectRemovalUnMarkModeTooltip:"Modo desmarcar",objectRemovalCancelConfirmationTitle:"Cancelar proceso",objectRemovalCancelConfirmationHint:"¿Seguro que quieres cancelar la eliminación del objeto en:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"este"},FIE_ZH_HANT=Object.fromEntries(Object.entries(FIE_ZH).map(([e,o])=>[e,toHant(o)])),FIE_LOCALE_TRANSLATIONS={zh:FIE_ZH,es:FIE_ES,"zh-Hant":FIE_ZH_HANT},IMAGE_EDITOR_TABS=["Adjust","Annotate","Watermark","Filters","Finetune","Resize"];function buildCropPresetItems(e=IMAGE_PLATFORM_PRESETS,o){return e.map((e,a)=>{const t={titleKey:e.label,descriptionKey:e.ratio,ratio:e.value+1e-6*(a+1)};return o&&(t.icon=o(e.value)),t})}function buildImageEditorTranslations(e,o=IMAGE_PLATFORM_PRESETS,a={}){return{...a,...Object.fromEntries(o.flatMap(e=>[[e.label,e.label],[e.ratio,e.ratio]])),...FIE_LOCALE_TRANSLATIONS[e]??{}}}function createImageEditorConfig(e){const o=e.locale??"zh",a=e.platformPresets??IMAGE_PLATFORM_PRESETS,t=buildImageEditorTranslations(o,a,e.baseTranslations),i=e.themeMode??"dark",r="light"===i?IMAGE_EDITOR_LIGHT_PALETTE:IMAGE_EDITOR_DARK_PALETTE,l=r["accent-primary"],n="light"===i?"#18181b":"#ffffff",s={fill:"light"===i?"rgba(91,91,214,0.28)":"rgba(124,124,240,0.35)",stroke:l,strokeWidth:2},d={stroke:l,strokeWidth:4},p={useBackendTranslations:!1,source:e.source,tabsIds:[...IMAGE_EDITOR_TABS],defaultTabId:"Adjust",defaultToolId:"Crop",Crop:{presetsItems:buildCropPresetItems(a,e.renderRatioIcon)},savingPixelRatio:e.savingPixelRatio??4,previewPixelRatio:e.previewPixelRatio??2,language:"en",translations:t,defaultSavedImageType:"jpeg",defaultSavedImageQuality:.92,defaultSavedImageName:"image",onBeforeSave:()=>!1,annotationsCommon:{fill:n},Rect:{...s},Ellipse:{...s},Polygon:{...s},Text:{fontSize:30},Line:{...d},Arrow:{...d},Pen:{...d},theme:{palette:{...r,...e.theme?.palette},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',...e.theme?.typography}},onAnnotationAdd:compensateAnnotationRotation};return void 0!==e.loadableDesignState&&(p.loadableDesignState=e.loadableDesignState),e.onSave&&(p.onSave=e.onSave),e.onClose&&(p.onClose=e.onClose),p}exports.FIE_ES=FIE_ES,exports.FIE_ZH=FIE_ZH,exports.FIE_ZH_HANT=FIE_ZH_HANT,exports.IMAGE_EDITOR_DARK_PALETTE=IMAGE_EDITOR_DARK_PALETTE,exports.IMAGE_EDITOR_LIGHT_PALETTE=IMAGE_EDITOR_LIGHT_PALETTE,exports.IMAGE_EDITOR_TABS=IMAGE_EDITOR_TABS,exports.buildCropPresetItems=buildCropPresetItems,exports.buildImageEditorTranslations=buildImageEditorTranslations,exports.createImageEditorConfig=createImageEditorConfig;
|
|
1
|
+
"use strict";var zh={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.posterCors":"封面渲染失败:视频或贴纸服务器未允许跨域读取(CORS)","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},ZH_HANT_MAP={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},toHant=e=>{let o=e;for(const[e,a]of Object.entries(ZH_HANT_MAP).sort((e,o)=>o[0].length-e[0].length))o=o.replaceAll(e,a);return o};Object.fromEntries(Object.entries(zh).map(([e,o])=>[e,toHant(o)]));var DEFAULT_PLATFORM_TARGETS=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],RATIO_LABEL={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function parseRatio(e){const[o,a]=e.split(":").map(Number);return o&&a?o/a:1}function dedupePresets(e){const o=new Set,a=[];for(const t of e)t&&!o.has(t)&&(o.add(t),a.push({ratio:t,value:parseRatio(t),label:RATIO_LABEL[t]??t}));return a}function buildVideoPlatformRatioPresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Set,a=[];for(const t of e){if(!t.videoRatio)continue;const e=`${t.platform}:${t.postType}:${t.videoRatio}`;if(o.has(e))continue;o.add(e);const r=t.label.split(" ").slice(0,-1).join(" ")||t.label;a.push({platform:t.platform,postType:t.postType,label:`${r} ${t.videoRatio}`,ratio:t.videoRatio,value:parseRatio(t.videoRatio)})}return a}function buildImagePlatformPresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Map;for(const a of e){const e=o.get(a.platform);(!e||"post"!==e.postType&&"post"===a.postType)&&o.set(a.platform,a)}return Array.from(o.values()).map(e=>{const[o,a]=e.imageSize.split("x").map(Number),t=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${t} ${e.ratio}`,ratio:e.ratio,value:parseRatio(e.ratio),w:o,h:a}})}dedupePresets(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),dedupePresets(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]),buildVideoPlatformRatioPresets();var IMAGE_PLATFORM_PRESETS=buildImagePlatformPresets();function sizeOf(e,o){return e>=1?{w:2*Math.round(o*e/2),h:o}:{w:o,h:2*Math.round(o/e/2)}}function buildVideoSizePresets(e=DEFAULT_PLATFORM_TARGETS){const o=new Set,a=[];for(const t of e){if(!t.videoRatio||!t.videoResolution)continue;const e="1080p"===t.videoResolution?1080:720,{w:r,h:i}=sizeOf(parseRatio(t.videoRatio),e),l=`${r}x${i}`;o.has(l)||(o.add(l),a.push({label:`${t.shortLabel} ${r}×${i}`,w:r,h:i}))}return a}function compensateAnnotationRotation(e,o){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const a=o.adjustments?.rotation??0;return a?{rotation:-a}:{}}buildVideoSizePresets();var IMAGE_EDITOR_DARK_PALETTE={"txt-primary":"#f1f1f4","txt-secondary":"#b6bac4","txt-secondary-invert":"#14141a","txt-placeholder":"#7c818c","txt-warning":"#fbbf24","txt-error":"#f87171","txt-info":"#7cc4f5","icon-primary":"#d6d8e0","icons-secondary":"#9aa0ac","icons-muted":"#7c818c","icons-placeholder":"#3a3a44","icons-invert":"#14141a","icons-primary-hover":"#ffffff","icons-secondary-hover":"#d6d8e0","bg-primary":"#14141a","bg-primary-light":"#1a1a22","bg-primary-hover":"#20202a","bg-primary-active":"#2a2a38","bg-primary-stateless":"#20202a","bg-secondary":"#1a1a22","bg-stateless":"#1a1a22","bg-active":"#262633","bg-hover":"#20202a","bg-grey":"#23232e","bg-base-light":"#23232e","bg-base-medium":"#2a2a38","bg-tooltip":"#2a2a33","accent-primary":"#7C7CF0","accent-primary-hover":"#8F8FF5","accent-primary-active":"#6A6AE8","accent-stateless":"#7C7CF0","btn-primary-text":"#ffffff","btn-secondary-text":"#f1f1f4","btn-disabled-text":"#6a6a72","link-primary":"#c4c4cc","link-stateless":"#c4c4cc","link-hover":"#ffffff","link-active":"#ffffff","borders-primary":"#2e2e3a","borders-primary-hover":"#4a4a58","borders-secondary":"#26262f","borders-strong":"#3a3a46","borders-invert":"#d6d8e0","borders-item":"#26262f","borders-button":"#3a3a46","active-secondary":"#1f1f29","active-secondary-hover":"rgba(124,124,240,0.16)",tag:"#9aa0ac","light-shadow":"rgba(0,0,0,0.4)","medium-shadow":"rgba(0,0,0,0.5)"},IMAGE_EDITOR_LIGHT_PALETTE={"txt-primary":"#0a0a0a","txt-secondary":"#52525b","txt-secondary-invert":"#ffffff","txt-placeholder":"#a1a1aa","txt-warning":"#b45309","txt-error":"#dc2626","txt-info":"#2563eb","icon-primary":"#3f3f46","icons-secondary":"#71717a","icons-muted":"#a1a1aa","icons-placeholder":"#d4d4d8","icons-invert":"#ffffff","icons-primary-hover":"#0a0a0a","icons-secondary-hover":"#3f3f46","bg-primary":"#ffffff","bg-primary-light":"#fafafa","bg-primary-hover":"#f4f4f5","bg-primary-active":"#e4e4e7","bg-primary-stateless":"#f4f4f5","bg-secondary":"#fafafa","bg-stateless":"#fafafa","bg-active":"#ededfb","bg-hover":"#f4f4f5","bg-grey":"#f1f1f3","bg-base-light":"#f4f4f5","bg-base-medium":"#e4e4e7","bg-tooltip":"#18181b","accent-primary":"#5B5BD6","accent-primary-hover":"#4F4FC9","accent-primary-active":"#4444B8","accent-stateless":"#5B5BD6","btn-primary-text":"#ffffff","btn-secondary-text":"#0a0a0a","btn-disabled-text":"#a1a1aa","link-primary":"#5B5BD6","link-stateless":"#5B5BD6","link-hover":"#4444B8","link-active":"#4444B8","borders-primary":"#e6e6e8","borders-primary-hover":"#d4d4d8","borders-secondary":"#ededf0","borders-strong":"#d4d4d8","borders-invert":"#3f3f46","borders-item":"#ededf0","borders-button":"#d4d4d8","active-secondary":"#ededfb","active-secondary-hover":"rgba(91,91,214,0.10)",tag:"#71717a","light-shadow":"rgba(0,0,0,0.06)","medium-shadow":"rgba(0,0,0,0.12)"},FIE_ZH={name:"名称",save:"保存",saveAs:"另存为",back:"返回",loading:"加载中…",resetOperations:"重置/清除全部操作",changesLoseWarningHint:"按下「重置」将丢失所有修改,确定继续吗?",discardChangesWarningHint:"关闭弹窗后,最后的修改将不会保存。",cancel:"取消",apply:"应用",warning:"警告",confirm:"确认",discardChanges:"放弃修改",undoTitle:"撤销上一步",redoTitle:"重做上一步",showImageTitle:"显示原图",zoomInTitle:"放大",fitTitle:"适应",zoomOutTitle:"缩小",toggleZoomMenuTitle:"缩放菜单",pointerToolTitle:"指针工具",panToolTitle:"手工具:拖动画面",adjustTab:"调整",finetuneTab:"微调",filtersTab:"滤镜",watermarkTab:"水印",annotateTabLabel:"标注",resize:"调整尺寸",resizeTab:"尺寸",imageName:"图片名称",invalidImageError:"提供的图片无效。",uploadImageError:"上传图片出错。",areNotImages:"不是图片",isNotImage:"不是图片",toBeUploaded:"待上传",cropTool:"裁剪",original:"原始",custom:"自定义",square:"方形",landscape:"横向",portrait:"纵向",ellipse:"椭圆",classicTv:"经典电视",cinemascope:"宽银幕",arrowTool:"箭头",blurTool:"模糊",brightnessTool:"亮度",contrastTool:"对比度",ellipseTool:"椭圆",unFlipX:"取消水平翻转",flipX:"水平翻转",unFlipY:"取消垂直翻转",flipY:"垂直翻转",hsvTool:"HSV",hue:"色相",brightness:"亮度",saturation:"饱和度",value:"明度",imageTool:"图片",importing:"导入中…",addImage:"添加图片",uploadImage:"上传图片",fromGallery:"从图库",lineTool:"直线",penTool:"画笔",polygonTool:"多边形",sides:"边数",rectangleTool:"矩形",cornerRadius:"圆角",resizeWidthTitle:"宽度(像素)",resizeHeightTitle:"高度(像素)",toggleRatioLockTitle:"锁定/解锁比例",resetSize:"重置为原图尺寸",rotateTool:"旋转",textTool:"文字",textSpacings:"文字间距",textAlignment:"文字对齐",fontFamily:"字体",size:"大小",letterSpacing:"字间距",lineHeight:"行高",warmthTool:"色温",addWatermark:"添加水印",addTextWatermark:"添加文字水印",addWatermarkTitle:"选择水印类型",uploadWatermark:"上传水印",addWatermarkAsText:"以文字添加",padding:"内边距",paddings:"内边距",shadow:"阴影",horizontal:"水平",vertical:"垂直",blur:"模糊",opacity:"不透明度",transparency:"透明度",position:"位置",stroke:"描边",saveAsModalTitle:"另存为",extension:"扩展名",format:"格式",nameIsRequired:"名称必填。",quality:"质量",imageDimensionsHoverTitle:"保存图片尺寸(宽 × 高)",cropSizeLowerThanResizedWarning:"注意:所选裁剪区域小于已应用的调整尺寸,可能导致画质下降",actualSize:"实际大小(100%)",fitSize:"适应大小",zoomFit:"缩放至适当大小",zoomTo:"缩放至",addImageTitle:"选择要添加的图片…",mutualizedFailedToLoadImg:"图片加载失败。",tabsMenu:"菜单",download:"下载",width:"宽度",height:"高度",cropItemNoEffect:"该裁剪项无预览",px:"px",invalidTextContent:"文字内容无效",baselineShift:"基线偏移",aiTab:"AI 工具",objectRemovalTool:"对象移除",objectRemovalBrushSize:"画笔大小(px)",objectRemovalApplyButton:"应用",objectRemovalBrushMode:"画笔模式",objectRemovalBrushCircleType:"圆形画笔",objectRemovalBrushSquareType:"方形画笔",objectRemovalApplyingText:"正在移除所选区域",objectRemovalMarkModeTooltip:"标记模式",objectRemovalUnMarkModeTooltip:"取消标记模式",objectRemovalCancelConfirmationTitle:"取消处理",objectRemovalCancelConfirmationHint:"确定要取消移除以下素材中的对象:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"该"},FIE_ES={name:"Nombre",save:"Guardar",saveAs:"Guardar como",back:"Volver",loading:"Cargando…",resetOperations:"Restablecer / borrar cambios",changesLoseWarningHint:"Al pulsar “Restablecer” se perderán todos los cambios. ¿Continuar?",discardChangesWarningHint:"Al cerrar el cuadro, los últimos cambios no se guardarán.",cancel:"Cancelar",apply:"Aplicar",warning:"Advertencia",confirm:"Confirmar",discardChanges:"Descartar cambios",undoTitle:"Deshacer",redoTitle:"Rehacer",showImageTitle:"Mostrar original",zoomInTitle:"Ampliar",fitTitle:"Ajustar",zoomOutTitle:"Reducir",toggleZoomMenuTitle:"Menú de zoom",pointerToolTitle:"Herramienta de puntero",panToolTitle:"Mano: desplazar lienzo",adjustTab:"Ajustar",finetuneTab:"Ajustes finos",filtersTab:"Filtros",watermarkTab:"Marca de agua",annotateTabLabel:"Anotar",resize:"Redimensionar",resizeTab:"Tamaño",imageName:"Nombre de imagen",invalidImageError:"La imagen proporcionada no es válida.",uploadImageError:"Error al subir la imagen.",areNotImages:"No son imágenes",isNotImage:"No es una imagen",toBeUploaded:"Pendiente de subir",cropTool:"Recortar",original:"Original",custom:"Personalizado",square:"Cuadrado",landscape:"Horizontal",portrait:"Vertical",ellipse:"Elipse",classicTv:"TV clásica",cinemascope:"Cinemascope",arrowTool:"Flecha",blurTool:"Desenfoque",brightnessTool:"Brillo",contrastTool:"Contraste",ellipseTool:"Elipse",unFlipX:"Quitar volteo horizontal",flipX:"Voltear horizontal",unFlipY:"Quitar volteo vertical",flipY:"Voltear vertical",hsvTool:"HSV",hue:"Matiz",brightness:"Brillo",saturation:"Saturación",value:"Valor",imageTool:"Imagen",importing:"Importando…",addImage:"Añadir imagen",uploadImage:"Subir imagen",fromGallery:"Desde galería",lineTool:"Línea",penTool:"Pincel",polygonTool:"Polígono",sides:"Lados",rectangleTool:"Rectángulo",cornerRadius:"Radio de esquina",resizeWidthTitle:"Ancho (px)",resizeHeightTitle:"Alto (px)",toggleRatioLockTitle:"Bloquear/desbloquear proporción",resetSize:"Restablecer tamaño original",rotateTool:"Rotar",textTool:"Texto",textSpacings:"Espaciado de texto",textAlignment:"Alineación de texto",fontFamily:"Fuente",size:"Tamaño",letterSpacing:"Espaciado",lineHeight:"Altura de línea",warmthTool:"Temperatura",addWatermark:"Añadir marca de agua",addTextWatermark:"Añadir marca de texto",addWatermarkTitle:"Elegir tipo de marca",uploadWatermark:"Subir marca de agua",addWatermarkAsText:"Añadir como texto",padding:"Relleno",paddings:"Relleno",shadow:"Sombra",horizontal:"Horizontal",vertical:"Vertical",blur:"Desenfoque",opacity:"Opacidad",transparency:"Transparencia",position:"Posición",stroke:"Trazo",saveAsModalTitle:"Guardar como",extension:"Extensión",format:"Formato",nameIsRequired:"El nombre es obligatorio.",quality:"Calidad",imageDimensionsHoverTitle:"Tamaño guardado (ancho × alto)",cropSizeLowerThanResizedWarning:"Nota: el área recortada es menor que el tamaño ajustado y puede reducir la calidad",actualSize:"Tamaño real (100%)",fitSize:"Ajustar tamaño",zoomFit:"Ajustar al area",zoomTo:"Zoom a",addImageTitle:"Elegir imagen para añadir…",mutualizedFailedToLoadImg:"No se pudo cargar la imagen.",tabsMenu:"Menú",download:"Descargar",width:"Ancho",height:"Alto",cropItemNoEffect:"Este recorte no tiene vista previa",px:"px",invalidTextContent:"Contenido de texto no válido",baselineShift:"Desplazamiento de línea base",aiTab:"Herramientas IA",objectRemovalTool:"Eliminar objeto",objectRemovalBrushSize:"Tamaño de pincel (px)",objectRemovalApplyButton:"Aplicar",objectRemovalBrushMode:"Modo pincel",objectRemovalBrushCircleType:"Pincel circular",objectRemovalBrushSquareType:"Pincel cuadrado",objectRemovalApplyingText:"Eliminando el área seleccionada",objectRemovalMarkModeTooltip:"Modo marcar",objectRemovalUnMarkModeTooltip:"Modo desmarcar",objectRemovalCancelConfirmationTitle:"Cancelar proceso",objectRemovalCancelConfirmationHint:"¿Seguro que quieres cancelar la eliminación del objeto en:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"este"},FIE_ZH_HANT=Object.fromEntries(Object.entries(FIE_ZH).map(([e,o])=>[e,toHant(o)])),FIE_LOCALE_TRANSLATIONS={zh:FIE_ZH,es:FIE_ES,"zh-Hant":FIE_ZH_HANT},IMAGE_EDITOR_TABS=["Adjust","Annotate","Watermark","Filters","Finetune","Resize"];function buildCropPresetItems(e=IMAGE_PLATFORM_PRESETS,o){return e.map((e,a)=>{const t={titleKey:e.label,descriptionKey:e.ratio,ratio:e.value+1e-6*(a+1)};return o&&(t.icon=o(e.value)),t})}function buildImageEditorTranslations(e,o=IMAGE_PLATFORM_PRESETS,a={}){return{...a,...Object.fromEntries(o.flatMap(e=>[[e.label,e.label],[e.ratio,e.ratio]])),...FIE_LOCALE_TRANSLATIONS[e]??{}}}function createImageEditorConfig(e){const o=e.locale??"zh",a=e.platformPresets??IMAGE_PLATFORM_PRESETS,t=buildImageEditorTranslations(o,a,e.baseTranslations),r=e.themeMode??"dark",i="light"===r?IMAGE_EDITOR_LIGHT_PALETTE:IMAGE_EDITOR_DARK_PALETTE,l=i["accent-primary"],n="light"===r?"#18181b":"#ffffff",s={fill:"light"===r?"rgba(91,91,214,0.28)":"rgba(124,124,240,0.35)",stroke:l,strokeWidth:2},d={stroke:l,strokeWidth:4},p={useBackendTranslations:!1,source:e.source,tabsIds:[...IMAGE_EDITOR_TABS],defaultTabId:"Adjust",defaultToolId:"Crop",Crop:{presetsItems:buildCropPresetItems(a,e.renderRatioIcon)},savingPixelRatio:e.savingPixelRatio??4,previewPixelRatio:e.previewPixelRatio??2,language:"en",translations:t,defaultSavedImageType:"jpeg",defaultSavedImageQuality:.92,defaultSavedImageName:"image",onBeforeSave:()=>!1,annotationsCommon:{fill:n},Rect:{...s},Ellipse:{...s},Polygon:{...s},Text:{fontSize:30},Line:{...d},Arrow:{...d},Pen:{...d},theme:{palette:{...i,...e.theme?.palette},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',...e.theme?.typography}},onAnnotationAdd:compensateAnnotationRotation};return void 0!==e.loadableDesignState&&(p.loadableDesignState=e.loadableDesignState),e.onSave&&(p.onSave=e.onSave),e.onClose&&(p.onClose=e.onClose),p}exports.FIE_ES=FIE_ES,exports.FIE_ZH=FIE_ZH,exports.FIE_ZH_HANT=FIE_ZH_HANT,exports.IMAGE_EDITOR_DARK_PALETTE=IMAGE_EDITOR_DARK_PALETTE,exports.IMAGE_EDITOR_LIGHT_PALETTE=IMAGE_EDITOR_LIGHT_PALETTE,exports.IMAGE_EDITOR_TABS=IMAGE_EDITOR_TABS,exports.buildCropPresetItems=buildCropPresetItems,exports.buildImageEditorTranslations=buildImageEditorTranslations,exports.createImageEditorConfig=createImageEditorConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toHant as e,IMAGE_PLATFORM_PRESETS as a,compensateAnnotationRotation as o}from"./chunk-FAFKY4LX.js";var r={"txt-primary":"#f1f1f4","txt-secondary":"#b6bac4","txt-secondary-invert":"#14141a","txt-placeholder":"#7c818c","txt-warning":"#fbbf24","txt-error":"#f87171","txt-info":"#7cc4f5","icon-primary":"#d6d8e0","icons-secondary":"#9aa0ac","icons-muted":"#7c818c","icons-placeholder":"#3a3a44","icons-invert":"#14141a","icons-primary-hover":"#ffffff","icons-secondary-hover":"#d6d8e0","bg-primary":"#14141a","bg-primary-light":"#1a1a22","bg-primary-hover":"#20202a","bg-primary-active":"#2a2a38","bg-primary-stateless":"#20202a","bg-secondary":"#1a1a22","bg-stateless":"#1a1a22","bg-active":"#262633","bg-hover":"#20202a","bg-grey":"#23232e","bg-base-light":"#23232e","bg-base-medium":"#2a2a38","bg-tooltip":"#2a2a33","accent-primary":"#7C7CF0","accent-primary-hover":"#8F8FF5","accent-primary-active":"#6A6AE8","accent-stateless":"#7C7CF0","btn-primary-text":"#ffffff","btn-secondary-text":"#f1f1f4","btn-disabled-text":"#6a6a72","link-primary":"#c4c4cc","link-stateless":"#c4c4cc","link-hover":"#ffffff","link-active":"#ffffff","borders-primary":"#2e2e3a","borders-primary-hover":"#4a4a58","borders-secondary":"#26262f","borders-strong":"#3a3a46","borders-invert":"#d6d8e0","borders-item":"#26262f","borders-button":"#3a3a46","active-secondary":"#1f1f29","active-secondary-hover":"rgba(124,124,240,0.16)",tag:"#9aa0ac","light-shadow":"rgba(0,0,0,0.4)","medium-shadow":"rgba(0,0,0,0.5)"},t={"txt-primary":"#0a0a0a","txt-secondary":"#52525b","txt-secondary-invert":"#ffffff","txt-placeholder":"#a1a1aa","txt-warning":"#b45309","txt-error":"#dc2626","txt-info":"#2563eb","icon-primary":"#3f3f46","icons-secondary":"#71717a","icons-muted":"#a1a1aa","icons-placeholder":"#d4d4d8","icons-invert":"#ffffff","icons-primary-hover":"#0a0a0a","icons-secondary-hover":"#3f3f46","bg-primary":"#ffffff","bg-primary-light":"#fafafa","bg-primary-hover":"#f4f4f5","bg-primary-active":"#e4e4e7","bg-primary-stateless":"#f4f4f5","bg-secondary":"#fafafa","bg-stateless":"#fafafa","bg-active":"#ededfb","bg-hover":"#f4f4f5","bg-grey":"#f1f1f3","bg-base-light":"#f4f4f5","bg-base-medium":"#e4e4e7","bg-tooltip":"#18181b","accent-primary":"#5B5BD6","accent-primary-hover":"#4F4FC9","accent-primary-active":"#4444B8","accent-stateless":"#5B5BD6","btn-primary-text":"#ffffff","btn-secondary-text":"#0a0a0a","btn-disabled-text":"#a1a1aa","link-primary":"#5B5BD6","link-stateless":"#5B5BD6","link-hover":"#4444B8","link-active":"#4444B8","borders-primary":"#e6e6e8","borders-primary-hover":"#d4d4d8","borders-secondary":"#ededf0","borders-strong":"#d4d4d8","borders-invert":"#3f3f46","borders-item":"#ededf0","borders-button":"#d4d4d8","active-secondary":"#ededfb","active-secondary-hover":"rgba(91,91,214,0.10)",tag:"#71717a","light-shadow":"rgba(0,0,0,0.06)","medium-shadow":"rgba(0,0,0,0.12)"},i={name:"名称",save:"保存",saveAs:"另存为",back:"返回",loading:"加载中…",resetOperations:"重置/清除全部操作",changesLoseWarningHint:"按下「重置」将丢失所有修改,确定继续吗?",discardChangesWarningHint:"关闭弹窗后,最后的修改将不会保存。",cancel:"取消",apply:"应用",warning:"警告",confirm:"确认",discardChanges:"放弃修改",undoTitle:"撤销上一步",redoTitle:"重做上一步",showImageTitle:"显示原图",zoomInTitle:"放大",fitTitle:"适应",zoomOutTitle:"缩小",toggleZoomMenuTitle:"缩放菜单",pointerToolTitle:"指针工具",panToolTitle:"手工具:拖动画面",adjustTab:"调整",finetuneTab:"微调",filtersTab:"滤镜",watermarkTab:"水印",annotateTabLabel:"标注",resize:"调整尺寸",resizeTab:"尺寸",imageName:"图片名称",invalidImageError:"提供的图片无效。",uploadImageError:"上传图片出错。",areNotImages:"不是图片",isNotImage:"不是图片",toBeUploaded:"待上传",cropTool:"裁剪",original:"原始",custom:"自定义",square:"方形",landscape:"横向",portrait:"纵向",ellipse:"椭圆",classicTv:"经典电视",cinemascope:"宽银幕",arrowTool:"箭头",blurTool:"模糊",brightnessTool:"亮度",contrastTool:"对比度",ellipseTool:"椭圆",unFlipX:"取消水平翻转",flipX:"水平翻转",unFlipY:"取消垂直翻转",flipY:"垂直翻转",hsvTool:"HSV",hue:"色相",brightness:"亮度",saturation:"饱和度",value:"明度",imageTool:"图片",importing:"导入中…",addImage:"添加图片",uploadImage:"上传图片",fromGallery:"从图库",lineTool:"直线",penTool:"画笔",polygonTool:"多边形",sides:"边数",rectangleTool:"矩形",cornerRadius:"圆角",resizeWidthTitle:"宽度(像素)",resizeHeightTitle:"高度(像素)",toggleRatioLockTitle:"锁定/解锁比例",resetSize:"重置为原图尺寸",rotateTool:"旋转",textTool:"文字",textSpacings:"文字间距",textAlignment:"文字对齐",fontFamily:"字体",size:"大小",letterSpacing:"字间距",lineHeight:"行高",warmthTool:"色温",addWatermark:"添加水印",addTextWatermark:"添加文字水印",addWatermarkTitle:"选择水印类型",uploadWatermark:"上传水印",addWatermarkAsText:"以文字添加",padding:"内边距",paddings:"内边距",shadow:"阴影",horizontal:"水平",vertical:"垂直",blur:"模糊",opacity:"不透明度",transparency:"透明度",position:"位置",stroke:"描边",saveAsModalTitle:"另存为",extension:"扩展名",format:"格式",nameIsRequired:"名称必填。",quality:"质量",imageDimensionsHoverTitle:"保存图片尺寸(宽 × 高)",cropSizeLowerThanResizedWarning:"注意:所选裁剪区域小于已应用的调整尺寸,可能导致画质下降",actualSize:"实际大小(100%)",fitSize:"适应大小",zoomFit:"缩放至适当大小",zoomTo:"缩放至",addImageTitle:"选择要添加的图片…",mutualizedFailedToLoadImg:"图片加载失败。",tabsMenu:"菜单",download:"下载",width:"宽度",height:"高度",cropItemNoEffect:"该裁剪项无预览",px:"px",invalidTextContent:"文字内容无效",baselineShift:"基线偏移",aiTab:"AI 工具",objectRemovalTool:"对象移除",objectRemovalBrushSize:"画笔大小(px)",objectRemovalApplyButton:"应用",objectRemovalBrushMode:"画笔模式",objectRemovalBrushCircleType:"圆形画笔",objectRemovalBrushSquareType:"方形画笔",objectRemovalApplyingText:"正在移除所选区域",objectRemovalMarkModeTooltip:"标记模式",objectRemovalUnMarkModeTooltip:"取消标记模式",objectRemovalCancelConfirmationTitle:"取消处理",objectRemovalCancelConfirmationHint:"确定要取消移除以下素材中的对象:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"该"},n={name:"Nombre",save:"Guardar",saveAs:"Guardar como",back:"Volver",loading:"Cargando…",resetOperations:"Restablecer / borrar cambios",changesLoseWarningHint:"Al pulsar “Restablecer” se perderán todos los cambios. ¿Continuar?",discardChangesWarningHint:"Al cerrar el cuadro, los últimos cambios no se guardarán.",cancel:"Cancelar",apply:"Aplicar",warning:"Advertencia",confirm:"Confirmar",discardChanges:"Descartar cambios",undoTitle:"Deshacer",redoTitle:"Rehacer",showImageTitle:"Mostrar original",zoomInTitle:"Ampliar",fitTitle:"Ajustar",zoomOutTitle:"Reducir",toggleZoomMenuTitle:"Menú de zoom",pointerToolTitle:"Herramienta de puntero",panToolTitle:"Mano: desplazar lienzo",adjustTab:"Ajustar",finetuneTab:"Ajustes finos",filtersTab:"Filtros",watermarkTab:"Marca de agua",annotateTabLabel:"Anotar",resize:"Redimensionar",resizeTab:"Tamaño",imageName:"Nombre de imagen",invalidImageError:"La imagen proporcionada no es válida.",uploadImageError:"Error al subir la imagen.",areNotImages:"No son imágenes",isNotImage:"No es una imagen",toBeUploaded:"Pendiente de subir",cropTool:"Recortar",original:"Original",custom:"Personalizado",square:"Cuadrado",landscape:"Horizontal",portrait:"Vertical",ellipse:"Elipse",classicTv:"TV clásica",cinemascope:"Cinemascope",arrowTool:"Flecha",blurTool:"Desenfoque",brightnessTool:"Brillo",contrastTool:"Contraste",ellipseTool:"Elipse",unFlipX:"Quitar volteo horizontal",flipX:"Voltear horizontal",unFlipY:"Quitar volteo vertical",flipY:"Voltear vertical",hsvTool:"HSV",hue:"Matiz",brightness:"Brillo",saturation:"Saturación",value:"Valor",imageTool:"Imagen",importing:"Importando…",addImage:"Añadir imagen",uploadImage:"Subir imagen",fromGallery:"Desde galería",lineTool:"Línea",penTool:"Pincel",polygonTool:"Polígono",sides:"Lados",rectangleTool:"Rectángulo",cornerRadius:"Radio de esquina",resizeWidthTitle:"Ancho (px)",resizeHeightTitle:"Alto (px)",toggleRatioLockTitle:"Bloquear/desbloquear proporción",resetSize:"Restablecer tamaño original",rotateTool:"Rotar",textTool:"Texto",textSpacings:"Espaciado de texto",textAlignment:"Alineación de texto",fontFamily:"Fuente",size:"Tamaño",letterSpacing:"Espaciado",lineHeight:"Altura de línea",warmthTool:"Temperatura",addWatermark:"Añadir marca de agua",addTextWatermark:"Añadir marca de texto",addWatermarkTitle:"Elegir tipo de marca",uploadWatermark:"Subir marca de agua",addWatermarkAsText:"Añadir como texto",padding:"Relleno",paddings:"Relleno",shadow:"Sombra",horizontal:"Horizontal",vertical:"Vertical",blur:"Desenfoque",opacity:"Opacidad",transparency:"Transparencia",position:"Posición",stroke:"Trazo",saveAsModalTitle:"Guardar como",extension:"Extensión",format:"Formato",nameIsRequired:"El nombre es obligatorio.",quality:"Calidad",imageDimensionsHoverTitle:"Tamaño guardado (ancho × alto)",cropSizeLowerThanResizedWarning:"Nota: el área recortada es menor que el tamaño ajustado y puede reducir la calidad",actualSize:"Tamaño real (100%)",fitSize:"Ajustar tamaño",zoomFit:"Ajustar al area",zoomTo:"Zoom a",addImageTitle:"Elegir imagen para añadir…",mutualizedFailedToLoadImg:"No se pudo cargar la imagen.",tabsMenu:"Menú",download:"Descargar",width:"Ancho",height:"Alto",cropItemNoEffect:"Este recorte no tiene vista previa",px:"px",invalidTextContent:"Contenido de texto no válido",baselineShift:"Desplazamiento de línea base",aiTab:"Herramientas IA",objectRemovalTool:"Eliminar objeto",objectRemovalBrushSize:"Tamaño de pincel (px)",objectRemovalApplyButton:"Aplicar",objectRemovalBrushMode:"Modo pincel",objectRemovalBrushCircleType:"Pincel circular",objectRemovalBrushSquareType:"Pincel cuadrado",objectRemovalApplyingText:"Eliminando el área seleccionada",objectRemovalMarkModeTooltip:"Modo marcar",objectRemovalUnMarkModeTooltip:"Modo desmarcar",objectRemovalCancelConfirmationTitle:"Cancelar proceso",objectRemovalCancelConfirmationHint:"¿Seguro que quieres cancelar la eliminación del objeto en:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"este"},l=Object.fromEntries(Object.entries(i).map(([a,o])=>[a,e(o)])),s={zh:i,es:n,"zh-Hant":l},d=["Adjust","Annotate","Watermark","Filters","Finetune","Resize"];function c(e=a,o){return e.map((e,a)=>{const r={titleKey:e.label,descriptionKey:e.ratio,ratio:e.value+1e-6*(a+1)};return o&&(r.icon=o(e.value)),r})}function m(e,o=a,r={}){return{...r,...Object.fromEntries(o.flatMap(e=>[[e.label,e.label],[e.ratio,e.ratio]])),...s[e]??{}}}function p(e){const i=e.locale??"zh",n=e.platformPresets??a,l=m(i,n,e.baseTranslations),s=e.themeMode??"dark",p="light"===s?t:r,g=p["accent-primary"],b="light"===s?"#18181b":"#ffffff",f={fill:"light"===s?"rgba(91,91,214,0.28)":"rgba(124,124,240,0.35)",stroke:g,strokeWidth:2},u={stroke:g,strokeWidth:4},T={useBackendTranslations:!1,source:e.source,tabsIds:[...d],defaultTabId:"Adjust",defaultToolId:"Crop",Crop:{presetsItems:c(n,e.renderRatioIcon)},savingPixelRatio:e.savingPixelRatio??4,previewPixelRatio:e.previewPixelRatio??2,language:"en",translations:l,defaultSavedImageType:"jpeg",defaultSavedImageQuality:.92,defaultSavedImageName:"image",onBeforeSave:()=>!1,annotationsCommon:{fill:b},Rect:{...f},Ellipse:{...f},Polygon:{...f},Text:{fontSize:30},Line:{...u},Arrow:{...u},Pen:{...u},theme:{palette:{...p,...e.theme?.palette},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',...e.theme?.typography}},onAnnotationAdd:o};return void 0!==e.loadableDesignState&&(T.loadableDesignState=e.loadableDesignState),e.onSave&&(T.onSave=e.onSave),e.onClose&&(T.onClose=e.onClose),T}export{n as FIE_ES,i as FIE_ZH,l as FIE_ZH_HANT,r as IMAGE_EDITOR_DARK_PALETTE,t as IMAGE_EDITOR_LIGHT_PALETTE,d as IMAGE_EDITOR_TABS,c as buildCropPresetItems,m as buildImageEditorTranslations,p as createImageEditorConfig};
|
|
1
|
+
import{toHant as e,IMAGE_PLATFORM_PRESETS as a,compensateAnnotationRotation as o}from"./chunk-YFCBSEKB.js";var r={"txt-primary":"#f1f1f4","txt-secondary":"#b6bac4","txt-secondary-invert":"#14141a","txt-placeholder":"#7c818c","txt-warning":"#fbbf24","txt-error":"#f87171","txt-info":"#7cc4f5","icon-primary":"#d6d8e0","icons-secondary":"#9aa0ac","icons-muted":"#7c818c","icons-placeholder":"#3a3a44","icons-invert":"#14141a","icons-primary-hover":"#ffffff","icons-secondary-hover":"#d6d8e0","bg-primary":"#14141a","bg-primary-light":"#1a1a22","bg-primary-hover":"#20202a","bg-primary-active":"#2a2a38","bg-primary-stateless":"#20202a","bg-secondary":"#1a1a22","bg-stateless":"#1a1a22","bg-active":"#262633","bg-hover":"#20202a","bg-grey":"#23232e","bg-base-light":"#23232e","bg-base-medium":"#2a2a38","bg-tooltip":"#2a2a33","accent-primary":"#7C7CF0","accent-primary-hover":"#8F8FF5","accent-primary-active":"#6A6AE8","accent-stateless":"#7C7CF0","btn-primary-text":"#ffffff","btn-secondary-text":"#f1f1f4","btn-disabled-text":"#6a6a72","link-primary":"#c4c4cc","link-stateless":"#c4c4cc","link-hover":"#ffffff","link-active":"#ffffff","borders-primary":"#2e2e3a","borders-primary-hover":"#4a4a58","borders-secondary":"#26262f","borders-strong":"#3a3a46","borders-invert":"#d6d8e0","borders-item":"#26262f","borders-button":"#3a3a46","active-secondary":"#1f1f29","active-secondary-hover":"rgba(124,124,240,0.16)",tag:"#9aa0ac","light-shadow":"rgba(0,0,0,0.4)","medium-shadow":"rgba(0,0,0,0.5)"},t={"txt-primary":"#0a0a0a","txt-secondary":"#52525b","txt-secondary-invert":"#ffffff","txt-placeholder":"#a1a1aa","txt-warning":"#b45309","txt-error":"#dc2626","txt-info":"#2563eb","icon-primary":"#3f3f46","icons-secondary":"#71717a","icons-muted":"#a1a1aa","icons-placeholder":"#d4d4d8","icons-invert":"#ffffff","icons-primary-hover":"#0a0a0a","icons-secondary-hover":"#3f3f46","bg-primary":"#ffffff","bg-primary-light":"#fafafa","bg-primary-hover":"#f4f4f5","bg-primary-active":"#e4e4e7","bg-primary-stateless":"#f4f4f5","bg-secondary":"#fafafa","bg-stateless":"#fafafa","bg-active":"#ededfb","bg-hover":"#f4f4f5","bg-grey":"#f1f1f3","bg-base-light":"#f4f4f5","bg-base-medium":"#e4e4e7","bg-tooltip":"#18181b","accent-primary":"#5B5BD6","accent-primary-hover":"#4F4FC9","accent-primary-active":"#4444B8","accent-stateless":"#5B5BD6","btn-primary-text":"#ffffff","btn-secondary-text":"#0a0a0a","btn-disabled-text":"#a1a1aa","link-primary":"#5B5BD6","link-stateless":"#5B5BD6","link-hover":"#4444B8","link-active":"#4444B8","borders-primary":"#e6e6e8","borders-primary-hover":"#d4d4d8","borders-secondary":"#ededf0","borders-strong":"#d4d4d8","borders-invert":"#3f3f46","borders-item":"#ededf0","borders-button":"#d4d4d8","active-secondary":"#ededfb","active-secondary-hover":"rgba(91,91,214,0.10)",tag:"#71717a","light-shadow":"rgba(0,0,0,0.06)","medium-shadow":"rgba(0,0,0,0.12)"},i={name:"名称",save:"保存",saveAs:"另存为",back:"返回",loading:"加载中…",resetOperations:"重置/清除全部操作",changesLoseWarningHint:"按下「重置」将丢失所有修改,确定继续吗?",discardChangesWarningHint:"关闭弹窗后,最后的修改将不会保存。",cancel:"取消",apply:"应用",warning:"警告",confirm:"确认",discardChanges:"放弃修改",undoTitle:"撤销上一步",redoTitle:"重做上一步",showImageTitle:"显示原图",zoomInTitle:"放大",fitTitle:"适应",zoomOutTitle:"缩小",toggleZoomMenuTitle:"缩放菜单",pointerToolTitle:"指针工具",panToolTitle:"手工具:拖动画面",adjustTab:"调整",finetuneTab:"微调",filtersTab:"滤镜",watermarkTab:"水印",annotateTabLabel:"标注",resize:"调整尺寸",resizeTab:"尺寸",imageName:"图片名称",invalidImageError:"提供的图片无效。",uploadImageError:"上传图片出错。",areNotImages:"不是图片",isNotImage:"不是图片",toBeUploaded:"待上传",cropTool:"裁剪",original:"原始",custom:"自定义",square:"方形",landscape:"横向",portrait:"纵向",ellipse:"椭圆",classicTv:"经典电视",cinemascope:"宽银幕",arrowTool:"箭头",blurTool:"模糊",brightnessTool:"亮度",contrastTool:"对比度",ellipseTool:"椭圆",unFlipX:"取消水平翻转",flipX:"水平翻转",unFlipY:"取消垂直翻转",flipY:"垂直翻转",hsvTool:"HSV",hue:"色相",brightness:"亮度",saturation:"饱和度",value:"明度",imageTool:"图片",importing:"导入中…",addImage:"添加图片",uploadImage:"上传图片",fromGallery:"从图库",lineTool:"直线",penTool:"画笔",polygonTool:"多边形",sides:"边数",rectangleTool:"矩形",cornerRadius:"圆角",resizeWidthTitle:"宽度(像素)",resizeHeightTitle:"高度(像素)",toggleRatioLockTitle:"锁定/解锁比例",resetSize:"重置为原图尺寸",rotateTool:"旋转",textTool:"文字",textSpacings:"文字间距",textAlignment:"文字对齐",fontFamily:"字体",size:"大小",letterSpacing:"字间距",lineHeight:"行高",warmthTool:"色温",addWatermark:"添加水印",addTextWatermark:"添加文字水印",addWatermarkTitle:"选择水印类型",uploadWatermark:"上传水印",addWatermarkAsText:"以文字添加",padding:"内边距",paddings:"内边距",shadow:"阴影",horizontal:"水平",vertical:"垂直",blur:"模糊",opacity:"不透明度",transparency:"透明度",position:"位置",stroke:"描边",saveAsModalTitle:"另存为",extension:"扩展名",format:"格式",nameIsRequired:"名称必填。",quality:"质量",imageDimensionsHoverTitle:"保存图片尺寸(宽 × 高)",cropSizeLowerThanResizedWarning:"注意:所选裁剪区域小于已应用的调整尺寸,可能导致画质下降",actualSize:"实际大小(100%)",fitSize:"适应大小",zoomFit:"缩放至适当大小",zoomTo:"缩放至",addImageTitle:"选择要添加的图片…",mutualizedFailedToLoadImg:"图片加载失败。",tabsMenu:"菜单",download:"下载",width:"宽度",height:"高度",cropItemNoEffect:"该裁剪项无预览",px:"px",invalidTextContent:"文字内容无效",baselineShift:"基线偏移",aiTab:"AI 工具",objectRemovalTool:"对象移除",objectRemovalBrushSize:"画笔大小(px)",objectRemovalApplyButton:"应用",objectRemovalBrushMode:"画笔模式",objectRemovalBrushCircleType:"圆形画笔",objectRemovalBrushSquareType:"方形画笔",objectRemovalApplyingText:"正在移除所选区域",objectRemovalMarkModeTooltip:"标记模式",objectRemovalUnMarkModeTooltip:"取消标记模式",objectRemovalCancelConfirmationTitle:"取消处理",objectRemovalCancelConfirmationHint:"确定要取消移除以下素材中的对象:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"该"},n={name:"Nombre",save:"Guardar",saveAs:"Guardar como",back:"Volver",loading:"Cargando…",resetOperations:"Restablecer / borrar cambios",changesLoseWarningHint:"Al pulsar “Restablecer” se perderán todos los cambios. ¿Continuar?",discardChangesWarningHint:"Al cerrar el cuadro, los últimos cambios no se guardarán.",cancel:"Cancelar",apply:"Aplicar",warning:"Advertencia",confirm:"Confirmar",discardChanges:"Descartar cambios",undoTitle:"Deshacer",redoTitle:"Rehacer",showImageTitle:"Mostrar original",zoomInTitle:"Ampliar",fitTitle:"Ajustar",zoomOutTitle:"Reducir",toggleZoomMenuTitle:"Menú de zoom",pointerToolTitle:"Herramienta de puntero",panToolTitle:"Mano: desplazar lienzo",adjustTab:"Ajustar",finetuneTab:"Ajustes finos",filtersTab:"Filtros",watermarkTab:"Marca de agua",annotateTabLabel:"Anotar",resize:"Redimensionar",resizeTab:"Tamaño",imageName:"Nombre de imagen",invalidImageError:"La imagen proporcionada no es válida.",uploadImageError:"Error al subir la imagen.",areNotImages:"No son imágenes",isNotImage:"No es una imagen",toBeUploaded:"Pendiente de subir",cropTool:"Recortar",original:"Original",custom:"Personalizado",square:"Cuadrado",landscape:"Horizontal",portrait:"Vertical",ellipse:"Elipse",classicTv:"TV clásica",cinemascope:"Cinemascope",arrowTool:"Flecha",blurTool:"Desenfoque",brightnessTool:"Brillo",contrastTool:"Contraste",ellipseTool:"Elipse",unFlipX:"Quitar volteo horizontal",flipX:"Voltear horizontal",unFlipY:"Quitar volteo vertical",flipY:"Voltear vertical",hsvTool:"HSV",hue:"Matiz",brightness:"Brillo",saturation:"Saturación",value:"Valor",imageTool:"Imagen",importing:"Importando…",addImage:"Añadir imagen",uploadImage:"Subir imagen",fromGallery:"Desde galería",lineTool:"Línea",penTool:"Pincel",polygonTool:"Polígono",sides:"Lados",rectangleTool:"Rectángulo",cornerRadius:"Radio de esquina",resizeWidthTitle:"Ancho (px)",resizeHeightTitle:"Alto (px)",toggleRatioLockTitle:"Bloquear/desbloquear proporción",resetSize:"Restablecer tamaño original",rotateTool:"Rotar",textTool:"Texto",textSpacings:"Espaciado de texto",textAlignment:"Alineación de texto",fontFamily:"Fuente",size:"Tamaño",letterSpacing:"Espaciado",lineHeight:"Altura de línea",warmthTool:"Temperatura",addWatermark:"Añadir marca de agua",addTextWatermark:"Añadir marca de texto",addWatermarkTitle:"Elegir tipo de marca",uploadWatermark:"Subir marca de agua",addWatermarkAsText:"Añadir como texto",padding:"Relleno",paddings:"Relleno",shadow:"Sombra",horizontal:"Horizontal",vertical:"Vertical",blur:"Desenfoque",opacity:"Opacidad",transparency:"Transparencia",position:"Posición",stroke:"Trazo",saveAsModalTitle:"Guardar como",extension:"Extensión",format:"Formato",nameIsRequired:"El nombre es obligatorio.",quality:"Calidad",imageDimensionsHoverTitle:"Tamaño guardado (ancho × alto)",cropSizeLowerThanResizedWarning:"Nota: el área recortada es menor que el tamaño ajustado y puede reducir la calidad",actualSize:"Tamaño real (100%)",fitSize:"Ajustar tamaño",zoomFit:"Ajustar al area",zoomTo:"Zoom a",addImageTitle:"Elegir imagen para añadir…",mutualizedFailedToLoadImg:"No se pudo cargar la imagen.",tabsMenu:"Menú",download:"Descargar",width:"Ancho",height:"Alto",cropItemNoEffect:"Este recorte no tiene vista previa",px:"px",invalidTextContent:"Contenido de texto no válido",baselineShift:"Desplazamiento de línea base",aiTab:"Herramientas IA",objectRemovalTool:"Eliminar objeto",objectRemovalBrushSize:"Tamaño de pincel (px)",objectRemovalApplyButton:"Aplicar",objectRemovalBrushMode:"Modo pincel",objectRemovalBrushCircleType:"Pincel circular",objectRemovalBrushSquareType:"Pincel cuadrado",objectRemovalApplyingText:"Eliminando el área seleccionada",objectRemovalMarkModeTooltip:"Modo marcar",objectRemovalUnMarkModeTooltip:"Modo desmarcar",objectRemovalCancelConfirmationTitle:"Cancelar proceso",objectRemovalCancelConfirmationHint:"¿Seguro que quieres cancelar la eliminación del objeto en:",objectRemovalCancelConfirmationHintCompletion:"?",theKeyword:"este"},l=Object.fromEntries(Object.entries(i).map(([a,o])=>[a,e(o)])),s={zh:i,es:n,"zh-Hant":l},d=["Adjust","Annotate","Watermark","Filters","Finetune","Resize"];function c(e=a,o){return e.map((e,a)=>{const r={titleKey:e.label,descriptionKey:e.ratio,ratio:e.value+1e-6*(a+1)};return o&&(r.icon=o(e.value)),r})}function m(e,o=a,r={}){return{...r,...Object.fromEntries(o.flatMap(e=>[[e.label,e.label],[e.ratio,e.ratio]])),...s[e]??{}}}function p(e){const i=e.locale??"zh",n=e.platformPresets??a,l=m(i,n,e.baseTranslations),s=e.themeMode??"dark",p="light"===s?t:r,g=p["accent-primary"],b="light"===s?"#18181b":"#ffffff",f={fill:"light"===s?"rgba(91,91,214,0.28)":"rgba(124,124,240,0.35)",stroke:g,strokeWidth:2},u={stroke:g,strokeWidth:4},T={useBackendTranslations:!1,source:e.source,tabsIds:[...d],defaultTabId:"Adjust",defaultToolId:"Crop",Crop:{presetsItems:c(n,e.renderRatioIcon)},savingPixelRatio:e.savingPixelRatio??4,previewPixelRatio:e.previewPixelRatio??2,language:"en",translations:l,defaultSavedImageType:"jpeg",defaultSavedImageQuality:.92,defaultSavedImageName:"image",onBeforeSave:()=>!1,annotationsCommon:{fill:b},Rect:{...f},Ellipse:{...f},Polygon:{...f},Text:{fontSize:30},Line:{...u},Arrow:{...u},Pen:{...u},theme:{palette:{...p,...e.theme?.palette},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',...e.theme?.typography}},onAnnotationAdd:o};return void 0!==e.loadableDesignState&&(T.loadableDesignState=e.loadableDesignState),e.onSave&&(T.onSave=e.onSave),e.onClose&&(T.onClose=e.onClose),T}export{n as FIE_ES,i as FIE_ZH,l as FIE_ZH_HANT,r as IMAGE_EDITOR_DARK_PALETTE,t as IMAGE_EDITOR_LIGHT_PALETTE,d as IMAGE_EDITOR_TABS,c as buildCropPresetItems,m as buildImageEditorTranslations,p as createImageEditorConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var zod=require("zod"),StrokeCommon={color:zod.z.string().max(32),width:zod.z.number().positive().max(200)},RotationCommon={rotation:zod.z.number().min(-180).max(180).optional()},TimelineCommon={startAt:zod.z.number().min(0).optional(),endAt:zod.z.number().min(0).optional(),timelineTrack:zod.z.number().int().min(0).max(99).optional(),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()},FilterCommon={brightness:zod.z.number().min(-1).max(1).default(0),contrast:zod.z.number().min(-1).max(1).default(0),saturation:zod.z.number().min(-1).max(1).default(0),temperature:zod.z.number().min(-1).max(1).default(0),tint:zod.z.number().min(-1).max(1).default(0),vibrance:zod.z.number().min(-1).max(1).default(0),gamma:zod.z.number().min(-1).max(1).default(0),highlights:zod.z.number().min(-1).max(1).default(0),shadows:zod.z.number().min(-1).max(1).default(0),whites:zod.z.number().min(-1).max(1).default(0),blacks:zod.z.number().min(-1).max(1).default(0),lightSense:zod.z.number().min(-1).max(1).default(0),sharpen:zod.z.number().min(0).max(1).default(0),clarity:zod.z.number().min(0).max(1).default(0),grain:zod.z.number().min(0).max(1).default(0),fade:zod.z.number().min(0).max(1).default(0),vignette:zod.z.number().min(0).max(1).default(0)},Overlay=zod.z.discriminatedUnion("type",[zod.z.object({type:zod.z.literal("pen"),points:zod.z.array(zod.z.number()).min(4),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("line"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("arrow"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("rect"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("ellipse"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("text"),x:zod.z.number(),y:zod.z.number(),text:zod.z.string().max(500),color:zod.z.string().max(32),fontSize:zod.z.number().positive().max(512),fontFamily:zod.z.string().max(120).optional(),fontWeight:zod.z.string().max(20).optional(),italic:zod.z.boolean().optional(),underline:zod.z.boolean().optional(),strikethrough:zod.z.boolean().optional(),align:zod.z.enum(["left","center","right"]).optional(),width:zod.z.number().positive().max(8192).optional(),backgroundColor:zod.z.string().max(32).optional(),strokeColor:zod.z.string().max(32).optional(),borderWidth:zod.z.number().min(0).max(64).optional(),paddingX:zod.z.number().min(0).max(256).optional(),paddingY:zod.z.number().min(0).max(256).optional(),lineHeight:zod.z.number().positive().max(4).optional(),opacity:zod.z.number().min(0).max(100).optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("sticker"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),emoji:zod.z.string().max(16).optional(),src:zod.z.string().optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("adjust"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),layerKind:zod.z.enum(["adjust","filter"]).optional(),filterPreset:zod.z.string().max(32).optional(),...FilterCommon,...TimelineCommon,...RotationCommon})]),Clip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(7),in:zod.z.number().min(0),out:zod.z.number().min(0),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()}),AudioClip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(2),track:zod.z.number().int().min(0).default(0),startAt:zod.z.number().min(0),in:zod.z.number().min(0),out:zod.z.number().min(0),speed:zod.z.number().min(.5).max(2).default(1),volume:zod.z.number().min(0).max(10),muted:zod.z.boolean().optional(),locked:zod.z.boolean().optional(),fadeIn:zod.z.number().min(0).default(0),fadeOut:zod.z.number().min(0).default(0)}),Transition=zod.z.object({type:zod.z.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:zod.z.number().min(0).max(2).default(.4)}),ExportSettings=zod.z.object({fileName:zod.z.string().max(120).optional(),format:zod.z.enum(["mp4","mov","mxf"]).default("mp4"),width:zod.z.number().int().min(2).max(8192).optional(),height:zod.z.number().int().min(2).max(8192).optional(),frameRate:zod.z.number().int().min(12).max(120).default(30),bitrateMode:zod.z.enum(["auto","custom"]).optional(),videoBitrateKbps:zod.z.number().int().min(100).max(5e4).optional(),audioBitrateKbps:zod.z.number().int().min(32).max(1024).optional(),audioCodec:zod.z.enum(["aac","mp3"]).default("aac")}).optional(),DEFAULT_FILTERS={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},VideoEditState=zod.z.object({clips:zod.z.array(Clip).min(1).max(50),audioClips:zod.z.array(AudioClip).max(8).default([]),canvas:zod.z.object({w:zod.z.number().int().min(2).max(4096),h:zod.z.number().int().min(2).max(4096)}),crop:zod.z.object({x:zod.z.number().min(0),y:zod.z.number().min(0),width:zod.z.number().positive(),height:zod.z.number().positive()}).optional(),scale:zod.z.object({width:zod.z.number().positive(),height:zod.z.number().positive(),fit:zod.z.enum(["contain","cover","force"]),backgroundColor:zod.z.string().max(32).optional()}).optional(),rotation:zod.z.number().min(-180).max(180).default(0),flipX:zod.z.boolean().default(!1),flipY:zod.z.boolean().default(!1),filters:zod.z.object(FilterCommon).default(DEFAULT_FILTERS),filterPreset:zod.z.string().max(32).optional(),overlays:zod.z.array(Overlay).max(200).optional(),transitions:zod.z.array(Transition).max(49).default([]),keepAudio:zod.z.boolean().default(!0),poster:zod.z.object({time:zod.z.number().min(0),src:zod.z.string().optional(),useAsVideoCover:zod.z.boolean().optional(),preview:zod.z.string().optional()}).optional(),exportSettings:ExportSettings}).superRefine((e,t)=>{e.clips.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`clips[${o}].out 必须大于 in`,path:["clips",o,"out"]})}),e.audioClips?.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`audioClips[${o}].out 必须大于 in`,path:["audioClips",o,"out"]})}),e.canvas.w%2==0&&e.canvas.h%2==0||t.addIssue({code:zod.z.ZodIssueCode.custom,message:"canvas 宽高必须为偶数",path:["canvas"]}),null!=e.exportSettings?.width&&e.exportSettings.width%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.width must be even",path:["exportSettings","width"]}),null!=e.exportSettings?.height&&e.exportSettings.height%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.height must be even",path:["exportSettings","height"]})});function defaultVideoEditState(){return{clips:[],audioClips:[],canvas:{w:2,h:2},rotation:0,flipX:!1,flipY:!1,filters:DEFAULT_FILTERS,transitions:[],keepAudio:!0}}var MIN_CLIP=.1;function clipDuration(e){return e.out-e.in}function totalDuration(e){return e.reduce((e,t)=>e+clipDuration(t),0)}function clipStartsAt(e,t){let o=0;for(let i=0;i<t&&i<e.length;i++)o+=clipDuration(e[i]);return o}function locateOutput(e,t){if(!e.length||t<0)return null;let o=0;for(let i=0;i<e.length;i++){const r=clipDuration(e[i]);if(t<o+r)return{idx:i,srcTime:e[i].in+(t-o)};o+=r}if(Math.abs(t-o)<1e-9||t<=o){const t=e.length-1;return{idx:t,srcTime:e[t].out}}return null}function splitAtOutput(e,t){const o=locateOutput(e,t);if(!o)return e;const i=e[o.idx];return o.srcTime<i.in+MIN_CLIP||o.srcTime>i.out-MIN_CLIP?e:[...e.slice(0,o.idx),{...i,out:o.srcTime},{...i,in:o.srcTime},...e.slice(o.idx+1)]}function removeClip(e,t){return e.length<=1||!e[t]?e:e.filter((e,o)=>o!==t)}function duplicateClip(e,t){const o=e[t];return o?[...e.slice(0,t+1),{...o},...e.slice(t+1)]:e}function reorderClips(e,t,o){if(t===o||!e[t]||o<0||o>=e.length)return e;const i=[...e],[r]=i.splice(t,1);return i.splice(o,0,r),i}function trimClipEdge(e,t,o,i,r){if(!e[t])return e;const a=e.map(e=>({...e}));return"in"===o?a[t].in=Math.min(Math.max(i,0),a[t].out-MIN_CLIP):a[t].out=Math.max(Math.min(i,r),a[t].in+MIN_CLIP),a}function clampAudioClip(e,t,o){const i=Math.max(Math.min(e.out,t),MIN_CLIP),r=Math.min(Math.max(e.in,0),i-MIN_CLIP),a=Math.min(Math.max(e.startAt,0),Math.max(0,o-MIN_CLIP));return{...e,in:r,out:i,startAt:a}}function contentDuration(e,t=[]){const o=totalDuration(e),i=t.reduce((e,t)=>Math.max(e,t.startAt+(t.out-t.in)/Math.max(.01,t.speed??1)),0);return Math.max(o,i)}function usedVideoSrcIndices(e){return[...new Set(e.map(e=>e.srcIdx))].sort((e,t)=>e-t)}function remapSrcIndices(e,t){const o=new Map(t.map((e,t)=>[e,t]));return e.map(e=>({...e,srcIdx:o.get(e.srcIdx)??0}))}var DEG2RAD=Math.PI/180;function rotatedSize(e,t,o){const i=normalizeDeg(o);if(0===i||180===i)return{w:e,h:t};if(90===i||270===i)return{w:t,h:e};const r=i*DEG2RAD;return{w:Math.round(Math.abs(e*Math.cos(r))+Math.abs(t*Math.sin(r))),h:Math.round(Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)))}}function normalizeDeg(e){return(e%360+360)%360}function evenize(e){const t=Math.round(e);return t-t%2}function clampRect(e,t,o=40){const i=Math.min(Math.max(o,e.width),t.w),r=Math.min(Math.max(o,e.height),t.h),a=Math.min(Math.max(0,e.x),t.w-i),n=Math.min(Math.max(0,e.y),t.h-r);return{x:Math.round(a),y:Math.round(n),width:Math.round(i),height:Math.round(r)}}function centeredMaxRect(e,t){let o=e.w,i=o/t;return i>e.h&&(i=e.h,o=i*t),{x:Math.round((e.w-o)/2),y:Math.round((e.h-i)/2),width:Math.round(o),height:Math.round(i)}}function fitRects(e,t,o){const i={x:0,y:0,width:e.width,height:e.height},r={x:0,y:0,width:t.w,height:t.h};return"cover"===o?{src:centeredMaxRect({w:e.width,h:e.height},t.w/t.h),dst:r}:"contain"===o?{src:i,dst:centeredMaxRect({w:t.w,h:t.h},e.width/e.height)}:{src:i,dst:r}}function outputSize(e,t){if(t.scale)return{w:evenize(t.scale.width),h:evenize(t.scale.height)};if(t.crop)return{w:evenize(t.crop.width),h:evenize(t.crop.height)};const o=rotatedSize(e.w,e.h,t.rotation);return{w:evenize(o.w),h:evenize(o.h)}}var FILTER_PRESETS=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function findFilterPreset(e){return e?FILTER_PRESETS.find(t=>t.id===e):void 0}function buildFilterCss(e,t){const o=findFilterPreset(t)?.css??"",i=e.temperature??0,r=e.tint??0,a=e.vibrance??0,n=e.gamma??0,s=e.sharpen??0,l=e.clarity??0;return[`brightness(${1+e.brightness})`,`contrast(${1+e.contrast})`,`saturate(${1+e.saturation})`,o,a?`saturate(${(1+.65*a).toFixed(3)})`:"",i>0?`sepia(${Math.min(.36,.28*i).toFixed(3)})`:"",i?`hue-rotate(${(14*-i).toFixed(2)}deg)`:"",r?`hue-rotate(${(10*r).toFixed(2)}deg)`:"",n?`brightness(${(1+.08*n).toFixed(3)})`:"",l||s?`contrast(${(1+.16*l+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}function isOverlayHidden(e){return Boolean(e.hidden)}function overlayTrack(e,t){const o=Number(e.timelineTrack);return Number.isFinite(o)?Math.max(0,Math.round(o)):t}function overlayLayerRenderOrder(e){return e.map((e,t)=>({overlay:e,index:t,track:overlayTrack(e,t)})).sort((e,t)=>t.track-e.track||e.index-t.index).map(e=>e.overlay)}function rotationFilters(e){const t=normalizeDeg(e);if(0===t)return[];if(90===t)return["transpose=1"];if(180===t)return["transpose=1","transpose=1"];if(270===t)return["transpose=2"];const o=`${t}*PI/180`;return[`rotate=${o}:ow=rotw(${o}):oh=roth(${o}):c=black`]}function clampInt(e,t,o,i){const r=Math.round(Number(e));return Number.isFinite(r)?Math.min(o,Math.max(t,r)):i}function evenExportSize(e,t){const o=clampInt(e,2,8192,t);return o%2==0?o:o-1}function exportSettingsOf(e){return e.exportSettings??void 0}function exportFormat(e){const t=String(exportSettingsOf(e)?.format??"mp4").toLowerCase();return"mov"===t||"mxf"===t?t:"mp4"}function exportFrameRate(e){return clampInt(exportSettingsOf(e)?.frameRate,12,120,30)}function exportOutputSize(e){const t=outputSize(e.canvas,e),o=exportSettingsOf(e);if(!o)return t;const i=Number.isFinite(Number(o.width))&&Number(o.width)>0,r=Number.isFinite(Number(o.height))&&Number(o.height)>0;if(!i&&!r)return t;const a=t.w>0&&t.h>0?t.w/t.h:1;if(i&&r)return{w:evenExportSize(o.width,t.w),h:evenExportSize(o.height,t.h)};if(i){const e=evenExportSize(o.width,t.w);return{w:e,h:evenExportSize(e/a,t.h)}}const n=evenExportSize(o.height,t.h);return{w:evenExportSize(n*a,t.w),h:n}}function exportScaleFilters(e){const t=outputSize(e.canvas,e),o=exportOutputSize(e);return o.w===t.w&&o.h===t.h?[]:[`scale=${o.w}:${o.h}`]}function videoBitrateKbps(e){const t=Number(exportSettingsOf(e)?.videoBitrateKbps);return Number.isFinite(t)&&t>=100?Math.round(t):0}function audioBitrateKbps(e){const t=Number(exportSettingsOf(e)?.audioBitrateKbps);return Number.isFinite(t)&&t>=32?Math.round(t):0}function audioCodecArg(e){return"mp3"===exportSettingsOf(e)?.audioCodec?"libmp3lame":"aac"}function ffmpegPadColor(e){if("string"!=typeof e)return"0x000000";const t=e.trim(),o=t.match(/^#?([0-9a-fA-F]{3})$/);if(o)return`0x${o[1].split("").map(e=>e+e).join("").toLowerCase()}`;const i=t.match(/^#?([0-9a-fA-F]{6})$/);return i?`0x${i[1].toLowerCase()}`:"0x000000"}function eqFilter(e){const{brightness:t,contrast:o,saturation:i}=e,r=e.gamma??0,a=e.temperature??0,n=e.tint??0,s=e.vibrance??0,l=e.highlights??0,d=e.shadows??0,p=e.whites??0,u=e.blacks??0,c=e.lightSense??0;if(0===t&&0===o&&0===i&&0===r&&0===a&&0===n&&0===s&&0===l&&0===d&&0===p&&0===u&&0===c)return null;const m=[],h=t+.08*l+.06*d+.05*p-.05*u+.08*c,v=o+.08*p+.08*u,f=i+.65*s;0!==h&&m.push(`brightness=${h.toFixed(3)}`),0!==v&&m.push(`contrast=${(1+v).toFixed(3)}`),0!==f&&m.push(`saturation=${(1+f).toFixed(3)}`),0!==r&&m.push(`gamma=${(1+r*(r>0?1:.5)).toFixed(3)}`);const z=m.length?[`eq=${m.join(":")}`]:[];return 0===a&&0===n||z.push(`colorbalance=rs=${(.18*a+.08*n).toFixed(3)}:gs=${(.02*a-.04*n).toFixed(3)}:bs=${(.18*-a-.08*n).toFixed(3)}`),z.join(",")}function audioClipOutputDuration(e){return Math.max(.001,(e.out-e.in)/Math.max(.01,e.speed??1))}function isClipHidden(e){return Boolean(e.hidden)}function clipVideoFilter(e,t,o,i,r,a){return isClipHidden(t)?`color=c=black:s=${i}x${r}:r=${a}:d=${Math.max(.001,t.out-t.in)},setsar=1,format=yuv420p[v${o}]`:`[${e}:v]trim=start=${t.in}:end=${t.out},setpts=PTS-STARTPTS,scale=${i}:${r}:force_original_aspect_ratio=increase,crop=${i}:${r},setsar=1,fps=${a},format=yuv420p[v${o}]`}function musicClipFilter(e,t,o,i){const r=Math.min(2,Math.max(.5,t.speed??1)),a=audioClipOutputDuration(t),n=Math.min(Math.max(0,t.fadeIn??0),a),s=Math.min(Math.max(0,t.fadeOut??0),a),l=[`atrim=start=${t.in}:end=${t.out}`,"asetpts=PTS-STARTPTS"];return Math.abs(r-1)>.001&&l.push(`atempo=${r.toFixed(3)}`),n>0&&l.push(`afade=t=in:st=0:d=${n.toFixed(3)}`),s>0&&l.push(`afade=t=out:st=${Math.max(0,a-s).toFixed(3)}:d=${s.toFixed(3)}`),l.push(`volume=${t.volume}`,AFORMAT,`adelay=${o}|${o}`),`${e}${l.join(",")}[${i}]`}function buildVideoFilters(e,t={}){const o=[];if(e.flipX&&o.push("hflip"),e.flipY&&o.push("vflip"),o.push(...rotationFilters(e.rotation)),e.crop){const{x:t,y:i,width:r,height:a}=e.crop;o.push(`crop=${r}:${a}:${t}:${i}`)}if(e.scale){const{width:t,height:i,fit:r}=e.scale;"force"===r?o.push(`scale=${t}:${i}`):"cover"===r?o.push(`scale=${t}:${i}:force_original_aspect_ratio=increase`,`crop=${t}:${i}`):o.push(`scale=${t}:${i}:force_original_aspect_ratio=decrease`,`pad=${t}:${i}:(ow-iw)/2:(oh-ih)/2:${ffmpegPadColor(e.scale.backgroundColor)}`)}const i=eqFilter(e.filters);i&&o.push(i);const r=findFilterPreset(e.filterPreset);return r&&o.push(r.vf),!1!==t.includeExportScale&&o.push(...exportScaleFilters(e)),o.push(`fps=${exportFrameRate(e)}`),normalizeDeg(e.rotation)%90==0||e.scale||o.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),o}function codecArgs(e,t){const o=exportFormat(t),i="mxf"===o?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],r=videoBitrateKbps(t);if(r>0?i.push("-b:v",`${r}k`,"-maxrate",`${r}k`,"-bufsize",`${Math.max(2*r,512)}k`):"mxf"===o&&i.push("-q:v","2"),e)if("mxf"===o)i.push("-c:a","pcm_s16le");else{i.push("-c:a",audioCodecArg(t));const e=audioBitrateKbps(t);e>0&&i.push("-b:a",`${e}k`)}return"mxf"===o&&i.push("-f","mxf"),i}var AFORMAT="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",ANULL="anullsrc=r=44100:cl=stereo";function declick(e){return e>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round(1e3*(e-.01))/1e3}:d=0.01`:""}var LIMITER="alimiter=limit=0.95:level=disabled:latency=1";function timedOverlayRanges(e,t=Number.POSITIVE_INFINITY){const o=[];for(const i of e??[]){if(isOverlayHidden(i))continue;if("adjust"===i.type)continue;const e=Number(i.startAt),r=Number(i.endAt);if(Number.isFinite(e)&&Number.isFinite(r)&&!(r<=e)&&(o.push({startAt:Math.max(0,e),endAt:Math.max(e+.01,r)}),o.length>=t))break}return o}function evenFloor(e,t=2){const o=Math.max(t,Math.floor(Number(e)||t));return o%2==0?o:o-1}function timedEffectRange(e){const t=Number.isFinite(e.startAt)?Math.max(0,Number(e.startAt)):0,o=Number(e.endAt);return Number.isFinite(o)?{startAt:t,endAt:Math.max(t+.1,o)}:{startAt:t,endAt:t+3}}function adjustmentOverlayFilters(e){const t=eqFilter({...DEFAULT_FILTERS,...e}),o=findFilterPreset(e.filterPreset);return[t,o?.vf].filter(e=>Boolean(e))}function adjustmentRect(e,t){const o=Math.max(2,evenFloor(t.w)),i=Math.max(2,evenFloor(t.h)),r=Math.max(0,Math.min(o-2,evenFloor(e.x,0))),a=Math.max(0,Math.min(i-2,evenFloor(e.y,0))),n=Math.min(o-r,Math.max(2,evenFloor(e.w))),s=Math.min(i-a,Math.max(2,evenFloor(e.h)));return n<=1||s<=1?null:{x:r,y:a,w:n,h:s}}function timedAdjustmentEffects(e,t){const o=[];for(const i of e??[]){if(isOverlayHidden(i))continue;if("adjust"!==i.type)continue;const e=adjustmentRect(i,t);if(!e)continue;const r=adjustmentOverlayFilters(i);r.length&&o.push({rect:e,filters:r,...timedEffectRange(i)})}return o}function appendTimedOverlayFilters(e,t,o,i){let r=t;return i.forEach((t,i)=>{const a=`[vtimed${o+i}]`;e.push(`${r}[${o+i}:v]overlay=0:0:enable='between(t,${t.startAt.toFixed(3)},${t.endAt.toFixed(3)})'${a}`),r=a}),r}function appendTimedAdjustmentFilters(e,t,o){let i=t;return o.forEach((t,o)=>{const r=`[vadjsrc${o}]`,a=`[vadjbase${o}]`,n=`[vadjcrop${o}]`,s=`[vadj${o}]`,{rect:l}=t;e.push(`${i}split=2${r}${a}`),e.push(`${r}crop=${l.w}:${l.h}:${l.x}:${l.y},${t.filters.join(",")}${n}`),e.push(`${a}${n}overlay=${l.x}:${l.y}:enable='between(t,${t.startAt.toFixed(3)},${t.endAt.toFixed(3)})'${s}`),i=s}),i}function overlayEnableExpr(e){const t=Number(e.startAt),o=Number(e.endAt);return!Number.isFinite(t)||!Number.isFinite(o)||o<=t?"":`:enable='between(t,${Math.max(0,t).toFixed(3)},${Math.max(t+.01,o).toFixed(3)})'`}function appendAdjustmentFilter(e,t,o,i){const r=`[${i}src]`,a=`[${i}base]`,n=`[${i}crop]`,s=`[${i}]`,{rect:l}=o;return e.push(`${t}split=2${r}${a}`),e.push(`${r}crop=${l.w}:${l.h}:${l.x}:${l.y},${o.filters.join(",")}${n}`),e.push(`${a}${n}overlay=${l.x}:${l.y}:enable='between(t,${o.startAt.toFixed(3)},${o.endAt.toFixed(3)})'${s}`),s}function appendLayeredOverlayFilters(e,t,o,i,r,a,n){let s=t,l=0,d=0;for(const t of overlayLayerRenderOrder(i??[])){if(isOverlayHidden(t))continue;if("adjust"===t.type){const o=adjustmentRect(t,a),i=adjustmentOverlayFilters(t);if(!o||!i.length)continue;s=appendAdjustmentFilter(e,s,{rect:o,filters:i,...timedEffectRange(t)},`v${n}adj${d}`),d++;continue}if(l>=r){l++;continue}const i=`[v${n}lay${l}]`;e.push(`${s}[${o+l}:v]overlay=0:0${overlayEnableExpr(t)}${i}`),s=i,l++}return s}function buildSingleSourceArgs(e,t,o,i,r,a=[],n=[]){const s=buildVideoFilters(e,{includeExportScale:!1}),l=e.clips,d=e.keepAudio&&r,p=l.length>=2,u=l.some(isClipHidden),c=exportFrameRate(e),m=n.length>0,h=m?[]:timedOverlayRanges(e.overlays,a.length),v=m?[]:a.slice(0,h.length),f=m?n:[],z=m?[]:timedAdjustmentEffects(e.overlays,outputSize(e.canvas,e));if(p||u||i||v.length||f.length||z.length){const r=[];let a;if(p){l.forEach((t,o)=>{r.push(clipVideoFilter(0,t,o,e.canvas.w,e.canvas.h,c)),d&&r.push(`[0:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${declick(t.out-t.in)}[a${o}]`)});const t=l.map((e,t)=>d?`[v${t}][a${t}]`:`[v${t}]`).join(""),o=d?"[vcat][acat]":"[vcat]";r.push(`${t}concat=n=${l.length}:v=1:a=${d?1:0}${o}`),a="[vcat]"}else u?(r.push(clipVideoFilter(0,l[0],0,e.canvas.w,e.canvas.h,c)),a="[v0]"):a="[0:v]";s.length&&(r.push(`${a}${s.join(",")}[vflt]`),a="[vflt]"),f.length?(i&&(r.push(`${a}[1:v]overlay=0:0[vlegacy]`),a="[vlegacy]"),a=appendLayeredOverlayFilters(r,a,1+(i?1:0),e.overlays,f.length,outputSize(e.canvas,e),"s")):z.length&&(a=appendTimedAdjustmentFilters(r,a,z)),!f.length&&i?(r.push(`${a}[1:v]overlay=0:0[vout]`),a="[vout]"):"[0:v]"===a&&(r.push("[0:v]null[vout]"),a="[vout]"),v.length&&(a=appendTimedOverlayFilters(r,a,1+(i?1:0),h));const n=exportScaleFilters(e);n.length&&(r.push(`${a}${n.join(",")}[vscaled]`),a="[vscaled]");const m=[];p||1!==l.length||m.push("-ss",String(l[0].in),"-t",String(l[0].out-l[0].in));const g=["-y",...m,"-i",t];i&&g.push("-i",i);for(const e of f)g.push("-i",e);for(const e of v)g.push("-i",e);return g.push("-filter_complex",r.join(";"),"-map",a),d&&g.push("-map",p?"[acat]":"0:a?"),g.push(...codecArgs(d,e)),g.push(o),g}const g=["-ss",String(l[0].in),"-t",String(l[0].out-l[0].in)],x=buildVideoFilters(e),b=["-y",...g,"-i",t];return x.length&&b.push("-vf",x.join(",")),d||b.push("-an"),b.push(...codecArgs(d,e)),b.push(o),b}function buildFfmpegArgs(e,t,o){const{videoPaths:i,videoHasAudio:r,audioPaths:a,overlayPath:n,textOverlayPaths:s=[],overlayLayerPaths:l=[]}=t,d=(e.audioClips??[]).filter(e=>!e.muted),p=l.length>0,u=p?[]:timedOverlayRanges(e.overlays,s.length),c=p?[]:s.slice(0,u.length),m=p?l:[],h=p?[]:timedAdjustmentEffects(e.overlays,outputSize(e.canvas,e));if(1===i.length&&0===d.length)return buildSingleSourceArgs(e,i[0],o,n,r[0]??!1,c,m);const v=i.length,f=a.length,z=e.canvas.w,g=e.canvas.h,x=e.clips,b=e.keepAudio&&x.some(e=>r[e.srcIdx]),S=exportFrameRate(e),y=x.reduce((e,t)=>e+(t.out-t.in),0),T=[];x.forEach((e,t)=>{T.push(clipVideoFilter(e.srcIdx,e,t,z,g,S)),b&&(r[e.srcIdx]?T.push(`[${e.srcIdx}:a]atrim=start=${e.in}:end=${e.out},asetpts=PTS-STARTPTS${declick(e.out-e.in)},${AFORMAT}[a${t}]`):T.push(`${ANULL},atrim=start=0:end=${e.out-e.in},asetpts=PTS-STARTPTS,${AFORMAT}[a${t}]`))});const $=x.map((e,t)=>b?`[v${t}][a${t}]`:`[v${t}]`).join("");T.push(`${$}concat=n=${x.length}:v=1:a=${b?1:0}${b?"[vcat][acat]":"[vcat]"}`);let R=b?"[acat]":"";if(!b&&d.length&&(T.push(`${ANULL},atrim=start=0:end=${y},asetpts=PTS-STARTPTS,${AFORMAT}[acat]`),R="[acat]"),d.length){d.forEach((e,t)=>{const o=Math.max(0,Math.round(1e3*e.startAt));T.push(musicClipFilter(`[${v+e.srcIdx}:a]`,e,o,`mu${t}`))});const e=`${R}${d.map((e,t)=>`[mu${t}]`).join("")}`;T.push(`${e}amix=inputs=${1+d.length}:duration=first:dropout_transition=0:normalize=0,${LIMITER}[aout]`),R="[aout]"}let A="[vcat]";const E=buildVideoFilters(e,{includeExportScale:!1});E.length&&(T.push(`${A}${E.join(",")}[vflt]`),A="[vflt]"),m.length?(n&&(T.push(`${A}[${v+f}:v]overlay=0:0[vlegacy]`),A="[vlegacy]"),A=appendLayeredOverlayFilters(T,A,v+f+(n?1:0),e.overlays,m.length,outputSize(e.canvas,e),"m")):h.length&&(A=appendTimedAdjustmentFilters(T,A,h)),!m.length&&n&&(T.push(`${A}[${v+f}:v]overlay=0:0[vout]`),A="[vout]"),c.length&&(A=appendTimedOverlayFilters(T,A,v+f+(n?1:0),u));const F=exportScaleFilters(e);F.length&&(T.push(`${A}${F.join(",")}[vscaled]`),A="[vscaled]");const w=["-y"];for(const e of i)w.push("-i",e);for(const e of a)w.push("-i",e);n&&w.push("-i",n);for(const e of m)w.push("-i",e);for(const e of c)w.push("-i",e);w.push("-filter_complex",T.join(";"),"-map",A);const P=!!R;return P&&w.push("-map",R),w.push(...codecArgs(P,e)),P&&w.push("-ar","44100","-ac","2"),w.push(o),w}function buildPosterArgs(e,t,o){return["-y","-ss",String(t),"-i",e,"-frames:v","1","-q:v","2",o]}var MAX_DEPTH=100;function createHistory(e){return{past:[],present:e,future:[]}}function pushHistory(e,t){if(t===e.present)return e;const o=[...e.past,e.present];return o.length>MAX_DEPTH&&o.shift(),{past:o,present:t,future:[]}}function replacePresent(e,t){return t===e.present?e:{...e,present:t}}function canUndo(e){return e.past.length>0}function canRedo(e){return e.future.length>0}function undo(e){return canUndo(e)?{past:e.past.slice(0,-1),present:e.past[e.past.length-1],future:[e.present,...e.future]}:e}function redo(e){if(!canRedo(e))return e;const[t,...o]=e.future;return{past:[...e.past,e.present],present:t,future:o}}var zh={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},en={"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","tune.temperature":"Temperature","tune.tint":"Tint","tune.vibrance":"Vibrance","tune.highlights":"Highlights","tune.shadows":"Shadows","tune.whites":"Whites","tune.blacks":"Blacks","tune.lightSense":"Light","tune.sharpen":"Sharpen","tune.clarity":"Clarity","tune.grain":"Grain","tune.fade":"Fade","tune.vignette":"Vignette","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.fontSize":"Size","overlay.font":"Font","overlay.align":"Align","overlay.background":"Background","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add → drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Wide 1.91:1","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting…","act.poster":"🖼 Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"← Change image","act.changeVideo":"← Change file","crop.rotateLeft":"↺ Rotate left","crop.flipX":"⇋ Flip horizontal","crop.flipY":"⇵ Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting…","msg.exportPrepare":"Preparing media…","msg.exportUpload":"Uploading media…","msg.exportEncode":"Encoding video…","msg.exportDownload":"Receiving result…","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done ✓","msg.loading":"Loading media…","msg.exported":"Exported: ","msg.saving":"Saving…","msg.saved":"Saved to drive ✓","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"↔ Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"· center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"♪ Audio track (+ on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"⇧ F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video — crop · filters · text · export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot · videos: trim/mute/cover"},es={"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporción","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturación","tune.gamma":"Gamma","tune.temperature":"Temperatura","tune.tint":"Tinte","tune.vibrance":"Intensidad","tune.highlights":"Altas luces","tune.shadows":"Sombras","tune.whites":"Blancos","tune.blacks":"Negros","tune.lightSense":"Luz","tune.sharpen":"Enfoque","tune.clarity":"Claridad","tune.grain":"Grano","tune.fade":"Desvanecer","tune.vignette":"Viñeta","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"Línea","overlay.arrow":"Flecha","overlay.rect":"Rectángulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.fontSize":"Tamaño","overlay.font":"Fuente","overlay.align":"Alinear","overlay.background":"Fondo","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para añadirlo → arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"Cálido","filter.cool":"Frío","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Panorámico 1.91:1","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar música","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando…","act.poster":"🖼 Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"← Cambiar imagen","act.changeVideo":"← Cambiar archivo","crop.rotateLeft":"↺ Girar a la izquierda","crop.flipX":"⇋ Voltear horizontal","crop.flipY":"⇵ Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con música; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir línea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar línea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"Añadir clip de vídeo","tip.addAudio":"Añadir música (archivo de audio o vídeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar después)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporción","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de vídeo","err.maxVideo":"Máximo {max} vídeos","err.videoLoad":"No se pudo cargar el vídeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un vídeo con sonido (se extrae automáticamente)","err.maxAudio":"Máximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o vídeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando…","msg.exportPrepare":"Preparando medios…","msg.exportUpload":"Subiendo medios…","msg.exportEncode":"Codificando video…","msg.exportDownload":"Recibiendo resultado…","msg.exportingHint":"Espera un momento. El resultado se devolverá automáticamente al finalizar.","msg.done":"Listo ✓","msg.loading":"Cargando medios…","msg.exported":"Exportado: ","msg.saving":"Guardando…","msg.saved":"Guardado en disco ✓","lbl.ratioSection":"Proporción de imagen (recorte, sin deformar)","lbl.dragToReposition":"↔ Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tamaño de exportación (px; recorte cover centrado si la proporción difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tamaño","lbl.noScale":"(sin escala)","lbl.coverNote":"· recorte centrado (cover) cuando la proporción difiere, sin deformar","lbl.audioTrackHint":"♪ Pista de audio (+ a la derecha para añadir música, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportación usa el valor definido)","lbl.music":"Música","kbd.fit":"⇧ F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / vídeo — recorta · filtros · texto · exporta","panel.pick":"Haz clic para elegir una imagen o vídeo","panel.pickHint":"Imágenes con Filerobot · vídeos: cortar/silenciar/portada"},ZH_HANT_MAP={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},toHant=e=>{let t=e;for(const[e,o]of Object.entries(ZH_HANT_MAP).sort((e,t)=>t[0].length-e[0].length))t=t.replaceAll(e,o);return t},zhHant=Object.fromEntries(Object.entries(zh).map(([e,t])=>[e,toHant(t)])),EDITOR_MESSAGES={zh:zh,en:en,es:es,"zh-Hant":zhHant};function tEditor(e,t,o){let i=EDITOR_MESSAGES[e]?.[t]??EDITOR_MESSAGES.zh[t]??t;if(o)for(const[e,t]of Object.entries(o))i=i.replaceAll(`{${e}}`,String(t));return i}var DEFAULT_PLATFORM_TARGETS=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],RATIO_LABEL={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function parseRatio(e){const[t,o]=e.split(":").map(Number);return t&&o?t/o:1}function dedupePresets(e){const t=new Set,o=[];for(const i of e)i&&!t.has(i)&&(t.add(i),o.push({ratio:i,value:parseRatio(i),label:RATIO_LABEL[i]??i}));return o}var IMAGE_RATIO_PRESETS=dedupePresets(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),VIDEO_RATIO_PRESETS=dedupePresets(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]);function buildVideoPlatformRatioPresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Set,o=[];for(const i of e){if(!i.videoRatio)continue;const e=`${i.platform}:${i.postType}:${i.videoRatio}`;if(t.has(e))continue;t.add(e);const r=i.label.split(" ").slice(0,-1).join(" ")||i.label;o.push({platform:i.platform,postType:i.postType,label:`${r} ${i.videoRatio}`,ratio:i.videoRatio,value:parseRatio(i.videoRatio)})}return o}var VIDEO_PLATFORM_RATIO_PRESETS=buildVideoPlatformRatioPresets();function buildImagePlatformPresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Map;for(const o of e){const e=t.get(o.platform);(!e||"post"!==e.postType&&"post"===o.postType)&&t.set(o.platform,o)}return Array.from(t.values()).map(e=>{const[t,o]=e.imageSize.split("x").map(Number),i=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${i} ${e.ratio}`,ratio:e.ratio,value:parseRatio(e.ratio),w:t,h:o}})}var IMAGE_PLATFORM_PRESETS=buildImagePlatformPresets();function sizeOf(e,t){return e>=1?{w:2*Math.round(t*e/2),h:t}:{w:t,h:2*Math.round(t/e/2)}}function buildVideoSizePresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Set,o=[];for(const i of e){if(!i.videoRatio||!i.videoResolution)continue;const e="1080p"===i.videoResolution?1080:720,{w:r,h:a}=sizeOf(parseRatio(i.videoRatio),e),n=`${r}x${a}`;t.has(n)||(t.add(n),o.push({label:`${i.shortLabel} ${r}×${a}`,w:r,h:a}))}return o}var VIDEO_SIZE_PRESETS=buildVideoSizePresets();function compensateAnnotationRotation(e,t){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const o=t.adjustments?.rotation??0;return o?{rotation:-o}:{}}exports.AudioClip=AudioClip,exports.Clip=Clip,exports.DEFAULT_FILTERS=DEFAULT_FILTERS,exports.DEFAULT_PLATFORM_TARGETS=DEFAULT_PLATFORM_TARGETS,exports.DEG2RAD=DEG2RAD,exports.EDITOR_MESSAGES=EDITOR_MESSAGES,exports.ExportSettings=ExportSettings,exports.FILTER_PRESETS=FILTER_PRESETS,exports.IMAGE_PLATFORM_PRESETS=IMAGE_PLATFORM_PRESETS,exports.IMAGE_RATIO_PRESETS=IMAGE_RATIO_PRESETS,exports.MIN_CLIP=MIN_CLIP,exports.Overlay=Overlay,exports.Transition=Transition,exports.VIDEO_PLATFORM_RATIO_PRESETS=VIDEO_PLATFORM_RATIO_PRESETS,exports.VIDEO_RATIO_PRESETS=VIDEO_RATIO_PRESETS,exports.VIDEO_SIZE_PRESETS=VIDEO_SIZE_PRESETS,exports.VideoEditState=VideoEditState,exports.buildFfmpegArgs=buildFfmpegArgs,exports.buildFilterCss=buildFilterCss,exports.buildImagePlatformPresets=buildImagePlatformPresets,exports.buildPosterArgs=buildPosterArgs,exports.buildVideoPlatformRatioPresets=buildVideoPlatformRatioPresets,exports.buildVideoSizePresets=buildVideoSizePresets,exports.canRedo=canRedo,exports.canUndo=canUndo,exports.centeredMaxRect=centeredMaxRect,exports.clampAudioClip=clampAudioClip,exports.clampRect=clampRect,exports.clipDuration=clipDuration,exports.clipStartsAt=clipStartsAt,exports.compensateAnnotationRotation=compensateAnnotationRotation,exports.contentDuration=contentDuration,exports.createHistory=createHistory,exports.defaultVideoEditState=defaultVideoEditState,exports.duplicateClip=duplicateClip,exports.evenize=evenize,exports.findFilterPreset=findFilterPreset,exports.fitRects=fitRects,exports.locateOutput=locateOutput,exports.normalizeDeg=normalizeDeg,exports.outputSize=outputSize,exports.parseRatio=parseRatio,exports.pushHistory=pushHistory,exports.redo=redo,exports.remapSrcIndices=remapSrcIndices,exports.removeClip=removeClip,exports.reorderClips=reorderClips,exports.replacePresent=replacePresent,exports.rotatedSize=rotatedSize,exports.splitAtOutput=splitAtOutput,exports.tEditor=tEditor,exports.toHant=toHant,exports.totalDuration=totalDuration,exports.trimClipEdge=trimClipEdge,exports.undo=undo,exports.usedVideoSrcIndices=usedVideoSrcIndices;
|
|
1
|
+
"use strict";var zod=require("zod"),StrokeCommon={color:zod.z.string().max(32),width:zod.z.number().positive().max(200)},RotationCommon={rotation:zod.z.number().min(-180).max(180).optional()},TimelineCommon={startAt:zod.z.number().min(0).optional(),endAt:zod.z.number().min(0).optional(),timelineTrack:zod.z.number().int().min(0).max(99).optional(),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()},FilterCommon={brightness:zod.z.number().min(-1).max(1).default(0),contrast:zod.z.number().min(-1).max(1).default(0),saturation:zod.z.number().min(-1).max(1).default(0),temperature:zod.z.number().min(-1).max(1).default(0),tint:zod.z.number().min(-1).max(1).default(0),vibrance:zod.z.number().min(-1).max(1).default(0),gamma:zod.z.number().min(-1).max(1).default(0),highlights:zod.z.number().min(-1).max(1).default(0),shadows:zod.z.number().min(-1).max(1).default(0),whites:zod.z.number().min(-1).max(1).default(0),blacks:zod.z.number().min(-1).max(1).default(0),lightSense:zod.z.number().min(-1).max(1).default(0),sharpen:zod.z.number().min(0).max(1).default(0),clarity:zod.z.number().min(0).max(1).default(0),grain:zod.z.number().min(0).max(1).default(0),fade:zod.z.number().min(0).max(1).default(0),vignette:zod.z.number().min(0).max(1).default(0)},Overlay=zod.z.discriminatedUnion("type",[zod.z.object({type:zod.z.literal("pen"),points:zod.z.array(zod.z.number()).min(4),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("line"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("arrow"),x1:zod.z.number(),y1:zod.z.number(),x2:zod.z.number(),y2:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("rect"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("ellipse"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number(),...StrokeCommon,...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("text"),x:zod.z.number(),y:zod.z.number(),text:zod.z.string().max(500),color:zod.z.string().max(32),fontSize:zod.z.number().positive().max(512),fontFamily:zod.z.string().max(120).optional(),fontWeight:zod.z.string().max(20).optional(),italic:zod.z.boolean().optional(),underline:zod.z.boolean().optional(),strikethrough:zod.z.boolean().optional(),align:zod.z.enum(["left","center","right"]).optional(),width:zod.z.number().positive().max(8192).optional(),backgroundColor:zod.z.string().max(32).optional(),strokeColor:zod.z.string().max(32).optional(),borderWidth:zod.z.number().min(0).max(64).optional(),paddingX:zod.z.number().min(0).max(256).optional(),paddingY:zod.z.number().min(0).max(256).optional(),lineHeight:zod.z.number().positive().max(4).optional(),opacity:zod.z.number().min(0).max(100).optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("sticker"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),emoji:zod.z.string().max(16).optional(),src:zod.z.string().optional(),...TimelineCommon,...RotationCommon}),zod.z.object({type:zod.z.literal("adjust"),x:zod.z.number(),y:zod.z.number(),w:zod.z.number().positive(),h:zod.z.number().positive(),layerKind:zod.z.enum(["adjust","filter"]).optional(),filterPreset:zod.z.string().max(32).optional(),...FilterCommon,...TimelineCommon,...RotationCommon})]),Clip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(7),in:zod.z.number().min(0),out:zod.z.number().min(0),hidden:zod.z.boolean().optional(),locked:zod.z.boolean().optional()}),AudioClip=zod.z.object({srcIdx:zod.z.number().int().min(0).max(2),track:zod.z.number().int().min(0).default(0),startAt:zod.z.number().min(0),in:zod.z.number().min(0),out:zod.z.number().min(0),speed:zod.z.number().min(.5).max(2).default(1),volume:zod.z.number().min(0).max(10),muted:zod.z.boolean().optional(),locked:zod.z.boolean().optional(),fadeIn:zod.z.number().min(0).default(0),fadeOut:zod.z.number().min(0).default(0)}),Transition=zod.z.object({type:zod.z.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:zod.z.number().min(0).max(2).default(.4)}),ExportSettings=zod.z.object({fileName:zod.z.string().max(120).optional(),format:zod.z.enum(["mp4","mov","mxf"]).default("mp4"),width:zod.z.number().int().min(2).max(8192).optional(),height:zod.z.number().int().min(2).max(8192).optional(),frameRate:zod.z.number().int().min(12).max(120).default(30),bitrateMode:zod.z.enum(["auto","custom"]).optional(),videoBitrateKbps:zod.z.number().int().min(100).max(5e4).optional(),audioBitrateKbps:zod.z.number().int().min(32).max(1024).optional(),audioCodec:zod.z.enum(["aac","mp3"]).default("aac")}).optional(),DEFAULT_FILTERS={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},VideoEditState=zod.z.object({clips:zod.z.array(Clip).min(1).max(50),audioClips:zod.z.array(AudioClip).max(8).default([]),canvas:zod.z.object({w:zod.z.number().int().min(2).max(4096),h:zod.z.number().int().min(2).max(4096)}),crop:zod.z.object({x:zod.z.number().min(0),y:zod.z.number().min(0),width:zod.z.number().positive(),height:zod.z.number().positive()}).optional(),scale:zod.z.object({width:zod.z.number().positive(),height:zod.z.number().positive(),fit:zod.z.enum(["contain","cover","force"]),backgroundColor:zod.z.string().max(32).optional()}).optional(),rotation:zod.z.number().min(-180).max(180).default(0),flipX:zod.z.boolean().default(!1),flipY:zod.z.boolean().default(!1),filters:zod.z.object(FilterCommon).default(DEFAULT_FILTERS),filterPreset:zod.z.string().max(32).optional(),overlays:zod.z.array(Overlay).max(200).optional(),transitions:zod.z.array(Transition).max(49).default([]),keepAudio:zod.z.boolean().default(!0),poster:zod.z.object({time:zod.z.number().min(0),src:zod.z.string().optional(),useAsVideoCover:zod.z.boolean().optional(),preview:zod.z.string().optional()}).optional(),exportSettings:ExportSettings}).superRefine((e,t)=>{e.clips.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`clips[${o}].out 必须大于 in`,path:["clips",o,"out"]})}),e.audioClips?.forEach((e,o)=>{e.out<=e.in&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`audioClips[${o}].out 必须大于 in`,path:["audioClips",o,"out"]})}),e.canvas.w%2==0&&e.canvas.h%2==0||t.addIssue({code:zod.z.ZodIssueCode.custom,message:"canvas 宽高必须为偶数",path:["canvas"]}),null!=e.exportSettings?.width&&e.exportSettings.width%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.width must be even",path:["exportSettings","width"]}),null!=e.exportSettings?.height&&e.exportSettings.height%2!=0&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:"exportSettings.height must be even",path:["exportSettings","height"]})});function defaultVideoEditState(){return{clips:[],audioClips:[],canvas:{w:2,h:2},rotation:0,flipX:!1,flipY:!1,filters:DEFAULT_FILTERS,transitions:[],keepAudio:!0}}var MIN_CLIP=.1;function clipDuration(e){return e.out-e.in}function totalDuration(e){return e.reduce((e,t)=>e+clipDuration(t),0)}function clipStartsAt(e,t){let o=0;for(let i=0;i<t&&i<e.length;i++)o+=clipDuration(e[i]);return o}function locateOutput(e,t){if(!e.length||t<0)return null;let o=0;for(let i=0;i<e.length;i++){const r=clipDuration(e[i]);if(t<o+r)return{idx:i,srcTime:e[i].in+(t-o)};o+=r}if(Math.abs(t-o)<1e-9||t<=o){const t=e.length-1;return{idx:t,srcTime:e[t].out}}return null}function splitAtOutput(e,t){const o=locateOutput(e,t);if(!o)return e;const i=e[o.idx];return o.srcTime<i.in+MIN_CLIP||o.srcTime>i.out-MIN_CLIP?e:[...e.slice(0,o.idx),{...i,out:o.srcTime},{...i,in:o.srcTime},...e.slice(o.idx+1)]}function removeClip(e,t){return e.length<=1||!e[t]?e:e.filter((e,o)=>o!==t)}function duplicateClip(e,t){const o=e[t];return o?[...e.slice(0,t+1),{...o},...e.slice(t+1)]:e}function reorderClips(e,t,o){if(t===o||!e[t]||o<0||o>=e.length)return e;const i=[...e],[r]=i.splice(t,1);return i.splice(o,0,r),i}function trimClipEdge(e,t,o,i,r){if(!e[t])return e;const a=e.map(e=>({...e}));return"in"===o?a[t].in=Math.min(Math.max(i,0),a[t].out-MIN_CLIP):a[t].out=Math.max(Math.min(i,r),a[t].in+MIN_CLIP),a}function clampAudioClip(e,t,o){const i=Math.max(Math.min(e.out,t),MIN_CLIP),r=Math.min(Math.max(e.in,0),i-MIN_CLIP),a=Math.min(Math.max(e.startAt,0),Math.max(0,o-MIN_CLIP));return{...e,in:r,out:i,startAt:a}}function contentDuration(e,t=[]){const o=totalDuration(e),i=t.reduce((e,t)=>Math.max(e,t.startAt+(t.out-t.in)/Math.max(.01,t.speed??1)),0);return Math.max(o,i)}function usedVideoSrcIndices(e){return[...new Set(e.map(e=>e.srcIdx))].sort((e,t)=>e-t)}function remapSrcIndices(e,t){const o=new Map(t.map((e,t)=>[e,t]));return e.map(e=>({...e,srcIdx:o.get(e.srcIdx)??0}))}var DEG2RAD=Math.PI/180;function rotatedSize(e,t,o){const i=normalizeDeg(o);if(0===i||180===i)return{w:e,h:t};if(90===i||270===i)return{w:t,h:e};const r=i*DEG2RAD;return{w:Math.round(Math.abs(e*Math.cos(r))+Math.abs(t*Math.sin(r))),h:Math.round(Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)))}}function normalizeDeg(e){return(e%360+360)%360}function evenize(e){const t=Math.round(e);return t-t%2}function clampRect(e,t,o=40){const i=Math.min(Math.max(o,e.width),t.w),r=Math.min(Math.max(o,e.height),t.h),a=Math.min(Math.max(0,e.x),t.w-i),n=Math.min(Math.max(0,e.y),t.h-r);return{x:Math.round(a),y:Math.round(n),width:Math.round(i),height:Math.round(r)}}function centeredMaxRect(e,t){let o=e.w,i=o/t;return i>e.h&&(i=e.h,o=i*t),{x:Math.round((e.w-o)/2),y:Math.round((e.h-i)/2),width:Math.round(o),height:Math.round(i)}}function fitRects(e,t,o){const i={x:0,y:0,width:e.width,height:e.height},r={x:0,y:0,width:t.w,height:t.h};return"cover"===o?{src:centeredMaxRect({w:e.width,h:e.height},t.w/t.h),dst:r}:"contain"===o?{src:i,dst:centeredMaxRect({w:t.w,h:t.h},e.width/e.height)}:{src:i,dst:r}}function outputSize(e,t){if(t.scale)return{w:evenize(t.scale.width),h:evenize(t.scale.height)};if(t.crop)return{w:evenize(t.crop.width),h:evenize(t.crop.height)};const o=rotatedSize(e.w,e.h,t.rotation);return{w:evenize(o.w),h:evenize(o.h)}}var FILTER_PRESETS=[{id:"bw",label:"黑白",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"复古",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"暖阳",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"冷调",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"鲜艳",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function findFilterPreset(e){return e?FILTER_PRESETS.find(t=>t.id===e):void 0}function buildFilterCss(e,t){const o=findFilterPreset(t)?.css??"",i=e.temperature??0,r=e.tint??0,a=e.vibrance??0,n=e.gamma??0,s=e.sharpen??0,l=e.clarity??0;return[`brightness(${1+e.brightness})`,`contrast(${1+e.contrast})`,`saturate(${1+e.saturation})`,o,a?`saturate(${(1+.65*a).toFixed(3)})`:"",i>0?`sepia(${Math.min(.36,.28*i).toFixed(3)})`:"",i?`hue-rotate(${(14*-i).toFixed(2)}deg)`:"",r?`hue-rotate(${(10*r).toFixed(2)}deg)`:"",n?`brightness(${(1+.08*n).toFixed(3)})`:"",l||s?`contrast(${(1+.16*l+.1*s).toFixed(3)})`:""].filter(Boolean).join(" ")}function isOverlayHidden(e){return Boolean(e.hidden)}function overlayTrack(e,t){const o=Number(e.timelineTrack);return Number.isFinite(o)?Math.max(0,Math.round(o)):t}function overlayLayerRenderOrder(e){return e.map((e,t)=>({overlay:e,index:t,track:overlayTrack(e,t)})).sort((e,t)=>t.track-e.track||e.index-t.index).map(e=>e.overlay)}function rotationFilters(e){const t=normalizeDeg(e);if(0===t)return[];if(90===t)return["transpose=1"];if(180===t)return["transpose=1","transpose=1"];if(270===t)return["transpose=2"];const o=`${t}*PI/180`;return[`rotate=${o}:ow=rotw(${o}):oh=roth(${o}):c=black`]}function clampInt(e,t,o,i){const r=Math.round(Number(e));return Number.isFinite(r)?Math.min(o,Math.max(t,r)):i}function evenExportSize(e,t){const o=clampInt(e,2,8192,t);return o%2==0?o:o-1}function exportSettingsOf(e){return e.exportSettings??void 0}function exportFormat(e){const t=String(exportSettingsOf(e)?.format??"mp4").toLowerCase();return"mov"===t||"mxf"===t?t:"mp4"}function exportFrameRate(e){return clampInt(exportSettingsOf(e)?.frameRate,12,120,30)}function exportOutputSize(e){const t=outputSize(e.canvas,e),o=exportSettingsOf(e);if(!o)return t;const i=Number.isFinite(Number(o.width))&&Number(o.width)>0,r=Number.isFinite(Number(o.height))&&Number(o.height)>0;if(!i&&!r)return t;const a=t.w>0&&t.h>0?t.w/t.h:1;if(i&&r)return{w:evenExportSize(o.width,t.w),h:evenExportSize(o.height,t.h)};if(i){const e=evenExportSize(o.width,t.w);return{w:e,h:evenExportSize(e/a,t.h)}}const n=evenExportSize(o.height,t.h);return{w:evenExportSize(n*a,t.w),h:n}}function exportScaleFilters(e){const t=outputSize(e.canvas,e),o=exportOutputSize(e);return o.w===t.w&&o.h===t.h?[]:[`scale=${o.w}:${o.h}`]}function videoBitrateKbps(e){const t=Number(exportSettingsOf(e)?.videoBitrateKbps);return Number.isFinite(t)&&t>=100?Math.round(t):0}function audioBitrateKbps(e){const t=Number(exportSettingsOf(e)?.audioBitrateKbps);return Number.isFinite(t)&&t>=32?Math.round(t):0}function audioCodecArg(e){return"mp3"===exportSettingsOf(e)?.audioCodec?"libmp3lame":"aac"}function ffmpegPadColor(e){if("string"!=typeof e)return"0x000000";const t=e.trim(),o=t.match(/^#?([0-9a-fA-F]{3})$/);if(o)return`0x${o[1].split("").map(e=>e+e).join("").toLowerCase()}`;const i=t.match(/^#?([0-9a-fA-F]{6})$/);return i?`0x${i[1].toLowerCase()}`:"0x000000"}function eqFilter(e){const{brightness:t,contrast:o,saturation:i}=e,r=e.gamma??0,a=e.temperature??0,n=e.tint??0,s=e.vibrance??0,l=e.highlights??0,d=e.shadows??0,p=e.whites??0,u=e.blacks??0,c=e.lightSense??0;if(0===t&&0===o&&0===i&&0===r&&0===a&&0===n&&0===s&&0===l&&0===d&&0===p&&0===u&&0===c)return null;const m=[],h=t+.08*l+.06*d+.05*p-.05*u+.08*c,v=o+.08*p+.08*u,f=i+.65*s;0!==h&&m.push(`brightness=${h.toFixed(3)}`),0!==v&&m.push(`contrast=${(1+v).toFixed(3)}`),0!==f&&m.push(`saturation=${(1+f).toFixed(3)}`),0!==r&&m.push(`gamma=${(1+r*(r>0?1:.5)).toFixed(3)}`);const z=m.length?[`eq=${m.join(":")}`]:[];return 0===a&&0===n||z.push(`colorbalance=rs=${(.18*a+.08*n).toFixed(3)}:gs=${(.02*a-.04*n).toFixed(3)}:bs=${(.18*-a-.08*n).toFixed(3)}`),z.join(",")}function audioClipOutputDuration(e){return Math.max(.001,(e.out-e.in)/Math.max(.01,e.speed??1))}function isClipHidden(e){return Boolean(e.hidden)}function clipVideoFilter(e,t,o,i,r,a){return isClipHidden(t)?`color=c=black:s=${i}x${r}:r=${a}:d=${Math.max(.001,t.out-t.in)},setsar=1,format=yuv420p[v${o}]`:`[${e}:v]trim=start=${t.in}:end=${t.out},setpts=PTS-STARTPTS,scale=${i}:${r}:force_original_aspect_ratio=increase,crop=${i}:${r},setsar=1,fps=${a},format=yuv420p[v${o}]`}function musicClipFilter(e,t,o,i){const r=Math.min(2,Math.max(.5,t.speed??1)),a=audioClipOutputDuration(t),n=Math.min(Math.max(0,t.fadeIn??0),a),s=Math.min(Math.max(0,t.fadeOut??0),a),l=[`atrim=start=${t.in}:end=${t.out}`,"asetpts=PTS-STARTPTS"];return Math.abs(r-1)>.001&&l.push(`atempo=${r.toFixed(3)}`),n>0&&l.push(`afade=t=in:st=0:d=${n.toFixed(3)}`),s>0&&l.push(`afade=t=out:st=${Math.max(0,a-s).toFixed(3)}:d=${s.toFixed(3)}`),l.push(`volume=${t.volume}`,AFORMAT,`adelay=${o}|${o}`),`${e}${l.join(",")}[${i}]`}function buildVideoFilters(e,t={}){const o=[];if(e.flipX&&o.push("hflip"),e.flipY&&o.push("vflip"),o.push(...rotationFilters(e.rotation)),e.crop){const{x:t,y:i,width:r,height:a}=e.crop;o.push(`crop=${r}:${a}:${t}:${i}`)}if(e.scale){const{width:t,height:i,fit:r}=e.scale;"force"===r?o.push(`scale=${t}:${i}`):"cover"===r?o.push(`scale=${t}:${i}:force_original_aspect_ratio=increase`,`crop=${t}:${i}`):o.push(`scale=${t}:${i}:force_original_aspect_ratio=decrease`,`pad=${t}:${i}:(ow-iw)/2:(oh-ih)/2:${ffmpegPadColor(e.scale.backgroundColor)}`)}const i=eqFilter(e.filters);i&&o.push(i);const r=findFilterPreset(e.filterPreset);return r&&o.push(r.vf),!1!==t.includeExportScale&&o.push(...exportScaleFilters(e)),o.push(`fps=${exportFrameRate(e)}`),normalizeDeg(e.rotation)%90==0||e.scale||o.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),o}function codecArgs(e,t){const o=exportFormat(t),i="mxf"===o?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],r=videoBitrateKbps(t);if(r>0?i.push("-b:v",`${r}k`,"-maxrate",`${r}k`,"-bufsize",`${Math.max(2*r,512)}k`):"mxf"===o&&i.push("-q:v","2"),e)if("mxf"===o)i.push("-c:a","pcm_s16le");else{i.push("-c:a",audioCodecArg(t));const e=audioBitrateKbps(t);e>0&&i.push("-b:a",`${e}k`)}return"mxf"===o&&i.push("-f","mxf"),i}var AFORMAT="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",ANULL="anullsrc=r=44100:cl=stereo";function declick(e){return e>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round(1e3*(e-.01))/1e3}:d=0.01`:""}var LIMITER="alimiter=limit=0.95:level=disabled:latency=1";function timedOverlayRanges(e,t=Number.POSITIVE_INFINITY){const o=[];for(const i of e??[]){if(isOverlayHidden(i))continue;if("adjust"===i.type)continue;const e=Number(i.startAt),r=Number(i.endAt);if(Number.isFinite(e)&&Number.isFinite(r)&&!(r<=e)&&(o.push({startAt:Math.max(0,e),endAt:Math.max(e+.01,r)}),o.length>=t))break}return o}function evenFloor(e,t=2){const o=Math.max(t,Math.floor(Number(e)||t));return o%2==0?o:o-1}function timedEffectRange(e){const t=Number.isFinite(e.startAt)?Math.max(0,Number(e.startAt)):0,o=Number(e.endAt);return Number.isFinite(o)?{startAt:t,endAt:Math.max(t+.1,o)}:{startAt:t,endAt:t+3}}function adjustmentOverlayFilters(e){const t=eqFilter({...DEFAULT_FILTERS,...e}),o=findFilterPreset(e.filterPreset);return[t,o?.vf].filter(e=>Boolean(e))}function adjustmentRect(e,t){const o=Math.max(2,evenFloor(t.w)),i=Math.max(2,evenFloor(t.h)),r=Math.max(0,Math.min(o-2,evenFloor(e.x,0))),a=Math.max(0,Math.min(i-2,evenFloor(e.y,0))),n=Math.min(o-r,Math.max(2,evenFloor(e.w))),s=Math.min(i-a,Math.max(2,evenFloor(e.h)));return n<=1||s<=1?null:{x:r,y:a,w:n,h:s}}function timedAdjustmentEffects(e,t){const o=[];for(const i of e??[]){if(isOverlayHidden(i))continue;if("adjust"!==i.type)continue;const e=adjustmentRect(i,t);if(!e)continue;const r=adjustmentOverlayFilters(i);r.length&&o.push({rect:e,filters:r,...timedEffectRange(i)})}return o}function appendTimedOverlayFilters(e,t,o,i){let r=t;return i.forEach((t,i)=>{const a=`[vtimed${o+i}]`;e.push(`${r}[${o+i}:v]overlay=0:0:enable='between(t,${t.startAt.toFixed(3)},${t.endAt.toFixed(3)})'${a}`),r=a}),r}function appendTimedAdjustmentFilters(e,t,o){let i=t;return o.forEach((t,o)=>{const r=`[vadjsrc${o}]`,a=`[vadjbase${o}]`,n=`[vadjcrop${o}]`,s=`[vadj${o}]`,{rect:l}=t;e.push(`${i}split=2${r}${a}`),e.push(`${r}crop=${l.w}:${l.h}:${l.x}:${l.y},${t.filters.join(",")}${n}`),e.push(`${a}${n}overlay=${l.x}:${l.y}:enable='between(t,${t.startAt.toFixed(3)},${t.endAt.toFixed(3)})'${s}`),i=s}),i}function overlayEnableExpr(e){const t=Number(e.startAt),o=Number(e.endAt);return!Number.isFinite(t)||!Number.isFinite(o)||o<=t?"":`:enable='between(t,${Math.max(0,t).toFixed(3)},${Math.max(t+.01,o).toFixed(3)})'`}function appendAdjustmentFilter(e,t,o,i){const r=`[${i}src]`,a=`[${i}base]`,n=`[${i}crop]`,s=`[${i}]`,{rect:l}=o;return e.push(`${t}split=2${r}${a}`),e.push(`${r}crop=${l.w}:${l.h}:${l.x}:${l.y},${o.filters.join(",")}${n}`),e.push(`${a}${n}overlay=${l.x}:${l.y}:enable='between(t,${o.startAt.toFixed(3)},${o.endAt.toFixed(3)})'${s}`),s}function appendLayeredOverlayFilters(e,t,o,i,r,a,n){let s=t,l=0,d=0;for(const t of overlayLayerRenderOrder(i??[])){if(isOverlayHidden(t))continue;if("adjust"===t.type){const o=adjustmentRect(t,a),i=adjustmentOverlayFilters(t);if(!o||!i.length)continue;s=appendAdjustmentFilter(e,s,{rect:o,filters:i,...timedEffectRange(t)},`v${n}adj${d}`),d++;continue}if(l>=r){l++;continue}const i=`[v${n}lay${l}]`;e.push(`${s}[${o+l}:v]overlay=0:0${overlayEnableExpr(t)}${i}`),s=i,l++}return s}function buildSingleSourceArgs(e,t,o,i,r,a=[],n=[]){const s=buildVideoFilters(e,{includeExportScale:!1}),l=e.clips,d=e.keepAudio&&r,p=l.length>=2,u=l.some(isClipHidden),c=exportFrameRate(e),m=n.length>0,h=m?[]:timedOverlayRanges(e.overlays,a.length),v=m?[]:a.slice(0,h.length),f=m?n:[],z=m?[]:timedAdjustmentEffects(e.overlays,outputSize(e.canvas,e));if(p||u||i||v.length||f.length||z.length){const r=[];let a;if(p){l.forEach((t,o)=>{r.push(clipVideoFilter(0,t,o,e.canvas.w,e.canvas.h,c)),d&&r.push(`[0:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${declick(t.out-t.in)}[a${o}]`)});const t=l.map((e,t)=>d?`[v${t}][a${t}]`:`[v${t}]`).join(""),o=d?"[vcat][acat]":"[vcat]";r.push(`${t}concat=n=${l.length}:v=1:a=${d?1:0}${o}`),a="[vcat]"}else u?(r.push(clipVideoFilter(0,l[0],0,e.canvas.w,e.canvas.h,c)),a="[v0]"):a="[0:v]";s.length&&(r.push(`${a}${s.join(",")}[vflt]`),a="[vflt]"),f.length?(i&&(r.push(`${a}[1:v]overlay=0:0[vlegacy]`),a="[vlegacy]"),a=appendLayeredOverlayFilters(r,a,1+(i?1:0),e.overlays,f.length,outputSize(e.canvas,e),"s")):z.length&&(a=appendTimedAdjustmentFilters(r,a,z)),!f.length&&i?(r.push(`${a}[1:v]overlay=0:0[vout]`),a="[vout]"):"[0:v]"===a&&(r.push("[0:v]null[vout]"),a="[vout]"),v.length&&(a=appendTimedOverlayFilters(r,a,1+(i?1:0),h));const n=exportScaleFilters(e);n.length&&(r.push(`${a}${n.join(",")}[vscaled]`),a="[vscaled]");const m=[];p||1!==l.length||m.push("-ss",String(l[0].in),"-t",String(l[0].out-l[0].in));const g=["-y",...m,"-i",t];i&&g.push("-i",i);for(const e of f)g.push("-i",e);for(const e of v)g.push("-i",e);return g.push("-filter_complex",r.join(";"),"-map",a),d&&g.push("-map",p?"[acat]":"0:a?"),g.push(...codecArgs(d,e)),g.push(o),g}const g=["-ss",String(l[0].in),"-t",String(l[0].out-l[0].in)],x=buildVideoFilters(e),b=["-y",...g,"-i",t];return x.length&&b.push("-vf",x.join(",")),d||b.push("-an"),b.push(...codecArgs(d,e)),b.push(o),b}function buildFfmpegArgs(e,t,o){const{videoPaths:i,videoHasAudio:r,audioPaths:a,overlayPath:n,textOverlayPaths:s=[],overlayLayerPaths:l=[]}=t,d=(e.audioClips??[]).filter(e=>!e.muted),p=l.length>0,u=p?[]:timedOverlayRanges(e.overlays,s.length),c=p?[]:s.slice(0,u.length),m=p?l:[],h=p?[]:timedAdjustmentEffects(e.overlays,outputSize(e.canvas,e));if(1===i.length&&0===d.length)return buildSingleSourceArgs(e,i[0],o,n,r[0]??!1,c,m);const v=i.length,f=a.length,z=e.canvas.w,g=e.canvas.h,x=e.clips,b=e.keepAudio&&x.some(e=>r[e.srcIdx]),S=exportFrameRate(e),y=x.reduce((e,t)=>e+(t.out-t.in),0),T=[];x.forEach((e,t)=>{T.push(clipVideoFilter(e.srcIdx,e,t,z,g,S)),b&&(r[e.srcIdx]?T.push(`[${e.srcIdx}:a]atrim=start=${e.in}:end=${e.out},asetpts=PTS-STARTPTS${declick(e.out-e.in)},${AFORMAT}[a${t}]`):T.push(`${ANULL},atrim=start=0:end=${e.out-e.in},asetpts=PTS-STARTPTS,${AFORMAT}[a${t}]`))});const $=x.map((e,t)=>b?`[v${t}][a${t}]`:`[v${t}]`).join("");T.push(`${$}concat=n=${x.length}:v=1:a=${b?1:0}${b?"[vcat][acat]":"[vcat]"}`);let R=b?"[acat]":"";if(!b&&d.length&&(T.push(`${ANULL},atrim=start=0:end=${y},asetpts=PTS-STARTPTS,${AFORMAT}[acat]`),R="[acat]"),d.length){d.forEach((e,t)=>{const o=Math.max(0,Math.round(1e3*e.startAt));T.push(musicClipFilter(`[${v+e.srcIdx}:a]`,e,o,`mu${t}`))});const e=`${R}${d.map((e,t)=>`[mu${t}]`).join("")}`;T.push(`${e}amix=inputs=${1+d.length}:duration=first:dropout_transition=0:normalize=0,${LIMITER}[aout]`),R="[aout]"}let A="[vcat]";const E=buildVideoFilters(e,{includeExportScale:!1});E.length&&(T.push(`${A}${E.join(",")}[vflt]`),A="[vflt]"),m.length?(n&&(T.push(`${A}[${v+f}:v]overlay=0:0[vlegacy]`),A="[vlegacy]"),A=appendLayeredOverlayFilters(T,A,v+f+(n?1:0),e.overlays,m.length,outputSize(e.canvas,e),"m")):h.length&&(A=appendTimedAdjustmentFilters(T,A,h)),!m.length&&n&&(T.push(`${A}[${v+f}:v]overlay=0:0[vout]`),A="[vout]"),c.length&&(A=appendTimedOverlayFilters(T,A,v+f+(n?1:0),u));const F=exportScaleFilters(e);F.length&&(T.push(`${A}${F.join(",")}[vscaled]`),A="[vscaled]");const w=["-y"];for(const e of i)w.push("-i",e);for(const e of a)w.push("-i",e);n&&w.push("-i",n);for(const e of m)w.push("-i",e);for(const e of c)w.push("-i",e);w.push("-filter_complex",T.join(";"),"-map",A);const P=!!R;return P&&w.push("-map",R),w.push(...codecArgs(P,e)),P&&w.push("-ar","44100","-ac","2"),w.push(o),w}function buildPosterArgs(e,t,o){return["-y","-ss",String(t),"-i",e,"-frames:v","1","-q:v","2",o]}var MAX_DEPTH=100;function createHistory(e){return{past:[],present:e,future:[]}}function pushHistory(e,t){if(t===e.present)return e;const o=[...e.past,e.present];return o.length>MAX_DEPTH&&o.shift(),{past:o,present:t,future:[]}}function replacePresent(e,t){return t===e.present?e:{...e,present:t}}function canUndo(e){return e.past.length>0}function canRedo(e){return e.future.length>0}function undo(e){return canUndo(e)?{past:e.past.slice(0,-1),present:e.past[e.past.length-1],future:[e.present,...e.future]}:e}function redo(e){if(!canRedo(e))return e;const[t,...o]=e.future;return{past:[...e.past,e.present],present:t,future:o}}var zh={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.posterCors":"封面渲染失败:视频或贴纸服务器未允许跨域读取(CORS)","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},en={"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","tune.temperature":"Temperature","tune.tint":"Tint","tune.vibrance":"Vibrance","tune.highlights":"Highlights","tune.shadows":"Shadows","tune.whites":"Whites","tune.blacks":"Blacks","tune.lightSense":"Light","tune.sharpen":"Sharpen","tune.clarity":"Clarity","tune.grain":"Grain","tune.fade":"Fade","tune.vignette":"Vignette","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.fontSize":"Size","overlay.font":"Font","overlay.align":"Align","overlay.background":"Background","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add → drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Wide 1.91:1","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting…","act.poster":"🖼 Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"← Change image","act.changeVideo":"← Change file","crop.rotateLeft":"↺ Rotate left","crop.flipX":"⇋ Flip horizontal","crop.flipY":"⇵ Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.posterCors":"Failed to render cover: the video or sticker server does not allow cross-origin access (CORS)","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting…","msg.exportPrepare":"Preparing media…","msg.exportUpload":"Uploading media…","msg.exportEncode":"Encoding video…","msg.exportDownload":"Receiving result…","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done ✓","msg.loading":"Loading media…","msg.exported":"Exported: ","msg.saving":"Saving…","msg.saved":"Saved to drive ✓","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"↔ Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"· center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"♪ Audio track (+ on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"⇧ F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video — crop · filters · text · export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot · videos: trim/mute/cover"},es={"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporción","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturación","tune.gamma":"Gamma","tune.temperature":"Temperatura","tune.tint":"Tinte","tune.vibrance":"Intensidad","tune.highlights":"Altas luces","tune.shadows":"Sombras","tune.whites":"Blancos","tune.blacks":"Negros","tune.lightSense":"Luz","tune.sharpen":"Enfoque","tune.clarity":"Claridad","tune.grain":"Grano","tune.fade":"Desvanecer","tune.vignette":"Viñeta","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"Línea","overlay.arrow":"Flecha","overlay.rect":"Rectángulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.fontSize":"Tamaño","overlay.font":"Fuente","overlay.align":"Alinear","overlay.background":"Fondo","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para añadirlo → arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"Cálido","filter.cool":"Frío","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Panorámico 1.91:1","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar música","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando…","act.poster":"🖼 Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"← Cambiar imagen","act.changeVideo":"← Cambiar archivo","crop.rotateLeft":"↺ Girar a la izquierda","crop.flipX":"⇋ Voltear horizontal","crop.flipY":"⇵ Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con música; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir línea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar línea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"Añadir clip de vídeo","tip.addAudio":"Añadir música (archivo de audio o vídeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar después)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporción","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de vídeo","err.maxVideo":"Máximo {max} vídeos","err.videoLoad":"No se pudo cargar el vídeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un vídeo con sonido (se extrae automáticamente)","err.maxAudio":"Máximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.posterCors":"No se pudo renderizar la portada: el servidor de vídeo o stickers no permite el acceso entre orígenes (CORS)","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o vídeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando…","msg.exportPrepare":"Preparando medios…","msg.exportUpload":"Subiendo medios…","msg.exportEncode":"Codificando video…","msg.exportDownload":"Recibiendo resultado…","msg.exportingHint":"Espera un momento. El resultado se devolverá automáticamente al finalizar.","msg.done":"Listo ✓","msg.loading":"Cargando medios…","msg.exported":"Exportado: ","msg.saving":"Guardando…","msg.saved":"Guardado en disco ✓","lbl.ratioSection":"Proporción de imagen (recorte, sin deformar)","lbl.dragToReposition":"↔ Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tamaño de exportación (px; recorte cover centrado si la proporción difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tamaño","lbl.noScale":"(sin escala)","lbl.coverNote":"· recorte centrado (cover) cuando la proporción difiere, sin deformar","lbl.audioTrackHint":"♪ Pista de audio (+ a la derecha para añadir música, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportación usa el valor definido)","lbl.music":"Música","kbd.fit":"⇧ F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / vídeo — recorta · filtros · texto · exporta","panel.pick":"Haz clic para elegir una imagen o vídeo","panel.pickHint":"Imágenes con Filerobot · vídeos: cortar/silenciar/portada"},ZH_HANT_MAP={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},toHant=e=>{let t=e;for(const[e,o]of Object.entries(ZH_HANT_MAP).sort((e,t)=>t[0].length-e[0].length))t=t.replaceAll(e,o);return t},zhHant=Object.fromEntries(Object.entries(zh).map(([e,t])=>[e,toHant(t)])),EDITOR_MESSAGES={zh:zh,en:en,es:es,"zh-Hant":zhHant};function tEditor(e,t,o){let i=EDITOR_MESSAGES[e]?.[t]??EDITOR_MESSAGES.zh[t]??t;if(o)for(const[e,t]of Object.entries(o))i=i.replaceAll(`{${e}}`,String(t));return i}var DEFAULT_PLATFORM_TARGETS=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],RATIO_LABEL={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function parseRatio(e){const[t,o]=e.split(":").map(Number);return t&&o?t/o:1}function dedupePresets(e){const t=new Set,o=[];for(const i of e)i&&!t.has(i)&&(t.add(i),o.push({ratio:i,value:parseRatio(i),label:RATIO_LABEL[i]??i}));return o}var IMAGE_RATIO_PRESETS=dedupePresets(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),VIDEO_RATIO_PRESETS=dedupePresets(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]);function buildVideoPlatformRatioPresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Set,o=[];for(const i of e){if(!i.videoRatio)continue;const e=`${i.platform}:${i.postType}:${i.videoRatio}`;if(t.has(e))continue;t.add(e);const r=i.label.split(" ").slice(0,-1).join(" ")||i.label;o.push({platform:i.platform,postType:i.postType,label:`${r} ${i.videoRatio}`,ratio:i.videoRatio,value:parseRatio(i.videoRatio)})}return o}var VIDEO_PLATFORM_RATIO_PRESETS=buildVideoPlatformRatioPresets();function buildImagePlatformPresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Map;for(const o of e){const e=t.get(o.platform);(!e||"post"!==e.postType&&"post"===o.postType)&&t.set(o.platform,o)}return Array.from(t.values()).map(e=>{const[t,o]=e.imageSize.split("x").map(Number),i=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${i} ${e.ratio}`,ratio:e.ratio,value:parseRatio(e.ratio),w:t,h:o}})}var IMAGE_PLATFORM_PRESETS=buildImagePlatformPresets();function sizeOf(e,t){return e>=1?{w:2*Math.round(t*e/2),h:t}:{w:t,h:2*Math.round(t/e/2)}}function buildVideoSizePresets(e=DEFAULT_PLATFORM_TARGETS){const t=new Set,o=[];for(const i of e){if(!i.videoRatio||!i.videoResolution)continue;const e="1080p"===i.videoResolution?1080:720,{w:r,h:a}=sizeOf(parseRatio(i.videoRatio),e),n=`${r}x${a}`;t.has(n)||(t.add(n),o.push({label:`${i.shortLabel} ${r}×${a}`,w:r,h:a}))}return o}var VIDEO_SIZE_PRESETS=buildVideoSizePresets();function compensateAnnotationRotation(e,t){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const o=t.adjustments?.rotation??0;return o?{rotation:-o}:{}}exports.AudioClip=AudioClip,exports.Clip=Clip,exports.DEFAULT_FILTERS=DEFAULT_FILTERS,exports.DEFAULT_PLATFORM_TARGETS=DEFAULT_PLATFORM_TARGETS,exports.DEG2RAD=DEG2RAD,exports.EDITOR_MESSAGES=EDITOR_MESSAGES,exports.ExportSettings=ExportSettings,exports.FILTER_PRESETS=FILTER_PRESETS,exports.IMAGE_PLATFORM_PRESETS=IMAGE_PLATFORM_PRESETS,exports.IMAGE_RATIO_PRESETS=IMAGE_RATIO_PRESETS,exports.MIN_CLIP=MIN_CLIP,exports.Overlay=Overlay,exports.Transition=Transition,exports.VIDEO_PLATFORM_RATIO_PRESETS=VIDEO_PLATFORM_RATIO_PRESETS,exports.VIDEO_RATIO_PRESETS=VIDEO_RATIO_PRESETS,exports.VIDEO_SIZE_PRESETS=VIDEO_SIZE_PRESETS,exports.VideoEditState=VideoEditState,exports.buildFfmpegArgs=buildFfmpegArgs,exports.buildFilterCss=buildFilterCss,exports.buildImagePlatformPresets=buildImagePlatformPresets,exports.buildPosterArgs=buildPosterArgs,exports.buildVideoPlatformRatioPresets=buildVideoPlatformRatioPresets,exports.buildVideoSizePresets=buildVideoSizePresets,exports.canRedo=canRedo,exports.canUndo=canUndo,exports.centeredMaxRect=centeredMaxRect,exports.clampAudioClip=clampAudioClip,exports.clampRect=clampRect,exports.clipDuration=clipDuration,exports.clipStartsAt=clipStartsAt,exports.compensateAnnotationRotation=compensateAnnotationRotation,exports.contentDuration=contentDuration,exports.createHistory=createHistory,exports.defaultVideoEditState=defaultVideoEditState,exports.duplicateClip=duplicateClip,exports.evenize=evenize,exports.findFilterPreset=findFilterPreset,exports.fitRects=fitRects,exports.locateOutput=locateOutput,exports.normalizeDeg=normalizeDeg,exports.outputSize=outputSize,exports.parseRatio=parseRatio,exports.pushHistory=pushHistory,exports.redo=redo,exports.remapSrcIndices=remapSrcIndices,exports.removeClip=removeClip,exports.reorderClips=reorderClips,exports.replacePresent=replacePresent,exports.rotatedSize=rotatedSize,exports.splitAtOutput=splitAtOutput,exports.tEditor=tEditor,exports.toHant=toHant,exports.totalDuration=totalDuration,exports.trimClipEdge=trimClipEdge,exports.undo=undo,exports.usedVideoSrcIndices=usedVideoSrcIndices;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{outputSize as t,isOverlayHidden as e,findFilterPreset as n,normalizeDeg as s,overlayLayerRenderOrder as o}from"./chunk-VDEZTXEA.js";export{DEG2RAD,FILTER_PRESETS,buildFilterCss,centeredMaxRect,clampRect,evenize,findFilterPreset,fitRects,normalizeDeg,outputSize,rotatedSize}from"./chunk-VDEZTXEA.js";export{MIN_CLIP,canRedo,canUndo,clampAudioClip,clipDuration,clipStartsAt,contentDuration,createHistory,duplicateClip,locateOutput,pushHistory,redo,remapSrcIndices,removeClip,reorderClips,replacePresent,splitAtOutput,totalDuration,trimClipEdge,undo,usedVideoSrcIndices}from"./chunk-7D4QE3R2.js";import{DEFAULT_FILTERS as a}from"./chunk-7PSQLYXL.js";export{AudioClip,Clip,DEFAULT_FILTERS,ExportSettings,Overlay,Transition,VideoEditState,defaultVideoEditState}from"./chunk-7PSQLYXL.js";export{DEFAULT_PLATFORM_TARGETS,EDITOR_MESSAGES,IMAGE_PLATFORM_PRESETS,IMAGE_RATIO_PRESETS,VIDEO_PLATFORM_RATIO_PRESETS,VIDEO_RATIO_PRESETS,VIDEO_SIZE_PRESETS,buildImagePlatformPresets,buildVideoPlatformRatioPresets,buildVideoSizePresets,compensateAnnotationRotation,parseRatio,tEditor,toHant}from"./chunk-FAFKY4LX.js";function r(t,e,n,s){const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(n,Math.max(e,o)):s}function i(t,e){const n=r(t,2,8192,e);return n%2==0?n:n-1}function u(t){return t.exportSettings??void 0}function c(t){return r(u(t)?.frameRate,12,120,30)}function h(e){const n=t(e.canvas,e),s=function(e){const n=t(e.canvas,e),s=u(e);if(!s)return n;const o=Number.isFinite(Number(s.width))&&Number(s.width)>0,a=Number.isFinite(Number(s.height))&&Number(s.height)>0;if(!o&&!a)return n;const r=n.w>0&&n.h>0?n.w/n.h:1;if(o&&a)return{w:i(s.width,n.w),h:i(s.height,n.h)};if(o){const t=i(s.width,n.w);return{w:t,h:i(t/r,n.h)}}const c=i(s.height,n.h);return{w:i(c*r,n.w),h:c}}(e);return s.w===n.w&&s.h===n.h?[]:[`scale=${s.w}:${s.h}`]}function l(t){const{brightness:e,contrast:n,saturation:s}=t,o=t.gamma??0,a=t.temperature??0,r=t.tint??0,i=t.vibrance??0,u=t.highlights??0,c=t.shadows??0,h=t.whites??0,l=t.blacks??0,p=t.lightSense??0;if(0===e&&0===n&&0===s&&0===o&&0===a&&0===r&&0===i&&0===u&&0===c&&0===h&&0===l&&0===p)return null;const $=[],f=e+.08*u+.06*c+.05*h-.05*l+.08*p,m=n+.08*h+.08*l,d=s+.65*i;0!==f&&$.push(`brightness=${f.toFixed(3)}`),0!==m&&$.push(`contrast=${(1+m).toFixed(3)}`),0!==d&&$.push(`saturation=${(1+d).toFixed(3)}`),0!==o&&$.push(`gamma=${(1+o*(o>0?1:.5)).toFixed(3)}`);const v=$.length?[`eq=${$.join(":")}`]:[];return 0===a&&0===r||v.push(`colorbalance=rs=${(.18*a+.08*r).toFixed(3)}:gs=${(.02*a-.04*r).toFixed(3)}:bs=${(.18*-a-.08*r).toFixed(3)}`),v.join(",")}function p(t){return Boolean(t.hidden)}function $(t,e,n,s,o,a){return p(e)?`color=c=black:s=${s}x${o}:r=${a}:d=${Math.max(.001,e.out-e.in)},setsar=1,format=yuv420p[v${n}]`:`[${t}:v]trim=start=${e.in}:end=${e.out},setpts=PTS-STARTPTS,scale=${s}:${o}:force_original_aspect_ratio=increase,crop=${s}:${o},setsar=1,fps=${a},format=yuv420p[v${n}]`}function f(t,e={}){const o=[];if(t.flipX&&o.push("hflip"),t.flipY&&o.push("vflip"),o.push(...function(t){const e=s(t);if(0===e)return[];if(90===e)return["transpose=1"];if(180===e)return["transpose=1","transpose=1"];if(270===e)return["transpose=2"];const n=`${e}*PI/180`;return[`rotate=${n}:ow=rotw(${n}):oh=roth(${n}):c=black`]}(t.rotation)),t.crop){const{x:e,y:n,width:s,height:a}=t.crop;o.push(`crop=${s}:${a}:${e}:${n}`)}if(t.scale){const{width:e,height:n,fit:s}=t.scale;"force"===s?o.push(`scale=${e}:${n}`):"cover"===s?o.push(`scale=${e}:${n}:force_original_aspect_ratio=increase`,`crop=${e}:${n}`):o.push(`scale=${e}:${n}:force_original_aspect_ratio=decrease`,`pad=${e}:${n}:(ow-iw)/2:(oh-ih)/2:${function(t){if("string"!=typeof t)return"0x000000";const e=t.trim(),n=e.match(/^#?([0-9a-fA-F]{3})$/);if(n)return`0x${n[1].split("").map(t=>t+t).join("").toLowerCase()}`;const s=e.match(/^#?([0-9a-fA-F]{6})$/);return s?`0x${s[1].toLowerCase()}`:"0x000000"}(t.scale.backgroundColor)}`)}const a=l(t.filters);a&&o.push(a);const r=n(t.filterPreset);return r&&o.push(r.vf),!1!==e.includeExportScale&&o.push(...h(t)),o.push(`fps=${c(t)}`),s(t.rotation)%90==0||t.scale||o.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),o}function m(t,e){const n=function(t){const e=String(u(t)?.format??"mp4").toLowerCase();return"mov"===e||"mxf"===e?e:"mp4"}(e),s="mxf"===n?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],o=function(t){const e=Number(u(t)?.videoBitrateKbps);return Number.isFinite(e)&&e>=100?Math.round(e):0}(e);if(o>0?s.push("-b:v",`${o}k`,"-maxrate",`${o}k`,"-bufsize",`${Math.max(2*o,512)}k`):"mxf"===n&&s.push("-q:v","2"),t)if("mxf"===n)s.push("-c:a","pcm_s16le");else{s.push("-c:a",function(t){return"mp3"===u(t)?.audioCodec?"libmp3lame":"aac"}(e));const t=function(t){const e=Number(u(t)?.audioBitrateKbps);return Number.isFinite(e)&&e>=32?Math.round(e):0}(e);t>0&&s.push("-b:a",`${t}k`)}return"mxf"===n&&s.push("-f","mxf"),s}var d="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",v="anullsrc=r=44100:cl=stereo";function x(t){return t>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round(1e3*(t-.01))/1e3}:d=0.01`:""}function g(t,n=Number.POSITIVE_INFINITY){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"===o.type)continue;const t=Number(o.startAt),a=Number(o.endAt);if(Number.isFinite(t)&&Number.isFinite(a)&&!(a<=t)&&(s.push({startAt:Math.max(0,t),endAt:Math.max(t+.01,a)}),s.length>=n))break}return s}function b(t,e=2){const n=Math.max(e,Math.floor(Number(t)||e));return n%2==0?n:n-1}function S(t){const e=Number.isFinite(t.startAt)?Math.max(0,Number(t.startAt)):0,n=Number(t.endAt);return Number.isFinite(n)?{startAt:e,endAt:Math.max(e+.1,n)}:{startAt:e,endAt:e+3}}function A(t){const e=l({...a,...t}),s=n(t.filterPreset);return[e,s?.vf].filter(t=>Boolean(t))}function y(t,e){const n=Math.max(2,b(e.w)),s=Math.max(2,b(e.h)),o=Math.max(0,Math.min(n-2,b(t.x,0))),a=Math.max(0,Math.min(s-2,b(t.y,0))),r=Math.min(n-o,Math.max(2,b(t.w))),i=Math.min(s-a,Math.max(2,b(t.h)));return r<=1||i<=1?null:{x:o,y:a,w:r,h:i}}function T(t,n){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"!==o.type)continue;const t=y(o,n);if(!t)continue;const a=A(o);a.length&&s.push({rect:t,filters:a,...S(o)})}return s}function E(t,e,n,s){let o=e;return s.forEach((e,s)=>{const a=`[vtimed${n+s}]`;t.push(`${o}[${n+s}:v]overlay=0:0:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${a}`),o=a}),o}function M(t,e,n){let s=e;return n.forEach((e,n)=>{const o=`[vadjsrc${n}]`,a=`[vadjbase${n}]`,r=`[vadjcrop${n}]`,i=`[vadj${n}]`,{rect:u}=e;t.push(`${s}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${e.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${i}`),s=i}),s}function F(t){const e=Number(t.startAt),n=Number(t.endAt);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?"":`:enable='between(t,${Math.max(0,e).toFixed(3)},${Math.max(e+.01,n).toFixed(3)})'`}function P(t,e,n,s){const o=`[${s}src]`,a=`[${s}base]`,r=`[${s}crop]`,i=`[${s}]`,{rect:u}=n;return t.push(`${e}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${n.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${n.startAt.toFixed(3)},${n.endAt.toFixed(3)})'${i}`),i}function w(t,n,s,a,r,i,u){let c=n,h=0,l=0;for(const n of o(a??[])){if(e(n))continue;if("adjust"===n.type){const e=y(n,i),s=A(n);if(!e||!s.length)continue;c=P(t,c,{rect:e,filters:s,...S(n)},`v${u}adj${l}`),l++;continue}if(h>=r){h++;continue}const o=`[v${u}lay${h}]`;t.push(`${c}[${s+h}:v]overlay=0:0${F(n)}${o}`),c=o,h++}return c}function _(e,n,s){const{videoPaths:o,videoHasAudio:a,audioPaths:r,overlayPath:i,textOverlayPaths:u=[],overlayLayerPaths:l=[]}=n,b=(e.audioClips??[]).filter(t=>!t.muted),S=l.length>0,A=S?[]:g(e.overlays,u.length),y=S?[]:u.slice(0,A.length),F=S?l:[],P=S?[]:T(e.overlays,t(e.canvas,e));if(1===o.length&&0===b.length)return function(e,n,s,o,a,r=[],i=[]){const u=f(e,{includeExportScale:!1}),l=e.clips,d=e.keepAudio&&a,v=l.length>=2,b=l.some(p),S=c(e),A=i.length>0,y=A?[]:g(e.overlays,r.length),F=A?[]:r.slice(0,y.length),P=A?i:[],_=A?[]:T(e.overlays,t(e.canvas,e));if(v||b||o||F.length||P.length||_.length){const a=[];let r;if(v){l.forEach((t,n)=>{a.push($(0,t,n,e.canvas.w,e.canvas.h,S)),d&&a.push(`[0:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)}[a${n}]`)});const t=l.map((t,e)=>d?`[v${e}][a${e}]`:`[v${e}]`).join(""),n=d?"[vcat][acat]":"[vcat]";a.push(`${t}concat=n=${l.length}:v=1:a=${d?1:0}${n}`),r="[vcat]"}else b?(a.push($(0,l[0],0,e.canvas.w,e.canvas.h,S)),r="[v0]"):r="[0:v]";u.length&&(a.push(`${r}${u.join(",")}[vflt]`),r="[vflt]"),P.length?(o&&(a.push(`${r}[1:v]overlay=0:0[vlegacy]`),r="[vlegacy]"),r=w(a,r,1+(o?1:0),e.overlays,P.length,t(e.canvas,e),"s")):_.length&&(r=M(a,r,_)),!P.length&&o?(a.push(`${r}[1:v]overlay=0:0[vout]`),r="[vout]"):"[0:v]"===r&&(a.push("[0:v]null[vout]"),r="[vout]"),F.length&&(r=E(a,r,1+(o?1:0),y));const i=h(e);i.length&&(a.push(`${r}${i.join(",")}[vscaled]`),r="[vscaled]");const c=[];v||1!==l.length||c.push("-ss",String(l[0].in),"-t",String(l[0].out-l[0].in));const p=["-y",...c,"-i",n];o&&p.push("-i",o);for(const t of P)p.push("-i",t);for(const t of F)p.push("-i",t);return p.push("-filter_complex",a.join(";"),"-map",r),d&&p.push("-map",v?"[acat]":"0:a?"),p.push(...m(d,e)),p.push(s),p}const R=["-ss",String(l[0].in),"-t",String(l[0].out-l[0].in)],j=f(e),I=["-y",...R,"-i",n];return j.length&&I.push("-vf",j.join(",")),d||I.push("-an"),I.push(...m(d,e)),I.push(s),I}(e,o[0],s,i,a[0]??!1,y,F);const _=o.length,R=r.length,j=e.canvas.w,I=e.canvas.h,N=e.clips,k=e.keepAudio&&N.some(t=>a[t.srcIdx]),L=c(e),O=N.reduce((t,e)=>t+(e.out-e.in),0),C=[];N.forEach((t,e)=>{C.push($(t.srcIdx,t,e,j,I,L)),k&&(a[t.srcIdx]?C.push(`[${t.srcIdx}:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)},${d}[a${e}]`):C.push(`${v},atrim=start=0:end=${t.out-t.in},asetpts=PTS-STARTPTS,${d}[a${e}]`))});const D=N.map((t,e)=>k?`[v${e}][a${e}]`:`[v${e}]`).join("");C.push(`${D}concat=n=${N.length}:v=1:a=${k?1:0}${k?"[vcat][acat]":"[vcat]"}`);let V=k?"[acat]":"";if(!k&&b.length&&(C.push(`${v},atrim=start=0:end=${O},asetpts=PTS-STARTPTS,${d}[acat]`),V="[acat]"),b.length){b.forEach((t,e)=>{const n=Math.max(0,Math.round(1e3*t.startAt));C.push(function(t,e,n,s){const o=Math.min(2,Math.max(.5,e.speed??1)),a=function(t){return Math.max(.001,(t.out-t.in)/Math.max(.01,t.speed??1))}(e),r=Math.min(Math.max(0,e.fadeIn??0),a),i=Math.min(Math.max(0,e.fadeOut??0),a),u=[`atrim=start=${e.in}:end=${e.out}`,"asetpts=PTS-STARTPTS"];return Math.abs(o-1)>.001&&u.push(`atempo=${o.toFixed(3)}`),r>0&&u.push(`afade=t=in:st=0:d=${r.toFixed(3)}`),i>0&&u.push(`afade=t=out:st=${Math.max(0,a-i).toFixed(3)}:d=${i.toFixed(3)}`),u.push(`volume=${e.volume}`,d,`adelay=${n}|${n}`),`${t}${u.join(",")}[${s}]`}(`[${_+t.srcIdx}:a]`,t,n,`mu${e}`))});const t=`${V}${b.map((t,e)=>`[mu${e}]`).join("")}`;C.push(`${t}amix=inputs=${1+b.length}:duration=first:dropout_transition=0:normalize=0,alimiter=limit=0.95:level=disabled:latency=1[aout]`),V="[aout]"}let z="[vcat]";const X=f(e,{includeExportScale:!1});X.length&&(C.push(`${z}${X.join(",")}[vflt]`),z="[vflt]"),F.length?(i&&(C.push(`${z}[${_+R}:v]overlay=0:0[vlegacy]`),z="[vlegacy]"),z=w(C,z,_+R+(i?1:0),e.overlays,F.length,t(e.canvas,e),"m")):P.length&&(z=M(C,z,P)),!F.length&&i&&(C.push(`${z}[${_+R}:v]overlay=0:0[vout]`),z="[vout]"),y.length&&(z=E(C,z,_+R+(i?1:0),A));const G=h(e);G.length&&(C.push(`${z}${G.join(",")}[vscaled]`),z="[vscaled]");const Y=["-y"];for(const t of o)Y.push("-i",t);for(const t of r)Y.push("-i",t);i&&Y.push("-i",i);for(const t of F)Y.push("-i",t);for(const t of y)Y.push("-i",t);Y.push("-filter_complex",C.join(";"),"-map",z);const B=!!V;return B&&Y.push("-map",V),Y.push(...m(B,e)),B&&Y.push("-ar","44100","-ac","2"),Y.push(s),Y}function R(t,e,n){return["-y","-ss",String(e),"-i",t,"-frames:v","1","-q:v","2",n]}export{_ as buildFfmpegArgs,R as buildPosterArgs};
|
|
1
|
+
import{outputSize as t,isOverlayHidden as e,findFilterPreset as n,normalizeDeg as s,overlayLayerRenderOrder as o}from"./chunk-EABJNGSW.js";export{DEG2RAD,FILTER_PRESETS,buildFilterCss,centeredMaxRect,clampRect,evenize,findFilterPreset,fitRects,normalizeDeg,outputSize,rotatedSize}from"./chunk-EABJNGSW.js";export{MIN_CLIP,canRedo,canUndo,clampAudioClip,clipDuration,clipStartsAt,contentDuration,createHistory,duplicateClip,locateOutput,pushHistory,redo,remapSrcIndices,removeClip,reorderClips,replacePresent,splitAtOutput,totalDuration,trimClipEdge,undo,usedVideoSrcIndices}from"./chunk-7D4QE3R2.js";import{DEFAULT_FILTERS as a}from"./chunk-7PSQLYXL.js";export{AudioClip,Clip,DEFAULT_FILTERS,ExportSettings,Overlay,Transition,VideoEditState,defaultVideoEditState}from"./chunk-7PSQLYXL.js";export{DEFAULT_PLATFORM_TARGETS,EDITOR_MESSAGES,IMAGE_PLATFORM_PRESETS,IMAGE_RATIO_PRESETS,VIDEO_PLATFORM_RATIO_PRESETS,VIDEO_RATIO_PRESETS,VIDEO_SIZE_PRESETS,buildImagePlatformPresets,buildVideoPlatformRatioPresets,buildVideoSizePresets,compensateAnnotationRotation,parseRatio,tEditor,toHant}from"./chunk-YFCBSEKB.js";function r(t,e,n,s){const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(n,Math.max(e,o)):s}function i(t,e){const n=r(t,2,8192,e);return n%2==0?n:n-1}function u(t){return t.exportSettings??void 0}function c(t){return r(u(t)?.frameRate,12,120,30)}function h(e){const n=t(e.canvas,e),s=function(e){const n=t(e.canvas,e),s=u(e);if(!s)return n;const o=Number.isFinite(Number(s.width))&&Number(s.width)>0,a=Number.isFinite(Number(s.height))&&Number(s.height)>0;if(!o&&!a)return n;const r=n.w>0&&n.h>0?n.w/n.h:1;if(o&&a)return{w:i(s.width,n.w),h:i(s.height,n.h)};if(o){const t=i(s.width,n.w);return{w:t,h:i(t/r,n.h)}}const c=i(s.height,n.h);return{w:i(c*r,n.w),h:c}}(e);return s.w===n.w&&s.h===n.h?[]:[`scale=${s.w}:${s.h}`]}function l(t){const{brightness:e,contrast:n,saturation:s}=t,o=t.gamma??0,a=t.temperature??0,r=t.tint??0,i=t.vibrance??0,u=t.highlights??0,c=t.shadows??0,h=t.whites??0,l=t.blacks??0,p=t.lightSense??0;if(0===e&&0===n&&0===s&&0===o&&0===a&&0===r&&0===i&&0===u&&0===c&&0===h&&0===l&&0===p)return null;const $=[],f=e+.08*u+.06*c+.05*h-.05*l+.08*p,m=n+.08*h+.08*l,d=s+.65*i;0!==f&&$.push(`brightness=${f.toFixed(3)}`),0!==m&&$.push(`contrast=${(1+m).toFixed(3)}`),0!==d&&$.push(`saturation=${(1+d).toFixed(3)}`),0!==o&&$.push(`gamma=${(1+o*(o>0?1:.5)).toFixed(3)}`);const v=$.length?[`eq=${$.join(":")}`]:[];return 0===a&&0===r||v.push(`colorbalance=rs=${(.18*a+.08*r).toFixed(3)}:gs=${(.02*a-.04*r).toFixed(3)}:bs=${(.18*-a-.08*r).toFixed(3)}`),v.join(",")}function p(t){return Boolean(t.hidden)}function $(t,e,n,s,o,a){return p(e)?`color=c=black:s=${s}x${o}:r=${a}:d=${Math.max(.001,e.out-e.in)},setsar=1,format=yuv420p[v${n}]`:`[${t}:v]trim=start=${e.in}:end=${e.out},setpts=PTS-STARTPTS,scale=${s}:${o}:force_original_aspect_ratio=increase,crop=${s}:${o},setsar=1,fps=${a},format=yuv420p[v${n}]`}function f(t,e={}){const o=[];if(t.flipX&&o.push("hflip"),t.flipY&&o.push("vflip"),o.push(...function(t){const e=s(t);if(0===e)return[];if(90===e)return["transpose=1"];if(180===e)return["transpose=1","transpose=1"];if(270===e)return["transpose=2"];const n=`${e}*PI/180`;return[`rotate=${n}:ow=rotw(${n}):oh=roth(${n}):c=black`]}(t.rotation)),t.crop){const{x:e,y:n,width:s,height:a}=t.crop;o.push(`crop=${s}:${a}:${e}:${n}`)}if(t.scale){const{width:e,height:n,fit:s}=t.scale;"force"===s?o.push(`scale=${e}:${n}`):"cover"===s?o.push(`scale=${e}:${n}:force_original_aspect_ratio=increase`,`crop=${e}:${n}`):o.push(`scale=${e}:${n}:force_original_aspect_ratio=decrease`,`pad=${e}:${n}:(ow-iw)/2:(oh-ih)/2:${function(t){if("string"!=typeof t)return"0x000000";const e=t.trim(),n=e.match(/^#?([0-9a-fA-F]{3})$/);if(n)return`0x${n[1].split("").map(t=>t+t).join("").toLowerCase()}`;const s=e.match(/^#?([0-9a-fA-F]{6})$/);return s?`0x${s[1].toLowerCase()}`:"0x000000"}(t.scale.backgroundColor)}`)}const a=l(t.filters);a&&o.push(a);const r=n(t.filterPreset);return r&&o.push(r.vf),!1!==e.includeExportScale&&o.push(...h(t)),o.push(`fps=${c(t)}`),s(t.rotation)%90==0||t.scale||o.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),o}function m(t,e){const n=function(t){const e=String(u(t)?.format??"mp4").toLowerCase();return"mov"===e||"mxf"===e?e:"mp4"}(e),s="mxf"===n?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],o=function(t){const e=Number(u(t)?.videoBitrateKbps);return Number.isFinite(e)&&e>=100?Math.round(e):0}(e);if(o>0?s.push("-b:v",`${o}k`,"-maxrate",`${o}k`,"-bufsize",`${Math.max(2*o,512)}k`):"mxf"===n&&s.push("-q:v","2"),t)if("mxf"===n)s.push("-c:a","pcm_s16le");else{s.push("-c:a",function(t){return"mp3"===u(t)?.audioCodec?"libmp3lame":"aac"}(e));const t=function(t){const e=Number(u(t)?.audioBitrateKbps);return Number.isFinite(e)&&e>=32?Math.round(e):0}(e);t>0&&s.push("-b:a",`${t}k`)}return"mxf"===n&&s.push("-f","mxf"),s}var d="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",v="anullsrc=r=44100:cl=stereo";function x(t){return t>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round(1e3*(t-.01))/1e3}:d=0.01`:""}function g(t,n=Number.POSITIVE_INFINITY){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"===o.type)continue;const t=Number(o.startAt),a=Number(o.endAt);if(Number.isFinite(t)&&Number.isFinite(a)&&!(a<=t)&&(s.push({startAt:Math.max(0,t),endAt:Math.max(t+.01,a)}),s.length>=n))break}return s}function S(t,e=2){const n=Math.max(e,Math.floor(Number(t)||e));return n%2==0?n:n-1}function b(t){const e=Number.isFinite(t.startAt)?Math.max(0,Number(t.startAt)):0,n=Number(t.endAt);return Number.isFinite(n)?{startAt:e,endAt:Math.max(e+.1,n)}:{startAt:e,endAt:e+3}}function A(t){const e=l({...a,...t}),s=n(t.filterPreset);return[e,s?.vf].filter(t=>Boolean(t))}function y(t,e){const n=Math.max(2,S(e.w)),s=Math.max(2,S(e.h)),o=Math.max(0,Math.min(n-2,S(t.x,0))),a=Math.max(0,Math.min(s-2,S(t.y,0))),r=Math.min(n-o,Math.max(2,S(t.w))),i=Math.min(s-a,Math.max(2,S(t.h)));return r<=1||i<=1?null:{x:o,y:a,w:r,h:i}}function M(t,n){const s=[];for(const o of t??[]){if(e(o))continue;if("adjust"!==o.type)continue;const t=y(o,n);if(!t)continue;const a=A(o);a.length&&s.push({rect:t,filters:a,...b(o)})}return s}function T(t,e,n,s){let o=e;return s.forEach((e,s)=>{const a=`[vtimed${n+s}]`;t.push(`${o}[${n+s}:v]overlay=0:0:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${a}`),o=a}),o}function E(t,e,n){let s=e;return n.forEach((e,n)=>{const o=`[vadjsrc${n}]`,a=`[vadjbase${n}]`,r=`[vadjcrop${n}]`,i=`[vadj${n}]`,{rect:u}=e;t.push(`${s}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${e.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${e.startAt.toFixed(3)},${e.endAt.toFixed(3)})'${i}`),s=i}),s}function F(t){const e=Number(t.startAt),n=Number(t.endAt);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?"":`:enable='between(t,${Math.max(0,e).toFixed(3)},${Math.max(e+.01,n).toFixed(3)})'`}function P(t,e,n,s){const o=`[${s}src]`,a=`[${s}base]`,r=`[${s}crop]`,i=`[${s}]`,{rect:u}=n;return t.push(`${e}split=2${o}${a}`),t.push(`${o}crop=${u.w}:${u.h}:${u.x}:${u.y},${n.filters.join(",")}${r}`),t.push(`${a}${r}overlay=${u.x}:${u.y}:enable='between(t,${n.startAt.toFixed(3)},${n.endAt.toFixed(3)})'${i}`),i}function w(t,n,s,a,r,i,u){let c=n,h=0,l=0;for(const n of o(a??[])){if(e(n))continue;if("adjust"===n.type){const e=y(n,i),s=A(n);if(!e||!s.length)continue;c=P(t,c,{rect:e,filters:s,...b(n)},`v${u}adj${l}`),l++;continue}if(h>=r){h++;continue}const o=`[v${u}lay${h}]`;t.push(`${c}[${s+h}:v]overlay=0:0${F(n)}${o}`),c=o,h++}return c}function _(e,n,s){const{videoPaths:o,videoHasAudio:a,audioPaths:r,overlayPath:i,textOverlayPaths:u=[],overlayLayerPaths:l=[]}=n,S=(e.audioClips??[]).filter(t=>!t.muted),b=l.length>0,A=b?[]:g(e.overlays,u.length),y=b?[]:u.slice(0,A.length),F=b?l:[],P=b?[]:M(e.overlays,t(e.canvas,e));if(1===o.length&&0===S.length)return function(e,n,s,o,a,r=[],i=[]){const u=f(e,{includeExportScale:!1}),l=e.clips,d=e.keepAudio&&a,v=l.length>=2,S=l.some(p),b=c(e),A=i.length>0,y=A?[]:g(e.overlays,r.length),F=A?[]:r.slice(0,y.length),P=A?i:[],_=A?[]:M(e.overlays,t(e.canvas,e));if(v||S||o||F.length||P.length||_.length){const a=[];let r;if(v){l.forEach((t,n)=>{a.push($(0,t,n,e.canvas.w,e.canvas.h,b)),d&&a.push(`[0:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)}[a${n}]`)});const t=l.map((t,e)=>d?`[v${e}][a${e}]`:`[v${e}]`).join(""),n=d?"[vcat][acat]":"[vcat]";a.push(`${t}concat=n=${l.length}:v=1:a=${d?1:0}${n}`),r="[vcat]"}else S?(a.push($(0,l[0],0,e.canvas.w,e.canvas.h,b)),r="[v0]"):r="[0:v]";u.length&&(a.push(`${r}${u.join(",")}[vflt]`),r="[vflt]"),P.length?(o&&(a.push(`${r}[1:v]overlay=0:0[vlegacy]`),r="[vlegacy]"),r=w(a,r,1+(o?1:0),e.overlays,P.length,t(e.canvas,e),"s")):_.length&&(r=E(a,r,_)),!P.length&&o?(a.push(`${r}[1:v]overlay=0:0[vout]`),r="[vout]"):"[0:v]"===r&&(a.push("[0:v]null[vout]"),r="[vout]"),F.length&&(r=T(a,r,1+(o?1:0),y));const i=h(e);i.length&&(a.push(`${r}${i.join(",")}[vscaled]`),r="[vscaled]");const c=[];v||1!==l.length||c.push("-ss",String(l[0].in),"-t",String(l[0].out-l[0].in));const p=["-y",...c,"-i",n];o&&p.push("-i",o);for(const t of P)p.push("-i",t);for(const t of F)p.push("-i",t);return p.push("-filter_complex",a.join(";"),"-map",r),d&&p.push("-map",v?"[acat]":"0:a?"),p.push(...m(d,e)),p.push(s),p}const R=["-ss",String(l[0].in),"-t",String(l[0].out-l[0].in)],N=f(e),j=["-y",...R,"-i",n];return N.length&&j.push("-vf",N.join(",")),d||j.push("-an"),j.push(...m(d,e)),j.push(s),j}(e,o[0],s,i,a[0]??!1,y,F);const _=o.length,R=r.length,N=e.canvas.w,j=e.canvas.h,I=e.clips,k=e.keepAudio&&I.some(t=>a[t.srcIdx]),C=c(e),L=I.reduce((t,e)=>t+(e.out-e.in),0),O=[];I.forEach((t,e)=>{O.push($(t.srcIdx,t,e,N,j,C)),k&&(a[t.srcIdx]?O.push(`[${t.srcIdx}:a]atrim=start=${t.in}:end=${t.out},asetpts=PTS-STARTPTS${x(t.out-t.in)},${d}[a${e}]`):O.push(`${v},atrim=start=0:end=${t.out-t.in},asetpts=PTS-STARTPTS,${d}[a${e}]`))});const D=I.map((t,e)=>k?`[v${e}][a${e}]`:`[v${e}]`).join("");O.push(`${D}concat=n=${I.length}:v=1:a=${k?1:0}${k?"[vcat][acat]":"[vcat]"}`);let V=k?"[acat]":"";if(!k&&S.length&&(O.push(`${v},atrim=start=0:end=${L},asetpts=PTS-STARTPTS,${d}[acat]`),V="[acat]"),S.length){S.forEach((t,e)=>{const n=Math.max(0,Math.round(1e3*t.startAt));O.push(function(t,e,n,s){const o=Math.min(2,Math.max(.5,e.speed??1)),a=function(t){return Math.max(.001,(t.out-t.in)/Math.max(.01,t.speed??1))}(e),r=Math.min(Math.max(0,e.fadeIn??0),a),i=Math.min(Math.max(0,e.fadeOut??0),a),u=[`atrim=start=${e.in}:end=${e.out}`,"asetpts=PTS-STARTPTS"];return Math.abs(o-1)>.001&&u.push(`atempo=${o.toFixed(3)}`),r>0&&u.push(`afade=t=in:st=0:d=${r.toFixed(3)}`),i>0&&u.push(`afade=t=out:st=${Math.max(0,a-i).toFixed(3)}:d=${i.toFixed(3)}`),u.push(`volume=${e.volume}`,d,`adelay=${n}|${n}`),`${t}${u.join(",")}[${s}]`}(`[${_+t.srcIdx}:a]`,t,n,`mu${e}`))});const t=`${V}${S.map((t,e)=>`[mu${e}]`).join("")}`;O.push(`${t}amix=inputs=${1+S.length}:duration=first:dropout_transition=0:normalize=0,alimiter=limit=0.95:level=disabled:latency=1[aout]`),V="[aout]"}let B="[vcat]";const z=f(e,{includeExportScale:!1});z.length&&(O.push(`${B}${z.join(",")}[vflt]`),B="[vflt]"),F.length?(i&&(O.push(`${B}[${_+R}:v]overlay=0:0[vlegacy]`),B="[vlegacy]"),B=w(O,B,_+R+(i?1:0),e.overlays,F.length,t(e.canvas,e),"m")):P.length&&(B=E(O,B,P)),!F.length&&i&&(O.push(`${B}[${_+R}:v]overlay=0:0[vout]`),B="[vout]"),y.length&&(B=T(O,B,_+R+(i?1:0),A));const G=h(e);G.length&&(O.push(`${B}${G.join(",")}[vscaled]`),B="[vscaled]");const Y=["-y"];for(const t of o)Y.push("-i",t);for(const t of r)Y.push("-i",t);i&&Y.push("-i",i);for(const t of F)Y.push("-i",t);for(const t of y)Y.push("-i",t);Y.push("-filter_complex",O.join(";"),"-map",B);const H=!!V;return H&&Y.push("-map",V),Y.push(...m(H,e)),H&&Y.push("-ar","44100","-ac","2"),Y.push(s),Y}function R(t,e,n){return["-y","-ss",String(e),"-i",t,"-frames:v","1","-q:v","2",n]}export{_ as buildFfmpegArgs,R as buildPosterArgs};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={"tool.trim":"剪辑","tool.crop":"裁剪","tool.tune":"调色","tool.filter":"滤镜","tool.annotate":"标注","tool.sticker":"贴纸","tool.resize":"比例","tune.brightness":"亮度","tune.contrast":"对比","tune.saturation":"饱和","tune.gamma":"Gamma","tune.temperature":"色温","tune.tint":"色调","tune.vibrance":"自然饱和","tune.highlights":"高光","tune.shadows":"阴影","tune.whites":"白色","tune.blacks":"黑色","tune.lightSense":"光感","tune.sharpen":"锐化","tune.clarity":"清晰度","tune.grain":"颗粒","tune.fade":"褪色","tune.vignette":"暗角","overlay.select":"选择","overlay.pen":"画笔","overlay.eraser":"橡皮","overlay.line":"直线","overlay.arrow":"箭头","overlay.rect":"矩形","overlay.ellipse":"椭圆","overlay.text":"文字","overlay.color":"线色","overlay.width":"线宽","overlay.fontSize":"字号","overlay.font":"字体","overlay.align":"对齐","overlay.background":"背景","overlay.copySelected":"复制","overlay.delSelected":"删除选中","overlay.editSelected":"编辑","overlay.pickImage":"选择图片","overlay.hint":"点 emoji/图片添加 → 画布上拖动摆位,拖右下角紫色把手缩放","overlay.textPlaceholder":"输入文字,回车确认","filter.none":"原图","filter.bw":"黑白","filter.sepia":"复古","filter.warm":"暖阳","filter.cool":"冷调","filter.vivid":"鲜艳","ratio.orig":"原始","ratio.free":"自由比例","ratio.9:16":"竖屏 9:16","ratio.16:9":"横屏 16:9","ratio.1:1":"方形 1:1","ratio.4:5":"竖图 4:5","ratio.3:4":"竖图 3:4","ratio.2:3":"竖图 2:3","ratio.1.91:1":"横幅 1.91:1","act.fit":"适应","act.zoomFit":"缩放至适当大小","act.zoomTo":"缩放至 {value}%","act.split":"分割","act.copy":"复制","act.delete":"删除","act.restore":"还原","act.deleteMusic":"删除音乐","act.cancel":"取消","act.exportPoster":"导出封面","act.exporting":"导出中…","act.poster":"🖼 封面","act.again":"再次下载","act.saveDrive":"存网盘","act.changeImage":"← 换一张","act.changeVideo":"← 换一个","crop.rotateLeft":"↺ 向左旋转","crop.flipX":"⇋ 水平翻转","crop.flipY":"⇵ 垂直翻转","crop.rotateLeftShort":"左转","crop.flipXShort":"横翻","crop.flipYShort":"竖翻","tip.close":"关闭(换文件)","tip.undo":"撤销","tip.redo":"重做","tip.resetOpened":"重置到打开文件时","tip.previewZoom":"预览缩放比例","tip.previewZoomOut":"缩小预览","tip.previewZoomIn":"放大预览","tip.previewZoomFit":"适应预览","tip.previewPointer":"指针工具","tip.previewPan":"手工具:拖动画面","tip.poster":"预览并选择封面帧","tip.keepAudio":"原视频声音开关(与音乐混音;预览同步)","tip.split":"在播放头处把当前片段一分为二","tip.zoomOut":"缩小时间轴(Ctrl+滚轮)","tip.zoomIn":"放大时间轴(Ctrl+滚轮)","tip.fit":"缩放到适应宽度","tip.addVideo":"添加视频片段","tip.addAudio":"添加音乐(音频文件,或选含声音的视频自动提取音轨;与原声混音)","tip.dupClip":"复制该片段(插到其后)","tip.delClip":"删除该片段","tip.lockAspect":"锁定纵横比","tip.dblConfirm":"双击确认裁剪","err.notVideo":"请选择视频文件","err.maxVideo":"最多 {max} 个视频素材","err.videoLoad":"视频加载失败,请换一个文件","err.notAudio":"请选择音频文件(mp3/wav/m4a),或含声音的视频(自动提取音轨)","err.maxAudio":"最多 {max} 个音频素材","err.audioLoad":"音频加载失败,请换一个文件","err.processFailed":"处理失败","err.posterFailed":"封面渲染失败","err.canvas":"canvas 不可用","err.imageRead":"图片读取失败,请换一张","err.notImage":"请选择图片文件","err.fileType":"只支持图片或视频文件","err.saveDrive":"存网盘失败","msg.processing":"正在导出中…","msg.exportPrepare":"正在准备素材…","msg.exportUpload":"正在上传素材…","msg.exportEncode":"正在编码视频…","msg.exportDownload":"正在接收结果…","msg.exportingHint":"请稍候,导出完成后会自动返回结果。","msg.done":"完成 ✓","msg.loading":"素材加载中…","msg.exported":"已导出:","msg.saving":"存网盘中…","msg.saved":"已存到网盘 ✓","lbl.ratioSection":"画面比例(裁剪,不变形)","lbl.dragToReposition":"↔ 拖动预览可调整裁剪位置","lbl.sizeSection":"导出尺寸(像素;比例不符时 cover 居中裁剪)","lbl.currentOut":"当前输出","lbl.zoomSize":"大小","lbl.noScale":"(未缩放)","lbl.coverNote":"· 比例不一致时居中裁剪(cover),不变形","lbl.audioTrackHint":"♪ 音频轨(右侧 + 添加音乐,与原声混音)","lbl.volume":"音量","lbl.volNote":"(预览最大 100%,导出按设定值)","lbl.music":"音乐","kbd.fit":"⇧ F","poster.title":"选择封面帧","panel.title":"媒体编辑器","panel.subtitle":"上传图片 / 视频,裁剪 · 滤镜 · 文字 · 导出","panel.pick":"点击选择图片或视频","panel.pickHint":"图片用 Filerobot · 视频可裁剪/静音/封面"},o={"简":"簡","体":"體","图":"圖","频":"頻","视":"視","辑":"輯","调":"調","滤":"濾","标":"標","注":"註","贴":"貼","选":"選","择":"擇","线":"線","箭":"箭","头":"頭","复":"複","删":"刪","除":"除","编":"編","边":"邊","输":"輸","入":"入","确":"確","认":"認","饱":"飽","对":"對","暖":"暖","阳":"陽","冷":"冷","纵":"縱","横":"橫","适":"適","应":"應","缩":"縮","实":"實","际":"際","导":"導","出":"出","封":"封","面":"面","换":"換","张":"張","预":"預","览":"覽","动":"動","声":"聲","开":"開","关":"關","与":"與","乐":"樂","混":"混","处":"處","载":"載","错":"錯","误":"誤","读":"讀","仅":"僅","终":"終","稍":"稍","候":"候","返回":"返回","当前":"目前","输出":"輸出","画":"畫","变":"變","音频":"音訊","音轨":"音軌","添加":"新增","删除":"刪除","保存":"儲存","加载":"載入","网盘":"網盤"},t=e=>{let t=e;for(const[e,a]of Object.entries(o).sort((e,o)=>o[0].length-e[0].length))t=t.replaceAll(e,a);return t},a={zh:e,en:{"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","tune.temperature":"Temperature","tune.tint":"Tint","tune.vibrance":"Vibrance","tune.highlights":"Highlights","tune.shadows":"Shadows","tune.whites":"Whites","tune.blacks":"Blacks","tune.lightSense":"Light","tune.sharpen":"Sharpen","tune.clarity":"Clarity","tune.grain":"Grain","tune.fade":"Fade","tune.vignette":"Vignette","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.fontSize":"Size","overlay.font":"Font","overlay.align":"Align","overlay.background":"Background","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add → drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Wide 1.91:1","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting…","act.poster":"🖼 Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"← Change image","act.changeVideo":"← Change file","crop.rotateLeft":"↺ Rotate left","crop.flipX":"⇋ Flip horizontal","crop.flipY":"⇵ Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting…","msg.exportPrepare":"Preparing media…","msg.exportUpload":"Uploading media…","msg.exportEncode":"Encoding video…","msg.exportDownload":"Receiving result…","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done ✓","msg.loading":"Loading media…","msg.exported":"Exported: ","msg.saving":"Saving…","msg.saved":"Saved to drive ✓","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"↔ Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"· center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"♪ Audio track (+ on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"⇧ F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video — crop · filters · text · export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot · videos: trim/mute/cover"},es:{"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporción","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturación","tune.gamma":"Gamma","tune.temperature":"Temperatura","tune.tint":"Tinte","tune.vibrance":"Intensidad","tune.highlights":"Altas luces","tune.shadows":"Sombras","tune.whites":"Blancos","tune.blacks":"Negros","tune.lightSense":"Luz","tune.sharpen":"Enfoque","tune.clarity":"Claridad","tune.grain":"Grano","tune.fade":"Desvanecer","tune.vignette":"Viñeta","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"Línea","overlay.arrow":"Flecha","overlay.rect":"Rectángulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.fontSize":"Tamaño","overlay.font":"Fuente","overlay.align":"Alinear","overlay.background":"Fondo","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para añadirlo → arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"Cálido","filter.cool":"Frío","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","ratio.3:4":"Vertical 3:4","ratio.2:3":"Vertical 2:3","ratio.1.91:1":"Panorámico 1.91:1","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar música","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando…","act.poster":"🖼 Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"← Cambiar imagen","act.changeVideo":"← Cambiar archivo","crop.rotateLeft":"↺ Girar a la izquierda","crop.flipX":"⇋ Voltear horizontal","crop.flipY":"⇵ Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con música; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir línea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar línea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"Añadir clip de vídeo","tip.addAudio":"Añadir música (archivo de audio o vídeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar después)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporción","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de vídeo","err.maxVideo":"Máximo {max} vídeos","err.videoLoad":"No se pudo cargar el vídeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un vídeo con sonido (se extrae automáticamente)","err.maxAudio":"Máximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o vídeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando…","msg.exportPrepare":"Preparando medios…","msg.exportUpload":"Subiendo medios…","msg.exportEncode":"Codificando video…","msg.exportDownload":"Recibiendo resultado…","msg.exportingHint":"Espera un momento. El resultado se devolverá automáticamente al finalizar.","msg.done":"Listo ✓","msg.loading":"Cargando medios…","msg.exported":"Exportado: ","msg.saving":"Guardando…","msg.saved":"Guardado en disco ✓","lbl.ratioSection":"Proporción de imagen (recorte, sin deformar)","lbl.dragToReposition":"↔ Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tamaño de exportación (px; recorte cover centrado si la proporción difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tamaño","lbl.noScale":"(sin escala)","lbl.coverNote":"· recorte centrado (cover) cuando la proporción difiere, sin deformar","lbl.audioTrackHint":"♪ Pista de audio (+ a la derecha para añadir música, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportación usa el valor definido)","lbl.music":"Música","kbd.fit":"⇧ F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / vídeo — recorta · filtros · texto · exporta","panel.pick":"Haz clic para elegir una imagen o vídeo","panel.pickHint":"Imágenes con Filerobot · vídeos: cortar/silenciar/portada"},"zh-Hant":Object.fromEntries(Object.entries(e).map(([e,o])=>[e,t(o)]))};function i(e,o,t){let i=a[e]?.[o]??a.zh[o]??o;if(t)for(const[e,o]of Object.entries(t))i=i.replaceAll(`{${e}}`,String(o));return i}var r=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT·Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG·Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB·Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT·Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI·Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH·Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG·Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD·Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],l={"1:1":"方形 1:1","4:5":"竖图 4:5","3:4":"竖图 3:4","9:16":"竖屏 9:16","16:9":"横屏 16:9","2:3":"竖图 2:3","1.91:1":"横幅 1.91:1"};function n(e){const[o,t]=e.split(":").map(Number);return o&&t?o/t:1}function p(e){const o=new Set,t=[];for(const a of e)a&&!o.has(a)&&(o.add(a),t.push({ratio:a,value:n(a),label:l[a]??a}));return t}var s=p(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),c=p(["9:16","16:9","1:1","4:5","3:4","2:3","1.91:1"]);function d(e=r){const o=new Set,t=[];for(const a of e){if(!a.videoRatio)continue;const e=`${a.platform}:${a.postType}:${a.videoRatio}`;if(o.has(e))continue;o.add(e);const i=a.label.split(" ").slice(0,-1).join(" ")||a.label;t.push({platform:a.platform,postType:a.postType,label:`${i} ${a.videoRatio}`,ratio:a.videoRatio,value:n(a.videoRatio)})}return t}var m=d();function u(e=r){const o=new Map;for(const t of e){const e=o.get(t.platform);(!e||"post"!==e.postType&&"post"===t.postType)&&o.set(t.platform,t)}return Array.from(o.values()).map(e=>{const[o,t]=e.imageSize.split("x").map(Number),a=e.label.split(" ").slice(0,-1).join(" ")||e.label;return{platform:e.platform,label:`${a} ${e.ratio}`,ratio:e.ratio,value:n(e.ratio),w:o,h:t}})}var v=u();function g(e,o){return e>=1?{w:2*Math.round(o*e/2),h:o}:{w:o,h:2*Math.round(o/e/2)}}function f(e=r){const o=new Set,t=[];for(const a of e){if(!a.videoRatio||!a.videoResolution)continue;const e="1080p"===a.videoResolution?1080:720,{w:i,h:r}=g(n(a.videoRatio),e),l=`${i}x${r}`;o.has(l)||(o.add(l),t.push({label:`${a.shortLabel} ${i}×${r}`,w:i,h:r}))}return t}var h=f();function b(e,o){if(e.isDuplicated)return{};if(0!==(e.rotation??0))return{};const t=o.adjustments?.rotation??0;return t?{rotation:-t}:{}}export{r as DEFAULT_PLATFORM_TARGETS,a as EDITOR_MESSAGES,v as IMAGE_PLATFORM_PRESETS,s as IMAGE_RATIO_PRESETS,m as VIDEO_PLATFORM_RATIO_PRESETS,c as VIDEO_RATIO_PRESETS,h as VIDEO_SIZE_PRESETS,u as buildImagePlatformPresets,d as buildVideoPlatformRatioPresets,f as buildVideoSizePresets,b as compensateAnnotationRotation,n as parseRatio,i as tEditor,t as toHant};
|