(a)When the plaintiff in an action or special proceeding resides out of the state, or is a foreign corporation, the defendant may at any time apply to the court by noticed motion for an order requiring the plaintiff to file an undertaking to secure an award of costs and attorney's fees which may be awarded in the action or special proceeding. For the purposes of this section, "attorney's fees" means reasonable attorney's fees a party may be authorized to recover by a statute apart from this section or by contract.
(b)The motion shall be made on the grounds that the plaintiff resides out of the state or is a foreign corporation and that there is a reasonable possibility that the moving defendant will obtain judgment in the action or special proceeding. The motion shall be accompanied by an affidavit in support of the grounds for the motion and by a memorandum of points and authorities. The affidavit shall set forth the nature and amount of the costs and attorney's fees the defendant has incurred and expects to incur by the conclusion of the action or special proceeding.
(c)If the court, after hearing, determines that the grounds for the motion have been established, the court shall order that the plaintiff file the undertaking in an amount specified in the court's order as security for costs and attorney's fees.
(d)The plaintiff shall file the undertaking not later than 30 days after service of the court's order requiring it or within a greater time allowed by the court. If the plaintiff fails to file the undertaking within the time allowed, the plaintiff's action or special proceeding shall be dismissed as to the defendant in whose favor the order requiring the undertaking was made.
(e)If the defendant's motion for an order requiring an undertaking is filed not later than 30 days after service of summons on the defendant, further proceedings may be stayed in the discretion of the court upon application to the court by the defendant by noticed motion for the stay until 10 days after the motion for the undertaking is denied or, if granted, until 10 days after the required undertaking has been filed and the defendant has been served with a copy of the undertaking. The hearing on the application for the stay shall be held not later than 60 days after service of the summons. If the defendant files a motion for an order requiring an undertaking, which is granted but the defendant objects to the undertaking, the court may in its discretion stay the proceedings not longer than 10 days after a sufficient undertaking has been filed and the defendant has been served with a copy of the undertaking.
(f)The determinations of the court under this section have no effect on the determination of any issues on the merits of the action or special proceeding and may not be given in evidence nor referred to in the trial of the action or proceeding.
(g)An order granting or denying a motion for an undertaking under this section is not appealable.