Pasting image with feathered edges in Javascript

I have two images, and have created an ROI from the second image that I’d like to paste into the first image, but with its edges feathered (with a transparency gradient), like this.

I’ve seen solutions to this in Python, but I don’t know how to do this in the Javascript version of openCV.

I think I need to first create a mask and blur it, but I don’t know how to do that:

let mask = cv.Mat.zeros(src.rows, src.cols, cv.CV_8U);
let rect = new cv.Rect(25, 25, 100, 100);
//how do I set the mask to 255 where the rect is?

Once I have this mask, how would I do the alpha blending?

thank you

related: