1use std::collections::HashMap;
24use std::fmt;
25use std::sync::Arc;
26
27use serde_json::Value;
28
29#[cfg(feature = "dates")]
30use jiff::{Timestamp, ZonedDateTime, civil, fmt::strtime, tz::TimeZone};
31
32pub type FilterFn = dyn Fn(&Value, Option<&str>) -> Result<Value, FilterError> + Send + Sync;
38
39#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
45#[error("{message}")]
46pub struct FilterError {
47 message: String,
48}
49
50impl FilterError {
51 #[must_use]
62 pub fn new(message: impl Into<String>) -> Self {
63 Self {
64 message: message.into(),
65 }
66 }
67}
68
69#[derive(Clone)]
93pub struct FilterRegistry {
94 filters: HashMap<String, Arc<FilterFn>>,
95}
96
97impl FilterRegistry {
98 #[must_use]
105 pub fn new() -> Self {
106 Self::default()
107 }
108
109 pub fn insert<F>(&mut self, name: impl Into<String>, filter: F)
124 where
125 F: Fn(&Value, Option<&str>) -> Result<Value, FilterError> + Send + Sync + 'static,
126 {
127 self.filters.insert(name.into(), Arc::new(filter));
128 }
129
130 #[must_use]
132 pub fn get(&self, name: &str) -> Option<&FilterFn> {
133 self.filters.get(name).map(Arc::as_ref)
134 }
135
136 #[must_use]
138 pub fn contains(&self, name: &str) -> bool {
139 self.filters.contains_key(name)
140 }
141
142 pub fn remove(&mut self, name: &str) -> bool {
144 self.filters.remove(name).is_some()
145 }
146
147 #[must_use]
149 pub fn len(&self) -> usize {
150 self.filters.len()
151 }
152
153 #[must_use]
155 pub fn is_empty(&self) -> bool {
156 self.filters.is_empty()
157 }
158}
159
160impl Default for FilterRegistry {
161 fn default() -> Self {
162 let mut filters = HashMap::new();
163 filters.insert("upper".to_owned(), Arc::new(upper) as Arc<FilterFn>);
164 filters.insert("lower".to_owned(), Arc::new(lower) as Arc<FilterFn>);
165 filters.insert("trim".to_owned(), Arc::new(trim) as Arc<FilterFn>);
166 filters.insert("default".to_owned(), Arc::new(default) as Arc<FilterFn>);
167 filters.insert("len".to_owned(), Arc::new(len) as Arc<FilterFn>);
168 filters.insert("join".to_owned(), Arc::new(join) as Arc<FilterFn>);
169 filters.insert("round".to_owned(), Arc::new(round) as Arc<FilterFn>);
170 filters.insert("fixed".to_owned(), Arc::new(fixed) as Arc<FilterFn>);
171 filters.insert("thousands".to_owned(), Arc::new(thousands) as Arc<FilterFn>);
172 filters.insert("percent".to_owned(), Arc::new(percent) as Arc<FilterFn>);
173 #[cfg(feature = "dates")]
174 {
175 filters.insert("date".to_owned(), Arc::new(date) as Arc<FilterFn>);
176 filters.insert("timezone".to_owned(), Arc::new(timezone) as Arc<FilterFn>);
177 }
178 Self { filters }
179 }
180}
181
182impl fmt::Debug for FilterRegistry {
183 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
184 let mut names: Vec<&str> = self.filters.keys().map(String::as_str).collect();
185 names.sort_unstable();
186 f.debug_struct("FilterRegistry")
187 .field("names", &names)
188 .finish()
189 }
190}
191
192fn as_text(value: &Value) -> Result<String, FilterError> {
194 match value {
195 Value::String(text) => Ok(text.clone()),
196 Value::Number(number) => Ok(number.to_string()),
197 Value::Bool(value) => Ok(value.to_string()),
198 Value::Null => Err(FilterError::new("value is null")),
199 Value::Array(_) => Err(FilterError::new("value is an array")),
200 Value::Object(_) => Err(FilterError::new("value is an object")),
201 }
202}
203
204fn upper(value: &Value, _argument: Option<&str>) -> Result<Value, FilterError> {
205 Ok(Value::String(as_text(value)?.to_uppercase()))
206}
207
208fn lower(value: &Value, _argument: Option<&str>) -> Result<Value, FilterError> {
209 Ok(Value::String(as_text(value)?.to_lowercase()))
210}
211
212fn trim(value: &Value, _argument: Option<&str>) -> Result<Value, FilterError> {
213 Ok(Value::String(as_text(value)?.trim().to_owned()))
214}
215
216fn default(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
217 let fallback = argument.ok_or_else(|| {
218 FilterError::new("default needs a fallback value, for example | default: \"n/a\"")
219 })?;
220 if value.is_null() {
221 Ok(Value::String(fallback.to_owned()))
222 } else {
223 Ok(value.clone())
224 }
225}
226
227fn len(value: &Value, _argument: Option<&str>) -> Result<Value, FilterError> {
228 let length = match value {
229 Value::String(text) => text.chars().count(),
230 Value::Array(items) => items.len(),
231 Value::Object(map) => map.len(),
232 Value::Null => 0,
233 Value::Number(_) | Value::Bool(_) => {
234 return Err(FilterError::new(
235 "len needs a string, array or object, not a scalar",
236 ));
237 }
238 };
239 Ok(Value::from(length as u64))
240}
241
242fn join(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
243 let separator = argument.unwrap_or(", ");
244 let Value::Array(items) = value else {
245 return Err(FilterError::new("join needs an array"));
246 };
247
248 let mut parts = Vec::with_capacity(items.len());
249 for item in items {
250 parts.push(as_text(item)?);
251 }
252 Ok(Value::String(parts.join(separator)))
253}
254
255const MAX_DECIMAL_PLACES: usize = 15;
257
258fn value_kind(value: &Value) -> &'static str {
260 match value {
261 Value::Null => "null",
262 Value::Bool(_) => "a boolean",
263 Value::Number(_) => "a number",
264 Value::String(_) => "a string",
265 Value::Array(_) => "an array",
266 Value::Object(_) => "an object",
267 }
268}
269
270fn as_number(value: &Value, name: &str) -> Result<f64, FilterError> {
272 let number = match value {
273 Value::Number(number) => number.as_f64(),
274 Value::String(text) => text.trim().parse::<f64>().ok(),
275 Value::Null | Value::Bool(_) | Value::Array(_) | Value::Object(_) => None,
276 };
277
278 match number {
279 Some(number) if number.is_finite() => Ok(number),
280 Some(_) => Err(FilterError::new(format!("{name} needs a finite number"))),
281 None => Err(FilterError::new(format!(
282 "{name} needs a number, found {}",
283 match value {
284 Value::String(text) => format!("'{text}'"),
285 other => value_kind(other).to_owned(),
286 }
287 ))),
288 }
289}
290
291fn decimal_places(
293 argument: Option<&str>,
294 name: &str,
295 default: usize,
296) -> Result<usize, FilterError> {
297 let Some(raw) = argument else {
298 return Ok(default);
299 };
300
301 let places = raw.trim().parse::<usize>().map_err(|_| {
302 FilterError::new(format!(
303 "{name} needs a whole number of decimal places, found '{raw}'"
304 ))
305 })?;
306
307 if places > MAX_DECIMAL_PLACES {
308 return Err(FilterError::new(format!(
309 "{name} supports at most {MAX_DECIMAL_PLACES} decimal places"
310 )));
311 }
312 Ok(places)
313}
314
315fn number_from_text(text: &str) -> Result<Value, FilterError> {
317 serde_json::from_str::<Value>(text)
318 .map_err(|_| FilterError::new(format!("'{text}' is not a number")))
319}
320
321fn round(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
322 let places = decimal_places(argument, "round", 0)?;
323 let number = as_number(value, "round")?;
324 let factor = 10f64.powi(places as i32);
325 let rounded = (number * factor).round() / factor;
326 number_from_text(&format!("{rounded:.places$}"))
327}
328
329fn fixed(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
330 let Some(argument) = argument else {
331 return Err(FilterError::new(
332 "fixed needs a number of decimal places, for example | fixed: 2",
333 ));
334 };
335 let places = decimal_places(Some(argument), "fixed", 0)?;
336 let number = as_number(value, "fixed")?;
337 Ok(Value::String(format!("{number:.places$}")))
338}
339
340fn thousands(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
341 let separator = argument.unwrap_or(",");
342 let text = match value {
343 Value::Number(number) => number.to_string(),
344 Value::String(text) => {
345 let text = text.trim();
346 as_number(value, "thousands")?;
347 text.to_owned()
348 }
349 other => {
350 return Err(FilterError::new(format!(
351 "thousands needs a number, found {}",
352 value_kind(other)
353 )));
354 }
355 };
356 Ok(Value::String(group_thousands(&text, separator)))
357}
358
359fn percent(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
360 let places = decimal_places(argument, "percent", 0)?;
361 let number = as_number(value, "percent")?;
362 Ok(Value::String(format!("{:.places$}%", number * 100.0)))
363}
364
365fn group_thousands(text: &str, separator: &str) -> String {
367 let (mantissa, exponent) = match text.find(['e', 'E']) {
368 Some(index) => (&text[..index], &text[index..]),
369 None => (text, ""),
370 };
371
372 let (sign, mantissa) = match mantissa.strip_prefix('-') {
373 Some(rest) => ("-", rest),
374 None => ("", mantissa.strip_prefix('+').unwrap_or(mantissa)),
375 };
376
377 let (integer, fraction) = match mantissa.split_once('.') {
378 Some((integer, fraction)) => (integer, Some(fraction)),
379 None => (mantissa, None),
380 };
381
382 let mut grouped = String::with_capacity(text.len() + text.len() / 3);
383 grouped.push_str(sign);
384 grouped.push_str(&group_digits(integer, separator));
385 if let Some(fraction) = fraction {
386 grouped.push('.');
387 grouped.push_str(fraction);
388 }
389 grouped.push_str(exponent);
390 grouped
391}
392
393fn group_digits(digits: &str, separator: &str) -> String {
395 let mut reversed = String::with_capacity(digits.len() + digits.len() / 3);
396 for (index, digit) in digits.chars().rev().enumerate() {
397 if index > 0 && index % 3 == 0 {
398 reversed.push_str(separator);
399 }
400 reversed.push(digit);
401 }
402 reversed.chars().rev().collect()
403}
404
405#[cfg(feature = "dates")]
407enum DateTimeValue {
408 Zoned(ZonedDateTime),
410 Naive(civil::DateTime),
412}
413
414#[cfg(feature = "dates")]
420fn parse_datetime(value: &Value) -> Result<DateTimeValue, FilterError> {
421 match value {
422 Value::String(text) => {
423 let text = text.trim();
424
425 if let Ok(datetime) = text.parse::<civil::DateTime>() {
426 return Ok(DateTimeValue::Naive(datetime));
427 }
428 if let Ok(date) = text.parse::<civil::Date>() {
429 return Ok(DateTimeValue::Naive(civil::DateTime::from(date)));
430 }
431 if let Ok(zoned) = text.parse::<ZonedDateTime>() {
432 return Ok(DateTimeValue::Zoned(zoned));
433 }
434 if let Ok(timestamp) = text.parse::<Timestamp>() {
435 return Ok(DateTimeValue::Zoned(
436 timestamp.to_zoned_datetime(TimeZone::UTC),
437 ));
438 }
439
440 Err(FilterError::new(format!(
441 "'{text}' is not a date; use an ISO 8601 value such as 2024-06-01T12:00:00Z"
442 )))
443 }
444 Value::Number(number) => {
445 let seconds = number
446 .as_i64()
447 .or_else(|| {
448 let value = number.as_f64()?;
449 (value.fract() == 0.0 && value.abs() <= 9_007_199_254_740_992.0)
450 .then_some(value as i64)
451 })
452 .ok_or_else(|| FilterError::new("date needs a whole number of epoch seconds"))?;
453
454 let timestamp = Timestamp::from_second(seconds).map_err(|error| {
455 FilterError::new(format!(
456 "'{seconds}' is outside the supported date range: {error}"
457 ))
458 })?;
459 Ok(DateTimeValue::Zoned(
460 timestamp.to_zoned_datetime(TimeZone::UTC),
461 ))
462 }
463 other => Err(FilterError::new(format!(
464 "date needs an ISO 8601 string or a number of epoch seconds, found {}",
465 value_kind(other)
466 ))),
467 }
468}
469
470#[cfg(feature = "dates")]
472fn date(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
473 let format = argument
474 .ok_or_else(|| FilterError::new("date needs a format, for example | date: \"%Y-%m-%d\""))?;
475
476 let formatted = match parse_datetime(value)? {
477 DateTimeValue::Zoned(zoned) => strtime::format(format, &zoned),
478 DateTimeValue::Naive(datetime) => strtime::format(format, datetime),
479 }
480 .map_err(|error| {
481 FilterError::new(format!("cannot format the date with '{format}': {error}"))
482 })?;
483
484 Ok(Value::String(formatted))
485}
486
487#[cfg(feature = "dates")]
489fn timezone(value: &Value, argument: Option<&str>) -> Result<Value, FilterError> {
490 let name = argument.ok_or_else(|| {
491 FilterError::new("timezone needs a zone name, for example | timezone: \"Europe/Paris\"")
492 })?;
493
494 let zone = if name.eq_ignore_ascii_case("local") {
495 TimeZone::system()
496 } else {
497 TimeZone::get(name)
498 .map_err(|error| FilterError::new(format!("unknown time zone '{name}': {error}")))?
499 };
500
501 let zoned = match parse_datetime(value)? {
502 DateTimeValue::Zoned(zoned) => zoned.with_time_zone(zone),
503 DateTimeValue::Naive(datetime) => datetime.to_zoned_datetime(zone).map_err(|error| {
504 FilterError::new(format!(
505 "'{name}' cannot represent that local date and time: {error}"
506 ))
507 })?,
508 };
509
510 let text = strtime::format("%Y-%m-%dT%H:%M:%S%.f%:z", &zoned)
511 .map_err(|error| FilterError::new(format!("cannot write the converted date: {error}")))?;
512 Ok(Value::String(text))
513}
514
515#[cfg(test)]
516mod tests {
517 #![allow(
518 clippy::unwrap_used,
519 clippy::expect_used,
520 clippy::panic,
521 clippy::indexing_slicing
522 )]
523
524 use super::*;
525 use serde_json::json;
526
527 fn call(registry: &FilterRegistry, name: &str, value: Value, argument: Option<&str>) -> Value {
528 let filter = registry.get(name).expect("filter must exist");
529 filter(&value, argument).expect("filter must succeed")
530 }
531
532 #[test]
533 fn builtins_are_registered() {
534 let registry = FilterRegistry::default();
535 for name in ["upper", "lower", "trim", "default", "len", "join"] {
536 assert!(registry.contains(name), "{name}");
537 }
538 }
539
540 #[test]
541 fn upper_lower_and_trim_change_text() {
542 let registry = FilterRegistry::default();
543 assert_eq!(call(®istry, "upper", json!("Ada"), None), json!("ADA"));
544 assert_eq!(call(®istry, "lower", json!("Ada"), None), json!("ada"));
545 assert_eq!(call(®istry, "trim", json!(" Ada "), None), json!("Ada"));
546 }
547
548 #[test]
549 fn string_filters_format_scalars() {
550 let registry = FilterRegistry::default();
551 assert_eq!(call(®istry, "upper", json!(42), None), json!("42"));
552 assert_eq!(call(®istry, "upper", json!(true), None), json!("TRUE"));
553 }
554
555 #[test]
556 fn string_filters_reject_structured_values() {
557 let registry = FilterRegistry::default();
558 let filter = registry.get("upper").unwrap();
559 assert!(filter(&json!([1]), None).is_err());
560 assert!(filter(&json!({"a": 1}), None).is_err());
561 assert!(filter(&json!(null), None).is_err());
562 }
563
564 #[test]
565 fn default_replaces_null_only() {
566 let registry = FilterRegistry::default();
567 assert_eq!(
568 call(®istry, "default", json!(null), Some("n/a")),
569 json!("n/a")
570 );
571 assert_eq!(
572 call(®istry, "default", json!("Ada"), Some("n/a")),
573 json!("Ada")
574 );
575 assert_eq!(
576 call(®istry, "default", json!(""), Some("n/a")),
577 json!("")
578 );
579 }
580
581 #[test]
582 fn default_requires_an_argument() {
583 let registry = FilterRegistry::default();
584 assert!(registry.get("default").unwrap()(&json!(null), None).is_err());
585 }
586
587 #[test]
588 fn len_counts_text_array_and_object() {
589 let registry = FilterRegistry::default();
590 assert_eq!(call(®istry, "len", json!("héllo"), None), json!(5));
591 assert_eq!(call(®istry, "len", json!([1, 2, 3]), None), json!(3));
592 assert_eq!(call(®istry, "len", json!({"a": 1}), None), json!(1));
593 assert_eq!(call(®istry, "len", json!(null), None), json!(0));
594 }
595
596 #[test]
597 fn join_uses_the_argument_as_separator() {
598 let registry = FilterRegistry::default();
599 assert_eq!(
600 call(®istry, "join", json!(["a", "b"]), Some(" + ")),
601 json!("a + b")
602 );
603 assert_eq!(
604 call(®istry, "join", json!(["a", "b"]), None),
605 json!("a, b")
606 );
607 }
608
609 #[test]
610 fn join_rejects_a_non_array() {
611 let registry = FilterRegistry::default();
612 assert!(registry.get("join").unwrap()(&json!("a"), None).is_err());
613 }
614
615 #[test]
616 fn insert_replaces_a_builtin() {
617 let mut registry = FilterRegistry::default();
618 registry.insert("upper", |value, _| Ok(value.clone()));
619 assert_eq!(call(®istry, "upper", json!("Ada"), None), json!("Ada"));
620 }
621
622 #[test]
623 fn remove_reports_whether_the_filter_was_present() {
624 let mut registry = FilterRegistry::default();
625 assert!(registry.remove("upper"));
626 assert!(!registry.remove("upper"));
627 assert!(!registry.contains("upper"));
628 }
629
630 #[test]
631 fn debug_lists_the_names() {
632 let registry = FilterRegistry::default();
633 let rendered = format!("{registry:?}");
634 assert!(rendered.contains("upper"), "{rendered}");
635 assert!(rendered.contains("join"), "{rendered}");
636 }
637
638 #[test]
639 fn number_filters_are_registered() {
640 let registry = FilterRegistry::default();
641 for name in ["round", "fixed", "thousands", "percent"] {
642 assert!(registry.contains(name), "{name}");
643 }
644 }
645
646 #[test]
647 fn round_uses_half_away_from_zero() {
648 let registry = FilterRegistry::default();
649 assert_eq!(call(®istry, "round", json!(2.5), None), json!(3));
650 assert_eq!(call(®istry, "round", json!(-2.5), None), json!(-3));
651 assert_eq!(
652 call(®istry, "round", json!(1234.5678), Some("2")),
653 json!(1234.57)
654 );
655 }
656
657 #[test]
658 fn fixed_keeps_the_requested_places() {
659 let registry = FilterRegistry::default();
660 assert_eq!(
661 call(®istry, "fixed", json!(2.5), Some("2")),
662 json!("2.50")
663 );
664 assert_eq!(
665 call(®istry, "fixed", json!(1234.5678), Some("0")),
666 json!("1235")
667 );
668 }
669
670 #[test]
671 fn thousands_groups_the_integer_digits() {
672 let registry = FilterRegistry::default();
673 assert_eq!(
674 call(®istry, "thousands", json!(1234567.89), None),
675 json!("1,234,567.89")
676 );
677 assert_eq!(
678 call(®istry, "thousands", json!(-1234567), Some(" ")),
679 json!("-1 234 567")
680 );
681 assert_eq!(
682 call(®istry, "thousands", json!("1234.5"), None),
683 json!("1,234.5")
684 );
685 }
686
687 #[test]
688 fn percent_multiplies_by_one_hundred() {
689 let registry = FilterRegistry::default();
690 assert_eq!(
691 call(®istry, "percent", json!(0.1234), None),
692 json!("12%")
693 );
694 assert_eq!(
695 call(®istry, "percent", json!(0.1234), Some("1")),
696 json!("12.3%")
697 );
698 }
699
700 #[test]
701 fn number_filters_reject_non_numbers() {
702 let registry = FilterRegistry::default();
703 for name in ["round", "fixed", "thousands", "percent"] {
704 let filter = registry.get(name).unwrap();
705 let argument = (name == "fixed").then_some("2");
706 assert!(filter(&json!("abc"), argument).is_err(), "{name}");
707 assert!(filter(&json!(true), argument).is_err(), "{name}");
708 assert!(filter(&json!([1]), argument).is_err(), "{name}");
709 }
710 }
711
712 #[test]
713 fn number_filters_reject_too_many_places() {
714 let registry = FilterRegistry::default();
715 assert!(registry.get("round").unwrap()(&json!(1.5), Some("16")).is_err());
716 assert!(registry.get("round").unwrap()(&json!(1.5), Some("two")).is_err());
717 }
718
719 #[cfg(feature = "dates")]
720 #[test]
721 fn date_filters_are_registered() {
722 let registry = FilterRegistry::default();
723 for name in ["date", "timezone"] {
724 assert!(registry.contains(name), "{name}");
725 }
726 }
727
728 #[cfg(feature = "dates")]
729 #[test]
730 fn date_formats_an_instant_and_a_naive_value() {
731 let registry = FilterRegistry::default();
732 assert_eq!(
733 call(
734 ®istry,
735 "date",
736 json!("2024-06-01T12:34:56Z"),
737 Some("%Y-%m-%d %H:%M")
738 ),
739 json!("2024-06-01 12:34")
740 );
741 assert_eq!(
742 call(
743 ®istry,
744 "date",
745 json!("2024-06-01T12:34:56"),
746 Some("%d/%m/%Y %H:%M")
747 ),
748 json!("01/06/2024 12:34")
749 );
750 assert_eq!(
751 call(®istry, "date", json!("2024-06-01"), Some("%B %-d, %Y")),
752 json!("June 1, 2024")
753 );
754 }
755
756 #[cfg(feature = "dates")]
757 #[test]
758 fn date_reads_epoch_seconds() {
759 let registry = FilterRegistry::default();
760 assert_eq!(
761 call(
762 ®istry,
763 "date",
764 json!(1_717_245_296),
765 Some("%Y-%m-%dT%H:%M:%SZ")
766 ),
767 json!("2024-06-01T12:34:56Z")
768 );
769 }
770
771 #[cfg(feature = "dates")]
772 #[test]
773 fn timezone_converts_an_instant() {
774 let registry = FilterRegistry::default();
775 let converted = call(
776 ®istry,
777 "timezone",
778 json!("2024-06-01T12:00:00Z"),
779 Some("Europe/Paris"),
780 );
781 assert_eq!(converted, json!("2024-06-01T14:00:00+02:00"));
782 assert_eq!(
783 call(®istry, "date", converted, Some("%H:%M")),
784 json!("14:00")
785 );
786 }
787
788 #[cfg(feature = "dates")]
789 #[test]
790 fn timezone_attaches_a_zone_to_a_naive_value() {
791 let registry = FilterRegistry::default();
792 assert_eq!(
793 call(
794 ®istry,
795 "timezone",
796 json!("2024-06-01T12:00:00"),
797 Some("Asia/Tokyo")
798 ),
799 json!("2024-06-01T12:00:00+09:00")
800 );
801 }
802
803 #[cfg(feature = "dates")]
804 #[test]
805 fn date_and_timezone_report_clear_errors() {
806 let registry = FilterRegistry::default();
807
808 let unknown =
809 registry.get("timezone").unwrap()(&json!("2024-06-01T12:00:00Z"), Some("Mars/Olympus"))
810 .unwrap_err();
811 assert!(
812 unknown.to_string().contains("unknown time zone"),
813 "{unknown}"
814 );
815
816 let bad_date = registry.get("date").unwrap()(&json!("not a date"), Some("%Y")).unwrap_err();
817 assert!(bad_date.to_string().contains("is not a date"), "{bad_date}");
818
819 let missing_format = registry.get("date").unwrap()(&json!("2024-06-01"), None).unwrap_err();
820 assert!(
821 missing_format.to_string().contains("needs a format"),
822 "{missing_format}"
823 );
824 }
825}