mediasfu-vue 1.1.3 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 — 2026-09-21
4
+
5
+ - Added person-aware background blur to the classic and modern background modals.
6
+ - Uses the shared compositor and stable `"blur"` state so modal, hybrid, and headless integrations follow one virtual-background contract.
7
+ - Requires `mediasfu-shared` 1.2.3 or later for blur helpers and consume-socket lifecycle cleanup.
8
+
3
9
  ## 1.1.3 — 2026-09-16
4
10
 
5
11
  - Requires `mediasfu-shared` 1.2.2 or later. That release reports the room layout to the recording service as soon as a recording starts, instead of waiting for the next participant or screen change.
package/README.md CHANGED
@@ -326,6 +326,20 @@ camera media from `useMediasfuHeadless().localVideo`; it resolves the active
326
326
  processed/virtual stream before the raw camera, so self-view matches the stream
327
327
  published to everyone else.
328
328
 
329
+ The classic and modern background modals include **Blur** alongside image
330
+ backgrounds. Fully custom web UIs can use the same room lifecycle directly:
331
+
332
+ ```ts
333
+ import { applyBackgroundBlur, clearVirtualBackground } from 'mediasfu-shared';
334
+
335
+ await applyBackgroundBlur({ parameters: latestRoomParameters, blurPixels: 16 });
336
+ await clearVirtualBackground({ parameters: latestRoomParameters });
337
+ ```
338
+
339
+ Turn the camera on before applying an effect. Keep the parameter publication
340
+ current and render the SDK-resolved local stream; do not build a second canvas
341
+ pipeline or select the raw camera stream yourself.
342
+
329
343
  Reuse `ModernBreakoutRoomsModal` with the same live room bag when you want the
330
344
  built-in planner. Save assignments before Start and show action errors in your
331
345
  page. Filtering tiles is not a breakout transition: the SDK must update room
