Projects
Kolab:3.4
roundcubemail-plugins-kolab
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 101
View file
roundcubemail-plugins-kolab.spec
Changed
@@ -23,8 +23,8 @@ %global tmpdir %{_var}/lib/roundcubemail Name: roundcubemail-plugins-kolab -Version: 3.2.3 -Release: 5%{?dist} +Version: 3.2.4 +Release: 1%{?dist} Summary: Kolab Groupware plugins for Roundcube Webmail Group: Applications/Internet @@ -34,8 +34,6 @@ Source0: http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz Source1: comm.py -Patch0001: 0001-Fix-bug-where-relations-tags-members-changes-were-ig.patch - BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -902,8 +900,6 @@ # Remove hidden files find . -type f -name ".*" -delete -%patch0001 -p1 - # Eliminate links for link in `find . -type l`; do source=$(readlink -f ${link}) @@ -1967,6 +1963,9 @@ %defattr(-,root,root,-) %changelog +* Wed Feb 4 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.2.4-1 +- Release of version 3.2.4 + * Sat Jan 24 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.2.3-5 - Fix symbolic link to go up far enough (#4307, comment #4).
View file
0001-Fix-bug-where-relations-tags-members-changes-were-ig.patch
Deleted
@@ -1,26 +0,0 @@ -From 23e4d1b25aa0cbcf72bde36eda4340e0623fab85 Mon Sep 17 00:00:00 2001 -From: Aleksander Machniak <machniak@kolabsys.com> -Date: Thu, 22 Jan 2015 06:18:27 -0500 -Subject: [PATCH] Fix bug where relations/tags members changes were ignored on - relation update (#4095) - ---- - plugins/libkolab/lib/kolab_format_configuration.php | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/plugins/libkolab/lib/kolab_format_configuration.php b/plugins/libkolab/lib/kolab_format_configuration.php -index 30ddaf3..ceb7ebb 100644 ---- a/plugins/libkolab/lib/kolab_format_configuration.php -+++ b/plugins/libkolab/lib/kolab_format_configuration.php -@@ -125,6 +125,8 @@ class kolab_format_configuration extends kolab_format - // adjust content-type string - $this->CTYPEv2 = 'application/x-vnd.kolab.configuration.' . $object['type']; - -+ // reset old object data, otherwise set() will overwrite current data (#4095) -+ $this->xmldata = null; - // set common object properties - parent::set($object); - --- -2.1.0 -
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +roundcubemail-plugins-kolab (1:3.2.4-0~kolab1) unstable; urgency=low + + * Release of version 3.2.4 + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Wed, 4 Feb 2015 18:41:13 +0200 + roundcubemail-plugins-kolab (1:3.2.3-0~kolab3) unstable; urgency=low * Removed empty kolab/skins/images folder
View file
debian.series
Changed
@@ -1,1 +0,0 @@ -0001-Fix-bug-where-relations-tags-members-changes-were-ig.patch -p1
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/files
Deleted
-(directory)
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/files/.htaccess
Deleted
@@ -1,5 +0,0 @@ -<IfModule mod_deflate.c> -SetOutputFilter NONE -</IfModule> - -Options -Indexes
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/calendar.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/calendar.php
Changed
@@ -497,7 +497,7 @@ foreach (array('-M','-H','-D','+M','+H','+D') as $trigger) $select_offset->add(rcube_label('trigger' . $trigger, 'libcalendaring'), $trigger); - $preset = libcalendaring::parse_alaram_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); + $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); $p['blocks']['view']['options']['alarmoffset'] = array( 'title' => html::label($field_id . 'value', Q($this->gettext('defaultalarmoffset'))), 'content' => $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1]), @@ -665,7 +665,7 @@ foreach (array('-M','-H','-D') as $trigger) $select_offset->add(rcube_label('trigger' . $trigger, 'libcalendaring'), $trigger); - $preset = libcalendaring::parse_alaram_value($this->rc->config->get('calendar_birthdays_alarm_offset', '-1D')); + $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_birthdays_alarm_offset', '-1D')); $p['blocks']['birthdays']['options']['birthdays_alarmoffset'] = array( 'title' => html::label($field_id . 'value', rcube::Q($this->gettext('showalarms'))), 'content' => $select_type->show($this->rc->config->get('calendar_birthdays_alarm_type', '')) . ' ' . $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1]), @@ -842,7 +842,7 @@ $success = $reload = $got_msg = false; // don't notify if modifying a recurring instance (really?) - if ($event['_savemode'] && $event['_savemode'] != 'all' && $event['_notify']) + if ($event['_savemode'] && in_array($event['_savemode'], array('current','future')) && $event['_notify'] && $action != 'remove') unset($event['_notify']); // force notify if hidden + active else if ((int)$this->rc->config->get('calendar_itip_send_option', $this->defaults['calendar_itip_send_option']) === 1) @@ -866,20 +866,35 @@ case "edit": $this->write_preprocess($event, $action); - if ($success = $this->driver->edit_event($event)) - $this->cleanup_event($event); + if ($success = $this->driver->edit_event($event)) { + $this->cleanup_event($event); + if ($success !== true) { + $event['id'] = $success; + $old = null; + } + } $reload = $success && ($event['recurrence'] || $event['_savemode'] || $event['_fromcalendar']) ? 2 : 1; break; case "resize": $this->write_preprocess($event, $action); - $success = $this->driver->resize_event($event); + if ($success = $this->driver->resize_event($event)) { + if ($success !== true) { + $event['id'] = $success; + $old = null; + } + } $reload = $event['_savemode'] ? 2 : 1; break; case "move": $this->write_preprocess($event, $action); - $success = $this->driver->move_event($event); + if ($success = $this->driver->move_event($event)) { + if ($success !== true) { + $event['id'] = $success; + $old = null; + } + } $reload = $success && $event['_savemode'] ? 2 : 1; break; @@ -957,6 +972,7 @@ $ev = $this->driver->get_event($event); $ev['attendees'] = $event['attendees']; + $ev['free_busy'] = $event['free_busy']; // send invitation to delegatee + add it as attendee if ($status == 'delegated' && $event['to']) { @@ -1110,6 +1126,12 @@ // make sure we have the complete record $event = $action == 'remove' ? $old : $this->driver->get_event($event); + // sending notification on a recurrence instance -> re-send the main event + if ($event['recurrence_id']) { + $event = $this->driver->get_event(array('id' => $event['recurrence_id'], 'cal' => $event['calendar'])); + $action = 'edit'; + } + // only notify if data really changed (TODO: do diff check on client already) if (!$old || $action == 'remove' || self::event_diff($event, $old)) { $sent = $this->notify_attendees($event, $old, $action, $event['_comment']); @@ -1205,6 +1227,16 @@ $event['_part'] = $mime_id; $events[] = $this->_client_event($event, true); + + // add recurring instances + if (!empty($event['recurrence'])) { + foreach ($this->driver->get_recurring_events($event, $event['start']) as $recurring) { + $recurring['temporary'] = true; + $recurring['readonly'] = true; + $recurring['calendar'] = '--invitation--itip'; + $events[] = $this->_client_event($recurring, true); + } + } } return $events; @@ -1756,7 +1788,7 @@ */ public function attachment_upload() { - $this->lib->attachment_upload(self::SESSION_KEY, 'cal:'); + $this->lib->attachment_upload(self::SESSION_KEY, 'cal-'); } /** @@ -1820,7 +1852,8 @@ } $attachments = array(); - $eventid = 'cal:'.$event['id']; + $eventid = 'cal-'.$event['id']; + if (is_array($_SESSION[self::SESSION_KEY]) && $_SESSION[self::SESSION_KEY]['id'] == $eventid) { if (!empty($_SESSION[self::SESSION_KEY]['attachments'])) { foreach ($_SESSION[self::SESSION_KEY]['attachments'] as $id => $attachment) { @@ -2419,6 +2452,7 @@ } // send itip reply to organizer + $invitation['event']['comment'] = rcube_utils::get_input_value('_comment', rcube_utils::INPUT_POST); if ($status && $itip->update_invitation($invitation, $invitation['attendee'], strtoupper($status))) { $this->invitestatus = html::div('rsvp-status ' . strtolower($status), $itip->gettext('youhave'.strtolower($status))); } @@ -2442,8 +2476,10 @@ $this->register_handler('plugin.event_inviteform', array($this, 'itip_event_inviteform')); $this->register_handler('plugin.event_invitebox', array($this->ui, 'event_invitebox')); - if (!$this->invitestatus) + if (!$this->invitestatus) { + $this->itip->set_rsvp_actions(array('accepted','tentative','declined')); $this->register_handler('plugin.event_rsvp_buttons', array($this->ui, 'event_rsvp_buttons')); + } $this->rc->output->set_pagetitle($itip->gettext('itipinvitation') . ' ' . $this->event['title']); } @@ -2665,6 +2701,7 @@ $metadata['attendee'] = $attendee['email']; $metadata['rsvp'] = $attendee['role'] != 'NON-PARTICIPANT'; $reply_sender = $attendee['email']; + $event_attendee = $attendee; } } @@ -2787,6 +2824,9 @@ $error_msg = $this->gettext('newerversionexists'); } else if (!$existing && ($status != 'declined' || $this->rc->config->get('kolab_invitation_calendars'))) { + if ($status == 'declined' || $event['status'] == 'CANCELLED' || $event_attendee['role'] == 'NON-PARTICIPANT') { + $event['free_busy'] = 'free'; + } $success = $this->driver->new_event($event); } else if ($status == 'declined') @@ -2957,7 +2997,7 @@ } // copy mail attachments to event else if ($message->attachments) { - $eventid = 'cal:'; + $eventid = 'cal-'; if (!is_array($_SESSION[self::SESSION_KEY]) || $_SESSION[self::SESSION_KEY]['id'] != $eventid) { $_SESSION[self::SESSION_KEY] = array(); $_SESSION[self::SESSION_KEY]['id'] = $eventid;
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/calendar_ui.js -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/calendar_ui.js
Changed
@@ -742,9 +742,11 @@ // show warning if editing a recurring event if (event.id && event.recurrence) { - var sel = event.thisandfuture ? 'future' : (event.isexception ? 'current' : 'all'); + var allow_exceptions = !has_attendees(event) || !is_organizer(event), + sel = event._savemode || (allow_exceptions && event.thisandfuture ? 'future' : (allow_exceptions && event.isexception ? 'current' : 'all')); $('#edit-recurring-warning').show(); $('input.edit-recurring-savemode[value="'+sel+'"]').prop('checked', true); + $('input.edit-recurring-savemode[value="current"], input.edit-recurring-savemode[value="future"]').prop('disabled', !allow_exceptions); } else $('#edit-recurring-warning').hide(); @@ -764,6 +766,11 @@ if (event.attendees) { for (j=0; j < event.attendees.length; j++) { data = event.attendees[j]; + // reset attendee status + if (event._savemode == 'new' && data.role != 'ORGANIZER') { + data.status = 'NEEDS-ACTION'; + delete data.noreply; + } add_attendee(data, !allow_invitations); if (allow_invitations && data.role != 'ORGANIZER' && !data.noreply) reply_selected++; @@ -1977,7 +1984,7 @@ var img_src = rcmail.assets_path('program/resources/blank.gif'); var html = '<td class="role">' + select + '</td>' + - '<td class="name">' + dispname + '</td>' + + '<td class="name"><span class="attendee-name">' + dispname + '</span></td>' + '<td class="availability"><img src="' + img_src + '" class="availabilityicon ' + avail + '" data-email="' + data.email + '" alt="" /></td>' + '<td class="confirmstate"><span class="' + String(data.status).toLowerCase() + '" title="' + Q(tooltip) + '">' + Q(data.status || '') + '</span></td>' + (data.cutype != 'RESOURCE' ? '<td class="invite">' + (organizer || readonly || !invbox ? '' : invbox) + '</td>' : '') + @@ -1995,7 +2002,7 @@ tr.find('a.deletelink').click({ id:(data.email || data.name) }, function(e) { remove_attendee(this, e.data.id); return false; }); tr.find('a.mailtolink').click(event_attendee_click); - tr.find('a.expandlink').click(data, function(e) { me.expand_attendee_group(e, add_attendee, remove_attendee); }); + tr.find('a.expandlink').click(data, function(e) { me.expand_attendee_group(e, add_attendee, remove_attendee); return false; }); tr.find('input.edit-attendee-reply').click(function() { var enabled = $('#edit-attendees-invite:checked').length || $('input.edit-attendee-reply:checked').length; $('#eventedit .attendees-commentbox')[enabled ? 'show' : 'hide'](); @@ -2217,7 +2224,7 @@ } // load resource calendar - resources_events_source.url = "./?_task=calendar&_action=resources-calendar&_id="+escape(resource.ID); + resources_events_source.url = "./?_task=calendar&_action=resources-calendar&_id="+urlencode(resource.ID); $(rcmail.gui_objects.resourceinfocalendar).fullCalendar('addEventSource', resources_events_source); } }; @@ -2394,6 +2401,14 @@ } } } + + // set free_busy status to transparent if declined (#4425) + if (data.status == 'DECLINED' || data.role == 'NON-PARTICIPANT') { + me.selected_event.free_busy = 'free'; + } + else { + me.selected_event.free_busy = 'busy'; + } } // submit status change to server @@ -2519,12 +2534,13 @@ var update_event_confirm = function(action, event, data) { if (!data) data = event; - var decline = false, notify = false, html = '', cal = me.calendars[event.calendar]; + var decline = false, notify = false, html = '', cal = me.calendars[event.calendar], + _has_attendees = has_attendees(event), _is_organizer = is_organizer(event); // event has attendees, ask whether to notify them - if (has_attendees(event)) { + if (_has_attendees) { var checked = (settings.itip_notify & 1 ? ' checked="checked"' : ''); - if (is_organizer(event)) { + if (_is_organizer) { notify = true; if (settings.itip_notify & 2) { html += '<div class="message">' + @@ -2550,11 +2566,25 @@ // recurring event: user needs to select the savemode if (event.recurrence) { + var disabled_state = '', message_label = (action == 'remove' ? 'removerecurringeventwarning' : 'changerecurringeventwarning'); + + if (_has_attendees) { + if (action == 'remove') { + if (!_is_organizer) { + message_label = 'removerecurringallonly'; + disabled_state = ' disabled'; + } + } + else if (is_organizer(event)) { + disabled_state = ' disabled'; + } + } + html += '<div class="message"><span class="ui-icon ui-icon-alert"></span>' + - rcmail.gettext((action == 'remove' ? 'removerecurringeventwarning' : 'changerecurringeventwarning'), 'calendar') + '</div>' + + rcmail.gettext(message_label, 'calendar') + '</div>' + '<div class="savemode">' + - '<a href="#current" class="button">' + rcmail.gettext('currentevent', 'calendar') + '</a>' + - '<a href="#future" class="button">' + rcmail.gettext('futurevents', 'calendar') + '</a>' + + '<a href="#current" class="button' + disabled_state + '">' + rcmail.gettext('currentevent', 'calendar') + '</a>' + + '<a href="#future" class="button' + disabled_state + '">' + rcmail.gettext('futurevents', 'calendar') + '</a>' + '<a href="#all" class="button">' + rcmail.gettext('allevents', 'calendar') + '</a>' + (action != 'remove' ? '<a href="#new" class="button">' + rcmail.gettext('saveasnew', 'calendar') + '</a>' : '') + '</div>'; @@ -2564,14 +2594,24 @@ if (html) { var $dialog = $('<div>').html(html); - $dialog.find('a.button').button().click(function(e) { + $dialog.find('a.button').button().filter(':not(.disabled)').click(function(e) { data._savemode = String(this.href).replace(/.+#/, ''); data._notify = settings.itip_notify; - if ($dialog.find('input.confirm-attendees-donotify').length) - data._notify = $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0; - if (decline && $dialog.find('input.confirm-attendees-decline:checked').length) - data.decline = 1; - update_event(action, data); + + // open event edit dialog when saving as new + if (data._savemode == 'new') { + event._savemode = 'new'; + event_edit_dialog('edit', event); + fc.fullCalendar('refetchEvents'); + } + else { + if ($dialog.find('input.confirm-attendees-donotify').length) + data._notify = $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0; + if (decline && $dialog.find('input.confirm-attendees-decline:checked').length) + data.decline = 1; + update_event(action, data); + } + $dialog.dialog("close"); return false; });
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/composer.json
Changed
@@ -4,7 +4,7 @@ "description": "Calendar plugin", "homepage": "http://git.kolab.org/roundcubemail-plugins-kolab/", "license": "AGPLv3", - "version": "3.2.3", + "version": "3.2.4", "authors": [ { "name": "Thomas Bruederli", @@ -26,6 +26,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libcalendaring": ">=3.2.3" + "kolab/libcalendaring": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/drivers/calendar_driver.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/drivers/calendar_driver.php
Changed
@@ -432,6 +432,61 @@ } /** + * Create instances of a recurring event + * + * @param array Hash array with event properties + * @param object DateTime Start date of the recurrence window + * @param object DateTime End date of the recurrence window + * @return array List of recurring event instances + */ + public function get_recurring_events($event, $start, $end = null) + { + $events = array(); + + if ($event['recurrence']) { + // include library class + require_once(dirname(__FILE__) . '/../lib/calendar_recurrence.php'); + + $rcmail = rcmail::get_instance(); + $recurrence = new calendar_recurrence($rcmail->plugins->get_plugin('calendar'), $event); + + // determine a reasonable end date if none given + if (!$end) { + switch ($event['recurrence']['FREQ']) { + case 'YEARLY': $intvl = 'P100Y'; break; + case 'MONTHLY': $intvl = 'P20Y'; break; + default: $intvl = 'P10Y'; break; + } + + $end = clone $event['start']; + $end->add(new DateInterval($intvl)); + } + + $i = 0; + while ($next_event = $recurrence->next_instance()) { + $next_event['uid'] = $event['uid'] . '-' . ++$i; + // add to output if in range + if (($next_event['start'] <= $end && $next_event['end'] >= $start)) { + $next_event['id'] = $next_event['uid']; + $next_event['recurrence_id'] = $event['uid']; + $next_event['_instance'] = $i; + $events[] = $next_event; + } + else if ($next_event['start'] > $end) { // stop loop if out of range + break; + } + + // avoid endless recursion loops + if ($i > 1000) { + break; + } + } + } + + return $events; + } + + /** * Provide a list of revisions for the given event * * @param array $event Hash array with event properties:
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/drivers/database/database_driver.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/drivers/database/database_driver.php
Changed
@@ -1163,7 +1163,7 @@ // convert legacy alarms data else if (strlen($alarms)) { list($trigger, $action) = explode(':', $alarms, 2); - if ($trigger = libcalendaring::parse_alaram_value($trigger)) { + if ($trigger = libcalendaring::parse_alarm_value($trigger)) { $valarms = array(array('action' => $action, 'trigger' => $trigger[3] ?: $trigger[0])); } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/drivers/kolab/kolab_calendar.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/drivers/kolab/kolab_calendar.php
Changed
@@ -76,7 +76,7 @@ // fetch objects from the given IMAP folder $this->storage = kolab_storage::get_folder($this->name); - $this->ready = $this->storage && !PEAR::isError($this->storage) && $this->storage->type !== null; + $this->ready = $this->storage && $this->storage->valid; // Set readonly and alarms flags according to folder permissions if ($this->ready) { @@ -196,7 +196,7 @@ $this->events[$master_id] = $this->_to_rcube_event($record); if (($master = $this->events[$master_id]) && $master['recurrence']) { - $this->_get_recurring_events($record, $master['start'], null, $id); + $this->get_recurring_events($record, $master['start'], null, $id); } } @@ -323,7 +323,7 @@ // resolve recurring events if ($record['recurrence'] && $virtual == 1) { - $events = array_merge($events, $this->_get_recurring_events($record, $start, $end)); + $events = array_merge($events, $this->get_recurring_events($record, $start, $end)); } } @@ -455,7 +455,7 @@ // refresh local cache with recurring instances if ($exception_id) { - $this->_get_recurring_events($object, $event['start'], $event['end'], $exception_id); + $this->get_recurring_events($object, $event['start'], $event['end'], $exception_id); } } @@ -538,7 +538,7 @@ * @param string ID of a specific recurring event instance * @return array List of recurring event instances */ - public function _get_recurring_events($event, $start, $end = null, $event_id = null) + public function get_recurring_events($event, $start, $end = null, $event_id = null) { $object = $event['_formatobj']; if (!$object) {
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/drivers/kolab/kolab_driver.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/drivers/kolab/kolab_driver.php
Changed
@@ -704,7 +704,7 @@ // removing the first instance => just move to next occurence if ($master['id'] == $event['id']) { - $recurring = reset($storage->_get_recurring_events($event, $event['start'], null, $event['id'].'-1')); + $recurring = reset($storage->get_recurring_events($event, $event['start'], null, $event['id'].'-1')); // no future instances found: delete the master event (bug #1677) if (!$recurring['start']) { @@ -889,14 +889,16 @@ // save submitted data as new (non-recurring) event $event['recurrence'] = array(); $event['uid'] = $this->cal->generate_uid(); - + unset($event['recurrence_id'], $event['id'], $event['_savemode'], $event['_fromcalendar'], $event['_identity'], $event['_notify']); + // copy attachment data to new event foreach ((array)$event['attachments'] as $idx => $attachment) { - if (!$attachment['data']) - $attachment['data'] = $fromcalendar->get_attachment_body($attachment['id'], $event); + if (!$attachment['content']) + $event['attachments'][$idx]['content'] = $this->get_attachment_body($attachment['id'], $master); } - - $success = $storage->insert_event($event); + + if ($success = $storage->insert_event($event)) + $success = $event['uid']; break; case 'future': @@ -906,7 +908,7 @@ $event['thisandfuture'] = $savemode == 'future'; // remove some internal properties which should not be saved - unset($event['_savemode'], $event['_fromcalendar'], $event['_identity']); + unset($event['_savemode'], $event['_fromcalendar'], $event['_identity'], $event['_notify']); // save properties to a recurrence exception instance if ($old['recurrence_id']) { @@ -1244,6 +1246,28 @@ } /** + * Create instances of a recurring event + * + * @param array Hash array with event properties + * @param object DateTime Start date of the recurrence window + * @param object DateTime End date of the recurrence window + * @return array List of recurring event instances + */ + public function get_recurring_events($event, $start, $end = null) + { + // load the given event data into a libkolabxml container + if (!$event['_formatobj']) { + $event_xml = new kolab_format_event(); + $event_xml->set($event); + $event['_formatobj'] = $event_xml; + } + + $this->_read_calendars(); + $storage = reset($this->calendars); + return $storage->get_recurring_events($event, $start, $end); + } + + /** * Fetch free/busy information from a person within the given range */ public function get_freebusy_list($email, $start, $end)
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/lib/calendar_ui.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/lib/calendar_ui.php
Changed
@@ -886,7 +886,7 @@ function event_rsvp_buttons($attrib = array()) { - return $this->cal->itip->itip_rsvp_buttons($attrib, array('accepted','tentative','declined','delegated')); + return $this->cal->itip->itip_rsvp_buttons($attrib); } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/localization/en_US.inc -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/localization/en_US.inc
Changed
@@ -261,6 +261,7 @@ $labels['removeeventconfirm'] = 'Delete event'; $labels['changerecurringeventwarning'] = 'This is a recurring event. Would you like to edit the current event only, this and all future occurences, all occurences or save it as a new event?'; $labels['removerecurringeventwarning'] = 'This is a recurring event. Would you like to delete the current event only, this and all future occurences or all occurences of this event?'; +$labels['removerecurringallonly'] = 'This is a recurring event. As a participant, you can only delete the entire event with all occurences.'; $labels['currentevent'] = 'Current'; $labels['futurevents'] = 'Future'; $labels['allevents'] = 'All';
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/calendar/skins/larry/calendar.css -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/calendar/skins/larry/calendar.css
Changed
@@ -1056,6 +1056,7 @@ .event-update-confirm a.button { margin: 0 0.5em 0 0.2em; min-width: 5em; + text-align: center; } #event-rsvp, @@ -1129,13 +1130,21 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - position: relative; } #eventedit .edit-attendees-table td.name select { width: 100%; } +#eventedit .edit-attendees-table td.name .attendee-name { + display: block; + position: relative; + overflow: hidden; + text-overflow: ellipsis; + padding: 5px 7px 6px; + margin: -5px -7px -6px; +} + #eventedit .edit-attendees-table a.deletelink { display: inline-block; width: 17px; @@ -1177,6 +1186,7 @@ #edit-attendees-form #edit-attendee-schedule { position: absolute; right: 0; + top: 0; } .edit-attendees-table select.edit-attendee-role {
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_activesync/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_activesync/composer.json
Changed
@@ -26,6 +26,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_addressbook/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_addressbook/composer.json
Changed
@@ -26,6 +26,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_config/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_config/composer.json
Changed
@@ -21,6 +21,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_delegation/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_delegation/composer.json
Changed
@@ -21,7 +21,7 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3", + "kolab/libkolab": ">=3.2.4", "kolab/kolab_auth": ">=3.2.2" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_files/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_files/composer.json
Changed
@@ -21,6 +21,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_folders/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_folders/composer.json
Changed
@@ -21,6 +21,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_notes/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_notes/composer.json
Changed
@@ -21,7 +21,7 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3", + "kolab/libkolab": ">=3.2.4", "roundcube/jqueryui": ">=1.10.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_notes/kolab_notes.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_notes/kolab_notes.php
Changed
@@ -60,7 +60,7 @@ public function startup($args) { // the notes module can be enabled/disabled by the kolab_auth plugin - if ($this->rc->config->get('notes_disabled', false) || !$this->rc->config->get('notes_enabled', true)) { + if ($this->rc->config->get('kolab_notes_disabled', false) || !$this->rc->config->get('kolab_notes_enabled', true)) { return; }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_notes/skins/larry/notes.css -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_notes/skins/larry/notes.css
Changed
@@ -281,6 +281,11 @@ box-sizing: border-box; } +/* Firefox 3.6 */ +_:not(), _:-moz-handler-blocked, .notesview #notedetailstitle .tagedit-list { + min-height: 26px; +} + .notesview #notedetailstitle .disabled .tagedit-list { min-height: 26px; }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/kolab_tags/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/kolab_tags/composer.json
Changed
@@ -21,6 +21,6 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libkolab": ">=3.2.3" + "kolab/libkolab": ">=3.2.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/composer.json
Changed
@@ -4,7 +4,7 @@ "description": "Library providing common functions for calendaring plugins", "homepage": "http://git.kolab.org/roundcubemail-plugins-kolab/", "license": "AGPLv3", - "version": "3.2.3", + "version": "3.2.4", "authors": [ { "name": "Thomas Bruederli",
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/lib/libcalendaring_itip.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/lib/libcalendaring_itip.php
Changed
@@ -125,7 +125,8 @@ 'name' => $bodytext, 'vars' => array( 'title' => $event['title'], - 'date' => $this->lib->event_date_text($event, true), + 'date' => $this->lib->event_date_text($event, true) . + (empty($event['recurrence']) ? '' : sprintf("\n%s: %s", $this->gettext('recurring'), $this->lib->recurrence_text($event['recurrence']))), 'attendees' => join(",\n ", $attendees_list), 'sender' => $this->sender['name'], 'organizer' => $this->sender['name'], @@ -682,7 +683,7 @@ // add input field for reply comment $rsvp_additions .= html::a(array('href' => '#toggle', 'class' => 'reply-comment-toggle'), $this->gettext('itipeditresponse')); $rsvp_additions .= html::div('itip-reply-comment', - html::tag('textarea', array('id' => 'reply-comment-'.$dom_id, 'cols' => 40, 'rows' => 6, 'style' => 'display:none', 'placeholder' => $this->gettext('itipcomment')), '') + html::tag('textarea', array('id' => 'reply-comment-'.$dom_id, 'name' => '_comment', 'cols' => 40, 'rows' => 6, 'style' => 'display:none', 'placeholder' => $this->gettext('itipcomment')), '') ); return $rsvp_additions; @@ -697,27 +698,31 @@ $table->add('ititle', $title); $table->add('title', Q($event['title'])); if ($event['start'] && $event['end']) { - $table->add('label', $this->plugin->gettext('date'), $this->domain); + $table->add('label', $this->gettext('date')); $table->add('date', Q($this->lib->event_date_text($event))); } else if ($event['due'] && $event['_type'] == 'task') { - $table->add('label', $this->plugin->gettext('date'), $this->domain); + $table->add('label', $this->gettext('date')); $table->add('date', Q($this->lib->event_date_text($event))); } + if (!empty($event['recurrence'])) { + $table->add('label', $this->gettext('recurring')); + $table->add('recurrence', $this->lib->recurrence_text($event['recurrence'])); + } if ($event['location']) { - $table->add('label', $this->plugin->gettext('location'), $this->domain); + $table->add('label', $this->gettext('location')); $table->add('location', Q($event['location'])); } if ($event['sensitivity'] && $event['sensitivity'] != 'public') { - $table->add('label', $this->plugin->gettext('sensitivity'), $this->domain); - $table->add('sensitivity', ucfirst($this->plugin->gettext($event['sensitivity'], $this->domain)) . '!'); + $table->add('label', $this->gettext('sensitivity')); + $table->add('sensitivity', ucfirst($this->gettext($event['sensitivity'])) . '!'); } if ($event['status'] == 'COMPLETED' || $event['status'] == 'CANCELLED') { - $table->add('label', $this->plugin->gettext('status'), $this->domain); - $table->add('status', $this->plugin->gettext('status-' . strtolower($event['status']), $this->domain)); + $table->add('label', $this->gettext('status')); + $table->add('status', $this->gettext('status-' . strtolower($event['status']))); } if ($event['comment']) { - $table->add('label', $this->plugin->gettext('comment'), $this->domain); + $table->add('label', $this->gettext('comment')); $table->add('location', Q($event['comment'])); }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/libcalendaring.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/libcalendaring.php
Changed
@@ -341,7 +341,7 @@ $select_offset->add($this->gettext('trigger@'), '@'); // pre-set with default values from user settings - $preset = self::parse_alaram_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); + $preset = self::parse_alarm_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); $hidden = array('style' => 'display:none'); $html = html::span('edit-alarm-set', $select_type->show($this->rc->config->get('calendar_default_alarm_type', '')) . ' ' . @@ -421,7 +421,7 @@ * Helper function to convert alarm trigger strings * into two-field values (e.g. "-45M" => 45, "-M") */ - public static function parse_alaram_value($val) + public static function parse_alarm_value($val) { if ($val[0] == '@') { return array(new DateTime($val)); @@ -432,6 +432,12 @@ foreach ($m2 as $seg) { $prefix = $seg[2] == 'D' || $seg[2] == 'W' ? 'P' : 'PT'; if ($seg[1] > 0) { // ignore zero values + // convert seconds to minutes + if ($seg[2] == 'S') { + $seg[2] = 'M'; + $seg[1] = max(1, round($seg[1]/60)); + } + return array($seg[1], $m[1].$seg[2], $m[1].$seg[1].$seg[2], $m[1].$prefix.$seg[1].$seg[2]); } } @@ -452,7 +458,7 @@ if ($alarm['trigger'] instanceof DateTime) { $alarm['trigger'] = '@' . $alarm['trigger']->format('U'); } - else if ($trigger = libcalendaring::parse_alaram_value($alarm['trigger'])) { + else if ($trigger = libcalendaring::parse_alarm_value($alarm['trigger'])) { $alarm['trigger'] = $trigger[2]; } return $alarm; @@ -472,7 +478,7 @@ } catch (Exception $e) { /* handle this ? */ } } - else if ($trigger = libcalendaring::parse_alaram_value($alarm['trigger'])) { + else if ($trigger = libcalendaring::parse_alarm_value($alarm['trigger'])) { $alarm['trigger'] = $trigger[3]; } return $alarm; @@ -538,7 +544,7 @@ 'vars' => array('datetime' => $rcube->format_date($m[1])) )); } - else if ($val = self::parse_alaram_value($trigger)) { + else if ($val = self::parse_alarm_value($trigger)) { // TODO: for all-day events say 'on date of event at XX' ? if ($val[0] == 0) $text .= ' ' . $rcube->gettext('libcalendaring.triggerattime'); @@ -577,7 +583,7 @@ // support legacy format if (!$rec['valarms']) { list($trigger, $action) = explode(':', $rec['alarms'], 2); - if ($alarm = self::parse_alaram_value($trigger)) { + if ($alarm = self::parse_alarm_value($trigger)) { $rec['valarms'] = array(array('action' => $action, 'trigger' => $alarm[3] ?: $alarm[0])); } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/libvcalendar.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/libvcalendar.php
Changed
@@ -320,7 +320,12 @@ if ($object['recurrence']) { foreach ($vobject->children as $component) { if ($component->name == 'VEVENT' && isset($component->{'RECURRENCE-ID'})) { - $object['recurrence']['EXCEPTIONS'][] = $this->_to_array($component); + try { + $object['recurrence']['EXCEPTIONS'][] = $this->_to_array($component); + } + catch (Exception $e) { + console("iCal data parse error: " . $e->getMessage(), $component->serialize()); + } } } } @@ -588,7 +593,7 @@ $alarm['trigger'] = $prop->getDateTime(); } } - if (!$trigger && ($values = libcalendaring::parse_alaram_value($prop->value))) { + if (!$trigger && ($values = libcalendaring::parse_alarm_value($prop->value))) { $trigger = $values[2]; } @@ -1057,7 +1062,7 @@ else if ($event['alarms']) { $va = VObject\Component::create('VALARM'); list($trigger, $va->action) = explode(':', $event['alarms']); - $val = libcalendaring::parse_alaram_value($trigger); + $val = libcalendaring::parse_alarm_value($trigger); if ($val[3]) $va->add('TRIGGER', $val[3]); else if ($val[0] instanceof DateTime)
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/localization/en_US.inc -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/localization/en_US.inc
Changed
@@ -46,6 +46,7 @@ $labels['showmore'] = 'Show more...'; // recurrence related labels +$labels['recurring'] = 'Repeats'; $labels['frequency'] = 'Repeat'; $labels['never'] = 'never'; $labels['daily'] = 'daily';
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/tests/libcalendaring.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/tests/libcalendaring.php
Changed
@@ -29,29 +29,29 @@ } /** - * libcalendaring::parse_alaram_value() + * libcalendaring::parse_alarm_value() */ - function test_parse_alaram_value() + function test_parse_alarm_value() { - $alarm = libcalendaring::parse_alaram_value('-15M'); + $alarm = libcalendaring::parse_alarm_value('-15M'); $this->assertEquals('15', $alarm[0]); $this->assertEquals('-M', $alarm[1]); $this->assertEquals('-PT15M', $alarm[3]); - $alarm = libcalendaring::parse_alaram_value('-PT5H'); + $alarm = libcalendaring::parse_alarm_value('-PT5H'); $this->assertEquals('5', $alarm[0]); $this->assertEquals('-H', $alarm[1]); - $alarm = libcalendaring::parse_alaram_value('P0DT1H0M0S'); + $alarm = libcalendaring::parse_alarm_value('P0DT1H0M0S'); $this->assertEquals('1', $alarm[0]); $this->assertEquals('+H', $alarm[1]); // FIXME: this should return something like (1140 + 120 + 30)M - $alarm = libcalendaring::parse_alaram_value('-P1DT2H30M'); + $alarm = libcalendaring::parse_alarm_value('-P1DT2H30M'); // $this->assertEquals('1590', $alarm[0]); // $this->assertEquals('-M', $alarm[1]); - $alarm = libcalendaring::parse_alaram_value('@1420722000'); + $alarm = libcalendaring::parse_alarm_value('@1420722000'); $this->assertInstanceOf('DateTime', $alarm[0]); }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libcalendaring/tests/libvcalendar.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libcalendaring/tests/libvcalendar.php
Changed
@@ -177,7 +177,7 @@ $event = $events[0]; $this->assertEquals('-12H:DISPLAY', $event['alarms'], "Serialized alarms string"); - $alarm = libcalendaring::parse_alaram_value($event['alarms']); + $alarm = libcalendaring::parse_alarm_value($event['alarms']); $this->assertEquals('12', $alarm[0], "Alarm value"); $this->assertEquals('-H', $alarm[1], "Alarm unit"); @@ -189,7 +189,7 @@ $event = $events[0]; $this->assertEquals('-30M:DISPLAY', $event['alarms'], "Stripped alarm string"); - $alarm = libcalendaring::parse_alaram_value($event['alarms']); + $alarm = libcalendaring::parse_alarm_value($event['alarms']); $this->assertEquals('30', $alarm[0], "Alarm value"); $this->assertEquals('-M', $alarm[1], "Alarm unit"); $this->assertEquals('-30M', $alarm[2], "Alarm string"); @@ -242,7 +242,7 @@ // alarms $this->assertEquals('-45M:AUDIO', $event['alarms'], "Relative alarm string"); - $alarm = libcalendaring::parse_alaram_value($event['alarms']); + $alarm = libcalendaring::parse_alarm_value($event['alarms']); $this->assertEquals('45', $alarm[0], "Alarm value"); $this->assertEquals('-M', $alarm[1], "Alarm unit");
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/composer.json
Changed
@@ -4,7 +4,7 @@ "description": "Plugin to setup a basic environment for the interaction with a Kolab server.", "homepage": "http://git.kolab.org/roundcubemail-plugins-kolab/", "license": "AGPLv3", - "version": "3.2.3", + "version": "3.2.4", "authors": [ { "name": "Thomas Bruederli",
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/lib/kolab_format_configuration.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/lib/kolab_format_configuration.php
Changed
@@ -125,6 +125,8 @@ // adjust content-type string $this->CTYPEv2 = 'application/x-vnd.kolab.configuration.' . $object['type']; + // reset old object data, otherwise set() will overwrite current data (#4095) + $this->xmldata = null; // set common object properties parent::set($object);
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/lib/kolab_format_event.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/lib/kolab_format_event.php
Changed
@@ -96,11 +96,13 @@ // save recurrence exceptions if (is_array($object['recurrence']) && $object['recurrence']['EXCEPTIONS']) { $vexceptions = new vectorevent; - foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) { + foreach((array)$object['recurrence']['EXCEPTIONS'] as $i => $exception) { $exevent = new kolab_format_event; - $exevent->set($this->compact_exception($exception)); // only save differing values + $exevent->set(($compacted = $this->compact_exception($exception, $object))); // only save differing values $exevent->obj->setRecurrenceID(self::get_datetime($exception['start'], null, true), (bool)$exception['thisandfuture']); $vexceptions->push($exevent->obj); + // write cleaned-up exception data back to memory/cache + $object['recurrence']['EXCEPTIONS'][$i] = $this->expand_exception($compacted, $object); } $this->obj->setExceptions($vexceptions); } @@ -207,7 +209,7 @@ /** * Remove some attributes from the exception container */ - private function compact_exception($exception) + private function compact_exception($exception, $master) { $forbidden = array('recurrence','organizer','attendees','sequence'); @@ -217,6 +219,12 @@ } } + foreach ($master as $prop => $value) { + if (isset($exception[$prop]) && gettype($exception[$prop]) == gettype($value) && $exception[$prop] == $value) { + unset($exception[$prop]); + } + } + return $exception; }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/lib/kolab_storage.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/lib/kolab_storage.php
Changed
@@ -35,6 +35,11 @@ const UID_KEY_PRIVATE = '/private/vendor/kolab/uniqueid'; const UID_KEY_CYRUS = '/shared/vendor/cmu/cyrus-imapd/uniqueid'; + const ERROR_IMAP_CONN = 1; + const ERROR_CACHE_DB = 2; + const ERROR_NO_PERMISSION = 3; + const ERROR_INVALID_FOLDER = 4; + public static $version = '3.0'; public static $last_error; public static $encode_ids = false; @@ -139,7 +144,6 @@ return self::$ldap; } - /** * Get a list of storage folders for the given data type * @@ -154,7 +158,7 @@ if (self::setup()) { foreach ((array)self::list_folders('', '*', $type, $subscribed, $folderdata) as $foldername) { - $folders[$foldername] = new kolab_storage_folder($foldername, $folderdata[$foldername]); + $folders[$foldername] = new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); } } @@ -171,26 +175,26 @@ { if (self::setup()) { foreach ((array)self::list_folders('', '*', $type . '.default', false, $folderdata) as $foldername) { - return new kolab_storage_folder($foldername, $folderdata[$foldername]); + return new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); } } return null; } - /** * Getter for a specific storage folder * - * @param string IMAP folder to access (UTF7-IMAP) + * @param string IMAP folder to access (UTF7-IMAP) + * @param string Expected folder type + * * @return object kolab_storage_folder The folder object */ - public static function get_folder($folder) + public static function get_folder($folder, $type = null) { - return self::setup() ? new kolab_storage_folder($folder) : null; + return self::setup() ? new kolab_storage_folder($folder, $type) : null; } - /** * Getter for a single Kolab object, identified by its UID. * This will search all folders storing objects of the given type. @@ -203,11 +207,11 @@ { self::setup(); $folder = null; - foreach ((array)self::list_folders('', '*', $type) as $foldername) { + foreach ((array)self::list_folders('', '*', $type, null, $folderdata) as $foldername) { if (!$folder) - $folder = new kolab_storage_folder($foldername); + $folder = new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); else - $folder->set_folder($foldername); + $folder->set_folder($foldername, $type, $folderdata[$foldername]); if ($object = $folder->get_object($uid, '*')) return $object; @@ -230,11 +234,11 @@ $folder = null; $result = array(); - foreach ((array)self::list_folders('', '*', $type) as $foldername) { + foreach ((array)self::list_folders('', '*', $type, null, $folderdata) as $foldername) { if (!$folder) - $folder = new kolab_storage_folder($foldername); + $folder = new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); else - $folder->set_folder($foldername); + $folder->set_folder($foldername, $type, $folderdata[$foldername]); foreach ($folder->select($query, '*') as $object) { $result[] = $object; @@ -901,7 +905,7 @@ !self::folder_is_subscribed($foldername, true) && !in_array(self::$imap->folder_namespace($foldername), (array)$exclude_ns) ) { - $folders[] = new kolab_storage_folder($foldername, $folderdata[$foldername]); + $folders[] = new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); } } @@ -974,7 +978,7 @@ $parent_parent = join($delim, $path); if (!$refs[$parent]) { if ($folder->type && self::folder_type($parent) == $folder->type) { - $refs[$parent] = new kolab_storage_folder($parent, $folder->type); + $refs[$parent] = new kolab_storage_folder($parent, $folder->type, $folder->type); $refs[$parent]->parent = $parent_parent; } else if ($parent_parent == $other_ns) { @@ -1193,7 +1197,7 @@ } } else if (self::$imap->subscribe($folder)) { - self::$subscriptions === null; + self::$subscriptions = null; return true; } @@ -1221,7 +1225,7 @@ return true; } else if (self::$imap->unsubscribe($folder)) { - self::$subscriptions === null; + self::$subscriptions = null; return true; } @@ -1542,7 +1546,7 @@ foreach ($folders as $userfolder) { foreach ((array)self::list_folders($userfolder->name . $delimiter, '*', $type, false, $folderdata) as $foldername) { if (!$folders[$foldername]) { - $folders[$foldername] = new kolab_storage_folder($foldername, $folderdata[$foldername]); + $folders[$foldername] = new kolab_storage_folder($foldername, $type, $folderdata[$foldername]); $userfolder->children[] = $folders[$foldername]; } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/lib/kolab_storage_cache.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/lib/kolab_storage_cache.php
Changed
@@ -48,6 +48,7 @@ protected $extra_cols = array(); protected $order_by = null; protected $limit = null; + protected $error = 0; /** @@ -80,6 +81,7 @@ $this->db = $rcmail->get_dbh(); $this->imap = $rcmail->get_storage(); $this->enabled = $rcmail->config->get('kolab_cache', false); + $this->folders_table = $this->db->table_name('kolab_folders'); if ($this->enabled) { // always read folder cache and lock state from DB master @@ -98,8 +100,7 @@ */ public function select_by_id($folder_id) { - $folders_table = $this->db->table_name('kolab_folders', true); - $sql_arr = $this->db->fetch_assoc($this->db->query("SELECT * FROM $folders_table WHERE `folder_id` = ?", $folder_id)); + $sql_arr = $this->db->fetch_assoc($this->db->query("SELECT * FROM `{$this->folders_table}` WHERE `folder_id` = ?", $folder_id)); if ($sql_arr) { $this->metadata = $sql_arr; $this->folder_id = $sql_arr['folder_id']; @@ -120,14 +121,13 @@ { $this->folder = $storage_folder; - if (empty($this->folder->name)) { + if (empty($this->folder->name) || !$this->folder->valid) { $this->ready = false; return; } // compose fully qualified ressource uri for this instance $this->resource_uri = $this->folder->get_resource_uri(); - $this->folders_table = $this->db->table_name('kolab_folders'); $this->cache_table = $this->db->table_name('kolab_cache_' . $this->folder->type); $this->ready = $this->enabled && !empty($this->folder->type); $this->folder_id = null; @@ -151,6 +151,16 @@ } /** + * Returns code of last error + * + * @return int Error code + */ + public function get_error() + { + return $this->error; + } + + /** * Synchronize local cache data with remote */ public function synchronize() @@ -244,6 +254,7 @@ } } + $this->check_error(); $this->synched = time(); } @@ -260,7 +271,12 @@ { // delegate to another cache instance if ($foldername && $foldername != $this->folder->name) { - return kolab_storage::get_folder($foldername)->cache->get($msguid, $type); + $success = false; + if ($targetfolder = kolab_storage::get_folder($foldername)) { + $success = $targetfolder->cache->get($msguid, $type); + $this->error = $targetfolder->cache->get_error(); + } + return $success; } // load object if not in memory @@ -289,6 +305,7 @@ } } + $this->check_error(); return $this->objects[$msguid]; } @@ -308,8 +325,11 @@ // delegate to another cache instance if ($foldername && $foldername != $this->folder->name) { - kolab_storage::get_folder($foldername)->cache->set($msguid, $object); - return; + if ($targetfolder = kolab_storage::get_folder($foldername)) { + $targetfolder->cache->set($msguid, $object); + $this->error = $targetfolder->cache->get_error(); + } + return; } // remove old entry @@ -327,6 +347,8 @@ // ...or set in-memory cache to false $this->objects[$msguid] = $object; } + + $this->check_error(); } @@ -385,6 +407,8 @@ // keep a copy in memory for fast access $this->objects = array($msguid => $object); $this->uid2msg = array($object['uid'] => $msguid); + + $this->check_error(); } @@ -424,6 +448,7 @@ } unset($this->uid2msg[$uid]); + $this->check_error(); } @@ -457,15 +482,20 @@ return; } - $target = kolab_storage::get_folder($new_folder); + if ($target = kolab_storage::get_folder($new_folder)) { + // resolve new message UID in target folder + $this->db->query( + "UPDATE `{$this->folders_table}` SET `resource` = ? ". + "WHERE `resource` = ?", + $target->get_resource_uri(), + $this->resource_uri + ); - // resolve new message UID in target folder - $this->db->query( - "UPDATE `{$this->folders_table}` SET `resource` = ? ". - "WHERE `resource` = ?", - $target->get_resource_uri(), - $this->resource_uri - ); + $this->check_error(); + } + else { + $this->error = kolab_storage::ERROR_IMAP_CONN; + } } /** @@ -530,6 +560,7 @@ } if ($index->is_error()) { + $this->check_error(); if ($uids) { return null; } @@ -552,6 +583,8 @@ } } + $this->check_error(); + return $result; } @@ -594,6 +627,7 @@ } if ($index->is_error()) { + $this->check_error(); return null; } @@ -602,6 +636,7 @@ $count = $index->count(); } + $this->check_error(); return $count; } @@ -935,24 +970,29 @@ return; $this->_read_folder_data(); - $sql_query = "SELECT `synclock`, `ctag` FROM `{$this->folders_table}` WHERE `folder_id` = ?"; // abort if database is not set-up if ($this->db->is_error()) { + $this->check_error(); $this->ready = false; return; } - $this->synclock = true; + $read_query = "SELECT `synclock`, `ctag` FROM `{$this->folders_table}` WHERE `folder_id` = ?"; + $write_query = "UPDATE `{$this->folders_table}` SET `synclock` = ? WHERE `folder_id` = ? AND `synclock` = ?"; - // wait if locked (expire locks after 10 minutes) - while ($this->metadata && intval($this->metadata['synclock']) > 0 && $this->metadata['synclock'] + $this->max_sync_lock_time > time()) { + // wait if locked (expire locks after 10 minutes) ... + // ... or if setting lock fails (another process meanwhile set it) + while ( + (intval($this->metadata['synclock']) + $this->max_sync_lock_time > time()) || + (($res = $this->db->query($write_query, time(), $this->folder_id, intval($this->metadata['synclock']))) && + !($affected = $this->db->affected_rows($res))) + ) { usleep(500000); - $this->metadata = $this->db->fetch_assoc($this->db->query($sql_query, $this->folder_id)); + $this->metadata = $this->db->fetch_assoc($this->db->query($read_query, $this->folder_id)); } - // set lock - $this->db->query("UPDATE `{$this->folders_table}` SET `synclock` = ? WHERE `folder_id` = ?", time(), $this->folder_id); + $this->synclock = $affected > 0; } /** @@ -973,6 +1013,22 @@ } /** + * Check IMAP connection error state + */ + protected function check_error() + { + if (($err_code = $this->imap->get_error_code()) < 0) { + $this->error = kolab_storage::ERROR_IMAP_CONN; + if (($res_code = $this->imap->get_response_code()) !== 0 && in_array($res_code, array(rcube_storage::NOPERM, rcube_storage::READONLY))) { + $this->error = kolab_storage::ERROR_NO_PERMISSION; + } + } + else if ($this->db->is_error()) { + $this->error = kolab_storage::ERROR_CACHE_DB; + } + } + + /** * Resolve an object UID into an IMAP message UID * * @param string Kolab object UID
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/libkolab/lib/kolab_storage_folder.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/lib/kolab_storage_folder.php
Changed
@@ -30,18 +30,28 @@ */ public $cache; - private $type_annotation; - private $resource_uri; + /** + * Indicate validity status + * @var boolean + */ + public $valid = false; + + protected $error = 0; + + protected $resource_uri; /** * Default constructor + * + * @param string The folder name/path + * @param string Expected folder type */ - function __construct($name, $type = null) + function __construct($name, $type = null, $type_annotation = null) { parent::__construct($name); $this->imap->set_options(array('skip_deleted' => true)); - $this->set_folder($name, $type); + $this->set_folder($name, $type, $type_annotation); } @@ -49,30 +59,63 @@ * Set the IMAP folder this instance connects to * * @param string The folder name/path + * @param string Expected folder type * @param string Optional folder type if known */ - public function set_folder($name, $type = null) + public function set_folder($name, $type = null, $type_annotation = null) { - $this->type_annotation = $type ? $type : kolab_storage::folder_type($name); + if (empty($type_annotation)) { + $type_annotation = kolab_storage::folder_type($name); + } $oldtype = $this->type; - list($this->type, $suffix) = explode('.', $this->type_annotation); + list($this->type, $suffix) = explode('.', $type_annotation); $this->default = $suffix == 'default'; $this->subtype = $this->default ? '' : $suffix; $this->name = $name; $this->id = kolab_storage::folder_id($name); + $this->valid = !empty($this->type) && $this->type != 'mail' && (!$type || $this->type == $type); + + if (!$this->valid) { + $this->error = $this->imap->get_error_code() < 0 ? kolab_storage::ERROR_IMAP_CONN : kolab_storage::ERROR_INVALID_FOLDER; + } // reset cached object properties $this->owner = $this->namespace = $this->resource_uri = $this->info = $this->idata = null; - // get a new cache instance of folder type changed - if (!$this->cache || $type != $oldtype) + // get a new cache instance if folder type changed + if (!$this->cache || $this->type != $oldtype) $this->cache = kolab_storage_cache::factory($this); + else + $this->cache->set_folder($this); $this->imap->set_folder($this->name); - $this->cache->set_folder($this); } + /** + * Returns code of last error + * + * @return int Error code + */ + public function get_error() + { + return $this->error ?: $this->cache->get_error(); + } + + /** + * Check IMAP connection error state + */ + public function check_error() + { + if (($err_code = $this->imap->get_error_code()) < 0) { + $this->error = kolab_storage::ERROR_IMAP_CONN; + if (($res_code = $this->imap->get_response_code()) !== 0 && in_array($res_code, array(rcube_storage::NOPERM, rcube_storage::READONLY))) { + $this->error = kolab_storage::ERROR_NO_PERMISSION; + } + } + + return $this->error; + } /** * Compose a unique resource URI for this IMAP folder @@ -138,6 +181,8 @@ if (!($success = $this->set_metadata(array(kolab_storage::UID_KEY_SHARED => $uid)))) { $success = $this->set_metadata(array(kolab_storage::UID_KEY_PRIVATE => $uid)); } + + $this->check_error(); return $success; } @@ -147,6 +192,7 @@ public function get_ctag() { $fdata = $this->get_imap_data(); + $this->check_error(); return sprintf('%d-%d-%d', $fdata['UIDVALIDITY'], $fdata['HIGHESTMODSEQ'], $fdata['UIDNEXT']); } @@ -204,6 +250,10 @@ */ public function count($query = null) { + if (!$this->valid) { + return 0; + } + // synchronize cache first $this->cache->synchronize(); @@ -221,6 +271,10 @@ { if (!$type) $type = $this->type; + if (!$this->valid) { + return array(); + } + // synchronize caches $this->cache->synchronize(); @@ -238,9 +292,14 @@ */ public function select($query = array()) { + if (!$this->valid) { + return array(); + } + // check query argument - if (empty($query)) + if (empty($query)) { return $this->get_objects(); + } // synchronize caches $this->cache->synchronize(); @@ -258,6 +317,10 @@ */ public function get_uids($query = array()) { + if (!$this->valid) { + return array(); + } + // synchronize caches $this->cache->synchronize(); @@ -319,6 +382,10 @@ */ public function get_object($uid, $type = null) { + if (!$this->valid) { + return false; + } + // synchronize caches $this->cache->synchronize(); @@ -348,7 +415,7 @@ */ public function get_attachment($uid, $part, $mailbox = null, $print = false, $fp = null, $skip_charset_conv = false) { - if ($msguid = ($mailbox ? $uid : $this->cache->uid2msguid($uid))) { + if ($this->valid && ($msguid = ($mailbox ? $uid : $this->cache->uid2msguid($uid)))) { $this->imap->set_folder($mailbox ? $mailbox : $this->name); if (substr($part, 0, 2) == 'i:') { @@ -392,6 +459,10 @@ */ public function read_object($msguid, $type = null, $folder = null) { + if (!$this->valid) { + return false; + } + if (!$type) $type = $this->type; if (!$folder) $folder = $this->name; @@ -537,6 +608,10 @@ */ public function save(&$object, $type = null, $uid = null) { + if (!$this->valid) { + return false; + } + if (!$type) $type = $this->type; @@ -732,6 +807,10 @@ */ public function delete($object, $expunge = true) { + if (!$this->valid) { + return false; + } + $msguid = is_array($object) ? $object['_msguid'] : $this->cache->uid2msguid($object); $success = false; @@ -759,6 +838,10 @@ */ public function delete_all() { + if (!$this->valid) { + return false; + } + $this->cache->purge(); $this->cache->bypass(true); $result = $this->imap->clear_folder($this->name); @@ -776,6 +859,10 @@ */ public function undelete($uid) { + if (!$this->valid) { + return false; + } + if ($msguid = $this->cache->uid2msguid($uid, true)) { $this->cache->bypass(true); $result = $this->imap->set_flag($msguid, 'UNDELETED', $this->name); @@ -799,6 +886,10 @@ */ public function move($uid, $target_folder) { + if (!$this->valid) { + return false; + } + if (is_string($target_folder)) $target_folder = kolab_storage::get_folder($target_folder); @@ -1054,8 +1145,6 @@ */ private function trigger_url($url, $auth_user = null, $auth_passwd = null) { - require_once('HTTP/Request2.php'); - try { $request = libkolab::http_request($url);
View file
roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/tests
Added
+(directory)
View file
roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/tests/README.md
Added
@@ -0,0 +1,43 @@ +libkolab plugin tests +===================== + +In order to run the functional tests for libkolab classes, some configuration +for the Roundcube test instance need to be created. Along with the default +config for a given Roundcube instance, you should provide a config specifically +for running tests. To do so, create a config file named `config-test.inc.php` +in the regular Roundcube config dir. That should provide specific `db_dsnw` and +`default_host` values for testing purposes as well as the credentials of a +valid IMAP user account used for running the tests with. + +Add these config options used by the libkolab tests: + +``` + // Unit tests settings + $config['tests_username'] = 'roundcube.test@example.org'; + $config['tests_password'] = '<test-account-password>'; + $config['default_host'] = '<kolab-server>'; + + // disable all plugins + $config['plugins'] = array(); +``` + +WARNING +------- +Please note that the configured IMAP account as well as the Roundcube database +configred in `db_dsnw` will be wiped and filled with test data in every test +run. Under no circumstances you should use credentials of a production database +or email account! + + +Run the tests +------------- + +The tests are based on PHPUnit and need to be exected from the Roundcube +test directory in order to load and initialize the Roundcube framework context. + +To execute individual tests, call `phpunit` from the tests directory: + +``` + cd <roundcube-dir>/tests/ + phpunit ../plugins/libkolab/tests/<filename> +``` \ No newline at end of file
View file
roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/libkolab/tests/kolab_storage_folder.php
Added
@@ -0,0 +1,168 @@ +<?php + +/** + * libkolab/kolab_storage_folder class tests + * + * @author Thomas Bruederli <bruederli@kolabsys.com> + * + * Copyright (C) 2015, Kolab Systems AG <contact@kolabsys.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +class kolab_storage_folder_test extends PHPUnit_Framework_TestCase +{ + public static function setUpBeforeClass() + { + // load libkolab plugin + $rcmail = rcmail::get_instance(); + $rcmail->plugins->load_plugin('libkolab', true, true); + + if ($rcmail->config->get('tests_username')) { + $authenticated = $rcmail->login( + $rcmail->config->get('tests_username'), + $rcmail->config->get('tests_password'), + $rcmail->config->get('default_host'), + false + ); + + if (!$authenticated) { + throw new Exception('IMAP login failed for user ' . $rcmail->config->get('tests_username')); + } + + // check for defult groupware folders and clear them + $imap = $rcmail->get_storage(); + $folders = $imap->list_folders('', '*'); + + foreach (array('Calendar','Contacts','Files','Tasks','Notes') as $folder) { + if (in_array($folder, $folders)) { + if (!$imap->clear_folder($folder)) { + throw new Exception("Failed to clear folder '$folder'"); + } + } + else { + throw new Exception("Default folder '$folder' doesn't exits in test user account"); + } + } + } + else { + throw new Exception('Missing test account username/password in config-test.inc.php'); + } + + kolab_storage::setup(); + } + + function test_001_folder_type_check() + { + $folder = new kolab_storage_folder('Calendar', 'event', 'event.default'); + $this->assertTrue($folder->valid); + $this->assertEquals($folder->get_error(), 0); + + $folder = new kolab_storage_folder('Calendar', 'event', 'mail'); + $this->assertFalse($folder->valid); + $this->assertEquals($folder->get_error(), kolab_storage::ERROR_INVALID_FOLDER); + + $folder = new kolab_storage_folder('INBOX'); + $this->assertFalse($folder->valid); + $this->assertEquals($folder->get_error(), kolab_storage::ERROR_INVALID_FOLDER); + } + + function test_002_get_owner() + { + $rcmail = rcmail::get_instance(); + $folder = new kolab_storage_folder('Calendar', 'event', 'event'); + $this->assertEquals($folder->get_owner(), $rcmail->config->get('tests_username')); + + $domain = preg_replace('/^.+@/', '@', $rcmail->config->get('tests_username')); + + $shared_ns = kolab_storage::namespace_root('shared'); + $folder = new kolab_storage_folder($shared_ns . 'A-shared-folder', 'event', 'event'); + $this->assertEquals($folder->get_owner(true), 'anonymous' . $domain); + + $other_ns = kolab_storage::namespace_root('other'); + $folder = new kolab_storage_folder($other_ns . 'major.tom/Calendar', 'event', 'event'); + $this->assertEquals($folder->get_owner(true), 'major.tom' . $domain); + } + + function test_003_get_resource_uri() + { + $rcmail = rcmail::get_instance(); + $foldername = 'Calendar'; + + $folder = new kolab_storage_folder($foldername, 'event', 'event.default'); + $this->assertEquals($folder->get_resource_uri(), sprintf('imap://%s@%s/%s', + urlencode($rcmail->config->get('tests_username')), + $rcmail->config->get('default_host'), + $foldername + )); + } + + function test_004_get_uid() + { + $rcmail = rcmail::get_instance(); + $folder = new kolab_storage_folder('Doesnt-Exist', 'event', 'event'); + + // generate UID from folder name if IMAP operations fail + $uid1 = $folder->get_uid(); + $this->assertEquals($folder->get_uid(), $uid1); + $this->assertEquals($folder->get_error(), kolab_storage::ERROR_IMAP_CONN); + } + + function test_005_subscribe() + { + $folder = new kolab_storage_folder('Contacts', 'contact'); + $this->assertTrue($folder->subscribe(true)); + $this->assertTrue($folder->is_subscribed()); + + $this->assertTrue($folder->subscribe(false)); + $this->assertFalse($folder->is_subscribed()); + + $folder->subscribe(true); + } + + function test_006_activate() + { + $folder = new kolab_storage_folder('Calendar', 'contact'); + $this->assertTrue($folder->activate(true)); + $this->assertTrue($folder->is_active()); + + $this->assertTrue($folder->activate(false)); + $this->assertFalse($folder->is_active()); + } + + function test_010_write_contacts() + { + $contacts = array( + 'name' => 'FN', + 'surname' => 'Last', + 'firstname' => 'First', + 'email' => array( + array('type' => 'home', 'address' => 'first.last@example.org'), + ), + ); + + $folder = new kolab_storage_folder('Contacts', 'contact'); + $saved = $folder->save($contact, 'contact'); + $this->assertTrue((bool)$saved); + } + + /** + * @depends test_010_write_contacts + */ + function test_011_list_contacts() + { + $folder = new kolab_storage_folder('Contacts', 'contact'); + $this->assertEquals($folder->count(), 1); + } +}
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/ODFViewerPlugin.js -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/ODFViewerPlugin.js
Changed
@@ -1,43 +1,67 @@ /** - * @license * Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> * * @licstart - * The JavaScript code in this page is free software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * (GNU AGPL) as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. The code is distributed - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. + * This file is part of WebODF. * - * As additional permission under GNU AGPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. + * WebODF is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License (GNU AGPL) + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. * - * As a special exception to the AGPL, any HTML file which merely makes function - * calls to this code, and for that purpose includes it by reference shall be - * deemed a separate work for copyright law purposes. In addition, the copyright - * holders of this code give you permission to combine this code with free - * software libraries that are released under the GNU LGPL. You may copy and - * distribute such a system following the terms of the GNU AGPL for this code - * and the LGPL for the libraries. If you modify this code, you may extend this - * exception to your version of the code, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your - * version. + * WebODF is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * This license applies to this entire compilation. + * You should have received a copy of the GNU Affero General Public License + * along with WebODF. If not, see <http://www.gnu.org/licenses/>. * @licend + * * @source: http://www.webodf.org/ - * @source: http://gitorious.org/webodf/webodf/ + * @source: https://github.com/kogmbh/WebODF/ */ -/*global runtime, document, odf, console*/ +/*global runtime, document, odf, gui, console, webodf*/ function ODFViewerPlugin() { "use strict"; + function init(callback) { +/* + var lib = document.createElement('script'), + pluginCSS; + + lib.async = false; + lib.src = './webodf.js'; + lib.type = 'text/javascript'; + lib.onload = function () { +*/ + runtime.loadClass('gui.HyperlinkClickHandler'); + runtime.loadClass('odf.OdfCanvas'); + runtime.loadClass('ops.Session'); + runtime.loadClass('gui.CaretManager'); + runtime.loadClass("gui.HyperlinkTooltipView"); + runtime.loadClass('gui.SessionController'); + runtime.loadClass('gui.SvgSelectionView'); + runtime.loadClass('gui.SelectionViewManager'); + runtime.loadClass('gui.ShadowCursor'); + runtime.loadClass('gui.SessionView'); + + callback(); +/* + }; + + document.getElementsByTagName('head')[0].appendChild(lib); + + pluginCSS = document.createElement('link'); + pluginCSS.setAttribute("rel", "stylesheet"); + pluginCSS.setAttribute("type", "text/css"); + pluginCSS.setAttribute("href", "./ODFViewerPlugin.css"); + document.head.appendChild(pluginCSS); +*/ + } + // that should probably be provided by webodf function nsResolver(prefix) { var ns = { @@ -50,6 +74,8 @@ } var self = this, + pluginName = "WebODF", + pluginURL = "http://webodf.org", odfCanvas = null, odfElement = null, initialized = false, @@ -59,18 +85,61 @@ currentPage = null; this.initialize = function (viewerElement, documentUrl) { - odfElement = document.getElementById('canvas'); - odfCanvas = new odf.OdfCanvas(odfElement); - odfCanvas.load(documentUrl); - - odfCanvas.addListener('statereadychange', function () { - root = odfCanvas.odfContainer().rootElement; - initialized = true; - documentType = odfCanvas.odfContainer().getDocumentType(root); - if (documentType === 'text' && odfCanvas.enableAnnotations) { - odfCanvas.enableAnnotations(true); - } - self.onLoad(); + // If the URL has a fragment (#...), try to load the file it represents + init(function () { + var session, + sessionController, + sessionView, + odtDocument, + shadowCursor, + selectionViewManager, + caretManager, + localMemberId = 'localuser', + hyperlinkTooltipView, + eventManager; + + odfElement = document.getElementById('canvas'); + odfCanvas = new odf.OdfCanvas(odfElement); + odfCanvas.load(documentUrl); + + odfCanvas.addListener('statereadychange', function () { + root = odfCanvas.odfContainer().rootElement; + initialized = true; + documentType = odfCanvas.odfContainer().getDocumentType(root); + + if (documentType === 'text') { + odfCanvas.enableAnnotations(true, false); + + session = new ops.Session(odfCanvas); + odtDocument = session.getOdtDocument(); + shadowCursor = new gui.ShadowCursor(odtDocument); + sessionController = new gui.SessionController(session, localMemberId, shadowCursor, {}); + eventManager = sessionController.getEventManager(); + caretManager = new gui.CaretManager(sessionController, odfCanvas.getViewport()); + selectionViewManager = new gui.SelectionViewManager(gui.SvgSelectionView); + sessionView = new gui.SessionView({ + caretAvatarsInitiallyVisible: false + }, localMemberId, session, sessionController.getSessionConstraints(), caretManager, selectionViewManager); + selectionViewManager.registerCursor(shadowCursor); + hyperlinkTooltipView = new gui.HyperlinkTooltipView(odfCanvas, + sessionController.getHyperlinkClickHandler().getModifier); + eventManager.subscribe("mousemove", hyperlinkTooltipView.showTooltip); + eventManager.subscribe("mouseout", hyperlinkTooltipView.hideTooltip); + + var op = new ops.OpAddMember(); + op.init({ + memberid: localMemberId, + setProperties: { + fillName: runtime.tr("Unknown Author"), + color: "blue" + } + }); + session.enqueue([op]); + sessionController.insertLocalCursor(); + } + + self.onLoad(); + }); }); }; @@ -128,9 +197,28 @@ } return pages; }; - + this.showPage = function (n) { odfCanvas.showPage(n); }; - + + this.getPluginName = function () { + return pluginName; + }; + + this.getPluginVersion = function () { + var version; + + if (String(typeof webodf) !== "undefined") { + version = webodf.Version; + } else { + version = "Unknown"; + } + + return version; + }; + + this.getPluginURL = function () { + return pluginURL; + }; }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/README -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/README
Changed
@@ -6,11 +6,5 @@ INSTALLATION ------------ -Make the the folder 'files' in this directory writeable for the webserver. -It is used to temporarily store attachment files. Also make sure in the -webserver configuraton that this directory is not browsable. For Apache -webservers the included .htaccess file should already do the job. - Add 'odfviewer' to the list of plugins in the config/main.inc.php file of your Roundcube installation. -
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/odf.html -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/odf.html
Changed
@@ -1,11 +1,13 @@ +<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/> <title>Roundcube WebODF Viewer</title> -<link rel="stylesheet" type="text/css" href="%%DOCROOT%%viewer.css"/> -<script type="text/javascript" src="%%DOCROOT%%viewer.js" charset="utf-8"></script> -<script type="text/javascript" src="%%DOCROOT%%ODFViewerPlugin.js" charset="utf-8"></script> -<script type="text/javascript" src="%%DOCROOT%%webodf.js" charset="utf-8"></script> +<link rel="stylesheet" type="text/css" href="%%viewer.css%%"/> +<script type="text/javascript" src="%%viewer.js%%" charset="utf-8"></script> +<script type="text/javascript" src="%%ODFViewerPlugin.js%%" charset="utf-8"></script> +<script type="text/javascript" src="%%webodf.js%%" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> /** @@ -33,74 +35,74 @@ */ -function init() { - viewer = new Viewer(new ODFViewerPlugin(), '%%DOCURL%%'); -} -window.setTimeout(init, 0); +window.onload = function () { + var viewer = new Viewer(new ODFViewerPlugin(), %%PARAMS%%); +}; </script> </head> - <body> - <div id="viewer"> - <div id="titlebar"> - <div id="documentName"></div> - <div id="toolbarRight"> - <button id="presentation" class="toolbarButton presentation" title="Presentation"></button> - <button id="fullscreen" class="toolbarButton fullscreen" title="Fullscreen"></button> - <button id="download" class="toolbarButton download" title="Download"></button> - </div> - </div> - <div id="toolbarContainer"> - <div id="toolbar"> - <div id="toolbarLeft"> - <div id="navButtons" class="splitToolbarButton"> - <button id="previous" class="toolbarButton pageUp" title="Previous Page"></button> - <div class="splitToolbarButtonSeparator"></div> - <button id="next" class="toolbarButton pageDown" title="Next Page"></button> - </div> - <label id="pageNumberLabel" class="toolbarLabel" for="pageNumber">Page:</label> - <input type="number" id="pageNumber" class="toolbarField pageNumber"></input> - <span id="numPages" class="toolbarLabel"></span> + <div id="viewer"> + <div id="titlebar"> + <div id="documentName"></div> + <div id="toolbarRight"> + <button id="presentation" class="toolbarButton presentation" title="Presentation"></button> + <button id="fullscreen" class="toolbarButton fullscreen" title="Fullscreen"></button> + <button id="download" class="toolbarButton download" title="Download"></button> </div> - <div id="toolbarMiddleContainer" class="outerCenter"> - <div id="toolbarMiddle" class="innerCenter"> - <div id = 'zoomButtons' class="splitToolbarButton"> - <button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out"></button> + </div> + <div id="toolbarContainer"> + <div id="toolbar"> + <div id="toolbarLeft"> + <div id="navButtons" class="splitToolbarButton"> + <button id="previous" class="toolbarButton pageUp" title="Previous Page"></button> <div class="splitToolbarButtonSeparator"></div> - <button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In"></button> + <button id="next" class="toolbarButton pageDown" title="Next Page"></button> </div> - <span id="scaleSelectContainer" class="dropdownToolbarButton"> - <select id="scaleSelect" title="Zoom" oncontextmenu="return false;"> - <option id="pageAutoOption" value="auto" selected>Automatic</option> - <option id="pageActualOption" value="page-actual">Actual Size</option> - <option id="pageWidthOption" value="page-width">Full Width</option> - <option id="customScaleOption" value="custom"></option> - <option value="0.5">50%</option> - <option value="0.75">75%</option> - <option value="1">100%</option> - <option value="1.25">125%</option> - <option value="1.5">150%</option> - <option value="2">200%</option> - </select> - </span> - <div id="sliderContainer"> - <div id="slider"></div> + <label id="pageNumberLabel" class="toolbarLabel" for="pageNumber">Page:</label> + <input type="number" id="pageNumber" class="toolbarField pageNumber"/> + <span id="numPages" class="toolbarLabel"></span> + </div> + <div id="toolbarMiddleContainer" class="outerCenter"> + <div id="toolbarMiddle" class="innerCenter"> + <div id = 'zoomButtons' class="splitToolbarButton"> + <button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out"></button> + <div class="splitToolbarButtonSeparator"></div> + <button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In"></button> + </div> + <span id="scaleSelectContainer" class="dropdownToolbarButton"> + <select id="scaleSelect" title="Zoom" oncontextmenu="return false;"> + <option id="pageAutoOption" value="auto" selected>Automatic</option> + <option id="pageActualOption" value="page-actual">Actual Size</option> + <option id="pageWidthOption" value="page-width">Full Width</option> + <option id="customScaleOption" value="custom"> </option> + <option value="0.5">50%</option> + <option value="0.75">75%</option> + <option value="1">100%</option> + <option value="1.25">125%</option> + <option value="1.5">150%</option> + <option value="2">200%</option> + </select> + </span> + <div id="sliderContainer"> + <div id="slider"></div> + </div> </div> </div> </div> </div> + <div id="canvasContainer"> + <div id="canvas"></div> + </div> + <div id="overlayNavigator"> + <div id="previousPage"></div> + <div id="nextPage"></div> + </div> + <div id="overlayCloseButton"> + ✖ + </div> + <div id="dialogOverlay"></div> + <div id="blanked"></div> </div> - <div id="canvasContainer"> - <div id="canvas"></div> - </div> - <div id="overlayNavigator"> - <div id="previousPage"></div> - <div id="nextPage"></div> - </div> - <div id="overlayCloseButton"> - ✖ - </div> - </div> </body> </html>
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/odfviewer.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/odfviewer.php
Changed
@@ -26,132 +26,84 @@ */ class odfviewer extends rcube_plugin { - public $task = 'mail|calendar|tasks|logout'; - - private $tempdir = 'plugins/odfviewer/files/'; - private $tempbase = 'plugins/odfviewer/files/'; - - private $odf_mimetypes = array( - 'application/vnd.oasis.opendocument.chart', - 'application/vnd.oasis.opendocument.chart-template', - 'application/vnd.oasis.opendocument.formula', - 'application/vnd.oasis.opendocument.formula-template', - 'application/vnd.oasis.opendocument.graphics', - 'application/vnd.oasis.opendocument.graphics-template', - 'application/vnd.oasis.opendocument.presentation', - 'application/vnd.oasis.opendocument.presentation-template', - 'application/vnd.oasis.opendocument.text', - 'application/vnd.oasis.opendocument.text-master', - 'application/vnd.oasis.opendocument.text-template', - 'application/vnd.oasis.opendocument.spreadsheet', - 'application/vnd.oasis.opendocument.spreadsheet-template', - ); + public $task = 'mail|calendar|tasks'; - function init() - { - $this->tempdir = $this->home . '/files/'; - $this->tempbase = $this->urlbase . 'files/'; + private $odf_mimetypes = array( + 'application/vnd.oasis.opendocument.chart', + 'application/vnd.oasis.opendocument.chart-template', + 'application/vnd.oasis.opendocument.formula', + 'application/vnd.oasis.opendocument.formula-template', + 'application/vnd.oasis.opendocument.graphics', + 'application/vnd.oasis.opendocument.graphics-template', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.oasis.opendocument.presentation-template', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.text-master', + 'application/vnd.oasis.opendocument.text-template', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template', + ); - // webODF only supports IE9 or higher - $ua = new rcube_browser; - if ($ua->ie && $ua->ver < 9) - return; - // extend list of mimetypes that should open in preview - $rcmail = rcube::get_instance(); - if ($rcmail->action == 'preview' || $rcmail->action == 'show' || $rcmail->task == 'calendar' || $rcmail->task == 'tasks') { - $mimetypes = (array)$rcmail->config->get('client_mimetypes'); - $rcmail->config->set('client_mimetypes', array_merge($mimetypes, $this->odf_mimetypes)); - } - - $this->add_hook('message_part_get', array($this, 'get_part')); - $this->add_hook('session_destroy', array($this, 'session_cleanup')); - } + function init() + { + // webODF only supports IE9 or higher + $ua = new rcube_browser; + if ($ua->ie && $ua->ver < 9) { + return; + } - /** - * Handler for message attachment download - */ - function get_part($args) - { - if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) { - if (empty($_GET['_load'])) { + // extend list of mimetypes that should open in preview $rcmail = rcube::get_instance(); - $exts = rcube_mime::get_mime_extensions($args['mimetype']); - $suffix = $exts ? '.'.$exts[0] : '.odt'; - $fn = md5(session_id() . $_SERVER['REQUEST_URI']) . $suffix; - - // FIXME: copy file to disk because only apache can send the file correctly - $tempfn = $this->tempdir . $fn; - if (!file_exists($tempfn)) { - if ($args['body']) { - file_put_contents($tempfn, $args['body']); - } - else { - $fp = fopen($tempfn, 'w'); - $imap = rcube::get_instance()->get_storage(); - $imap->get_message_part($args['uid'], $args['id'], $args['part'], false, $fp); - fclose($fp); - } - - // remember tempfiles in session to clean up on logout - $_SESSION['odfviewer']['tempfiles'][] = $fn; - } - - // send webODF viewer page - $html = file_get_contents($this->home . '/odf.html'); - header("Content-Type: text/html; charset=" . RCMAIL_CHARSET); - echo strtr($html, array( - '%%DOCROOT%%' => $rcmail->output->asset_url($this->urlbase), - '%%DOCURL%%' => $rcmail->output->asset_url($this->tempbase . $fn), # $_SERVER['REQUEST_URI'].'&_load=1', - )); - $args['abort'] = true; - } -/* - else { - if ($_SERVER['REQUEST_METHOD'] == 'HEAD') { - header("Content-Length: " . max(10, $args['part']->size)); # content-length has to be present - $args['body'] = ' '; # send empty body - return $args; + if ($rcmail->action == 'preview' || $rcmail->action == 'show' || $rcmail->task == 'calendar' || $rcmail->task == 'tasks') { + $mimetypes = (array)$rcmail->config->get('client_mimetypes'); + $rcmail->config->set('client_mimetypes', array_merge($mimetypes, $this->odf_mimetypes)); } - } -*/ + + $this->add_hook('message_part_get', array($this, 'get_part')); } - return $args; - } + /** + * Handler for message attachment download + */ + function get_part($args) + { + if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) { + $rcmail = rcube::get_instance(); + $params = array( + 'documentUrl' => $_SERVER['REQUEST_URI'] . '&_download=1', + 'filename' => $args['part']->filename ?: 'file.odt', + 'type' => $args['mimetype'], + ); + + // send webODF viewer page + $html = file_get_contents($this->home . '/odf.html'); + header("Content-Type: text/html; charset=" . RCMAIL_CHARSET); + echo strtr($html, array( + '%%PARAMS%%' => rcube_output::json_serialize($params), + '%%viewer.css%%' => $this->asset_path('viewer.css'), + '%%viewer.js%%' => $this->asset_path('viewer.js'), + '%%ODFViewerPlugin.js%%' => $this->asset_path('ODFViewerPlugin.js'), + '%%webodf.js%%' => $this->asset_path('webodf.js'), + )); + + $args['abort'] = true; + } - /** - * Remove temp files opened during this session - */ - function session_cleanup() - { - foreach ((array)$_SESSION['odfviewer']['tempfiles'] as $fn) { - @unlink($this->tempdir . $fn); + return $args; } - - // also trigger general garbage collection because not everybody logs out properly - $this->gc_cleanup(); - } - /** - * Garbage collector function for temp files. - * Remove temp files older than two days - */ - function gc_cleanup() - { - $tmp = unslashify($this->tempdir); - $expire = mktime() - 172800; // expire in 48 hours + private function asset_path($path) + { + $rcmail = rcube::get_instance(); + $assets_dir = $rcmail->config->get('assets_dir'); - if ($dir = opendir($tmp)) { - while (($fname = readdir($dir)) !== false) { - if ($fname[0] == '.') - continue; + $mtime = filemtime($this->home . '/' . $path); + if (!$mtime && $assets_dir) { + $mtime = filemtime($assets_dir . '/plugins/odfviewer/' . $path); + } - if (filemtime($tmp.'/'.$fname) < $expire) - @unlink($tmp.'/'.$fname); - } + $path = $this->urlbase . $path . ($mtime ? '?s=' . $mtime : ''); - closedir($dir); + return $rcmail->output->asset_url($path); } - } } -
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/viewer.css -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/viewer.css
Changed
@@ -28,7 +28,7 @@ -webkit-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); -moz-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); - + background-image: url(images/texture.png), linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99)); background-image: url(images/texture.png), -webkit-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99)); background-image: url(images/texture.png), -moz-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/viewer.js -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/viewer.js
Changed
@@ -1,41 +1,50 @@ /** - * @license - * Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> + * Copyright (C) 2012-2015 KO GmbH <copyright@kogmbh.com> * * @licstart - * The JavaScript code in this page is free software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * (GNU AGPL) as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. The code is distributed - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. + * This file is part of WebODF. * - * As additional permission under GNU AGPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. + * WebODF is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License (GNU AGPL) + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. * - * As a special exception to the AGPL, any HTML file which merely makes function - * calls to this code, and for that purpose includes it by reference shall be - * deemed a separate work for copyright law purposes. In addition, the copyright - * holders of this code give you permission to combine this code with free - * software libraries that are released under the GNU LGPL. You may copy and - * distribute such a system following the terms of the GNU AGPL for this code - * and the LGPL for the libraries. If you modify this code, you may extend this - * exception to your version of the code, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your - * version. + * WebODF is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * This license applies to this entire compilation. + * You should have received a copy of the GNU Affero General Public License + * along with WebODF. If not, see <http://www.gnu.org/licenses/>. * @licend + * * @source: http://www.webodf.org/ - * @source: http://gitorious.org/webodf/webodf/ + * @source: https://github.com/kogmbh/WebODF/ + */ + +/* + * This file is a derivative from a part of Mozilla's PDF.js project. The + * original license header follows. + */ + +/* Copyright 2012 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /*global document, window*/ -function Viewer(viewerPlugin, docurl) { +function Viewer(viewerPlugin, parameters) { "use strict"; var self = this, @@ -45,25 +54,88 @@ kDefaultScaleDelta = 1.1, kDefaultScale = 'auto', presentationMode = false, + isFullScreen = false, initialized = false, isSlideshow = false, url, - viewerElement, + viewerElement = document.getElementById('viewer'), canvasContainer = document.getElementById('canvasContainer'), overlayNavigator = document.getElementById('overlayNavigator'), + titlebar = document.getElementById('titlebar'), + toolbar = document.getElementById('toolbarContainer'), pageSwitcher = document.getElementById('toolbarLeft'), zoomWidget = document.getElementById('toolbarMiddleContainer'), scaleSelector = document.getElementById('scaleSelect'), - filename, + dialogOverlay = document.getElementById('dialogOverlay'), + toolbarRight = document.getElementById('toolbarRight'), + aboutDialog, pages = [], currentPage, scaleChangeTimer, - touchTimer; + touchTimer, + toolbarTouchTimer, + /**@const*/ + UI_FADE_DURATION = 5000; + + function isBlankedOut() { + return (blanked.style.display === 'block'); + } + + function initializeAboutInformation() { + var aboutDialogCentererTable, aboutDialogCentererCell, aboutButton, pluginName, pluginVersion, pluginURL; + + if (viewerPlugin) { + pluginName = viewerPlugin.getPluginName(); + pluginVersion = viewerPlugin.getPluginVersion(); + pluginURL = viewerPlugin.getPluginURL(); + } + + // Create dialog + aboutDialogCentererTable = document.createElement('div'); + aboutDialogCentererTable.id = "aboutDialogCentererTable"; + aboutDialogCentererCell = document.createElement('div'); + aboutDialogCentererCell.id = "aboutDialogCentererCell"; + aboutDialog = document.createElement('div'); + aboutDialog.id = "aboutDialog"; + aboutDialog.innerHTML = + "<h1>ViewerJS</h1>" + + "<p>Open Source document viewer for webpages, built with HTML and JavaScript.</p>" + + "<p>Learn more and get your own copy on the <a href=\"http://viewerjs.org/\" target=\"_blank\">ViewerJS website</a>.</p>" + + (viewerPlugin ? ("<p>Using the <a href = \""+ pluginURL + "\" target=\"_blank\">" + pluginName + "</a> " + + "(<span id = \"pluginVersion\">" + pluginVersion + "</span>) " + + "plugin to show you this document.</p>") + : "") + + "<p>Supported by <a href=\"http://nlnet.nl\" target=\"_blank\"><br><img src=\"images\/nlnet.png\" width=\"160\" height=\"60\" alt=\"NLnet Foundation\"></a></p>" + + "<p>Made by <a href=\"http://kogmbh.com\" target=\"_blank\"><br><img src=\"images\/kogmbh.png\" width=\"172\" height=\"40\" alt=\"KO GmbH\"></a></p>" + + "<button id = \"aboutDialogCloseButton\" class = \"toolbarButton textButton\">Close</button>"; + dialogOverlay.appendChild(aboutDialogCentererTable); + aboutDialogCentererTable.appendChild(aboutDialogCentererCell); + aboutDialogCentererCell.appendChild(aboutDialog); + + // Create button to open dialog that says "ViewerJS" + aboutButton = document.createElement('button'); + aboutButton.id = "about"; + aboutButton.className = "toolbarButton textButton about"; + aboutButton.title = "About"; + aboutButton.innerHTML = "ViewerJS" + toolbarRight.appendChild(aboutButton); + + // Attach events to the above + aboutButton.addEventListener('click', function () { + showAboutDialog(); + }); + document.getElementById('aboutDialogCloseButton').addEventListener('click', function () { + hideAboutDialog(); + }); + + } - function isFullScreen() { - // Note that the browser fullscreen (triggered by short keys) might - // be considered different from content fullscreen when expecting a boolean - return document.isFullScreen || document.mozFullScreen || document.webkitIsFullScreen; + function showAboutDialog() { + dialogOverlay.style.display = "block"; + } + + function hideAboutDialog() { + dialogOverlay.style.display = "none"; } function selectScaleOption(value) { @@ -171,18 +243,38 @@ delayedRefresh(300); } - - this.initialize = function (url) { - viewerElement = document.getElementById('viewer'); - filename = url.replace(/^.*[\\\/]/, ''); - document.title = filename; - document.getElementById('documentName').innerHTML = document.title; + function readZoomParameter(zoom) { + var validZoomStrings = ["auto", "page-actual", "page-width"], + number; + + if (validZoomStrings.indexOf(zoom) !== -1) { + return zoom; + } + number = parseFloat(zoom); + if (number && kMinScale <= number && number <= kMaxScale) { + return zoom; + } + return kDefaultScale; + } + + this.initialize = function () { + var initialScale, + element; + + initialScale = readZoomParameter(parameters.zoom); + + url = parameters.documentUrl; + document.title = parameters.filename; + var documentName = document.getElementById('documentName'); + documentName.innerHTML = ""; + documentName.appendChild(documentName.ownerDocument.createTextNode(parameters.filename)); viewerPlugin.onLoad = function () { +// document.getElementById('pluginVersion').innerHTML = viewerPlugin.getPluginVersion(); isSlideshow = viewerPlugin.isSlideshow(); if (isSlideshow) { - // No padding for slideshows - canvasContainer.style.padding = 0; + // Slideshow pages should be centered + canvasContainer.classList.add("slideshow"); // Show page nav controls only for presentations pageSwitcher.style.visibility = 'visible'; } else { @@ -201,7 +293,7 @@ self.showPage(1); // Set default scale - parseScale(kDefaultScale); + parseScale(initialScale); canvasContainer.onscroll = onScroll; delayedRefresh(); @@ -260,21 +352,31 @@ */ this.toggleFullScreen = function () { var elem = viewerElement; - if (!isFullScreen()) { - if (elem.requestFullScreen) { - elem.requestFullScreen(); + if (!isFullScreen) { + if (elem.requestFullscreen) { + elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); + } else if (elem.webkitRequestFullscreen) { + elem.webkitRequestFullscreen(); } else if (elem.webkitRequestFullScreen) { - elem.webkitRequestFullScreen(); + elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); + } else if (elem.msRequestFullscreen) { + elem.msRequestFullscreen(); } } else { - if (document.cancelFullScreen) { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); } } }; @@ -284,14 +386,12 @@ * Presentation mode involves fullscreen + hidden UI controls */ this.togglePresentationMode = function () { - var titlebar = document.getElementById('titlebar'), - toolbar = document.getElementById('toolbarContainer'), - overlayCloseButton = document.getElementById('overlayCloseButton'); + var overlayCloseButton = document.getElementById('overlayCloseButton'); if (!presentationMode) { titlebar.style.display = toolbar.style.display = 'none'; overlayCloseButton.style.display = 'block'; - canvasContainer.className = 'presentationMode'; + canvasContainer.classList.add('presentationMode'); isSlideshow = true; canvasContainer.onmousedown = function (event) { event.preventDefault(); @@ -309,9 +409,12 @@ }; parseScale('page-fit'); } else { + if (isBlankedOut()) { + leaveBlankOut(); + } titlebar.style.display = toolbar.style.display = 'block'; overlayCloseButton.style.display = 'none'; - canvasContainer.className = ''; + canvasContainer.classList.remove('presentationMode'); canvasContainer.onmouseup = function () {}; canvasContainer.oncontextmenu = function () {}; canvasContainer.onmousedown = function () {}; @@ -362,123 +465,213 @@ }; function cancelPresentationMode() { - if (presentationMode && !isFullScreen()) { + if (presentationMode && !isFullScreen) { self.togglePresentationMode(); } } + function handleFullScreenChange() { + isFullScreen = !isFullScreen; + cancelPresentationMode(); + } + function showOverlayNavigator() { if (isSlideshow) { - overlayNavigator.className = 'touched'; + overlayNavigator.className = 'viewer-touched'; window.clearTimeout(touchTimer); touchTimer = window.setTimeout(function () { overlayNavigator.className = ''; - }, 2000); + }, UI_FADE_DURATION); } } - function init(docurl) { + /** + * @param {!boolean} timed Fade after a while + */ + function showToolbars() { + titlebar.classList.add('viewer-touched'); + toolbar.classList.add('viewer-touched'); + window.clearTimeout(toolbarTouchTimer); + toolbarTouchTimer = window.setTimeout(function () { + hideToolbars(); + }, UI_FADE_DURATION); + } - self.initialize(docurl); + function hideToolbars() { + titlebar.classList.remove('viewer-touched'); + toolbar.classList.remove('viewer-touched'); + } - if (!(document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen)) { - document.getElementById('fullscreen').style.visibility = 'hidden'; + function toggleToolbars() { + if (titlebar.classList.contains('viewer-touched')) { + hideToolbars(); + } else { + showToolbars(); } + } - document.getElementById('overlayCloseButton').addEventListener('click', self.toggleFullScreen); - document.getElementById('fullscreen').addEventListener('click', self.toggleFullScreen); - document.getElementById('presentation').addEventListener('click', function () { - if (!isFullScreen()) { - self.toggleFullScreen(); - } - self.togglePresentationMode(); - }); + function blankOut(value) { + blanked.style.display = 'block'; + blanked.style.backgroundColor = value; + hideToolbars(); + } - document.addEventListener('fullscreenchange', cancelPresentationMode); - document.addEventListener('webkitfullscreenchange', cancelPresentationMode); - document.addEventListener('mozfullscreenchange', cancelPresentationMode); + function leaveBlankOut() { + blanked.style.display = 'none'; + toggleToolbars(); + } - document.getElementById('download').addEventListener('click', function () { - self.download(); - }); + function init() { - document.getElementById('zoomOut').addEventListener('click', function () { - self.zoomOut(); - }); +// initializeAboutInformation(); + if (viewerPlugin) { - document.getElementById('zoomIn').addEventListener('click', function () { - self.zoomIn(); - }); + self.initialize(); - document.getElementById('previous').addEventListener('click', function () { - self.showPreviousPage(); - }); + if (!(document.exitFullscreen || document.cancelFullScreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.webkitCancelFullScreen || document.msExitFullscreen)) { + document.getElementById('fullscreen').style.visibility = 'hidden'; + document.getElementById('presentation').style.visibility = 'hidden'; + } - document.getElementById('next').addEventListener('click', function () { - self.showNextPage(); - }); + document.getElementById('overlayCloseButton').addEventListener('click', self.toggleFullScreen); + document.getElementById('fullscreen').addEventListener('click', self.toggleFullScreen); + document.getElementById('presentation').addEventListener('click', function () { + if (!isFullScreen) { + self.toggleFullScreen(); + } + self.togglePresentationMode(); + }); - document.getElementById('previousPage').addEventListener('click', function () { - self.showPreviousPage(); - }); + document.addEventListener('fullscreenchange', handleFullScreenChange); + document.addEventListener('webkitfullscreenchange', handleFullScreenChange); + document.addEventListener('mozfullscreenchange', handleFullScreenChange); + document.addEventListener('MSFullscreenChange', handleFullScreenChange); - document.getElementById('nextPage').addEventListener('click', function () { - self.showNextPage(); - }); + document.getElementById('download').addEventListener('click', function () { + self.download(); + }); - document.getElementById('pageNumber').addEventListener('change', function () { - self.showPage(this.value); - }); + document.getElementById('zoomOut').addEventListener('click', function () { + self.zoomOut(); + }); - document.getElementById('scaleSelect').addEventListener('change', function () { - parseScale(this.value); - }); + document.getElementById('zoomIn').addEventListener('click', function () { + self.zoomIn(); + }); + + document.getElementById('previous').addEventListener('click', function () { + self.showPreviousPage(); + }); - canvasContainer.addEventListener('click', showOverlayNavigator); - overlayNavigator.addEventListener('click', showOverlayNavigator); + document.getElementById('next').addEventListener('click', function () { + self.showNextPage(); + }); - window.addEventListener('scalechange', function (evt) { - var customScaleOption = document.getElementById('customScaleOption'), - predefinedValueFound = selectScaleOption(String(evt.scale)); + document.getElementById('previousPage').addEventListener('click', function () { + self.showPreviousPage(); + }); - customScaleOption.selected = false; + document.getElementById('nextPage').addEventListener('click', function () { + self.showNextPage(); + }); - if (!predefinedValueFound) { - customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%'; - customScaleOption.selected = true; - } - }, true); + document.getElementById('pageNumber').addEventListener('change', function () { + self.showPage(this.value); + }); - window.addEventListener('resize', function (evt) { - if (initialized && - (document.getElementById('pageWidthOption').selected || - document.getElementById('pageAutoOption').selected)) { - parseScale(document.getElementById('scaleSelect').value); - } - showOverlayNavigator(); - }); + document.getElementById('scaleSelect').addEventListener('change', function () { + parseScale(this.value); + }); - window.addEventListener('keydown', function (evt) { - var key = evt.keyCode, - shiftKey = evt.shiftKey; + canvasContainer.addEventListener('click', showOverlayNavigator); + overlayNavigator.addEventListener('click', showOverlayNavigator); + canvasContainer.addEventListener('click', toggleToolbars); + titlebar.addEventListener('click', showToolbars); + toolbar.addEventListener('click', showToolbars); - switch (key) { - case 33: // pageUp - case 38: // up - case 37: // left - self.showPreviousPage(); - break; - case 34: // pageDown - case 40: // down - case 39: // right - self.showNextPage(); - break; - case 32: // space - shiftKey ? self.showPreviousPage() : self.showNextPage(); - break; - } - }); + window.addEventListener('scalechange', function (evt) { + var customScaleOption = document.getElementById('customScaleOption'), + predefinedValueFound = selectScaleOption(String(evt.scale)); + + customScaleOption.selected = false; + + if (!predefinedValueFound) { + customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%'; + customScaleOption.selected = true; + } + }, true); + + window.addEventListener('resize', function (evt) { + if (initialized && + (document.getElementById('pageWidthOption').selected || + document.getElementById('pageAutoOption').selected)) { + parseScale(document.getElementById('scaleSelect').value); + } + showOverlayNavigator(); + }); + + window.addEventListener('keydown', function (evt) { + var key = evt.keyCode, + shiftKey = evt.shiftKey; + + // blanked-out mode? + if (isBlankedOut()) { + switch (key) { + case 16: // Shift + case 17: // Ctrl + case 18: // Alt + case 91: // LeftMeta + case 93: // RightMeta + case 224: // MetaInMozilla + case 225: // AltGr + // ignore modifier keys alone + break; + default: + leaveBlankOut(); + break; + } + } else { + switch (key) { + case 8: // backspace + case 33: // pageUp + case 37: // left arrow + case 38: // up arrow + case 80: // key 'p' + self.showPreviousPage(); + break; + case 13: // enter + case 34: // pageDown + case 39: // right arrow + case 40: // down arrow + case 78: // key 'n' + self.showNextPage(); + break; + case 32: // space + shiftKey ? self.showPreviousPage() : self.showNextPage(); + break; + case 66: // key 'b' blanks screen (to black) or returns to the document + case 190: // and so does the key '.' (dot) + if (presentationMode) { + blankOut('#000'); + } + break; + case 87: // key 'w' blanks page (to white) or returns to the document + case 188: // and so does the key ',' (comma) + if (presentationMode) { + blankOut('#FFF'); + } + break; + case 36: // key 'Home' goes to first page + self.showPage(0); + break; + case 35: // key 'End' goes to last page + self.showPage(pages.length); + break; + } + } + }); + } } - init(docurl); + init(); }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/odfviewer/webodf.js -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/odfviewer/webodf.js
Changed
@@ -1,464 +1,30 @@ -// Input 0 /* + This is a generated file. DO NOT EDIT. - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> + Copyright (C) 2010-2014 KO GmbH <copyright@kogmbh.com> @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -var core={},gui={},xmldom={},odf={},ops={}; -// Input 1 -function Runtime(){}Runtime.ByteArray=function(e){};Runtime.prototype.getVariable=function(e){};Runtime.prototype.toJson=function(e){};Runtime.prototype.fromJson=function(e){};Runtime.ByteArray.prototype.slice=function(e,k){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(e){};Runtime.prototype.byteArrayFromString=function(e,k){};Runtime.prototype.byteArrayToString=function(e,k){};Runtime.prototype.concatByteArrays=function(e,k){}; -Runtime.prototype.read=function(e,k,l,p){};Runtime.prototype.readFile=function(e,k,l){};Runtime.prototype.readFileSync=function(e,k){};Runtime.prototype.loadXML=function(e,k){};Runtime.prototype.writeFile=function(e,k,l){};Runtime.prototype.isFile=function(e,k){};Runtime.prototype.getFileSize=function(e,k){};Runtime.prototype.deleteFile=function(e,k){};Runtime.prototype.log=function(e,k){};Runtime.prototype.setTimeout=function(e,k){};Runtime.prototype.libraryPaths=function(){}; -Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(e){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(e,k,l){};var IS_COMPILED_CODE=!0; -Runtime.byteArrayToString=function(e,k){function l(h){var b="",f,d=h.length;for(f=0;f<d;f+=1)b+=String.fromCharCode(h[f]&255);return b}function p(h){var b="",f,d=h.length,a,n,q,g;for(f=0;f<d;f+=1)a=h[f],128>a?b+=String.fromCharCode(a):(f+=1,n=h[f],194<=a&&224>a?b+=String.fromCharCode((a&31)<<6|n&63):(f+=1,q=h[f],224<=a&&240>a?b+=String.fromCharCode((a&15)<<12|(n&63)<<6|q&63):(f+=1,g=h[f],240<=a&&245>a&&(a=(a&7)<<18|(n&63)<<12|(q&63)<<6|g&63,a-=65536,b+=String.fromCharCode((a>>10)+55296,(a&1023)+56320))))); -return b}var r;"utf8"===k?r=p(e):("binary"!==k&&this.log("Unsupported encoding: "+k),r=l(e));return r};Runtime.getVariable=function(e){try{return eval(e)}catch(k){}};Runtime.toJson=function(e){return JSON.stringify(e)};Runtime.fromJson=function(e){return JSON.parse(e)};Runtime.getFunctionName=function(e){return void 0===e.name?(e=/function\s+(\w+)/.exec(e))&&e[1]:e.name}; -function BrowserRuntime(e){function k(h,b){var f,d,a;void 0!==b?a=h:b=h;e?(d=e.ownerDocument,a&&(f=d.createElement("span"),f.className=a,f.appendChild(d.createTextNode(a)),e.appendChild(f),e.appendChild(d.createTextNode(" "))),f=d.createElement("span"),0<b.length&&"<"===b[0]?f.innerHTML=b:f.appendChild(d.createTextNode(b)),e.appendChild(f),e.appendChild(d.createElement("br"))):console&&console.log(b);"alert"===a&&alert(b)}var l=this,p={},r=window.ArrayBuffer&&window.Uint8Array;r&&(Uint8Array.prototype.slice= -function(h,b){void 0===b&&(void 0===h&&(h=0),b=this.length);var f=this.subarray(h,b),d,a;b-=h;d=new Uint8Array(new ArrayBuffer(b));for(a=0;a<b;a+=1)d[a]=f[a];return d});this.ByteArray=r?function(h){return new Uint8Array(new ArrayBuffer(h))}:function(h){var b=[];b.length=h;return b};this.concatByteArrays=r?function(h,b){var f,d=h.length,a=b.length,n=new this.ByteArray(d+a);for(f=0;f<d;f+=1)n[f]=h[f];for(f=0;f<a;f+=1)n[f+d]=b[f];return n}:function(h,b){return h.concat(b)};this.byteArrayFromArray=function(h){return h.slice()}; -this.byteArrayFromString=function(h,b){var f;if("utf8"===b){f=h.length;var d,a,n,q=0;for(a=0;a<f;a+=1)n=h.charCodeAt(a),q+=1+(128<n)+(2048<n);d=new l.ByteArray(q);for(a=q=0;a<f;a+=1)n=h.charCodeAt(a),128>n?(d[q]=n,q+=1):2048>n?(d[q]=192|n>>>6,d[q+1]=128|n&63,q+=2):(d[q]=224|n>>>12&15,d[q+1]=128|n>>>6&63,d[q+2]=128|n&63,q+=3)}else for("binary"!==b&&l.log("unknown encoding: "+b),f=h.length,d=new l.ByteArray(f),a=0;a<f;a+=1)d[a]=h.charCodeAt(a)&255;return f=d};this.byteArrayToString=Runtime.byteArrayToString; -this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=function(h,b,f){function d(){var q;4===a.readyState&&(0!==a.status||a.responseText?200===a.status||0===a.status?(q="binary"===b?null!==a.responseBody&&"undefined"!==String(typeof VBArray)?(new VBArray(a.responseBody)).toArray():l.byteArrayFromString(a.responseText,"binary"):a.responseText,p[h]=q,f(null,q)):f(a.responseText||a.statusText):f("File "+h+" is empty."))}if(p.hasOwnProperty(h))f(null, -p[h]);else{var a=new XMLHttpRequest;a.open("GET",h,!0);a.onreadystatechange=d;a.overrideMimeType&&("binary"!==b?a.overrideMimeType("text/plain; charset="+b):a.overrideMimeType("text/plain; charset=x-user-defined"));try{a.send(null)}catch(n){f(n.message)}}};this.read=function(h,b,f,d){function a(){var a;4===n.readyState&&(0!==n.status||n.responseText?200===n.status||0===n.status?(n.response?(a=n.response,a=new Uint8Array(a)):a=null!==n.responseBody&&"undefined"!==String(typeof VBArray)?(new VBArray(n.responseBody)).toArray(): -l.byteArrayFromString(n.responseText,"binary"),p[h]=a,d(null,a.slice(b,b+f))):d(n.responseText||n.statusText):d("File "+h+" is empty."))}if(p.hasOwnProperty(h))d(null,p[h].slice(b,b+f));else{var n=new XMLHttpRequest;n.open("GET",h,!0);n.onreadystatechange=a;n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined");n.responseType="arraybuffer";try{n.send(null)}catch(q){d(q.message)}}};this.readFileSync=function(h,b){var f=new XMLHttpRequest,d;f.open("GET",h,!1);f.overrideMimeType&& -("binary"!==b?f.overrideMimeType("text/plain; charset="+b):f.overrideMimeType("text/plain; charset=x-user-defined"));try{if(f.send(null),200===f.status||0===f.status)d=f.responseText}catch(a){}return d};this.writeFile=function(h,b,f){p[h]=b;var d=new XMLHttpRequest;d.open("PUT",h,!0);d.onreadystatechange=function(){4===d.readyState&&(0!==d.status||d.responseText?200<=d.status&&300>d.status||0===d.status?f(null):f("Status "+String(d.status)+": "+d.responseText||d.statusText):f("File "+h+" is empty."))}; -b=b.buffer&&!d.sendAsBinary?b.buffer:l.byteArrayToString(b,"binary");try{d.sendAsBinary?d.sendAsBinary(b):d.send(b)}catch(a){l.log("HUH? "+a+" "+b),f(a.message)}};this.deleteFile=function(h,b){delete p[h];var f=new XMLHttpRequest;f.open("DELETE",h,!0);f.onreadystatechange=function(){4===f.readyState&&(200>f.status&&300<=f.status?b(f.responseText):b(null))};f.send(null)};this.loadXML=function(h,b){var f=new XMLHttpRequest;f.open("GET",h,!0);f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange= -function(){4===f.readyState&&(0!==f.status||f.responseText?200===f.status||0===f.status?b(null,f.responseXML):b(f.responseText):b("File "+h+" is empty."))};try{f.send(null)}catch(d){b(d.message)}};this.isFile=function(h,b){l.getFileSize(h,function(f){b(-1!==f)})};this.getFileSize=function(h,b){var f=new XMLHttpRequest;f.open("HEAD",h,!0);f.onreadystatechange=function(){if(4===f.readyState){var d=f.getResponseHeader("Content-Length");d?b(parseInt(d,10)):b(-1)}};f.send(null)};this.log=k;this.assert= -function(h,b,f){if(!h)throw k("alert","ASSERTION FAILED:\n"+b),f&&f(),b;};this.setTimeout=function(h,b){setTimeout(function(){h()},b)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(h){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(h){return(new DOMParser).parseFromString(h,"text/xml")};this.exit=function(h){k("Calling exit with code "+String(h)+", but exit() is not implemented.")}; -this.getWindow=function(){return window};this.getNetwork=function(){var h=this.getVariable("now");return void 0===h?{networkStatus:"unavailable"}:h}} -function NodeJSRuntime(){function e(b,d,a){b=p.resolve(r,b);"binary"!==d?l.readFile(b,d,a):l.readFile(b,null,a)}var k=this,l=require("fs"),p=require("path"),r="",h,b;this.ByteArray=function(b){return new Buffer(b)};this.byteArrayFromArray=function(b){var d=new Buffer(b.length),a,n=b.length;for(a=0;a<n;a+=1)d[a]=b[a];return d};this.concatByteArrays=function(b,d){var a=new Buffer(b.length+d.length);b.copy(a,0,0);d.copy(a,b.length,0);return a};this.byteArrayFromString=function(b,d){return new Buffer(b, -d)};this.byteArrayToString=function(b,d){return b.toString(d)};this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=e;this.loadXML=function(b,d){e(b,"utf-8",function(a,b){if(a)return d(a);d(null,k.parseXML(b))})};this.writeFile=function(b,d,a){b=p.resolve(r,b);l.writeFile(b,d,"binary",function(b){a(b||null)})};this.deleteFile=function(b,d){b=p.resolve(r,b);l.unlink(b,d)};this.read=function(b,d,a,n){b=p.resolve(r,b);l.open(b,"r+",666,function(b, -g){if(b)n(b);else{var c=new Buffer(a);l.read(g,c,0,a,d,function(a,b){l.close(g);n(a,c)})}})};this.readFileSync=function(b,d){return d?"binary"===d?l.readFileSync(b,null):l.readFileSync(b,d):""};this.isFile=function(b,d){b=p.resolve(r,b);l.stat(b,function(a,b){d(!a&&b.isFile())})};this.getFileSize=function(b,d){b=p.resolve(r,b);l.stat(b,function(a,b){a?d(-1):d(b.size)})};this.log=function(b,d){var a;void 0!==d?a=b:d=b;"alert"===a&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(d+ -"\n");"alert"===a&&process.stderr.write("!!!!! ALERT !!!!!\n")};this.assert=function(b,d,a){b||(process.stderr.write("ASSERTION FAILED: "+d),a&&a())};this.setTimeout=function(b,d){setTimeout(function(){b()},d)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(b){r=b};this.currentDirectory=function(){return r};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return b};this.parseXML=function(b){return h.parseFromString(b,"text/xml")}; -this.exit=process.exit;this.getWindow=function(){return null};this.getNetwork=function(){return{networkStatus:"unavailable"}};h=new (require("xmldom").DOMParser);b=k.parseXML("<a/>").implementation} -function RhinoRuntime(){function e(b,f){var d;void 0!==f?d=b:f=b;"alert"===d&&print("\n!!!!! ALERT !!!!!");print(f);"alert"===d&&print("!!!!! ALERT !!!!!")}var k=this,l=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),p,r,h="";l.setValidating(!1);l.setNamespaceAware(!0);l.setExpandEntityReferences(!1);l.setSchema(null);r=Packages.org.xml.sax.EntityResolver({resolveEntity:function(b,f){var d=new Packages.java.io.FileReader(f);return new Packages.org.xml.sax.InputSource(d)}});p=l.newDocumentBuilder(); -p.setEntityResolver(r);this.ByteArray=function(b){return[b]};this.byteArrayFromArray=function(b){return b};this.byteArrayFromString=function(b,f){var d=[],a,n=b.length;for(a=0;a<n;a+=1)d[a]=b.charCodeAt(a)&255;return d};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.concatByteArrays=function(b,f){return b.concat(f)};this.loadXML=function(b,f){var d=new Packages.java.io.File(b),a;try{a=p.parse(d)}catch(n){print(n); -f(n);return}f(null,a)};this.readFile=function(b,f,d){h&&(b=h+"/"+b);var a=new Packages.java.io.File(b),n="binary"===f?"latin1":f;a.isFile()?(b=readFile(b,n),"binary"===f&&(b=k.byteArrayFromString(b,"binary")),d(null,b)):d(b+" is not a file.")};this.writeFile=function(b,f,d){h&&(b=h+"/"+b);b=new Packages.java.io.FileOutputStream(b);var a,n=f.length;for(a=0;a<n;a+=1)b.write(f[a]);b.close();d(null)};this.deleteFile=function(b,f){h&&(b=h+"/"+b);(new Packages.java.io.File(b))["delete"]()?f(null):f("Could not delete "+ -b)};this.read=function(b,f,d,a){h&&(b=h+"/"+b);var n;n=b;var q="binary";(new Packages.java.io.File(n)).isFile()?("binary"===q&&(q="latin1"),n=readFile(n,q)):n=null;n?a(null,this.byteArrayFromString(n.substring(f,f+d),"binary")):a("Cannot read "+b)};this.readFileSync=function(b,f){return f?readFile(b,f):""};this.isFile=function(b,f){h&&(b=h+"/"+b);var d=new Packages.java.io.File(b);f(d.isFile())};this.getFileSize=function(b,f){h&&(b=h+"/"+b);var d=new Packages.java.io.File(b);f(d.length())};this.log= -e;this.assert=function(b,f,d){b||(e("alert","ASSERTION FAILED: "+f),d&&d())};this.setTimeout=function(b,f){b()};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(b){h=b};this.currentDirectory=function(){return h};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return p.getDOMImplementation()};this.parseXML=function(b){return p.parse(b)};this.exit=quit;this.getWindow=function(){return null};this.getNetwork=function(){return{networkStatus:"unavailable"}}} -var runtime=function(){return"undefined"!==String(typeof window)?new BrowserRuntime(window.document.getElementById("logoutput")):"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime}(); -(function(){function e(e){var k=e[0],h;h=eval("if (typeof "+k+" === 'undefined') {eval('"+k+" = {};');}"+k);for(k=1;k<e.length-1;k+=1)h=h.hasOwnProperty(e[k])?h[e[k]]:h[e[k]]={};return h[e[e.length-1]]}var k={},l={};runtime.loadClass=function(p){function r(b){b=b.replace(/\./g,"/")+".js";var a=runtime.libraryPaths(),n,q,g;runtime.currentDirectory&&a.push(runtime.currentDirectory());for(n=0;n<a.length;n+=1){q=a[n];if(!l.hasOwnProperty(q))try{g=runtime.readFileSync(a[n]+"/manifest.js","utf8"),l[q]= -g&&g.length?eval(g):null}catch(c){l[q]=null,runtime.log("Cannot load manifest for "+q+".")}g=null;if((q=l[q])&&q.indexOf&&-1!==q.indexOf(b))return a[n]+"/"+b}return null}function h(b){var a,n;n=r(b);if(!n)throw b+" is not listed in any manifest.js.";try{a=runtime.readFileSync(n,"utf8")}catch(q){throw runtime.log("Error loading "+b+" "+q),q;}if(void 0===a)throw"Cannot load class "+b;a=a+("\n//# sourceURL="+n)+("\n//@ sourceURL="+n);try{a=eval(b+" = eval(code);")}catch(g){throw runtime.log("Error loading "+ -b+" "+g),g;}return a}if(!IS_COMPILED_CODE&&!k.hasOwnProperty(p)){var b=p.split("."),f;f=e(b);if(!f&&(f=h(p),!f||Runtime.getFunctionName(f)!==b[b.length-1]))throw runtime.log("Loaded code is not for "+b[b.length-1]),"Loaded code is not for "+b[b.length-1];k[p]=!0}}})(); -(function(e){function k(e){if(e.length){var k=e[0];runtime.readFile(k,"utf8",function(r,h){function b(){var a;(a=eval(d))&&runtime.exit(a)}var f="";runtime.libraryPaths();var d=h;-1!==k.indexOf("/")&&(f=k.substring(0,k.indexOf("/")));runtime.setCurrentDirectory(f);r||null===d?(runtime.log(r),runtime.exit(1)):b.apply(null,e)})}}e=e?Array.prototype.slice.call(e):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(e):k(e.slice(1))})("undefined"!==String(typeof arguments)&& -arguments); -// Input 2 -core.Base64=function(){function e(a){var c=[],b,m=a.length;for(b=0;b<m;b+=1)c[b]=a.charCodeAt(b)&255;return c}function k(a){var c,b="",m,g=a.length-2;for(m=0;m<g;m+=3)c=a[m]<<16|a[m+1]<<8|a[m+2],b+=u[c>>>18],b+=u[c>>>12&63],b+=u[c>>>6&63],b+=u[c&63];m===g+1?(c=a[m]<<4,b+=u[c>>>6],b+=u[c&63],b+="=="):m===g&&(c=a[m]<<10|a[m+1]<<2,b+=u[c>>>12],b+=u[c>>>6&63],b+=u[c&63],b+="=");return b}function l(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,"");var b=[],c=a.length%4,m,g=a.length,q;for(m=0;m<g;m+=4)q=(t[a.charAt(m)]|| -0)<<18|(t[a.charAt(m+1)]||0)<<12|(t[a.charAt(m+2)]||0)<<6|(t[a.charAt(m+3)]||0),b.push(q>>16,q>>8&255,q&255);b.length-=[0,0,2,1][c];return b}function p(a){var b=[],c,m=a.length,g;for(c=0;c<m;c+=1)g=a[c],128>g?b.push(g):2048>g?b.push(192|g>>>6,128|g&63):b.push(224|g>>>12&15,128|g>>>6&63,128|g&63);return b}function r(a){var b=[],c,m=a.length,g,q,s;for(c=0;c<m;c+=1)g=a[c],128>g?b.push(g):(c+=1,q=a[c],224>g?b.push((g&31)<<6|q&63):(c+=1,s=a[c],b.push((g&15)<<12|(q&63)<<6|s&63)));return b}function h(a){return k(e(a))} -function b(a){return String.fromCharCode.apply(String,l(a))}function f(a){return r(e(a))}function d(a){a=r(a);for(var c="",b=0;b<a.length;)c+=String.fromCharCode.apply(String,a.slice(b,b+45E3)),b+=45E3;return c}function a(a,b,c){var m="",g,q,s;for(s=b;s<c;s+=1)b=a.charCodeAt(s)&255,128>b?m+=String.fromCharCode(b):(s+=1,g=a.charCodeAt(s)&255,224>b?m+=String.fromCharCode((b&31)<<6|g&63):(s+=1,q=a.charCodeAt(s)&255,m+=String.fromCharCode((b&15)<<12|(g&63)<<6|q&63)));return m}function n(b,c){function m(){var d= -s+g;d>b.length&&(d=b.length);q+=a(b,s,d);s=d;d=s===b.length;c(q,d)&&!d&&runtime.setTimeout(m,0)}var g=1E5,q="",s=0;b.length<g?c(a(b,0,b.length),!0):("string"!==typeof b&&(b=b.slice()),m())}function q(a){return p(e(a))}function g(a){return String.fromCharCode.apply(String,p(a))}function c(a){return String.fromCharCode.apply(String,p(e(a)))}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(){var a=[],b;for(b=0;26>b;b+=1)a.push(65+b);for(b=0;26>b;b+=1)a.push(97+b);for(b= -0;10>b;b+=1)a.push(48+b);a.push(43);a.push(47);return a})();var t=function(a){var b={},c,m;c=0;for(m=a.length;c<m;c+=1)b[a.charAt(c)]=c;return b}(u),s,m,A=runtime.getWindow(),x,v;A&&A.btoa?(x=function(a){return A.btoa(a)},s=function(a){return x(c(a))}):(x=h,s=function(a){return k(q(a))});A&&A.atob?(v=function(a){return A.atob(a)},m=function(b){b=v(b);return a(b,0,b.length)}):(v=b,m=function(a){return d(l(a))});return function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=k;this.convertBase64ToByteArray= -this.convertBase64ToUTF8Array=l;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=p;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=r;this.convertUTF8StringToBase64=h;this.convertBase64ToUTF8String=b;this.convertUTF8StringToUTF16Array=f;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=d;this.convertUTF8StringToUTF16String=n;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=q;this.convertUTF16ArrayToUTF8String=g;this.convertUTF16StringToUTF8String= -c;this.convertUTF16StringToBase64=s;this.convertBase64ToUTF16String=m;this.fromBase64=b;this.toBase64=h;this.atob=v;this.btoa=x;this.utob=c;this.btou=n;this.encode=s;this.encodeURI=function(a){return s(a).replace(/[+\/]/g,function(a){return"+"===a?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return m(a.replace(/[\-_]/g,function(a){return"-"===a?"+":"/"}))}}}(); -// Input 3 -core.RawDeflate=function(){function e(){this.dl=this.fc=0}function k(){this.extra_bits=this.static_tree=this.dyn_tree=null;this.max_code=this.max_length=this.elems=this.extra_base=0}function l(a,b,c,m){this.good_length=a;this.max_lazy=b;this.nice_length=c;this.max_chain=m}function p(){this.next=null;this.len=0;this.ptr=[];this.ptr.length=r;this.off=0}var r=8192,h,b,f,d,a=null,n,q,g,c,u,t,s,m,A,x,v,w,P,B,E,O,y,J,C,D,G,X,Q,F,K,H,U,Z,W,L,I,M,S,T,R,N,V,z,ca,$,Y,da,aa,la,sa,ga,ia,ea,ha,ma,ta,ua=[0,0,0, -0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ja=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ka=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ya=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],na;na=[new l(0,0,0,0),new l(4,4,8,4),new l(4,5,16,8),new l(4,6,32,32),new l(4,4,16,16),new l(8,16,32,32),new l(8,16,128,128),new l(8,32,128,256),new l(32,128,258,1024),new l(32,258,258,4096)];var oa=function(c){a[q+n++]=c;if(q+n===r){var m;if(0!==n){null!==h?(c=h,h=h.next):c=new p; -c.next=null;c.len=c.off=0;null===b?b=f=c:f=f.next=c;c.len=n-q;for(m=0;m<c.len;m++)c.ptr[m]=a[q+m];n=q=0}}},pa=function(b){b&=65535;q+n<r-2?(a[q+n++]=b&255,a[q+n++]=b>>>8):(oa(b&255),oa(b>>>8))},qa=function(){v=(v<<5^c[y+3-1]&255)&8191;w=s[32768+v];s[y&32767]=w;s[32768+v]=y},ba=function(a,b){A>16-b?(m|=a<<A,pa(m),m=a>>16-A,A+=b-16):(m|=a<<A,A+=b)},fa=function(a,b){ba(b[a].fc,b[a].dl)},za=function(a,b,c){return a[b].fc<a[c].fc||a[b].fc===a[c].fc&&V[b]<=V[c]},Aa=function(a,b,c){var m;for(m=0;m<c&&ta< -ma.length;m++)a[b+m]=ma.charCodeAt(ta++)&255;return m},va=function(){var a,b,m=65536-D-y;if(-1===m)m--;else if(65274<=y){for(a=0;32768>a;a++)c[a]=c[a+32768];J-=32768;y-=32768;x-=32768;for(a=0;8192>a;a++)b=s[32768+a],s[32768+a]=32768<=b?b-32768:0;for(a=0;32768>a;a++)b=s[a],s[a]=32768<=b?b-32768:0;m+=32768}C||(a=Aa(c,y+D,m),0>=a?C=!0:D+=a)},Ba=function(a){var b=G,m=y,g,q=O,d=32506<y?y-32506:0,t=y+258,n=c[m+q-1],e=c[m+q];O>=F&&(b>>=2);do if(g=a,c[g+q]===e&&c[g+q-1]===n&&c[g]===c[m]&&c[++g]===c[m+1]){m+= -2;g++;do++m;while(c[m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&m<t);g=258-(t-m);m=t-258;if(g>q){J=a;q=g;if(258<=g)break;n=c[m+q-1];e=c[m+q]}}while((a=s[a&32767])>d&&0!==--b);return q},ka=function(a,b){t[aa++]=b;0===a?K[b].fc++:(a--,K[z[b]+256+1].fc++,H[(256>a?ca[a]:ca[256+(a>>7)])&255].fc++,u[la++]=a,ga|=ia);ia<<=1;0===(aa&7)&&(da[sa++]=ga,ga=0,ia=1);if(2<Q&&0===(aa&4095)){var c=8*aa,m=y-x,g;for(g=0;30>g;g++)c+= -H[g].fc*(5+ja[g]);c>>=3;if(la<parseInt(aa/2,10)&&c<parseInt(m/2,10))return!0}return 8191===aa||8192===la},wa=function(a,b){for(var c=T[b],m=b<<1;m<=R;){m<R&&za(a,T[m+1],T[m])&&m++;if(za(a,c,T[m]))break;T[b]=T[m];b=m;m<<=1}T[b]=c},Ca=function(a,b){var c=0;do c|=a&1,a>>=1,c<<=1;while(0<--b);return c>>1},Da=function(a,b){var c=[];c.length=16;var m=0,g;for(g=1;15>=g;g++)m=m+S[g-1]<<1,c[g]=m;for(m=0;m<=b;m++)g=a[m].dl,0!==g&&(a[m].fc=Ca(c[g]++,g))},xa=function(a){var b=a.dyn_tree,c=a.static_tree,m=a.elems, -g,q=-1,s=m;R=0;N=573;for(g=0;g<m;g++)0!==b[g].fc?(T[++R]=q=g,V[g]=0):b[g].dl=0;for(;2>R;)g=T[++R]=2>q?++q:0,b[g].fc=1,V[g]=0,ea--,null!==c&&(ha-=c[g].dl);a.max_code=q;for(g=R>>1;1<=g;g--)wa(b,g);do g=T[1],T[1]=T[R--],wa(b,1),c=T[1],T[--N]=g,T[--N]=c,b[s].fc=b[g].fc+b[c].fc,V[s]=V[g]>V[c]+1?V[g]:V[c]+1,b[g].dl=b[c].dl=s,T[1]=s++,wa(b,1);while(2<=R);T[--N]=T[1];s=a.dyn_tree;g=a.extra_bits;var m=a.extra_base,c=a.max_code,d=a.max_length,t=a.static_tree,n,e,f,u,h=0;for(e=0;15>=e;e++)S[e]=0;s[T[N]].dl= -0;for(a=N+1;573>a;a++)n=T[a],e=s[s[n].dl].dl+1,e>d&&(e=d,h++),s[n].dl=e,n>c||(S[e]++,f=0,n>=m&&(f=g[n-m]),u=s[n].fc,ea+=u*(e+f),null!==t&&(ha+=u*(t[n].dl+f)));if(0!==h){do{for(e=d-1;0===S[e];)e--;S[e]--;S[e+1]+=2;S[d]--;h-=2}while(0<h);for(e=d;0!==e;e--)for(n=S[e];0!==n;)g=T[--a],g>c||(s[g].dl!==e&&(ea+=(e-s[g].dl)*s[g].fc,s[g].fc=e),n--)}Da(b,q)},Ea=function(a,b){var c,m=-1,g,q=a[0].dl,s=0,d=7,n=4;0===q&&(d=138,n=3);a[b+1].dl=65535;for(c=0;c<=b;c++)g=q,q=a[c+1].dl,++s<d&&g===q||(s<n?W[g].fc+=s:0!== -g?(g!==m&&W[g].fc++,W[16].fc++):10>=s?W[17].fc++:W[18].fc++,s=0,m=g,0===q?(d=138,n=3):g===q?(d=6,n=3):(d=7,n=4))},Fa=function(){8<A?pa(m):0<A&&oa(m);A=m=0},Ga=function(a,b){var c,m=0,g=0,q=0,s=0,d,n;if(0!==aa){do 0===(m&7)&&(s=da[q++]),c=t[m++]&255,0===(s&1)?fa(c,a):(d=z[c],fa(d+256+1,a),n=ua[d],0!==n&&(c-=$[d],ba(c,n)),c=u[g++],d=(256>c?ca[c]:ca[256+(c>>7)])&255,fa(d,b),n=ja[d],0!==n&&(c-=Y[d],ba(c,n))),s>>=1;while(m<aa)}fa(256,a)},Ha=function(a,b){var c,m=-1,g,q=a[0].dl,s=0,d=7,n=4;0===q&&(d=138, -n=3);for(c=0;c<=b;c++)if(g=q,q=a[c+1].dl,!(++s<d&&g===q)){if(s<n){do fa(g,W);while(0!==--s)}else 0!==g?(g!==m&&(fa(g,W),s--),fa(16,W),ba(s-3,2)):10>=s?(fa(17,W),ba(s-3,3)):(fa(18,W),ba(s-11,7));s=0;m=g;0===q?(d=138,n=3):g===q?(d=6,n=3):(d=7,n=4)}},Ia=function(){var a;for(a=0;286>a;a++)K[a].fc=0;for(a=0;30>a;a++)H[a].fc=0;for(a=0;19>a;a++)W[a].fc=0;K[256].fc=1;ga=aa=la=sa=ea=ha=0;ia=1},ra=function(a){var b,m,g,q;q=y-x;da[sa]=ga;xa(L);xa(I);Ea(K,L.max_code);Ea(H,I.max_code);xa(M);for(g=18;3<=g&&0=== -W[ya[g]].dl;g--);ea+=3*(g+1)+14;b=ea+3+7>>3;m=ha+3+7>>3;m<=b&&(b=m);if(q+4<=b&&0<=x)for(ba(0+a,3),Fa(),pa(q),pa(~q),g=0;g<q;g++)oa(c[x+g]);else if(m===b)ba(2+a,3),Ga(U,Z);else{ba(4+a,3);q=L.max_code+1;b=I.max_code+1;g+=1;ba(q-257,5);ba(b-1,5);ba(g-4,4);for(m=0;m<g;m++)ba(W[ya[m]].dl,3);Ha(K,q-1);Ha(H,b-1);Ga(K,H)}Ia();0!==a&&Fa()},Ja=function(c,m,g){var s,d,t;for(s=0;null!==b&&s<g;){d=g-s;d>b.len&&(d=b.len);for(t=0;t<d;t++)c[m+s+t]=b.ptr[b.off+t];b.off+=d;b.len-=d;s+=d;0===b.len&&(d=b,b=b.next,d.next= -h,h=d)}if(s===g)return s;if(q<n){d=g-s;d>n-q&&(d=n-q);for(t=0;t<d;t++)c[m+s+t]=a[q+t];q+=d;s+=d;n===q&&(n=q=0)}return s},La=function(a,t,e){var f;if(!d){if(!C){A=m=0;var h,u;if(0===Z[0].dl){L.dyn_tree=K;L.static_tree=U;L.extra_bits=ua;L.extra_base=257;L.elems=286;L.max_length=15;L.max_code=0;I.dyn_tree=H;I.static_tree=Z;I.extra_bits=ja;I.extra_base=0;I.elems=30;I.max_length=15;I.max_code=0;M.dyn_tree=W;M.static_tree=null;M.extra_bits=Ka;M.extra_base=0;M.elems=19;M.max_length=7;for(u=h=M.max_code= -0;28>u;u++)for($[u]=h,f=0;f<1<<ua[u];f++)z[h++]=u;z[h-1]=u;for(u=h=0;16>u;u++)for(Y[u]=h,f=0;f<1<<ja[u];f++)ca[h++]=u;for(h>>=7;30>u;u++)for(Y[u]=h<<7,f=0;f<1<<ja[u]-7;f++)ca[256+h++]=u;for(f=0;15>=f;f++)S[f]=0;for(f=0;143>=f;)U[f++].dl=8,S[8]++;for(;255>=f;)U[f++].dl=9,S[9]++;for(;279>=f;)U[f++].dl=7,S[7]++;for(;287>=f;)U[f++].dl=8,S[8]++;Da(U,287);for(f=0;30>f;f++)Z[f].dl=5,Z[f].fc=Ca(f,5);Ia()}for(f=0;8192>f;f++)s[32768+f]=0;X=na[Q].max_lazy;F=na[Q].good_length;G=na[Q].max_chain;x=y=0;D=Aa(c,0, -65536);if(0>=D)C=!0,D=0;else{for(C=!1;262>D&&!C;)va();for(f=v=0;2>f;f++)v=(v<<5^c[f]&255)&8191}b=null;q=n=0;3>=Q?(O=2,E=0):(E=2,B=0);g=!1}d=!0;if(0===D)return g=!0,0}if((f=Ja(a,t,e))===e)return e;if(g)return f;if(3>=Q)for(;0!==D&&null===b;){qa();0!==w&&32506>=y-w&&(E=Ba(w),E>D&&(E=D));if(3<=E)if(u=ka(y-J,E-3),D-=E,E<=X){E--;do y++,qa();while(0!==--E);y++}else y+=E,E=0,v=c[y]&255,v=(v<<5^c[y+1]&255)&8191;else u=ka(0,c[y]&255),D--,y++;u&&(ra(0),x=y);for(;262>D&&!C;)va()}else for(;0!==D&&null===b;){qa(); -O=E;P=J;E=2;0!==w&&(O<X&&32506>=y-w)&&(E=Ba(w),E>D&&(E=D),3===E&&4096<y-J&&E--);if(3<=O&&E<=O){u=ka(y-1-P,O-3);D-=O-1;O-=2;do y++,qa();while(0!==--O);B=0;E=2;y++;u&&(ra(0),x=y)}else 0!==B?ka(0,c[y-1]&255)&&(ra(0),x=y):B=1,y++,D--;for(;262>D&&!C;)va()}0===D&&(0!==B&&ka(0,c[y-1]&255),ra(1),g=!0);return f+Ja(a,f+t,e-f)};this.deflate=function(m,g){var q,n;ma=m;ta=0;"undefined"===String(typeof g)&&(g=6);(q=g)?1>q?q=1:9<q&&(q=9):q=6;Q=q;C=d=!1;if(null===a){h=b=f=null;a=[];a.length=r;c=[];c.length=65536; -u=[];u.length=8192;t=[];t.length=32832;s=[];s.length=65536;K=[];K.length=573;for(q=0;573>q;q++)K[q]=new e;H=[];H.length=61;for(q=0;61>q;q++)H[q]=new e;U=[];U.length=288;for(q=0;288>q;q++)U[q]=new e;Z=[];Z.length=30;for(q=0;30>q;q++)Z[q]=new e;W=[];W.length=39;for(q=0;39>q;q++)W[q]=new e;L=new k;I=new k;M=new k;S=[];S.length=16;T=[];T.length=573;V=[];V.length=573;z=[];z.length=256;ca=[];ca.length=512;$=[];$.length=29;Y=[];Y.length=30;da=[];da.length=1024}for(var l=Array(1024),p=[];0<(q=La(l,0,l.length));){var G= -[];G.length=q;for(n=0;n<q;n++)G[n]=String.fromCharCode(l[n]);p[p.length]=G.join("")}ma=null;return p.join("")}}; -// Input 4 -core.ByteArray=function(e){this.pos=0;this.data=e;this.readUInt32LE=function(){var e=this.data,l=this.pos+=4;return e[--l]<<24|e[--l]<<16|e[--l]<<8|e[--l]};this.readUInt16LE=function(){var e=this.data,l=this.pos+=2;return e[--l]<<8|e[--l]}}; -// Input 5 -core.ByteArrayWriter=function(e){var k=this,l=new runtime.ByteArray(0);this.appendByteArrayWriter=function(e){l=runtime.concatByteArrays(l,e.getByteArray())};this.appendByteArray=function(e){l=runtime.concatByteArrays(l,e)};this.appendArray=function(e){l=runtime.concatByteArrays(l,runtime.byteArrayFromArray(e))};this.appendUInt16LE=function(e){k.appendArray([e&255,e>>8&255])};this.appendUInt32LE=function(e){k.appendArray([e&255,e>>8&255,e>>16&255,e>>24&255])};this.appendString=function(k){l=runtime.concatByteArrays(l, -runtime.byteArrayFromString(k,e))};this.getLength=function(){return l.length};this.getByteArray=function(){return l}}; -// Input 6 -core.RawInflate=function(){var e,k,l=null,p,r,h,b,f,d,a,n,q,g,c,u,t,s,m=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],A=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],v=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[16,17,18, -0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=function(){this.list=this.next=null},E=function(){this.n=this.b=this.e=0;this.t=null},O=function(a,b,c,m,g,q){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var s=Array(this.BMAX+1),d,n,t,e,f,u,h,k=Array(this.BMAX+1),l,p,r,G=new E,A=Array(this.BMAX);e=Array(this.N_MAX);var v,x=Array(this.BMAX+1),C,w,X;X=this.root=null;for(f=0;f<s.length;f++)s[f]=0;for(f=0;f<k.length;f++)k[f]=0;for(f=0;f<A.length;f++)A[f]=null;for(f=0;f<e.length;f++)e[f]= -0;for(f=0;f<x.length;f++)x[f]=0;d=256<b?a[256]:this.BMAX;l=a;p=0;f=b;do s[l[p]]++,p++;while(0<--f);if(s[0]==b)this.root=null,this.status=this.m=0;else{for(u=1;u<=this.BMAX&&0==s[u];u++);h=u;q<u&&(q=u);for(f=this.BMAX;0!=f&&0==s[f];f--);t=f;q>f&&(q=f);for(C=1<<u;u<f;u++,C<<=1)if(0>(C-=s[u])){this.status=2;this.m=q;return}if(0>(C-=s[f]))this.status=2,this.m=q;else{s[f]+=C;x[1]=u=0;l=s;p=1;for(r=2;0<--f;)x[r++]=u+=l[p++];l=a;f=p=0;do 0!=(u=l[p++])&&(e[x[u]++]=f);while(++f<b);b=x[t];x[0]=f=0;l=e;p=0; -e=-1;v=k[0]=0;r=null;for(w=0;h<=t;h++)for(a=s[h];0<a--;){for(;h>v+k[1+e];){v+=k[1+e];e++;w=(w=t-v)>q?q:w;if((n=1<<(u=h-v))>a+1)for(n-=a+1,r=h;++u<w&&!((n<<=1)<=s[++r]);)n-=s[r];v+u>d&&v<d&&(u=d-v);w=1<<u;k[1+e]=u;r=Array(w);for(n=0;n<w;n++)r[n]=new E;X=null==X?this.root=new B:X.next=new B;X.next=null;X.list=r;A[e]=r;0<e&&(x[e]=f,G.b=k[e],G.e=16+u,G.t=r,u=(f&(1<<v)-1)>>v-k[e],A[e-1][u].e=G.e,A[e-1][u].b=G.b,A[e-1][u].n=G.n,A[e-1][u].t=G.t)}G.b=h-v;p>=b?G.e=99:l[p]<c?(G.e=256>l[p]?16:15,G.n=l[p++]): -(G.e=g[l[p]-c],G.n=m[l[p++]-c]);n=1<<h-v;for(u=f>>v;u<w;u+=n)r[u].e=G.e,r[u].b=G.b,r[u].n=G.n,r[u].t=G.t;for(u=1<<h-1;0!=(f&u);u>>=1)f^=u;for(f^=u;(f&(1<<v)-1)!=x[e];)v-=k[e],e--}this.m=k[1];this.status=0!=C&&1!=t?1:0}}},y=function(a){for(;b<a;){var c=h,m;m=t.length==s?-1:t[s++];h=c|m<<b;b+=8}},J=function(a){return h&m[a]},C=function(a){h>>=a;b-=a},D=function(b,m,s){var d,t,h;if(0==s)return 0;for(h=0;;){y(c);t=q.list[J(c)];for(d=t.e;16<d;){if(99==d)return-1;C(t.b);d-=16;y(d);t=t.t[J(d)];d=t.e}C(t.b); -if(16==d)k&=32767,b[m+h++]=e[k++]=t.n;else{if(15==d)break;y(d);a=t.n+J(d);C(d);y(u);t=g.list[J(u)];for(d=t.e;16<d;){if(99==d)return-1;C(t.b);d-=16;y(d);t=t.t[J(d)];d=t.e}C(t.b);y(d);n=k-t.n-J(d);for(C(d);0<a&&h<s;)a--,n&=32767,k&=32767,b[m+h++]=e[k++]=e[n++]}if(h==s)return s}f=-1;return h},G,X=function(a,b,m){var s,d,n,t,f,e,h,k=Array(316);for(s=0;s<k.length;s++)k[s]=0;y(5);e=257+J(5);C(5);y(5);h=1+J(5);C(5);y(4);s=4+J(4);C(4);if(286<e||30<h)return-1;for(d=0;d<s;d++)y(3),k[P[d]]=J(3),C(3);for(;19> -d;d++)k[P[d]]=0;c=7;d=new O(k,19,19,null,null,c);if(0!=d.status)return-1;q=d.root;c=d.m;t=e+h;for(s=n=0;s<t;)if(y(c),f=q.list[J(c)],d=f.b,C(d),d=f.n,16>d)k[s++]=n=d;else if(16==d){y(2);d=3+J(2);C(2);if(s+d>t)return-1;for(;0<d--;)k[s++]=n}else{17==d?(y(3),d=3+J(3),C(3)):(y(7),d=11+J(7),C(7));if(s+d>t)return-1;for(;0<d--;)k[s++]=0;n=0}c=9;d=new O(k,e,257,A,x,c);0==c&&(d.status=1);if(0!=d.status)return-1;q=d.root;c=d.m;for(s=0;s<h;s++)k[s]=k[s+e];u=6;d=new O(k,h,0,v,w,u);g=d.root;u=d.m;return 0==u&& -257<e||0!=d.status?-1:D(a,b,m)};this.inflate=function(m,F){null==e&&(e=Array(65536));b=h=k=0;f=-1;d=!1;a=n=0;q=null;t=m;s=0;var P=new runtime.ByteArray(F);a:{var H,B;for(H=0;H<F&&(!d||-1!=f);){if(0<a){if(0!=f)for(;0<a&&H<F;)a--,n&=32767,k&=32767,P[0+H++]=e[k++]=e[n++];else{for(;0<a&&H<F;)a--,k&=32767,y(8),P[0+H++]=e[k++]=J(8),C(8);0==a&&(f=-1)}if(H==F)break}if(-1==f){if(d)break;y(1);0!=J(1)&&(d=!0);C(1);y(2);f=J(2);C(2);q=null;a=0}switch(f){case 0:B=P;var E=0+H,W=F-H,L=void 0,L=b&7;C(L);y(16);L=J(16); -C(16);y(16);if(L!=(~h&65535))B=-1;else{C(16);a=L;for(L=0;0<a&&L<W;)a--,k&=32767,y(8),B[E+L++]=e[k++]=J(8),C(8);0==a&&(f=-1);B=L}break;case 1:if(null!=q)B=D(P,0+H,F-H);else b:{B=P;E=0+H;W=F-H;if(null==l){for(var I=void 0,L=Array(288),I=void 0,I=0;144>I;I++)L[I]=8;for(;256>I;I++)L[I]=9;for(;280>I;I++)L[I]=7;for(;288>I;I++)L[I]=8;r=7;I=new O(L,288,257,A,x,r);if(0!=I.status){alert("HufBuild error: "+I.status);B=-1;break b}l=I.root;r=I.m;for(I=0;30>I;I++)L[I]=5;G=5;I=new O(L,30,0,v,w,G);if(1<I.status){l= -null;alert("HufBuild error: "+I.status);B=-1;break b}p=I.root;G=I.m}q=l;g=p;c=r;u=G;B=D(B,E,W)}break;case 2:B=null!=q?D(P,0+H,F-H):X(P,0+H,F-H);break;default:B=-1}if(-1==B)break a;H+=B}}t=null;return P}}; -// Input 7 -/* - - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -core.LoopWatchDog=function(e,k){var l=Date.now(),p=0;this.check=function(){var r;if(e&&(r=Date.now(),r-l>e))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(p+=1,p>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; -// Input 8 -core.Cursor=function(e,k){function l(b){b.parentNode&&(a.push({prev:b.previousSibling,next:b.nextSibling}),b.parentNode.removeChild(b))}function p(a,b){a.nodeType===Node.TEXT_NODE&&(0===a.length?a.parentNode.removeChild(a):b.nodeType===Node.TEXT_NODE&&(b.insertData(0,a.data),a.parentNode.removeChild(a)))}function r(){a.forEach(function(a){a.prev&&a.prev.nextSibling&&p(a.prev,a.prev.nextSibling);a.next&&a.next.previousSibling&&p(a.next.previousSibling,a.next)});a.length=0}function h(b,c,q){if(c.nodeType=== -Node.TEXT_NODE){runtime.assert(Boolean(c),"putCursorIntoTextNode: invalid container");var d=c.parentNode;runtime.assert(Boolean(d),"putCursorIntoTextNode: container without parent");runtime.assert(0<=q&&q<=c.length,"putCursorIntoTextNode: offset is out of bounds");0===q?d.insertBefore(b,c):(q!==c.length&&c.splitText(q),d.insertBefore(b,c.nextSibling))}else if(c.nodeType===Node.ELEMENT_NODE){runtime.assert(Boolean(c),"putCursorIntoContainer: invalid container");for(d=c.firstChild;null!==d&&0<q;)d= -d.nextSibling,q-=1;c.insertBefore(b,d)}a.push({prev:b.previousSibling,next:b.nextSibling})}var b=e.createElementNS("urn:webodf:names:cursor","cursor"),f=e.createElementNS("urn:webodf:names:cursor","anchor"),d,a=[],n,q;this.getNode=function(){return b};this.getAnchorNode=function(){return f.parentNode?f:b};this.getSelectedRange=function(){q?(n.setStartBefore(b),n.collapse(!0)):(n.setStartAfter(d?f:b),n.setEndBefore(d?b:f));return n};this.setSelectedRange=function(a,c){n&&n!==a&&n.detach();n=a;d=!1!== -c;(q=a.collapsed)?(l(f),l(b),h(b,a.startContainer,a.startOffset)):(l(f),l(b),h(d?b:f,a.endContainer,a.endOffset),h(d?f:b,a.startContainer,a.startOffset));r()};this.remove=function(){l(b);r()};b.setAttributeNS("urn:webodf:names:cursor","memberId",k);f.setAttributeNS("urn:webodf:names:cursor","memberId",k)}; -// Input 9 -/* - - Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -core.EventNotifier=function(e){var k={};this.emit=function(e,p){var r,h;runtime.assert(k.hasOwnProperty(e),'unknown event fired "'+e+'"');h=k[e];for(r=0;r<h.length;r+=1)h[r](p)};this.subscribe=function(e,p){runtime.assert(k.hasOwnProperty(e),'tried to subscribe to unknown event "'+e+'"');k[e].push(p);runtime.log('event "'+e+'" subscribed.')};this.unsubscribe=function(e,p){var r;runtime.assert(k.hasOwnProperty(e),'tried to unsubscribe from unknown event "'+e+'"');r=k[e].indexOf(p);runtime.assert(-1!== -r,'tried to unsubscribe unknown callback from event "'+e+'"');-1!==r&&k[e].splice(r,1);runtime.log('event "'+e+'" unsubscribed.')};(function(){var l;for(l=0;l<e.length;l+=1)k[e[l]]=[]})()}; -// Input 10 -core.UnitTest=function(){};core.UnitTest.prototype.setUp=function(){};core.UnitTest.prototype.tearDown=function(){};core.UnitTest.prototype.description=function(){};core.UnitTest.prototype.tests=function(){};core.UnitTest.prototype.asyncTests=function(){}; -core.UnitTest.provideTestAreaDiv=function(){var e=runtime.getWindow().document,k=e.getElementById("testarea");runtime.assert(!k,'Unclean test environment, found a div with id "testarea".');k=e.createElement("div");k.setAttribute("id","testarea");e.body.appendChild(k);return k}; -core.UnitTest.cleanupTestAreaDiv=function(){var e=runtime.getWindow().document,k=e.getElementById("testarea");runtime.assert(!!k&&k.parentNode===e.body,'Test environment broken, found no div with id "testarea" below body.');e.body.removeChild(k)}; -core.UnitTestRunner=function(){function e(d){b+=1;runtime.log("fail",d)}function k(b,a){var n;try{if(b.length!==a.length)return e("array of length "+b.length+" should be "+a.length+" long"),!1;for(n=0;n<b.length;n+=1)if(b[n]!==a[n])return e(b[n]+" should be "+a[n]+" at array index "+n),!1}catch(q){return!1}return!0}function l(b,a,n){var q=b.attributes,g=q.length,c,f,t;for(c=0;c<g;c+=1)if(f=q.item(c),"xmlns"!==f.prefix){t=a.getAttributeNS(f.namespaceURI,f.localName);if(!a.hasAttributeNS(f.namespaceURI, -f.localName))return e("Attribute "+f.localName+" with value "+f.value+" was not present"),!1;if(t!==f.value)return e("Attribute "+f.localName+" was "+t+" should be "+f.value),!1}return n?!0:l(a,b,!0)}function p(b,a){if(b.nodeType!==a.nodeType)return e(b.nodeType+" should be "+a.nodeType),!1;if(b.nodeType===Node.TEXT_NODE)return b.data===a.data;runtime.assert(b.nodeType===Node.ELEMENT_NODE,"Only textnodes and elements supported.");if(b.namespaceURI!==a.namespaceURI||b.localName!==a.localName)return e(b.namespaceURI+ -" should be "+a.namespaceURI),!1;if(!l(b,a,!1))return!1;for(var n=b.firstChild,q=a.firstChild;n;){if(!q||!p(n,q))return!1;n=n.nextSibling;q=q.nextSibling}return q?!1:!0}function r(b,a){return 0===a?b===a&&1/b===1/a:b===a?!0:"number"===typeof a&&isNaN(a)?"number"===typeof b&&isNaN(b):Object.prototype.toString.call(a)===Object.prototype.toString.call([])?k(b,a):"object"===typeof a&&"object"===typeof b?a.constructor===Element||a.constructor===Node?p(a,b):f(a,b):!1}function h(b,a,n){"string"===typeof a&& -"string"===typeof n||runtime.log("WARN: shouldBe() expects string arguments");var q,g;try{g=eval(a)}catch(c){q=c}b=eval(n);q?e(a+" should be "+b+". Threw exception "+q):r(g,b)?runtime.log("pass",a+" is "+n):String(typeof g)===String(typeof b)?(n=0===g&&0>1/g?"-0":String(g),e(a+" should be "+b+". Was "+n+".")):e(a+" should be "+b+" (of type "+typeof b+"). Was "+g+" (of type "+typeof g+").")}var b=0,f;f=function(b,a){var n=Object.keys(b),q=Object.keys(a);n.sort();q.sort();return k(n,q)&&Object.keys(b).every(function(g){var c= -b[g],q=a[g];return r(c,q)?!0:(e(c+" should be "+q+" for key "+g),!1)})};this.areNodesEqual=p;this.shouldBeNull=function(b,a){h(b,a,"null")};this.shouldBeNonNull=function(b,a){var n,q;try{q=eval(a)}catch(g){n=g}n?e(a+" should be non-null. Threw exception "+n):null!==q?runtime.log("pass",a+" is non-null."):e(a+" should be non-null. Was "+q)};this.shouldBe=h;this.countFailedTests=function(){return b}}; -core.UnitTester=function(){function e(e,k){return"<span style='color:blue;cursor:pointer' onclick='"+k+"'>"+e+"</span>"}var k=0,l={};this.runTests=function(p,r,h){function b(c){if(0===c.length)l[f]=n,k+=d.countFailedTests(),r();else{g=c[0];var m=Runtime.getFunctionName(g);runtime.log("Running "+m);u=d.countFailedTests();a.setUp();g(function(){a.tearDown();n[m]=u===d.countFailedTests();b(c.slice(1))})}}var f=Runtime.getFunctionName(p),d=new core.UnitTestRunner,a=new p(d),n={},q,g,c,u,t="BrowserRuntime"=== -runtime.type();if(l.hasOwnProperty(f))runtime.log("Test "+f+" has already run.");else{t?runtime.log("<span>Running "+e(f,'runSuite("'+f+'");')+": "+a.description()+"</span>"):runtime.log("Running "+f+": "+a.description);c=a.tests();for(q=0;q<c.length;q+=1)g=c[q],p=Runtime.getFunctionName(g)||g.testName,h.length&&-1===h.indexOf(p)||(t?runtime.log("<span>Running "+e(p,'runTest("'+f+'","'+p+'")')+"</span>"):runtime.log("Running "+p),u=d.countFailedTests(),a.setUp(),g(),a.tearDown(),n[p]=u===d.countFailedTests()); -b(a.asyncTests())}};this.countFailedTests=function(){return k};this.results=function(){return l}}; -// Input 11 -core.PositionIterator=function(e,k,l,p){function r(){this.acceptNode=function(a){return a.nodeType===Node.TEXT_NODE&&0===a.length?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function h(a){this.acceptNode=function(b){return b.nodeType===Node.TEXT_NODE&&0===b.length?NodeFilter.FILTER_REJECT:a.acceptNode(b)}}function b(){var b=d.currentNode.nodeType;a=b===Node.TEXT_NODE?d.currentNode.length-1:b===Node.ELEMENT_NODE?1:0}var f=this,d,a,n;this.nextPosition=function(){if(d.currentNode===e)return!1; -0===a&&d.currentNode.nodeType===Node.ELEMENT_NODE?null===d.firstChild()&&(a=1):d.currentNode.nodeType===Node.TEXT_NODE&&a+1<d.currentNode.length?a+=1:null!==d.nextSibling()?a=0:(d.parentNode(),a=1);return!0};this.previousPosition=function(){var q=!0;if(0===a)if(null===d.previousSibling()){d.parentNode();if(d.currentNode===e)return d.firstChild(),!1;a=0}else b();else d.currentNode.nodeType===Node.TEXT_NODE?a-=1:null!==d.lastChild()?b():d.currentNode===e?q=!1:a=0;return q};this.container=function(){var b= -d.currentNode,g=b.nodeType;return 0===a&&g!==Node.TEXT_NODE?b.parentNode:b};this.rightNode=function(){var b=d.currentNode,g=b.nodeType;if(g===Node.TEXT_NODE&&a===b.length)for(b=b.nextSibling;b&&1!==n(b);)b=b.nextSibling;else g===Node.ELEMENT_NODE&&1===a&&(b=null);return b};this.leftNode=function(){var b=d.currentNode;if(0===a)for(b=b.previousSibling;b&&1!==n(b);)b=b.previousSibling;else if(b.nodeType===Node.ELEMENT_NODE)for(b=b.lastChild;b&&1!==n(b);)b=b.previousSibling;return b};this.getCurrentNode= -function(){return d.currentNode};this.domOffset=function(){if(d.currentNode.nodeType===Node.TEXT_NODE)return a;var b=0,g=d.currentNode,c;for(c=1===a?d.lastChild():d.previousSibling();c;)b+=1,c=d.previousSibling();d.currentNode=g;return b};this.unfilteredDomOffset=function(){if(d.currentNode.nodeType===Node.TEXT_NODE)return a;for(var b=0,g=d.currentNode,g=1===a?g.lastChild:g.previousSibling;g;)b+=1,g=g.previousSibling;return b};this.textOffset=function(){if(d.currentNode.nodeType!==Node.TEXT_NODE)return 0; -for(var b=a,g=d.currentNode;d.previousSibling()&&d.currentNode.nodeType===Node.TEXT_NODE;)b+=d.currentNode.length;d.currentNode=g;return b};this.getPreviousSibling=function(){var a=d.currentNode,b=d.previousSibling();d.currentNode=a;return b};this.getNextSibling=function(){var a=d.currentNode,b=d.nextSibling();d.currentNode=a;return b};this.text=function(){var a,b="",c=f.textNeighborhood();for(a=0;a<c.length;a+=1)b+=c[a].data;return b};this.textNeighborhood=function(){var a=d.currentNode,b=[];if(a.nodeType!== -Node.TEXT_NODE)return b;for(;d.previousSibling();)if(d.currentNode.nodeType!==Node.TEXT_NODE){d.nextSibling();break}do b.push(d.currentNode);while(d.nextSibling()&&d.currentNode.nodeType===Node.TEXT_NODE);d.currentNode=a;return b};this.substr=function(a,b){return f.text().substr(a,b)};this.setUnfilteredPosition=function(b,g){var c;runtime.assert(null!==b&&void 0!==b,"PositionIterator.setUnfilteredPosition called without container");d.currentNode=b;if(b.nodeType===Node.TEXT_NODE)return a=g,runtime.assert(g<= -b.length,"Error in setPosition: "+g+" > "+b.length),runtime.assert(0<=g,"Error in setPosition: "+g+" < 0"),g===b.length&&(a=void 0,d.nextSibling()?a=0:d.parentNode()&&(a=1),runtime.assert(void 0!==a,"Error in setPosition: position not valid.")),!0;c=n(b);g<b.childNodes.length&&c!==NodeFilter.FILTER_REJECT?(d.currentNode=b.childNodes[g],c=n(d.currentNode),a=0):a=0===g?0:1;c===NodeFilter.FILTER_REJECT&&(a=1);if(c!==NodeFilter.FILTER_ACCEPT)return f.nextPosition();runtime.assert(n(d.currentNode)===NodeFilter.FILTER_ACCEPT, -"PositionIterater.setUnfilteredPosition call resulted in an non-visible node being set");return!0};this.moveToEnd=function(){d.currentNode=e;a=1};this.moveToEndOfNode=function(b){b.nodeType===Node.TEXT_NODE?f.setUnfilteredPosition(b,b.length):(d.currentNode=b,a=1)};this.getNodeFilter=function(){return n};n=(l?new h(l):new r).acceptNode;n.acceptNode=n;d=e.ownerDocument.createTreeWalker(e,k||4294967295,n,p);a=0;null===d.firstChild()&&(a=1)}; -// Input 12 -runtime.loadClass("core.PositionIterator");core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(e){};(function(){return core.PositionFilter})(); -// Input 13 -core.Async=function(){this.forEach=function(e,k,l){function p(f){b!==h&&(f?(b=h,l(f)):(b+=1,b===h&&l(null)))}var r,h=e.length,b=0;for(r=0;r<h;r+=1)k(e[r],p)}}; -// Input 14 -runtime.loadClass("core.RawInflate");runtime.loadClass("core.ByteArray");runtime.loadClass("core.ByteArrayWriter");runtime.loadClass("core.Base64"); -core.Zip=function(e,k){function l(a){var b=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728, -853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202, -4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804, -225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542, -2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035, -2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],c,m,g=a.length,s=0,s=0;c=-1;for(m=0;m<g;m+=1)s=(c^a[m])&255,s=b[s],c=c>>>8^s;return c^-1}function p(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function r(a){var b=a.getFullYear();return 1980>b?0:b-1980<< -25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function h(a,b){var c,m,g,d,q,n,f,e=this;this.load=function(b){if(void 0!==e.data)b(null,e.data);else{var c=q+34+m+g+256;c+f>u&&(c=u-f);runtime.read(a,f,c,function(c,m){if(c||null===m)b(c,m);else a:{var g=m,f=new core.ByteArray(g),t=f.readUInt32LE(),u;if(67324752!==t)b("File entry signature is wrong."+t.toString()+" "+g.length.toString(),null);else{f.pos+=22;t=f.readUInt16LE();u=f.readUInt16LE();f.pos+=t+u; -if(d){g=g.slice(f.pos,f.pos+q);if(q!==g.length){b("The amount of compressed bytes read was "+g.length.toString()+" instead of "+q.toString()+" for "+e.filename+" in "+a+".",null);break a}g=s(g,n)}else g=g.slice(f.pos,f.pos+n);n!==g.length?b("The amount of bytes read was "+g.length.toString()+" instead of "+n.toString()+" for "+e.filename+" in "+a+".",null):(e.data=g,b(null,g))}}})}};this.set=function(a,b,c,m){e.filename=a;e.data=b;e.compressed=c;e.date=m};this.error=null;b&&(c=b.readUInt32LE(),33639248!== -c?this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,d=b.readUInt16LE(),this.date=p(b.readUInt32LE()),b.readUInt32LE(),q=b.readUInt32LE(),n=b.readUInt32LE(),m=b.readUInt16LE(),g=b.readUInt16LE(),c=b.readUInt16LE(),b.pos+=8,f=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+m),"utf8"),b.pos+=m+g+c))}function b(a,b){if(22!==a.length)b("Central directory length should be 22.", -m);else{var g=new core.ByteArray(a),s;s=g.readUInt32LE();101010256!==s?b("Central directory signature is wrong: "+s.toString(),m):(s=g.readUInt16LE(),0!==s?b("Zip files with non-zero disk numbers are not supported.",m):(s=g.readUInt16LE(),0!==s?b("Zip files with non-zero disk numbers are not supported.",m):(s=g.readUInt16LE(),t=g.readUInt16LE(),s!==t?b("Number of entries is inconsistent.",m):(s=g.readUInt32LE(),g=g.readUInt16LE(),g=u-22-s,runtime.read(e,g,u-g,function(a,g){if(a||null===g)b(a,m);else a:{var s= -new core.ByteArray(g),d,f;c=[];for(d=0;d<t;d+=1){f=new h(e,s);if(f.error){b(f.error,m);break a}c[c.length]=f}b(null,m)}})))))}}function f(a,b){var m=null,g,s;for(s=0;s<c.length;s+=1)if(g=c[s],g.filename===a){m=g;break}m?m.data?b(null,m.data):m.load(b):b(a+" not found.",null)}function d(a){var b=new core.ByteArrayWriter("utf8"),c=0;b.appendArray([80,75,3,4,20,0,0,0,0,0]);a.data&&(c=a.data.length);b.appendUInt32LE(r(a.date));b.appendUInt32LE(l(a.data));b.appendUInt32LE(c);b.appendUInt32LE(c);b.appendUInt16LE(a.filename.length); -b.appendUInt16LE(0);b.appendString(a.filename);a.data&&b.appendByteArray(a.data);return b}function a(a,b){var c=new core.ByteArrayWriter("utf8"),m=0;c.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);a.data&&(m=a.data.length);c.appendUInt32LE(r(a.date));c.appendUInt32LE(l(a.data));c.appendUInt32LE(m);c.appendUInt32LE(m);c.appendUInt16LE(a.filename.length);c.appendArray([0,0,0,0,0,0,0,0,0,0,0,0]);c.appendUInt32LE(b);c.appendString(a.filename);return c}function n(a,b){if(a===c.length)b(null);else{var m=c[a]; -void 0!==m.data?n(a+1,b):m.load(function(c){c?b(c):n(a+1,b)})}}function q(b,m){n(0,function(g){if(g)m(g);else{g=new core.ByteArrayWriter("utf8");var s,f,q,n=[0];for(s=0;s<c.length;s+=1)g.appendByteArrayWriter(d(c[s])),n.push(g.getLength());q=g.getLength();for(s=0;s<c.length;s+=1)f=c[s],g.appendByteArrayWriter(a(f,n[s]));s=g.getLength()-q;g.appendArray([80,75,5,6,0,0,0,0]);g.appendUInt16LE(c.length);g.appendUInt16LE(c.length);g.appendUInt32LE(s);g.appendUInt32LE(q);g.appendArray([0,0]);b(g.getByteArray())}})} -function g(a,b){q(function(c){runtime.writeFile(a,c,b)},b)}var c,u,t,s=(new core.RawInflate).inflate,m=this,A=new core.Base64;this.load=f;this.save=function(a,b,m,g){var s,d;for(s=0;s<c.length;s+=1)if(d=c[s],d.filename===a){d.set(a,b,m,g);return}d=new h(e);d.set(a,b,m,g);c.push(d)};this.write=function(a){g(e,a)};this.writeAs=g;this.createByteArray=q;this.loadContentXmlAsFragments=function(a,b){m.loadAsString(a,function(a,c){if(a)return b.rootElementReady(a);b.rootElementReady(null,c,!0)})};this.loadAsString= -function(a,b){f(a,function(a,c){if(a||null===c)return b(a,null);var m=runtime.byteArrayToString(c,"utf8");b(null,m)})};this.loadAsDOM=function(a,b){m.loadAsString(a,function(a,c){if(a||null===c)b(a,null);else{var m=(new DOMParser).parseFromString(c,"text/xml");b(null,m)}})};this.loadAsDataURL=function(a,b,c){f(a,function(a,m){if(a)return c(a,null);var g=0,s;b||(b=80===m[1]&&78===m[2]&&71===m[3]?"image/png":255===m[0]&&216===m[1]&&255===m[2]?"image/jpeg":71===m[0]&&73===m[1]&&70===m[2]?"image/gif": -"");for(s="data:"+b+";base64,";g<m.length;)s+=A.convertUTF8ArrayToBase64(m.slice(g,Math.min(g+45E3,m.length))),g+=45E3;c(null,s)})};this.getEntries=function(){return c.slice()};u=-1;null===k?c=[]:runtime.getFileSize(e,function(a){u=a;0>u?k("File '"+e+"' cannot be read.",m):runtime.read(e,u-22,22,function(a,c){a||null===k||null===c?k(a,m):b(c,k)})})}; -// Input 15 -core.CSSUnits=function(){var e={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(k,l,p){return k*e[p]/e[l]};this.convertMeasure=function(e,l){var p,r;e&&l?(p=parseFloat(e),r=e.replace(p.toString(),""),p=this.convert(p,r,l)):p="";return p.toString()};this.getUnits=function(e){return e.substr(e.length-2,e.length)}}; -// Input 16 -xmldom.LSSerializerFilter=function(){}; -// Input 17 -"function"!==typeof Object.create&&(Object.create=function(e){var k=function(){};k.prototype=e;return new k}); -xmldom.LSSerializer=function(){function e(e){var h=e||{},b=function(a){var b={},g;for(g in a)a.hasOwnProperty(g)&&(b[a[g]]=g);return b}(e),f=[h],d=[b],a=0;this.push=function(){a+=1;h=f[a]=Object.create(h);b=d[a]=Object.create(b)};this.pop=function(){f[a]=void 0;d[a]=void 0;a-=1;h=f[a];b=d[a]};this.getLocalNamespaceDefinitions=function(){return b};this.getQName=function(a){var d=a.namespaceURI,g=0,c;if(!d)return a.localName;if(c=b[d])return c+":"+a.localName;do{c||!a.prefix?(c="ns"+g,g+=1):c=a.prefix; -if(h[c]===d)break;if(!h[c]){h[c]=d;b[d]=c;break}c=null}while(null===c);return c+":"+a.localName}}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}function l(e,h){var b="",f=p.filter?p.filter.acceptNode(h):NodeFilter.FILTER_ACCEPT,d;if(f===NodeFilter.FILTER_ACCEPT&&h.nodeType===Node.ELEMENT_NODE){e.push();d=e.getQName(h);var a,n=h.attributes,q,g,c,u="",t;a="<"+d;q=n.length;for(g=0;g<q;g+=1)c=n.item(g),"http://www.w3.org/2000/xmlns/"!== -c.namespaceURI&&(t=p.filter?p.filter.acceptNode(c):NodeFilter.FILTER_ACCEPT,t===NodeFilter.FILTER_ACCEPT&&(t=e.getQName(c),c="string"===typeof c.value?k(c.value):c.value,u+=" "+(t+'="'+c+'"')));q=e.getLocalNamespaceDefinitions();for(g in q)q.hasOwnProperty(g)&&((n=q[g])?"xmlns"!==n&&(a+=" xmlns:"+q[g]+'="'+g+'"'):a+=' xmlns="'+g+'"');b+=a+(u+">")}if(f===NodeFilter.FILTER_ACCEPT||f===NodeFilter.FILTER_SKIP){for(f=h.firstChild;f;)b+=l(e,f),f=f.nextSibling;h.nodeValue&&(b+=k(h.nodeValue))}d&&(b+="</"+ -d+">",e.pop());return b}var p=this;this.filter=null;this.writeToString=function(k,h){if(!k)return"";var b=new e(h);return l(b,k)}}; -// Input 18 -xmldom.RelaxNGParser=function(){function e(a,b){this.message=function(){b&&(a+=1===b.nodeType?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");return a}}function k(a){if(2>=a.e.length)return a;var b={name:a.name,e:a.e.slice(0,2)};return k({name:a.name,e:[b].concat(a.e.slice(2))})}function l(a){a=a.split(":",2);var b="",d;1===a.length?a=["",a[0]]:b=a[0];for(d in f)f[d]===b&&(a[0]=d);return a}function p(a,b){for(var d=0,g,c,f=a.name;a.e&&d<a.e.length;)if(g= -a.e[d],"ref"===g.name){c=b[g.a.name];if(!c)throw g.a.name+" was not defined.";g=a.e.slice(d+1);a.e=a.e.slice(0,d);a.e=a.e.concat(c.e);a.e=a.e.concat(g)}else d+=1,p(g,b);g=a.e;"choice"!==f||g&&g[1]&&"empty"!==g[1].name||(g&&g[0]&&"empty"!==g[0].name?(g[1]=g[0],g[0]={name:"empty"}):(delete a.e,a.name="empty"));if("group"===f||"interleave"===f)"empty"===g[0].name?"empty"===g[1].name?(delete a.e,a.name="empty"):(f=a.name=g[1].name,a.names=g[1].names,g=a.e=g[1].e):"empty"===g[1].name&&(f=a.name=g[0].name, -a.names=g[0].names,g=a.e=g[0].e);"oneOrMore"===f&&"empty"===g[0].name&&(delete a.e,a.name="empty");if("attribute"===f){c=a.names?a.names.length:0;for(var e,s=a.localnames=[c],m=a.namespaces=[c],d=0;d<c;d+=1)e=l(a.names[d]),m[d]=e[0],s[d]=e[1]}"interleave"===f&&("interleave"===g[0].name?a.e="interleave"===g[1].name?g[0].e.concat(g[1].e):[g[1]].concat(g[0].e):"interleave"===g[1].name&&(a.e=[g[0]].concat(g[1].e)))}function r(a,b){for(var d=0,g;a.e&&d<a.e.length;)g=a.e[d],"elementref"===g.name?(g.id= -g.id||0,a.e[d]=b[g.id]):"element"!==g.name&&r(g,b),d+=1}var h=this,b,f={"http://www.w3.org/XML/1998/namespace":"xml"},d;d=function(a,b,e){var g=[],c,h,t=a.localName,s=[];c=a.attributes;var m=t,p=s,r={},v,w;for(v=0;v<c.length;v+=1)if(w=c.item(v),w.namespaceURI)"http://www.w3.org/2000/xmlns/"===w.namespaceURI&&(f[w.value]=w.localName);else{"name"!==w.localName||"element"!==m&&"attribute"!==m||p.push(w.value);if("name"===w.localName||"combine"===w.localName||"type"===w.localName){var P=w,B;B=w.value; -B=B.replace(/^\s\s*/,"");for(var E=/\s/,O=B.length-1;E.test(B.charAt(O));)O-=1;B=B.slice(0,O+1);P.value=B}r[w.localName]=w.value}c=r;c.combine=c.combine||void 0;a=a.firstChild;m=g;p=s;for(r="";a;){if(a.nodeType===Node.ELEMENT_NODE&&"http://relaxng.org/ns/structure/1.0"===a.namespaceURI){if(v=d(a,b,m))"name"===v.name?p.push(f[v.a.ns]+":"+v.text):"choice"===v.name&&(v.names&&v.names.length)&&(p=p.concat(v.names),delete v.names),m.push(v)}else a.nodeType===Node.TEXT_NODE&&(r+=a.nodeValue);a=a.nextSibling}a= -r;"value"!==t&&"param"!==t&&(a=/^\s*([\s\S]*\S)?\s*$/.exec(a)[1]);"value"===t&&void 0===c.type&&(c.type="token",c.datatypeLibrary="");"attribute"!==t&&"element"!==t||void 0===c.name||(h=l(c.name),g=[{name:"name",text:h[1],a:{ns:h[0]}}].concat(g),delete c.name);"name"===t||"nsName"===t||"value"===t?void 0===c.ns&&(c.ns=""):delete c.ns;"name"===t&&(h=l(a),c.ns=h[0],a=h[1]);1<g.length&&("define"===t||"oneOrMore"===t||"zeroOrMore"===t||"optional"===t||"list"===t||"mixed"===t)&&(g=[{name:"group",e:k({name:"group", -e:g}).e}]);2<g.length&&"element"===t&&(g=[g[0]].concat({name:"group",e:k({name:"group",e:g.slice(1)}).e}));1===g.length&&"attribute"===t&&g.push({name:"text",text:a});1!==g.length||"choice"!==t&&"group"!==t&&"interleave"!==t?2<g.length&&("choice"===t||"group"===t||"interleave"===t)&&(g=k({name:t,e:g}).e):(t=g[0].name,s=g[0].names,c=g[0].a,a=g[0].text,g=g[0].e);"mixed"===t&&(t="interleave",g=[g[0],{name:"text"}]);"optional"===t&&(t="choice",g=[g[0],{name:"empty"}]);"zeroOrMore"===t&&(t="choice",g= -[{name:"oneOrMore",e:[g[0]]},{name:"empty"}]);if("define"===t&&c.combine){a:{m=c.combine;p=c.name;r=g;for(v=0;e&&v<e.length;v+=1)if(w=e[v],"define"===w.name&&w.a&&w.a.name===p){w.e=[{name:m,e:w.e.concat(r)}];e=w;break a}e=null}if(e)return}e={name:t};g&&0<g.length&&(e.e=g);for(h in c)if(c.hasOwnProperty(h)){e.a=c;break}void 0!==a&&(e.text=a);s&&0<s.length&&(e.names=s);"element"===t&&(e.id=b.length,b.push(e),e={name:"elementref",id:e.id});return e};this.parseRelaxNGDOM=function(a,n){var q=[],g=d(a&& -a.documentElement,q,void 0),c,u,t={};for(c=0;c<g.e.length;c+=1)u=g.e[c],"define"===u.name?t[u.a.name]=u:"start"===u.name&&(b=u);if(!b)return[new e("No Relax NG start element was found.")];p(b,t);for(c in t)t.hasOwnProperty(c)&&p(t[c],t);for(c=0;c<q.length;c+=1)p(q[c],t);n&&(h.rootPattern=n(b.e[0],q));r(b,q);for(c=0;c<q.length;c+=1)r(q[c],q);h.start=b;h.elements=q;h.nsmap=f;return null}}; -// Input 19 -runtime.loadClass("xmldom.RelaxNGParser"); -xmldom.RelaxNG=function(){function e(a){return function(){var b;return function(){void 0===b&&(b=a());return b}}()}function k(a,b){return function(){var c={},m=0;return function(g){var s=g.hash||g.toString(),d;d=c[s];if(void 0!==d)return d;c[s]=d=b(g);d.hash=a+m.toString();m+=1;return d}}()}function l(a){return function(){var b={};return function(c){var m,g;g=b[c.localName];if(void 0===g)b[c.localName]=g={};else if(m=g[c.namespaceURI],void 0!==m)return m;return g[c.namespaceURI]=m=a(c)}}()}function p(a, -b,c){return function(){var m={},g=0;return function(s,d){var e=b&&b(s,d),f,t;if(void 0!==e)return e;e=s.hash||s.toString();f=d.hash||d.toString();t=m[e];if(void 0===t)m[e]=t={};else if(e=t[f],void 0!==e)return e;t[f]=e=c(s,d);e.hash=a+g.toString();g+=1;return e}}()}function r(a,b){"choice"===b.p1.type?r(a,b.p1):a[b.p1.hash]=b.p1;"choice"===b.p2.type?r(a,b.p2):a[b.p2.hash]=b.p2}function h(a,b){return{type:"element",nc:a,nullable:!1,textDeriv:function(){return v},startTagOpenDeriv:function(m){return a.contains(m)? -c(b,w):v},attDeriv:function(a,b){return v},startTagCloseDeriv:function(){return this}}}function b(){return{type:"list",nullable:!1,hash:"list",textDeriv:function(a,b){return w}}}function f(b,c,m,g){if(c===v)return v;if(g>=m.length)return c;0===g&&(g=0);for(var s=m.item(g);s.namespaceURI===a;){g+=1;if(g>=m.length)return c;s=m.item(g)}return s=f(b,c.attDeriv(b,m.item(g)),m,g+1)}function d(b,a,c){c.e[0].a?(b.push(c.e[0].text),a.push(c.e[0].a.ns)):d(b,a,c.e[0]);c.e[1].a?(b.push(c.e[1].text),a.push(c.e[1].a.ns)): -d(b,a,c.e[1])}var a="http://www.w3.org/2000/xmlns/",n,q,g,c,u,t,s,m,A,x,v={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return v}},w={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(b,a){return v},startTagCloseDeriv:function(){return w},endTagDeriv:function(){return v}}, -P={type:"text",nullable:!0,hash:"text",textDeriv:function(){return P},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return P},endTagDeriv:function(){return v}},B,E,O;n=p("choice",function(b,a){if(b===v)return a;if(a===v||b===a)return b},function(b,a){var c={},m;r(c,{p1:b,p2:a});a=b=void 0;for(m in c)c.hasOwnProperty(m)&&(void 0===b?b=c[m]:a=void 0===a?c[m]:n(a,c[m]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, -textDeriv:function(c,m){return n(a.textDeriv(c,m),b.textDeriv(c,m))},startTagOpenDeriv:l(function(c){return n(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,m){return n(a.attDeriv(c,m),b.attDeriv(c,m))},startTagCloseDeriv:e(function(){return n(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:e(function(){return n(a.endTagDeriv(),b.endTagDeriv())})}}(b,a)});q=function(a,b,c){return function(){var m={},g=0;return function(s,d){var e=b&&b(s,d),f,t;if(void 0!==e)return e; -e=s.hash||s.toString();f=d.hash||d.toString();e<f&&(t=e,e=f,f=t,t=s,s=d,d=t);t=m[e];if(void 0===t)m[e]=t={};else if(e=t[f],void 0!==e)return e;t[f]=e=c(s,d);e.hash=a+g.toString();g+=1;return e}}()}("interleave",function(b,a){if(b===v||a===v)return v;if(b===w)return a;if(a===w)return b},function(b,a){return{type:"interleave",p1:b,p2:a,nullable:b.nullable&&a.nullable,textDeriv:function(c,m){return n(q(b.textDeriv(c,m),a),q(b,a.textDeriv(c,m)))},startTagOpenDeriv:l(function(c){return n(B(function(b){return q(b, -a)},b.startTagOpenDeriv(c)),B(function(a){return q(b,a)},a.startTagOpenDeriv(c)))}),attDeriv:function(c,m){return n(q(b.attDeriv(c,m),a),q(b,a.attDeriv(c,m)))},startTagCloseDeriv:e(function(){return q(b.startTagCloseDeriv(),a.startTagCloseDeriv())})}});g=p("group",function(b,a){if(b===v||a===v)return v;if(b===w)return a;if(a===w)return b},function(b,a){return{type:"group",p1:b,p2:a,nullable:b.nullable&&a.nullable,textDeriv:function(c,m){var s=g(b.textDeriv(c,m),a);return b.nullable?n(s,a.textDeriv(c, -m)):s},startTagOpenDeriv:function(c){var m=B(function(b){return g(b,a)},b.startTagOpenDeriv(c));return b.nullable?n(m,a.startTagOpenDeriv(c)):m},attDeriv:function(c,m){return n(g(b.attDeriv(c,m),a),g(b,a.attDeriv(c,m)))},startTagCloseDeriv:e(function(){return g(b.startTagCloseDeriv(),a.startTagCloseDeriv())})}});c=p("after",function(b,a){if(b===v||a===v)return v},function(b,a){return{type:"after",p1:b,p2:a,nullable:!1,textDeriv:function(m,g){return c(b.textDeriv(m,g),a)},startTagOpenDeriv:l(function(m){return B(function(b){return c(b, -a)},b.startTagOpenDeriv(m))}),attDeriv:function(m,g){return c(b.attDeriv(m,g),a)},startTagCloseDeriv:e(function(){return c(b.startTagCloseDeriv(),a)}),endTagDeriv:e(function(){return b.nullable?a:v})}});u=k("oneormore",function(b){return b===v?v:{type:"oneOrMore",p:b,nullable:b.nullable,textDeriv:function(a,c){return g(b.textDeriv(a,c),n(this,w))},startTagOpenDeriv:function(a){var c=this;return B(function(b){return g(b,n(c,w))},b.startTagOpenDeriv(a))},attDeriv:function(a,c){return g(b.attDeriv(a, -c),n(this,w))},startTagCloseDeriv:e(function(){return u(b.startTagCloseDeriv())})}});s=p("attribute",void 0,function(b,a){return{type:"attribute",nullable:!1,nc:b,p:a,attDeriv:function(c,m){return b.contains(m)&&(a.nullable&&/^\s+$/.test(m.nodeValue)||a.textDeriv(c,m.nodeValue).nullable)?w:v},startTagCloseDeriv:function(){return v}}});t=k("value",function(b){return{type:"value",nullable:!1,value:b,textDeriv:function(a,c){return c===b?w:v},attDeriv:function(){return v},startTagCloseDeriv:function(){return this}}}); -A=k("data",function(b){return{type:"data",nullable:!1,dataType:b,textDeriv:function(){return w},attDeriv:function(){return v},startTagCloseDeriv:function(){return this}}});B=function J(b,a){return"after"===a.type?c(a.p1,b(a.p2)):"choice"===a.type?n(J(b,a.p1),J(b,a.p2)):a};E=function(b,a,c){var m=c.currentNode;a=a.startTagOpenDeriv(m);a=f(b,a,m.attributes,0);var g=a=a.startTagCloseDeriv(),m=c.currentNode;a=c.firstChild();for(var s=[],d;a;)a.nodeType===Node.ELEMENT_NODE?s.push(a):a.nodeType!==Node.TEXT_NODE|| -/^\s*$/.test(a.nodeValue)||s.push(a.nodeValue),a=c.nextSibling();0===s.length&&(s=[""]);d=g;for(g=0;d!==v&&g<s.length;g+=1)a=s[g],"string"===typeof a?d=/^\s*$/.test(a)?n(d,d.textDeriv(b,a)):d.textDeriv(b,a):(c.currentNode=a,d=E(b,d,c));c.currentNode=m;return a=d.endTagDeriv()};m=function(a){var b,c,m;if("name"===a.name)b=a.text,c=a.a.ns,a={name:b,ns:c,hash:"{"+c+"}"+b,contains:function(a){return a.namespaceURI===c&&a.localName===b}};else if("choice"===a.name){b=[];c=[];d(b,c,a);a="";for(m=0;m<b.length;m+= -1)a+="{"+c[m]+"}"+b[m]+",";a={hash:a,contains:function(a){var m;for(m=0;m<b.length;m+=1)if(b[m]===a.localName&&c[m]===a.namespaceURI)return!0;return!1}}}else a={hash:"anyName",contains:function(){return!0}};return a};x=function C(a,c){var d,e;if("elementref"===a.name){d=a.id||0;a=c[d];if(void 0!==a.name){var f=a;d=c[f.id]={hash:"element"+f.id.toString()};f=h(m(f.e[0]),x(f.e[1],c));for(e in f)f.hasOwnProperty(e)&&(d[e]=f[e]);return d}return a}switch(a.name){case "empty":return w;case "notAllowed":return v; -case "text":return P;case "choice":return n(C(a.e[0],c),C(a.e[1],c));case "interleave":d=C(a.e[0],c);for(e=1;e<a.e.length;e+=1)d=q(d,C(a.e[e],c));return d;case "group":return g(C(a.e[0],c),C(a.e[1],c));case "oneOrMore":return u(C(a.e[0],c));case "attribute":return s(m(a.e[0]),C(a.e[1],c));case "value":return t(a.text);case "data":return d=a.a&&a.a.type,void 0===d&&(d=""),A(d);case "list":return b()}throw"No support for "+a.name;};this.makePattern=function(a,b){var c={},m;for(m in b)b.hasOwnProperty(m)&& -(c[m]=b[m]);return m=x(a,c)};this.validate=function(a,b){var c;a.currentNode=a.root;c=E(null,O,a);c.nullable?b(null):(runtime.log("Error in Relax NG validation: "+c),b(["Error in Relax NG validation: "+c]))};this.init=function(a){O=a}}; -// Input 20 -runtime.loadClass("xmldom.RelaxNGParser"); -xmldom.RelaxNG2=function(){function e(b,e){this.message=function(){e&&(b+=e.nodeType===Node.ELEMENT_NODE?" Element ":" Node ",b+=e.nodeName,e.nodeValue&&(b+=" with value '"+e.nodeValue+"'"),b+=".");return b}}function k(b,e,d,a){return"empty"===b.name?null:r(b,e,d,a)}function l(b,f,d){if(2!==b.e.length)throw"Element with wrong # of elements: "+b.e.length;for(var a=(d=f.currentNode)?d.nodeType:0,n=null;a>Node.ELEMENT_NODE;){if(a!==Node.COMMENT_NODE&&(a!==Node.TEXT_NODE||!/^\s+$/.test(f.currentNode.nodeValue)))return[new e("Not allowed node of type "+ -a+".")];a=(d=f.nextSibling())?d.nodeType:0}if(!d)return[new e("Missing element "+b.names)];if(b.names&&-1===b.names.indexOf(h[d.namespaceURI]+":"+d.localName))return[new e("Found "+d.nodeName+" instead of "+b.names+".",d)];if(f.firstChild()){for(n=k(b.e[1],f,d);f.nextSibling();)if(a=f.currentNode.nodeType,!(f.currentNode&&f.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(f.currentNode.nodeValue)||a===Node.COMMENT_NODE))return[new e("Spurious content.",f.currentNode)];if(f.parentNode()!==d)return[new e("Implementation error.")]}else n= -k(b.e[1],f,d);f.nextSibling();return n}var p,r,h;r=function(b,f,d,a){var n=b.name,q=null;if("text"===n)a:{for(var g=(b=f.currentNode)?b.nodeType:0;b!==d&&3!==g;){if(1===g){q=[new e("Element not allowed here.",b)];break a}g=(b=f.nextSibling())?b.nodeType:0}f.nextSibling();q=null}else if("data"===n)q=null;else if("value"===n)a!==b.text&&(q=[new e("Wrong value, should be '"+b.text+"', not '"+a+"'",d)]);else if("list"===n)q=null;else if("attribute"===n)a:{if(2!==b.e.length)throw"Attribute with wrong # of elements: "+ -b.e.length;n=b.localnames.length;for(q=0;q<n;q+=1){a=d.getAttributeNS(b.namespaces[q],b.localnames[q]);""!==a||d.hasAttributeNS(b.namespaces[q],b.localnames[q])||(a=void 0);if(void 0!==g&&void 0!==a){q=[new e("Attribute defined too often.",d)];break a}g=a}q=void 0===g?[new e("Attribute not found: "+b.names,d)]:k(b.e[1],f,d,g)}else if("element"===n)q=l(b,f,d);else if("oneOrMore"===n){a=0;do g=f.currentNode,n=r(b.e[0],f,d),a+=1;while(!n&&g!==f.currentNode);1<a?(f.currentNode=g,q=null):q=n}else if("choice"=== -n){if(2!==b.e.length)throw"Choice with wrong # of options: "+b.e.length;g=f.currentNode;if("empty"===b.e[0].name){if(n=r(b.e[1],f,d,a))f.currentNode=g;q=null}else{if(n=k(b.e[0],f,d,a))f.currentNode=g,n=r(b.e[1],f,d,a);q=n}}else if("group"===n){if(2!==b.e.length)throw"Group with wrong # of members: "+b.e.length;q=r(b.e[0],f,d)||r(b.e[1],f,d)}else if("interleave"===n)a:{g=b.e.length;a=[g];for(var c=g,h,t,s,m;0<c;){h=0;t=f.currentNode;for(q=0;q<g;q+=1)s=f.currentNode,!0!==a[q]&&a[q]!==s&&(m=b.e[q],(n= -r(m,f,d))?(f.currentNode=s,void 0===a[q]&&(a[q]=!1)):s===f.currentNode||"oneOrMore"===m.name||"choice"===m.name&&("oneOrMore"===m.e[0].name||"oneOrMore"===m.e[1].name)?(h+=1,a[q]=s):(h+=1,a[q]=!0));if(t===f.currentNode&&h===c){q=null;break a}if(0===h){for(q=0;q<g;q+=1)if(!1===a[q]){q=[new e("Interleave does not match.",d)];break a}q=null;break a}for(q=c=0;q<g;q+=1)!0!==a[q]&&(c+=1)}q=null}else throw n+" not allowed in nonEmptyPattern.";return q};this.validate=function(b,e){b.currentNode=b.root;var d= -k(p.e[0],b,b.root);e(d)};this.init=function(b,e){p=b;h=e}}; -// Input 21 -xmldom.OperationalTransformInterface=function(){};xmldom.OperationalTransformInterface.prototype.retain=function(e){};xmldom.OperationalTransformInterface.prototype.insertCharacters=function(e){};xmldom.OperationalTransformInterface.prototype.insertElementStart=function(e,k){};xmldom.OperationalTransformInterface.prototype.insertElementEnd=function(){};xmldom.OperationalTransformInterface.prototype.deleteCharacters=function(e){};xmldom.OperationalTransformInterface.prototype.deleteElementStart=function(){}; -xmldom.OperationalTransformInterface.prototype.deleteElementEnd=function(){};xmldom.OperationalTransformInterface.prototype.replaceAttributes=function(e){};xmldom.OperationalTransformInterface.prototype.updateAttributes=function(e){}; -// Input 22 -xmldom.OperationalTransformDOM=function(e,k){this.retain=function(e){};this.insertCharacters=function(e){};this.insertElementStart=function(e,k){};this.insertElementEnd=function(){};this.deleteCharacters=function(e){};this.deleteElementStart=function(){};this.deleteElementEnd=function(){};this.replaceAttributes=function(e){};this.updateAttributes=function(e){};this.atEnd=function(){return!0}}; -// Input 23 -xmldom.XPathIterator=function(){}; -xmldom.XPath=function(){function e(a,b,c){return-1!==a&&(a<b||-1===b)&&(a<c||-1===c)}function k(a){for(var b=[],c=0,d=a.length,f;c<d;){var s=a,m=d,h=b,k="",l=[],p=s.indexOf("[",c),r=s.indexOf("/",c),B=s.indexOf("=",c);e(r,p,B)?(k=s.substring(c,r),c=r+1):e(p,r,B)?(k=s.substring(c,p),c=n(s,p,l)):e(B,r,p)?(k=s.substring(c,B),c=B):(k=s.substring(c,m),c=m);h.push({location:k,predicates:l});if(c<d&&"="===a[c]){f=a.substring(c+1,d);if(2<f.length&&("'"===f[0]||'"'===f[0]))f=f.slice(1,f.length-1);else try{f= -parseInt(f,10)}catch(E){}c=d}}return{steps:b,value:f}}function l(){var a,b=!1;this.setNode=function(b){a=b};this.reset=function(){b=!1};this.next=function(){var c=b?null:a;b=!0;return c}}function p(a,b,c){this.reset=function(){a.reset()};this.next=function(){for(var d=a.next();d&&!(d=d.getAttributeNodeNS(b,c));)d=a.next();return d}}function r(a,b){var c=a.next(),d=null;this.reset=function(){a.reset();c=a.next();d=null};this.next=function(){for(;c;){if(d)if(b&&d.firstChild)d=d.firstChild;else{for(;!d.nextSibling&& -d!==c;)d=d.parentNode;d===c?c=a.next():d=d.nextSibling}else{do(d=c.firstChild)||(c=a.next());while(c&&!d)}if(d&&d.nodeType===Node.ELEMENT_NODE)return d}return null}}function h(a,b){this.reset=function(){a.reset()};this.next=function(){for(var c=a.next();c&&!b(c);)c=a.next();return c}}function b(a,b,c){b=b.split(":",2);var d=c(b[0]),e=b[1];return new h(a,function(a){return a.localName===e&&a.namespaceURI===d})}function f(b,g,c){var d=new l,e=a(d,g,c),s=g.value;return void 0===s?new h(b,function(a){d.setNode(a); -e.reset();return e.next()}):new h(b,function(a){d.setNode(a);e.reset();return(a=e.next())&&a.nodeValue===s})}function d(b,g,c){var d=b.ownerDocument,e=[],s=null;if(d&&d.evaluate)for(c=d.evaluate(g,b,c,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null),s=c.iterateNext();null!==s;)s.nodeType===Node.ELEMENT_NODE&&e.push(s),s=c.iterateNext();else{e=new l;e.setNode(b);b=k(g);e=a(e,b,c);b=[];for(c=e.next();c;)b.push(c),c=e.next();e=b}return e}var a,n;n=function(a,b,c){for(var d=b,e=a.length,s=0;d<e;)"]"=== -a[d]?(s-=1,0>=s&&c.push(k(a.substring(b,d)))):"["===a[d]&&(0>=s&&(b=d+1),s+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};a=function(a,g,c){var d,e,s,m;for(d=0;d<g.steps.length;d+=1)for(s=g.steps[d],e=s.location,""===e?a=new r(a,!1):"@"===e[0]?(m=e.slice(1).split(":",2),a=new p(a,c(m[0]),m[1])):"."!==e&&(a=new r(a,!1),-1!==e.indexOf(":")&&(a=b(a,e,c))),e=0;e<s.predicates.length;e+=1)m=s.predicates[e],a=f(a,m,c);return a};xmldom.XPath= -function(){this.getODFElementsWithXPath=d};return xmldom.XPath}(); -// Input 24 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -odf.Namespaces=function(){function e(e){return k[e]||null}var k={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},l;e.lookupNamespaceURI=e;l=function(){};l.forEachPrefix=function(e){for(var l in k)k.hasOwnProperty(l)&&e(l,k[l])};l.resolvePrefix=e;l.namespaceMap=k;l.drawns="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";l.fons="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0";l.officens="urn:oasis:names:tc:opendocument:xmlns:office:1.0";l.presentationns="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0";l.stylens= -"urn:oasis:names:tc:opendocument:xmlns:style:1.0";l.svgns="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";l.tablens="urn:oasis:names:tc:opendocument:xmlns:table:1.0";l.textns="urn:oasis:names:tc:opendocument:xmlns:text:1.0";l.xlinkns="http://www.w3.org/1999/xlink";l.xmlns="http://www.w3.org/XML/1998/namespace";return l}(); -// Input 25 -runtime.loadClass("xmldom.XPath"); -odf.StyleInfo=function(){function e(a,b){for(var c=g[a.localName],m=c&&c[a.namespaceURI],d=m?m.length:0,f,c=0;c<d;c+=1)(f=a.getAttributeNS(m[c].ns,m[c].localname))&&a.setAttributeNS(m[c].ns,n[m[c].ns]+m[c].localname,b+f);for(c=a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&(m=c,e(m,b)),c=c.nextSibling}function k(a,b){for(var c=g[a.localName],m=c&&c[a.namespaceURI],d=m?m.length:0,e,c=0;c<d;c+=1)if(e=a.getAttributeNS(m[c].ns,m[c].localname))e=e.replace(b,""),a.setAttributeNS(m[c].ns,n[m[c].ns]+m[c].localname, -e);for(c=a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&(m=c,k(m,b)),c=c.nextSibling}function l(a,b){var c=g[a.localName],m=(c=c&&c[a.namespaceURI])?c.length:0,d,e,f;for(f=0;f<m;f+=1)if(d=a.getAttributeNS(c[f].ns,c[f].localname))b=b||{},e=c[f].keyname,e=b[e]=b[e]||{},e[d]=1;return b}function p(a,b){var c,m;l(a,b);for(c=a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&(m=c,p(m,b)),c=c.nextSibling}function r(a,b,c){this.key=a;this.name=b;this.family=c;this.requires={}}function h(a,b,c){var m=a+'"'+ -b,d=c[m];d||(d=c[m]=new r(m,a,b));return d}function b(c,d,e){var m=g[c.localName],f=(m=m&&m[c.namespaceURI])?m.length:0,n=c.getAttributeNS(a,"name"),q=c.getAttributeNS(a,"family"),k;n&&q&&(d=h(n,q,e));if(d)for(n=0;n<f;n+=1)if(q=c.getAttributeNS(m[n].ns,m[n].localname))k=m[n].keyname,q=h(q,k,e),d.requires[q.key]=q;for(n=c.firstChild;n;)n.nodeType===Node.ELEMENT_NODE&&(c=n,b(c,d,e)),n=n.nextSibling;return e}function f(a,b){var c=b[a.family];c||(c=b[a.family]={});c[a.name]=1;Object.keys(a.requires).forEach(function(c){f(a.requires[c], -b)})}function d(a,c){var d=b(a,null,{});Object.keys(d).forEach(function(a){a=d[a];var b=c[a.family];b&&b.hasOwnProperty(a.name)&&f(a,c)})}var a="urn:oasis:names:tc:opendocument:xmlns:style:1.0",n={"urn:oasis:names:tc:opendocument:xmlns:chart:1.0":"chart:","urn:oasis:names:tc:opendocument:xmlns:database:1.0":"db:","urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0":"dr3d:","urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":"draw:","urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":"fo:","urn:oasis:names:tc:opendocument:xmlns:form:1.0":"form:", -"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":"number:","urn:oasis:names:tc:opendocument:xmlns:office:1.0":"office:","urn:oasis:names:tc:opendocument:xmlns:presentation:1.0":"presentation:","urn:oasis:names:tc:opendocument:xmlns:style:1.0":"style:","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0":"svg:","urn:oasis:names:tc:opendocument:xmlns:table:1.0":"table:","urn:oasis:names:tc:opendocument:xmlns:text:1.0":"chart:","http://www.w3.org/XML/1998/namespace":"xml:"},q={text:[{ens:a, -en:"tab-stop",ans:a,a:"leader-text-style"},{ens:a,en:"drop-cap",ans:a,a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-body-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"citation-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"linenumbering-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-level-style-number",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"ruby-text",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"span",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"a",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"visited-style-name"},{ens:a,en:"text-properties",ans:a,a:"text-line-through-text-style"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index-source", -ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"main-entry-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-bibliography",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-chapter",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-end",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-link-start",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-page-number",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-span",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"index-entry-tab-stop",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-entry-text",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-title-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-level-style-bullet",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"outline-level-style",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"}],paragraph:[{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"caption",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"circle",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -en:"connector",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"control",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"custom-shape",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"ellipse",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"frame",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"line",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"measure",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -en:"path",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polygon",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polyline",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"rect",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"regular-polygon",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",en:"annotation",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"text-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",en:"column",ans:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",a:"text-style-name"},{ens:a,en:"style",ans:a,a:"next-style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"body",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"even-columns",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"even-rows",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -en:"first-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"first-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"last-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"last-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"odd-columns",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"odd-rows",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"paragraph-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"notes-configuration",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"default-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"alphabetical-index-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"bibliography-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"h",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"illustration-index-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-source-style",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"object-index-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"p",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"table-index-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-of-content-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-index-entry-template",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-index-entry-template", -ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:a,en:"page-layout-properties",ans:a,a:"register-truth-ref-style-name"}],chart:[{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"axis",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"chart",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"data-label",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"data-point",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"equation",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"error-indicator",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"floor", -ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"footer",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"grid",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"legend",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0", -en:"mean-value",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"plot-area",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"regression-curve",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"series",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"stock-gain-marker",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"stock-loss-marker",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"stock-range-line",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"subtitle", -ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"title",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",en:"wall",ans:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",a:"style-name"}],section:[{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"alphabetical-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"bibliography",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"illustration-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"index-title",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"object-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"section",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-of-content",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-index",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -a:"style-name"}],ruby:[{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"ruby",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"}],table:[{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",en:"query",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",en:"table-representation",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -en:"background",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"}],"table-column":[{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",en:"column",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -a:"style-name"}],"table-row":[{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",en:"query",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"default-row-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",en:"table-representation",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"default-row-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"}],"table-cell":[{ens:"urn:oasis:names:tc:opendocument:xmlns:database:1.0", -en:"column",ans:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",a:"default-cell-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"default-cell-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"default-cell-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"body",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"covered-table-cell",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"even-columns",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"covered-table-cell",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -en:"even-columns",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"even-rows",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"first-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"first-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"last-column",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"last-row",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"odd-columns",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"odd-rows",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",en:"table-cell",ans:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",a:"style-name"}],graphic:[{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"cube",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"extrude",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"rotate", -ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"scene",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"sphere",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"caption",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -en:"circle",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"connector",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"control",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"custom-shape",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"ellipse",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"frame",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"g",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"line", -ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"measure",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"page-thumbnail",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"path",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polygon",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polyline",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"rect",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"regular-polygon", -ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",en:"annotation",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"}],presentation:[{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"cube",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"extrude",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"rotate",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"scene",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",en:"sphere",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"caption",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"circle",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"connector",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"control",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -en:"custom-shape",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"ellipse",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"frame",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"g",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"line",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"measure",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"page-thumbnail",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", -en:"path",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polygon",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"polyline",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"rect",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", -a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"regular-polygon",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",en:"annotation",ans:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",a:"style-name"}],"drawing-page":[{ens:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",en:"page",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", -en:"notes",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:a,en:"handout-master",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"},{ens:a,en:"master-page",ans:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",a:"style-name"}],"list-style":[{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"numbered-paragraph", -ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"list-item",ans:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",a:"style-override"},{ens:a,en:"style",ans:a,a:"list-style-name"},{ens:a,en:"style",ans:a,a:"data-style-name"},{ens:a,en:"style",ans:a,a:"percentage-data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",en:"date-time-decl",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"creation-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"creation-time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"database-display",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"editing-duration",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"expression", -ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"meta-field",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"modification-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"modification-time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"print-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"print-time",ans:a, -a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-formula",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-defined",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-field-get",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-field-input",ans:a,a:"data-style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-get",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-input",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-set",ans:a,a:"data-style-name"}],data:[{ens:a,en:"style",ans:a,a:"data-style-name"},{ens:a,en:"style",ans:a,a:"percentage-data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",en:"date-time-decl",ans:a,a:"data-style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"creation-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"creation-time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"database-display",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"editing-duration",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -en:"expression",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"meta-field",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"modification-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"modification-time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"print-date",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"print-time", -ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"table-formula",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"time",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-defined",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-field-get",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"user-field-input",ans:a,a:"data-style-name"}, -{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-get",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-input",ans:a,a:"data-style-name"},{ens:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",en:"variable-set",ans:a,a:"data-style-name"}],"page-layout":[{ens:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",en:"notes",ans:a,a:"page-layout-name"},{ens:a,en:"handout-master",ans:a,a:"page-layout-name"},{ens:a,en:"master-page",ans:a, -a:"page-layout-name"}]},g,c=new xmldom.XPath;this.UsedStyleList=function(b,c){var g={};this.uses=function(b){var c=b.localName,d=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","name")||b.getAttributeNS(a,"name");b="style"===c?b.getAttributeNS(a,"family"):"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"===b.namespaceURI?"data":c;return(b=g[b])?0<b[d]:!1};p(b,g);c&&d(c,g)};this.canElementHaveStyle=function(a,b){var c=g[b.localName],c=c&&c[b.namespaceURI];return 0<(c?c.length: -0)};this.hasDerivedStyles=function(a,b,d){var m=b("style"),g=d.getAttributeNS(m,"name");d=d.getAttributeNS(m,"family");return c.getODFElementsWithXPath(a,"//style:*[@style:parent-style-name='"+g+"'][@style:family='"+d+"']",b).length?!0:!1};this.prefixStyleNames=function(b,c,d){var m;if(b){for(m=b.firstChild;m;){if(m.nodeType===Node.ELEMENT_NODE){var g=m,f=c,h=g.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","name"),q=void 0;h?q="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0": -(h=g.getAttributeNS(a,"name"))&&(q=a);q&&g.setAttributeNS(q,n[q]+"name",f+h)}m=m.nextSibling}e(b,c);d&&e(d,c)}};this.removePrefixFromStyleNames=function(b,c,d){var m=RegExp("^"+c);if(b){for(c=b.firstChild;c;){if(c.nodeType===Node.ELEMENT_NODE){var g=c,e=m,f=g.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","name"),h=void 0;f?h="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":(f=g.getAttributeNS(a,"name"))&&(h=a);h&&(f=f.replace(e,""),g.setAttributeNS(h,n[h]+"name",f))}c=c.nextSibling}k(b, -m);d&&k(d,m)}};this.determineStylesForNode=l;g=function(a){var b,c,m,d,g,e={},f;for(b in a)if(a.hasOwnProperty(b))for(d=a[b],m=d.length,c=0;c<m;c+=1)g=d[c],f=e[g.en]=e[g.en]||{},f=f[g.ens]=f[g.ens]||[],f.push({ns:g.ans,localname:g.a,keyname:b});return e}(q)}; -// Input 26 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -odf.OdfUtils=function(){function e(a){var b=a&&a.localName;return("p"===b||"h"===b)&&a.namespaceURI===u}function k(a){return/^[ \t\r\n]+$/.test(a)}function l(a){var b=a&&a.localName;return("span"===b||"p"===b||"h"===b)&&a.namespaceURI===u}function p(a){var b=a&&a.localName,c,d=!1;b&&(c=a.namespaceURI,c===u?d="s"===b||"tab"===b||"line-break"===b:c===t&&(d="frame"===b&&"as-char"===a.getAttributeNS(u,"anchor-type")));return d}function r(a){for(;null!==a.firstChild&&l(a);)a=a.firstChild;return a}function h(a){for(;null!== -a.lastChild&&l(a);)a=a.lastChild;return a}function b(a){for(;!e(a)&&null===a.previousSibling;)a=a.parentNode;return e(a)?null:h(a.previousSibling)}function f(a){for(;!e(a)&&null===a.nextSibling;)a=a.parentNode;return e(a)?null:r(a.nextSibling)}function d(a){for(var c=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=b(a);else return!k(a.data.substr(a.length-1,1));else if(p(a)){c=!0;break}else a=b(a);return c}function a(a){var c=!1;for(a=a&&h(a);a;){if(a.nodeType===Node.TEXT_NODE&&0<a.length&& -!k(a.data)){c=!0;break}else if(p(a)){c=!0;break}a=b(a)}return c}function n(a){var b=!1;for(a=a&&r(a);a;){if(a.nodeType===Node.TEXT_NODE&&0<a.length&&!k(a.data)){b=!0;break}else if(p(a)){b=!0;break}a=f(a)}return b}function q(a,b){return k(a.data.substr(b))?!n(f(a)):!1}function g(a){return(a=/-?([0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)|(%))/.exec(a))?{value:parseFloat(a[1]),unit:a[3]}:null}function c(a){return(a=g(a))&&"%"!==a.unit?null:a} -var u="urn:oasis:names:tc:opendocument:xmlns:text:1.0",t="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",s=/^\s*$/;this.isParagraph=e;this.getParagraphElement=function(a){for(;a&&!e(a);)a=a.parentNode;return a};this.isListItem=function(a){return"list-item"===(a&&a.localName)&&a.namespaceURI===u};this.isODFWhitespace=k;this.isGroupingElement=l;this.isCharacterElement=p;this.firstChild=r;this.lastChild=h;this.previousNode=b;this.nextNode=f;this.scanLeftForNonWhitespace=d;this.lookLeftForCharacter= -function(a){var c;c=0;a.nodeType===Node.TEXT_NODE&&0<a.length?(c=a.data,c=k(c.substr(c.length-1,1))?1===c.length?d(b(a))?2:0:k(c.substr(c.length-2,1))?0:2:1):p(a)&&(c=1);return c};this.lookRightForCharacter=function(a){var b=!1;a&&a.nodeType===Node.TEXT_NODE&&0<a.length?b=!k(a.data.substr(0,1)):p(a)&&(b=!0);return b};this.scanLeftForAnyCharacter=a;this.scanRightForAnyCharacter=n;this.isTrailingWhitespace=q;this.isSignificantWhitespace=function(c,g){var e=c.data,f;if(!k(e[g]))return!1;if(0<g){if(!k(e[g- -1]))return!0;if(1<g)if(!k(e[g-2]))f=!0;else{if(!k(e.substr(0,g)))return!1}else d(b(c))&&(f=!0);if(!0===f)return q(c,g)?!1:!0;e=e[g+1];return k(e)?!1:a(b(c))?!1:!0}return!1};this.getFirstNonWhitespaceChild=function(a){for(a=a.firstChild;a&&a.nodeType===Node.TEXT_NODE&&s.test(a.nodeValue);)a=a.nextSibling;return a};this.parseLength=g;this.parseFoFontSize=function(a){var b;b=(b=g(a))&&(0>=b.value||"%"===b.unit)?null:b;return b||c(a)};this.parseFoLineHeight=function(a){var b;b=(b=g(a))&&(0>b.value||"%"=== -b.unit)?null:b;return b||c(a)};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument,d=c.createRange(),g=[],e;e=c.createTreeWalker(a.commonAncestorContainer.nodeType===Node.TEXT_NODE?a.commonAncestorContainer.parentNode:a.commonAncestorContainer,NodeFilter.SHOW_ALL,function(c){d.selectNodeContents(c);if(!1===b&&c.nodeType===Node.TEXT_NODE){if(0>=a.compareBoundaryPoints(a.START_TO_START,d)&&0<=a.compareBoundaryPoints(a.END_TO_END,d))return NodeFilter.FILTER_ACCEPT}else if(-1===a.compareBoundaryPoints(a.END_TO_START, -d)&&1===a.compareBoundaryPoints(a.START_TO_END,d))return c.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT},!1);e.currentNode=a.startContainer.previousSibling||a.startContainer.parentNode;for(c=e.nextNode();c;)g.push(c),c=e.nextNode();d.detach();return g}}; -// Input 27 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be + The code in this file is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License (GNU AGPL) + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + The code in this file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with WebODF. If not, see <http://www.gnu.org/licenses/>. + + As additional permission under GNU AGPL version 3 section 7, you + may distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU AGPL normally + required by section 4, provided you include this license notice and a URL + through which recipients can access the Corresponding Source. + + As a special exception to the AGPL, any HTML file which merely makes function + calls to this code, and for that purpose includes it in unmodified form by reference or in-line shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and @@ -470,1247 +36,616 @@ This license applies to this entire compilation. @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils"); -odf.TextStyleApplicator=function(e,k){function l(a){function b(a,c){return"object"===typeof a&&"object"===typeof c?Object.keys(a).every(function(d){return b(a[d],c[d])}):a===c}this.isStyleApplied=function(d){d=e.getAppliedStylesForElement(d);return b(a,d)}}function p(a){var b={};this.applyStyleToContainer=function(d){var f;f=d.getAttributeNS(n,"style-name");var m=d.ownerDocument;f=f||"";if(!b.hasOwnProperty(f)){var h=f,l=f,p;l?(p=e.getStyleElement(l,"text"),p.parentNode===k?m=p.cloneNode(!0):(m=m.createElementNS(q, -"style:style"),m.setAttributeNS(q,"style:parent-style-name",l),m.setAttributeNS(q,"style:family","text"),m.setAttributeNS(g,"scope","document-content"))):(m=m.createElementNS(q,"style:style"),m.setAttributeNS(q,"style:family","text"),m.setAttributeNS(g,"scope","document-content"));e.updateStyle(m,a,!0);k.appendChild(m);b[h]=m}f=b[f].getAttributeNS(q,"name");d.setAttributeNS(n,"text:style-name",f)}}function r(a,b){var d=b.ownerDocument.createRange(),g=b.nodeType===Node.TEXT_NODE?b.length:b.childNodes.length; -d.setStart(a.startContainer,a.startOffset);d.setEnd(a.endContainer,a.endOffset);g=0===d.comparePoint(b,0)&&0===d.comparePoint(b,g);d.detach();return g}function h(a){var b;0!==a.endOffset&&(a.endContainer.nodeType===Node.TEXT_NODE&&a.endOffset!==a.endContainer.length)&&(d.push(a.endContainer.splitText(a.endOffset)),d.push(a.endContainer));0!==a.startOffset&&(a.startContainer.nodeType===Node.TEXT_NODE&&a.startOffset!==a.startContainer.length)&&(b=a.startContainer.splitText(a.startOffset),d.push(a.startContainer), -d.push(b),a.setStart(b,0))}function b(a,b){if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a.parentNode.removeChild(a);else if(b.nodeType===Node.TEXT_NODE)return b.insertData(0,a.data),a.parentNode.removeChild(a),b;return a}function f(a){a.nextSibling&&(a=b(a,a.nextSibling));a.previousSibling&&b(a.previousSibling,a)}var d,a=new odf.OdfUtils,n=odf.Namespaces.textns,q=odf.Namespaces.stylens,g="urn:webodf:names:scope";this.applyStyle=function(b,g){var e,s,m,q,k;e={};var v;runtime.assert(Boolean(g["style:text-properties"]), -"applyStyle without any text properties");e["style:text-properties"]=g["style:text-properties"];q=new p(e);k=new l(e);d=[];h(b);e=a.getTextNodes(b,!1);v={startContainer:b.startContainer,startOffset:b.startOffset,endContainer:b.endContainer,endOffset:b.endOffset};e.forEach(function(b){s=k.isStyleApplied(b);if(!1===s){var c=b.ownerDocument,d=b.parentNode,g,e=b,f=new core.LoopWatchDog(1E3);a.isParagraph(d)?(c=c.createElementNS(n,"text:span"),d.insertBefore(c,b),g=!1):(b.previousSibling&&!r(v,b.previousSibling)? -(c=d.cloneNode(!1),d.parentNode.insertBefore(c,d.nextSibling)):c=d,g=!0);for(;e&&(e===b||r(v,e));)f.check(),d=e.nextSibling,e.parentNode!==c&&c.appendChild(e),e=d;if(e&&g)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);e;)f.check(),d=e.nextSibling,b.appendChild(e),e=d;m=c;q.applyStyleToContainer(m)}});d.forEach(f);d=null}}; -// Input 28 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - This license applies to this entire compilation. - @licend @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils");runtime.loadClass("xmldom.XPath");runtime.loadClass("core.CSSUnits"); -odf.Style2CSS=function(){function e(a){var b={},c,d;if(!a)return b;for(a=a.firstChild;a;){if(d=a.namespaceURI!==u||"style"!==a.localName&&"default-style"!==a.localName?a.namespaceURI===s&&"list-style"===a.localName?"list":a.namespaceURI!==u||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(u,"family"))(c=a.getAttributeNS&&a.getAttributeNS(u,"name"))||(c=""),d=b[d]=b[d]||{},d[c]=a;a=a.nextSibling}return b}function k(a,b){if(!b||!a)return null;if(a[b])return a[b]; -var c,d;for(c in a)if(a.hasOwnProperty(c)&&(d=k(a[c].derivedStyles,b)))return d;return null}function l(a,b,c){var d=b[a],g,e;d&&(g=d.getAttributeNS(u,"parent-style-name"),e=null,g&&(e=k(c,g),!e&&b[g]&&(l(g,b,c),e=b[g],b[g]=null)),e?(e.derivedStyles||(e.derivedStyles={}),e.derivedStyles[a]=d):c[a]=d)}function p(a,b){for(var c in a)a.hasOwnProperty(c)&&(l(c,a,b),a[c]=null)}function r(a,b){var c=x[a],d;if(null===c)return null;d=b?"["+c+'|style-name="'+b+'"]':"["+c+"|style-name]";"presentation"===c&& -(c="draw",d=b?'[presentation|style-name="'+b+'"]':"[presentation|style-name]");return c+"|"+v[a].join(d+","+c+"|")+d}function h(a,b,c){var d=[],g,e;d.push(r(a,b));for(g in c.derivedStyles)if(c.derivedStyles.hasOwnProperty(g))for(e in b=h(a,g,c.derivedStyles[g]),b)b.hasOwnProperty(e)&&d.push(b[e]);return d}function b(a,b,c){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===b&&a.localName===c)return b=a;a=a.nextSibling}return null}function f(a,b){var c="",d,g;for(d in b)b.hasOwnProperty(d)&& -(d=b[d],g=a.getAttributeNS(d[0],d[1]),d[2]&&g&&(c+=d[2]+":"+g+";"));return c}function d(a){return(a=b(a,u,"text-properties"))?Q.parseFoFontSize(a.getAttributeNS(c,"font-size")):null}function a(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d});return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function n(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var g=c.getAttributeNS(s,"level"), -e;c=Q.getFirstNonWhitespaceChild(c);c=Q.getFirstNonWhitespaceChild(c);var m;c&&(e=c.attributes,m=e["fo:text-indent"]?e["fo:text-indent"].value:void 0,e=e["fo:margin-left"]?e["fo:margin-left"].value:void 0);m||(m="-0.6cm");c="-"===m.charAt(0)?m.substring(1):"-"+m;for(g=g&&parseInt(g,10);1<g;)b+=" > text|list-item > text|list",g-=1;g=b+" > text|list-item > *:not(text|list):first-child";void 0!==e&&(e=g+"{margin-left:"+e+";}",a.insertRule(e,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+ -d+";";d+="counter-increment:list;";d+="margin-left:"+m+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(f){throw f;}}function q(e,k,t,l){if("list"===k)for(var p=l.firstChild,r,v;p;){if(p.namespaceURI===s)if(r=p,"list-level-style-number"===p.localName){var N=r;v=N.getAttributeNS(u,"num-format");var x=N.getAttributeNS(u,"num-suffix"),z={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},N=N.getAttributeNS(u,"num-prefix")||"",N=z.hasOwnProperty(v)? -N+(" counter(list, "+z[v]+")"):v?N+("'"+v+"';"):N+" ''";x&&(N+=" '"+x+"'");v="content: "+N+";";n(e,t,r,v)}else"list-level-style-image"===p.localName?(v="content: none;",n(e,t,r,v)):"list-level-style-bullet"===p.localName&&(v="content: '"+r.getAttributeNS(s,"bullet-char")+"';",n(e,t,r,v));p=p.nextSibling}else if("page"===k)if(x=r=t="",p=l.getElementsByTagNameNS(u,"page-layout-properties")[0],r=p.parentNode.parentNode.parentNode.masterStyles,x="",t+=f(p,D),v=p.getElementsByTagNameNS(u,"background-image"), -0<v.length&&(x=v.item(0).getAttributeNS(m,"href"))&&(t+="background-image: url('odfkit:"+x+"');",v=v.item(0),t+=f(v,P)),"presentation"===F){if(r)for(v=r.getElementsByTagNameNS(u,"master-page"),z=0;z<v.length;z+=1)if(v[z].getAttributeNS(u,"page-layout-name")===p.parentNode.getAttributeNS(u,"name")){x=v[z].getAttributeNS(u,"name");r="draw|page[draw|master-page-name="+x+"] {"+t+"}";x="office|body, draw|page[draw|master-page-name="+x+"] {"+f(p,G)+" }";try{e.insertRule(r,e.cssRules.length),e.insertRule(x, -e.cssRules.length)}catch(ca){throw ca;}}}else{if("text"===F){r="office|text {"+t+"}";x="office|body {width: "+p.getAttributeNS(c,"page-width")+";}";try{e.insertRule(r,e.cssRules.length),e.insertRule(x,e.cssRules.length)}catch($){throw $;}}}else{t=h(k,t,l).join(",");p="";if(r=b(l,u,"text-properties")){var z=r,Y;v=Y="";x=1;r=""+f(z,w);N=z.getAttributeNS(u,"text-underline-style");"solid"===N&&(Y+=" underline");N=z.getAttributeNS(u,"text-line-through-style");"solid"===N&&(Y+=" line-through");Y.length&& -(r+="text-decoration:"+Y+";");if(Y=z.getAttributeNS(u,"font-name")||z.getAttributeNS(c,"font-family"))N=X[Y],r+="font-family: "+(N||Y)+", sans-serif;";N=z.parentNode;if(z=d(N)){for(;N;){if(z=d(N))if("%"!==z.unit){v="font-size: "+z.value*x+z.unit+";";break}else x*=z.value/100;z=N;Y=N="";N=null;"default-style"===z.localName?N=null:(N=z.getAttributeNS(u,"parent-style-name"),Y=z.getAttributeNS(u,"family"),N=U.getODFElementsWithXPath(K,N?"//style:*[@style:name='"+N+"'][@style:family='"+Y+"']":"//style:default-style[@style:family='"+ -Y+"']",odf.Namespaces.resolvePrefix)[0])}v||(v="font-size: "+parseFloat(H)*x+Z.getUnits(H)+";");r+=v}p+=r}if(r=b(l,u,"paragraph-properties"))v=r,r=""+f(v,B),x=v.getElementsByTagNameNS(u,"background-image"),0<x.length&&(z=x.item(0).getAttributeNS(m,"href"))&&(r+="background-image: url('odfkit:"+z+"');",x=x.item(0),r+=f(x,P)),(v=v.getAttributeNS(c,"line-height"))&&"normal"!==v&&(v=Q.parseFoLineHeight(v),r="%"!==v.unit?r+("line-height: "+v.value+";"):r+("line-height: "+v.value/100+";")),p+=r;if(r=b(l, -u,"graphic-properties"))z=r,r=""+f(z,E),v=z.getAttributeNS(g,"opacity"),x=z.getAttributeNS(g,"fill"),z=z.getAttributeNS(g,"fill-color"),"solid"===x||"hatch"===x?z&&"none"!==z?(v=isNaN(parseFloat(v))?1:parseFloat(v)/100,(z=a(z))&&(r+="background-color: rgba("+z.r+","+z.g+","+z.b+","+v+");")):r+="background: none;":"none"===x&&(r+="background: none;"),p+=r;if(r=b(l,u,"drawing-page-properties"))v=""+f(r,E),"true"===r.getAttributeNS(A,"background-visible")&&(v+="background: none;"),p+=v;if(r=b(l,u,"table-cell-properties"))r= -""+f(r,O),p+=r;if(r=b(l,u,"table-row-properties"))r=""+f(r,J),p+=r;if(r=b(l,u,"table-column-properties"))r=""+f(r,y),p+=r;if(r=b(l,u,"table-properties"))r=""+f(r,C),p+=r;if(0!==p.length)try{e.insertRule(t+"{"+p+"}",e.cssRules.length)}catch(da){throw da;}}for(var aa in l.derivedStyles)l.derivedStyles.hasOwnProperty(aa)&&q(e,k,aa,l.derivedStyles[aa])}var g=odf.Namespaces.drawns,c=odf.Namespaces.fons,u=odf.Namespaces.stylens,t=odf.Namespaces.svgns,s=odf.Namespaces.textns,m=odf.Namespaces.xlinkns,A=odf.Namespaces.presentationns, -x={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"},v={graphic:"circle connected control custom-shape ellipse frame g line measure page page-thumbnail path polygon polyline rect regular-polygon".split(" "),paragraph:"alphabetical-index-entry-template h illustration-index-entry-template index-source-style object-index-entry-template p table-index-entry-template table-of-content-entry-template user-index-entry-template".split(" "), + @source: https://github.com/kogmbh/WebODF/ +*/ +var webodf_version="0.5.4";function Runtime(){}Runtime.prototype.getVariable=function(f){};Runtime.prototype.toJson=function(f){};Runtime.prototype.fromJson=function(f){};Runtime.prototype.byteArrayFromString=function(f,k){};Runtime.prototype.byteArrayToString=function(f,k){};Runtime.prototype.read=function(f,k,a,d){};Runtime.prototype.readFile=function(f,k,a){};Runtime.prototype.readFileSync=function(f,k){};Runtime.prototype.loadXML=function(f,k){};Runtime.prototype.writeFile=function(f,k,a){}; +Runtime.prototype.deleteFile=function(f,k){};Runtime.prototype.log=function(f,k){};Runtime.prototype.setTimeout=function(f,k){};Runtime.prototype.clearTimeout=function(f){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(f){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(f){};Runtime.prototype.exit=function(f){}; +Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(f){};Runtime.prototype.cancelAnimationFrame=function(f){};Runtime.prototype.assert=function(f,k){};var IS_COMPILED_CODE=!0; +Runtime.byteArrayToString=function(f,k){function a(d){var a="",c,m=d.length;for(c=0;c<m;c+=1)a+=String.fromCharCode(d[c]&255);return a}function d(d){var a="",c,m=d.length,l=[],r,b,e,n;for(c=0;c<m;c+=1)r=d[c],128>r?l.push(r):(c+=1,b=d[c],194<=r&&224>r?l.push((r&31)<<6|b&63):(c+=1,e=d[c],224<=r&&240>r?l.push((r&15)<<12|(b&63)<<6|e&63):(c+=1,n=d[c],240<=r&&245>r&&(r=(r&7)<<18|(b&63)<<12|(e&63)<<6|n&63,r-=65536,l.push((r>>10)+55296,(r&1023)+56320))))),1E3<=l.length&&(a+=String.fromCharCode.apply(null, +l),l.length=0);return a+String.fromCharCode.apply(null,l)}var c;"utf8"===k?c=d(f):("binary"!==k&&this.log("Unsupported encoding: "+k),c=a(f));return c};Runtime.getVariable=function(f){try{return eval(f)}catch(k){}};Runtime.toJson=function(f){return JSON.stringify(f)};Runtime.fromJson=function(f){return JSON.parse(f)};Runtime.getFunctionName=function(f){return void 0===f.name?(f=/function\s+(\w+)/.exec(f))&&f[1]:f.name}; +Runtime.assert=function(f,k){if(!f)throw this.log("alert","ASSERTION FAILED:\n"+k),Error(k);}; +function BrowserRuntime(f){function k(d){var a=d.length,b,e,n=0;for(b=0;b<a;b+=1)e=d.charCodeAt(b),n+=1+(128<e)+(2048<e),55040<e&&57344>e&&(n+=1,b+=1);return n}function a(d,a,b){var e=d.length,n,g;a=new Uint8Array(new ArrayBuffer(a));b?(a[0]=239,a[1]=187,a[2]=191,g=3):g=0;for(b=0;b<e;b+=1)n=d.charCodeAt(b),128>n?(a[g]=n,g+=1):2048>n?(a[g]=192|n>>>6,a[g+1]=128|n&63,g+=2):55040>=n||57344<=n?(a[g]=224|n>>>12&15,a[g+1]=128|n>>>6&63,a[g+2]=128|n&63,g+=3):(b+=1,n=(n-55296<<10|d.charCodeAt(b)-56320)+65536, +a[g]=240|n>>>18&7,a[g+1]=128|n>>>12&63,a[g+2]=128|n>>>6&63,a[g+3]=128|n&63,g+=4);return a}function d(a){var d=a.length,b=new Uint8Array(new ArrayBuffer(d)),e;for(e=0;e<d;e+=1)b[e]=a.charCodeAt(e)&255;return b}function c(a,d){var b,e,n;void 0!==d?n=a:d=a;f?(e=f.ownerDocument,n&&(b=e.createElement("span"),b.className=n,b.appendChild(e.createTextNode(n)),f.appendChild(b),f.appendChild(e.createTextNode(" "))),b=e.createElement("span"),0<d.length&&"<"===d[0]?b.innerHTML=d:b.appendChild(e.createTextNode(d)), +f.appendChild(b),f.appendChild(e.createElement("br"))):console&&console.log(d);m.enableAlerts&&"alert"===n&&alert(d)}function h(c,r,b){if(0!==b.status||b.responseText)if(200===b.status||0===b.status){if(b.response&&"string"!==typeof b.response)"binary"===r?(b=b.response,b=new Uint8Array(b)):b=String(b.response);else if("binary"===r)if(null!==b.responseBody&&"undefined"!==String(typeof VBArray)){b=(new VBArray(b.responseBody)).toArray();var e=b.length;r=new Uint8Array(new ArrayBuffer(e));for(c=0;c< +e;c+=1)r[c]=b[c];b=r}else{(c=b.getResponseHeader("Content-Length"))&&(c=parseInt(c,10));if(c&&c!==b.responseText.length)a:{e=b.responseText;r=!1;var n=k(e);if("number"===typeof c){if(c!==n&&c!==n+3){e=void 0;break a}r=n+3===c;n=c}e=a(e,n,r)}void 0===e&&(e=d(b.responseText));b=e}else b=b.responseText;b={err:null,data:b}}else b={err:b.responseText||b.statusText,data:null};else b={err:"File "+c+" is empty.",data:null};return b}function q(d,a,b){var e=new XMLHttpRequest;e.open("GET",d,b);e.overrideMimeType&& +("binary"!==a?e.overrideMimeType("text/plain; charset="+a):e.overrideMimeType("text/plain; charset=x-user-defined"));return e}function p(d,a,b){var e=q(d,a,!0);e.onreadystatechange=function(){var g;4===e.readyState&&(g=h(d,a,e),b(g.err,g.data))};try{e.send(null)}catch(n){b(n.message,null)}}var m=this;this.byteArrayFromString=function(c,r){var b;"utf8"===r?b=a(c,k(c),!1):("binary"!==r&&m.log("unknown encoding: "+r),b=d(c));return b};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable= +Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=p;this.read=function(d,a,b,e){p(d,"binary",function(n,g){var d=null;if(g){if("string"===typeof g)throw"This should not happen.";d=g.subarray(a,a+b)}e(n,d)})};this.readFileSync=function(d,a){var b=q(d,a,!1),e;try{b.send(null);e=h(d,a,b);if(e.err)throw e.err;if(null===e.data)throw"No data read from "+d+".";}catch(n){throw n;}return e.data};this.writeFile=function(d,a,b){var e=new XMLHttpRequest,n;e.open("PUT", +d,!0);e.onreadystatechange=function(){4===e.readyState&&(0!==e.status||e.responseText?200<=e.status&&300>e.status||0===e.status?b(null):b("Status "+String(e.status)+": "+e.responseText||e.statusText):b("File "+d+" is empty."))};n=a.buffer&&!e.sendAsBinary?a.buffer:m.byteArrayToString(a,"binary");try{e.sendAsBinary?e.sendAsBinary(n):e.send(n)}catch(g){m.log("HUH? "+g+" "+a),b(g.message)}};this.deleteFile=function(d,a){var b=new XMLHttpRequest;b.open("DELETE",d,!0);b.onreadystatechange=function(){4=== +b.readyState&&(200>b.status&&300<=b.status?a(b.responseText):a(null))};b.send(null)};this.loadXML=function(d,a){var b=new XMLHttpRequest;b.open("GET",d,!0);b.overrideMimeType&&b.overrideMimeType("text/xml");b.onreadystatechange=function(){4===b.readyState&&(0!==b.status||b.responseText?200===b.status||0===b.status?a(null,b.responseXML):a(b.responseText,null):a("File "+d+" is empty.",null))};try{b.send(null)}catch(e){a(e.message,null)}};this.log=c;this.enableAlerts=!0;this.assert=Runtime.assert;this.setTimeout= +function(d,a){return setTimeout(function(){d()},a)};this.clearTimeout=function(d){clearTimeout(d)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.currentDirectory=function(){return""};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(d){return(new DOMParser).parseFromString(d,"text/xml")};this.exit=function(d){c("Calling exit with code "+String(d)+", but exit() is not implemented.")}; +this.getWindow=function(){return window};this.requestAnimationFrame=function(d){var a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,b=0;if(a)a.bind(window),b=a(d);else return setTimeout(d,15);return b};this.cancelAnimationFrame=function(d){var a=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;a?(a.bind(window),a(d)):clearTimeout(d)}} +function NodeJSRuntime(){function f(d){var a=d.length,c,b=new Uint8Array(new ArrayBuffer(a));for(c=0;c<a;c+=1)b[c]=d[c];return b}function k(a,q,p){function b(b,n){if(b)return p(b,null);if(!n)return p("No data for "+a+".",null);if("string"===typeof n)return p(b,n);p(b,f(n))}a=c.resolve(h,a);"binary"!==q?d.readFile(a,q,b):d.readFile(a,null,b)}var a=this,d=require("fs"),c=require("path"),h="",q,p;this.byteArrayFromString=function(a,d){var c=new Buffer(a,d),b,e=c.length,n=new Uint8Array(new ArrayBuffer(e)); +for(b=0;b<e;b+=1)n[b]=c[b];return n};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=k;this.loadXML=function(d,c){k(d,"utf-8",function(q,b){if(q)return c(q,null);if(!b)return c("No data for "+d+".",null);c(null,a.parseXML(b))})};this.writeFile=function(a,q,p){q=new Buffer(q);a=c.resolve(h,a);d.writeFile(a,q,"binary",function(b){p(b||null)})};this.deleteFile=function(a,q){a=c.resolve(h,a); +d.unlink(a,q)};this.read=function(a,q,p,b){a=c.resolve(h,a);d.open(a,"r+",666,function(e,n){if(e)b(e,null);else{var g=new Buffer(p);d.read(n,g,0,p,q,function(e){d.close(n);b(e,f(g))})}})};this.readFileSync=function(a,c){var q;q=d.readFileSync(a,"binary"===c?null:c);if(null===q)throw"File "+a+" could not be read.";"binary"===c&&(q=f(q));return q};this.log=function(a,d){var c;void 0!==d?c=a:d=a;"alert"===c&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(d+"\n");"alert"===c&&process.stderr.write("!!!!! ALERT !!!!!\n")}; +this.assert=Runtime.assert;this.setTimeout=function(a,d){return setTimeout(function(){a()},d)};this.clearTimeout=function(a){clearTimeout(a)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(a){h=a};this.currentDirectory=function(){return h};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return p};this.parseXML=function(a){return q.parseFromString(a,"text/xml")};this.exit=process.exit;this.getWindow=function(){return null};this.requestAnimationFrame= +function(a){return setTimeout(a,15)};this.cancelAnimationFrame=function(a){clearTimeout(a)};q=new (require("xmldom").DOMParser);p=a.parseXML("<a/>").implementation} +function RhinoRuntime(){var f=this,k={},a=k.javax.xml.parsers.DocumentBuilderFactory.newInstance(),d,c,h="";a.setValidating(!1);a.setNamespaceAware(!0);a.setExpandEntityReferences(!1);a.setSchema(null);c=k.org.xml.sax.EntityResolver({resolveEntity:function(a,d){var c=new k.java.io.FileReader(d);return new k.org.xml.sax.InputSource(c)}});d=a.newDocumentBuilder();d.setEntityResolver(c);this.byteArrayFromString=function(a,d){var c,h=a.length,r=new Uint8Array(new ArrayBuffer(h));for(c=0;c<h;c+=1)r[c]= +a.charCodeAt(c)&255;return r};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.loadXML=function(a,c){var h=new k.java.io.File(a),l=null;try{l=d.parse(h)}catch(r){return print(r),c(r,null)}c(null,l)};this.readFile=function(a,d,c){h&&(a=h+"/"+a);var l=new k.java.io.File(a),r="binary"===d?"latin1":d;l.isFile()?((a=readFile(a,r))&&"binary"===d&&(a=f.byteArrayFromString(a,"binary")),c(null,a)):c(a+" is not a file.", +null)};this.writeFile=function(a,d,c){h&&(a=h+"/"+a);a=new k.java.io.FileOutputStream(a);var l,r=d.length;for(l=0;l<r;l+=1)a.write(d[l]);a.close();c(null)};this.deleteFile=function(a,d){h&&(a=h+"/"+a);var c=new k.java.io.File(a),l=a+Math.random(),l=new k.java.io.File(l);c.rename(l)?(l.deleteOnExit(),d(null)):d("Could not delete "+a)};this.read=function(a,d,c,l){h&&(a=h+"/"+a);var r;r=a;var b="binary";(new k.java.io.File(r)).isFile()?("binary"===b&&(b="latin1"),r=readFile(r,b)):r=null;r?l(null,this.byteArrayFromString(r.substring(d, +d+c),"binary")):l("Cannot read "+a,null)};this.readFileSync=function(a,d){if(!d)return"";var c=readFile(a,d);if(null===c)throw"File could not be read.";return c};this.log=function(a,d){var c;void 0!==d?c=a:d=a;"alert"===c&&print("\n!!!!! ALERT !!!!!");print(d);"alert"===c&&print("!!!!! ALERT !!!!!")};this.assert=Runtime.assert;this.setTimeout=function(a){a();return 0};this.clearTimeout=function(){};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(a){h=a};this.currentDirectory= +function(){return h};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return d.getDOMImplementation()};this.parseXML=function(a){a=new k.java.io.StringReader(a);a=new k.org.xml.sax.InputSource(a);return d.parse(a)};this.exit=quit;this.getWindow=function(){return null};this.requestAnimationFrame=function(a){a();return 0};this.cancelAnimationFrame=function(){}} +Runtime.create=function(){return"undefined"!==String(typeof window)?new BrowserRuntime(window.document.getElementById("logoutput")):"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime};var runtime=Runtime.create(),core={},gui={},xmldom={},odf={},ops={},webodf={};(function(){webodf.Version="undefined"!==String(typeof webodf_version)?webodf_version:"From Source"})(); +(function(){function f(a,d,c){var h=a+"/manifest.json",b,e;runtime.log("Loading manifest: "+h);try{b=runtime.readFileSync(h,"utf-8")}catch(n){if(c)runtime.log("No loadable manifest found.");else throw console.log(String(n)),n;return}c=JSON.parse(b);for(e in c)c.hasOwnProperty(e)&&(d[e]={dir:a,deps:c[e]})}function k(a,d,c){function h(g){if(!n[g]&&!c(g)){if(e[g])throw"Circular dependency detected for "+g+".";e[g]=!0;if(!d[g])throw"Missing dependency information for class "+g+".";var a=d[g],p=a.deps, +q,f=p.length;for(q=0;q<f;q+=1)h(p[q]);e[g]=!1;n[g]=!0;b.push(a.dir+"/"+g.replace(".","/")+".js")}}var b=[],e={},n={};a.forEach(h);return b}function a(a,d){return d+("\n//# sourceURL="+a)}function d(d){var c,h;for(c=0;c<d.length;c+=1)h=runtime.readFileSync(d[c],"utf-8"),h=a(d[c],h),eval(h)}function c(a){a=a.split(".");var d,c=q,h=a.length;for(d=0;d<h;d+=1){if(!c.hasOwnProperty(a[d]))return!1;c=c[a[d]]}return!0}var h,q={core:core,gui:gui,xmldom:xmldom,odf:odf,ops:ops};runtime.loadClasses=function(a, +q){if(IS_COMPILED_CODE||0===a.length)return q&&q();var l;if(!(l=h)){l=[];var r=runtime.libraryPaths(),b;runtime.currentDirectory()&&-1===r.indexOf(runtime.currentDirectory())&&f(runtime.currentDirectory(),l,!0);for(b=0;b<r.length;b+=1)f(r[b],l)}h=l;a=k(a,h,c);if(0===a.length)return q&&q();if("BrowserRuntime"===runtime.type()&&q){l=a;r=document.currentScript||document.documentElement.lastChild;b=document.createDocumentFragment();var e,n;for(n=0;n<l.length;n+=1)e=document.createElement("script"),e.type= +"text/javascript",e.charset="utf-8",e.async=!1,e.setAttribute("src",l[n]),b.appendChild(e);q&&(e.onload=q);r.parentNode.insertBefore(b,r)}else d(a),q&&q()};runtime.loadClass=function(a,d){runtime.loadClasses([a],d)}})();(function(){var f=function(f){return f};runtime.getTranslator=function(){return f};runtime.setTranslator=function(k){f=k};runtime.tr=function(k){var a=f(k);return a&&"string"===String(typeof a)?a:k}})(); +(function(f){function k(a){if(a.length){var d=a[0];runtime.readFile(d,"utf8",function(c,h){function q(){var a;(a=eval(f))&&runtime.exit(a)}var p="",p=d.lastIndexOf("/"),f=h,p=-1!==p?d.substring(0,p):".";runtime.setCurrentDirectory(p);c?(runtime.log(c),runtime.exit(1)):null===f?(runtime.log("No code found for "+d),runtime.exit(1)):q.apply(null,a)})}}f=f?Array.prototype.slice.call(f):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(f):k(f.slice(1))})("undefined"!== +String(typeof arguments)&&arguments);(function(){core.Async=function(){return{forEach:function(f,k,a){function d(d){q!==h&&(d?(q=h,a(d)):(q+=1,q===h&&a(null)))}var c,h=f.length,q=0;for(c=0;c<h;c+=1)k(f[c],d)},destroyAll:function(f,k){function a(d,c){if(c)k(c);else if(d<f.length)f[d](function(c){a(d+1,c)});else k()}a(0,void 0)}}}()})();function makeBase64(){function f(b){var g,n=b.length,e=new Uint8Array(new ArrayBuffer(n));for(g=0;g<n;g+=1)e[g]=b.charCodeAt(g)&255;return e}function k(g){var b,n="",e,a=g.length-2;for(e=0;e<a;e+=3)b=g[e]<<16|g[e+1]<<8|g[e+2],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>18],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>12&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b& +63];e===a+1?(b=g[e]<<4,n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b&63],n+="=="):e===a&&(b=g[e]<<10|g[e+1]<<2,n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>12],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b&63],n+="=");return n}function a(b){b=b.replace(/[^A-Za-z0-9+\/]+/g, +"");var n=b.length,e=new Uint8Array(new ArrayBuffer(3*n)),a=b.length%4,d=0,c,J;for(c=0;c<n;c+=4)J=(g[b.charAt(c)]||0)<<18|(g[b.charAt(c+1)]||0)<<12|(g[b.charAt(c+2)]||0)<<6|(g[b.charAt(c+3)]||0),e[d]=J>>16,e[d+1]=J>>8&255,e[d+2]=J&255,d+=3;n=3*n-[0,0,2,1][a];return e.subarray(0,n)}function d(b){var g,n,e=b.length,a=0,d=new Uint8Array(new ArrayBuffer(3*e));for(g=0;g<e;g+=1)n=b[g],128>n?d[a++]=n:(2048>n?d[a++]=192|n>>>6:(d[a++]=224|n>>>12&15,d[a++]=128|n>>>6&63),d[a++]=128|n&63);return d.subarray(0, +a)}function c(b){var g,n,e,a,d=b.length,c=new Uint8Array(new ArrayBuffer(d)),h=0;for(g=0;g<d;g+=1)n=b[g],128>n?c[h++]=n:(g+=1,e=b[g],224>n?c[h++]=(n&31)<<6|e&63:(g+=1,a=b[g],c[h++]=(n&15)<<12|(e&63)<<6|a&63));return c.subarray(0,h)}function h(b){return k(f(b))}function q(b){return String.fromCharCode.apply(String,a(b))}function p(b){return c(f(b))}function m(b){b=c(b);for(var g="",n=0;n<b.length;)g+=String.fromCharCode.apply(String,b.subarray(n,n+45E3)),n+=45E3;return g}function l(b,g,n){var e,a, +d,c="";for(d=g;d<n;d+=1)g=b.charCodeAt(d)&255,128>g?c+=String.fromCharCode(g):(d+=1,e=b.charCodeAt(d)&255,224>g?c+=String.fromCharCode((g&31)<<6|e&63):(d+=1,a=b.charCodeAt(d)&255,c+=String.fromCharCode((g&15)<<12|(e&63)<<6|a&63)));return c}function r(b,g){function n(){var d=a+1E5;d>b.length&&(d=b.length);e+=l(b,a,d);a=d;d=a===b.length;g(e,d)&&!d&&runtime.setTimeout(n,0)}var e="",a=0;1E5>b.length?g(l(b,0,b.length),!0):("string"!==typeof b&&(b=b.slice()),n())}function b(b){return d(f(b))}function e(b){return String.fromCharCode.apply(String, +d(b))}function n(b){return String.fromCharCode.apply(String,d(f(b)))}var g=function(b){var g={},n,e;n=0;for(e=b.length;n<e;n+=1)g[b.charAt(n)]=n;return g}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),u,t,y=runtime.getWindow(),v,s;y&&y.btoa?(v=y.btoa,u=function(b){return v(n(b))}):(v=h,u=function(g){return k(b(g))});y&&y.atob?(s=y.atob,t=function(b){b=s(b);return l(b,0,b.length)}):(s=q,t=function(b){return m(a(b))});core.Base64=function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64= +k;this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=a;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=d;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=c;this.convertUTF8StringToBase64=h;this.convertBase64ToUTF8String=q;this.convertUTF8StringToUTF16Array=p;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=m;this.convertUTF8StringToUTF16String=r;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=b;this.convertUTF16ArrayToUTF8String= +e;this.convertUTF16StringToUTF8String=n;this.convertUTF16StringToBase64=u;this.convertBase64ToUTF16String=t;this.fromBase64=q;this.toBase64=h;this.atob=s;this.btoa=v;this.utob=n;this.btou=r;this.encode=u;this.encodeURI=function(b){return u(b).replace(/[+\/]/g,function(b){return"+"===b?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(b){return t(b.replace(/[\-_]/g,function(b){return"-"===b?"+":"/"}))};return this};return core.Base64}core.Base64=makeBase64();core.ByteArray=function(f){this.pos=0;this.data=f;this.readUInt32LE=function(){this.pos+=4;var f=this.data,a=this.pos;return f[--a]<<24|f[--a]<<16|f[--a]<<8|f[--a]};this.readUInt16LE=function(){this.pos+=2;var f=this.data,a=this.pos;return f[--a]<<8|f[--a]}};core.ByteArrayWriter=function(f){function k(a){a>c-d&&(c=Math.max(2*c,d+a),a=new Uint8Array(new ArrayBuffer(c)),a.set(h),h=a)}var a=this,d=0,c=1024,h=new Uint8Array(new ArrayBuffer(c));this.appendByteArrayWriter=function(d){a.appendByteArray(d.getByteArray())};this.appendByteArray=function(a){var c=a.length;k(c);h.set(a,d);d+=c};this.appendArray=function(a){var c=a.length;k(c);h.set(a,d);d+=c};this.appendUInt16LE=function(d){a.appendArray([d&255,d>>8&255])};this.appendUInt32LE=function(d){a.appendArray([d& +255,d>>8&255,d>>16&255,d>>24&255])};this.appendString=function(d){a.appendByteArray(runtime.byteArrayFromString(d,f))};this.getLength=function(){return d};this.getByteArray=function(){var a=new Uint8Array(new ArrayBuffer(d));a.set(h.subarray(0,d));return a}};core.CSSUnits=function(){var f=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(a,d,c){return a*k[c]/k[d]};this.convertMeasure=function(a,d){var c,h;a&&d&&(c=parseFloat(a),h=a.replace(c.toString(),""),c=f.convert(c,h,d));return c};this.getUnits=function(a){return a.substr(a.length-2,a.length)}};(function(){function f(){var d,c,h,f,p,k,l,r,b;void 0===a&&(c=(d=runtime.getWindow())&&d.document,k=c.documentElement,l=c.body,a={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},c&&(f=c.createElement("div"),f.style.position="absolute",f.style.left="-99999px",f.style.transform="scale(2)",f.style["-webkit-transform"]="scale(2)",p=c.createElement("div"),f.appendChild(p),l.appendChild(f),d=c.createRange(),d.selectNode(p),a.rangeBCRIgnoresElementBCR=0===d.getClientRects().length, +p.appendChild(c.createTextNode("Rect transform test")),c=p.getBoundingClientRect(),h=d.getBoundingClientRect(),a.unscaledRangeClientRects=2<Math.abs(c.height-h.height),f.style.transform="",f.style["-webkit-transform"]="",c=k.style.overflow,h=l.style.overflow,r=l.style.height,b=l.scrollTop,k.style.overflow="visible",l.style.overflow="visible",l.style.height="200%",l.scrollTop=l.scrollHeight,a.elementBCRIgnoresBodyScroll=d.getBoundingClientRect().top!==p.getBoundingClientRect().top,l.scrollTop=b,l.style.height= +r,l.style.overflow=h,k.style.overflow=c,d.detach(),l.removeChild(f),d=Object.keys(a).map(function(b){return b+":"+String(a[b])}).join(", "),runtime.log("Detected browser quirks - "+d)));return a}function k(a,c,h){for(a=a?a.firstElementChild:null;a;){if(a.localName===h&&a.namespaceURI===c)return a;a=a.nextElementSibling}return null}var a;core.DomUtilsImpl=function(){function a(b,g){for(var e=0,d;b.parentNode!==g;)runtime.assert(null!==b.parentNode,"parent is null"),b=b.parentNode;for(d=g.firstChild;d!== +b;)e+=1,d=d.nextSibling;return e}function c(b,g){return 0>=b.compareBoundaryPoints(Range.START_TO_START,g)&&0<=b.compareBoundaryPoints(Range.END_TO_END,g)}function h(b,g){return 0>=b.compareBoundaryPoints(Range.END_TO_START,g)&&0<=b.compareBoundaryPoints(Range.START_TO_END,g)}function q(b,g){var e=null;b.nodeType===Node.TEXT_NODE&&(0===b.length?(b.parentNode.removeChild(b),g.nodeType===Node.TEXT_NODE&&(e=g)):(g.nodeType===Node.TEXT_NODE&&(b.appendData(g.data),g.parentNode.removeChild(g)),e=b));return e} +function p(b){for(var g=b.parentNode;b.firstChild;)g.insertBefore(b.firstChild,b);g.removeChild(b);return g}function m(b,g){for(var e=b.parentNode,a=b.firstChild,d;a;)d=a.nextSibling,m(a,g),a=d;e&&g(b)&&p(b);return e}function l(b,g){return b===g||Boolean(b.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function r(b,g){return f().unscaledRangeClientRects?b:b/g}function b(n,g,e){Object.keys(g).forEach(function(a){var d=a.split(":"),c=d[1],h=e(d[0]),d=g[a],f=typeof d;"object"===f?Object.keys(d).length&& +(a=h?n.getElementsByTagNameNS(h,c)[0]||n.ownerDocument.createElementNS(h,a):n.getElementsByTagName(c)[0]||n.ownerDocument.createElement(a),n.appendChild(a),b(a,d,e)):h&&(runtime.assert("number"===f||"string"===f,"attempting to map unsupported type '"+f+"' (key: "+a+")"),n.setAttributeNS(h,a,String(d)))})}var e=null;this.splitBoundaries=function(b){var g,e=[],c,h,f;if(b.startContainer.nodeType===Node.TEXT_NODE||b.endContainer.nodeType===Node.TEXT_NODE){c=b.endContainer;h=b.endContainer.nodeType!== +Node.TEXT_NODE?b.endOffset===b.endContainer.childNodes.length:!1;f=b.endOffset;g=b.endContainer;if(f<g.childNodes.length)for(g=g.childNodes.item(f),f=0;g.firstChild;)g=g.firstChild;else for(;g.lastChild;)g=g.lastChild,f=g.nodeType===Node.TEXT_NODE?g.textContent.length:g.childNodes.length;g===c&&(c=null);b.setEnd(g,f);f=b.endContainer;0!==b.endOffset&&f.nodeType===Node.TEXT_NODE&&(g=f,b.endOffset!==g.length&&(e.push(g.splitText(b.endOffset)),e.push(g)));f=b.startContainer;0!==b.startOffset&&f.nodeType=== +Node.TEXT_NODE&&(g=f,b.startOffset!==g.length&&(f=g.splitText(b.startOffset),e.push(g),e.push(f),b.setStart(f,0)));if(null!==c){for(f=b.endContainer;f.parentNode&&f.parentNode!==c;)f=f.parentNode;h=h?c.childNodes.length:a(f,c);b.setEnd(c,h)}}return e};this.containsRange=c;this.rangesIntersect=h;this.rangeIntersection=function(b,g){var e;h(b,g)&&(e=b.cloneRange(),-1===b.compareBoundaryPoints(Range.START_TO_START,g)&&e.setStart(g.startContainer,g.startOffset),1===b.compareBoundaryPoints(Range.END_TO_END, +g)&&e.setEnd(g.endContainer,g.endOffset));return e};this.getNodesInRange=function(b,g,e){var a=[],d=b.commonAncestorContainer,d=d.nodeType===Node.TEXT_NODE?d.parentNode:d;e=b.startContainer.ownerDocument.createTreeWalker(d,e,g,!1);var c,h;b.endContainer.childNodes[b.endOffset-1]?(c=b.endContainer.childNodes[b.endOffset-1],h=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(c=b.endContainer,h=Node.DOCUMENT_POSITION_PRECEDING);b.startContainer.childNodes[b.startOffset]?(b=b.startContainer.childNodes[b.startOffset], +e.currentNode=b):b.startOffset===(b.startContainer.nodeType===Node.TEXT_NODE?b.startContainer.length:b.startContainer.childNodes.length)?(b=b.startContainer,e.currentNode=b,e.lastChild(),b=e.nextNode()):(b=b.startContainer,e.currentNode=b);if(b){b=e.currentNode;if(b!==d)for(b=b.parentNode;b&&b!==d;)g(b)===NodeFilter.FILTER_REJECT&&(e.currentNode=b),b=b.parentNode;b=e.currentNode;switch(g(b)){case NodeFilter.FILTER_REJECT:for(b=e.nextSibling();!b&&e.parentNode();)b=e.nextSibling();break;case NodeFilter.FILTER_SKIP:b= +e.nextNode()}for(;b;){g=c.compareDocumentPosition(b);if(0!==g&&0===(g&h))break;a.push(b);b=e.nextNode()}}return a};this.normalizeTextNodes=function(b){b&&b.nextSibling&&(b=q(b,b.nextSibling));b&&b.previousSibling&&q(b.previousSibling,b)};this.rangeContainsNode=function(b,g){var e=g.ownerDocument.createRange(),a=g.ownerDocument.createRange(),d;e.setStart(b.startContainer,b.startOffset);e.setEnd(b.endContainer,b.endOffset);a.selectNodeContents(g);d=c(e,a);e.detach();a.detach();return d};this.mergeIntoParent= +p;this.removeUnwantedNodes=m;this.getElementsByTagNameNS=function(b,g,e){var a=[];b=b.getElementsByTagNameNS(g,e);a.length=e=b.length;for(g=0;g<e;g+=1)a[g]=b.item(g);return a};this.getElementsByTagName=function(b,g){var e=[],a,d,c;a=b.getElementsByTagName(g);e.length=c=a.length;for(d=0;d<c;d+=1)e[d]=a.item(d);return e};this.containsNode=function(b,g){return b===g||b.contains(g)};this.comparePoints=function(b,g,e,c){if(b===e)return c-g;var h=b.compareDocumentPosition(e);2===h?h=-1:4===h?h=1:10===h? +(g=a(b,e),h=g<c?1:-1):(c=a(e,b),h=c<g?-1:1);return h};this.adaptRangeDifferenceToZoomLevel=r;this.translateRect=function(b,g,e){return{top:r(b.top-g.top,e),left:r(b.left-g.left,e),bottom:r(b.bottom-g.top,e),right:r(b.right-g.left,e),width:r(b.width,e),height:r(b.height,e)}};this.getBoundingClientRect=function(b){var g=b.ownerDocument,a=f(),d=g.body;if((!1===a.unscaledRangeClientRects||a.rangeBCRIgnoresElementBCR)&&b.nodeType===Node.ELEMENT_NODE)return b=b.getBoundingClientRect(),a.elementBCRIgnoresBodyScroll? +{left:b.left+d.scrollLeft,right:b.right+d.scrollLeft,top:b.top+d.scrollTop,bottom:b.bottom+d.scrollTop,width:b.width,height:b.height}:b;var c;e?c=e:e=c=g.createRange();a=c;a.selectNode(b);return a.getBoundingClientRect()};this.mapKeyValObjOntoNode=function(b,g,e){Object.keys(g).forEach(function(a){var d=a.split(":"),c=d[1],d=e(d[0]),h=g[a];d?(c=b.getElementsByTagNameNS(d,c)[0],c||(c=b.ownerDocument.createElementNS(d,a),b.appendChild(c)),c.textContent=h):runtime.log("Key ignored: "+a)})};this.removeKeyElementsFromNode= +function(b,g,e){g.forEach(function(g){var a=g.split(":"),d=a[1];(a=e(a[0]))?(d=b.getElementsByTagNameNS(a,d)[0])?d.parentNode.removeChild(d):runtime.log("Element for "+g+" not found."):runtime.log("Property Name ignored: "+g)})};this.getKeyValRepresentationOfNode=function(b,g){for(var e={},a=b.firstElementChild,d;a;){if(d=g(a.namespaceURI))e[d+":"+a.localName]=a.textContent;a=a.nextElementSibling}return e};this.mapObjOntoNode=b;this.cloneEvent=function(b){var g=Object.create(null);Object.keys(b).forEach(function(e){g[e]= +b[e]});g.prototype=b.constructor.prototype;return g};this.getDirectChild=k;(function(b){var g,e;e=runtime.getWindow();null!==e&&(g=e.navigator.appVersion.toLowerCase(),e=-1===g.indexOf("chrome")&&(-1!==g.indexOf("applewebkit")||-1!==g.indexOf("safari")),g=-1!==g.indexOf("msie")||-1!==g.indexOf("trident"),e||g)&&(b.containsNode=l)})(this)};core.DomUtils=new core.DomUtilsImpl})();core.Cursor=function(f,k){function a(b){b.parentNode&&(p.push(b.previousSibling),p.push(b.nextSibling),b.parentNode.removeChild(b))}function d(b,e,a){if(e.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(e),"putCursorIntoTextNode: invalid container");var g=e.parentNode;runtime.assert(Boolean(g),"putCursorIntoTextNode: container without parent");runtime.assert(0<=a&&a<=e.length,"putCursorIntoTextNode: offset is out of bounds");0===a?g.insertBefore(b,e):(a!==e.length&&e.splitText(a),g.insertBefore(b, +e.nextSibling))}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(b,e.childNodes.item(a));p.push(b.previousSibling);p.push(b.nextSibling)}var c=f.createElementNS("urn:webodf:names:cursor","cursor"),h=f.createElementNS("urn:webodf:names:cursor","anchor"),q,p=[],m=f.createRange(),l,r=core.DomUtils;this.getNode=function(){return c};this.getAnchorNode=function(){return h.parentNode?h:c};this.getSelectedRange=function(){l?(m.setStartBefore(c),m.collapse(!0)):(m.setStartAfter(q?h:c),m.setEndBefore(q? +c:h));return m};this.setSelectedRange=function(b,e){m&&m!==b&&m.detach();m=b;q=!1!==e;(l=b.collapsed)?(a(h),a(c),d(c,b.startContainer,b.startOffset)):(a(h),a(c),d(q?c:h,b.endContainer,b.endOffset),d(q?h:c,b.startContainer,b.startOffset));p.forEach(r.normalizeTextNodes);p.length=0};this.hasForwardSelection=function(){return q};this.remove=function(){a(c);p.forEach(r.normalizeTextNodes);p.length=0};c.setAttributeNS("urn:webodf:names:cursor","memberId",k);h.setAttributeNS("urn:webodf:names:cursor","memberId", +k)};core.Destroyable=function(){};core.Destroyable.prototype.destroy=function(f){};core.EventSource=function(){};core.EventSource.prototype.subscribe=function(f,k){};core.EventSource.prototype.unsubscribe=function(f,k){};core.EventNotifier=function(f){function k(d){runtime.assert(!a.hasOwnProperty(d),'Duplicated event ids: "'+d+'" registered more than once.');a[d]=[]}var a={};this.emit=function(d,c){var h,f;runtime.assert(a.hasOwnProperty(d),'unknown event fired "'+d+'"');f=a[d];for(h=0;h<f.length;h+=1)f[h](c)};this.subscribe=function(d,c){runtime.assert(a.hasOwnProperty(d),'tried to subscribe to unknown event "'+d+'"');a[d].push(c)};this.unsubscribe=function(d,c){var h;runtime.assert(a.hasOwnProperty(d),'tried to unsubscribe from unknown event "'+ +d+'"');h=a[d].indexOf(c);runtime.assert(-1!==h,'tried to unsubscribe unknown callback from event "'+d+'"');-1!==h&&a[d].splice(h,1)};this.register=k;f&&f.forEach(k)};core.ScheduledTask=function(f,k,a){function d(){q&&(a(h),q=!1)}function c(){d();f.apply(void 0,p);p=null}var h,q=!1,p=[],m=!1;this.trigger=function(){runtime.assert(!1===m,"Can't trigger destroyed ScheduledTask instance");p=Array.prototype.slice.call(arguments);q||(q=!0,h=k(c))};this.triggerImmediate=function(){runtime.assert(!1===m,"Can't trigger destroyed ScheduledTask instance");p=Array.prototype.slice.call(arguments);c()};this.processRequests=function(){q&&c()};this.cancel=d;this.restart=function(){runtime.assert(!1=== +m,"Can't trigger destroyed ScheduledTask instance");d();q=!0;h=k(c)};this.destroy=function(a){d();m=!0;a()}};(function(){var f;core.Task={};core.Task.SUPPRESS_MANUAL_PROCESSING=!1;core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||f.performRedraw()};core.Task.createRedrawTask=function(k){return new core.ScheduledTask(k,f.requestRedrawTask,f.cancelRedrawTask)};core.Task.createTimeoutTask=function(f,a){return new core.ScheduledTask(f,function(d){return runtime.setTimeout(d,a)},runtime.clearTimeout)};f=new function(){var f={};this.requestRedrawTask=function(a){var d=runtime.requestAnimationFrame(function(){a(); +delete f[d]});f[d]=a;return d};this.performRedraw=function(){Object.keys(f).forEach(function(a){f[a]();runtime.cancelAnimationFrame(parseInt(a,10))});f={}};this.cancelRedrawTask=function(a){runtime.cancelAnimationFrame(a);delete f[a]}}})();core.EventSubscriptions=function(){function f(d,c,h){d.subscribe(c,h);a.push({eventSource:d,eventid:c,callback:h})}function k(){var h=[];a.forEach(function(a){a.eventSource.unsubscribe(a.eventid,a.callback)});a.length=0;Object.keys(c).forEach(function(a){c[a].forEach(function(a){h.push(a.task.destroy)});delete c[a]});core.Async.destroyAll(h,function(){});d=new core.EventNotifier}var a=[],d=new core.EventNotifier,c={},h=0;this.addSubscription=f;this.addFrameSubscription=function(a,p,k){var l,r,b,e; +c.hasOwnProperty(p)||(c[p]=[]);b=c[p];for(e=0;e<b.length;e+=1)if(b[e].eventSource===a){l=b[e];break}l||(r="s"+h,h+=1,d.register(r),l={frameEventId:r,eventSource:a,task:core.Task.createRedrawTask(function(){d.emit(r,void 0)})},b.push(l),f(a,p,l.task.trigger));d.subscribe(l.frameEventId,k)};this.unsubscribeAll=k;this.destroy=function(a){k();a()}};core.LazyProperty=function(f){var k,a=!1;this.value=function(){a||(k=f(),a=!0);return k};this.reset=function(){a=!1}};core.LoopWatchDog=function(f,k){var a=Date.now(),d=0;this.check=function(){var c;if(f&&(c=Date.now(),c-a>f))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(d+=1,d>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.NodeFilterChain=function(f){var k=NodeFilter.FILTER_REJECT,a=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(d){var c;for(c=0;c<f.length;c+=1)if(f[c].acceptNode(d)===k)return k;return a}};core.PositionIterator=function(f,k,a,d){function c(){this.acceptNode=function(b){return!b||b.nodeType===n&&0===b.length?t:u}}function h(b){this.acceptNode=function(e){return!e||e.nodeType===n&&0===e.length?t:b.acceptNode(e)}}function q(){var e=r.currentNode,a=e.nodeType;b=a===n?e.length-1:a===g?1:0}function p(){if(null===r.previousSibling()){if(!r.parentNode()||r.currentNode===f)return r.firstChild(),!1;b=0}else q();return!0}function m(){var g=r.currentNode,a;a=e(g);if(g!==f)for(g=g.parentNode;g&& +g!==f;)e(g)===t&&(r.currentNode=g,a=t),g=g.parentNode;a===t?(b=r.currentNode.nodeType===n?g.length:1,g=l.nextPosition()):g=a===u?!0:l.nextPosition();g&&runtime.assert(e(r.currentNode)===u,"moveToAcceptedNode did not result in walker being on an accepted node");return g}var l=this,r,b,e,n=Node.TEXT_NODE,g=Node.ELEMENT_NODE,u=NodeFilter.FILTER_ACCEPT,t=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var e=r.currentNode,a=e.nodeType;if(e===f)return!1;if(0===b&&a===g)null===r.firstChild()&&(b=1); +else if(a===n&&b+1<e.length)b+=1;else if(null!==r.nextSibling())b=0;else if(r.parentNode())b=1;else return!1;return!0};this.previousPosition=function(){var g=!0,e=r.currentNode;0===b?g=p():e.nodeType===n?b-=1:null!==r.lastChild()?q():e===f?g=!1:b=0;return g};this.previousNode=p;this.container=function(){var g=r.currentNode,e=g.nodeType;0===b&&e!==n&&(g=g.parentNode);return g};this.rightNode=function(){var a=r.currentNode,d=a.nodeType;if(d===n&&b===a.length)for(a=a.nextSibling;a&&e(a)!==u;)a=a.nextSibling; +else d===g&&1===b&&(a=null);return a};this.leftNode=function(){var a=r.currentNode;if(0===b)for(a=a.previousSibling;a&&e(a)!==u;)a=a.previousSibling;else if(a.nodeType===g)for(a=a.lastChild;a&&e(a)!==u;)a=a.previousSibling;return a};this.getCurrentNode=function(){return r.currentNode};this.unfilteredDomOffset=function(){if(r.currentNode.nodeType===n)return b;for(var g=0,e=r.currentNode,e=1===b?e.lastChild:e.previousSibling;e;)g+=1,e=e.previousSibling;return g};this.getPreviousSibling=function(){var b= +r.currentNode,g=r.previousSibling();r.currentNode=b;return g};this.getNextSibling=function(){var b=r.currentNode,g=r.nextSibling();r.currentNode=b;return g};this.setPositionBeforeElement=function(g){runtime.assert(Boolean(g),"setPositionBeforeElement called without element");r.currentNode=g;b=0;return m()};this.setUnfilteredPosition=function(g,e){runtime.assert(Boolean(g),"PositionIterator.setUnfilteredPosition called without container");r.currentNode=g;g.nodeType===n?(b=e,runtime.assert(e<=g.length, +"Error in setPosition: "+e+" > "+g.length),runtime.assert(0<=e,"Error in setPosition: "+e+" < 0"),e===g.length&&(r.nextSibling()?b=0:r.parentNode()?b=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):e<g.childNodes.length?(r.currentNode=g.childNodes.item(e),b=0):b=1;return m()};this.moveToEnd=function(){r.currentNode=f;b=1};this.moveToEndOfNode=function(g){g.nodeType===n?l.setUnfilteredPosition(g,g.length):(r.currentNode=g,b=1)};this.isBeforeNode=function(){return 0===b}; +this.getNodeFilter=function(){return e};e=(a?new h(a):new c).acceptNode;e.acceptNode=e;k=k||NodeFilter.SHOW_ALL;runtime.assert(f.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes");r=f.ownerDocument.createTreeWalker(f,k,e,d);b=0;null===r.firstChild()&&(b=1)};core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(f){};core.PositionFilterChain=function(){var f=[],k=core.PositionFilter.FilterResult.FILTER_ACCEPT,a=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(d){var c;for(c=0;c<f.length;c+=1)if(f[c].acceptPosition(d)===a)return a;return k};this.addFilter=function(a){f.push(a)}};(function(){core.RawInflate=function(){var f;(function(k){f=k()})(function(){return function a(d,c,h){function f(p,l){if(!c[p]){if(!d[p])throw Error("Cannot find module '"+p+"'");var r=c[p]={exports:{}};d[p][0].call(r.exports,function(b){var e=d[p][1][b];return f(e?e:b)},r,r.exports,a,d,c,h)}return c[p].exports}for(var p=0;p<h.length;p++)f(h[p]);return f}({1:[function(a,d,c){function h(b,e){var a=new n(e);a.push(b,!0);if(a.err)throw a.msg;return a.result}var f=a("./zlib/inflate.js"),p=a("./utils/common"), +m=a("./utils/strings"),l=a("./zlib/constants"),r=a("./zlib/messages"),b=a("./zlib/zstream"),e=a("./zlib/gzheader"),n=function(g){var a=this.options=p.assign({chunkSize:16384,windowBits:0,to:""},g||{});a.raw&&0<=a.windowBits&&16>a.windowBits&&(a.windowBits=-a.windowBits,0===a.windowBits&&(a.windowBits=-15));!(0<=a.windowBits&&16>a.windowBits)||g&&g.windowBits||(a.windowBits+=32);15<a.windowBits&&48>a.windowBits&&0===(a.windowBits&15)&&(a.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks= +[];this.strm=new b;this.strm.avail_out=0;g=f.inflateInit2(this.strm,a.windowBits);if(g!==l.Z_OK)throw Error(r[g]);this.header=new e;f.inflateGetHeader(this.strm,this.header)};n.prototype.push=function(b,e){var a=this.strm,d=this.options.chunkSize,n,c,h,r,B;if(this.ended)return!1;c=e===~~e?e:!0===e?l.Z_FINISH:l.Z_NO_FLUSH;a.input="string"===typeof b?m.binstring2buf(b):b;a.next_in=0;a.avail_in=a.input.length;do{0===a.avail_out&&(a.output=new p.Buf8(d),a.next_out=0,a.avail_out=d);n=f.inflate(a,l.Z_NO_FLUSH); +if(n!==l.Z_STREAM_END&&n!==l.Z_OK)return this.onEnd(n),this.ended=!0,!1;if(a.next_out&&(0===a.avail_out||n===l.Z_STREAM_END||0===a.avail_in&&c===l.Z_FINISH))if("string"===this.options.to)h=m.utf8border(a.output,a.next_out),r=a.next_out-h,B=m.buf2string(a.output,h),a.next_out=r,a.avail_out=d-r,r&&p.arraySet(a.output,a.output,h,r,0),this.onData(B);else this.onData(p.shrinkBuf(a.output,a.next_out))}while((0<a.avail_in||0===a.avail_out)&&n!==l.Z_STREAM_END);n===l.Z_STREAM_END&&(c=l.Z_FINISH);return c=== +l.Z_FINISH?(n=f.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===l.Z_OK):!0};n.prototype.onData=function(b){this.chunks.push(b)};n.prototype.onEnd=function(b){b===l.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):p.flattenChunks(this.chunks));this.chunks=[];this.err=b;this.msg=this.strm.msg};c.Inflate=n;c.inflate=h;c.inflateRaw=function(b,a){a=a||{};a.raw=!0;return h(b,a)};c.ungzip=h},{"./utils/common":2,"./utils/strings":3,"./zlib/constants":5,"./zlib/gzheader":7,"./zlib/inflate.js":9, +"./zlib/messages":11,"./zlib/zstream":12}],2:[function(a,d,c){a="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;c.assign=function(a){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var c=d.shift();if(c){if("object"!==typeof c)throw new TypeError(c+"must be non-object");for(var h in c)c.hasOwnProperty(h)&&(a[h]=c[h])}}return a};c.shrinkBuf=function(a,d){if(a.length===d)return a;if(a.subarray)return a.subarray(0,d);a.length=d;return a}; +var h={arraySet:function(a,d,c,h,b){if(d.subarray&&a.subarray)a.set(d.subarray(c,c+h),b);else for(var e=0;e<h;e++)a[b+e]=d[c+e]},flattenChunks:function(a){var d,c,h,b,e;d=h=0;for(c=a.length;d<c;d++)h+=a[d].length;e=new Uint8Array(h);d=h=0;for(c=a.length;d<c;d++)b=a[d],e.set(b,h),h+=b.length;return e}},f={arraySet:function(a,d,c,h,b){for(var e=0;e<h;e++)a[b+e]=d[c+e]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array, +c.assign(c,h)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))};c.setTyped(a)},{}],3:[function(a,d,c){function h(b,a){if(65537>a&&(b.subarray&&m||!b.subarray&&p))return String.fromCharCode.apply(null,f.shrinkBuf(b,a));for(var g="",d=0;d<a;d++)g+=String.fromCharCode(b[d]);return g}var f=a("./common"),p=!0,m=!0;try{String.fromCharCode.apply(null,[0])}catch(l){p=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){m=!1}var b=new f.Buf8(256);for(a=0;256>a;a++)b[a]=252<=a?6:248<= +a?5:240<=a?4:224<=a?3:192<=a?2:1;b[254]=b[254]=1;c.string2buf=function(b){var a,g,d,c,h,r=b.length,p=0;for(c=0;c<r;c++)g=b.charCodeAt(c),55296===(g&64512)&&c+1<r&&(d=b.charCodeAt(c+1),56320===(d&64512)&&(g=65536+(g-55296<<10)+(d-56320),c++)),p+=128>g?1:2048>g?2:65536>g?3:4;a=new f.Buf8(p);for(c=h=0;h<p;c++)g=b.charCodeAt(c),55296===(g&64512)&&c+1<r&&(d=b.charCodeAt(c+1),56320===(d&64512)&&(g=65536+(g-55296<<10)+(d-56320),c++)),128>g?a[h++]=g:(2048>g?a[h++]=192|g>>>6:(65536>g?a[h++]=224|g>>>12:(a[h++]= +240|g>>>18,a[h++]=128|g>>>12&63),a[h++]=128|g>>>6&63),a[h++]=128|g&63);return a};c.buf2binstring=function(b){return h(b,b.length)};c.binstring2buf=function(b){for(var a=new f.Buf8(b.length),g=0,d=a.length;g<d;g++)a[g]=b.charCodeAt(g);return a};c.buf2string=function(a,d){var g,c,f,r,p=d||a.length,q=Array(2*p);for(g=c=0;g<p;)if(f=a[g++],128>f)q[c++]=f;else if(r=b[f],4<r)q[c++]=65533,g+=r-1;else{for(f&=2===r?31:3===r?15:7;1<r&&g<p;)f=f<<6|a[g++]&63,r--;1<r?q[c++]=65533:65536>f?q[c++]=f:(f-=65536,q[c++]= +55296|f>>10&1023,q[c++]=56320|f&1023)}return h(q,c)};c.utf8border=function(a,d){var g;d=d||a.length;d>a.length&&(d=a.length);for(g=d-1;0<=g&&128===(a[g]&192);)g--;return 0>g||0===g?d:g+b[a[g]]>d?g:d}},{"./common":2}],4:[function(a,d,c){d.exports=function(a,d,c,f){var l=a&65535|0;a=a>>>16&65535|0;for(var r=0;0!==c;){r=2E3<c?2E3:c;c-=r;do l=l+d[f++]|0,a=a+l|0;while(--r);l%=65521;a%=65521}return l|a<<16|0}},{}],5:[function(a,d,c){d.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3, +Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],6:[function(a,d,c){var h=function(){for(var a,d=[],c=0;256>c;c++){a=c;for(var h=0;8>h;h++)a=a&1?3988292384^a>>>1:a>>>1;d[c]=a}return d}();d.exports=function(a,d,c,f){c=f+c;for(a^= +-1;f<c;f++)a=a>>>8^h[(a^d[f])&255];return a^-1}},{}],7:[function(a,d,c){d.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(a,d,c){d.exports=function(a,d){var c,f,l,r,b,e,n,g,u,t,y,v,s,x,w,B,I,C,F,J,N,K,H,z;c=a.state;f=a.next_in;H=a.input;l=f+(a.avail_in-5);r=a.next_out;z=a.output;b=r-(d-a.avail_out);e=r+(a.avail_out-257);n=c.dmax;g=c.wsize;u=c.whave;t=c.wnext;y=c.window;v=c.hold;s=c.bits; +x=c.lencode;w=c.distcode;B=(1<<c.lenbits)-1;I=(1<<c.distbits)-1;a:do b:for(15>s&&(v+=H[f++]<<s,s+=8,v+=H[f++]<<s,s+=8),C=x[v&B];;){F=C>>>24;v>>>=F;s-=F;F=C>>>16&255;if(0===F)z[r++]=C&65535;else if(F&16){J=C&65535;if(F&=15)s<F&&(v+=H[f++]<<s,s+=8),J+=v&(1<<F)-1,v>>>=F,s-=F;15>s&&(v+=H[f++]<<s,s+=8,v+=H[f++]<<s,s+=8);C=w[v&I];c:for(;;){F=C>>>24;v>>>=F;s-=F;F=C>>>16&255;if(F&16){C&=65535;F&=15;s<F&&(v+=H[f++]<<s,s+=8,s<F&&(v+=H[f++]<<s,s+=8));C+=v&(1<<F)-1;if(C>n){a.msg="invalid distance too far back"; +c.mode=30;break a}v>>>=F;s-=F;F=r-b;if(C>F){F=C-F;if(F>u&&c.sane){a.msg="invalid distance too far back";c.mode=30;break a}N=0;K=y;if(0===t){if(N+=g-F,F<J){J-=F;do z[r++]=y[N++];while(--F);N=r-C;K=z}}else if(t<F){if(N+=g+t-F,F-=t,F<J){J-=F;do z[r++]=y[N++];while(--F);N=0;if(t<J){F=t;J-=F;do z[r++]=y[N++];while(--F);N=r-C;K=z}}}else if(N+=t-F,F<J){J-=F;do z[r++]=y[N++];while(--F);N=r-C;K=z}for(;2<J;)z[r++]=K[N++],z[r++]=K[N++],z[r++]=K[N++],J-=3;J&&(z[r++]=K[N++],1<J&&(z[r++]=K[N++]))}else{N=r-C;do z[r++]= +z[N++],z[r++]=z[N++],z[r++]=z[N++],J-=3;while(2<J);J&&(z[r++]=z[N++],1<J&&(z[r++]=z[N++]))}}else if(0===(F&64)){C=w[(C&65535)+(v&(1<<F)-1)];continue c}else{a.msg="invalid distance code";c.mode=30;break a}break}}else if(0===(F&64)){C=x[(C&65535)+(v&(1<<F)-1)];continue b}else{F&32?c.mode=12:(a.msg="invalid literal/length code",c.mode=30);break a}break}while(f<l&&r<e);J=s>>3;f-=J;s-=J<<3;a.next_in=f;a.next_out=r;a.avail_in=f<l?5+(l-f):5-(f-l);a.avail_out=r<e?257+(e-r):257-(r-e);c.hold=v&(1<<s)-1;c.bits= +s}},{}],9:[function(a,d,c){function f(b){return(b>>>24&255)+(b>>>8&65280)+((b&65280)<<8)+((b&255)<<24)}function q(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new b.Buf16(320);this.work= +new b.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function p(a){var g;if(!a||!a.state)return y;g=a.state;a.total_in=a.total_out=g.total=0;a.msg="";g.wrap&&(a.adler=g.wrap&1);g.mode=v;g.last=0;g.havedict=0;g.dmax=32768;g.head=null;g.hold=0;g.bits=0;g.lencode=g.lendyn=new b.Buf32(s);g.distcode=g.distdyn=new b.Buf32(x);g.sane=1;g.back=-1;return t}function m(b){var a;if(!b||!b.state)return y;a=b.state;a.wsize=0;a.whave=0;a.wnext=0;return p(b)}function l(b,a){var g,e;if(!b|| +!b.state)return y;e=b.state;0>a?(g=0,a=-a):(g=(a>>4)+1,48>a&&(a&=15));if(a&&(8>a||15<a))return y;null!==e.window&&e.wbits!==a&&(e.window=null);e.wrap=g;e.wbits=a;return m(b)}function r(b,a){var g;if(!b)return y;g=new q;b.state=g;g.window=null;g=l(b,a);g!==t&&(b.state=null);return g}var b=a("../utils/common"),e=a("./adler32"),n=a("./crc32"),g=a("./inffast"),u=a("./inftrees"),t=0,y=-2,v=1,s=852,x=592,w=!0,B,I;c.inflateReset=m;c.inflateReset2=l;c.inflateResetKeep=p;c.inflateInit=function(b){return r(b, +15)};c.inflateInit2=r;c.inflate=function(a,d){var c,r,K,H,q,l,p,m,s,x,P,D,Q,$;D=0;var A,V,ba,Y,E,X=new b.Buf8(4),R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return y;c=a.state;12===c.mode&&(c.mode=13);q=a.next_out;K=a.output;p=a.avail_out;H=a.next_in;r=a.input;l=a.avail_in;m=c.hold;s=c.bits;x=l;P=p;E=t;a:for(;;)switch(c.mode){case v:if(0===c.wrap){c.mode=13;break}for(;16>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(c.wrap&2&&35615===m){c.check= +0;X[0]=m&255;X[1]=m>>>8&255;c.check=n(c.check,X,2,0);s=m=0;c.mode=2;break}c.flags=0;c.head&&(c.head.done=!1);if(!(c.wrap&1)||(((m&255)<<8)+(m>>8))%31){a.msg="incorrect header check";c.mode=30;break}if(8!==(m&15)){a.msg="unknown compression method";c.mode=30;break}m>>>=4;s-=4;Q=(m&15)+8;if(0===c.wbits)c.wbits=Q;else if(Q>c.wbits){a.msg="invalid window size";c.mode=30;break}c.dmax=1<<Q;a.adler=c.check=1;c.mode=m&512?10:12;s=m=0;break;case 2:for(;16>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.flags= +m;if(8!==(c.flags&255)){a.msg="unknown compression method";c.mode=30;break}if(c.flags&57344){a.msg="unknown header flags set";c.mode=30;break}c.head&&(c.head.text=m>>8&1);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=3;case 3:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.head&&(c.head.time=m);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,X[2]=m>>>16&255,X[3]=m>>>24&255,c.check=n(c.check,X,4,0));s=m=0;c.mode=4;case 4:for(;16>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+= +8}c.head&&(c.head.xflags=m&255,c.head.os=m>>8);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=5;case 5:if(c.flags&1024){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.length=m;c.head&&(c.head.extra_len=m);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(c.flags&1024&&(D=c.length,D>l&&(D=l),D&&(c.head&&(Q=c.head.extra_len-c.length,c.head.extra||(c.head.extra=Array(c.head.extra_len)),b.arraySet(c.head.extra, +r,H,D,Q)),c.flags&512&&(c.check=n(c.check,r,D,H)),l-=D,H+=D,c.length-=D),c.length))break a;c.length=0;c.mode=7;case 7:if(c.flags&2048){if(0===l)break a;D=0;do Q=r[H+D++],c.head&&Q&&65536>c.length&&(c.head.name+=String.fromCharCode(Q));while(Q&&D<l);c.flags&512&&(c.check=n(c.check,r,D,H));l-=D;H+=D;if(Q)break a}else c.head&&(c.head.name=null);c.length=0;c.mode=8;case 8:if(c.flags&4096){if(0===l)break a;D=0;do Q=r[H+D++],c.head&&Q&&65536>c.length&&(c.head.comment+=String.fromCharCode(Q));while(Q&&D< +l);c.flags&512&&(c.check=n(c.check,r,D,H));l-=D;H+=D;if(Q)break a}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(c.flags&512){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(m!==(c.check&65535)){a.msg="header crc mismatch";c.mode=30;break}s=m=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0);a.adler=c.check=0;c.mode=12;break;case 10:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}a.adler=c.check=f(m);s=m=0;c.mode=11;case 11:if(0===c.havedict)return a.next_out=q,a.avail_out=p,a.next_in= +H,a.avail_in=l,c.hold=m,c.bits=s,2;a.adler=c.check=1;c.mode=12;case 12:if(5===d||6===d)break a;case 13:if(c.last){m>>>=s&7;s-=s&7;c.mode=27;break}for(;3>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.last=m&1;m>>>=1;s-=1;switch(m&3){case 0:c.mode=14;break;case 1:D=c;if(w){Q=void 0;B=new b.Buf32(512);I=new b.Buf32(32);for(Q=0;144>Q;)D.lens[Q++]=8;for(;256>Q;)D.lens[Q++]=9;for(;280>Q;)D.lens[Q++]=7;for(;288>Q;)D.lens[Q++]=8;u(1,D.lens,0,288,B,0,D.work,{bits:9});for(Q=0;32>Q;)D.lens[Q++]=5;u(2,D.lens, +0,32,I,0,D.work,{bits:5});w=!1}D.lencode=B;D.lenbits=9;D.distcode=I;D.distbits=5;c.mode=20;if(6===d){m>>>=2;s-=2;break a}break;case 2:c.mode=17;break;case 3:a.msg="invalid block type",c.mode=30}m>>>=2;s-=2;break;case 14:m>>>=s&7;for(s-=s&7;32>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if((m&65535)!==(m>>>16^65535)){a.msg="invalid stored block lengths";c.mode=30;break}c.length=m&65535;s=m=0;c.mode=15;if(6===d)break a;case 15:c.mode=16;case 16:if(D=c.length){D>l&&(D=l);D>p&&(D=p);if(0===D)break a;b.arraySet(K, +r,H,D,q);l-=D;H+=D;p-=D;q+=D;c.length-=D;break}c.mode=12;break;case 17:for(;14>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.nlen=(m&31)+257;m>>>=5;s-=5;c.ndist=(m&31)+1;m>>>=5;s-=5;c.ncode=(m&15)+4;m>>>=4;s-=4;if(286<c.nlen||30<c.ndist){a.msg="too many length or distance symbols";c.mode=30;break}c.have=0;c.mode=18;case 18:for(;c.have<c.ncode;){for(;3>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.lens[R[c.have++]]=m&7;m>>>=3;s-=3}for(;19>c.have;)c.lens[R[c.have++]]=0;c.lencode=c.lendyn;c.lenbits=7; +D={bits:c.lenbits};E=u(0,c.lens,0,19,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid code lengths set";c.mode=30;break}c.have=0;c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;;){D=c.lencode[m&(1<<c.lenbits)-1];A=D>>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(16>ba)m>>>=A,s-=A,c.lens[c.have++]=ba;else{if(16===ba){for(D=A+2;s<D;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}m>>>=A;s-=A;if(0===c.have){a.msg="invalid bit length repeat";c.mode=30;break}Q= +c.lens[c.have-1];D=3+(m&3);m>>>=2;s-=2}else if(17===ba){for(D=A+3;s<D;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}m>>>=A;s-=A;Q=0;D=3+(m&7);m>>>=3;s-=3}else{for(D=A+7;s<D;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}m>>>=A;s-=A;Q=0;D=11+(m&127);m>>>=7;s-=7}if(c.have+D>c.nlen+c.ndist){a.msg="invalid bit length repeat";c.mode=30;break}for(;D--;)c.lens[c.have++]=Q}}if(30===c.mode)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block";c.mode=30;break}c.lenbits=9;D={bits:c.lenbits};E=u(1,c.lens, +0,c.nlen,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid literal/lengths set";c.mode=30;break}c.distbits=6;c.distcode=c.distdyn;D={bits:c.distbits};E=u(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,D);c.distbits=D.bits;if(E){a.msg="invalid distances set";c.mode=30;break}c.mode=20;if(6===d)break a;case 20:c.mode=21;case 21:if(6<=l&&258<=p){a.next_out=q;a.avail_out=p;a.next_in=H;a.avail_in=l;c.hold=m;c.bits=s;g(a,P);q=a.next_out;K=a.output;p=a.avail_out;H=a.next_in;r=a.input;l=a.avail_in; +m=c.hold;s=c.bits;12===c.mode&&(c.back=-1);break}for(c.back=0;;){D=c.lencode[m&(1<<c.lenbits)-1];A=D>>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(V&&0===(V&240)){Q=A;$=V;for(Y=ba;;){D=c.lencode[Y+((m&(1<<Q+$)-1)>>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<<s;s+=8}m>>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;c.length=ba;if(0===V){c.mode=26;break}if(V&32){c.back=-1;c.mode=12;break}if(V&64){a.msg="invalid literal/length code"; +c.mode=30;break}c.extra=V&15;c.mode=22;case 22:if(c.extra){for(D=c.extra;s<D;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.length+=m&(1<<c.extra)-1;m>>>=c.extra;s-=c.extra;c.back+=c.extra}c.was=c.length;c.mode=23;case 23:for(;;){D=c.distcode[m&(1<<c.distbits)-1];A=D>>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(0===(V&240)){Q=A;$=V;for(Y=ba;;){D=c.distcode[Y+((m&(1<<Q+$)-1)>>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<<s; +s+=8}m>>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;if(V&64){a.msg="invalid distance code";c.mode=30;break}c.offset=ba;c.extra=V&15;c.mode=24;case 24:if(c.extra){for(D=c.extra;s<D;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}c.offset+=m&(1<<c.extra)-1;m>>>=c.extra;s-=c.extra;c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back";c.mode=30;break}c.mode=25;case 25:if(0===p)break a;D=P-p;if(c.offset>D){D=c.offset-D;if(D>c.whave&&c.sane){a.msg="invalid distance too far back";c.mode=30;break}D> +c.wnext?(D-=c.wnext,Q=c.wsize-D):Q=c.wnext-D;D>c.length&&(D=c.length);$=c.window}else $=K,Q=q-c.offset,D=c.length;D>p&&(D=p);p-=D;c.length-=D;do K[q++]=$[Q++];while(--D);0===c.length&&(c.mode=21);break;case 26:if(0===p)break a;K[q++]=c.length;p--;c.mode=21;break;case 27:if(c.wrap){for(;32>s;){if(0===l)break a;l--;m|=r[H++]<<s;s+=8}P-=p;a.total_out+=P;c.total+=P;P&&(a.adler=c.check=c.flags?n(c.check,K,P,q-P):e(c.check,K,P,q-P));P=p;if((c.flags?m:f(m))!==c.check){a.msg="incorrect data check";c.mode= +30;break}s=m=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;32>s;){if(0===l)break a;l--;m+=r[H++]<<s;s+=8}if(m!==(c.total&4294967295)){a.msg="incorrect length check";c.mode=30;break}s=m=0}c.mode=29;case 29:E=1;break a;case 30:E=-3;break a;case 31:return-4;default:return y}a.next_out=q;a.avail_out=p;a.next_in=H;a.avail_in=l;c.hold=m;c.bits=s;if(c.wsize||P!==a.avail_out&&30>c.mode&&(27>c.mode||4!==d))r=a.output,H=a.next_out,q=P-a.avail_out,p=a.state,null===p.window&&(p.wsize=1<<p.wbits,p.wnext=0,p.whave= +0,p.window=new b.Buf8(p.wsize)),q>=p.wsize?(b.arraySet(p.window,r,H-p.wsize,p.wsize,0),p.wnext=0,p.whave=p.wsize):(l=p.wsize-p.wnext,l>q&&(l=q),b.arraySet(p.window,r,H-q,l,p.wnext),(q-=l)?(b.arraySet(p.window,r,H-q,q,0),p.wnext=q,p.whave=p.wsize):(p.wnext+=l,p.wnext===p.wsize&&(p.wnext=0),p.whave<p.wsize&&(p.whave+=l)));x-=a.avail_in;P-=a.avail_out;a.total_in+=x;a.total_out+=P;c.total+=P;c.wrap&&P&&(a.adler=c.check=c.flags?n(c.check,K,P,a.next_out-P):e(c.check,K,P,a.next_out-P));a.data_type=c.bits+ +(c.last?64:0)+(12===c.mode?128:0)+(20===c.mode||15===c.mode?256:0);(0===x&&0===P||4===d)&&E===t&&(E=-5);return E};c.inflateEnd=function(b){if(!b||!b.state)return y;var a=b.state;a.window&&(a.window=null);b.state=null;return t};c.inflateGetHeader=function(b,a){var c;if(!b||!b.state)return y;c=b.state;if(0===(c.wrap&2))return y;c.head=a;a.done=!1;return t};c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":2,"./adler32":4,"./crc32":6,"./inffast":8,"./inftrees":10}],10:[function(a, +d,c){var f=a("../utils/common"),q=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],p=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];d.exports=function(a,b,c,d,g,u,t,y){for(var v=y.bits,s=0,x= +0,w=0,B=0,I=0,C=0,F=0,J=0,N=0,K=0,H,z,Z=null,T=0,G,U=new f.Buf16(16),C=new f.Buf16(16),aa=null,P=0,D,Q,$,s=0;15>=s;s++)U[s]=0;for(x=0;x<d;x++)U[b[c+x]]++;I=v;for(B=15;1<=B&&0===U[B];B--);I>B&&(I=B);if(0===B)return g[u++]=20971520,g[u++]=20971520,y.bits=1,0;for(w=1;w<B&&0===U[w];w++);I<w&&(I=w);for(s=J=1;15>=s;s++)if(J<<=1,J-=U[s],0>J)return-1;if(0<J&&(0===a||1!==B))return-1;C[1]=0;for(s=1;15>s;s++)C[s+1]=C[s]+U[s];for(x=0;x<d;x++)0!==b[c+x]&&(t[C[b[c+x]]++]=x);switch(a){case 0:Z=aa=t;G=19;break;case 1:Z= +q;T-=257;aa=p;P-=257;G=256;break;default:Z=m,aa=l,G=-1}x=K=0;s=w;v=u;C=I;F=0;z=-1;N=1<<I;d=N-1;if(1===a&&852<N||2===a&&592<N)return 1;for(var A=0;;){A++;D=s-F;t[x]<G?(Q=0,$=t[x]):t[x]>G?(Q=aa[P+t[x]],$=Z[T+t[x]]):(Q=96,$=0);J=1<<s-F;w=H=1<<C;do H-=J,g[v+(K>>F)+H]=D<<24|Q<<16|$|0;while(0!==H);for(J=1<<s-1;K&J;)J>>=1;0!==J?(K&=J-1,K+=J):K=0;x++;if(0===--U[s]){if(s===B)break;s=b[c+t[x]]}if(s>I&&(K&d)!==z){0===F&&(F=I);v+=w;C=s-F;for(J=1<<C;C+F<B;){J-=U[C+F];if(0>=J)break;C++;J<<=1}N+=1<<C;if(1===a&& +852<N||2===a&&592<N)return 1;z=K&d;g[z]=I<<24|C<<16|v-u|0}}0!==K&&(g[v+K]=s-F<<24|4194304);y.bits=I;return 0}},{"../utils/common":2}],11:[function(a,d,c){d.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],12:[function(a,d,c){d.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out= +0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},{}]},{},[1])(1)});return{inflate:function(k,a){return f.inflateRaw(k)}}}()})();core.StepDirection={PREVIOUS:1,NEXT:2};core.StepIterator=function(f,k){function a(){b=null;n=e=void 0}function d(){void 0===n&&(n=f.acceptPosition(k)===l);return n}function c(b,c){a();return k.setUnfilteredPosition(b,c)}function h(){b||(b=k.container());return b}function q(){void 0===e&&(e=k.unfilteredDomOffset());return e}function p(){for(a();k.nextPosition();)if(a(),d())return!0;return!1}function m(){for(a();k.previousPosition();)if(a(),d())return!0;return!1}var l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.StepDirection.NEXT, +b,e,n;this.isStep=d;this.setPosition=c;this.container=h;this.offset=q;this.nextStep=p;this.previousStep=m;this.advanceStep=function(b){return b===r?p():m()};this.roundToClosestStep=function(){var b,a,e=d();e||(b=h(),a=q(),e=m(),e||(c(b,a),e=p()));return e};this.roundToPreviousStep=function(){var b=d();b||(b=m());return b};this.roundToNextStep=function(){var b=d();b||(b=p());return b};this.leftNode=function(){return k.leftNode()};this.snapshot=function(){return new core.StepIterator.StepSnapshot(h(), +q())};this.restore=function(b){c(b.container,b.offset)}};core.StepIterator.StepSnapshot=function(f,k){this.container=f;this.offset=k};core.UnitTest=function(){};core.UnitTest.prototype.setUp=function(){};core.UnitTest.prototype.tearDown=function(){};core.UnitTest.prototype.description=function(){};core.UnitTest.prototype.tests=function(){};core.UnitTest.prototype.asyncTests=function(){}; +core.UnitTest.provideTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!k,'Unclean test environment, found a div with id "testarea".');k=f.createElement("div");k.setAttribute("id","testarea");f.body.appendChild(k);return k}; +core.UnitTest.cleanupTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!!k&&k.parentNode===f.body,'Test environment broken, found no div with id "testarea" below body.');f.body.removeChild(k)};core.UnitTest.createXmlDocument=function(f,k,a){var d="<?xml version='1.0' encoding='UTF-8'?>",d=d+("<"+f);Object.keys(a).forEach(function(c){d+=" xmlns:"+c+'="'+a[c]+'"'});d+=">";d+=k;d+="</"+f+">";return runtime.parseXML(d)}; +core.UnitTest.createOdtDocument=function(f,k){return core.UnitTest.createXmlDocument("office:document",f,k)}; +core.UnitTestLogger=function(){var f=[],k=0,a=0,d="",c="";this.startTest=function(h,q){f=[];k=0;d=h;c=q;a=Date.now()};this.endTest=function(){var h=Date.now();return{description:c,suite:[d,c],success:0===k,log:f,time:h-a}};this.debug=function(a){f.push({category:"debug",message:a})};this.fail=function(a){k+=1;f.push({category:"fail",message:a})};this.pass=function(a){f.push({category:"pass",message:a})}}; +core.UnitTestRunner=function(f,k){function a(b){l+=1;e?k.debug(b):k.fail(b)}function d(b,c){var e;try{if(b.length!==c.length)return a("array of length "+b.length+" should be "+c.length+" long"),!1;for(e=0;e<b.length;e+=1)if(b[e]!==c[e])return a(b[e]+" should be "+c[e]+" at array index "+e),!1}catch(d){return!1}return!0}function c(b,g,e){var d=b.attributes,f=d.length,h,m,l;for(h=0;h<f;h+=1)if(m=d.item(h),"xmlns"!==m.prefix&&"urn:webodf:names:steps"!==m.namespaceURI){l=g.getAttributeNS(m.namespaceURI, +m.localName);if(!g.hasAttributeNS(m.namespaceURI,m.localName))return a("Attribute "+m.localName+" with value "+m.value+" was not present"),!1;if(l!==m.value)return a("Attribute "+m.localName+" was "+l+" should be "+m.value),!1}return e?!0:c(g,b,!0)}function h(b,g){var e,d;e=b.nodeType;d=g.nodeType;if(e!==d)return a("Nodetype '"+e+"' should be '"+d+"'"),!1;if(e===Node.TEXT_NODE){if(b.data===g.data)return!0;a("Textnode data '"+b.data+"' should be '"+g.data+"'");return!1}runtime.assert(e===Node.ELEMENT_NODE, +"Only textnodes and elements supported.");if(b.namespaceURI!==g.namespaceURI)return a("namespace '"+b.namespaceURI+"' should be '"+g.namespaceURI+"'"),!1;if(b.localName!==g.localName)return a("localName '"+b.localName+"' should be '"+g.localName+"'"),!1;if(!c(b,g,!1))return!1;e=b.firstChild;for(d=g.firstChild;e;){if(!d)return a("Nodetype '"+e.nodeType+"' is unexpected here."),!1;if(!h(e,d))return!1;e=e.nextSibling;d=d.nextSibling}return d?(a("Nodetype '"+d.nodeType+"' is missing here."),!1):!0}function q(a, +c,e){if(0===c)return a===c&&1/a===1/c;if(a===c)return!0;if(null===a||null===c)return!1;if("number"===typeof c&&isNaN(c))return"number"===typeof a&&isNaN(a);if("number"===typeof c&&"number"===typeof a){if(a===c)return!0;void 0===e&&(e=1E-4);runtime.assert("number"===typeof e,"Absolute tolerance not given as number.");runtime.assert(0<=e,"Absolute tolerance should be given as positive number, was "+e);a=Math.abs(a-c);return a<=e}return Object.prototype.toString.call(c)===Object.prototype.toString.call([])? +d(a,c):"object"===typeof c&&"object"===typeof a?c.constructor===Element||c.constructor===Node?h(a,c):b(a,c):!1}function p(b){if(0===b&&0>1/b)return"-0";if("object"===typeof b)try{return JSON.stringify(b)}catch(a){}return String(b)}function m(b,c,e,d){"string"===typeof c&&"string"===typeof e||k.debug("WARN: shouldBe() expects string arguments");var f,h;try{h=eval(c)}catch(m){f=m}b=eval(e);f?a(c+" should be "+b+". Threw exception "+f):q(h,b,d)?k.pass(c+" is "+e):String(typeof h)===String(typeof b)? +a(c+" should be "+p(b)+". Was "+p(h)+"."):a(c+" should be "+b+" (of type "+typeof b+"). Was "+h+" (of type "+typeof h+").")}var l=0,r,b,e=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){r=l;e=!0};this.endExpectFail=function(){var b=r===l;e=!1;l=r;b&&(l+=1,k.fail("Expected at least one failed test, but none registered."))};b=function(b,c){var e=Object.keys(b),f=Object.keys(c);e.sort();f.sort();return d(e,f)&&Object.keys(b).every(function(e){var d=b[e],f=c[e];return q(d, +f)?!0:(a(d+" should be "+f+" for key "+e),!1)})};this.areNodesEqual=h;this.shouldBeNull=function(b,a){m(b,a,"null")};this.shouldBeNonNull=function(b,c){var e,d;try{d=eval(c)}catch(f){e=f}e?a(c+" should be non-null. Threw exception "+e):null!==d?k.pass(c+" is non-null."):a(c+" should be non-null. Was "+d)};this.shouldBe=m;this.testFailed=a;this.countFailedTests=function(){return l};this.name=function(b){var a,c,e=[],d=b.length;e.length=d;for(a=0;a<d;a+=1){c=Runtime.getFunctionName(b[a])||"";if(""=== +c)throw"Found a function without a name.";e[a]={f:b[a],name:c}}return e}}; +core.UnitTester=function(){function f(a,c){return"<span style='color:blue;cursor:pointer' onclick='"+c+"'>"+a+"</span>"}function k(c){a.reporter&&a.reporter(c)}var a=this,d=0,c=new core.UnitTestLogger,h={},q="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(a){var c,d;q?runtime.log("<span>Running "+f(a.description,'runTest("'+a.suite[0]+'","'+a.description+'")')+"</span>"):runtime.log("Running "+a.description);if(!a.success)for(c=0;c<a.log.length;c+=1)d=a.log[c],runtime.log(d.category, +d.message)};this.runTests=function(p,m,l){function r(a){function f(){q&&e.endExpectFail();k(c.endTest());n.tearDown();g[p]=s===e.countFailedTests();r(a.slice(1))}var p,q;if(0===a.length)h[b]=g,d+=e.countFailedTests(),m();else if(t=a[0].f,p=a[0].name,q=!0===a[0].expectFail,s=e.countFailedTests(),l.length&&-1===l.indexOf(p))r(a.slice(1));else{n.setUp();c.startTest(b,p);q&&e.beginExpectFail();try{t(f)}catch(u){e.testFailed("Unexpected exception encountered: "+u.toString()+"\n"+u.stack),f()}}}var b=Runtime.getFunctionName(p)|| +"",e=new core.UnitTestRunner(a.resourcePrefix,c),n=new p(e),g={},u,t,y,v,s;if(h.hasOwnProperty(b))runtime.log("Test "+b+" has already run.");else{q?runtime.log("<span>Running "+f(b,'runSuite("'+b+'");')+": "+n.description()+"</span>"):runtime.log("Running "+b+": "+n.description);y=n.tests();for(u=0;u<y.length;u+=1)if(t=y[u].f,p=y[u].name,v=!0===y[u].expectFail,!l.length||-1!==l.indexOf(p)){s=e.countFailedTests();n.setUp();c.startTest(b,p);v&&e.beginExpectFail();try{t()}catch(x){e.testFailed("Unexpected exception encountered: "+ +x.toString()+"\n"+x.stack)}v&&e.endExpectFail();k(c.endTest());n.tearDown();g[p]=s===e.countFailedTests()}r(n.asyncTests())}};this.failedTestsCount=function(){return d};this.results=function(){return h}};core.Utils=function(){function f(k,a){if(a&&Array.isArray(a)){k=k||[];if(!Array.isArray(k))throw"Destination is not an array.";k=k.concat(a.map(function(a){return f(null,a)}))}else if(a&&"object"===typeof a){k=k||{};if("object"!==typeof k)throw"Destination is not an object.";Object.keys(a).forEach(function(d){k[d]=f(k[d],a[d])})}else k=a;return k}this.hashString=function(f){var a=0,d,c;d=0;for(c=f.length;d<c;d+=1)a=(a<<5)-a+f.charCodeAt(d),a|=0;return a};this.mergeObjects=function(k,a){Object.keys(a).forEach(function(d){k[d]= +f(k[d],a[d])});return k}};core.Zip=function(f,k){function a(b,a,c){u?c(null,u.subarray(b,b+a)):c("File data not loaded",null)}function d(b){var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145, +1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878, +1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068, +1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842, +628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896, +3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],c,e,g=b.length,d=0,d=0;c=-1;for(e=0;e<g;e+=1)d=(c^b[e])&255,d=a[d],c=c>>>8^d;return c^-1}function c(b){return new Date((b>>25&127)+1980,(b>>21&15)-1,b>>16&31,b>>11&15, +b>>5&63,(b&31)<<1)}function h(b){var a=b.getFullYear();return 1980>a?0:a-1980<<25|b.getMonth()+1<<21|b.getDate()<<16|b.getHours()<<11|b.getMinutes()<<5|b.getSeconds()>>1}function q(b,e){var g,d,n,f,h,m,l,r=this;this.load=function(c){if(null!==r.data)c(null,r.data);else{var e=h+34+d+n+256;e+l>t&&(e=t-l);a(l,e,function(a,e){if(a||null===e)c(a,e);else a:{var g=e,d=new core.ByteArray(g),n=d.readUInt32LE(),l;if(67324752!==n)c("File entry signature is wrong."+n.toString()+" "+g.length.toString(),null); +else{d.pos+=22;n=d.readUInt16LE();l=d.readUInt16LE();d.pos+=n+l;if(f){g=g.subarray(d.pos,d.pos+h);if(h!==g.length){c("The amount of compressed bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+r.filename+" in "+b+".",null);break a}g=v(g,m)}else g=g.subarray(d.pos,d.pos+m);m!==g.length?c("The amount of bytes read was "+g.length.toString()+" instead of "+m.toString()+" for "+r.filename+" in "+b+".",null):(r.data=g,c(null,g))}}})}};this.set=function(b,a,c,e){r.filename=b;r.data= +a;r.compressed=c;r.date=e};this.error=null;e&&(g=e.readUInt32LE(),33639248!==g?this.error="Central directory entry has wrong signature at position "+(e.pos-4).toString()+' for file "'+b+'": '+e.data.length.toString():(e.pos+=6,f=e.readUInt16LE(),this.date=c(e.readUInt32LE()),e.readUInt32LE(),h=e.readUInt32LE(),m=e.readUInt32LE(),d=e.readUInt16LE(),n=e.readUInt16LE(),g=e.readUInt16LE(),e.pos+=8,l=e.readUInt32LE(),this.filename=runtime.byteArrayToString(e.data.subarray(e.pos,e.pos+d),"utf8"),this.data= +null,e.pos+=d+n+g))}function p(b,c){if(22!==b.length)c("Central directory length should be 22.",s);else{var e=new core.ByteArray(b),d;d=e.readUInt32LE();101010256!==d?c("Central directory signature is wrong: "+d.toString(),s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),y=e.readUInt16LE(),d!==y?c("Number of entries is inconsistent.",s):(d=e.readUInt32LE(), +e=e.readUInt16LE(),e=t-22-d,a(e,t-e,function(b,a){if(b||null===a)c(b,s);else a:{var e=new core.ByteArray(a),d,n;g=[];for(d=0;d<y;d+=1){n=new q(f,e);if(n.error){c(n.error,s);break a}g[g.length]=n}c(null,s)}})))))}}function m(b,a){var c=null,e,d;for(d=0;d<g.length;d+=1)if(e=g[d],e.filename===b){c=e;break}c?c.data?a(null,c.data):c.load(a):a(b+" not found.",null)}function l(b){var a=new core.ByteArrayWriter("utf8"),c=0;a.appendArray([80,75,3,4,20,0,0,0,0,0]);b.data&&(c=b.data.length);a.appendUInt32LE(h(b.date)); +a.appendUInt32LE(b.data?d(b.data):0);a.appendUInt32LE(c);a.appendUInt32LE(c);a.appendUInt16LE(b.filename.length);a.appendUInt16LE(0);a.appendString(b.filename);b.data&&a.appendByteArray(b.data);return a}function r(b,a){var c=new core.ByteArrayWriter("utf8"),e=0;c.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);b.data&&(e=b.data.length);c.appendUInt32LE(h(b.date));c.appendUInt32LE(b.data?d(b.data):0);c.appendUInt32LE(e);c.appendUInt32LE(e);c.appendUInt16LE(b.filename.length);c.appendArray([0,0,0,0,0,0, +0,0,0,0,0,0]);c.appendUInt32LE(a);c.appendString(b.filename);return c}function b(a,c){if(a===g.length)c(null);else{var e=g[a];null!==e.data?b(a+1,c):e.load(function(e){e?c(e):b(a+1,c)})}}function e(a,c){b(0,function(b){if(b)c(b);else{var e,d,n=new core.ByteArrayWriter("utf8"),f=[0];for(e=0;e<g.length;e+=1)n.appendByteArrayWriter(l(g[e])),f.push(n.getLength());b=n.getLength();for(e=0;e<g.length;e+=1)d=g[e],n.appendByteArrayWriter(r(d,f[e]));e=n.getLength()-b;n.appendArray([80,75,5,6,0,0,0,0]);n.appendUInt16LE(g.length); +n.appendUInt16LE(g.length);n.appendUInt32LE(e);n.appendUInt32LE(b);n.appendArray([0,0]);a(n.getByteArray())}})}function n(b,a){e(function(c){runtime.writeFile(b,c,function(b){b||(u=c,t=u.length);a(b)})},a)}var g,u,t,y,v=core.RawInflate.inflate,s=this,x=new core.Base64;this.load=m;this.save=function(b,a,c,e){var d,n;for(d=0;d<g.length;d+=1)if(n=g[d],n.filename===b){n.set(b,a,c,e);return}n=new q(f);n.set(b,a,c,e);g.push(n)};this.remove=function(b){var a,c;for(a=0;a<g.length;a+=1)if(c=g[a],c.filename=== +b)return g.splice(a,1),!0;return!1};this.write=function(b){n(f,b)};this.writeAs=n;this.createByteArray=e;this.loadContentXmlAsFragments=function(b,a){s.loadAsString(b,function(b,c){if(b)return a.rootElementReady(b);a.rootElementReady(null,c,!0)})};this.loadAsString=function(b,a){m(b,function(b,c){if(b||null===c)return a(b,null);var e=runtime.byteArrayToString(c,"utf8");a(null,e)})};this.loadAsDOM=function(b,a){s.loadAsString(b,function(b,c){if(b||null===c)a(b,null);else{var e=(new DOMParser).parseFromString(c, +"text/xml");a(null,e)}})};this.loadAsDataURL=function(b,a,c){m(b,function(b,e){if(b||!e)return c(b,null);var g=0,d;a||(a=80===e[1]&&78===e[2]&&71===e[3]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":71===e[0]&&73===e[1]&&70===e[2]?"image/gif":"");for(d="data:"+a+";base64,";g<e.length;)d+=x.convertUTF8ArrayToBase64(e.subarray(g,Math.min(g+45E3,e.length))),g+=45E3;c(null,d)})};this.getEntries=function(){return g.slice()};t=-1;null===k?g=[]:runtime.readFile(f,"binary",function(b,c){"string"=== +typeof c&&(b="file was read as a string. Should be Uint8Array.");b||!c||0===c.length?k("File '"+f+"' cannot be read. Err: "+(b||"[none]"),s):(u=c,t=u.length,a(t-22,22,function(b,a){b||null===a?k(b,s):p(a,k)}))})};core.SimpleClientRect=null;gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}};gui.SessionConstraints=function(){function f(d){k.hasOwnProperty(d)||(k[d]=!1,a.register(d))}var k={},a=new core.EventNotifier;this.registerConstraint=f;this.subscribe=function(d,c){f(d);a.subscribe(d,c)};this.unsubscribe=function(d,c){a.unsubscribe(d,c)};this.setState=function(d,c){runtime.assert(!0===k.hasOwnProperty(d),"No such constraint");k[d]!==c&&(k[d]=c,a.emit(d,c))};this.getState=function(a){runtime.assert(!0===k.hasOwnProperty(a),"No such constraint");return k[a]}};gui.BlacklistNamespaceNodeFilter=function(f){var k={},a=NodeFilter.FILTER_REJECT,d=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(c){return!c||k.hasOwnProperty(c.namespaceURI)?a:d};(function(){f.forEach(function(a){k[a]=!0})})()};odf.Namespaces={namespaceMap:{config:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",db:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dc:"http://purl.org/dc/elements/1.1/",dr3d:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chart:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",form:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",math:"http://www.w3.org/1998/Math/MathML", +meta:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",number:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xforms:"http://www.w3.org/2002/xforms", +xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},configns:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",dbns:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dcns:"http://purl.org/dc/elements/1.1/",dr3dns:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",drawns:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chartns:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fons:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",formns:"urn:oasis:names:tc:opendocument:xmlns:form:1.0", +mathns:"http://www.w3.org/1998/Math/MathML",metans:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",numberns:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",officens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentationns:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",stylens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svgns:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",tablens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",textns:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", +xformsns:"http://www.w3.org/2002/xforms",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"};(function(){var f=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,a;for(a in f)f.hasOwnProperty(a)&&(k[f[a]]=a)})();odf.Namespaces.forEachPrefix=function(f){var k=odf.Namespaces.namespaceMap,a;for(a in k)k.hasOwnProperty(a)&&f(a,k[a])}; +odf.Namespaces.lookupNamespaceURI=function(f){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(f)&&(k=odf.Namespaces.namespaceMap[f]);return k};odf.Namespaces.lookupPrefix=function(f){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(f)?k[f]:null};odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI;(function(){odf.OdfSchemaImpl=function(){var f=[["config:config-item","uncategorized"],["form:item","object"],["form:option","uncategorized"],["math:math","field"],["meta:user-defined","uncategorized"],["number:currency-symbol","uncategorized"],["number:embedded-text","uncategorized"],["number:text","uncategorized"],["presentation:date-time-decl","uncategorized"],["presentation:footer-decl","uncategorized"],["presentation:header-decl","uncategorized"],["svg:desc","text"],["svg:title","text"],["table:desc", +"uncategorized"],["table:title","uncategorized"],["text:a","text"],["text:author-initials","field"],["text:author-name","field"],["text:bibliography-mark","field"],["text:bookmark-ref","field"],["text:chapter","field"],["text:character-count","field"],["text:conditional-text","field"],["text:creation-date","field"],["text:creation-time","field"],["text:creator","field"],["text:database-display","field"],["text:database-name","field"],["text:database-row-number","field"],["text:date","field"],["text:dde-connection", +"field"],["text:description","field"],["text:editing-cycles","field"],["text:editing-duration","field"],["text:execute-macro","uncategorized"],["text:expression","uncategorized"],["text:file-name","field"],["text:h","text"],["text:hidden-paragraph","text"],["text:hidden-text","text"],["text:image-count","field"],["text:index-entry-span","uncategorized"],["text:index-title-template","uncategorized"],["text:initial-creator","field"],["text:keywords","field"],["text:linenumbering-separator","style"], +["text:measure","uncategorized"],["text:meta","uncategorized"],["text:meta-field","uncategorized"],["text:modification-date","field"],["text:modification-time","field"],["text:note-citation","field"],["text:note-continuation-notice-backward","style"],["text:note-continuation-notice-forward","style"],["text:note-ref","field"],["text:object-count","field"],["text:p","text"],["text:page-continuation","uncategorized"],["text:page-count","field"],["text:page-number","field"],["text:page-variable-get", +"field"],["text:page-variable-set","field"],["text:paragraph-count","field"],["text:placeholder","field"],["text:print-date","field"],["text:print-time","field"],["text:printed-by","field"],["text:reference-ref","field"],["text:ruby-base","text"],["text:ruby-text","text"],["text:script","text"],["text:sender-city","field"],["text:sender-company","field"],["text:sender-country","field"],["text:sender-email","field"],["text:sender-fax","field"],["text:sender-firstname","field"],["text:sender-initials", +"field"],["text:sender-lastname","field"],["text:sender-phone-private","field"],["text:sender-phone-work","field"],["text:sender-position","field"],["text:sender-postal-code","field"],["text:sender-state-or-province","field"],["text:sender-street","field"],["text:sender-title","field"],["text:sequence","uncategorized"],["text:sequence-ref","uncategorized"],["text:sheet-name","uncategorized"],["text:span","text"],["text:subject","field"],["text:table-count","field"],["text:table-formula","deprecated"], +["text:template-name","uncategorized"],["text:text-input","field"],["text:time","field"],["text:title","field"],["text:user-defined","field"],["text:user-field-get","field"],["text:user-field-input","field"],["text:variable-get","field"],["text:variable-input","field"],["text:variable-set","field"],["text:word-count","field"],["xforms:model","uncategorized"]],k={};this.isTextContainer=function(a,d){return"text"===k[a+":"+d]};this.isField=function(a,d){return"field"===k[a+":"+d]};this.getFields=function(){return f.filter(function(a){return"field"=== +a[1]}).map(function(a){return a[0]})};(function(){f.forEach(function(a){var d=a[1],c=a[0].split(":");a=c[0];var c=c[1],f=odf.Namespaces.lookupNamespaceURI(a);f?k[f+":"+c]=d:runtime.log("DEBUG: OdfSchema - unknown prefix '"+a+"'")})})()};odf.OdfSchema=new odf.OdfSchemaImpl})();odf.OdfUtilsImpl=function(){function f(b){return"image"===(b&&b.localName)&&b.namespaceURI===T}function k(b){return null!==b&&b.nodeType===Node.ELEMENT_NODE&&"frame"===b.localName&&b.namespaceURI===T&&"as-char"===b.getAttributeNS(Z,"anchor-type")}function a(b){var a;(a="annotation"===(b&&b.localName)&&b.namespaceURI===odf.Namespaces.officens)||(a="div"===(b&&b.localName)&&"annotationWrapper"===b.className);return a}function d(b){return"a"===(b&&b.localName)&&b.namespaceURI===Z}function c(b){var a= +b&&b.localName;return("p"===a||"h"===a)&&b.namespaceURI===Z}function h(b,a){for(b&&void 0!==a&&!c(b)&&b.childNodes.item(a)&&(b=b.childNodes.item(a));b&&!c(b);)b=b.parentNode;return b}function q(b,a){for(;b&&b!==a;){if(b.namespaceURI===odf.Namespaces.officens&&"annotation"===b.localName)return b;b=b.parentNode}return null}function p(b){return/^[ \t\r\n]+$/.test(b)}function m(b){if(null===b||b.nodeType!==Node.ELEMENT_NODE)return!1;var a=b.localName;return P.isTextContainer(b.namespaceURI,a)||"span"=== +a&&"webodf-annotationHighlight"===b.className}function l(b){return null===b||b.nodeType!==Node.ELEMENT_NODE?!1:P.isField(b.namespaceURI,b.localName)}function r(b){var a=b&&b.localName,c=!1;a&&(b=b.namespaceURI,b===Z&&(c="s"===a||"tab"===a||"line-break"===a));return c}function b(b){return r(b)||l(b)||k(b)||a(b)}function e(b){var a=b&&b.localName,c=!1;a&&(b=b.namespaceURI,b===Z&&(c="s"===a));return c}function n(b){return-1!==aa.indexOf(b.namespaceURI)}function g(b){if(r(b)||l(b))return!1;if(m(b.parentNode)&& +b.nodeType===Node.TEXT_NODE)return 0===b.textContent.length;for(b=b.firstChild;b;){if(n(b)||!g(b))return!1;b=b.nextSibling}return!0}function u(b){for(;null!==b.firstChild&&m(b);)b=b.firstChild;return b}function t(b){for(;null!==b.lastChild&&m(b);)b=b.lastChild;return b}function y(b){for(;!c(b)&&null===b.previousSibling;)b=b.parentNode;return c(b)?null:t(b.previousSibling)}function v(b){for(;!c(b)&&null===b.nextSibling;)b=b.parentNode;return c(b)?null:u(b.nextSibling)}function s(a){for(var c=!1;a;)if(a.nodeType=== +Node.TEXT_NODE)if(0===a.length)a=y(a);else return!p(a.data.substr(a.length-1,1));else b(a)?(c=!1===e(a),a=null):a=y(a);return c}function x(a){var c=!1,e;for(a=a&&u(a);a;){e=a.nodeType===Node.TEXT_NODE?a.length:0;if(0<e&&!p(a.data)){c=!0;break}if(b(a)){c=!0;break}a=v(a)}return c}function w(b,a){return p(b.data.substr(a))?!x(v(b)):!1}function B(a,c){var e=a.data,g;if(!p(e[c])||b(a.parentNode))return!1;0<c?p(e[c-1])||(g=!0):s(y(a))&&(g=!0);return!0===g?w(a,c)?!1:!0:!1}function I(b){return(b=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)|(%))/.exec(b))? +{value:parseFloat(b[1]),unit:b[3]}:null}function C(b){return(b=I(b))&&(0>b.value||"%"===b.unit)?null:b}function F(b){return(b=I(b))&&"%"!==b.unit?null:b}function J(b){switch(b.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(b.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(b.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(b.localName){case "cursor":case "editinfo":return!1}}return!0} +function N(b,a){for(;0<a.length&&!U.rangeContainsNode(b,a[0]);)a.shift();for(;0<a.length&&!U.rangeContainsNode(b,a[a.length-1]);)a.pop()}function K(c,e,g){var d;d=U.getNodesInRange(c,function(c){var e=NodeFilter.FILTER_REJECT;if(r(c.parentNode)||l(c.parentNode)||a(c))e=NodeFilter.FILTER_REJECT;else if(c.nodeType===Node.TEXT_NODE){if(g||Boolean(h(c)&&(!p(c.textContent)||B(c,0))))e=NodeFilter.FILTER_ACCEPT}else if(b(c))e=NodeFilter.FILTER_ACCEPT;else if(J(c)||m(c))e=NodeFilter.FILTER_SKIP;return e}, +NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);e||N(c,d);return d}function H(b,c,e){for(;b;){if(e(b)){c[0]!==b&&c.unshift(b);break}if(a(b))break;b=b.parentNode}}function z(b,a){var c=b;if(a<c.childNodes.length-1)c=c.childNodes[a+1];else{for(;!c.nextSibling;)c=c.parentNode;c=c.nextSibling}for(;c.firstChild;)c=c.firstChild;return c}var Z=odf.Namespaces.textns,T=odf.Namespaces.drawns,G=odf.Namespaces.xlinkns,U=core.DomUtils,aa=[odf.Namespaces.dbns,odf.Namespaces.dcns,odf.Namespaces.dr3dns,odf.Namespaces.drawns, +odf.Namespaces.chartns,odf.Namespaces.formns,odf.Namespaces.numberns,odf.Namespaces.officens,odf.Namespaces.presentationns,odf.Namespaces.stylens,odf.Namespaces.svgns,odf.Namespaces.tablens,odf.Namespaces.textns],P=odf.OdfSchema;this.isImage=f;this.isCharacterFrame=k;this.isInlineRoot=a;this.isTextSpan=function(b){return"span"===(b&&b.localName)&&b.namespaceURI===Z};this.isHyperlink=d;this.getHyperlinkTarget=function(b){return b.getAttributeNS(G,"href")||""};this.isParagraph=c;this.getParagraphElement= +h;this.getParentAnnotation=q;this.isWithinAnnotation=function(b,a){return Boolean(q(b,a))};this.getAnnotationCreator=function(b){return b.getElementsByTagNameNS(odf.Namespaces.dcns,"creator")[0].textContent};this.isListItem=function(b){return"list-item"===(b&&b.localName)&&b.namespaceURI===Z};this.isLineBreak=function(b){return"line-break"===(b&&b.localName)&&b.namespaceURI===Z};this.isODFWhitespace=p;this.isGroupingElement=m;this.isFieldElement=l;this.isCharacterElement=r;this.isAnchoredAsCharacterElement= +b;this.isSpaceElement=e;this.isODFNode=n;this.hasNoODFContent=g;this.firstChild=u;this.lastChild=t;this.previousNode=y;this.nextNode=v;this.scanLeftForNonSpace=s;this.lookLeftForCharacter=function(a){var c,e=c=0;a.nodeType===Node.TEXT_NODE&&(e=a.length);0<e?(c=a.data,c=p(c.substr(e-1,1))?1===e?s(y(a))?2:0:p(c.substr(e-2,1))?0:2:1):b(a)&&(c=1);return c};this.lookRightForCharacter=function(a){var c=!1,e=0;a&&a.nodeType===Node.TEXT_NODE&&(e=a.length);0<e?c=!p(a.data.substr(0,1)):b(a)&&(c=!0);return c}; +this.scanLeftForAnyCharacter=function(a){var c=!1,e;for(a=a&&t(a);a;){e=a.nodeType===Node.TEXT_NODE?a.length:0;if(0<e&&!p(a.data)){c=!0;break}if(b(a)){c=!0;break}a=y(a)}return c};this.scanRightForAnyCharacter=x;this.isTrailingWhitespace=w;this.isSignificantWhitespace=B;this.isDowngradableSpaceElement=function(b){return e(b)?s(y(b))&&x(v(b)):!1};this.parseLength=I;this.parseNonNegativeLength=C;this.parseFoFontSize=function(b){var a;a=(a=I(b))&&(0>=a.value||"%"===a.unit)?null:a;return a||F(b)};this.parseFoLineHeight= +function(b){return C(b)||F(b)};this.isTextContentContainingNode=J;this.getTextNodes=function(b,a){var c;c=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT;b.nodeType===Node.TEXT_NODE?Boolean(h(b)&&(!p(b.textContent)||B(b,0)))&&(a=NodeFilter.FILTER_ACCEPT):J(b)&&(a=NodeFilter.FILTER_SKIP);return a},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);a||N(b,c);return c};this.getTextElements=K;this.getParagraphElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT; +if(c(b))a=NodeFilter.FILTER_ACCEPT;else if(J(b)||m(b))a=NodeFilter.FILTER_SKIP;return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,c);return a};this.getImageElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_SKIP;f(b)&&(a=NodeFilter.FILTER_ACCEPT);return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,f);return a};this.getHyperlinkElements=function(b){var a=[],e=b.cloneRange();b.collapsed&&b.endContainer.nodeType===Node.ELEMENT_NODE&&(b=z(b.endContainer,b.endOffset), +b.nodeType===Node.TEXT_NODE&&e.setEnd(b,1));K(e,!0,!1).forEach(function(b){for(b=b.parentNode;!c(b);){if(d(b)&&-1===a.indexOf(b)){a.push(b);break}b=b.parentNode}});e.detach();return a};this.getNormalizedFontFamilyName=function(b){/^(["'])(?:.|[\n\r])*?\1$/.test(b)||(b=b.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(b)&&(b="'"+b.replace(/[ \t\r\n\f]+/g," ")+"'"));return b}};odf.OdfUtils=new odf.OdfUtilsImpl;gui.OdfTextBodyNodeFilter=function(){var f=odf.OdfUtils,k=Node.TEXT_NODE,a=NodeFilter.FILTER_REJECT,d=NodeFilter.FILTER_ACCEPT,c=odf.Namespaces.textns;this.acceptNode=function(h){if(h.nodeType===k){if(!f.isGroupingElement(h.parentNode))return a}else if(h.namespaceURI===c&&"tracked-changes"===h.localName)return a;return d}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){}; +function createXPathSingleton(){function f(a,b,c){return-1!==a&&(a<b||-1===b)&&(a<c||-1===c)}function k(a){for(var b=[],c=0,d=a.length,g;c<d;){var h=a,m=d,p=b,q="",k=[],x=h.indexOf("[",c),w=h.indexOf("/",c),B=h.indexOf("=",c);f(w,x,B)?(q=h.substring(c,w),c=w+1):f(x,w,B)?(q=h.substring(c,x),c=l(h,x,k)):f(B,w,x)?(q=h.substring(c,B),c=B):(q=h.substring(c,m),c=m);p.push({location:q,predicates:k});if(c<d&&"="===a[c]){g=a.substring(c+1,d);if(2<g.length&&("'"===g[0]||'"'===g[0]))g=g.slice(1,g.length-1); +else try{g=parseInt(g,10)}catch(I){}c=d}}return{steps:b,value:g}}function a(){var a=null,b=!1;this.setNode=function(b){a=b};this.reset=function(){b=!1};this.next=function(){var c=b?null:a;b=!0;return c}}function d(a,b,c){this.reset=function(){a.reset()};this.next=function(){for(var d=a.next();d;){d.nodeType===Node.ELEMENT_NODE&&(d=d.getAttributeNodeNS(b,c));if(d)break;d=a.next()}return d}}function c(a,b){var c=a.next(),d=null;this.reset=function(){a.reset();c=a.next();d=null};this.next=function(){for(;c;){if(d)if(b&& +d.firstChild)d=d.firstChild;else{for(;!d.nextSibling&&d!==c;)d=d.parentNode;d===c?c=a.next():d=d.nextSibling}else{do(d=c.firstChild)||(c=a.next());while(c&&!d)}if(d&&d.nodeType===Node.ELEMENT_NODE)return d}return null}}function h(a,b){this.reset=function(){a.reset()};this.next=function(){for(var c=a.next();c&&!b(c);)c=a.next();return c}}function q(a,b,c){b=b.split(":",2);var d=c(b[0]),g=b[1];return new h(a,function(b){return b.localName===g&&b.namespaceURI===d})}function p(c,b,e){var d=new a,g=m(d, +b,e),f=b.value;return void 0===f?new h(c,function(b){d.setNode(b);g.reset();return null!==g.next()}):new h(c,function(b){d.setNode(b);g.reset();return(b=g.next())?b.nodeValue===f:!1})}var m,l;l=function(a,b,c){for(var d=b,g=a.length,f=0;d<g;)"]"===a[d]?(f-=1,0>=f&&c.push(k(a.substring(b,d)))):"["===a[d]&&(0>=f&&(b=d+1),f+=1),d+=1;return d};m=function(a,b,e){var f,g,h,m;for(f=0;f<b.steps.length;f+=1){h=b.steps[f];g=h.location;if(""===g)a=new c(a,!1);else if("@"===g[0]){g=g.substr(1).split(":",2);m= +e(g[0]);if(!m)throw"No namespace associated with the prefix "+g[0];a=new d(a,m,g[1])}else"."!==g&&(a=new c(a,!1),-1!==g.indexOf(":")&&(a=q(a,g,e)));for(g=0;g<h.predicates.length;g+=1)m=h.predicates[g],a=p(a,m,e)}return a};return{getODFElementsWithXPath:function(c,b,e){var d=c.ownerDocument,g=[],f=null;if(d&&"function"===typeof d.evaluate)for(e=d.evaluate(b,c,e,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null),f=e.iterateNext();null!==f;)f.nodeType===Node.ELEMENT_NODE&&g.push(f),f=e.iterateNext();else{g= +new a;g.setNode(c);c=k(b);g=m(g,c,e);c=[];for(e=g.next();e;)c.push(e),e=g.next();g=c}return g}}}xmldom.XPath=createXPathSingleton();odf.StyleInfo=function(){function f(b,a){var c,e,d,g,n,h=0;if(c=C[b.localName])if(d=c[b.namespaceURI])h=d.length;for(c=0;c<h;c+=1)e=d[c],g=e.ns,n=e.localname,(e=b.getAttributeNS(g,n))&&b.setAttributeNS(g,B[g]+n,a+e);for(d=b.firstElementChild;d;)f(d,a),d=d.nextElementSibling}function k(b,a){var c,e,d,g,f,n=0;if(c=C[b.localName])if(d=c[b.namespaceURI])n=d.length;for(c=0;c<n;c+=1)if(e=d[c],g=e.ns,f=e.localname,e=b.getAttributeNS(g,f))e=e.replace(a,""),b.setAttributeNS(g,B[g]+f,e);for(d=b.firstElementChild;d;)k(d, +a),d=d.nextElementSibling}function a(b,a){var c,e,d,g,f,n=0;if(c=C[b.localName])if(d=c[b.namespaceURI])n=d.length;for(c=0;c<n;c+=1)if(g=d[c],e=g.ns,f=g.localname,e=b.getAttributeNS(e,f))a=a||{},g=g.keyname,a.hasOwnProperty(g)?a[g][e]=1:(f={},f[e]=1,a[g]=f);return a}function d(b,c){var e,g;a(b,c);for(e=b.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&(g=e,d(g,c)),e=e.nextSibling}function c(b,a,c){this.key=b;this.name=a;this.family=c;this.requires={}}function h(b,a,e){var d=b+'"'+a,g=e[d];g||(g=e[d]= +new c(d,b,a));return g}function q(b,a,c){var e,d,g,f,n,m=0;e=b.getAttributeNS(s,"name");f=b.getAttributeNS(s,"family");e&&f&&(a=h(e,f,c));if(a){if(e=C[b.localName])if(g=e[b.namespaceURI])m=g.length;for(e=0;e<m;e+=1)if(f=g[e],d=f.ns,n=f.localname,d=b.getAttributeNS(d,n))f=f.keyname,f=h(d,f,c),a.requires[f.key]=f}for(b=b.firstElementChild;b;)q(b,a,c),b=b.nextElementSibling;return c}function p(b,a){var c=a[b.family];c||(c=a[b.family]={});c[b.name]=1;Object.keys(b.requires).forEach(function(c){p(b.requires[c], +a)})}function m(b,a){var c=q(b,null,{});Object.keys(c).forEach(function(b){b=c[b];var e=a[b.family];e&&e.hasOwnProperty(b.name)&&p(b,a)})}function l(b,a){function c(a){(a=g.getAttributeNS(s,a))&&(b[a]=!0)}var e=["font-name","font-name-asian","font-name-complex"],d,g;for(d=a&&a.firstElementChild;d;)g=d,e.forEach(c),l(b,g),d=d.nextElementSibling}function r(b,a){function c(b){var e=g.getAttributeNS(s,b);e&&a.hasOwnProperty(e)&&g.setAttributeNS(s,"style:"+b,a[e])}var e=["font-name","font-name-asian", +"font-name-complex"],d,g;for(d=b&&b.firstElementChild;d;)g=d,e.forEach(c),r(g,a),d=d.nextElementSibling}var b=odf.Namespaces.chartns,e=odf.Namespaces.dbns,n=odf.Namespaces.dr3dns,g=odf.Namespaces.drawns,u=odf.Namespaces.formns,t=odf.Namespaces.numberns,y=odf.Namespaces.officens,v=odf.Namespaces.presentationns,s=odf.Namespaces.stylens,x=odf.Namespaces.tablens,w=odf.Namespaces.textns,B={"urn:oasis:names:tc:opendocument:xmlns:chart:1.0":"chart:","urn:oasis:names:tc:opendocument:xmlns:database:1.0":"db:", +"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0":"dr3d:","urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":"draw:","urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":"fo:","urn:oasis:names:tc:opendocument:xmlns:form:1.0":"form:","urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":"number:","urn:oasis:names:tc:opendocument:xmlns:office:1.0":"office:","urn:oasis:names:tc:opendocument:xmlns:presentation:1.0":"presentation:","urn:oasis:names:tc:opendocument:xmlns:style:1.0":"style:","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0":"svg:", +"urn:oasis:names:tc:opendocument:xmlns:table:1.0":"table:","urn:oasis:names:tc:opendocument:xmlns:text:1.0":"chart:","http://www.w3.org/XML/1998/namespace":"xml:"},I={text:[{ens:s,en:"tab-stop",ans:s,a:"leader-text-style"},{ens:s,en:"drop-cap",ans:s,a:"style-name"},{ens:w,en:"notes-configuration",ans:w,a:"citation-body-style-name"},{ens:w,en:"notes-configuration",ans:w,a:"citation-style-name"},{ens:w,en:"a",ans:w,a:"style-name"},{ens:w,en:"alphabetical-index",ans:w,a:"style-name"},{ens:w,en:"linenumbering-configuration", +ans:w,a:"style-name"},{ens:w,en:"list-level-style-number",ans:w,a:"style-name"},{ens:w,en:"ruby-text",ans:w,a:"style-name"},{ens:w,en:"span",ans:w,a:"style-name"},{ens:w,en:"a",ans:w,a:"visited-style-name"},{ens:s,en:"text-properties",ans:s,a:"text-line-through-text-style"},{ens:w,en:"alphabetical-index-source",ans:w,a:"main-entry-style-name"},{ens:w,en:"index-entry-bibliography",ans:w,a:"style-name"},{ens:w,en:"index-entry-chapter",ans:w,a:"style-name"},{ens:w,en:"index-entry-link-end",ans:w,a:"style-name"}, +{ens:w,en:"index-entry-link-start",ans:w,a:"style-name"},{ens:w,en:"index-entry-page-number",ans:w,a:"style-name"},{ens:w,en:"index-entry-span",ans:w,a:"style-name"},{ens:w,en:"index-entry-tab-stop",ans:w,a:"style-name"},{ens:w,en:"index-entry-text",ans:w,a:"style-name"},{ens:w,en:"index-title-template",ans:w,a:"style-name"},{ens:w,en:"list-level-style-bullet",ans:w,a:"style-name"},{ens:w,en:"outline-level-style",ans:w,a:"style-name"}],paragraph:[{ens:g,en:"caption",ans:g,a:"text-style-name"},{ens:g, +en:"circle",ans:g,a:"text-style-name"},{ens:g,en:"connector",ans:g,a:"text-style-name"},{ens:g,en:"control",ans:g,a:"text-style-name"},{ens:g,en:"custom-shape",ans:g,a:"text-style-name"},{ens:g,en:"ellipse",ans:g,a:"text-style-name"},{ens:g,en:"frame",ans:g,a:"text-style-name"},{ens:g,en:"line",ans:g,a:"text-style-name"},{ens:g,en:"measure",ans:g,a:"text-style-name"},{ens:g,en:"path",ans:g,a:"text-style-name"},{ens:g,en:"polygon",ans:g,a:"text-style-name"},{ens:g,en:"polyline",ans:g,a:"text-style-name"}, +{ens:g,en:"rect",ans:g,a:"text-style-name"},{ens:g,en:"regular-polygon",ans:g,a:"text-style-name"},{ens:y,en:"annotation",ans:g,a:"text-style-name"},{ens:u,en:"column",ans:u,a:"text-style-name"},{ens:s,en:"style",ans:s,a:"next-style-name"},{ens:x,en:"body",ans:x,a:"paragraph-style-name"},{ens:x,en:"even-columns",ans:x,a:"paragraph-style-name"},{ens:x,en:"even-rows",ans:x,a:"paragraph-style-name"},{ens:x,en:"first-column",ans:x,a:"paragraph-style-name"},{ens:x,en:"first-row",ans:x,a:"paragraph-style-name"}, +{ens:x,en:"last-column",ans:x,a:"paragraph-style-name"},{ens:x,en:"last-row",ans:x,a:"paragraph-style-name"},{ens:x,en:"odd-columns",ans:x,a:"paragraph-style-name"},{ens:x,en:"odd-rows",ans:x,a:"paragraph-style-name"},{ens:w,en:"notes-configuration",ans:w,a:"default-style-name"},{ens:w,en:"alphabetical-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"bibliography-entry-template",ans:w,a:"style-name"},{ens:w,en:"h",ans:w,a:"style-name"},{ens:w,en:"illustration-index-entry-template",ans:w,a:"style-name"}, +{ens:w,en:"index-source-style",ans:w,a:"style-name"},{ens:w,en:"object-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"p",ans:w,a:"style-name"},{ens:w,en:"table-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"table-of-content-entry-template",ans:w,a:"style-name"},{ens:w,en:"table-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"user-index-entry-template",ans:w,a:"style-name"},{ens:s,en:"page-layout-properties",ans:s,a:"register-truth-ref-style-name"}],chart:[{ens:b,en:"axis",ans:b, +a:"style-name"},{ens:b,en:"chart",ans:b,a:"style-name"},{ens:b,en:"data-label",ans:b,a:"style-name"},{ens:b,en:"data-point",ans:b,a:"style-name"},{ens:b,en:"equation",ans:b,a:"style-name"},{ens:b,en:"error-indicator",ans:b,a:"style-name"},{ens:b,en:"floor",ans:b,a:"style-name"},{ens:b,en:"footer",ans:b,a:"style-name"},{ens:b,en:"grid",ans:b,a:"style-name"},{ens:b,en:"legend",ans:b,a:"style-name"},{ens:b,en:"mean-value",ans:b,a:"style-name"},{ens:b,en:"plot-area",ans:b,a:"style-name"},{ens:b,en:"regression-curve", +ans:b,a:"style-name"},{ens:b,en:"series",ans:b,a:"style-name"},{ens:b,en:"stock-gain-marker",ans:b,a:"style-name"},{ens:b,en:"stock-loss-marker",ans:b,a:"style-name"},{ens:b,en:"stock-range-line",ans:b,a:"style-name"},{ens:b,en:"subtitle",ans:b,a:"style-name"},{ens:b,en:"title",ans:b,a:"style-name"},{ens:b,en:"wall",ans:b,a:"style-name"}],section:[{ens:w,en:"alphabetical-index",ans:w,a:"style-name"},{ens:w,en:"bibliography",ans:w,a:"style-name"},{ens:w,en:"illustration-index",ans:w,a:"style-name"}, +{ens:w,en:"index-title",ans:w,a:"style-name"},{ens:w,en:"object-index",ans:w,a:"style-name"},{ens:w,en:"section",ans:w,a:"style-name"},{ens:w,en:"table-of-content",ans:w,a:"style-name"},{ens:w,en:"table-index",ans:w,a:"style-name"},{ens:w,en:"user-index",ans:w,a:"style-name"}],ruby:[{ens:w,en:"ruby",ans:w,a:"style-name"}],table:[{ens:e,en:"query",ans:e,a:"style-name"},{ens:e,en:"table-representation",ans:e,a:"style-name"},{ens:x,en:"background",ans:x,a:"style-name"},{ens:x,en:"table",ans:x,a:"style-name"}], +"table-column":[{ens:e,en:"column",ans:e,a:"style-name"},{ens:x,en:"table-column",ans:x,a:"style-name"}],"table-row":[{ens:e,en:"query",ans:e,a:"default-row-style-name"},{ens:e,en:"table-representation",ans:e,a:"default-row-style-name"},{ens:x,en:"table-row",ans:x,a:"style-name"}],"table-cell":[{ens:e,en:"column",ans:e,a:"default-cell-style-name"},{ens:x,en:"table-column",ans:x,a:"default-cell-style-name"},{ens:x,en:"table-row",ans:x,a:"default-cell-style-name"},{ens:x,en:"body",ans:x,a:"style-name"}, +{ens:x,en:"covered-table-cell",ans:x,a:"style-name"},{ens:x,en:"even-columns",ans:x,a:"style-name"},{ens:x,en:"covered-table-cell",ans:x,a:"style-name"},{ens:x,en:"even-columns",ans:x,a:"style-name"},{ens:x,en:"even-rows",ans:x,a:"style-name"},{ens:x,en:"first-column",ans:x,a:"style-name"},{ens:x,en:"first-row",ans:x,a:"style-name"},{ens:x,en:"last-column",ans:x,a:"style-name"},{ens:x,en:"last-row",ans:x,a:"style-name"},{ens:x,en:"odd-columns",ans:x,a:"style-name"},{ens:x,en:"odd-rows",ans:x,a:"style-name"}, +{ens:x,en:"table-cell",ans:x,a:"style-name"}],graphic:[{ens:n,en:"cube",ans:g,a:"style-name"},{ens:n,en:"extrude",ans:g,a:"style-name"},{ens:n,en:"rotate",ans:g,a:"style-name"},{ens:n,en:"scene",ans:g,a:"style-name"},{ens:n,en:"sphere",ans:g,a:"style-name"},{ens:g,en:"caption",ans:g,a:"style-name"},{ens:g,en:"circle",ans:g,a:"style-name"},{ens:g,en:"connector",ans:g,a:"style-name"},{ens:g,en:"control",ans:g,a:"style-name"},{ens:g,en:"custom-shape",ans:g,a:"style-name"},{ens:g,en:"ellipse",ans:g,a:"style-name"}, +{ens:g,en:"frame",ans:g,a:"style-name"},{ens:g,en:"g",ans:g,a:"style-name"},{ens:g,en:"line",ans:g,a:"style-name"},{ens:g,en:"measure",ans:g,a:"style-name"},{ens:g,en:"page-thumbnail",ans:g,a:"style-name"},{ens:g,en:"path",ans:g,a:"style-name"},{ens:g,en:"polygon",ans:g,a:"style-name"},{ens:g,en:"polyline",ans:g,a:"style-name"},{ens:g,en:"rect",ans:g,a:"style-name"},{ens:g,en:"regular-polygon",ans:g,a:"style-name"},{ens:y,en:"annotation",ans:g,a:"style-name"}],presentation:[{ens:n,en:"cube",ans:v, +a:"style-name"},{ens:n,en:"extrude",ans:v,a:"style-name"},{ens:n,en:"rotate",ans:v,a:"style-name"},{ens:n,en:"scene",ans:v,a:"style-name"},{ens:n,en:"sphere",ans:v,a:"style-name"},{ens:g,en:"caption",ans:v,a:"style-name"},{ens:g,en:"circle",ans:v,a:"style-name"},{ens:g,en:"connector",ans:v,a:"style-name"},{ens:g,en:"control",ans:v,a:"style-name"},{ens:g,en:"custom-shape",ans:v,a:"style-name"},{ens:g,en:"ellipse",ans:v,a:"style-name"},{ens:g,en:"frame",ans:v,a:"style-name"},{ens:g,en:"g",ans:v,a:"style-name"}, +{ens:g,en:"line",ans:v,a:"style-name"},{ens:g,en:"measure",ans:v,a:"style-name"},{ens:g,en:"page-thumbnail",ans:v,a:"style-name"},{ens:g,en:"path",ans:v,a:"style-name"},{ens:g,en:"polygon",ans:v,a:"style-name"},{ens:g,en:"polyline",ans:v,a:"style-name"},{ens:g,en:"rect",ans:v,a:"style-name"},{ens:g,en:"regular-polygon",ans:v,a:"style-name"},{ens:y,en:"annotation",ans:v,a:"style-name"}],"drawing-page":[{ens:g,en:"page",ans:g,a:"style-name"},{ens:v,en:"notes",ans:g,a:"style-name"},{ens:s,en:"handout-master", +ans:g,a:"style-name"},{ens:s,en:"master-page",ans:g,a:"style-name"}],"list-style":[{ens:w,en:"list",ans:w,a:"style-name"},{ens:w,en:"numbered-paragraph",ans:w,a:"style-name"},{ens:w,en:"list-item",ans:w,a:"style-override"},{ens:s,en:"style",ans:s,a:"list-style-name"}],data:[{ens:s,en:"style",ans:s,a:"data-style-name"},{ens:s,en:"style",ans:s,a:"percentage-data-style-name"},{ens:v,en:"date-time-decl",ans:s,a:"data-style-name"},{ens:w,en:"creation-date",ans:s,a:"data-style-name"},{ens:w,en:"creation-time", +ans:s,a:"data-style-name"},{ens:w,en:"database-display",ans:s,a:"data-style-name"},{ens:w,en:"date",ans:s,a:"data-style-name"},{ens:w,en:"editing-duration",ans:s,a:"data-style-name"},{ens:w,en:"expression",ans:s,a:"data-style-name"},{ens:w,en:"meta-field",ans:s,a:"data-style-name"},{ens:w,en:"modification-date",ans:s,a:"data-style-name"},{ens:w,en:"modification-time",ans:s,a:"data-style-name"},{ens:w,en:"print-date",ans:s,a:"data-style-name"},{ens:w,en:"print-time",ans:s,a:"data-style-name"},{ens:w, +en:"table-formula",ans:s,a:"data-style-name"},{ens:w,en:"time",ans:s,a:"data-style-name"},{ens:w,en:"user-defined",ans:s,a:"data-style-name"},{ens:w,en:"user-field-get",ans:s,a:"data-style-name"},{ens:w,en:"user-field-input",ans:s,a:"data-style-name"},{ens:w,en:"variable-get",ans:s,a:"data-style-name"},{ens:w,en:"variable-input",ans:s,a:"data-style-name"},{ens:w,en:"variable-set",ans:s,a:"data-style-name"}],"page-layout":[{ens:v,en:"notes",ans:s,a:"page-layout-name"},{ens:s,en:"handout-master",ans:s, +a:"page-layout-name"},{ens:s,en:"master-page",ans:s,a:"page-layout-name"}]},C,F=xmldom.XPath;this.collectUsedFontFaces=l;this.changeFontFaceNames=r;this.UsedStyleList=function(b,a){var c={};this.uses=function(b){var a=b.localName,e=b.getAttributeNS(g,"name")||b.getAttributeNS(s,"name");b="style"===a?b.getAttributeNS(s,"family"):b.namespaceURI===t?"data":a;return(b=c[b])?0<b[e]:!1};d(b,c);a&&m(a,c)};this.getStyleName=function(b,a){var c,e,d=C[a.localName];if(d&&(d=d[a.namespaceURI]))for(e=0;e<d.length;e+= +1)if(d[e].keyname===b&&(d=d[e],a.hasAttributeNS(d.ns,d.localname))){c=a.getAttributeNS(d.ns,d.localname);break}return c};this.hasDerivedStyles=function(b,a,c){var e=c.getAttributeNS(s,"name");c=c.getAttributeNS(s,"family");return F.getODFElementsWithXPath(b,"//style:*[@style:parent-style-name='"+e+"'][@style:family='"+c+"']",a).length?!0:!1};this.prefixStyleNames=function(b,a,c){var e;if(b){for(e=b.firstChild;e;){if(e.nodeType===Node.ELEMENT_NODE){var d=e,n=a,h=d.getAttributeNS(g,"name"),m=void 0; +h?m=g:(h=d.getAttributeNS(s,"name"))&&(m=s);m&&d.setAttributeNS(m,B[m]+"name",n+h)}e=e.nextSibling}f(b,a);c&&f(c,a)}};this.removePrefixFromStyleNames=function(b,a,c){var e=RegExp("^"+a);if(b){for(a=b.firstChild;a;){if(a.nodeType===Node.ELEMENT_NODE){var d=a,f=e,n=d.getAttributeNS(g,"name"),h=void 0;n?h=g:(n=d.getAttributeNS(s,"name"))&&(h=s);h&&(n=n.replace(f,""),d.setAttributeNS(h,B[h]+"name",n))}a=a.nextSibling}k(b,e);c&&k(c,e)}};this.determineStylesForNode=a;C=function(){var b,a,c,e,d,g={},f,n, +h,m;for(c in I)if(I.hasOwnProperty(c))for(e=I[c],a=e.length,b=0;b<a;b+=1)d=e[b],h=d.en,m=d.ens,g.hasOwnProperty(h)?f=g[h]:g[h]=f={},f.hasOwnProperty(m)?n=f[m]:f[m]=n=[],n.push({ns:d.ans,localname:d.a,keyname:c});return g}()};"function"!==typeof Object.create&&(Object.create=function(f){var k=function(){};k.prototype=f;return new k}); +xmldom.LSSerializer=function(){function f(a){var d=a||{},f=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}(a),p=[d],m=[f],l=0;this.push=function(){l+=1;d=p[l]=Object.create(d);f=m[l]=Object.create(f)};this.pop=function(){p.pop();m.pop();l-=1;d=p[l];f=m[l]};this.getLocalNamespaceDefinitions=function(){return f};this.getQName=function(a){var b=a.namespaceURI,c=0,n;if(!b)return a.localName;if(n=f[b])return n+":"+a.localName;do{n||!a.prefix?(n="ns"+c,c+=1):n=a.prefix;if(d[n]=== +b)break;if(!d[n]){d[n]=b;f[b]=n;break}n=null}while(null===n);return n+":"+a.localName}}function k(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}function a(c,f){var q="",p=d.filter?d.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,m;if(p===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){c.push();m=c.getQName(f);var l,r=f.attributes,b,e,n,g="",u;l="<"+m;b=r.length;for(e=0;e<b;e+=1)n=r.item(e),"http://www.w3.org/2000/xmlns/"!== +n.namespaceURI&&(u=d.filter?d.filter.acceptNode(n):NodeFilter.FILTER_ACCEPT,u===NodeFilter.FILTER_ACCEPT&&(u=c.getQName(n),n="string"===typeof n.value?k(n.value):n.value,g+=" "+(u+'="'+n+'"')));b=c.getLocalNamespaceDefinitions();for(e in b)b.hasOwnProperty(e)&&((r=b[e])?"xmlns"!==r&&(l+=" xmlns:"+b[e]+'="'+e+'"'):l+=' xmlns="'+e+'"');q+=l+(g+">")}if(p===NodeFilter.FILTER_ACCEPT||p===NodeFilter.FILTER_SKIP){for(p=f.firstChild;p;)q+=a(c,p),p=p.nextSibling;f.nodeValue&&(q+=k(f.nodeValue))}m&&(q+="</"+ +m+">",c.pop());return q}var d=this;this.filter=null;this.writeToString=function(c,d){if(!c)return"";var q=new f(d);return a(q,c)}};(function(){function f(a){var b,c=p.length;for(b=0;b<c;b+=1)if("urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&a.localName===p[b])return b;return-1}function k(a,b){var e=new c.UsedStyleList(a,b),d=new odf.OdfNodeFilter;this.acceptNode=function(a){var c=d.acceptNode(a);c===NodeFilter.FILTER_ACCEPT&&a.parentNode===b&&a.nodeType===Node.ELEMENT_NODE&&(c=e.uses(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);return c}}function a(a,b){var c=new k(a,b);this.acceptNode=function(b){var a= +c.acceptNode(b);a!==NodeFilter.FILTER_ACCEPT||!b.parentNode||b.parentNode.namespaceURI!==odf.Namespaces.textns||"s"!==b.parentNode.localName&&"tab"!==b.parentNode.localName||(a=NodeFilter.FILTER_REJECT);return a}}function d(a,b){if(b){var c=f(b),d,g=a.firstChild;if(-1!==c){for(;g;){d=f(g);if(-1!==d&&d>c)break;g=g.nextSibling}a.insertBefore(b,g)}}}var c=new odf.StyleInfo,h=core.DomUtils,q=odf.Namespaces.stylens,p="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "), +m=Date.now()+"_webodf_",l=new core.Base64;odf.ODFElement=function(){};odf.ODFDocumentElement=function(){};odf.ODFDocumentElement.prototype=new odf.ODFElement;odf.ODFDocumentElement.prototype.constructor=odf.ODFDocumentElement;odf.ODFDocumentElement.prototype.fontFaceDecls=null;odf.ODFDocumentElement.prototype.manifest=null;odf.ODFDocumentElement.prototype.settings=null;odf.ODFDocumentElement.namespaceURI="urn:oasis:names:tc:opendocument:xmlns:office:1.0";odf.ODFDocumentElement.localName="document"; +odf.AnnotationElement=function(){};odf.OdfPart=function(a,b,c,d){var g=this;this.size=0;this.type=null;this.name=a;this.container=c;this.url=null;this.mimetype=b;this.onstatereadychange=this.document=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.data="";this.load=function(){null!==d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(b,a){b&&runtime.log(b);g.url=a;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))}};odf.OdfPart.prototype.load=function(){}; +odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+l.toBase64(this.data):null};odf.OdfContainer=function b(e,f){function g(b){for(var a=b.firstChild,c;a;)c=a.nextSibling,a.nodeType===Node.ELEMENT_NODE?g(a):a.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&b.removeChild(a),a=c}function p(b){var a={},c,e,d=b.ownerDocument.createNodeIterator(b,NodeFilter.SHOW_ELEMENT,null,!1);for(b=d.nextNode();b;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&("annotation"=== +b.localName?(c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(a.hasOwnProperty(c)?runtime.log("Warning: annotation name used more than once with <office:annotation/>: '"+c+"'"):a[c]=b):"annotation-end"===b.localName&&((c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?a.hasOwnProperty(c)?(e=a[c],e.annotationEndElement?runtime.log("Warning: annotation name used more than once with <office:annotation-end/>: '"+c+"'"):e.annotationEndElement= +b):runtime.log("Warning: annotation end without an annotation start, name: '"+c+"'"):runtime.log("Warning: annotation end without a name found"))),b=d.nextNode()}function t(b,a){for(var c=b&&b.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS("urn:webodf:names:scope","scope",a),c=c.nextSibling}function y(b,a){for(var c=E.rootElement.meta,c=c&&c.firstChild;c&&(c.namespaceURI!==b||c.localName!==a);)c=c.nextSibling;for(c=c&&c.firstChild;c&&c.nodeType!==Node.TEXT_NODE;)c=c.nextSibling;return c? +c.data:null}function v(b){var a={},c;for(b=b.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&b.namespaceURI===q&&"font-face"===b.localName&&(c=b.getAttributeNS(q,"name"),a[c]=b),b=b.nextSibling;return a}function s(b,a){var c=null,e,d,g;if(b)for(c=b.cloneNode(!0),e=c.firstElementChild;e;)d=e.nextElementSibling,(g=e.getAttributeNS("urn:webodf:names:scope","scope"))&&g!==a&&c.removeChild(e),e=d;return c}function x(b,a){var e,d,g,f=null,n={};if(b)for(a.forEach(function(b){c.collectUsedFontFaces(n,b)}), +f=b.cloneNode(!0),e=f.firstElementChild;e;)d=e.nextElementSibling,g=e.getAttributeNS(q,"name"),n[g]||f.removeChild(e),e=d;return f}function w(b){var a=E.rootElement.ownerDocument,c;if(b){g(b.documentElement);try{c=a.importNode(b.documentElement,!0)}catch(e){}}return c}function B(b){E.state=b;if(E.onchange)E.onchange(E);if(E.onstatereadychange)E.onstatereadychange(E)}function I(b){da=null;E.rootElement=b;b.fontFaceDecls=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"); +b.styles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");b.automaticStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");b.masterStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");b.body=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");b.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");b.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"settings");b.scripts=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");p(b)}function C(a){var e=w(a),g=E.rootElement,f;e&&"document-styles"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI?(g.fontFaceDecls=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),d(g,g.fontFaceDecls),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"styles"),d(g,g.styles),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),t(g.automaticStyles,"document-styles"),d(g,g.automaticStyles),e=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=e||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),d(g,g.masterStyles), +c.prefixStyleNames(g.automaticStyles,m,g.masterStyles)):B(b.INVALID)}function F(a){a=w(a);var e,g,f,n;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){e=E.rootElement;f=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(e.fontFaceDecls&&f){n=e.fontFaceDecls;var m,l,p,k,H={};g=v(n);k=v(f);for(f=f.firstElementChild;f;){m=f.nextElementSibling;if(f.namespaceURI===q&&"font-face"===f.localName)if(l=f.getAttributeNS(q, +"name"),g.hasOwnProperty(l)){if(!f.isEqualNode(g[l])){p=l;for(var K=g,s=k,u=0,z=void 0,z=p=p.replace(/\d+$/,"");K.hasOwnProperty(z)||s.hasOwnProperty(z);)u+=1,z=p+u;p=z;f.setAttributeNS(q,"style:name",p);n.appendChild(f);g[p]=f;delete k[l];H[l]=p}}else n.appendChild(f),g[l]=f,delete k[l];f=m}n=H}else f&&(e.fontFaceDecls=f,d(e,f));g=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");t(g,"document-content");n&&c.changeFontFaceNames(g,n);if(e.automaticStyles&&g)for(n= +g.firstChild;n;)e.automaticStyles.appendChild(n),n=g.firstChild;else g&&(e.automaticStyles=g,d(e,g));a=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw"<office:body/> tag is mising.";e.body=a;d(e,e.body)}else B(b.INVALID)}function J(b){b=w(b);var a;b&&"document-meta"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"), +d(a,a.meta))}function N(b){b=w(b);var a;b&&"document-settings"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),d(a,a.settings))}function K(b){b=w(b);var a;if(b&&"manifest"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===b.namespaceURI)for(a=E.rootElement,a.manifest=b,b=a.manifest.firstElementChild;b;)"file-entry"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"=== +b.namespaceURI&&(R[b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),b=b.nextElementSibling}function H(b,a,c){b=h.getElementsByTagName(b,a);var e;for(e=0;e<b.length;e+=1)a=b[e],c.hasOwnProperty(a.namespaceURI)||a.parentNode.removeChild(a)}function z(b){H(b,"script",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:office:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:table:1.0":!0, +"urn:oasis:names:tc:opendocument:xmlns:text:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":!0});H(b,"style",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:style:1.0":!0})}function Z(b){var a=b.firstElementChild,c=[],e,d,g,f=b.attributes,n=f.length;for(e=0;e<n;e+=1)g=f.item(e),d=g.localName.substr(0,2).toLowerCase(),null===g.namespaceURI&&"on"===d&&c.push(g);n=c.length;for(e= +0;e<n;e+=1)b.removeAttributeNode(c[e]);for(;a;)Z(a),a=a.nextElementSibling}function T(a){var c=a.shift();c?X.loadAsDOM(c.path,function(e,d){d&&(z(d),Z(d.documentElement));c.handler(d);E.state===b.INVALID?e?runtime.log("ERROR: Unable to load "+c.path+" - "+e):runtime.log("ERROR: Unable to load "+c.path):(e&&runtime.log("DEBUG: Unable to load "+c.path+" - "+e),T(a))}):(p(E.rootElement),B(b.DONE))}function G(b){var a="";odf.Namespaces.forEachPrefix(function(b,c){a+=" xmlns:"+b+'="'+c+'"'});return'<?xml version="1.0" encoding="UTF-8"?><office:'+ +b+" "+a+' office:version="1.2">'}function U(){var b=new xmldom.LSSerializer,a=G("document-meta");b.filter=new odf.OdfNodeFilter;a+=b.writeToString(E.rootElement.meta,odf.Namespaces.namespaceMap);return a+"</office:document-meta>"}function aa(b,a){var c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",b);c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", +"manifest:media-type",a);return c}function P(){var b=runtime.parseXML('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"></manifest:manifest>'),a=b.documentElement,c=new xmldom.LSSerializer,e;for(e in R)R.hasOwnProperty(e)&&a.appendChild(aa(e,R[e]));c.filter=new odf.OdfNodeFilter;return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+c.writeToString(b,odf.Namespaces.namespaceMap)}function D(){var b,a,e,d=odf.Namespaces.namespaceMap, +g=new xmldom.LSSerializer,f=G("document-styles");a=s(E.rootElement.automaticStyles,"document-styles");e=E.rootElement.masterStyles.cloneNode(!0);b=x(E.rootElement.fontFaceDecls,[e,E.rootElement.styles,a]);c.removePrefixFromStyleNames(a,m,e);g.filter=new k(e,a);f+=g.writeToString(b,d);f+=g.writeToString(E.rootElement.styles,d);f+=g.writeToString(a,d);f+=g.writeToString(e,d);return f+"</office:document-styles>"}function Q(){var b,c,e=odf.Namespaces.namespaceMap,d=new xmldom.LSSerializer,g=G("document-content"); +c=s(E.rootElement.automaticStyles,"document-content");b=x(E.rootElement.fontFaceDecls,[c]);d.filter=new a(E.rootElement.body,c);g+=d.writeToString(b,e);g+=d.writeToString(c,e);g+=d.writeToString(E.rootElement.body,e);return g+"</office:document-content>"}function $(a,c){runtime.loadXML(a,function(a,e){if(a)c(a);else if(e){z(e);Z(e.documentElement);var d=w(e);d&&"document"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(I(d),B(b.DONE)):B(b.INVALID)}else c("No DOM was loaded.")})} +function A(b,a){var c;c=E.rootElement;var e=c.meta;e||(c.meta=e=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),d(c,e));c=e;b&&h.mapKeyValObjOntoNode(c,b,odf.Namespaces.lookupNamespaceURI);a&&h.removeKeyElementsFromNode(c,a,odf.Namespaces.lookupNamespaceURI)}function V(a,c){function e(b,a){var c;a||(a=b);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);n[b]=c;n.appendChild(c)}var d=new core.Zip("",null),g="application/vnd.oasis.opendocument."+ +a+(!0===c?"-template":""),f=runtime.byteArrayFromString(g,"utf8"),n=E.rootElement,h=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);d.save("mimetype",f,!1,new Date);e("meta");e("settings");e("scripts");e("fontFaceDecls","font-face-decls");e("styles");e("automaticStyles","automatic-styles");e("masterStyles","master-styles");e("body");n.body.appendChild(h);R["/"]=g;R["settings.xml"]="text/xml";R["meta.xml"]="text/xml";R["styles.xml"]="text/xml";R["content.xml"]="text/xml"; +B(b.DONE);return d}function ba(){var b,a=new Date,c="";E.rootElement.settings&&E.rootElement.settings.firstElementChild&&(b=new xmldom.LSSerializer,c=G("document-settings"),b.filter=new odf.OdfNodeFilter,c+=b.writeToString(E.rootElement.settings,odf.Namespaces.namespaceMap),c+="</office:document-settings>");(b=c)?(b=runtime.byteArrayFromString(b,"utf8"),X.save("settings.xml",b,!0,a)):X.remove("settings.xml");c=runtime.getWindow();b="WebODF/"+webodf.Version;c&&(b=b+" "+c.navigator.userAgent);A({"meta:generator":b}, +null);b=runtime.byteArrayFromString(U(),"utf8");X.save("meta.xml",b,!0,a);b=runtime.byteArrayFromString(D(),"utf8");X.save("styles.xml",b,!0,a);b=runtime.byteArrayFromString(Q(),"utf8");X.save("content.xml",b,!0,a);b=runtime.byteArrayFromString(P(),"utf8");X.save("META-INF/manifest.xml",b,!0,a)}function Y(b,a){ba();X.writeAs(b,function(b){a(b)})}var E=this,X,R={},da,S="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=y;this.setRootElement=I;this.getContentElement=function(){var b; +da||(b=E.rootElement.body,da=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!da)throw"Could not find content element in <office:body/>.";return da};this.getDocumentType=function(){var b=E.getContentElement();return b&&b.localName};this.isTemplate=function(){return"-template"===R["/"].substr(-9)}; +this.setIsTemplate=function(b){var a=R["/"],c="-template"===a.substr(-9);b!==c&&(a=b?a+"-template":a.substr(0,a.length-9),R["/"]=a,b=runtime.byteArrayFromString(a,"utf8"),X.save("mimetype",b,!1,new Date))};this.getPart=function(b){return new odf.OdfPart(b,R[b],E,X)};this.getPartData=function(b,a){X.load(b,a)};this.setMetadata=A;this.incrementEditingCycles=function(){var b=y(odf.Namespaces.metans,"editing-cycles"),b=b?parseInt(b,10):0;isNaN(b)&&(b=0);A({"meta:editing-cycles":b+1},null);return b+1}; +this.createByteArray=function(b,a){ba();X.createByteArray(b,a)};this.saveAs=Y;this.save=function(b){Y(S,b)};this.getUrl=function(){return S};this.setBlob=function(b,a,c){c=l.convertBase64ToByteArray(c);X.save(b,c,!1,new Date);R.hasOwnProperty(b)&&runtime.log(b+" has been overwritten.");R[b]=a};this.removeBlob=function(b){var a=X.remove(b);runtime.assert(a,"file is not found: "+b);delete R[b]};this.state=b.LOADING;this.rootElement=function(b){var a=document.createElementNS(b.namespaceURI,b.localName), +c;b=new b.Type;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});e===odf.OdfContainer.DocumentType.TEXT?X=V("text"):e===odf.OdfContainer.DocumentType.TEXT_TEMPLATE?X=V("text",!0):e===odf.OdfContainer.DocumentType.PRESENTATION?X=V("presentation"):e===odf.OdfContainer.DocumentType.PRESENTATION_TEMPLATE?X=V("presentation",!0):e===odf.OdfContainer.DocumentType.SPREADSHEET?X=V("spreadsheet"): +e===odf.OdfContainer.DocumentType.SPREADSHEET_TEMPLATE?X=V("spreadsheet",!0):(S=e,X=new core.Zip(S,function(a,c){X=c;a?$(S,function(c){a&&(X.error=a+"\n"+c,B(b.INVALID))}):T([{path:"styles.xml",handler:C},{path:"content.xml",handler:F},{path:"meta.xml",handler:J},{path:"settings.xml",handler:N},{path:"META-INF/manifest.xml",handler:K}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer= +function(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,TEXT_TEMPLATE:2,PRESENTATION:3,PRESENTATION_TEMPLATE:4,SPREADSHEET:5,SPREADSHEET_TEMPLATE:6};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){}; +gui.AnnotationViewManager=function(f,k,a,d){function c(b){var a=b.annotationEndElement,c=l.createRange(),d=b.getAttributeNS(odf.Namespaces.officens,"name");a&&(c.setStart(b,b.childNodes.length),c.setEnd(a,0),b=r.getTextNodes(c,!1),b.forEach(function(b){var a;a:{for(a=b.parentNode;a.namespaceURI!==odf.Namespaces.officens||"body"!==a.localName;){if(a.namespaceURI===e&&"webodf-annotationHighlight"===a.className&&a.getAttribute("annotation")===d){a=!0;break a}a=a.parentNode}a=!1}a||(a=l.createElement("span"), +a.className="webodf-annotationHighlight",a.setAttribute("annotation",d),b.parentNode.replaceChild(a,b),a.appendChild(b))}));c.detach()}function h(c){var e=f.getSizer();c?(a.style.display="inline-block",e.style.paddingRight=b.getComputedStyle(a).width):(a.style.display="none",e.style.paddingRight=0);f.refreshSize()}function q(){m.sort(function(b,a){return 0!==(b.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function p(){var b;for(b=0;b<m.length;b+=1){var c=m[b],e=c.parentNode, +d=e.nextElementSibling,h=d.nextElementSibling,l=e.parentNode,p=0,p=m[m.indexOf(c)-1],q=void 0,c=f.getZoomLevel();e.style.left=(a.getBoundingClientRect().left-l.getBoundingClientRect().left)/c+"px";e.style.width=a.getBoundingClientRect().width/c+"px";d.style.width=parseFloat(e.style.left)-30+"px";p&&(q=p.parentNode.getBoundingClientRect(),20>=(l.getBoundingClientRect().top-q.bottom)/c?e.style.top=Math.abs(l.getBoundingClientRect().top-q.bottom)/c+20+"px":e.style.top="0px");h.style.left=d.getBoundingClientRect().width/ +c+"px";var d=h.style,l=h.getBoundingClientRect().left/c,p=h.getBoundingClientRect().top/c,q=e.getBoundingClientRect().left/c,k=e.getBoundingClientRect().top/c,r=0,I=0,r=q-l,r=r*r,I=k-p,I=I*I,l=Math.sqrt(r+I);d.width=l+"px";p=Math.asin((e.getBoundingClientRect().top-h.getBoundingClientRect().top)/(c*parseFloat(h.style.width)));h.style.transform="rotate("+p+"rad)";h.style.MozTransform="rotate("+p+"rad)";h.style.WebkitTransform="rotate("+p+"rad)";h.style.msTransform="rotate("+p+"rad)"}}var m=[],l=k.ownerDocument, +r=odf.OdfUtils,b=runtime.getWindow(),e="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(b),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=p;this.rehighlightAnnotations=function(){m.forEach(function(b){c(b)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==a.style.display&&0<m.length?(m[m.length-1].parentNode.getBoundingClientRect().bottom-a.getBoundingClientRect().top)/f.getZoomLevel()+"px":null};this.addAnnotation= +function(b){h(!0);m.push(b);q();var a=l.createElement("div"),e=l.createElement("div"),f=l.createElement("div"),k=l.createElement("div"),v;a.className="annotationWrapper";a.setAttribute("creator",r.getAnnotationCreator(b));b.parentNode.insertBefore(a,b);e.className="annotationNote";e.appendChild(b);d&&(v=l.createElement("div"),v.className="annotationRemoveButton",e.appendChild(v));f.className="annotationConnector horizontal";k.className="annotationConnector angular";a.appendChild(e);a.appendChild(f); +a.appendChild(k);b.annotationEndElement&&c(b);p()};this.forgetAnnotations=function(){for(;m.length;){var b=m[0],a=m.indexOf(b),c=b.parentNode.parentNode;"div"===c.localName&&(c.parentNode.insertBefore(b,c),c.parentNode.removeChild(c));for(var b=b.getAttributeNS(odf.Namespaces.officens,"name"),b=l.querySelectorAll('span.webodf-annotationHighlight[annotation="'+b+'"]'),e=c=void 0,c=0;c<b.length;c+=1){for(e=b.item(c);e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.parentNode.removeChild(e)}-1!== +a&&m.splice(a,1);0===m.length&&h(!1)}}};gui.Viewport=function(){};gui.Viewport.prototype.scrollIntoView=function(f,k){};gui.SingleScrollViewport=function(f){this.scrollIntoView=function(k,a){var d,c,h,q;q=f.offsetHeight-f.clientHeight;h=f.offsetWidth-f.clientWidth;var p=f.getBoundingClientRect();if(k&&p){d=p.left+5;c=p.top+5;h=p.right-(h+5);q=p.bottom-(q+5);if(a||k.top<c)f.scrollTop-=c-k.top;else if(k.top>q||k.bottom>q)f.scrollTop=k.bottom-k.top<=q-c?f.scrollTop+(k.bottom-q):f.scrollTop+(k.top-c);k.left<d?f.scrollLeft-=d-k.left:k.right>h&&(f.scrollLeft=k.right-k.left<=h-d?f.scrollLeft+(k.right-h):f.scrollLeft-(d-k.left))}}};(function(){function f(a,h,q,p,m){var l,k=0,b;for(b in a)if(a.hasOwnProperty(b)){if(k===q){l=b;break}k+=1}l?h.getPartData(a[l].href,function(b,n){if(b)runtime.log(b);else if(n){var g="@font-face { font-family: "+(a[l].family||l)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+d.convertUTF8ArrayToBase64(n)+') format("truetype"); }';try{p.insertRule(g,p.cssRules.length)}catch(k){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(k)+"\nRule: "+g)}}else runtime.log("missing font data for "+ +a[l].href);f(a,h,q+1,p,m)}):m&&m()}var k=xmldom.XPath,a=odf.OdfUtils,d=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(c,d){for(var q=c.rootElement.fontFaceDecls;d.cssRules.length;)d.deleteRule(d.cssRules.length-1);if(q){var p={},m,l,r,b;if(q)for(q=k.getODFElementsWithXPath(q,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),m=0;m<q.length;m+=1)l=q[m],r=l.getAttributeNS(odf.Namespaces.stylens,"name"),b=a.getNormalizedFontFamilyName(l.getAttributeNS(odf.Namespaces.svgns, +"font-family")),l=k.getODFElementsWithXPath(l,"svg:font-face-src/svg:font-face-uri",odf.Namespaces.lookupNamespaceURI),0<l.length&&(l=l[0].getAttributeNS(odf.Namespaces.xlinkns,"href"),p[r]={href:l,family:b});f(p,c,0,d)}}}})();odf.Formatting=function(){function f(b){return(b=B[b])?x.mergeObjects({},b):{}}function k(){for(var a=b.rootElement.fontFaceDecls,c={},e,d,a=a&&a.firstElementChild;a;){if(e=a.getAttributeNS(g,"name"))if((d=a.getAttributeNS(n,"font-family"))||0<a.getElementsByTagNameNS(n,"font-face-uri").length)c[e]=d;a=a.nextElementSibling}return c}function a(a){for(var c=b.rootElement.styles.firstElementChild;c;){if(c.namespaceURI===g&&"default-style"===c.localName&&c.getAttributeNS(g,"family")===a)return c;c=c.nextElementSibling}return null} +function d(a,c,e){var d,f,n;e=e||[b.rootElement.automaticStyles,b.rootElement.styles];for(n=0;n<e.length;n+=1)for(d=e[n],d=d.firstElementChild;d;){f=d.getAttributeNS(g,"name");if(d.namespaceURI===g&&"style"===d.localName&&d.getAttributeNS(g,"family")===c&&f===a||"list-style"===c&&d.namespaceURI===u&&"list-style"===d.localName&&f===a||"data"===c&&d.namespaceURI===t&&f===a)return d;d=d.nextElementSibling}return null}function c(b){for(var a,c,e,d,f={},n=b.firstElementChild;n;){if(n.namespaceURI===g)for(e= +f[n.nodeName]={},c=n.attributes,a=0;a<c.length;a+=1)d=c.item(a),e[d.name]=d.value;n=n.nextElementSibling}c=b.attributes;for(a=0;a<c.length;a+=1)d=c.item(a),f[d.name]=d.value;return f}function h(e,n){for(var h=b.rootElement.styles,m,l={},p=e.getAttributeNS(g,"family"),k=e;k;)m=c(k),l=x.mergeObjects(m,l),k=(m=k.getAttributeNS(g,"parent-style-name"))?d(m,p,[h]):null;if(k=a(p))m=c(k),l=x.mergeObjects(m,l);!1!==n&&(m=f(p),l=x.mergeObjects(m,l));return l}function q(b,a){function c(b){Object.keys(b).forEach(function(a){Object.keys(b[a]).forEach(function(b){n+= +"|"+a+":"+b+"|"})})}for(var d=b.nodeType===Node.TEXT_NODE?b.parentNode:b,g,f=[],n="",h=!1;d;)!h&&v.isGroupingElement(d)&&(h=!0),(g=e.determineStylesForNode(d))&&f.push(g),d=d.parentNode;h&&(f.forEach(c),a&&(a[n]=f));return h?f:void 0}function p(a){var c={orderedStyles:[],styleProperties:{}};a.forEach(function(a){Object.keys(a).forEach(function(e){var f=Object.keys(a[e])[0],n={name:f,family:e,displayName:void 0,isCommonStyle:!1},m;(m=d(f,e))?(e=h(m),c.styleProperties=x.mergeObjects(e,c.styleProperties), +n.displayName=m.getAttributeNS(g,"display-name")||void 0,n.isCommonStyle=m.parentNode===b.rootElement.styles):runtime.log("No style element found for '"+f+"' of family '"+e+"'");c.orderedStyles.push(n)})});return c}function m(b,a){var c={},e=[];a||(a={});b.forEach(function(b){q(b,c)});Object.keys(c).forEach(function(b){a[b]||(a[b]=p(c[b]));e.push(a[b])});return e}function l(a){for(var c=b.rootElement.masterStyles.firstElementChild;c&&(c.namespaceURI!==g||"master-page"!==c.localName||c.getAttributeNS(g, +"name")!==a);)c=c.nextElementSibling;return c}function r(b,a){var c;b&&(c=w.convertMeasure(b,"px"));void 0===c&&a&&(c=w.convertMeasure(a,"px"));return c}var b,e=new odf.StyleInfo,n=odf.Namespaces.svgns,g=odf.Namespaces.stylens,u=odf.Namespaces.textns,t=odf.Namespaces.numberns,y=odf.Namespaces.fons,v=odf.OdfUtils,s=core.DomUtils,x=new core.Utils,w=new core.CSSUnits,B={paragraph:{"style:paragraph-properties":{"fo:text-align":"left"}}};this.getSystemDefaultStyleAttributes=f;this.setOdfContainer=function(a){b= +a};this.getFontMap=k;this.getAvailableParagraphStyles=function(){for(var a=b.rootElement.styles,c,e,d=[],a=a&&a.firstElementChild;a;)"style"===a.localName&&a.namespaceURI===g&&(c=a.getAttributeNS(g,"family"),"paragraph"===c&&(c=a.getAttributeNS(g,"name"),e=a.getAttributeNS(g,"display-name")||c,c&&e&&d.push({name:c,displayName:e}))),a=a.nextElementSibling;return d};this.isStyleUsed=function(a){var c,d=b.rootElement;c=e.hasDerivedStyles(d,odf.Namespaces.lookupNamespaceURI,a);a=(new e.UsedStyleList(d.styles)).uses(a)|| +(new e.UsedStyleList(d.automaticStyles)).uses(a)||(new e.UsedStyleList(d.body)).uses(a);return c||a};this.getDefaultStyleElement=a;this.getStyleElement=d;this.getStyleAttributes=c;this.getInheritedStyleAttributes=h;this.getFirstCommonParentStyleNameOrSelf=function(a){var c=b.rootElement.styles,e;if(e=d(a,"paragraph",[b.rootElement.automaticStyles]))if(a=e.getAttributeNS(g,"parent-style-name"),!a)return null;return(e=d(a,"paragraph",[c]))?a:null};this.hasParagraphStyle=function(b){return Boolean(d(b, +"paragraph"))};this.getAppliedStyles=m;this.getAppliedStylesForElement=function(b,a){return m([b],a)[0]};this.updateStyle=function(a,c){var e,d;s.mapObjOntoNode(a,c,odf.Namespaces.lookupNamespaceURI);(e=(e=c["style:text-properties"])&&e["style:font-name"])&&!k().hasOwnProperty(e)&&(d=a.ownerDocument.createElementNS(g,"style:font-face"),d.setAttributeNS(g,"style:name",e),d.setAttributeNS(n,"svg:font-family",e),b.rootElement.fontFaceDecls.appendChild(d))};this.createDerivedStyleObject=function(a,e, +g){var f=d(a,e);runtime.assert(Boolean(f),"No style element found for '"+a+"' of family '"+e+"'");a=f.parentNode===b.rootElement.styles?{"style:parent-style-name":a}:c(f);a["style:family"]=e;x.mergeObjects(a,g);return a};this.getDefaultTabStopDistance=function(){for(var b=a("paragraph"),b=b&&b.firstElementChild,c;b;)b.namespaceURI===g&&"paragraph-properties"===b.localName&&(c=b.getAttributeNS(g,"tab-stop-distance")),b=b.nextElementSibling;c||(c="1.25cm");return v.parseNonNegativeLength(c)};this.getMasterPageElement= +l;this.getContentSize=function(a,c){var e,f,n,h,m,p,k,q,t,u;a:{f=d(a,c);runtime.assert("paragraph"===c||"table"===c,"styleFamily must be either paragraph or table");if(f){if(f=f.getAttributeNS(g,"master-page-name"))(e=l(f))||runtime.log("WARN: No master page definition found for "+f);e||(e=l("Standard"));e||(e=b.rootElement.masterStyles.getElementsByTagNameNS(g,"master-page")[0])||runtime.log("WARN: Document has no master pages defined");if(e)for(f=e.getAttributeNS(g,"page-layout-name"),n=b.rootElement.automaticStyles.getElementsByTagNameNS(g, +"page-layout"),h=0;h<n.length;h+=1)if(e=n.item(h),e.getAttributeNS(g,"name")===f)break a}e=null}e||(e=s.getDirectChild(b.rootElement.styles,g,"default-page-layout"));(e=s.getDirectChild(e,g,"page-layout-properties"))?("landscape"===e.getAttributeNS(g,"print-orientation")?(f="29.7cm",n="21.001cm"):(f="21.001cm",n="29.7cm"),f=r(e.getAttributeNS(y,"page-width"),f),n=r(e.getAttributeNS(y,"page-height"),n),h=r(e.getAttributeNS(y,"margin")),void 0===h?(h=r(e.getAttributeNS(y,"margin-left"),"2cm"),m=r(e.getAttributeNS(y, +"margin-right"),"2cm"),p=r(e.getAttributeNS(y,"margin-top"),"2cm"),k=r(e.getAttributeNS(y,"margin-bottom"),"2cm")):h=m=p=k=h,q=r(e.getAttributeNS(y,"padding")),void 0===q?(q=r(e.getAttributeNS(y,"padding-left"),"0cm"),t=r(e.getAttributeNS(y,"padding-right"),"0cm"),u=r(e.getAttributeNS(y,"padding-top"),"0cm"),e=r(e.getAttributeNS(y,"padding-bottom"),"0cm")):q=t=u=e=q):(f=r("21.001cm"),n=r("29.7cm"),h=m=p=k=h=r("2cm"),q=t=u=e=q=r("0cm"));return{width:f-h-m-q-t,height:n-p-k-u-e}}};(function(){var f=odf.Namespaces.stylens,k=odf.Namespaces.textns,a={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"};odf.StyleTreeNode=function(a){this.derivedStyles={};this.element=a};odf.StyleTree=function(d,c){function h(a){var b,c,d,g={};if(!a)return g;for(a=a.firstElementChild;a;){if(c=a.namespaceURI!==f||"style"!==a.localName&& +"default-style"!==a.localName?a.namespaceURI===k&&"list-style"===a.localName?"list":a.namespaceURI!==f||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(f,"family"))(b=a.getAttributeNS(f,"name"))||(b=""),g.hasOwnProperty(c)?d=g[c]:g[c]=d={},d[b]=a;a=a.nextElementSibling}return g}function q(a,b){if(a.hasOwnProperty(b))return a[b];var c=null,d=Object.keys(a),g;for(g=0;g<d.length&&!(c=q(a[d[g]].derivedStyles,b));g+=1);return c}function p(a,b,c){var d,g, +h;if(!b.hasOwnProperty(a))return null;d=new odf.StyleTreeNode(b[a]);g=d.element.getAttributeNS(f,"parent-style-name");h=null;g&&(h=q(c,g)||p(g,b,c));h?h.derivedStyles[a]=d:c[a]=d;delete b[a];return d}function m(a,b){a&&Object.keys(a).forEach(function(c){p(c,a,b)})}var l={};this.getStyleTree=function(){return l};(function(){var f,b,e;b=h(d);e=h(c);Object.keys(a).forEach(function(a){f=l[a]={};m(b[a],f);m(e[a],f)})})()}})();(function(){function f(a,c){try{a.insertRule(c,a.cssRules.length)}catch(d){runtime.log("cannot load rule: "+c+" - "+d)}}function k(a,c){this.listCounterCount=0;this.contentRules=a;this.counterIdStack=[];this.continuedCounterIdStack=c}function a(a){function c(e,d,p,k){var q=d.namespaceURI===h&&"list"===d.localName,r=d.namespaceURI===h&&"list-item"===d.localName;if(q||r){if(q){var q=p+=1,s,x,w;k.listCounterCount+=1;r=e+"-level"+q+"-"+k.listCounterCount;d.setAttributeNS("urn:webodf:names:helper","counter-id", +r);s=k.continuedCounterIdStack.shift();s||(s=r,b+=r+" 1 ",x='text|list[webodfhelper|counter-id="'+r+'"] > text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+s+" 0;",x+="}",f(a,x));for(;k.counterIdStack.length>=q;)k.counterIdStack.pop();k.counterIdStack.push(s);w=k.contentRules[q.toString()]||"";for(x=1;x<=q;x+=1)w=w.replace(x+"webodf-listLevel",k.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+r+'"] > text|list-item > :not(text|list):first-child:before'; +x+="{";x+=w;x+="counter-increment: "+s+";";x+="}";f(a,x)}for(d=d.firstElementChild;d;)c(e,d,p,k),d=d.nextElementSibling}else k.continuedCounterIdStack=[]}var d=0,b="",e={};this.createCounterRules=function(b,a,f){var h=a.getAttributeNS(q,"id"),m=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),m=e[f].slice(0));b=new k(b,m);h?h="Y"+h:(d+=1,h="X"+d);c(h,a,0,b);e[h+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var c;c="office|document{"+("counter-reset: "+b+ +";");c+="}";f(a,c)}}var d=odf.Namespaces.fons,c=odf.Namespaces.stylens,h=odf.Namespaces.textns,q=odf.Namespaces.xmlns,p={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function m(b){var a=n.parseLength(b);return a?e.convert(a.value,a.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function l(b){return b.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function k(b,a){var c;b&&(c=b.getAttributeNS(h,"style-name"));return c===a}function b(b, +e,d){e=e.getElementsByTagNameNS(h,"list");b=new a(b);var f,n,m,x,w,B,I={},C;for(C=0;C<e.length;C+=1)if(f=e.item(C),B=f.getAttributeNS(h,"style-name")){m=f.getAttributeNS(h,"continue-numbering");x=f.getAttributeNS(h,"continue-list");(w=f.getAttributeNS(q,"id"))&&(I[w]=f);w=d[B].element.firstElementChild;for(var F=void 0,J={};w;){var F=(F=w.getAttributeNS(h,"level"))&&parseInt(F,10),N=J,K=w,H="",z=void 0,Z=void 0,T=z=void 0;if("list-level-style-number"===K.localName){var G=K,H=G.getAttributeNS(c,"num-format"), +z=G.getAttributeNS(c,"num-suffix")||"",Z=G.getAttributeNS(c,"num-prefix")||"",U="",aa=G.getAttributeNS(h,"level"),G=G.getAttributeNS(h,"display-levels");Z&&(U+='"'+l(Z)+'"\n');if(p.hasOwnProperty(H))for(aa=aa?parseInt(aa,10):1,G=G?parseInt(G,10):1;0<G;)U+=" counter("+(aa-G+1)+"webodf-listLevel,"+p[H]+")",1<G&&(U+='"."'),G-=1;else U=H?U+(' "'+H+'"'):U+' ""';H="content:"+U+' "'+l(z)+'"'}else"list-level-style-image"===K.localName?H="content: none":"list-level-style-bullet"===K.localName&&(H=K.getAttributeNS(h, +"bullet-char"),H='content: "'+l(H)+'"');if(z=K.getElementsByTagNameNS(c,"list-level-properties")[0])Z=z.getAttributeNS(h,"list-level-position-and-space-mode"),"label-alignment"===Z&&((z=z.getElementsByTagNameNS(c,"list-level-label-alignment")[0])&&(T=z.getAttributeNS(h,"label-followed-by")),"space"===T&&(H+=' "\\a0"'));N[F]="\n"+H+";\n";w=w.nextElementSibling}w=J;m&&!x&&k(n,B)?b.createCounterRules(w,f,n):x&&k(I[x],B)?b.createCounterRules(w,f,I[x]):b.createCounterRules(w,f);n=f}b.initialiseCreatedCounters()} +var e=new core.CSSUnits,n=odf.OdfUtils;this.applyListStyles=function(a,e,n){var l,p;(l=e.list)&&Object.keys(l).forEach(function(b){p=l[b];for(var e=p.element.firstElementChild;e;){if(e.namespaceURI===h){for(var n=a,k=e,q='text|list[text|style-name="'+b+'"]',r=k.getAttributeNS(h,"level"),t=void 0,u=void 0,N=u=void 0,K=void 0,H=void 0,z=t=void 0,Z=void 0,T=void 0,G=void 0,K=void 0,N=(u=k.getElementsByTagNameNS(c,"list-level-properties")[0])&&u.getAttributeNS(h,"list-level-position-and-space-mode"), +K=u&&u.getElementsByTagNameNS(c,"list-level-label-alignment")[0],t=r=r&&parseInt(r,10);1<t;)q+=" > text|list-item > text|list",t-=1;t=u&&u.getAttributeNS(d,"text-align")||"left";switch(t){case "end":t="right";break;case "start":t="left"}"label-alignment"===N?(H=K&&K.getAttributeNS(d,"margin-left")||"0px",T=K&&K.getAttributeNS(d,"text-indent")||"0px",G=K&&K.getAttributeNS(h,"label-followed-by"),K=m(H)):(H=u&&u.getAttributeNS(h,"space-before")||"0px",z=u&&u.getAttributeNS(h,"min-label-width")||"0px", +Z=u&&u.getAttributeNS(h,"min-label-distance")||"0px",K=m(H)+m(z));u=q+" > text|list-item";u+="{";u+="margin-left: "+K+"px;";u+="}";f(n,u);u=q+" > text|list-item > text|list";u+="{";u+="margin-left: "+-K+"px;";u+="}";f(n,u);u=q+" > text|list-item > :not(text|list):first-child:before";u+="{";u+="text-align: "+t+";";u+="display: inline-block;";"label-alignment"===N?(u+="margin-left: "+T+";","listtab"===G&&(u+="padding-right: 0.2cm;")):(u+="min-width: "+z+";",u+="margin-left: "+(0===parseFloat(z)?"": +"-")+z+";",u+="padding-right: "+Z+";");u+="}";f(n,u)}e=e.nextElementSibling}});b(a,n,l)}}})();odf.LazyStyleProperties=function(f,k){var a={};this.value=function(d){var c;a.hasOwnProperty(d)?c=a[d]:(c=k[d](),void 0===c&&f&&(c=f.value(d)),a[d]=c);return c};this.reset=function(d){f=d;a={}}}; +odf.StyleParseUtils=function(){function f(a){var d,c;a=(a=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/.exec(a))?{value:parseFloat(a[1]),unit:a[3]}:null;c=a&&a.unit;"px"===c?d=a.value:"cm"===c?d=96*(a.value/2.54):"mm"===c?d=96*(a.value/25.4):"in"===c?d=96*a.value:"pt"===c?d=a.value/0.75:"pc"===c&&(d=16*a.value);return d}var k=odf.Namespaces.stylens;this.parseLength=f;this.parsePositiveLengthOrPercent=function(a,d,c){var h;a&&(h=parseFloat(a.substr(0, +a.indexOf("%"))),isNaN(h)&&(h=void 0));var k;void 0!==h?(c&&(k=c.value(d)),h=void 0===k?void 0:h*(k/100)):h=f(a);return h};this.getPropertiesElement=function(a,d,c){for(d=c?c.nextElementSibling:d.firstElementChild;null!==d&&(d.localName!==a||d.namespaceURI!==k);)d=d.nextElementSibling;return d};this.parseAttributeList=function(a){a&&(a=a.replace(/^\s*(.*?)\s*$/g,"$1"));return a&&0<a.length?a.split(/\s+/):[]}};odf.Style2CSS=function(){function f(b,a,c){var e=[];c=c.derivedStyles;var d;var g=y[b],h;void 0===g?a=null:(h=a?"["+g+'|style-name="'+a+'"]':"","presentation"===g&&(g="draw",h=a?'[presentation|style-name="'+a+'"]':""),a=g+"|"+v[b].join(h+","+g+"|")+h);null!==a&&e.push(a);for(d in c)c.hasOwnProperty(d)&&(a=f(b,d,c[d]),e=e.concat(a));return e}function k(b){var a="",c="",a=null;if("default-style"===b.localName)return null;a=b.getAttributeNS(r,"parent-style-name");c=b.getAttributeNS(r,"family");return a= +P.getODFElementsWithXPath(U,a?"//style:*[@style:name='"+a+"'][@style:family='"+c+"']":"//style:default-style[@style:family='"+c+"']",odf.Namespaces.lookupNamespaceURI)[0]}function a(b,a){var c="",e,d,g;for(e=0;e<a.length;e+=1)if(d=a[e],g=b.getAttributeNS(d[0],d[1])){g=g.trim();if(H.hasOwnProperty(d[1])){var f=g,h=f.indexOf(" "),n=void 0;g=void 0;-1!==h?(n=f.substring(0,h),g=f.substring(h)):(n=f,g="");(n=T.parseLength(n))&&"pt"===n.unit&&0.75>n.value&&(f="0.75pt"+g);g=f}else if(z.hasOwnProperty(d[1])){var f= +b,h=d[0],n=d[1],m=T.parseLength(g),l=void 0,p=void 0,q=void 0,K=void 0,q=void 0;if(m&&"%"===m.unit){l=m.value/100;p=k(f.parentNode);for(K="0";p;){if(q=u.getDirectChild(p,r,"paragraph-properties"))if(q=T.parseLength(q.getAttributeNS(h,n))){if("%"!==q.unit){K=q.value*l+q.unit;break}l*=q.value/100}p=k(p)}g=K}}d[2]&&(c+=d[2]+":"+g+";")}return c}function d(b,a,c,e){return a+a+c+c+e+e}function c(b,a){var e=[b],d=a.derivedStyles;Object.keys(d).forEach(function(b){b=c(b,d[b]);e=e.concat(b)});return e}function h(b, +a,e,d){function f(a,c){var e=[],d;a.forEach(function(b){h.forEach(function(a){e.push("draw|page[webodfhelper|page-style-name='"+a+"'] draw|frame[presentation|class='"+b+"']")})});0<e.length&&(d=e.join(",")+"{visibility:"+c+";}",b.insertRule(d,b.cssRules.length))}var h=c(a,d),n=[],m=[];["page-number","date-time","header","footer"].forEach(function(b){var a;a=e.getAttributeNS(g,"display-"+b);"true"===a?n.push(b):"false"===a&&m.push(b)});f(n,"visible");f(m,"hidden")}function q(b,c,H,z){var v,y;if("page"=== +c){var E=z.element,U="",R,P;P=R="";H=u.getDirectChild(E,r,"page-layout-properties");var S;if(H)if(S=E.getAttributeNS(r,"name"),U+=a(H,N),(R=u.getDirectChild(H,r,"background-image"))&&(P=R.getAttributeNS(n,"href"))&&(U=U+("background-image: url('odfkit:"+P+"');")+a(R,x)),"presentation"===G)for(E=(E=u.getDirectChild(E.parentNode.parentNode,l,"master-styles"))&&E.firstElementChild;E;)E.namespaceURI===r&&"master-page"===E.localName&&E.getAttributeNS(r,"page-layout-name")===S&&(P=E.getAttributeNS(r,"name"), +R="draw|page[draw|master-page-name="+P+"] {"+U+"}",P="office|body, draw|page[draw|master-page-name="+P+"] {"+a(H,K)+" }",b.insertRule(R,b.cssRules.length),b.insertRule(P,b.cssRules.length)),E=E.nextElementSibling;else"text"===G&&(R="office|text {"+U+"}",P="office|body {width: "+H.getAttributeNS(m,"page-width")+";}",b.insertRule(R,b.cssRules.length),b.insertRule(P,b.cssRules.length))}else{U=f(c,H,z).join(",");S="";if(E=u.getDirectChild(z.element,r,"text-properties")){var M=E,ea=y="";R="";P=1;E=""+ +a(M,s);v=M.getAttributeNS(r,"text-underline-style");"solid"===v&&(y+=" underline");v=M.getAttributeNS(r,"text-line-through-style");"solid"===v&&(y+=" line-through");y.length&&(E=E+("text-decoration:"+y+";\n")+("text-decoration-line:"+y+";\n"),E+="-moz-text-decoration-line:"+y+";\n");v=M.getAttributeNS(r,"text-line-through-type");switch(v){case "double":ea+=" double";break;case "single":ea+=" single"}ea&&(E+="text-decoration-style:"+ea+";\n",E+="-moz-text-decoration-style:"+ea+";\n");if(y=M.getAttributeNS(r, +"font-name")||M.getAttributeNS(m,"font-family"))v=Z[y],E+="font-family: "+(v||y)+";";if(v=M.getAttributeNS(r,"text-position"))y=t.parseAttributeList(v),v=y[0],y=y[1],E+="vertical-align: "+v+"\n; ",y&&(P=parseFloat(y)/100);if(M.hasAttributeNS(m,"font-size")||1!==P){for(M=M.parentNode;M;){if(v=(v=u.getDirectChild(M,r,"text-properties"))?T.parseFoFontSize(v.getAttributeNS(m,"font-size")):null){if("%"!==v.unit){R="font-size: "+v.value*P+v.unit+";";break}P*=v.value/100}M=k(M)}R||(R="font-size: "+parseFloat(aa)* +P+D.getUnits(aa)+";")}E+=R;S+=E}if(E=u.getDirectChild(z.element,r,"paragraph-properties"))R=E,E=""+a(R,w),(P=u.getDirectChild(R,r,"background-image"))&&(M=P.getAttributeNS(n,"href"))&&(E=E+("background-image: url('odfkit:"+M+"');")+a(P,x)),(R=R.getAttributeNS(m,"line-height"))&&"normal"!==R&&(R=T.parseFoLineHeight(R),E="%"!==R.unit?E+("line-height: "+R.value+R.unit+";"):E+("line-height: "+R.value/100+";")),S+=E;if(E=u.getDirectChild(z.element,r,"graphic-properties"))M=E,E=""+a(M,B),R=M.getAttributeNS(p, +"opacity"),P=M.getAttributeNS(p,"fill"),M=M.getAttributeNS(p,"fill-color"),"solid"===P||"hatch"===P?M&&"none"!==M?(R=isNaN(parseFloat(R))?1:parseFloat(R)/100,P=M.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,d),(M=(P=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(P))?{r:parseInt(P[1],16),g:parseInt(P[2],16),b:parseInt(P[3],16)}:null)&&(E+="background-color: rgba("+M.r+","+M.g+","+M.b+","+R+");")):E+="background: none;":"none"===P&&(E+="background: none;"),S+=E;if(E=u.getDirectChild(z.element,r,"drawing-page-properties"))R= +E,P=""+a(R,B),"true"===R.getAttributeNS(g,"background-visible")&&(P+="background: none;"),S+=P,h(b,H,E,z);if(E=u.getDirectChild(z.element,r,"table-cell-properties"))H=S,S=""+a(E,I),S=H+S;if(E=u.getDirectChild(z.element,r,"table-row-properties"))H=S,S=""+a(E,F),S=H+S;if(E=u.getDirectChild(z.element,r,"table-column-properties"))H=S,S=""+a(E,C),S=H+S;if(E=u.getDirectChild(z.element,r,"table-properties"))H=S,S=""+a(E,J),E=E.getAttributeNS(e,"border-model"),"collapsing"===E?S+="border-collapse:collapse;": +"separating"===E&&(S+="border-collapse:separate;"),S=H+S;0!==S.length&&b.insertRule(U+"{"+S+"}",b.cssRules.length)}for(var ha in z.derivedStyles)z.derivedStyles.hasOwnProperty(ha)&&q(b,c,ha,z.derivedStyles[ha])}var p=odf.Namespaces.drawns,m=odf.Namespaces.fons,l=odf.Namespaces.officens,r=odf.Namespaces.stylens,b=odf.Namespaces.svgns,e=odf.Namespaces.tablens,n=odf.Namespaces.xlinkns,g=odf.Namespaces.presentationns,u=core.DomUtils,t=new odf.StyleParseUtils,y={graphic:"draw","drawing-page":"draw",paragraph:"text", +presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"},v={graphic:"circle connected control custom-shape ellipse frame g line measure page page-thumbnail path polygon polyline rect regular-polygon".split(" "),paragraph:"alphabetical-index-entry-template h illustration-index-entry-template index-source-style object-index-entry-template p table-index-entry-template table-of-content-entry-template user-index-entry-template".split(" "), presentation:"caption circle connector control custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),"drawing-page":"caption circle connector control page custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),ruby:["ruby","ruby-text"],section:"alphabetical-index bibliography illustration-index index-title object-index section table-of-content table-index user-index".split(" "),table:["background", "table"],"table-cell":"body covered-table-cell even-columns even-rows first-column first-row last-column last-row odd-columns odd-rows table-cell".split(" "),"table-column":["table-column"],"table-row":["table-row"],text:"a index-entry-chapter index-entry-link-end index-entry-link-start index-entry-page-number index-entry-span index-entry-tab-stop index-entry-text index-title-template linenumbering-configuration list-level-style-number list-level-style-bullet outline-level-style span".split(" "), -list:["list-item"]},w=[[c,"color","color"],[c,"background-color","background-color"],[c,"font-weight","font-weight"],[c,"font-style","font-style"]],P=[[u,"repeat","background-repeat"]],B=[[c,"background-color","background-color"],[c,"text-align","text-align"],[c,"text-indent","text-indent"],[c,"padding","padding"],[c,"padding-left","padding-left"],[c,"padding-right","padding-right"],[c,"padding-top","padding-top"],[c,"padding-bottom","padding-bottom"],[c,"border-left","border-left"],[c,"border-right", -"border-right"],[c,"border-top","border-top"],[c,"border-bottom","border-bottom"],[c,"margin","margin"],[c,"margin-left","margin-left"],[c,"margin-right","margin-right"],[c,"margin-top","margin-top"],[c,"margin-bottom","margin-bottom"],[c,"border","border"]],E=[[c,"background-color","background-color"],[c,"min-height","min-height"],[g,"stroke","border"],[t,"stroke-color","border-color"],[t,"stroke-width","border-width"]],O=[[c,"background-color","background-color"],[c,"border-left","border-left"], -[c,"border-right","border-right"],[c,"border-top","border-top"],[c,"border-bottom","border-bottom"],[c,"border","border"]],y=[[u,"column-width","width"]],J=[[u,"row-height","height"],[c,"keep-together",null]],C=[[u,"width","width"],[c,"margin-left","margin-left"],[c,"margin-right","margin-right"],[c,"margin-top","margin-top"],[c,"margin-bottom","margin-bottom"]],D=[[c,"background-color","background-color"],[c,"padding","padding"],[c,"padding-left","padding-left"],[c,"padding-right","padding-right"], -[c,"padding-top","padding-top"],[c,"padding-bottom","padding-bottom"],[c,"border","border"],[c,"border-left","border-left"],[c,"border-right","border-right"],[c,"border-top","border-top"],[c,"border-bottom","border-bottom"],[c,"margin","margin"],[c,"margin-left","margin-left"],[c,"margin-right","margin-right"],[c,"margin-top","margin-top"],[c,"margin-bottom","margin-bottom"]],G=[[c,"page-width","width"],[c,"page-height","height"]],X={},Q=new odf.OdfUtils,F,K,H,U=new xmldom.XPath,Z=new core.CSSUnits; -this.style2css=function(a,b,c,d,g){for(var m,f,s,n;b.cssRules.length;)b.deleteRule(b.cssRules.length-1);m=null;d&&(m=d.ownerDocument,K=d.parentNode);g&&(m=g.ownerDocument,K=g.parentNode);if(m)for(n in odf.Namespaces.forEachPrefix(function(a,c){s="@namespace "+a+" url("+c+");";try{b.insertRule(s,b.cssRules.length)}catch(d){}}),X=c,F=a,H=window.getComputedStyle(document.body,null).getPropertyValue("font-size")||"12pt",a=e(d),d=e(g),g={},x)if(x.hasOwnProperty(n))for(f in c=g[n]={},p(a[n],c),p(d[n],c), -c)c.hasOwnProperty(f)&&q(b,n,f,c[f])}}; -// Input 29 -runtime.loadClass("core.Base64");runtime.loadClass("core.Zip");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.Namespaces"); -odf.OdfContainer=function(){function e(a,b,c){for(a=a?a.firstChild:null;a;){if(a.localName===c&&a.namespaceURI===b)return a;a=a.nextSibling}return null}function k(a){var b,c=q.length;for(b=0;b<c;b+=1)if(a.namespaceURI===d&&a.localName===q[b])return b;return-1}function l(a,b){var c;a&&(c=new f.UsedStyleList(a,b));this.acceptNode=function(a){return"http://www.w3.org/1999/xhtml"===a.namespaceURI?3:a.namespaceURI&&a.namespaceURI.match(/^urn:webodf:/)?2:c&&a.parentNode===b&&a.nodeType===Node.ELEMENT_NODE? -c.uses(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function p(a,b){if(b){var c=k(b),d,g=a.firstChild;if(-1!==c){for(;g;){d=k(g);if(-1!==d&&d>c)break;g=g.nextSibling}a.insertBefore(b,g)}}}function r(a){this.OdfContainer=a}function h(a,b,c,d){var g=this;this.size=0;this.type=null;this.name=a;this.container=c;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){null!== -d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);g.url=b;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))};this.abort=function(){}}function b(a){this.length=0;this.item=function(a){}}var f=new odf.StyleInfo,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",a="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",n="urn:webodf:names:scope",q="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),g=(new Date).getTime()+ -"_webodf_",c=new core.Base64;r.prototype=new function(){};r.prototype.constructor=r;r.namespaceURI=d;r.localName="document";h.prototype.load=function(){};h.prototype.getUrl=function(){return this.data?"data:;base64,"+c.toBase64(this.data):null};odf.OdfContainer=function t(c,m){function q(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?q(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function k(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&& -c.setAttributeNS(n,"scope",b),c=c.nextSibling}function v(a,b){var c=null,d,g,e;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)g=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(e=d.getAttributeNS(n,"scope"))&&e!==b&&c.removeChild(d),d=g;return c}function w(a){var b=M.rootElement.ownerDocument,c;if(a){q(a.documentElement);try{c=b.importNode(a.documentElement,!0)}catch(d){}}return c}function P(a){M.state=a;if(M.onchange)M.onchange(M);if(M.onstatereadychange)M.onstatereadychange(M)}function B(a){R=null; -M.rootElement=a;a.fontFaceDecls=e(a,d,"font-face-decls");a.styles=e(a,d,"styles");a.automaticStyles=e(a,d,"automatic-styles");a.masterStyles=e(a,d,"master-styles");a.body=e(a,d,"body");a.meta=e(a,d,"meta")}function E(a){a=w(a);var b=M.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===d?(b.fontFaceDecls=e(a,d,"font-face-decls"),p(b,b.fontFaceDecls),b.styles=e(a,d,"styles"),p(b,b.styles),b.automaticStyles=e(a,d,"automatic-styles"),k(b.automaticStyles,"document-styles"),p(b,b.automaticStyles), -b.masterStyles=e(a,d,"master-styles"),p(b,b.masterStyles),f.prefixStyleNames(b.automaticStyles,g,b.masterStyles)):P(t.INVALID)}function O(a){a=w(a);var b,c,g;if(a&&"document-content"===a.localName&&a.namespaceURI===d){b=M.rootElement;c=e(a,d,"font-face-decls");if(b.fontFaceDecls&&c)for(g=c.firstChild;g;)b.fontFaceDecls.appendChild(g),g=c.firstChild;else c&&(b.fontFaceDecls=c,p(b,c));c=e(a,d,"automatic-styles");k(c,"document-content");if(b.automaticStyles&&c)for(g=c.firstChild;g;)b.automaticStyles.appendChild(g), -g=c.firstChild;else c&&(b.automaticStyles=c,p(b,c));b.body=e(a,d,"body");p(b,b.body)}else P(t.INVALID)}function y(a){a=w(a);var b;a&&("document-meta"===a.localName&&a.namespaceURI===d)&&(b=M.rootElement,b.meta=e(a,d,"meta"),p(b,b.meta))}function J(a){a=w(a);var b;a&&("document-settings"===a.localName&&a.namespaceURI===d)&&(b=M.rootElement,b.settings=e(a,d,"settings"),p(b,b.settings))}function C(b){b=w(b);var c;if(b&&"manifest"===b.localName&&b.namespaceURI===a)for(c=M.rootElement,c.manifest=b,b=c.manifest.firstChild;b;)b.nodeType=== -Node.ELEMENT_NODE&&("file-entry"===b.localName&&b.namespaceURI===a)&&(T[b.getAttributeNS(a,"full-path")]=b.getAttributeNS(a,"media-type")),b=b.nextSibling}function D(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],S.loadAsDOM(c,function(b,c){d(c);M.state!==t.INVALID&&D(a)})):P(t.DONE)}function G(a){var b="";odf.Namespaces.forEachPrefix(function(a,c){b+=" xmlns:"+a+'="'+c+'"'});return'<?xml version="1.0" encoding="UTF-8"?><office:'+a+" "+b+' office:version="1.2">'}function X(){var a=new xmldom.LSSerializer, -b=G("document-meta");a.filter=new l;b+=a.writeToString(M.rootElement.meta,odf.Namespaces.namespaceMap);return b+"</office:document-meta>"}function Q(b,c){var d=document.createElementNS(a,"manifest:file-entry");d.setAttributeNS(a,"manifest:full-path",b);d.setAttributeNS(a,"manifest:media-type",c);return d}function F(){var b=runtime.parseXML('<manifest:manifest xmlns:manifest="'+a+'"></manifest:manifest>'),c=e(b,a,"manifest"),d=new xmldom.LSSerializer,g;for(g in T)T.hasOwnProperty(g)&&c.appendChild(Q(g, -T[g]));d.filter=new l;return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+d.writeToString(b,odf.Namespaces.namespaceMap)}function K(){var a=new xmldom.LSSerializer,b=G("document-settings");a.filter=new l;b+=a.writeToString(M.rootElement.settings,odf.Namespaces.namespaceMap);return b+"</office:document-settings>"}function H(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(M.rootElement.automaticStyles,"document-styles"),d=M.rootElement.masterStyles&&M.rootElement.masterStyles.cloneNode(!0), -e=G("document-styles");f.removePrefixFromStyleNames(c,g,d);b.filter=new l(d,c);e+=b.writeToString(M.rootElement.fontFaceDecls,a);e+=b.writeToString(M.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+"</office:document-styles>"}function U(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(M.rootElement.automaticStyles,"document-content"),d=G("document-content");b.filter=new l(M.rootElement.body,c);d+=b.writeToString(c,a);d+=b.writeToString(M.rootElement.body, -a);return d+"</office:document-content>"}function Z(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var g=w(c);g&&"document"===g.localName&&g.namespaceURI===d?(B(g),P(t.DONE)):P(t.INVALID)}})}function W(){function a(b,c){var e;c||(c=b);e=document.createElementNS(d,c);g[b]=e;g.appendChild(e)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),g=M.rootElement,e=document.createElementNS(d,"text");b.save("mimetype",c,!1,new Date);a("meta");a("settings"); -a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");g.body.appendChild(e);P(t.DONE);return b}function L(){var a,b=new Date;a=runtime.byteArrayFromString(K(),"utf8");S.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(X(),"utf8");S.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(H(),"utf8");S.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(U(),"utf8");S.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(F(), -"utf8");S.save("META-INF/manifest.xml",a,!0,b)}function I(a,b){L();S.writeAs(a,function(a){b(a)})}var M=this,S,T={},R;this.onstatereadychange=m;this.parts=this.rootElement=this.state=this.onchange=null;this.setRootElement=B;this.getContentElement=function(){var a;R||(a=M.rootElement.body,R=a.getElementsByTagNameNS(d,"text")[0]||a.getElementsByTagNameNS(d,"presentation")[0]||a.getElementsByTagNameNS(d,"spreadsheet")[0]);return R};this.getDocumentType=function(){var a=M.getContentElement();return a&& -a.localName};this.getPart=function(a){return new h(a,T[a],M,S)};this.getPartData=function(a,b){S.load(a,b)};this.createByteArray=function(a,b){L();S.createByteArray(a,b)};this.saveAs=I;this.save=function(a){I(c,a)};this.getUrl=function(){return c};this.state=t.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),c;a=new a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}(r);this.parts=new b(this);S=c?new core.Zip(c,function(a,b){S=b;a?Z(c,function(b){a&& -(S.error=a+"\n"+b,P(t.INVALID))}):D([["styles.xml",E],["content.xml",O],["meta.xml",y],["settings.xml",J],["META-INF/manifest.xml",C]])}):W()};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)};return odf.OdfContainer}(); -// Input 30 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.OdfContainer"); -odf.FontLoader=function(){function e(k,h,b,f,d){var a,n=0,q;for(q in k)if(k.hasOwnProperty(q)){if(n===b){a=q;break}n+=1}if(!a)return d();h.getPartData(k[a].href,function(g,c){if(g)runtime.log(g);else{var n="@font-face { font-family: '"+(k[a].family||a)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+p.convertUTF8ArrayToBase64(c)+') format("truetype"); }';try{f.insertRule(n,f.cssRules.length)}catch(q){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(q)+"\nRule: "+n)}}e(k, -h,b+1,f,d)})}function k(k,h,b){e(k,h,0,b,function(){})}var l=new xmldom.XPath,p=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(e,h){for(var b=e.rootElement.fontFaceDecls;h.cssRules.length;)h.deleteRule(h.cssRules.length-1);if(b){var f={},d,a,n,q;if(b)for(b=l.getODFElementsWithXPath(b,"style:font-face[svg:font-face-src]",odf.Namespaces.resolvePrefix),d=0;d<b.length;d+=1)a=b[d],n=a.getAttributeNS(odf.Namespaces.stylens,"name"),q=a.getAttributeNS(odf.Namespaces.svgns,"font-family"), -a=l.getODFElementsWithXPath(a,"svg:font-face-src/svg:font-face-uri",odf.Namespaces.resolvePrefix),0<a.length&&(a=a[0].getAttributeNS(odf.Namespaces.xlinkns,"href"),f[n]={href:a,family:q});k(f,e,h)}}};return odf.FontLoader}(); -// Input 31 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.OdfUtils");runtime.loadClass("odf.TextStyleApplicator"); -odf.Formatting=function(){function e(a,b){Object.keys(b).forEach(function(c){try{a[c]=b[c].constructor===Object?e(a[c],b[c]):b[c]}catch(d){a[c]=b[c]}});return a}function k(b,d,e){var f;e=e||[a.rootElement.automaticStyles,a.rootElement.styles];for(f=e.shift();f;){for(f=f.firstChild;f;){if(f.nodeType===Node.ELEMENT_NODE&&(f.namespaceURI===g&&"style"===f.localName&&f.getAttributeNS(g,"family")===d&&f.getAttributeNS(g,"name")===b||"list-style"===d&&f.namespaceURI===c&&"list-style"===f.localName&&f.getAttributeNS(g, -"name")===b))return f;f=f.nextSibling}f=e.shift()}return null}function l(a){for(var b={},c=a.firstChild;c;){if(c.nodeType===Node.ELEMENT_NODE&&c.namespaceURI===g)for(b[c.nodeName]={},a=0;a<c.attributes.length;a+=1)b[c.nodeName][c.attributes[a].name]=c.attributes[a].value;c=c.nextSibling}return b}function p(a,b){Object.keys(b).forEach(function(c){var d=c.split(":"),g=d[1],e=odf.Namespaces.resolvePrefix(d[0]),d=b[c];"object"===typeof d&&Object.keys(d).length?(c=a.getElementsByTagNameNS(e,g)[0]||a.ownerDocument.createElementNS(e, -c),a.appendChild(c),p(c,d)):a.setAttributeNS(e,c,d)})}function r(b){var c=a.rootElement.styles,d;d={};for(var f={},n=b;n;)d=l(n),f=e(d,f),n=(d=n.getAttributeNS(g,"parent-style-name"))?k(d,b.getAttributeNS(g,"family"),[c]):null;a:{b=b.getAttributeNS(g,"family");for(c=a.rootElement.styles.firstChild;c;){if(c.nodeType===Node.ELEMENT_NODE&&c.namespaceURI===g&&"default-style"===c.localName&&c.getAttributeNS(g,"family")===b){n=c;break a}c=c.nextSibling}n=null}n&&(d=l(n),f=e(d,f));return f}function h(a, -b){for(var c=a.nodeType===Node.TEXT_NODE?a.parentNode:a,d,g=[],e="",f=!1;c;)!f&&u.isGroupingElement(c)&&(f=!0),(d=n.determineStylesForNode(c))&&g.push(d),c=c.parentNode;f&&(g.forEach(function(a){Object.keys(a).forEach(function(b){Object.keys(a[b]).forEach(function(a){e+="|"+b+":"+a+"|"})})}),b&&(b[e]=g));return f?g:void 0}function b(a){var b={orderedStyles:[]};a.forEach(function(a){Object.keys(a).forEach(function(c){var d=Object.keys(a[c])[0],f,n;f=k(d,c);n=r(f);b=e(n,b);b.orderedStyles.push({name:d, -family:c,displayName:f.getAttributeNS(g,"display-name")})})});return b}function f(){var b,d=[];[a.rootElement.automaticStyles,a.rootElement.styles].forEach(function(a){for(b=a.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&(b.namespaceURI===g&&"style"===b.localName||b.namespaceURI===c&&"list-style"===b.localName)&&d.push(b.getAttributeNS(g,"name")),b=b.nextSibling});return d}var d=this,a,n=new odf.StyleInfo,q=odf.Namespaces.svgns,g=odf.Namespaces.stylens,c=odf.Namespaces.textns,u=new odf.OdfUtils; -this.setOdfContainer=function(b){a=b};this.getFontMap=function(){for(var b=a.rootElement.fontFaceDecls,c={},d,e,b=b&&b.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&(d=b.getAttributeNS(g,"name"))&&((e=b.getAttributeNS(q,"font-family"))||b.getElementsByTagNameNS(q,"font-face-uri")[0])&&(c[d]=e),b=b.nextSibling;return c};this.getAvailableParagraphStyles=function(){for(var b=a.rootElement.styles&&a.rootElement.styles.firstChild,c,d,e=[];b;)b.nodeType===Node.ELEMENT_NODE&&("style"===b.localName&&b.namespaceURI=== -g)&&(d=b,c=d.getAttributeNS(g,"family"),"paragraph"===c&&(c=d.getAttributeNS(g,"name"),d=d.getAttributeNS(g,"display-name")||c,c&&d&&e.push({name:c,displayName:d}))),b=b.nextSibling;return e};this.isStyleUsed=function(b){var c;c=n.hasDerivedStyles(a.rootElement,odf.Namespaces.resolvePrefix,b);b=(new n.UsedStyleList(a.rootElement.styles)).uses(b)||(new n.UsedStyleList(a.rootElement.automaticStyles)).uses(b)||(new n.UsedStyleList(a.rootElement.body)).uses(b);return c||b};this.getStyleElement=k;this.getStyleAttributes= -l;this.getInheritedStyleAttributes=r;this.getFirstNamedParentStyleNameOrSelf=function(b){for(var c=a.rootElement.automaticStyles,d=a.rootElement.styles,e;null!==(e=k(b,"paragraph",[c]));)b=e.getAttributeNS(g,"parent-style-name");return(e=k(b,"paragraph",[d]))?b:null};this.hasParagraphStyle=function(a){return Boolean(k(a,"paragraph"))};this.getAppliedStyles=function(a){var c={},d=[];u.getTextNodes(a).forEach(function(a){h(a,c)});Object.keys(c).forEach(function(a){d.push(b(c[a]))});return d};this.getAppliedStylesForElement= -function(a){return(a=h(a))?b(a):void 0};this.applyStyle=function(b,c){(new odf.TextStyleApplicator(d,a.rootElement.automaticStyles)).applyStyle(b,c)};this.updateStyle=function(a,b,c){var d;p(a,b);b=a.getAttributeNS(g,"name");if(c||!b){c=f();d=Math.floor(1E8*Math.random());do b="auto"+d,d+=1;while(-1!==c.indexOf(b));a.setAttributeNS(g,"style:name",b)}}}; -// Input 32 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.Formatting");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.FontLoader");runtime.loadClass("odf.Style2CSS");runtime.loadClass("odf.OdfUtils"); -odf.OdfCanvas=function(){function e(){function a(d){c=!0;runtime.setTimeout(function(){try{d()}catch(g){runtime.log(g)}c=!1;0<b.length&&a(b.pop())},10)}var b=[],c=!1;this.clearQueue=function(){b.length=0};this.addToQueue=function(d){if(0===b.length&&!c)return a(d);b.push(d)}}function k(a){function b(){for(;0<c.cssRules.length;)c.deleteRule(0);c.insertRule("#shadowContent draw|page {display:none;}",0);c.insertRule("office|presentation draw|page {display:none;}",1);c.insertRule("#shadowContent draw|page:nth-of-type("+ -d+") {display:block;}",2);c.insertRule("office|presentation draw|page:nth-of-type("+d+") {display:block;}",3)}var c=a.sheet,d=1;this.showFirstPage=function(){d=1;b()};this.showNextPage=function(){d+=1;b()};this.showPreviousPage=function(){1<d&&(d-=1,b())};this.showPage=function(a){0<a&&(d=a,b())};this.css=a}function l(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function p(a){function b(a,c){for(;c;){if(c===a)return!0;c=c.parentNode}return!1} -function c(){var e=[],f=runtime.getWindow().getSelection(),m,n;for(m=0;m<f.rangeCount;m+=1)n=f.getRangeAt(m),null!==n&&(b(a,n.startContainer)&&b(a,n.endContainer))&&e.push(n);if(e.length===d.length){for(f=0;f<e.length&&(m=e[f],n=d[f],m=m===n?!1:null===m||null===n?!0:m.startContainer!==n.startContainer||m.startOffset!==n.startOffset||m.endContainer!==n.endContainer||m.endOffset!==n.endOffset,!m);f+=1);if(f===e.length)return}d=e;var f=[e.length],h,s=a.ownerDocument;for(m=0;m<e.length;m+=1)n=e[m],h= -s.createRange(),h.setStart(n.startContainer,n.startOffset),h.setEnd(n.endContainer,n.endOffset),f[m]=h;d=f;f=g.length;for(e=0;e<f;e+=1)g[e](a,d)}var d=[],g=[];this.addListener=function(a,b){var c,d=g.length;for(c=0;c<d;c+=1)if(g[c]===b)return;g.push(b)};l(a,"mouseup",c);l(a,"keyup",c);l(a,"keydown",c)}function r(a,b,c){(new odf.Style2CSS).style2css(a.getDocumentType(),c.sheet,b.getFontMap(),a.rootElement.styles,a.rootElement.automaticStyles)}function h(a,b,c,d){c.setAttribute("styleid",b);var g,e= -c.getAttributeNS(v,"anchor-type"),f=c.getAttributeNS(A,"x"),n=c.getAttributeNS(A,"y"),s=c.getAttributeNS(A,"width"),q=c.getAttributeNS(A,"height"),k=c.getAttributeNS(t,"min-height"),p=c.getAttributeNS(t,"min-width"),l=c.getAttributeNS(u,"master-page-name"),r=null,x,w;x=0;var y,E=a.rootElement.ownerDocument;if(l){r=a.rootElement.masterStyles.getElementsByTagNameNS(m,"master-page");x=null;for(w=0;w<r.length;w+=1)if(r[w].getAttributeNS(m,"name")===l){x=r[w];break}r=x}else r=null;if(r){l=E.createElementNS(u, -"draw:page");y=r.firstElementChild;for(x=0;y;)"true"!==y.getAttributeNS(B,"placeholder")&&(w=y.cloneNode(!0),l.appendChild(w),h(a,b+"_"+x,w,d)),y=y.nextElementSibling,x+=1;J.appendChild(l);x=J.getElementsByTagNameNS(u,"page").length;if(w=l.getElementsByTagNameNS(v,"page-number")[0]){for(;w.firstChild;)w.removeChild(w.firstChild);w.appendChild(E.createTextNode(x))}h(a,b,l,d);l.setAttributeNS(u,"draw:master-page-name",r.getAttributeNS(m,"name"))}if("as-char"===e)g="display: inline-block;";else if(e|| -f||n)g="position: absolute;";else if(s||q||k||p)g="display: block;";f&&(g+="left: "+f+";");n&&(g+="top: "+n+";");s&&(g+="width: "+s+";");q&&(g+="height: "+q+";");k&&(g+="min-height: "+k+";");p&&(g+="min-width: "+p+";");g&&(g="draw|"+c.localName+'[styleid="'+b+'"] {'+g+"}",d.insertRule(g,d.cssRules.length))}function b(a){for(a=a.firstChild;a;){if(a.namespaceURI===s&&"binary-data"===a.localName)return"data:image/png;base64,"+a.textContent.replace(/[\r\n\s]/g,"");a=a.nextSibling}return""}function f(a, -c,d,g){function e(b){b&&(b='draw|image[styleid="'+a+'"] {'+("background-image: url("+b+");")+"}",g.insertRule(b,g.cssRules.length))}d.setAttribute("styleid",a);var f=d.getAttributeNS(w,"href"),m;if(f)try{m=c.getPart(f),m.onchange=function(a){e(a.url)},m.load()}catch(n){runtime.log("slight problem: "+n)}else f=b(d),e(f)}function d(a,b,c){function d(a,c,g){var e;c.hasAttributeNS(w,"href")&&(e=c.getAttributeNS(w,"href"),"#"===e[0]?(e=e.substring(1),a=function(){var a=O.getODFElementsWithXPath(b,"//text:bookmark-start[@text:name='"+ -e+"']",odf.Namespaces.resolvePrefix);0===a.length&&(a=O.getODFElementsWithXPath(b,"//text:bookmark[@text:name='"+e+"']",odf.Namespaces.resolvePrefix));0<a.length&&a[0].scrollIntoView(!0);return!1}):a=function(){E.open(e)},c.onclick=a)}var g,e,f;e=b.getElementsByTagNameNS(v,"a");for(g=0;g<e.length;g+=1)f=e.item(g),d(a,f,c)}function a(a){var b=a.ownerDocument;Array.prototype.slice.call(a.getElementsByTagNameNS(v,"s")).forEach(function(a){for(var c,d;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(b.createTextNode(" ")); -d=parseInt(a.getAttributeNS(v,"c"),10);if(1<d)for(a.removeAttributeNS(v,"c"),c=1;c<d;c+=1)a.parentNode.insertBefore(a.cloneNode(!0),a)})}function n(a){Array.prototype.slice.call(a.getElementsByTagNameNS(v,"tab")).forEach(function(a){a.textContent="\t"})}function q(a,c,d,g){function e(a,b){var c=n.documentElement.namespaceURI;"video/"===b.substr(0,6)?(f=n.createElementNS(c,"video"),f.setAttribute("controls","controls"),m=n.createElementNS(c,"source"),m.setAttribute("src",a),m.setAttribute("type",b), -f.appendChild(m),d.parentNode.appendChild(f)):d.innerHtml="Unrecognised Plugin"}var f,m,n=d.ownerDocument,h;if(a=d.getAttributeNS(w,"href"))try{h=c.getPart(a),h.onchange=function(a){e(a.url,a.mimetype)},h.load()}catch(s){runtime.log("slight problem: "+s)}else runtime.log("using MP4 data fallback"),a=b(d),e(a,"video/mp4")}function g(a){var b=a.getElementsByTagName("head")[0],c;"undefined"!==String(typeof webodf_css)?(c=a.createElementNS(b.namespaceURI,"style"),c.setAttribute("media","screen, print, handheld, projection"), -c.appendChild(a.createTextNode(webodf_css))):(c=a.createElementNS(b.namespaceURI,"link"),a="webodf.css",runtime.currentDirectory&&(a=runtime.currentDirectory()+"/../"+a),c.setAttribute("href",a),c.setAttribute("rel","stylesheet"));c.setAttribute("type","text/css");b.appendChild(c);return c}function c(a){var b=a.getElementsByTagName("head")[0],c=a.createElementNS(b.namespaceURI,"style"),d="";c.setAttribute("type","text/css");c.setAttribute("media","screen, print, handheld, projection");odf.Namespaces.forEachPrefix(function(a, -b){d+="@namespace "+a+" url("+b+");\n"});c.appendChild(a.createTextNode(d));b.appendChild(c);return c}var u=odf.Namespaces.drawns,t=odf.Namespaces.fons,s=odf.Namespaces.officens,m=odf.Namespaces.stylens,A=odf.Namespaces.svgns,x=odf.Namespaces.tablens,v=odf.Namespaces.textns,w=odf.Namespaces.xlinkns,P=odf.Namespaces.xmlns,B=odf.Namespaces.presentationns,E=runtime.getWindow(),O=new xmldom.XPath,y=new odf.OdfUtils,J;odf.OdfCanvas=function(b){function s(a,b,c){function d(a,b,c,g){z.addToQueue(function(){f(a, -b,c,g)})}var g,e;g=b.getElementsByTagNameNS(u,"image");for(b=0;b<g.length;b+=1)e=g.item(b),d("image"+String(b),a,e,c)}function t(a,b,c){function d(a,b,c,g){z.addToQueue(function(){q(a,b,c,g)})}var g,e;g=b.getElementsByTagNameNS(u,"plugin");for(b=0;b<g.length;b+=1)e=g.item(b),d("video"+String(b),a,e,c)}function A(){var a=b.firstChild;a.firstChild&&(1<R?(a.style.MozTransformOrigin="center top",a.style.WebkitTransformOrigin="center top",a.style.OTransformOrigin="center top",a.style.msTransformOrigin= -"center top"):(a.style.MozTransformOrigin="left top",a.style.WebkitTransformOrigin="left top",a.style.OTransformOrigin="left top",a.style.msTransformOrigin="left top"),a.style.WebkitTransform="scale("+R+")",a.style.MozTransform="scale("+R+")",a.style.OTransform="scale("+R+")",a.style.msTransform="scale("+R+")",b.style.width=Math.round(R*a.offsetWidth)+"px",b.style.height=Math.round(R*a.offsetHeight)+"px")}function w(c){function g(){for(var e=b;e.firstChild;)e.removeChild(e.firstChild);b.style.display= -"inline-block";var f=U.rootElement;b.ownerDocument.importNode(f,!0);Z.setOdfContainer(U);var e=U,q=I;(new odf.FontLoader).loadFonts(e,q.sheet);r(U,Z,M);for(var k=U,e=S.sheet,q=b;q.firstChild;)q.removeChild(q.firstChild);q=H.createElementNS(b.namespaceURI,"div");q.style.display="inline-block";q.style.background="white";q.appendChild(f);b.appendChild(q);J=H.createElementNS(b.namespaceURI,"div");J.id="shadowContent";J.style.position="absolute";J.style.top=0;J.style.left=0;k.getContentElement().appendChild(J); -var p=f.body,l,w,Q;w=[];for(l=p.firstChild;l&&l!==p;)if(l.namespaceURI===u&&(w[w.length]=l),l.firstChild)l=l.firstChild;else{for(;l&&l!==p&&!l.nextSibling;)l=l.parentNode;l&&l.nextSibling&&(l=l.nextSibling)}for(Q=0;Q<w.length;Q+=1)l=w[Q],h(k,"frame"+String(Q),l,e);w=O.getODFElementsWithXPath(p,".//*[*[@text:anchor-type='paragraph']]",odf.Namespaces.resolvePrefix);for(l=0;l<w.length;l+=1)p=w[l],p.setAttributeNS&&p.setAttributeNS("urn:webodf","containsparagraphanchor",!0);l=f.body.getElementsByTagNameNS(x, -"table-cell");for(p=0;p<l.length;p+=1)w=l.item(p),w.hasAttributeNS(x,"number-columns-spanned")&&w.setAttribute("colspan",w.getAttributeNS(x,"number-columns-spanned")),w.hasAttributeNS(x,"number-rows-spanned")&&w.setAttribute("rowspan",w.getAttributeNS(x,"number-rows-spanned"));d(k,f.body,e);a(f.body);n(f.body);s(k,f.body,e);t(k,f.body,e);l=f.body;var F,B,z,k={},p={},K;w=E.document.getElementsByTagNameNS(v,"list-style");for(f=0;f<w.length;f+=1)F=w.item(f),(B=F.getAttributeNS(m,"name"))&&(p[B]=F);l= -l.getElementsByTagNameNS(v,"list");for(f=0;f<l.length;f+=1)if(F=l.item(f),w=F.getAttributeNS(P,"id")){Q=F.getAttributeNS(v,"continue-list");F.setAttribute("id",w);z="text|list#"+w+" > text|list-item > *:first-child:before {";if(B=F.getAttributeNS(v,"style-name")){F=p[B];K=y.getFirstNonWhitespaceChild(F);F=void 0;if("list-level-style-number"===K.localName){F=K.getAttributeNS(m,"num-format");B=K.getAttributeNS(m,"num-suffix");var L="",L={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"}, -$=void 0,$=K.getAttributeNS(m,"num-prefix")||"",$=L.hasOwnProperty(F)?$+(" counter(list, "+L[F]+")"):F?$+("'"+F+"';"):$+" ''";B&&($+=" '"+B+"'");F=L="content: "+$+";"}else"list-level-style-image"===K.localName?F="content: none;":"list-level-style-bullet"===K.localName&&(F="content: '"+K.getAttributeNS(v,"bullet-char")+"';");K=F}if(Q){for(F=k[Q];F;)Q=F,F=k[Q];z+="counter-increment:"+Q+";";K?(K=K.replace("list",Q),z+=K):z+="content:counter("+Q+");"}else Q="",K?(K=K.replace("list",w),z+=K):z+="content: counter("+ -w+");",z+="counter-increment:"+w+";",e.insertRule("text|list#"+w+" {counter-reset:"+w+"}",e.cssRules.length);z+="}";k[w]=Q;z&&e.insertRule(z,e.cssRules.length)}q.insertBefore(J,q.firstChild);A();if(!c&&(e=[U],N.hasOwnProperty("statereadychange")))for(q=N.statereadychange,K=0;K<q.length;K+=1)q[K].apply(null,e)}U.state===odf.OdfContainer.DONE?g():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),runtime.setTimeout(function da(){U.state===odf.OdfContainer.DONE?g():(runtime.log("will be back later..."), -runtime.setTimeout(da,500))},100))}function F(){if(V){for(var a=V.ownerDocument.createDocumentFragment();V.firstChild;)a.insertBefore(V.firstChild,null);V.parentNode.replaceChild(a,V)}}function B(a){a=a||E.event;for(var b=a.target,c=E.getSelection(),d=0<c.rangeCount?c.getRangeAt(0):null,g=d&&d.startContainer,e=d&&d.startOffset,f=d&&d.endContainer,m=d&&d.endOffset,n,h;b&&("p"!==b.localName&&"h"!==b.localName||b.namespaceURI!==v);)b=b.parentNode;T&&(b&&b.parentNode!==V)&&(n=b.ownerDocument,h=n.documentElement.namespaceURI, -V?V.parentNode&&F():(V=n.createElementNS(h,"p"),V.style.margin="0px",V.style.padding="0px",V.style.border="0px",V.setAttribute("contenteditable",!0)),b.parentNode.replaceChild(V,b),V.appendChild(b),V.focus(),d&&(c.removeAllRanges(),d=b.ownerDocument.createRange(),d.setStart(g,e),d.setEnd(f,m),c.addRange(d)),a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.returnValue=!1,a.cancelBubble=!0))}runtime.assert(null!==b&&void 0!==b,"odf.OdfCanvas constructor needs DOM element");var H=b.ownerDocument, -U,Z=new odf.Formatting,W=new p(b),L,I,M,S,T=!1,R=1,N={},V,z=new e;g(H);L=new k(c(H));I=c(H);M=c(H);S=c(H);this.refreshCSS=function(){r(U,Z,M);A()};this.refreshSize=function(){A()};this.odfContainer=function(){return U};this.slidevisibilitycss=function(){return L.css};this.setOdfContainer=function(a,b){U=a;w(!0===b)};this.load=this.load=function(a){z.clearQueue();b.innerHTML="loading "+a;b.removeAttribute("style");U=new odf.OdfContainer(a,function(a){U=a;w(!1)})};this.save=function(a){F();U.save(a)}; -this.setEditable=function(a){l(b,"click",B);(T=a)||F()};this.addListener=function(a,c){switch(a){case "selectionchange":W.addListener(a,c);break;case "click":l(b,a,c);break;default:var d=N[a];void 0===d&&(d=N[a]=[]);c&&-1===d.indexOf(c)&&d.push(c)}};this.getFormatting=function(){return Z};this.setZoomLevel=function(a){R=a;A()};this.getZoomLevel=function(){return R};this.fitToContainingElement=function(a,c){var d=b.offsetHeight/R;R=a/(b.offsetWidth/R);c/d<R&&(R=c/d);A()};this.fitToWidth=function(a){R= -a/(b.offsetWidth/R);A()};this.fitSmart=function(a,c){var d,g;d=b.offsetWidth/R;g=b.offsetHeight/R;d=a/d;void 0!==c&&c/g<d&&(d=c/g);R=Math.min(1,d);A()};this.fitToHeight=function(a){R=a/(b.offsetHeight/R);A()};this.showFirstPage=function(){L.showFirstPage()};this.showNextPage=function(){L.showNextPage()};this.showPreviousPage=function(){L.showPreviousPage()};this.showPage=function(a){L.showPage(a);A()};this.showAllPages=function(){};this.getElement=function(){return b}};return odf.OdfCanvas}(); -// Input 33 -runtime.loadClass("odf.OdfCanvas"); -odf.CommandLineTools=function(){this.roundTrip=function(e,k,l){new odf.OdfContainer(e,function(p){if(p.state===odf.OdfContainer.INVALID)return l("Document "+e+" is invalid.");p.state===odf.OdfContainer.DONE?p.saveAs(k,function(e){l(e)}):l("Document was not completely loaded.")})};this.render=function(e,k,l){for(k=k.getElementsByTagName("body")[0];k.firstChild;)k.removeChild(k.firstChild);k=new odf.OdfCanvas(k);k.addListener("statereadychange",function(e){l(e)});k.load(e)}}; -// Input 34 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.Operation=function(){};ops.Operation.prototype.init=function(e){};ops.Operation.prototype.execute=function(e){};ops.Operation.prototype.spec=function(){}; -// Input 35 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpAddCursor=function(){var e,k;this.init=function(l){e=l.memberid;k=l.timestamp};this.execute=function(k){var p=k.getCursor(e);if(p)return!1;p=new ops.OdtCursor(e,k);k.addCursor(p);k.emit(ops.OdtDocument.signalCursorAdded,p);return!0};this.spec=function(){return{optype:"AddCursor",memberid:e,timestamp:k}}}; -// Input 36 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.OdfUtils"); -ops.OpApplyStyle=function(){function e(b){var a=0<=h?r+h:r,e=b.getIteratorAtPosition(0<=h?r:r+h),a=h?b.getIteratorAtPosition(a):e;b=b.getDOM().createRange();b.setStart(e.container(),e.unfilteredDomOffset());b.setEnd(a.container(),a.unfilteredDomOffset());return b}function k(b){var a=b.commonAncestorContainer,e;e=Array.prototype.slice.call(a.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","p"));for(e=e.concat(Array.prototype.slice.call(a.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","h")));a&& -!f.isParagraph(a);)a=a.parentNode;a&&e.push(a);return e.filter(function(a){var g=a.nodeType===Node.TEXT_NODE?a.length:a.childNodes.length;return 0>=b.comparePoint(a,0)&&0<=b.comparePoint(a,g)})}var l,p,r,h,b,f=new odf.OdfUtils;this.init=function(d){l=d.memberid;p=d.timestamp;r=d.position;h=d.length;b=d.info};this.execute=function(d){var a=e(d),f=k(a);d.getFormatting().applyStyle(a,b);a.detach();d.getOdfCanvas().refreshCSS();f.forEach(function(a){d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a, -memberId:l,timeStamp:p})});return!0};this.spec=function(){return{optype:"ApplyStyle",memberid:l,timestamp:p,position:r,length:h,info:b}}}; -// Input 37 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpRemoveCursor=function(){var e,k;this.init=function(l){e=l.memberid;k=l.timestamp};this.execute=function(k){return k.removeCursor(e)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:e,timestamp:k}}}; -// Input 38 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpMoveCursor=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=r.length||0};this.execute=function(k){var h=k.getCursor(e),b=k.getCursorPosition(e),f=k.getPositionFilter(),d=l-b;if(!h)return!1;b=h.getStepCounter();d=0<d?b.countForwardSteps(d,f):0>d?-b.countBackwardSteps(-d,f):0;h.move(d);p&&(f=0<p?b.countForwardSteps(p,f):0>p?-b.countBackwardSteps(-p,f):0,h.move(f,!0));k.emit(ops.OdtDocument.signalCursorMoved,h);return!0};this.spec=function(){return{optype:"MoveCursor", -memberid:e,timestamp:k,position:l,length:p}}}; -// Input 39 -ops.OpInsertTable=function(){function e(b,d){var g;if(1===a.length)g=a[0];else if(3===a.length)switch(b){case 0:g=a[0];break;case p-1:g=a[2];break;default:g=a[1]}else g=a[b];if(1===g.length)return g[0];if(3===g.length)switch(d){case 0:return g[0];case r-1:return g[2];default:return g[1]}return g[d]}var k,l,p,r,h,b,f,d,a;this.init=function(e){k=e.memberid;l=e.timestamp;h=e.position;p=e.initialRows;r=e.initialColumns;b=e.tableName;f=e.tableStyleName;d=e.tableColumnStyleName;a=e.tableCellStyleMatrix}; -this.execute=function(a){var q=a.getPositionInTextNode(h),g=a.getRootNode();if(q){var c=a.getDOM(),u=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),t=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column"),s,m,A,x;f&&u.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",f);b&&u.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",b);t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0", -"table:number-columns-repeated",r);d&&t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",d);u.appendChild(t);for(A=0;A<p;A+=1){t=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-row");for(x=0;x<r;x+=1)s=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-cell"),(m=e(A,x))&&s.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",m),m=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", -"text:p"),s.appendChild(m),t.appendChild(s);u.appendChild(t)}q=a.getParagraphElement(q.textNode);g.insertBefore(u,q?q.nextSibling:void 0);a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalTableAdded,{tableElement:u,memberId:k,timeStamp:l});return!0}return!1};this.spec=function(){return{optype:"InsertTable",memberid:k,timestamp:l,position:h,initialRows:p,initialColumns:r,tableName:b,tableStyleName:f,tableColumnStyleName:d,tableCellStyleMatrix:a}}}; -// Input 40 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpInsertText=function(){function e(e,b){var f=b.parentNode,d=b.nextSibling,a=[];e.getCursors().forEach(function(d){var e=d.getSelectedRange();!e||e.startContainer!==b&&e.endContainer!==b||a.push({cursor:d,startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset})});f.removeChild(b);f.insertBefore(b,d);a.forEach(function(a){var b=a.cursor.getSelectedRange();b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer,a.endOffset)})}var k, -l,p,r;this.init=function(e){k=e.memberid;l=e.timestamp;p=e.position;r=e.text};this.execute=function(h){var b,f=r.split(" "),d,a,n,q,g=h.getRootNode().ownerDocument,c;if(b=h.getPositionInTextNode(p,k)){a=b.textNode;n=a.parentNode;q=a.nextSibling;d=b.offset;b=h.getParagraphElement(a);d!==a.length&&(q=a.splitText(d));0<f[0].length&&a.appendData(f[0]);for(c=1;c<f.length;c+=1)d=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s"),d.appendChild(g.createTextNode(" ")),n.insertBefore(d, -q),0<f[c].length&&n.insertBefore(g.createTextNode(f[c]),q);e(h,a);0===a.length&&a.parentNode.removeChild(a);h.getOdfCanvas().refreshSize();h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,memberId:k,timeStamp:l});return!0}return!1};this.spec=function(){return{optype:"InsertText",memberid:k,timestamp:l,position:p,text:r}}}; -// Input 41 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpRemoveText=function(){function e(a){var b,d,c,e,f;b=a.getCursors();e=a.getPositionFilter();for(f in b)b.hasOwnProperty(f)&&(d=b[f].getStepCounter(),d.isPositionWalkable(e)||(c=-d.countBackwardSteps(1,e),0===c&&(c=d.countForwardSteps(1,e)),b[f].move(c),f===p&&a.emit(ops.OdtDocument.signalCursorMoved,b[f])))}function k(a){if(!d.isParagraph(a)&&(d.isGroupingElement(a)||d.isCharacterElement(a))&&0===a.textContent.length){for(a=a.firstChild;a;){if(d.isCharacterElement(a))return!1;a=a.nextSibling}return!0}return!1} -function l(b,e,g){var c,f;c=g?e.lastChild:e.firstChild;for(g&&(f=b.getElementsByTagNameNS(a,"editinfo")[0]||b.firstChild);c;){e.removeChild(c);if("editinfo"!==c.localName)if(k(c))for(;c.firstChild;)b.insertBefore(c.firstChild,f);else b.insertBefore(c,f);c=g?e.lastChild:e.firstChild}b=e.parentNode;b.removeChild(e);d.isListItem(b)&&0===b.childNodes.length&&b.parentNode.removeChild(b)}var p,r,h,b,f,d,a="urn:webodf:names:editinfo";this.init=function(a){runtime.assert(0<=a.length,"OpRemoveText only supports positive lengths"); -p=a.memberid;r=a.timestamp;h=parseInt(a.position,10);b=parseInt(a.length,10);f=a.text;d=new odf.OdfUtils};this.execute=function(a){var d=[],g,c,f,t=null,s=null,m;c=h;var A=b;a.upgradeWhitespacesAtPosition(c);g=a.getPositionInTextNode(c);var d=g.textNode,x=g.offset,v=d.parentNode;g=a.getParagraphElement(v);f=A;""===d.data?(v.removeChild(d),c=a.getTextNeighborhood(c,A)):0!==x?(v=f<d.length-x?f:d.length-x,d.deleteData(x,v),a.upgradeWhitespacesAtPosition(c),c=a.getTextNeighborhood(c,A+v),f-=v,v&&c[0]=== -d&&c.splice(0,1)):c=a.getTextNeighborhood(c,A);for(d=c;f;)if(d[0]&&(t=d[0],s=t.parentNode,m=t.length),c=a.getParagraphElement(t),g!==c){if(c=a.getNeighboringParagraph(g,1))1<a.getWalkableParagraphLength(g)?l(g,c,!1):(l(c,g,!0),g=c);f-=1}else if(m<=f){s.removeChild(t);for(e(a);k(s);){for(c=s.parentNode;s.firstChild;)c.insertBefore(s.firstChild,s);c.removeChild(s);s=c}f-=m;d.splice(0,1)}else t.deleteData(0,f),a.upgradeWhitespacesAtPosition(h),f=0;e(a);a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalParagraphChanged, -{paragraphElement:g,memberId:p,timeStamp:r});a.emit(ops.OdtDocument.signalCursorMoved,a.getCursor(p));return!0};this.spec=function(){return{optype:"RemoveText",memberid:p,timestamp:r,position:h,length:b,text:f}}}; -// Input 42 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpSplitParagraph=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=new odf.OdfUtils};this.execute=function(r){var h,b,f,d,a,n;h=r.getPositionInTextNode(l,e);if(!h)return!1;b=r.getParagraphElement(h.textNode);if(!b)return!1;f=p.isListItem(b.parentNode)?b.parentNode:b;0===h.offset?(n=h.textNode.previousSibling,a=null):(n=h.textNode,a=h.offset>=h.textNode.length?null:h.textNode.splitText(h.offset));for(h=h.textNode;h!==f;)if(h=h.parentNode,d=h.cloneNode(!1),n){for(a&& -d.appendChild(a);n.nextSibling;)d.appendChild(n.nextSibling);h.parentNode.insertBefore(d,h.nextSibling);n=h;a=d}else h.parentNode.insertBefore(d,h),n=d,a=h;p.isListItem(a)&&(a=a.childNodes[0]);r.getOdfCanvas().refreshSize();r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,memberId:e,timeStamp:k});r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:e,timeStamp:k});return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:e,timestamp:k,position:l}}}; -// Input 43 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpSetParagraphStyle=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=r.styleName};this.execute=function(r){var h;if(h=r.getPositionInTextNode(l))if(h=r.getParagraphElement(h.textNode))return""!==p?h.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",p):h.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),r.getOdfCanvas().refreshSize(),r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:h, -timeStamp:k,memberId:e}),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:e,timestamp:k,position:l,styleName:p}}}; -// Input 44 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpUpdateParagraphStyle=function(){function e(a,b,d){var e,c,f;for(e=0;e<d.length;e+=1)c=d[e],f=b[c.propertyName],void 0!==f&&a.setAttributeNS(c.attrNs,c.attrPrefix+":"+c.attrLocaName,void 0!==c.unit?f+c.unit:f)}function k(a,b,d){var e,c;for(e=0;e<d.length;e+=1)c=d[e],-1!==b.indexOf(c.propertyName)&&a.removeAttributeNS(c.attrNs,c.attrLocaName)}var l,p,r,h,b,f=[{propertyName:"fontSize",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"font-size", -unit:"pt"},{propertyName:"fontName",attrNs:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",attrPrefix:"style",attrLocaName:"font-name"},{propertyName:"color",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"color"},{propertyName:"backgroundColor",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"background-color"},{propertyName:"fontWeight",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", -attrPrefix:"fo",attrLocaName:"font-weight"},{propertyName:"fontStyle",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"font-style"},{propertyName:"underline",attrNs:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",attrPrefix:"style",attrLocaName:"text-underline-style"},{propertyName:"strikethrough",attrNs:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",attrPrefix:"style",attrLocaName:"text-line-through-style"}],d=[{propertyName:"topMargin",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", -attrPrefix:"fo",attrLocaName:"margin-top",unit:"mm"},{propertyName:"bottomMargin",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"margin-bottom",unit:"mm"},{propertyName:"leftMargin",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"margin-left",unit:"mm"},{propertyName:"rightMargin",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"margin-right",unit:"mm"}, -{propertyName:"textAlign",attrNs:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",attrPrefix:"fo",attrLocaName:"text-align"}];this.init=function(a){l=a.memberid;p=a.timestamp;r=a.styleName;h=a.setProperties;b=a.removedProperties};this.execute=function(a){var n,l,g,c;return(n=a.getParagraphStyleElement(r))?(l=n.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","paragraph-properties")[0],g=n.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0", -"text-properties")[0],h&&(void 0===l&&h.paragraphProperties&&(l=a.getDOM().createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:paragraph-properties"),n.appendChild(l)),void 0===g&&h.textProperties&&(g=a.getDOM().createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:text-properties"),n.appendChild(g)),h.paragraphProperties&&e(l,h.paragraphProperties,d),h.textProperties&&(h.textProperties.fontName&&!a.getOdfCanvas().getFormatting().getFontMap().hasOwnProperty(h.textProperties.fontName)&& -(c=a.getDOM().createElementNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:font-face"),c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:name",h.textProperties.fontName),c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","svg:font-family",h.textProperties.fontName),a.getOdfCanvas().odfContainer().rootElement.fontFaceDecls.appendChild(c)),e(g,h.textProperties,f))),b&&(b.paragraphPropertyNames&&(k(l,b.paragraphPropertyNames,d),0===l.attributes.length&& -n.removeChild(l)),b.textPropertyNames&&(k(g,b.textPropertyNames,f),0===g.attributes.length&&n.removeChild(g))),a.getOdfCanvas().refreshCSS(),a.emit(ops.OdtDocument.signalParagraphStyleModified,r),!0):!1};this.spec=function(){return{optype:"UpdateParagraphStyle",memberid:l,timestamp:p,styleName:r,setProperties:h,removedProperties:b}}}; -// Input 45 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpCloneParagraphStyle=function(){var e,k,l,p,r;this.init=function(h){e=h.memberid;k=h.timestamp;l=h.styleName;p=h.newStyleName;r=h.newStyleDisplayName};this.execute=function(e){var b=e.getParagraphStyleElement(l),f;if(!b)return!1;f=b.cloneNode(!0);f.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:name",p);r?f.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:display-name",r):f.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","display-name"); -b.parentNode.appendChild(f);e.getOdfCanvas().refreshCSS();e.emit(ops.OdtDocument.signalStyleCreated,p);return!0};this.spec=function(){return{optype:"CloneParagraphStyle",memberid:e,timestamp:k,styleName:l,newStyleName:p,newStyleDisplayName:r}}}; -// Input 46 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpDeleteParagraphStyle=function(){var e,k,l;this.init=function(p){e=p.memberid;k=p.timestamp;l=p.styleName};this.execute=function(e){var k=e.getParagraphStyleElement(l);if(!k)return!1;k.parentNode.removeChild(k);e.getOdfCanvas().refreshCSS();e.emit(ops.OdtDocument.signalStyleDeleted,l);return!0};this.spec=function(){return{optype:"DeleteParagraphStyle",memberid:e,timestamp:k,styleName:l}}}; -// Input 47 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpApplyStyle");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertTable");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpCloneParagraphStyle");runtime.loadClass("ops.OpDeleteParagraphStyle"); -ops.OperationFactory=function(){this.create=function(e){var k=null;"AddCursor"===e.optype?k=new ops.OpAddCursor:"ApplyStyle"===e.optype?k=new ops.OpApplyStyle:"InsertTable"===e.optype?k=new ops.OpInsertTable:"InsertText"===e.optype?k=new ops.OpInsertText:"RemoveText"===e.optype?k=new ops.OpRemoveText:"SplitParagraph"===e.optype?k=new ops.OpSplitParagraph:"SetParagraphStyle"===e.optype?k=new ops.OpSetParagraphStyle:"UpdateParagraphStyle"===e.optype?k=new ops.OpUpdateParagraphStyle:"CloneParagraphStyle"=== -e.optype?k=new ops.OpCloneParagraphStyle:"DeleteParagraphStyle"===e.optype?k=new ops.OpDeleteParagraphStyle:"MoveCursor"===e.optype?k=new ops.OpMoveCursor:"RemoveCursor"===e.optype&&(k=new ops.OpRemoveCursor);k&&k.init(e);return k}}; -// Input 48 -runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.OdfUtils"); -gui.SelectionMover=function(e,k){function l(){c.setUnfilteredPosition(e.getNode(),0);return c}function p(a,b,c){var d;c.setStart(a,b);d=c.getClientRects()[0];if(!d)if(d={},a.childNodes[b-1]){c.setStart(a,b-1);c.setEnd(a,b);b=c.getClientRects()[0];if(!b){for(c=b=0;a&&a.nodeType===Node.ELEMENT_NODE;)b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.parentNode;b={top:c,left:b}}d.top=b.top;d.left=b.right;d.bottom=b.bottom}else a.nodeType===Node.TEXT_NODE?(a.previousSibling&&(d=a.previousSibling.getClientRects()[0]), -d||(c.setStart(a,0),c.setEnd(a,b),d=c.getClientRects()[0])):d=a.getClientRects()[0];return{top:d.top,left:d.left,bottom:d.bottom}}function r(a,b,c){var d=a,g=l(),f,h=k.ownerDocument.createRange(),n=e.getSelectedRange()?e.getSelectedRange().cloneRange():k.ownerDocument.createRange(),q;for(f=p(e.getNode(),0,h);0<d&&c();)d-=1;b?(b=g.container(),g=g.unfilteredDomOffset(),-1===n.comparePoint(b,g)?(n.setStart(b,g),q=!1):n.setEnd(b,g)):(n.setStart(g.container(),g.unfilteredDomOffset()),n.collapse(!0));e.setSelectedRange(n, -q);n=p(e.getNode(),0,h);if(n.top===f.top||void 0===u)u=n.left;window.clearTimeout(t);t=window.setTimeout(function(){u=void 0},2E3);h.detach();return a-d}function h(a){var b=l();return 1===a.acceptPosition(b)?!0:!1}function b(a,b){for(var c=l(),d=new core.LoopWatchDog(1E3),e=0,g=0;0<a&&c.nextPosition();)e+=1,d.check(),1===b.acceptPosition(c)&&(g+=e,e=0,a-=1);return g}function f(a,b){for(var c=l(),d=new core.LoopWatchDog(1E3),e=0,g=0;0<a&&c.previousPosition();)e+=1,d.check(),1===b.acceptPosition(c)&& -(g+=e,e=0,a-=1);return g}function d(a,b){var c=l(),d=0,e=0,g=0>a?-1:1;for(a=Math.abs(a);0<a;){for(var f=b,h=g,n=c,q=n.container(),r=0,t=null,C=void 0,D=10,G=void 0,X=0,Q=void 0,F=void 0,K=void 0,G=void 0,H=k.ownerDocument.createRange(),U=new core.LoopWatchDog(1E3),G=p(q,n.unfilteredDomOffset(),H),Q=G.top,F=void 0===u?G.left:u,K=Q;!0===(0>h?n.previousPosition():n.nextPosition());)if(U.check(),1===f.acceptPosition(n)&&(r+=1,q=n.container(),G=p(q,n.unfilteredDomOffset(),H),G.top!==Q)){if(G.top!==K&& -K!==Q)break;K=G.top;G=Math.abs(F-G.left);if(null===t||G<D)t=q,C=n.unfilteredDomOffset(),D=G,X=r}null!==t?(n.setUnfilteredPosition(t,C),r=X):r=0;H.detach();d+=r;if(0===d)break;e+=d;a-=1}return e*g}function a(a,b){var c=l(),d=g.getParagraphElement(c.getCurrentNode()),e=0,f,n,h,q,r=k.ownerDocument.createRange();0>a?(f=c.previousPosition,n=-1):(f=c.nextPosition,n=1);for(h=p(c.container(),c.unfilteredDomOffset(),r);f.call(c);)if(b.acceptPosition(c)===NodeFilter.FILTER_ACCEPT){if(g.getParagraphElement(c.getCurrentNode())!== -d)break;q=p(c.container(),c.unfilteredDomOffset(),r);if(q.bottom!==h.bottom&&(h=q.top>=h.top&&q.bottom<h.bottom||q.top<=h.top&&q.bottom>h.bottom,!h))break;e+=n;h=q}r.detach();return e}function n(a,b){for(var c=0,d;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(d=b.firstChild;d!==a;)c+=1,d=d.nextSibling;return c}function q(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=l(),e=d.container(),g=d.unfilteredDomOffset(), -f=0,h=new core.LoopWatchDog(1E3);d.setUnfilteredPosition(a,b);a=d.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=d.unfilteredDomOffset();d.setUnfilteredPosition(e,g);var e=a,g=b,k=d.container(),p=d.unfilteredDomOffset();if(e===k)e=p-g;else{var q=e.compareDocumentPosition(k);2===q?q=-1:4===q?q=1:10===q?(g=n(e,k),q=g<p?1:-1):(p=n(k,e),q=p<g?-1:1);e=q}if(0>e)for(;d.nextPosition()&&(h.check(),1===c.acceptPosition(d)&&(f+=1),d.container()!== -a||d.unfilteredDomOffset()!==b););else if(0<e)for(;d.previousPosition()&&(h.check(),1===c.acceptPosition(d)&&(f-=1),d.container()!==a||d.unfilteredDomOffset()!==b););return f}var g,c,u,t;this.movePointForward=function(a,b){return r(a,b,c.nextPosition)};this.movePointBackward=function(a,b){return r(a,b,c.previousPosition)};this.getStepCounter=function(){return{countForwardSteps:b,countBackwardSteps:f,countLinesSteps:d,countStepsToLineBoundary:a,countStepsToPosition:q,isPositionWalkable:h}};(function(){g= -new odf.OdfUtils;c=gui.SelectionMover.createPositionIterator(k);var a=k.ownerDocument.createRange();a.setStart(c.container(),c.unfilteredDomOffset());a.collapse(!0);e.setSelectedRange(a)})()};gui.SelectionMover.createPositionIterator=function(e){var k=new function(){this.acceptNode=function(e){return"urn:webodf:names:cursor"===e.namespaceURI||"urn:webodf:names:editinfo"===e.namespaceURI?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};return new core.PositionIterator(e,5,k,!1)};(function(){return gui.SelectionMover})(); -// Input 49 -runtime.loadClass("core.Cursor");runtime.loadClass("gui.SelectionMover"); -ops.OdtCursor=function(e,k){var l=this,p,r;this.removeFromOdtDocument=function(){r.remove()};this.move=function(e,b){var f=0;0<e?f=p.movePointForward(e,b):0>=e&&(f=-p.movePointBackward(-e,b));l.handleUpdate();return f};this.handleUpdate=function(){};this.getStepCounter=function(){return p.getStepCounter()};this.getMemberId=function(){return e};this.getNode=function(){return r.getNode()};this.getAnchorNode=function(){return r.getAnchorNode()};this.getSelectedRange=function(){return r.getSelectedRange()}; -this.getOdtDocument=function(){return k};r=new core.Cursor(k.getDOM(),e);p=new gui.SelectionMover(r,k.getRootNode())}; -// Input 50 -/* - - Copyright (C) 2012 KO GmbH <aditya.bhatt@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.EditInfo=function(e,k){function l(){var e=[],b;for(b in r)r.hasOwnProperty(b)&&e.push({memberid:b,time:r[b].time});e.sort(function(b,d){return b.time-d.time});return e}var p,r={};this.getNode=function(){return p};this.getOdtDocument=function(){return k};this.getEdits=function(){return r};this.getSortedEdits=function(){return l()};this.addEdit=function(e,b){var f,d=e.split("___")[0];if(!r[e])for(f in r)if(r.hasOwnProperty(f)&&f.split("___")[0]===d){delete r[f];break}r[e]={time:b}};this.clearEdits= -function(){r={}};p=k.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");e.insertBefore(p,e.firstChild)}; -// Input 51 -gui.Avatar=function(e,k){var l=this,p,r,h;this.setColor=function(b){r.style.borderColor=b};this.setImageUrl=function(b){l.isVisible()?r.src=b:h=b};this.isVisible=function(){return"block"===p.style.display};this.show=function(){h&&(r.src=h,h=void 0);p.style.display="block"};this.hide=function(){p.style.display="none"};this.markAsFocussed=function(b){p.className=b?"active":""};(function(){var b=e.ownerDocument,f=b.documentElement.namespaceURI;p=b.createElementNS(f,"div");r=b.createElementNS(f,"img"); -r.width=64;r.height=64;p.appendChild(r);p.style.width="64px";p.style.height="70px";p.style.position="absolute";p.style.top="-80px";p.style.left="-34px";p.style.display=k?"block":"none";e.appendChild(p)})()}; -// Input 52 -runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); -gui.Caret=function(e,k){function l(){f&&b.parentNode&&!d&&(d=!0,r.style.borderColor="transparent"===r.style.borderColor?a:"transparent",runtime.setTimeout(function(){d=!1;l()},500))}function p(a){var b;if("string"===typeof a){if(""===a)return 0;b=/^(\d+)(\.\d+)?px$/.exec(a);runtime.assert(null!==b,"size ["+a+"] does not have unit px.");return parseFloat(b[1])}return a}var r,h,b,f=!1,d=!1,a="";this.setFocus=function(){f=!0;h.markAsFocussed(!0);l()};this.removeFocus=function(){f=!1;h.markAsFocussed(!1); -r.style.borderColor=a};this.setAvatarImageUrl=function(a){h.setImageUrl(a)};this.setColor=function(b){a!==b&&(a=b,"transparent"!==r.style.borderColor&&(r.style.borderColor=a),h.setColor(a))};this.getCursor=function(){return e};this.getFocusElement=function(){return r};this.toggleHandleVisibility=function(){h.isVisible()?h.hide():h.show()};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.ensureVisible=function(){var a,b,d,c,f,h,k,m=e.getOdtDocument().getOdfCanvas().getElement().parentNode; -f=k=r;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{f=f.parentElement;if(!f)break;h=d.getComputedStyle(f,null)}while("block"!==h.display);h=f;f=c=0;if(h&&m){b=!1;do{d=h.offsetParent;for(a=h.parentNode;a!==d;){if(a===m){a=h;var l=m,x=0;b=0;var v=void 0,w=runtime.getWindow();for(runtime.assert(null!==w,"Expected to be run in an environment which has a global window, like a browser.");a&&a!==l;)v=w.getComputedStyle(a, -null),x+=p(v.marginLeft)+p(v.borderLeftWidth)+p(v.paddingLeft),b+=p(v.marginTop)+p(v.borderTopWidth)+p(v.paddingTop),a=a.parentElement;a=x;c+=a;f+=b;b=!0;break}a=a.parentNode}if(b)break;c+=p(h.offsetLeft);f+=p(h.offsetTop);h=d}while(h&&h!==m);d=c;c=f}else c=d=0;d+=k.offsetLeft;c+=k.offsetTop;f=d-5;h=c-5;d=d+k.scrollWidth-1+5;k=c+k.scrollHeight-1+5;h<m.scrollTop?m.scrollTop=h:k>m.scrollTop+m.clientHeight-1&&(m.scrollTop=k-m.clientHeight+1);f<m.scrollLeft?m.scrollLeft=f:d>m.scrollLeft+m.clientWidth- -1&&(m.scrollLeft=d-m.clientWidth+1)};(function(){var a=e.getOdtDocument().getDOM();r=a.createElementNS(a.documentElement.namespaceURI,"span");b=e.getNode();b.appendChild(r);h=new gui.Avatar(b,k)})()}; -// Input 53 -runtime.loadClass("core.EventNotifier"); -gui.ClickHandler=function(){function e(){l=0;p=null}var k,l=0,p=null,r=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(e,b){r.subscribe(e,b)};this.handleMouseUp=function(h){var b=runtime.getWindow();p&&p.x===h.screenX&&p.y===h.screenY?(l+=1,1===l?r.emit(gui.ClickHandler.signalSingleClick,void 0):2===l?r.emit(gui.ClickHandler.signalDoubleClick,void 0):3===l&&(b.clearTimeout(k),r.emit(gui.ClickHandler.signalTripleClick, -void 0),e())):(r.emit(gui.ClickHandler.signalSingleClick,void 0),l=1,p={x:h.screenX,y:h.screenY},b.clearTimeout(k),k=b.setTimeout(e,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); -// Input 54 -gui.Clipboard=function(){this.setDataFromRange=function(e,k){var l=!0,p,r=e.clipboardData,h=runtime.getWindow(),b,f;!r&&h&&(r=h.clipboardData);r?(h=new XMLSerializer,b=runtime.getDOMImplementation().createDocument("","",null),p=b.importNode(k.cloneContents(),!0),f=b.createElement("span"),f.appendChild(p),b.appendChild(f),p=r.setData("text/plain",k.toString()),l=l&&p,p=r.setData("text/html",h.serializeToString(b)),l=l&&p,e.preventDefault()):l=!1;return l}};(function(){return gui.Clipboard})(); -// Input 55 -runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("gui.ClickHandler");runtime.loadClass("gui.Clipboard"); -gui.SessionController=function(){gui.SessionController=function(e,k){function l(a,b,c,d){var e="on"+b,g=!1;a.attachEvent&&(g=a.attachEvent(e,c));!g&&a.addEventListener&&(a.addEventListener(b,c,!1),g=!0);g&&!d||!a.hasOwnProperty(e)||(a[e]=c)}function p(a,b,c){var d="on"+b;a.detachEvent&&a.detachEvent(d,c);a.removeEventListener&&a.removeEventListener(b,c,!1);a[d]===c&&(a[d]=null)}function r(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function h(a){r(a)}function b(a,b){var c=e.getOdtDocument(), -d=gui.SelectionMover.createPositionIterator(c.getRootNode()),g=c.getOdfCanvas().getElement(),f;if(f=a){for(;f!==g&&!("urn:webodf:names:cursor"===f.namespaceURI&&"cursor"===f.localName||"urn:webodf:names:editinfo"===f.namespaceURI&&"editinfo"===f.localName);)if(f=f.parentNode,!f)return;f!==g&&a!==f&&(a=f.parentNode,b=Array.prototype.indexOf.call(a.childNodes,f));d.setUnfilteredPosition(a,b);return c.getDistanceFromCursor(k,d.container(),d.unfilteredDomOffset())}}function f(a){var b=new ops.OpMoveCursor, -c=e.getOdtDocument().getCursorPosition(k);b.init({memberid:k,position:c+a});return b}function d(a){var b=new ops.OpMoveCursor,c=e.getOdtDocument().getCursorSelection(k);b.init({memberid:k,position:c.position,length:c.length+a});return b}function a(a){var b=e.getOdtDocument(),c=b.getParagraphElement(b.getCursor(k).getNode()),d=null;runtime.assert(Boolean(c),"SessionController: Cursor outside paragraph");b=b.getCursor(k).getStepCounter().countLinesSteps(a,b.getPositionFilter());0!==b&&(a=e.getOdtDocument().getCursorSelection(k), -d=new ops.OpMoveCursor,d.init({memberid:k,position:a.position,length:a.length+b}));return d}function n(a){var b=e.getOdtDocument(),c=b.getParagraphElement(b.getCursor(k).getNode()),d=null;runtime.assert(Boolean(c),"SessionController: Cursor outside paragraph");a=b.getCursor(k).getStepCounter().countLinesSteps(a,b.getPositionFilter());0!==a&&(b=b.getCursorPosition(k),d=new ops.OpMoveCursor,d.init({memberid:k,position:b+a}));return d}function q(a){var b=e.getOdtDocument(),c=b.getCursorPosition(k),d= -null;a=b.getCursor(k).getStepCounter().countStepsToLineBoundary(a,b.getPositionFilter());0!==a&&(d=new ops.OpMoveCursor,d.init({memberid:k,position:c+a}));return d}function g(){var a=e.getOdtDocument(),b=gui.SelectionMover.createPositionIterator(a.getRootNode()),c=null;b.moveToEnd();b=a.getDistanceFromCursor(k,b.container(),b.unfilteredDomOffset());0!==b&&(a=a.getCursorSelection(k),c=new ops.OpMoveCursor,c.init({memberid:k,position:a.position,length:a.length+b}));return c}function c(){var a=e.getOdtDocument(), -b,c=null;b=a.getDistanceFromCursor(k,a.getRootNode(),0);0!==b&&(a=a.getCursorSelection(k),c=new ops.OpMoveCursor,c.init({memberid:k,position:a.position,length:a.length+b}));return c}function u(a){0>a.length&&(a.position+=a.length,a.length=-a.length);return a}function t(a){var b=new ops.OpRemoveText;b.init({memberid:k,position:a.position,length:a.length});return b}function s(){var a=e.getOdtDocument().getCursor(k),b=runtime.getWindow().getSelection();b.removeAllRanges();b.addRange(a.getSelectedRange().cloneRange())} -function m(b){var m=b.keyCode,h=null,l=!1;if(37===m)h=b.shiftKey?d(-1):f(-1),l=!0;else if(39===m)h=b.shiftKey?d(1):f(1),l=!0;else if(38===m){if(y&&b.altKey&&b.shiftKey||b.ctrlKey&&b.shiftKey){var l=e.getOdtDocument(),p=l.getParagraphElement(l.getCursor(k).getNode()),v,h=null;if(p){m=l.getDistanceFromCursor(k,p,0);v=gui.SelectionMover.createPositionIterator(l.getRootNode());for(v.setUnfilteredPosition(p,0);0===m&&v.previousPosition();)p=v.getCurrentNode(),O.isParagraph(p)&&(m=l.getDistanceFromCursor(k, -p,0));0!==m&&(l=l.getCursorSelection(k),h=new ops.OpMoveCursor,h.init({memberid:k,position:l.position,length:l.length+m}))}}else h=b.metaKey&&b.shiftKey?c():b.shiftKey?a(-1):n(-1);l=!0}else if(40===m){if(y&&b.altKey&&b.shiftKey||b.ctrlKey&&b.shiftKey){h=e.getOdtDocument();v=h.getParagraphElement(h.getCursor(k).getNode());m=null;if(v){l=gui.SelectionMover.createPositionIterator(h.getRootNode());l.moveToEndOfNode(v);for(v=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset());0===v&&l.nextPosition();)p= -l.getCurrentNode(),O.isParagraph(p)&&(l.moveToEndOfNode(p),v=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset()));0!==v&&(h=h.getCursorSelection(k),m=new ops.OpMoveCursor,m.init({memberid:k,position:h.position,length:h.length+v}))}h=m}else h=b.metaKey&&b.shiftKey?g():b.shiftKey?a(1):n(1);l=!0}else 36===m?(!y&&b.ctrlKey&&b.shiftKey?h=c():y&&b.metaKey||b.ctrlKey?(l=e.getOdtDocument(),h=null,m=l.getDistanceFromCursor(k,l.getRootNode(),0),0!==m&&(l=l.getCursorPosition(k),h=new ops.OpMoveCursor, -h.init({memberid:k,position:l+m,length:0}))):h=q(-1),l=!0):35===m?(!y&&b.ctrlKey&&b.shiftKey?h=g():y&&b.metaKey||b.ctrlKey?(h=e.getOdtDocument(),l=gui.SelectionMover.createPositionIterator(h.getRootNode()),m=null,l.moveToEnd(),l=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset()),0!==l&&(h=h.getCursorPosition(k),m=new ops.OpMoveCursor,m.init({memberid:k,position:h+l,length:0})),h=m):h=q(1),l=!0):8===m?(m=e.getOdtDocument(),h=u(m.getCursorSelection(k)),l=null,0===h.length?0<h.position&& -m.getPositionInTextNode(h.position-1)&&(l=new ops.OpRemoveText,l.init({memberid:k,position:h.position-1,length:1})):l=t(h),h=l,l=!0):46===m?(m=e.getOdtDocument(),h=u(m.getCursorSelection(k)),l=null,0===h.length?m.getPositionInTextNode(h.position+1)&&(l=new ops.OpRemoveText,l.init({memberid:k,position:h.position,length:1})):l=t(h),h=l,l=null!==h):D&&90===m&&(!y&&b.ctrlKey||y&&b.metaKey)&&(b.shiftKey?D.moveForward(1):D.moveBackward(1),s(),l=!0);h&&e.enqueue(h);l&&r(b)}function A(a){var b,c;c=null=== -a.which?String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?String.fromCharCode(a.which):null;13===a.keyCode?(b=e.getOdtDocument().getCursorPosition(k),c=new ops.OpSplitParagraph,c.init({memberid:k,position:b}),e.enqueue(c),r(a)):!c||(a.altKey||a.ctrlKey||a.metaKey)||(b=new ops.OpInsertText,b.init({memberid:k,position:e.getOdtDocument().getCursorPosition(k),text:c}),e.enqueue(b),r(a))}function x(a){var b=e.getOdtDocument().getCursor(k);b.getSelectedRange().collapsed||(J.setDataFromRange(a, -b.getSelectedRange())?(b=new ops.OpRemoveText,a=u(e.getOdtDocument().getCursorSelection(k)),b.init({memberid:k,position:a.position,length:a.length}),e.enqueue(b)):runtime.log("Cut operation failed"))}function v(){return!1!==e.getOdtDocument().getCursor(k).getSelectedRange().collapsed}function w(a){var b,c;window.clipboardData&&window.clipboardData.getData?b=window.clipboardData.getData("Text"):a.clipboardData&&a.clipboardData.getData&&(b=a.clipboardData.getData("text/plain"));b&&(c=new ops.OpInsertText, -c.init({memberid:k,position:e.getOdtDocument().getCursorPosition(k),text:b}),e.enqueue(c),r(a))}function P(){return!1}function B(a){if(D)D.onOperationExecuted(a)}function E(a){e.getOdtDocument().emit(ops.OdtDocument.signalUndoStackChanged,a)}var O=new odf.OdfUtils,y=-1!==runtime.getWindow().navigator.appVersion.toLowerCase().indexOf("mac"),J=new gui.Clipboard,C=new gui.ClickHandler,D;this.startEditing=function(){var a,b=e.getOdtDocument();a=b.getOdfCanvas().getElement();l(a,"keydown",m);l(a,"keypress", -A);l(a,"keyup",h);l(a,"beforecut",v,!0);l(a,"mouseup",C.handleMouseUp);l(a,"cut",x);l(a,"beforepaste",P,!0);l(a,"paste",w);b.subscribe(ops.OdtDocument.signalOperationExecuted,s);b.subscribe(ops.OdtDocument.signalOperationExecuted,B);a=new ops.OpAddCursor;a.init({memberid:k});e.enqueue(a);D&&D.saveInitialState()};this.endEditing=function(){var a;a=e.getOdtDocument();a.unsubscribe(ops.OdtDocument.signalOperationExecuted,B);a.unsubscribe(ops.OdtDocument.signalOperationExecuted,s);a=a.getOdfCanvas().getElement(); -p(a,"keydown",m);p(a,"keypress",A);p(a,"keyup",h);p(a,"cut",x);p(a,"beforecut",v);p(a,"paste",w);p(a,"mouseup",C.handleMouseUp);p(a,"beforepaste",P);a=new ops.OpRemoveCursor;a.init({memberid:k});e.enqueue(a);D&&D.resetInitialState()};this.getInputMemberId=function(){return k};this.getSession=function(){return e};this.setUndoManager=function(a){D&&D.unsubscribe(gui.UndoManager.signalUndoStackChanged,E);if(D=a)D.setOdtDocument(e.getOdtDocument()),D.setPlaybackFunction(function(a){a.execute(e.getOdtDocument())}), -D.subscribe(gui.UndoManager.signalUndoStackChanged,E)};this.getUndoManager=function(){return D};C.subscribe(gui.ClickHandler.signalSingleClick,function(){var a=runtime.getWindow().getSelection(),c=e.getOdtDocument().getCursorPosition(k),d,g;d=b(a.anchorNode,a.anchorOffset);a=b(a.focusNode,a.focusOffset);if(0!==a||0!==d)g=new ops.OpMoveCursor,g.init({memberid:k,position:c+d,length:a-d}),e.enqueue(g)});C.subscribe(gui.ClickHandler.signalDoubleClick,function(){var a=e.getOdtDocument(),b=gui.SelectionMover.createPositionIterator(a.getRootNode()), -c=a.getCursor(k).getNode(),a=a.getCursorPosition(k),d=/[A-Za-z0-9]/,g=0,f=0,m,h,l;b.setUnfilteredPosition(c,0);if(b.previousPosition()&&(m=b.getCurrentNode(),m.nodeType===Node.TEXT_NODE))for(h=m.data.length-1;0<=h;h-=1)if(l=m.data[h],d.test(l))g-=1;else break;b.setUnfilteredPosition(c,0);if(b.nextPosition()&&(m=b.getCurrentNode(),m.nodeType===Node.TEXT_NODE))for(h=0;h<m.data.length;h+=1)if(l=m.data[h],d.test(l))f+=1;else break;if(0!==g||0!==f)b=new ops.OpMoveCursor,b.init({memberid:k,position:a+g, -length:Math.abs(g)+Math.abs(f)}),e.enqueue(b)});C.subscribe(gui.ClickHandler.signalTripleClick,function(){var a=e.getOdtDocument(),b=gui.SelectionMover.createPositionIterator(a.getRootNode()),c=a.getParagraphElement(a.getCursor(k).getNode()),d=a.getCursorPosition(k),g;g=a.getDistanceFromCursor(k,c,0);b.moveToEndOfNode(c);a=a.getDistanceFromCursor(k,c,b.unfilteredDomOffset());if(0!==g||0!==a)b=new ops.OpMoveCursor,b.init({memberid:k,position:d+g,length:Math.abs(g)+Math.abs(a)}),e.enqueue(b)})};return gui.SessionController}(); -// Input 56 -ops.UserModel=function(){};ops.UserModel.prototype.getUserDetailsAndUpdates=function(e,k){};ops.UserModel.prototype.unsubscribeUserDetailsUpdates=function(e,k){}; -// Input 57 -/* - - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.TrivialUserModel=function(){var e={bob:{memberid:"bob",fullname:"Bob Pigeon",color:"red",imageurl:"avatar-pigeon.png"},alice:{memberid:"alice",fullname:"Alice Bee",color:"green",imageurl:"avatar-flower.png"},you:{memberid:"you",fullname:"I, Robot",color:"blue",imageurl:"avatar-joe.png"}};this.getUserDetailsAndUpdates=function(k,l){var p=k.split("___")[0];l(k,e[p]||null)};this.unsubscribeUserDetailsUpdates=function(e,l){}}; -// Input 58 -ops.NowjsUserModel=function(){var e={},k={},l=runtime.getNetwork();this.getUserDetailsAndUpdates=function(p,r){var h=p.split("___")[0],b=e[h],f=k[h]=k[h]||[],d;runtime.assert(void 0!==r,"missing callback");for(d=0;d<f.length&&(f[d].subscriber!==r||f[d].memberId!==p);d+=1);d<f.length?runtime.log("double subscription request for "+p+" in NowjsUserModel::getUserDetailsAndUpdates"):(f.push({memberId:p,subscriber:r}),1===f.length&&l.subscribeUserDetailsUpdates(h));b&&r(p,b)};this.unsubscribeUserDetailsUpdates= -function(p,r){var h,b=p.split("___")[0],f=k[b];runtime.assert(void 0!==r,"missing subscriber parameter or null");runtime.assert(f,"tried to unsubscribe when no one is subscribed ('"+p+"')");if(f){for(h=0;h<f.length&&(f[h].subscriber!==r||f[h].memberId!==p);h+=1);runtime.assert(h<f.length,"tried to unsubscribe when not subscribed for memberId '"+p+"'");f.splice(h,1);0===f.length&&(runtime.log("no more subscribers for: "+p),delete k[b],delete e[b],l.unsubscribeUserDetailsUpdates(b))}};l.updateUserDetails= -function(l,r){var h=r?{userid:r.uid,fullname:r.fullname,imageurl:"/user/"+r.avatarId+"/avatar.png",color:r.color}:null,b,f;if(b=k[l])for(e[l]=h,f=0;f<b.length;f+=1)b[f].subscriber(b[f].memberId,h)};runtime.assert("ready"===l.networkStatus,"network not ready")}; -// Input 59 -/* - - Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(e){};ops.OperationRouter.prototype.setPlaybackFunction=function(e){};ops.OperationRouter.prototype.push=function(e){}; -// Input 60 -/* - - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.TrivialOperationRouter=function(){var e,k;this.setOperationFactory=function(l){e=l};this.setPlaybackFunction=function(e){k=e};this.push=function(l){l=l.spec();l.timestamp=(new Date).getTime();l=e.create(l);k(l)}}; -// Input 61 -ops.NowjsOperationRouter=function(e,k){function l(a){var e;e=p.create(a);runtime.log(" op in: "+runtime.toJson(a));if(null!==e)if(a=Number(a.server_seq),runtime.assert(!isNaN(a),"server seq is not a number"),a===b+1)for(r(e),b=a,d=0,e=b+1;f.hasOwnProperty(e);e+=1)r(f[e]),delete f[e],runtime.log("op with server seq "+a+" taken from hold (reordered)");else runtime.assert(a!==b+1,"received incorrect order from server"),runtime.assert(!f.hasOwnProperty(a),"reorder_queue has incoming op"),runtime.log("op with server seq "+ -a+" put on hold"),f[a]=e;else runtime.log("ignoring invalid incoming opspec: "+a)}var p,r,h=runtime.getNetwork(),b=-1,f={},d=0,a=1E3;this.setOperationFactory=function(a){p=a};this.setPlaybackFunction=function(a){r=a};h.ping=function(a){null!==k&&a(k)};h.receiveOp=function(a,b){a===e&&l(b)};this.push=function(f){f=f.spec();runtime.assert(null!==k,"Router sequence N/A without memberid");a+=1;f.client_nonce="C:"+k+":"+a;f.parent_op=b+"+"+d;d+=1;runtime.log("op out: "+runtime.toJson(f));h.deliverOp(e, -f)};this.requestReplay=function(a){h.requestReplay(e,function(a){runtime.log("replaying: "+runtime.toJson(a));l(a)},function(b){runtime.log("replay done ("+b+" ops).");a&&a()})};(function(){h.memberid=k;h.joinSession(e,function(a){runtime.assert(a,"Trying to join a session which does not exists or where we are already in")})})()}; -// Input 62 -gui.EditInfoHandle=function(e){var k=[],l,p=e.ownerDocument,r=p.documentElement.namespaceURI;this.setEdits=function(e){k=e;var b,f,d,a;l.innerHTML="";for(e=0;e<k.length;e+=1)b=p.createElementNS(r,"div"),b.className="editInfo",f=p.createElementNS(r,"span"),f.className="editInfoColor",f.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[e].memberid),d=p.createElementNS(r,"span"),d.className="editInfoAuthor",d.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[e].memberid), -a=p.createElementNS(r,"span"),a.className="editInfoTime",a.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[e].memberid),a.innerHTML=k[e].time,b.appendChild(f),b.appendChild(d),b.appendChild(a),l.appendChild(b)};this.show=function(){l.style.display="block"};this.hide=function(){l.style.display="none"};l=p.createElementNS(r,"div");l.setAttribute("class","editInfoHandle");l.style.display="none";e.appendChild(l)}; -// Input 63 -runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoHandle"); -gui.EditInfoMarker=function(e,k){function l(a,d){return window.setTimeout(function(){b.style.opacity=a},d)}var p=this,r,h,b,f,d;this.addEdit=function(a,k){var p=Date.now()-k;e.addEdit(a,k);h.setEdits(e.getSortedEdits());b.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",a);f&&window.clearTimeout(f);d&&window.clearTimeout(d);1E4>p?(l(1,0),f=l(0.5,1E4-p),d=l(0.2,2E4-p)):1E4<=p&&2E4>p?(l(0.5,0),d=l(0.2,2E4-p)):l(0.2,0)};this.getEdits=function(){return e.getEdits()};this.clearEdits=function(){e.clearEdits(); -h.setEdits([]);b.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&b.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return e};this.show=function(){b.style.display="block"};this.hide=function(){p.hideHandle();b.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};(function(){var a=e.getOdtDocument().getDOM();b=a.createElementNS(a.documentElement.namespaceURI,"div");b.setAttribute("class","editInfoMarker"); -b.onmouseover=function(){p.showHandle()};b.onmouseout=function(){p.hideHandle()};r=e.getNode();r.appendChild(b);h=new gui.EditInfoHandle(r);k||p.hide()})()}; -// Input 64 -/* - - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoMarker"); -gui.SessionView=function(){return function(e,k,l){function p(a,b,c){c=c.split("___")[0];return a+"."+b+'[editinfo|memberid^="'+c+'"]'}function r(a,b,c){function d(b,c,e){e=p(b,c,a)+e;a:{var g=q.firstChild;for(b=p(b,c,a);g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=e:q.appendChild(document.createTextNode(e))}d("div","editInfoMarker","{ background-color: "+c+"; }");d("span","editInfoColor","{ background-color: "+c+"; }");d("span","editInfoAuthor", -':before { content: "'+b+'"; }')}function h(a){var b,c;for(c in g)g.hasOwnProperty(c)&&(b=g[c],a?b.show():b.hide())}function b(a){var b,c;for(c in n)n.hasOwnProperty(c)&&(b=n[c],a?b.showHandle():b.hideHandle())}function f(a,b){var c=n[a];void 0===b?runtime.log('UserModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),c&&(c.setAvatarImageUrl(b.imageurl),c.setColor(b.color)),r(a,b.fullname,b.color))}function d(a){var b= -l.createCaret(a,u);a=a.getMemberId();var c=k.getUserModel();n[a]=b;f(a,null);c.getUserDetailsAndUpdates(a,f);runtime.log("+++ View here +++ eagerly created an Caret for '"+a+"'! +++")}function a(a){var b=!1,c;delete n[a];for(c in g)if(g.hasOwnProperty(c)&&g[c].getEditInfo().getEdits().hasOwnProperty(a)){b=!0;break}b||k.getUserModel().unsubscribeUserDetailsUpdates(a,f)}var n={},q,g={},c=void 0!==e.editInfoMarkersInitiallyVisible?e.editInfoMarkersInitiallyVisible:!0,u=void 0!==e.caretAvatarsInitiallyVisible? -e.caretAvatarsInitiallyVisible:!0;this.showEditInfoMarkers=function(){c||(c=!0,h(c))};this.hideEditInfoMarkers=function(){c&&(c=!1,h(c))};this.showCaretAvatars=function(){u||(u=!0,b(u))};this.hideCaretAvatars=function(){u&&(u=!1,b(u))};this.getSession=function(){return k};this.getCaret=function(a){return n[a]};(function(){var b=k.getOdtDocument(),e=document.getElementsByTagName("head")[0];b.subscribe(ops.OdtDocument.signalCursorAdded,d);b.subscribe(ops.OdtDocument.signalCursorRemoved,a);b.subscribe(ops.OdtDocument.signalParagraphChanged, -function(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",h=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];h?(f=h.getAttributeNS("urn:webodf:names:editinfo","id"),e=g[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,k.getOdtDocument()),e=new gui.EditInfoMarker(e,c),h=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],h.setAttributeNS("urn:webodf:names:editinfo","id",f),g[f]=e);e.addEdit(d,new Date(a))});q=document.createElementNS(e.namespaceURI, -"style");q.type="text/css";q.media="screen, print, handheld, projection";q.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));e.appendChild(q)})()}}(); -// Input 65 -/* - - Copyright (C) 2012 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.Caret");gui.CaretFactory=function(e){this.createCaret=function(k,l){var p=k.getMemberId(),r=e.getSession().getOdtDocument(),h=r.getOdfCanvas().getElement(),b=new gui.Caret(k,l);p===e.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+p),r.subscribe(ops.OdtDocument.signalParagraphChanged,function(e){e.memberId===p&&b.ensureVisible()}),k.handleUpdate=b.ensureVisible,h.setAttribute("tabindex",0),h.onfocus=b.setFocus,h.onblur=b.removeFocus,h.focus());return b}}; -// Input 66 -runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Namespaces"); -gui.PresenterUI=function(){var e=new xmldom.XPath;return function(k){var l=this;l.setInitialSlideMode=function(){l.startSlideMode("single")};l.keyDownHandler=function(e){if(!e.target.isContentEditable&&"input"!==e.target.nodeName)switch(e.keyCode){case 84:l.toggleToolbar();break;case 37:case 8:l.prevSlide();break;case 39:case 32:l.nextSlide();break;case 36:l.firstSlide();break;case 35:l.lastSlide()}};l.root=function(){return l.odf_canvas.odfContainer().rootElement};l.firstSlide=function(){l.slideChange(function(e, -l){return 0})};l.lastSlide=function(){l.slideChange(function(e,l){return l-1})};l.nextSlide=function(){l.slideChange(function(e,l){return e+1<l?e+1:-1})};l.prevSlide=function(){l.slideChange(function(e,l){return 1>e?-1:e-1})};l.slideChange=function(e){var k=l.getPages(l.odf_canvas.odfContainer().rootElement),h=-1,b=0;k.forEach(function(e){e=e[1];e.hasAttribute("slide_current")&&(h=b,e.removeAttribute("slide_current"));b+=1});e=e(h,k.length);-1===e&&(e=h);k[e][1].setAttribute("slide_current","1"); -document.getElementById("pagelist").selectedIndex=e;"cont"===l.slide_mode&&window.scrollBy(0,k[e][1].getBoundingClientRect().top-30)};l.selectSlide=function(e){l.slideChange(function(l,h){return e>=h||0>e?-1:e})};l.scrollIntoContView=function(e){var k=l.getPages(l.odf_canvas.odfContainer().rootElement);0!==k.length&&window.scrollBy(0,k[e][1].getBoundingClientRect().top-30)};l.getPages=function(e){e=e.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var l=[],h;for(h=0;h<e.length;h+=1)l.push([e[h].getAttribute("draw:name"), -e[h]]);return l};l.fillPageList=function(k,r){for(var h=l.getPages(k),b,f,d;r.firstChild;)r.removeChild(r.firstChild);for(b=0;b<h.length;b+=1)f=document.createElement("option"),d=e.getODFElementsWithXPath(h[b][1],'./draw:frame[@presentation:class="title"]//draw:text-box/text:p',xmldom.XPath),d=0<d.length?d[0].textContent:h[b][0],f.textContent=b+1+": "+d,r.appendChild(f)};l.startSlideMode=function(e){var k=document.getElementById("pagelist"),h=l.odf_canvas.slidevisibilitycss().sheet;for(l.slide_mode= -e;0<h.cssRules.length;)h.deleteRule(0);l.selectSlide(0);"single"===l.slide_mode?(h.insertRule("draw|page { position:fixed; left:0px;top:30px; z-index:1; }",0),h.insertRule("draw|page[slide_current] { z-index:2;}",1),h.insertRule("draw|page { -webkit-transform: scale(1);}",2),l.fitToWindow(),window.addEventListener("resize",l.fitToWindow,!1)):"cont"===l.slide_mode&&window.removeEventListener("resize",l.fitToWindow,!1);l.fillPageList(l.odf_canvas.odfContainer().rootElement,k)};l.toggleToolbar=function(){var e, -k,h;e=l.odf_canvas.slidevisibilitycss().sheet;k=-1;for(h=0;h<e.cssRules.length;h+=1)if(".toolbar"===e.cssRules[h].cssText.substring(0,8)){k=h;break}-1<k?e.deleteRule(k):e.insertRule(".toolbar { position:fixed; left:0px;top:-200px; z-index:0; }",0)};l.fitToWindow=function(){var e=l.getPages(l.root()),k=(window.innerHeight-40)/e[0][1].clientHeight,e=(window.innerWidth-10)/e[0][1].clientWidth,k=k<e?k:e,e=l.odf_canvas.slidevisibilitycss().sheet;e.deleteRule(2);e.insertRule("draw|page { \n-moz-transform: scale("+ -k+"); \n-moz-transform-origin: 0% 0%; -webkit-transform-origin: 0% 0%; -webkit-transform: scale("+k+"); -o-transform-origin: 0% 0%; -o-transform: scale("+k+"); -ms-transform-origin: 0% 0%; -ms-transform: scale("+k+"); }",2)};l.load=function(e){l.odf_canvas.load(e)};l.odf_element=k;l.odf_canvas=new odf.OdfCanvas(l.odf_element);l.odf_canvas.addListener("statereadychange",l.setInitialSlideMode);l.slide_mode="undefined";document.addEventListener("keydown",l.keyDownHandler,!1)}}(); -// Input 67 -runtime.loadClass("core.PositionIterator");runtime.loadClass("core.Cursor"); -gui.XMLEdit=function(e,k){function l(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function p(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function r(){var a=e.ownerDocument.defaultView.getSelection();!a||(0>=a.rangeCount||!t)||(a=a.getRangeAt(0),t.setPoint(a.startContainer,a.startOffset))}function h(){var a=e.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();t&&t.node()&&(b=t.node(),c=b.ownerDocument.createRange(), -c.setStart(b,t.position()),c.collapse(!0),a.addRange(c))}function b(a){var b=a.charCode||a.keyCode;if(t=null,t&&37===b)r(),t.stepBackward(),h();else if(16<=b&&20>=b||33<=b&&40>=b)return;p(a)}function f(a){}function d(a){e.ownerDocument.defaultView.getSelection().getRangeAt(0);p(a)}function a(b){for(var c=b.firstChild;c&&c!==b;)c.nodeType===Node.ELEMENT_NODE&&a(c),c=c.nextSibling||c.parentNode;var d,e,g,c=b.attributes;d="";for(g=c.length-1;0<=g;g-=1)e=c.item(g),d=d+" "+e.nodeName+'="'+e.nodeValue+ -'"';b.setAttribute("customns_name",b.nodeName);b.setAttribute("customns_atts",d);c=b.firstChild;for(e=/^\s*$/;c&&c!==b;)d=c,c=c.nextSibling||c.parentNode,d.nodeType===Node.TEXT_NODE&&e.test(d.nodeValue)&&d.parentNode.removeChild(d)}function n(a,b){for(var c=a.firstChild,d,e,g;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(n(c,b),d=c.attributes,g=d.length-1;0<=g;g-=1)e=d.item(g),"http://www.w3.org/2000/xmlns/"!==e.namespaceURI||b[e.nodeValue]||(b[e.nodeValue]=e.localName);c=c.nextSibling||c.parentNode}} -function q(){var a=e.ownerDocument.createElement("style"),b;b={};n(e,b);var c={},d,f,h=0;for(d in b)if(b.hasOwnProperty(d)&&d){f=b[d];if(!f||c.hasOwnProperty(f)||"xmlns"===f){do f="ns"+h,h+=1;while(c.hasOwnProperty(f));b[d]=f}c[f]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+g;a.appendChild(e.ownerDocument.createTextNode(b));k=k.parentNode.replaceChild(a,k)}var g,c,u,t=null;e.id||(e.id="xml"+String(Math.random()).substring(2));c="#"+e.id+" ";g=c+"*,"+c+":visited, "+c+":link {display:block; margin: 0px; margin-left: 10px; font-size: medium; color: black; background: white; font-variant: normal; font-weight: normal; font-style: normal; font-family: sans-serif; text-decoration: none; white-space: pre-wrap; height: auto; width: auto}\n"+ -c+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+c+":after {color: blue; content: '</' attr(customns_name) '>';}\n"+c+"{overflow: auto;}\n";(function(a){l(a,"click",d);l(a,"keydown",b);l(a,"keypress",f);l(a,"drop",p);l(a,"dragend",p);l(a,"beforepaste",p);l(a,"paste",p)})(e);this.updateCSS=q;this.setXML=function(b){b=b.documentElement||b;u=b=e.ownerDocument.importNode(b,!0);for(a(b);e.lastChild;)e.removeChild(e.lastChild);e.appendChild(b);q();t=new core.PositionIterator(b)}; -this.getXML=function(){return u}}; -// Input 68 -/* - - Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(e,k){};gui.UndoManager.prototype.unsubscribe=function(e,k){};gui.UndoManager.prototype.setOdtDocument=function(e){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(e){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; -gui.UndoManager.prototype.moveForward=function(e){};gui.UndoManager.prototype.moveBackward=function(e){};gui.UndoManager.prototype.onOperationExecuted=function(e){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";(function(){return gui.UndoManager})(); -// Input 69 -/* - - Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -gui.UndoStateRules=function(){function e(e){switch(e.spec().optype){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.isEditOperation=e;this.isPartOfOperationSet=function(k,l){if(e(k)){if(0===l.length)return!0;var p;if(p=e(l[l.length-1]))a:{p=l.filter(e);var r=k.spec().optype,h;b:switch(r){case "RemoveText":case "InsertText":h=!0;break b;default:h=!1}if(h&&r===p[0].spec().optype){if(1===p.length){p=!0;break a}r=p[p.length-2].spec().position;p=p[p.length-1].spec().position; -h=k.spec().position;if(p===h-(p-r)){p=!0;break a}}p=!1}return p}return!0}}; -// Input 70 -/* - - Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.UndoManager");runtime.loadClass("gui.UndoStateRules"); -gui.TrivialUndoManager=function(){function e(){n.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:l.hasUndoStates(),redoAvailable:l.hasRedoStates()})}function k(){f!==r&&f!==d[d.length-1]&&d.push(f)}var l=this,p,r,h,b,f=[],d=[],a=[],n=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged]),q=new gui.UndoStateRules;this.subscribe=function(a,b){n.subscribe(a,b)};this.unsubscribe=function(a,b){n.unsubscribe(a,b)};this.hasUndoStates=function(){return 0<d.length};this.hasRedoStates= -function(){return 0<a.length};this.setOdtDocument=function(a){b=a};this.resetInitialState=function(){d.length=0;a.length=0;r.length=0;f.length=0;p=null;e()};this.saveInitialState=function(){p=b.getOdfCanvas().odfContainer().rootElement.cloneNode(!0);r=[];k();d.forEach(function(a){r=r.concat(a)});f=r;d.length=0;a.length=0;e()};this.setPlaybackFunction=function(a){h=a};this.onOperationExecuted=function(b){a.length=0;q.isEditOperation(b)&&f===r||!q.isPartOfOperationSet(b,f)?(k(),f=[b],d.push(f),e()): -f.push(b)};this.moveForward=function(b){for(var c=0,k;b&&a.length;)k=a.pop(),d.push(k),k.forEach(h),b-=1,c+=1;c&&(f=d[d.length-1],e());return c};this.moveBackward=function(g){for(var c=b.getOdfCanvas(),k=c.odfContainer(),l=0;g&&d.length;)a.push(d.pop()),g-=1,l+=1;l&&(k.setRootElement(p.cloneNode(!0)),c.setOdfContainer(k,!0),b.getCursors().forEach(function(a){b.removeCursor(a.getMemberId())}),r.forEach(h),d.forEach(function(a){a.forEach(h)}),c.refreshCSS(),f=d[d.length-1]||r,e());return l}}; -// Input 71 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.EventNotifier");runtime.loadClass("odf.OdfUtils"); -ops.OdtDocument=function(e){function k(){var a=e.odfContainer().getContentElement(),b=a&&a.localName;runtime.assert("text"===b,"Unsupported content element type '"+b+"'for OdtDocument");return a}function l(a){var b=gui.SelectionMover.createPositionIterator(k());for(a+=1;0<a&&b.nextPosition();)1===d.acceptPosition(b)&&(a-=1);return b}function p(b){return a.getParagraphElement(b)}function r(a){return e.getFormatting().getStyleElement(a,"paragraph")}function h(a,b){runtime.assert(" "===a.data[b],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space"); -var d=a.ownerDocument.createElementNS(f,"text:s");d.appendChild(a.ownerDocument.createTextNode(" "));a.deleteData(b,1);a.splitText(b);a.parentNode.insertBefore(d,a.nextSibling)}var b=this,f="urn:oasis:names:tc:opendocument:xmlns:text:1.0",d,a,n={},q=new core.EventNotifier([ops.OdtDocument.signalCursorAdded,ops.OdtDocument.signalCursorRemoved,ops.OdtDocument.signalCursorMoved,ops.OdtDocument.signalParagraphChanged,ops.OdtDocument.signalParagraphStyleModified,ops.OdtDocument.signalStyleCreated,ops.OdtDocument.signalStyleDeleted, -ops.OdtDocument.signalTableAdded,ops.OdtDocument.signalOperationExecuted,ops.OdtDocument.signalUndoStackChanged]);this.getIteratorAtPosition=l;this.getTextNeighborhood=function(a,b){var d=l(a),e=[],f=[],h,k=0,n=!1;h=!0;var q=0,p;runtime.assert(0<=b,"OdtDocument.getTextNeighborhood only supports positive lengths");do{f=d.textNeighborhood();n=!1;for(p=0;p<e.length;p+=1)if(e[p]===f[0]){n=!0;break}if(!n){n=0;if(h){h=d.container();for(n=0;n<f.length;n+=1)if(f[n]===h){q=n;break}n=q;h=!1}for(f.length&&(e= -e.concat(f));n<f.length;n+=1)k+=f[n].data.length}}while(!0===d.nextPosition()&&k<b);return e.slice(q)};this.upgradeWhitespaceToElement=h;this.upgradeWhitespacesAtPosition=function(b){b=l(b);var c=null,d,e=0;b.previousPosition();b.previousPosition();for(e=-2;2>=e;e+=1)c=b.container(),d=b.unfilteredDomOffset(),c.nodeType===Node.TEXT_NODE&&(" "===c.data[d]&&a.isSignificantWhitespace(c,d))&&h(c,d),b.nextPosition()};this.getParagraphStyleElement=r;this.getParagraphElement=p;this.getParagraphStyleAttributes= -function(a){return(a=r(a))?e.getFormatting().getInheritedStyleAttributes(a):null};this.getPositionInTextNode=function(a,b){var e=gui.SelectionMover.createPositionIterator(k()),f=null,h,m=0,l=null;runtime.assert(0<=a,"position must be >= 0");1===d.acceptPosition(e)?(h=e.container(),h.nodeType===Node.TEXT_NODE&&(f=h,m=0)):a+=1;for(;0<a||null===f;){if(!e.nextPosition())return null;if(1===d.acceptPosition(e))if(a-=1,h=e.container(),h.nodeType===Node.TEXT_NODE)h!==f?(f=h,m=e.domOffset()):m+=1;else if(null!== -f){if(0===a){m=f.length;break}f=null}else if(0===a){f=k().ownerDocument.createTextNode("");h.insertBefore(f,e.rightNode());m=0;break}}if(null===f)return null;if(b&&n[b]){for(l=n[b].getNode();0===m&&l.nextSibling&&"cursor"===l.nextSibling.localName;)l.parentNode.insertBefore(l,l.nextSibling.nextSibling);l&&0<f.length&&(f=k().ownerDocument.createTextNode(""),m=0,l.parentNode.insertBefore(f,l.nextSibling))}for(;0===m&&(f.previousSibling&&"cursor"===f.previousSibling.localName)&&(h=f.previousSibling, -0<f.length&&(f=k().ownerDocument.createTextNode("")),h.parentNode.insertBefore(f,h),l!==h););for(;f.previousSibling&&f.previousSibling.nodeType===Node.TEXT_NODE;)f.previousSibling.appendData(f.data),m=f.length+f.previousSibling.length,f=f.previousSibling,f.parentNode.removeChild(f.nextSibling);return{textNode:f,offset:m}};this.getNeighboringParagraph=function(a,b){var e=l(0),f=null;e.setUnfilteredPosition(a,0);do if(1===d.acceptPosition(e)&&(f=p(e.container()),f!==a))return f;while(!0===(0<b?e.nextPosition(): -e.previousPosition()));if(f===a)return null};this.getWalkableParagraphLength=function(a){var b=l(0),e=0;b.setUnfilteredPosition(a,0);do{if(p(b.container())!==a)break;1===d.acceptPosition(b)&&(e+=1)}while(b.nextPosition());return e};this.getDistanceFromCursor=function(a,b,e){a=n[a];var f=0;runtime.assert(null!==b&&void 0!==b,"OdtDocument.getDistanceFromCursor called without node");a&&(a=a.getStepCounter().countStepsToPosition,f=a(b,e,d));return f};this.getCursorPosition=function(a){return-b.getDistanceFromCursor(a, -k(),0)};this.getCursorSelection=function(a){var b;a=n[a];var e=0;b=0;a&&(b=a.getStepCounter().countStepsToPosition,e=-b(k(),0,d),b=b(a.getAnchorNode(),0,d));return{position:e+b,length:-b}};this.getPositionFilter=function(){return d};this.getOdfCanvas=function(){return e};this.getRootNode=k;this.getDOM=function(){return k().ownerDocument};this.getCursor=function(a){return n[a]};this.getCursors=function(){var a=[],b;for(b in n)n.hasOwnProperty(b)&&a.push(n[b]);return a};this.addCursor=function(a){runtime.assert(Boolean(a), -"OdtDocument::addCursor without cursor");var b=a.getStepCounter().countForwardSteps(1,d),e=a.getMemberId();runtime.assert(Boolean(e),"OdtDocument::addCursor has cursor without memberid");a.move(b);n[e]=a};this.removeCursor=function(a){var c=n[a];return c?(c.removeFromOdtDocument(),delete n[a],b.emit(ops.OdtDocument.signalCursorRemoved,a),!0):!1};this.getMetaData=function(a){for(var b=e.odfContainer().rootElement.firstChild;b&&"meta"!==b.localName;)b=b.nextSibling;for(b=b&&b.firstChild;b&&b.localName!== -a;)b=b.nextSibling;for(b=b&&b.firstChild;b&&b.nodeType!==Node.TEXT_NODE;)b=b.nextSibling;return b?b.data:null};this.getFormatting=function(){return e.getFormatting()};this.emit=function(a,b){q.emit(a,b)};this.subscribe=function(a,b){q.subscribe(a,b)};this.unsubscribe=function(a,b){q.unsubscribe(a,b)};d=new function(){function b(e,f,g){var h,l;if(f&&(h=a.lookLeftForCharacter(f),1===h||2===h&&(a.scanRightForAnyCharacter(g)||a.scanRightForAnyCharacter(a.nextNode(e)))))return c;h=null===f&&a.isParagraph(e); -l=a.lookRightForCharacter(g);if(h)return l?c:a.scanRightForAnyCharacter(g)?d:c;if(!l)return d;f=f||a.previousNode(e);return a.scanLeftForAnyCharacter(f)?d:c}var c=core.PositionFilter.FilterResult.FILTER_ACCEPT,d=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(e){var f=e.container(),h=f.nodeType,l,k,n;if(h!==Node.ELEMENT_NODE&&h!==Node.TEXT_NODE)return d;if(h===Node.TEXT_NODE){if(!a.isGroupingElement(f.parentNode))return d;h=e.unfilteredDomOffset();l=f.data;runtime.assert(h!== -l.length,"Unexpected offset.");if(0<h){e=l.substr(h-1,1);if(!a.isODFWhitespace(e))return c;if(1<h)if(e=l.substr(h-2,1),!a.isODFWhitespace(e))k=c;else{if(!a.isODFWhitespace(l.substr(0,h)))return d}else n=a.previousNode(f),a.scanLeftForNonWhitespace(n)&&(k=c);if(k===c)return a.isTrailingWhitespace(f,h)?d:c;k=l.substr(h,1);return a.isODFWhitespace(k)?d:a.scanLeftForAnyCharacter(a.previousNode(f))?d:c}n=e.leftNode();k=f;f=f.parentNode;k=b(f,n,k)}else a.isGroupingElement(f)?(n=e.leftNode(),k=e.rightNode(), -k=b(f,n,k)):k=d;return k}};a=new odf.OdfUtils};ops.OdtDocument.signalCursorAdded="cursor/added";ops.OdtDocument.signalCursorRemoved="cursor/removed";ops.OdtDocument.signalCursorMoved="cursor/moved";ops.OdtDocument.signalParagraphChanged="paragraph/changed";ops.OdtDocument.signalTableAdded="table/added";ops.OdtDocument.signalStyleCreated="style/created";ops.OdtDocument.signalStyleDeleted="style/deleted";ops.OdtDocument.signalParagraphStyleModified="paragraphstyle/modified"; -ops.OdtDocument.signalOperationExecuted="operation/executed";ops.OdtDocument.signalUndoStackChanged="undo/changed";(function(){return ops.OdtDocument})(); -// Input 72 -/* - - Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com> - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.TrivialOperationRouter");runtime.loadClass("ops.OperationFactory");runtime.loadClass("ops.OdtDocument"); -ops.Session=function(e){var k=new ops.OdtDocument(e),l=new ops.TrivialUserModel,p=null;this.setUserModel=function(e){l=e};this.setOperationRouter=function(e){p=e;e.setPlaybackFunction(function(e){e.execute(k);k.emit(ops.OdtDocument.signalOperationExecuted,e)});e.setOperationFactory(new ops.OperationFactory)};this.getUserModel=function(){return l};this.getOdtDocument=function(){return k};this.enqueue=function(e){p.push(e)};this.setOperationRouter(new ops.TrivialOperationRouter)}; -// Input 73 -var webodf_css="@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);\n@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);\n@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);\n@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);\n@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);\n@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);\n@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);\n@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);\n@namespace runtimens url(urn:webodf); /* namespace for runtime only */\n@namespace cursor url(urn:webodf:names:cursor);\n@namespace editinfo url(urn:webodf:names:editinfo);\n\noffice|document > *, office|document-content > * {\n display: none;\n}\noffice|body, office|document {\n display: inline-block;\n position: relative;\n}\n\ntext|p, text|h {\n display: block;\n padding: 0;\n margin: 0;\n line-height: normal;\n position: relative;\n min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\n}\ntext|line-break {\n content: \" \";\n display: block;\n}\ntext|tracked-changes {\n /*Consumers that do not support change tracking, should ignore changes.*/\n display: none;\n}\noffice|binary-data {\n display: none;\n}\noffice|text {\n display: block;\n text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\n\noffice|spreadsheet {\n display: block;\n border-collapse: collapse;\n empty-cells: show;\n font-family: sans-serif;\n font-size: 10pt;\n text-align: left;\n page-break-inside: avoid;\n overflow: hidden;\n}\noffice|presentation {\n display: inline-block;\n text-align: left;\n}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\n display: none;\n}\n@media print {\n draw|page {\n border: 1pt solid black;\n page-break-inside: avoid;\n }\n presentation|notes {\n /*TODO*/\n }\n}\noffice|spreadsheet text|p {\n border: 0px;\n padding: 1px;\n margin: 0px;\n}\noffice|spreadsheet table|table {\n margin: 3px;\n}\noffice|spreadsheet table|table:after {\n /* show sheet name the end of the sheet */\n /*content: attr(table|name);*/ /* gives parsing error in opera */\n}\noffice|spreadsheet table|table-row {\n counter-increment: row;\n}\noffice|spreadsheet table|table-row:before {\n width: 3em;\n background: #cccccc;\n border: 1px solid black;\n text-align: center;\n content: counter(row);\n display: table-cell;\n}\noffice|spreadsheet table|table-cell {\n border: 1px solid #cccccc;\n}\ntable|table {\n display: table;\n}\ndraw|frame table|table {\n width: 100%;\n height: 100%;\n background: white;\n}\ntable|table-header-rows {\n display: table-header-group;\n}\ntable|table-row {\n display: table-row;\n}\ntable|table-column {\n display: table-column;\n}\ntable|table-cell {\n width: 0.889in;\n display: table-cell;\n word-break: break-all; /* prevent long words from extending out the table cell */\n}\ndraw|frame {\n display: block;\n}\ndraw|image {\n display: block;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n -moz-background-size: 100% 100%;\n}\n/* only show the first image in frame */\ndraw|frame > draw|image:nth-of-type(n+2) {\n display: none;\n}\ntext|list:before {\n display: none;\n content:\"\";\n}\ntext|list {\n counter-reset: list;\n}\ntext|list-item {\n display: block;\n}\ntext|number {\n display:none;\n}\n\ntext|a {\n color: blue;\n text-decoration: underline;\n cursor: pointer;\n}\ntext|note-citation {\n vertical-align: super;\n font-size: smaller;\n}\ntext|note-body {\n display: none;\n}\ntext|note:hover text|note-citation {\n background: #dddddd;\n}\ntext|note:hover text|note-body {\n display: block;\n left:1em;\n max-width: 80%;\n position: absolute;\n background: #ffffaa;\n}\nsvg|title, svg|desc {\n display: none;\n}\nvideo {\n width: 100%;\n height: 100%\n}\n\n/* below set up the cursor */\ncursor|cursor {\n display: inline;\n width: 0px;\n height: 1em;\n /* making the position relative enables the avatar to use\n the cursor as reference for its absolute position */\n position: relative;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n height: 1em;\n border-left: 2px solid black;\n outline: none;\n}\n\ncursor|cursor > div {\n padding: 3px;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n border: none !important;\n border-radius: 5px;\n opacity: 0.3;\n}\n\ncursor|cursor > div > img {\n border-radius: 5px;\n}\n\ncursor|cursor > div.active {\n opacity: 0.8;\n}\n\ncursor|cursor > div:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n"; +list:["list-item"]},s=[[m,"color","color"],[m,"background-color","background-color"],[m,"font-weight","font-weight"],[m,"font-style","font-style"]],x=[[r,"repeat","background-repeat"]],w=[[m,"background-color","background-color"],[m,"text-align","text-align"],[m,"text-indent","text-indent"],[m,"padding","padding"],[m,"padding-left","padding-left"],[m,"padding-right","padding-right"],[m,"padding-top","padding-top"],[m,"padding-bottom","padding-bottom"],[m,"border-left","border-left"],[m,"border-right", +"border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"margin","margin"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"],[m,"border","border"]],B=[[m,"background-color","background-color"],[m,"min-height","min-height"],[p,"stroke","border"],[b,"stroke-color","border-color"],[b,"stroke-width","border-width"],[m,"border","border"],[m,"border-left","border-left"],[m,"border-right","border-right"], +[m,"border-top","border-top"],[m,"border-bottom","border-bottom"]],I=[[m,"background-color","background-color"],[m,"border-left","border-left"],[m,"border-right","border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"border","border"]],C=[[r,"column-width","width"]],F=[[r,"row-height","height"],[m,"keep-together",null]],J=[[r,"width","width"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"]], +N=[[m,"background-color","background-color"],[m,"padding","padding"],[m,"padding-left","padding-left"],[m,"padding-right","padding-right"],[m,"padding-top","padding-top"],[m,"padding-bottom","padding-bottom"],[m,"border","border"],[m,"border-left","border-left"],[m,"border-right","border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"margin","margin"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"]], +K=[[m,"page-width","width"],[m,"page-height","height"]],H={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},z={margin:!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"margin-bottom":!0},Z={},T=odf.OdfUtils,G,U,aa,P=xmldom.XPath,D=new core.CSSUnits;this.style2css=function(b,a,c,e,d){function g(b,a){f="@namespace "+b+" url("+a+");";try{c.insertRule(f,c.cssRules.length)}catch(e){}}var f,h,n;for(U=a;c.cssRules.length;)c.deleteRule(c.cssRules.length- +1);odf.Namespaces.forEachPrefix(g);g("webodfhelper","urn:webodf:names:helper");Z=e;G=b;aa=runtime.getWindow().getComputedStyle(document.body,null).getPropertyValue("font-size")||"12pt";for(n in y)if(y.hasOwnProperty(n))for(h in b=d[n],b)b.hasOwnProperty(h)&&q(c,n,h,b[h])}};(function(){function f(k,a){var d=this;this.getDistance=function(a){var f=d.x-a.x;a=d.y-a.y;return Math.sqrt(f*f+a*a)};this.getCenter=function(a){return new f((d.x+a.x)/2,(d.y+a.y)/2)};d.x=k;d.y=a}gui.ZoomHelper=function(){function k(b,a,c,d){b=d?"translate3d("+b+"px, "+a+"px, 0) scale3d("+c+", "+c+", 1)":"translate("+b+"px, "+a+"px) scale("+c+")";e.style.WebkitTransform=b;e.style.MozTransform=b;e.style.msTransform=b;e.style.OTransform=b;e.style.transform=b}function a(b){b?k(-n.x,-n.y,t,!0):(k(0, +0,t,!0),k(0,0,t,!1))}function d(b){if(s&&C){var a=s.style.overflow,c=s.classList.contains("webodf-customScrollbars");b&&c||!b&&!c||(b?(s.classList.add("webodf-customScrollbars"),s.style.overflow="hidden",runtime.requestAnimationFrame(function(){s.style.overflow=a})):s.classList.remove("webodf-customScrollbars"))}}function c(){k(-n.x,-n.y,t,!0);s.scrollLeft=0;s.scrollTop=0;F=x.style.overflow;x.style.overflow="visible";d(!1)}function h(){k(0,0,t,!0);s.scrollLeft=n.x;s.scrollTop=n.y;x.style.overflow= +F||"";d(!0)}function q(b){return new f(b.pageX-e.offsetLeft,b.pageY-e.offsetTop)}function p(b){g&&(n.x-=b.x-g.x,n.y-=b.y-g.y,n=new f(Math.min(Math.max(n.x,e.offsetLeft),(e.offsetLeft+e.offsetWidth)*t-s.clientWidth),Math.min(Math.max(n.y,e.offsetTop),(e.offsetTop+e.offsetHeight)*t-s.clientHeight)));g=b}function m(b){var a=b.touches.length,e=0<a?q(b.touches[0]):null;b=1<a?q(b.touches[1]):null;e&&b?(u=e.getDistance(b),y=t,g=e.getCenter(b),c(),I=B.PINCH):e&&(g=e,I=B.SCROLL)}function l(b){var d=b.touches.length, +g=0<d?q(b.touches[0]):null,d=1<d?q(b.touches[1]):null;if(g&&d)if(b.preventDefault(),I===B.SCROLL)I=B.PINCH,c(),u=g.getDistance(d);else{b=g.getCenter(d);g=g.getDistance(d)/u;p(b);var d=t,f=Math.min(v,e.offsetParent.clientWidth/e.offsetWidth);t=y*g;t=Math.min(Math.max(t,f),v);g=t/d;n.x+=(g-1)*(b.x+n.x);n.y+=(g-1)*(b.y+n.y);a(!0)}else g&&(I===B.PINCH?(I=B.SCROLL,h()):p(g))}function r(){I===B.PINCH&&(w.emit(gui.ZoomHelper.signalZoomChanged,t),h(),a(!1));I=B.NONE}function b(){s&&(s.removeEventListener("touchstart", +m,!1),s.removeEventListener("touchmove",l,!1),s.removeEventListener("touchend",r,!1))}var e,n,g,u,t,y,v=4,s,x,w=new core.EventNotifier([gui.ZoomHelper.signalZoomChanged]),B={NONE:0,SCROLL:1,PINCH:2},I=B.NONE,C=runtime.getWindow().hasOwnProperty("ontouchstart"),F="";this.subscribe=function(b,a){w.subscribe(b,a)};this.unsubscribe=function(b,a){w.unsubscribe(b,a)};this.getZoomLevel=function(){return t};this.setZoomLevel=function(b){e&&(t=b,a(!1),w.emit(gui.ZoomHelper.signalZoomChanged,t))};this.destroy= +function(a){b();d(!1);a()};this.setZoomableElement=function(c){b();e=c;s=e.offsetParent;x=e.parentNode;a(!1);s&&(s.addEventListener("touchstart",m,!1),s.addEventListener("touchmove",l,!1),s.addEventListener("touchend",r,!1));d(!0)};y=t=1;n=new f(0,0)};gui.ZoomHelper.signalZoomChanged="zoomChanged"})();ops.Canvas=function(){};ops.Canvas.prototype.getZoomLevel=function(){};ops.Canvas.prototype.getElement=function(){};ops.Canvas.prototype.getSizer=function(){};ops.Canvas.prototype.getZoomHelper=function(){};(function(){function f(){function b(e){c=!0;runtime.setTimeout(function(){try{e()}catch(d){runtime.log(String(d)+"\n"+d.stack)}c=!1;0<a.length&&b(a.pop())},10)}var a=[],c=!1;this.clearQueue=function(){a.length=0};this.addToQueue=function(e){if(0===a.length&&!c)return b(e);a.push(e)}}function k(b){function a(){for(;0<c.cssRules.length;)c.deleteRule(0);c.insertRule("#shadowContent draw|page {display:none;}",0);c.insertRule("office|presentation draw|page {display:none;}",1);c.insertRule("#shadowContent draw|page:nth-of-type("+ +e+") {display:block;}",2);c.insertRule("office|presentation draw|page:nth-of-type("+e+") {display:block;}",3)}var c=b.sheet,e=1;this.showFirstPage=function(){e=1;a()};this.showNextPage=function(){e+=1;a()};this.showPreviousPage=function(){1<e&&(e-=1,a())};this.showPage=function(b){0<b&&(e=b,a())};this.css=b;this.destroy=function(a){b.parentNode.removeChild(b);a()}}function a(b){for(;b.firstChild;)b.removeChild(b.firstChild)}function d(b){b=b.sheet;for(var a=b.cssRules;a.length;)b.deleteRule(a.length- +1)}function c(b,a,c){var e=new odf.Style2CSS,d=new odf.ListStyleToCss;c=c.sheet;var g=(new odf.StyleTree(b.rootElement.styles,b.rootElement.automaticStyles)).getStyleTree();e.style2css(b.getDocumentType(),b.rootElement,c,a.getFontMap(),g);d.applyListStyles(c,g,b.rootElement.body)}function h(b,a){(new odf.FontLoader).loadFonts(b,a.sheet)}function q(b,a,c){var e=null;b=b.rootElement.body.getElementsByTagNameNS(J,c+"-decl");c=a.getAttributeNS(J,"use-"+c+"-name");var d;if(c&&0<b.length)for(a=0;a<b.length;a+= +1)if(d=b[a],d.getAttributeNS(J,"name")===c){e=d.textContent;break}return e}function p(b,c,e,d){var g=b.ownerDocument;c=K.getElementsByTagNameNS(b,c,e);for(b=0;b<c.length;b+=1)a(c[b]),d&&(e=c[b],e.appendChild(g.createTextNode(d)))}function m(b,a,c){a.setAttributeNS("urn:webodf:names:helper","styleid",b);var e,d=a.getAttributeNS(C,"anchor-type"),g=a.getAttributeNS(B,"x"),f=a.getAttributeNS(B,"y"),h=a.getAttributeNS(B,"width"),n=a.getAttributeNS(B,"height"),m=a.getAttributeNS(s,"min-height"),l=a.getAttributeNS(s, +"min-width");if("as-char"===d)e="display: inline-block;";else if(d||g||f)e="position: absolute;";else if(h||n||m||l)e="display: block;";g&&(e+="left: "+g+";");f&&(e+="top: "+f+";");h&&(e+="width: "+h+";");n&&(e+="height: "+n+";");m&&(e+="min-height: "+m+";");l&&(e+="min-width: "+l+";");e&&(e="draw|"+a.localName+'[webodfhelper|styleid="'+b+'"] {'+e+"}",c.insertRule(e,c.cssRules.length))}function l(b){for(b=b.firstChild;b;){if(b.namespaceURI===x&&"binary-data"===b.localName)return"data:image/png;base64,"+ +b.textContent.replace(/[\r\n\s]/g,"");b=b.nextSibling}return""}function r(b,a,c,e){function d(a){a&&(a='draw|image[webodfhelper|styleid="'+b+'"] {'+("background-image: url("+a+");")+"}",e.insertRule(a,e.cssRules.length))}function g(b){d(b.url)}c.setAttributeNS("urn:webodf:names:helper","styleid",b);var f=c.getAttributeNS(F,"href"),h;if(f)try{h=a.getPart(f),h.onchange=g,h.load()}catch(n){runtime.log("slight problem: "+String(n))}else f=l(c),d(f)}function b(b){var a=b.ownerDocument;K.getElementsByTagNameNS(b, +C,"line-break").forEach(function(b){b.hasChildNodes()||b.appendChild(a.createElement("br"))})}function e(b){var a=b.ownerDocument;K.getElementsByTagNameNS(b,C,"s").forEach(function(b){for(var c,e;b.firstChild;)b.removeChild(b.firstChild);b.appendChild(a.createTextNode(" "));e=parseInt(b.getAttributeNS(C,"c"),10);if(1<e)for(b.removeAttributeNS(C,"c"),c=1;c<e;c+=1)b.parentNode.insertBefore(b.cloneNode(!0),b)})}function n(b){K.getElementsByTagNameNS(b,C,"tab").forEach(function(b){b.textContent="\t"})} +function g(b,a){function c(b,e){var f=h.documentElement.namespaceURI;"video/"===e.substr(0,6)?(d=h.createElementNS(f,"video"),d.setAttribute("controls","controls"),g=h.createElementNS(f,"source"),b&&g.setAttribute("src",b),g.setAttribute("type",e),d.appendChild(g),a.parentNode.appendChild(d)):a.innerHtml="Unrecognised Plugin"}function e(b){c(b.url,b.mimetype)}var d,g,f,h=a.ownerDocument,n;if(f=a.getAttributeNS(F,"href"))try{n=b.getPart(f),n.onchange=e,n.load()}catch(m){runtime.log("slight problem: "+ +String(m))}else runtime.log("using MP4 data fallback"),f=l(a),c(f,"video/mp4")}function u(b){var a=b.getElementsByTagName("head")[0],c,e;c=b.styleSheets.length;for(e=a.firstElementChild;e&&("style"!==e.localName||!e.hasAttribute("webodfcss"));)e=e.nextElementSibling;if(e)return c=parseInt(e.getAttribute("webodfcss"),10),e.setAttribute("webodfcss",c+1),e;"string"===String(typeof webodf_css)?c=webodf_css:(e="webodf.css",runtime.currentDirectory&&(e=runtime.currentDirectory(),0<e.length&&"/"!==e.substr(-1)&& +(e+="/"),e+="../webodf.css"),c=runtime.readFileSync(e,"utf-8"));e=b.createElementNS(a.namespaceURI,"style");e.setAttribute("media","screen, print, handheld, projection");e.setAttribute("type","text/css");e.setAttribute("webodfcss","1");e.appendChild(b.createTextNode(c));a.appendChild(e);return e}function t(b){var a=parseInt(b.getAttribute("webodfcss"),10);1===a?b.parentNode.removeChild(b):b.setAttribute("count",a-1)}function y(b){var a=b.getElementsByTagName("head")[0],c=b.createElementNS(a.namespaceURI, +"style"),e="";c.setAttribute("type","text/css");c.setAttribute("media","screen, print, handheld, projection");odf.Namespaces.forEachPrefix(function(b,a){e+="@namespace "+b+" url("+a+");\n"});e+="@namespace webodfhelper url(urn:webodf:names:helper);\n";c.appendChild(b.createTextNode(e));a.appendChild(c);return c}var v=odf.Namespaces.drawns,s=odf.Namespaces.fons,x=odf.Namespaces.officens,w=odf.Namespaces.stylens,B=odf.Namespaces.svgns,I=odf.Namespaces.tablens,C=odf.Namespaces.textns,F=odf.Namespaces.xlinkns, +J=odf.Namespaces.presentationns,N=xmldom.XPath,K=core.DomUtils;odf.OdfCanvas=function(l,s){function B(b,a,c){function e(b,a,c,d){ma.addToQueue(function(){r(b,a,c,d)})}var d,g;d=a.getElementsByTagNameNS(v,"image");for(a=0;a<d.length;a+=1)g=d.item(a),e("image"+String(a),b,g,c)}function F(b,a){function c(b,a){ma.addToQueue(function(){g(b,a)})}var e,d,f;d=a.getElementsByTagNameNS(v,"plugin");for(e=0;e<d.length;e+=1)f=d.item(e),c(b,f)}function G(){var b;b=Y.firstChild;var a=ga.getZoomLevel();b&&(Y.style.WebkitTransformOrigin= +"0% 0%",Y.style.MozTransformOrigin="0% 0%",Y.style.msTransformOrigin="0% 0%",Y.style.OTransformOrigin="0% 0%",Y.style.transformOrigin="0% 0%",da&&((b=da.getMinimumHeightForAnnotationPane())?Y.style.minHeight=b:Y.style.removeProperty("min-height")),l.style.width=Math.round(a*Y.offsetWidth)+"px",l.style.height=Math.round(a*Y.offsetHeight)+"px",l.style.display="inline-block")}function U(c,d){var g=ha.sheet;a(l);Y=$.createElementNS(l.namespaceURI,"div");Y.style.display="inline-block";Y.style.background= +"white";Y.style.setProperty("float","left","important");Y.appendChild(d);l.appendChild(Y);E=$.createElementNS(l.namespaceURI,"div");E.id="annotationsPane";ca=$.createElementNS(l.namespaceURI,"div");ca.id="shadowContent";ca.style.position="absolute";ca.style.top=0;ca.style.left=0;c.getContentElement().appendChild(ca);var f=d.body,h,k=[],r;for(h=f.firstElementChild;h&&h!==f;)if(h.namespaceURI===v&&(k[k.length]=h),h.firstElementChild)h=h.firstElementChild;else{for(;h&&h!==f&&!h.nextElementSibling;)h= +h.parentNode;h&&h.nextElementSibling&&(h=h.nextElementSibling)}for(r=0;r<k.length;r+=1)h=k[r],m("frame"+String(r),h,g);k=N.getODFElementsWithXPath(f,".//*[*[@text:anchor-type='paragraph']]",odf.Namespaces.lookupNamespaceURI);for(h=0;h<k.length;h+=1)f=k[h],f.setAttributeNS&&f.setAttributeNS("urn:webodf:names:helper","containsparagraphanchor",!0);f=V;h=ca;var s,u,t,z,y=0,G;r=c.rootElement.ownerDocument;if((k=d.body.firstElementChild)&&k.namespaceURI===x&&("presentation"===k.localName||"drawing"===k.localName))for(k= +k.firstElementChild;k;){if(s=(s=k.getAttributeNS(v,"master-page-name"))?f.getMasterPageElement(s):null){u=k.getAttributeNS("urn:webodf:names:helper","styleid");t=r.createElementNS(v,"draw:page");G=s.firstElementChild;for(y=0;G;)"true"!==G.getAttributeNS(J,"placeholder")&&(z=G.cloneNode(!0),t.appendChild(z)),G=G.nextElementSibling,y+=1;G=z=y=void 0;for(var A=K.getElementsByTagNameNS(t,v,"frame"),y=0;y<A.length;y+=1)z=A[y],(G=z.getAttributeNS(J,"class"))&&!/^(date-time|footer|header|page-number)$/.test(G)&& +z.parentNode.removeChild(z);z=K.getElementsByTagNameNS(t,v,"*");for(y=0;y<z.length;y+=1)m(u+"_"+y,z[y],g);h.appendChild(t);y=String(h.getElementsByTagNameNS(v,"page").length);p(t,C,"page-number",y);p(t,J,"header",q(c,k,"header"));p(t,J,"footer",q(c,k,"footer"));m(u,t,g);t.setAttributeNS("urn:webodf:names:helper","page-style-name",k.getAttributeNS(v,"style-name"));t.setAttributeNS(v,"draw:master-page-name",s.getAttributeNS(w,"name"))}k=k.nextElementSibling}f=l.namespaceURI;k=K.getElementsByTagNameNS(d.body, +I,"table-cell");for(h=0;h<k.length;h+=1)r=k[h],r.hasAttributeNS(I,"number-columns-spanned")&&r.setAttributeNS(f,"colspan",r.getAttributeNS(I,"number-columns-spanned")),r.hasAttributeNS(I,"number-rows-spanned")&&r.setAttributeNS(f,"rowspan",r.getAttributeNS(I,"number-rows-spanned"));b(d.body);e(d.body);n(d.body);B(c,d.body,g);F(c,d.body);Y.insertBefore(ca,Y.firstChild);ga.setZoomableElement(Y)}function aa(b){X?(E.parentNode||Y.appendChild(E),da&&da.forgetAnnotations(),da=new gui.AnnotationViewManager(Q, +b.body,E,R),K.getElementsByTagNameNS(b.body,x,"annotation").forEach(da.addAnnotation),da.rerenderAnnotations(),G()):E.parentNode&&(Y.removeChild(E),da.forgetAnnotations(),G())}function P(b){function e(){d(M);d(ea);d(ha);a(l);l.style.display="inline-block";var g=A.rootElement;l.ownerDocument.importNode(g,!0);V.setOdfContainer(A);h(A,M);c(A,V,ea);U(A,g);aa(g);b||ma.addToQueue(function(){var b=[A];if(fa.hasOwnProperty("statereadychange")){var a=fa.statereadychange,c;for(c=0;c<a.length;c+=1)a[c].apply(null, +b)}})}A.state===odf.OdfContainer.DONE?e():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),pa=runtime.setTimeout(function W(){A.state===odf.OdfContainer.DONE?e():(runtime.log("will be back later..."),pa=runtime.setTimeout(W,500))},100))}function D(b){ma.clearQueue();l.innerHTML=runtime.tr("Loading")+" "+b+"...";l.removeAttribute("style");A=new odf.OdfContainer(b,function(b){A=b;P(!1)})}runtime.assert(null!==l&&void 0!==l,"odf.OdfCanvas constructor needs DOM element");runtime.assert(null!== +l.ownerDocument&&void 0!==l.ownerDocument,"odf.OdfCanvas constructor needs DOM");var Q=this,$=l.ownerDocument,A,V=new odf.Formatting,ba,Y=null,E=null,X=!1,R=!1,da=null,S,M,ea,ha,ca,fa={},pa,ka,ia=!1,la=!1,ma=new f,ga=new gui.ZoomHelper,ja=s||new gui.SingleScrollViewport(l.parentNode);this.refreshCSS=function(){ia=!0;ka.trigger()};this.refreshSize=function(){ka.trigger()};this.odfContainer=function(){return A};this.setOdfContainer=function(b,a){A=b;P(!0===a)};this.load=this.load=D;this.save=function(b){A.save(b)}; +this.addListener=function(b,a){switch(b){case "click":var c=l,e=b;c.addEventListener?c.addEventListener(e,a,!1):c.attachEvent?c.attachEvent("on"+e,a):c["on"+e]=a;break;default:c=fa.hasOwnProperty(b)?fa[b]:fa[b]=[],a&&-1===c.indexOf(a)&&c.push(a)}};this.getFormatting=function(){return V};this.getAnnotationViewManager=function(){return da};this.refreshAnnotations=function(){aa(A.rootElement)};this.rerenderAnnotations=function(){da&&(la=!0,ka.trigger())};this.getSizer=function(){return Y};this.enableAnnotations= +function(b,a){b!==X&&(X=b,R=a,A&&aa(A.rootElement))};this.addAnnotation=function(b){da&&(da.addAnnotation(b),G())};this.forgetAnnotations=function(){da&&(da.forgetAnnotations(),G())};this.getZoomHelper=function(){return ga};this.setZoomLevel=function(b){ga.setZoomLevel(b)};this.getZoomLevel=function(){return ga.getZoomLevel()};this.fitToContainingElement=function(b,a){var c=ga.getZoomLevel(),e=l.offsetHeight/c,c=b/(l.offsetWidth/c);a/e<c&&(c=a/e);ga.setZoomLevel(c)};this.fitToWidth=function(b){var a= +l.offsetWidth/ga.getZoomLevel();ga.setZoomLevel(b/a)};this.fitSmart=function(b,a){var c,e;e=ga.getZoomLevel();c=l.offsetWidth/e;e=l.offsetHeight/e;c=b/c;void 0!==a&&a/e<c&&(c=a/e);ga.setZoomLevel(Math.min(1,c))};this.fitToHeight=function(b){var a=l.offsetHeight/ga.getZoomLevel();ga.setZoomLevel(b/a)};this.showFirstPage=function(){ba.showFirstPage()};this.showNextPage=function(){ba.showNextPage()};this.showPreviousPage=function(){ba.showPreviousPage()};this.showPage=function(b){ba.showPage(b);G()}; +this.getElement=function(){return l};this.getViewport=function(){return ja};this.addCssForFrameWithImage=function(b){var a=b.getAttributeNS(v,"name"),c=b.firstElementChild;m(a,b,ha.sheet);c&&r(a+"img",A,c,ha.sheet)};this.destroy=function(b){var a=$.getElementsByTagName("head")[0],c=[ba.destroy,ka.destroy];runtime.clearTimeout(pa);E&&E.parentNode&&E.parentNode.removeChild(E);ga.destroy(function(){Y&&(l.removeChild(Y),Y=null)});t(S);a.removeChild(M);a.removeChild(ea);a.removeChild(ha);core.Async.destroyAll(c, +b)};S=u($);ba=new k(y($));M=y($);ea=y($);ha=y($);ka=core.Task.createRedrawTask(function(){ia&&(c(A,V,ea),ia=!1);la&&(da&&da.rerenderAnnotations(),la=!1);G()});ga.subscribe(gui.ZoomHelper.signalZoomChanged,G)}})();odf.StepUtils=function(){this.getContentBounds=function(f){var k=f.container(),a,d;runtime.assert(f.isStep(),"Step iterator must be on a step");k.nodeType===Node.TEXT_NODE&&0<f.offset()?a=f.offset():(k=f.leftNode())&&k.nodeType===Node.TEXT_NODE&&(a=k.length);k&&(k.nodeType===Node.TEXT_NODE?(runtime.assert(0<a,"Empty text node found"),d={container:k,startOffset:a-1,endOffset:a}):d={container:k,startOffset:0,endOffset:k.childNodes.length});return d}};ops.MemberProperties=function(){}; +ops.Member=function(f,k){var a=new ops.MemberProperties;this.getMemberId=function(){return f};this.getProperties=function(){return a};this.setProperties=function(d){Object.keys(d).forEach(function(c){a[c]=d[c]})};this.removeProperties=function(d){Object.keys(d).forEach(function(c){"fullName"!==c&&"color"!==c&&"imageUrl"!==c&&a.hasOwnProperty(c)&&delete a[c]})};runtime.assert(Boolean(f),"No memberId was supplied!");k.fullName||(k.fullName=runtime.tr("Unknown Author"));k.color||(k.color="black");k.imageUrl|| +(k.imageUrl="avatar-joe.png");a=k};ops.Document=function(){};ops.Document.prototype.getMemberIds=function(){};ops.Document.prototype.removeCursor=function(f){};ops.Document.prototype.getDocumentElement=function(){};ops.Document.prototype.getRootNode=function(){};ops.Document.prototype.getDOMDocument=function(){};ops.Document.prototype.cloneDocumentElement=function(){};ops.Document.prototype.setDocumentElement=function(f){};ops.Document.prototype.subscribe=function(f,k){};ops.Document.prototype.unsubscribe=function(f,k){}; +ops.Document.prototype.getCanvas=function(){};ops.Document.prototype.createRootFilter=function(f){};ops.Document.prototype.createPositionIterator=function(f){};ops.Document.signalCursorAdded="cursor/added";ops.Document.signalCursorRemoved="cursor/removed";ops.Document.signalCursorMoved="cursor/moved";ops.Document.signalMemberAdded="member/added";ops.Document.signalMemberUpdated="member/updated";ops.Document.signalMemberRemoved="member/removed";ops.OdtCursor=function(f,k){var a=this,d={},c,h,q=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){h.remove()};this.subscribe=function(a,c){q.subscribe(a,c)};this.unsubscribe=function(a,c){q.unsubscribe(a,c)};this.getMemberId=function(){return f};this.getNode=function(){return h.getNode()};this.getAnchorNode=function(){return h.getAnchorNode()};this.getSelectedRange=function(){return h.getSelectedRange()};this.setSelectedRange=function(c,d){h.setSelectedRange(c, +d);q.emit(ops.OdtCursor.signalCursorUpdated,a)};this.hasForwardSelection=function(){return h.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return c};this.setSelectionType=function(a){d.hasOwnProperty(a)?c=a:runtime.log("Invalid selection type: "+a)};this.resetSelectionType=function(){a.setSelectionType(ops.OdtCursor.RangeSelection)};h=new core.Cursor(k.getDOMDocument(),f);d[ops.OdtCursor.RangeSelection]=!0;d[ops.OdtCursor.RegionSelection]=!0;a.resetSelectionType()}; +ops.OdtCursor.RangeSelection="Range";ops.OdtCursor.RegionSelection="Region";ops.OdtCursor.signalCursorUpdated="cursorUpdated";(function(){var f=0;ops.StepsCache=function(k,a,d){function c(b,a){var c=this;this.nodeId=b;this.steps=-1;this.node=a;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(b){b.setPositionBeforeElement(a);d(c.steps,b)}}function h(b,a,c){var e=this;this.nodeId=b;this.steps=a;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(b){b.setUnfilteredPosition(c,0);d(e.steps,b)}}function q(b,a){var c="["+b.nodeId;a&&(c+=" => "+a.nodeId);return c+ +"]"}function p(){for(var b=y,a,c,e,d=new core.LoopWatchDog(0,1E5),f={};b;){d.check();(a=b.previousBookmark)?runtime.assert(a.nextBookmark===b,"Broken bookmark link to previous @"+q(a,b)):(runtime.assert(b===y,"Broken bookmark link @"+q(b)),runtime.assert(void 0===v||y===y||y.steps<=v,"Base point is damaged @"+q(b)));(c=b.nextBookmark)&&runtime.assert(c.previousBookmark===b,"Broken bookmark link to next @"+q(b,c));if(void 0===v||b===y||b.steps<=v)runtime.assert(t.containsNode(k,b.node),"Disconnected node is being reported as undamaged @"+ +q(b)),a&&(e=b.node.compareDocumentPosition(a.node),runtime.assert(0===e||0!==(e&x),"Bookmark order with previous does not reflect DOM order @"+q(a,b))),c&&t.containsNode(k,c.node)&&(e=b.node.compareDocumentPosition(c.node),runtime.assert(0===e||0!==(e&s),"Bookmark order with next does not reflect DOM order @"+q(b,c)));b=b.nextBookmark}Object.keys(g).forEach(function(b){var a=g[b];(void 0===v||b<=v)&&runtime.assert(a.steps<=b,"Bookmark step of "+a.steps+" exceeds cached step lookup for "+b+" @"+q(a)); +runtime.assert(!1===f.hasOwnProperty(a.nodeId),"Bookmark "+q(a)+" appears twice in cached step lookup at steps "+f[a.nodeId]+" and "+b);f[a.nodeId]=b})}function m(b){var a="";b.nodeType===Node.ELEMENT_NODE&&(a=b.getAttributeNS(n,"nodeId")||"");return a}function l(b){var a=f.toString();b.setAttributeNS(n,"nodeId",a);f+=1;return a}function r(b){var c,e,d=new core.LoopWatchDog(0,1E4);void 0!==v&&b>v&&(b=v);for(c=Math.floor(b/a)*a;!e&&0<=c;)e=g[c],c-=a;for(e=e||y;e.nextBookmark&&e.nextBookmark.steps<= +b;)d.check(),e=e.nextBookmark;runtime.assert(-1===b||e.steps<=b,"Bookmark @"+q(e)+" at step "+e.steps+" exceeds requested step of "+b);return e}function b(b){b.previousBookmark&&(b.previousBookmark.nextBookmark=b.nextBookmark);b.nextBookmark&&(b.nextBookmark.previousBookmark=b.previousBookmark)}function e(b){for(var a,c=null;!c&&b&&b!==k;)(a=m(b))&&(c=u[a])&&c.node!==b&&(runtime.log("Cloned node detected. Creating new bookmark"),c=null,b.removeAttributeNS(n,"nodeId")),b=b.parentNode;return c}var n= +"urn:webodf:names:steps",g={},u={},t=core.DomUtils,y,v,s=Node.DOCUMENT_POSITION_FOLLOWING,x=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(e,d){var f,h=Math.ceil(e/a)*a,n,p,q;if(void 0!==v&&v<e){n=r(v);for(p=n.nextBookmark;p&&p.steps<=e;)f=p.nextBookmark,q=Math.ceil(p.steps/a)*a,g[q]===p&&delete g[q],t.containsNode(k,p.node)?p.steps=e+1:(b(p),delete u[p.nodeId]),p=f;v=e}else n=r(e);p=m(d)||l(d);f=u[p];f?f.node!==d&&(runtime.log("Cloned node detected. Creating new bookmark"),p=l(d), +f=u[p]=new c(p,d)):f=u[p]=new c(p,d);p=f;p.steps!==e&&(f=Math.ceil(p.steps/a)*a,f!==h&&g[f]===p&&delete g[f],p.steps=e);if(n!==p&&n.nextBookmark!==p){if(n.steps===p.steps)for(;0!==(p.node.compareDocumentPosition(n.node)&s)&&n!==y;)n=n.previousBookmark;n!==p&&n.nextBookmark!==p&&(b(p),f=n.nextBookmark,p.nextBookmark=n.nextBookmark,p.previousBookmark=n,n.nextBookmark=p,f&&(f.previousBookmark=p))}n=g[h];if(!n||p.steps>n.steps)g[h]=p;w()};this.setToClosestStep=function(b,a){var c;w();c=r(b);c.setIteratorPosition(a); +return c.steps};this.setToClosestDomPoint=function(b,a,c){var d,f;w();if(b===k&&0===a)d=y;else if(b===k&&a===k.childNodes.length)for(f in d=y,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>d.steps&&(d=b));else if(d=e(b.childNodes.item(a)||b),!d)for(c.setUnfilteredPosition(b,a);!d&&c.previousNode();)d=e(c.getCurrentNode());d=d||y;void 0!==v&&d.steps>v&&(d=r(v));d.setIteratorPosition(c);return d.steps};this.damageCacheAfterStep=function(b){0>b&&(b=-1);void 0===v?v=b:b<v&&(v=b);w()};(function(){var b=m(k)|| +l(k);y=new h(b,0,k);w=ops.StepsCache.ENABLE_CACHE_VERIFICATION?p:function(){}})()};ops.StepsCache.ENABLE_CACHE_VERIFICATION=!1;ops.StepsCache.Bookmark=function(){};ops.StepsCache.Bookmark.prototype.setIteratorPosition=function(f){}})();(function(){ops.OdtStepsTranslator=function(f,k,a,d){function c(b,a,c){var e=a.getCurrentNode();a.isBeforeNode()&&r.isParagraph(e)&&(c||(b+=1),l.updateBookmark(b,e))}function h(b,e){do{if(a.acceptPosition(e)===n){c(b,e,!0);break}c(b-1,e,!1)}while(e.nextPosition())}function q(){var b=f();b!==m&&(m&&runtime.log("Undo detected. Resetting steps cache"),m=b,l=new ops.StepsCache(m,d,h),e=k(m))}function p(b,c){if(!c||a.acceptPosition(b)===n)return!0;for(;b.previousPosition();)if(a.acceptPosition(b)===n){if(c(g, +b.container(),b.unfilteredDomOffset()))return!0;break}for(;b.nextPosition();)if(a.acceptPosition(b)===n){if(c(u,b.container(),b.unfilteredDomOffset()))return!0;break}return!1}var m,l,r=odf.OdfUtils,b=core.DomUtils,e,n=core.PositionFilter.FilterResult.FILTER_ACCEPT,g=core.StepDirection.PREVIOUS,u=core.StepDirection.NEXT;this.convertStepsToDomPoint=function(b){var d,g;if(isNaN(b))throw new TypeError("Requested steps is not numeric ("+b+")");if(0>b)throw new RangeError("Requested steps is negative ("+ +b+")");q();for(d=l.setToClosestStep(b,e);d<b&&e.nextPosition();)(g=a.acceptPosition(e)===n)&&(d+=1),c(d,e,g);if(d!==b)throw new RangeError("Requested steps ("+b+") exceeds available steps ("+d+")");return{node:e.container(),offset:e.unfilteredDomOffset()}};this.convertDomPointToSteps=function(d,g,f){var h;q();b.containsNode(m,d)||(g=0>b.comparePoints(m,0,d,g),d=m,g=g?0:m.childNodes.length);e.setUnfilteredPosition(d,g);p(e,f)||e.setUnfilteredPosition(d,g);f=e.container();g=e.unfilteredDomOffset(); +d=l.setToClosestDomPoint(f,g,e);if(0>b.comparePoints(e.container(),e.unfilteredDomOffset(),f,g))return 0<d?d-1:d;for(;(e.container()!==f||e.unfilteredDomOffset()!==g)&&e.nextPosition();)(h=a.acceptPosition(e)===n)&&(d+=1),c(d,e,h);return d+0};this.prime=function(){var b,d;q();for(b=l.setToClosestStep(0,e);e.nextPosition();)(d=a.acceptPosition(e)===n)&&(b+=1),c(b,e,d)};this.handleStepsInserted=function(b){q();l.damageCacheAfterStep(b.position)};this.handleStepsRemoved=function(b){q();l.damageCacheAfterStep(b.position- +1)};q()}})();ops.Operation=function(){};ops.Operation.prototype.init=function(f){};ops.Operation.prototype.execute=function(f){};ops.Operation.prototype.spec=function(){};ops.TextPositionFilter=function(){function f(a,d,f){var l,r;if(d){if(k.isInlineRoot(d)&&k.isGroupingElement(f))return h;l=k.lookLeftForCharacter(d);if(1===l||2===l&&(k.scanRightForAnyCharacter(f)||k.scanRightForAnyCharacter(k.nextNode(a))))return c}else if(k.isInlineRoot(a.previousSibling)&&k.isGroupingElement(a))return c;l=null===d&&k.isParagraph(a);r=k.lookRightForCharacter(f);if(l)return r?c:k.scanRightForAnyCharacter(f)?h:c;if(!r)return h;d=d||k.previousNode(a);return k.scanLeftForAnyCharacter(d)? +h:c}var k=odf.OdfUtils,a=Node.ELEMENT_NODE,d=Node.TEXT_NODE,c=core.PositionFilter.FilterResult.FILTER_ACCEPT,h=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(q){var p=q.container(),m=p.nodeType,l,r,b;if(m!==a&&m!==d)return h;if(m===d){m=q.unfilteredDomOffset();l=p.data;runtime.assert(m!==l.length,"Unexpected offset.");if(0<m){q=l[m-1];if(!k.isODFWhitespace(q))return c;if(1<m)if(q=l[m-2],!k.isODFWhitespace(q))r=c;else{if(!k.isODFWhitespace(l.substr(0,m)))return h}else b= +k.previousNode(p),k.scanLeftForNonSpace(b)&&(r=c);if(r===c)return k.isTrailingWhitespace(p,m)?h:c;r=l[m];return k.isODFWhitespace(r)?h:k.scanLeftForAnyCharacter(k.previousNode(p))?h:c}b=q.leftNode();r=p;p=p.parentNode;r=f(p,b,r)}else k.isGroupingElement(p)?(b=q.leftNode(),r=q.rightNode(),r=f(p,b,r)):r=h;return r}};ops.OdtDocument=function(f){function k(b){return new core.PositionIterator(b,C,N,!1)}function a(){var b=f.odfContainer().getContentElement(),a=b&&b.localName;runtime.assert("text"===a,"Unsupported content element type '"+a+"' for OdtDocument");return b}function d(){return b.getDocumentElement().ownerDocument}function c(b){for(;b&&!(b.namespaceURI===odf.Namespaces.officens&&"text"===b.localName||b.namespaceURI===odf.Namespaces.officens&&"annotation"===b.localName);)b=b.parentNode;return b}function h(b){this.acceptPosition= +function(a){a=a.container();var e;e="string"===typeof b?u[b].getNode():b;return c(a)===c(e)?v:s}}function q(b,a,c,e){e=k(e);var d;1===c.length?d=c[0]:(d=new core.PositionFilterChain,c.forEach(d.addFilter));c=new core.StepIterator(d,e);c.setPosition(b,a);return c}function p(b){var c=k(a());b=B.convertStepsToDomPoint(b);c.setUnfilteredPosition(b.node,b.offset);return c}function m(b){return b===x}function l(b){var a,c=[],d,f=2;runtime.assert(b.isStep(),"positionIterator is not at a step");do{if(a=e.getContentBounds(b))if(a= +a.container,n.isDowngradableSpaceElement(a)){for(d=a.lastChild;a.firstChild;)c.push(a.firstChild),a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a);b.setPosition(d,d.nodeType===Node.TEXT_NODE?d.length:d.childNodes.length);b.roundToPreviousStep()}f-=1}while(0<f&&b.nextStep());c.forEach(g.normalizeTextNodes)}function r(b,a,c){b=b.childNodes.item(a)||b;return(b=n.getParagraphElement(b))&&g.containsNode(c,b)?b:c}var b=this,e,n=odf.OdfUtils,g=core.DomUtils,u={},t={},y=new core.EventNotifier([ops.Document.signalMemberAdded, +ops.Document.signalMemberUpdated,ops.Document.signalMemberRemoved,ops.Document.signalCursorAdded,ops.Document.signalCursorRemoved,ops.Document.signalCursorMoved,ops.OdtDocument.signalParagraphChanged,ops.OdtDocument.signalParagraphStyleModified,ops.OdtDocument.signalCommonStyleCreated,ops.OdtDocument.signalCommonStyleDeleted,ops.OdtDocument.signalTableAdded,ops.OdtDocument.signalOperationStart,ops.OdtDocument.signalOperationEnd,ops.OdtDocument.signalProcessingBatchStart,ops.OdtDocument.signalProcessingBatchEnd, +ops.OdtDocument.signalUndoStackChanged,ops.OdtDocument.signalStepsInserted,ops.OdtDocument.signalStepsRemoved,ops.OdtDocument.signalMetadataUpdated,ops.OdtDocument.signalAnnotationAdded]),v=core.PositionFilter.FilterResult.FILTER_ACCEPT,s=core.PositionFilter.FilterResult.FILTER_REJECT,x=core.StepDirection.NEXT,w,B,I,C=NodeFilter.SHOW_ALL,F=new gui.BlacklistNamespaceNodeFilter(["urn:webodf:names:cursor","urn:webodf:names:editinfo"]),J=new gui.OdfTextBodyNodeFilter,N=new core.NodeFilterChain([F,J]); +this.createPositionIterator=k;this.getDocumentElement=function(){return f.odfContainer().rootElement};this.getDOMDocument=function(){return this.getDocumentElement().ownerDocument};this.cloneDocumentElement=function(){var a=b.getDocumentElement(),c=f.getAnnotationViewManager();c&&c.forgetAnnotations();a=a.cloneNode(!0);f.refreshAnnotations();return a};this.setDocumentElement=function(b){var a=f.odfContainer();a.setRootElement(b);f.setOdfContainer(a,!0);f.refreshCSS()};this.getDOMDocument=d;this.getRootElement= +c;this.createStepIterator=q;this.getIteratorAtPosition=p;this.convertCursorStepToDomPoint=function(b){return B.convertStepsToDomPoint(b)};this.convertDomPointToCursorStep=function(b,a,c){var e;c===x&&(e=m);return B.convertDomPointToSteps(b,a,e)};this.convertDomToCursorRange=function(b){var a;a=B.convertDomPointToSteps(b.anchorNode,b.anchorOffset);b=b.anchorNode===b.focusNode&&b.anchorOffset===b.focusOffset?a:B.convertDomPointToSteps(b.focusNode,b.focusOffset);return{position:a,length:b-a}};this.convertCursorToDomRange= +function(b,a){var c=d().createRange(),e,g;e=B.convertStepsToDomPoint(b);a?(g=B.convertStepsToDomPoint(b+a),0<a?(c.setStart(e.node,e.offset),c.setEnd(g.node,g.offset)):(c.setStart(g.node,g.offset),c.setEnd(e.node,e.offset))):c.setStart(e.node,e.offset);return c};this.upgradeWhitespacesAtPosition=function(b){var a=p(b),a=new core.StepIterator(w,a),c,d=2;runtime.assert(a.isStep(),"positionIterator is not at a step (requested step: "+b+")");do{if(c=e.getContentBounds(a))if(b=c.container,c=c.startOffset, +b.nodeType===Node.TEXT_NODE&&n.isSignificantWhitespace(b,c)){runtime.assert(" "===b.data[c],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var g=b.ownerDocument.createElementNS(odf.Namespaces.textns,"text:s"),f=b.parentNode,h=b;g.appendChild(b.ownerDocument.createTextNode(" "));1===b.length?f.replaceChild(g,b):(b.deleteData(c,1),0<c&&(c<b.length&&b.splitText(c),h=b.nextSibling),f.insertBefore(g,h));b=g;a.setPosition(b,b.childNodes.length);a.roundToPreviousStep()}d-= +1}while(0<d&&a.nextStep())};this.downgradeWhitespaces=l;this.downgradeWhitespacesAtPosition=function(b){b=p(b);b=new core.StepIterator(w,b);l(b)};this.getTextNodeAtStep=function(a,c){var e=p(a),g=e.container(),f,h=0,n=null;g.nodeType===Node.TEXT_NODE?(f=g,h=e.unfilteredDomOffset(),0<f.length&&(0<h&&(f=f.splitText(h)),f.parentNode.insertBefore(d().createTextNode(""),f),f=f.previousSibling,h=0)):(f=d().createTextNode(""),h=0,g.insertBefore(f,e.rightNode()));if(c){if(u[c]&&b.getCursorPosition(c)===a){for(n= +u[c].getNode();n.nextSibling&&"cursor"===n.nextSibling.localName;)n.parentNode.insertBefore(n.nextSibling,n);0<f.length&&f.nextSibling!==n&&(f=d().createTextNode(""),h=0);n.parentNode.insertBefore(f,n)}}else for(;f.nextSibling&&"cursor"===f.nextSibling.localName;)f.parentNode.insertBefore(f.nextSibling,f);for(;f.previousSibling&&f.previousSibling.nodeType===Node.TEXT_NODE;)e=f.previousSibling,e.appendData(f.data),h=e.length,f=e,f.parentNode.removeChild(f.nextSibling);for(;f.nextSibling&&f.nextSibling.nodeType=== +Node.TEXT_NODE;)e=f.nextSibling,f.appendData(e.data),f.parentNode.removeChild(e);return{textNode:f,offset:h}};this.fixCursorPositions=function(){Object.keys(u).forEach(function(a){var e=u[a],d=c(e.getNode()),g=b.createRootFilter(d),f,h,n,l=!1;n=e.getSelectedRange();f=r(n.startContainer,n.startOffset,d);h=q(n.startContainer,n.startOffset,[w,g],f);n.collapsed?d=h:(f=r(n.endContainer,n.endOffset,d),d=q(n.endContainer,n.endOffset,[w,g],f));h.isStep()&&d.isStep()?h.container()!==d.container()||h.offset()!== +d.offset()||n.collapsed&&e.getAnchorNode()===e.getNode()||(l=!0,n.setStart(h.container(),h.offset()),n.collapse(!0)):(l=!0,runtime.assert(h.roundToClosestStep(),"No walkable step found for cursor owned by "+a),n.setStart(h.container(),h.offset()),runtime.assert(d.roundToClosestStep(),"No walkable step found for cursor owned by "+a),n.setEnd(d.container(),d.offset()));l&&(e.setSelectedRange(n,e.hasForwardSelection()),b.emit(ops.Document.signalCursorMoved,e))})};this.getCursorPosition=function(b){return(b= +u[b])?B.convertDomPointToSteps(b.getNode(),0):0};this.getCursorSelection=function(b){b=u[b];var a=0,c=0;b&&(a=B.convertDomPointToSteps(b.getNode(),0),c=B.convertDomPointToSteps(b.getAnchorNode(),0));return{position:c,length:a-c}};this.getPositionFilter=function(){return w};this.getOdfCanvas=function(){return f};this.getCanvas=function(){return f};this.getRootNode=a;this.addMember=function(b){runtime.assert(void 0===t[b.getMemberId()],"This member already exists");t[b.getMemberId()]=b};this.getMember= +function(b){return t.hasOwnProperty(b)?t[b]:null};this.removeMember=function(b){delete t[b]};this.getCursor=function(b){return u[b]};this.getMemberIds=function(){var b=[],a;for(a in u)u.hasOwnProperty(a)&&b.push(u[a].getMemberId());return b};this.addCursor=function(a){runtime.assert(Boolean(a),"OdtDocument::addCursor without cursor");var c=a.getMemberId(),e=b.convertCursorToDomRange(0,0);runtime.assert("string"===typeof c,"OdtDocument::addCursor has cursor without memberid");runtime.assert(!u[c], +"OdtDocument::addCursor is adding a duplicate cursor with memberid "+c);a.setSelectedRange(e,!0);u[c]=a};this.removeCursor=function(a){var c=u[a];return c?(c.removeFromDocument(),delete u[a],b.emit(ops.Document.signalCursorRemoved,a),!0):!1};this.moveCursor=function(a,c,e,d){a=u[a];c=b.convertCursorToDomRange(c,e);a&&(a.setSelectedRange(c,0<=e),a.setSelectionType(d||ops.OdtCursor.RangeSelection))};this.getFormatting=function(){return f.getFormatting()};this.emit=function(b,a){y.emit(b,a)};this.subscribe= +function(b,a){y.subscribe(b,a)};this.unsubscribe=function(b,a){y.unsubscribe(b,a)};this.createRootFilter=function(b){return new h(b)};this.close=function(b){b()};this.destroy=function(b){b()};w=new ops.TextPositionFilter;e=new odf.StepUtils;B=new ops.OdtStepsTranslator(a,k,w,500);y.subscribe(ops.OdtDocument.signalStepsInserted,B.handleStepsInserted);y.subscribe(ops.OdtDocument.signalStepsRemoved,B.handleStepsRemoved);y.subscribe(ops.OdtDocument.signalOperationEnd,function(a){var c=a.spec(),e=c.memberid, +d=(new Date(c.timestamp)).toISOString(),g=f.odfContainer(),h={setProperties:{},removedProperties:[]};a.isEdit&&("UpdateMetadata"===c.optype&&(h.setProperties=JSON.parse(JSON.stringify(c.setProperties)),c.removedProperties&&(h.removedProperties=c.removedProperties.attributes.split(","))),c=b.getMember(e).getProperties().fullName,g.setMetadata({"dc:creator":c,"dc:date":d},null),h.setProperties["dc:creator"]=c,h.setProperties["dc:date"]=d,I||(h.setProperties["meta:editing-cycles"]=g.incrementEditingCycles(), +g.setMetadata(null,["meta:editing-duration","meta:document-statistic"])),I=a,b.emit(ops.OdtDocument.signalMetadataUpdated,h))});y.subscribe(ops.OdtDocument.signalProcessingBatchEnd,core.Task.processTasks)};ops.OdtDocument.signalParagraphChanged="paragraph/changed";ops.OdtDocument.signalTableAdded="table/added";ops.OdtDocument.signalCommonStyleCreated="style/created";ops.OdtDocument.signalCommonStyleDeleted="style/deleted";ops.OdtDocument.signalParagraphStyleModified="paragraphstyle/modified"; +ops.OdtDocument.signalOperationStart="operation/start";ops.OdtDocument.signalOperationEnd="operation/end";ops.OdtDocument.signalProcessingBatchStart="router/batchstart";ops.OdtDocument.signalProcessingBatchEnd="router/batchend";ops.OdtDocument.signalUndoStackChanged="undo/changed";ops.OdtDocument.signalStepsInserted="steps/inserted";ops.OdtDocument.signalStepsRemoved="steps/removed";ops.OdtDocument.signalMetadataUpdated="metadata/updated";ops.OdtDocument.signalAnnotationAdded="annotation/added";ops.OpAddAnnotation=function(){function f(a,c,d){var f=a.getTextNodeAtStep(d,k);f&&(a=f.textNode,d=a.parentNode,f.offset!==a.length&&a.splitText(f.offset),d.insertBefore(c,a.nextSibling),0===a.length&&d.removeChild(a))}var k,a,d,c,h,q;this.init=function(f){k=f.memberid;a=parseInt(f.timestamp,10);d=parseInt(f.position,10);c=parseInt(f.length,10)||0;h=f.name};this.isEdit=!0;this.group=void 0;this.execute=function(p){var m=p.getCursor(k),l,r;q=p.getDOMDocument();var b=new Date(a),e,n,g;e=q.createElementNS(odf.Namespaces.officens, +"office:annotation");e.setAttributeNS(odf.Namespaces.officens,"office:name",h);l=q.createElementNS(odf.Namespaces.dcns,"dc:creator");l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k);l.textContent=p.getMember(k).getProperties().fullName;r=q.createElementNS(odf.Namespaces.dcns,"dc:date");r.appendChild(q.createTextNode(b.toISOString()));b=q.createElementNS(odf.Namespaces.textns,"text:list");n=q.createElementNS(odf.Namespaces.textns,"text:list-item");g=q.createElementNS(odf.Namespaces.textns, +"text:p");n.appendChild(g);b.appendChild(n);e.appendChild(l);e.appendChild(r);e.appendChild(b);c&&(l=q.createElementNS(odf.Namespaces.officens,"office:annotation-end"),l.setAttributeNS(odf.Namespaces.officens,"office:name",h),e.annotationEndElement=l,f(p,l,d+c));f(p,e,d);p.emit(ops.OdtDocument.signalStepsInserted,{position:d});m&&(l=q.createRange(),r=e.getElementsByTagNameNS(odf.Namespaces.textns,"p")[0],l.selectNodeContents(r),m.setSelectedRange(l,!1),m.setSelectionType(ops.OdtCursor.RangeSelection), +p.emit(ops.Document.signalCursorMoved,m));p.getOdfCanvas().addAnnotation(e);p.fixCursorPositions();p.emit(ops.OdtDocument.signalAnnotationAdded,{memberId:k,annotation:e});return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:k,timestamp:a,position:d,length:c,name:h}}};ops.OpAddCursor=function(){var f,k;this.init=function(a){f=a.memberid;k=a.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(a){var d=a.getCursor(f);if(d)return!1;d=new ops.OdtCursor(f,a);a.addCursor(d);a.emit(ops.Document.signalCursorAdded,d);return!0};this.spec=function(){return{optype:"AddCursor",memberid:f,timestamp:k}}};ops.OpAddMember=function(){var f,k,a;this.init=function(d){f=d.memberid;k=parseInt(d.timestamp,10);a=d.setProperties};this.isEdit=!1;this.group=void 0;this.execute=function(d){var c;if(d.getMember(f))return!1;c=new ops.Member(f,a);d.addMember(c);d.emit(ops.Document.signalMemberAdded,c);return!0};this.spec=function(){return{optype:"AddMember",memberid:f,timestamp:k,setProperties:a}}};ops.OpAddStyle=function(){var f,k,a,d,c,h,q=odf.Namespaces.stylens;this.init=function(p){f=p.memberid;k=p.timestamp;a=p.styleName;d=p.styleFamily;c="true"===p.isAutomaticStyle||!0===p.isAutomaticStyle;h=p.setProperties};this.isEdit=!0;this.group=void 0;this.execute=function(f){var m=f.getOdfCanvas().odfContainer(),l=f.getFormatting(),k=f.getDOMDocument().createElementNS(q,"style:style");if(!k)return!1;h&&l.updateStyle(k,h);k.setAttributeNS(q,"style:family",d);k.setAttributeNS(q,"style:name",a);c? +m.rootElement.automaticStyles.appendChild(k):m.rootElement.styles.appendChild(k);f.getOdfCanvas().refreshCSS();c||f.emit(ops.OdtDocument.signalCommonStyleCreated,{name:a,family:d});return!0};this.spec=function(){return{optype:"AddStyle",memberid:f,timestamp:k,styleName:a,styleFamily:d,isAutomaticStyle:c,setProperties:h}}};odf.ObjectNameGenerator=function(f,k){function a(b,a){var c={};this.generateName=function(){var e=a(),d=0,f;do f=b+d,d+=1;while(c[f]||e[f]);c[f]=!0;return f}}function d(){var b={};[f.rootElement.automaticStyles,f.rootElement.styles].forEach(function(a){for(a=a.firstElementChild;a;)a.namespaceURI===c&&"style"===a.localName&&(b[a.getAttributeNS(c,"name")]=!0),a=a.nextElementSibling});return b}var c=odf.Namespaces.stylens,h=odf.Namespaces.drawns,q=odf.Namespaces.xlinkns,p=(new core.Utils).hashString(k), +m=null,l=null,r=null,b={},e={};this.generateStyleName=function(){null===m&&(m=new a("auto"+p+"_",function(){return d()}));return m.generateName()};this.generateFrameName=function(){var c,e,d;if(null===l){e=f.rootElement.body.getElementsByTagNameNS(h,"frame");for(c=0;c<e.length;c+=1)d=e.item(c),b[d.getAttributeNS(h,"name")]=!0;l=new a("fr"+p+"_",function(){return b})}return l.generateName()};this.generateImageName=function(){var b,c,d;if(null===r){d=f.rootElement.body.getElementsByTagNameNS(h,"image"); +for(b=0;b<d.length;b+=1)c=d.item(b),c=c.getAttributeNS(q,"href"),c=c.substring(9,c.lastIndexOf(".")),e[c]=!0;r=new a("img"+p+"_",function(){return e})}return r.generateName()}};odf.TextStyleApplicator=function(f,k,a){function d(a){function c(b,a){return"object"===typeof b&&"object"===typeof a?Object.keys(b).every(function(d){return c(b[d],a[d])}):b===a}var b={};this.isStyleApplied=function(e){e=k.getAppliedStylesForElement(e,b).styleProperties;return c(a,e)}}function c(c){var d={};this.applyStyleToContainer=function(b){var e;e=b.getAttributeNS(p,"style-name");var h=b.ownerDocument;e=e||"";if(!d.hasOwnProperty(e)){var g=e,q;q=e?k.createDerivedStyleObject(e,"text",c):c;h= +h.createElementNS(m,"style:style");k.updateStyle(h,q);h.setAttributeNS(m,"style:name",f.generateStyleName());h.setAttributeNS(m,"style:family","text");h.setAttributeNS("urn:webodf:names:scope","scope","document-content");a.appendChild(h);d[g]=h}e=d[e].getAttributeNS(m,"name");b.setAttributeNS(p,"text:style-name",e)}}function h(a,c){var b=a.ownerDocument,e=a.parentNode,d,g,f,h=new core.LoopWatchDog(1E4);g=[];g.push(a);for(f=a.nextSibling;f&&q.rangeContainsNode(c,f);)h.check(),g.push(f),f=f.nextSibling; +"span"!==e.localName||e.namespaceURI!==p?(d=b.createElementNS(p,"text:span"),e.insertBefore(d,a),b=!1):(a.previousSibling&&!q.rangeContainsNode(c,e.firstChild)?(d=e.cloneNode(!1),e.parentNode.insertBefore(d,e.nextSibling)):d=e,b=!0);g.forEach(function(b){b.parentNode!==d&&d.appendChild(b)});if(f&&b)for(g=d.cloneNode(!1),d.parentNode.insertBefore(g,d.nextSibling);f;)h.check(),b=f.nextSibling,g.appendChild(f),f=b;return d}var q=core.DomUtils,p=odf.Namespaces.textns,m=odf.Namespaces.stylens;this.applyStyle= +function(a,f,b){var e={},n,g,m,k;runtime.assert(b&&b.hasOwnProperty("style:text-properties"),"applyStyle without any text properties");e["style:text-properties"]=b["style:text-properties"];m=new c(e);k=new d(e);a.forEach(function(b){n=k.isStyleApplied(b);!1===n&&(g=h(b,f),m.applyStyleToContainer(g))})}};ops.OpApplyDirectStyling=function(){function f(a,c,d){var b=a.getOdfCanvas().odfContainer(),e=p.splitBoundaries(c),f=q.getTextNodes(c,!1);(new odf.TextStyleApplicator(new odf.ObjectNameGenerator(b,k),a.getFormatting(),b.rootElement.automaticStyles)).applyStyle(f,c,d);e.forEach(p.normalizeTextNodes)}var k,a,d,c,h,q=odf.OdfUtils,p=core.DomUtils;this.init=function(f){k=f.memberid;a=f.timestamp;d=parseInt(f.position,10);c=parseInt(f.length,10);h=f.setProperties};this.isEdit=!0;this.group=void 0;this.execute= +function(m){var l=m.convertCursorToDomRange(d,c),p=q.getParagraphElements(l);f(m,l,h);l.detach();m.getOdfCanvas().refreshCSS();m.fixCursorPositions();p.forEach(function(b){m.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,memberId:k,timeStamp:a})});m.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"ApplyDirectStyling",memberid:k,timestamp:a,position:d,length:c,setProperties:h}}};ops.OpApplyHyperlink=function(){function f(a){for(;a;){if(p.isHyperlink(a))return!0;a=a.parentNode}return!1}var k,a,d,c,h,q=core.DomUtils,p=odf.OdfUtils;this.init=function(f){k=f.memberid;a=f.timestamp;d=f.position;c=f.length;h=f.hyperlink};this.isEdit=!0;this.group=void 0;this.execute=function(m){var l=m.getDOMDocument(),r=m.convertCursorToDomRange(d,c),b=q.splitBoundaries(r),e=[],n=p.getTextNodes(r,!1);if(0===n.length)return!1;n.forEach(function(b){var a=p.getParagraphElement(b);runtime.assert(!1=== +f(b),"The given range should not contain any link.");var c=h,d=l.createElementNS(odf.Namespaces.textns,"text:a");d.setAttributeNS(odf.Namespaces.xlinkns,"xlink:type","simple");d.setAttributeNS(odf.Namespaces.xlinkns,"xlink:href",c);b.parentNode.insertBefore(d,b);d.appendChild(b);-1===e.indexOf(a)&&e.push(a)});b.forEach(q.normalizeTextNodes);r.detach();m.fixCursorPositions();m.getOdfCanvas().refreshSize();m.getOdfCanvas().rerenderAnnotations();e.forEach(function(b){m.emit(ops.OdtDocument.signalParagraphChanged, +{paragraphElement:b,memberId:k,timeStamp:a})});return!0};this.spec=function(){return{optype:"ApplyHyperlink",memberid:k,timestamp:a,position:d,length:c,hyperlink:h}}};ops.OpInsertImage=function(){var f,k,a,d,c,h,q,p,m=odf.Namespaces.drawns,l=odf.Namespaces.svgns,r=odf.Namespaces.textns,b=odf.Namespaces.xlinkns,e=odf.OdfUtils;this.init=function(b){f=b.memberid;k=b.timestamp;a=b.position;d=b.filename;c=b.frameWidth;h=b.frameHeight;q=b.frameStyleName;p=b.frameName};this.isEdit=!0;this.group=void 0;this.execute=function(n){var g=n.getOdfCanvas(),u=n.getTextNodeAtStep(a,f),t,y;if(!u)return!1;t=u.textNode;y=e.getParagraphElement(t);var u=u.offset!==t.length?t.splitText(u.offset): +t.nextSibling,v=n.getDOMDocument(),s=v.createElementNS(m,"draw:image"),v=v.createElementNS(m,"draw:frame");s.setAttributeNS(b,"xlink:href",d);s.setAttributeNS(b,"xlink:type","simple");s.setAttributeNS(b,"xlink:show","embed");s.setAttributeNS(b,"xlink:actuate","onLoad");v.setAttributeNS(m,"draw:style-name",q);v.setAttributeNS(m,"draw:name",p);v.setAttributeNS(r,"text:anchor-type","as-char");v.setAttributeNS(l,"svg:width",c);v.setAttributeNS(l,"svg:height",h);v.appendChild(s);t.parentNode.insertBefore(v, +u);n.emit(ops.OdtDocument.signalStepsInserted,{position:a});0===t.length&&t.parentNode.removeChild(t);g.addCssForFrameWithImage(v);g.refreshCSS();n.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:y,memberId:f,timeStamp:k});g.rerenderAnnotations();return!0};this.spec=function(){return{optype:"InsertImage",memberid:f,timestamp:k,filename:d,position:a,frameWidth:c,frameHeight:h,frameStyleName:q,frameName:p}}};ops.OpInsertTable=function(){function f(b,a){var f;if(1===l.length)f=l[0];else if(3===l.length)switch(b){case 0:f=l[0];break;case d-1:f=l[2];break;default:f=l[1]}else f=l[b];if(1===f.length)return f[0];if(3===f.length)switch(a){case 0:return f[0];case c-1:return f[2];default:return f[1]}return f[a]}var k,a,d,c,h,q,p,m,l,r=odf.OdfUtils;this.init=function(b){k=b.memberid;a=b.timestamp;h=b.position;d=b.initialRows;c=b.initialColumns;q=b.tableName;p=b.tableStyleName;m=b.tableColumnStyleName;l=b.tableCellStyleMatrix}; +this.isEdit=!0;this.group=void 0;this.execute=function(b){var e=b.getTextNodeAtStep(h),n=b.getRootNode();if(e){var g=b.getDOMDocument(),l=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),t=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column"),y,v,s,x;p&&l.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",p);q&&l.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",q);t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0", +"table:number-columns-repeated",c);m&&t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",m);l.appendChild(t);for(s=0;s<d;s+=1){t=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-row");for(x=0;x<c;x+=1)y=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-cell"),(v=f(s,x))&&y.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",v),v=g.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", +"text:p"),y.appendChild(v),t.appendChild(y);l.appendChild(t)}e=r.getParagraphElement(e.textNode);n.insertBefore(l,e.nextSibling);b.emit(ops.OdtDocument.signalStepsInserted,{position:h});b.getOdfCanvas().refreshSize();b.emit(ops.OdtDocument.signalTableAdded,{tableElement:l,memberId:k,timeStamp:a});b.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertTable",memberid:k,timestamp:a,position:h,initialRows:d,initialColumns:c,tableName:q,tableStyleName:p,tableColumnStyleName:m, +tableCellStyleMatrix:l}}};ops.OpInsertText=function(){var f,k,a,d,c,h=odf.OdfUtils;this.init=function(h){f=h.memberid;k=h.timestamp;a=h.position;c=h.text;d="true"===h.moveCursor||!0===h.moveCursor};this.isEdit=!0;this.group=void 0;this.execute=function(q){var p,m,l,r=null,b=q.getDOMDocument(),e,n=0,g,u=q.getCursor(f),t;q.upgradeWhitespacesAtPosition(a);if(p=q.getTextNodeAtStep(a)){m=p.textNode;r=m.nextSibling;l=m.parentNode;e=h.getParagraphElement(m);for(t=0;t<c.length;t+=1)if("\t"===c[t]||"\t"!==c[t]&&h.isODFWhitespace(c[t])&& +(0===t||t===c.length-1||"\t"!==c[t-1]&&h.isODFWhitespace(c[t-1])))0===n?(p.offset!==m.length&&(r=m.splitText(p.offset)),0<t&&m.appendData(c.substring(0,t))):n<t&&(n=c.substring(n,t),l.insertBefore(b.createTextNode(n),r)),n=t+1,"\t"===c[t]?(g=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:tab"),g.appendChild(b.createTextNode("\t"))):(" "!==c[t]&&runtime.log("WARN: InsertText operation contains non-tab, non-space whitespace character (character code "+c.charCodeAt(t)+")"), +g=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s"),g.appendChild(b.createTextNode(" "))),l.insertBefore(g,r);0===n?m.insertData(p.offset,c):n<c.length&&(p=c.substring(n),l.insertBefore(b.createTextNode(p),r));l=m.parentNode;r=m.nextSibling;l.removeChild(m);l.insertBefore(m,r);0===m.length&&m.parentNode.removeChild(m);q.emit(ops.OdtDocument.signalStepsInserted,{position:a});u&&d&&(q.moveCursor(f,a+c.length,0),q.emit(ops.Document.signalCursorMoved,u));q.downgradeWhitespacesAtPosition(a); +q.downgradeWhitespacesAtPosition(a+c.length);q.getOdfCanvas().refreshSize();q.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:e,memberId:f,timeStamp:k});q.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertText",memberid:f,timestamp:k,position:a,text:c,moveCursor:d}}};odf.CollapsingRules=function(f){function k(a){return d.isODFNode(a)||"br"===a.localName&&d.isLineBreak(a.parentNode)||a.nodeType===Node.TEXT_NODE&&d.isODFNode(a.parentNode)}function a(h){var q;h.nodeType===Node.TEXT_NODE?(q=h.parentNode,q.removeChild(h)):q=c.removeUnwantedNodes(h,k);return q&&!d.isParagraph(q)&&q!==f&&d.hasNoODFContent(q)?a(q):q}var d=odf.OdfUtils,c=core.DomUtils;this.mergeChildrenIntoParent=a};ops.OpMergeParagraph=function(){function f(b){return r.isGroupingElement(b)&&r.hasNoODFContent(b)}function k(b){if(b.nodeType===Node.TEXT_NODE){if(0===b.length)return runtime.log("WARN: Empty text node found during merge operation"),!0;if(r.isODFWhitespace(b.data)&&!1===r.isSignificantWhitespace(b,0))return!0;b="#text"}else b=(b.prefix?b.prefix+":":"")+b.localName;runtime.log("WARN: Unexpected text element found near paragraph boundary ["+b+"]");return!1}function a(a){a.collapsed||(b.splitBoundaries(a), +a=r.getTextElements(a,!1,!0).filter(k),a.forEach(function(b){b.parentNode.removeChild(b)}))}function d(b,a,c){b=b.convertCursorStepToDomPoint(a);var e=r.getParagraphElement(b.node,b.offset);runtime.assert(Boolean(e),"Paragraph not found at step "+a);c&&c.setPosition(b.node,b.offset);return e}var c,h,q,p,m,l,r=odf.OdfUtils,b=core.DomUtils,e=odf.Namespaces.textns;this.init=function(b){c=b.memberid;h=b.timestamp;q=b.moveCursor;p=b.paragraphStyleName;m=parseInt(b.sourceStartPosition,10);l=parseInt(b.destinationStartPosition, +10)};this.isEdit=!0;this.group=void 0;this.execute=function(n){var g,k,r=n.getCursor(c);g=n.getRootNode();var y=new odf.CollapsingRules(g),v=n.createStepIterator(g,0,[n.getPositionFilter()],g),s;runtime.assert(l<m,"Destination paragraph ("+l+") must be before source paragraph ("+m+")");k=d(n,l);g=d(n,m,v);v.previousStep();runtime.assert(b.containsNode(k,v.container()),"Destination paragraph must be adjacent to the source paragraph");s=k.ownerDocument.createRange();v.setPosition(k,k.childNodes.length); +v.roundToPreviousStep();s.setStart(v.container(),v.offset());s.setEnd(k,k.childNodes.length);a(s);s=k.childNodes.length;var x=g.ownerDocument.createRange();v.setPosition(g,0);v.roundToNextStep();x.setStart(g,0);x.setEnd(v.container(),v.offset());a(x);for(x=g.firstChild;x;)"editinfo"===x.localName?g.removeChild(x):(k.appendChild(x),b.removeUnwantedNodes(x,f)),x=g.firstChild;runtime.assert(0===g.childNodes.length,"Source paragraph should be empty before it is removed");y.mergeChildrenIntoParent(g); +n.emit(ops.OdtDocument.signalStepsRemoved,{position:m-1});v.setPosition(k,s);v.roundToClosestStep();v.previousStep()||v.roundToNextStep();n.downgradeWhitespaces(v);p?k.setAttributeNS(e,"text:style-name",p):k.removeAttributeNS(e,"style-name");r&&q&&(n.moveCursor(c,m-1,0),n.emit(ops.Document.signalCursorMoved,r));n.fixCursorPositions();n.getOdfCanvas().refreshSize();n.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:k,memberId:c,timeStamp:h});n.getOdfCanvas().rerenderAnnotations();return!0}; +this.spec=function(){return{optype:"MergeParagraph",memberid:c,timestamp:h,moveCursor:q,paragraphStyleName:p,sourceStartPosition:m,destinationStartPosition:l}}};ops.OpMoveCursor=function(){var f,k,a,d,c;this.init=function(h){f=h.memberid;k=h.timestamp;a=h.position;d=h.length||0;c=h.selectionType||ops.OdtCursor.RangeSelection};this.isEdit=!1;this.group=void 0;this.execute=function(h){var k=h.getCursor(f),p;if(!k)return!1;p=h.convertCursorToDomRange(a,d);k.setSelectedRange(p,0<=d);k.setSelectionType(c);h.emit(ops.Document.signalCursorMoved,k);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:f,timestamp:k,position:a,length:d,selectionType:c}}};ops.OpRemoveAnnotation=function(){var f,k,a,d,c=core.DomUtils;this.init=function(c){f=c.memberid;k=c.timestamp;a=parseInt(c.position,10);d=parseInt(c.length,10)};this.isEdit=!0;this.group=void 0;this.execute=function(d){function f(a){m.parentNode.insertBefore(a,m)}for(var k=d.getIteratorAtPosition(a).container(),m;k.namespaceURI!==odf.Namespaces.officens||"annotation"!==k.localName;)k=k.parentNode;if(null===k)return!1;m=k;k=m.annotationEndElement;d.getOdfCanvas().forgetAnnotations();c.getElementsByTagNameNS(m, +"urn:webodf:names:cursor","cursor").forEach(f);c.getElementsByTagNameNS(m,"urn:webodf:names:cursor","anchor").forEach(f);m.parentNode.removeChild(m);k&&k.parentNode.removeChild(k);d.emit(ops.OdtDocument.signalStepsRemoved,{position:0<a?a-1:a});d.fixCursorPositions();d.getOdfCanvas().refreshAnnotations();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:f,timestamp:k,position:a,length:d}}};ops.OpRemoveBlob=function(){var f,k,a;this.init=function(d){f=d.memberid;k=d.timestamp;a=d.filename};this.isEdit=!0;this.group=void 0;this.execute=function(d){d.getOdfCanvas().odfContainer().removeBlob(a);return!0};this.spec=function(){return{optype:"RemoveBlob",memberid:f,timestamp:k,filename:a}}};ops.OpRemoveCursor=function(){var f,k;this.init=function(a){f=a.memberid;k=a.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(a){return a.removeCursor(f)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:f,timestamp:k}}};ops.OpRemoveHyperlink=function(){var f,k,a,d,c=core.DomUtils,h=odf.OdfUtils;this.init=function(c){f=c.memberid;k=c.timestamp;a=c.position;d=c.length};this.isEdit=!0;this.group=void 0;this.execute=function(q){var p=q.convertCursorToDomRange(a,d),m=h.getHyperlinkElements(p);runtime.assert(1===m.length,"The given range should only contain a single link.");m=c.mergeIntoParent(m[0]);p.detach();q.fixCursorPositions();q.getOdfCanvas().refreshSize();q.getOdfCanvas().rerenderAnnotations();q.emit(ops.OdtDocument.signalParagraphChanged, +{paragraphElement:h.getParagraphElement(m),memberId:f,timeStamp:k});return!0};this.spec=function(){return{optype:"RemoveHyperlink",memberid:f,timestamp:k,position:a,length:d}}};ops.OpRemoveMember=function(){var f,k;this.init=function(a){f=a.memberid;k=parseInt(a.timestamp,10)};this.isEdit=!1;this.group=void 0;this.execute=function(a){if(!a.getMember(f))return!1;a.removeMember(f);a.emit(ops.Document.signalMemberRemoved,f);return!0};this.spec=function(){return{optype:"RemoveMember",memberid:f,timestamp:k}}};ops.OpRemoveStyle=function(){var f,k,a,d;this.init=function(c){f=c.memberid;k=c.timestamp;a=c.styleName;d=c.styleFamily};this.isEdit=!0;this.group=void 0;this.execute=function(c){var f=c.getFormatting().getStyleElement(a,d);if(!f)return!1;f.parentNode.removeChild(f);c.getOdfCanvas().refreshCSS();c.emit(ops.OdtDocument.signalCommonStyleDeleted,{name:a,family:d});return!0};this.spec=function(){return{optype:"RemoveStyle",memberid:f,timestamp:k,styleName:a,styleFamily:d}}};ops.OpRemoveText=function(){var f,k,a,d,c=odf.OdfUtils,h=core.DomUtils;this.init=function(c){runtime.assert(0<=c.length,"OpRemoveText only supports positive lengths");f=c.memberid;k=c.timestamp;a=parseInt(c.position,10);d=parseInt(c.length,10)};this.isEdit=!0;this.group=void 0;this.execute=function(q){var p,m,l,r=q.getCursor(f),b=new odf.CollapsingRules(q.getRootNode());q.upgradeWhitespacesAtPosition(a);q.upgradeWhitespacesAtPosition(a+d);p=q.convertCursorToDomRange(a,d);h.splitBoundaries(p);m=c.getTextElements(p, +!1,!0);l=c.getParagraphElement(p.startContainer,p.startOffset);runtime.assert(void 0!==l,"Attempting to remove text outside a paragraph element");p.detach();m.forEach(function(a){a.parentNode?(runtime.assert(h.containsNode(l,a),"RemoveText only supports removing elements within the same paragraph"),b.mergeChildrenIntoParent(a)):runtime.log("WARN: text element has already been removed from it's container")});q.emit(ops.OdtDocument.signalStepsRemoved,{position:a});q.downgradeWhitespacesAtPosition(a); +q.fixCursorPositions();q.getOdfCanvas().refreshSize();q.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:l,memberId:f,timeStamp:k});r&&(r.resetSelectionType(),q.emit(ops.Document.signalCursorMoved,r));q.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"RemoveText",memberid:f,timestamp:k,position:a,length:d}}};ops.OpSetBlob=function(){var f,k,a,d,c;this.init=function(h){f=h.memberid;k=h.timestamp;a=h.filename;d=h.mimetype;c=h.content};this.isEdit=!0;this.group=void 0;this.execute=function(f){f.getOdfCanvas().odfContainer().setBlob(a,d,c);return!0};this.spec=function(){return{optype:"SetBlob",memberid:f,timestamp:k,filename:a,mimetype:d,content:c}}};ops.OpSetParagraphStyle=function(){function f(a,c,d){var f=[a.getPositionFilter()],h=d.container();d=d.unfilteredDomOffset();return!1===a.createStepIterator(h,d,f,c).previousStep()}var k,a,d,c,h=odf.OdfUtils;this.init=function(f){k=f.memberid;a=f.timestamp;d=f.position;c=f.styleName};this.isEdit=!0;this.group=void 0;this.execute=function(q){var p,m;p=q.getIteratorAtPosition(d);return(m=h.getParagraphElement(p.container()))?(runtime.assert(f(q,m,p),"SetParagraphStyle position should be the first position in the paragraph"), +c?m.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",c):m.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),q.getOdfCanvas().refreshSize(),q.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:m,timeStamp:a,memberId:k}),q.getOdfCanvas().rerenderAnnotations(),!0):!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:k,timestamp:a,position:d,styleName:c}}};ops.OpSplitParagraph=function(){var f,k,a,d,c,h,q=odf.OdfUtils,p=odf.Namespaces.textns;this.init=function(m){f=m.memberid;k=m.timestamp;d=m.position;a=m.sourceParagraphPosition;h=m.paragraphStyleName;c="true"===m.moveCursor||!0===m.moveCursor};this.isEdit=!0;this.group=void 0;this.execute=function(a){var l,r,b,e,n,g,u,t=a.getCursor(f);a.upgradeWhitespacesAtPosition(d);l=a.getTextNodeAtStep(d);if(!l)return!1;r=q.getParagraphElement(l.textNode);if(!r)return!1;b=q.isListItem(r.parentNode)?r.parentNode: +r;0===l.offset?(u=l.textNode.previousSibling,g=null):(u=l.textNode,g=l.offset>=l.textNode.length?null:l.textNode.splitText(l.offset));for(e=l.textNode;e!==b;){e=e.parentNode;n=e.cloneNode(!1);g&&n.appendChild(g);if(u)for(;u&&u.nextSibling;)n.appendChild(u.nextSibling);else for(;e.firstChild;)n.appendChild(e.firstChild);e.parentNode.insertBefore(n,e.nextSibling);u=e;g=n}q.isListItem(g)&&(g=g.childNodes.item(0));h?g.setAttributeNS(p,"text:style-name",h):g.removeAttributeNS(p,"style-name");0===l.textNode.length&& +l.textNode.parentNode.removeChild(l.textNode);a.emit(ops.OdtDocument.signalStepsInserted,{position:d});t&&c&&(a.moveCursor(f,d+1,0),a.emit(ops.Document.signalCursorMoved,t));a.fixCursorPositions();a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:f,timeStamp:k});a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});a.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph", +memberid:f,timestamp:k,position:d,sourceParagraphPosition:a,paragraphStyleName:h,moveCursor:c}}};ops.OpUpdateMember=function(){function f(a){var c="//dc:creator[@editinfo:memberid='"+k+"']";a=xmldom.XPath.getODFElementsWithXPath(a.getRootNode(),c,function(a){return"editinfo"===a?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(a)});for(c=0;c<a.length;c+=1)a[c].textContent=d.fullName}var k,a,d,c;this.init=function(f){k=f.memberid;a=parseInt(f.timestamp,10);d=f.setProperties;c=f.removedProperties};this.isEdit=!1;this.group=void 0;this.execute=function(a){var q=a.getMember(k);if(!q)return!1; +c&&q.removeProperties(c);d&&(q.setProperties(d),d.fullName&&f(a));a.emit(ops.Document.signalMemberUpdated,q);return!0};this.spec=function(){return{optype:"UpdateMember",memberid:k,timestamp:a,setProperties:d,removedProperties:c}}};ops.OpUpdateMetadata=function(){var f,k,a,d;this.init=function(c){f=c.memberid;k=parseInt(c.timestamp,10);a=c.setProperties;d=c.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(c){c=c.getOdfCanvas().odfContainer();var f=null;d&&(f=d.attributes.split(","));c.setMetadata(a,f);return!0};this.spec=function(){return{optype:"UpdateMetadata",memberid:f,timestamp:k,setProperties:a,removedProperties:d}}};ops.OpUpdateParagraphStyle=function(){function f(a,c){var d,f,b=c?c.split(","):[];for(d=0;d<b.length;d+=1)f=b[d].split(":"),a.removeAttributeNS(odf.Namespaces.lookupNamespaceURI(f[0]),f[1])}var k,a,d,c,h,q=odf.Namespaces.stylens;this.init=function(f){k=f.memberid;a=f.timestamp;d=f.styleName;c=f.setProperties;h=f.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(a){var k=a.getFormatting(),l,r,b;return(l=""!==d?k.getStyleElement(d,"paragraph"):k.getDefaultStyleElement("paragraph"))? +(r=l.getElementsByTagNameNS(q,"paragraph-properties").item(0),b=l.getElementsByTagNameNS(q,"text-properties").item(0),c&&k.updateStyle(l,c),h&&(k=h["style:paragraph-properties"],r&&k&&(f(r,k.attributes),0===r.attributes.length&&l.removeChild(r)),k=h["style:text-properties"],b&&k&&(f(b,k.attributes),0===b.attributes.length&&l.removeChild(b)),f(l,h.attributes)),a.getOdfCanvas().refreshCSS(),a.emit(ops.OdtDocument.signalParagraphStyleModified,d),a.getOdfCanvas().rerenderAnnotations(),!0):!1};this.spec= +function(){return{optype:"UpdateParagraphStyle",memberid:k,timestamp:a,styleName:d,setProperties:c,removedProperties:h}}};ops.OperationFactory=function(){function f(a){return function(d){return new a}}var k;this.register=function(a,d){k[a]=d};this.create=function(a){var d=null,c=k[a.optype];c&&(d=c(a),d.init(a));return d};k={AddMember:f(ops.OpAddMember),UpdateMember:f(ops.OpUpdateMember),RemoveMember:f(ops.OpRemoveMember),AddCursor:f(ops.OpAddCursor),ApplyDirectStyling:f(ops.OpApplyDirectStyling),SetBlob:f(ops.OpSetBlob),RemoveBlob:f(ops.OpRemoveBlob),InsertImage:f(ops.OpInsertImage),InsertTable:f(ops.OpInsertTable), +InsertText:f(ops.OpInsertText),RemoveText:f(ops.OpRemoveText),MergeParagraph:f(ops.OpMergeParagraph),SplitParagraph:f(ops.OpSplitParagraph),SetParagraphStyle:f(ops.OpSetParagraphStyle),UpdateParagraphStyle:f(ops.OpUpdateParagraphStyle),AddStyle:f(ops.OpAddStyle),RemoveStyle:f(ops.OpRemoveStyle),MoveCursor:f(ops.OpMoveCursor),RemoveCursor:f(ops.OpRemoveCursor),AddAnnotation:f(ops.OpAddAnnotation),RemoveAnnotation:f(ops.OpRemoveAnnotation),UpdateMetadata:f(ops.OpUpdateMetadata),ApplyHyperlink:f(ops.OpApplyHyperlink), +RemoveHyperlink:f(ops.OpRemoveHyperlink)}};ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(f){};ops.OperationRouter.prototype.setPlaybackFunction=function(f){};ops.OperationRouter.prototype.push=function(f){};ops.OperationRouter.prototype.close=function(f){};ops.OperationRouter.prototype.subscribe=function(f,k){};ops.OperationRouter.prototype.unsubscribe=function(f,k){};ops.OperationRouter.prototype.hasLocalUnsyncedOps=function(){};ops.OperationRouter.prototype.hasSessionHostConnection=function(){}; +ops.OperationRouter.signalProcessingBatchStart="router/batchstart";ops.OperationRouter.signalProcessingBatchEnd="router/batchend";ops.TrivialOperationRouter=function(){var f=new core.EventNotifier([ops.OperationRouter.signalProcessingBatchStart,ops.OperationRouter.signalProcessingBatchEnd]),k,a,d=0;this.setOperationFactory=function(a){k=a};this.setPlaybackFunction=function(c){a=c};this.push=function(c){d+=1;f.emit(ops.OperationRouter.signalProcessingBatchStart,{});c.forEach(function(c){c=c.spec();c.timestamp=Date.now();c=k.create(c);c.group="g"+d;a(c)});f.emit(ops.OperationRouter.signalProcessingBatchEnd,{})};this.close=function(a){a()}; +this.subscribe=function(a,d){f.subscribe(a,d)};this.unsubscribe=function(a,d){f.unsubscribe(a,d)};this.hasLocalUnsyncedOps=function(){return!1};this.hasSessionHostConnection=function(){return!0}};ops.Session=function(f){function k(a){c.emit(ops.OdtDocument.signalProcessingBatchStart,a)}function a(a){c.emit(ops.OdtDocument.signalProcessingBatchEnd,a)}var d=new ops.OperationFactory,c=new ops.OdtDocument(f),h=null;this.setOperationFactory=function(a){d=a;h&&h.setOperationFactory(d)};this.setOperationRouter=function(f){h&&(h.unsubscribe(ops.OperationRouter.signalProcessingBatchStart,k),h.unsubscribe(ops.OperationRouter.signalProcessingBatchEnd,a));h=f;h.subscribe(ops.OperationRouter.signalProcessingBatchStart, +k);h.subscribe(ops.OperationRouter.signalProcessingBatchEnd,a);f.setPlaybackFunction(function(a){c.emit(ops.OdtDocument.signalOperationStart,a);return a.execute(c)?(c.emit(ops.OdtDocument.signalOperationEnd,a),!0):!1});f.setOperationFactory(d)};this.getOperationFactory=function(){return d};this.getOdtDocument=function(){return c};this.enqueue=function(a){h.push(a)};this.close=function(a){h.close(function(d){d?a(d):c.close(a)})};this.destroy=function(a){c.destroy(a)};this.setOperationRouter(new ops.TrivialOperationRouter)};gui.AnnotationController=function(f,k,a){function d(){var b=p.getCursor(a),b=b&&b.getNode(),c=!1;b&&(c=!r.isWithinAnnotation(b,p.getRootNode()));c!==m&&(m=c,l.emit(gui.AnnotationController.annotatableChanged,m))}function c(b){b.getMemberId()===a&&d()}function h(b){b===a&&d()}function q(b){b.getMemberId()===a&&d()}var p=f.getOdtDocument(),m=!1,l=new core.EventNotifier([gui.AnnotationController.annotatableChanged]),r=odf.OdfUtils,b=core.StepDirection.NEXT;this.isAnnotatable=function(){return m};this.addAnnotation= +function(){var b=new ops.OpAddAnnotation,c=p.getCursorSelection(a),d=c.length,c=c.position;m&&(c=0<=d?c:c+d,d=Math.abs(d),b.init({memberid:a,position:c,length:d,name:a+Date.now()}),f.enqueue([b]))};this.removeAnnotation=function(c){var d,g;d=p.getMember(a).getProperties().fullName;if(!0!==k.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)||d===r.getAnnotationCreator(c))d=p.convertDomPointToCursorStep(c,0,b),g=p.convertDomPointToCursorStep(c,c.childNodes.length),c=new ops.OpRemoveAnnotation, +c.init({memberid:a,position:d,length:g-d}),g=new ops.OpMoveCursor,g.init({memberid:a,position:0<d?d-1:d,length:0}),f.enqueue([c,g])};this.subscribe=function(b,a){l.subscribe(b,a)};this.unsubscribe=function(b,a){l.unsubscribe(b,a)};this.destroy=function(b){p.unsubscribe(ops.Document.signalCursorAdded,c);p.unsubscribe(ops.Document.signalCursorRemoved,h);p.unsubscribe(ops.Document.signalCursorMoved,q);b()};k.registerConstraint(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN);p.subscribe(ops.Document.signalCursorAdded, +c);p.subscribe(ops.Document.signalCursorRemoved,h);p.subscribe(ops.Document.signalCursorMoved,q);d()};gui.AnnotationController.annotatableChanged="annotatable/changed";gui.Avatar=function(f,k){var a=this,d,c,h;this.setColor=function(a){c.style.borderColor=a};this.setImageUrl=function(d){a.isVisible()?c.src=d:h=d};this.isVisible=function(){return"block"===d.style.display};this.show=function(){h&&(c.src=h,h=void 0);d.style.display="block"};this.hide=function(){d.style.display="none"};this.markAsFocussed=function(a){a?d.classList.add("active"):d.classList.remove("active")};this.destroy=function(a){f.removeChild(d);a()};(function(){var a=f.ownerDocument;d=a.createElement("div"); +c=a.createElement("img");d.appendChild(c);d.style.display=k?"block":"none";d.className="handle";f.appendChild(d)})()};gui.StepInfo=function(){};gui.StepInfo.VisualDirection={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1};gui.StepInfo.prototype.container=function(){};gui.StepInfo.prototype.offset=function(){};gui.VisualStepScanner=function(){};gui.VisualStepScanner.prototype.process=function(f,k,a){};gui.GuiStepUtils=function(){function f(c){c=a.getContentBounds(c);var f,h=null;if(c)if(c.container.nodeType===Node.TEXT_NODE)f=c.container.ownerDocument.createRange(),f.setStart(c.container,c.startOffset),f.setEnd(c.container,c.endOffset),(h=0<f.getClientRects().length?f.getBoundingClientRect():null)&&" "===c.container.data.substring(c.startOffset,c.endOffset)&&1>=h.width&&(h=null),f.detach();else if(k.isCharacterElement(c.container)||k.isCharacterFrame(c.container))h=d.getBoundingClientRect(c.container); +return h}var k=odf.OdfUtils,a=new odf.StepUtils,d=core.DomUtils,c=core.StepDirection.NEXT,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,q=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=f;this.moveToFilteredStep=function(a,d,k){function r(b,a){a.process(v,g,u)&&(b=!0,!t&&a.token&&(t=a.token));return b}var b=d===c,e,n,g,u,t,y=a.snapshot();e=!1;var v;do e=f(a),v={token:a.snapshot(),container:a.container,offset:a.offset,direction:d,visualDirection:d===c?h:q},n=a.nextStep()?f(a):null,a.restore(v.token), +b?(g=e,u=n):(g=n,u=e),e=k.reduce(r,!1);while(!e&&a.advanceStep(d));e||k.forEach(function(b){!t&&b.token&&(t=b.token)});a.restore(t||y);return Boolean(t)}};gui.Caret=function(f,k,a,d){function c(){r.style.opacity="0"===r.style.opacity?"1":"0";x.trigger()}function h(){g.selectNodeContents(n);return g.getBoundingClientRect()}function q(){Object.keys(C).forEach(function(b){F[b]=C[b]})}function p(){if(!1===C.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!d&&!f.getSelectedRange().collapsed)C.visibility="hidden",r.style.visibility="hidden",x.cancel();else if(C.visibility="visible",r.style.visibility="visible",!1===C.isFocused)r.style.opacity= +"1",x.cancel();else{if(w||F.visibility!==C.visibility)r.style.opacity="1",x.cancel();x.trigger()}if(I||B){var a;a=f.getNode();var c,g,n=t.getBoundingClientRect(u.getSizer()),m=!1,p=0;a.removeAttributeNS("urn:webodf:names:cursor","caret-sizer-active");if(0<a.getClientRects().length)g=h(),p=g.left-t.getBoundingClientRect(a).left,m=!0;else if(v.setPosition(a,0),g=y.getContentRect(v),!g&&v.nextStep()&&(c=y.getContentRect(v))&&(g=c,m=!0),g||(a.setAttributeNS("urn:webodf:names:cursor","caret-sizer-active", +"true"),g=h(),m=!0),!g)for(runtime.log("WARN: No suitable client rectangle found for visual caret for "+f.getMemberId());a;){if(0<a.getClientRects().length){g=t.getBoundingClientRect(a);m=!0;break}a=a.parentNode}g=t.translateRect(g,n,u.getZoomLevel());a={top:g.top,height:g.height,right:m?g.left:g.right,width:t.adaptRangeDifferenceToZoomLevel(p,u.getZoomLevel())};8>a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});l.style.height=a.height+"px";l.style.top=a.top+"px";l.style.left=a.right- +a.width+"px";l.style.width=a.width?a.width+"px":"";e&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?e.style.font=a.font:(e.style.fontStyle=a.fontStyle,e.style.fontVariant=a.fontVariant,e.style.fontWeight=a.fontWeight,e.style.fontSize=a.fontSize,e.style.lineHeight=a.lineHeight,e.style.fontFamily=a.fontFamily))}C.isShown&&B&&k.scrollIntoView(r.getBoundingClientRect());F.isFocused!==C.isFocused&&b.markAsFocussed(C.isFocused);q();I=B=w=!1}function m(b){l.parentNode.removeChild(l);n.parentNode.removeChild(n); +b()}var l,r,b,e,n,g,u=f.getDocument().getCanvas(),t=core.DomUtils,y=new gui.GuiStepUtils,v,s,x,w=!1,B=!1,I=!1,C={isFocused:!1,isShown:!0,visibility:"hidden"},F={isFocused:!C.isFocused,isShown:!C.isShown,visibility:"hidden"};this.handleUpdate=function(){I=!0;s.trigger()};this.refreshCursorBlinking=function(){w=!0;s.trigger()};this.setFocus=function(){C.isFocused=!0;s.trigger()};this.removeFocus=function(){C.isFocused=!1;s.trigger()};this.show=function(){C.isShown=!0;s.trigger()};this.hide=function(){C.isShown= +!1;s.trigger()};this.setAvatarImageUrl=function(a){b.setImageUrl(a)};this.setColor=function(a){r.style.borderColor=a;b.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return r};this.toggleHandleVisibility=function(){b.isVisible()?b.hide():b.show()};this.showHandle=function(){b.show()};this.hideHandle=function(){b.hide()};this.setOverlayElement=function(b){e=b;l.appendChild(b);I=!0;s.trigger()};this.ensureVisible=function(){B=!0;s.trigger()};this.getBoundingClientRect= +function(){return t.getBoundingClientRect(l)};this.destroy=function(a){core.Async.destroyAll([s.destroy,x.destroy,b.destroy,m],a)};(function(){var e=f.getDocument(),d=[e.createRootFilter(f.getMemberId()),e.getPositionFilter()],h=e.getDOMDocument();g=h.createRange();n=h.createElement("span");n.className="webodf-caretSizer";n.textContent="|";f.getNode().appendChild(n);l=h.createElement("div");l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());l.className="webodf-caretOverlay"; +r=h.createElement("div");r.className="caret";l.appendChild(r);b=new gui.Avatar(l,a);u.getSizer().appendChild(l);v=e.createStepIterator(f.getNode(),0,d,e.getRootNode());s=core.Task.createRedrawTask(p);x=core.Task.createTimeoutTask(c,500);s.triggerImmediate()})()};odf.TextSerializer=function(){function f(d){var c="",h=k.filter?k.filter.acceptNode(d):NodeFilter.FILTER_ACCEPT,q=d.nodeType,p;if((h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)&&a.isTextContentContainingNode(d))for(p=d.firstChild;p;)c+=f(p),p=p.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(q===Node.ELEMENT_NODE&&a.isParagraph(d)?c+="\n":q===Node.TEXT_NODE&&d.textContent&&(c+=d.textContent));return c}var k=this,a=odf.OdfUtils;this.filter=null;this.writeToString=function(a){if(!a)return""; +a=f(a);"\n"===a[a.length-1]&&(a=a.substr(0,a.length-1));return a}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,a){var d;d=a.startContainer.ownerDocument.createElement("span");d.appendChild(a.cloneContents());d=f.writeToString(d);try{k.setData("text/plain",d)}catch(c){k.setData("Text",d)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,a){var d,c=k.clipboardData;d=runtime.getWindow();!c&&d&&(c=d.clipboardData);c?(d=!0,f.exportRangeToDataTransfer(c,a),k.preventDefault()):d=!1;return d}};gui.SessionContext=function(f,k){var a=f.getOdtDocument(),d=odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var c=a.getCursor(k),f;if(!c)return!1;f=c&&c.getNode();c=a.getMember(k).getProperties().fullName;return(f=d.getParentAnnotation(f,a.getRootNode()))&&d.getAnnotationCreator(f)===c?!0:!1}};gui.StyleSummary=function(f){function k(a,d){var k=a+"|"+d,m;c.hasOwnProperty(k)||(m=[],f.forEach(function(c){c=(c=c.styleProperties[a])&&c[d];-1===m.indexOf(c)&&m.push(c)}),c[k]=m);return c[k]}function a(a,c,d){return function(){var f=k(a,c);return d.length>=f.length&&f.every(function(a){return-1!==d.indexOf(a)})}}function d(a,c){var d=k(a,c);return 1===d.length?d[0]:void 0}var c={};this.getPropertyValues=k;this.getCommonValue=d;this.isBold=a("style:text-properties","fo:font-weight",["bold"]);this.isItalic= +a("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=a("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=a("style:text-properties","style:text-line-through-style",["solid"]);this.fontSize=function(){var a=d("style:text-properties","fo:font-size");return a&&parseFloat(a)};this.fontName=function(){return d("style:text-properties","style:font-name")};this.isAlignedLeft=a("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter= +a("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=a("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=a("style:paragraph-properties","fo:text-align",["justify"]);this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName};this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight, +isAlignedJustified:this.isAlignedJustified}};gui.DirectFormattingController=function(f,k,a,d,c,h,q){function p(){return V.value().styleSummary}function m(){return V.value().enabledFeatures}function l(b){var a;b.collapsed?(a=b.startContainer,a.hasChildNodes()&&b.startOffset<a.childNodes.length&&(a=a.childNodes.item(b.startOffset)),b=[a]):b=aa.getTextElements(b,!0,!1);return b}function r(){var b=G.getCursor(d),c=b&&b.getSelectedRange(),e=[],e=[],g=!0,f={directTextStyling:!0,directParagraphStyling:!0};c&&(e=l(c),0===e.length&&(e=[c.startContainer, +c.endContainer],g=!1),e=G.getFormatting().getAppliedStyles(e));void 0!==e[0]&&$&&(e[0].styleProperties=U.mergeObjects(e[0].styleProperties,$));!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(f.directTextStyling=f.directParagraphStyling=a.isLocalCursorWithinOwnAnnotation());f.directTextStyling&&(f.directTextStyling=g&&void 0!==b&&b.getSelectionType()===ops.OdtCursor.RangeSelection);return{enabledFeatures:f,appliedStyles:e,styleSummary:new gui.StyleSummary(e)}}function b(b,a){var c={};Object.keys(b).forEach(function(e){var d= +b[e](),g=a[e]();d!==g&&(c[e]=g)});return c}function e(){var a,c;c=A.styleSummary;var e=V.value(),d=e.styleSummary,g=A.enabledFeatures,f=e.enabledFeatures;a=b(c.text,d.text);c=b(c.paragraph,d.paragraph);g=!(f.directTextStyling===g.directTextStyling&&f.directParagraphStyling===g.directParagraphStyling);A=e;g&&P.emit(gui.DirectFormattingController.enabledChanged,f);0<Object.keys(a).length&&P.emit(gui.DirectFormattingController.textStylingChanged,a);0<Object.keys(c).length&&P.emit(gui.DirectFormattingController.paragraphStylingChanged, +c)}function n(){V.reset();e()}function g(b){("string"===typeof b?b:b.getMemberId())===d&&V.reset()}function u(){V.reset()}function t(b){var a=G.getCursor(d);b=b.paragraphElement;a&&aa.getParagraphElement(a.getNode())===b&&V.reset()}function y(b,a){a(!b());return!0}function v(b){if(m().directTextStyling){var a=G.getCursorSelection(d),c={"style:text-properties":b};0!==a.length?(b=new ops.OpApplyDirectStyling,b.init({memberid:d,position:a.position,length:a.length,setProperties:c}),f.enqueue([b])):($= +U.mergeObjects($||{},c),V.reset())}}function s(b,a){var c={};c[b]=a;v(c)}function x(b){b=b.spec();$&&b.memberid===d&&"SplitParagraph"!==b.optype&&($=null,V.reset())}function w(b){s("fo:font-weight",b?"bold":"normal")}function B(b){s("fo:font-style",b?"italic":"normal")}function I(b){s("style:text-underline-style",b?"solid":"none")}function C(b){s("style:text-line-through-style",b?"solid":"none")}function F(b){if(m().directParagraphStyling){var a=G.getCursor(d).getSelectedRange(),a=aa.getParagraphElements(a), +e=G.getFormatting(),g=[],h={},n;a.forEach(function(a){var f=G.convertDomPointToCursorStep(a,0,Q),k=a.getAttributeNS(odf.Namespaces.textns,"style-name"),l;a=k?h.hasOwnProperty(k)?h[k]:void 0:n;a||(a=c.generateStyleName(),k?(h[k]=a,l=e.createDerivedStyleObject(k,"paragraph",{})):(n=a,l={}),l=b(l),k=new ops.OpAddStyle,k.init({memberid:d,styleName:a.toString(),styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:l}),g.push(k));k=new ops.OpSetParagraphStyle;k.init({memberid:d,styleName:a.toString(), +position:f});g.push(k)});f.enqueue(g)}}function J(b){F(function(a){return U.mergeObjects(a,b)})}function N(b){J({"style:paragraph-properties":{"fo:text-align":b}})}function K(b,a){var c=G.getFormatting().getDefaultTabStopDistance(),e=a["style:paragraph-properties"],d;e&&(e=e["fo:margin-left"],d=aa.parseLength(e));return U.mergeObjects(a,{"style:paragraph-properties":{"fo:margin-left":d&&d.unit===c.unit?d.value+b*c.value+d.unit:b*c.value+c.unit}})}function H(b,a){var c=l(b),c=0===c.length?[b.startContainer]: +c,c=G.getFormatting().getAppliedStyles(c),e=0<c.length?c[0].styleProperties:void 0,d=G.getFormatting().getAppliedStylesForElement(a).styleProperties;if(!e||"text"!==e["style:family"]||!e["style:text-properties"])return!1;if(!d||!d["style:text-properties"])return!0;e=e["style:text-properties"];d=d["style:text-properties"];return!Object.keys(e).every(function(b){return e[b]===d[b]})}function z(){}function Z(){return!1}var T=this,G=f.getOdtDocument(),U=new core.Utils,aa=odf.OdfUtils,P=new core.EventNotifier([gui.DirectFormattingController.enabledChanged, +gui.DirectFormattingController.textStylingChanged,gui.DirectFormattingController.paragraphStylingChanged]),D=odf.Namespaces.textns,Q=core.StepDirection.NEXT,$=null,A,V;this.enabledFeatures=m;this.formatTextSelection=v;this.createCursorStyleOp=function(b,a,c){var e=null,g=$;c&&(g=(c=V.value().appliedStyles[0])&&c.styleProperties);g&&g["style:text-properties"]&&(e=new ops.OpApplyDirectStyling,e.init({memberid:d,position:b,length:a,setProperties:{"style:text-properties":g["style:text-properties"]}}), +$=null,V.reset());return e};this.setBold=w;this.setItalic=B;this.setHasUnderline=I;this.setHasStrikethrough=C;this.setFontSize=function(b){s("fo:font-size",b+"pt")};this.setFontName=function(b){s("style:font-name",b)};this.getAppliedStyles=function(){return V.value().appliedStyles};this.toggleBold=y.bind(T,function(){return p().isBold()},w);this.toggleItalic=y.bind(T,function(){return p().isItalic()},B);this.toggleUnderline=y.bind(T,function(){return p().hasUnderline()},I);this.toggleStrikethrough= +y.bind(T,function(){return p().hasStrikeThrough()},C);this.isBold=function(){return p().isBold()};this.isItalic=function(){return p().isItalic()};this.hasUnderline=function(){return p().hasUnderline()};this.hasStrikeThrough=function(){return p().hasStrikeThrough()};this.fontSize=function(){return p().fontSize()};this.fontName=function(){return p().fontName()};this.isAlignedLeft=function(){return p().isAlignedLeft()};this.isAlignedCenter=function(){return p().isAlignedCenter()};this.isAlignedRight= +function(){return p().isAlignedRight()};this.isAlignedJustified=function(){return p().isAlignedJustified()};this.alignParagraphLeft=function(){N("left");return!0};this.alignParagraphCenter=function(){N("center");return!0};this.alignParagraphRight=function(){N("right");return!0};this.alignParagraphJustified=function(){N("justify");return!0};this.indent=function(){F(K.bind(null,1));return!0};this.outdent=function(){F(K.bind(null,-1));return!0};this.createParagraphStyleOps=function(b){if(!m().directParagraphStyling)return[]; +var a=G.getCursor(d),e=a.getSelectedRange(),g=[],f,h;a.hasForwardSelection()?(f=a.getAnchorNode(),h=a.getNode()):(f=a.getNode(),h=a.getAnchorNode());a=aa.getParagraphElement(h);runtime.assert(Boolean(a),"DirectFormattingController: Cursor outside paragraph");var k=a,n=[G.getPositionFilter(),G.createRootFilter(d)];if(!1!==G.createStepIterator(e.endContainer,e.endOffset,n,k).nextStep())return g;h!==f&&(a=aa.getParagraphElement(f));if(!$&&!H(e,a))return g;e=(e=V.value().appliedStyles[0])&&e.styleProperties; +if(!e)return g;if(a=a.getAttributeNS(D,"style-name"))e={"style:text-properties":e["style:text-properties"]},e=G.getFormatting().createDerivedStyleObject(a,"paragraph",e);f=c.generateStyleName();a=new ops.OpAddStyle;a.init({memberid:d,styleName:f,styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:e});g.push(a);a=new ops.OpSetParagraphStyle;a.init({memberid:d,styleName:f,position:b});g.push(a);return g};this.subscribe=function(b,a){P.subscribe(b,a)};this.unsubscribe=function(b,a){P.unsubscribe(b, +a)};this.destroy=function(b){G.unsubscribe(ops.Document.signalCursorAdded,g);G.unsubscribe(ops.Document.signalCursorRemoved,g);G.unsubscribe(ops.Document.signalCursorMoved,g);G.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,u);G.unsubscribe(ops.OdtDocument.signalParagraphChanged,t);G.unsubscribe(ops.OdtDocument.signalOperationEnd,x);G.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,e);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,n);b()};(function(){G.subscribe(ops.Document.signalCursorAdded, +g);G.subscribe(ops.Document.signalCursorRemoved,g);G.subscribe(ops.Document.signalCursorMoved,g);G.subscribe(ops.OdtDocument.signalParagraphStyleModified,u);G.subscribe(ops.OdtDocument.signalParagraphChanged,t);G.subscribe(ops.OdtDocument.signalOperationEnd,x);G.subscribe(ops.OdtDocument.signalProcessingBatchEnd,e);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,n);V=new core.LazyProperty(r);A=V.value();h||(T.formatTextSelection=z,T.setBold=z,T.setItalic=z,T.setHasUnderline=z,T.setHasStrikethrough= +z,T.setFontSize=z,T.setFontName=z,T.toggleBold=Z,T.toggleItalic=Z,T.toggleUnderline=Z,T.toggleStrikethrough=Z);q||(T.alignParagraphCenter=z,T.alignParagraphJustified=z,T.alignParagraphLeft=z,T.alignParagraphRight=z,T.createParagraphStyleOps=function(){return[]},T.indent=z,T.outdent=z)})()};gui.DirectFormattingController.enabledChanged="enabled/changed";gui.DirectFormattingController.textStylingChanged="textStyling/changed";gui.DirectFormattingController.paragraphStylingChanged="paragraphStyling/changed"; +gui.DirectFormattingController.SelectionInfo=function(){};gui.KeyboardHandler=function(){function f(a,d){d||(d=k.None);switch(a){case gui.KeyboardHandler.KeyCode.LeftMeta:case gui.KeyboardHandler.KeyCode.RightMeta:case gui.KeyboardHandler.KeyCode.MetaInMozilla:d|=k.Meta;break;case gui.KeyboardHandler.KeyCode.Ctrl:d|=k.Ctrl;break;case gui.KeyboardHandler.KeyCode.Alt:d|=k.Alt;break;case gui.KeyboardHandler.KeyCode.Shift:d|=k.Shift}return a+":"+d}var k=gui.KeyboardHandler.Modifier,a=null,d={};this.setDefault=function(c){a=c};this.bind=function(a,h,k,p){a=f(a, +h);runtime.assert(p||!1===d.hasOwnProperty(a),"tried to overwrite the callback handler of key combo: "+a);d[a]=k};this.unbind=function(a,h){var k=f(a,h);delete d[k]};this.reset=function(){a=null;d={}};this.handleEvent=function(c){var h=c.keyCode,q=k.None;c.metaKey&&(q|=k.Meta);c.ctrlKey&&(q|=k.Ctrl);c.altKey&&(q|=k.Alt);c.shiftKey&&(q|=k.Shift);h=f(h,q);h=d[h];q=!1;h?q=h():null!==a&&(q=a(c));q&&(c.preventDefault?c.preventDefault():c.returnValue=!1)}}; +gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,CtrlAlt:6,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Ctrl:17,Alt:18,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LeftMeta:91,RightMeta:93,MetaInMozilla:224};gui.HyperlinkClickHandler=function(f,k,a){function d(){var b=f();runtime.assert(Boolean(b.classList),"Document container has no classList element");b.classList.remove("webodf-inactiveLinks")}function c(){var b=f();runtime.assert(Boolean(b.classList),"Document container has no classList element");b.classList.add("webodf-inactiveLinks")}function h(){b.removeEventListener("focus",c,!1);n.forEach(function(b){k.unbind(b.keyCode,b.modifier);a.unbind(b.keyCode,b.modifier)});n.length=0}function q(e){h(); +if(e!==p.None){b.addEventListener("focus",c,!1);switch(e){case p.Ctrl:n.push({keyCode:m.Ctrl,modifier:p.None});break;case p.Meta:n.push({keyCode:m.LeftMeta,modifier:p.None}),n.push({keyCode:m.RightMeta,modifier:p.None}),n.push({keyCode:m.MetaInMozilla,modifier:p.None})}n.forEach(function(b){k.bind(b.keyCode,b.modifier,d);a.bind(b.keyCode,b.modifier,c)})}}var p=gui.KeyboardHandler.Modifier,m=gui.KeyboardHandler.KeyCode,l=xmldom.XPath,r=odf.OdfUtils,b=runtime.getWindow(),e=p.None,n=[];runtime.assert(null!== +b,"Expected to be run in an environment which has a global window, like a browser.");this.handleClick=function(a){var c=a.target||a.srcElement,d,h;a.ctrlKey?d=p.Ctrl:a.metaKey&&(d=p.Meta);if(e===p.None||e===d){a:{for(;null!==c;){if(r.isHyperlink(c))break a;if(r.isParagraph(c))break;c=c.parentNode}c=null}c&&(c=r.getHyperlinkTarget(c),""!==c&&("#"===c[0]?(c=c.substring(1),d=f(),h=l.getODFElementsWithXPath(d,"//text:bookmark-start[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI),0===h.length&& +(h=l.getODFElementsWithXPath(d,"//text:bookmark[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI)),0<h.length&&h[0].scrollIntoView(!0)):b.open(c),a.preventDefault?a.preventDefault():a.returnValue=!1))}};this.setModifier=function(b){e!==b&&(runtime.assert(b===p.None||b===p.Ctrl||b===p.Meta,"Unsupported KeyboardHandler.Modifier value: "+b),e=b,e!==p.None?c():d(),q(e))};this.getModifier=function(){return e};this.destroy=function(b){c();h();b()}};gui.EventManager=function(f){function k(b){function a(b,c,e){var d,f=!1;d="on"+c;b.attachEvent&&(b.attachEvent(d,e),f=!0);!f&&b.addEventListener&&(b.addEventListener(c,e,!1),f=!0);f&&!x[c]||!b.hasOwnProperty(d)||(b[d]=e)}function c(b,a,e){var d="on"+a;b.detachEvent&&b.detachEvent(d,e);b.removeEventListener&&b.removeEventListener(a,e,!1);b[d]===e&&(b[d]=null)}function e(a){if(-1===f.indexOf(a)){f.push(a);if(d.filters.every(function(b){return b(a)}))try{g.emit(b,a)}catch(c){runtime.log("Error occurred while processing "+ +b+":\n"+c.message+"\n"+c.stack)}runtime.setTimeout(function(){f.splice(f.indexOf(a),1)},0)}}var d=this,f=[],g=new core.EventNotifier([b]);this.filters=[];this.subscribe=function(a){g.subscribe(b,a)};this.unsubscribe=function(a){g.unsubscribe(b,a)};this.destroy=function(){c(s,b,e);c(C,b,e);c(F,b,e)};w[b]&&a(s,b,e);a(C,b,e);a(F,b,e)}function a(b,a,c){function e(a){c(a,d,function(a){a.type=b;f.emit(b,a)})}var d={},f=new core.EventNotifier([b]);this.subscribe=function(a){f.subscribe(b,a)};this.unsubscribe= +function(a){f.unsubscribe(b,a)};this.destroy=function(){a.forEach(function(b){J.unsubscribe(b,e)})};(function(){a.forEach(function(b){J.subscribe(b,e)})})()}function d(b){runtime.clearTimeout(b);delete N[b]}function c(b,a){var c=runtime.setTimeout(function(){b();d(c)},a);N[c]=!0;return c}function h(b,a,e){var f=b.touches.length,g=b.touches[0],h=a.timer;"touchmove"===b.type||"touchend"===b.type?h&&d(h):"touchstart"===b.type&&(1!==f?runtime.clearTimeout(h):h=c(function(){e({clientX:g.clientX,clientY:g.clientY, +pageX:g.pageX,pageY:g.pageY,target:b.target||b.srcElement||null,detail:1})},400));a.timer=h}function q(b,a,c){var e=b.touches[0],d=b.target||b.srcElement||null,f=a.target;1!==b.touches.length||"touchend"===b.type?f=null:"touchstart"===b.type&&"webodf-draggable"===d.getAttribute("class")?f=d:"touchmove"===b.type&&f&&(b.preventDefault(),b.stopPropagation(),c({clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,target:f,detail:1}));a.target=f}function p(b,a,c){var e=b.target||b.srcElement|| +null,d=a.dragging;"drag"===b.type?d=!0:"touchend"===b.type&&d&&(d=!1,b=b.changedTouches[0],c({clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY,target:e,detail:1}));a.dragging=d}function m(){F.classList.add("webodf-touchEnabled");J.unsubscribe("touchstart",m)}function l(b){var a=b.scrollX,c=b.scrollY;this.restore=function(){b.scrollX===a&&b.scrollY===c||b.scrollTo(a,c)}}function r(b){var a=b.scrollTop,c=b.scrollLeft;this.restore=function(){if(b.scrollTop!==a||b.scrollLeft!==c)b.scrollTop= +a,b.scrollLeft=c}}function b(b,a){var c=I[b]||B[b]||null;!c&&a&&(c=I[b]=new k(b));return c}function e(a,c){b(a,!0).subscribe(c)}function n(a,c){var e=b(a,!1);e&&e.unsubscribe(c)}function g(){return f.getDOMDocument().activeElement===C}function u(){g()&&C.blur();C.setAttribute("disabled","true")}function t(){C.removeAttribute("disabled")}function y(b){for(var a=[];b;)(b.scrollWidth>b.clientWidth||b.scrollHeight>b.clientHeight)&&a.push(new r(b)),b=b.parentNode;a.push(new l(s));return a}function v(){var b; +g()||(b=y(C),t(),C.focus(),b.forEach(function(b){b.restore()}))}var s=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},B={},I={},C,F=f.getCanvas().getElement(),J=this,N={};this.addFilter=function(a,c){b(a,!0).filters.push(c)};this.removeFilter=function(a,c){var e=b(a,!0),d=e.filters.indexOf(c);-1!==d&&e.filters.splice(d,1)};this.subscribe=e;this.unsubscribe=n;this.hasFocus=g;this.focus=v;this.getEventTrap=function(){return C}; +this.setEditing=function(b){var a=g();a&&C.blur();b?C.removeAttribute("readOnly"):C.setAttribute("readOnly","true");a&&v()};this.destroy=function(b){n("touchstart",m);Object.keys(N).forEach(function(b){d(parseInt(b,10))});N.length=0;Object.keys(B).forEach(function(b){B[b].destroy()});B={};n("mousedown",u);n("mouseup",t);n("contextmenu",t);Object.keys(I).forEach(function(b){I[b].destroy()});I={};C.parentNode.removeChild(C);b()};(function(){var b=f.getOdfCanvas().getSizer(),c=b.ownerDocument;runtime.assert(Boolean(s), +"EventManager requires a window object to operate correctly");C=c.createElement("textarea");C.id="eventTrap";C.setAttribute("tabindex","-1");C.setAttribute("readOnly","true");C.setAttribute("rows","1");b.appendChild(C);e("mousedown",u);e("mouseup",t);e("contextmenu",t);B.longpress=new a("longpress",["touchstart","touchmove","touchend"],h);B.drag=new a("drag",["touchstart","touchmove","touchend"],q);B.dragstop=new a("dragstop",["drag","touchend"],p);e("touchstart",m)})()};gui.IOSSafariSupport=function(f){function k(){a.innerHeight!==a.outerHeight&&(d.style.display="none",runtime.requestAnimationFrame(function(){d.style.display="block"}))}var a=runtime.getWindow(),d=f.getEventTrap();this.destroy=function(a){f.unsubscribe("focus",k);d.removeAttribute("autocapitalize");d.style.WebkitTransform="";a()};f.subscribe("focus",k);d.setAttribute("autocapitalize","off");d.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,a,d){function c(){var c=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(c=a.isLocalCursorWithinOwnAnnotation());c!==l&&(l=c,m.emit(gui.HyperlinkController.enabledChanged,l))}function h(a){a.getMemberId()===d&&c()}var q=odf.OdfUtils,p=f.getOdtDocument(),m=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),l=!1;this.isEnabled=function(){return l};this.subscribe=function(a,b){m.subscribe(a,b)};this.unsubscribe=function(a,b){m.unsubscribe(a, +b)};this.addHyperlink=function(a,b){if(l){var c=p.getCursorSelection(d),h=new ops.OpApplyHyperlink,g=[];if(0===c.length||b)b=b||a,h=new ops.OpInsertText,h.init({memberid:d,position:c.position,text:b}),c.length=b.length,g.push(h);h=new ops.OpApplyHyperlink;h.init({memberid:d,position:c.position,length:c.length,hyperlink:a});g.push(h);f.enqueue(g)}};this.removeHyperlinks=function(){if(l){var a=p.createPositionIterator(p.getRootNode()),b=p.getCursor(d).getSelectedRange(),c=q.getHyperlinkElements(b), +h=b.collapsed&&1===c.length,g=p.getDOMDocument().createRange(),k=[],m,y;0!==c.length&&(c.forEach(function(b){g.selectNodeContents(b);m=p.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});y=new ops.OpRemoveHyperlink;y.init({memberid:d,position:m.position,length:m.length});k.push(y)}),h||(h=c[0],-1===b.comparePoint(h,0)&&(g.setStart(h,0),g.setEnd(b.startContainer,b.startOffset),m=p.convertDomToCursorRange({anchorNode:g.startContainer, +anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0<m.length&&(y=new ops.OpApplyHyperlink,y.init({memberid:d,position:m.position,length:m.length,hyperlink:q.getHyperlinkTarget(h)}),k.push(y))),c=c[c.length-1],a.moveToEndOfNode(c),a=a.unfilteredDomOffset(),1===b.comparePoint(c,a)&&(g.setStart(b.endContainer,b.endOffset),g.setEnd(c,a),m=p.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0<m.length&& +(y=new ops.OpApplyHyperlink,y.init({memberid:d,position:m.position,length:m.length,hyperlink:q.getHyperlinkTarget(c)}),k.push(y)))),f.enqueue(k),g.detach())}};this.destroy=function(a){p.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,c);a()};p.subscribe(ops.Document.signalCursorMoved,h);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,c);c()};gui.HyperlinkController.enabledChanged="enabled/changed";gui.ImageController=function(f,k,a,d,c){function h(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=a.isLocalCursorWithinOwnAnnotation());b!==n&&(n=b,e.emit(gui.ImageController.enabledChanged,n))}function q(b){b.getMemberId()===d&&h()}var p={"image/gif":".gif","image/jpeg":".jpg","image/png":".png"},m=odf.Namespaces.textns,l=f.getOdtDocument(),r=odf.OdfUtils,b=l.getFormatting(),e=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),n=!1;this.isEnabled=function(){return n}; +this.subscribe=function(b,a){e.subscribe(b,a)};this.unsubscribe=function(b,a){e.unsubscribe(b,a)};this.insertImage=function(a,e,h,k){if(n){runtime.assert(0<h&&0<k,"Both width and height of the image should be greater than 0px.");k={width:h,height:k};if(h=r.getParagraphElement(l.getCursor(d).getNode()).getAttributeNS(m,"style-name")){h=b.getContentSize(h,"paragraph");var q=1,s=1;k.width>h.width&&(q=h.width/k.width);k.height>h.height&&(s=h.height/k.height);h=Math.min(q,s);k={width:k.width*h,height:k.height* +h}}h=k.width+"px";k=k.height+"px";var x=l.getOdfCanvas().odfContainer().rootElement.styles,q=a.toLowerCase(),s=p.hasOwnProperty(q)?p[q]:null,w,q=[];runtime.assert(null!==s,"Image type is not supported: "+a);s="Pictures/"+c.generateImageName()+s;w=new ops.OpSetBlob;w.init({memberid:d,filename:s,mimetype:a,content:e});q.push(w);b.getStyleElement("Graphics","graphic",[x])||(a=new ops.OpAddStyle,a.init({memberid:d,styleName:"Graphics",styleFamily:"graphic",isAutomaticStyle:!1,setProperties:{"style:graphic-properties":{"text:anchor-type":"paragraph", +"svg:x":"0cm","svg:y":"0cm","style:wrap":"dynamic","style:number-wrapped-paragraphs":"no-limit","style:wrap-contour":"false","style:vertical-pos":"top","style:vertical-rel":"paragraph","style:horizontal-pos":"center","style:horizontal-rel":"paragraph"}}}),q.push(a));a=c.generateStyleName();e=new ops.OpAddStyle;e.init({memberid:d,styleName:a,styleFamily:"graphic",isAutomaticStyle:!0,setProperties:{"style:parent-style-name":"Graphics","style:graphic-properties":{"style:vertical-pos":"top","style:vertical-rel":"baseline", +"style:horizontal-pos":"center","style:horizontal-rel":"paragraph","fo:background-color":"transparent","style:background-transparency":"100%","style:shadow":"none","style:mirror":"none","fo:clip":"rect(0cm, 0cm, 0cm, 0cm)","draw:luminance":"0%","draw:contrast":"0%","draw:red":"0%","draw:green":"0%","draw:blue":"0%","draw:gamma":"100%","draw:color-inversion":"false","draw:image-opacity":"100%","draw:color-mode":"standard"}}});q.push(e);w=new ops.OpInsertImage;w.init({memberid:d,position:l.getCursorPosition(d), +filename:s,frameWidth:h,frameHeight:k,frameStyleName:a,frameName:c.generateFrameName()});q.push(w);f.enqueue(q)}};this.destroy=function(b){l.unsubscribe(ops.Document.signalCursorMoved,q);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);b()};l.subscribe(ops.Document.signalCursorMoved,q);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var a=f.getSizer(),h=c.createElement("div");h.id="imageSelector";h.style.borderWidth="1px";a.appendChild(h);d.forEach(function(a){var d=c.createElement("div");d.className=a;h.appendChild(d)});return h}var a=odf.Namespaces.svgns,d="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),c=f.getElement().ownerDocument,h=!1;this.select=function(d){var p,m,l=c.getElementById("imageSelector");l||(l=k());h=!0;p=l.parentNode; +m=d.getBoundingClientRect();var r=p.getBoundingClientRect(),b=f.getZoomLevel();p=(m.left-r.left)/b-1;m=(m.top-r.top)/b-1;l.style.display="block";l.style.left=p+"px";l.style.top=m+"px";l.style.width=d.getAttributeNS(a,"width");l.style.height=d.getAttributeNS(a,"height")};this.clearSelection=function(){var a;h&&(a=c.getElementById("imageSelector"))&&(a.style.display="none");h=!1};this.isSelectorElement=function(a){var d=c.getElementById("imageSelector");return d?a===d||a.parentNode===d:!1}};(function(){function f(f){function a(a){q=a.which&&String.fromCharCode(a.which)===h;h=void 0;return!1===q}function d(){q=!1}function c(a){h=a.data;q=!1}var h,q=!1;this.destroy=function(h){f.unsubscribe("textInput",d);f.unsubscribe("compositionend",c);f.removeFilter("keypress",a);h()};f.subscribe("textInput",d);f.subscribe("compositionend",c);f.addFilter("keypress",a)}gui.InputMethodEditor=function(k,a){function d(a){e&&(a?e.getNode().setAttributeNS(b,"composing","true"):(e.getNode().removeAttributeNS(b, +"composing"),u.textContent=""))}function c(){y&&(y=!1,d(!1),s.emit(gui.InputMethodEditor.signalCompositionEnd,{data:v}),v="")}function h(){C||(C=!0,c(),e&&e.getSelectedRange().collapsed?n.value="":n.value=w.writeToString(e.getSelectedRange().cloneContents()),n.setSelectionRange(0,n.value.length),C=!1)}function q(){a.hasFocus()&&t.trigger()}function p(){x=void 0;t.cancel();d(!0);y||s.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function m(b){b=x=b.data;y=!0;v+=b;t.trigger()}function l(b){b.data!== +x&&(b=b.data,y=!0,v+=b,t.trigger());x=void 0}function r(){u.textContent=n.value}var b="urn:webodf:names:cursor",e=null,n=a.getEventTrap(),g=n.ownerDocument,u,t,y=!1,v="",s=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),x,w,B=[],I,C=!1;this.subscribe=s.subscribe;this.unsubscribe=s.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(e=b,e.getNode().appendChild(u),b.subscribe(ops.OdtCursor.signalCursorUpdated,q),a.subscribe("input", +r),a.subscribe("compositionupdate",r))};this.removeCursor=function(b){e&&b===k&&(e.getNode().removeChild(u),e.unsubscribe(ops.OdtCursor.signalCursorUpdated,q),a.unsubscribe("input",r),a.unsubscribe("compositionupdate",r),e=null)};this.destroy=function(b){a.unsubscribe("compositionstart",p);a.unsubscribe("compositionend",m);a.unsubscribe("textInput",l);a.unsubscribe("keypress",c);a.unsubscribe("focus",h);core.Async.destroyAll(I,b)};(function(){w=new odf.TextSerializer;w.filter=new odf.OdfNodeFilter; +a.subscribe("compositionstart",p);a.subscribe("compositionend",m);a.subscribe("textInput",l);a.subscribe("keypress",c);a.subscribe("focus",h);B.push(new f(a));I=B.map(function(b){return b.destroy});u=g.createElement("span");u.setAttribute("id","composer");t=core.Task.createTimeoutTask(h,1);I.push(t.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function a(a){h.emit(gui.MetadataController.signalMetadataChanged,a)}function d(a){var c=-1===q.indexOf(a);c||runtime.log("Setting "+a+" is restricted.");return c}var c=f.getOdtDocument(),h=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),q=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(a,c){var h={},q="",b;a&&Object.keys(a).filter(d).forEach(function(b){h[b]=a[b]}); +c&&(q=c.filter(d).join(","));if(0<q.length||0<Object.keys(h).length)b=new ops.OpUpdateMetadata,b.init({memberid:k,setProperties:h,removedProperties:0<q.length?{attributes:q}:null}),f.enqueue([b])};this.getMetadata=function(a){var d;runtime.assert("string"===typeof a,"Property must be a string");d=a.split(":");runtime.assert(2===d.length,"Property must be a namespace-prefixed string");a=odf.Namespaces.lookupNamespaceURI(d[0]);runtime.assert(Boolean(a),"Prefix must be for an ODF namespace.");return c.getOdfCanvas().odfContainer().getMetadata(a, +d[1])};this.subscribe=function(a,c){h.subscribe(a,c)};this.unsubscribe=function(a,c){h.unsubscribe(a,c)};this.destroy=function(d){c.unsubscribe(ops.OdtDocument.signalMetadataUpdated,a);d()};c.subscribe(ops.OdtDocument.signalMetadataUpdated,a)};gui.MetadataController.signalMetadataChanged="metadata/changed";gui.PasteController=function(f,k,a,d){function c(){p=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?a.isLocalCursorWithinOwnAnnotation():!0}function h(b){b.getMemberId()===d&&c()}var q=f.getOdtDocument(),p=!1,m=odf.Namespaces.textns,l=core.StepDirection.NEXT,r=odf.OdfUtils;this.isEnabled=function(){return p};this.paste=function(b){if(p){var a=q.getCursorPosition(d),c=q.getCursor(d).getNode(),c=r.getParagraphElement(c),g=c.getAttributeNS(m,"style-name")||"",h=a,k=[],y=q.convertDomPointToCursorStep(c, +0,l);b.replace(/\r/g,"").split("\n").forEach(function(b){var a=new ops.OpInsertText,c=new ops.OpSplitParagraph;a.init({memberid:d,position:h,text:b,moveCursor:!0});k.push(a);h+=b.length;c.init({memberid:d,position:h,paragraphStyleName:g,sourceParagraphPosition:y,moveCursor:!0});k.push(c);y=h+=1});k.pop();f.enqueue(k)}};this.destroy=function(b){q.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,c);b()};q.subscribe(ops.Document.signalCursorMoved,h); +k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,c);c()};gui.ClosestXOffsetScanner=function(f){function k(a){return null!==a&&void 0!==c?Math.abs(a-f)>c:!1}function a(a){null!==a&&!1===k(a)&&(c=Math.abs(a-f))}var d=this,c,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(c,f,m){var l,r;c.visualDirection===h?(l=f&&f.right,r=m&&m.left):(l=f&&f.left,r=m&&m.right);if(k(l)||k(r))return!0;if(f||m)a(l),a(r),d.token=c.token;return!1}};gui.LineBoundaryScanner=function(){var f=this,k=null;this.token=void 0;this.process=function(a,d,c){var h;if(h=c)if(k){var q=k;h=Math.min(q.bottom-q.top,c.bottom-c.top);var p=Math.max(q.top,c.top),q=Math.min(q.bottom,c.bottom)-p;h=0.4>=(0<h?q/h:0)}else h=!1;!d||c&&!h||(f.token=a.token);if(h)return!0;k=(a=k)&&d?{left:Math.min(a.left,d.left),right:Math.max(a.right,d.right),top:Math.min(a.top,d.top),bottom:Math.min(a.bottom,d.bottom)}:a||d;return!1}};gui.ParagraphBoundaryScanner=function(){var f=this,k=!1,a,d=odf.OdfUtils;this.token=void 0;this.process=function(c){var h=d.getParagraphElement(c.container());k||(a=h,k=!0);if(a!==h)return!0;f.token=c.token;return!1}};odf.WordBoundaryFilter=function(f,k){function a(b,a,c){for(var e=null,d=f.getRootNode(),h;b!==d&&null!==b&&null===e;)h=0>a?b.previousSibling:b.nextSibling,c(h)===NodeFilter.FILTER_ACCEPT&&(e=h),b=b.parentNode;return e}function d(b,a){var e;return null===b?n.NO_NEIGHBOUR:q.isCharacterElement(b)?n.SPACE_CHAR:b.nodeType===c||q.isTextSpan(b)||q.isHyperlink(b)?(e=b.textContent.charAt(a()),m.test(e)?n.SPACE_CHAR:p.test(e)?n.PUNCTUATION_CHAR:n.WORD_CHAR):n.OTHER}var c=Node.TEXT_NODE,h=Node.ELEMENT_NODE, +q=odf.OdfUtils,p=/[!-#%-*,-\/:-;?-@\[-\]_{}\u00a1\u00ab\u00b7\u00bb\u00bf;\u00b7\u055a-\u055f\u0589-\u058a\u05be\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964-\u0965\u0970\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u104a-\u104f\u10fb\u1361-\u1368\u166d-\u166e\u169b-\u169c\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944-\u1945\u19de-\u19df\u1a1e-\u1a1f\u1b5a-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u206e\u207d-\u207e\u208d-\u208e\u3008-\u3009\u2768-\u2775\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2cf9-\u2cfc\u2cfe-\u2cff\u2e00-\u2e7e\u3000-\u303f\u30a0\u30fb\ua60d-\ua60f\ua673\ua67e\ua874-\ua877\ua8ce-\ua8cf\ua92e-\ua92f\ua95f\uaa5c-\uaa5f\ufd3e-\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]|\ud800[\udd00-\udd01\udf9f\udfd0]|\ud802[\udd1f\udd3f\ude50-\ude58]|\ud809[\udc00-\udc7e]/, +m=/\s/,l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT,b=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,e=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,n={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(c){var f=c.container(),m=c.leftNode(),q=c.rightNode(),p=c.unfilteredDomOffset,s=function(){return c.unfilteredDomOffset()-1};f.nodeType===h&&(null===q&&(q=a(f,1,c.getNodeFilter())),null===m&&(m= +a(f,-1,c.getNodeFilter())));f!==q&&(p=function(){return 0});f!==m&&null!==m&&(s=function(){return m.textContent.length-1});f=d(m,s);q=d(q,p);return f===n.WORD_CHAR&&q===n.WORD_CHAR||f===n.PUNCTUATION_CHAR&&q===n.PUNCTUATION_CHAR||k===b&&f!==n.NO_NEIGHBOUR&&q===n.SPACE_CHAR||k===e&&f===n.SPACE_CHAR&&q!==n.NO_NEIGHBOUR?r:l}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function a(b){var a=b.spec();if(b.isEdit||a.memberid===k)I=void 0,C.cancel()}function d(){var b=t.getCursor(k).getNode();return t.createStepIterator(b,0,[s,w],t.getRootElement(b))}function c(b,a,c){c=new odf.WordBoundaryFilter(t,c);var e=t.getRootElement(b)||t.getRootNode(),d=t.createRootFilter(e);return t.createStepIterator(b,a,[s,d,c],e)}function h(b,a){return a?{anchorNode:b.startContainer,anchorOffset:b.startOffset,focusNode:b.endContainer,focusOffset:b.endOffset}: +{anchorNode:b.endContainer,anchorOffset:b.endOffset,focusNode:b.startContainer,focusOffset:b.startOffset}}function q(b,a,c){var e=new ops.OpMoveCursor;e.init({memberid:k,position:b,length:a||0,selectionType:c});return e}function p(b,a,c){var e;e=t.getCursor(k);e=h(e.getSelectedRange(),e.hasForwardSelection());e.focusNode=b;e.focusOffset=a;c||(e.anchorNode=e.focusNode,e.anchorOffset=e.focusOffset);b=t.convertDomToCursorRange(e);f.enqueue([q(b.position,b.length)])}function m(b){var a;a=c(b.startContainer, +b.startOffset,F);a.roundToPreviousStep()&&b.setStart(a.container(),a.offset());a=c(b.endContainer,b.endOffset,J);a.roundToNextStep()&&b.setEnd(a.container(),a.offset())}function l(b){var a=v.getParagraphElements(b),c=a[0],a=a[a.length-1];c&&b.setStart(c,0);a&&(v.isParagraph(b.endContainer)&&0===b.endOffset?b.setEndBefore(a):b.setEnd(a,a.childNodes.length))}function r(b,a,c,e){var d,f;e?(d=c.startContainer,f=c.startOffset):(d=c.endContainer,f=c.endOffset);y.containsNode(b,d)||(f=0>y.comparePoints(b, +0,d,f)?0:b.childNodes.length,d=b);b=t.createStepIterator(d,f,a,v.getParagraphElement(d)||b);b.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");e?c.setStart(b.container(),b.offset()):c.setEnd(b.container(),b.offset())}function b(b,a){var c=d();c.advanceStep(b)&&p(c.container(),c.offset(),a)}function e(b,a){var c,e=I,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===e&&B&&(e=B());isNaN(e)||(c=d(),x.moveToFilteredStep(c,b,f)&&c.advanceStep(b)&&(f=[new gui.ClosestXOffsetScanner(e), +new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,b,f)&&(p(c.container(),c.offset(),a),I=e,C.restart())))}function n(b,a){var c=d(),e=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,b,e)&&p(c.container(),c.offset(),a)}function g(b,a){var e=t.getCursor(k),e=h(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,F);e.advanceStep(b)&&p(e.container(),e.offset(),a)}function u(b,a,c){var e=!1,d=t.getCursor(k), +d=h(d.getSelectedRange(),d.hasForwardSelection()),e=t.getRootElement(d.focusNode);runtime.assert(Boolean(e),"SelectionController: Cursor outside root");d=t.createStepIterator(d.focusNode,d.focusOffset,[s,w],e);d.roundToClosestStep();d.advanceStep(b)&&(c=c(d.container()))&&(b===N?(d.setPosition(c,0),e=d.roundToNextStep()):(d.setPosition(c,c.childNodes.length),e=d.roundToPreviousStep()),e&&p(d.container(),d.offset(),a))}var t=f.getOdtDocument(),y=core.DomUtils,v=odf.OdfUtils,s=t.getPositionFilter(), +x=new gui.GuiStepUtils,w=t.createRootFilter(k),B=null,I,C,F=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,J=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,N=core.StepDirection.PREVIOUS,K=core.StepDirection.NEXT;this.selectionToRange=function(b){var a=0<=y.comparePoints(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),c=b.focusNode.ownerDocument.createRange();a?(c.setStart(b.anchorNode,b.anchorOffset),c.setEnd(b.focusNode,b.focusOffset)):(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode, +b.anchorOffset));return{range:c,hasForwardSelection:a}};this.rangeToSelection=h;this.selectImage=function(b){var a=t.getRootElement(b),c=t.createRootFilter(a),a=t.createStepIterator(b,0,[c,t.getPositionFilter()],a),e;a.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");c=a.container();e=a.offset();a.setPosition(b,b.childNodes.length);a.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");b=t.convertDomToCursorRange({anchorNode:c,anchorOffset:e,focusNode:a.container(), +focusOffset:a.offset()});b=q(b.position,b.length,ops.OdtCursor.RegionSelection);f.enqueue([b])};this.expandToWordBoundaries=m;this.expandToParagraphBoundaries=l;this.selectRange=function(b,a,c){var e=t.getOdfCanvas().getElement(),d,g=[s];d=y.containsNode(e,b.startContainer);e=y.containsNode(e,b.endContainer);if(d||e)if(d&&e&&(2===c?m(b):3<=c&&l(b)),(c=a?t.getRootElement(b.startContainer):t.getRootElement(b.endContainer))||(c=t.getRootNode()),g.push(t.createRootFilter(c)),r(c,g,b,!0),r(c,g,b,!1),b= +h(b,a),a=t.convertDomToCursorRange(b),b=t.getCursorSelection(k),a.position!==b.position||a.length!==b.length)b=q(a.position,a.length,ops.OdtCursor.RangeSelection),f.enqueue([b])};this.moveCursorToLeft=function(){b(N,!1);return!0};this.moveCursorToRight=function(){b(K,!1);return!0};this.extendSelectionToLeft=function(){b(N,!0);return!0};this.extendSelectionToRight=function(){b(K,!0);return!0};this.setCaretXPositionLocator=function(b){B=b};this.moveCursorUp=function(){e(N,!1);return!0};this.moveCursorDown= +function(){e(K,!1);return!0};this.extendSelectionUp=function(){e(N,!0);return!0};this.extendSelectionDown=function(){e(K,!0);return!0};this.moveCursorBeforeWord=function(){g(N,!1);return!0};this.moveCursorPastWord=function(){g(K,!1);return!0};this.extendSelectionBeforeWord=function(){g(N,!0);return!0};this.extendSelectionPastWord=function(){g(K,!0);return!0};this.moveCursorToLineStart=function(){n(N,!1);return!0};this.moveCursorToLineEnd=function(){n(K,!1);return!0};this.extendSelectionToLineStart= +function(){n(N,!0);return!0};this.extendSelectionToLineEnd=function(){n(K,!0);return!0};this.extendSelectionToParagraphStart=function(){u(N,!0,v.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){u(K,!0,v.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){u(N,!1,v.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){u(K,!1,v.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){u(N,!1,t.getRootElement);return!0}; +this.moveCursorToDocumentEnd=function(){u(K,!1,t.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){u(N,!0,t.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){u(K,!0,t.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var b=t.getCursor(k),b=t.getRootElement(b.getNode()),a,c,e;runtime.assert(Boolean(b),"SelectionController: Cursor outside root");e=t.createStepIterator(b,0,[s,w],b);e.roundToClosestStep();a=e.container();c=e.offset(); +e.setPosition(b,b.childNodes.length);e.roundToClosestStep();b=t.convertDomToCursorRange({anchorNode:a,anchorOffset:c,focusNode:e.container(),focusOffset:e.offset()});f.enqueue([q(b.position,b.length)]);return!0};this.destroy=function(b){t.unsubscribe(ops.OdtDocument.signalOperationStart,a);core.Async.destroyAll([C.destroy],b)};(function(){C=core.Task.createTimeoutTask(function(){I=void 0},2E3);t.subscribe(ops.OdtDocument.signalOperationStart,a)})()};gui.TextController=function(f,k,a,d,c,h){function q(){u=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?a.isLocalCursorWithinOwnAnnotation():!0}function p(b){b.getMemberId()===d&&q()}function m(b,a,c){var d=[e.getPositionFilter()];c&&d.push(e.createRootFilter(b.startContainer));c=e.createStepIterator(b.startContainer,b.startOffset,d,a);c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");a=e.convertDomPointToCursorStep(c.container(),c.offset()); +b.collapsed?b=a:(c.setPosition(b.endContainer,b.endOffset),c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),b=e.convertDomPointToCursorStep(c.container(),c.offset()));return{position:a,length:b-a}}function l(b){var a,c,e,f=n.getParagraphElements(b),h=b.cloneRange(),k=[];a=f[0];1<f.length&&(n.hasNoODFContent(a)&&(a=f[f.length-1]),c=a.getAttributeNS(odf.Namespaces.textns,"style-name")||"");f.forEach(function(a,f){var n,l;h.setStart(a,0);h.collapse(!0); +n=m(h,a,!1).position;0<f&&(l=new ops.OpMergeParagraph,l.init({memberid:d,paragraphStyleName:c,destinationStartPosition:e,sourceStartPosition:n,moveCursor:1===f}),k.unshift(l));e=n;h.selectNodeContents(a);if(n=g.rangeIntersection(h,b))n=m(n,a,!0),0<n.length&&(l=new ops.OpRemoveText,l.init({memberid:d,position:n.position,length:n.length}),k.unshift(l))});return k}function r(b){0>b.length&&(b.position+=b.length,b.length=-b.length);return b}function b(b){if(!u)return!1;var a,c=e.getCursor(d).getSelectedRange().cloneRange(), +g=r(e.getCursorSelection(d)),h;if(0===g.length){g=void 0;a=e.getCursor(d).getNode();h=e.getRootElement(a);var k=[e.getPositionFilter(),e.createRootFilter(h)];h=e.createStepIterator(a,0,k,h);h.roundToClosestStep()&&(b?h.nextStep():h.previousStep())&&(g=r(e.convertDomToCursorRange({anchorNode:a,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),b?(c.setStart(a,0),c.setEnd(h.container(),h.offset())):(c.setStart(h.container(),h.offset()),c.setEnd(a,0)))}g&&f.enqueue(l(c));return void 0!== +g}var e=f.getOdtDocument(),n=odf.OdfUtils,g=core.DomUtils,u=!1,t=odf.Namespaces.textns,y=core.StepDirection.NEXT;this.isEnabled=function(){return u};this.enqueueParagraphSplittingOps=function(){if(!u)return!1;var b=e.getCursor(d),a=b.getSelectedRange(),c=r(e.getCursorSelection(d)),g=[],b=n.getParagraphElement(b.getNode()),k=b.getAttributeNS(t,"style-name")||"";0<c.length&&(g=g.concat(l(a)));a=new ops.OpSplitParagraph;a.init({memberid:d,position:c.position,paragraphStyleName:k,sourceParagraphPosition:e.convertDomPointToCursorStep(b, +0,y),moveCursor:!0});g.push(a);h&&(c=h(c.position+1),g=g.concat(c));f.enqueue(g);return!0};this.removeTextByBackspaceKey=function(){return b(!1)};this.removeTextByDeleteKey=function(){return b(!0)};this.removeCurrentSelection=function(){if(!u)return!1;var b=e.getCursor(d).getSelectedRange();f.enqueue(l(b));return!0};this.insertText=function(b){if(u){var a=e.getCursor(d).getSelectedRange(),g=r(e.getCursorSelection(d)),h=[],k=!1;0<g.length&&(h=h.concat(l(a)),k=!0);a=new ops.OpInsertText;a.init({memberid:d, +position:g.position,text:b,moveCursor:!0});h.push(a);c&&(b=c(g.position,b.length,k))&&h.push(b);f.enqueue(h)}};this.destroy=function(b){e.unsubscribe(ops.Document.signalCursorMoved,p);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,q);b()};e.subscribe(ops.Document.signalCursorMoved,p);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,q);q()};gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(f,k){};gui.UndoManager.prototype.unsubscribe=function(f,k){};gui.UndoManager.prototype.setDocument=function(f){};gui.UndoManager.prototype.setInitialState=function(){};gui.UndoManager.prototype.initialize=function(){};gui.UndoManager.prototype.purgeInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(f){};gui.UndoManager.prototype.hasUndoStates=function(){}; +gui.UndoManager.prototype.hasRedoStates=function(){};gui.UndoManager.prototype.moveForward=function(f){};gui.UndoManager.prototype.moveBackward=function(f){};gui.UndoManager.prototype.onOperationExecuted=function(f){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";gui.SessionControllerOptions=function(){this.annotationsEnabled=this.directParagraphStylingEnabled=this.directTextStylingEnabled=!1}; +(function(){var f=core.PositionFilter.FilterResult.FILTER_ACCEPT;gui.SessionController=function(k,a,d,c){function h(b){return b.target||b.srcElement||null}function q(b,a){var c=G.getDOMDocument(),e=null;c.caretRangeFromPoint?(c=c.caretRangeFromPoint(b,a),e={container:c.startContainer,offset:c.startOffset}):c.caretPositionFromPoint&&(c=c.caretPositionFromPoint(b,a))&&c.offsetNode&&(e={container:c.offsetNode,offset:c.offset});return e}function p(b){var c=G.getCursor(a).getSelectedRange();c.collapsed? +b.preventDefault():$.setDataFromRange(b,c)?fa.removeCurrentSelection():runtime.log("Cut operation failed")}function m(){return!1!==G.getCursor(a).getSelectedRange().collapsed}function l(b){var c=G.getCursor(a).getSelectedRange();c.collapsed?b.preventDefault():$.setDataFromRange(b,c)||runtime.log("Copy operation failed")}function r(b){var a;T.clipboardData&&T.clipboardData.getData?a=T.clipboardData.getData("Text"):b.clipboardData&&b.clipboardData.getData&&(a=b.clipboardData.getData("text/plain")); +a&&(fa.removeCurrentSelection(),ga.paste(a));b.preventDefault?b.preventDefault():b.returnValue=!1}function b(){return!1}function e(b){if(S)S.onOperationExecuted(b)}function n(b){G.emit(ops.OdtDocument.signalUndoStackChanged,b)}function g(){var b;return S?(b=M.hasFocus(),S.moveBackward(1),b&&M.focus(),!0):!1}function u(){var b;return S?(b=M.hasFocus(),S.moveForward(1),b&&M.focus(),!0):!1}function t(b){var c=G.getCursor(a).getSelectedRange(),e=h(b).getAttribute("end");c&&e&&(b=q(b.clientX,b.clientY))&& +(ia.setUnfilteredPosition(b.container,b.offset),R.acceptPosition(ia)===f&&(c=c.cloneRange(),"left"===e?c.setStart(ia.container(),ia.unfilteredDomOffset()):c.setEnd(ia.container(),ia.unfilteredDomOffset()),d.setSelectedRange(c,"right"===e),G.emit(ops.Document.signalCursorMoved,d)))}function y(){W.selectRange(d.getSelectedRange(),d.hasForwardSelection(),1)}function v(){var b=T.getSelection(),a=0<b.rangeCount&&W.selectionToRange(b);Y&&a&&(X=!0,ka.clearSelection(),ia.setUnfilteredPosition(b.focusNode, +b.focusOffset),R.acceptPosition(ia)===f&&(2===na?W.expandToWordBoundaries(a.range):3<=na&&W.expandToParagraphBoundaries(a.range),d.setSelectedRange(a.range,a.hasForwardSelection),G.emit(ops.Document.signalCursorMoved,d)))}function s(b){var c=h(b),e=G.getCursor(a);if(Y=null!==c&&P.containsNode(G.getOdfCanvas().getElement(),c))X=!1,c=G.getRootElement(c)||G.getRootNode(),R=G.createRootFilter(c),na=0===b.button?b.detail:0,e&&b.shiftKey?T.getSelection().collapse(e.getAnchorNode(),0):(b=T.getSelection(), +c=e.getSelectedRange(),b.extend?e.hasForwardSelection()?(b.collapse(c.startContainer,c.startOffset),b.extend(c.endContainer,c.endOffset)):(b.collapse(c.endContainer,c.endOffset),b.extend(c.startContainer,c.startOffset)):(b.removeAllRanges(),b.addRange(c.cloneRange()))),1<na&&v()}function x(b){var a=G.getRootElement(b),c=G.createRootFilter(a),a=G.createStepIterator(b,0,[c,G.getPositionFilter()],a);a.setPosition(b,b.childNodes.length);return a.roundToNextStep()?{container:a.container(),offset:a.offset()}: +null}function w(b){var a;a=(a=T.getSelection())?{anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}:null;var c=T.getSelection().isCollapsed,e,d;a.anchorNode||a.focusNode||!(e=q(b.clientX,b.clientY))||(a.anchorNode=e.container,a.anchorOffset=e.offset,a.focusNode=a.anchorNode,a.focusOffset=a.anchorOffset);if(D.isImage(a.focusNode)&&0===a.focusOffset&&D.isCharacterFrame(a.focusNode.parentNode)){if(d=a.focusNode.parentNode,e=d.getBoundingClientRect(), +b.clientX>e.left&&(e=x(d)))a.focusNode=e.container,a.focusOffset=e.offset,c&&(a.anchorNode=a.focusNode,a.anchorOffset=a.focusOffset)}else D.isImage(a.focusNode.firstChild)&&1===a.focusOffset&&D.isCharacterFrame(a.focusNode)&&(e=x(a.focusNode))&&(a.anchorNode=a.focusNode=e.container,a.anchorOffset=a.focusOffset=e.offset);a.anchorNode&&a.focusNode&&(a=W.selectionToRange(a),W.selectRange(a.range,a.hasForwardSelection,0===b.button?b.detail:0));M.focus()}function B(b){var a;if(a=q(b.clientX,b.clientY))b= +a.container,a=a.offset,b={anchorNode:b,anchorOffset:a,focusNode:b,focusOffset:a},b=W.selectionToRange(b),W.selectRange(b.range,b.hasForwardSelection,2),M.focus()}function I(b){var a=h(b),c,e,f;la.processRequests();Y&&(D.isImage(a)&&D.isCharacterFrame(a.parentNode)&&T.getSelection().isCollapsed?(W.selectImage(a.parentNode),M.focus()):ka.isSelectorElement(a)?M.focus():X?(a=d.getSelectedRange(),e=a.collapsed,D.isImage(a.endContainer)&&0===a.endOffset&&D.isCharacterFrame(a.endContainer.parentNode)&&(f= +a.endContainer.parentNode,f=x(f))&&(a.setEnd(f.container,f.offset),e&&a.collapse(!1)),W.selectRange(a,d.hasForwardSelection(),0===b.button?b.detail:0),M.focus()):ta?w(b):(c=P.cloneEvent(b),da=runtime.setTimeout(function(){w(c)},0)),na=0,X=Y=!1)}function C(b){var c=G.getCursor(a).getSelectedRange();c.collapsed||Q.exportRangeToDataTransfer(b.dataTransfer,c)}function F(){Y&&M.focus();na=0;X=Y=!1}function J(b){I(b)}function N(b){var a=h(b),c=null;"annotationRemoveButton"===a.className?(runtime.assert(ea, +"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),c=a.parentNode.getElementsByTagNameNS(odf.Namespaces.officens,"annotation").item(0),ha.removeAnnotation(c),M.focus()):"webodf-draggable"!==a.getAttribute("class")&&I(b)}function K(b){(b=b.data)&&(-1===b.indexOf("\n")?fa.insertText(b):ga.paste(b))}function H(b){return function(){b();return!0}}function z(b){return function(c){return G.getCursor(a).getSelectionType()===ops.OdtCursor.RangeSelection? +b(c):!0}}function Z(b){M.unsubscribe("keydown",A.handleEvent);M.unsubscribe("keypress",V.handleEvent);M.unsubscribe("keyup",ba.handleEvent);M.unsubscribe("copy",l);M.unsubscribe("mousedown",s);M.unsubscribe("mousemove",la.trigger);M.unsubscribe("mouseup",N);M.unsubscribe("contextmenu",J);M.unsubscribe("dragstart",C);M.unsubscribe("dragend",F);M.unsubscribe("click",oa.handleClick);M.unsubscribe("longpress",B);M.unsubscribe("drag",t);M.unsubscribe("dragstop",y);G.unsubscribe(ops.OdtDocument.signalOperationEnd, +ma.trigger);G.unsubscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.unsubscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.unsubscribe(ops.OdtDocument.signalOperationEnd,e);b()}var T=runtime.getWindow(),G=k.getOdtDocument(),U=new gui.SessionConstraints,aa=new gui.SessionContext(k,a),P=core.DomUtils,D=odf.OdfUtils,Q=new gui.MimeDataExporter,$=new gui.Clipboard(Q),A=new gui.KeyboardHandler,V=new gui.KeyboardHandler,ba=new gui.KeyboardHandler,Y=!1,E=new odf.ObjectNameGenerator(G.getOdfCanvas().odfContainer(), +a),X=!1,R=null,da,S=null,M=new gui.EventManager(G),ea=c.annotationsEnabled,ha=new gui.AnnotationController(k,U,a),ca=new gui.DirectFormattingController(k,U,aa,a,E,c.directTextStylingEnabled,c.directParagraphStylingEnabled),fa=new gui.TextController(k,U,aa,a,ca.createCursorStyleOp,ca.createParagraphStyleOps),pa=new gui.ImageController(k,U,aa,a,E),ka=new gui.ImageSelector(G.getOdfCanvas()),ia=G.createPositionIterator(G.getRootNode()),la,ma,ga=new gui.PasteController(k,U,aa,a),ja=new gui.InputMethodEditor(a, +M),na=0,oa=new gui.HyperlinkClickHandler(G.getOdfCanvas().getElement,A,ba),sa=new gui.HyperlinkController(k,U,aa,a),W=new gui.SelectionController(k,a),ua=new gui.MetadataController(k,a),L=gui.KeyboardHandler.Modifier,O=gui.KeyboardHandler.KeyCode,qa=-1!==T.navigator.appVersion.toLowerCase().indexOf("mac"),ta=-1!==["iPad","iPod","iPhone"].indexOf(T.navigator.platform),ra;runtime.assert(null!==T,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo= +u;this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(a),"Inserting local cursor a second time.");var b=new ops.OpAddCursor;b.init({memberid:a});k.enqueue([b]);M.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(a),"Removing local cursor without inserting before.");var b=new ops.OpRemoveCursor;b.init({memberid:a});k.enqueue([b])};this.startEditing=function(){ja.subscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection); +ja.subscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.subscribe("beforecut",m);M.subscribe("cut",p);M.subscribe("beforepaste",b);M.subscribe("paste",r);S&&S.initialize();M.setEditing(!0);oa.setModifier(qa?L.Meta:L.Ctrl);A.bind(O.Backspace,L.None,H(fa.removeTextByBackspaceKey),!0);A.bind(O.Delete,L.None,fa.removeTextByDeleteKey);A.bind(O.Tab,L.None,z(function(){fa.insertText("\t");return!0}));qa?(A.bind(O.Clear,L.None,fa.removeCurrentSelection),A.bind(O.B,L.Meta,z(ca.toggleBold)),A.bind(O.I, +L.Meta,z(ca.toggleItalic)),A.bind(O.U,L.Meta,z(ca.toggleUnderline)),A.bind(O.L,L.MetaShift,z(ca.alignParagraphLeft)),A.bind(O.E,L.MetaShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.MetaShift,z(ca.alignParagraphRight)),A.bind(O.J,L.MetaShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.MetaShift,ha.addAnnotation),A.bind(O.Z,L.Meta,g),A.bind(O.Z,L.MetaShift,u)):(A.bind(O.B,L.Ctrl,z(ca.toggleBold)),A.bind(O.I,L.Ctrl,z(ca.toggleItalic)),A.bind(O.U,L.Ctrl,z(ca.toggleUnderline)),A.bind(O.L,L.CtrlShift, +z(ca.alignParagraphLeft)),A.bind(O.E,L.CtrlShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.CtrlShift,z(ca.alignParagraphRight)),A.bind(O.J,L.CtrlShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.CtrlAlt,ha.addAnnotation),A.bind(O.Z,L.Ctrl,g),A.bind(O.Z,L.CtrlShift,u));V.setDefault(z(function(b){var a;a=null===b.which||void 0===b.which?String.fromCharCode(b.keyCode):0!==b.which&&0!==b.charCode?String.fromCharCode(b.which):null;return!a||b.altKey||b.ctrlKey||b.metaKey?!1:(fa.insertText(a),!0)})); +V.bind(O.Enter,L.None,z(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ja.unsubscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);ja.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.unsubscribe("cut",p);M.unsubscribe("beforecut",m);M.unsubscribe("paste",r);M.unsubscribe("beforepaste",b);M.setEditing(!1);oa.setModifier(L.None);A.bind(O.Backspace,L.None,function(){return!0},!0);A.unbind(O.Delete,L.None);A.unbind(O.Tab,L.None);qa?(A.unbind(O.Clear, +L.None),A.unbind(O.B,L.Meta),A.unbind(O.I,L.Meta),A.unbind(O.U,L.Meta),A.unbind(O.L,L.MetaShift),A.unbind(O.E,L.MetaShift),A.unbind(O.R,L.MetaShift),A.unbind(O.J,L.MetaShift),ea&&A.unbind(O.C,L.MetaShift),A.unbind(O.Z,L.Meta),A.unbind(O.Z,L.MetaShift)):(A.unbind(O.B,L.Ctrl),A.unbind(O.I,L.Ctrl),A.unbind(O.U,L.Ctrl),A.unbind(O.L,L.CtrlShift),A.unbind(O.E,L.CtrlShift),A.unbind(O.R,L.CtrlShift),A.unbind(O.J,L.CtrlShift),ea&&A.unbind(O.C,L.CtrlAlt),A.unbind(O.Z,L.Ctrl),A.unbind(O.Z,L.CtrlShift));V.setDefault(null); +V.unbind(O.Enter,L.None)};this.getInputMemberId=function(){return a};this.getSession=function(){return k};this.getSessionConstraints=function(){return U};this.setUndoManager=function(b){S&&S.unsubscribe(gui.UndoManager.signalUndoStackChanged,n);if(S=b)S.setDocument(G),S.setPlaybackFunction(k.enqueue),S.subscribe(gui.UndoManager.signalUndoStackChanged,n)};this.getUndoManager=function(){return S};this.getMetadataController=function(){return ua};this.getAnnotationController=function(){return ha};this.getDirectFormattingController= +function(){return ca};this.getHyperlinkClickHandler=function(){return oa};this.getHyperlinkController=function(){return sa};this.getImageController=function(){return pa};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return M};this.getKeyboardHandlers=function(){return{keydown:A,keypress:V}};this.destroy=function(b){var a=[la.destroy,ma.destroy,ca.destroy,ja.destroy,M.destroy,oa.destroy,sa.destroy,ua.destroy,W.destroy, +fa.destroy,Z];ra&&a.unshift(ra.destroy);runtime.clearTimeout(da);core.Async.destroyAll(a,b)};la=core.Task.createRedrawTask(v);ma=core.Task.createRedrawTask(function(){var b=G.getCursor(a);if(b&&b.getSelectionType()===ops.OdtCursor.RegionSelection&&(b=D.getImageElements(b.getSelectedRange())[0])){ka.select(b.parentNode);return}ka.clearSelection()});A.bind(O.Left,L.None,z(W.moveCursorToLeft));A.bind(O.Right,L.None,z(W.moveCursorToRight));A.bind(O.Up,L.None,z(W.moveCursorUp));A.bind(O.Down,L.None,z(W.moveCursorDown)); +A.bind(O.Left,L.Shift,z(W.extendSelectionToLeft));A.bind(O.Right,L.Shift,z(W.extendSelectionToRight));A.bind(O.Up,L.Shift,z(W.extendSelectionUp));A.bind(O.Down,L.Shift,z(W.extendSelectionDown));A.bind(O.Home,L.None,z(W.moveCursorToLineStart));A.bind(O.End,L.None,z(W.moveCursorToLineEnd));A.bind(O.Home,L.Ctrl,z(W.moveCursorToDocumentStart));A.bind(O.End,L.Ctrl,z(W.moveCursorToDocumentEnd));A.bind(O.Home,L.Shift,z(W.extendSelectionToLineStart));A.bind(O.End,L.Shift,z(W.extendSelectionToLineEnd));A.bind(O.Up, +L.CtrlShift,z(W.extendSelectionToParagraphStart));A.bind(O.Down,L.CtrlShift,z(W.extendSelectionToParagraphEnd));A.bind(O.Home,L.CtrlShift,z(W.extendSelectionToDocumentStart));A.bind(O.End,L.CtrlShift,z(W.extendSelectionToDocumentEnd));qa?(A.bind(O.Left,L.Alt,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Alt,z(W.moveCursorPastWord)),A.bind(O.Left,L.Meta,z(W.moveCursorToLineStart)),A.bind(O.Right,L.Meta,z(W.moveCursorToLineEnd)),A.bind(O.Home,L.Meta,z(W.moveCursorToDocumentStart)),A.bind(O.End,L.Meta, +z(W.moveCursorToDocumentEnd)),A.bind(O.Left,L.AltShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.AltShift,z(W.extendSelectionPastWord)),A.bind(O.Left,L.MetaShift,z(W.extendSelectionToLineStart)),A.bind(O.Right,L.MetaShift,z(W.extendSelectionToLineEnd)),A.bind(O.Up,L.AltShift,z(W.extendSelectionToParagraphStart)),A.bind(O.Down,L.AltShift,z(W.extendSelectionToParagraphEnd)),A.bind(O.Up,L.MetaShift,z(W.extendSelectionToDocumentStart)),A.bind(O.Down,L.MetaShift,z(W.extendSelectionToDocumentEnd)), +A.bind(O.A,L.Meta,z(W.extendSelectionToEntireDocument))):(A.bind(O.Left,L.Ctrl,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Ctrl,z(W.moveCursorPastWord)),A.bind(O.Left,L.CtrlShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.CtrlShift,z(W.extendSelectionPastWord)),A.bind(O.A,L.Ctrl,z(W.extendSelectionToEntireDocument)));ta&&(ra=new gui.IOSSafariSupport(M));M.subscribe("keydown",A.handleEvent);M.subscribe("keypress",V.handleEvent);M.subscribe("keyup",ba.handleEvent);M.subscribe("copy",l);M.subscribe("mousedown", +s);M.subscribe("mousemove",la.trigger);M.subscribe("mouseup",N);M.subscribe("contextmenu",J);M.subscribe("dragstart",C);M.subscribe("dragend",F);M.subscribe("click",oa.handleClick);M.subscribe("longpress",B);M.subscribe("drag",t);M.subscribe("dragstop",y);G.subscribe(ops.OdtDocument.signalOperationEnd,ma.trigger);G.subscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.subscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.subscribe(ops.OdtDocument.signalOperationEnd,e)}})();gui.CaretManager=function(f,k){function a(a){return h.hasOwnProperty(a)?h[a]:null}function d(){return Object.keys(h).map(function(a){return h[a]})}function c(a){var c=h[a];c&&(delete h[a],a===f.getInputMemberId()?(p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.ensureVisible),p.unsubscribe(ops.Document.signalCursorMoved,c.refreshCursorBlinking),m.unsubscribe("compositionupdate",c.handleUpdate),m.unsubscribe("compositionend",c.handleUpdate),m.unsubscribe("focus",c.setFocus),m.unsubscribe("blur", +c.removeFocus),q.removeEventListener("focus",c.show,!1),q.removeEventListener("blur",c.hide,!1)):p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.handleUpdate),c.destroy(function(){}))}var h={},q=runtime.getWindow(),p=f.getSession().getOdtDocument(),m=f.getEventManager();this.registerCursor=function(a,c,b){var e=a.getMemberId();a=new gui.Caret(a,k,c,b);h[e]=a;e===f.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+e),p.subscribe(ops.OdtDocument.signalProcessingBatchEnd, +a.ensureVisible),p.subscribe(ops.Document.signalCursorMoved,a.refreshCursorBlinking),m.subscribe("compositionupdate",a.handleUpdate),m.subscribe("compositionend",a.handleUpdate),m.subscribe("focus",a.setFocus),m.subscribe("blur",a.removeFocus),q.addEventListener("focus",a.show,!1),q.addEventListener("blur",a.hide,!1),a.setOverlayElement(m.getEventTrap())):p.subscribe(ops.OdtDocument.signalProcessingBatchEnd,a.handleUpdate);return a};this.getCaret=a;this.getCarets=d;this.destroy=function(a){var k= +d().map(function(b){return b.destroy});f.getSelectionController().setCaretXPositionLocator(null);p.unsubscribe(ops.Document.signalCursorRemoved,c);h={};core.Async.destroyAll(k,a)};f.getSelectionController().setCaretXPositionLocator(function(){var c=a(f.getInputMemberId()),d;c&&(d=c.getBoundingClientRect());return d?d.right:void 0});p.subscribe(ops.Document.signalCursorRemoved,c)};gui.EditInfoHandle=function(f){var k=[],a,d=f.ownerDocument,c=d.documentElement.namespaceURI;this.setEdits=function(f){k=f;var q,p,m,l;a.innerHTML="";for(f=0;f<k.length;f+=1)q=d.createElementNS(c,"div"),q.className="editInfo",p=d.createElementNS(c,"span"),p.className="editInfoColor",p.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid),m=d.createElementNS(c,"span"),m.className="editInfoAuthor",m.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid), +l=d.createElementNS(c,"span"),l.className="editInfoTime",l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid),l.innerHTML=k[f].time,q.appendChild(p),q.appendChild(m),q.appendChild(l),a.appendChild(q)};this.show=function(){a.style.display="block"};this.hide=function(){a.style.display="none"};this.destroy=function(c){f.removeChild(a);c()};a=d.createElementNS(c,"div");a.setAttribute("class","editInfoHandle");a.style.display="none";f.appendChild(a)};ops.EditInfo=function(f,k){function a(){var a=[],d;for(d in c)c.hasOwnProperty(d)&&a.push({memberid:d,time:c[d].time});a.sort(function(a,c){return a.time-c.time});return a}var d,c={};this.getNode=function(){return d};this.getOdtDocument=function(){return k};this.getEdits=function(){return c};this.getSortedEdits=function(){return a()};this.addEdit=function(a,d){c[a]={time:d}};this.clearEdits=function(){c={}};this.destroy=function(a){f.parentNode&&f.removeChild(d);a()};d=k.getDOMDocument().createElementNS("urn:webodf:names:editinfo", +"editinfo");f.insertBefore(d,f.firstChild)};gui.EditInfoMarker=function(f,k){function a(a,b){return runtime.setTimeout(function(){q.style.opacity=a},b)}var d=this,c,h,q,p,m,l;this.addEdit=function(c,b){var e=Date.now()-b;f.addEdit(c,b);h.setEdits(f.getSortedEdits());q.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",c);runtime.clearTimeout(m);runtime.clearTimeout(l);1E4>e?(p=a(1,0),m=a(0.5,1E4-e),l=a(0.2,2E4-e)):1E4<=e&&2E4>e?(p=a(0.5,0),l=a(0.2,2E4-e)):p=a(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits= +function(){f.clearEdits();h.setEdits([]);q.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&q.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){q.style.display="block"};this.hide=function(){d.hideHandle();q.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(a){runtime.clearTimeout(p);runtime.clearTimeout(m);runtime.clearTimeout(l);c.removeChild(q); +h.destroy(function(b){b?a(b):f.destroy(a)})};(function(){var a=f.getOdtDocument().getDOMDocument();q=a.createElementNS(a.documentElement.namespaceURI,"div");q.setAttribute("class","editInfoMarker");q.onmouseover=function(){d.showHandle()};q.onmouseout=function(){d.hideHandle()};c=f.getNode();c.appendChild(q);h=new gui.EditInfoHandle(c);k||d.hide()})()};gui.HyperlinkTooltipView=function(f,k){var a=core.DomUtils,d=odf.OdfUtils,c=runtime.getWindow(),h,q,p;runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(m){var l=m.target||m.srcElement,r=f.getSizer(),b=f.getZoomLevel(),e;a:{for(;l;){if(d.isHyperlink(l))break a;if(d.isParagraph(l)||d.isInlineRoot(l))break;l=l.parentNode}l=null}if(l){a.containsNode(r,p)||r.appendChild(p);e=q;var n;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:n= +runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:n=runtime.tr("\u2318-click to follow link");break;default:n=""}e.textContent=n;h.textContent=d.getHyperlinkTarget(l);p.style.display="block";e=c.innerWidth-p.offsetWidth-15;l=m.clientX>e?e:m.clientX+15;e=c.innerHeight-p.offsetHeight-10;m=m.clientY>e?e:m.clientY+10;r=r.getBoundingClientRect();l=(l-r.left)/b;m=(m-r.top)/b;p.style.left=l+"px";p.style.top=m+"px"}};this.hideTooltip=function(){p.style.display="none"};this.destroy= +function(a){p.parentNode&&p.parentNode.removeChild(p);a()};(function(){var a=f.getElement().ownerDocument;h=a.createElement("span");q=a.createElement("span");h.className="webodf-hyperlinkTooltipLink";q.className="webodf-hyperlinkTooltipText";p=a.createElement("div");p.className="webodf-hyperlinkTooltip";p.appendChild(h);p.appendChild(q);f.getElement().appendChild(p)})()};gui.OdfFieldView=function(f){function k(){var a=odf.OdfSchema.getFields().map(function(a){return a.replace(":","|")}),d=a.join(",\n")+"\n{ background-color: #D0D0D0; }\n",a=a.map(function(a){return a+":empty::after"}).join(",\n")+"\n{ content:' '; white-space: pre; }\n";return d+"\n"+a}var a,d=f.getElement().ownerDocument;this.showFieldHighlight=function(){a.appendChild(d.createTextNode(k()))};this.hideFieldHighlight=function(){for(var c=a.sheet,d=c.cssRules;d.length;)c.deleteRule(d.length-1)};this.destroy= +function(c){a.parentNode&&a.parentNode.removeChild(a);c()};a=function(){var a=d.getElementsByTagName("head").item(0),f=d.createElement("style"),k="";f.type="text/css";f.media="screen, print, handheld, projection";odf.Namespaces.forEachPrefix(function(a,c){k+="@namespace "+a+" url("+c+");\n"});f.appendChild(d.createTextNode(k));a.appendChild(f);return f}()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),a=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(d,c){k=d;a=!1!==c};this.hasForwardSelection=function(){return a};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(a).map(function(d){return a[d]})}var a={};this.getSelectionView=function(d){return a.hasOwnProperty(d)?a[d]:null};this.getSelectionViews=k;this.removeSelectionView=function(d){a.hasOwnProperty(d)&&(a[d].destroy(function(){}),delete a[d])};this.hideSelectionView=function(d){a.hasOwnProperty(d)&&a[d].hide()};this.showSelectionView=function(d){a.hasOwnProperty(d)&&a[d].show()};this.rerenderSelectionViews=function(){Object.keys(a).forEach(function(d){a[d].rerender()})}; +this.registerCursor=function(d,c){var h=d.getMemberId(),k=new f(d);c?k.show():k.hide();return a[h]=k};this.destroy=function(a){function c(k,p){p?a(p):k<f.length?f[k].destroy(function(a){c(k+1,a)}):a()}var f=k();c(0,void 0)}};gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0}; +(function(){gui.SessionView=function(f,k,a,d,c,h){function q(b){b.memberId===k&&I.getViewport().scrollIntoView(b.annotation.getBoundingClientRect())}function p(){var b=document.getElementsByTagName("head").item(0),a=document.createElement("style");a.type="text/css";a.media="screen, print, handheld, projection";b.appendChild(a);return a}function m(b,a,c){function e(a,c,d){c=a+'[editinfo|memberid="'+b+'"]'+d+c;a:{var f=v.firstChild;for(a=a+'[editinfo|memberid="'+b+'"]'+d+"{";f;){if(f.nodeType===Node.TEXT_NODE&& +0===f.data.indexOf(a)){a=f;break a}f=f.nextSibling}a=null}a?a.data=c:v.appendChild(document.createTextNode(c))}e("div.editInfoMarker","{ background-color: "+c+"; }","");e("span.editInfoColor","{ background-color: "+c+"; }","");e("span.editInfoAuthor",'{ content: "'+a+'"; }',":before");e("dc|creator","{ background-color: "+c+"; }","");e(".webodf-selectionOverlay","{ fill: "+c+"; stroke: "+c+";}","");b===k&&(e(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"), +b=gui.ShadowCursor.ShadowCursorMemberId,e(".webodf-selectionOverlay","{ fill: "+c+"; stroke: "+c+";}",""),e(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function l(b){var a,c;for(c in w)w.hasOwnProperty(c)&&(a=w[c],b?a.show():a.hide())}function r(b){c.getCarets().forEach(function(a){b?a.showHandle():a.hideHandle()})}function b(b){var a=b.getMemberId();b=b.getProperties();m(a,b.fullName,b.color)}function e(b){var e=b.getMemberId(),d=a.getOdtDocument().getMember(e).getProperties(); +c.registerCursor(b,J,N);h.registerCursor(b,!0);if(b=c.getCaret(e))b.setAvatarImageUrl(d.imageUrl),b.setColor(d.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+e+"'! +++")}function n(b){b=b.getMemberId();var a=h.getSelectionView(k),e=h.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),d=c.getCaret(k);b===k?(e.hide(),a&&a.show(),d&&d.show()):b===gui.ShadowCursor.ShadowCursorMemberId&&(e.show(),a&&a.hide(),d&&d.hide())}function g(b){h.removeSelectionView(b)}function u(b){var c= +b.paragraphElement,e=b.memberId;b=b.timeStamp;var d,f="",g=c.getElementsByTagNameNS(x,"editinfo").item(0);g?(f=g.getAttributeNS(x,"id"),d=w[f]):(f=Math.random().toString(),d=new ops.EditInfo(c,a.getOdtDocument()),d=new gui.EditInfoMarker(d,F),g=c.getElementsByTagNameNS(x,"editinfo").item(0),g.setAttributeNS(x,"id",f),w[f]=d);d.addEdit(e,new Date(b));C.trigger()}function t(){var b;""!==s.innerHTML&&(s.innerHTML="");!0===d.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(b=a.getOdtDocument().getMember(k))&& +(b=b.getProperties().fullName,s.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+b+"']) .annotationRemoveButton { display: none; }")))}function y(a){var c=Object.keys(w).map(function(b){return w[b]});B.unsubscribe(ops.Document.signalMemberAdded,b);B.unsubscribe(ops.Document.signalMemberUpdated,b);B.unsubscribe(ops.Document.signalCursorAdded,e);B.unsubscribe(ops.Document.signalCursorRemoved,g);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,u);B.unsubscribe(ops.Document.signalCursorMoved, +n);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalTableAdded,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);d.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,t);B.unsubscribe(ops.Document.signalMemberAdded,t);B.unsubscribe(ops.Document.signalMemberUpdated,t);v.parentNode.removeChild(v);s.parentNode.removeChild(s);(function Z(b,e){e?a(e):b<c.length? +c[b].destroy(function(a){Z(b+1,a)}):a()})(0,void 0)}var v,s,x="urn:webodf:names:editinfo",w={},B,I,C,F=void 0!==f.editInfoMarkersInitiallyVisible?Boolean(f.editInfoMarkersInitiallyVisible):!0,J=void 0!==f.caretAvatarsInitiallyVisible?Boolean(f.caretAvatarsInitiallyVisible):!0,N=void 0!==f.caretBlinksOnRangeSelect?Boolean(f.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){F||(F=!0,l(F))};this.hideEditInfoMarkers=function(){F&&(F=!1,l(F))};this.showCaretAvatars=function(){J||(J=!0,r(J))}; +this.hideCaretAvatars=function(){J&&(J=!1,r(J))};this.getSession=function(){return a};this.getCaret=function(b){return c.getCaret(b)};this.destroy=function(b){var a=[C.destroy,y];B.unsubscribe(ops.OdtDocument.signalAnnotationAdded,q);core.Async.destroyAll(a,b)};B=a.getOdtDocument();I=B.getOdfCanvas();B.subscribe(ops.OdtDocument.signalAnnotationAdded,q);B.subscribe(ops.Document.signalMemberAdded,b);B.subscribe(ops.Document.signalMemberUpdated,b);B.subscribe(ops.Document.signalCursorAdded,e);B.subscribe(ops.Document.signalCursorRemoved, +g);B.subscribe(ops.OdtDocument.signalParagraphChanged,u);B.subscribe(ops.Document.signalCursorMoved,n);B.subscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);B.subscribe(ops.OdtDocument.signalTableAdded,h.rerenderSelectionViews);B.subscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);d.subscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,t);B.subscribe(ops.Document.signalMemberAdded,t);B.subscribe(ops.Document.signalMemberUpdated,t);v=p(); +v.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));v.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));s=p();t();C=core.Task.createRedrawTask(function(){var b=I.getAnnotationViewManager();b&&(b.rehighlightAnnotations(),B.fixCursorPositions())})}})();gui.SvgSelectionView=function(f){function k(){var b=e.getRootNode();n!==b&&(n=b,g=e.getCanvas().getSizer(),g.appendChild(t),t.setAttribute("class","webodf-selectionOverlay"),v.setAttribute("class","webodf-draggable"),s.setAttribute("class","webodf-draggable"),v.setAttribute("end","left"),s.setAttribute("end","right"),v.setAttribute("r",8),s.setAttribute("r",8),t.appendChild(y),t.appendChild(v),t.appendChild(s))}function a(b){b=b.getBoundingClientRect();return Boolean(b&&0!==b.height)}function d(b){var c= +x.getTextElements(b,!0,!1),e=b.cloneRange(),d=b.cloneRange();b=b.cloneRange();if(!c.length)return null;var f;a:{f=0;var g=c[f],h=e.startContainer===g?e.startOffset:0,k=h;e.setStart(g,h);for(e.setEnd(g,k);!a(e);){if(g.nodeType===Node.ELEMENT_NODE&&k<g.childNodes.length)k=g.childNodes.length;else if(g.nodeType===Node.TEXT_NODE&&k<g.length)k+=1;else if(c[f])g=c[f],f+=1,h=k=0;else{f=!1;break a}e.setStart(g,h);e.setEnd(g,k)}f=!0}if(!f)return null;a:{f=c.length-1;g=c[f];k=h=d.endContainer===g?d.endOffset: +g.nodeType===Node.TEXT_NODE?g.length:g.childNodes.length;d.setStart(g,h);for(d.setEnd(g,k);!a(d);){if(g.nodeType===Node.ELEMENT_NODE&&0<h)h=0;else if(g.nodeType===Node.TEXT_NODE&&0<h)h-=1;else if(c[f])g=c[f],f-=1,h=k=g.length||g.childNodes.length;else{c=!1;break a}d.setStart(g,h);d.setEnd(g,k)}c=!0}if(!c)return null;b.setStart(e.startContainer,e.startOffset);b.setEnd(d.endContainer,d.endOffset);return{firstRange:e,lastRange:d,fillerRange:b}}function c(b,a){var c={};c.top=Math.min(b.top,a.top);c.left= +Math.min(b.left,a.left);c.right=Math.max(b.right,a.right);c.bottom=Math.max(b.bottom,a.bottom);c.width=c.right-c.left;c.height=c.bottom-c.top;return c}function h(b,a){a&&0<a.width&&0<a.height&&(b=b?c(b,a):a);return b}function q(b){function a(b){C.setUnfilteredPosition(b,0);return t.acceptNode(b)===F&&s.acceptPosition(C)===F?F:J}function c(b){var e=null;a(b)===F&&(e=w.getBoundingClientRect(b));return e}var d=b.commonAncestorContainer,f=b.startContainer,g=b.endContainer,k=b.startOffset,n=b.endOffset, +l,m,p=null,q,r=u.createRange(),s,t=new odf.OdfNodeFilter,v;if(f===d||g===d)return r=b.cloneRange(),p=r.getBoundingClientRect(),r.detach(),p;for(b=f;b.parentNode!==d;)b=b.parentNode;for(m=g;m.parentNode!==d;)m=m.parentNode;s=e.createRootFilter(f);for(d=b.nextSibling;d&&d!==m;)q=c(d),p=h(p,q),d=d.nextSibling;if(x.isParagraph(b))p=h(p,w.getBoundingClientRect(b));else if(b.nodeType===Node.TEXT_NODE)d=b,r.setStart(d,k),r.setEnd(d,d===m?n:d.length),q=r.getBoundingClientRect(),p=h(p,q);else for(v=u.createTreeWalker(b, +NodeFilter.SHOW_TEXT,a,!1),d=v.currentNode=f;d&&d!==g;)r.setStart(d,k),r.setEnd(d,d.length),q=r.getBoundingClientRect(),p=h(p,q),l=d,k=0,d=v.nextNode();l||(l=f);if(x.isParagraph(m))p=h(p,w.getBoundingClientRect(m));else if(m.nodeType===Node.TEXT_NODE)d=m,r.setStart(d,d===b?k:0),r.setEnd(d,n),q=r.getBoundingClientRect(),p=h(p,q);else for(v=u.createTreeWalker(m,NodeFilter.SHOW_TEXT,a,!1),d=v.currentNode=g;d&&d!==l;)if(r.setStart(d,0),r.setEnd(d,n),q=r.getBoundingClientRect(),p=h(p,q),d=v.previousNode())n= +d.length;return p}function p(b,a){var c=b.getBoundingClientRect(),e={width:0};e.top=c.top;e.bottom=c.bottom;e.height=c.height;e.left=e.right=a?c.right:c.left;return e}function m(){var b=f.getSelectedRange(),a;if(a=I&&f.getSelectionType()===ops.OdtCursor.RangeSelection&&!b.collapsed){k();var e=w.getBoundingClientRect(g),h=B.getZoomLevel(),b=d(b),n,l,m,r,u,x;if(b){a=b.firstRange;n=b.lastRange;l=b.fillerRange;m=w.translateRect(p(a,!1),e,h);u=w.translateRect(p(n,!0),e,h);r=(r=q(l))?w.translateRect(r, +e,h):c(m,u);x=r.left;r=m.left+Math.max(0,r.width-(m.left-r.left));e=Math.min(m.top,u.top);h=u.top+u.height;x=[{x:m.left,y:e+m.height},{x:m.left,y:e},{x:r,y:e},{x:r,y:h-u.height},{x:u.right,y:h-u.height},{x:u.right,y:h},{x:x,y:h},{x:x,y:e+m.height},{x:m.left,y:e+m.height}];r="";var C;for(C=0;C<x.length;C+=1)r+=x[C].x+","+x[C].y+" ";y.setAttribute("points",r);v.setAttribute("cx",m.left);v.setAttribute("cy",e+m.height/2);s.setAttribute("cx",u.right);s.setAttribute("cy",h-u.height/2);a.detach();n.detach(); +l.detach()}a=Boolean(b)}t.style.display=a?"block":"none"}function l(b){I&&b===f&&N.trigger()}function r(b){b=8/b;v.setAttribute("r",b);s.setAttribute("r",b)}function b(b){g.removeChild(t);g.classList.remove("webodf-virtualSelections");f.getDocument().unsubscribe(ops.Document.signalCursorMoved,l);B.unsubscribe(gui.ZoomHelper.signalZoomChanged,r);b()}var e=f.getDocument(),n,g,u=e.getDOMDocument(),t=u.createElementNS("http://www.w3.org/2000/svg","svg"),y=u.createElementNS("http://www.w3.org/2000/svg", +"polygon"),v=u.createElementNS("http://www.w3.org/2000/svg","circle"),s=u.createElementNS("http://www.w3.org/2000/svg","circle"),x=odf.OdfUtils,w=core.DomUtils,B=e.getCanvas().getZoomHelper(),I=!0,C=f.getDocument().createPositionIterator(e.getRootNode()),F=NodeFilter.FILTER_ACCEPT,J=NodeFilter.FILTER_REJECT,N;this.rerender=function(){I&&N.trigger()};this.show=function(){I=!0;N.trigger()};this.hide=function(){I=!1;N.trigger()};this.destroy=function(a){core.Async.destroyAll([N.destroy,b],a)};(function(){var b= +f.getMemberId();N=core.Task.createRedrawTask(m);k();t.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",b);g.classList.add("webodf-virtualSelections");f.getDocument().subscribe(ops.Document.signalCursorMoved,l);B.subscribe(gui.ZoomHelper.signalZoomChanged,r);r(B.getZoomLevel())})()};gui.UndoStateRules=function(){function f(a,d){var f=a.length;this.previous=function(){for(f-=1;0<=f;f-=1)if(d(a[f]))return a[f];return null}}function k(a){a=a.spec();var d;a.hasOwnProperty("position")&&(d=a.position);return d}function a(a){return a.isEdit}function d(a,d,f){if(!f)return f=k(a)-k(d),0===f||1===Math.abs(f);a=k(a);d=k(d);f=k(f);return a-d===d-f}this.isEditOperation=a;this.isPartOfOperationSet=function(c,h){var k=void 0!==c.group,p;if(!c.isEdit||0===h.length)return!0;p=h[h.length-1];if(k&& +c.group===p.group)return!0;a:switch(c.spec().optype){case "RemoveText":case "InsertText":p=!0;break a;default:p=!1}if(p&&h.some(a)){if(k){var m;k=c.spec().optype;p=new f(h,a);var l=p.previous(),r=null,b,e;runtime.assert(Boolean(l),"No edit operations found in state");e=l.group;runtime.assert(void 0!==e,"Operation has no group");for(b=1;l&&l.group===e;){if(k===l.spec().optype){m=l;break}l=p.previous()}if(m){for(l=p.previous();l;){if(l.group!==e){if(2===b)break;e=l.group;b+=1}if(k===l.spec().optype){r= +l;break}l=p.previous()}m=d(c,m,r)}else m=!1;return m}m=c.spec().optype;k=new f(h,a);p=k.previous();runtime.assert(Boolean(p),"No edit operations found in state");m=m===p.spec().optype?d(c,p,k.previous()):!1;return m}return!1}};gui.TrivialUndoManager=function(f){function k(b){0<b.length&&(x=!0,n(b),x=!1)}function a(){v.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:m.hasUndoStates(),redoAvailable:m.hasRedoStates()})}function d(){u!==e&&u!==t[t.length-1]&&t.push(u)}function c(b){var a=b.previousSibling||b.nextSibling;b.parentNode.removeChild(b);r.normalizeTextNodes(a)}function h(b){return Object.keys(b).map(function(a){return b[a]})}function q(b){function a(b){var g=b.spec();if(d[g.memberid])switch(g.optype){case "AddCursor":c[g.memberid]|| +(c[g.memberid]=b,delete d[g.memberid],f-=1);break;case "MoveCursor":e[g.memberid]||(e[g.memberid]=b)}}var c={},e={},d={},f,k=b.pop();g.getMemberIds().forEach(function(b){d[b]=!0});for(f=Object.keys(d).length;k&&0<f;)k.reverse(),k.forEach(a),k=b.pop();return h(c).concat(h(e))}function p(){var f=b=g.cloneDocumentElement();r.getElementsByTagNameNS(f,l,"cursor").forEach(c);r.getElementsByTagNameNS(f,l,"anchor").forEach(c);d();u=e=q([e].concat(t));t.length=0;y.length=0;a()}var m=this,l="urn:webodf:names:cursor", +r=core.DomUtils,b,e=[],n,g,u=[],t=[],y=[],v=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged,gui.UndoManager.signalUndoStateCreated,gui.UndoManager.signalUndoStateModified,gui.TrivialUndoManager.signalDocumentRootReplaced]),s=f||new gui.UndoStateRules,x=!1;this.subscribe=function(b,a){v.subscribe(b,a)};this.unsubscribe=function(b,a){v.unsubscribe(b,a)};this.hasUndoStates=function(){return 0<t.length};this.hasRedoStates=function(){return 0<y.length};this.setDocument=function(b){g=b}; +this.purgeInitialState=function(){t.length=0;y.length=0;e.length=0;u.length=0;b=null;a()};this.setInitialState=p;this.initialize=function(){b||p()};this.setPlaybackFunction=function(b){n=b};this.onOperationExecuted=function(b){x||(s.isEditOperation(b)&&(u===e||0<y.length)||!s.isPartOfOperationSet(b,u)?(y.length=0,d(),u=[b],t.push(u),v.emit(gui.UndoManager.signalUndoStateCreated,{operations:u}),a()):(u.push(b),v.emit(gui.UndoManager.signalUndoStateModified,{operations:u})))};this.moveForward=function(b){for(var c= +0,e;b&&y.length;)e=y.pop(),t.push(e),k(e),b-=1,c+=1;c&&(u=t[t.length-1],a());return c};this.moveBackward=function(c){for(var d=0;c&&t.length;)y.push(t.pop()),c-=1,d+=1;d&&(g.getMemberIds().forEach(function(b){g.removeCursor(b)}),g.setDocumentElement(b.cloneNode(!0)),v.emit(gui.TrivialUndoManager.signalDocumentRootReplaced,{}),k(e),t.forEach(k),u=t[t.length-1]||e,a());return d}};gui.TrivialUndoManager.signalDocumentRootReplaced="documentRootReplaced";odf.GraphicProperties=function(f,k,a){var d=this,c=odf.Namespaces.stylens,h=odf.Namespaces.svgns;this.verticalPos=function(){return d.data.value("verticalPos")};this.verticalRel=function(){return d.data.value("verticalRel")};this.horizontalPos=function(){return d.data.value("horizontalPos")};this.horizontalRel=function(){return d.data.value("horizontalRel")};this.strokeWidth=function(){return d.data.value("strokeWidth")};d.data=new odf.LazyStyleProperties(void 0===a?void 0:a.data,{verticalPos:function(){var a= +f.getAttributeNS(c,"vertical-pos");return""===a?void 0:a},verticalRel:function(){var a=f.getAttributeNS(c,"vertical-rel");return""===a?void 0:a},horizontalPos:function(){var a=f.getAttributeNS(c,"horizontal-pos");return""===a?void 0:a},horizontalRel:function(){var a=f.getAttributeNS(c,"horizontal-rel");return""===a?void 0:a},strokeWidth:function(){var a=f.getAttributeNS(h,"stroke-width");return k.parseLength(a)}})}; +odf.ComputedGraphicProperties=function(){var f;this.setGraphicProperties=function(k){f=k};this.verticalPos=function(){return f&&f.verticalPos()||"from-top"};this.verticalRel=function(){return f&&f.verticalRel()||"page"};this.horizontalPos=function(){return f&&f.horizontalPos()||"from-left"};this.horizontalRel=function(){return f&&f.horizontalRel()||"page"}};odf.PageLayoutProperties=function(f,k,a){var d=this,c=odf.Namespaces.fons;this.pageHeight=function(){return d.data.value("pageHeight")||1123};this.pageWidth=function(){return d.data.value("pageWidth")||794};d.data=new odf.LazyStyleProperties(void 0===a?void 0:a.data,{pageHeight:function(){var a;f&&(a=f.getAttributeNS(c,"page-height"),a=k.parseLength(a));return a},pageWidth:function(){var a;f&&(a=f.getAttributeNS(c,"page-width"),a=k.parseLength(a));return a}})}; +odf.PageLayout=function(f,k,a){var d=null;f&&(d=k.getPropertiesElement("page-layout-properties",f));this.pageLayout=new odf.PageLayoutProperties(d,k,a&&a.pageLayout)};odf.PageLayoutCache=function(){};odf.PageLayoutCache.prototype.getPageLayout=function(f){};odf.PageLayoutCache.prototype.getDefaultPageLayout=function(){};odf.ParagraphProperties=function(f,k,a){var d=this,c=odf.Namespaces.fons;this.marginTop=function(){return d.data.value("marginTop")};d.data=new odf.LazyStyleProperties(void 0===a?void 0:a.data,{marginTop:function(){var d=f.getAttributeNS(c,"margin-top");return k.parsePositiveLengthOrPercent(d,"marginTop",a&&a.data)}})}; +odf.ComputedParagraphProperties=function(){var f={},k=[];this.setStyleChain=function(a){k=a;f={}};this.marginTop=function(){var a,d;if(f.hasOwnProperty("marginTop"))a=f.marginTop;else{for(d=0;void 0===a&&d<k.length;d+=1)a=k[d].marginTop();f.marginTop=a}return a||0}};odf.TextProperties=function(f,k,a){var d=this,c=odf.Namespaces.fons;this.fontSize=function(){return d.data.value("fontSize")};d.data=new odf.LazyStyleProperties(void 0===a?void 0:a.data,{fontSize:function(){var d=f.getAttributeNS(c,"font-size");return k.parsePositiveLengthOrPercent(d,"fontSize",a&&a.data)}})}; +odf.ComputedTextProperties=function(){var f={},k=[];this.setStyleChain=function(a){k=a;f={}};this.fontSize=function(){var a,d;if(f.hasOwnProperty("fontSize"))a=f.fontSize;else{for(d=0;void 0===a&&d<k.length;d+=1)a=k[d].fontSize();f.fontSize=a}return a||12}};odf.MasterPage=function(f,k){var a;f?(a=f.getAttributeNS(odf.Namespaces.stylens,"page-layout-name"),this.pageLayout=k.getPageLayout(a)):this.pageLayout=k.getDefaultPageLayout()};odf.MasterPageCache=function(){};odf.MasterPageCache.prototype.getMasterPage=function(f){}; +odf.StylePileEntry=function(f,k,a,d){this.masterPage=function(){var c=f.getAttributeNS(odf.Namespaces.stylens,"master-page-name"),d=null;c&&(d=a.getMasterPage(c));return d};(function(a){var h=f.getAttributeNS(odf.Namespaces.stylens,"family"),q=null;if("graphic"===h||"chart"===h)a.graphic=void 0===d?void 0:d.graphic,q=k.getPropertiesElement("graphic-properties",f,q),null!==q&&(a.graphic=new odf.GraphicProperties(q,k,a.graphic));if("paragraph"===h||"table-cell"===h||"graphic"===h||"presentation"=== +h||"chart"===h)a.paragraph=void 0===d?void 0:d.paragraph,q=k.getPropertiesElement("paragraph-properties",f,q),null!==q&&(a.paragraph=new odf.ParagraphProperties(q,k,a.paragraph));if("text"===h||"paragraph"===h||"table-cell"===h||"graphic"===h||"presentation"===h||"chart"===h)a.text=void 0===d?void 0:d.text,q=k.getPropertiesElement("text-properties",f,q),null!==q&&(a.text=new odf.TextProperties(q,k,a.text))})(this)}; +odf.StylePile=function(f,k){function a(a,b){var c,h;a.hasAttributeNS(d,"parent-style-name")&&(h=a.getAttributeNS(d,"parent-style-name"),-1===b.indexOf(h)&&(c=l(h,b)));return new odf.StylePileEntry(a,f,k,c)}var d=odf.Namespaces.stylens,c={},h={},q,p={},m={},l;l=function(d,b){var e=p[d],f;!e&&(f=c[d])&&(b.push(d),e=a(f,b),p[d]=e);return e};this.getStyle=function(d){var b=m[d]||p[d],e,f=[];b||(e=h[d],e||(e=c[d])&&f.push(d),e&&(b=a(e,f)));return b};this.addCommonStyle=function(a){var b;a.hasAttributeNS(d, +"name")&&(b=a.getAttributeNS(d,"name"),c.hasOwnProperty(b)||(c[b]=a))};this.addAutomaticStyle=function(a){var b;a.hasAttributeNS(d,"name")&&(b=a.getAttributeNS(d,"name"),h.hasOwnProperty(b)||(h[b]=a))};this.setDefaultStyle=function(c){void 0===q&&(q=a(c,[]))};this.getDefaultStyle=function(){return q}};odf.ComputedGraphicStyle=function(){this.text=new odf.ComputedTextProperties;this.paragraph=new odf.ComputedParagraphProperties;this.graphic=new odf.ComputedGraphicProperties}; +odf.ComputedParagraphStyle=function(){this.text=new odf.ComputedTextProperties;this.paragraph=new odf.ComputedParagraphProperties};odf.ComputedTextStyle=function(){this.text=new odf.ComputedTextProperties}; +odf.StyleCache=function(f){function k(b,a,c,e){a=c.getAttributeNS(a,"class-names");var d;if(a)for(a=a.split(" "),d=0;d<a.length;d+=1)if(c=a[d])e.push(b),e.push(c)}function a(b,a){var c=t.getStyleName("paragraph",b);void 0!==c&&(a.push("paragraph"),a.push(c));b.namespaceURI!==g||"h"!==b.localName&&"p"!==b.localName||k("paragraph",g,b,a);return a}function d(b,a,c){var e=[],d,f,g,h;for(d=0;d<b.length;d+=2)g=b[d],h=b[d+1],g=p[g],h=g.getStyle(h),void 0!==h&&(h=h[a],void 0!==h&&h!==f&&(e.push(h),f=h)); +g=p[c];if(h=g.getDefaultStyle())h=h[a],void 0!==h&&h!==f&&e.push(h);return e}function c(b,e){var d=t.getStyleName("text",b),h=b.parentNode;void 0!==d&&(e.push("text"),e.push(d));"span"===b.localName&&b.namespaceURI===g&&k("text",g,b,e);if(!h||h===f)return e;h.namespaceURI!==g||"p"!==h.localName&&"h"!==h.localName?c(h,e):a(h,e);return e}function h(b){b=b.getAttributeNS(u,"family");return p[b]}var q=this,p,m,l,r,b,e,n,g=odf.Namespaces.textns,u=odf.Namespaces.stylens,t=new odf.StyleInfo,y=new odf.StyleParseUtils, +v,s,x,w,B,I;this.getComputedGraphicStyle=function(b){var a=[];b=t.getStyleName("graphic",b);void 0!==b&&(a.push("graphic"),a.push(b));b=a.join("/");var c=r[b];runtime.assert(0===a.length%2,"Invalid style chain.");void 0===c&&(c=new odf.ComputedGraphicStyle,c.graphic.setGraphicProperties(d(a,"graphic","graphic")[0]),c.text.setStyleChain(d(a,"text","graphic")),c.paragraph.setStyleChain(d(a,"paragraph","graphic")),r[b]=c);return c};this.getComputedParagraphStyle=function(b){b=a(b,[]);var c=b.join("/"), +e=l[c];runtime.assert(0===b.length%2,"Invalid style chain.");void 0===e&&(e=new odf.ComputedParagraphStyle,e.text.setStyleChain(d(b,"text","paragraph")),e.paragraph.setStyleChain(d(b,"paragraph","paragraph")),l[c]=e);return e};this.getComputedTextStyle=function(b){b=c(b,[]);var a=b.join("/"),e=m[a];runtime.assert(0===b.length%2,"Invalid style chain.");void 0===e&&(e=new odf.ComputedTextStyle,e.text.setStyleChain(d(b,"text","text")),m[a]=e);return e};this.getPageLayout=function(b){var a=I[b];a||((a= +B[b])?(a=new odf.PageLayout(a,y,w),I[b]=a):a=w);return a};this.getDefaultPageLayout=function(){return w};this.getMasterPage=function(b){var a=s[b];void 0===a&&((a=v[b])?(a=new odf.MasterPage(a,q),s[b]=a):a=null);return a};this.getDefaultMasterPage=function(){return x};this.update=function(){var a,c,d=null,g=null;m={};l={};r={};v={};s={};I={};B={};b=new odf.StylePile(y,q);e=new odf.StylePile(y,q);n=new odf.StylePile(y,q);p={text:b,paragraph:e,graphic:n};for(a=f.styles.firstElementChild;a;)a.namespaceURI=== +u&&((c=h(a))?"style"===a.localName?c.addCommonStyle(a):"default-style"===a.localName&&c.setDefaultStyle(a):"default-page-layout"===a.localName&&(d=a)),a=a.nextElementSibling;w=new odf.PageLayout(d,y);for(a=f.automaticStyles.firstElementChild;a;)a.namespaceURI===u&&((c=h(a))&&"style"===a.localName?c.addAutomaticStyle(a):"page-layout"===a.localName&&(B[a.getAttributeNS(u,"name")]=a)),a=a.nextElementSibling;for(a=f.masterStyles.firstElementChild;a;)a.namespaceURI===u&&"master-page"===a.localName&&(g= +g||a,c=a,d=c.getAttributeNS(u,"name"),0<d.length&&!v.hasOwnProperty(d)&&(v[d]=c)),a=a.nextElementSibling;x=new odf.MasterPage(g,q)}};ops.OperationTransformMatrix=function(){function f(b){b.position+=b.length;b.length*=-1}function k(b){var a=0>b.length;a&&f(b);return a}function a(b,a){function c(f){b[f]===a&&d.push(f)}var d=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return d}function d(b,a){function c(d){b[d]===a&&delete b[d]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function c(b){var a={};Object.keys(b).forEach(function(d){a[d]="object"===typeof b[d]?c(b[d]):b[d]});return a}function h(b, +a,c,d){var f,h=!1,k=!1,m,l=[];d&&d.attributes&&(l=d.attributes.split(","));b&&(c||0<l.length)&&Object.keys(b).forEach(function(a){var e=b[a],d;"object"!==typeof e&&(c&&(d=c[a]),void 0!==d?(delete b[a],k=!0,d===e&&(delete c[a],h=!0)):-1!==l.indexOf(a)&&(delete b[a],k=!0))});if(a&&a.attributes&&(c||0<l.length)){m=a.attributes.split(",");for(d=0;d<m.length;d+=1)if(f=m[d],c&&void 0!==c[f]||l&&-1!==l.indexOf(f))m.splice(d,1),d-=1,k=!0;0<m.length?a.attributes=m.join(","):delete a.attributes}return{majorChanged:h, +minorChanged:k}}function q(b){for(var a in b)if(b.hasOwnProperty(a))return!0;return!1}function p(b){for(var a in b)if(b.hasOwnProperty(a)&&("attributes"!==a||0<b.attributes.length))return!0;return!1}function m(b,a,c,d,f){var k=b?b[f]:null,m=a?a[f]:null,l=c?c[f]:null,r=d?d[f]:null,x;x=h(k,m,l,r);k&&!q(k)&&delete b[f];m&&!p(m)&&delete a[f];l&&!q(l)&&delete c[f];r&&!p(r)&&delete d[f];return x}function l(b,a){return{opSpecsA:[b],opSpecsB:[a]}}var r;r={AddCursor:{AddCursor:l,AddMember:l,AddStyle:l,ApplyDirectStyling:l, +InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},AddMember:{AddStyle:l,ApplyDirectStyling:l,InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMetadata:l,UpdateParagraphStyle:l},AddStyle:{AddStyle:l,ApplyDirectStyling:l,InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveMember:l, +RemoveStyle:function(b,c){var f,g=[b],h=[c];b.styleFamily===c.styleFamily&&(f=a(b.setProperties,c.styleName),0<f.length&&(f={optype:"UpdateParagraphStyle",memberid:c.memberid,timestamp:c.timestamp,styleName:b.styleName,removedProperties:{attributes:f.join(",")}},h.unshift(f)),d(b.setProperties,c.styleName));return{opSpecsA:g,opSpecsB:h}},RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},ApplyDirectStyling:{ApplyDirectStyling:function(b,a,d){var f, +h,k,l,p,r,x,w;l=[b];k=[a];if(!(b.position+b.length<=a.position||b.position>=a.position+a.length)){f=d?b:a;h=d?a:b;if(b.position!==a.position||b.length!==a.length)r=c(f),x=c(h);a=m(h.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)k=[],b=[],l=f.position+f.length,p=h.position+h.length,h.position<f.position?a.minorChanged&&(w=c(x),w.length=f.position-h.position,b.push(w),h.position=f.position,h.length=p-h.position):f.position<h.position&&a.majorChanged&& +(w=c(r),w.length=h.position-f.position,k.push(w),f.position=h.position,f.length=l-f.position),p>l?a.minorChanged&&(r=x,r.position=l,r.length=p-l,b.push(r),h.length=l-h.position):l>p&&a.majorChanged&&(r.position=p,r.length=l-p,k.push(r),f.length=p-f.position),f.setProperties&&q(f.setProperties)&&k.push(f),h.setProperties&&q(h.setProperties)&&b.push(h),d?(l=k,k=b):l=b}return{opSpecsA:l,opSpecsB:k}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&& +(b.length+=a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,d=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);d>=a.sourceStartPosition&&(d-=1);b.position=c;b.length=d-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=b.position?b.position-=a.length:a.position<c&&(b.position<a.position?b.length=d<c?b.length-a.length: +a.position-b.position:(b.position=a.position,d<c?b.length=c-d:f=[]));return{opSpecsA:f,opSpecsB:h}},SetParagraphStyle:l,SplitParagraph:function(b,a){a.position<b.position?b.position+=1:a.position<b.position+b.length&&(b.length+=1);return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},InsertText:{InsertText:function(b,a,c){b.position<a.position?a.position+=b.text.length:b.position>a.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length; +return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){b.position>=a.sourceStartPosition?b.position-=1:(b.position<a.sourceStartPosition&&(a.sourceStartPosition+=b.text.length),b.position<a.destinationStartPosition&&(a.destinationStartPosition+=b.text.length));return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:function(b,a){var c=k(a);b.position<a.position?a.position+=b.text.length:b.position<a.position+a.length&&(a.length+=b.text.length);c&&f(a);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l, +RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c;c=a.position+a.length;var d=[b],f=[a];c<=b.position?b.position-=a.length:b.position<=a.position?a.position+=b.text.length:(a.length=b.position-a.position,c={optype:"RemoveText",memberid:a.memberid,timestamp:a.timestamp,position:b.position+b.text.length,length:c-b.position},f.unshift(c),b.position=a.position);return{opSpecsA:d,opSpecsB:f}},SetParagraphStyle:function(b,a){a.position>b.position&&(a.position+=b.text.length);return{opSpecsA:[b], +opSpecsB:[a]}},SplitParagraph:function(b,a){b.position<a.sourceParagraphPosition&&(a.sourceParagraphPosition+=b.text.length);b.position<=a.position?a.position+=b.text.length:b.position+=1;return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MergeParagraph:{MergeParagraph:function(b,a,c){var d=[b],f=[a],h;b.destinationStartPosition===a.destinationStartPosition?(d=[],f=[],b.moveCursor&&(h={optype:"MoveCursor",memberid:b.memberid,timestamp:b.timestamp,position:b.sourceStartPosition- +1},d.push(h)),a.moveCursor&&(h={optype:"MoveCursor",memberid:a.memberid,timestamp:a.timestamp,position:a.sourceStartPosition-1},f.push(h)),b=c?b:a,b={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,position:b.destinationStartPosition,styleName:b.paragraphStyleName},c?d.push(b):f.push(b)):a.sourceStartPosition===b.destinationStartPosition?(b.destinationStartPosition=a.destinationStartPosition,b.sourceStartPosition-=1,b.paragraphStyleName=a.paragraphStyleName):b.sourceStartPosition=== +a.destinationStartPosition?(a.destinationStartPosition=b.destinationStartPosition,a.sourceStartPosition-=1,a.paragraphStyleName=b.paragraphStyleName):b.destinationStartPosition<a.destinationStartPosition?(a.destinationStartPosition-=1,a.sourceStartPosition-=1):(b.destinationStartPosition-=1,b.sourceStartPosition-=1);return{opSpecsA:d,opSpecsB:f}},MoveCursor:function(b,a){var c=a.position,d=a.position+a.length,f=Math.min(c,d),c=Math.max(c,d);f>=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&& +(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.position<b.destinationStartPosition&&(b.destinationStartPosition-=a.length),a.position<b.sourceStartPosition&&(b.sourceStartPosition-=a.length));return{opSpecsA:[b],opSpecsB:[a]}},SetParagraphStyle:function(b,a){var c=[b],d=[a];if(a.position>b.sourceStartPosition)a.position-= +1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:d}},SplitParagraph:function(b,a){var c,d=[b],f=[a];a.position<b.destinationStartPosition?(b.destinationStartPosition+=1,b.sourceStartPosition+=1):a.position>=b.destinationStartPosition&&a.position<b.sourceStartPosition?(a.paragraphStyleName=b.paragraphStyleName,c={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp, +position:b.destinationStartPosition,styleName:b.paragraphStyleName},d.push(c),a.position===b.sourceStartPosition-1&&b.moveCursor&&(c={optype:"MoveCursor",memberid:b.memberid,timestamp:b.timestamp,position:a.position,length:0},d.push(c)),b.destinationStartPosition=a.position+1,b.sourceStartPosition+=1):a.position>=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:d,opSpecsB:f}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MoveCursor:{MoveCursor:l,RemoveCursor:function(b, +a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=k(b),d=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.position<d&&(b.position<a.position?b.length=h<d?b.length-a.length:a.position-b.position:(b.position=a.position,b.length=h<d?d-h:0));c&&f(b);return{opSpecsA:[b],opSpecsB:[a]}},SetParagraphStyle:l,SplitParagraph:function(b,a){var c=k(b);a.position<b.position?b.position+=1:a.position<b.position+ +b.length&&(b.length+=1);c&&f(b);return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveCursor:{RemoveCursor:function(b,a){var c=b.memberid===a.memberid;return{opSpecsA:c?[]:[b],opSpecsB:c?[]:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveMember:{RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveStyle:{RemoveStyle:function(b, +a){var c=b.styleName===a.styleName&&b.styleFamily===a.styleFamily;return{opSpecsA:c?[]:[b],opSpecsB:c?[]:[a]}},RemoveText:l,SetParagraphStyle:function(b,a){var c,d=[b],f=[a];"paragraph"===b.styleFamily&&b.styleName===a.styleName&&(c={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,position:a.position,styleName:""},d.unshift(c),a.styleName="");return{opSpecsA:d,opSpecsB:f}},SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:function(b,c){var f,g=[b],h=[c];"paragraph"=== +b.styleFamily&&(f=a(c.setProperties,b.styleName),0<f.length&&(f={optype:"UpdateParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,styleName:c.styleName,removedProperties:{attributes:f.join(",")}},g.unshift(f)),b.styleName===c.styleName?h=[]:d(c.setProperties,b.styleName));return{opSpecsA:g,opSpecsB:h}}},RemoveText:{RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=b.position?b.position-=a.length:c<=a.position?a.position-=b.length:a.position<c&&(b.position< +a.position?(b.length=d<c?b.length-a.length:a.position-b.position,c<d?(a.position=b.position,a.length=d-c):h=[]):(c<d?a.length-=b.length:a.position<b.position?a.length=b.position-a.position:h=[],d<c?(b.position=a.position,b.length=c-d):f=[]));return{opSpecsA:f,opSpecsB:h}},SetParagraphStyle:function(b,a){b.position<a.position&&(a.position-=b.length);return{opSpecsA:[b],opSpecsB:[a]}},SplitParagraph:function(a,c){var d=a.position+a.length,f=[a],h=[c];c.position<=a.position?a.position+=1:c.position< +d&&(a.length=c.position-a.position,d={optype:"RemoveText",memberid:a.memberid,timestamp:a.timestamp,position:c.position+1,length:d-c.position},f.unshift(d));a.position+a.length<=c.position?c.position-=a.length:a.position<c.position&&(c.position=a.position);a.position+a.length<c.sourceParagraphPosition&&(c.sourceParagraphPosition-=a.length);return{opSpecsA:f,opSpecsB:h}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SetParagraphStyle:{SetParagraphStyle:function(a,c,d){a.position===c.position&& +(d?c.styleName=a.styleName:a.styleName=c.styleName);return{opSpecsA:[a],opSpecsB:[c]}},SplitParagraph:function(a,d){var f=[a],g=[d],h;a.position>d.position?a.position+=1:a.position===d.sourceParagraphPosition&&(d.paragraphStyleName=a.styleName,h=c(a),h.position=d.position+1,f.push(h));return{opSpecsA:f,opSpecsB:g}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SplitParagraph:{SplitParagraph:function(a,c,d){var f,h;a.position<c.position?f=!0:c.position<a.position?h=!0:a.position===c.position&& +(d?f=!0:h=!0);f?(c.position+=1,c.sourceParagraphPosition=a.position<c.sourceParagraphPosition?c.sourceParagraphPosition+1:a.position+1):h&&(a.position+=1,a.sourceParagraphPosition=c.position<c.sourceParagraphPosition?a.sourceParagraphPosition+1:c.position+1);return{opSpecsA:[a],opSpecsB:[c]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},UpdateMember:{UpdateMetadata:l,UpdateParagraphStyle:l},UpdateMetadata:{UpdateMetadata:function(a,c,d){var f,k=[a],l=[c];f=d?a:c;a=d?c:a;h(a.setProperties|| +null,a.removedProperties||null,f.setProperties||null,f.removedProperties||null);f.setProperties&&q(f.setProperties)||f.removedProperties&&p(f.removedProperties)||(d?k=[]:l=[]);a.setProperties&&q(a.setProperties)||a.removedProperties&&p(a.removedProperties)||(d?l=[]:k=[]);return{opSpecsA:k,opSpecsB:l}},UpdateParagraphStyle:l},UpdateParagraphStyle:{UpdateParagraphStyle:function(a,c,d){var f,k=[a],l=[c];a.styleName===c.styleName&&(f=d?a:c,a=d?c:a,m(a.setProperties,a.removedProperties,f.setProperties, +f.removedProperties,"style:paragraph-properties"),m(a.setProperties,a.removedProperties,f.setProperties,f.removedProperties,"style:text-properties"),h(a.setProperties||null,a.removedProperties||null,f.setProperties||null,f.removedProperties||null),f.setProperties&&q(f.setProperties)||f.removedProperties&&p(f.removedProperties)||(d?k=[]:l=[]),a.setProperties&&q(a.setProperties)||a.removedProperties&&p(a.removedProperties)||(d?l=[]:k=[]));return{opSpecsA:k,opSpecsB:l}}}};this.passUnchanged=l;this.extendTransformations= +function(a){Object.keys(a).forEach(function(c){var d=a[c],f,h=r.hasOwnProperty(c);runtime.log((h?"Extending":"Adding")+" map for optypeA: "+c);h||(r[c]={});f=r[c];Object.keys(d).forEach(function(a){var b=f.hasOwnProperty(a);runtime.assert(c<=a,"Wrong order:"+c+", "+a);runtime.log(" "+(b?"Overwriting":"Adding")+" entry for optypeB: "+a);f[a]=d[a]})})};this.transformOpspecVsOpspec=function(a,c){var d=a.optype<=c.optype,f;runtime.log("Crosstransforming:");runtime.log(runtime.toJson(a));runtime.log(runtime.toJson(c)); +d||(f=a,a=c,c=f);(f=(f=r[a.optype])&&f[c.optype])?(f=f(a,c,!d),d||null===f||(f={opSpecsA:f.opSpecsB,opSpecsB:f.opSpecsA})):f=null;runtime.log("result:");f?(runtime.log(runtime.toJson(f.opSpecsA)),runtime.log(runtime.toJson(f.opSpecsB))):runtime.log("null");return f}};ops.OperationTransformer=function(){function f(a,d){for(var c,h,q=[],p=[];0<a.length&&d;){c=a.shift();c=k.transformOpspecVsOpspec(c,d);if(!c)return null;q=q.concat(c.opSpecsA);if(0===c.opSpecsB.length){q=q.concat(a);d=null;break}for(;1<c.opSpecsB.length;){h=f(a,c.opSpecsB.shift());if(!h)return null;p=p.concat(h.opSpecsB);a=h.opSpecsA}d=c.opSpecsB.pop()}d&&p.push(d);return{opSpecsA:q,opSpecsB:p}}var k=new ops.OperationTransformMatrix;this.getOperationTransformMatrix=function(){return k};this.transform= +function(a,d){for(var c,h=[];0<d.length;){c=f(a,d.shift());if(!c)return null;a=c.opSpecsA;h=h.concat(c.opSpecsB)}return{opSpecsA:a,opSpecsB:h}}};var webodf_css='@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);@namespace webodfhelper url(urn:webodf:names:helper);@namespace cursor url(urn:webodf:names:cursor);@namespace editinfo url(urn:webodf:names:editinfo);@namespace annotation url(urn:webodf:names:annotation);@namespace dc url(http://purl.org/dc/elements/1.1/);@namespace svgns url(http://www.w3.org/2000/svg);office|document > *, office|document-content > * {display: none;}office|body, office|document {display: inline-block;position: relative;}text|p, text|h {display: block;padding: 0;margin: 0;line-height: normal;position: relative;}text|p::after, text|h::after {content: "\\200B";white-space: pre;}*[webodfhelper|containsparagraphanchor] {position: relative;}text|s {white-space: pre;}text|tab {display: inline;white-space: pre;}text|tracked-changes {display: none;}office|binary-data {display: none;}office|text {display: block;text-align: left;overflow: visible;word-wrap: break-word;}office|text::selection {background: transparent;}.webodf-virtualSelections *::selection {background: transparent;}.webodf-virtualSelections *::-moz-selection {background: transparent;}office|text * draw|text-box {display: block;border: 1px solid #d3d3d3;}office|text draw|frame {z-index: 1;}office|spreadsheet {display: block;border-collapse: collapse;empty-cells: show;font-family: sans-serif;font-size: 10pt;text-align: left;page-break-inside: avoid;overflow: hidden;}office|presentation {display: inline-block;text-align: left;}#shadowContent {display: inline-block;text-align: left;}draw|page {display: block;position: relative;overflow: hidden;}presentation|notes, presentation|footer-decl, presentation|date-time-decl {display: none;}@media print {draw|page {border: 1pt solid black;page-break-inside: avoid;}presentation|notes {}}office|spreadsheet text|p {border: 0px;padding: 1px;margin: 0px;}office|spreadsheet table|table {margin: 3px;}office|spreadsheet table|table:after {}office|spreadsheet table|table-row {counter-increment: row;}office|spreadsheet table|table-row:before {width: 3em;background: #cccccc;border: 1px solid black;text-align: center;content: counter(row);display: table-cell;}office|spreadsheet table|table-cell {border: 1px solid #cccccc;}table|table {display: table;}draw|frame table|table {width: 100%;height: 100%;background: white;}table|table-header-rows {display: table-header-group;}table|table-row {display: table-row;}table|table-column {display: table-column;}table|table-cell {width: 0.889in;display: table-cell;word-break: break-all;}draw|frame {display: block;}draw|image {display: block;width: 100%;height: 100%;top: 0px;left: 0px;background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%;}draw|frame > draw|image:nth-of-type(n+2) {display: none;}text|list:before {display: none;content:"";}text|list {display: block;}text|list-item {display: block;}text|number {display:none;}text|a {color: blue;text-decoration: underline;cursor: pointer;}.webodf-inactiveLinks text|a {cursor: text;}text|note-citation {vertical-align: super;font-size: smaller;}text|note-body {display: none;}text|note:hover text|note-citation {background: #dddddd;}text|note:hover text|note-body {display: block;left:1em;max-width: 80%;position: absolute;background: #ffffaa;}text|bibliography-source {display: none;}svg|title, svg|desc {display: none;}video {width: 100%;height: 100%}cursor|anchor {display: none;}cursor|cursor {display: none;}.webodf-caretOverlay {position: absolute;top: 5%;height: 1em;z-index: 10;padding-left: 1px;pointer-events: none;}.webodf-caretOverlay .caret {position: absolute;border-left: 2px solid black;top: 0;bottom: 0;right: 0;}.webodf-caretOverlay .handle {position: absolute;margin-top: 5px;padding-top: 3px;margin-left: auto;margin-right: auto;width: 64px;height: 68px;border-radius: 5px;opacity: 0.3;text-align: center;background-color: black;box-shadow: 0px 0px 5px rgb(90, 90, 90);border: 1px solid black;top: -85px;right: -32px;}.webodf-caretOverlay .handle > img {box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;background-color: rgb(200, 200, 200);border-radius: 5px;border: 2px solid;height: 60px;width: 60px;display: block;margin: auto;}.webodf-caretOverlay .handle.active {opacity: 0.8;}.webodf-caretOverlay .handle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 43%;}.webodf-caretSizer {display: inline-block;width: 0;visibility: hidden;}#eventTrap {display: block;position: absolute;bottom: 0;left: 0;outline: none;opacity: 0;color: rgba(255, 255, 255, 0);pointer-events: none;white-space: pre;overflow: hidden;}cursor|cursor > #composer {text-decoration: underline;}cursor|cursor[cursor|caret-sizer-active="true"],cursor|cursor[cursor|composing="true"] {display: inline;}editinfo|editinfo {display: inline-block;}.editInfoMarker {position: absolute;width: 10px;height: 100%;left: -20px;opacity: 0.8;top: 0;border-radius: 5px;background-color: transparent;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);}.editInfoMarker:hover {box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);}.editInfoHandle {position: absolute;background-color: black;padding: 5px;border-radius: 5px;opacity: 0.8;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);bottom: 100%;margin-bottom: 10px;z-index: 3;left: -25px;}.editInfoHandle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 5px;}.editInfo {font-family: sans-serif;font-weight: normal;font-style: normal;text-decoration: none;color: white;width: 100%;height: 12pt;}.editInfoColor {float: left;width: 10pt;height: 10pt;border: 1px solid white;}.editInfoAuthor {float: left;margin-left: 5pt;font-size: 10pt;text-align: left;height: 12pt;line-height: 12pt;}.editInfoTime {float: right;margin-left: 30pt;font-size: 8pt;font-style: italic;color: yellow;height: 12pt;line-height: 12pt;}.annotationWrapper {display: inline;position: relative;}.annotationRemoveButton:before {content: "\u00d7";color: white;padding: 5px;line-height: 1em;}.annotationRemoveButton {width: 20px;height: 20px;border-radius: 10px;background-color: black;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);position: absolute;top: -10px;left: -10px;z-index: 3;text-align: center;font-family: sans-serif;font-style: normal;font-weight: normal;text-decoration: none;font-size: 15px;}.annotationRemoveButton:hover {cursor: pointer;box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);}.annotationNote {width: 4cm;position: absolute;display: inline;z-index: 10;top: 0;}.annotationNote > office|annotation {display: block;text-align: left;}.annotationConnector {position: absolute;display: inline;top: 0;z-index: 2;border-top: 1px dashed brown;}.annotationConnector.angular {-moz-transform-origin: left top;-webkit-transform-origin: left top;-ms-transform-origin: left top;transform-origin: left top;}.annotationConnector.horizontal {left: 0;}.annotationConnector.horizontal:before {content: "";display: inline;position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: brown transparent transparent transparent;top: -1px;left: -5px;}office|annotation {width: 100%;height: 100%;display: none;background: rgb(198, 238, 184);background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);box-shadow: 0 3px 4px -3px #ccc;}office|annotation > dc|creator {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;color: white;background-color: brown;padding: 4px;}office|annotation > dc|date {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;border: 4px solid transparent;color: black;}office|annotation > text|list {display: block;padding: 5px;}office|annotation text|p {font-size: 10pt;color: black;font-weight: normal;font-style: normal;text-decoration: none;font-family: sans-serif;}#annotationsPane {background-color: #EAEAEA;width: 4cm;height: 100%;display: none;position: absolute;outline: 1px solid #ccc;}.webodf-annotationHighlight {background-color: yellow;position: relative;}.webodf-selectionOverlay {position: absolute;pointer-events: none;top: 0;left: 0;top: 0;left: 0;width: 100%;height: 100%;z-index: 15;}.webodf-selectionOverlay > polygon {fill-opacity: 0.3;stroke-opacity: 0.8;stroke-width: 1;fill-rule: evenodd;}.webodf-selectionOverlay > .webodf-draggable {fill-opacity: 0.8;stroke-opacity: 0;stroke-width: 8;pointer-events: all;display: none;-moz-transform-origin: center center;-webkit-transform-origin: center center;-ms-transform-origin: center center;transform-origin: center center;}#imageSelector {display: none;position: absolute;border-style: solid;border-color: black;}#imageSelector > div {width: 5px;height: 5px;display: block;position: absolute;border: 1px solid black;background-color: #ffffff;}#imageSelector > .topLeft {top: -4px;left: -4px;}#imageSelector > .topRight {top: -4px;right: -4px;}#imageSelector > .bottomRight {right: -4px;bottom: -4px;}#imageSelector > .bottomLeft {bottom: -4px;left: -4px;}#imageSelector > .topMiddle {top: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .rightMiddle {top: 50%;right: -4px;margin-top: -2.5px;}#imageSelector > .bottomMiddle {bottom: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .leftMiddle {top: 50%;left: -4px;margin-top: -2.5px;}div.webodf-customScrollbars::-webkit-scrollbar{width: 8px;height: 8px;background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-track{background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-thumb{background-color: #444;border-radius: 4px;}.webodf-hyperlinkTooltip {display: none;color: white;background-color: black;border-radius: 5px;box-shadow: 2px 2px 5px gray;padding: 3px;position: absolute;max-width: 210px;text-align: left;word-break: break-all;z-index: 16;}.webodf-hyperlinkTooltipText {display: block;font-weight: bold;}';
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/tasklist/composer.json -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/tasklist/composer.json
Changed
@@ -21,7 +21,7 @@ "require": { "php": ">=5.3.0", "roundcube/plugin-installer": ">=0.1.3", - "kolab/libcalendaring": ">=3.2.3", + "kolab/libcalendaring": ">=3.2.4", "roundcube/jqueryui": ">=1.10.4" } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/tasklist/drivers/database/tasklist_database_driver.php -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/tasklist/drivers/database/tasklist_database_driver.php
Changed
@@ -770,7 +770,7 @@ // convert legacy alarms data else if (strlen($alarms)) { list($trigger, $action) = explode(':', $alarms, 2); - if ($trigger = libcalendaring::parse_alaram_value($trigger)) { + if ($trigger = libcalendaring::parse_alarm_value($trigger)) { $valarms = array(array('action' => $action, 'trigger' => $trigger[3] ?: $trigger[0])); } }
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/tasklist/skins/larry/tasklist.css -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/tasklist/skins/larry/tasklist.css
Changed
@@ -903,7 +903,7 @@ } #taskedit .edit-attendees-table tbody td { - padding: 4px 7px; + padding: 5px 7px 6px; } #taskedit .edit-attendees-table tbody tr:last-child td { @@ -955,7 +955,15 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; +} + +#taskedit .edit-attendees-table td.name .attendee-name { + display: block; position: relative; + overflow: hidden; + text-overflow: ellipsis; + padding: 5px 7px 6px 4px; + margin: -5px -7px -6px; } #taskedit .edit-attendees-table td.name select {
View file
roundcubemail-plugins-kolab-3.2.3.tar.gz/plugins/tasklist/tasklist.js -> roundcubemail-plugins-kolab-3.2.4.tar.gz/plugins/tasklist/tasklist.js
Changed
@@ -1720,7 +1720,7 @@ rcmail.gettext('expandattendeegroup','libcalendaring') + '</a>'; } - var html = '<td class="name">' + dispname + '</td>' + + var html = '<td class="name"><span class="attendee-name">' + dispname + '</span></td>' + '<td class="confirmstate"><span class="' + String(data.status).toLowerCase() + '" title="' + Q(tooltip) + '">' + Q(data.status || '') + '</span></td>' + (data.cutype != 'RESOURCE' ? '<td class="invite">' + (readonly || !invbox ? '' : invbox) + '</td>' : '') + '<td class="options">' + (readonly ? '' : dellink) + '</td>'; @@ -1736,7 +1736,7 @@ tr.find('a.deletelink').click({ id:(data.email || data.name) }, function(e) { remove_attendee(this, e.data.id); return false; }); tr.find('a.mailtolink').click(task_attendee_click); - tr.find('a.expandlink').click(data, function(e) { me.expand_attendee_group(e, add_attendee, remove_attendee); }); + tr.find('a.expandlink').click(data, function(e) { me.expand_attendee_group(e, add_attendee, remove_attendee); return false; }); tr.find('input.edit-attendee-reply').click(function() { var enabled = $('#edit-attendees-invite:checked').length || $('input.edit-attendee-reply:checked').length; $('#taskeditform .attendees-commentbox')[enabled ? 'show' : 'hide']();
View file
roundcubemail-plugins-kolab.dsc
Changed
@@ -2,7 +2,7 @@ Source: roundcubemail-plugins-kolab Binary: roundcubemail-plugins-kolab Architecture: all -Version: 1:3.2.3-0~kolab3 +Version: 1:3.2.4-0~kolab1 Maintainer: Christoph Wickert <wickert@kolabsys.com> Uploaders: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>, Paul Klos <kolab@klos2day.nl> Standards-Version: 3.9.3 @@ -10,5 +10,5 @@ Package-List: roundcubemail-plugins-kolab deb web extra Files: - 00000000000000000000000000000000 0 roundcubemail-plugins-kolab-3.2.3.tar.gz + 00000000000000000000000000000000 0 roundcubemail-plugins-kolab-3.2.4.tar.gz 00000000000000000000000000000000 0 debian.tar.gz
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.