Before a witness is committed to jail under subdivision (4) of section 29-507 or 29-508, he or she shall:
(1) Receive written notice of the allegations upon which the state relied for its claim of a right to require a recognizance or detention and of the time and place of the hearing on those allegations;
(2) Have a hearing before a judge;
(3) Have the evidence in support of the state's claim disclosed to him or her at a hearing;
(4) Have an opportunity to be heard in person and to present witnesses and documentary evidence;
(5) Have, to the extent practicable, the right to confront and cross-examine witnesses;
(6) Have the right to counsel; and
(7) Be given a written statement by the decisionmaker as to the evidence relied upon and the reasons for the decision made.
A decision to commit a person to jail may be appealed and shall be given priority on the appellate court's calendar.