package/dist/index.cjs CHANGED
@@ -1721,6 +1721,8 @@ async function addVideosGrid({
1721
1721
  keepBackground,
1722
1722
  virtualStream,
1723
1723
  forceFullDisplay,
1724
+ shared,
1725
+ shareScreenStarted,
1724
1726
  otherGridStreams,
1725
1727
  updateOtherGridStreams,
1726
1728
  updateMiniCardsGrid,
@@ -1742,6 +1744,11 @@ async function addVideosGrid({
1742
1744
  const newComponents = [[], []];
1743
1745
  let remoteProducerId = "";
1744
1746
  numtoadd = mainGridStreams.length;
1747
+ const sidePanelForceFullDisplay = mediasfuShared.resolveSidePanelForceFullDisplay({
1748
+ forceFullDisplay,
1749
+ screenShareActive: !!(shared || shareScreenStarted),
1750
+ itemCount: numtoadd + (removeAltGrid ? 0 : altGridStreams.length)
1751
+ });
1745
1752
  if (removeAltGrid) {
1746
1753
  updateAddAltGrid(false);
1747
1754
  }
@@ -1878,7 +1885,7 @@ async function addVideosGrid({
1878
1885
  videoStream: videoParticipant.stream || new MediaStream(),
1879
1886
  remoteProducerId: videoParticipant.stream?.id || "",
1880
1887
  eventType,
1881
- forceFullDisplay: eventType === "webinar" ? false : forceFullDisplay,
1888
+ forceFullDisplay: eventType === "webinar" ? false : sidePanelForceFullDisplay,
1882
1889
  customStyle: {
1883
1890
  border: themedBorder
1884
1891
  },
@@ -1920,7 +1927,7 @@ async function addVideosGrid({
1920
1927
  videoStream: participant.stream || new MediaStream(),
1921
1928
  remoteProducerId: remoteProducerId || "",
1922
1929
  eventType,
1923
- forceFullDisplay,
1930
+ forceFullDisplay: sidePanelForceFullDisplay,
1924
1931
  customStyle: {
1925
1932
  border: themedBorder
1926
1933
  },
@@ -2060,7 +2067,7 @@ async function addVideosGrid({
2060
2067
  videoStream: participant.stream || new MediaStream(),
2061
2068
  remoteProducerId: remoteProducerId || "",
2062
2069
  eventType,
2063
- forceFullDisplay,
2070
+ forceFullDisplay: sidePanelForceFullDisplay,
2064
2071
  customStyle: {
2065
2072
  border: themedBorder
2066
2073
  },
@@ -17560,6 +17567,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17560
17567
  isVisible: { type: Boolean },
17561
17568
  onClose: {},
17562
17569
  parameters: {},
17570
+ keepProcessingWhenHidden: { type: Boolean, default: true },
17563
17571
  renderMode: {},
17564
17572
  position: { default: "topLeft" },
17565
17573
  backgroundColor: { default: "#f5f5f5" },
@@ -17691,7 +17699,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17691
17699
  const saveBackgroundButtonRef = vue.ref(null);
17692
17700
  const mainCanvasRef = vue.ref(null);
17693
17701
  const previewLoopVersion = vue.ref(0);
17694
- const previewAnimationFrameId = vue.ref(null);
17702
+ let stopPreviewFrameLoop = null;
17695
17703
  const previewCaptureTimeoutId = vue.ref(null);
17696
17704
  const clonedStream = vue.ref(null);
17697
17705
  const clonedTrack = vue.ref(null);
@@ -17715,10 +17723,8 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17715
17723
  };
17716
17724
  const stopPreviewProcessing = () => {
17717
17725
  previewLoopVersion.value++;
17718
- if (previewAnimationFrameId.value !== null) {
17719
- cancelAnimationFrame(previewAnimationFrameId.value);
17720
- previewAnimationFrameId.value = null;
17721
- }
17726
+ stopPreviewFrameLoop?.();
17727
+ stopPreviewFrameLoop = null;
17722
17728
  if (previewCaptureTimeoutId.value !== null) {
17723
17729
  clearTimeout(previewCaptureTimeoutId.value);
17724
17730
  previewCaptureTimeoutId.value = null;
@@ -17800,6 +17806,36 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17800
17806
  });
17801
17807
  container.appendChild(img);
17802
17808
  });
17809
+ const blurBackground = document.createElement("div");
17810
+ blurBackground.classList.add("img-thumbnail", "m-1", "d-flex", "align-items-center", "justify-content-center");
17811
+ blurBackground.setAttribute("role", "button");
17812
+ blurBackground.setAttribute("aria-label", "Blur background");
17813
+ blurBackground.style.width = "68px";
17814
+ blurBackground.style.minHeight = "52px";
17815
+ blurBackground.style.cursor = "pointer";
17816
+ blurBackground.style.background = "linear-gradient(135deg, rgba(96,165,250,.45), rgba(15,23,42,.92))";
17817
+ blurBackground.style.border = "1px solid rgba(148, 163, 184, 0.28)";
17818
+ blurBackground.style.borderRadius = "10px";
17819
+ blurBackground.innerHTML = '<span style="color:#e2e8f0; font-weight:600;">Blur</span>';
17820
+ blurBackground.addEventListener("click", () => {
17821
+ selectedImage.value = mediasfuShared.VIRTUAL_BACKGROUND_BLUR;
17822
+ customImage.value = "";
17823
+ props.parameters.updateSelectedImage?.(mediasfuShared.VIRTUAL_BACKGROUND_BLUR);
17824
+ props.parameters.updateCustomImage?.("");
17825
+ clearCanvas();
17826
+ const canvas = backgroundCanvasRef.value;
17827
+ const context = canvas?.getContext("2d");
17828
+ if (canvas && context) {
17829
+ context.fillStyle = "#1e293b";
17830
+ context.fillRect(0, 0, canvas.width, canvas.height);
17831
+ context.fillStyle = "#e2e8f0";
17832
+ context.font = "600 26px Arial";
17833
+ context.textAlign = "center";
17834
+ context.textBaseline = "middle";
17835
+ context.fillText("Blur", canvas.width / 2, canvas.height / 2);
17836
+ }
17837
+ });
17838
+ container.appendChild(blurBackground);
17803
17839
  const noBackground = document.createElement("div");
17804
17840
  noBackground.classList.add("img-thumbnail", "m-1", "d-flex", "align-items-center", "justify-content-center");
17805
17841
  noBackground.style.width = "68px";
@@ -17940,10 +17976,11 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17940
17976
  const selfieSegmentationPreview = async (doSegmentation) => {
17941
17977
  const refVideo = captureVideoRef.value;
17942
17978
  const previewVideo = videoPreviewRef.value;
17979
+ const useBlur = mediasfuShared.isVirtualBackgroundBlur(selectedImage.value);
17943
17980
  const virtualImage = new Image();
17944
17981
  virtualImage.crossOrigin = "anonymous";
17945
- virtualImage.src = selectedImage.value || "";
17946
- if (doSegmentation && selectedImage.value) {
17982
+ virtualImage.src = useBlur ? "" : selectedImage.value || "";
17983
+ if (doSegmentation && selectedImage.value && !useBlur) {
17947
17984
  await new Promise((resolve) => {
17948
17985
  if (virtualImage.complete && virtualImage.naturalWidth > 0) {
17949
17986
  resolve();
@@ -17976,23 +18013,18 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
17976
18013
  };
17977
18014
  const onResults = (results) => {
17978
18015
  try {
17979
- if (!pauseSegmentation.value && mediaCanvas && mediaCanvas.width > 0 && mediaCanvas.height > 0 && virtualImage && virtualImage.width > 0 && virtualImage.height > 0) {
17980
- ctx?.save();
17981
- ctx?.clearRect(0, 0, mediaCanvas.width, mediaCanvas.height);
17982
- if (ctx) ctx.globalCompositeOperation = "source-over";
17983
- ctx?.drawImage(results.segmentationMask, 0, 0, mediaCanvas.width, mediaCanvas.height);
18016
+ if (!pauseSegmentation.value && mediaCanvas && mediaCanvas.width > 0 && mediaCanvas.height > 0 && (useBlur || virtualImage && virtualImage.width > 0 && virtualImage.height > 0)) {
17984
18017
  if (ctx) {
17985
- ctx.globalCompositeOperation = "source-in";
17986
- ctx.drawImage(results.image, 0, 0, mediaCanvas.width, mediaCanvas.height);
17987
- ctx.globalCompositeOperation = "destination-over";
17988
- const pattern = ctx.createPattern(virtualImage, repeatMode);
17989
- if (pattern) {
17990
- ctx.fillStyle = pattern;
17991
- } else {
17992
- ctx.fillStyle = "";
17993
- }
17994
- ctx.fillRect(0, 0, mediaCanvas.width, mediaCanvas.height);
17995
- ctx.restore();
18018
+ mediasfuShared.compositeVirtualBackgroundFrame({
18019
+ ctx,
18020
+ segmentationMask: results.segmentationMask,
18021
+ sourceImage: results.image,
18022
+ backgroundImage: useBlur ? null : virtualImage,
18023
+ width: mediaCanvas.width,
18024
+ height: mediaCanvas.height,
18025
+ repeatPattern: repeatMode,
18026
+ blurFallbackPixels: useBlur ? mediasfuShared.DEFAULT_BACKGROUND_BLUR_PIXELS : 0
18027
+ });
17996
18028
  markFirstFrameRendered();
17997
18029
  }
17998
18030
  }
@@ -18018,6 +18050,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
18018
18050
  prevKeepBackground.value = keepBackground.value;
18019
18051
  props.parameters.updatePrevKeepBackground?.(keepBackground.value);
18020
18052
  if (!doSegmentation) {
18053
+ stopPreviewProcessing();
18021
18054
  processedStream.value?.getVideoTracks().forEach((track) => track.stop());
18022
18055
  processedStream.value = null;
18023
18056
  props.parameters.updateProcessedStream?.(null);
@@ -18029,20 +18062,17 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
18029
18062
  stopPreviewProcessing();
18030
18063
  const loopVersion = previewLoopVersion.value;
18031
18064
  let startedProcessing = false;
18032
- const processFrame = () => {
18033
- if (loopVersion !== previewLoopVersion.value || !selfieSegmentation.value || pauseSegmentation.value || !videoElement || videoElement.videoWidth === 0 || videoElement.videoHeight === 0) {
18034
- return;
18035
- }
18036
- try {
18037
- void selfieSegmentation.value.send({ image: videoElement }).catch(() => void 0);
18038
- } catch {
18039
- }
18040
- previewAnimationFrameId.value = requestAnimationFrame(processFrame);
18041
- };
18042
18065
  const startProcessing = () => {
18043
18066
  if (startedProcessing) return;
18044
18067
  startedProcessing = true;
18045
- processFrame();
18068
+ const segmentation = selfieSegmentation.value;
18069
+ if (!segmentation) return;
18070
+ stopPreviewFrameLoop = mediasfuShared.startVirtualBackgroundFrameLoop({
18071
+ owner: segmentation,
18072
+ keepProcessingWhenHidden: props.keepProcessingWhenHidden,
18073
+ shouldContinue: () => loopVersion === previewLoopVersion.value && !pauseSegmentation.value && videoElement.srcObject?.getVideoTracks?.()[0]?.readyState === "live",
18074
+ processFrame: () => videoElement.videoWidth > 0 && videoElement.videoHeight > 0 ? segmentation.send({ image: videoElement }) : void 0
18075
+ });
18046
18076
  };
18047
18077
  videoElement.onloadeddata = startProcessing;
18048
18078
  if (videoElement.readyState >= 2 && videoElement.videoWidth > 0 && videoElement.videoHeight > 0) {
@@ -18157,7 +18187,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
18157
18187
  }
18158
18188
  }
18159
18189
  try {
18160
- if (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height) {
18190
+ if (!useBlur && (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height)) {
18161
18191
  repeatMode = "repeat";
18162
18192
  }
18163
18193
  } catch {
@@ -18327,8 +18357,10 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
18327
18357
  }
18328
18358
  }
18329
18359
  renderDefaultImages();
18330
- if (selectedImage.value) {
18360
+ if (selectedImage.value && !mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
18331
18361
  await loadImageToCanvas(selectedImage.value, selectedImage.value);
18362
+ } else if (mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
18363
+ renderDefaultImages();
18332
18364
  } else {
18333
18365
  clearCanvas();
18334
18366
  }
@@ -18825,7 +18857,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
18825
18857
  };
18826
18858
  }
18827
18859
  });
18828
- const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-017b72d2"]]);
18860
+ const BackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-1410a1d9"]]);
18829
18861
  const _hoisted_1$e = { class: "card-header" };
18830
18862
  const _hoisted_2$b = { class: "room-title" };
18831
18863
  const _hoisted_3$a = { class: "room-actions" };
@@ -44839,6 +44871,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
44839
44871
  isVisible: { type: Boolean },
44840
44872
  onClose: {},
44841
44873
  parameters: {},
44874
+ keepProcessingWhenHidden: { type: Boolean, default: true },
44842
44875
  renderMode: { default: "modal" },
44843
44876
  position: { default: "topLeft" },
44844
44877
  backgroundColor: { default: void 0 },
@@ -44914,7 +44947,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
44914
44947
  const saveBackgroundButtonRef = vue.ref(null);
44915
44948
  const mainCanvasRef = vue.ref(null);
44916
44949
  const previewLoopVersion = vue.ref(0);
44917
- const previewAnimationFrameId = vue.ref(null);
44950
+ let stopPreviewFrameLoop = null;
44918
44951
  const previewCaptureTimeoutId = vue.ref(null);
44919
44952
  const uploadFileName = vue.ref("No file selected");
44920
44953
  const isAutoApplyBusy = vue.ref(false);
@@ -45064,6 +45097,31 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45064
45097
  clearCanvas();
45065
45098
  hideLoading();
45066
45099
  };
45100
+ const handleBlurBackground = () => {
45101
+ selectedImage.value = mediasfuShared.VIRTUAL_BACKGROUND_BLUR;
45102
+ customImage.value = "";
45103
+ props.parameters.updateSelectedImage?.(mediasfuShared.VIRTUAL_BACKGROUND_BLUR);
45104
+ props.parameters.updateCustomImage?.("");
45105
+ const canvas = backgroundCanvasRef.value;
45106
+ const ctx = canvas?.getContext("2d");
45107
+ if (canvas && ctx) {
45108
+ canvas.width = 640;
45109
+ canvas.height = 360;
45110
+ const gradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
45111
+ gradient.addColorStop(0, "#334155");
45112
+ gradient.addColorStop(1, "#0f172a");
45113
+ ctx.fillStyle = gradient;
45114
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
45115
+ ctx.fillStyle = "#e2e8f0";
45116
+ ctx.font = "600 26px Arial";
45117
+ ctx.textAlign = "center";
45118
+ ctx.textBaseline = "middle";
45119
+ ctx.fillText("Blur", canvas.width / 2, canvas.height / 2);
45120
+ }
45121
+ showPreviewVideo.value = false;
45122
+ showBackgroundCanvas.value = true;
45123
+ resetActionButtons();
45124
+ };
45067
45125
  const chooseResolutionSource = (entry) => {
45068
45126
  const parameters = getCurrentParameters();
45069
45127
  if (parameters.targetResolution === "fhd" || parameters.targetResolution === "qhd") {
@@ -45178,10 +45236,11 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45178
45236
  if (!mainCanvas || !refVideo || !previewVideo) {
45179
45237
  return;
45180
45238
  }
45239
+ const useBlur = mediasfuShared.isVirtualBackgroundBlur(selectedImage.value);
45181
45240
  const virtualImage = new Image();
45182
45241
  virtualImage.crossOrigin = "anonymous";
45183
- virtualImage.src = selectedImage.value || "";
45184
- if (doSegmentation && selectedImage.value) {
45242
+ virtualImage.src = useBlur ? "" : selectedImage.value || "";
45243
+ if (doSegmentation && selectedImage.value && !useBlur) {
45185
45244
  await new Promise((resolve) => {
45186
45245
  if (virtualImage.complete && virtualImage.naturalWidth > 0) {
45187
45246
  resolve();
@@ -45209,22 +45268,19 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45209
45268
  };
45210
45269
  const onResults = (results) => {
45211
45270
  try {
45212
- if (pauseSegmentation.value || !ctx || mediaCanvas.width <= 0 || mediaCanvas.height <= 0 || virtualImage.width <= 0 || virtualImage.height <= 0) {
45271
+ if (pauseSegmentation.value || !ctx || mediaCanvas.width <= 0 || mediaCanvas.height <= 0 || !useBlur && (virtualImage.width <= 0 || virtualImage.height <= 0)) {
45213
45272
  return;
45214
45273
  }
45215
- ctx.save();
45216
- ctx.clearRect(0, 0, mediaCanvas.width, mediaCanvas.height);
45217
- ctx.globalCompositeOperation = "source-over";
45218
- ctx.drawImage(results.segmentationMask, 0, 0, mediaCanvas.width, mediaCanvas.height);
45219
- ctx.globalCompositeOperation = "source-in";
45220
- ctx.drawImage(results.image, 0, 0, mediaCanvas.width, mediaCanvas.height);
45221
- ctx.globalCompositeOperation = "destination-over";
45222
- const pattern = ctx.createPattern(virtualImage, repeatMode);
45223
- if (pattern) {
45224
- ctx.fillStyle = pattern;
45225
- }
45226
- ctx.fillRect(0, 0, mediaCanvas.width, mediaCanvas.height);
45227
- ctx.restore();
45274
+ mediasfuShared.compositeVirtualBackgroundFrame({
45275
+ ctx,
45276
+ segmentationMask: results.segmentationMask,
45277
+ sourceImage: results.image,
45278
+ backgroundImage: useBlur ? null : virtualImage,
45279
+ width: mediaCanvas.width,
45280
+ height: mediaCanvas.height,
45281
+ repeatPattern: repeatMode,
45282
+ blurFallbackPixels: useBlur ? mediasfuShared.DEFAULT_BACKGROUND_BLUR_PIXELS : 0
45283
+ });
45228
45284
  markFirstFrameRendered();
45229
45285
  } catch (error) {
45230
45286
  console.log("Error applying background:", error);
@@ -45248,6 +45304,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45248
45304
  prevKeepBackground.value = keepBackground.value;
45249
45305
  props.parameters.updatePrevKeepBackground?.(keepBackground.value);
45250
45306
  if (!doSegmentation) {
45307
+ stopPreviewProcessing();
45251
45308
  processedStream.value?.getVideoTracks().forEach((track) => track.stop());
45252
45309
  processedStream.value = null;
45253
45310
  props.parameters.updateProcessedStream?.(null);
@@ -45261,20 +45318,17 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45261
45318
  stopPreviewProcessing();
45262
45319
  const loopVersion = previewLoopVersion.value;
45263
45320
  let startedProcessing = false;
45264
- const processFrame = () => {
45265
- if (loopVersion !== previewLoopVersion.value || !selfieSegmentation.value || pauseSegmentation.value || videoElement.videoWidth === 0 || videoElement.videoHeight === 0) {
45266
- return;
45267
- }
45268
- try {
45269
- void selfieSegmentation.value.send({ image: videoElement }).catch(() => void 0);
45270
- } catch {
45271
- }
45272
- previewAnimationFrameId.value = requestAnimationFrame(processFrame);
45273
- };
45274
45321
  const startProcessing = () => {
45275
45322
  if (startedProcessing) return;
45276
45323
  startedProcessing = true;
45277
- processFrame();
45324
+ const segmentation = selfieSegmentation.value;
45325
+ if (!segmentation) return;
45326
+ stopPreviewFrameLoop = mediasfuShared.startVirtualBackgroundFrameLoop({
45327
+ owner: segmentation,
45328
+ keepProcessingWhenHidden: props.keepProcessingWhenHidden,
45329
+ shouldContinue: () => loopVersion === previewLoopVersion.value && !pauseSegmentation.value && videoElement.srcObject?.getVideoTracks?.()[0]?.readyState === "live",
45330
+ processFrame: () => videoElement.videoWidth > 0 && videoElement.videoHeight > 0 ? segmentation.send({ image: videoElement }) : void 0
45331
+ });
45278
45332
  };
45279
45333
  videoElement.onloadeddata = startProcessing;
45280
45334
  if (videoElement.readyState >= 2 && videoElement.videoWidth > 0 && videoElement.videoHeight > 0) {
@@ -45373,7 +45427,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45373
45427
  }
45374
45428
  }
45375
45429
  try {
45376
- if (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height) {
45430
+ if (!useBlur && (virtualImage.width < mediaCanvas.width || virtualImage.height < mediaCanvas.height)) {
45377
45431
  repeatMode = "repeat";
45378
45432
  }
45379
45433
  } catch {
@@ -45426,10 +45480,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45426
45480
  };
45427
45481
  const stopPreviewProcessing = () => {
45428
45482
  previewLoopVersion.value++;
45429
- if (previewAnimationFrameId.value !== null) {
45430
- cancelAnimationFrame(previewAnimationFrameId.value);
45431
- previewAnimationFrameId.value = null;
45432
- }
45483
+ stopPreviewFrameLoop?.();
45484
+ stopPreviewFrameLoop = null;
45433
45485
  if (previewCaptureTimeoutId.value !== null) {
45434
45486
  clearTimeout(previewCaptureTimeoutId.value);
45435
45487
  previewCaptureTimeoutId.value = null;
@@ -45641,8 +45693,10 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45641
45693
  console.log("Error preloading model:");
45642
45694
  }
45643
45695
  }
45644
- if (selectedImage.value) {
45696
+ if (selectedImage.value && !mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
45645
45697
  await loadImageToCanvas(selectedImage.value, selectedImage.value);
45698
+ } else if (mediasfuShared.isVirtualBackgroundBlur(selectedImage.value)) {
45699
+ handleBlurBackground();
45646
45700
  } else {
45647
45701
  clearCanvas();
45648
45702
  }
@@ -45759,7 +45813,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45759
45813
  display: "flex",
45760
45814
  alignItems: "center",
45761
45815
  justifyContent: "space-between",
45762
- gap: "10px",
45816
+ gap: "8px",
45763
45817
  padding: "12px 16px 10px",
45764
45818
  borderBottom: "1px solid var(--ms-modern-panel-border)",
45765
45819
  background: panelGradientBackground$2
@@ -45997,15 +46051,16 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
45997
46051
  const defaultApplyButtonProps = vue.computed(() => ({
45998
46052
  class: "ms-modern-background-modal__apply",
45999
46053
  style: {
46000
- minHeight: "36px",
46001
- minWidth: "136px",
46054
+ minHeight: "34px",
46055
+ minWidth: "110px",
46002
46056
  borderRadius: "9999px",
46003
46057
  border: "1px solid var(--ms-modern-panel-border)",
46004
- paddingInline: "16px",
46058
+ paddingInline: "14px",
46059
+ fontSize: "13px",
46005
46060
  background: "var(--ms-modern-field-background)",
46006
46061
  color: "var(--ms-modern-text-primary)",
46007
46062
  fontFamily: "var(--ms-modern-font-family)",
46008
- fontWeight: 700,
46063
+ fontWeight: 600,
46009
46064
  boxShadow: "var(--ms-modern-shadow-soft)",
46010
46065
  cursor: "pointer"
46011
46066
  }
@@ -46023,15 +46078,16 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
46023
46078
  const defaultSaveButtonProps = vue.computed(() => ({
46024
46079
  class: "ms-modern-background-modal__save",
46025
46080
  style: {
46026
- minHeight: "36px",
46027
- minWidth: "136px",
46081
+ minHeight: "34px",
46082
+ minWidth: "110px",
46028
46083
  borderRadius: "9999px",
46029
46084
  border: "none",
46030
- paddingInline: "16px",
46085
+ paddingInline: "14px",
46086
+ fontSize: "13px",
46031
46087
  background: "linear-gradient(135deg, var(--ms-modern-brand-primary) 0%, var(--ms-modern-brand-secondary) 55%, var(--ms-modern-accent) 100%)",
46032
46088
  color: "#ffffff",
46033
46089
  fontFamily: "var(--ms-modern-font-family)",
46034
- fontWeight: 700,
46090
+ fontWeight: 600,
46035
46091
  boxShadow: "var(--ms-modern-shadow-soft)",
46036
46092
  cursor: "pointer"
46037
46093
  }
@@ -46211,6 +46267,36 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
46211
46267
  ]
46212
46268
  );
46213
46269
  });
46270
+ nodes.push(
46271
+ vue.h(
46272
+ "button",
46273
+ {
46274
+ type: "button",
46275
+ "aria-label": "Blur background",
46276
+ style: thumbnailButtonStyle(mediasfuShared.isVirtualBackgroundBlur(selectedImage.value), true),
46277
+ onClick: handleBlurBackground
46278
+ },
46279
+ vue.h(
46280
+ "span",
46281
+ {
46282
+ style: {
46283
+ display: "flex",
46284
+ alignItems: "center",
46285
+ justifyContent: "center",
46286
+ width: "100%",
46287
+ height: "100%",
46288
+ fontFamily: "var(--ms-modern-font-family)",
46289
+ fontSize: "0.85rem",
46290
+ fontWeight: 600,
46291
+ color: "var(--ms-modern-text-primary)",
46292
+ backdropFilter: "blur(10px)",
46293
+ background: "linear-gradient(135deg, rgba(96,165,250,.35), rgba(15,23,42,.8))"
46294
+ }
46295
+ },
46296
+ "Blur"
46297
+ )
46298
+ )
46299
+ );
46214
46300
  nodes.push(
46215
46301
  vue.h(
46216
46302
  "button",
@@ -46397,7 +46483,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
46397
46483
  };
46398
46484
  }
46399
46485
  });
46400
- const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-fb3cadb6"]]);
46486
+ const ModernBackgroundModal = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-fcfc461a"]]);
46401
46487
  const panelGradientBackground$1 = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
46402
46488
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
46403
46489
  __name: "ModernConfirmHereModal",