MCPcopy
hub / github.com/audreyt/ethercalc / l

Function l

static/ethercalc.js:3–3  ·  view source on GitHub ↗
(e,t)

Source from the content-addressed store, hash-verified

1// Auto-generated from "make depends"; ALL CHANGES HERE WILL BE LOST!
2!function(e,t){"function"==typeof define&&define.amd?define([],t.bind(e,this)):"object"==typeof module&&module.exports?module.exports=t.call(e,this):e.SocialCalc=t.call(e,this)}(this,function(e){var t;t||(t={}),t.Constants={cellDataType:{v:"value",n:"value",t:"text",f:"formula",c:"constant"},textdatadefaulttype:"t",s_BrowserNotSupported:"Browser not supported.",s_InternalError:"Internal SocialCalc error (probably an internal bug): ",s_pssUnknownColType:"Unknown col type item",s_pssUnknownRowType:"Unknown row type item",s_pssUnknownLineType:"Unknown line type",s_cfspUnknownCellType:"Unknown cell type item",doCanonicalizeSheet:!0,s_escUnknownSheetCmd:"Unknown sheet command: ",s_escUnknownSetCoordCmd:"Unknown set coord command: ",s_escUnknownCmd:"Unknown command: ",s_caccCircRef:"Circular reference to ",defaultRowNameWidth:"30",defaultAssumedRowHeight:15,defaultCellIDPrefix:"cell_",defaultCellLayout:"padding:2px 2px 1px 2px;vertical-align:top;",defaultCellFontStyle:"normal normal",defaultCellFontSize:"small",defaultCellFontFamily:"Verdana,Arial,Helvetica,sans-serif",defaultPaneDividerWidth:"3",defaultPaneDividerHeight:"3",defaultGridCSS:"1px solid #C0C0C0;",defaultCommentClass:"",defaultCommentStyle:"background-repeat:no-repeat;background-position:top right;background-image:url(images/sc-commentbg.gif);",defaultCommentNoGridClass:"",defaultCommentNoGridStyle:"",defaultReadonlyClass:"",defaultReadonlyStyle:"background-repeat:no-repeat;background-position:top right;background-image:url(images/sc-lockbg.gif);",defaultReadonlyNoGridClass:"",defaultReadonlyNoGridStyle:"",defaultReadonlyComment:"Locked cell",defaultColWidth:"80",defaultMinimumColWidth:10,defaultHighlightTypeCursorClass:"",defaultHighlightTypeCursorStyle:"color:#FFF;backgroundColor:#A6A6A6;",defaultHighlightTypeRangeClass:"",defaultHighlightTypeRangeStyle:"color:#000;backgroundColor:#E5E5E5;",defaultColnameClass:"",defaultColnameStyle:"overflow:visible;font-size:small;text-align:center;color:#FFFFFF;background-color:#808080;",defaultSelectedColnameClass:"",defaultSelectedColnameStyle:"overflow:visible;font-size:small;text-align:center;color:#FFFFFF;background-color:#404040;",defaultRownameClass:"",defaultRownameStyle:"position:relative;overflow:visible;font-size:small;text-align:right;color:#FFFFFF;background-color:#808080;",defaultSelectedRownameClass:"",defaultSelectedRownameStyle:"position:relative;overflow:visible;font-size:small;text-align:right;color:#FFFFFF;background-color:#404040;",defaultUpperLeftClass:"",defaultUpperLeftStyle:"font-size:small;",defaultSkippedCellClass:"",defaultSkippedCellStyle:"font-size:small;background-color:#CCC",defaultPaneDividerClass:"",defaultPaneDividerStyle:"font-size:small;background-color:#C0C0C0;padding:0px;",defaultUnhideLeftClass:"",defaultUnhideLeftStyle:"float:right;width:9px;height:12px;cursor:pointer;background-image:url(images/sc-unhideleft.gif);padding:0;",defaultUnhideRightClass:"",defaultUnhideRightStyle:"float:left;width:9px;height:12px;cursor:pointer;background-image:url(images/sc-unhideright.gif);padding:0;",defaultUnhideTopClass:"",defaultUnhideTopStyle:"float:left;left:1px;position:absolute;bottom:-4px;width:12px;height:9px;cursor:pointer;background-image:url(images/sc-unhidetop.gif);padding:0;",defaultUnhideBottomClass:"",defaultUnhideBottomStyle:"float:left;width:12px;height:9px;cursor:pointer;background-image:url(images/sc-unhidebottom.gif);padding:0;",defaultColResizeBarClass:"col-resize-bar",defaultRowResizeBarClass:"row-resize-bar",s_rcMissingSheet:"Render Context must have a sheet object",defaultLinkFormatString:'<span style="font-size:smaller;text-decoration:none !important;background-color:#66B;color:#FFF;">Link</span>',defaultPageLinkFormatString:'<span style="font-size:smaller;text-decoration:none !important;background-color:#66B;color:#FFF;">Page</span>',defaultFormatp:"#,##0.0%",defaultFormatc:"[$$]#,##0.00",defaultFormatdt:"d-mmm-yyyy h:mm:ss",defaultFormatd:"d-mmm-yyyy",defaultFormatt:"[h]:mm:ss",defaultDisplayTRUE:"TRUE",defaultDisplayFALSE:"FALSE",defaultImagePrefix:"images/sc_",defaultTableEditorIDPrefix:"te_",defaultPageUpDnAmount:15,AllowCtrlS:!0,defaultTableControlThickness:20,cteGriddivClass:"",s_statusline_executing:"Executing...",s_statusline_displaying:"Displaying...",s_statusline_ordering:"Ordering...",s_statusline_calculating:"Calculating...",s_statusline_calculatingls:"Calculating... Loading Sheet...",s_statusline_doingserverfunc:"doing server function ",s_statusline_incell:" in cell ",s_statusline_calcstart:"Calculation start...",s_statusline_sum:"SUM",s_statusline_recalcneeded:'<span style="color:#999;">(Recalc needed)</span>',s_statusline_circref:'<span style="color:red;">Circular reference: ',s_statusline_sendemail:"Sending Email ",s_inputboxdisplaymultilinetext:"[Multi-line text: Click icon on right to edit]",defaultInputEchoClass:"",defaultInputEchoStyle:"filter:alpha(opacity=90);opacity:.9;backgroundColor:#FFD;border:1px solid #884;fontSize:small;padding:2px 10px 1px 2px;cursor:default;",defaultInputEchoPromptClass:"",defaultInputEchoPromptStyle:"filter:alpha(opacity=90);opacity:.9;backgroundColor:#FFD;borderLeft:1px solid #884;borderRight:1px solid #884;borderBottom:1px solid #884;fontSize:small;fontStyle:italic;padding:2px 10px 1px 2px;cursor:default;",defaultInputEchoHintClass:"",defaultInputEchoHintStyle:"filter:alpha(opacity=80);opacity:.8;backgroundColor:#884;border:1px solid #884;fontSize:small;fontWeight:bold;padding:2px 2px 2px 2px;color:#FFF;position:absolute;top:-20px;cursor:default;",ietUnknownFunction:"Unknown function ",CH_radius1:29,CH_radius2:41,s_CHfillAllTooltip:"Fill Contents and Formats Down/Right",s_CHfillContentsTooltip:"Fill Contents Only Down/Right",s_CHmovePasteAllTooltip:"Move Contents and Formats",s_CHmovePasteContentsTooltip:"Move Contents Only",s_CHmoveInsertAllTooltip:"Slide Contents and Formats within Row/Col",s_CHmoveInsertContentsTooltip:"Slide Contents within Row/Col",s_CHindicatorOperationLookup:{Fill:"Fill",FillC:"Fill Contents",Move:"Move",MoveI:"Slide",MoveC:"Move Contents",MoveIC:"Slide Contents"},s_CHindicatorDirectionLookup:{Down:" Down",Right:" Right",Horizontal:" Horizontal",Vertical:" Vertical"},defaultTCSliderThickness:9,defaultTCButtonThickness:20,defaultTCThumbThickness:15,TCmainStyle:"backgroundColor:#EEE;",TCmainClass:"",TCendcapStyle:"backgroundColor:#FFF;",TCendcapClass:"",TCpanesliderClass:"tc-paneslider",s_panesliderTooltiph:"Drag to lock pane vertically",s_panesliderTooltipv:"Drag to lock pane horizontally",TClessbuttonStyle:"backgroundColor:#AAA;",TClessbuttonClass:"",TClessbuttonRepeatWait:300,TClessbuttonRepeatInterval:20,TCmorebuttonStyle:"backgroundColor:#AAA;",TCmorebuttonClass:"",TCmorebuttonRepeatWait:300,TCmorebuttonRepeatInterval:20,TCscrollareaStyle:"backgroundColor:#DDD;",TCscrollareaClass:"",TCscrollareaRepeatWait:500,TCscrollareaRepeatInterval:100,TCthumbClass:"",TCthumbStyle:"backgroundColor:#CCC;",TCPStrackinglineClass:"tracklingine",TCPStrackinglineStyle:"overflow:hidden;position:absolute;zIndex:100;",TCPStrackinglineThickness:"2px",TCTDFSthumbstatusvClass:"",TCTDFSthumbstatusvStyle:"height:20px;width:auto;border:3px solid #808080;overflow:hidden;backgroundColor:#FFF;fontSize:small;position:absolute;zIndex:100;",TCTDFSthumbstatushClass:"",TCTDFSthumbstatushStyle:"height:20px;width:auto;border:1px solid black;padding:2px;backgroundColor:#FFF;fontSize:small;position:absolute;zIndex:100;",TCTDFSthumbstatusrownumClass:"",TCTDFSthumbstatusrownumStyle:"color:#FFF;background-color:#808080;font-size:small;white-space:nowrap;padding:3px;",TCTDFStopOffsetv:0,TCTDFSleftOffsetv:-80,s_TCTDFthumbstatusPrefixv:"Row ",TCTDFStopOffseth:-30,TCTDFSleftOffseth:0,s_TCTDFthumbstatusPrefixh:"Col ",TooltipOffsetX:2,TooltipOffsetY:10,TDpopupElementClass:"",TDpopupElementStyle:"border:1px solid black;padding:1px 2px 2px 2px;textAlign:center;backgroundColor:#FFF;fontSize:7pt;fontFamily:Verdana,Arial,Helvetica,sans-serif;position:absolute;width:auto;zIndex:110;",SCToolbarbackground:"background-color:#ffffff;",SCTabbackground:"background-color:#CCC;",SCTabselectedCSS:"font-size:small;padding:6px 30px 6px 8px;color:#FFF;background-color:#404040;cursor:default;border-right:1px solid #CCC;",SCTabplainCSS:"font-size:small;padding:6px 30px 6px 8px;color:#FFF;background-color:#808080;cursor:default;border-right:1px solid #CCC;",SCToolbartext:"font-size:x-small;font-weight:bold;color:#888",SCFormulabarheight:30,SCStatuslineheight:20,SCStatuslineCSS:"font-size:10px;padding:3px 0px;",SCFormatNumberFormats:"[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!Automatic!:general|%loc!Auto w/ commas!:[,]General|[break]:|00:00|000:000|0000:0000|00000:00000|[break]:|%loc!Formula!:formula|%loc!Hidden!:hidden|[newcol]:1234:0|1,234:#,##0|1,234.5:#,##0.0|1,234.56:#,##0.00|1,234.567:#,##0.000|1,234.5678:#,##0.0000|[break]:|1,234%:#,##0%|1,234.5%:#,##0.0%|1,234.56%:#,##0.00%|[newcol]:|$1,234:$#,##0|$1,234.5:$#,##0.0|$1,234.56:$#,##0.00|[break]:|(1,234):#,##0_);(#,##0)|(1,234.5):#,##0.0_);(#,##0.0)|(1,234.56):#,##0.00_);(#,##0.00)|[break]:|($1,234):$#,##0_);($#,##0)|($1,234.5):$#,##0.0_);($#,##0.0)|($1,234.56):$#,##0.00_);($#,##0.00)|[newcol]:|1/4/06:m/d/yy|01/04/2006:mm/dd/yyyy|2006-01-04:yyyy-mm-dd|4-Jan-06:d-mmm-yy|04-Jan-2006:dd-mmm-yyyy|January 4, 2006:mmmm d, yyyy|[break]:|1\\c23:h:mm|1\\c23 PM:h:mm AM/PM|1\\c23\\c45:h:mm:ss|01\\c23\\c45:hh:mm:ss|26\\c23 (h\\cm):[hh]:mm|69\\c45 (m\\cs):[mm]:ss|69 (s):[ss]|[newcol]:|2006-01-04 01\\c23\\c45:yyyy-mm-dd hh:mm:ss|January 4, 2006:mmmm d, yyyy hh:mm:ss|Wed:ddd|Wednesday:dddd|",SCFormatTextFormats:"[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!Automatic!:general|%loc!Plain Text!:text-plain|HTML:text-html|%loc!Wikitext!:text-wiki|%loc!Link!:text-link|%loc!Formula!:formula|%loc!Hidden!:hidden|",SCFormatPadsizes:"[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!No padding!:0px|[newcol]:|1 pixel:1px|2 pixels:2px|3 pixels:3px|4 pixels:4px|5 pixels:5px|6 pixels:6px|7 pixels:7px|8 pixels:8px|[newcol]:|9 pixels:9px|10 pixels:10px|11 pixels:11px|12 pixels:12px|13 pixels:13px|14 pixels:14px|16 pixels:16px|18 pixels:18px|[newcol]:|20 pixels:20px|22 pixels:22px|24 pixels:24px|28 pixels:28px|36 pixels:36px|",SCFormatFontsizes:"[cancel]:|[break]:|%loc!Default!:|[custom]:|X-Small:x-small|Small:small|Medium:medium|Large:large|X-Large:x-large|[newcol]:|6pt:6pt|7pt:7pt|8pt:8pt|9pt:9pt|10pt:10pt|11pt:11pt|12pt:12pt|14pt:14pt|16pt:16pt|[newcol]:|18pt:18pt|20pt:20pt|22pt:22pt|24pt:24pt|28pt:28pt|36pt:36pt|48pt:48pt|72pt:72pt|[newcol]:|8 pixels:8px|9 pixels:9px|10 pixels:10px|11 pixels:11px|12 pixels:12px|13 pixels:13px|14 pixels:14px|[newcol]:|16 pixels:16px|18 pixels:18px|20 pixels:20px|22 pixels:22px|24 pixels:24px|28 pixels:28px|36 pixels:36px|",SCFormatFontfamilies:"[cancel]:|[break]:|%loc!Default!:|[custom]:|Verdana:Verdana,Arial,Helvetica,sans-serif|Arial:arial,helvetica,sans-serif|Courier:'Courier New',Courier,monospace|",SCFormatFontlook:"[cancel]:|[break]:|%loc!Default!:|%loc!Normal!:normal normal|%loc!Bold!:normal bold|%loc!Italic!:italic normal|%loc!Bold Italic!:italic bold",SCFormatTextAlignhoriz:"[cancel]:|[break]:|%loc!Default!:|%loc!Left!:left|%loc!Center!:center|%loc!Right!:right|",SCFormatNumberAlignhoriz:"[cancel]:|[break]:|%loc!Default!:|%loc!Left!:left|%loc!Center!:center|%loc!Right!:right|",SCFormatAlignVertical:"[cancel]:|[break]:|%loc!Default!:|%loc!Top!:top|%loc!Middle!:middle|%loc!Bottom!:bottom|",SCFormatColwidth:"[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|20 pixels:20|40:40|60:60|80:80|100:100|120:120|140:140|160:160|[newcol]:|180 pixels:180|200:200|220:220|240:240|260:260|280:280|300:300|",SCFormatRecalc:"[cancel]:|[break]:|%loc!Auto!:|%loc!Manual!:off|",SCFormatUserMaxCol:"[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|Unlimited:0|10:10|20:20|30:30|40:40|50:50|60:60|80:80|100:100|",SCFormatUserMaxRow:"[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|Unlimited:0|10:10|20:20|30:30|40:40|50:50|60:60|80:80|100:100|",ISCButtonNormalBackground:"transparent",ISCButtonBorderNormal:"none",ISCButtonBorderHover:"none",ISCButtonBorderDown:"none",ISCButtonDownBackground:"#888",s_PopupListCancel:"[Cancel]",s_PopupListCustom:"Custom",s_loc_align_center:"Align Center",s_loc_align_left:"Align Left",s_loc_align_right:"Align Right",s_loc_alignment:"Alignment",s_loc_audit:"Audit",s_loc_audit_trail_this_session:"Audit Trail This Session",s_loc_auto:"Auto",s_loc_auto_sum:"Auto Sum",s_loc_auto_wX_commas:"Auto w/ commas",s_loc_automatic:"Automatic",s_loc_background:"Background",s_loc_bold:"Bold",s_loc_bold_XampX_italics:"Bold &amp; Italics",s_loc_bold_italic:"Bold Italic",s_loc_borders:"Borders",s_loc_borders_off:"Borders Off",s_loc_borders_on:"Borders On",s_loc_bottom:"Bottom",s_loc_bottom_border:"Bottom Border",s_loc_cell_settings:"CELL SETTINGS",s_loc_csv_format:"CSV format",s_loc_cancel:"Cancel",s_loc_category:"Category",s_loc_center:"Center",s_loc_clear:"Clear",s_loc_clear_socialcalc_clipboard:"Clear SocialCalc Clipboard",s_loc_clipboard:"Clipboard",s_loc_color:"Color",s_loc_column_:"Column ",s_loc_comment:"Comment",s_loc_copy:"Copy",s_loc_custom:"Custom",s_loc_cut:"Cut",s_loc_default:"Default",s_loc_default_alignment:"Default Alignment",s_loc_default_column_width:"Default Column Width",s_loc_default_font:"Default Font",s_loc_default_format:"Default Format",s_loc_default_padding:"Default Padding",s_loc_delete:"Delete",s_loc_delete_column:"Delete Column",s_loc_delete_contents:"Delete Cell Contents",s_loc_delete_row:"Delete Row",s_loc_description:"Description",s_loc_display_clipboard_in:"Display Clipboard in",s_loc_down:"Down",s_loc_edit:"Edit",s_loc_existing_names:"Existing Names",s_loc_family:"Family",s_loc_fill_down:"Fill Down",s_loc_fill_right:"Fill Right",s_loc_font:"Font",s_loc_format:"Format",s_loc_formula:"Formula",s_loc_function_list:"Function List",s_loc_functions:"Functions",s_loc_grid:"Grid",s_loc_hidden:"Hidden",s_loc_hide_column:"Hide Column",s_loc_hide_row:"Hide Row",s_loc_horizontal:"Horizontal",s_loc_insert_column:"Insert Column Before",s_loc_insert_row:"Insert Row Before",s_loc_italic:"Italic",s_loc_last_sort:"Last Sort",s_loc_left:"Left",s_loc_left_border:"Left Border",s_loc_link:"Link",s_loc_link_input_box:"Link Input Box",s_loc_list:"List",s_loc_load_socialcalc_clipboard_with_this:"Load SocialCalc Clipboard With This",s_loc_lock_cell:"Lock Cell",s_loc_major_sort:"Major Sort",s_loc_manual:"Manual",s_loc_merge_cells:"Merge/Unmerge Cells",s_loc_middle:"Middle",s_loc_minor_sort:"Minor Sort",s_loc_move_insert:"Move Insert",s_loc_move_paste:"Move Paste",s_loc_multiXline_input_box:"Multi-line Input Box",s_loc_name:"Name",s_loc_names:"Names",s_loc_no_padding:"No padding",s_loc_normal:"Normal",s_loc_number:"Number",s_loc_number_horizontal:"Number Horizontal",s_loc_ok:"OK",s_loc_padding:"Padding",s_loc_page_name:"Page Name",s_loc_paste:"Paste",s_loc_paste_formats:"Paste Formats",s_loc_plain_text:"Plain Text",s_loc_recalc:"Recalc",s_loc_recalculation:"Recalculation",s_loc_redo:"Redo",s_loc_right:"Right",s_loc_right_border:"Right Border",s_loc_sheet_settings:"SHEET SETTINGS",s_loc_save:"Save",s_loc_save_to:"Save to",s_loc_set_cell_contents:"Set Cell Contents",s_loc_set_cells_to_sort:"Set Cells To Sort",s_loc_set_value_to:"Set Value To",s_loc_set_to_link_format:"Set to Link format",s_loc_setXclear_move_from:"Set/Clear Move From",s_loc_show_cell_settings:"Show Cell Settings",s_loc_show_sheet_settings:"Show Sheet Settings",s_loc_show_in_new_browser_window:"Show in new browser window",s_loc_size:"Size",s_loc_socialcalcXsave_format:"SocialCalc-save format",s_loc_sort:"Sort",s_loc_sort_:"Sort ",s_loc_sort_cells:"Sort Cells",s_loc_swap_colors:"Swap Colors",s_loc_tabXdelimited_format:"Tab-delimited format",s_loc_text:"Text",s_loc_text_horizontal:"Text Horizontal",s_loc_this_is_aXbrXsample:"This is a<br>sample",s_loc_top:"Top",s_loc_top_border:"Top Border",s_loc_undone_steps:"UNDONE STEPS",s_loc_url:"URL",s_loc_undo:"Undo",s_loc_unlock_cell:"Unlock Cell",s_loc_unmerge_cells:"Unmerge Cells",s_loc_up:"Up",s_loc_value:"Value",s_loc_vertical:"Vertical",s_loc_wikitext:"Wikitext",s_loc_workspace:"Workspace",s_loc_XnewX:"[New]",s_loc_XnoneX:"[None]",s_loc_Xselect_rangeX:"[select range]",SVStatuslineheight:20,SVStatuslineCSS:"font-size:10px;padding:3px 0px;",FormatNumber_separatorchar:",",FormatNumber_decimalchar:".",FormatNumber_defaultCurrency:"$",s_FormatNumber_daynames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s_FormatNumber_daynames3:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s_FormatNumber_monthnames:["January","February","March","April","May","June","July","August","September","October","November","December"],s_FormatNumber_monthnames3:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s_FormatNumber_am:"AM",s_FormatNumber_am1:"A",s_FormatNumber_pm:"PM",s_FormatNumber_pm1:"P",s_parseerrexponent:"Improperly formed number exponent",s_parseerrchar:"Unexpected character in formula",s_parseerrstring:"Improperly formed string",s_parseerrspecialvalue:"Improperly formed special value",s_parseerrtwoops:"Error in formula (two operators inappropriately in a row)",s_parseerrmissingopenparen:"Missing open parenthesis in list with comma(s). ",s_parseerrcloseparennoopen:"Closing parenthesis without open parenthesis. ",s_parseerrmissingcloseparen:"Missing close parenthesis. ",s_parseerrmissingoperand:"Missing operand. ",s_parseerrerrorinformula:"Error in formula.",s_calcerrerrorvalueinformula:"Error value in formula",s_parseerrerrorinformulabadval:"Error in formula resulting in bad value",s_formularangeresult:"Formula results in range value:",s_calcerrnumericnan:"Formula results in an bad numeric value",s_calcerrnumericoverflow:"Numeric overflow",s_sheetunavailable:"Sheet unavailable:",s_calcerrcellrefmissing:"Cell reference missing when expected.",s_calcerrsheetnamemissing:"Sheet name missing when expected.",s_circularnameref:"Circular name reference to name",s_calcerrunknownname:"Unknown name",s_calcerrincorrectargstofunction:"Incorrect arguments to function",s_sheetfuncunknownfunction:"Unknown function",s_sheetfunclnarg:"LN argument must be greater than 0",s_sheetfunclog10arg:"LOG10 argument must be greater than 0",s_sheetfunclogsecondarg:"LOG second argument must be numeric greater than 0",s_sheetfunclogfirstarg:"LOG first argument must be greater than 0",s_sheetfuncroundsecondarg:"ROUND second argument must be numeric",s_sheetfuncddblife:"DDB life must be greater than 1",s_sheetfuncslnlife:"SLN life must be greater than 1",s_fdef_ABS:"Absolute value function. ",s_fdef_ACOS:"Trigonometric arccosine function. ",s_fdef_AND:"True if all arguments are true. ",s_fdef_ASIN:"Trigonometric arcsine function. ",s_fdef_ATAN:"Trigonometric arctan function. ",s_fdef_ATAN2:"Trigonometric arc tangent function (result is in radians). ",s_fdef_AVERAGE:"Averages the values. ",s_fdef_CHOOSE:"Returns the value specified by the index. The values may be ranges of cells. ",s_fdef_COLUMNS:"Returns the number of columns in the range. ",s_fdef_COS:"Trigonometric cosine function (value is in radians). ",s_fdef_CONCAT:"Join Together Text & Values to Create a Single Combined Text String. ",s_fdef_CONCATENATE:"Join Together Text & Values to Create a Single Combined Text String. ",s_fdef_COUNT:"Counts the number of numeric values, not blank, text, or error. ",s_fdef_COUNTA:"Counts the number of non-blank values. ",s_fdef_COUNTBLANK:'Counts the number of blank values. (Note: "" is not blank.) ',s_fdef_COUNTIF:'Counts the number of number of cells in the range that meet the criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). ',s_fdef_DATE:'Returns the appropriate date value given numbers for year, month, and day. For example: DATE(2006,2,1) for February 1, 2006. Note: In this program, day "1" is December 31, 1899 and the year 1900 is not a leap year. Some programs use January 1, 1900, as day "1" and treat 1900 as a leap year. In both cases, though, dates on or after March 1, 1900, are the same. ',s_fdef_DAVERAGE:"Averages the values in the specified field in records that meet the criteria. ",s_fdef_DAY:"Returns the day of month for a date value. ",s_fdef_DCOUNT:"Counts the number of numeric values, not blank, text, or error, in the specified field in records that meet the criteria. ",s_fdef_DCOUNTA:"Counts the number of non-blank values in the specified field in records that meet the criteria. ",s_fdef_DDB:"Returns the amount of depreciation at the given period of time (the default factor is 2 for double-declining balance). ",s_fdef_DEGREES:"Converts value in radians into degrees. ",s_fdef_DGET:"Returns the value of the specified field in the single record that meets the criteria. ",s_fdef_DMAX:"Returns the maximum of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DMIN:"Returns the maximum of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DPRODUCT:"Returns the result of multiplying the numeric values in the specified field in records that meet the criteria. ",s_fdef_DSTDEV:"Returns the sample standard deviation of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DSTDEVP:"Returns the standard deviation of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DSUM:"Returns the sum of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DVAR:"Returns the sample variance of the numeric values in the specified field in records that meet the criteria. ",s_fdef_DVARP:"Returns the variance of the numeric values in the specified field in records that meet the criteria. ",s_fdef_EVEN:"Rounds the value up in magnitude to the nearest even integer. ",s_fdef_EXACT:'Returns "true" if the values are exactly the same, including case, type, etc. ',s_fdef_EXP:"Returns e raised to the value power. ",s_fdef_FACT:"Returns factorial of the value. ",s_fdef_FALSE:'Returns the logical value "false". ',s_fdef_FIND:'Returns the starting position within string2 of the first occurrence of string1 at or after "start". If start is omitted, 1 is assumed. ',s_fdef_FV:"Returns the future value of repeated payments of money invested at the given rate for the specified number of periods, with optional present value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ",s_fdef_HLOOKUP:"Look for the matching value for the given value in the range and return the corresponding value in the cell specified by the row offset. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match<=value) instead of exact match. ",s_fdef_HOUR:"Returns the hour portion of a time or date/time value. ",s_fdef_IF:"Results in true-value if logical-expression is TRUE or non-zero, otherwise results in false-value. ",s_fdef_INDEX:"Returns a cell or range reference for the specified row and column in the range. If range is 1-dimensional, then only one of rownum or colnum are needed. If range is 2-dimensional and rownum or colnum are zero, a reference to the range of just the specified column or row is returned. You can use the returned reference value in a range, e.g., sum(A1:INDEX(A2:A10,4)). ",s_fdef_INT:"Returns the value rounded down to the nearest integer (towards -infinity). ",s_fdef_IRR:"Returns the interest rate at which the cash flows in the range have a net present value of zero. Uses an iterative process that will return #NUM! error if it does not converge. There may be more than one possible solution. Providing the optional guess value may help in certain situations where it does not converge or finds an inappropriate solution (the default guess is 10%). ",s_fdef_ISBLANK:'Returns "true" if the value is a reference to a blank cell. ',s_fdef_ISERR:'Returns "true" if the value is of type "Error" but not "NA". ',s_fdef_ISERROR:'Returns "true" if the value is of type "Error". ',s_fdef_ISLOGICAL:'Returns "true" if the value is of type "Logical" (true/false). ',s_fdef_ISNA:'Returns "true" if the value is the error type "NA". ',s_fdef_ISNONTEXT:'Returns "true" if the value is not of type "Text". ',s_fdef_ISNUMBER:'Returns "true" if the value is of type "Number" (including logical values). ',s_fdef_ISTEXT:'Returns "true" if the value is of type "Text". ',s_fdef_LEFT:"Returns the specified number of characters from the text value. If count is omitted, 1 is assumed. ",s_fdef_LEN:"Returns the number of characters in the text value. ",s_fdef_LN:"Returns the natural logarithm of the value. ",s_fdef_LOG:"Returns the logarithm of the value using the specified base. ",s_fdef_LOG10:"Returns the base 10 logarithm of the value. ",s_fdef_LOWER:"Returns the text value with all uppercase characters converted to lowercase. ",s_fdef_MATCH:"Look for the matching value for the given value in the range and return position (the first is 1) in that range. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match<=value) instead of exact match. If rangelookup is -1, act like 1 but the bracket is match>=value. ",s_fdef_MAX:"Returns the maximum of the numeric values. ",s_fdef_MID:"Returns the specified number of characters from the text value starting from the specified position. ",s_fdef_MIN:"Returns the minimum of the numeric values. ",s_fdef_MINUTE:"Returns the minute portion of a time or date/time value. ",s_fdef_MOD:"Returns the remainder of the first value divided by the second. ",s_fdef_MONTH:"Returns the month part of a date value. ",s_fdef_N:"Returns the value if it is a numeric value otherwise an error. ",s_fdef_NA:"Returns the #N/A error value which propagates through most operations. ",s_fdef_NOT:"Returns FALSE if value is true, and TRUE if it is false. ",s_fdef_NOW:"Returns the current date/time. ",s_fdef_NPER:"Returns the number of periods at which payments invested each period at the given rate with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period) has the given present value. ",s_fdef_NPV:"Returns the net present value of cash flows (which may be individual values and/or ranges) at the given rate. The flows are positive if income, negative if paid out, and are assumed at the end of each period. ",s_fdef_ODD:"Rounds the value up in magnitude to the nearest odd integer. ",s_fdef_OR:"True if any argument is true ",s_fdef_PI:"The value 3.1415926... ",s_fdef_PMT:"Returns the amount of each payment that must be invested at the given rate for the specified number of periods to have the specified present value, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ",s_fdef_POWER:"Returns the first value raised to the second value power. ",s_fdef_PRODUCT:"Returns the result of multiplying the numeric values. ",s_fdef_PROPER:"Returns the text value with the first letter of each word converted to uppercase and the others to lowercase. ",s_fdef_PV:"Returns the present value of the given number of payments each invested at the given rate, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ",s_fdef_RADIANS:"Converts value in degrees into radians. ",s_fdef_RATE:"Returns the rate at which the given number of payments each invested at the given rate has the specified present value, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). Uses an iterative process that will return #NUM! error if it does not converge. There may be more than one possible solution. Providing the optional guess value may help in certain situations where it does not converge or finds an inappropriate solution (the default guess is 10%). ",s_fdef_REPLACE:"Returns text1 with the specified number of characters starting from the specified position replaced by text2. ",s_fdef_REPT:"Returns the text repeated the specified number of times. ",s_fdef_RIGHT:"Returns the specified number of characters from the text value starting from the end. If count is omitted, 1 is assumed. ",s_fdef_ROUND:"Rounds the value to the specified number of decimal places. If precision is negative, then round to powers of 10. The default precision is 0 (round to integer). ",s_fdef_ROWS:"Returns the number of rows in the range. ",s_fdef_SECOND:"Returns the second portion of a time or date/time value (truncated to an integer). ",s_fdef_SIN:"Trigonometric sine function (value is in radians) ",s_fdef_SLN:"Returns the amount of depreciation at each period of time using the straight-line method. ",s_fdef_SQRT:"Square root of the value ",s_fdef_STDEV:"Returns the sample standard deviation of the numeric values. ",s_fdef_STDEVP:"Returns the standard deviation of the numeric values. ",s_fdef_SUBSTITUTE:'Returns text1 with the all occurrences of oldtext replaced by newtext. If "occurrence" is present, then only that occurrence is replaced. ',s_fdef_SUM:"Adds the numeric values. The values to the sum function may be ranges in the form similar to A1:B5. ",s_fdef_SUMIF:'Sums the numeric values of cells in the range that meet the criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). If range2 is present, then range1 is tested and the corresponding range2 value is summed. ',s_fdef_SUMIFS:'Sums the numeric values of cells in the sum_range that meet the multiple criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). ',s_fdef_SYD:"Depreciation by Sum of Year's Digits method. ",s_fdef_T:"Returns the text value or else a null string. ",s_fdef_TAN:"Trigonometric tangent function (value is in radians) ",s_fdef_TIME:"Returns the time value given the specified hour, minute, and second. ",s_fdef_TODAY:'Returns the current date (an integer). Note: In this program, day "1" is December 31, 1899 and the year 1900 is not a leap year. Some programs use January 1, 1900, as day "1" and treat 1900 as a leap year. In both cases, though, dates on or after March 1, 1900, are the same. ',s_fdef_TRIM:"Returns the text value with leading, trailing, and repeated spaces removed. ",s_fdef_TRUE:'Returns the logical value "true". ',s_fdef_TRUNC:"Truncates the value to the specified number of decimal places. If precision is negative, truncate to powers of 10. ",s_fdef_UPPER:"Returns the text value with all lowercase characters converted to uppercase. ",s_fdef_VALUE:"Converts the specified text value into a numeric value. Various forms that look like numbers (including digits followed by %, forms that look like dates, etc.) are handled. This may not handle all of the forms accepted by other spreadsheets and may be locale dependent. ",s_fdef_VAR:"Returns the sample variance of the numeric values. ",s_fdef_VARP:"Returns the variance of the numeric values. ",s_fdef_VLOOKUP:"Look for the matching value for the given value in the range and return the corresponding value in the cell specified by the column offset. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match>=value) instead of exact match. ",s_fdef_WEEKDAY:"Returns the day of week specified by the date value. If type is 1 (the default), Sunday is day and Saturday is day 7. If type is 2, Monday is day 1 and Sunday is day 7. If type is 3, Monday is day 0 and Sunday is day 6. ",s_fdef_YEAR:"Returns the year part of a date value. ",s_fdef_SUMPRODUCT:"Sums the pairwise products of 2 or more ranges. The ranges must be of equal length.",s_fdef_CEILING:"Rounds the given number up to the nearest integer or multiple of significance. Significance is the value to whose multiple of ten the value is to be rounded up (.01, .1, 1, 10, etc.)",s_fdef_FLOOR:"Rounds the given number down to the nearest multiple of significance. Significance is the value to whose multiple of ten the number is to be rounded down (.01, .1, 1, 10, etc.)",s_farg_v:"value",s_farg_vn:"value1, value2, ...",s_farg_xy:"valueX, valueY",s_farg_choose:"index, value1, value2, ...",s_farg_range:"range",s_farg_rangec:"range, criteria",s_farg_date:"year, month, day",s_farg_dfunc:"databaserange, fieldname, criteriarange",s_farg_ddb:"cost, salvage, lifetime, period, [factor]",s_farg_find:"string1, string2, [start]",s_farg_fv:"rate, n, payment, [pv, [paytype]]",s_farg_hlookup:"value, range, row, [rangelookup]",s_farg_iffunc:"logical-expression, true-value, [false-value]",s_farg_index:"range, rownum, colnum",s_farg_irr:"range, [guess]",s_farg_tc:"text, count",s_farg_log:"value, base",s_farg_match:"value, range, [rangelookup]",s_farg_mid:"text, start, length",s_farg_nper:"rate, payment, pv, [fv, [paytype]]",s_farg_npv:"rate, value1, value2, ...",s_farg_pmt:"rate, n, pv, [fv, [paytype]]",s_farg_pv:"rate, n, payment, [fv, [paytype]]",s_farg_rate:"n, payment, pv, [fv, [paytype, [guess]]]",s_farg_replace:"text1, start, length, text2",s_farg_vp:"value, [precision]",s_farg_valpre:"value, precision",s_farg_csl:"cost, salvage, lifetime",s_farg_cslp:"cost, salvage, lifetime, period",s_farg_subs:"text1, oldtext, newtext, [occurrence]",s_farg_sumif:"range1, criteria, [range2]",s_farg_hms:"hour, minute, second",s_farg_txt:"text",s_farg_vlookup:"value, range, col, [rangelookup]",s_farg_weekday:"date, [type]",s_farg_dt:"date",s_farg_rangen:"range1, range2, ...",s_farg_vsig:"value, [significance]",function_classlist:["all","stat","lookup","datetime","financial","test","math","text","gui","action"],s_fclass_all:"All",s_fclass_stat:"Statistics",s_fclass_lookup:"Lookup",s_fclass_datetime:"Date & Time",s_fclass_financial:"Financial",s_fclass_test:"Test",s_fclass_math:"Math",s_fclass_text:"Text",s_fclass_action:"Email & Copy",s_fclass_gui:"Button & Input",lastone:null},t.ConstantsDefaultClasses={defaultComment:"",defaultCommentNoGrid:"",defaultHighlightTypeCursor:"",defaultHighlightTypeRange:"",defaultColname:"",defaultSelectedColname:"",defaultRowname:"",defaultSelectedRowname:"",defaultUpperLeft:"",defaultSkippedCell:"",defaultPaneDivider:"",cteGriddiv:"",defaultInputEcho:{classname:"",style:"filter:alpha(opacity=90);opacity:.9;"},TCmain:"",TCendcap:"",TCpaneslider:"",TClessbutton:"",TCmorebutton:"",TCscrollarea:"",TCthumb:"",TCPStrackingline:"",TCTDFSthumbstatus:"",TDpopupElement:""},t.ConstantsSetClasses=function(e){var o,i=t.ConstantsDefaultClasses,n=t.Constants;
3e=e||"";for(o in i)"string"==typeof i[o]?(n[o+"Class"]=e+(i[o]||o),void 0!==n[o+"Style"]&&(n[o+"Style"]="")):"object"==typeof i[o]&&(n[o+"Class"]=e+(i[o].classname||o),n[o+"Style"]=i[o].style)},t.ConstantsSetImagePrefix=function(e){var o=t.Constants;for(var i in o)"string"==typeof o[i]&&(o[i]=o[i].replace(o.defaultImagePrefix,e));o.defaultImagePrefix=e};var t;t||(t={}),t.Callbacks={expand_wiki:null,expand_markup:function(e,o,i){return t.default_expand_markup(e,o,i)},MakePageLink:null,NormalizeSheetName:null},t.Cell=function(e){this.coord=e,this.datavalue="",this.datatype=null,this.formula="",this.valuetype="b",this.readonly=!1},t.CellProperties={coord:1,datavalue:1,datatype:1,formula:1,valuetype:1,errors:1,comment:1,readonly:1,bt:2,br:2,bb:2,bl:2,layout:2,font:2,color:2,bgcolor:2,cellformat:2,nontextvalueformat:2,textvalueformat:2,colspan:2,rowspan:2,cssc:2,csss:2,mod:2,displaystring:3,parseinfo:3,hcolspan:3,hrowspan:3},t.CellPropertiesTable={bt:"borderstyle",br:"borderstyle",bb:"borderstyle",bl:"borderstyle",layout:"layout",font:"font",color:"color",bgcolor:"color",cellformat:"cellformat",nontextvalueformat:"valueformat",textvalueformat:"valueformat"},t.Sheet=function(){t.ResetSheet(this),this.statuscallback=null,this.statuscallbackparams=null},t.ResetSheet=function(e){e.cells={},e.attribs={lastcol:1,lastrow:1,defaultlayout:0,usermaxcol:0,usermaxrow:0},e.rowattribs={hide:{},height:{}},e.colattribs={width:{},hide:{}},e.names={},e.layouts=[],e.layouthash={},e.fonts=[],e.fonthash={},e.colors=[],e.colorhash={},e.borderstyles=[],e.borderstylehash={},e.cellformats=[],e.cellformathash={},e.valueformats=[],e.valueformathash={},e.matched_cells=[],e.selected_search_cell=void 0,e.copiedfrom="",e.changes=new t.UndoStack,e.renderneeded=!1,e.changedrendervalues=!0,e.recalcchangedavalue=!1,e.hiddencolrow="",e.sci=new t.SheetCommandInfo(e),e.ioEventTree={},e.ioParameterList={}},t.Sheet.prototype.ResetSheet=function(){t.ResetSheet(this)},t.Sheet.prototype.AddCell=function(e){return this.cells[e.coord]=e},t.Sheet.prototype.LastCol=function(){var e=1;for(var o in this.cells){var i=t.coordToCr(o);i.col>e&&(e=i.col)}return e},t.Sheet.prototype.LastRow=function(){var e=1;for(var o in this.cells){var i=t.coordToCr(o);i.row>e&&(e=i.row)}return e},t.Sheet.prototype.GetAssuredCell=function(e){return this.cells[e]||this.AddCell(new t.Cell(e))},t.Sheet.prototype.ParseSheetSave=function(e){t.ParseSheetSave(e,this)},t.Sheet.prototype.CellFromStringParts=function(e,o,i){return t.CellFromStringParts(this,e,o,i)},t.Sheet.prototype.CreateSheetSave=function(e,o){return t.CreateSheetSave(this,e,o)},t.Sheet.prototype.CellToString=function(e){return t.CellToString(this,e)},t.Sheet.prototype.CanonicalizeSheet=function(e){return t.CanonicalizeSheet(this,e)},t.Sheet.prototype.EncodeCellAttributes=function(e){return t.EncodeCellAttributes(this,e)},t.Sheet.prototype.EncodeSheetAttributes=function(){return t.EncodeSheetAttributes(this)},t.Sheet.prototype.DecodeCellAttributes=function(e,o,i){return t.DecodeCellAttributes(this,e,o,i)},t.Sheet.prototype.DecodeSheetAttributes=function(e){return t.DecodeSheetAttributes(this,e)},t.Sheet.prototype.ScheduleSheetCommands=function(e,o){return t.ScheduleSheetCommands(this,e,o)},t.Sheet.prototype.SheetUndo=function(){return t.SheetUndo(this)},t.Sheet.prototype.SheetRedo=function(){return t.SheetRedo(this)},t.Sheet.prototype.CreateAuditString=function(){return t.CreateAuditString(this)},t.Sheet.prototype.GetStyleNum=function(e,o){return t.GetStyleNum(this,e,o)},t.Sheet.prototype.GetStyleString=function(e,o){return t.GetStyleString(this,e,o)},t.Sheet.prototype.RecalcSheet=function(){return t.RecalcSheet(this)},t.ParseSheetSave=function(e,o){var i,n,r,a,s,l,c,u,d,h=e.split(/\r\n|\n/),p=[],f=t.Constants;for(n=0;n<h.length;n++){switch(i=h[n],p=i.split(":"),p[0]){case"cell":c=o.GetAssuredCell(p[1]),r=2,o.CellFromStringParts(c,p,r);break;case"col":for(l=p[1],r=2;a=p[r++];)switch(a){case"w":o.colattribs.width[l]=p[r++];break;case"hide":o.colattribs.hide[l]=p[r++];break;default:throw f.s_pssUnknownColType+" '"+a+"'"}break;case"row":for(l=p[1]-0,r=2;a=p[r++];)switch(a){case"h":o.rowattribs.height[l]=p[r++]-0;break;case"hide":o.rowattribs.hide[l]=p[r++];break;default:throw f.s_pssUnknownRowType+" '"+a+"'"}break;case"sheet":for(u=o.attribs,r=1;a=p[r++];)switch(a){case"c":u.lastcol=p[r++]-0;break;case"r":u.lastrow=p[r++]-0;break;case"w":u.defaultcolwidth=p[r++]+"";break;case"h":u.defaultrowheight=p[r++]-0;break;case"tf":u.defaulttextformat=p[r++]-0;break;case"ntf":u.defaultnontextformat=p[r++]-0;break;case"layout":u.defaultlayout=p[r++]-0;break;case"font":u.defaultfont=p[r++]-0;break;case"tvf":u.defaulttextvalueformat=p[r++]-0;break;case"ntvf":u.defaultnontextvalueformat=p[r++]-0;break;case"color":u.defaultcolor=p[r++]-0;break;case"bgcolor":u.defaultbgcolor=p[r++]-0;break;case"circularreferencecell":u.circularreferencecell=p[r++];break;case"recalc":u.recalc=p[r++];break;case"needsrecalc":u.needsrecalc=p[r++];break;case"usermaxcol":u.usermaxcol=p[r++]-0;break;case"usermaxrow":u.usermaxrow=p[r++]-0;break;default:r+=1}break;case"name":d=t.decodeFromSave(p[1]).toUpperCase(),o.names[d]={desc:t.decodeFromSave(p[2])},o.names[d].definition=t.decodeFromSave(p[3]);break;case"layout":p=h[n].match(/^layout\:(\d+)\:(.+)$/),o.layouts[p[1]-0]=p[2],o.layouthash[p[2]]=p[1]-0;break;case"font":o.fonts[p[1]-0]=p[2],o.fonthash[p[2]]=p[1]-0;break;case"color":o.colors[p[1]-0]=p[2],o.colorhash[p[2]]=p[1]-0;break;case"border":o.borderstyles[p[1]-0]=p[2],o.borderstylehash[p[2]]=p[1]-0;break;case"cellformat":s=t.decodeFromSave(p[2]),o.cellformats[p[1]-0]=s,o.cellformathash[s]=p[1]-0;break;case"valueformat":s=t.decodeFromSave(p[2]),o.valueformats[p[1]-0]=s,o.valueformathash[s]=p[1]-0;break;case"version":break;case"copiedfrom":o.copiedfrom=p[1]+":"+p[2];break;case"clipboardrange":case"clipboard":break;case"":break;default:throw alert(f.s_pssUnknownLineType+" '"+p[0]+"'"),f.s_pssUnknownLineType+" '"+p[0]+"'"}p=null}},t.CellFromStringParts=function(e,o,i,n){for(var o,r,a;r=i[n++];)switch(r){case"v":o.datavalue=t.decodeFromSave(i[n++])-0,o.datatype="v",o.valuetype="n";break;case"t":o.datavalue=t.decodeFromSave(i[n++]),o.datatype="t",o.valuetype=t.Constants.textdatadefaulttype;break;case"vt":a=i[n++],o.valuetype=a,"n"==a.charAt(0)?(o.datatype="v",o.datavalue=t.decodeFromSave(i[n++])-0):(o.datatype="t",o.datavalue=t.decodeFromSave(i[n++]));break;case"vtf":a=i[n++],o.valuetype=a,o.datavalue="n"==a.charAt(0)?t.decodeFromSave(i[n++])-0:t.decodeFromSave(i[n++]),o.formula=t.decodeFromSave(i[n++]),o.datatype="f";break;case"vtc":a=i[n++],o.valuetype=a,o.datavalue="n"==a.charAt(0)?t.decodeFromSave(i[n++])-0:t.decodeFromSave(i[n++]),o.formula=t.decodeFromSave(i[n++]),o.datatype="c";break;case"ro":ro=t.decodeFromSave(i[n++]),o.readonly="yes"==ro.toLowerCase();break;case"e":o.errors=t.decodeFromSave(i[n++]);break;case"b":o.bt=i[n++]-0,o.br=i[n++]-0,o.bb=i[n++]-0,o.bl=i[n++]-0;break;case"l":o.layout=i[n++]-0;break;case"f":o.font=i[n++]-0;break;case"c":o.color=i[n++]-0;break;case"bg":o.bgcolor=i[n++]-0;break;case"cf":o.cellformat=i[n++]-0;break;case"ntvf":o.nontextvalueformat=i[n++]-0;break;case"tvf":o.textvalueformat=i[n++]-0;break;case"colspan":o.colspan=i[n++]-0;break;case"rowspan":o.rowspan=i[n++]-0;break;case"cssc":o.cssc=i[n++];break;case"csss":o.csss=t.decodeFromSave(i[n++]);break;case"mod":n+=1;break;case"comment":o.comment=t.decodeFromSave(i[n++]);break;default:throw t.Constants.s_cfspUnknownCellType+" '"+r+"'"}},t.sheetfields=["defaultrowheight","defaultcolwidth","circularreferencecell","recalc","needsrecalc","usermaxcol","usermaxrow"],t.sheetfieldsshort=["h","w","circularreferencecell","recalc","needsrecalc","usermaxcol","usermaxrow"],t.sheetfieldsxlat=["defaulttextformat","defaultnontextformat","defaulttextvalueformat","defaultnontextvalueformat","defaultcolor","defaultbgcolor","defaultfont","defaultlayout"],t.sheetfieldsxlatshort=["tf","ntf","tvf","ntvf","color","bgcolor","font","layout"],t.sheetfieldsxlatxlt=["cellformat","cellformat","valueformat","valueformat","color","color","font","layout"],t.CreateSheetSave=function(e,o,i){var n,r,a,s,l,c,u,d,h,p,f,m=[];e.CanonicalizeSheet(i||t.Constants.doCanonicalizeSheet);var g=e.xlt;for(f=o?t.ParseRange(o):{cr1:{row:1,col:1},cr2:{row:g.maxrow,col:g.maxcol}},r=f.cr1,a=f.cr2,m.push("version:1.5"),s=r.row;s<=a.row;s++)for(l=r.col;l<=a.col;l++)c=t.crToCoord(l,s),n=e.cells[c],n&&(u=e.CellToString(n),0!=u.length&&(u="cell:"+c+u,m.push(u)));for(l=1;l<=g.maxcol;l++)c=t.rcColname(l),e.colattribs.width[c]&&m.push("col:"+c+":w:"+e.colattribs.width[c]),e.colattribs.hide[c]&&m.push("col:"+c+":hide:"+e.colattribs.hide[c]);for(s=1;s<=g.maxrow;s++)e.rowattribs.height[s]&&m.push("row:"+s+":h:"+e.rowattribs.height[s]),e.rowattribs.hide[s]&&m.push("row:"+s+":hide:"+e.rowattribs.hide[s]);for(u="sheet:c:"+g.maxcol+":r:"+g.maxrow,h=0;h<t.sheetfields.length;h++)d=t.encodeForSave(e.attribs[t.sheetfields[h]]),d&&(u+=":"+t.sheetfieldsshort[h]+":"+d);for(h=0;h<t.sheetfieldsxlat.length;h++)d=e.attribs[t.sheetfieldsxlat[h]],d&&(u+=":"+t.sheetfieldsxlatshort[h]+":"+g[t.sheetfieldsxlatxlt[h]+"sxlat"][d]);for(m.push(u),h=1;h<g.newborderstyles.length;h++)m.push("border:"+h+":"+g.newborderstyles[h]);for(h=1;h<g.newcellformats.length;h++)m.push("cellformat:"+h+":"+t.encodeForSave(g.newcellformats[h]));for(h=1;h<g.newcolors.length;h++)m.push("color:"+h+":"+g.newcolors[h]);for(h=1;h<g.newfonts.length;h++)m.push("font:"+h+":"+g.newfonts[h]);for(h=1;h<g.newlayouts.length;h++)m.push("layout:"+h+":"+g.newlayouts[h]);for(h=1;h<g.newvalueformats.length;h++)m.push("valueformat:"+h+":"+t.encodeForSave(g.newvalueformats[h]));for(h=0;h<g.namesorder.length;h++)p=g.namesorder[h],m.push("name:"+t.encodeForSave(p).toUpperCase()+":"+t.encodeForSave(e.names[p].desc)+":"+t.encodeForSave(e.names[p].definition));return o&&m.push("copiedfrom:"+t.crToCoord(r.col,r.row)+":"+t.crToCoord(a.col,a.row)),m.push(""),delete e.xlt,m.join("\n")},t.CellToString=function(e,o){var o,i,n,r,a,s,l,c,u;return i="",o?(n=t.encodeForSave(o.datavalue),"v"==o.datatype?i+="n"==o.valuetype?":v:"+n:":vt:"+o.valuetype+":"+n:"t"==o.datatype?i+=o.valuetype==t.Constants.textdatadefaulttype?":t:"+n:":vt:"+o.valuetype+":"+n:(r=t.encodeForSave(o.formula),"f"==o.datatype?i+=":vtf:"+o.valuetype+":"+n+":"+r:"c"==o.datatype&&(i+=":vtc:"+o.valuetype+":"+n+":"+r)),o.readonly&&(i+=":ro:yes"),o.errors&&(i+=":e:"+t.encodeForSave(o.errors)),a=o.bt||"",s=o.br||"",l=o.bb||"",c=o.bl||"",e.xlt?(u=e.xlt,(a||s||l||c)&&(i+=":b:"+u.borderstylesxlat[a||0]+":"+u.borderstylesxlat[s||0]+":"+u.borderstylesxlat[l||0]+":"+u.borderstylesxlat[c||0]),o.layout&&(i+=":l:"+u.layoutsxlat[o.layout]),o.font&&(i+=":f:"+u.fontsxlat[o.font]),o.color&&(i+=":c:"+u.colorsxlat[o.color]),o.bgcolor&&(i+=":bg:"+u.colorsxlat[o.bgcolor]),o.cellformat&&(i+=":cf:"+u.cellformatsxlat[o.cellformat]),o.textvalueformat&&(i+=":tvf:"+u.valueformatsxlat[o.textvalueformat]),o.nontextvalueformat&&(i+=":ntvf:"+u.valueformatsxlat[o.nontextvalueformat])):((a||s||l||c)&&(i+=":b:"+a+":"+s+":"+l+":"+c),o.layout&&(i+=":l:"+o.layout),o.font&&(i+=":f:"+o.font),o.color&&(i+=":c:"+o.color),o.bgcolor&&(i+=":bg:"+o.bgcolor),o.cellformat&&(i+=":cf:"+o.cellformat),o.textvalueformat&&(i+=":tvf:"+o.textvalueformat),o.nontextvalueformat&&(i+=":ntvf:"+o.nontextvalueformat)),o.colspan&&(i+=":colspan:"+o.colspan),o.rowspan&&(i+=":rowspan:"+o.rowspan),o.cssc&&(i+=":cssc:"+o.cssc),o.csss&&(i+=":csss:"+t.encodeForSave(o.csss)),o.mod&&(i+=":mod:"+o.mod),o.comment&&(i+=":comment:"+t.encodeForSave(o.comment)),i):i},t.CanonicalizeSheet=function(e,o){var i,n,r,a,s,l,c,u,d,h,p,f,m,g=0,v=0,b=["borderstyle","cellformat","color","font","layout","valueformat"],y={};y.namesorder=[];for(c in e.names)y.namesorder.push(c);if(y.namesorder.sort(),!t.Constants.doCanonicalizeSheet||!o){for(l=0;l<b.length;l++){for(c=b[l],y["new"+c+"s"]=e[c+"s"],i=e[c+"s"].length,d=new Array(i),d[0]="",f=1;i>f;f++)d[f]=f;y[c+"sxlat"]=d}return y.maxrow=e.attribs.lastrow,y.maxcol=e.attribs.lastcol,void(e.xlt=y)}for(l=0;l<b.length;l++)c=b[l],y[c+"sUsed"]={};var C=y.colorsUsed,w=y.borderstylesUsed,x=y.fontsUsed,_=y.layoutsUsed,S=y.cellformatsUsed,k=y.valueformatsUsed;for(n in e.cells)r=t.coordToCr(n),a=e.cells[n],s=!1,a.valuetype&&"b"!=a.valuetype&&(s=!0),a.color&&(C[a.color]=1,s=!0),a.bgcolor&&(C[a.bgcolor]=1,s=!0),a.bt&&(w[a.bt]=1,s=!0),a.br&&(w[a.br]=1,s=!0),a.bb&&(w[a.bb]=1,s=!0),a.bl&&(w[a.bl]=1,s=!0),a.layout&&(_[a.layout]=1,s=!0),a.font&&(x[a.font]=1,s=!0),a.cellformat&&(S[a.cellformat]=1,s=!0),a.textvalueformat&&(k[a.textvalueformat]=1,s=!0),a.nontextvalueformat&&(k[a.nontextvalueformat]=1,s=!0),s&&(r.row>g&&(g=r.row),r.col>v&&(v=r.col));for(f=0;f<t.sheetfieldsxlat.length;f++)m=e.attribs[t.sheetfieldsxlat[f]],m&&(y[t.sheetfieldsxlatxlt[f]+"sUsed"][m]=1);c={height:1,hide:1};for(m in c)for(r in e.rowattribs[m])r>g&&(g=r);c={hide:1,width:1};for(m in c)for(n in e.colattribs[m])r=t.coordToCr(n+"1"),r.col>v&&(v=r.col);for(l=0;l<b.length;l++){c=b[l],u=[],h=y[c+"sUsed"];for(m in h)u.push(e[c+"s"][m]);for(u.sort(),u.unshift(""),d=[""],p=e[c+"hash"],f=1;f<u.length;f++)d[p[u[f]]]=f;y[c+"sxlat"]=d,y["new"+c+"s"]=u}y.maxrow=g||1,y.maxcol=v||1,e.xlt=y},t.EncodeCellAttributes=function(e,t){var o,i,n,r={},a=function(e){r[e]={def:!0,val:""}},s=function(e){for(var t=0;t<e.length;t++)a(e[t])},l=function(e,t){r[e].def=!1,r[e].val=t||""},c=function(e,t){"*"!=t&&(r[e].def=!1,r[e].val=t)},u=e.GetAssuredCell(t);for(a("alignhoriz"),u.cellformat&&l("alignhoriz",e.cellformats[u.cellformat]),s(["alignvert","padtop","padright","padbottom","padleft"]),u.layout&&(parts=e.layouts[u.layout].match(/^padding:\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+);vertical-align:\s*(\S+);/),c("padtop",parts[1]),c("padright",parts[2]),c("padbottom",parts[3]),c("padleft",parts[4]),c("alignvert",parts[5])),s(["fontfamily","fontlook","fontsize"]),u.font&&(parts=e.fonts[u.font].match(/^(\*|\S+? \S+?) (\S+?) (\S.*)$/),c("fontfamily",parts[3]),c("fontsize",parts[2]),c("fontlook",parts[1])),a("textcolor"),u.color&&l("textcolor",e.colors[u.color]),a("bgcolor"),u.bgcolor&&l("bgcolor",e.colors[u.bgcolor]),s(["numberformat","textformat"]),u.nontextvalueformat&&l("numberformat",e.valueformats[u.nontextvalueformat]),u.textvalueformat&&l("textformat",e.valueformats[u.textvalueformat]),s(["colspan","rowspan"]),l("colspan",u.colspan||1),l("rowspan",u.rowspan||1),o=0;4>o;o++)i="trbl".charAt(o),n="b"+i,a(n),l(n,u[n]?e.borderstyles[u[n]]:""),a(n+"thickness"),a(n+"style"),a(n+"color"),u[n]&&(parts=e.borderstyles[u[n]].match(/(\S+)\s+(\S+)\s+(\S.+)/),l(n+"thickness",parts[1]),l(n+"style",parts[2]),l(n+"color",parts[3]));return s(["cssc","csss","mod"]),l("cssc",u.cssc||""),l("csss",u.csss||""),l("mod",u.mod||"n"),r},t.EncodeSheetAttributes=function(e){var t,o=e.attribs,i={},n=function(e){i[e]={def:!0,val:""}},r=function(e){for(var t=0;t<e.length;t++)n(e[t])},a=function(e,o){i[e].def=!1,i[e].val=o||t},s=function(e,t){"*"!=t&&(i[e].def=!1,i[e].val=t)};return n("colwidth"),o.defaultcolwidth&&a("colwidth",o.defaultcolwidth),n("rowheight"),o.rowheight&&a("rowheight",o.defaultrowheight),n("textalignhoriz"),o.defaulttextformat&&a("textalignhoriz",e.cellformats[o.defaulttextformat]),n("numberalignhoriz"),o.defaultnontextformat&&a("numberalignhoriz",e.cellformats[o.defaultnontextformat]),r(["alignvert","padtop","padright","padbottom","padleft"]),o.defaultlayout&&(parts=e.layouts[o.defaultlayout].match(/^padding:\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+);vertical-align:\s*(\S+);/),s("padtop",parts[1]),s("padright",parts[2]),s("padbottom",parts[3]),s("padleft",parts[4]),s("alignvert",parts[5])),r(["fontfamily","fontlook","fontsize"]),o.defaultfont&&(parts=e.fonts[o.defaultfont].match(/^(\*|\S+? \S+?) (\S+?) (\S.*)$/),s("fontfamily",parts[3]),s("fontsize",parts[2]),s("fontlook",parts[1])),n("textcolor"),o.defaultcolor&&a("textcolor",e.colors[o.defaultcolor]),n("bgcolor"),o.defaultbgcolor&&a("bgcolor",e.colors[o.defaultbgcolor]),r(["numberformat","textformat"]),o.defaultnontextvalueformat&&a("numberformat",e.valueformats[o.defaultnontextvalueformat]),o.defaulttextvalueformat&&a("textformat",e.valueformats[o.defaulttextvalueformat]),n("recalc"),o.recalc&&a("recalc",o.recalc),n("usermaxcol"),o.usermaxcol&&a("usermaxcol",o.usermaxcol),n("usermaxrow"),o.usermaxrow&&a("usermaxrow",o.usermaxrow),i},t.DecodeCellAttributes=function(e,t,o,n){var r,a,s,l=e.GetAssuredCell(t),c=!1,u=function(e,t,i){var n;o[e]&&(n=o[e].def?"":o[e].val,n!=(t||"")&&h(i+" "+n))},d="",h=function(e){d&&(d+="\n"),d+="set "+(n||t)+" "+e,c=!0};for(u("alignhoriz",e.cellformats[l.cellformat],"cellformat"),r=o.alignvert.def&&o.padtop.def&&o.padright.def&&o.padbottom.def&&o.padleft.def?"":"padding:"+(o.padtop.def?"* ":o.padtop.val+" ")+(o.padright.def?"* ":o.padright.val+" ")+(o.padbottom.def?"* ":o.padbottom.val+" ")+(o.padleft.def?"*":o.padleft.val)+";vertical-align:"+(o.alignvert.def?"*;":o.alignvert.val+";"),r!=(e.layouts[l.layout]||"")&&h("layout "+r),r=o.fontlook.def&&o.fontsize.def&&o.fontfamily.def?"":(o.fontlook.def?"* ":o.fontlook.val+" ")+(o.fontsize.def?"* ":o.fontsize.val+" ")+(o.fontfamily.def?"*":o.fontfamily.val),r!=(e.fonts[l.font]||"")&&h("font "+r),u("textcolor",e.colors[l.color],"color"),u("bgcolor",e.colors[l.bgcolor],"bgcolor"),u("numberformat",e.valueformats[l.nontextvalueformat],"nontextvalueformat"),u("textformat",e.valueformats[l.textvalueformat],"textvalueformat"),i=0;4>i;i++)a="trbl".charAt(i),s="b"+a,u(s,e.borderstyles[l[s]],s);return u("cssc",l.cssc,"cssc"),u("csss",l.csss,"csss"),o.mod&&(r=o.mod.def?"n":o.mod.val,r!=(l.mod||"n")&&("n"==r&&(r=""),h("mod "+r))),c?d:null},t.DecodeSheetAttributes=function(e,t){var o,i=e.attribs,n=!1,r=function(e,o,i){var n;t[e]&&(n=t[e].def?"":t[e].val,n!=(o||"")&&s(i+" "+n))},a="",s=function(e){a&&(a+="\n"),a+="set sheet "+e,n=!0};return r("colwidth",i.defaultcolwidth,"defaultcolwidth"),r("rowheight",i.defaultrowheight,"defaultrowheight"),r("textalignhoriz",e.cellformats[i.defaulttextformat],"defaulttextformat"),r("numberalignhoriz",e.cellformats[i.defaultnontextformat],"defaultnontextformat"),o=t.alignvert.def&&t.padtop.def&&t.padright.def&&t.padbottom.def&&t.padleft.def?"":"padding:"+(t.padtop.def?"* ":t.padtop.val+" ")+(t.padright.def?"* ":t.padright.val+" ")+(t.padbottom.def?"* ":t.padbottom.val+" ")+(t.padleft.def?"*":t.padleft.val)+";vertical-align:"+(t.alignvert.def?"*;":t.alignvert.val+";"),o!=(e.layouts[i.defaultlayout]||"")&&s("defaultlayout "+o),o=t.fontlook.def&&t.fontsize.def&&t.fontfamily.def?"":(t.fontlook.def?"* ":t.fontlook.val+" ")+(t.fontsize.def?"* ":t.fontsize.val+" ")+(t.fontfamily.def?"*":t.fontfamily.val),o!=(e.fonts[i.defaultfont]||"")&&s("defaultfont "+o),r("textcolor",e.colors[i.defaultcolor],"defaultcolor"),r("bgcolor",e.colors[i.defaultbgcolor],"defaultbgcolor"),r("numberformat",e.valueformats[i.defaultnontextvalueformat],"defaultnontextvalueformat"),r("textformat",e.valueformats[i.defaulttextvalueformat],"defaulttextvalueformat"),r("recalc",e.attribs.recalc,"recalc"),r("usermaxcol",e.attribs.usermaxcol,"usermaxcol"),r("usermaxrow",e.attribs.usermaxrow,"usermaxrow"),n?a:null},t.SheetCommandInfo=function(e){this.sheetobj=e,this.timerobj=null,this.firsttimerdelay=50,this.timerdelay=1,this.maxtimeslice=100,this.saveundo=!1,this.CmdExtensionCallbacks={}},t.ScheduleSheetCommands=function(o,i,n){var r=o.sci,a=new t.Parse(i);r.sheetobj.statuscallback&&o.statuscallback(r,"cmdstart","",r.sheetobj.statuscallbackparams),n&&r.sheetobj.changes.PushChange(""),r.timerobj=e.setTimeout(function(){t.SheetCommandsTimerRoutine(r,a,n)},r.firsttimerdelay)},t.SheetCommandsTimerRoutine=function(o,i,n){var r,a=new Date;for(o.timerobj=null;!i.EOF();){try{r=t.ExecuteSheetCommand(o.sheetobj,i,n)}catch(s){r=s.message}if(r&&("function"==typeof alert?alert(r):console.log(r)),i.NextLine(),new Date-a>=o.maxtimeslice)return void(o.timerobj=e.setTimeout(function(){t.SheetCommandsTimerRoutine(o,i,n)},o.timerdelay))}o.sheetobj.statuscallback&&o.sheetobj.statuscallback(o,"cmdend","",o.sheetobj.statuscallbackparams)},t.ExecuteSheetCommand=function(e,o,i){function n(o){function i(e){return"v"==e||"c"==e}var n=t.GetSpreadsheetControlObject().editor,r=n.range2,a=void 0;if(r.hasrange){var s,l;o&&r.bottom-r.top==1&&r.left==r.right?(s=e.GetAssuredCell(t.crToCoord(r.left,r.top)),l=e.GetAssuredCell(t.crToCoord(r.left,r.bottom)),i(s.datatype)&&i(l.datatype)&&(a=l.datavalue-s.datavalue)):o||r.left==r.right||(s=e.GetAssuredCell(t.crToCoord(r.left,r.top)),l=e.GetAssuredCell(t.crToCoord(r.right,r.top)),i(s.datatype)&&i(l.datatype)&&(a=l.datavalue-s.datavalue))}return n.Range2Remove(),a}var r,a,s,l,c,u,d,h,p,f,m,g,v,b,y,C,w,x,_,S,k,T,F,E,D,P,A,I,M,R,N,L,O,z,H,B,U,j,V,W,G,$,Y,K,q,X,J,Z,Q,et,tt,ot,it,nt,rt,at,st,lt,ct,ut,dt,b,y,ht,pt,ft,mt=e.attribs,gt=e.changes,vt=t.CellProperties,bt=t.Constants,yt=!1,Ct=function(){var e=t.ParseRange(l);g=e.cr1,v=e.cr2,v.col>mt.lastcol&&(mt.lastcol=v.col),v.row>mt.lastrow&&(mt.lastrow=v.row)};switch(p="",r=o.RestOfStringNoMove(),i&&e.changes.AddDo(r),a=o.NextToken()){case"set":if(l=o.NextToken(),c=o.NextToken(),s=o.RestOfString(),f="set "+l+" "+c,"sheet"==l)switch(e.renderneeded=!0,c){case"defaultcolwidth":i&&gt.AddUndo(f,mt[c]),mt[c]=s;break;case"defaultcolor":case"defaultbgcolor":i&&gt.AddUndo(f,e.GetStyleString("color",mt[c])),mt[c]=e.GetStyleNum("color",s);break;case"defaultlayout":i&&gt.AddUndo(f,e.GetStyleString("layout",mt[c])),mt[c]=e.GetStyleNum("layout",s);break;case"defaultfont":i&&gt.AddUndo(f,e.GetStyleString("font",mt[c])),"* * *"==s&&(s=""),mt[c]=e.GetStyleNum("font",s);break;case"defaulttextformat":case"defaultnontextformat":i&&gt.AddUndo(f,e.GetStyleString("cellformat",mt[c])),mt[c]=e.GetStyleNum("cellformat",s);break;case"defaulttextvalueformat":case"defaultnontextvalueformat":i&&gt.AddUndo(f,e.GetStyleString("valueformat",mt[c])),mt[c]=e.GetStyleNum("valueformat",s);for(C in e.cells)delete e.cells[C].displaystring;break;case"lastcol":case"lastrow":i&&gt.AddUndo(f,mt[c]-0),u=s-0,"number"==typeof u&&(mt[c]=u>0?u:1);break;case"recalc":i&&gt.AddUndo(f,mt[c]),"off"==s?mt.recalc=s:delete mt.recalc;break;case"usermaxcol":case"usermaxrow":i&&gt.AddUndo(f,mt[c]-0),u=s-0,"number"==typeof u&&(mt[c]=u>0?u:0);break;default:p=bt.s_escUnknownSheetCmd+r}else if(/^[a-z]{1,2}(:[a-z]{1,2})?$/i.test(l))for(e.renderneeded=!0,l=l.toUpperCase(),d=l.indexOf(":"),d>=0?(g=t.coordToCr(l.substring(0,d)+"1"),v=t.coordToCr(l.substring(d+1)+"1")):(g=t.coordToCr(l+"1"),v=g),b=g.col;b<=v.col;b++)"width"==c?(C=t.rcColname(b),i&&gt.AddUndo("set "+C+" width",e.colattribs.width[C]),s.length>0?e.colattribs.width[C]=s:delete e.colattribs.width[C]):"hide"==c&&(e.hiddencolrow="col",C=t.rcColname(b),i&&gt.AddUndo("set "+C+" hide",e.colattribs.hide[C]),s.length>0?e.colattribs.hide[C]=s:delete e.colattribs.hide[C]);else if(/^\d+(:\d+)?$/i.test(l))for(e.renderneeded=!0,l=l.toUpperCase(),d=l.indexOf(":"),d>=0?(g=t.coordToCr("A"+l.substring(0,d)),v=t.coordToCr("A"+l.substring(d+1))):(g=t.coordToCr("A"+l),v=g),y=g.row;y<=v.row;y++)"height"==c?(i&&gt.AddUndo("set "+y+" height",e.rowattribs.height[y]),s.length>0?e.rowattribs.height[y]=s:delete e.rowattribs.height[y]):"hide"==c&&(e.hiddencolrow="row",i&&gt.AddUndo("set "+y+" hide",e.rowattribs.hide[y]),s.length>0?e.rowattribs.hide[y]=s:delete e.rowattribs.hide[y]);else if(/^[a-z]{1,2}\d+(:[a-z]{1,2}\d+)?$/i.test(l))for(yt=!0,Ct(),g.row!=v.row||g.col!=v.col||e.celldisplayneeded||e.renderneeded?(e.renderneeded=!0,e.celldisplayneeded=""):e.celldisplayneeded=t.crToCoord(g.col,g.row),y=g.row;y<=v.row;y++)for(b=g.col;b<=v.col;b++)C=t.crToCoord(b,y),w=e.GetAssuredCell(C),w.readonly&&"readonly"!=c||(i&&gt.AddUndo("set "+C+" all",e.CellToString(w)),"value"==c?(d=s.indexOf(" "),w.datavalue=s.substring(d+1)-0,delete w.errors,w.datatype="v",w.valuetype=s.substring(0,d),delete w.displaystring,delete w.parseinfo,mt.needsrecalc="yes"):"text"==c?(d=s.indexOf(" "),w.datavalue=t.decodeFromSave(s.substring(d+1)),delete w.errors,w.datatype="t",w.valuetype=s.substring(0,d),delete w.displaystring,delete w.parseinfo,mt.needsrecalc="yes"):"formula"==c?(w.datavalue=0,delete w.errors,w.datatype="f",t._app&&"e#N/A"!=w.valuetype&&(w.prevvaluetype=w.valuetype),w.valuetype="e#N/A",w.formula=s,delete w.displaystring,delete w.parseinfo,mt.needsrecalc="yes"):"constant"==c?(d=s.indexOf(" "),h=s.substring(d+1).indexOf(" "),w.datavalue=s.substring(d+1,d+1+h)-0,w.valuetype=s.substring(0,d),"e"==w.valuetype.charAt(0)?w.errors=w.valuetype.substring(1):delete w.errors,w.datatype="c",w.formula=s.substring(d+h+2),delete w.displaystring,delete w.parseinfo,mt.needsrecalc="yes"):"empty"==c?(w.datavalue="",delete w.errors,w.datatype=null,w.formula="",w.valuetype="b",delete w.displaystring,delete w.parseinfo,mt.needsrecalc="yes"):"all"==c?(s.length>0?(w=new t.Cell(C),e.CellFromStringParts(w,s.split(":"),1),e.cells[C]=w):delete e.cells[C],mt.needsrecalc="yes"):/^b[trbl]$/.test(c)?(w[c]=e.GetStyleNum("borderstyle",s),e.renderneeded=!0):"color"==c||"bgcolor"==c?w[c]=e.GetStyleNum("color",s):"layout"==c||"cellformat"==c?w[c]=e.GetStyleNum(c,s):"font"==c?("* * *"==s&&(s=""),w[c]=e.GetStyleNum("font",s)):"textvalueformat"==c||"nontextvalueformat"==c?(w[c]=e.GetStyleNum("valueformat",s),delete w.displaystring):"cssc"==c?(s=s.replace(/[^a-zA-Z0-9\-]/g,""),w.cssc=s):"csss"==c?(s=s.replace(/\n/g,""),w.csss=s):"mod"==c?(s=s.replace(/[^yY]/g,"").toLowerCase(),w.mod=s):"comment"==c?w.comment=t.decodeFromSave(s):"readonly"==c?w.readonly="yes"==s.toLowerCase():p=bt.s_escUnknownSetCoordCmd+r);break;case"merge":if(e.renderneeded=!0,l=o.NextToken(),s=o.RestOfString(),Ct(),w=e.GetAssuredCell(g.coord),w.readonly)break;for(y=g.row;y<=v.row;y++)for(b=g.col;b<=v.col;b++)(y!=g.row||b!=g.col)&&(quashedCellCoord=t.crToCoord(b,y),quashedCell=e.GetAssuredCell(quashedCellCoord),i&&gt.AddUndo("set "+quashedCellCoord+" all",e.CellToString(quashedCell)),delete e.cells[quashedCellCoord]);i&&gt.AddUndo("unmerge "+g.coord),v.col>g.col?w.colspan=v.col-g.col+1:delete w.colspan,v.row>g.row?w.rowspan=v.row-g.row+1:delete w.rowspan,e.changedrendervalues=!0;break;case"unmerge":if(e.renderneeded=!0,l=o.NextToken(),s=o.RestOfString(),Ct(),w=e.GetAssuredCell(g.coord),w.readonly)break;i&&gt.AddUndo("merge "+g.coord+":"+t.crToCoord(g.col+(w.colspan||1)-1,g.row+(w.rowspan||1)-1)),delete w.colspan,delete w.rowspan,e.changedrendervalues=!0;break;case"erase":case"cut":for(e.renderneeded=!0,e.changedrendervalues=!0,l=o.NextToken(),s=o.RestOfString(),Ct(),i&&gt.AddUndo("changedrendervalues"),"cut"==a&&(i&&gt.AddUndo("loadclipboard",t.encodeForSave(t.Clipboard.clipboard)),t.Clipboard.clipboard=t.CreateSheetSave(e,l)),y=g.row;y<=v.row;y++)for(b=g.col;b<=v.col;b++)C=t.crToCoord(b,y),w=e.GetAssuredCell(C),w.readonly||(i&&gt.AddUndo("set "+C+" all",e.CellToString(w)),"all"==s?delete e.cells[C]:"formulas"==s?(w.datavalue="",w.datatype=null,w.formula="",w.valuetype="b",delete w.errors,delete w.displaystring,delete w.parseinfo,w.comment&&delete w.comment):"formats"==s&&(x=new t.Cell(C),x.datavalue=w.datavalue,x.datatype=w.datatype,x.formula=w.formula,x.valuetype=w.valuetype,w.comment&&(x.comment=w.comment),e.cells[C]=x));mt.needsrecalc="yes";break;case"fillright":case"filldown":e.renderneeded=!0,e.changedrendervalues=!0,i&&gt.AddUndo("changedrendervalues"),l=o.NextToken(),s=o.RestOfString(),Ct();var wt;for("fillright"==a?(_=!0,S=g.row,k=g.col+1,wt=n(!1)):(_=!1,S=g.row+1,k=g.col,wt=n(!0)),y=S;y<=v.row;y++)for(b=k;b<=v.col;b++)if(C=t.crToCoord(b,y),w=e.GetAssuredCell(C),!w.readonly){if(i&&gt.AddUndo("set "+C+" all",e.CellToString(w)),_?(T=t.crToCoord(g.col,y),E=b-k+1,F=0):(T=t.crToCoord(b,g.row),E=0,F=y-S+1),D=e.GetAssuredCell(T),"all"==s||"formats"==s)for(c in vt)1!=vt[c]&&(void 0===typeof D[c]||3==vt[c]?delete w[c]:w[c]=D[c]);("all"==s||"formulas"==s)&&(w.datavalue=void 0!==wt?D.datavalue+(_?E:F)*wt:D.datavalue,w.datatype=D.datatype,w.valuetype=D.valuetype,w.formula="f"==w.datatype?t.OffsetFormulaCoords(D.formula,E,F):D.formula,delete w.parseinfo,w.errors=D.errors),delete w.displaystring}mt.needsrecalc="yes";break;case"copy":l=o.NextToken(),s=o.RestOfString(),i&&gt.AddUndo("loadclipboard",t.encodeForSave(t.Clipboard.clipboard)),t.Clipboard.clipboard=t.CreateSheetSave(e,l);break;case"loadclipboard":s=o.RestOfString(),i&&gt.AddUndo("loadclipboard",t.encodeForSave(t.Clipboard.clipboard)),t.Clipboard.clipboard=t.decodeFromSave(s);break;case"clearclipboard":i&&gt.AddUndo("loadclipboard",t.encodeForSave(t.Clipboard.clipboard)),t.Clipboard.clipboard="";break;case"paste":if(e.renderneeded=!0,e.changedrendervalues=!0,i&&gt.AddUndo("changedrendervalues"),l=o.NextToken(),s=o.RestOfString(),Ct(),!t.Clipboard.clipboard)break;for(P=new t.Sheet,P.ParseSheetSave(t.Clipboard.clipboard),A=t.ParseRange(P.copiedfrom),I=Math.max(v.col-g.col+1,A.cr2.col-A.cr1.col+1),M=Math.max(v.row-g.row+1,A.cr2.row-A.cr1.row+1),g.col+I-1>mt.lastcol&&(mt.lastcol=g.col+I-1),g.row+M-1>mt.lastrow&&(mt.lastrow=g.row+M-1),y=g.row;y<g.row+M;y++)for(b=g.col;b<g.col+I;b++)if(C=t.crToCoord(b,y),w=e.GetAssuredCell(C),!w.readonly){i&&gt.AddUndo("set "+C+" all",e.CellToString(w));var xt=A.cr1.col+(b-g.col)%(A.cr2.col-A.cr1.col+1),_t=A.cr1.row+(y-g.row)%(A.cr2.row-A.cr1.row+1);if(T=t.crToCoord(xt,_t),D=P.GetAssuredCell(T),"all"==s||"formats"==s){y==g.row&&(sourceColname=t.rcColname(A.cr1.col+(b-g.col)%(A.cr2.col-A.cr1.col+1)),colWidth=P.colattribs.width[sourceColname],colHide=P.colattribs.hide[sourceColname],null!=colWidth&&(e.colattribs.width[t.rcColname(b)]=colWidth),null!=colHide&&(e.colattribs.hide[t.rcColname(b)]=colHide)),b==g.col&&(sourceRow=A.cr1.row+(y-g.row)%(A.cr2.row-A.cr1.row+1),rowHide=P.rowattribs.hide[sourceRow],null!=rowHide&&(e.rowattribs.hide[y]=rowHide));for(c in vt)1!=vt[c]&&(void 0===typeof D[c]||3==vt[c]?delete w[c]:(R=t.CellPropertiesTable[c],w[c]=R&&D[c]?e.GetStyleNum(R,P.GetStyleString(R,D[c])):D[c]))}("all"==s||"formulas"==s)&&(w.datavalue=D.datavalue,w.datatype=D.datatype,w.valuetype=D.valuetype,w.formula="f"==w.datatype?t.OffsetFormulaCoords(D.formula,b-xt,y-_t):D.formula,delete w.parseinfo,w.errors=D.errors,D.comment?w.comment=D.comment:w.comment&&delete w.comment),delete w.displaystring}mt.needsrecalc="yes";break;case"sort":for(e.renderneeded=!0,e.changedrendervalues=!0,i&&gt.AddUndo("changedrendervalues"),l=o.NextToken(),Ct(),X=[],J=[],Z=0,Q=0;3>=Q;Q++)X[Q]=o.NextToken(),J[Q]=o.NextToken(),X[Q]&&(Z=Q);for(tt={},et=[],ot=[],it=[],y=g.row;y<=v.row;y++){for(b=g.col;b<=v.col;b++)C=t.crToCoord(b,y),w=e.cells[C],w?(tt[C]=e.CellToString(w),i&&gt.AddUndo("set "+C+" all",tt[C])):i&&gt.AddUndo("set "+C+" all");for(et.push(et.length),ot.push([]),it.push([]),slast=it.length-1,Q=0;Z>=Q;Q++)C=X[Q]+y,w=e.GetAssuredCell(C),m=w.datavalue,rt=w.valuetype.charAt(0)||"b","t"==rt&&(m=m.toLowerCase()),ot[slast].push(m),it[slast].push(rt)}for(nt=function(e,t){var o,i,n,r,a;for(o=0;Z>=o;o++)if("up"==J[o]?(i=e,n=t):(i=t,n=e),r=it[i][o],tb=it[n][o],"t"==r?"t"==tb?(i=ot[i][o],n=ot[n][o],a=i>n?1:n>i?-1:0):"n"==tb?a=1:"b"==tb?a="up"==J[o]?-1:1:"e"==tb&&(a=-1):"n"==r?"t"==tb?a=-1:"n"==tb?(i=ot[i][o]-0,n=ot[n][o]-0,a=i>n?1:n>i?-1:0):"b"==tb?a="up"==J[o]?-1:1:"e"==tb&&(a=-1):"e"==r?"e"==tb?(i=ot[i][o],n=ot[n][o],a=i>n?1:n>i?-1:0):a="b"==tb&&"up"==J[o]?-1:1:"b"==r&&(a="b"==tb?0:"up"==J[o]?1:-1),a)return a;return a=e>t?1:t>e?-1:0},et.sort(nt),y=g.row;y<=v.row;y++)for(at=et[y-g.row],b=g.col;b<=v.col;b++)C=t.crToCoord(b,y),st=t.crToCoord(b,at+g.row),tt[st]?(w=new t.Cell(C),e.CellFromStringParts(w,tt[st].split(":"),1),"f"==w.datatype&&(w.formula=t.OffsetFormulaCoords(w.formula,0,y-g.row-at)),e.cells[C]=w):delete e.cells[C];mt.needsrecalc="yes";break;case"insertcol":case"insertrow":for(e.renderneeded=!0,e.changedrendervalues=!0,e.widgetsClean=!1,l=o.NextToken(),s=o.RestOfString(),Ct(),"insertcol"==a?(E=1,N=g.col,F=0,L=1,O=g.col,H=g.col,z=1,B=mt.lastrow,i&&gt.AddUndo("deletecol "+g.coord)):(E=0,N=1,F=1,L=g.row,O=1,H=mt.lastcol,z=g.row,B=g.row,i&&gt.AddUndo("deleterow "+g.coord)),y=mt.lastrow;y>=L;y--)for(b=mt.lastcol;b>=N;b--)T=t.crToCoord(b,y),C=t.crToCoord(b+E,y+F),e.cells[T]?e.cells[C]=e.cells[T]:delete e.cells[C];
4for(y=z;B>=y;y++)for(b=O;H>=b;b++){C=t.crToCoord(b,y),w=new t.Cell(C),e.cells[C]=w,T=t.crToCoord(b-E,y-F),D=e.GetAssuredCell(T);for(c in vt)2==vt[c]&&(w[c]=D[c])}for(C in e.cells)w=e.cells[C],w&&"f"==w.datatype&&(w.formula=t.AdjustFormulaCoords(w.formula,g.col,E,g.row,F)),w&&delete w.parseinfo;for(lt in e.names)e.names[lt]&&(ct=e.names[lt].definition,ut="","="==ct.charAt(0)&&(ut="=",ct=ct.substring(1)),e.names[lt].definition=ut+t.AdjustFormulaCoords(ct,g.col,E,g.row,F));for(y=mt.lastrow;y>=L&&"insertrow"==a;y--){U=y+F;for(c in e.rowattribs)m=e.rowattribs[c][y],e.rowattribs[c][U]!=m&&(m?e.rowattribs[c][U]=m:delete e.rowattribs[c][U])}for(b=mt.lastcol;b>=N&&"insertcol"==a;b--){V=t.rcColname(b),j=t.rcColname(b+E);for(c in e.colattribs)m=e.colattribs[c][V],e.colattribs[c][j]!=m&&(m?e.colattribs[c][j]=m:delete e.colattribs[c][j])}var St=new t.RenderContext(e);St.CalculateCellSkipData();var kt={};for(var Tt in St.cellskip){var Ft=t.coordToCr(Tt),Et=St.cellskip[Tt];"insertcol"===a&&Ft.col===O&&(kt[Et]||(e.GetAssuredCell(Et).colspan+=E),kt[Et]=!0),"insertrow"===a&&Ft.row===z&&(kt[Et]||(e.GetAssuredCell(Et).rowspan+=F),kt[Et]=!0)}mt.lastcol+=E,mt.lastrow+=F,mt.needsrecalc="yes";break;case"deletecol":case"deleterow":for(e.renderneeded=!0,e.changedrendervalues=!0,e.widgetsClean=!1,l=o.NextToken(),s=o.RestOfString(),G=mt.lastcol,W=mt.lastrow,Ct(),"deletecol"==a?(E=g.col-v.col-1,F=0,k=v.col+1,S=1):(E=0,F=g.row-v.row-1,k=1,S=v.row+1),y=S;W-F>=y;y++)for(b=k;G-E>=b;b++)if(C=t.crToCoord(b+E,y+F),w=e.cells[C],w&&w.readonly)return p="Unable to remove "+("deletecol"==a?"column":"row")+", because cell "+w.coord+" is locked";for(y=S;W-F>=y;y++)for(b=k;G-E>=b;b++)C=t.crToCoord(b+E,y+F),i&&(S-F>y||k-E>b)&&(w=e.cells[C],w?gt.AddUndo("set "+C+" all",e.CellToString(w)):gt.AddUndo("erase "+C+" all")),T=t.crToCoord(b,y),w=e.cells[T],w?e.cells[C]=w:delete e.cells[C];for(C in e.cells)w=e.cells[C],w&&("f"==w.datatype?(K=w.formula,w.formula=t.AdjustFormulaCoords(K,g.col,E,g.row,F),w.formula!=K&&(delete w.parseinfo,i&&-1!=w.formula.indexOf("#REF!")&&(q=t.coordToCr(C),gt.AddUndo("set "+t.rcColname(q.col-E)+(q.row-F)+" formula "+K)))):delete w.parseinfo);for(lt in e.names)e.names[lt]&&(ct=e.names[lt].definition,ut="","="==ct.charAt(0)&&(ut="=",ct=ct.substring(1)),e.names[lt].definition=ut+t.AdjustFormulaCoords(ct,g.col,E,g.row,F));for(y=S;W-F>=y&&"deleterow"==a;y++){$=y+F;for(c in e.rowattribs)m=e.rowattribs[c][y],e.rowattribs[c][$]!=m&&(i&&gt.AddUndo("set "+$+" "+c,e.rowattribs[c][$]),m?e.rowattribs[c][$]=m:delete e.rowattribs[c][$])}for(b=k;G-E>=b&&"deletecol"==a;b++){V=t.rcColname(b),Y=t.rcColname(b+E);for(c in e.colattribs)m=e.colattribs[c][V],e.colattribs[c][Y]!=m&&(i&&gt.AddUndo("set "+Y+" "+c,e.colattribs[c][Y]),m?e.colattribs[c][Y]=m:delete e.colattribs[c][Y])}var St=new t.RenderContext(e);St.CalculateCellSkipData();var Dt={};for(var Tt in St.cellskip){var Ft=t.coordToCr(Tt),Et=St.cellskip[Tt],Pt=St.coordToCR[Et];"deletecol"===a&&Ft.col===k+E&&Pt.col<Ft.col&&(Dt[Et]||(e.GetAssuredCell(Et).colspan+=E),Dt[Et]=!0),"deleterow"===a&&Ft.row===S+F&&Pt.row<Ft.row&&(Dt[Et]||(e.GetAssuredCell(Et).rowspan+=F),Dt[Et]=!0)}if(i)if("deletecol"==a)for(b=g.col;b<=v.col;b++)gt.AddUndo("insertcol "+t.rcColname(g.col));else for(y=g.row;y<=v.row;y++)gt.AddUndo("insertrow "+g.row);"deletecol"==a?g.col<=G&&(v.col<=G?mt.lastcol+=E:mt.lastcol=g.col-1):g.row<=W&&(v.row<=W?mt.lastrow+=F:mt.lastrow=g.row-1),mt.needsrecalc="yes";break;case"movepaste":case"moveinsert":var At,It,Mt,Rt,Nt,Lt,Ot;for(e.renderneeded=!0,e.changedrendervalues=!0,i&&gt.AddUndo("changedrendervalues"),l=o.NextToken(),It=o.NextToken(),s=o.RestOfString(),""==s&&(s="all"),Ct(),Mt=t.coordToCr(It),E=Mt.col-g.col,F=Mt.row-g.row,I=v.col-g.col+1,M=v.row-g.row+1,At={},y=g.row;y<=v.row;y++)for(b=g.col;b<=v.col;b++)if(C=t.crToCoord(b,y),w=e.GetAssuredCell(C),!w.readonly&&(i&&gt.AddUndo("set "+C+" all",e.CellToString(w)),e.cells[C])){At[C]=new t.Cell(C);for(c in vt)void 0!==typeof w[c]&&(At[C][c]=w[c],"all"==s&&delete w[c],"formulas"==s&&(1==vt[c]||3==vt[c])&&delete w[c],"formats"==s&&2==vt[c]&&delete w[c]);"formulas"==s&&(w.datavalue="",w.datatype=null,w.formula="",w.valuetype="b"),"all"==s&&delete e.cells[C]}if("moveinsert"==a&&(Rt=!1,Nt=!1,0==F&&(Mt.col<g.col||Mt.col>v.col)?Mt.col<g.col?(Lt=g.col-Mt.col,Rt=-1):(Mt.col-=1,E=Mt.col-v.col,Lt=Mt.col-v.col,Rt=1):0==E&&(Mt.row<g.row||Mt.row>v.row)?Mt.row<g.row?(Lt=g.row-Mt.row,Nt=-1):(Mt.row-=1,F=Mt.row-v.row,Lt=Mt.row-v.row,Nt=1):a="movepaste"),Ot={},Nt)for(y=0;Lt>y;y++)for(b=g.col;b<=v.col;b++){if(0>Nt?(T=t.crToCoord(b,Mt.row+Lt-y-1),C=t.crToCoord(b,v.row-y)):(T=t.crToCoord(b,Mt.row-Lt+y+1),C=t.crToCoord(b,g.row+y)),D=e.GetAssuredCell(T),i&&gt.AddUndo("set "+T+" all",e.CellToString(D)),w=e.GetAssuredCell(C),"all"==s||"formats"==s)for(c in vt)1!=vt[c]&&(void 0===typeof D[c]||3==vt[c]?delete w[c]:w[c]=D[c]);("all"==s||"formulas"==s)&&(w.datavalue=D.datavalue,w.datatype=D.datatype,w.valuetype=D.valuetype,w.formula=D.formula,delete w.parseinfo,w.errors=D.errors),delete w.displaystring,Ot[T]=C}if(Rt)for(b=0;Lt>b;b++)for(y=g.row;y<=v.row;y++){if(0>Rt?(T=t.crToCoord(Mt.col+Lt-b-1,y),C=t.crToCoord(v.col-b,y)):(T=t.crToCoord(Mt.col-Lt+b+1,y),C=t.crToCoord(g.col+b,y)),D=e.GetAssuredCell(T),i&&gt.AddUndo("set "+T+" all",e.CellToString(D)),w=e.GetAssuredCell(C),"all"==s||"formats"==s)for(c in vt)1!=vt[c]&&(void 0===typeof D[c]||3==vt[c]?delete w[c]:w[c]=D[c]);("all"==s||"formulas"==s)&&(w.datavalue=D.datavalue,w.datatype=D.datatype,w.valuetype=D.valuetype,w.formula=D.formula,delete w.parseinfo,w.errors=D.errors),delete w.displaystring,Ot[T]=C}for(Mt.col+I-1>mt.lastcol&&(mt.lastcol=Mt.col+I-1),Mt.row+M-1>mt.lastrow&&(mt.lastrow=Mt.row+M-1),y=g.row;y<g.row+M;y++)for(b=g.col;b<g.col+I;b++)if(C=t.crToCoord(b+E,y+F),w=e.GetAssuredCell(C),!w.readonly)if(i&&gt.AddUndo("set "+C+" all",e.CellToString(w)),T=t.crToCoord(b,y),Ot[T]=C,"all"!=s||At[T]){if(D=At[T],D||(D=e.GetAssuredCell(T)),"all"==s||"formats"==s)for(c in vt)1!=vt[c]&&(void 0===typeof D[c]||3==vt[c]?delete w[c]:w[c]=D[c]);("all"==s||"formulas"==s)&&(w.datavalue=D.datavalue,w.datatype=D.datatype,w.valuetype=D.valuetype,w.formula=D.formula,delete w.parseinfo,w.errors=D.errors,D.comment?w.comment=D.comment:w.comment&&delete w.comment),delete w.displaystring}else delete e.cells[C];for(C in e.cells)w=e.cells[C],w&&("f"==w.datatype?(K=w.formula,w.formula=t.ReplaceFormulaCoords(K,Ot),w.formula!=K&&(delete w.parseinfo,i&&!Ot[C]&&gt.AddUndo("set "+C+" formula "+K))):delete w.parseinfo);for(lt in e.names)e.names[lt]&&(ct=e.names[lt].definition,K=ct,ut="","="==ct.charAt(0)&&(ut="=",ct=ct.substring(1)),e.names[lt].definition=ut+t.ReplaceFormulaCoords(ct,Ot),i&&e.names[lt].definition!=K&&gt.AddUndo("name define "+lt+" "+K));mt.needsrecalc="yes";break;case"name":if(l=o.NextToken(),lt=o.NextToken(),s=o.RestOfString(),lt=lt.toUpperCase().replace(/[^A-Z0-9_\.]/g,""),""==lt)break;if("define"==l){if(""==s)break;e.names[lt]?(i&&gt.AddUndo("name define "+lt+" "+e.names[lt].definition),e.names[lt].definition=s):(i&&gt.AddUndo("name delete "+lt),e.names[lt]={definition:s,desc:""})}else"desc"==l?e.names[lt]&&(i&&gt.AddUndo("name desc "+lt+" "+e.names[lt].desc),e.names[lt].desc=s):"delete"==l&&(i&&(e.names[lt].desc&&gt.AddUndo("name desc "+lt+" "+e.names[lt].desc),gt.AddUndo("name define "+lt+" "+e.names[lt].definition)),delete e.names[lt]);mt.needsrecalc="yes";break;case"recalc":mt.needsrecalc="yes",e.recalconce=!0;break;case"redisplay":e.renderneeded=!0;break;case"changedrendervalues":e.changedrendervalues=!0;break;case"pane":if(lt=o.NextToken().toUpperCase(),pt=1,ht=t.GetSpreadsheetControlObject().editor,"ROW"===lt.toUpperCase()){for(y=parseInt(o.NextToken(),10),"undefined"!=typeof ht.context.rowpanes[1]&&"number"==typeof ht.context.rowpanes[1].first&&(pt=ht.context.rowpanes[1].first),i&&gt.AddUndo("pane row "+pt);"yes"==ht.context.sheetobj.rowattribs.hide[y];)y++;(!y||y<=ht.context.rowpanes[0].first)&&ht.context.rowpanes.length>1?ht.context.rowpanes.length=1:ht.context.rowpanes.length-1&&!ht.timeout?(ht.context.SetRowPaneFirstLast(0,ht.context.rowpanes[0].first,y-1),ht.context.SetRowPaneFirstLast(1,y,y)):(ht.context.SetRowPaneFirstLast(0,ht.context.rowpanes[0].first,y-1),ht.context.SetRowPaneFirstLast(1,y,y)),ht.griddiv&&(ft=document.getElementById("trackingline-vertical"),ft&&(ht.griddiv.removeChild(ft),ht.FitToEditTable()))}else{for(b=parseInt(o.NextToken(),10),"undefined"!=typeof ht.context.colpanes[1]&&"number"==typeof ht.context.colpanes[1].first&&(pt=ht.context.colpanes[1].first),i&&gt.AddUndo("pane col "+pt);"yes"==ht.context.sheetobj.colattribs.hide[t.rcColname(b)];)b++;(!b||b<=ht.context.colpanes[0].first)&&ht.context.colpanes.length>1?ht.context.colpanes.length=1:ht.context.colpanes.length-1&&!ht.timeout?(ht.context.SetColPaneFirstLast(0,ht.context.colpanes[0].first,b-1),ht.context.SetColPaneFirstLast(1,b,b)):(ht.context.SetColPaneFirstLast(0,ht.context.colpanes[0].first,b-1),ht.context.SetColPaneFirstLast(1,b,b)),ht.griddiv&&(ft=document.getElementById("trackingline-horizon"),ft&&(ht.griddiv.removeChild(ft),ht.FitToEditTable()))}e.renderneeded=!0;break;case"startcmdextension":lt=o.NextToken(),dt=e.sci.CmdExtensionCallbacks[lt],dt&&dt.func(lt,dt.data,e,o,i);break;case"settimetrigger":case"sendemail":case"submitform":break;default:p=bt.s_escUnknownCmd+r}return t._app&&(yt?1==e.renderneeded&&"value"!=c&&"text"!=c&&"formula"!=c&&"constant"!=c&&"empty"!=c?e.widgetsClean=!1:"all"==c&&(e.widgetsClean=!1):1==e.renderneeded&&(e.widgetsClean=!1)),p},t.SheetUndo=function(e){var t,o=e.changes.TOS(),i=o?o.undo.length-1:-1,n="";for(t=i;t>=0;t--)n&&(n+="\n"),n+=o.undo[t];e.changes.Undo(),e.ScheduleSheetCommands(n,!1)},t.SheetRedo=function(e){var t,o,i=e.changes.Redo();if(!i)return void e.ScheduleSheetCommands("",!1);t=e.changes.TOS();var n="";for(o=0;t&&o<t.command.length;o++)n&&(n+="\n"),n+=t.command[o];e.ScheduleSheetCommands(n,!1)},t.CreateAuditString=function(e){var t,o,i="",n=e.changes.stack,r=e.changes.tos;for(t=0;r>=t;t++)for(o=0;o<n[t].command.length;o++)i+=n[t].command[o]+"\n";return i},t.GetStyleNum=function(e,t,o){var i;return 0==o.length?0:(i=e[t+"hash"][o],i||(e[t+"s"].length<1&&e[t+"s"].push(""),i=e[t+"s"].push(o)-1,e[t+"hash"][o]=i,e.changedrendervalues=!0),i)},t.GetStyleString=function(e,t,o){return o?e[t+"s"][o]:null},t.OffsetFormulaCoords=function(e,o,i){var n,r,a,s,l,c,u="",d=t.Formula;if(!d)return"Need SocialCalc.Formula";var h=d.TokenType,p=h.op,f=h.string,m=h.coord,g=d.TokenOpExpansion;for(n=d.ParseFormulaIntoTokens(e),s=0;s<n.length;s++)a=n[s].type,r=n[s].text,a==m?(c="",l=t.coordToCr(r),"$"!=r.charAt(0)?l.col+=o:c+="$",c+=t.rcColname(l.col),-1==r.indexOf("$",1)?l.row+=i:c+="$",c+=l.row,(l.row<1||l.col<1)&&(c="#REF!"),u+=c):u+=a==f?r.indexOf('"')>=0?'"'+r.replace(/"/,'""')+'"':'"'+r+'"':a==p?g[r]||r:r;return u},t.AdjustFormulaCoords=function(e,o,i,n,r){var a,s,l,c,u="",d=!1,h=t.Formula;if(!h)return"Need SocialCalc.Formula";var p=h.TokenType,f=p.op,m=p.string,g=p.coord,v=h.TokenOpExpansion;for(parseinfo=t.Formula.ParseFormulaIntoTokens(e),l=0;l<parseinfo.length;l++)a=parseinfo[l].type,s=parseinfo[l].text,a==f&&("!"==s?d=!0:":"!=s&&(d=!1),s=v[s]||s),a==g?(cr=t.coordToCr(s),(0>i&&cr.col>=o&&cr.col<o-i||0>r&&cr.row>=n&&cr.row<n-r)&&(d||(cr.col=0,cr.row=0)),d||(cr.col>=o&&(cr.col+=i),cr.row>=n&&(cr.row+=r)),c="$"==s.charAt(0)?"$"+t.rcColname(cr.col):t.rcColname(cr.col),c+=-1!=s.indexOf("$",1)?"$"+cr.row:cr.row,(cr.row<1||cr.col<1)&&(c="#REF!"),s=c):a==m&&(s=s.indexOf('"')>=0?'"'+s.replace(/"/,'""')+'"':'"'+s+'"'),u+=s;return u},t.ReplaceFormulaCoords=function(e,o){var i,n,r,a,s,l="",c=!1,u=t.Formula;if(!u)return"Need SocialCalc.Formula";var d=u.TokenType,h=d.op,p=d.string,f=d.coord,m=u.TokenOpExpansion;for(parseinfo=t.Formula.ParseFormulaIntoTokens(e),r=0;r<parseinfo.length;r++)i=parseinfo[r].type,n=parseinfo[r].text,i==h&&("!"==n?c=!0:":"!=n&&(c=!1),n=m[n]||n),i==f?(cr=t.coordToCr(n),s=t.crToCoord(cr.col,cr.row),o[s]&&!c&&(cr=t.coordToCr(o[s]),a="$"==n.charAt(0)?"$"+t.rcColname(cr.col):t.rcColname(cr.col),a+=-1!=n.indexOf("$",1)?"$"+cr.row:cr.row,n=a)):i==p&&(n=n.indexOf('"')>=0?'"'+n.replace(/"/,'""')+'"':'"'+n+'"'),l+=n;return l},t.RecalcInfo={sheet:null,currentState:0,state:{idle:0,start_calc:1,order:2,calc:3,start_wait:4,done_wait:5},recalctimer:null,maxtimeslice:100,timeslicedelay:1,starttime:0,queue:[],LoadSheet:function(){return!1}},t.RecalcData=function(){this.inrecalc=!0,this.celllist=[],this.celllistitem=0,this.calclist=null,this.calclistlength=0,this.firstcalc=null,this.lastcalc=null,this.nextcalc=null,this.count=0,this.checkinfo={}},t.RecalcCheckInfo=function(){this.oldcoord=null,this.parsepos=0,this.inrange=!1,this.inrangestart=!1,this.cr1=null,this.cr2=null,this.c1=null,this.c2=null,this.r1=null,this.r2=null,this.c=null,this.r=null},t.RecalcSheet=function(e){var o=t.RecalcInfo;return o.currentState!=o.state.idle?void o.queue.push(e):(delete e.attribs.circularreferencecell,t.Formula.FreshnessInfoReset(),t.RecalcClearTimeout(),o.sheet=e,o.currentState=o.state.start_calc,o.starttime=new Date,e.statuscallback&&e.statuscallback(o,"calcstart",null,e.statuscallbackparams),void t.RecalcSetTimeout())},t.RecalcSetTimeout=function(){var o=t.RecalcInfo;o.recalctimer=e.setTimeout(t.RecalcTimerRoutine,o.timeslicedelay)},t.RecalcClearTimeout=function(){var o=t.RecalcInfo;o.recalctimer&&(e.clearTimeout(o.recalctimer),o.recalctimer=null)},t.RecalcLoadedSheet=function(e,o,i,n){var r,a=t.RecalcInfo,s=t.Formula;r=t.Formula.AddSheetToCache(e||s.SheetCache.waitingForLoading,o,n),i&&r&&"off"!=r.attribs.recalc&&(r.previousrecalcsheet=a.sheet,a.sheet=r,a.currentState=a.state.start_calc),s.SheetCache.waitingForLoading=null,t.RecalcSetTimeout()},t.RecalcTimerRoutine=function(){var e,o,i,n,r,a=new Date,s=0,l=t.Formula;if(!l)return"Need SocialCalc.Formula";var c=t.RecalcInfo,u=c.sheet;if(u){var d=u.recalcdata||(u.recalcdata={}),h=function(e,t){u.statuscallback&&u.statuscallback(d,e,t,u.statuscallbackparams)};if(t.RecalcClearTimeout(),c.currentState==c.state.start_calc){d=new t.RecalcData,u.recalcdata=d;for(i in u.cells)i&&d.celllist.push(i);d.calclist={},c.currentState=c.state.order}if(c.currentState==c.state.order){for(;d.celllistitem<d.celllist.length;)if(i=d.celllist[d.celllistitem++],n=t.RecalcCheckCell(u,i),new Date-a>=c.maxtimeslice)return h("calcorder",{coord:i,total:d.celllist.length,count:d.celllistitem}),void t.RecalcSetTimeout();return h("calccheckdone",d.calclistlength),d.nextcalc=d.firstcalc,c.currentState=c.state.calc,void t.RecalcSetTimeout()}if(c.currentState==c.state.start_wait){if(c.currentState=c.state.done_wait,c.LoadSheet&&(r=c.LoadSheet(l.SheetCache.waitingForLoading)))return;return void t.RecalcLoadedSheet(null,"",!1)}if(c.currentState==c.state.done_wait)return c.currentState=c.state.calc,void t.RecalcSetTimeout();for(c.currentState!=c.state.calc&&alert("Recalc state error: "+c.currentState+". Error in SocialCalc code."),i=u.recalcdata.nextcalc;i;){if(o=u.cells[i],o.parseinfo||(o.parseinfo=l.ParseFormulaIntoTokens(o.formula)),o.parseinfo.coord=i,e=l.evaluate_parsed_formula(o.parseinfo,u,!1),l.SheetCache.waitingForLoading){if(1!=c.firstRenderScheduled){var p=t.GetSpreadsheetControlObject().editor;p.ScheduleRender(!1),c.firstRenderScheduled=!0}return d.nextcalc=i,d.count+=s,h("calcloading",{sheetname:l.SheetCache.waitingForLoading}),c.currentState=c.state.start_wait,void t.RecalcSetTimeout()}if(l.RemoteFunctionInfo.waitingForServer)return d.nextcalc=i,d.count+=s,h("calcserverfunc",{funcname:l.RemoteFunctionInfo.waitingForServer,coord:i,total:d.calclistlength,count:d.count}),void(c.currentState=c.state.done_wait);if((o.datavalue!=e.value||o.valuetype!=e.type)&&(o.datavalue=e.value,o.valuetype=e.type,delete o.displaystring,u.recalcchangedavalue=!0),e.error&&(o.errors=e.error),s++,i=u.recalcdata.calclist[i],new Date-a>=c.maxtimeslice)return d.nextcalc=i,d.count+=s,h("calcstep",{coord:i,total:d.calclistlength,count:d.count}),void t.RecalcSetTimeout()}if(d.inrecalc=!1,u.reRenderCellList=u.recalcdata.celllist,delete u.recalcdata,delete u.attribs.needsrecalc,c.sheet=u.previousrecalcsheet||null,c.sheet)return c.currentState=c.state.calc,void t.RecalcSetTimeout();l.FreshnessInfo.recalc_completed=!0,c.currentState=c.state.idle,h("calcfinished",new Date-c.starttime),c.queue.length>0&&(u=c.queue.shift(),u.RecalcSheet())}},t.RecalcCheckCell=function(e,o){var i,n,r,a,s,l,c,u,d,h,p=t.Formula;if(!p)return"Need SocialCalc.Formula";var f=p.TokenType,m=f.op,g=f.name,v=f.coord,b=e.recalcdata,y=b.checkinfo,C=!1,w=null,x=o;e:for(;x;)if(d=e.cells[x],h=y[x],!d||"f"!=d.datatype||h&&"object"!=typeof h)x=w,y[x]&&(w=y[x].oldcoord);else{for(h||(h=new t.RecalcCheckInfo,y[x]=h),d.errors&&delete d.errors,d.parseinfo||(d.parseinfo=p.ParseFormulaIntoTokens(d.formula)),i=d.parseinfo,a=h.parsepos;a<i.length;a++){if(h.inrange){if(h.inrangestart&&(h.cr1.col>h.cr2.col?(h.c1=h.cr2.col,h.c2=h.cr1.col):(h.c1=h.cr1.col,h.c2=h.cr2.col),h.c=h.c1-1,h.cr1.row>h.cr2.row?(h.r1=h.cr2.row,h.r2=h.cr1.row):(h.r1=h.cr1.row,h.r2=h.cr2.row),h.r=h.r1,h.inrangestart=!1),h.c+=1,h.c>h.c2){if(h.r+=1,h.r>h.r2){h.inrange=!1;continue}h.c=h.c1}if(s=t.crToCoord(h.c,h.r),h.parsepos=a,h.oldcoord=w,w=x,x=s,y[x]&&"object"==typeof y[x])return d.errors=t.Constants.s_caccCircRef+o,y[o]=!0,b.firstcalc?b.calclist[b.lastcalc]=o:b.firstcalc=o,b.lastcalc=o,b.calclistlength++,e.attribs.circularreferencecell=x+"|"+w,d.errors;continue e}if(r=i[a].type,n=i[a].text,r==m&&("!"==n?C=!0:":"!=n&&(C=!1)),r==g)if(l=p.LookupName(e,n),"range"==l.type){if(c=l.value.indexOf("|"),-1!=c){h.cr1=t.coordToCr(l.value.substring(0,c)),u=l.value.indexOf("|",c+1),h.cr2=t.coordToCr(l.value.substring(c+1,u)),h.inrange=!0,h.inrangestart=!0,a-=1;continue}}else"coord"==l.type&&(r=v,n=l.value);if(r==v){if(a>=2&&i[a-1].type==m&&":"==i[a-1].text&&i[a-2].type==v&&!C){h.cr1=t.coordToCr(i[a-2].text),h.cr2=t.coordToCr(n),h.inrange=!0,h.inrangestart=!0,a-=1;continue}if(!C){if(-1!=n.indexOf("$")&&(n=n.replace(/\$/g,"")),h.parsepos=a+1,h.oldcoord=w,w=x,x=n,y[x]&&"object"==typeof y[x])return d.errors=t.Constants.s_caccCircRef+o,y[o]=!0,b.firstcalc?b.calclist[b.lastcalc]=o:b.firstcalc=o,b.lastcalc=o,b.calclistlength++,e.attribs.circularreferencecell=x+"|"+w,d.errors;continue e}}}C=!1,y[x]=!0,b.firstcalc?b.calclist[b.lastcalc]=x:b.firstcalc=x,b.lastcalc=x,b.calclistlength++,x=w,w=y[x]?y[x].oldcoord:null}return""},t.Parse=function(e){this.str=e,this.pos=0,this.delimiter=" ",this.lineEnd=e.indexOf("\n"),this.lineEnd<0&&(this.lineEnd=e.length)},t.Parse.prototype.NextToken=function(){if(this.pos<0)return"";var e=this.str.indexOf(this.delimiter,this.pos),t=this.pos;return e>this.lineEnd&&(e=this.lineEnd),e>=0?(this.pos=e+1,this.str.substring(t,e)):(this.pos=this.lineEnd,this.str.substring(t,this.lineEnd))},t.Parse.prototype.RestOfString=function(){var e=this.pos;return this.pos<0||this.pos>=this.lineEnd?"":(this.pos=this.lineEnd,this.str.substring(e,this.lineEnd))},t.Parse.prototype.RestOfStringNoMove=function(){return this.pos<0||this.pos>=this.lineEnd?"":this.str.substring(this.pos,this.lineEnd)},t.Parse.prototype.NextLine=function(){this.pos=this.lineEnd+1,this.lineEnd=this.str.indexOf("\n",this.pos),this.lineEnd<0&&(this.lineEnd=this.str.length)},t.Parse.prototype.EOF=function(){return this.pos<0||this.pos>=this.str.length?!0:!1},t.UndoStack=function(){this.stack=[],this.tos=-1,this.maxRedo=0,this.maxUndo=50},t.UndoStack.prototype.PushChange=function(e){for(;this.stack.length>0&&this.stack.length-1>this.tos;)this.stack.pop();this.stack.push({command:[],type:e,undo:[]}),this.maxRedo&&this.stack.length>this.maxRedo&&this.stack.shift(),this.maxUndo&&this.stack.length>this.maxUndo&&(this.stack[this.stack.length-this.maxUndo-1].undo=[]),this.tos=this.stack.length-1},t.UndoStack.prototype.AddDo=function(){if(this.stack[this.stack.length-1]){for(var e=[],t=0;t<arguments.length;t++)null!=arguments[t]&&e.push(arguments[t]);var o=e.join(" ");this.stack[this.stack.length-1].command.push(o)}},t.UndoStack.prototype.AddUndo=function(){if(this.stack[this.stack.length-1]){for(var e=[],t=0;t<arguments.length;t++)null!=arguments[t]&&e.push(arguments[t]);var o=e.join(" ");this.stack[this.stack.length-1].undo.push(o)}},t.UndoStack.prototype.TOS=function(){return this.tos>=0?this.stack[this.tos]:null},t.UndoStack.prototype.Undo=function(){return this.tos>=0&&(!this.maxUndo||this.tos>this.stack.length-this.maxUndo-1)?(this.tos-=1,!0):!1},t.UndoStack.prototype.Redo=function(){return this.tos<this.stack.length-1?(this.tos+=1,!0):!1},t.Clipboard={clipboard:""},t.RenderContext=function(e){var o=e.attribs,i=t.Constants;if(this.sheetobj=e,this.hideRowsCols=!1,this.showGrid=!1,this.showRCHeaders=!1,this.rownamewidth=i.defaultRowNameWidth,this.pixelsPerRow=i.defaultAssumedRowHeight,this.cellskip={},this.coordToCR={},this.colwidth=[],this.rowheight=[],this.totalwidth=0,this.totalheight=0,this.rowpanes=[],this.colpanes=[],this.colunhideleft=[],this.colunhideright=[],this.rowunhidetop=[],this.rowunhidebottom=[],this.maxcol=0,this.maxrow=0,this.highlights={},this.cursorsuffix="",this.highlightTypes={cursor:{style:i.defaultHighlightTypeCursorStyle,className:i.defaultHighlightTypeCursorClass},range:{style:i.defaultHighlightTypeRangeStyle,className:i.defaultHighlightTypeRangeClass},cursorinsertup:{style:"color:#FFF;backgroundColor:#A6A6A6;backgroundRepeat:repeat-x;backgroundPosition:top left;backgroundImage:url("+i.defaultImagePrefix+"cursorinsertup.gif);",className:i.defaultHighlightTypeCursorClass},cursorinsertleft:{style:"color:#FFF;backgroundColor:#A6A6A6;backgroundRepeat:repeat-y;backgroundPosition:top left;backgroundImage:url("+i.defaultImagePrefix+"cursorinsertleft.gif);",className:i.defaultHighlightTypeCursorClass},range2:{style:"color:#000;backgroundColor:#FFF;backgroundImage:url("+i.defaultImagePrefix+"range2.gif);",className:""}},this.cellIDprefix=i.defaultCellIDPrefix,this.defaultlinkstyle=null,this.defaultHTMLlinkstyle={type:"html"},this.defaultfontstyle=i.defaultCellFontStyle,this.defaultfontsize=i.defaultCellFontSize,this.defaultfontfamily=i.defaultCellFontFamily,this.defaultlayout=i.defaultCellLayout,this.defaultpanedividerwidth=i.defaultPaneDividerWidth,this.defaultpanedividerheight=i.defaultPaneDividerHeight,this.gridCSS=i.defaultGridCSS,this.commentClassName=i.defaultCommentClass,this.commentCSS=i.defaultCommentStyle,this.commentNoGridClassName=i.defaultCommentNoGridClass,this.commentNoGridCSS=i.defaultCommentNoGridStyle,this.readonlyClassName=i.defaultReadonlyClass,this.readonlyCSS=i.defaultReadonlyStyle,this.readonlyNoGridClassName=i.defaultReadonlyNoGridClass,this.readonlyNoGridCSS=i.defaultReadonlyNoGridStyle,this.readonlyComment=i.defaultReadonlyComment,this.classnames={colname:i.defaultColnameClass,rowname:i.defaultRownameClass,selectedcolname:i.defaultSelectedColnameClass,selectedrowname:i.defaultSelectedRownameClass,upperleft:i.defaultUpperLeftClass,skippedcell:i.defaultSkippedCellClass,panedivider:i.defaultPaneDividerClass,unhideleft:i.defaultUnhideLeftClass,unhideright:i.defaultUnhideRightClass,unhidetop:i.defaultUnhideTopClass,unhidebottom:i.defaultUnhideBottomClass,colresizebar:i.defaultColResizeBarClass,rowresizebar:i.defaultRowResizeBarClass},this.explicitStyles={colname:i.defaultColnameStyle,rowname:i.defaultRownameStyle,selectedcolname:i.defaultSelectedColnameStyle,selectedrowname:i.defaultSelectedRownameStyle,upperleft:i.defaultUpperLeftStyle,skippedcell:i.defaultSkippedCellStyle,panedivider:i.defaultPaneDividerStyle,unhideleft:i.defaultUnhideLeftStyle,unhideright:i.defaultUnhideRightStyle,unhidetop:i.defaultUnhideTopStyle,unhidebottom:i.defaultUnhideBottomStyle},this.cellskip=null,this.needcellskip=!0,this.fonts=[],this.layouts=[],this.needprecompute=!0,!o)throw i.s_rcMissingSheet;this.rowpanes[0]={first:1,last:o.lastrow},this.colpanes[0]={first:1,last:o.lastcol},this.usermaxcol=o.usermaxcol,this.usermaxrow=o.usermaxrow},t.RenderContext.prototype.PrecomputeSheetFontsAndLayouts=function(){t.PrecomputeSheetFontsAndLayouts(this)},t.RenderContext.prototype.CalculateCellSkipData=function(){t.CalculateCellSkipData(this)},t.RenderContext.prototype.CalculateColWidthData=function(){t.CalculateColWidthData(this)},t.RenderContext.prototype.CalculateRowHeightData=function(){t.CalculateRowHeightData(this)},t.RenderContext.prototype.SetRowPaneFirstLast=function(e,t,o){this.rowpanes[e]={first:t,last:o}},t.RenderContext.prototype.SetColPaneFirstLast=function(e,t,o){this.colpanes[e]={first:t,last:o}},t.RenderContext.prototype.CoordInPane=function(e,o,i){return t.CoordInPane(this,e,o,i)},t.RenderContext.prototype.CellInPane=function(e,o,i,n){return t.CellInPane(this,e,o,i,n)},t.RenderContext.prototype.InitializeTable=function(e){t.InitializeTable(this,e)},t.RenderContext.prototype.RenderSheet=function(e,o){return t.RenderSheet(this,e,o)},t.RenderContext.prototype.RenderColGroup=function(){return t.RenderColGroup(this)},t.RenderContext.prototype.RenderColHeaders=function(){return t.RenderColHeaders(this)},t.RenderContext.prototype.RenderSizingRow=function(){return t.RenderSizingRow(this)},t.RenderContext.prototype.RenderRow=function(e,o,i){return t.RenderRow(this,e,o,i)},t.RenderContext.prototype.RenderSpacingRow=function(){return t.RenderSpacingRow(this)},t.RenderContext.prototype.RenderCell=function(e,o,i,n,r,a){return t.RenderCell(this,e,o,i,n,r,a)},t.PrecomputeSheetFontsAndLayouts=function(e){var o,i,n,r,a,s,l,c,u=e.sheetobj,d=u.attribs;for(d.defaultfont&&(o=u.fonts[d.defaultfont],o=o.replace(/^\*/,t.Constants.defaultCellFontStyle),o=o.replace(/(.+)\*(.+)/,"$1"+t.Constants.defaultCellFontSize+"$2"),o=o.replace(/\*$/,t.Constants.defaultCellFontFamily),i=o.match(/^(\S+? \S+?) (\S+?) (\S.*)$/),e.defaultfontstyle=i[1],e.defaultfontsize=i[2],e.defaultfontfamily=i[3]),s=1;s<u.fonts.length;s++)l=u.fonts[s],l=l.replace(/^\*/,e.defaultfontstyle),l=l.replace(/(.+)\*(.+)/,"$1"+e.defaultfontsize+"$2"),l=l.replace(/\*$/,e.defaultfontfamily),i=l.match(/^(\S+?) (\S+?) (\S+?) (\S.*)$/),i&&(e.fonts[s]={style:i[1],weight:i[2],size:i[3],family:i[4]});for(n=/^padding:\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+);vertical-align:\s*(\S+);/,r=t.Constants.defaultCellLayout.match(n),a=d.defaultlayout?u.layouts[d.defaultlayout].match(n):["","*","*","*","*","*"],s=1;s<u.layouts.length;s++)if(l=u.layouts[s],i=l.match(n)){for(c=1;5>=c;c++)"*"==i[c]&&(i[c]="*"!=a[c]?a[c]:r[c]);e.layouts[s]="padding:"+i[1]+" "+i[2]+" "+i[3]+" "+i[4]+";vertical-align:"+i[5]+";"}e.needprecompute=!1},t.CalculateCellSkipData=function(e){{var o,i,n,r,a,s,l,c,u,d=e.sheetobj;d.rowattribs,d.colattribs}for(e.maxrow=0,e.maxcol=0,e.cellskip={},o=1;o<=d.attribs.lastrow;o++)for(i=1;i<=d.attribs.lastcol;i++)if(n=t.crToCoord(i,o),r=d.cells[n],void 0!==r&&!e.cellskip[n]&&(a=r.colspan||1,s=r.rowspan||1,a>1||s>1))for(l=o;o+s>l;l++)for(c=i;i+a>c;c++)u=t.crToCoord(c,l),u==n?e.coordToCR[n]={row:o,col:i}:e.cellskip[u]=n,l>e.maxrow&&(maxrow=l),c>e.maxcol&&(maxcol=c);e.needcellskip=!1},t.CalculateColWidthData=function(e){{var o,i,n,r,a=e.sheetobj;a.colattribs}for(r=e.showRCHeaders?e.rownamewidth-0:0,colpane=0;colpane<e.colpanes.length;colpane++)for(o=e.colpanes[colpane].first;o<=e.colpanes[colpane].last;o++)i=t.rcColname(o),"yes"==a.colattribs.hide[i]?e.colwidth[o]=0:(n=a.colattribs.width[i]||a.attribs.defaultcolwidth||t.Constants.defaultColWidth,("blank"==n||"auto"==n)&&(n=""),e.colwidth[o]=n+"",r+=n&&n-0>0?n-0:10);e.totalwidth=r},t.CalculateRowHeightData=function(e){var o,i,n,r=e.sheetobj;for(n=e.showRCHeaders?e.pixelsPerRow:0,rowpane=0;rowpane<e.rowpanes.length;rowpane++)for(o=e.rowpanes[rowpane].first;o<=e.rowpanes[rowpane].last;o++)"yes"===r.rowattribs.hide[o]?e.rowheight[o]=0:(i=r.rowattribs.height[o]||r.attribs.defaultrowheight||t.Constants.defaultAssumedRowHeight,("blank"===i||"auto"===i)&&(i=""),e.rowheight[o]=i+"",n+=i&&i-0>0?i-0:10);e.totalheight=n},t.InitializeTable=function(e,t){t.style.borderCollapse="collapse",t.cellSpacing="0",t.cellPadding="0",t.style.width=e.totalwidth+"px"},t.RenderSheet=function(e,t,o){var i,n,r,a,s,l;for(e.sheetobj.changedrendervalues&&(e.needcellskip=!0,e.needprecompute=!0,e.sheetobj.changedrendervalues=!1),e.needcellskip&&e.CalculateCellSkipData(),e.needprecompute&&e.PrecomputeSheetFontsAndLayouts(),e.CalculateColWidthData(),e.CalculateRowHeightData(),r=document.createElement("table"),e.InitializeTable(r),a=e.RenderColGroup(),r.appendChild(a),s=document.createElement("tbody"),s.appendChild(e.RenderSizingRow()),e.showRCHeaders&&(i=e.RenderColHeaders(),i&&s.appendChild(i)),n=0;n<e.rowpanes.length;n++){for(rownum=e.rowpanes[n].first;rownum<=e.rowpanes[n].last;rownum++)i=e.RenderRow(rownum,n,o),s.appendChild(i);n<e.rowpanes.length-1&&(i=e.RenderSpacingRow(),s.appendChild(i))}return r.appendChild(s),t&&(l=t.parentNode,l&&l.replaceChild(r,t)),r},t.RenderRow=function(e,o,i,n){var r,a,s,l,c=e.sheetobj,u=document.createElement("tr");if(e.showRCHeaders){if(a=document.createElement("td"),e.classnames&&(a.className=e.classnames.rowname),e.explicitStyles&&(a.style.cssText=e.explicitStyles.rowname),a.width=e.rownamewidth,a.height=e.rowheight[o],a.style.verticalAlign="top",a.innerHTML=o+"",o<e.rowpanes[e.rowpanes.length-1].last&&"yes"==c.rowattribs.hide[o+1]){var d=document.createElement("div");d.style.position="relative";var h=document.createElement("div");e.classnames&&(h.className=e.classnames.unhidetop),e.explicitStyles&&(h.style.cssText=e.explicitStyles.unhidetop);var p=e.rowheight[o]-0-t.Constants.defaultAssumedRowHeight;p=0===p?4:p,h.style.bottom="-"+p+"px",e.rowunhidetop[o]=h,d.appendChild(h),a.appendChild(d)}if(o>1&&"yes"==c.rowattribs.hide[o-1]){var h=document.createElement("div");e.classnames&&(h.className=e.classnames.unhidebottom),e.explicitStyles&&(h.style.cssText=e.explicitStyles.unhidebottom),e.rowunhidebottom[o]=h,a.appendChild(h)}var f=document.createElement("div");f.className=e.classnames.rowresizebar,a.appendChild(f),u.appendChild(a)}for(s=0;s<e.colpanes.length;s++){for(r=e.colpanes[s].first;r<=e.colpanes[s].last;r++)a=e.RenderCell(o,r,i,s,null,n),a&&u.appendChild(a);s<e.colpanes.length-1&&(a=document.createElement("td"),a.width=e.defaultpanedividerwidth,e.classnames.panedivider&&(a.className=e.classnames.panedivider),e.explicitStyles.panedivider&&(a.style.cssText=e.explicitStyles.panedivider),l=document.createElement("div"),l.style.width=e.defaultpanedividerwidth+"px",l.style.overflow="hidden",a.appendChild(l),u.appendChild(a))}return"yes"==c.rowattribs.hide[o]&&(u.style.cssText+=";display:none"),u},t.RenderSpacingRow=function(e){var t,o,i,n,r=(e.sheetobj,document.createElement("tr"));for(e.showRCHeaders&&(o=document.createElement("td"),o.width=e.rownamewidth,o.height=e.defaultpanedividerheight,e.classnames.panedivider&&(o.className=e.classnames.panedivider),e.explicitStyles.panedivider&&(o.style.cssText=e.explicitStyles.panedivider),r.appendChild(o)),i=0;i<e.colpanes.length;i++){for(t=e.colpanes[i].first;t<=e.colpanes[i].last;t++)o=document.createElement("td"),n=e.colwidth[t],n&&(o.width=n),o.height=e.defaultpanedividerheight,e.classnames.panedivider&&(o.className=e.classnames.panedivider),e.explicitStyles.panedivider&&(o.style.cssText=e.explicitStyles.panedivider),o&&r.appendChild(o);i<e.colpanes.length-1&&(o=document.createElement("td"),o.width=e.defaultpanedividerwidth,o.height=e.defaultpanedividerheight,e.classnames.panedivider&&(o.className=e.classnames.panedivider),e.explicitStyles.panedivider&&(o.style.cssText=e.explicitStyles.panedivider),r.appendChild(o))}return r},t.RenderColHeaders=function(e){var o,i,n=e.sheetobj,r=document.createElement("tr");if(!e.showRCHeaders)return null;for(i=document.createElement("td"),e.classnames&&(i.className=e.classnames.upperleft),e.explicitStyles&&(i.style.cssText=e.explicitStyles.upperleft),i.width=e.rownamewidth,r.appendChild(i),colpane=0;colpane<e.colpanes.length;colpane++){for(o=e.colpanes[colpane].first;o<=e.colpanes[colpane].last;o++){if(i=document.createElement("td"),e.classnames&&(i.className=e.classnames.colname),e.explicitStyles&&(i.style.cssText=e.explicitStyles.colname),"yes"==n.colattribs.hide[t.rcColname(o)]&&(i.style.cssText+=";display:none"),i.innerHTML=t.rcColname(o),o<e.colpanes[e.colpanes.length-1].last&&"yes"==n.colattribs.hide[t.rcColname(o+1)]){var a=document.createElement("div");
5e.classnames&&(a.className=e.classnames.unhideleft),e.explicitStyles&&(a.style.cssText=e.explicitStyles.unhideleft),e.colunhideleft[o]=a,i.appendChild(a)}o>1&&"yes"==n.colattribs.hide[t.rcColname(o-1)]&&(a=document.createElement("div"),e.classnames&&(a.className=e.classnames.unhideright),e.explicitStyles&&(a.style.cssText=e.explicitStyles.unhideright),e.colunhideright[o]=a,i.appendChild(a));var s=document.createElement("span");s.style.height=t.Constants.defaultAssumedRowHeight+"px",s.className=e.classnames.colresizebar,i.appendChild(s),r.appendChild(i)}colpane<e.colpanes.length-1&&(i=document.createElement("td"),i.width=e.defaultpanedividerwidth,e.classnames.panedivider&&(i.className=e.classnames.panedivider),e.explicitStyles.panedivider&&(i.style.cssText=e.explicitStyles.panedivider),r.appendChild(i))}return r},t.RenderColGroup=function(e){var o,i,n,r,a=e.sheetobj,s=document.createElement("colgroup");for(e.showRCHeaders&&(n=document.createElement("col"),n.width=e.rownamewidth,s.appendChild(n)),o=0;o<e.colpanes.length;o++){for(i=e.colpanes[o].first;i<=e.colpanes[o].last;i++)n=document.createElement("col"),"yes"==a.colattribs.hide[t.rcColname(i)]?n.width="1":(r=e.colwidth[i],r&&(n.width=r),s.appendChild(n));o<e.colpanes.length-1&&(n=document.createElement("col"),n.width=e.defaultpanedividerwidth,s.appendChild(n))}return s},t.RenderSizingRow=function(e){var o,i,n,r,a=e.sheetobj,s=document.createElement("tr");for(e.showRCHeaders&&(n=document.createElement("td"),n.style.width=e.rownamewidth+"px",n.height="1",s.appendChild(n)),o=0;o<e.colpanes.length;o++){for(i=e.colpanes[o].first;i<=e.colpanes[o].last;i++)n=document.createElement("td"),"yes"==a.colattribs.hide[t.rcColname(i)]?n.width="1":(r=e.colwidth[i],r&&(n.width=r)),n.height="1",s.appendChild(n);o<e.colpanes.length-1&&(n=document.createElement("td"),n.width=e.defaultpanedividerwidth,n.height="1",s.appendChild(n))}return s},t.RenderCell=function(e,o,i,n,r,a,s){var l,c,u,d,h,p,f,m=e.sheetobj,g="";o-=0,i-=0;var v=t.crToCoord(i,o);if(e.cellskip[v])return e.CoordInPane(e.cellskip[v],n,r)?null:(u=a?t.CreatePseudoElement():document.createElement("td"),e.classnames.skippedcell&&(u.className=e.classnames.skippedcell),e.explicitStyles.skippedcell&&(u.style.cssText=e.explicitStyles.skippedcell),u.innerHTML="&nbsp;",u);if(u=a?t.CreatePseudoElement():document.createElement("td"),e.cellIDprefix&&(u.id=e.cellIDprefix+v),h=m.cells[v],h||(h=new t.Cell(v)),f=m.attribs,scc=t.Constants,h.colspan>1){for(d=1,l=1;l<h.colspan;l++)"yes"!=m.colattribs.hide[t.rcColname(i+l)]&&e.CellInPane(o,i+l,n,r)&&d++;u.colSpan=d}if(h.rowspan>1){for(d=1,l=1;l<h.rowspan;l++)"yes"!=m.rowattribs.hide[o+l+""]&&e.CellInPane(o+l,i,n,r)&&d++;u.rowSpan=d}return(void 0==h.displaystring||0==m.widgetsClean)&&(h.displaystring=t.FormatValueForDisplay(m,h.datavalue,v,s||e.defaultlinkstyle)),u.innerHTML=h.displaystring,l=h.layout||f.defaultlayout,g+=l&&"undefined"!=typeof e.layouts[l]?e.layouts[l]:scc.defaultCellLayout,l=h.font||f.defaultfont,l&&"undefined"!=typeof e.fonts[l]?(c=e.fonts[l],g+="font-style:"+c.style+";font-weight:"+c.weight+";font-size:"+c.size+";font-family:"+c.family+";"):(scc.defaultCellFontSize&&(g+="font-size:"+scc.defaultCellFontSize+";"),scc.defaultCellFontFamily&&(g+="font-family:"+scc.defaultCellFontFamily+";")),l=h.color||f.defaultcolor,l&&"undefined"!=typeof m.colors[l]&&(g+="color:"+m.colors[l]+";"),l=h.bgcolor||f.defaultbgcolor,l&&"undefined"!=typeof m.colors[l]&&(g+="background-color:"+m.colors[l]+";"),l=h.cellformat,l&&"undefined"!=typeof m.cellformats[l]?g+="text-align:"+m.cellformats[l]+";":(c=h.valuetype.charAt(0),"t"==c?(l=f.defaulttextformat,l&&"undefined"!=typeof m.cellformats[l]&&(g+="text-align:"+m.cellformats[l]+";")):"n"==c?(l=f.defaultnontextformat,g+=l&&"undefined"!=typeof m.cellformats[l]?"text-align:"+m.cellformats[l]+";":"text-align:right;"):g+="text-align:left;"),(h.colspan>1||h.rowspan>1)&&(p=m.cells[t.crToCoord(i+(h.colspan||1)-1,o+(h.rowspan||1)-1)]),l=h.bt,l&&"undefined"!=typeof m.borderstyles[l]&&(g+="border-top:"+m.borderstyles[l]+";"),l="undefined"!=typeof p?p.br:h.br,l&&"undefined"!=typeof m.borderstyles[l]?g+="border-right:"+m.borderstyles[l]+";":e.showGrid&&(c=e.CellInPane(o,i+(h.colspan||1),n,r)?t.crToCoord(i+(h.colspan||1),o):"nomatch",e.cellskip[c]&&(c=e.cellskip[c]),m.cells[c]&&m.cells[c].bl||(g+="border-right:"+e.gridCSS)),l="undefined"!=typeof p?p.bb:h.bb,l&&"undefined"!=typeof m.borderstyles[l]?g+="border-bottom:"+m.borderstyles[l]+";":e.showGrid&&(c=e.CellInPane(o+(h.rowspan||1),i,n,r)?t.crToCoord(i,o+(h.rowspan||1)):"nomatch",e.cellskip[c]&&(c=e.cellskip[c]),m.cells[c]&&m.cells[c].bt||(g+="border-bottom:"+e.gridCSS)),l=h.bl,l&&"undefined"!=typeof m.borderstyles[l]&&(g+="border-left:"+m.borderstyles[l]+";"),h.comment&&(u.title=h.comment,e.showGrid?(e.commentClassName&&(u.className=(u.className?u.className+" ":"")+e.commentClassName),g+=e.commentCSS):(e.commentNoGridClassName&&(u.className=(u.className?u.className+" ":"")+e.commentNoGridClassName),g+=e.commentNoGridCSS)),h.readonly&&(h.comment||(u.title=e.readonlyComment),e.showGrid?(e.readonlyClassName&&(u.className=(u.className?u.className+" ":"")+e.readonlyClassName),g+=e.readonlyCSS):(e.readonlyNoGridClassName&&(u.className=(u.className?u.className+" ":"")+e.readonlyNoGridClassName),g+=e.readonlyNoGridCSS)),u.style.cssText=g,void 0!==h.cssc&&(a?u.className=(u.className?u.className+" ":"")+h.cssc:u.classList.add(h.cssc)),c=e.highlights[v],c&&("cursor"==c&&(c+=e.cursorsuffix),e.highlightTypes[c].className&&(u.className=(u.className?u.className+" ":"")+e.highlightTypes[c].className),t.setStyles(u,e.highlightTypes[c].style)),"yes"==m.colattribs.hide[t.rcColname(i)]&&(u.style.cssText+=";display:none"),"yes"==m.rowattribs.hide[o]&&(u.style.cssText+=";display:none"),u},t.CoordInPane=function(e,t,o,i){var n=e.coordToCR[t];if(!n||!n.row||!n.col)throw"Bad coordToCR for "+t;return e.CellInPane(n.row,n.col,o,i)},t.CellInPane=function(e,t,o,i,n){var r=e.rowpanes[i],a=e.colpanes[n];if(!r||!a)throw"CellInPane called with unknown panes "+i+"/"+n;return t<r.first||t>r.last?!1:o<a.first||o>a.last?!1:!0},t.CreatePseudoElement=function(){return{style:{cssText:""},innerHTML:"",className:""}},t.rcColname=function(e){e>702&&(e=702),1>e&&(e=1);var t=(e-1)%26+65,o=Math.floor((e-1)/26);return o?String.fromCharCode(o+64)+String.fromCharCode(t):String.fromCharCode(t)},t.letters=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],t.crToCoord=function(e,o){var i;1>e&&(e=1),e>702&&(e=702),1>o&&(o=1);var n=(e-1)%26,r=Math.floor((e-1)/26);return i=r?t.letters[r-1]+t.letters[n]+o:t.letters[n]+o},t.coordToCol={},t.coordToRow={},t.coordToCr=function(e){var o,i,n,r=t.coordToRow[e];if(r)return{row:r,col:t.coordToCol[e]};for(o=0,r=0,i=0;i<e.length;i++)n=e.charCodeAt(i),36==n||(57>=n?r=10*r+n-48:n>=97?o=26*o+n-96:n>=65&&(o=26*o+n-64));return t.coordToCol[e]=o,t.coordToRow[e]=r,{row:r,col:o}},t.ParseRange=function(e){var o,i,n,r;return e||(e="A1:A1"),e=e.toUpperCase(),o=e.indexOf(":"),o>=0?(i=e.substring(0,o),n=t.coordToCr(i),n.coord=i,i=e.substring(o+1),r=t.coordToCr(i),r.coord=i):(n=t.coordToCr(e),n.coord=e,r=t.coordToCr(e),r.coord=e),{cr1:n,cr2:r}},t.decodeFromSave=function(e){if("string"!=typeof e)return e;if(-1==e.indexOf("\\"))return e;var t=e.replace(/\\c/g,":");return t=t.replace(/\\n/g,"\n"),t.replace(/\\b/g,"\\")},t.decodeFromAjax=function(e){if("string"!=typeof e)return e;if(-1==e.indexOf("\\"))return e;var t=e.replace(/\\c/g,":");return t=t.replace(/\\n/g,"\n"),t=t.replace(/\\e/g,"]]"),t.replace(/\\b/g,"\\")},t.encodeForSave=function(e){return"string"!=typeof e?e:(-1!=e.indexOf("\\")&&(e=e.replace(/\\/g,"\\b")),-1!=e.indexOf(":")&&(e=e.replace(/:/g,"\\c")),-1!=e.indexOf("\n")&&(e=e.replace(/\n/g,"\\n")),e)},t.special_chars=function(e){return/[&<>"]/.test(e)&&(e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;")),e},t.Lookup=function(e,t){for(i=0;i<t.length;i++)if(t[i]>e)return i>0?i-1:null;return t.length-1},t.setStyles=function(e,t){var o,i,n,r,a;if(t)for(o=t.split(";"),i=0;i<o.length;i++)n=o[i].indexOf(":"),-1!=n&&(r=o[i].substring(0,n),a=o[i].substring(n+1),r&&a&&(e.style[r]=a))},t.GetViewportInfo=function(){var t={};return e.innerWidth?(t.width=e.innerWidth,t.height=e.innerHeight,t.horizontalScroll=e.pageXOffset,t.verticalScroll=e.pageYOffset):document.documentElement&&document.documentElement.clientWidth?(t.width=document.documentElement.clientWidth,t.height=document.documentElement.clientHeight,t.horizontalScroll=document.documentElement.scrollLeft,t.verticalScroll=document.documentElement.scrollTop):document.body.clientWidth&&(t.width=document.body.clientWidth,t.height=document.body.clientHeight,t.horizontalScroll=document.body.scrollLeft,t.verticalScroll=document.body.scrollTop),t},t.GetElementPosition=function(e){for(var o=0,i=0;e&&"relative"!=t.GetComputedStyle(e,"position");)o+=e.offsetLeft,i+=e.offsetTop,e=e.offsetParent;return{left:o,top:i}},t.GetElementPositionWithScroll=function(e){var t=e.getBoundingClientRect();return{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width?t.width:t.right-t.left,height:t.height?t.height:t.bottom-t.top}},t.GetElementFixedParent=function(e){for(;e&&"HTML"!=e.tagName;){if("fixed"==t.GetComputedStyle(e,"position"))return e;e=e.parentNode}return!1},t.GetComputedStyle=function(e,t){var o;return o="undefined"!=typeof e.currentStyle?e.currentStyle:document.defaultView.getComputedStyle(e,null),o[t]},t.LookupElement=function(e,t){var o;for(o=0;o<t.length;o++)if(t[o].element==e)return t[o];return null},t.AssignID=function(e,t,o){e.idPrefix&&(t.id=e.idPrefix+o)},t.GetCellContents=function(e,t){var o="",i=e.cells[t];if(i)switch(i.datatype){case"v":o=i.datavalue+"";break;case"t":o="'"+i.datavalue;break;case"f":o="="+i.formula;break;case"c":o=i.formula}return o},t.FormatValueForDisplay=function(e,o,i,n){var r,a,s,l,c=e.attribs,u=(t.Constants,e.cells[i]);u||(u=new t.Cell(i)),l=o,a=u.valuetype||"",s=a.substring(1),valueinputwidget=a.charAt(1);var d=a.substring(2),h=null,p=null;if(a=a.charAt(0),u.errors||"e"==a)return l=u.errors||s||"Error in cell";if("t"==a){if(r=e.valueformats[u.textvalueformat-0]||e.valueformats[c.defaulttextvalueformat-0]||"","formula"==r)return l="f"==u.datatype?t.special_chars("="+u.formula)||"&nbsp;":"c"==u.datatype?t.special_chars("'"+u.formula)||"&nbsp;":t.special_chars("'"+l)||"&nbsp;";var h=l;l=t.format_text_for_display(l,u.valuetype,r,e,n,u.nontextvalueformat);var p=l}else if("n"==a){if(r=u.nontextvalueformat,(null==r||""==r)&&(r=c.defaultnontextvalueformat),r=e.valueformats[r-0],(null==r||"none"==r)&&(r=""),"formula"==r)return l="f"==u.datatype?t.special_chars("="+u.formula)||"&nbsp;":"c"==u.datatype?t.special_chars("'"+u.formula)||"&nbsp;":t.special_chars("'"+l)||"&nbsp;";if("forcetext"==r)return l="f"==u.datatype?t.special_chars("="+u.formula)||"&nbsp;":"c"==u.datatype?t.special_chars(u.formula)||"&nbsp;":t.special_chars(l)||"&nbsp;";var h=l;l=t.format_number_for_display(l,u.valuetype,r);var p=l}else l="&nbsp;";if("i"==valueinputwidget&&null!=h&&null!=p){var f=e.ioParameterList[i],m=t.Formula.FunctionList[d];if(m){var g=m[5],v=0==h?"":"checked";g=g.replace(/<%=checked%>/g,v),g=g.replace(/<%=formated_value%>/g,p),g=g.replace(/<%=display_value%>/g,h);var b;if(f){for(var y=0;y<f.length;y++){b="coord"==f[y].type?e.GetAssuredCell(f[y].value).datavalue:f[y].value;var C=new RegExp("<%=parameter"+y+"_value%>","g");g=g.replace(C,b)}if(f.html)for(var w=0;w<f.html.length;w++){var C=new RegExp("<%=html"+w+"_value%>","g");g=g.replace(C,f.html[w])}f.css&&(g=g.replace(/^(<\w+)(\W)/,"$1 style='"+f.css+"'$2"))}return g.replace(/<%=cell_reference%>/g,i)}return"error:Widget HTML missing"}return l},t.format_text_for_display=function(e,o,i,n,r,a){var i,s,l,c,u,d;return s=o.substring(1),d=e,("none"==i||null==i)&&(i=""),/^(text-|custom|hidden)/.test(i)||(i=""),(""==i||"General"==i)&&("h"==s&&(i="text-html"),("w"==s||"r"==s)&&(i="text-wiki"),"l"==s&&(i="text-link"),s||(i="text-plain")),"text-html"==i||(t.Callbacks.expand_wiki&&/^text-wiki/.test(i)?d=t.Callbacks.expand_wiki(d,n,r,i):"text-wiki"==i?d=t.Callbacks.expand_markup&&t.Callbacks.expand_markup(d,n,r)||t.special_chars("wiki-text:"+d):"text-url"==i?(l=t.special_chars(d),c=encodeURI(d),d='<a href="'+c+'">'+l+"</a>"):"text-link"==i?d=t.expand_text_link(d,n,r,i):"text-image"==i?(c=encodeURI(d),d='<img src="'+c+'">'):"text-custom:"==i.substring(0,12)?(l=t.special_chars(d),l=l.replace(/ /g,"&nbsp; "),l=l.replace(/\n/g,"<br>"),c=encodeURI(d),u={},u.r=d,u.s=l,u.u=c,d=i.substring(12),d=d.replace(/@(r|s|u)/g,function(e,t){return u[t]})):"custom"==i.substring(0,6)?(d=t.special_chars(d),d=d.replace(/ /g,"&nbsp; "),d=d.replace(/\n/g,"<br>"),d+=" (custom format)"):"hidden"==i?d="&nbsp;":null!=a&&""!=a&&"none"!=n.valueformats[a-0]&&""!=n.valueformats[a-0]?(i=n.valueformats[a],d=t.format_number_for_display(e,o,i)):(d=t.special_chars(d),d=d.replace(/ /g,"&nbsp; "),d=d.replace(/\n/g,"<br>"))),d},t.format_number_for_display=function(e,o,i){var n,r,a=t.Constants;return n=e-0,r=o.substring(1),("Auto"==i||""==i)&&(i="%"==r?a.defaultFormatp:"$"==r?a.defaultFormatc:"dt"==r?a.defaultFormatdt:"d"==r?a.defaultFormatd:"t"==r?a.defaultFormatt:"l"==r?"logical":"General"),"logical"==i?n?a.defaultDisplayTRUE:a.defaultDisplayFALSE:"hidden"==i?"&nbsp;":t.FormatNumber.formatNumberWithFormat(e,i,"")},t.DetermineValueType=function(e){var o,i,n,r,a,s,l,c,u,d,h=e+"",p="t";return o=h.replace(/^\s+/,""),o=o.replace(/\s+$/,""),0==h.length?p="":h.match(/^\s+$/)||(o.match(/^[-+]?\d*(?:\.)?\d*(?:[eE][-+]?\d+)?$/)?(h=o-0,isNaN(h)?h=e+"":p="n"):o.match(/^[-+]?\d*(?:\.)?\d*\s*%$/)?(h=(o.slice(0,-1)-0)/100,p="n%"):o.match(/^[-+]?\$\s*\d*(?:\.)?\d*\s*$/)&&o.match(/\d/)?(h=o.replace(/\$/,"")-0,p="n$"):o.match(/^[-+]?(\d*,\d*)+(?:\.)?\d*$/)?(h=o.replace(/,/g,"")-0,p="n"):o.match(/^[-+]?(\d*,\d*)+(?:\.)?\d*\s*%$/)?(h=(o.replace(/[%,]/g,"")-0)/100,p="n%"):o.match(/^[-+]?\$\s*(\d*,\d*)+(?:\.)?\d*$/)&&o.match(/\d/)?(h=o.replace(/[\$,]/g,"")-0,p="n$"):(i=h.match(/^(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{1,4})\s*$/))?(n=i[3]-0,n=1e3>n?n+2e3:n,h=0===navigator.language.indexOf("fr")?t.FormatNumber.convert_date_gregorian_to_julian(n,i[2]-0,i[1]-0)-2415019:t.FormatNumber.convert_date_gregorian_to_julian(n,i[1]-0,i[2]-0)-2415019,p="nd"):(i=h.match(/^(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})\s*$/))?(n=i[1]-0,n=1e3>n?n+2e3:n,h=t.FormatNumber.convert_date_gregorian_to_julian(n,i[2]-0,i[3]-0)-2415019,p="nd"):(i=h.match(/^(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2}) (\d{1,2}):(\d{1,2})\s*$/))?(n=i[1]-0,n=1e3>n?n+2e3:n,r=i[4]-0,a=i[5]-0,h=t.FormatNumber.convert_date_gregorian_to_julian(n,i[2]-0,i[3]-0)-2415019,p="nd",24>r&&60>a&&(h+=r/24+a/1440,p="ndt")):(i=h.match(/^(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})\s*$/))?(n=i[1]-0,n=1e3>n?n+2e3:n,r=i[4]-0,a=i[5]-0,s=i[6]-0,h=t.FormatNumber.convert_date_gregorian_to_julian(n,i[2]-0,i[3]-0)-2415019,p="nd",24>r&&60>a&&60>s&&(h+=r/24+a/1440+s/86400,p="ndt")):(i=h.match(/^(\d{1,2}):(\d{1,2})\s*$/))?(r=i[1]-0,a=i[2]-0,24>r&&60>a&&(h=r/24+a/1440,p="nt")):(i=h.match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})\s*$/))?(r=i[1]-0,a=i[2]-0,s=i[3]-0,24>r&&60>a&&60>s&&(h=r/24+a/1440+s/86400,p="nt")):(i=h.match(/^\s*([-+]?\d+) (\d+)\/(\d+)\s*$/))?(u=i[1]-0,c=i[2]-0,l=i[3]-0,l&&l>0&&(h=u+(0>u?-c/l:c/l),p="n")):(d=t.InputConstants[h.toUpperCase()])?(c=d.indexOf(","),h=d.substring(0,c)-0,p=d.substring(c+1)):o.length>7&&"http://"==o.substring(0,7).toLowerCase()?(h=o,p="tl"):o.match(/<([A-Z][A-Z0-9]*)\b[^>]*>[\s\S]*?<\/\1>/i)&&(h=o,p="th")),{value:h,type:p}},t.InputConstants={TRUE:"1,nl",FALSE:"0,nl","#N/A":"0,e#N/A","#NULL!":"0,e#NULL!","#NUM!":"0,e#NUM!","#DIV/0!":"0,e#DIV/0!","#VALUE!":"0,e#VALUE!","#REF!":"0,e#REF!","#NAME?":"0,e#NAME?"},t.default_expand_markup=function(e){var o=e;return o=t.special_chars(o),o=o.replace(/ /g,"&nbsp; "),o=o.replace(/\n/g,"<br>")},t.expand_text_link=function(e,o,i,n){var r,a,s,l=t.Constants,c="",u=t.ParseCellLinkText(e+"");return r=u.desc?t.special_chars(u.desc):u.pagename?l.defaultPageLinkFormatString:l.defaultLinkFormatString,e.length>7&&"http://"==e.substring(0,7).toLowerCase()&&">"!=e.charAt(e.length-1)&&(r=r.substring(7)),a=u.newwin||!i?' target="_blank"':"",u.pagename?t.Callbacks.MakePageLink&&(c=t.Callbacks.MakePageLink(u.pagename,u.workspacename,i,n)):c=encodeURI(u.url),s='<a href="'+c+'"'+a+">"+r+"</a>"},t.ParseCellLinkText=function(e){var t={url:"",desc:"",newwin:!1,pagename:"",workspace:""},o=!1,i=e.length-1,n=0,r=e.lastIndexOf("<"),a=e.lastIndexOf("["),s=e.lastIndexOf("{"),l=-1;return">"==e.charAt(i)&&-1!=r||"]"==e.charAt(i)&&-1!=a||!("}"!=e.charAt(i)||"]"!=e.charAt(i-1)||-1==s||-1==a||s>a)?(">"==e.charAt(i)?(l=r-1,r>0&&"<"==e.charAt(l)&&">"==e.charAt(i-1)&&(l--,i--,t.newwin=!0)):"]"==e.charAt(i)?(l=a-1,o=!0,a>0&&"["==e.charAt(l)&&"]"==e.charAt(i-1)&&(l--,i--,t.newwin=!0)):"}"==e.charAt(i)&&(l=s-1,o=!0,wsend=a,i--,a>0&&"["==e.charAt(a-1)&&"]"==e.charAt(i-1)&&(wsend=a-1,i--,t.newwin=!0)," "==e.charAt(wsend-1)&&wsend--,t.workspace=e.substring(s+1,wsend)||"")," "==e.charAt(l)&&l--,'"'==e.charAt(n)&&'"'==e.charAt(l)&&(n++,l--)):(i++,l=i),o?t.pagename=e.substring(a+1,i)||"":t.url=e.substring(r+1,i)||"",l>=n&&(t.desc=e.substring(n,l+1)),t},t.ConvertSaveToOtherFormat=function(e,o,i){var n,r,a,s,l,c,u,d,h,p,f="";if("scsave"==o)return e;if(""==e)return"";if(n=new t.Sheet,n.ParseSheetSave(e),i)throw"SocialCalc.ConvertSaveToOtherFormat: Not doing recalc.";if(a=n.copiedfrom?t.ParseRange(n.copiedfrom):{cr1:{row:1,col:1},cr2:{row:n.attribs.lastrow,col:n.attribs.lastcol}},"html"==o)return r=new t.RenderContext(n),n.copiedfrom&&(r.rowpanes[0]={first:a.cr1.row,last:a.cr2.row},r.colpanes[0]={first:a.cr1.col,last:a.cr2.col}),s=document.createElement("div"),l=r.RenderSheet(null,r.defaultHTMLlinkstyle),s.appendChild(l),delete r,delete n,f=s.innerHTML,delete l,delete s,f;for(c=a.cr1.row;c<=a.cr2.row;c++){for(u=a.cr1.col;u<=a.cr2.col;u++)d=t.crToCoord(u,c),h=n.GetAssuredCell(d),p=h.errors?h.errors:h.datavalue+"","csv"==o?(-1!=p.indexOf('"')&&(p=p.replace(/"/g,'""')),/[, \n"]/.test(p)&&(p='"'+p+'"'),u>a.cr1.col&&(p=","+p)):"tab"==o&&(-1!=p.indexOf("\n")&&(-1!=p.indexOf('"')&&(p=p.replace(/"/g,'""')),p='"'+p+'"'),u>a.cr1.col&&(p=" "+p)),f+=p;f+="\n"}return f},t.ConvertOtherFormatToSave=function(e,o){var i,n,r,a,s,l,c,u,d,h,p,f,m="",g=function(){h++,h>f&&(f=h),p=t.crToCoord(h,d),t.SetConvertedCell(i,p,s),s=""};if("scsave"==o)return e;if(i=new t.Sheet,n=e.split(/\r\n|\n/),f=0,"csv"==o){for(d=0,l=!1,r=0;r<n.length&&(r!=n.length-1||""!=n[r]);r++)for(l?s+="\n":(s="",d++,h=0),a=n[r],c=0;c<a.length;c++)u=a.charAt(c),'"'!=u?(","!=u||l?s+=u:g(),c!=a.length-1||l||g()):l?c<a.length-1&&'"'==a.charAt(c+1)?(c++,s+='"'):(l=!1,c==a.length-1&&g()):l=!0;f>0&&(i.attribs.lastrow=d,i.attribs.lastcol=f,m=i.CreateSheetSave("A1:"+t.crToCoord(f,d)))}if("tab"==o){for(d=0,l=!1,r=0;r<n.length&&(r!=n.length-1||""!=n[r]);r++)for(l?s+="\n":(s="",d++,h=0),a=n[r],c=0;c<a.length;c++){if(u=a.charAt(c),'"'==u){if(l){c<a.length-1?'"'==a.charAt(c+1)?(c++,s+='"'):" "==a.charAt(c+1)&&(c++,l=!1,g()):(l=!1,g());continue}if(""==s){l=!0;continue}}" "!=u||l?s+=u:g(),c!=a.length-1||l||g()}f>0&&(i.attribs.lastrow=d,i.attribs.lastcol=f,m=i.CreateSheetSave("A1:"+t.crToCoord(f,d)))}return m},t.SetConvertedCell=function(e,o,i){var n,r;n=e.GetAssuredCell(o),r=t.DetermineValueType(i),"n"==r.type&&r.value==i?(n.datatype="v",n.valuetype="n",n.datavalue=r.value):"t"==r.type.charAt(0)?(n.datatype="t",n.valuetype=r.type,n.datavalue=r.value):(n.datatype="c",n.valuetype=r.type,n.datavalue=r.value,n.formula=i)};var t;t||(t={}),t.TableEditor=function(o){var i=t.Constants;this.context=o,this.toplevel=null,this.fullgrid=null,this.noEdit=!1,this.width=null,this.tablewidth=null,this.height=null,this.tableheight=null,this.inputBox=null,this.inputEcho=null,this.verticaltablecontrol=null,this.horizontaltablecontrol=null,this.logo=null,this.cellhandles=null,this.timeout=null,this.busy=!1,this.ensureecell=!1,this.deferredCommands=[],this.deferredEmailCommands=[],this.gridposition=null,this.headposition=null,this.firstscrollingrow=null,this.firstscrollingrowtop=null,this.lastnonscrollingrow=null,this.lastvisiblerow=null,this.firstscrollingcol=null,this.firstscrollingcolleft=null,this.lastnonscrollingcol=null,this.lastvisiblecol=null,this.rowpositions=[],this.colpositions=[],this.rowheight=[],this.colwidth=[],this.ecell=null,this.state="start",this.workingvalues={},this.imageprefix=i.defaultImagePrefix,this.idPrefix=i.defaultTableEditorIDPrefix,this.pageUpDnAmount=i.defaultPageUpDnAmount,this.recalcFunction=function(e){return e.context.sheetobj.RecalcSheet?void e.context.sheetobj.RecalcSheet(t.EditorSheetStatusCallback,e):null},this.ctrlkeyFunction=function(o,i){var n,r,a,s,l,c;switch(i){case"[ctrl-a]":return o.MoveECell("A1"),o.RangeAnchor("A1"),o.RangeExtend(t.crToCoord(o.context.sheetobj.attribs.lastcol,o.context.sheetobj.attribs.lastrow)),!1;case"[ctrl-c]":case"[ctrl-x]":return n=o.pasteTextarea,n.value="",r=t.GetEditorCellElement(o,o.ecell.row,o.ecell.col),r&&(a=t.GetElementPosition(r.element),n.style.left=a.left-1+"px",n.style.top=a.top-1+"px"),l=o.range.hasrange?t.crToCoord(o.range.left,o.range.top)+":"+t.crToCoord(o.range.right,o.range.bottom):o.ecell.coord,c=t.ConvertSaveToOtherFormat(t.CreateSheetSave(o.context.sheetobj,l),"tab"),s="[ctrl-c]"==i||o.noEdit||o.ECellReadonly()?"copy "+l+" formulas":"cut "+l+" formulas",o.EditorScheduleSheetCommands(s,!0,!1),n.style.display="block",n.value=c,n.focus(),n.select(),e.setTimeout(function(){var e=o.pasteTextarea;e.blur(),e.style.display="none",t.KeyboardFocus()},200),!0;case"[ctrl-v]":return o.noEdit||o.ECellReadonly()?!0:(n=o.pasteTextarea,n.value="",r=t.GetEditorCellElement(o,o.ecell.row,o.ecell.col),r&&(a=t.GetElementPosition(r.element),n.style.left=a.left-1+"px",n.style.top=a.top-1+"px"),n.style.display="block",n.value="",n.focus(),e.setTimeout(function(){var e=o.pasteTextarea,i=e.value;e.blur(),e.style.display="none";var n="";if(o.pastescclipboard)o.pastescclipboard=!1;else{var r=t.ConvertSaveToOtherFormat(t.Clipboard.clipboard,"tab");i=i.replace(/\r\n/g,"\n"),i==r||i.length-r.length==1&&i.substring(0,i.length-1)==r||(n="loadclipboard "+t.encodeForSave(t.ConvertOtherFormatToSave(i,"tab"))+"\n")}var a;if(o.range.hasrange){var s=new t.Sheet;s.ParseSheetSave(t.Clipboard.clipboard);var l=s.copiedfrom.match(/(.+):(.+)/);a=null!==l&&l[1]===l[2]?t.crToCoord(o.range.left,o.range.top)+":"+t.crToCoord(o.range.right,o.range.bottom):t.crToCoord(o.range.left,o.range.top)}else a=o.ecell.coord;n+="paste "+a+" formulas",o.EditorScheduleSheetCommands(n,!0,!1),t.KeyboardFocus()},200),!0);case"[ctrl-z]":return o.EditorScheduleSheetCommands("undo",!0,!1),!1;case"[ctrl-s]":if(!t.Constants.AllowCtrlS)break;return e.setTimeout(function(){var i=o.context.sheetobj,n=i.GetAssuredCell(o.ecell.coord),r=n.nontextvalueformat?i.valueformats[n.nontextvalueformat-0]||"":"",a=e.prompt("Advanced Feature:\n\nCustom Numeric Format or Command",r);if(null!=a){if(a.match(/^cmd:/))s=a.substring(4);else{if(a.match(/^edit:/))return s=a.substring(5),void(t.CtrlSEditor&&t.CtrlSEditor(s));l=o.range.hasrange?t.crToCoord(o.range.left,o.range.top)+":"+t.crToCoord(o.range.right,o.range.bottom):o.ecell.coord,s="set "+l+" nontextvalueformat "+a}o.EditorScheduleSheetCommands(s,!0,!1)}},200),!1}return!0},o.sheetobj.statuscallback=t.EditorSheetStatusCallback,o.sheetobj.statuscallbackparams=this,this.StatusCallback={},this.MoveECellCallback={},this.RangeChangeCallback={},this.SettingsCallbacks={},this.ecell={coord:"A1",row:1,col:1},o.highlights[this.ecell.coord]="cursor",this.range={hasrange:!1},this.range2={hasrange:!1}},t.TableEditor.prototype.CreateTableEditor=function(e,o){return t.CreateTableEditor(this,e,o)},t.TableEditor.prototype.ResizeTableEditor=function(e,o){return t.ResizeTableEditor(this,e,o)},t.TableEditor.prototype.SaveEditorSettings=function(){return t.SaveEditorSettings(this)},t.TableEditor.prototype.LoadEditorSettings=function(e,o){return t.LoadEditorSettings(this,e,o)},t.TableEditor.prototype.EditorRenderSheet=function(){t.EditorRenderSheet(this)},t.TableEditor.prototype.EditorScheduleSheetCommands=function(e,o,i){t.EditorScheduleSheetCommands(this,e,o,i)},t.TableEditor.prototype.ScheduleSheetCommands=function(e,t){this.context.sheetobj.ScheduleSheetCommands(e,t)},t.TableEditor.prototype.SheetUndo=function(){this.context.sheetobj.SheetUndo()},t.TableEditor.prototype.SheetRedo=function(){this.context.sheetobj.SheetRedo()},t.TableEditor.prototype.EditorStepSet=function(e,o){t.EditorStepSet(this,e,o)},t.TableEditor.prototype.GetStatuslineString=function(e,o,i){return t.EditorGetStatuslineString(this,e,o,i)},t.TableEditor.prototype.EditorMouseRegister=function(){return t.EditorMouseRegister(this)},t.TableEditor.prototype.EditorMouseUnregister=function(){return t.EditorMouseUnregister(this)},t.TableEditor.prototype.EditorMouseRange=function(e){return t.EditorMouseRange(this,e)},t.TableEditor.prototype.EditorProcessKey=function(e,o){return t.EditorProcessKey(this,e,o)},t.TableEditor.prototype.EditorAddToInput=function(e,o){return t.EditorAddToInput(this,e,o)},t.TableEditor.prototype.DisplayCellContents=function(){return t.EditorDisplayCellContents(this)},t.TableEditor.prototype.EditorSaveEdit=function(e){return t.EditorSaveEdit(this,e)},t.TableEditor.prototype.EditorApplySetCommandsToRange=function(e,o){return t.EditorApplySetCommandsToRange(this,e,o)},t.TableEditor.prototype.MoveECellWithKey=function(e){return t.MoveECellWithKey(this,e)},t.TableEditor.prototype.MoveECell=function(e){return t._app?"A1":t.MoveECell(this,e)},t.TableEditor.prototype.ReplaceCell=function(e,o,i){t.ReplaceCell(this,e,o,i)},t.TableEditor.prototype.UpdateCellCSS=function(e,o,i){t.UpdateCellCSS(this,e,o,i)},t.TableEditor.prototype.SetECellHeaders=function(e){t.SetECellHeaders(this,e)},t.TableEditor.prototype.EnsureECellVisible=function(){t.EnsureECellVisible(this)},t.TableEditor.prototype.ECellReadonly=function(e){return t.ECellReadonly(this,e)},t.TableEditor.prototype.RangeAnchor=function(e){t.RangeAnchor(this,e)},t.TableEditor.prototype.RangeExtend=function(e){t.RangeExtend(this,e)},t.TableEditor.prototype.RangeRemove=function(){t.RangeRemove(this)},t.TableEditor.prototype.Range2Remove=function(){t.Range2Remove(this)},t.TableEditor.prototype.FitToEditTable=function(){t.FitToEditTable(this)},t.TableEditor.prototype.CalculateEditorPositions=function(){t.CalculateEditorPositions(this)},t.TableEditor.prototype.ScheduleRender=function(){this.ScheduleRender(!0)},t.TableEditor.prototype.ScheduleRender=function(e){t._app&&1==e&&(this.context.sheetobj.widgetsClean=!1),t.ScheduleRender(this)},t.TableEditor.prototype.DoRenderStep=function(){t.DoRenderStep(this)},t.TableEditor.prototype.SchedulePositionCalculations=function(){t.SchedulePositionCalculations(this)},t.TableEditor.prototype.DoPositionCalculations=function(){t.DoPositionCalculations(this)},t.TableEditor.prototype.CalculateRowPositions=function(e,o,i){return t.CalculateRowPositions(this,e,o,i)},t.TableEditor.prototype.CalculateColPositions=function(e,o,i){return t.CalculateColPositions(this,e,o,i)},t.TableEditor.prototype.ScrollRelative=function(e,o){t.ScrollRelative(this,e,o)},t.TableEditor.prototype.ScrollRelativeBoth=function(e,o){t.ScrollRelativeBoth(this,e,o)},t.TableEditor.prototype.PageRelative=function(e,o){t.PageRelative(this,e,o)},t.TableEditor.prototype.LimitLastPanes=function(){t.LimitLastPanes(this)},t.TableEditor.prototype.ScrollTableUpOneRow=function(){return t.ScrollTableUpOneRow(this)},t.TableEditor.prototype.ScrollTableDownOneRow=function(){return t.ScrollTableDownOneRow(this)},t.TableEditor.prototype.ScrollTableLeftOneCol=function(){return t.ScrollTableLeftOneCol(this)},t.TableEditor.prototype.ScrollTableRightOneCol=function(){return t.ScrollTableRightOneCol(this)},t.TableEditor.prototype.StopPropagation=function(){return t.StopPropagation(this)},t.TableEditor.prototype.SetMouseMoveUp=function(){return t.SetMouseMoveUp(this)},t.TableEditor.prototype.RemoveMouseMoveUp=function(){return t.RemoveMouseMoveUp(this)},t.CreateTableEditor=function(o,i,n){var r=t.Constants,a=t.AssignID;o.toplevel=document.createElement("div"),o.toplevel.style.position="relative",a(o,o.toplevel,"toplevel"),o.width=i,o.height=n,o.griddiv=document.createElement("div"),o.tablewidth=Math.max(0,i-r.defaultTableControlThickness),o.tableheight=Math.max(0,n-r.defaultTableControlThickness),o.griddiv.style.width=o.tablewidth+"px",o.griddiv.style.height=o.tableheight+"px",o.griddiv.style.overflow="hidden",o.griddiv.style.cursor="default",r.cteGriddivClass&&(o.griddiv.className=r.cteGriddivClass),a(o,o.griddiv,"griddiv"),o.FitToEditTable(),o.EditorRenderSheet(),o.griddiv.appendChild(o.fullgrid),o.verticaltablecontrol=new t.TableControl(o,!0,o.tableheight),o.verticaltablecontrol.CreateTableControl(),a(o,o.verticaltablecontrol.main,"tablecontrolv"),o.horizontaltablecontrol=new t.TableControl(o,!1,o.tablewidth),o.horizontaltablecontrol.CreateTableControl(),a(o,o.horizontaltablecontrol.main,"tablecontrolh");var s,l,c,u,d;return s=document.createElement("table"),o.layouttable=s,s.cellSpacing=0,s.cellPadding=0,a(o,s,"layouttable"),l=document.createElement("tbody"),s.appendChild(l),c=document.createElement("tr"),l.appendChild(c),u=document.createElement("td"),u.appendChild(o.griddiv),c.appendChild(u),1!=t._app&&(u=document.createElement("td"),u.appendChild(o.verticaltablecontrol.main),c.appendChild(u)),c=document.createElement("tr"),l.appendChild(c),1!=t._app&&(u=document.createElement("td"),u.appendChild(o.horizontaltablecontrol.main),c.appendChild(u)),u=document.createElement("td"),u.style.background=t._app?"url("+o.imageprefix+"logo.gif) no-repeat right center":"url("+o.imageprefix+"logo.gif) no-repeat center center",u.innerHTML="<div style='cursor:pointer;font-size:1px;'><img src='"+o.imageprefix+"1x1.gif' border='0' width='18' height='18'></div>",c.appendChild(u),o.logo=u,a(o,o.logo,"logo"),u.firstChild.firstChild.title="SocialCalc",o.toplevel.appendChild(o.layouttable),o.noEdit||(o.inputEcho=new t.InputEcho(o),a(o,o.inputEcho.main,"inputecho")),o.cellhandles=new t.CellHandles(o),d=document.createElement("textarea"),t.setStyles(d,"display:none;position:absolute;height:1px;width:1px;opacity:0;filter:alpha(opacity=0);"),d.value="",o.pasteTextarea=d,a(o,o.pasteTextarea,"pastetextarea"),navigator.userAgent.match(/Safari\//)&&!navigator.userAgent.match(/Chrome\//)&&(e.removeEventListener("beforepaste",t.SafariPasteFunction,!1),e.addEventListener("beforepaste",t.SafariPasteFunction,!1),e.removeEventListener("beforecopy",t.SafariPasteFunction,!1),e.addEventListener("beforecopy",t.SafariPasteFunction,!1),e.removeEventListener("beforecut",t.SafariPasteFunction,!1),e.addEventListener("beforecut",t.SafariPasteFunction,!1)),o.toplevel.appendChild(o.pasteTextarea),t.MouseWheelRegister(o.toplevel,{WheelMove:t.EditorProcessMouseWheel,editor:o}),t.KeyboardSetFocus(o),t.EditorSheetStatusCallback(null,"startup",null,o),o.toplevel},t.SafariPasteFunction=function(e){e.preventDefault()},t.ResizeTableEditor=function(e,o,i){var n=t.Constants;e.width=o,e.height=i,e.toplevel.style.width=o+"px",e.toplevel.style.height=i+"px",e.tablewidth=t._app?Math.max(0,o):Math.max(0,o-n.defaultTableControlThickness),e.tableheight=Math.max(0,i-n.defaultTableControlThickness),e.griddiv.style.width=e.tablewidth+"px",e.griddiv.style.height=e.tableheight+"px",e.verticaltablecontrol.main.style.height=e.tableheight+"px",e.horizontaltablecontrol.main.style.width=e.tablewidth+"px",e.FitToEditTable(),e.ScheduleRender()},t.SaveEditorSettings=function(e){var t,o,i=e.context,n=e.range,r="";for(r+="version:1.0\n",t=0;t<i.rowpanes.length;t++)r+="rowpane:"+t+":"+i.rowpanes[t].first+":"+i.rowpanes[t].last+"\n";for(t=0;t<i.colpanes.length;t++)r+="colpane:"+t+":"+i.colpanes[t].first+":"+i.colpanes[t].last+"\n";e.ecell&&(r+="ecell:"+e.ecell.coord+"\n"),n.hasrange&&(r+="range:"+n.anchorcoord+":"+n.top+":"+n.bottom+":"+n.left+":"+n.right+"\n");
6for(o in e.SettingsCallbacks)r+=e.SettingsCallbacks[o].save(e,o);return r},t.LoadEditorSettings=function(e,o,i){var n,r,a,s,l,c,u,d,h,p=o.split(/\r\n|\n/),f=[],m=e.context;for(m.rowpanes=[{first:1,last:1}],m.colpanes=[{first:1,last:1}],e.ecell=null,e.range={hasrange:!1},e.range2={hasrange:!1},h=e.range,m.highlights={},d=m.highlights,r=0;r<p.length;r++)switch(n=p[r],f=n.split(":"),u=f[0]){case"version":break;case"rowpane":m.rowpanes[f[1]-0]={first:f[2]-0,last:f[3]-0};break;case"colpane":m.colpanes[f[1]-0]={first:f[2]-0,last:f[3]-0};break;case"ecell":e.ecell=t.coordToCr(f[1]),e.ecell.coord=f[1],d[f[1]]="cursor";break;case"range":for(h.hasrange=!0,h.anchorcoord=f[1],a=t.coordToCr(h.anchorcoord),h.anchorrow=a.row,h.anchorcol=a.col,h.top=f[2]-0,h.bottom=f[3]-0,h.left=f[4]-0,h.right=f[5]-0,s=h.top;s<=h.bottom;s++)for(l=h.left;l<=h.right;l++)c=t.crToCoord(l,s),"cursor"!=d[c]&&(d[c]="range");break;default:e.SettingsCallbacks[u]&&e.SettingsCallbacks[u].load(e,u,n,i)}},t.EditorRenderSheet=function(e){e.EditorMouseUnregister();var o=e.context.sheetobj;if(null!=o.reRenderCellList&&t._app&&o.widgetsClean===!0){for(var i in o.reRenderCellList){var n=o.reRenderCellList[i],r=o.cells[n].valuetype;("i"!=r.charAt(1)||r!=o.cells[n].prevvaluetype)&&(cr=t.coordToCr(n),cell=t.GetEditorCellElement(e,cr.row,cr.col),null!=cell&&e.ReplaceCell(cell,cr.row,cr.col))}o.reRenderCellList=[]}else e.fullgrid=e.context.RenderSheet(e.fullgrid),null!=o.reRenderCellList&&t._app&&(o.widgetsClean=!0,o.reRenderCellList=[]);e.ecell&&e.SetECellHeaders("selected"),t.AssignID(e,e.fullgrid,"fullgrid"),t._app||(e.fullgrid.className="te_download"),e.EditorMouseRegister()},t.EditorScheduleSheetCommands=function(e,o,i,n){if("start"==e.state||n){if(e.busy&&!n)return void e.deferredCommands.push({cmdstr:o,saveundo:i});var r=o.split(" ");switch(r[0]){case"recalc":case"redisplay":e.context.sheetobj.ScheduleSheetCommands(o,!1);break;case"undo":t._app&&(e.context.sheetobj.widgetsClean=!1),e.SheetUndo();break;case"redo":t._app&&(e.context.sheetobj.widgetsClean=!1),e.SheetRedo();break;case"setemailparameters":t.TriggerIoAction.Email(r[1],r[2]);break;default:e.context.sheetobj.ScheduleSheetCommands(o,i)}}},t.EditorSheetStatusCallback=function(e,o,i,n){var r,a,s,l=n.context.sheetobj,c=function(e){for(r in n.StatusCallback)n.StatusCallback[r].func&&n.StatusCallback[r].func(n,e,i,n.StatusCallback[r].params)};switch(o){case"startup":break;case"cmdstart":n.busy=!0,l.celldisplayneeded="";break;case"cmdextension":break;case"cmdend":if(c(o),l.changedrendervalues&&(n.context.PrecomputeSheetFontsAndLayouts(),n.context.CalculateCellSkipData(),l.changedrendervalues=!1),l.celldisplayneeded&&!l.renderneeded&&l.cells[l.celldisplayneeded]&&"e#N/A"!=l.cells[l.celldisplayneeded].valuetype&&(cr=t.coordToCr(l.celldisplayneeded),a=t.GetEditorCellElement(n,cr.row,cr.col),n.ReplaceCell(a,cr.row,cr.col)),n.deferredCommands.length)return s=n.deferredCommands.shift(),void n.EditorScheduleSheetCommands(s.cmdstr,s.saveundo,!0);if(l.attribs.needsrecalc&&("off"!=l.attribs.recalc||l.recalconce)&&n.recalcFunction?(n.FitToEditTable(),l.renderneeded=!1,l.recalconce&&delete l.recalconce,n.recalcFunction(n)):l.renderneeded?(n.FitToEditTable(),l.renderneeded=!1,n.ScheduleRender(!1)):n.SchedulePositionCalculations(),"col"==l.hiddencolrow&&null!==n.ecell){for(var u=n.ecell.col;"yes"==l.colattribs.hide[t.rcColname(u)];)u++;var d=t.crToCoord(u,n.ecell.row);n.MoveECell(d),l.hiddencolrow=""}if("row"==l.hiddencolrow&&null!==n.ecell){for(var h=n.ecell.row;"yes"==l.rowattribs.hide[h];)h++;var d=t.crToCoord(n.ecell.col,h);n.MoveECell(d),l.hiddencolrow=""}return;case"calcstart":n.busy=!0;break;case"calccheckdone":case"calcorder":case"calcstep":case"calcloading":case"calcserverfunc":break;case"calcfinished":return c(o),void n.ScheduleRender(!1);case"schedrender":n.busy=!0;break;case"renderdone":break;case"schedposcalc":n.busy=!0;break;case"doneposcalc":if(n.deferredEmailCommands.length){c(o);var p=n.deferredEmailCommands.shift();return void n.EditorScheduleSheetCommands(p.cmdstr,p.saveundo,!0)}return void(n.deferredCommands.length?(c(o),s=n.deferredCommands.shift(),n.EditorScheduleSheetCommands(s.cmdstr,s.saveundo,!0)):(n.busy=!1,c(o),"start"==n.state&&n.DisplayCellContents()));case"emailing":case"confirmemailsent":break;default:alert("Unknown status: "+o)}c(o)},t.EditorGetStatuslineString=function(e,o,i,n){var r,a,s,l,c,u,d,h,p=t.Constants;switch(a="",o){case"moveecell":case"rangechange":case"startup":break;case"cmdstart":n.command=!0,document.body.style.cursor="progress",e.griddiv.style.cursor="progress",a=p.s_statusline_executing;break;case"cmdextension":a="Command Extension: "+i;break;case"cmdend":n.command=!1;break;case"schedrender":a=p.s_statusline_displaying;break;case"renderdone":a=" ";break;case"schedposcalc":a=p.s_statusline_displaying;break;case"cmdendnorender":case"doneposcalc":document.body.style.cursor="default",e.griddiv.style.cursor="default","sent"==n.emailing&&(a=n.emailreponse,n.emailreponse="",n.emailing="done");break;case"calcorder":a=p.s_statusline_ordering+Math.floor(100*i.count/(i.total||1))+"%";break;case"calcstep":a=p.s_statusline_calculating+Math.floor(100*i.count/(i.total||1))+"%";break;case"calcloading":a=p.s_statusline_calculatingls+": "+i.sheetname;break;case"calcserverfunc":a=p.s_statusline_calculating+Math.floor(100*i.count/(i.total||1))+"%, "+p.s_statusline_doingserverfunc+i.funcname+p.s_statusline_incell+i.coord;break;case"calcstart":n.calculating=!0,document.body.style.cursor="progress",e.griddiv.style.cursor="progress",a=p.s_statusline_calcstart;break;case"calccheckdone":break;case"calcfinished":n.calculating=!1;break;case"emailing":n.emailing="sending",n.emailreponse="";break;case"confirmemailsent":n.emailing="sent","undefined"==typeof n.emailreponse&&(n.emailreponse=""),n.emailreponse+=i;break;default:a=o}if("sending"==n.emailing&&(a+=p.s_statusline_sendemail),"sent"==n.emailing&&(a+=n.emailreponse),!a&&n.calculating&&(a=p.s_statusline_calculating),!(n.calculating||n.command||a||!e.range.hasrange||e.range.left==e.range.right&&e.range.top==e.range.bottom)){for(h=0,c=e.range.top;c<=e.range.bottom;c++)for(u=e.range.left;u<=e.range.right;u++)d=e.context.sheetobj.cells[t.crToCoord(u,c)],d&&d.valuetype&&"n"==d.valuetype.charAt(0)&&(h+=d.datavalue-0);h=t.FormatNumber.formatNumberWithFormat(h,"[,]General",""),s=t.crToCoord(e.range.left,e.range.top)+":"+t.crToCoord(e.range.right,e.range.bottom),a=s+" ("+(e.range.right-e.range.left+1)+"x"+(e.range.bottom-e.range.top+1)+") "+p.s_statusline_sum+"="+h+" "+a}return r=(e.ecell||{}).coord+" &nbsp; "+a,n.calculating||"yes"!=e.context.sheetobj.attribs.needsrecalc||(r+=" &nbsp; "+p.s_statusline_recalcneeded),l=e.context.sheetobj.attribs.circularreferencecell,l&&(l=l.replace(/\|/," referenced by "),r+=" &nbsp; "+p.s_statusline_circref+l+"</span>"),r+=""},t.EditorMouseInfo={registeredElements:[],editor:null,element:null,ignore:!1,mousedowncoord:"",mouselastcoord:"",mouseresizecol:"",mouseresizeclientx:null,mouseresizedisplay:null},t.EditorMouseRegister=function(e){var o,i=t.EditorMouseInfo,n=e.fullgrid;for(o=0;o<i.registeredElements.length;o++)if(i.registeredElements[o].editor==e){if(i.registeredElements[o].element==n)return;break}if(o<i.registeredElements.length?i.registeredElements[o].element=n:i.registeredElements.push({element:n,editor:e}),n.addEventListener)n.addEventListener("mousedown",t.ProcessEditorMouseDown,!1),n.addEventListener("dblclick",t.ProcessEditorDblClick,!1);else{if(!n.attachEvent)throw"Browser not supported";n.attachEvent("onmousedown",t.ProcessEditorMouseDown),n.attachEvent("ondblclick",t.ProcessEditorDblClick)}i.ignore=!1},t.EditorMouseUnregister=function(e){{var o,i,n=t.EditorMouseInfo;e.fullgrid}for(o=0;o<n.registeredElements.length&&n.registeredElements[o].editor!=e;o++);o<n.registeredElements.length&&(i=n.registeredElements[o].element,i.removeEventListener?(i.removeEventListener("mousedown",t.ProcessEditorMouseDown,!1),i.removeEventListener("dblclick",t.ProcessEditorDblClick,!1)):i.detachEvent&&(i.detachEvent("onmousedown",t.ProcessEditorMouseDown),i.detachEvent("ondblclick",t.ProcessEditorDblClick)),n.registeredElements.splice(o,1))},t.StopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,e.preventDefault?e.preventDefault():e.returnValue=!1},t.SetMouseMoveUp=function(e,o,i,n){document.addEventListener?(document.addEventListener("mousemove",e,!0),document.addEventListener("mouseup",o,!0)):i.attachEvent&&(i.setCapture(),i.attachEvent("onmousemove",e),i.attachEvent("onmouseup",o),i.attachEvent("onlosecapture",o)),t.StopPropagation(n)},t.RemoveMouseMoveUp=function(e,o,i,n){t.StopPropagation(n),document.removeEventListener?(document.removeEventListener("mousemove",e,!0),document.removeEventListener("mouseup",o,!0)):i.detachEvent&&(i.detachEvent("onlosecapture",o),i.detachEvent("onmouseup",o),i.detachEvent("onmousemove",e),i.releaseCapture())},t.ProcessEditorMouseDown=function(o){var i,n,r,a,s=o||e.event,l=t.EditorMouseInfo,c=s.target||s.srcElement,u=c;3==u.nodeType&&(u=u.parentNode);var d;if(!l.ignore){for(d=null;!d&&c;c=c.parentNode)d=t.LookupElement(c,l.registeredElements);if(!d)return void(l.editor=null);i=d.editor,l.element=c,a=i.range;var h=t.GetElementPositionWithScroll(i.toplevel),p=s.clientX-h.left,f=s.clientY-h.top;if(n=t.GridMousePosition(i,p,f)){if(l.editor=i,n.rowheader)return void(n.rowselect?t.ProcessEditorRowselectMouseDown(o,c,n):t.ProcessEditorRowsizeMouseDown(o,c,n));if(n.colheader)return void(n.colselect?t.ProcessEditorColselectMouseDown(o,c,n):t.ProcessEditorColsizeMouseDown(o,c,n));if(n.coord){if(a.hasrange||o.shiftKey&&i.RangeAnchor(),r=i.MoveECell(n.coord),1==t._app)return void t.CmdGotFocus(!0);var m=i.context.sheetobj.cells[r];if(m&&"i"==m.valuetype.charAt(1)){var g=m.valuetype.substring(2),v=g+"_"+r;if(u&&v==u.id){var b=document.getElementById(v);t.CmdGotFocus(b)}}else a.hasrange&&(o.shiftKey?i.RangeExtend():i.RangeRemove()),l.mousedowncoord=r,l.mouselastcoord=r,i.EditorMouseRange(r),t.KeyboardSetFocus(i),"start"!=i.state&&i.inputBox&&i.inputBox.element.focus(),t.SetMouseMoveUp(t.ProcessEditorMouseMove,t.ProcessEditorMouseUp,c,s)}}}},t.EditorMouseRange=function(e,o){var i,n,r=e.range;switch(e.state){case"input":i=e.inputBox.GetText(),n=e.workingvalues,("(+-*/,:!&<>=^".indexOf(i.slice(-1))>=0&&"="==i.slice(0,1)||"="==i)&&(n.partialexpr=i),n.partialexpr?o&&e.inputBox.SetText(r.hasrange?n.partialexpr+t.crToCoord(r.left,r.top)+":"+t.crToCoord(r.right,r.bottom):n.partialexpr+o):(e.inputBox.Blur(),e.inputBox.ShowInputBox(!1),e.state="start",e.cellhandles.ShowCellHandles(!0),e.EditorSaveEdit(),e.inputBox.DisplayCellContents(null));break;case"inputboxdirect":e.inputBox.Blur(),e.inputBox.ShowInputBox(!1),e.state="start",e.cellhandles.ShowCellHandles(!0),e.EditorSaveEdit(),e.inputBox.DisplayCellContents(null)}},t.ProcessEditorMouseMove=function(o){var i,n,r,a=o||e.event,s=t.EditorMouseInfo;if(i=s.editor,i&&!s.ignore){n=s.element;var l=t.GetElementPositionWithScroll(i.toplevel),c=a.clientX-l.left,u=a.clientY-l.top;if(r=t.GridMousePosition(i,c,u)){if(r&&!r.coord)return void t.SetDragAutoRepeat(i,r);t.SetDragAutoRepeat(i,null),r.coord&&(r.coord!=s.mouselastcoord&&(o.shiftKey||i.range.hasrange||i.RangeAnchor(s.mousedowncoord),i.MoveECell(r.coord),i.RangeExtend()),s.mouselastcoord=r.coord,i.EditorMouseRange(r.coord),t.StopPropagation(a))}}},t.ProcessEditorMouseUp=function(o){var i,n,r,a=o||e.event,s=t.EditorMouseInfo;if(i=s.editor,i&&!s.ignore){n=s.element;var l=t.GetElementPositionWithScroll(i.toplevel),c=a.clientX-l.left,u=a.clientY-l.top;if(r=t.GridMousePosition(i,c,u),t.SetDragAutoRepeat(i,null),r)return r.coord||(r.coord=i.ecell.coord),i.range.hasrange?(i.MoveECell(r.coord),i.RangeExtend()):r.coord&&r.coord!=s.mousedowncoord&&(i.RangeAnchor(s.mousedowncoord),i.MoveECell(r.coord),i.RangeExtend()),i.EditorMouseRange(r.coord),s.editor=null,t.RemoveMouseMoveUp(t.ProcessEditorMouseMove,t.ProcessEditorMouseUp,n,a),!1}},t.ProcessEditorColsizeMouseDown=function(o,i,n){var r=o||e.event,a=t.EditorMouseInfo,s=a.editor,l=t.GetElementPositionWithScroll(s.toplevel),c=r.clientX-l.left;if(a.mouseresizecolnum=n.coltoresize,a.mouseresizecol=t.rcColname(n.coltoresize),a.mousedownclientx=c,a.mousecoltounhide=n.coltounhide,n.coltoresize){var u=document.createElement("div");a.mouseresizedisplay=u,u.style.width="auto",u.style.position="absolute",u.style.zIndex=100,u.style.top=s.headposition.top+"px",u.style.left=s.colpositions[n.coltoresize]+"px",u.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td style="height:100px;border:1px dashed black;background-color:white;width:'+(s.context.colwidth[a.mouseresizecolnum]-2)+'px;">&nbsp;</td><td><div style="font-size:small;color:white;background-color:gray;padding:4px;">'+s.context.colwidth[a.mouseresizecolnum]+"</div></td></tr></table>",t.setStyles(u.firstChild.lastChild.firstChild.childNodes[0],"filter:alpha(opacity=85);opacity:.85;"),s.toplevel.appendChild(u)}t.SetMouseMoveUp(t.ProcessEditorColsizeMouseMove,t.ProcessEditorColsizeMouseUp,s.toplevel,r)},t.ProcessEditorColsizeMouseMove=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor;if(r){if(n.mouseresizecolnum){var a=t.GetElementPositionWithScroll(r.toplevel),s=i.clientX-a.left,l=r.context.colwidth[n.mouseresizecolnum]-0+(s-n.mousedownclientx);l<t.Constants.defaultMinimumColWidth&&(l=t.Constants.defaultMinimumColWidth);var c=n.mouseresizedisplay;c.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td style="height:100px;border:1px dashed black;background-color:white;width:'+(l-2)+'px;">&nbsp;</td><td><div style="font-size:small;color:white;background-color:gray;padding:4px;">'+l+"</div></td></tr></table>",t.setStyles(c.firstChild.lastChild.firstChild.childNodes[0],"filter:alpha(opacity=85);opacity:.85;")}t.StopPropagation(i)}},t.ProcessEditorColsizeMouseUp=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor;if(r){element=n.element;var a=t.GetElementPositionWithScroll(r.toplevel),s=i.clientX-a.left;if(t.RemoveMouseMoveUp(t.ProcessEditorColsizeMouseMove,t.ProcessEditorColsizeMouseUp,r.toplevel,i),n.mousecoltounhide)r.EditorScheduleSheetCommands("set "+t.rcColname(n.mousecoltounhide)+" hide",!0,!1);else if(n.mouseresizecolnum){var l=r.context.colwidth[n.mouseresizecolnum]-0+(s-n.mousedownclientx);l<t.Constants.defaultMinimumColWidth&&(l=t.Constants.defaultMinimumColWidth),r.EditorScheduleSheetCommands("set "+n.mouseresizecol+" width "+l,!0,!1),r.timeout&&e.clearTimeout(r.timeout),r.timeout=e.setTimeout(t.FinishColRowSize,1)}return!1}},t.FinishColRowSize=function(){var e=t.EditorMouseInfo,o=e.editor;o&&(o.toplevel.removeChild(e.mouseresizedisplay),e.mouseresizedisplay=null,e.editor=null)},t.ProcessEditorRowselectMouseDown=function(o,i,n){var r=o||e.event,a=t.EditorMouseInfo,s=a.editor,l=t.GetSpreadsheetControlObject().sheet;coord1=t.crToCoord(1,n.row),coord2=t.crToCoord(l.LastCol(),n.row),coord3=t.crToCoord(s.firstscrollingcol,n.row),s.RangeAnchor(coord1),s.RangeExtend(coord2),s.MoveECell(coord3),t.SetMouseMoveUp(t.ProcessEditorRowselectMouseMove,t.ProcessEditorRowselectMouseUp,s.toplevel,r)},t.ProcessEditorRowselectMouseMove=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor,a=t.GetSpreadsheetControlObject().sheet;if(r){var s=t.GetElementPositionWithScroll(r.toplevel),l=i.clientX-s.left,c=i.clientY-s.top;result=t.GridMousePosition(r,l,c),coord2=t.crToCoord(a.LastCol(),result.row),coord3=t.crToCoord(r.firstscrollingcol,result.row),r.RangeExtend(coord2),r.MoveECell(coord3)}},t.ProcessEditorRowselectMouseUp=function(o){var i=(o||e.event,t.EditorMouseInfo),n=i.editor;n&&t.RemoveMouseMoveUp(t.ProcessEditorRowselectMouseMove,t.ProcessEditorRowselectMouseUp,n.toplevel,o)},t.ProcessEditorColselectMouseDown=function(o,i,n){var r=o||e.event,a=t.EditorMouseInfo,s=a.editor,l=t.GetSpreadsheetControlObject().sheet;coord1=t.crToCoord(n.col,1),coord2=t.crToCoord(n.col,l.LastRow()),coord3=t.crToCoord(n.col,s.firstscrollingrow),s.RangeAnchor(coord1),s.RangeExtend(coord2),s.MoveECell(coord3),t.SetMouseMoveUp(t.ProcessEditorColselectMouseMove,t.ProcessEditorColselectMouseUp,s.toplevel,r)},t.ProcessEditorColselectMouseMove=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor,a=t.GetSpreadsheetControlObject().sheet;if(r){var s=t.GetElementPositionWithScroll(r.toplevel),l=i.clientX-s.left,c=i.clientY-s.top;result=t.GridMousePosition(r,l,c),coord2=t.crToCoord(result.col,a.LastRow()),coord3=t.crToCoord(result.col,r.firstscrollingrow),r.RangeExtend(coord2),r.MoveECell(coord3)}},t.ProcessEditorColselectMouseUp=function(o){var i=(o||e.event,t.EditorMouseInfo),n=i.editor;n&&t.RemoveMouseMoveUp(t.ProcessEditorColselectMouseMove,t.ProcessEditorColselectMouseUp,n.toplevel,o)},t.ProcessEditorRowsizeMouseDown=function(o,i,n){var r=o||e.event,a=t.EditorMouseInfo,s=a.editor,l=t.GetSpreadsheetControlObject().spreadsheetDiv.firstChild.offsetHeight,c=r.clientY-l;if(a.mouseresizerownum=n.rowtoresize,a.mouseresizerow=n.rowtoresize,a.mousedownclienty=c,a.mouserowtounhide=n.rowtounhide,n.rowtoresize){var u=document.createElement("div");a.mouseresizedisplay=u,u.style.width=s.context.totalwidth+"px",u.style.height=s.rowpositions[n.rowtoresize]+"px",u.style.position="absolute",u.style.zIndex=100,u.style.top=s.rowpositions[n.rowtoresize]+"px",u.style.left=s.headposition.left+"px",u.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td style="width:100pxborder:1px dashed black;background-color:white;height:'+(s.context.rowheight[a.mouseresizerownum]-2)+'px;">&nbsp;</td><td><div style="font-size:small;color:white;background-color:gray;padding:4px;">'+s.context.rowheight[a.mouseresizerownum]+"</div></td></tr></table>",t.setStyles(u.firstChild.lastChild.firstChild.childNodes[0],"filter:alpha(opacity=85);opacity:.5;"),s.toplevel.appendChild(u)}t.SetMouseMoveUp(t.ProcessEditorRowsizeMouseMove,t.ProcessEditorRowsizeMouseUp,s.toplevel,r)},t.ProcessEditorRowsizeMouseMove=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor;if(r){if(n.mouseresizerownum){var a=t.GetSpreadsheetControlObject().spreadsheetDiv.firstChild.offsetHeight,s=i.clientY-a,l=r.context.rowheight[n.mouseresizerownum]-0+(s-n.mousedownclienty);l<t.Constants.defaultAssumedRowHeight&&(l=t.Constants.defaultAssumedRowHeight);var c=n.mouseresizedisplay;c.innerHTML='<table cellpadding="0" cellspacing="0"><tr><td style="width:100px;border:1px dashed black;background-color:white;height:'+(l-2)+'px;">&nbsp;</td><td><div style="font-size:small;color:white;background-color:gray;padding:4px;">'+l+"</div></td></tr></table>",t.setStyles(c.firstChild.lastChild.firstChild.childNodes[0],"filter:alpha(opacity=85);opacity:.5;")}t.StopPropagation(i)}},t.ProcessEditorRowsizeMouseUp=function(o){var i=o||e.event,n=t.EditorMouseInfo,r=n.editor;if(r){element=n.element;var a=t.GetSpreadsheetControlObject().spreadsheetDiv.firstChild.offsetHeight,s=i.clientY-a;if(t.RemoveMouseMoveUp(t.ProcessEditorRowsizeMouseMove,t.ProcessEditorRowsizeMouseUp,r.toplevel,i),n.mouserowtounhide)r.EditorScheduleSheetCommands("set "+n.mouserowtounhide+" hide",!0,!1);else if(n.mouseresizerownum){var l=r.context.rowheight[n.mouseresizerownum]-0+(s-n.mousedownclienty);l<t.Constants.defaultAssumedRowHeight&&(l=t.Constants.defaultAssumedRowHeight),r.EditorScheduleSheetCommands("set "+n.mouseresizerownum+" height "+l,!0,!1),r.timeout&&e.clearTimeout(r.timeout),r.timeout=e.setTimeout(t.FinishColRowSize,1)}return!1}},t.AutoRepeatInfo={timer:null,mouseinfo:null,repeatinterval:1e3,editor:null,repeatcallback:null},t.SetDragAutoRepeat=function(o,i,n){var r,a,s=t.AutoRepeatInfo;if(s.repeatcallback=n,!i)return s.timer&&(e.clearTimeout(s.timer),s.timer=null),void(s.mouseinfo=null);if(s.editor=o,s.mouseinfo&&(i.rowheader||i.rowfooter?i.row!=s.mouseinfo.row&&(r=t.crToCoord(o.ecell.col,i.row),s.repeatcallback?(a=i.row<s.mouseinfo.row?"left":i.row>s.mouseinfo.row?"right":"",s.repeatcallback(r,a)):(o.MoveECell(r),o.MoveECell(r),o.RangeExtend(),o.EditorMouseRange(r))):(i.colheader||i.colfooter)&&i.col!=s.mouseinfo.col&&(r=t.crToCoord(i.col,o.ecell.row),s.repeatcallback?(a=i.row<s.mouseinfo.row?"left":i.row>s.mouseinfo.row?"right":"",s.repeatcallback(r,a)):(o.MoveECell(r),o.RangeExtend(),o.EditorMouseRange(r)))),s.mouseinfo=i,i.distance<5)s.repeatinterval=333;else if(i.distance<10)s.repeatinterval=250;else if(i.distance<25)s.repeatinterval=100;else{if(!(i.distance<35))return void(s.timer&&(e.clearTimeout(s.timer),s.timer=null));s.repeatinterval=75}s.timer||(s.timer=e.setTimeout(t.DragAutoRepeat,s.repeatinterval))},t.DragAutoRepeat=function(){var o,i,n,r=t.AutoRepeatInfo,a=r.mouseinfo;a.rowheader?o="left":a.rowfooter?o="right":a.colheader?o="up":a.colfooter&&(o="down"),r.repeatcallback?(n=t.coordToCr(r.editor.ecell.coord),"left"==o&&n.col>1?n.col--:"right"==o?n.col++:"up"==o&&n.row>1?n.row--:"down"==o&&n.row++,i=t.crToCoord(n.col,n.row),r.repeatcallback(i,o)):(i=r.editor.MoveECellWithKey("[a"+o+"]shifted"),i&&r.editor.EditorMouseRange(i)),r.timer=e.setTimeout(t.DragAutoRepeat,r.repeatinterval)},t.ProcessEditorDblClick=function(o){var i,n,r,a,s=o||e.event,l=t.EditorMouseInfo,c=s.target||s.srcElement;if(!l.ignore){for(a=null;!a&&c;c=c.parentNode)a=t.LookupElement(c,l.registeredElements);if(!a)return void(l.editor=null);i=a.editor;var u=t.GetElementPositionWithScroll(i.toplevel),d=s.clientX-u.left,h=s.clientY-u.top;if(n=t.GridMousePosition(i,d,h),n&&n.coord){switch(l.editor=i,l.element=c,r=i.range,sheetobj=i.context.sheetobj,i.state){case"start":t.EditorOpenCellEdit(i);break;case"input":}t.StopPropagation(s)}}},t.EditorOpenCellEdit=function(e){var t;return e.ecell&&e.inputBox?e.inputBox.element.disabled?!0:(e.inputBox.ShowInputBox(!0),e.inputBox.Focus(),e.inputBox.SetText(""),e.inputBox.DisplayCellContents(),e.inputBox.Select("end"),t=e.workingvalues,t.partialexpr="",t.ecoord=e.ecell.coord,t.erow=e.ecell.row,void(t.ecol=e.ecell.col)):!0},t.EditorProcessKey=function(e,o,i){var n,r,a,s,l=(e.context.sheetobj,e.workingvalues),c=e.range;switch("string"!=typeof o&&(o=""),e.state){case"start":if(i.shiftKey&&"[a"==o.substr(0,2)&&(o+="shifted"),"[enter]"==o&&(o="[adown]"),"[tab]"==o&&(o=i.shiftKey?"[aleft]":"[aright]"),"[a"==o.substr(0,2)||"[pg"==o.substr(0,3)||"[home]"==o)return n=e.MoveECellWithKey(o),!n;if("[del]"==o||"[backspace]"==o){e.noEdit||e.ECellReadonly()||e.EditorApplySetCommandsToRange("empty","");break}if("[esc]"==o){if(c.hasrange){e.RangeRemove(),e.MoveECell(c.anchorcoord);for(s in e.StatusCallback)e.StatusCallback[s].func(e,"specialkey",o,e.StatusCallback[s].params)}return!1}if("[f2]"==o)return e.noEdit||e.ECellReadonly()?!0:(t.EditorOpenCellEdit(e),e.state="inputboxdirect",!1);if(o.length>1&&"["==o.substr(0,1)||0==o.length)return e.ctrlkeyFunction&&o.length>0?e.ctrlkeyFunction(e,o):!0;if(!e.ecell)return!0;if(!e.inputBox)return!0;if(e.ECellReadonly())return!0;e.inputBox.element.disabled=!1,e.state="input",e.inputBox.ShowInputBox(!0),e.inputBox.Focus(),e.inputBox.SetText(o),e.inputBox.Select("end"),l.partialexpr="",l.ecoord=e.ecell.coord,l.erow=e.ecell.row,l.ecol=e.ecell.col,e.RangeRemove();break;case"input":if(a=e.inputBox.GetText(),e.inputBox.skipOne)return!1;if("[esc]"==o||"[enter]"==o||"[tab]"==o||o&&"[a"==o.substr(0,2)){if(("(+-*/,:!&<>=^".indexOf(a.slice(-1))>=0&&"="==a.slice(0,1)||"="==a)&&(l.partialexpr=a),l.partialexpr&&(i.shiftKey&&"[a"==o.substr(0,2)&&(o+="shifted"),r=e.MoveECellWithKey(o)))return e.inputBox.SetText(c.hasrange?l.partialexpr+t.crToCoord(c.left,c.top)+":"+t.crToCoord(c.right,c.bottom):l.partialexpr+r),!1;e.inputBox.Blur(),e.inputBox.ShowInputBox(!1),e.state="start",e.cellhandles.ShowCellHandles(!0),"[esc]"!=o?(e.EditorSaveEdit(),e.ecell.coord!=l.ecoord&&e.MoveECell(l.ecoord),"[enter]"==o&&(o="[adown]"),"[tab]"==o&&(o=i.shiftKey?"[aleft]":"[aright]"),"[a"==o.substr(0,2)&&e.MoveECellWithKey(o)):(e.inputBox.DisplayCellContents(),e.RangeRemove(),e.MoveECell(l.ecoord));break}return l.partialexpr&&"[backspace]"==o?(e.inputBox.SetText(l.partialexpr),l.partialexpr="",e.RangeRemove(),e.MoveECell(l.ecoord),e.inputBox.ShowInputBox(!0),!1):"[f2]"==o?(e.state="inputboxdirect",!1):(c.hasrange&&e.RangeRemove(),e.MoveECell(l.ecoord),l.partialexpr&&(e.inputBox.ShowInputBox(!0),l.partialexpr=""),!0);case"inputboxdirect":if(a=e.inputBox.GetText(),"[esc]"==o||"[enter]"==o||"[tab]"==o){e.inputBox.Blur(),e.inputBox.ShowInputBox(!1),e.state="start",e.cellhandles.ShowCellHandles(!0),"[esc]"==o?e.inputBox.DisplayCellContents():(e.EditorSaveEdit(),e.ecell.coord!=l.ecoord&&e.MoveECell(l.ecoord),"[enter]"==o&&(o="[adown]"),"[tab]"==o&&(o=i.shiftKey?"[aleft]":"[aright]"),"[a"==o.substr(0,2)&&e.MoveECellWithKey(o));break}return"[f2]"==o?(e.state="input",!1):!0;case"skip-and-start":return e.state="start",e.cellhandles.ShowCellHandles(!0),!1;default:return!0}return!1},t.EditorAddToInput=function(e,t,o){var i=e.workingvalues;if(!e.noEdit&&!e.ECellReadonly())switch(e.state){case"start":e.state="input",e.inputBox.ShowInputBox(!0),e.inputBox.element.disabled=!1,e.inputBox.Focus(),e.inputBox.SetText((o||"")+t),e.inputBox.Select("end"),i.partialexpr="",i.ecoord=e.ecell.coord,i.erow=e.ecell.row,i.ecol=e.ecell.col,e.RangeRemove();break;case"input":case"inputboxdirect":e.inputBox.element.focus(),i.partialexpr&&(e.inputBox.SetText(i.partialexpr),i.partialexpr="",e.RangeRemove(),e.MoveECell(i.ecoord)),e.inputBox.SetText(e.inputBox.GetText()+t)}},t.EditorDisplayCellContents=function(e){e.inputBox&&e.inputBox.DisplayCellContents()},t.EditorSaveEdit=function(e,o){var i,n,r,a,s,l,c=e.context.sheetobj,u=e.workingvalues;r="text t",a="string"==typeof o?o:e.inputBox.GetText(),s=t.GetCellContents(c,u.ecoord)+"",a!=s&&(n=a.charAt(0),"="==n&&-1==a.indexOf("\n")?(r="formula",a=a.substring(1)):"'"==n?(r="text t",a=a.substring(1),i=t.DetermineValueType(a),"t"==i.type.charAt(0)&&(r="text "+i.type)):0==a.length?r="empty":(i=t.DetermineValueType(a),r="n"==i.type&&a==i.value+""?"value n":"t"==i.type.charAt(0)?"text "+i.type:""==i.type?"text t":"constant "+i.type+" "+i.value),"t"==r.charAt(0)&&(a=t.encodeForSave(a)),l="set "+u.ecoord+" "+r+" "+a,e.EditorScheduleSheetCommands(l,!0,!1),"undefined"!=typeof c.ioEventTree&&"undefined"!=typeof c.ioParameterList&&"undefined"!=typeof c.ioEventTree[u.ecoord]&&t.EditedTriggerCell(c.ioEventTree[u.ecoord],u.ecoord,e,c))},t.EditedTriggerCell=function(e,t,o,i){for(var n in e){var r=i.ioParameterList[n];if("undefined"!=typeof r)switch(r.function_name){case"EMAILONEDIT":case"EMAILONEDITIF":cmdline="setemailparameters "+n+" "+t,o.deferredEmailCommands.push({cmdstr:cmdline,saveundo:!1})}}},t.EditorApplySetCommandsToRange=function(e,o){var i,n,r=(e.context.sheetobj,e.ecell),a=e.range;a.hasrange?(coord=t.crToCoord(a.left,a.top)+":"+t.crToCoord(a.right,a.bottom),i="set "+coord+" "+o,n=e.EditorScheduleSheetCommands(i,!0,!1)):(i="set "+r.coord+" "+o,n=e.EditorScheduleSheetCommands(i,!0,!1)),e.DisplayCellContents()},t.EditorProcessMouseWheel=function(e,t,o,i){i.functionobj.editor.busy||(t>0&&i.functionobj.editor.ScrollRelative(!0,Math.floor(1.5*-t)),0>t&&i.functionobj.editor.ScrollRelative(!0,Math.ceil(1.5*-t)))},t.GridMousePosition=function(e,o,i){var n,r,a,s,l,c,u={};for(n=1;n<e.rowpositions.length&&!(e.rowheight[n]&&e.rowpositions[n]+e.rowheight[n]>i);n++);for(a=1;a<e.colpositions.length&&!(e.colwidth[a]&&e.colpositions[a]+e.colwidth[a]>o);a++);if(u.row=n,u.col=a,e.headposition&&1!=t._app){if(o<e.headposition.left&&o>=e.gridposition.left){for(u.rowheader=!0,u.distance=e.headposition.left-o,u.rowtoresize=!1,u.rowselect=!1,l=1;l<e.rowpositions.length;l++)if(e.rowheight[l]&&e.rowpositions[l]+e.rowheight[l]-3<=i&&e.rowpositions[l]+e.rowheight[l]+3>=i){u.rowtoresize=l;break}if((unhide=e.context.rowunhidetop[n])&&(pos=t.GetElementPosition(unhide),o>=pos.left&&o<pos.left+unhide.offsetWidth&&i>=e.rowpositions[n]+e.rowheight[n]-unhide.offsetHeight&&i<e.rowpositions[n]+e.rowheight[n]&&(u.rowtounhide=n+1)),(unhide=e.context.rowunhidebottom[n])&&(pos=t.GetElementPosition(unhide),o>=pos.left&&o<pos.left+unhide.offsetWidth&&i>=e.rowpositions[n]&&i<e.rowpositions[n]+unhide.offsetHeight&&(u.rowtounhide=n-1)),null==u.rowtounhide){for(r=0;r<e.context.rowpanes.length;r++)if(u.rowtoresize>=e.context.rowpanes[r].first&&u.rowtoresize<=e.context.rowpanes[r].last)return u;u.rowselect=!0}return delete u.rowtoresize,u}if(i<e.headposition.top&&i>e.gridposition.top){for(u.colheader=!0,u.distance=e.headposition.top-i,u.coltoresize=!1,u.colselect=!1,c=1;c<e.colpositions.length;c++)if(e.colwidth[c]&&e.colpositions[c]+e.colwidth[c]-3<=o&&e.colpositions[c]+e.colwidth[c]+3>=o){u.coltoresize=c;break}if((unhide=e.context.colunhideleft[a])&&(pos=t.GetElementPosition(unhide),o>=pos.left&&o<pos.left+unhide.offsetWidth&&i>=pos.top&&i<pos.top+unhide.offsetHeight&&(u.coltounhide=a+1)),(unhide=e.context.colunhideright[a])&&(pos=t.GetElementPosition(unhide),o>=pos.left&&o<pos.left+unhide.offsetWidth&&i>=pos.top&&i<pos.top+unhide.offsetHeight&&(u.coltounhide=a-1)),null==u.coltounhide){for(s=0;s<e.context.colpanes.length;s++)if(u.coltoresize>=e.context.colpanes[s].first&&u.coltoresize<=e.context.colpanes[s].last)return u;u.colselect=!0}return delete u.coltoresize,u}return o>=e.verticaltablecontrol.controlborder?(u.rowfooter=!0,u.distance=o-e.verticaltablecontrol.controlborder,u):i>=e.horizontaltablecontrol.controlborder?(u.colfooter=!0,u.distance=i-e.horizontaltablecontrol.controlborder,u):o<e.gridposition.left?(u.rowheader=!0,u.distance=e.headposition.left-o,u):i<=e.gridposition.top?(u.colheader=!0,u.distance=e.headposition.top-i,u):(u.coord=t.crToCoord(u.col,u.row),e.context.cellskip[u.coord]&&(u.coord=e.context.cellskip[u.coord]),u)}return null},t.GetEditorCellElement=function(e,o,i){var n=0,r=0;if(0==e.context.showRCHeaders)var n=-1,r=-1;var a,s,l,c,u=0,d=0;for(a=0;a<e.context.rowpanes.length;a++){if(o>=e.context.rowpanes[a].first&&o<=e.context.rowpanes[a].last)for(s=0;s<e.context.colpanes.length;s++){if(i>=e.context.colpanes[s].first&&i<=e.context.colpanes[s].last){for(u+=o-e.context.rowpanes[a].first+2,l=e.context.colpanes[s].first;i>=l;l++)c=e.context.cellskip[t.crToCoord(l,o)],c&&e.context.CoordInPane(c,a,s)||d++;return{element:e.griddiv.firstChild.lastChild.childNodes[u+r].childNodes[d+n],rowpane:a,colpane:s}}for(l=e.context.colpanes[s].first;l<=e.context.colpanes[s].last;l++)c=e.context.cellskip[t.crToCoord(l,o)],c&&e.context.CoordInPane(c,a,s)||d++;d+=1}u+=e.context.rowpanes[a].last-e.context.rowpanes[a].first+1+1}return null},t.MoveECellWithKey=function(e,o){var i,n,r,a,s=!1,l=1;if(!e.ecell)return null;switch("shifted"==o.slice(-7)&&(o=o.slice(0,-7),s=!0),n=e.ecell.row,r=e.ecell.col,a=e.context.sheetobj.cells[e.ecell.coord],o){case"[adown]":n+=a&&a.rowspan||1;break;case"[aup]":n--,l=-1;break;case"[pgdn]":n+=e.pageUpDnAmount-1+(a&&a.rowspan||1);break;case"[pgup]":n-=e.pageUpDnAmount,l=-1;break;case"[aright]":r+=a&&a.colspan||1;break;case"[aleft]":r--,l=-1;break;case"[home]":n=1,r=1;break;default:return null}for(e.context.sheetobj.attribs.usermaxcol&&(r=Math.min(e.context.sheetobj.attribs.usermaxcol,r)),e.context.sheetobj.attribs.usermaxrow&&(n=Math.min(e.context.sheetobj.attribs.usermaxrow,n));"yes"==e.context.sheetobj.colattribs.hide[t.rcColname(r)];)r+=l,1>r&&(l=-l,r=1);for(;"yes"==e.context.sheetobj.rowattribs.hide[n];)n+=l,1>n&&(l=-l,n=1);return e.range.hasrange||s&&e.RangeAnchor(),i=e.MoveECell(t.crToCoord(r,n)),e.range.hasrange&&(s?e.RangeExtend():e.RangeRemove()),i},t.MoveECell=function(e,o){var i,n,r=e.context.highlights,a=t.coordToCr(o);if(e.context.sheetobj.attribs.usermaxcol&&a.col>e.context.sheetobj.attribs.usermaxcol&&(a.col=e.context.sheetobj.attribs.usermaxcol),e.context.sheetobj.attribs.usermaxrow&&a.row>e.context.sheetobj.attribs.usermaxrow&&(a.row=e.context.sheetobj.attribs.usermaxrow),o=t.crToCoord(a.col,a.row),e.ecell){if(e.ecell.coord==o)return o;i=t.GetEditorCellElement(e,e.ecell.row,e.ecell.col),delete r[e.ecell.coord],e.range2.hasrange&&e.ecell.row>=e.range2.top&&e.ecell.row<=e.range2.bottom&&e.ecell.col>=e.range2.left&&e.ecell.col<=e.range2.right&&(r[e.ecell.coord]="range2"),e.UpdateCellCSS(i,e.ecell.row,e.ecell.col),e.SetECellHeaders(""),e.cellhandles&&e.cellhandles.ShowCellHandles(!1)

Callers 6

ethercalc.jsFile · 0.70
LFunction · 0.70
bFunction · 0.70
wFunction · 0.70
cFunction · 0.70
uFunction · 0.70

Calls 4

pushMethod · 0.80
getAttributeMethod · 0.80
stopMethod · 0.80
MFunction · 0.70

Tested by

no test coverage detected