4. Given Rt $\triangle A B C$ and Rt $\triangle A D C$ share the hypotenuse $A C, M$ and $N$ are the midpoints of sides $A C$ and $B D$ respectively. If $\angle B A C=30^{\circ}, \angle C A D=45^{\circ}, M N=1$, then the length of $A C$ is
4. $2(\sqrt{6} \pm \sqrt{2})$.

In two scenarios:
(1) When points $B$ and $D$ are on the same side of line $A C$, as shown in Figure 4, connect $D M$ and $B M$.
Then $M D = M B = \frac{1}{2} A C$, and $D M \perp A C$.
Thus, $\triangle B C M$ is an equilateral triangle.
Therefore, $\angle D M B = \angle D M C - \angle B M C = 30^{\circ}$.
In $\triangle D M B$, according to the "three lines coincide" property,
$M N \perp B D$, and $\angle B M N = \frac{1}{2} \angle D M B = 15^{\circ}$.
From $2 \cos^2 15^{\circ} - 1 = \cos 30^{\circ} = \frac{\sqrt{3}}{2}$, we get
$$
\cos 15^{\circ} = \frac{\sqrt{6} + \sqrt{2}}{4}.
$$

Thus, $A C = \frac{2 M N}{\cos 15^{\circ}} = 2(\sqrt{6} - \sqrt{2})$.
(2) When points $B$ and $D$ are on opposite sides of line $A C$, as shown in Figure 5, we have
$$
\angle B M D = \angle B M C + \angle D M C = 150^{\circ}.
$$

Similarly, $A C = 2(\sqrt{6} + \sqrt{2})$.