use crate::document_core::DocumentCore;
use crate::error::HwpError;
use crate::model::control::Control;
use crate::model::event::DocumentEvent;
impl DocumentCore {
fn find_note_equation_ref(
&self,
kind: &str,
section_idx: usize,
parent_para_idx: usize,
note_control_idx: usize,
note_para_idx: usize,
inner_control_idx: usize,
) -> Result<&crate::model::control::Equation, HwpError> {
let section = self.document.sections.get(section_idx).ok_or_else(|| {
HwpError::RenderError(format!("구역 인덱스 {} 범위 초과", section_idx))
})?;
let para = section.paragraphs.get(parent_para_idx).ok_or_else(|| {
HwpError::RenderError(format!("문단 인덱스 {} 범위 초과", parent_para_idx))
})?;
let note_para = match para.controls.get(note_control_idx) {
Some(Control::Footnote(note)) if kind == "footnote" => {
note.paragraphs.get(note_para_idx)
}
Some(Control::Endnote(note)) if kind == "endnote" => note.paragraphs.get(note_para_idx),
_ => None,
}
.ok_or_else(|| {
HwpError::RenderError(format!(
"각주/미주 문단을 찾을 수 없습니다: kind={} sec={} para={} ctrl={} note_para={}",
kind, section_idx, parent_para_idx, note_control_idx, note_para_idx
))
})?;
match note_para.controls.get(inner_control_idx) {
Some(Control::Equation(eq)) => Ok(eq),
_ => Err(HwpError::RenderError(format!(
"각주/미주 내부 컨트롤 {}은 수식이 아닙니다",
inner_control_idx
))),
}
}
fn find_note_equation_mut(
&mut self,
kind: &str,
section_idx: usize,
parent_para_idx: usize,
note_control_idx: usize,
note_para_idx: usize,
inner_control_idx: usize,
) -> Result<&mut crate::model::control::Equation, HwpError> {
let section = self.document.sections.get_mut(section_idx).ok_or_else(|| {
HwpError::RenderError(format!("구역 인덱스 {} 범위 초과", section_idx))
})?;
let para = section.paragraphs.get_mut(parent_para_idx).ok_or_else(|| {
HwpError::RenderError(format!("문단 인덱스 {} 범위 초과", parent_para_idx))
})?;
let note_para = match para.controls.get_mut(note_control_idx) {
Some(Control::Footnote(note)) if kind == "footnote" => {
note.paragraphs.get_mut(note_para_idx)
}
Some(Control::Endnote(note)) if kind == "endnote" => {
note.paragraphs.get_mut(note_para_idx)
}
_ => None,
}
.ok_or_else(|| {
HwpError::RenderError(format!(
"각주/미주 문단을 찾을 수 없습니다: kind={} sec={} para={} ctrl={} note_para={}",
kind, section_idx, parent_para_idx, note_control_idx, note_para_idx
))
})?;
match note_para.controls.get_mut(inner_control_idx) {
Some(Control::Equation(eq)) => Ok(eq),
_ => Err(HwpError::RenderError(format!(
"각주/미주 내부 컨트롤 {}은 수식이 아닙니다",
inner_control_idx
))),
}
}
pub fn get_note_equation_properties_native(
&self,
kind: &str,
section_idx: usize,
parent_para_idx: usize,
note_control_idx: usize,
note_para_idx: usize,
inner_control_idx: usize,
) -> Result<String, HwpError> {
let eq = self.find_note_equation_ref(
kind,
section_idx,
parent_para_idx,
note_control_idx,
note_para_idx,
inner_control_idx,
)?;
Ok(Self::equation_properties_json(eq))
}
pub fn set_note_equation_properties_native(
&mut self,
kind: &str,
section_idx: usize,
parent_para_idx: usize,
note_control_idx: usize,
note_para_idx: usize,
inner_control_idx: usize,
props_json: &str,
) -> Result<String, HwpError> {
let dpi = self.dpi;
let eq = self.find_note_equation_mut(
kind,
section_idx,
parent_para_idx,
note_control_idx,
note_para_idx,
inner_control_idx,
)?;
Self::apply_equation_properties(eq, dpi, props_json);
let section = &mut self.document.sections[section_idx];
section.raw_stream = None;
self.recompose_section(section_idx);
self.paginate_if_needed();
Ok(crate::document_core::helpers::json_ok())
}
pub(crate) fn footnote_numbering_name(
numbering: crate::model::footnote::FootnoteNumbering,
) -> &'static str {
use crate::model::footnote::FootnoteNumbering;
match numbering {
FootnoteNumbering::Continue => "continue",
FootnoteNumbering::RestartSection => "restartSection",
FootnoteNumbering::RestartPage => "restartPage",
}
}
pub(crate) fn footnote_numbering_from_str(
value: &str,
fallback: crate::model::footnote::FootnoteNumbering,
) -> crate::model::footnote::FootnoteNumbering {
use crate::model::footnote::FootnoteNumbering;
match value {
"continue" | "CONTINUOUS" | "continuous" => FootnoteNumbering::Continue,
"restartSection" | "ON_SECTION" | "RESTART_SECTION" | "onSection" => {
FootnoteNumbering::RestartSection
}
"restartPage" | "ON_PAGE" | "RESTART_PAGE" | "onPage" => FootnoteNumbering::RestartPage,
_ => fallback,
}
}
pub(crate) fn footnote_placement_name(
placement: crate::model::footnote::FootnotePlacement,
) -> &'static str {
use crate::model::footnote::FootnotePlacement;
match placement {
FootnotePlacement::EachColumn => "documentEnd",
FootnotePlacement::BelowText => "sectionEnd",
FootnotePlacement::RightColumn => "rightColumn",
}
}
pub(crate) fn footnote_placement_from_str(
value: &str,
fallback: crate::model::footnote::FootnotePlacement,
) -> crate::model::footnote::FootnotePlacement {
use crate::model::footnote::FootnotePlacement;
match value {
"documentEnd" | "eachColumn" => FootnotePlacement::EachColumn,
"sectionEnd" | "belowText" => FootnotePlacement::BelowText,
"rightColumn" => FootnotePlacement::RightColumn,
_ => fallback,
}
}
pub(crate) fn json_escape_note_char(ch: char) -> String {
if ch == '\0' {
String::new()
} else {
crate::document_core::helpers::json_escape(&ch.to_string())
}
}
fn make_note_inner_paragraph(
number_type: crate::model::control::AutoNumberType,
number: u16,
format: u8,
prefix_char: char,
suffix_char: char,
default_char_shape_id: u32,
para_shape_id: u16,
style_id: u8,
) -> crate::model::paragraph::Paragraph {
use crate::model::paragraph::{CharShapeRef, LineSeg, Paragraph};
let auto_num = crate::model::control::AutoNumber {
number_type,
format,
superscript: false,
number,
assigned_number: number,
user_symbol: '\0',
prefix_char,
suffix_char,
};
Paragraph {
text: " ".to_string(),
char_count: 10,
char_count_msb: true,
control_mask: 1u32 << 0x12,
char_offsets: vec![0, 8],
para_shape_id,
style_id,
char_shapes: vec![CharShapeRef {
start_pos: 0,
char_shape_id: default_char_shape_id,
}],
controls: vec![crate::model::control::Control::AutoNumber(auto_num)],
line_segs: vec![LineSeg {
text_start: 0,
line_height: 1000,
text_height: 1000,
baseline_distance: 850,
line_spacing: 600,
segment_width: 0,
tag: LineSeg::TAG_SINGLE_SEGMENT_LINE,
..Default::default()
}],
has_para_text: true,
..Default::default()
}
}
fn note_style(
&self,
local_name: &str,
english_name: &str,
) -> Option<(u8, &crate::model::style::Style)> {
let styles = &self.document.doc_info.styles;
let idx = styles.iter().position(|style| {
style.local_name == local_name || style.english_name.eq_ignore_ascii_case(english_name)
})?;
Some((u8::try_from(idx).ok()?, &styles[idx]))
}
fn endnote_style_defaults(
&self,
section_idx: usize,
para_idx: usize,
char_offset: usize,
) -> (u32, u16, u8) {
let section = &self.document.sections[section_idx];
for para in §ion.paragraphs {
for ctrl in ¶.controls {
if let Control::Endnote(en) = ctrl {
if let Some(ep) = en.paragraphs.first() {
let char_shape_id = ep
.char_shapes
.first()
.map(|cs| cs.char_shape_id)
.unwrap_or(0);
return (char_shape_id, ep.para_shape_id, ep.style_id);
}
}
}
}
if let Some((idx, style)) = self.note_style("미주", "Endnote") {
return (style.char_shape_id as u32, style.para_shape_id, idx);
}
let current_para = §ion.paragraphs[para_idx];
(
current_para.char_shape_id_at(char_offset).unwrap_or(0),
current_para.para_shape_id,
current_para.style_id,
)
}
pub fn insert_footnote_native(
&mut self,
section_idx: usize,
para_idx: usize,
char_offset: usize,
) -> Result<String, HwpError> {
use crate::model::footnote::Footnote;
use crate::model::paragraph::{CharShapeRef, LineSeg, Paragraph};
if section_idx >= self.document.sections.len() {
return Err(HwpError::RenderError(format!(
"구역 인덱스 {} 범위 초과",
section_idx
)));
}
if para_idx >= self.document.sections[section_idx].paragraphs.len() {
return Err(HwpError::RenderError(format!(
"문단 인덱스 {} 범위 초과",
para_idx
)));
}
let footnote_number = {
let mut count = 0u16;
let section = &self.document.sections[section_idx];
for (pi, para) in section.paragraphs.iter().enumerate() {
let is_before = pi < para_idx;
let is_same = pi == para_idx;
for (ci, ctrl) in para.controls.iter().enumerate() {
match ctrl {
Control::Footnote(_) => {
if is_before {
count += 1;
} else if is_same {
let positions =
crate::document_core::helpers::find_control_text_positions(
para,
);
let pos = positions.get(ci).copied().unwrap_or(usize::MAX);
if pos <= char_offset {
count += 1;
}
}
}
Control::Table(table)
if is_before
|| (is_same && {
let positions =
crate::document_core::helpers::find_control_text_positions(
para,
);
positions.get(ci).copied().unwrap_or(usize::MAX) <= char_offset
}) =>
{
for cell in &table.cells {
for cp in &cell.paragraphs {
count +=
cp.controls
.iter()
.filter(|c| matches!(c, Control::Footnote(_)))
.count() as u16;
}
}
}
Control::Shape(shape)
if is_before
|| (is_same && {
let positions =
crate::document_core::helpers::find_control_text_positions(
para,
);
positions.get(ci).copied().unwrap_or(usize::MAX) <= char_offset
}) =>
{
if let Some(text_box) =
shape.drawing().and_then(|d| d.text_box.as_ref())
{
for tp in &text_box.paragraphs {
count +=
tp.controls
.iter()
.filter(|c| matches!(c, Control::Footnote(_)))
.count() as u16;
}
}
}
_ => {}
}
}
}
count + 1
};
let (default_char_shape_id, default_para_shape_id, default_style_id) = {
let section = &self.document.sections[section_idx];
let mut found = None;
'outer: for para in §ion.paragraphs {
for ctrl in ¶.controls {
if let Control::Footnote(fn_) = ctrl {
if let Some(fp) = fn_.paragraphs.first() {
found = Some((
fp.char_shapes
.first()
.map(|cs| cs.char_shape_id)
.unwrap_or(0),
fp.para_shape_id,
fp.style_id,
));
break 'outer;
}
}
if let Control::Table(table) = ctrl {
for cell in &table.cells {
for cp in &cell.paragraphs {
for cc in &cp.controls {
if let Control::Footnote(fn_) = cc {
if let Some(fp) = fn_.paragraphs.first() {
found = Some((
fp.char_shapes
.first()
.map(|cs| cs.char_shape_id)
.unwrap_or(0),
fp.para_shape_id,
fp.style_id,
));
break 'outer;
}
}
}
}
}
}
}
}
found.unwrap_or_else(|| {
let current_para = §ion.paragraphs[para_idx];
(
current_para.char_shape_id_at(char_offset).unwrap_or(0),
current_para.para_shape_id,
current_para.style_id,
)
})
};
let (para_shape_id, style_id) = self
.note_style("각주", "Footnote")
.map(|(idx, style)| (style.para_shape_id, idx))
.unwrap_or((default_para_shape_id, default_style_id));
let auto_num = crate::model::control::AutoNumber {
number_type: crate::model::control::AutoNumberType::Footnote,
format: 0, superscript: false,
number: footnote_number,
assigned_number: footnote_number,
user_symbol: '\0',
prefix_char: '\0',
suffix_char: ')',
};
let inner_para = Paragraph {
text: " ".to_string(), char_count: 10, char_count_msb: true,
control_mask: 1u32 << 0x12, char_offsets: vec![0, 8], para_shape_id,
style_id,
char_shapes: vec![CharShapeRef {
start_pos: 0,
char_shape_id: default_char_shape_id,
}],
controls: vec![crate::model::control::Control::AutoNumber(auto_num)],
line_segs: vec![LineSeg {
text_start: 0,
line_height: 1000,
text_height: 1000,
baseline_distance: 850,
line_spacing: 600,
segment_width: 0,
tag: LineSeg::TAG_SINGLE_SEGMENT_LINE,
..Default::default()
}],
has_para_text: true,
..Default::default()
};
let footnote = Footnote {
number: footnote_number,
paragraphs: vec![inner_para],
after_decoration_letter: 0x0029, ..Default::default()
};
self.document.sections[section_idx].raw_stream = None;
let paragraph = &mut self.document.sections[section_idx].paragraphs[para_idx];
let insert_idx = {
let positions = crate::document_core::helpers::find_control_text_positions(paragraph);
let mut idx = paragraph.controls.len();
for (i, &pos) in positions.iter().enumerate() {
if pos > char_offset {
idx = i;
break;
}
}
idx
};
paragraph.align_ctrl_data_records();
paragraph
.controls
.insert(insert_idx, Control::Footnote(Box::new(footnote)));
paragraph.ctrl_data_records.insert(insert_idx, None);
paragraph.shift_for_inline_control_insert(insert_idx, char_offset);
paragraph.char_count += 8;
paragraph.control_mask |= 1u32 << 0x0011; paragraph.has_para_text = true;
self.shift_active_field_for_control_insert(section_idx, para_idx, insert_idx);
{
let mut num = 1u16;
for pi in 0..self.document.sections[section_idx].paragraphs.len() {
for ci in 0..self.document.sections[section_idx].paragraphs[pi]
.controls
.len()
{
match &mut self.document.sections[section_idx].paragraphs[pi].controls[ci] {
Control::Footnote(ref mut fn_) => {
fn_.number = num;
num += 1;
}
Control::Table(ref mut table) => {
for cell in &mut table.cells {
for cp in &mut cell.paragraphs {
for cc in &mut cp.controls {
if let Control::Footnote(ref mut fn_) = cc {
fn_.number = num;
num += 1;
}
}
}
}
}
Control::Shape(ref mut shape) => {
if let Some(text_box) =
shape.drawing_mut().and_then(|d| d.text_box.as_mut())
{
for tp in &mut text_box.paragraphs {
for tc in &mut tp.controls {
if let Control::Footnote(ref mut fn_) = tc {
fn_.number = num;
num += 1;
}
}
}
}
}
_ => {}
}
}
}
}
self.reflow_footnote_paragraph(section_idx, para_idx, insert_idx, 0);
self.reflow_paragraph(section_idx, para_idx);
self.recompose_section(section_idx);
self.paginate_if_needed();
self.refresh_footnote_numbers(section_idx);
self.invalidate_page_tree_cache();
let footnote_number = match self.document.sections[section_idx].paragraphs[para_idx]
.controls
.get(insert_idx)
{
Some(Control::Footnote(note)) => note.number,
_ => footnote_number,
};
self.event_log.push(DocumentEvent::PictureInserted {
section: section_idx,
para: para_idx,
});
Ok(format!(
"{{\"ok\":true,\"paraIdx\":{},\"controlIdx\":{},\"footnoteNumber\":{}}}",
para_idx, insert_idx, footnote_number
))
}
pub fn insert_endnote_native(
&mut self,
section_idx: usize,
para_idx: usize,
char_offset: usize,
) -> Result<String, HwpError> {
use crate::model::footnote::Endnote;
if section_idx >= self.document.sections.len() {
return Err(HwpError::RenderError(format!(
"구역 인덱스 {} 범위 초과",
section_idx
)));
}
if para_idx >= self.document.sections[section_idx].paragraphs.len() {
return Err(HwpError::RenderError(format!(
"문단 인덱스 {} 범위 초과",
para_idx
)));
}
let shape = self.document.sections[section_idx]
.section_def
.endnote_shape
.clone();
let number_format_code = Self::footnote_shape_number_format_code(shape.number_format);
let (default_char_shape_id, para_shape_id, style_id) =
self.endnote_style_defaults(section_idx, para_idx, char_offset);
let prefix_char = if shape.prefix_char == '\0' {
'\0'
} else {
shape.prefix_char
};
let suffix_char = if shape.suffix_char == '\0' {
')'
} else {
shape.suffix_char
};
let inner_para = Self::make_note_inner_paragraph(
crate::model::control::AutoNumberType::Endnote,
0,
number_format_code,
prefix_char,
suffix_char,
default_char_shape_id,
para_shape_id,
style_id,
);
let endnote = Endnote {
paragraphs: vec![inner_para],
before_decoration_letter: prefix_char as u16,
after_decoration_letter: suffix_char as u16,
number_shape: number_format_code as u32,
..Default::default()
};
self.document.sections[section_idx].raw_stream = None;
let paragraph = &mut self.document.sections[section_idx].paragraphs[para_idx];
let insert_idx = {
let positions = crate::document_core::helpers::find_control_text_positions(paragraph);
let mut idx = paragraph.controls.len();
for (i, &pos) in positions.iter().enumerate() {
if pos > char_offset {
idx = i;
break;
}
}
idx
};
paragraph.align_ctrl_data_records();
paragraph
.controls
.insert(insert_idx, Control::Endnote(Box::new(endnote)));
paragraph.ctrl_data_records.insert(insert_idx, None);
paragraph.shift_for_inline_control_insert(insert_idx, char_offset);
paragraph.char_count += 8;
paragraph.control_mask |= 1u32 << 0x0011;
paragraph.has_para_text = true;
self.shift_active_field_for_control_insert(section_idx, para_idx, insert_idx);
Self::sync_paragraph_endnotes_with_shape(
&mut self.document.sections[section_idx].paragraphs,
number_format_code,
prefix_char,
suffix_char,
);
self.refresh_endnote_numbers(section_idx);
let endnote_number = match self.document.sections[section_idx].paragraphs[para_idx]
.controls
.get(insert_idx)
{
Some(Control::Endnote(note)) => note.number,
_ => 0,
};
self.reflow_footnote_paragraph(section_idx, para_idx, insert_idx, 0);
self.reflow_paragraph(section_idx, para_idx);
self.recompose_section(section_idx);
self.paginate_if_needed();
self.invalidate_page_tree_cache();
self.event_log.push(DocumentEvent::PictureInserted {
section: section_idx,
para: para_idx,
});
Ok(format!(
"{{\"ok\":true,\"paraIdx\":{},\"controlIdx\":{},\"endnoteNumber\":{}}}",
para_idx, insert_idx, endnote_number
))
}
}
#[cfg(test)]
mod char_shape_inherit_tests {
use crate::document_core::DocumentCore;
use crate::model::control::Control;
use crate::model::paragraph::{CharShapeRef, Paragraph};
fn core_with_mixed_shape_paragraph() -> DocumentCore {
let mut core = DocumentCore::new_empty();
core.create_blank_document_native().unwrap();
core.insert_text_native(0, 0, 0, "0123456789abcdefghij")
.unwrap();
let para = &mut core.document.sections[0].paragraphs[0];
let boundary = para.char_offsets[10];
para.char_shapes = vec![
CharShapeRef {
start_pos: 0,
char_shape_id: 34,
},
CharShapeRef {
start_pos: boundary,
char_shape_id: 37,
},
];
core
}
fn a_footnote_host_paragraph_is_reflowed_on_its_column_not_the_page() {
use crate::model::page::ColumnDef;
let mut core = DocumentCore::new_empty();
core.create_blank_document_native().unwrap();
core.insert_text_native(0, 0, 0, "0123456789abcdefghij")
.unwrap();
let column_def = ColumnDef {
column_count: 2,
same_width: true,
spacing: 0,
..Default::default()
};
core.document.sections[0]
.paragraphs
.first_mut()
.expect("본문 문단")
.controls
.push(Control::ColumnDef(column_def));
core.recompose_section(0);
core.paginate();
let page_text_width_hwp = {
let page_def = &core.document.sections[0].section_def.page_def;
page_def.width as i32 - page_def.margin_left as i32 - page_def.margin_right as i32
};
core.insert_footnote_native(0, 0, 10).unwrap();
let published = core.document.sections[0].paragraphs[0]
.line_segs
.first()
.map(|seg| seg.segment_width)
.expect("본문 첫 줄");
assert!(
published < page_text_width_hwp * 3 / 4,
"2단 본문이 쪽 폭으로 발행되었다: segment_width={published}, \
쪽 본문 폭={page_text_width_hwp}"
);
assert!(
published > 0,
"열 상자는 양수여야 한다: segment_width={published}"
);
}
#[test]
fn insert_footnote_fallback_inherits_char_shape_at_cursor_offset() {
a_footnote_host_paragraph_is_reflowed_on_its_column_not_the_page();
let mut core = core_with_mixed_shape_paragraph();
core.insert_footnote_native(0, 0, 10).unwrap();
let inner = core.document.sections[0]
.paragraphs
.iter()
.find_map(|p| {
p.controls.iter().find_map(|c| match c {
Control::Footnote(f) => f.paragraphs.first(),
_ => None,
})
})
.expect("각주 내부 문단");
assert_eq!(
inner.char_shapes.first().map(|cs| cs.char_shape_id),
Some(37),
"각주 내부 문단이 커서 offset 글자모양(37)이 아닌 값을 상속"
);
}
#[test]
fn insert_footnote_ignores_table_footnote_positioned_after_cursor_in_same_paragraph() {
use crate::model::footnote::Footnote;
use crate::model::table::{Cell, Table};
let mut core = DocumentCore::new_empty();
core.create_blank_document_native().unwrap();
core.insert_text_native(0, 0, 0, "AB").unwrap();
let mut cell = Cell::default();
cell.paragraphs.push(Paragraph::default());
cell.paragraphs[0]
.controls
.push(Control::Footnote(Box::<Footnote>::default()));
let mut table = Table::default();
table.cells.push(cell);
let para = &mut core.document.sections[0].paragraphs[0];
para.controls.push(Control::Table(Box::new(table)));
para.ctrl_data_records.push(None);
para.char_offsets.push(2);
para.char_count += 8;
let result = core
.insert_footnote_native(0, 0, 0)
.expect("insert footnote before table");
let footnote_number: u16 = result
.split("\"footnoteNumber\":")
.nth(1)
.and_then(|s| s.split(|c: char| !c.is_ascii_digit()).next())
.and_then(|s| s.parse().ok())
.unwrap_or_else(|| panic!("missing footnoteNumber in {result}"));
assert_eq!(
footnote_number, 1,
"표 안 각주가 커서보다 뒤에 있으므로 신규 각주는 1번이어야 한다: {result}"
);
}
#[test]
fn insert_endnote_fallback_inherits_char_shape_at_cursor_offset() {
let mut core = core_with_mixed_shape_paragraph();
core.document.doc_info.styles.clear();
core.insert_endnote_native(0, 0, 10).unwrap();
let inner = core.document.sections[0]
.paragraphs
.iter()
.find_map(|p| {
p.controls.iter().find_map(|c| match c {
Control::Endnote(e) => e.paragraphs.first(),
_ => None,
})
})
.expect("미주 내부 문단");
assert_eq!(
inner.char_shapes.first().map(|cs| cs.char_shape_id),
Some(37),
"미주 내부 문단이 커서 offset 글자모양(37)이 아닌 값을 상속"
);
}
#[test]
fn insert_footnote_shifts_char_shapes_with_char_offsets() {
let mut core = DocumentCore::new_empty();
core.create_blank_document_native().unwrap();
core.insert_text_native(0, 0, 0, "abcd").unwrap();
{
let para = &mut core.document.sections[0].paragraphs[0];
para.text = "abcd".to_string();
para.char_offsets = vec![0, 1, 2, 3];
para.char_shapes = vec![
CharShapeRef {
start_pos: 0,
char_shape_id: 5,
},
CharShapeRef {
start_pos: 2,
char_shape_id: 6,
},
];
}
core.insert_footnote_native(0, 0, 1).unwrap();
let para = &core.document.sections[0].paragraphs[0];
assert_eq!(
para.char_shape_id_at(1),
Some(5),
"각주 삽입 후 원래 'b'(char idx 1) 글자모양이 오염됨 — char_shapes.start_pos 미시프트"
);
}
}