1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
//! High-performance, ergonomic editor layer for ASS subtitles
//!
//! `ass-editor` provides an interactive editing interface built on top of `ass-core`,
//! featuring zero-copy efficiency, incremental updates, and multi-document support.
//! Designed for building subtitle editors, conversion tools, and automation scripts.
//!
//! # Key Features
//!
//! ## ๐ Interactive Editing
//! - **Undo/redo**: Full history management with configurable depth
//! - **Multi-document sessions**: Manage multiple files with shared resources
//! - **Incremental parsing**: <1ms edits, <5ms re-parses via ass-core's streaming parser
//! - **Fluent APIs**: Ergonomic builders and method chaining for all operations
//!
//! ## โก High Performance
//! - **Zero-copy editing**: Direct manipulation of ass-core's zero-copy spans
//! - **Memory efficient**: ~1.2x input size including undo history with arena pooling
//! - **SIMD acceleration**: Optional SIMD features for parsing performance
//! - **Thread-safe**: Optional multi-threading support with Arc/Mutex
//!
//! ## ๐ Advanced Features
//! - **Search indexing**: FST-based trie indexing for fast regex queries across large scripts
//! - **Plugin system**: Extensible architecture with syntax highlighting and auto-completion
//! - **Format support**: Import/export SRT, WebVTT with configurable conversion options
//! - **Karaoke support**: Generate, split, adjust, and apply karaoke timing with syllable detection
//!
//! # Quick Start
//!
//! ```
//! use ass_editor::{EditorDocument, Position, Range};
//!
//! // Create a new document with ASS content
//! let mut doc = EditorDocument::from_content(r#"
//! [Script Info]
//! Title: My Subtitle
//!
//! [V4+ Styles]
//! Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
//! Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,0,2,10,10,10,1
//!
//! [Events]
//! Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
//! Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,Hello World
//! "#).unwrap();
//!
//! // Basic text editing with position-based operations
//! let pos = Position::new(doc.text().len() - 11); // Before "Hello World"
//! doc.insert(pos, "Welcome! ").unwrap();
//!
//! // Range-based operations
//! let range = Range::new(Position::new(pos.offset), Position::new(pos.offset + 8));
//! doc.replace(range, "Hi").unwrap();
//!
//! // Undo/redo support
//! assert!(doc.can_undo());
//! doc.undo().unwrap();
//! assert!(doc.can_redo());
//! doc.redo().unwrap();
//!
//! println!("Final text contains: {}", doc.text().contains("Hi World"));
//! ```
//!
//! # Advanced Usage Examples
//!
//! ## Style Management
//!
//! ```
//! # use ass_editor::{EditorDocument, StyleBuilder};
//! let mut doc = EditorDocument::new();
//!
//! // Create styles with builder pattern
//! let style = StyleBuilder::new()
//! .font("Arial")
//! .size(24)
//! .color("&H00FFFFFF")
//! .bold(true);
//!
//! // Apply styles to document
//! doc.styles().create("Title", style).unwrap();
//! ```
//!
//! ## Karaoke Timing
//!
//! ```
//! # use ass_editor::{EditorDocument, Position, Range, commands::karaoke_commands::*};
//! let mut doc = EditorDocument::from_content("Karaoke text here").unwrap();
//! let range = Range::new(Position::new(0), Position::new(17));
//!
//! // Generate karaoke with automatic syllable detection
//! doc.karaoke()
//! .in_range(range)
//! .generate(50) // 50 centiseconds per syllable
//! .karaoke_type(KaraokeType::Fill)
//! .execute()
//! .unwrap();
//!
//! // Adjust timing
//! doc.karaoke()
//! .in_range(range)
//! .adjust()
//! .scale(1.5) // Make 50% longer
//! .unwrap();
//! ```
//!
//! ## Multi-Document Sessions
//!
//! ```
//! # #[cfg(feature = "std")]
//! # {
//! # use ass_editor::{EditorSessionManager, SessionConfig};
//! let mut manager = EditorSessionManager::new();
//!
//! manager.create_session("subtitle1.ass".to_string()).unwrap();
//! manager.create_session("subtitle2.ass".to_string()).unwrap();
//!
//! // Switch between sessions with <100ยตs overhead
//! manager.switch_session("subtitle1.ass").unwrap();
//! // Edit session1...
//!
//! manager.switch_session("subtitle2.ass").unwrap();
//! // Edit session2 with shared plugins and memory pools...
//! # }
//! ```
//!
//! # Feature Flags
//!
//! ass-editor uses a two-tier feature system for maximum flexibility:
//!
//! ## Main Flavors
//! - **`default`**: Enables `full` for complete desktop functionality
//! - **`minimal`**: Core editing features - no_std compatible with alloc
//! - **`full`**: All features including std, analysis, plugins, formats, search, concurrency
//!
//! ## Optional Features
//! - **`simd`**: SIMD acceleration for parsing performance
//! - **`nostd`**: No-standard library support for embedded/WASM
//! - **`dev-benches`**: Development benchmarking
//!
//! ## Usage Examples
//!
//! ```toml
//! # Full-featured desktop editor (default)
//! ass-editor = "0.1"
//!
//! # Minimal editor for lightweight integrations
//! ass-editor = { version = "0.1", default-features = false, features = ["minimal"] }
//!
//! # Maximum performance with SIMD
//! ass-editor = { version = "0.1", features = ["full", "simd"] }
//!
//! # WASM/embedded build
//! ass-editor = { version = "0.1", default-features = false, features = ["minimal", "nostd"] }
//! ```
extern crate alloc;
// Re-export ass-core types as first-class citizens
pub use ;
pub use Script;
// Public API exports
pub use ;
pub use ;
// Re-export the fluent EventFilter directly
pub use EventFilter;
// Re-export the events EventFilter with a specific name to avoid conflict
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;