@trebco/treb 36.1.2 → 36.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-YLCFKX2G.mjs +24601 -0
- package/dist/treb-spreadsheet.mjs +1 -1
- package/dist/treb.d.ts +127 -116
- package/package.json +1 -1
- package/treb-embed/src/embedded-spreadsheet.ts +15 -5
|
@@ -4,5 +4,5 @@ import{A as or,B as fe,C as ae,D as Re,E as R,F as we,G as Ee,H as ir,I as Pe,J
|
|
|
4
4
|
You can revert to the original or save your
|
|
5
5
|
changes in the sidebar.`,close_box:!0,timeout:5e3,type:"info"});break;case"indent":case"outdent":this.grid.Indent(void 0,e.command==="indent"?1:-1);break;default:console.info("unhandled",e.command);break}Object.keys(t).length&&this.grid.ApplyStyle(void 0,t,!0),this.Focus()}ShowToolbar(e){if(this.options.toolbar&&this.options.container instanceof HTMLElement){let t=this.options.container.parentElement;t&&(e===void 0&&(e=!t.hasAttribute("toolbar")),e?t.setAttribute("toolbar",""):t.removeAttribute("toolbar"))}}ShowSidebar(e){if(this.options.toolbar&&this.options.container instanceof HTMLElement){let t=this.options.container.parentElement;t&&(e===void 0&&(e=t.hasAttribute("collapsed")),e?t.removeAttribute("collapsed"):t.setAttribute("collapsed",""))}}CreateChart(){return this.calculator.RegisterLibrary("treb-charts",Xt)&&this.UpdateAC(),this.options.chart_renderer?typeof this.options.chart_renderer=="function"?new xe(this.options.chart_renderer()):new xe(this.options.chart_renderer):new xe}async LoadLanguage(e=""){(!e||e==="locale")&&(e=(ee.locale||"").split(/-/).map(i=>i.toLowerCase())[0]),e=e.toLowerCase();let t;if(e&&["es","fr","pt","nl","de","pl","sv","no","da","it"].includes(e))try{t=await import(`./languages/treb-i18n-${e}.mjs`)}catch(n){console.error(n)}t?this.model.SetLanguage(t.LanguageMap):this.model.SetLanguage(),this.grid.Reselect(),this.grid.Update(!0),this.UpdateAC(),this.Publish({type:"language-change"})}Batch(e,t=!1){let r=this.last_selection,n=this.grid.Batch(e,t),o=!1,i=!1;for(let s of n)switch(s.type){case"composite":case"data":o=!0;break;case"structure":s.rebuild_required&&(i=!0);break;default:}i&&this.calculator.Reset(),(o||i)&&(this.Recalculate(),this.DocumentChange(r))}Freeze(e=0,t=0){this.grid.Freeze(e,t,!0)}FreezeSelection(){let e=this.grid.GetSelection();if(e.empty)this.grid.Freeze(0,0);else{let t=e.area;t.entire_sheet||(t.entire_row?this.grid.Freeze(t.end.row+1,0):t.entire_column?this.grid.Freeze(0,t.end.column+1):this.grid.Freeze(t.end.row+1,t.end.column+1))}}GetFreeze(){return this.grid.GetFreeze()}UpdateTheme(){this.grid.UpdateTheme(void 0),this.UpdateDocumentStyles();for(let e of this.model.sheets.list){for(let t of e.conditional_formats)t.internal=void 0;for(let t of e.annotations)if(t.view&&t.data.type==="textbox"){let r=t.view[this.grid.view_index]||{};r.update_callback&&r.update_callback()}}this.calculator.UpdateConditionals(),this.ApplyConditionalFormats(this.grid.active_sheet,!1),this.grid.Update(!0),this.Publish({type:"theme-change"})}GetSheetID(e){if(typeof e=="number"){let t=this.grid.model.sheets.list[e];if(t)return t.id}else{let t=this.model.sheets.Find(e);if(t)return t.id}}InsertTable(e,t={}){let r=e?this.model.ResolveArea(e,this.grid.active_sheet):this.GetSelectionReference().area,n=t.theme;typeof n=="number"&&(n=gt(n)),this.grid.InsertTable(r,t.totals_row,t.sortable,n)}RemoveTable(e){let t=this.ResolveTable(e||this.GetSelectionReference().target);t&&this.grid.RemoveTable(t)}UpdateTableStyle(e,t=4){let r=this.ResolveTable(e||this.GetSelectionReference().target);r&&(typeof t=="number"&&(t=gt(t)),r.theme=t,this.grid.active_sheet.FlushCellStyles(),this.grid.Update(!0),this.PushUndo())}SetTabColor(e,t){let r=typeof e>"u"?this.grid.active_sheet:this.model.sheets.Find(e);r&&this.grid.TabColor(r,t)}AddSheet(e){this.grid.AddSheet(e);let t=this.model.sheets.list[this.model.sheets.list.length-1];return this.calculator.Reset(),t.id}RemoveConnectedChart(e){let t=this.model.RemoveConnectedElement(e);if(t){let r=this.calculator.RemoveConnectedELement(t)}}UpdateConnectedChart(e,t){let r=this.model.connected_elements.get(e);if(r){r.formula=t;let n=r.internal;n?.state&&(n.state=void 0),this.calculator.UpdateConnectedElements(this.grid.active_sheet,r),r.update&&r.update.call(0,r)}}CreateConnectedFormula(e,t,r={}){let n=r?.r1c1||!1,o=r?.argument_separator||this.parser.argument_separator;this.parser.Save(),this.parser.flags.r1c1=n,o===","?this.parser.SetLocaleSettings("."):this.parser.SetLocaleSettings(",");let i=this.parser.Parse(e);if(this.parser.Restore(),i.expression)e="="+this.parser.Render(i.expression,{missing:""});else throw console.warn("invalid formula",i.error),new Error("invalid formula");let s=this.model.AddConnectedElement({formula:e,update:t?l=>{t.call(0,l)}:void 0});return this.calculator.UpdateConnectedElements(this.grid.active_sheet),this.UpdateConnectedElements(),s}CreateConnectedChart(e,t,r){let n=this.CreateChart();n.Initialize(t);let o=i=>{let s=this.parser.Parse(i.formula);if(s&&s.expression&&s.expression.type==="call"){this.parser.Walk(s.expression,u=>((u.type==="address"||u.type==="range")&&this.model.ResolveSheetID(u,void 0,this.grid.active_sheet),!0));let l=s.expression.name.toLowerCase(),c=this.calculator.CalculateExpression(s.expression);n.Exec(l,c)}n.Update()};return this.CreateConnectedFormula(e,o,r)}InsertAnnotation(e,t="treb-chart",r,n){let o,i,s=!1;if(typeof n=="object"?(i=n.argument_separator,s=!!n.r1c1):(n===","||n===";")&&(i=n),r&&(o=Kt.IsRectangle(r)?r:this.model.ResolveArea(r,this.grid.active_sheet)),i&&i!==this.parser.argument_separator||s){this.parser.Save(),i===","?this.parser.SetLocaleSettings("."):this.parser.SetLocaleSettings(","),this.parser.flags.r1c1=!!s;let m=this.parser.Parse(e);this.parser.Restore(),m.expression&&(e="="+this.parser.Render(m.expression,{missing:""}))}let{x:l,y:c}=this.grid.GetScrollOffset(),u=this.grid.scale||1,d={width:301,height:301};this.grid.CreateAnnotation({type:t,formula:e},void 0,void 0,void 0,o||{top:c/u+30,left:l/u+30,...d})}InsertImage(){this.SelectFile2(".png, .jpg, .jpeg, .gif, .svg",2)}RenameSheet(e,t){let r;typeof e=="number"?r=this.grid.model.sheets.list[e]:typeof e=="string"?r=this.model.sheets.Find(e):r=this.grid.active_sheet,r&&this.grid.RenameSheet(r,t)}DeleteSheet(e){if(typeof e=="string"){let t=this.model.sheets.Find(e);t&&this.grid.DeleteSheetID(t.id)}else this.grid.DeleteSheet(e);this.calculator.Reset()}HideSheet(e=0,t=!0){this.grid.ShowSheet(e,!t)}ListSheets(){return this.model.sheets.list.map(e=>{let t={name:e.name};return e.visible||(t.hidden=!0),t})}ShowSheet(e=0,t=!0){this.grid.ShowSheet(e,t)}ActivateSheet(e){this.grid.ActivateSheet(e)}SetColumnWidth(e,t,r){this.grid.SetColumnWidth(e,t,r)}SetRowHeight(e,t){this.grid.SetRowHeight(e,t)}InsertRows(e,t=1){if(typeof e>"u"){let r=this.grid.GetSelection();if(r.empty)return;let n=r.area;e=n.entire_column?0:n.start.row}this.grid.InsertRows(e,t)}InsertColumns(e,t=1){if(typeof e>"u"){let r=this.grid.GetSelection();if(r.empty)return;let n=r.area;e=n.entire_row?0:n.start.column}this.grid.InsertColumns(e,t)}DeleteRows(e,t=1){if(typeof e>"u"){let r=this.grid.GetSelection();if(r.empty)return;let n=r.area;e=n.entire_column?0:n.start.row,t=n.rows}this.grid.InsertRows(e,-t)}DeleteColumns(e,t=1){if(typeof e>"u"){let r=this.grid.GetSelection();if(r.empty)return;let n=r.area;e=n.entire_row?0:n.start.column,t=n.columns}this.grid.InsertColumns(e,-t)}FilterTable(e,t=0,r){let n=this.ResolveTable(e);if(!n)throw new Error("invalid table reference");r?this.grid.FilterTable(n,t,o=>r.call(0,o.value,o.calculated||void 0,JSON.parse(JSON.stringify(o.style||{})))):this.grid.FilterTable(n,0,()=>!0)}SortTable(e,t={}){let r=this.ResolveTable(e);if(!r)throw new Error("invalid table reference");this.grid.SortTable(r,t)}MergeCells(e){this.grid.MergeCells(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0)}UnmergeCells(e){this.grid.UnmergeCells(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0)}async ExportBlob(e){return this.export_worker||(this.export_worker=await this.LoadWorker()),new Promise((t,r)=>{this.export_worker?(this.export_worker.OnMessage(n=>{n.data.type==="export-complete"&&t(n.data.blob)}),this.export_worker.OnError(n=>{console.error("export worker error"),console.info(n),r(n)}),e||(e=this.Serialize({rendered_values:!0,expand_arrays:!0,export_colors:!0,decorated_cells:!0,tables:!0,share_resources:!1,export_functions:!0,apply_row_pattern:!0})),e.decimal_mark=ee.decimal_separator,this.export_worker.PostMessage({type:"export",sheet:e,decorated:this.calculator.DecoratedFunctionList()})):r("worker failed")})}Revert(){if(this.options.inline_document){this.LoadDocument(this.options.inline_document),this.initial_load_source="inline-document",this.options.local_storage&&(this.SaveLocalStorage("reverted_backup"),localStorage.removeItem(this.options.local_storage));return}let e=this.options.document;if(e){this.LoadNetworkDocument(e),this.initial_load_source="network-file",this.options.local_storage&&(this.SaveLocalStorage("reverted_backup"),localStorage.removeItem(this.options.local_storage));return}console.warn("to revert, there must be a document set in options"),this.dialog?.ShowDialog({title:"Can't revert -- no document is set in options",close_box:!0,timeout:3e3,type:"error"})}Export(){this.ExportBlob().then(e=>{let t="export";this.grid.model.document_name&&(t=this.grid.model.document_name.toLowerCase().replace(/\s+/g,"-")),e&&(this.SaveAs(e,t+".xlsx"),this.last_save_version=this.file_version)}).catch(e=>{throw/invalid uri/i.test(e.message)&&this.dialog?.ShowDialog({title:"Error exporting file",close_box:!0,message:"The worker cannot run from the filesystem, please use a web server.",timeout:3e3,type:"error"}),e})}GetSelectionReference(){return this.grid.GetSelection()}Focus(){this.grid.Focus()}Resize(){this.grid.UpdateLayout();for(let e of this.views)e.view.grid.UpdateLayout();this.Publish({type:"resize"})}Reset(){if(this.parent_view)return this.parent_view.Reset();this.grid.Reset(),this.ResetInternal(),this.UpdateAC(),this.Publish({type:"reset"})}LoadFromLocalStorage(e){this.options.local_storage=e;let t=localStorage.getItem(e);if(t)try{let r=JSON.parse(t);return this.LoadDocument(r,{source:"local-storage"}),!0}catch(r){console.error(r)}return!1}async LoadNetworkDocument(e,t){let r=t?t.scroll:void 0,n=t?!!t.recalculate:!1,o=t?t.sheet:void 0,i=/csv(?:$|\?|&)/i.test(e),s=/tsv(?:$|\?|&)/i.test(e);try{this.spinner?.Show();let l=await fetch(e);if(this.spinner?.Hide(),!l.ok)throw new Error("network error");let c=await l.text();if(typeof c=="string")if(i)this.LoadCSV(c,"network-file");else{if(s)throw new Error("tsv not supported (TODO)");{c.substr(0,11)==="&&&START&&&"?c=c.substr(11):c.substr(0,8)==="for(;;);"&&(c=c.substr(8));let u=JSON.parse(c);this.LoadDocument(u,{scroll:r,recalculate:n,override_sheet:o,source:"network-file"})}}}catch(l){console.info("error loading network document",e),console.error(l),this.dialog?.ShowDialog({title:"Error loading file",close_box:!0,message:"The network document returned an error",type:"error",timeout:3e3}),this.Reset()}}async LoadLocalFile(){this.SelectFile2(".treb, .csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/json",1)}ExportDelimited(e={}){if(e={delimiter:",",...e},!e.delimiter||e.delimiter!==","&&e.delimiter!==" ")throw new Error("invalid delimiter");let t=this.grid.active_sheet;switch(typeof e.sheet){case"undefined":break;case"string":t=this.model.sheets.Find(e.sheet);break;case"number":t=this.grid.model.sheets.list[e.sheet];break;default:t=void 0;break}if(!t)throw new Error("invalid sheet identifier");let r=t.cells.toJSON({nested:!1,expand_arrays:!0,calculated_value:!0}),n=[];for(let s=0;s<r.columns;s++)n.push("");let o=[];for(let s=0;s<r.rows;s++)o.push(n.slice(0));let i=new RegExp(`[
|
|
6
6
|
\r"${e.delimiter}]`);if(Zt(r.data))for(let s of r.data){let l="";!e.formulas&&typeof s.calculated<"u"?l=X(s.calculated)?pt(s.calculated):s.calculated.toString():typeof s.value=="string"&&s.value[0]==="'"?l=s.value.substr(1):typeof s.value<"u"&&(l=X(s.value)?pt(s.value):s.value.toString()),i.test(l)&&(l=l.replace(/"/g,'""'),l='"'+l+'"'),o[s.row][s.column]=l}return o.map(s=>s.join(e.delimiter)).join(`\r
|
|
7
|
-
`)}SaveLocalFile(e="treb.json",t={}){this.SaveToDesktop(e,t)}SaveToDesktop(e="treb.json",t={}){let r=this.grid.model.document_name||"document",n,o,i=e.split(/\./).filter(l=>l.trim().length),s=i.length?i[i.length-1].toLowerCase():"treb";if(i.length<=1||e==="treb.json")if(e==="treb.json"&&(s=e),(s==="csv"||s==="tsv")&&this.grid.model.sheets.length>1){let l=this.grid.active_sheet.name;e=(r+"-"+l).toLowerCase().replace(/\W+/g,"-")+"."+s}else e=r.toLowerCase().replace(/\W+/g,"-")+"."+s;switch(s){case"csv":o=this.ExportDelimited({delimiter:","});break;case"tsv":o=this.ExportDelimited({delimiter:" "});break;case"treb":case"json":case"treb.json":n=this.SerializeDocument({...t}),o=JSON.stringify(n,void 0,t.pretty?2:void 0),this.last_save_version=this.file_version;break;default:throw new Error("invalid file type")}if(o&&e){let l=new Blob([o],{type:"text/plain;charset=utf-8"});this.SaveAs(l,e)}}LoadCSV(e,t){if(this.parent_view)return this.parent_view.LoadCSV(e,t);this.grid.FromCSV(e),this.ResetInternal(),this.grid.Update(!0),this.Publish({type:"load",source:t}),this.UpdateDocumentStyles()}ScrollOffset(e){return this.grid.ScrollOffset(e)}LoadDocument(e,t={}){if(this.parent_view)return this.parent_view.LoadDocument(e,t);if(this.initial_load_source||(this.initial_load_source=t.source),t={flush:!0,recalculate:!1,...t},t.override_selection&&e.sheet_data){let r=Array.isArray(e.sheet_data)?e.sheet_data:[e.sheet_data];for(let n of r)if(n.id===t.override_selection.target.sheet_id){n.selection=t.override_selection;break}}if(this.ImportDocumentData(e,t.override_sheet),this.calculator.Reset(),e.rendered_values&&!t.recalculate?(this.calculator.RebuildClean(!0),this.ApplyConditionalFormats(this.grid.active_sheet,!1),this.grid.Update()):this.Recalculate(),this.InflateAnnotations(),t.flush&&this.FlushUndo(),this.Publish({type:"load",source:t.source}),this.UpdateDocumentStyles(),this.loaded=!0,t.scroll){let r=t.scroll;Promise.resolve().then(()=>this.ScrollTo(r))}}SetNote(e,t){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}this.grid.SetNote(e,t)}SetValidation(e,t,r){if(typeof e=="string"){let n=this.model.ResolveAddress(e,this.grid.active_sheet);e=bt(n)?new z(n.start,n.end):new z(n)}if(K(e)&&(e=new z(e)),typeof t>"u"||Array.isArray(t))this.grid.SetValidation(e,t,r);else{let n=this.model.ResolveArea(t,this.grid.active_sheet);this.grid.SetValidation(e,n,r)}}RemoveFunction(e){let t=e.toUpperCase();this.model.macro_functions.delete(t),this.UpdateAC()}DefineFunction(e,t="",r="0"){if(!e.length||/^[^A-Za-z]/.test(e)||/[^\w_.]/.test(e))throw new Error("invalid function name");typeof t=="string"&&(t=t?t.split(this.parser.argument_separator).map(n=>n.trim()):[]);for(let n of t)if(!n.length||/^[^A-Za-z]/.test(n)||/[^\w_.]/.test(n))throw new Error("invalid argument name");this.RemoveFunction(e),this.grid.model.macro_functions.set(e.toUpperCase(),{name:e,function_def:r,argument_names:t,expression:this.parser.Parse(r).expression}),this.UpdateAC()}SerializeDocument(e={}){e={share_resources:!0,shrink:!0,...e};let t=this.Serialize(e),r={app:"@trebco/treb",version:"36.1.2",revision:this.file_version,name:this.grid.model.document_name,user_data:this.grid.model.user_data,decimal_mark:ee.decimal_separator,...t};if(e.share_resources){let n=1,o=new Map,i=Array.isArray(r.sheet_data)?r.sheet_data:[r.sheet_data],s=c=>{let u=o.get(c);return u||(u=(n++).toString(),o.set(c,u)),`resource:${u}`};for(let c of i)if(c){c.background_image&&(c.background_image=s(c.background_image));for(let u of c.annotations||[])u.type==="image"&&u.data?.src&&(u.data.src=s(u.data.src))}let l={};for(let[c,u]of o.entries())l[u]=c;r.shared_resources=l}return e.rendered_values&&(r.rendered_values=!0),r}Recalculate(e){let t;switch(e?.type){case"data":t=e.area;break;case"composite":t=e.data_area;break}this.calculator.Calculate(t),this.calculator.grid_expanded&&!this.grid.headless&&this.grid.UpdateLayout(),this.ApplyConditionalFormats(this.grid.active_sheet,!1),this.grid.Update(!0),this.UpdateAnnotations(),this.Publish({type:"data"}),this.grid.UpdateStats()}SaveLocalStorage(e=this.options.local_storage){if(!e){console.warn("not saving, no key");return}let t=JSON.stringify(this.SerializeDocument({rendered_values:!0,expand_arrays:!0}));localStorage.setItem(e,t)}Undo(){if(this.parent_view)return this.parent_view.Undo();if(this.undo_pointer<=1){console.warn("nothing to undo");return}let e=this.undo_stack[--this.undo_pointer-1],t=e.selection?JSON.parse(e.selection):void 0;this.LoadDocument(JSON.parse(e.data),{flush:!1,override_selection:t,source:"undo"})}About(){this.dialog?.ShowDialog({type:"about"})}ScrollIntoView(e,t=!1){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}this.grid.ScrollIntoView(e,t)}ScrollTo(e,t={}){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}t={x:!0,y:!0,smooth:!1,...t},this.grid.ScrollTo(e,t.x,t.y,t.smooth)}Resolve(e,t){let r=this.model.ResolveAddress(e,this.grid.active_sheet,t);return K(r)?r.sheet_id?r:void 0:r.start.sheet_id?r:void 0}Unresolve(e,t=!0,r=!0){if(typeof e=="string"){let n=this.Resolve(e);if(!n)throw new Error("invalid reference");e=n}return this.calculator.Unresolve(e,this.grid.active_sheet,t,r)}Evaluate(e,t={}){return this.calculator.Evaluate(e,this.grid.active_sheet,t)}GetSelection(e=!0){let t=this.grid.GetSelection();if(t.empty)return"";let r="";if(t.area.count>1?r=z.CellAddressToLabel(t.area.start)+":"+z.CellAddressToLabel(t.area.end):r=z.CellAddressToLabel(t.area.start),!e)return r;let n=t.area.start.sheet_id||this.grid.active_sheet.id,o=this.calculator.ResolveSheetName(n,!0);return o?o+"!"+r:r}ParseNumber(e){return we.TryParse(e).value}FormatNumber(e,t="General"){return X(e)?Re.FormatPartsAsText(R.Get(t).FormatComplex(e)):R.Get(t).Format(e)}SpreadsheetDate(e){return e instanceof Date&&(e=e.getTime()),ae(e,!0)}JavascriptDate(e){return fe(e).getTime()}ApplyBorders(e,t,r=1){this.grid.ApplyBorders2(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0,t,{},r)}ApplyStyle(e,t={},r=!0){this.grid.ApplyStyle(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0,t,r)}ClearName(e){this.grid.SetName(e)}ListNames(){return this.model.SerializeNames()}DefineName(e,t,r,n=!1){if(typeof t>"u"||t===null)throw new Error("invalid value (null or undefined)");if(typeof r=="string"){let o=this.model.sheets.ID(r);if(typeof o=="number")r=o;else throw new Error("invalid scope; use a sheet name or sheet id")}if(typeof t=="object"&&(K(t)||bt(t))){this.grid.SetName(e,this.model.ResolveArea(t,this.grid.active_sheet),void 0,r,n);return}if(typeof t=="string"){let o=this.parser.Parse(t);if(!o.expression)throw new Error("invalid expression");switch(o.expression.type){case"address":case"range":this.grid.SetName(e,this.model.ResolveArea(o.expression,this.grid.active_sheet),void 0,r,n);return}this.grid.SetName(e,void 0,t,r,n)}else this.grid.SetName(e,void 0,t.toString(),r,n)}SetLink(e,t=""){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}if(!e){let r=this.GetSelectionReference();if(r.empty)return;e=r.target}this.grid.SetLink(e,t)}Select(e){let t;e&&(t=this.model.ResolveArea(e,this.grid.active_sheet),t.start.sheet_id&&t.start.sheet_id!==this.grid.active_sheet.id&&this.grid.ActivateSheetID(t.start.sheet_id)),this.grid.SelectRange(t)}Paste(e,...t){let r=a.clipboard,n={};switch(t.length){case 1:Array.isArray(t[0])?r=t[0]:typeof t[0]=="object"&&(n=t[0]);break;case 2:t[0]&&Array.isArray(t[0])&&(r=t[0]),t[1]&&typeof t[1]=="object"&&(n=t[1]);break}if(!r)throw new Error("no clipboad data");this.grid.PasteArea(this.RangeOrSelection(e,"no range and no selection"),r,n)}Copy(e){let t=this.RangeOrSelection(e),r=t?this.grid.CopyArea(t,"copy"):[];return a.clipboard=structuredClone(r),r}Cut(e){let t=this.RangeOrSelection(e),r=t?this.grid.CopyArea(t,"cut"):[];return a.clipboard=structuredClone(r),r}GetRange(e,t={}){let r=this.RangeOrSelection(e);if(!r)return;let n=t.type;return n||(t.formatted&&(n="formatted"),t.formula&&(n="A1")),n==="formula"&&(n="A1"),this.grid.GetRange(r,n)}GetStyle(e,t=!1){let r=this.RangeOrSelection(e);if(r)return this.grid.GetRangeStyle(r,t)}SetRange(e,t=void 0,r={}){let n=this.RangeOrSelection(e);if(n){if(r.spill&&Array.isArray(t)){let o=t.length,i=Math.max(0,...t.map(l=>l.length)),s={row:n.start.row+o+1,column:n.start.column+i+1};n.ConsumeAddress(s)}return this.grid.SetRange(n,t,r)}}Subscribe(e){return this.events.Subscribe(e)}Cancel(e){this.events.Cancel(e)}RangeOrSelection(e,t){if(!e){let r=this.GetSelectionReference();if(r.empty){if(t)throw t;return}else return r.area.Clone()}return this.model.ResolveArea(e,this.grid.active_sheet)}Serialize(e={}){let t=this.grid.active_sheet;t.selection=JSON.parse(JSON.stringify(this.grid.GetSelection()));let r=this.grid.ScrollOffset();r&&(t.scroll_offset=r);let n=this.model.sheets.list.map(l=>l.toJSON(e)),o;this.model.tables.size>0&&(o=Array.from(this.model.tables.values()));let i;if(this.model.macro_functions.size){i=[];for(let l of this.model.macro_functions.values())i.push({...l,expression:void 0})}let s=this.model.SerializeNames(t);return{sheet_data:n,active_sheet:t.id,named:s.length?s:void 0,macro_functions:i,tables:o}}ApplyConditionalFormats(e,t){let r=[];if(e.conditional_formats.length||e.flush_conditional_formats){for(let n of e.conditional_formats)switch(r.push(n.area),n.type){case"gradient":n.internal||(n.internal={}),n.internal.gradient||(n.internal.gradient=new sr(n.stops,this.grid.theme,n.color_space));break;case"data-bar":n.internal||(n.internal={});break}e.ApplyConditionalFormats()}t&&this.grid.Update(!0,r)}ResolveTable(e){let t;if(typeof e=="string"){let r=e.toLowerCase();this.model.tables.has(r)&&(t=this.model.tables.get(r))}if(!t){let r=this.model.ResolveAddress(e,this.grid.active_sheet);K(r)||(r=r.start),t=this.grid.GetTableReference(r)}return t}SaveAs(e,t){let r=this.DOM.Create("a");r.href=URL.createObjectURL(e),r.download=t,r.click(),URL.revokeObjectURL(r.href)}Publish(e){this.events.Publish(e)}async ImportXLSX(e,t,r){return this.parent_view?this.parent_view.ImportXLSX(e,t):(this.export_worker||(this.export_worker=await this.LoadWorker()),new Promise((n,o)=>{this.export_worker?(this.dialog?.ShowDialog({message:"Importing XLSX..."}),this.export_worker.OnMessage(i=>{if(i.data){if(i.data.type==="import-error")return o(i.data.error||"unknown error");if(i.data.type!=="import-complete")return o("unknown error (invalid message)");if(this.parser.decimal_mark!=="."){let s=this.parser.decimal_mark,l=this.parser.argument_separator;this.parser.Save(),this.parser.SetLocaleSettings(".");let c=u=>{let d=this.parser.Parse(u);if(d.expression)return"="+this.parser.Render(d.expression,{missing:"",convert_decimal:s,convert_argument_separator:l})};for(let u of i.data.results.named||[])u.expression=c(u.expression)||"";for(let u of i.data.results.sheets||[]){for(let d of u.cells||[])d.type==="formula"&&d.value&&(d.value=c(d.value));if(u.annotations)for(let d of u.annotations)d.formula&&(d.formula=c(d.formula))}this.parser.Restore()}this.grid.FromImportData(i.data.results),this.ResetInternal(),this.grid.Update(),this.UpdateAC(),this.Publish({type:"load",source:t,path:r}),this.UpdateDocumentStyles(),this.InflateAnnotations(),this.calculator.UpdateConditionals(),this.ApplyConditionalFormats(this.grid.active_sheet,!1)}else return o("unknown error (missing data)");this.dialog?.HideDialog(),n()}),this.export_worker.OnError(i=>{console.error("import worker error"),console.info(i),o(i)}),this.export_worker.PostMessage({type:"import",data:e})):o("worker failed")}))}ResetInternal(){this.calculator.Reset(),this.FlushUndo(),this.file_version=this.last_save_version=0}HandleCellEvent(e){if(e.data?.type==="hyperlink"){let t="hyperlink invalid target",r=e.data.reference||"";if(typeof r=="string"){if(/^https{0,1}:\/\//i.test(r)){if(!this.options.hyperlinks){console.warn("hyperlinks are disabled");return}let n=this.DOM.Create("a");n.setAttribute("target",this.options.hyperlinks),n.setAttribute("href",r),n.setAttribute("noreferrer","true"),n.setAttribute("nofollow","true"),n.click();return}else{let n=this.parser.Parse(r);if(n.expression){if(n.expression.type==="address"){(n.expression.sheet||n.expression.sheet_id)&&this.ActivateSheet(n.expression.sheet||n.expression.sheet_id),this.Select(r);return}else if(n.expression.type==="range"){(n.expression.start.sheet||n.expression.start.sheet_id)&&this.ActivateSheet(n.expression.start.sheet||n.expression.start.sheet_id),this.Select(r);return}}}console.warn(t,2);return}}}OnSheetChange(e){for(let t of e.activate.annotations)this.InflateAnnotation(t),this.calculator.UpdateAnnotations(t,e.activate);this.UpdateAnnotations(),this.calculator.UpdateConditionals(),this.ApplyConditionalFormats(e.activate,!0)}HandleDrag(e){if(e.dataTransfer&&e.dataTransfer.types){if(e.dataTransfer.types.some&&e.dataTransfer.types.some(t=>t==="Files"))e.preventDefault();else for(let t=0;t<e.dataTransfer.types.length;t++)if(e.dataTransfer.types[t]==="files"){e.preventDefault();return}}}HandleDrop(e){if(e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length){e.preventDefault();let t=e.dataTransfer.files[0];/^image/.test(t.type)?this.InsertImageInternal(t):this.LoadFileInternal(t,"drag-and-drop").catch(()=>{})}}SelectFile2(e,t){if(!this.file_chooser){let r=this.DOM.Create("input",void 0,void 0,{attrs:{type:"file"},events:{change:()=>{if(r.files&&r.files[0]){let n=r.files[0];switch(r.value="",this.file_chooser_operation){case 2:this.InsertImageInternal(n);break;case 1:this.LoadFileInternal(n,"local-file",!0);break;default:console.warn("file chooser: no operation");break}}}}});this.file_chooser=r}if(!this.file_chooser)throw new Error("could not create file chooser");this.file_chooser_operation=t,this.file_chooser.accept=e||"",this.file_chooser.click()}async InsertImageInternal(e){if(this.options.max_file_size&&e.size>this.options.max_file_size){this.dialog?.ShowDialog({type:"error",message:"This file exceeds the allowed image size. Please try a smaller image.",title:"Error adding image",timeout:3e3,close_box:!0});return}let t=e;await new Promise((r,n)=>{let o=new FileReader;o.onload=async()=>{try{if(o.result){let i;if(typeof o.result=="string")i=o.result;else{i="";let l=new Uint8Array(o.result);for(let c=0;c<l.byteLength;c++)i+=String.fromCharCode(l[c])}let s=this.DOM.Create("img");s.src=i,await Promise.resolve(),this.grid.CreateAnnotation({type:"image",formula:"",data:{scale:"",src:i,original_size:{width:s.width||300,height:s.height||300}}},void 0,void 0,void 0,{top:30,left:30,width:s.width||300,height:s.height||300})}r()}catch(i){n(i)}},o.onabort=()=>{n("Aborted")},o.onerror=()=>{n("File error")},setTimeout(()=>{o.readAsDataURL(t)},100)})}LoadFileInternal(e,t,r=!0){if(!e)return Promise.resolve();let n=new FileReader;return new Promise((o,i)=>{let s=l=>{n.onload=null,n.onabort=null,n.onerror=null,l?(r&&(this.dialog?.ShowDialog({title:"Error reading file",close_box:!0,message:"Please make sure your file is a valid XLSX, CSV or TREB file.",type:"error",timeout:3e3}),console.error(l)),i(l)):o()};n.onload=()=>{try{if(n.result)if(/\.csv$/i.test(e.name))this.LoadCSV(n.result,t);else if(/\.xls[xm]$/i.test(e.name)){typeof n.result=="string"?s("Unsupported file"):this.ImportXLSX(n.result,t).then(()=>s()).catch(l=>s(l));return}else{let l=JSON.parse(n.result);this.LoadDocument(l,{source:t})}s()}catch(l){s(l?.toString())}},n.onabort=()=>{s("Aborted")},n.onerror=()=>{s("File error")},setTimeout(()=>{/\.xls[xm]$/i.test(e.name)?n.readAsArrayBuffer(e):n.readAsText(e)},100)})}UpdateAnnotations(){for(let e of this.grid.active_sheet.annotations){let t=e.temp;if(t.vertex&&t.vertex.state_id!==t.state){t.state=t.vertex.state_id;for(let n of e.view)n&&(n.dirty=!0)}let r=e.view[this.grid.view_index]||{};r.dirty&&(r.dirty=!1,r.update_callback&&r.update_callback(),this.grid.AnnotationUpdated(e))}this.UpdateConnectedElements()}UpdateConnectedElements(){for(let e of this.model.connected_elements.values()){let t=e.internal;if(t?.vertex&&t.vertex.state_id!==t.state){t.state=t.vertex.state_id;let r=e.update;r&&Promise.resolve().then(()=>r.call(0,e))}}}RebuildAllAnnotations(){for(let e of this.grid.active_sheet.annotations){this.InflateAnnotation(e);let t=e.view[this.grid.view_index]||{};t.resize_callback&&t.resize_callback(),t.update_callback&&t.update_callback()}}InflateAnnotations(){for(let e of this.grid.active_sheet.annotations)this.InflateAnnotation(e)}InflateAnnotation(e){if(this.grid.headless)return;let t=e.view[this.grid.view_index]||{};if(t.inflated){e.dirty&&(t.resize_callback&&t.resize_callback(),e.dirty=!1);return}if(t.inflated=!0,e.dirty&&(e.dirty=!1),t.content_node){if(e.data.type==="treb-chart"){let r=this.CreateChart();r.Initialize(t.content_node);let n=()=>{if(e.data.formula){let o=this.parser.Parse(e.data.formula);if(o&&o.expression&&o.expression.type==="call"){this.parser.Walk(o.expression,l=>((l.type==="address"||l.type==="range")&&this.model.ResolveSheetID(l,void 0,this.grid.active_sheet),!0));let i=o.expression.name.toLowerCase(),s=this.calculator.CalculateExpression(o.expression);r.Exec(i,s)}}r.Update()};t.resize_callback=()=>{this.grid.headless||(r.Resize(),r.Update())},t.update_callback=()=>{this.grid.headless||n()},t.node?.parentElement&&(this.grid.headless||n())}else if(e.data.type==="image"){if(typeof e.data.data?.src=="string"){let r=ar(e.data.data.src);if(r){let n=this.DOM.Create("img");n.src=r,e.data.data.scale==="fixed"?(n.style.position="relative",n.style.left="50%",n.style.top="50%",n.style.transform="translate(-50%, -50%)"):(n.style.width="100%",n.style.height="100%"),t.content_node.appendChild(n)}}}else if(e.data.type==="textbox"&&e.data.data){let r,n=document.createElement("div");n.classList.add("treb-annotation-textbox");for(let o of e.data.data.paragraphs){let i=document.createElement("p");o.style&&(o.style.horizontal_align==="right"||o.style.horizontal_align==="center")&&(i.style.textAlign=o.style.horizontal_align);for(let s of o.content){let l=document.createElement("span");if(r||(r=l),e.data.formula||(l.textContent=s.text||""),s.style?.bold&&(l.style.fontWeight="600"),s.style?.italic&&(l.style.fontStyle="italic"),i.appendChild(l),e.data.formula)break}if(n.append(i),e.data.formula)break}if(t.content_node.append(n),e.data.data.style){let o=e.data.data.style,i=()=>{if(o.fill){let s=ft(this.grid.theme,o.fill);n.style.background=s}};t.update_callback=()=>{if(this.grid.headless||i(),r&&e.data.formula){let s=this.parser.Parse(e.data.formula);if(s&&s.expression){this.parser.Walk(s.expression,d=>((d.type==="address"||d.type==="range")&&this.model.ResolveSheetID(d,void 0,this.grid.active_sheet),!0));let l=this.calculator.CalculateExpression(s.expression),c=R.Get("General"),u;switch(s.expression.type){case"address":u=s.expression;break;case"range":u=s.expression.start;break}if(u){let m=(u.sheet_id?this.model.sheets.Find(u.sheet_id):this.grid.active_sheet)?.CellStyleData(u);m?.number_format&&(c=R.Get(m.number_format))}switch(l.type){case 3:case 2:case 8:r.textContent=c.Format(l.value);break;default:r.textContent=l.value?.toString()||""}}}},t.update_callback()}}}}DocumentChange(e){Promise.resolve().then(()=>{this.file_version++,this.file_version>=65536&&(this.file_version=1);let t=JSON.stringify(this.SerializeDocument({optimize:"size",rendered_values:!0,expand_arrays:!0}));this.options.undo&&this.PushUndo(t,e,!1),this.Publish({type:"document-change"})})}ResolveStorageKey(e,t=""){if(e){if(e===!0){let r=0,n=document.location.href;for(let i=0,s=n.length;i<s;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;let o=Math.abs(r).toString(16);return t?t+"-"+o:o}return e}}PushUndo(e,t,r=!0){let n=t||this.last_selection;this.undo_stack[this.undo_pointer-1]&&(this.undo_stack[this.undo_pointer-1].selection=n),r&&(this.file_version++,this.file_version>=65536&&(this.file_version=1)),e||(e=JSON.stringify(this.SerializeDocument({optimize:"size",rendered_values:!0,expand_arrays:!0}))),this.undo_stack[this.undo_pointer++]={data:e,selection:void 0};let o=this.undo_stack.length;if(o>16){let i=o-16;this.undo_stack=this.undo_stack.slice(i),this.undo_pointer-=i}}FlushUndo(e=!0){this.undo_stack=[],this.undo_pointer=0,this.last_save_version=this.file_version,e&&this.PushUndo(void 0,void 0,!1)}UpdateSelection(e,t){this.last_selection=JSON.stringify(e);let r={type:"selection"};t==="sheet-change"&&(r.reason=t),this.Publish(r)}UpdateSelectionStyleAnnotation(e){let t={style:JSON.parse(JSON.stringify(e.data.style||{}))};t.style&&(t.style.font_face||(t.style.font_face="stack:ui"),t.style.font_size||(t.style.font_size={unit:"em",value:1})),t.relative_font_size=ht.RelativeFontSize(t.style||{},this.grid.theme.grid_cell||{}),this.selection_state=t}UpdateSelectionStyle(e){let t=this.grid.GetFreeze(),r={frozen:!!t.rows||!!t.columns};if(e||(e=this.grid.GetSelection()),e&&!e.empty){r.selection=e;let n=this.grid.active_sheet.CellData(e.target);r.table=!!n.table,r.merge=!!n.merge_area,r.merge&&n.merge_area&&(n.merge_area.start.row!==e.target.row||n.merge_area.start.column!==e.target.column)&&(n=this.grid.active_sheet.CellData(n.merge_area.start)),r.comment=n.note,r.style=n.style?{...n.style}:void 0,r.relative_font_size=ht.RelativeFontSize(r.style||{},this.grid.theme.grid_cell||{}),r.empty=typeof n.value>"u"&&!n.style?.font_face}this.grid?.edit_state&&(this.grid.edit_state.font_face=r.style?.font_face||void 0),this.selection_state=r}UpdateDocumentStyles(){let e={},t={};for(let n of this.grid.model.sheets.list)n.NumberFormatsAndColors(t,e);this.document_styles.colors=Object.keys(t),this.document_styles.number_formats=Object.keys(e),this.document_styles.theme_colors=[];let r=[.5,.25,0,-.25,-.5];for(let n=0;n<10;n++)this.document_styles.theme_colors.push(r.map(o=>{let i={theme:n,tint:o},s=ft(this.grid.theme,i);return{color:i,resolved:s}}))}ConvertLocale(e){let t=new Jt;t.flags={...this.parser.flags};let r,n;e.decimal_mark==="."?(t.SetLocaleSettings("."),r=",",n=";"):(t.SetLocaleSettings(","),r=".",n=",");let o=i=>{let s=t.Parse(i);if(s.expression)return"="+t.Render(s.expression,{missing:"",convert_decimal:r,convert_argument_separator:n})};if(e.macro_functions)for(let i of e.macro_functions){let s=o(i.function_def);s&&(i.function_def=s)}if(e.named)for(let i of e.named){let s=o(i.expression);s&&(i.expression=s)}if(e.sheet_data){let i=Array.isArray(e.sheet_data)?e.sheet_data:[e.sheet_data];for(let s of i){if(s.annotations){for(let l of s.annotations)if(l.formula){let c=o(l.formula);c&&(l.formula=c)}}if(s.data?.length)for(let l of s.data){let c=Yt(l)?[l]:l.cells;for(let u of c)if(u.value&&typeof u.value=="string"&&u.value[0]==="="){let d=o(u.value.slice(1));d&&(u.value=d)}}}}}CompareVersions(e="",t=""){let r=e.split(".").map(s=>Number(s)||0).concat([0,0,0]),n=t.split(".").map(s=>Number(s)||0).concat([0,0,0]),o=[0,1,2],i={match:0};for(let s=0;s<3;s++)if(r[s]!==n[s]){i.match=r[s]>n[s]?1:-1,i.level=o[s];break}return i}ImportDocumentData(e,t){this.file_version=e.revision||0;let r=[],n=this.CompareVersions(e.version,"36.1.2");if(n.match>0&&(n.level===0||n.level===1)&&console.warn(`The file you are opening was created with a newer version of TREB (${e.version} vs 36.1.2).
|
|
7
|
+
`)}SaveLocalFile(e="treb.json",t={}){this.SaveToDesktop(e,t)}SaveToDesktop(e="treb.json",t={}){let r=this.grid.model.document_name||"document",n,o,i=e.split(/\./).filter(l=>l.trim().length),s=i.length?i[i.length-1].toLowerCase():"treb";if(i.length<=1||e==="treb.json")if(e==="treb.json"&&(s=e),(s==="csv"||s==="tsv")&&this.grid.model.sheets.length>1){let l=this.grid.active_sheet.name;e=(r+"-"+l).toLowerCase().replace(/\W+/g,"-")+"."+s}else e=r.toLowerCase().replace(/\W+/g,"-")+"."+s;switch(s){case"csv":o=this.ExportDelimited({delimiter:","});break;case"tsv":o=this.ExportDelimited({delimiter:" "});break;case"treb":case"json":case"treb.json":n=this.SerializeDocument({...t}),o=JSON.stringify(n,void 0,t.pretty?2:void 0),this.last_save_version=this.file_version;break;default:throw new Error("invalid file type")}if(o&&e){let l=new Blob([o],{type:"text/plain;charset=utf-8"});this.SaveAs(l,e)}}LoadCSV(e,t){if(this.parent_view)return this.parent_view.LoadCSV(e,t);this.grid.FromCSV(e),this.ResetInternal(),this.grid.Update(!0),this.Publish({type:"load",source:t}),this.UpdateDocumentStyles()}ScrollOffset(e){return this.grid.ScrollOffset(e)}LoadDocument(e,t={}){if(this.parent_view)return this.parent_view.LoadDocument(e,t);if(this.initial_load_source||(this.initial_load_source=t.source),t={flush:!0,recalculate:!1,...t},t.override_selection&&e.sheet_data){let r=Array.isArray(e.sheet_data)?e.sheet_data:[e.sheet_data];for(let n of r)if(n.id===t.override_selection.target.sheet_id){n.selection=t.override_selection;break}}if(this.ImportDocumentData(e,t.override_sheet),this.calculator.Reset(),e.rendered_values&&!t.recalculate?(this.calculator.RebuildClean(!0),this.ApplyConditionalFormats(this.grid.active_sheet,!1),this.grid.Update()):this.Recalculate(),this.InflateAnnotations(),t.flush&&this.FlushUndo(),this.Publish({type:"load",source:t.source,path:t.path}),this.UpdateDocumentStyles(),this.loaded=!0,t.scroll){let r=t.scroll;Promise.resolve().then(()=>this.ScrollTo(r))}}SetNote(e,t){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}this.grid.SetNote(e,t)}SetValidation(e,t,r){if(typeof e=="string"){let n=this.model.ResolveAddress(e,this.grid.active_sheet);e=bt(n)?new z(n.start,n.end):new z(n)}if(K(e)&&(e=new z(e)),typeof t>"u"||Array.isArray(t))this.grid.SetValidation(e,t,r);else{let n=this.model.ResolveArea(t,this.grid.active_sheet);this.grid.SetValidation(e,n,r)}}RemoveFunction(e){let t=e.toUpperCase();this.model.macro_functions.delete(t),this.UpdateAC()}DefineFunction(e,t="",r="0"){if(!e.length||/^[^A-Za-z]/.test(e)||/[^\w_.]/.test(e))throw new Error("invalid function name");typeof t=="string"&&(t=t?t.split(this.parser.argument_separator).map(n=>n.trim()):[]);for(let n of t)if(!n.length||/^[^A-Za-z]/.test(n)||/[^\w_.]/.test(n))throw new Error("invalid argument name");this.RemoveFunction(e),this.grid.model.macro_functions.set(e.toUpperCase(),{name:e,function_def:r,argument_names:t,expression:this.parser.Parse(r).expression}),this.UpdateAC()}SerializeDocument(e={}){e={share_resources:!0,shrink:!0,...e};let t=this.Serialize(e),r={app:"@trebco/treb",version:"36.1.2",revision:this.file_version,name:this.grid.model.document_name,user_data:this.grid.model.user_data,decimal_mark:ee.decimal_separator,...t};if(e.share_resources){let n=1,o=new Map,i=Array.isArray(r.sheet_data)?r.sheet_data:[r.sheet_data],s=c=>{let u=o.get(c);return u||(u=(n++).toString(),o.set(c,u)),`resource:${u}`};for(let c of i)if(c){c.background_image&&(c.background_image=s(c.background_image));for(let u of c.annotations||[])u.type==="image"&&u.data?.src&&(u.data.src=s(u.data.src))}let l={};for(let[c,u]of o.entries())l[u]=c;r.shared_resources=l}return e.rendered_values&&(r.rendered_values=!0),r}Recalculate(e){let t;switch(e?.type){case"data":t=e.area;break;case"composite":t=e.data_area;break}this.calculator.Calculate(t),this.calculator.grid_expanded&&!this.grid.headless&&this.grid.UpdateLayout(),this.ApplyConditionalFormats(this.grid.active_sheet,!1),this.grid.Update(!0),this.UpdateAnnotations(),this.Publish({type:"data"}),this.grid.UpdateStats()}SaveLocalStorage(e=this.options.local_storage){if(!e){console.warn("not saving, no key");return}let t=JSON.stringify(this.SerializeDocument({rendered_values:!0,expand_arrays:!0}));localStorage.setItem(e,t)}Undo(){if(this.parent_view)return this.parent_view.Undo();if(this.undo_pointer<=1)return console.warn("nothing to undo"),!1;let e=this.undo_stack[--this.undo_pointer-1],t=e.selection?JSON.parse(e.selection):void 0;return this.LoadDocument(JSON.parse(e.data),{flush:!1,override_selection:t,source:"undo"}),!0}About(){this.dialog?.ShowDialog({type:"about"})}ScrollIntoView(e,t=!1){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}this.grid.ScrollIntoView(e,t)}ScrollTo(e,t={}){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}t={x:!0,y:!0,smooth:!1,...t},this.grid.ScrollTo(e,t.x,t.y,t.smooth)}Resolve(e,t){let r=this.model.ResolveAddress(e,this.grid.active_sheet,t);return K(r)?r.sheet_id?r:void 0:r.start.sheet_id?r:void 0}Unresolve(e,t=!0,r=!0){if(typeof e=="string"){let n=this.Resolve(e);if(!n)throw new Error("invalid reference");e=n}return this.calculator.Unresolve(e,this.grid.active_sheet,t,r)}Evaluate(e,t={}){return this.calculator.Evaluate(e,this.grid.active_sheet,t)}GetSelection(e=!0){let t=this.grid.GetSelection();if(t.empty)return"";let r="";if(t.area.count>1?r=z.CellAddressToLabel(t.area.start)+":"+z.CellAddressToLabel(t.area.end):r=z.CellAddressToLabel(t.area.start),!e)return r;let n=t.area.start.sheet_id||this.grid.active_sheet.id,o=this.calculator.ResolveSheetName(n,!0);return o?o+"!"+r:r}ParseNumber(e){return we.TryParse(e).value}FormatNumber(e,t="General"){return X(e)?Re.FormatPartsAsText(R.Get(t).FormatComplex(e)):R.Get(t).Format(e)}SpreadsheetDate(e){return e instanceof Date&&(e=e.getTime()),ae(e,!0)}JavascriptDate(e){return fe(e).getTime()}ApplyBorders(e,t,r=1){this.grid.ApplyBorders2(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0,t,{},r)}ApplyStyle(e,t={},r=!0){this.grid.ApplyStyle(e?this.model.ResolveArea(e,this.grid.active_sheet):void 0,t,r)}ClearName(e){this.grid.SetName(e)}ListNames(){return this.model.SerializeNames()}DefineName(e,t,r,n=!1){if(typeof t>"u"||t===null)throw new Error("invalid value (null or undefined)");if(typeof r=="string"){let o=this.model.sheets.ID(r);if(typeof o=="number")r=o;else throw new Error("invalid scope; use a sheet name or sheet id")}if(typeof t=="object"&&(K(t)||bt(t))){this.grid.SetName(e,this.model.ResolveArea(t,this.grid.active_sheet),void 0,r,n);return}if(typeof t=="string"){let o=this.parser.Parse(t);if(!o.expression)throw new Error("invalid expression");switch(o.expression.type){case"address":case"range":this.grid.SetName(e,this.model.ResolveArea(o.expression,this.grid.active_sheet),void 0,r,n);return}this.grid.SetName(e,void 0,t,r,n)}else this.grid.SetName(e,void 0,t.toString(),r,n)}SetLink(e,t=""){if(typeof e=="string"){let r=this.model.ResolveAddress(e,this.grid.active_sheet);e=K(r)?r:r.start}if(!e){let r=this.GetSelectionReference();if(r.empty)return;e=r.target}this.grid.SetLink(e,t)}Select(e){let t;e&&(t=this.model.ResolveArea(e,this.grid.active_sheet),t.start.sheet_id&&t.start.sheet_id!==this.grid.active_sheet.id&&this.grid.ActivateSheetID(t.start.sheet_id)),this.grid.SelectRange(t)}Paste(e,...t){let r=a.clipboard,n={};switch(t.length){case 1:Array.isArray(t[0])?r=t[0]:typeof t[0]=="object"&&(n=t[0]);break;case 2:t[0]&&Array.isArray(t[0])&&(r=t[0]),t[1]&&typeof t[1]=="object"&&(n=t[1]);break}if(!r)throw new Error("no clipboad data");this.grid.PasteArea(this.RangeOrSelection(e,"no range and no selection"),r,n)}Copy(e){let t=this.RangeOrSelection(e),r=t?this.grid.CopyArea(t,"copy"):[];return a.clipboard=structuredClone(r),r}Cut(e){let t=this.RangeOrSelection(e),r=t?this.grid.CopyArea(t,"cut"):[];return a.clipboard=structuredClone(r),r}GetRange(e,t={}){let r=this.RangeOrSelection(e);if(!r)return;let n=t.type;return n||(t.formatted&&(n="formatted"),t.formula&&(n="A1")),n==="formula"&&(n="A1"),this.grid.GetRange(r,n)}GetStyle(e,t=!1){let r=this.RangeOrSelection(e);if(r)return this.grid.GetRangeStyle(r,t)}SetRange(e,t=void 0,r={}){let n=this.RangeOrSelection(e);if(n){if(r.spill&&Array.isArray(t)){let o=t.length,i=Math.max(0,...t.map(l=>l.length)),s={row:n.start.row+o+1,column:n.start.column+i+1};n.ConsumeAddress(s)}return this.grid.SetRange(n,t,r)}}Subscribe(e){return this.events.Subscribe(e)}Cancel(e){this.events.Cancel(e)}RangeOrSelection(e,t){if(!e){let r=this.GetSelectionReference();if(r.empty){if(t)throw t;return}else return r.area.Clone()}return this.model.ResolveArea(e,this.grid.active_sheet)}Serialize(e={}){let t=this.grid.active_sheet;t.selection=JSON.parse(JSON.stringify(this.grid.GetSelection()));let r=this.grid.ScrollOffset();r&&(t.scroll_offset=r);let n=this.model.sheets.list.map(l=>l.toJSON(e)),o;this.model.tables.size>0&&(o=Array.from(this.model.tables.values()));let i;if(this.model.macro_functions.size){i=[];for(let l of this.model.macro_functions.values())i.push({...l,expression:void 0})}let s=this.model.SerializeNames(t);return{sheet_data:n,active_sheet:t.id,named:s.length?s:void 0,macro_functions:i,tables:o}}ApplyConditionalFormats(e,t){let r=[];if(e.conditional_formats.length||e.flush_conditional_formats){for(let n of e.conditional_formats)switch(r.push(n.area),n.type){case"gradient":n.internal||(n.internal={}),n.internal.gradient||(n.internal.gradient=new sr(n.stops,this.grid.theme,n.color_space));break;case"data-bar":n.internal||(n.internal={});break}e.ApplyConditionalFormats()}t&&this.grid.Update(!0,r)}ResolveTable(e){let t;if(typeof e=="string"){let r=e.toLowerCase();this.model.tables.has(r)&&(t=this.model.tables.get(r))}if(!t){let r=this.model.ResolveAddress(e,this.grid.active_sheet);K(r)||(r=r.start),t=this.grid.GetTableReference(r)}return t}SaveAs(e,t){let r=this.DOM.Create("a");r.href=URL.createObjectURL(e),r.download=t,r.click(),URL.revokeObjectURL(r.href)}Publish(e){this.events.Publish(e)}async ImportXLSX(e,t,r){return this.parent_view?this.parent_view.ImportXLSX(e,t):(this.export_worker||(this.export_worker=await this.LoadWorker()),new Promise((n,o)=>{this.export_worker?(this.dialog?.ShowDialog({message:"Importing XLSX..."}),this.export_worker.OnMessage(i=>{if(i.data){if(i.data.type==="import-error")return o(i.data.error||"unknown error");if(i.data.type!=="import-complete")return o("unknown error (invalid message)");if(this.parser.decimal_mark!=="."){let s=this.parser.decimal_mark,l=this.parser.argument_separator;this.parser.Save(),this.parser.SetLocaleSettings(".");let c=u=>{let d=this.parser.Parse(u);if(d.expression)return"="+this.parser.Render(d.expression,{missing:"",convert_decimal:s,convert_argument_separator:l})};for(let u of i.data.results.named||[])u.expression=c(u.expression)||"";for(let u of i.data.results.sheets||[]){for(let d of u.cells||[])d.type==="formula"&&d.value&&(d.value=c(d.value));if(u.annotations)for(let d of u.annotations)d.formula&&(d.formula=c(d.formula))}this.parser.Restore()}this.grid.FromImportData(i.data.results),this.ResetInternal(),this.grid.Update(),this.UpdateAC(),this.Publish({type:"load",source:t,path:r}),this.UpdateDocumentStyles(),this.InflateAnnotations(),this.calculator.UpdateConditionals(),this.ApplyConditionalFormats(this.grid.active_sheet,!1)}else return o("unknown error (missing data)");this.dialog?.HideDialog(),n()}),this.export_worker.OnError(i=>{console.error("import worker error"),console.info(i),o(i)}),this.export_worker.PostMessage({type:"import",data:e})):o("worker failed")}))}ResetInternal(){this.calculator.Reset(),this.FlushUndo(),this.file_version=this.last_save_version=0}HandleCellEvent(e){if(e.data?.type==="hyperlink"){let t="hyperlink invalid target",r=e.data.reference||"";if(typeof r=="string"){if(/^https{0,1}:\/\//i.test(r)){if(!this.options.hyperlinks){console.warn("hyperlinks are disabled");return}let n=this.DOM.Create("a");n.setAttribute("target",this.options.hyperlinks),n.setAttribute("href",r),n.setAttribute("noreferrer","true"),n.setAttribute("nofollow","true"),n.click();return}else{let n=this.parser.Parse(r);if(n.expression){if(n.expression.type==="address"){(n.expression.sheet||n.expression.sheet_id)&&this.ActivateSheet(n.expression.sheet||n.expression.sheet_id),this.Select(r);return}else if(n.expression.type==="range"){(n.expression.start.sheet||n.expression.start.sheet_id)&&this.ActivateSheet(n.expression.start.sheet||n.expression.start.sheet_id),this.Select(r);return}}}console.warn(t,2);return}}}OnSheetChange(e){for(let t of e.activate.annotations)this.InflateAnnotation(t),this.calculator.UpdateAnnotations(t,e.activate);this.UpdateAnnotations(),this.calculator.UpdateConditionals(),this.ApplyConditionalFormats(e.activate,!0)}HandleDrag(e){if(e.dataTransfer&&e.dataTransfer.types){if(e.dataTransfer.types.some&&e.dataTransfer.types.some(t=>t==="Files"))e.preventDefault();else for(let t=0;t<e.dataTransfer.types.length;t++)if(e.dataTransfer.types[t]==="files"){e.preventDefault();return}}}HandleDrop(e){if(e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length){e.preventDefault();let t=e.dataTransfer.files[0];/^image/.test(t.type)?this.InsertImageInternal(t):this.LoadFileInternal(t,"drag-and-drop").catch(()=>{})}}SelectFile2(e,t){if(!this.file_chooser){let r=this.DOM.Create("input",void 0,void 0,{attrs:{type:"file"},events:{change:()=>{if(r.files&&r.files[0]){let n=r.files[0];switch(r.value="",this.file_chooser_operation){case 2:this.InsertImageInternal(n);break;case 1:this.LoadFileInternal(n,"local-file",!0);break;default:console.warn("file chooser: no operation");break}}}}});this.file_chooser=r}if(!this.file_chooser)throw new Error("could not create file chooser");this.file_chooser_operation=t,this.file_chooser.accept=e||"",this.file_chooser.click()}async InsertImageInternal(e){if(this.options.max_file_size&&e.size>this.options.max_file_size){this.dialog?.ShowDialog({type:"error",message:"This file exceeds the allowed image size. Please try a smaller image.",title:"Error adding image",timeout:3e3,close_box:!0});return}let t=e;await new Promise((r,n)=>{let o=new FileReader;o.onload=async()=>{try{if(o.result){let i;if(typeof o.result=="string")i=o.result;else{i="";let l=new Uint8Array(o.result);for(let c=0;c<l.byteLength;c++)i+=String.fromCharCode(l[c])}let s=this.DOM.Create("img");s.src=i,await Promise.resolve(),this.grid.CreateAnnotation({type:"image",formula:"",data:{scale:"",src:i,original_size:{width:s.width||300,height:s.height||300}}},void 0,void 0,void 0,{top:30,left:30,width:s.width||300,height:s.height||300})}r()}catch(i){n(i)}},o.onabort=()=>{n("Aborted")},o.onerror=()=>{n("File error")},setTimeout(()=>{o.readAsDataURL(t)},100)})}LoadFileInternal(e,t,r=!0){if(!e)return Promise.resolve();let n=new FileReader;return new Promise((o,i)=>{let s=l=>{n.onload=null,n.onabort=null,n.onerror=null,l?(r&&(this.dialog?.ShowDialog({title:"Error reading file",close_box:!0,message:"Please make sure your file is a valid XLSX, CSV or TREB file.",type:"error",timeout:3e3}),console.error(l)),i(l)):o()};n.onload=()=>{try{if(n.result)if(/\.csv$/i.test(e.name))this.LoadCSV(n.result,t);else if(/\.xls[xm]$/i.test(e.name)){typeof n.result=="string"?s("Unsupported file"):this.ImportXLSX(n.result,t).then(()=>s()).catch(l=>s(l));return}else{let l=JSON.parse(n.result);this.LoadDocument(l,{source:t})}s()}catch(l){s(l?.toString())}},n.onabort=()=>{s("Aborted")},n.onerror=()=>{s("File error")},setTimeout(()=>{/\.xls[xm]$/i.test(e.name)?n.readAsArrayBuffer(e):n.readAsText(e)},100)})}UpdateAnnotations(){for(let e of this.grid.active_sheet.annotations){let t=e.temp;if(t.vertex&&t.vertex.state_id!==t.state){t.state=t.vertex.state_id;for(let n of e.view)n&&(n.dirty=!0)}let r=e.view[this.grid.view_index]||{};r.dirty&&(r.dirty=!1,r.update_callback&&r.update_callback(),this.grid.AnnotationUpdated(e))}this.UpdateConnectedElements()}UpdateConnectedElements(){for(let e of this.model.connected_elements.values()){let t=e.internal;if(t?.vertex&&t.vertex.state_id!==t.state){t.state=t.vertex.state_id;let r=e.update;r&&Promise.resolve().then(()=>r.call(0,e))}}}RebuildAllAnnotations(){for(let e of this.grid.active_sheet.annotations){this.InflateAnnotation(e);let t=e.view[this.grid.view_index]||{};t.resize_callback&&t.resize_callback(),t.update_callback&&t.update_callback()}}InflateAnnotations(){for(let e of this.grid.active_sheet.annotations)this.InflateAnnotation(e)}InflateAnnotation(e){if(this.grid.headless)return;let t=e.view[this.grid.view_index]||{};if(t.inflated){e.dirty&&(t.resize_callback&&t.resize_callback(),e.dirty=!1);return}if(t.inflated=!0,e.dirty&&(e.dirty=!1),t.content_node){if(e.data.type==="treb-chart"){let r=this.CreateChart();r.Initialize(t.content_node);let n=()=>{if(e.data.formula){let o=this.parser.Parse(e.data.formula);if(o&&o.expression&&o.expression.type==="call"){this.parser.Walk(o.expression,l=>((l.type==="address"||l.type==="range")&&this.model.ResolveSheetID(l,void 0,this.grid.active_sheet),!0));let i=o.expression.name.toLowerCase(),s=this.calculator.CalculateExpression(o.expression);r.Exec(i,s)}}r.Update()};t.resize_callback=()=>{this.grid.headless||(r.Resize(),r.Update())},t.update_callback=()=>{this.grid.headless||n()},t.node?.parentElement&&(this.grid.headless||n())}else if(e.data.type==="image"){if(typeof e.data.data?.src=="string"){let r=ar(e.data.data.src);if(r){let n=this.DOM.Create("img");n.src=r,e.data.data.scale==="fixed"?(n.style.position="relative",n.style.left="50%",n.style.top="50%",n.style.transform="translate(-50%, -50%)"):(n.style.width="100%",n.style.height="100%"),t.content_node.appendChild(n)}}}else if(e.data.type==="textbox"&&e.data.data){let r,n=document.createElement("div");n.classList.add("treb-annotation-textbox");for(let o of e.data.data.paragraphs){let i=document.createElement("p");o.style&&(o.style.horizontal_align==="right"||o.style.horizontal_align==="center")&&(i.style.textAlign=o.style.horizontal_align);for(let s of o.content){let l=document.createElement("span");if(r||(r=l),e.data.formula||(l.textContent=s.text||""),s.style?.bold&&(l.style.fontWeight="600"),s.style?.italic&&(l.style.fontStyle="italic"),i.appendChild(l),e.data.formula)break}if(n.append(i),e.data.formula)break}if(t.content_node.append(n),e.data.data.style){let o=e.data.data.style,i=()=>{if(o.fill){let s=ft(this.grid.theme,o.fill);n.style.background=s}};t.update_callback=()=>{if(this.grid.headless||i(),r&&e.data.formula){let s=this.parser.Parse(e.data.formula);if(s&&s.expression){this.parser.Walk(s.expression,d=>((d.type==="address"||d.type==="range")&&this.model.ResolveSheetID(d,void 0,this.grid.active_sheet),!0));let l=this.calculator.CalculateExpression(s.expression),c=R.Get("General"),u;switch(s.expression.type){case"address":u=s.expression;break;case"range":u=s.expression.start;break}if(u){let m=(u.sheet_id?this.model.sheets.Find(u.sheet_id):this.grid.active_sheet)?.CellStyleData(u);m?.number_format&&(c=R.Get(m.number_format))}switch(l.type){case 3:case 2:case 8:r.textContent=c.Format(l.value);break;default:r.textContent=l.value?.toString()||""}}}},t.update_callback()}}}}DocumentChange(e){Promise.resolve().then(()=>{this.file_version++,this.file_version>=65536&&(this.file_version=1);let t=JSON.stringify(this.SerializeDocument({optimize:"size",rendered_values:!0,expand_arrays:!0}));this.options.undo&&this.PushUndo(t,e,!1),this.Publish({type:"document-change"})})}ResolveStorageKey(e,t=""){if(e){if(e===!0){let r=0,n=document.location.href;for(let i=0,s=n.length;i<s;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;let o=Math.abs(r).toString(16);return t?t+"-"+o:o}return e}}PushUndo(e,t,r=!0){let n=t||this.last_selection;this.undo_stack[this.undo_pointer-1]&&(this.undo_stack[this.undo_pointer-1].selection=n),r&&(this.file_version++,this.file_version>=65536&&(this.file_version=1)),e||(e=JSON.stringify(this.SerializeDocument({optimize:"size",rendered_values:!0,expand_arrays:!0}))),this.undo_stack[this.undo_pointer++]={data:e,selection:void 0};let o=this.undo_stack.length;if(o>16){let i=o-16;this.undo_stack=this.undo_stack.slice(i),this.undo_pointer-=i}}FlushUndo(e=!0){this.undo_stack=[],this.undo_pointer=0,this.last_save_version=this.file_version,e&&this.PushUndo(void 0,void 0,!1)}UpdateSelection(e,t){this.last_selection=JSON.stringify(e);let r={type:"selection"};t==="sheet-change"&&(r.reason=t),this.Publish(r)}UpdateSelectionStyleAnnotation(e){let t={style:JSON.parse(JSON.stringify(e.data.style||{}))};t.style&&(t.style.font_face||(t.style.font_face="stack:ui"),t.style.font_size||(t.style.font_size={unit:"em",value:1})),t.relative_font_size=ht.RelativeFontSize(t.style||{},this.grid.theme.grid_cell||{}),this.selection_state=t}UpdateSelectionStyle(e){let t=this.grid.GetFreeze(),r={frozen:!!t.rows||!!t.columns};if(e||(e=this.grid.GetSelection()),e&&!e.empty){r.selection=e;let n=this.grid.active_sheet.CellData(e.target);r.table=!!n.table,r.merge=!!n.merge_area,r.merge&&n.merge_area&&(n.merge_area.start.row!==e.target.row||n.merge_area.start.column!==e.target.column)&&(n=this.grid.active_sheet.CellData(n.merge_area.start)),r.comment=n.note,r.style=n.style?{...n.style}:void 0,r.relative_font_size=ht.RelativeFontSize(r.style||{},this.grid.theme.grid_cell||{}),r.empty=typeof n.value>"u"&&!n.style?.font_face}this.grid?.edit_state&&(this.grid.edit_state.font_face=r.style?.font_face||void 0),this.selection_state=r}UpdateDocumentStyles(){let e={},t={};for(let n of this.grid.model.sheets.list)n.NumberFormatsAndColors(t,e);this.document_styles.colors=Object.keys(t),this.document_styles.number_formats=Object.keys(e),this.document_styles.theme_colors=[];let r=[.5,.25,0,-.25,-.5];for(let n=0;n<10;n++)this.document_styles.theme_colors.push(r.map(o=>{let i={theme:n,tint:o},s=ft(this.grid.theme,i);return{color:i,resolved:s}}))}ConvertLocale(e){let t=new Jt;t.flags={...this.parser.flags};let r,n;e.decimal_mark==="."?(t.SetLocaleSettings("."),r=",",n=";"):(t.SetLocaleSettings(","),r=".",n=",");let o=i=>{let s=t.Parse(i);if(s.expression)return"="+t.Render(s.expression,{missing:"",convert_decimal:r,convert_argument_separator:n})};if(e.macro_functions)for(let i of e.macro_functions){let s=o(i.function_def);s&&(i.function_def=s)}if(e.named)for(let i of e.named){let s=o(i.expression);s&&(i.expression=s)}if(e.sheet_data){let i=Array.isArray(e.sheet_data)?e.sheet_data:[e.sheet_data];for(let s of i){if(s.annotations){for(let l of s.annotations)if(l.formula){let c=o(l.formula);c&&(l.formula=c)}}if(s.data?.length)for(let l of s.data){let c=Yt(l)?[l]:l.cells;for(let u of c)if(u.value&&typeof u.value=="string"&&u.value[0]==="="){let d=o(u.value.slice(1));d&&(u.value=d)}}}}}CompareVersions(e="",t=""){let r=e.split(".").map(s=>Number(s)||0).concat([0,0,0]),n=t.split(".").map(s=>Number(s)||0).concat([0,0,0]),o=[0,1,2],i={match:0};for(let s=0;s<3;s++)if(r[s]!==n[s]){i.match=r[s]>n[s]?1:-1,i.level=o[s];break}return i}ImportDocumentData(e,t){this.file_version=e.revision||0;let r=[],n=this.CompareVersions(e.version,"36.1.2");if(n.match>0&&(n.level===0||n.level===1)&&console.warn(`The file you are opening was created with a newer version of TREB (${e.version} vs 36.1.2).
|
|
8
8
|
You may encounter compatibility errors.`),e.sheet_data&&(Array.isArray(e.sheet_data)?r=e.sheet_data:r.push(e.sheet_data)),e.shared_resources){let i=e.shared_resources,s=l=>/^resource:/.test(l)?i[l.substring(9)]||"":l;for(let l of r){l.background_image&&(l.background_image=s(l.background_image));for(let c of l.annotations||[])c.type==="image"&&c.data?.src&&(c.data.src=s(c.data.src))}}e.decimal_mark&&e.decimal_mark!==ee.decimal_separator&&this.ConvertLocale(e);let o=this.grid.model;if(o.tables.clear(),e.tables)for(let i of e.tables)o.tables.set(i.name.toLowerCase(),i);this.grid.UpdateSheets(r,void 0,t||e.active_sheet);for(let i of this.model.tables.values())if(i.area.start.sheet_id){let s=o.sheets.Find(i.area.start.sheet_id);if(s)for(let l=i.area.start.row;l<=i.area.end.row;l++)for(let c=i.area.start.column;c<=i.area.end.column;c++){let u=s.cells.GetCell({row:l,column:c},!0);u.table=i}}if(o.document_name=e.name,o.user_data=e.user_data,o.named.Reset(),e.named)this.model.UnserializeNames(e.named,this.grid.active_sheet);else{let i=e.named_ranges;if(!i&&r[0]&&r[0].named_ranges&&(i=r[0].named_ranges),i)for(let[s,l]of Object.entries(i))o.named.SetNamedRange(s,new z(l.start,l.end));if(e.named_expressions)for(let s of e.named_expressions)this.model.UnserializeNames([{name:s.name,expression:s.expression}],this.grid.active_sheet)}if(o.macro_functions.clear(),e.macro_functions)for(let i of e.macro_functions)o.macro_functions.set(i.name.toUpperCase(),{...i,expression:this.parser.Parse(i.function_def||"").expression});this.UpdateAC()}async LoadWorker(){let e=lr(!!this.options.in_process_workers);return await e.Init("./treb-export-worker.mjs",()=>new Worker(new URL("./treb-export-worker.mjs",import.meta.url),{type:"module"})),e}HandleKeyDown(e){e.key==="z"?(Ee.is_mac&&e.metaKey||e.ctrlKey)&&(e.stopPropagation(),e.preventDefault(),this.Undo()):e.key==="F9"&&this.options.recalculate_on_f9&&(e.stopPropagation(),e.preventDefault(),this.Recalculate())}};var fn=`@charset "UTF-8";.treb-main.treb-main .treb-mouse-mask{background:transparent;bottom:0;display:none;left:0;position:fixed;right:0;top:0;z-index:9999}.treb-main.treb-main .treb-mouse-mask.column-resize{cursor:col-resize}.treb-main.treb-main .treb-mouse-mask.row-resize{cursor:row-resize}.treb-main.treb-main .treb-mouse-mask.nub-select{cursor:crosshair}.treb-main.treb-main .treb-mouse-mask.move{cursor:move}.treb-main.treb-main .treb-mouse-mask.nw-resize{cursor:nw-resize}.treb-main.treb-main .treb-note{max-width:15em;min-width:15em}.treb-main.treb-main .treb-hover-title,.treb-main.treb-main .treb-note{background:var(--treb-note-background,#fff);border:1px solid var(--treb-note-border-color,var(--treb-ui-border-color,#ddd));border-radius:2px;box-shadow:0 1px 4px 2px hsla(0,0%,43%,.2);color:var(--treb-note-color,#333);font-family:BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,"sans-serif";font-size:10.5pt;left:100px;line-height:normal;opacity:0;padding:7px 10px;position:fixed;top:100px;transition:opacity .2s;white-space:pre-line;z-index:39}.treb-main.treb-main .treb-hover-title{min-width:10em;pointer-events:none}.treb-main.treb-main .treb-sort-button{background:#fff;border:1px solid #ccc;border-radius:2px;height:1em;left:100px;opacity:0;pointer-events:none;position:absolute;top:100px;transition:opacity .1s ease;width:1em;z-index:39}.treb-main.treb-main .treb-sort-button:after{box-sizing:border-box}.treb-main.treb-main .treb-sort-button.asc:after{border:.4em solid transparent;border-top-color:currentcolor;content:"";height:.8em;left:50%;opacity:.5;position:absolute;top:50%;transform:translate(-50%,-25%);width:.8em}.treb-main.treb-main .treb-sort-button.desc:after{border:.4em solid transparent;border-bottom-color:currentcolor;content:"";height:.8em;left:50%;opacity:.5;position:absolute;top:50%;transform:translate(-50%,-80%);width:.8em}.treb-main.treb-main .treb-tooltip{border-radius:2px;box-shadow:0 1px 4px 2px hsla(0,0%,43%,.2);display:none;line-height:normal;padding:2px 10px;pointer-events:none;position:fixed;z-index:39}.treb-main.treb-main .treb-tooltip.arrow-up:after{border:4px solid transparent;border-bottom-color:inherit;box-sizing:border-box;content:" ";height:8px;left:calc(50% - 4px);overflow:hidden;position:absolute;top:-8px;width:8px}.treb-main.treb-main .treb-tooltip.arrow-left:after{border:4px solid transparent;border-right-color:inherit;box-sizing:border-box;content:" ";height:8px;left:-8px;overflow:hidden;position:absolute;top:calc(50% - 4px);width:8px}.treb-main.treb-main .treb-dropdown-caret{background:var(--treb-dropdown-caret-background,#fff);border:1px solid var(--treb-dropdown-caret-border-color,#ccc);border-radius:2px;box-shadow:0 1px 4px 2px hsla(0,0%,43%,.2);display:none;height:20px;position:absolute;width:20px;z-index:39}.treb-main.treb-main .treb-dropdown-caret path{fill:none;stroke:var(--treb-dropdown-caret-color,#444);stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.treb-main.treb-main .treb-dropdown-list{background:var(--treb-dropdown-background,#fff);border:1px solid var(--treb-dropdown-border-color,unset);box-shadow:0 1px 4px 2px hsla(0,0%,43%,.2);color:var(--treb-dropdown-color,inherit);display:none;font-size:10pt;max-height:10em;outline:none;overflow-y:auto;position:absolute;text-align:left;z-index:39}.treb-main.treb-main .treb-dropdown-list div{cursor:default;padding:2px}.treb-main.treb-main .treb-dropdown-list div.selected{background:var(--treb-dropdown-selected-background,#555);color:var(--treb-dropdown-selected-color,#fff)}.treb-main.treb-main .treb-dropdown-caret.active{background:var(--treb-dropdown-caret-active-background,#eee)}.treb-main.treb-main .treb-dropdown-caret.active+.treb-dropdown-list{display:block}.treb-main.treb-main .treb-error-highlight{background:rgba(255,0,0,.25);opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-in-out;z-index:40}.treb-main.treb-main .treb-autocomplete{box-sizing:border-box;font-size:inherit;font-weight:400;line-height:normal;max-height:10em;overflow-y:auto;position:fixed;text-align:left;top:-1000px;z-index:39}.treb-main.treb-main .treb-autocomplete *{box-sizing:border-box}.treb-main.treb-main .treb-autocomplete ul{list-style-type:none}.treb-main.treb-main .treb-autocomplete ul,.treb-main.treb-main .treb-autocomplete ul li{font-size:inherit;font-weight:inherit;margin:0;padding:0}.treb-main.treb-main .treb-autocomplete ul li a{color:inherit;cursor:default;display:inline-block;font-size:inherit;font-weight:inherit;padding:3px 6px;text-decoration:none;width:100%}.treb-main.treb-main .treb-autocomplete-tooltip{position:fixed;top:-1000px;white-space:pre;z-index:39}.treb-main.treb-main .treb-formula-bar{display:flex;flex-direction:row;gap:.5em;grid-area:1/1/2/2;max-width:100%;overflow-x:hidden;padding:0 2px 12px;text-align:left}.treb-main.treb-main .treb-formula-bar[hidden]{display:none}.treb-main.treb-main .treb-formula-bar .treb-address-label{border:1px solid var(--treb-formula-bar-border-color,var(--treb-ui-border-color,#ccc));border-radius:2px;display:flex;flex-direction:column;height:1.75em;justify-content:center;min-height:1.5em;min-width:95px;padding-left:3px;width:95px}.treb-main.treb-main .treb-formula-bar .treb-address-label>div{outline:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.treb-main.treb-main .treb-formula-bar .treb-insert-function-button{background:transparent;border:1px solid var(--treb-formula-bar-border-color,var(--treb-ui-border-color,#ccc));border-radius:2px;height:1.75em;min-height:1.5em}.treb-main.treb-main .treb-formula-bar .treb-insert-function-button[hidden]{display:none}.treb-main.treb-main .treb-formula-bar .expand-button{background:transparent;border:0;border-radius:2px;height:1.75em;margin-left:2px;outline:none;padding:1px}.treb-main.treb-main .treb-formula-bar .expand-button:after{border:5px solid transparent;border-top-color:#999;content:" ";display:inline-block;margin:0;padding:0;position:relative;top:-6px;transition:transform .15s ease}.treb-main.treb-main .treb-formula-bar[expanded] .expand-button:after{transform:rotate(180deg) translateY(6px)}.treb-main.treb-main .treb-formula-bar .treb-editor-container{border:1px solid var(--treb-formula-bar-border-color,var(--treb-ui-border-color,#ccc));border-radius:2px;display:flex;flex-direction:column;flex-grow:1;height:1.75em;justify-content:center;min-width:0}.treb-main.treb-main .treb-formula-bar .treb-editor-container>.treb-editor-shadow{opacity:.4}.treb-main.treb-main .treb-formula-bar[expanded] .treb-editor-container{height:4.5em;transition:height .1s ease-in-out}.treb-main.treb-main .treb-formula-bar[expanded] .treb-editor-container>div{overflow-y:auto}.treb-main.treb-main .treb-formula-bar .treb-editor-container>div{flex-grow:1;line-height:1.35;margin:2px;min-height:1em;outline:none;overflow-x:hidden;overflow-y:hidden;white-space:pre-wrap;width:100%}.treb-main.treb-main .treb-mouse-mask .ghost-tab{position:fixed}.treb-main.treb-main .treb-spreadsheet-footer{align-items:center;grid-area:3/1/4/2}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tab-container{align-self:flex-start;height:2.2em;overflow:hidden}.treb-main.treb-main .treb-spreadsheet-footer,.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs{color:var(--treb-ui-color,inherit);display:flex;flex-direction:row;height:2.2em;list-style-type:none;max-width:100%;padding-inline-start:0;z-index:2}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs{height:auto;margin-block-start:0;margin:0;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs::-webkit-scrollbar{display:none}.treb-main.treb-main .treb-spreadsheet-footer[hidden]{display:none}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li{display:inline-block;margin:0;position:relative}.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab,.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab,.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li{align-items:center;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top-width:1px;border:1px solid var(--treb-tab-bar-tab-border-color,var(--treb-ui-border-color,#ccc));border-top:0 solid var(--treb-tab-bar-tab-border-color,var(--treb-ui-border-color,#ccc));color:var(--treb-tab-bar-tab-color,var(--treb-ui-color,#fff));cursor:default;display:inline-flex;font-size:inherit;height:100%;justify-content:center;margin-right:-2px;overflow:hidden;padding:0 .75em;z-index:1}.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab:active,.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab:focus,.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab:active,.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab:focus,.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li:active,.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li:focus{z-index:3}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li{height:2.2em;overflow:visible;overflow-x:visible}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li:last-of-type{margin-right:0}.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab{margin-left:-1px}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li{white-space:nowrap}.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li[selected]{z-index:2}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control{align-items:center;display:flex;flex-direction:row;font-size:inherit;height:2.2em;justify-content:center;position:relative;width:5em}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-scale-input{background:transparent;border:1px solid transparent;border-radius:2px;color:inherit;font-family:inherit;font-size:inherit;padding:initial;text-align:center;transition:border-color .25s ease,background-color .25s ease;width:4em}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-slider-container{accent-color:var(--treb-scale-slider-accent-color,undefined);align-items:center;background:var(--treb-scale-slider-background,#fff);border:1px solid var(--treb-scale-slider-border-color,var(--treb-ui-border-color,#ccc));display:flex;flex-direction:row;height:4em;justify-content:center;left:.5em;opacity:0;pointer-events:none;position:absolute;top:0;transform:rotate(-90deg);transform-origin:left top;transition:opacity .25s ease;width:10em;z-index:40}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-scale-input:focus,.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control:hover .treb-scale-input{border-color:var(--treb-ui-border-color,#ccc)}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-slider-container>input[type=range]{width:8.5em}.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-scale-input:focus+.treb-slider-container,.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control .treb-slider-container:focus-within,.treb-main.treb-main .treb-spreadsheet-footer .treb-scale-control:hover .treb-slider-container{opacity:.85;pointer-events:auto}.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab{align-items:center;background:transparent;border:none;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top:0;color:currentColor;cursor:default;display:inline-flex;flex-direction:row;font-size:inherit;margin-right:-2px;min-width:2.5em;padding:.25em .75em;z-index:1}.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab svg{height:1em;opacity:.75;pointer-events:none;transition:opacity .125s ease-in-out;width:1em}.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab:hover svg{opacity:.75}.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab path{stroke:currentColor;stroke-linecap:round;stroke-width:1.5px}.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab:active,.treb-main.treb-main .treb-spreadsheet-footer .treb-delete-tab:focus{z-index:3}.treb-main.treb-main .treb-spreadsheet-footer .treb-stats-panel{flex:1 1;overflow:hidden;text-align:end;text-overflow:ellipsis;white-space:nowrap}.treb-main.treb-main .treb-spreadsheet-footer .treb-stats-panel>*{margin-left:.5em}.treb-main.treb-main .treb-spreadsheet-footer .treb-stats-panel .treb-stats-value{background:var(--treb-stats-value-background,#f8f8ff);border:1px solid var(--treb-stats-value-border-color,var(--treb-ui-border-color,#ddd));border-radius:3px;padding:0 .3em}.treb-main.treb-main .treb-grid .treb-overlay-container{margin:0;opacity:0;outline:none;padding:0;position:absolute;z-index:24}.treb-main.treb-main .treb-grid .treb-overlay-container.align-right .treb-overlay-inset{padding-right:3px;right:0;text-align:right}.treb-main.treb-main .treb-grid .treb-overlay-container.align-center .treb-overlay-inset{left:50%;text-align:center;transform:translateX(-50%)}.treb-main.treb-main .treb-grid .treb-overlay-inset{display:flex;flex-direction:column;height:100%;justify-content:flex-end;margin:0;min-width:100%;padding:0 4px;position:absolute}.treb-main.treb-main .treb-grid .treb-overlay-editor{outline:none;position:relative;white-space:nowrap;white-space:pre}.treb-main.treb-main .treb-grid .treb-overlay-editor.firefox:before{content:"\u200B"}.treb-main.treb-main .treb-spill-border{pointer-events:none;position:absolute;transform:translateZ(0)}.treb-main.treb-main .treb-spill-border rect{fill:none;filter:var(--treb-spill-border-filter,drop-shadow(3px 3px 2px rgba(0,0,0,.5)));stroke:var(--treb-spill-border-color,#5c5ce0);stroke-dasharray:var(--treb-spill-border-dasharray,0);stroke-width:var(--treb-spill-border-width,1px);z-index:35}.treb-main.treb-main .treb-buffer-canvas{display:none;position:absolute}.treb-main.treb-main .treb-spreadsheet-body{grid-area:2/1/3/2;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:transparent;display:flex;overflow:hidden;position:relative;z-index:1}.treb-main.treb-main .treb-grid{flex-grow:1;order:2;overflow:scroll;position:relative;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:transparent;display:grid;grid-template-columns:100px auto;grid-template-rows:20px auto;outline:none;overscroll-behavior:none}.treb-main.treb-main .treb-grid .tile-cover.grid-cover{grid-area:2/2/3/3}.treb-main.treb-main .treb-grid .tile-cover.column-header-cover{grid-area:1/2/2/3;position:-webkit-sticky;position:sticky;top:0}.treb-main.treb-main .treb-grid .tile-cover.row-header-cover{grid-area:2/1/3/2;left:0;position:-webkit-sticky;position:sticky}.treb-main.treb-main .treb-grid .treb-grid-selection{grid-area:1/1/2/2}.treb-main.treb-main .treb-grid .treb-corner{grid-area:1/1/2/2;position:-webkit-sticky;position:sticky}.treb-main.treb-main .treb-grid .treb-left-header{display:grid;grid-area:2/1/3/2;grid-template-columns:auto;grid-template-rows:auto;position:-webkit-sticky;position:sticky}.treb-main.treb-main .treb-grid .treb-top-header{display:grid;grid-area:1/2/2/3;grid-template-columns:auto;grid-template-rows:auto;position:-webkit-sticky;position:sticky}.treb-main.treb-main .treb-grid .treb-contents{display:grid;grid-area:2/2/3/3;grid-template-columns:auto;grid-template-rows:auto}.treb-main.treb-main .treb-grid.safari::-webkit-scrollbar{-webkit-appearance:none;height:7px;width:7px}.treb-main.treb-main .treb-grid.safari::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.25);border-radius:4px;-webkit-box-shadow:0 0 1px hsla(0,0%,100%,.5)}.treb-main.treb-main .treb-grid canvas{background:transparent;border:0;margin:0;padding:0}.treb-main.treb-main .treb-grid .nub-select{cursor:crosshair}.treb-main.treb-main .treb-grid .link-pointer{cursor:pointer}.treb-main.treb-main .treb-grid .mock-selection-node{background:red;left:-100px;position:fixed;top:-100px}.treb-main.treb-main .treb-grid .tile-cover{background:transparent;position:relative;z-index:14}.treb-main.treb-main .treb-grid .tile-cover.column-header-cover{z-index:22}.treb-main.treb-main .treb-grid .tile-cover.column-header-cover.resize{cursor:col-resize}.treb-main.treb-main .treb-grid .tile-cover.row-header-cover{z-index:22}.treb-main.treb-main .treb-grid .tile-cover.row-header-cover.resize{cursor:row-resize}.treb-main.treb-main .treb-grid .frozen-annotation-container,.treb-main.treb-main .treb-grid .treb-annotation-container{left:0;pointer-events:none;position:absolute;top:0;z-index:16}.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation{background:hsla(0,0%,100%,.5);border:1px solid #999;overflow:hidden;pointer-events:auto;position:absolute;z-index:1}.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation .annotation-content,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation .annotation-content{font-family:inherit;font-size:inherit;height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation .annotation-move-target,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation .annotation-move-target{cursor:move;height:10%;left:0;min-height:14px;position:absolute;top:0;width:100%;z-index:2}.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation .annotation-resize-target,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation .annotation-resize-target{bottom:0;cursor:nwse-resize;height:10%;min-height:14px;min-width:14px;position:absolute;right:0;width:10%;z-index:3}.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation.clone-focus,.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation.retain-focus,.treb-main.treb-main .treb-grid .frozen-annotation-container .annotation:focus,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation.clone-focus,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation.retain-focus,.treb-main.treb-main .treb-grid .treb-annotation-container .annotation:focus{box-shadow:0 0 0 3px rgba(14,165,233,.33)}.treb-main.treb-main .treb-grid .frozen-annotation-container .move-buffer,.treb-main.treb-main .treb-grid .treb-annotation-container .move-buffer{border:1px solid red;cursor:move;height:10%;left:0;position:absolute;top:0;width:100%}.treb-main.treb-main .treb-grid .treb-grid-selection{background:transparent;position:absolute;transform:translateZ(0);-moz-transform:scale(1);z-index:10}.treb-main.treb-main .treb-grid .frozen-selection{overflow:hidden;pointer-events:none;position:absolute;transform:translateZ(0);-moz-transform:scale(1);transition:background .33s;z-index:12}.treb-main.treb-main .treb-grid .frozen-selection.frozen-selection-rows{border-bottom:1px solid transparent}.treb-main.treb-main .treb-grid .frozen-selection.frozen-selection-columns{border-right:1px solid transparent}.treb-main.treb-main .treb-grid .frozen-annotation-container{height:100%;left:0;overflow:hidden;position:absolute;top:0;width:100%}.treb-main.treb-main .treb-grid .treb-corner{left:0;top:0;z-index:20}.treb-main.treb-main .treb-grid .treb-corner canvas{left:0;pointer-events:none;position:absolute;top:0}.treb-main.treb-main .treb-grid .treb-left-header{left:0;pointer-events:none;z-index:18}.treb-main.treb-main .treb-grid .treb-top-header{pointer-events:none;top:0;z-index:18}.treb-main.treb-main .treb-grid .treb-contents{height:2000px;width:2000px}.treb-main.treb-main{--alternate-selection-color-1:#fbb13c;--alternate-selection-color-2:#40c040;--alternate-selection-color-3:#b66d0d;--alternate-selection-color-4:#2176ae;--alternate-selection-color-5:#fe6847;--text-reference-color-1:#e08a00;--text-reference-color-2:#3aad3a;--text-reference-color-3:#b66d0d;--text-reference-color-4:#2176ae;--text-reference-color-5:#fe2f01}.treb-main.treb-main:focus-within .treb-grid-selection .primary-selection,.treb-main.treb-main:focus-within .treb-header-overlay{color:var(--treb-selection-color,#4caaf1)}.treb-main.treb-main .theme-color-1{color:var(--treb-theme-color-1,#e7e6e6)}.treb-main.treb-main .theme-color-2{color:var(--treb-theme-color-2,#44546a)}.treb-main.treb-main .theme-color-3{color:var(--treb-theme-color-3,#4472c4)}.treb-main.treb-main .theme-color-4{color:var(--treb-theme-color-4,#ed7d31)}.treb-main.treb-main .theme-color-5{color:var(--treb-theme-color-5,#a5a5a5)}.treb-main.treb-main .theme-color-6{color:var(--treb-theme-color-6,#ffc000)}.treb-main.treb-main .theme-color-7{color:var(--treb-theme-color-7,#5b9bd5)}.treb-main.treb-main .theme-color-8{color:var(--treb-theme-color-8,#70ad47)}.treb-main.treb-main .theme-color-9{color:var(--treb-theme-color-9,#0563c1)}.treb-main.treb-main .theme-color-10{color:var(--treb-theme-color-10,#954f72)}.treb-main.treb-main .treb-offset-dark{color:#000}.treb-main.treb-main .treb-offset-light{color:#fff}.treb-main.treb-main .note-marker{background:var(--treb-note-marker-color,#6fab20)}.treb-main.treb-main .grid-headers{background:var(--treb-grid-header-background,#eeeef2);color:var(--treb-grid-header-color,var(--treb-grid-default-color,#666));font-family:var(--treb-grid-header-font-family,inherit);font-size:var(--treb-grid-header-font-size,10pt);font-style:var(--treb-grid-header-font-style,normal);font-weight:var(--treb-grid-header-font-weight,normal);stroke:var(--treb-grid-header-grid-color,var(--treb-grid-grid-color,#ccccd4))}.treb-main.treb-main .grid-cells{background:var(--treb-grid-background,#fff);color:var(--treb-grid-default-color,inherit);font-family:var(--treb-grid-font-family,inherit);font-size:var(--treb-grid-font-size,14px);stroke:var(--treb-grid-grid-color,#ccccd4)}.treb-main.treb-main .frozen-selection.highlight-area{background:rgba(87,184,255,.25);border-bottom-color:#2176ae;border-left-color:#2176ae}.treb-main.treb-main .treb-autocomplete-tooltip{background:var(--treb-autocomplete-tooltip-background,#fffbb5);border:1px solid var(--treb-autocomplete-tooltip-border-color,unset);border-radius:2px;color:var(--treb-autocomplete-tooltip-color,inherit);font-size:14px;line-height:normal;margin:4px 0;padding:3px 8px}.treb-main.treb-main .treb-autocomplete-tooltip .active-argument{font-weight:700}.treb-main.treb-main .treb-autocomplete-tooltip .function-description{font-style:italic}.treb-main.treb-main .treb-autocomplete{background:var(--treb-autocomplete-background,#fff);border:1px solid var(--treb-autocomplete-border-color,var(--treb-ui-border-color,#ccc));border-radius:2px;box-shadow:0 1px 4px 2px hsla(0,0%,43%,.2);font-size:14px}.treb-main.treb-main .treb-autocomplete li{color:var(--treb-autocomplete-entry-color,#333)}.treb-main.treb-main .treb-autocomplete li a.selected{background:var(--treb-autocomplete-selected-entry-background,#2e8dd6);color:var(--treb-autocomplete-selected-entry-color,#fff)}.treb-main.treb-main .treb-header-overlay{color:var(--treb-selection-color-unfocused,var(--treb-selection-color,#4caaf1));stroke:none}.treb-main.treb-main .treb-header-overlay .treb-overlay{fill:#000;opacity:.05;stroke:none}.treb-main.treb-main .treb-header-overlay .treb-highlight{fill:currentColor}.treb-main.treb-main .treb-editor-container>div [data-highlight-index="1"],.treb-main.treb-main .treb-overlay-editor [data-highlight-index="1"]{color:var(--text-reference-color-1)}.treb-main.treb-main .treb-editor-container>div [data-highlight-index="2"],.treb-main.treb-main .treb-overlay-editor [data-highlight-index="2"]{color:var(--text-reference-color-2)}.treb-main.treb-main .treb-editor-container>div [data-highlight-index="3"],.treb-main.treb-main .treb-overlay-editor [data-highlight-index="3"]{color:var(--text-reference-color-3)}.treb-main.treb-main .treb-editor-container>div [data-highlight-index="4"],.treb-main.treb-main .treb-overlay-editor [data-highlight-index="4"]{color:var(--text-reference-color-4)}.treb-main.treb-main .treb-editor-container>div [data-highlight-index="5"],.treb-main.treb-main .treb-overlay-editor [data-highlight-index="5"]{color:var(--text-reference-color-5)}.treb-main.treb-main .treb-editor-container>div span.highlight-1,.treb-main.treb-main .treb-overlay-editor span.highlight-1{color:var(--text-reference-color-1)}.treb-main.treb-main .treb-editor-container>div span.highlight-2,.treb-main.treb-main .treb-overlay-editor span.highlight-2{color:var(--text-reference-color-2)}.treb-main.treb-main .treb-editor-container>div span.highlight-3,.treb-main.treb-main .treb-overlay-editor span.highlight-3{color:var(--text-reference-color-3)}.treb-main.treb-main .treb-editor-container>div span.highlight-4,.treb-main.treb-main .treb-overlay-editor span.highlight-4{color:var(--text-reference-color-4)}.treb-main.treb-main .treb-editor-container>div span.highlight-5,.treb-main.treb-main .treb-overlay-editor span.highlight-5{color:var(--text-reference-color-5)}.treb-main.treb-main .frozen-selection .selection,.treb-main.treb-main .treb-grid-selection .selection{stroke-width:var(--treb-selection-stroke-width,2px)}.treb-main.treb-main .frozen-selection .selection .treb-selection-outline,.treb-main.treb-main .treb-grid-selection .selection .treb-selection-outline{fill:none;stroke:currentColor}.treb-main.treb-main .frozen-selection .selection .treb-selection-fill,.treb-main.treb-main .treb-grid-selection .selection .treb-selection-fill{fill:currentColor;opacity:var(--treb-selection-fill-opacity,.1);stroke:none}.treb-main.treb-main .frozen-selection .alternate-selection,.treb-main.treb-main .treb-grid-selection .alternate-selection{stroke-dasharray:var(--treb-alternate-selection-dasharray,3 2)}.treb-main.treb-main .frozen-selection .alternate-selection:nth-of-type(1n),.treb-main.treb-main .treb-grid-selection .alternate-selection:nth-of-type(1n){color:var(--alternate-selection-color-1)}.treb-main.treb-main .frozen-selection .alternate-selection:nth-of-type(2n),.treb-main.treb-main .treb-grid-selection .alternate-selection:nth-of-type(2n){color:var(--alternate-selection-color-2)}.treb-main.treb-main .frozen-selection .alternate-selection:nth-of-type(3n),.treb-main.treb-main .treb-grid-selection .alternate-selection:nth-of-type(3n){color:var(--alternate-selection-color-3)}.treb-main.treb-main .frozen-selection .alternate-selection:nth-of-type(4n),.treb-main.treb-main .treb-grid-selection .alternate-selection:nth-of-type(4n){color:var(--alternate-selection-color-4)}.treb-main.treb-main .frozen-selection .alternate-selection:nth-of-type(5n),.treb-main.treb-main .treb-grid-selection .alternate-selection:nth-of-type(5n){color:var(--alternate-selection-color-5)}.treb-main.treb-main .frozen-selection .primary-selection,.treb-main.treb-main .treb-grid-selection .primary-selection{color:var(--treb-selection-color-unfocused,var(--treb-selection-color,#4caaf1))}.treb-main.treb-main .frozen-selection .primary-selection .treb-selection-nub,.treb-main.treb-main .treb-grid-selection .primary-selection .treb-selection-nub{fill:currentColor;stroke:#fff;stroke-width:1px}.treb-main.treb-main .treb-tooltip{background:var(--treb-resize-tooltip-background,rgba(0,0,0,.8));border-color:var(--treb-resize-tooltip-background,rgba(0,0,0,.8));color:var(--treb-resize-tooltip-color,#fff);font-size:11pt}.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab,.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li{background:var(--treb-tab-bar-tab-background,#eeeef2);color:var(--treb-tab-bar-tab-color,var(--treb-ui-color,inherit))}.treb-main.treb-main .treb-spreadsheet-footer .treb-add-tab[selected],.treb-main.treb-main .treb-spreadsheet-footer .treb-spreadsheet-tabs>li[selected]{background:var(--treb-tab-bar-active-tab-background,#fff);border-bottom-color:var(--treb-tab-bar-active-tab-border-color,currentColor);color:var(--treb-tab-bar-active-tab-color,var(--treb-ui-color,inherit))}.treb-main.treb-main .treb-formula-bar .treb-address-label,.treb-main.treb-main .treb-formula-bar .treb-editor-container{background:var(--treb-formula-bar-background,transparent);color:var(--treb-formula-bar-color,var(--treb-ui-color,inherit))}.treb-main.treb-main .treb-formula-bar .treb-address-label[locked],.treb-main.treb-main .treb-formula-bar .treb-editor-container[locked]{background:var(--treb-formula-bar-locked-background,#eef4fc);position:relative}.treb-main.treb-main .treb-formula-bar .treb-address-label[locked]:after,.treb-main.treb-main .treb-formula-bar .treb-editor-container[locked]:after{content:"";height:12px;opacity:.4;position:absolute;right:2px;top:2px;width:12px;--icon:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M416 224h-16v-80C400 65 335 0 256 0S112 65 112 144v80H96c-35 0-64 29-64 64v160c0 35 29 64 64 64h320c35 0 64-29 64-64V288c0-35-29-64-64-64m-240-80c0-44 36-80 80-80s80 36 80 80v80H176z'/%3E%3C/svg%3E");background:var(--treb-formula-bar-lock-icon-color,currentColor);mask-image:var(--icon);-webkit-mask-image:var(--icon);mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-size:12px 12px;-webkit-mask-size:12px 12px}.treb-main.treb-main .treb-annotation-textbox{background:Canvas;height:100%;left:0;overflow:hidden;padding:.5em;position:relative;top:0;width:100%}.treb-main.treb-main .treb-annotation-textbox p{margin-block-end:0;margin-block-start:0}.treb-dark-theme{--treb-autocomplete-background:#333;--treb-autocomplete-border-color:#fff;--treb-autocomplete-entry-color:#fff;--treb-autocomplete-selected-entry-background:darkred;--treb-autocomplete-tooltip-background:darkred;--treb-autocomplete-tooltip-border-color:#fff;--treb-autocomplete-tooltip-color:#fff;--treb-chart-background:#000;--treb-chart-grid-color:#976;--treb-chart-grid-zero-color:#fdd;--treb-chart-text-color:#fff;--treb-dialog-background:#000;--treb-dialog-color:#fff;--treb-dropdown-background:#000;--treb-dropdown-border-color:#fff;--treb-dropdown-caret-active-background:darkred;--treb-dropdown-caret-background:#444;--treb-dropdown-caret-border-color:#fff;--treb-dropdown-caret-color:#fff;--treb-dropdown-color:#fff;--treb-dropdown-selected-background:darkred;--treb-grid-background:#000;--treb-grid-default-color:#fff;--treb-grid-grid-color:#444;--treb-grid-header-background:#444;--treb-grid-header-grid-color:#000;--treb-note-background:#333;--treb-note-border-color:#aaa;--treb-note-color:#fff;--treb-note-marker-color:pink;--treb-resize-tooltip-background:#fff;--treb-resize-tooltip-color:#000;--treb-scale-slider-accent-color:#fff;--treb-scale-slider-background:#333;--treb-scale-slider-border-color:#aaa;--treb-selection-color:#ff0;--treb-selection-fill-opacity:.2;--treb-sidebar-button-background:#000;--treb-sidebar-button-border-color:#888;--treb-stats-value-background:#223;--treb-tab-bar-tab-background:#000;--treb-tab-bar-tab-color:#fff;--treb-theme-color-1:#222;--treb-theme-color-2:#ddd;--treb-toolbar-active-button-background:#555;--treb-toolbar-button-background:#000;--treb-toolbar-hover-button-background:#444;--treb-ui-color:#fff;--treb-table-header-background:#334;--treb-table-odd-background:#122;--treb-table-header-font-weight:700;--treb-table-header-border-top:#889;--treb-table-header-border-bottom:#889;--treb-table-footer-border-bottom:#889;--treb-table-odd-border-top:#889;--treb-table-odd-border-bottom:#889;--treb-table-even-border-top:#889;--treb-table-even-border-bottom:#889;--treb-table-total-border-top:#889;--treb-table-total-border-bottom:#889;--treb-table-total-background:#334;--treb-table-total-font-weight:700;--treb-color-scheme:dark;--treb-resize-handle-color:#add8e6;--treb-resize-frame-color:#add8e6;--treb-formula-bar-locked-background:#234;--treb-grid-background:#1e1e1e;--treb-grid-header-background:#565656;--treb-grid-header-color:#ddd;--treb-tab-bar-active-tab-background:#444;--treb-tab-bar-tab-background:transparent;--treb-tab-bar-tab-border-color:#444;--treb-ui-border-color:#aaa;--treb-toolbar-button-background:#565656;--treb-toolbar-button-background:#212121;--treb-toolbar-border-color:#434343;--treb-toolbar-color:#ddd;--treb-spill-border-color:pink;--treb-spill-border-filter:drop-shadow(3px 3px 2px hsla(0,0%,100%,.95))}@media (prefers-color-scheme:dark){.treb-light-dark-theme{--treb-autocomplete-background:#333;--treb-autocomplete-border-color:#fff;--treb-autocomplete-entry-color:#fff;--treb-autocomplete-selected-entry-background:darkred;--treb-autocomplete-tooltip-background:darkred;--treb-autocomplete-tooltip-border-color:#fff;--treb-autocomplete-tooltip-color:#fff;--treb-chart-background:#000;--treb-chart-grid-color:#976;--treb-chart-grid-zero-color:#fdd;--treb-chart-text-color:#fff;--treb-dialog-background:#000;--treb-dialog-color:#fff;--treb-dropdown-background:#000;--treb-dropdown-border-color:#fff;--treb-dropdown-caret-active-background:darkred;--treb-dropdown-caret-background:#444;--treb-dropdown-caret-border-color:#fff;--treb-dropdown-caret-color:#fff;--treb-dropdown-color:#fff;--treb-dropdown-selected-background:darkred;--treb-grid-background:#000;--treb-grid-default-color:#fff;--treb-grid-grid-color:#444;--treb-grid-header-background:#444;--treb-grid-header-grid-color:#000;--treb-note-background:#333;--treb-note-border-color:#aaa;--treb-note-color:#fff;--treb-note-marker-color:pink;--treb-resize-tooltip-background:#fff;--treb-resize-tooltip-color:#000;--treb-scale-slider-accent-color:#fff;--treb-scale-slider-background:#333;--treb-scale-slider-border-color:#aaa;--treb-selection-color:#ff0;--treb-selection-fill-opacity:.2;--treb-sidebar-button-background:#000;--treb-sidebar-button-border-color:#888;--treb-stats-value-background:#223;--treb-tab-bar-tab-background:#000;--treb-tab-bar-tab-color:#fff;--treb-theme-color-1:#222;--treb-theme-color-2:#ddd;--treb-toolbar-active-button-background:#555;--treb-toolbar-button-background:#000;--treb-toolbar-hover-button-background:#444;--treb-ui-color:#fff;--treb-table-header-background:#334;--treb-table-odd-background:#122;--treb-table-header-font-weight:700;--treb-table-header-border-top:#889;--treb-table-header-border-bottom:#889;--treb-table-footer-border-bottom:#889;--treb-table-odd-border-top:#889;--treb-table-odd-border-bottom:#889;--treb-table-even-border-top:#889;--treb-table-even-border-bottom:#889;--treb-table-total-border-top:#889;--treb-table-total-border-bottom:#889;--treb-table-total-background:#334;--treb-table-total-font-weight:700;--treb-color-scheme:dark;--treb-resize-handle-color:#add8e6;--treb-resize-frame-color:#add8e6;--treb-formula-bar-locked-background:#234;--treb-grid-background:#1e1e1e;--treb-grid-header-background:#565656;--treb-grid-header-color:#ddd;--treb-tab-bar-active-tab-background:#444;--treb-tab-bar-tab-background:transparent;--treb-tab-bar-tab-border-color:#444;--treb-ui-border-color:#aaa;--treb-toolbar-button-background:#565656;--treb-toolbar-button-background:#212121;--treb-toolbar-border-color:#434343;--treb-toolbar-color:#ddd;--treb-spill-border-color:pink;--treb-spill-border-filter:drop-shadow(3px 3px 2px hsla(0,0%,100%,.95))}}.treb-chart,.treb-main.treb-main .treb-chart{background:var(--treb-chart-background,#fff)}.treb-main.treb-main .treb-inherit-font .treb-chart{font-family:inherit}.treb-chart{--segment-2-offset:-20;--segment-3-offset:10;--segment-4-offset:-10;--segment-5-offset:20;--segment-6-offset:-25}.treb-chart .series-1{color:var(--treb-applied-theme-color-1)}.treb-chart .series-2{color:var(--treb-applied-theme-color-2)}.treb-chart .series-3{color:var(--treb-applied-theme-color-3)}.treb-chart .series-4{color:var(--treb-applied-theme-color-4)}.treb-chart .series-5{color:var(--treb-applied-theme-color-5)}.treb-chart .series-6{color:var(--treb-applied-theme-color-6)}.treb-chart .series-7{color:lch(from var(--treb-applied-theme-color-1) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-8{color:lch(from var(--treb-applied-theme-color-2) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-9{color:lch(from var(--treb-applied-theme-color-3) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-10{color:lch(from var(--treb-applied-theme-color-4) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-11{color:lch(from var(--treb-applied-theme-color-5) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-12{color:lch(from var(--treb-applied-theme-color-6) calc(l + var(--segment-2-offset)) c h)}.treb-chart .series-13{color:lch(from var(--treb-applied-theme-color-1) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-14{color:lch(from var(--treb-applied-theme-color-2) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-15{color:lch(from var(--treb-applied-theme-color-3) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-16{color:lch(from var(--treb-applied-theme-color-4) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-17{color:lch(from var(--treb-applied-theme-color-5) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-18{color:lch(from var(--treb-applied-theme-color-6) calc(l + var(--segment-3-offset)) c h)}.treb-chart .series-19{color:lch(from var(--treb-applied-theme-color-1) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-20{color:lch(from var(--treb-applied-theme-color-2) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-21{color:lch(from var(--treb-applied-theme-color-3) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-22{color:lch(from var(--treb-applied-theme-color-4) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-23{color:lch(from var(--treb-applied-theme-color-5) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-24{color:lch(from var(--treb-applied-theme-color-6) calc(l + var(--segment-4-offset)) c h)}.treb-chart .series-25{color:lch(from var(--treb-applied-theme-color-1) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-26{color:lch(from var(--treb-applied-theme-color-2) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-27{color:lch(from var(--treb-applied-theme-color-3) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-28{color:lch(from var(--treb-applied-theme-color-4) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-29{color:lch(from var(--treb-applied-theme-color-5) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-30{color:lch(from var(--treb-applied-theme-color-6) calc(l + var(--segment-5-offset)) c h)}.treb-chart .series-31{color:lch(from var(--treb-applied-theme-color-1) calc(l + var(--segment-6-offset)) c h)}.treb-chart .series-32{color:lch(from var(--treb-applied-theme-color-2) calc(l + var(--segment-6-offset)) c h)}.treb-chart .series-33{color:lch(from var(--treb-applied-theme-color-3) calc(l + var(--segment-6-offset)) c h)}.treb-chart .series-34{color:lch(from var(--treb-applied-theme-color-4) calc(l + var(--segment-6-offset)) c h)}.treb-chart .series-35{color:lch(from var(--treb-applied-theme-color-5) calc(l + var(--segment-6-offset)) c h)}.treb-chart .series-36{color:lch(from var(--treb-applied-theme-color-6) calc(l + var(--segment-6-offset)) c h)}.treb-chart .chart-title{font-size:1.4em}.treb-chart .axis-group{font-size:.9em}.treb-chart .axis-group .series-name{font-size:1.3em}.treb-chart text{fill:var(--treb-chart-text-color,#000);stroke:none}.treb-chart .legend{font-size:1.05em}.treb-chart .legend rect{fill:currentColor}.treb-chart .legend circle{fill:currentColor;fill-opacity:.5;r:.25em;stroke:currentColor;stroke-width:2px}.treb-chart .chart-grid,.treb-chart .chart-ticks{stroke:var(--treb-chart-grid-color,#ddd)}.treb-chart .chart-grid.zero,.treb-chart .chart-ticks.zero{stroke:var(--treb-chart-grid-zero-color,var(--treb-chart-grid-color,#999))}.treb-chart .label-target{fill:transparent;stroke:none}.treb-chart path.label-target{transition:fill .2s}.treb-chart path.label-target:hover{fill:rgba(0,0,0,.15)}.treb-chart .data-label{opacity:0;pointer-events:none;transition:opacity .2s ease-in-out}.treb-chart .data-label text{fill:#fff}.treb-chart .data-label path{fill:#000}.treb-chart .data-label .marker-highlight{fill:currentColor;stroke:none}.treb-chart .label-target:hover+.data-label{opacity:1}.treb-chart .chart-line{fill:none;stroke:currentColor;stroke-width:2}.treb-chart .chart-area .line{fill:none;stroke:currentColor;stroke-width:2px}.treb-chart .chart-area .fill{fill:currentColor;opacity:.5}.treb-chart .box-plot .iqr{fill:none;stroke:CanvasText;stroke-width:1px}.treb-chart .box-plot .median{fill:none;stroke:CanvasText;stroke-width:3px}.treb-chart .box-plot .outlier{r:3}.treb-chart .box-plot .outlier,.treb-chart .box-plot .whisker,.treb-chart .box-plot .whisker-extent{fill:none;stroke:CanvasText;stroke-width:1px}.treb-chart .box-plot .whisker-extent{stroke-dasharray:3 3}.treb-chart .bubble-chart{fill:color-mix(in srgb,currentColor 75%,transparent);stroke:currentColor;stroke-width:3}.treb-chart .bubble-label .label-background{fill:none;stroke:none}.treb-chart .bubble-label .label-text{transform:translate(var(--translate-offset),var(--translate-offset))}.treb-chart .scatter-plot{fill:none;stroke:currentColor;stroke-width:3}.treb-chart .scatter-plot .fill{fill:currentColor;opacity:.5;stroke:none}.treb-chart .scatter-plot .marker{fill:#fff;stroke-width:2.5px;transition:stroke-width .15s ease-in}.treb-chart .scatter-plot .marker:hover{stroke-width:5px}.treb-chart .donut path{fill:currentColor}.treb-chart .donut path.callout{fill:none;stroke:#999;stroke-dasharray:2 2}.treb-chart .donut text.callout-label{font-size:1em}.treb-chart .chart-column{fill:currentColor;stroke:none}.treb-chart .mc-correlation{stroke:currentColor;stroke-width:1}.treb-main.treb-main{--treb-icon-svg:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='153.073' height='133.742' viewBox='0.673 4.629 153.073 133.742'%3E%3ClinearGradient id='a' x1='.673' x2='153.746' y1='71.5' y2='71.5' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' style='stop-color:%235cb5ff'/%3E%3Cstop offset='1' style='stop-color:%230059b9'/%3E%3C/linearGradient%3E%3Cpath fill='url(%23a)' d='M91.656 28.313c-4.989 0-17.266 6.249-21.305 8.504-2.344-2.473-2.603-6.162-3.036-10.933-2.344 2.429-.824 9.806 0 12.496-10.238 7.635-18.83 15.531-27.597 24.471-2.992-4.729-5.031-8.593-5.726-17.183-3.038 6.509.867 15.057 3.121 19.784-9.674 12.193-19.263 25.297-27.03 37.834-35.488-74.973 72.853-119.534 143.663-88.855-43.867 29.199-55.192 121.353-132.248 96.843-5.423 7.809-9.069 18.006-13.538 27.072-3.73.263-6.334-1.646-7.288-3.12 7.506-18.181 17.183-34.192 27.075-49.984 10.718.306 21.346.478 30.198-1.04-7.681-2.038-16.877-.78-26.032-3.123C37.51 70.361 45.667 62.203 53.78 54.004c8.808.782 17.746 3.21 27.074 1.041-8.111-1.431-15.966-1.952-22.909-4.165 7.594-8.378 22.777-17.491 33.711-22.567'/%3E%3C/svg%3E")}.treb-main.treb-main .treb-icon-64{background:no-repeat 50%/100% var(--treb-icon-svg);height:64px;width:64px}.treb-main.treb-main .treb-dialog-mask{align-items:center;display:flex;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .2s;width:100%;z-index:1000}.treb-main.treb-main .treb-embed-dialog{align-items:center;background:var(--treb-dialog-background,#fff);border:1px solid var(--treb-dialog-border-color,var(--treb-ui-border-color,#999));border-radius:3px;border-top:3px solid #999;box-shadow:0 4px 6px -4px rgba(0,0,0,.3);color:var(--treb-dialog-color,#000);display:flex;flex-direction:row;font-size:var(--treb-dialog-font-size,16px);line-height:1.6em;padding:1rem;position:relative;text-align:left}.treb-main.treb-main .treb-embed-dialog>*{display:none}.treb-main.treb-main .treb-embed-dialog>div{position:relative}.treb-main.treb-main .treb-embed-dialog>:nth-child(2){display:block;flex-grow:1;padding:2px 20px 2px 12px}.treb-main.treb-main .treb-embed-dialog>.treb-close-box{background:transparent;border:0;padding:4px;position:absolute;right:0;top:0}.treb-main.treb-main .treb-embed-dialog>.treb-close-box>svg{cursor:default;fill:#73828c;height:20px;width:20px}.treb-main.treb-main .treb-embed-dialog>.treb-close-box>svg:active,.treb-main.treb-main .treb-embed-dialog>.treb-close-box>svg:hover{fill:#049cfb}.treb-main.treb-main .treb-embed-dialog small{display:block;font-size:.9em}.treb-main.treb-main .treb-embed-dialog a{color:inherit;text-decoration:none}.treb-main.treb-main .treb-embed-dialog a:active,.treb-main.treb-main .treb-embed-dialog a:hover{color:#049cfb}.treb-main.treb-main .treb-embed-dialog.dialog-type-success{border-top-color:#44d926;border-top-width:3px}.treb-main.treb-main .treb-embed-dialog.dialog-type-about{border-top-color:#009dff;border-top-width:3px}.treb-main.treb-main .treb-embed-dialog.dialog-type-error{border-top-color:#f92f06;border-top-width:3px}.treb-main.treb-main .treb-embed-dialog.dialog-type-info{border-top-color:#009dff;border-top-width:3px}.treb-main.treb-main .treb-embed-dialog .treb-embed-dialog-message,.treb-main.treb-main .treb-embed-dialog .treb-embed-dialog-title{white-space:pre}.treb-main.treb-main .treb-embed-dialog .treb-embed-progress-container{border:1px solid #ddd;height:6px;margin:1rem auto .5rem;position:relative;width:100%}.treb-main.treb-main .treb-embed-dialog .treb-embed-progress-bar{background:#52880b;height:100%;left:0;position:relative;top:0}.treb-main.treb-main .treb-spinner{align-items:center;background:transparent;display:flex;height:100%;justify-content:center;left:0;opacity:0;position:absolute;top:0;transition:visibility .25s,opacity .25s ease;visibility:collapse;width:100%;z-index:1000}.treb-main.treb-main .treb-spinner.visible{opacity:1;transition:visibility 0s,opacity 1s ease;visibility:visible}.treb-main.treb-main .treb-spinner>div{display:inline-block;height:80px;position:relative;width:80px}.treb-main.treb-main .treb-spinner>div div{animation:treb-spinner 1.2s cubic-bezier(.5,0,.5,1) infinite;border:8px solid #fff;border-color:var(--treb-spinner-color,currentColor) transparent transparent transparent;border-radius:50%;box-sizing:border-box;display:block;height:64px;margin:8px;position:absolute;width:64px}.treb-main.treb-main .treb-spinner>div div:first-child{animation-delay:-.45s}.treb-main.treb-main .treb-spinner>div div:nth-child(2){animation-delay:-.3s}.treb-main.treb-main .treb-spinner>div div:nth-child(3){animation-delay:-.15s}@keyframes treb-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.treb-main.treb-main{--icon-x:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/></svg>');--icon-popout:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path fill="currentColor" d="M22 14.5v5c0 2.484-2.016 4.5-4.5 4.5h-13A4.5 4.5 0 0 1 0 19.5v-13C0 4.016 2.016 2 4.5 2h11c.281 0 .5.219.5.5v1c0 .281-.219.5-.5.5h-11A2.507 2.507 0 0 0 2 6.5v13C2 20.875 3.125 22 4.5 22h13c1.375 0 2.5-1.125 2.5-2.5v-5c0-.281.219-.5.5-.5h1c.281 0 .5.219.5.5M28 1v8c0 .547-.453 1-1 1a1 1 0 0 1-.703-.297l-2.75-2.75L13.36 17.14c-.094.094-.234.156-.359.156s-.266-.063-.359-.156l-1.781-1.781c-.094-.094-.156-.234-.156-.359s.063-.266.156-.359L21.048 4.454l-2.75-2.75a1 1 0 0 1-.297-.703c0-.547.453-1 1-1h8c.547 0 1 .453 1 1z"/></svg>');--icon-toolbar:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 28"><path fill="currentColor" d="M5.5 22v2H0v-2zm5.5-2c.547 0 1 .453 1 1v4c0 .547-.453 1-1 1H7c-.547 0-1-.453-1-1v-4c0-.547.453-1 1-1zm2.5-6v2H0v-2zm-10-8v2H0V6zM24 22v2H12.5v-2zM9 4c.547 0 1 .453 1 1v4c0 .547-.453 1-1 1H5c-.547 0-1-.453-1-1V5c0-.547.453-1 1-1zm10 8c.547 0 1 .453 1 1v4c0 .547-.453 1-1 1h-4c-.547 0-1-.453-1-1v-4c0-.547.453-1 1-1zm5 2v2h-3.5v-2zm0-8v2H10.5V6z"/></svg>');--icon-export:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 28"><path fill="currentColor" d="M20 21c0-.547-.453-1-1-1s-1 .453-1 1 .453 1 1 1 1-.453 1-1m4 0c0-.547-.453-1-1-1s-1 .453-1 1 .453 1 1 1 1-.453 1-1m2-3.5v5a1.5 1.5 0 0 1-1.5 1.5h-23A1.5 1.5 0 0 1 0 22.5v-5A1.5 1.5 0 0 1 1.5 16h7.266l2.109 2.125c.578.562 1.328.875 2.125.875s1.547-.313 2.125-.875L17.25 16h7.25a1.5 1.5 0 0 1 1.5 1.5m-5.078-8.891a.98.98 0 0 1-.219 1.094l-7 7c-.187.203-.453.297-.703.297s-.516-.094-.703-.297l-7-7a.98.98 0 0 1-.219-1.094C5.234 8.25 5.594 8 6 8h4V1c0-.547.453-1 1-1h4c.547 0 1 .453 1 1v7h4c.406 0 .766.25.922.609"/></svg>');--icon-reset:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 28"><path fill="currentColor" d="M23.609 16.5c0 .031 0 .078-.016.109C22.265 22.14 17.702 26 11.937 26c-3.047 0-6-1.203-8.219-3.313l-2.016 2.016A1 1 0 0 1 .999 25c-.547 0-1-.453-1-1v-7c0-.547.453-1 1-1h7c.547 0 1 .453 1 1a1 1 0 0 1-.297.703l-2.141 2.141A7.99 7.99 0 0 0 11.998 22a7.98 7.98 0 0 0 6.813-3.813c.375-.609.562-1.203.828-1.828.078-.219.234-.359.469-.359h3c.281 0 .5.234.5.5zM24 4v7c0 .547-.453 1-1 1h-7c-.547 0-1-.453-1-1a1 1 0 0 1 .297-.703l2.156-2.156A8.04 8.04 0 0 0 12 6a7.98 7.98 0 0 0-6.813 3.813c-.375.609-.562 1.203-.828 1.828-.078.219-.234.359-.469.359H.781a.503.503 0 0 1-.5-.5v-.109C1.625 5.844 6.234 2 12 2c3.063 0 6.047 1.219 8.266 3.313l2.031-2.016A1 1 0 0 1 23 3c.547 0 1 .453 1 1"/></svg>');--icon-about:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 28"><path fill="currentColor" d="M14 21.5v-3c0-.281-.219-.5-.5-.5h-3c-.281 0-.5.219-.5.5v3c0 .281.219.5.5.5h3c.281 0 .5-.219.5-.5M18 11c0-2.859-3-5-5.688-5-2.547 0-4.453 1.094-5.797 3.328a.49.49 0 0 0 .125.656l2.063 1.563a.48.48 0 0 0 .297.094.5.5 0 0 0 .391-.187c.734-.938 1.047-1.219 1.344-1.437.266-.187.781-.375 1.344-.375 1 0 1.922.641 1.922 1.328 0 .812-.422 1.219-1.375 1.656-1.109.5-2.625 1.797-2.625 3.313v.562c0 .281.219.5.5.5h3c.281 0 .5-.219.5-.5 0-.359.453-1.125 1.188-1.547 1.188-.672 2.812-1.578 2.812-3.953zm6 3c0 6.625-5.375 12-12 12S0 20.625 0 14 5.375 2 12 2s12 5.375 12 12"/></svg>');--icon-chevron-left:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 28"><path fill="currentColor" d="M18.297 4.703 10 13l8.297 8.297a.99.99 0 0 1 0 1.406l-2.594 2.594a.99.99 0 0 1-1.406 0L2.703 13.703a.99.99 0 0 1 0-1.406L14.297.703a.99.99 0 0 1 1.406 0l2.594 2.594a.99.99 0 0 1 0 1.406"/></svg>');--icon-chevron-right:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19 28"><path fill="currentColor" d="M17.297 13.703 5.703 25.297a.99.99 0 0 1-1.406 0l-2.594-2.594a.99.99 0 0 1 0-1.406L10 13 1.703 4.703a.99.99 0 0 1 0-1.406L4.297.703a.99.99 0 0 1 1.406 0l11.594 11.594a.99.99 0 0 1 0 1.406"/></svg>');--icon-revert:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 28"><path fill="currentColor" d="M24 14c0 6.609-5.391 12-12 12a11.97 11.97 0 0 1-9.234-4.328.52.52 0 0 1 .031-.672l2.141-2.156a.6.6 0 0 1 .391-.141.5.5 0 0 1 .359.187A7.91 7.91 0 0 0 12 21.999c4.406 0 8-3.594 8-8s-3.594-8-8-8A7.95 7.95 0 0 0 6.563 8.14l2.141 2.156a.96.96 0 0 1 .219 1.078 1 1 0 0 1-.922.625h-7c-.547 0-1-.453-1-1v-7c0-.406.25-.766.625-.922a.96.96 0 0 1 1.078.219l2.031 2.016c2.203-2.078 5.187-3.313 8.266-3.313 6.609 0 12 5.391 12 12zM14 9.5v7c0 .281-.219.5-.5.5h-5a.494.494 0 0 1-.5-.5v-1c0-.281.219-.5.5-.5H12V9.5c0-.281.219-.5.5-.5h1c.281 0 .5.219.5.5"/></svg>');--icon-text-indent:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-text-indent-left" viewBox="0 0 16 16"><path d="M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5m.646 2.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L4.293 8 2.646 6.354a.5.5 0 0 1 0-.708M7 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5m0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5m-5 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/></svg>');--icon-text-outdent:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-text-indent-right" viewBox="0 0 16 16"><path d="M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5m10.646 2.146a.5.5 0 0 1 .708.708L11.707 8l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708zM2 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5m0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5m0 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/></svg>');--icon-text-align-left:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5m0-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/></svg>');--icon-text-align-center:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5m2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/></svg>');--icon-text-align-right:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5m4-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-4-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/></svg>');--icon-text-align-top:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 15a.5.5 0 0 0 .5-.5V5.707l3.146 3.146a.5.5 0 0 0 .707-.707l-4-4a.5.5 0 0 0-.706-.001l-.001.001-4 4a.5.5 0 0 0 .708.707L7.5 5.707V14.5a.5.5 0 0 0 .5.5'/%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10' d='M3 1.5h10'/%3E%3C/svg%3E");--icon-text-align-middle:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13A.5.5 0 0 1 1 8m7-8a.5.5 0 0 1 .5.5v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 1 1 .708-.708L7.5 4.293V.5A.5.5 0 0 1 8 0m-.5 11.707-1.146 1.147a.5.5 0 0 1-.708-.708l2-2a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 11.707V15.5a.5.5 0 0 1-1 0z"/></svg>');--icon-text-align-bottom:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a.5.5 0 0 0-.5.5v8.793L4.354 7.146a.5.5 0 0 0-.707.707l4 4a.5.5 0 0 0 .707.001l.001-.001 4-4a.5.5 0 0 0-.708-.707L8.5 10.293V1.5A.5.5 0 0 0 8 1'/%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10' d='M13 14.5H3'/%3E%3C/svg%3E");--icon-file-menu:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z"/></svg>');--icon-wrap-text:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4 5h8a.5.5 0 0 0 0-1H4a.5.5 0 0 0 0 1M10 8H4a.5.5 0 0 0 0 1h6a1.5 1.5 0 0 1 0 3v-1.203l-2.953 1.707L10 14.203V13a2.5 2.5 0 1 0 0-5M3.75 12.5a.5.5 0 0 0 .5.5H6v-1H4.25a.5.5 0 0 0-.5.5"/></svg>');--icon-unmerge-cells:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5M.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5m15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5"/></svg>');--icon-merge-cells:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5m5 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 10 4.5v-4a.5.5 0 0 1 .5-.5M0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5m10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0z"/></svg>');--icon-lock:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2m3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2M5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1"/></svg>');--icon-comment:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2.5a2 2 0 0 0-1.6.8L8 14.333 6.1 11.8a2 2 0 0 0-1.6-.8H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2.5a1 1 0 0 1 .8.4l1.9 2.533a1 1 0 0 0 1.6 0l1.9-2.533a1 1 0 0 1 .8-.4H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>');--icon-fill-color:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M6.192 2.78c-.458-.677-.927-1.248-1.35-1.643a3 3 0 0 0-.71-.515c-.217-.104-.56-.205-.882-.02-.367.213-.427.63-.43.896-.003.304.064.664.173 1.044.196.687.556 1.528 1.035 2.402L.752 8.22c-.277.277-.269.656-.218.918.055.283.187.593.36.903.348.627.92 1.361 1.626 2.068.707.707 1.441 1.278 2.068 1.626.31.173.62.305.903.36.262.05.64.059.918-.218l5.615-5.615c.118.257.092.512.05.939-.03.292-.068.665-.073 1.176v.123h.003a1 1 0 0 0 1.993 0H14v-.057a1 1 0 0 0-.004-.117c-.055-1.25-.7-2.738-1.86-3.494a4 4 0 0 0-.211-.434c-.349-.626-.92-1.36-1.627-2.067S8.857 3.052 8.23 2.704c-.31-.172-.62-.304-.903-.36-.262-.05-.64-.058-.918.219l-.217.216zM4.16 1.867c.381.356.844.922 1.311 1.632l-.704.705c-.382-.727-.66-1.402-.813-1.938a3.3 3.3 0 0 1-.131-.673q.137.09.337.274m.394 3.965c.54.852 1.107 1.567 1.607 2.033a.5.5 0 1 0 .682-.732c-.453-.422-1.017-1.136-1.564-2.027l1.088-1.088q.081.181.183.365c.349.627.92 1.361 1.627 2.068.706.707 1.44 1.278 2.068 1.626q.183.103.365.183l-4.861 4.862a1 1 0 0 1-.068-.01c-.137-.027-.342-.104-.608-.252-.524-.292-1.186-.8-1.846-1.46s-1.168-1.32-1.46-1.846c-.147-.265-.225-.47-.251-.607a1 1 0 0 1-.01-.068zm2.87-1.935a2.4 2.4 0 0 1-.241-.561c.135.033.324.11.562.241.524.292 1.186.8 1.846 1.46.45.45.83.901 1.118 1.31a3.5 3.5 0 0 0-1.066.091 11 11 0 0 1-.76-.694c-.66-.66-1.167-1.322-1.458-1.847z"/></svg>');--icon-text-color:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16" viewBox="0 0 16 16"><path d="m12.259 14.001-1.389-3.727H5.465l-1.354 3.727h-1.3L7.609 1.397h1.178l4.772 12.604zM8.418 3.604a6 6 0 0 1-.127-.387 4 4 0 0 1-.11-.501h-.035a5.5 5.5 0 0 1-.247.888L5.86 9.211h4.614z"/></svg>');--icon-border-bottom:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M.969 0H0v.969h.5V1h.469V.969H1V.5H.969zm.937 1h.938V0h-.938zm1.875 0h.938V0H3.78v1zm1.875 0h.938V0h-.938zM7.531.969V1h.938V.969H8.5V.5h-.031V0H7.53v.5H7.5v.469zM9.406 1h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.469V.969h.5V0h-.969v.5H15v.469h.031zM1 2.844v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM1 4.719V3.78H0v.938h1zm6.5-.938v.938h1V3.78h-1zm7.5 0v.938h1V3.78h-1zM1 6.594v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM.5 8.5h.469v-.031H1V7.53H.969V7.5H.5v.031H0v.938h.5zm1.406 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.469v-.031h.5V7.53h-.5V7.5h-.469v.031H15v.938h.031zM0 9.406v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zm-16 .937v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zm-16 .937v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zM0 15h16v1H0z"/></svg>');--icon-border-top:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 0v1h16V0zm1 2.844v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM1 4.719V3.78H0v.938h1zm6.5-.938v.938h1V3.78h-1zm7.5 0v.938h1V3.78h-1zM1 6.594v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM.5 8.5h.469v-.031H1V7.53H.969V7.5H.5v.031H0v.938h.5zm1.406 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.469v-.031h.5V7.53h-.5V7.5h-.469v.031H15v.938h.031zM0 9.406v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zm-16 .937v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zm-16 .937v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zM0 16h.969v-.5H1v-.469H.969V15H.5v.031H0zm1.906 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm1.875-.5v.5h.938v-.5H8.5v-.469h-.031V15H7.53v.031H7.5v.469zm1.875.5h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875-.5v.5H16v-.969h-.5V15h-.469v.031H15v.469z"/></svg>');--icon-border-left:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 0v16h1V0zm1.906 1h.938V0h-.938zm1.875 0h.938V0H3.78v1zm1.875 0h.938V0h-.938zM7.531.969V1h.938V.969H8.5V.5h-.031V0H7.53v.5H7.5v.469zM9.406 1h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.469V.969h.5V0h-.969v.5H15v.469h.031zM7.5 1.906v.938h1v-.938zm7.5 0v.938h1v-.938zM7.5 3.781v.938h1V3.78h-1zm7.5 0v.938h1V3.78h-1zM7.5 5.656v.938h1v-.938zm7.5 0v.938h1v-.938zM1.906 8.5h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.469v-.031h.5V7.53h-.5V7.5h-.469v.031H15v.938h.031zM7.5 9.406v.938h1v-.938zm8.5.938v-.938h-1v.938zm-8.5.937v.938h1v-.938zm8.5.938v-.938h-1v.938zm-8.5.937v.938h1v-.938zm8.5.938v-.938h-1v.938zM1.906 16h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm1.875-.5v.5h.938v-.5H8.5v-.469h-.031V15H7.53v.031H7.5v.469zm1.875.5h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875-.5v.5H16v-.969h-.5V15h-.469v.031H15v.469z"/></svg>');--icon-border-right:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M.969 0H0v.969h.5V1h.469V.969H1V.5H.969zm.937 1h.938V0h-.938zm1.875 0h.938V0H3.78v1zm1.875 0h.938V0h-.938zM7.531.969V1h.938V.969H8.5V.5h-.031V0H7.53v.5H7.5v.469zM9.406 1h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.938V0h-.938zM16 0h-1v16h1zM1 2.844v-.938H0v.938zm6.5-.938v.938h1v-.938zM1 4.719V3.78H0v.938h1zm6.5-.938v.938h1V3.78h-1zM1 6.594v-.938H0v.938zm6.5-.938v.938h1v-.938zM.5 8.5h.469v-.031H1V7.53H.969V7.5H.5v.031H0v.938h.5zm1.406 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zM0 9.406v.938h1v-.938zm7.5 0v.938h1v-.938zM0 11.281v.938h1v-.938zm7.5 0v.938h1v-.938zM0 13.156v.938h1v-.938zm7.5 0v.938h1v-.938zM0 16h.969v-.5H1v-.469H.969V15H.5v.031H0zm1.906 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm1.875-.5v.5h.938v-.5H8.5v-.469h-.031V15H7.53v.031H7.5v.469zm1.875.5h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938z"/></svg>');--icon-border-double-bottom:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M.969 0H0v.969h.5V1h.469V.969H1V.5H.969zm.937 1h.938V0h-.938zm1.875 0h.938V0H3.78v1zm1.875 0h.938V0h-.938zM7.531.969V1h.938V.969H8.5V.5h-.031V0H7.53v.5H7.5v.469zM9.406 1h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.938V0h-.938zm1.875 0h.469V.969h.5V0h-.969v.5H15v.469h.031zM1 2.844v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM1 4.719V3.78H0v.938zm6.5-.938v.938h1V3.78h-1zm7.5 0v.938h1V3.78h-1zM1 6.594v-.938H0v.938zm6.5-.938v.938h1v-.938zm7.5 0v.938h1v-.938zM.5 8.5h.469v-.031H1V7.53H.969V7.5H.5v.031H0v.938h.5zm1.406 0h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.469v-.031h.5V7.53h-.5V7.5h-.469v.031H15v.938h.031zM0 9.406v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zm-16 .937v.938h1v-.938zm7.5 0v.938h1v-.938zm8.5.938v-.938h-1v.938zM0 15h16v1H0zm0-2h16v1H0z"/></svg>');--icon-border-all:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 0h16v16H0zm1 1v6.5h6.5V1zm7.5 0v6.5H15V1zM15 8.5H8.5V15H15zM7.5 15V8.5H1V15z"/></svg>');--icon-border-outer:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M7.5 1.906v.938h1v-.938zm0 1.875v.938h1V3.78h-1zm0 1.875v.938h1v-.938zM1.906 8.5h.938v-1h-.938zm1.875 0h.938v-1H3.78v1zm1.875 0h.938v-1h-.938zm2.813 0v-.031H8.5V7.53h-.031V7.5H7.53v.031H7.5v.938h.031V8.5zm.937 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zm1.875 0h.938v-1h-.938zM7.5 9.406v.938h1v-.938zm0 1.875v.938h1v-.938zm0 1.875v.938h1v-.938z"/><path d="M0 0v16h16V0zm1 1h14v14H1z"/></svg>');--icon-border-none:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 0h.969v.5H1v.469H.969V1H.5V.969H0zm2.844 1h-.938V0h.938zm1.875 0H3.78V0h.938v1zm1.875 0h-.938V0h.938zm.937 0V.969H7.5V.5h.031V0h.938v.5H8.5v.469h-.031V1zm2.813 0h-.938V0h.938zm1.875 0h-.938V0h.938zm1.875 0h-.938V0h.938zM15.5 1h-.469V.969H15V.5h.031V0H16v.969h-.5zM1 1.906v.938H0v-.938zm6.5.938v-.938h1v.938zm7.5 0v-.938h1v.938zM1 3.78v.938H0V3.78zm6.5.938V3.78h1v.938zm7.5 0V3.78h1v.938zM1 5.656v.938H0v-.938zm6.5.938v-.938h1v.938zm7.5 0v-.938h1v.938zM.969 8.5H.5v-.031H0V7.53h.5V7.5h.469v.031H1v.938H.969zm1.875 0h-.938v-1h.938zm1.875 0H3.78v-1h.938v1zm1.875 0h-.938v-1h.938zm1.875-.031V8.5H7.53v-.031H7.5V7.53h.031V7.5h.938v.031H8.5v.938zm1.875.031h-.938v-1h.938zm1.875 0h-.938v-1h.938zm1.875 0h-.938v-1h.938zm1.406 0h-.469v-.031H15V7.53h.031V7.5h.469v.031h.5v.938h-.5zM0 10.344v-.938h1v.938zm7.5 0v-.938h1v.938zm8.5-.938v.938h-1v-.938zM0 12.22v-.938h1v.938zm7.5 0v-.938h1v.938zm8.5-.938v.938h-1v-.938zM0 14.094v-.938h1v.938zm7.5 0v-.938h1v.938zm8.5-.938v.938h-1v-.938zM.969 16H0v-.969h.5V15h.469v.031H1v.469H.969zm1.875 0h-.938v-1h.938zm1.875 0H3.78v-1h.938v1zm1.875 0h-.938v-1h.938zm.937 0v-.5H7.5v-.469h.031V15h.938v.031H8.5v.469h-.031v.5zm2.813 0h-.938v-1h.938zm1.875 0h-.938v-1h.938zm1.875 0h-.938v-1h.938zm.937 0v-.5H15v-.469h.031V15h.469v.031h.5V16z"/></svg>');--icon-palette:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 .5A.5.5 0 0 1 .5 0h5a.5.5 0 0 1 .5.5v5.277l4.147-4.131a.5.5 0 0 1 .707 0l3.535 3.536a.5.5 0 0 1 0 .708L10.261 10H15.5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5H3a3 3 0 0 1-2.121-.879A3 3 0 0 1 0 13.044m6-.21 7.328-7.3-2.829-2.828L6 7.188zM4.5 13a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M15 15v-4H9.258l-4.015 4zM0 .5v12.495zM0 12.995V13z"/></svg>');--icon-layout:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="m3 0 17 17.156v-.114z"/><path d="M3 0H0v16h1V1h1.585L19 17.455V19H4v1h16v-2.844z"/><path d="M6.886 3.922 5.343 5.465a.5.5 0 0 0 .708.707l1.539-1.54zM9.702 6.763l-1.53 1.53A.5.5 0 0 0 8.879 9l1.526-1.526zM12.517 9.604 11 11.121a.5.5 0 0 0 .707.707l1.514-1.514zM15.332 12.445l-1.504 1.504a.5.5 0 0 0 .707.707l1.501-1.5zM1 16H0a4 4 0 0 0 4 4v-1c-1.654 0-3-1.346-3-3M5 9v6h6zm1 2.414L8.586 14H6z"/></svg>');--icon-freeze:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 16a.5.5 0 0 1-.5-.5v-1.293l-.646.647a.5.5 0 0 1-.707-.708L7.5 12.793V8.866l-3.4 1.963-.496 1.85a.5.5 0 1 1-.966-.26l.237-.882-1.12.646a.5.5 0 0 1-.5-.866l1.12-.646-.884-.237a.5.5 0 1 1 .26-.966l1.848.495L7 8 3.6 6.037l-1.85.495a.5.5 0 0 1-.258-.966l.883-.237-1.12-.646a.5.5 0 1 1 .5-.866l1.12.646-.237-.883a.5.5 0 1 1 .966-.258l.495 1.849L7.5 7.134V3.207L6.147 1.854a.5.5 0 1 1 .707-.708l.646.647V.5a.5.5 0 1 1 1 0v1.293l.647-.647a.5.5 0 1 1 .707.708L8.5 3.207v3.927l3.4-1.963.496-1.85a.5.5 0 1 1 .966.26l-.236.882 1.12-.646a.5.5 0 0 1 .5.866l-1.12.646.883.237a.5.5 0 1 1-.26.966l-1.848-.495L9 8l3.4 1.963 1.849-.495a.5.5 0 0 1 .259.966l-.883.237 1.12.646a.5.5 0 0 1-.5.866l-1.12-.646.236.883a.5.5 0 1 1-.966.258l-.495-1.849-3.4-1.963v3.927l1.353 1.353a.5.5 0 0 1-.707.708l-.647-.647V15.5a.5.5 0 0 1-.5.5z"/></svg>');--icon-column-chart:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="M4.5 17.5a.5.5 0 0 1-1 0v-5a.5.5 0 0 1 1 0zM12.5 17.5a.5.5 0 0 1-1 0v-9a.5.5 0 0 1 1 0zM16.5 17.5a.5.5 0 0 1-1 0v-13a.5.5 0 0 1 1 0zM8.5 17.5a.5.5 0 0 1-1 0v-14a.5.5 0 0 1 1 0z"/></svg>');--icon-donut-chart:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="M12 1.23v1.548c2.526.701 4.5 2.699 5.203 5.222h1.565A9.01 9.01 0 0 0 12 1.23M2.5 10c0-3.51 2.426-6.456 5.688-7.27V1.183A9 9 0 0 0 1 10c0 1.761.513 3.397 1.387 4.784l1.093-1.093A7.43 7.43 0 0 1 2.5 10M17.221 12c-.878 3.166-3.778 5.5-7.221 5.5a7.45 7.45 0 0 1-3.692-.979l-1.093 1.093A8.96 8.96 0 0 0 10 19c4.282 0 7.859-2.993 8.77-7z"/></svg>');--icon-bar-chart:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="M2.5 4.5a.5.5 0 0 1 0-1h5a.5.5 0 0 1 0 1zM2.5 12.5a.5.5 0 0 1 0-1h9a.5.5 0 0 1 0 1zM2.5 16.5a.5.5 0 0 1 0-1h13a.5.5 0 0 1 0 1zM2.5 8.5a.5.5 0 0 1 0-1h14a.5.5 0 0 1 0 1z"/></svg>');--icon-line-chart:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="m1 8 3-3 7 5 8-8v2l-8 8-7-5-3 3z"/></svg>');--icon-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/><path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1z"/></svg>');--icon-recalculate:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="20" height="20" viewBox="0 0 20 20"><path d="M9.478 4.022c2.402-.209 4.583 1.047 5.711 3.014l1.083-.095c-1.233-2.528-3.912-4.175-6.881-3.916-2.97.26-5.321 2.347-6.098 5.051l1.083-.095c.768-2.132 2.698-3.748 5.102-3.959M10.523 15.977c-2.403.211-4.585-1.047-5.712-3.013l-1.08.095c1.234 2.527 3.91 4.175 6.879 3.914 2.971-.259 5.32-2.347 6.095-5.05l-1.08.095c-.769 2.132-2.699 3.749-5.102 3.959"/><path d="m2.272 15.616 5.197-3-4.098-1.097zM17.728 4.384l-5.197 3 4.098 1.098z"/></svg>');--icon-check:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0"/></svg>');--icon-table:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z"/></svg>')}.treb-main.treb-main .treb-layout-header{overflow:hidden;overflow-x:scroll;position:relative;-ms-overflow-style:none;scrollbar-width:none}.treb-main.treb-main .treb-layout-header::-webkit-scrollbar{display:none}.treb-main.treb-main .treb-toolbar{color:var(--treb-toolbar-color,var(--treb-ui-color,#333));display:flex;flex-direction:row;font-size:var(--treb-toolbar-font-size,inherit);gap:.5rem}.treb-main.treb-main .treb-toolbar>div{display:flex;flex-direction:row}.treb-main.treb-main .treb-toolbar>div>input,.treb-main.treb-main .treb-toolbar>input{background-color:var(--treb-toolbar-button-background,transparent);border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));height:32px;overflow:hidden;padding-left:.5em;padding-right:.5em;text-overflow:ellipsis}.treb-main.treb-main .treb-toolbar>.treb-menu>button{border-radius:3px}.treb-main.treb-main .treb-toolbar>.group>.treb-menu+button,.treb-main.treb-main .treb-toolbar>.group>button+.treb-menu>button,.treb-main.treb-main .treb-toolbar>.group>button+button,.treb-main.treb-main .treb-toolbar>.group>input+.treb-menu>button,.treb-main.treb-main .treb-toolbar>.group>input+button,.treb-main.treb-main .treb-toolbar>[composite]>.treb-menu+button,.treb-main.treb-main .treb-toolbar>[composite]>button+.treb-menu>button,.treb-main.treb-main .treb-toolbar>[composite]>button+button,.treb-main.treb-main .treb-toolbar>[composite]>input+.treb-menu>button,.treb-main.treb-main .treb-toolbar>[composite]>input+button{border-left-width:0}.treb-main.treb-main .treb-toolbar>.group>button:first-child,.treb-main.treb-main .treb-toolbar>.group>input:first-child,.treb-main.treb-main .treb-toolbar>[composite]>button:first-child,.treb-main.treb-main .treb-toolbar>[composite]>input:first-child{border-bottom-left-radius:3px;border-top-left-radius:3px}.treb-main.treb-main .treb-toolbar>.group>.treb-menu:last-child>button,.treb-main.treb-main .treb-toolbar>.group>button:last-child,.treb-main.treb-main .treb-toolbar>[composite]>.treb-menu:last-child>button,.treb-main.treb-main .treb-toolbar>[composite]>button:last-child{border-bottom-right-radius:3px;border-top-right-radius:3px}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button,.treb-main.treb-main .treb-toolbar .treb-menu>button,.treb-main.treb-main .treb-toolbar button[data-icon],.treb-main.treb-main .treb-toolbar>button,.treb-main.treb-main .treb-toolbar>div>button{align-items:center;background-color:var(--treb-toolbar-button-background,transparent);border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));display:flex;flex-direction:column;height:32px;justify-content:center;position:relative;width:32px}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[dropdown],.treb-main.treb-main .treb-toolbar .treb-menu>button[dropdown],.treb-main.treb-main .treb-toolbar button[data-icon][dropdown],.treb-main.treb-main .treb-toolbar>button[dropdown],.treb-main.treb-main .treb-toolbar>div>button[dropdown]{width:16px}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[dropdown]:after,.treb-main.treb-main .treb-toolbar .treb-menu>button[dropdown]:after,.treb-main.treb-main .treb-toolbar button[data-icon][dropdown]:after,.treb-main.treb-main .treb-toolbar>button[dropdown]:after,.treb-main.treb-main .treb-toolbar>div>button[dropdown]:after{border:5px solid transparent;border-top-color:currentcolor;box-sizing:content-box;content:"";height:0;left:50%;position:absolute;top:18px;transform:translate(-50%,-50%);width:0}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button:hover,.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[active],.treb-main.treb-main .treb-toolbar .treb-menu>button:hover,.treb-main.treb-main .treb-toolbar .treb-menu>button[active],.treb-main.treb-main .treb-toolbar button[data-icon]:hover,.treb-main.treb-main .treb-toolbar button[data-icon][active],.treb-main.treb-main .treb-toolbar>button:hover,.treb-main.treb-main .treb-toolbar>button[active],.treb-main.treb-main .treb-toolbar>div>button:hover,.treb-main.treb-main .treb-toolbar>div>button[active]{background-color:var(--treb-toolbar-hover-button-background,#f3f4f6)}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[data-color-bar]:after,.treb-main.treb-main .treb-toolbar .treb-menu>button[data-color-bar]:after,.treb-main.treb-main .treb-toolbar button[data-icon][data-color-bar]:after,.treb-main.treb-main .treb-toolbar>button[data-color-bar]:after,.treb-main.treb-main .treb-toolbar>div>button[data-color-bar]:after{background:var(--treb-color-bar-color,var(--treb-default-color,unset));border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));box-sizing:border-box;content:"";display:block;height:6px;position:relative;width:20px}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[data-command]:before,.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[data-icon]:before,.treb-main.treb-main .treb-toolbar .treb-menu>button[data-command]:before,.treb-main.treb-main .treb-toolbar .treb-menu>button[data-icon]:before,.treb-main.treb-main .treb-toolbar button[data-icon][data-command]:before,.treb-main.treb-main .treb-toolbar button[data-icon][data-icon]:before,.treb-main.treb-main .treb-toolbar>button[data-command]:before,.treb-main.treb-main .treb-toolbar>button[data-icon]:before,.treb-main.treb-main .treb-toolbar>div>button[data-command]:before,.treb-main.treb-main .treb-toolbar>div>button[data-icon]:before{background:currentColor;content:"";display:block;height:20px;mask-image:var(--icon);-webkit-mask-image:var(--icon);mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-size:var(--icon-size,16px 16px);-webkit-mask-size:var(--icon-size,16px 16px);position:relative;width:20px}.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[data-command].treb-font-stack:before,.treb-main.treb-main .treb-toolbar .treb-icon-buttons>button[data-icon].treb-font-stack:before,.treb-main.treb-main .treb-toolbar .treb-menu>button[data-command].treb-font-stack:before,.treb-main.treb-main .treb-toolbar .treb-menu>button[data-icon].treb-font-stack:before,.treb-main.treb-main .treb-toolbar button[data-icon][data-command].treb-font-stack:before,.treb-main.treb-main .treb-toolbar button[data-icon][data-icon].treb-font-stack:before,.treb-main.treb-main .treb-toolbar>button[data-command].treb-font-stack:before,.treb-main.treb-main .treb-toolbar>button[data-icon].treb-font-stack:before,.treb-main.treb-main .treb-toolbar>div>button[data-command].treb-font-stack:before,.treb-main.treb-main .treb-toolbar>div>button[data-icon].treb-font-stack:before{display:none}.treb-main.treb-main .treb-toolbar .treb-split{display:flex;flex-direction:column;gap:0}.treb-main.treb-main .treb-toolbar .treb-split button[data-command]{font-size:10px}.treb-main.treb-main .treb-toolbar .treb-split button[data-command]:before{display:none}.treb-main.treb-main .treb-toolbar .treb-split>button{align-items:center;display:flex;height:16px;justify-content:center}.treb-main.treb-main .treb-toolbar .treb-split>button:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.treb-main.treb-main .treb-toolbar .treb-split>button:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:0}.treb-main.treb-main .treb-toolbar .treb-font-stack{align-items:flex-start;overflow:hidden;width:8em}.treb-main.treb-main .treb-toolbar .treb-font-stack:before{display:none}.treb-main.treb-main .treb-toolbar .treb-menu{outline:none}.treb-main.treb-main .treb-toolbar .treb-menu>div{background:var(--treb-toolbar-button-background,#fff);border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));border-radius:3px;box-shadow:0 4px 6px -4px rgba(0,0,0,.4);display:none;flex-direction:column;margin-top:.5rem;position:fixed;top:48px;z-index:20}.treb-main.treb-main .treb-toolbar .treb-menu>div button{background:transparent;border:0;margin:3px 0;padding:.4rem 1rem;text-align:left;transition:background-color .125s ease;white-space:nowrap}.treb-main.treb-main .treb-toolbar .treb-menu>div button:hover{background:var(--treb-toolbar-hover-button-background,#f3f4f6)}.treb-main.treb-main .treb-toolbar .treb-menu>div.treb-icon-buttons>.treb-menu>button,.treb-main.treb-main .treb-toolbar .treb-menu>div.treb-icon-buttons>button{padding:0}.treb-main.treb-main .treb-toolbar .treb-menu>div>[separator]{background:var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));height:1px;margin:2px 0}.treb-main.treb-main .treb-toolbar .treb-menu.visible>div,.treb-main.treb-main .treb-toolbar .treb-menu:focus-within>div{display:flex}.treb-main.treb-main .treb-toolbar [data-icon=file-menu]{--icon:var(--icon-file-menu)}.treb-main.treb-main .treb-toolbar [data-command=justify-left]{--icon:var(--icon-text-align-left)}.treb-main.treb-main .treb-toolbar [data-command=justify-right]{--icon:var(--icon-text-align-right)}.treb-main.treb-main .treb-toolbar [data-command=justify-center]{--icon:var(--icon-text-align-center)}.treb-main.treb-main .treb-toolbar [data-command=indent]{--icon:var(--icon-text-indent)}.treb-main.treb-main .treb-toolbar [data-command=outdent]{--icon:var(--icon-text-outdent)}.treb-main.treb-main .treb-toolbar [data-command=align-top]{--icon:var(--icon-text-align-top)}.treb-main.treb-main .treb-toolbar [data-command=align-middle]{--icon:var(--icon-text-align-middle)}.treb-main.treb-main .treb-toolbar [data-command=align-bottom]{--icon:var(--icon-text-align-bottom)}.treb-main.treb-main .treb-toolbar [data-command=merge-cells]{--icon:var(--icon-merge-cells)}.treb-main.treb-main .treb-toolbar [data-command=unmerge-cells]{--icon:var(--icon-unmerge-cells)}.treb-main.treb-main .treb-toolbar [data-command=fill-color]{--icon:var(--icon-fill-color)}.treb-main.treb-main .treb-toolbar [data-command=text-color]{--icon:var(--icon-text-color)}.treb-main.treb-main .treb-toolbar [data-command=lock-cells]{--icon:var(--icon-lock)}.treb-main.treb-main .treb-toolbar [data-command=wrap-text]{--icon:var(--icon-wrap-text)}.treb-main.treb-main .treb-toolbar [data-icon=comment]{--icon:var(--icon-comment)}.treb-main.treb-main .treb-toolbar [data-icon=table]{--icon:var(--icon-table)}.treb-main.treb-main .treb-toolbar [data-icon=layout]{--icon:var(--icon-layout)}.treb-main.treb-main .treb-toolbar [data-command=freeze-panes]{--icon:var(--icon-freeze)}.treb-main.treb-main .treb-toolbar [data-command=insert-column-chart]{--icon:var(--icon-column-chart)}.treb-main.treb-main .treb-toolbar [data-command=insert-donut-chart]{--icon:var(--icon-donut-chart)}.treb-main.treb-main .treb-toolbar [data-command=insert-bar-chart]{--icon:var(--icon-bar-chart)}.treb-main.treb-main .treb-toolbar [data-command=insert-line-chart]{--icon:var(--icon-line-chart)}.treb-main.treb-main .treb-toolbar [data-command=insert-image]{--icon:var(--icon-image)}.treb-main.treb-main .treb-toolbar [data-command=border-bottom]{--icon:var(--icon-border-bottom)}.treb-main.treb-main .treb-toolbar [data-command=border-left]{--icon:var(--icon-border-left)}.treb-main.treb-main .treb-toolbar [data-command=border-right]{--icon:var(--icon-border-right)}.treb-main.treb-main .treb-toolbar [data-command=border-top]{--icon:var(--icon-border-top)}.treb-main.treb-main .treb-toolbar [data-command=border-outside]{--icon:var(--icon-border-outer)}.treb-main.treb-main .treb-toolbar [data-command=border-all]{--icon:var(--icon-border-all)}.treb-main.treb-main .treb-toolbar [data-command=border-none]{--icon:var(--icon-border-none)}.treb-main.treb-main .treb-toolbar [data-command=border-double-bottom]{--icon:var(--icon-border-double-bottom)}.treb-main.treb-main .treb-toolbar [data-icon=palette]{--icon:var(--icon-palette)}.treb-main.treb-main .treb-toolbar [data-command=recalculate]{--icon:var(--icon-recalculate);--icon-size:20px 20px}.treb-main.treb-main .treb-toolbar .treb-font-scale{width:4em}.treb-main.treb-main .treb-toolbar .treb-number-format{width:8em}.treb-main.treb-main .treb-toolbar .treb-color-chooser button[data-command=set-color]{align-items:center;display:flex;justify-content:center;padding:0;width:32px}.treb-main.treb-main .treb-toolbar .treb-color-chooser button[data-command=set-color]>svg{pointer-events:none}.treb-main.treb-main .treb-toolbar .treb-color-chooser>div{padding:.75rem}.treb-main.treb-main .treb-toolbar .treb-color-chooser>div+div{padding-top:0}.treb-main.treb-main .treb-toolbar .treb-color-chooser>div:last-child{align-items:center;display:flex;flex-direction:row;gap:.5rem}.treb-main.treb-main .treb-toolbar .treb-color-chooser>div:last-child input{flex-grow:1;padding:0 .5rem}.treb-main.treb-main .treb-toolbar .treb-color-chooser>div:last-child button,.treb-main.treb-main .treb-toolbar .treb-color-chooser>div:last-child input{border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));border-radius:3px;height:32px}.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-default-swatch button,.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-swatches button{border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));border-radius:2px;height:18px;margin:0;padding:0;width:18px}.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-default-swatch .treb-default-color:before,.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-swatches .treb-default-color:before{background:currentColor;content:"";display:block;height:100%;mask-image:var(--icon-x);-webkit-mask-image:var(--icon-x);mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-size:24px 24px;-webkit-mask-size:24px 24px;opacity:.7;position:relative;width:100%}.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-default-swatch{align-items:center;display:grid;gap:.5rem;grid-template-columns:auto 1fr}.treb-main.treb-main .treb-toolbar .treb-color-chooser .treb-swatches{display:grid;gap:.5rem;grid-template-columns:repeat(10,1fr)}.treb-main.treb-main .treb-toolbar .treb-comment-box textarea{border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));font:inherit;height:10rem;line-height:1.5;margin:.5rem;padding:.25rem;resize:both}.treb-main.treb-main .treb-toolbar .treb-comment-box textarea+div{align-items:center;display:flex;flex-direction:row;gap:.5rem;justify-content:center;padding:0 0 .5rem}.treb-main.treb-main .treb-toolbar .treb-comment-box textarea+div button{border:1px solid var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));border-radius:3px}.treb-main.treb-main .treb-toolbar .treb-font-scale{padding-left:2em;text-align:right;width:5em}.treb-main.treb-main .treb-toolbar [composite][font-scale]{position:relative}.treb-main.treb-main .treb-toolbar .treb-font-scale-icon{border-radius:3px;left:.5em;line-height:1;opacity:.9;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.treb-main.treb-main .treb-toolbar .treb-font-scale-icon:after,.treb-main.treb-main .treb-toolbar .treb-font-scale-icon:before{content:"A";position:relative}.treb-main.treb-main .treb-toolbar .treb-font-scale-icon:before{font-size:1.2em}.treb-main.treb-main .treb-toolbar .treb-font-scale-icon:after{font-size:.9em;left:-.125em}.treb-main.treb-main{--treb-font-stack-default-size:14px;--treb-font-stack-calibri-size:16px;--treb-font-stack-tscu-comic-size:16px;--treb-font-stack-helvetica-neue-size:13px;--treb-font-stack-cambria-size:16px;--treb-font-stack-sitka-text-variant:lining-nums tabular-nums}.treb-main.treb-main.treb-ua-osx{--treb-font-stack-system-ui-size:10pt}.treb-main.treb-main .treb-font-stack-default{font-family:calibri,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,"sans-serif"}.treb-main.treb-main .treb-font-stack-transitional{font-family:Charter,Bitstream Charter,Cambria,serif}.treb-main.treb-main .treb-font-stack-old-style{font-family:Iowan Old Style,Palatino Linotype,URW Palladio L,P052,serif}.treb-main.treb-main .treb-font-stack-handwritten{font-family:Segoe Print,Bradley Hand,Chilanka,TSCu_Comic,casual,cursive}.treb-main.treb-main .treb-font-stack-industrial{font-family:Bahnschrift,DIN Alternate,Franklin Gothic Medium,Nimbus Sans Narrow,sans-serif-condensed,sans-serif}.treb-main.treb-main .treb-font-stack-monospace{font-family:ui-monospace,Cascadia Code,Source Code Pro,Menlo,Consolas,DejaVu Sans Mono,monospace}.treb-main.treb-main .treb-font-stack-ui{font-family:system-ui,sans-serif}.treb-main.treb-main{all:revert;box-sizing:border-box;color:inherit;color-scheme:var(--treb-color-scheme,unset);display:grid;font-family:var(--treb-default-font,system-ui,"BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue","sans-serif");font-family:BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,"sans-serif";font-size:14px;font-style:normal;font-weight:400;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto minmax(0,1fr);height:100%;line-height:normal;position:relative;text-align:start;width:100%}.treb-main.treb-main a,.treb-main.treb-main button,.treb-main.treb-main div,.treb-main.treb-main input,.treb-main.treb-main li,.treb-main.treb-main ol,.treb-main.treb-main svg,.treb-main.treb-main textarea,.treb-main.treb-main ul{all:revert;box-sizing:border-box;font-family:var(--treb-default-font,system-ui,"BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue","sans-serif")}.treb-main.treb-main button,.treb-main.treb-main input{color:inherit;font:inherit}.treb-main.treb-main *{box-sizing:border-box}.treb-main.treb-main [contenteditable]{-webkit-user-modify:read-write;-moz-user-modify:read-write}.treb-main.treb-main[animate] .treb-layout-header{transition:height var(--treb-sidebar-transition,.2s ease),opacity var(--treb-sidebar-transition,.2s ease)}.treb-main.treb-main .treb-layout-header{grid-column:1/3;grid-row:1;height:1px;opacity:0}.treb-main.treb-main[toolbar] .treb-layout-header{height:42px;opacity:1}.treb-main.treb-main[dialog] .treb-layout-header,.treb-main.treb-main[dialog]>*{opacity:.6}.treb-main.treb-main[dialog] .treb-dialog-mask{opacity:1;pointer-events:auto}.treb-main.treb-main .treb-layout-spreadsheet{display:flex;flex-direction:row;gap:1em;grid-column:1;grid-row:2;position:relative;transition:opacity .2s ease;z-index:5}.treb-main.treb-main .treb-views.treb-can-revert .treb-view .treb-revert-indicator{opacity:1;pointer-events:auto}.treb-main.treb-main .treb-view{display:grid;flex:1 1 0px;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;position:relative}.treb-main.treb-main .treb-view .treb-spreadsheet-backdrop{box-shadow:0 4px 6px -4px rgba(0,0,0,.4);grid-column:1;grid-row:2;z-index:2}.treb-main.treb-main .treb-view .treb-spreadsheet-body{position:relative;z-index:4}.treb-main.treb-main .treb-view .treb-spreadsheet-footer{position:relative;z-index:5}.treb-main.treb-main .treb-view .treb-layout-resize-handle,.treb-main.treb-main .treb-view .treb-revert-indicator{display:none}.treb-main.treb-main .treb-view:first-of-type .treb-revert-indicator{align-self:start;border-color:orange transparent transparent orange;border-style:solid;border-width:.5em;display:block;grid-area:2/1/3/2;height:1rem;justify-self:start;opacity:0;overflow:hidden;pointer-events:none;position:relative;transition:opacity .125s ease;width:1rem;z-index:20}.treb-main.treb-main .treb-view:last-of-type .treb-layout-resize-handle{align-self:end;border-bottom:.5rem solid var(--treb-resize-handle-color,#0059b9);border-left:.5rem solid transparent;border-right:.5rem solid var(--treb-resize-handle-color,#0059b9);border-top:.5rem solid transparent;cursor:nw-resize;display:block;grid-area:2/1/3/2;height:1rem;justify-self:end;width:1rem;z-index:20}.treb-main.treb-main[animate] .treb-layout-sidebar{transition:width var(--treb-sidebar-transition,.2s ease),opacity var(--treb-sidebar-transition,.2s ease)}.treb-main.treb-main .treb-layout-sidebar{align-items:center;display:flex;flex-direction:column;gap:.75rem;grid-column:2;grid-row:2;justify-content:flex-start;overflow:hidden;padding-top:3rem;width:2.5rem;width:3rem}.treb-main.treb-main[collapsed] .treb-layout-sidebar{opacity:0;width:0}.treb-main.treb-main[collapsed] .treb-toggle-sidebar-button{background:var(--treb-toolbar-button-background,#fff);border-bottom-right-radius:0;border-color:var(--treb-toolbar-border-color,var(--treb-ui-border-color,#d1d5db));border-right-color:var(--treb-toolbar-button-background,transparent);border-top-right-radius:0;right:0}.treb-main.treb-main[collapsed] .treb-toggle-sidebar-button:after{mask-image:var(--icon-chevron-left);-webkit-mask-image:var(--icon-chevron-left)}.treb-main.treb-main .treb-layout-sidebar>button,.treb-main.treb-main .treb-toggle-sidebar-button{background:transparent;border:0;margin:0;padding:0}.treb-main.treb-main .treb-layout-sidebar>button:after,.treb-main.treb-main .treb-toggle-sidebar-button:after{background:#ccc;content:"";display:block;height:24px;mask-image:var(--icon);-webkit-mask-image:var(--icon);mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;transition:background-color .1s ease;width:24px}.treb-main.treb-main .treb-layout-sidebar>button[data-can-revert=false],.treb-main.treb-main .treb-toggle-sidebar-button[data-can-revert=false]{display:none}.treb-main.treb-main .treb-layout-sidebar>button:hover:after,.treb-main.treb-main .treb-toggle-sidebar-button:hover:after{background:#666}.treb-main.treb-main .treb-layout-sidebar>button[data-command=recalculate],.treb-main.treb-main .treb-toggle-sidebar-button[data-command=recalculate]{--icon:var(--icon-reset)}.treb-main.treb-main .treb-layout-sidebar>button[data-command=toggle-toolbar],.treb-main.treb-main .treb-toggle-sidebar-button[data-command=toggle-toolbar]{--icon:var(--icon-toolbar)}.treb-main.treb-main .treb-layout-sidebar>button[data-command=revert],.treb-main.treb-main .treb-toggle-sidebar-button[data-command=revert]{--icon:var(--icon-revert)}.treb-main.treb-main .treb-layout-sidebar>button[data-command=export-xlsx],.treb-main.treb-main .treb-toggle-sidebar-button[data-command=export-xlsx]{--icon:var(--icon-export)}.treb-main.treb-main .treb-layout-sidebar>button[data-command=about],.treb-main.treb-main .treb-toggle-sidebar-button[data-command=about]{--icon:var(--icon-about)}.treb-main.treb-main .treb-toggle-sidebar-button{align-items:center;background:transparent;border:1px solid transparent;border-radius:12px;bottom:6rem;display:flex;height:24px;justify-content:center;margin:0;padding:0;position:absolute;right:.5rem;right:calc(1.5rem - 12px);width:24px;z-index:39}.treb-main.treb-main .treb-toggle-sidebar-button:after{height:12px;mask-image:var(--icon-chevron-right);-webkit-mask-image:var(--icon-chevron-right);width:12px}.treb-main.treb-main .treb-resize-rect{border:1px dotted var(--treb-resize-frame-color,blue);display:block;height:100%;left:0;position:fixed;top:0;width:100%;z-index:9998}.treb-main.treb-main .treb-resize-mask{height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:9999}treb-spreadsheet{display:block;overflow:hidden;position:relative}.treb-default-size{height:550px;width:800px}`;var gn='<div class="treb-main treb-theme"><div class="treb-layout-header treb-animate"><div class="treb-toolbar"></div></div><div class="treb-dialog-mask"><div data-bind="dialog" class="treb-embed-dialog"><div data-bind="left"><a href="https://treb.app" target="_blank"><div class="treb-icon-64"></div></a></div><div data-bind="middle"><div data-bind="title" class="treb-embed-dialog-title"></div><div data-bind="message" class="treb-embed-dialog-message"></div><div data-bind="about" class="treb-embed-dialog-body"></div></div><button type="button" data-title="close_dialog" data-bind="close" class="treb-close-box"><svg viewBox="0 0 16 16"><path d="M11.854 4.146a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708-.708l7-7a.5.5 0 0 1 .708 0z"/><path d="M4.146 4.146a.5.5 0 0 0 0 .708l7 7a.5.5 0 0 0 .708-.708l-7-7a.5.5 0 0 0-.708 0z"/></svg></button></div></div><div class="treb-layout-spreadsheet treb-views"><template class="treb-view-template"><div class="treb-view"><div class="treb-formula-bar notranslate" hidden><div class="treb-address-label"><div></div></div><button class="treb-insert-function-button" data-title="insert_function" data-conditional="insert-function">\u{1D453}<small>(x)</small></button><div class="treb-editor-container"><div contenteditable="true"></div></div></div><div class="treb-spreadsheet-backdrop"></div><div class="treb-spreadsheet-body" role="grid"><div class="treb-grid" tabindex="-1"><div class="treb-overlay-container notranslate" translate="no"><div class="treb-overlay-inset"><div class="treb-overlay-editor" contenteditable tabindex="-1" spellcheck="true" role="gridcell"></div></div></div></div></div><div class="treb-spreadsheet-footer" hidden><button class="treb-delete-tab" data-title="delete_sheet" data-command="delete-tab" data-conditional="delete-tab"><svg tabindex="-1" viewbox="0 0 16 16"><path d="M4,4 L12,12 M12,4 L4,12"/></svg></button><div class="treb-spreadsheet-tab-container"><ol class="treb-spreadsheet-tabs" role="tablist"></ol></div><button class="treb-add-tab" data-command="add-tab" data-conditional="add-tab" data-title="add_sheet">+</button><div class="treb-stats-panel"></div><div class="treb-scale-control" data-conditional="scale-control"></div></div><div class="treb-layout-resize-handle" data-conditional="resize"></div><div class="treb-revert-indicator" data-command="revert-indicator" data-title="document_modified"></div></div></template></div><div class="treb-layout-sidebar treb-animate"><button data-command="recalculate" data-title="recalculate"></button> <button data-command="toggle-toolbar" data-conditional="toolbar" data-title="toggle_toolbar"></button> <button data-command="export-xlsx" data-conditional="export" data-title="export"></button> <button data-command="revert" data-conditional="revert" data-title="revert"></button> <button data-command="about" data-title="about"></button></div><button class="treb-toggle-sidebar-button" data-title="toggle_sidebar"></button></div>';var vn='<div class="treb-menu" title="File menu" file-menu><button data-icon="file-menu" menu-target></button><div><button data-command="reset">New document</button><div separator></div><button data-command="import-file">Open file...</button> <button data-command="save-json">Save JSON</button><div separator xlsx-support></div><button data-command="export-xlsx" xlsx-support>Export XLSX</button></div></div><div composite narrow><button data-command="justify-left" data-target="justify" title="Left-align text"></button><div class="treb-menu"><button dropdown title="Text justify options"></button><div class="treb-icon-buttons" data-replace="justify"><button data-command="justify-left" title="Left-align text"></button> <button data-command="justify-center" title="Center-align text"></button> <button data-command="justify-right" title="Right-align text"></button></div></div></div><div composite narrow><button data-command="align-top" data-target="align" title="Align to top"></button><div class="treb-menu"><button dropdown title="Text align options"></button><div class="treb-icon-buttons" data-replace="align"><button data-command="align-top" title="Align to top"></button> <button data-command="align-middle" title="Align to middle"></button> <button data-command="align-bottom" title="Align to bottom"></button></div></div></div><div class="group" wide><button data-command="justify-left" title="Left-align text"></button> <button data-command="justify-center" title="Center-align text"></button> <button data-command="justify-right" title="Right-align text"></button></div><div class="group" wide><button data-command="align-top" title="Align to top"></button> <button data-command="align-middle" title="Align to middle"></button> <button data-command="align-bottom" title="Align to bottom"></button></div><div class="group" wide indent-group><button data-command="outdent" title="Decrease indent"></button> <button data-command="indent" title="Incrase indent"></button></div><div class="group"><button data-command="wrap-text" title="Wrap text"></button> <button data-command="merge-cells" data-id="merge" data-inactive-title="Merge cells" data-active-title="Unmerge cells"></button> <button data-command="lock-cells" data-inactive-title="Lock cells" data-active-title="Unlock cells"></button> <button data-command="freeze-panes" data-inactive-title="Freeze panes" data-active-title="Unfreeze panes" freeze-button></button> <button data-command="insert-table" data-icon="table" data-inactive-title="Insert table" data-active-title="Remove table" table-button></button><div class="treb-menu"><button data-icon="comment" data-inactive-title="Comment" data-active-title="Update comment"></button><div class="treb-comment-box"><textarea></textarea><div><button data-command="clear-comment">Clear</button> <button data-command="update-comment">Save</button></div></div></div></div><div composite><button data-command="border-bottom" data-target="border" title="Bottom border"></button><div class="treb-menu"><button dropdown title="Border options"></button><div class="treb-icon-buttons" data-replace="border"><button data-command="border-top" title="Top border"></button> <button data-command="border-left" title="Left border"></button> <button data-command="border-right" title="Right border"></button> <button data-command="border-bottom" title="Bottom border"></button> <button data-command="border-double-bottom" title="Double bottom border"></button> <button data-command="border-outside" title="Outside borders"></button> <button data-command="border-all" title="All borders"></button> <button data-command="border-none" title="Clear borders"></button><div separator></div><div class="treb-menu treb-color-menu treb-submenu" data-color-command="border-color" data-replace-color="border" title="Border color" data-default-color-text="Default border color"><button data-icon="palette" data-color-bar="border" data-color="{}"></button></div></div></div></div><div composite><button data-command="fill-color" data-color-bar="fill" data-color="{}" title="Fill color"></button><div class="treb-menu treb-color-menu" data-color-command="fill-color" data-replace-color="fill" data-default-color-text="No fill"><button dropdown title="Color options"></button><div class="treb-color-chooser"><div class="treb-caption">Theme colors</div><div class="treb-swatches"></div><div class="treb-caption">No color</div><div class="treb-default-swatch"><button class="treb-default-color" data-command="set-color" data-color="{}"></button> <span class="treb-default-color-label" data-command="set-color" data-color="{}">...</span></div><div class="treb-caption">Other colors</div><div class="treb-swatches"></div><div><input placeholder="New color" class="treb-color-input"> <button data-command="set-color" data-color=""><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16"><path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/></svg></button></div></div></div></div><div composite><button data-command="text-color" data-color-bar="text" data-color="{}" title="Text color"></button><div class="treb-menu treb-color-menu" data-color-command="text-color" data-replace-color="text" data-default-color-text="Default text color"><button dropdown title="Color options"></button></div></div><div composite font-scale><div class="treb-font-scale-icon"></div><input class="treb-font-scale" title="Font scale"><div class="treb-menu"><button dropdown title="Font scale options"></button><div><button data-command="font-scale" data-scale="0.8">0.80</button> <button data-command="font-scale" data-scale="0.9">0.90</button> <button data-command="font-scale" data-scale="1.0">1.00</button> <button data-command="font-scale" data-scale="1.1">1.10</button> <button data-command="font-scale" data-scale="1.25">1.25</button> <button data-command="font-scale" data-scale="1.5">1.50</button> <button data-command="font-scale" data-scale="2.0">2.00</button></div></div></div><div composite font-stack><button class="treb-font-stack" data-command="font-stack" data-font-stack="" title="Font stack"></button><div class="treb-menu"><button dropdown title="Font stack options"></button><div><button data-command="font-stack" data-font-stack="default"></button> <button data-command="font-stack" data-font-stack="transitional"></button> <button data-command="font-stack" data-font-stack="monospace"></button> <button data-command="font-stack" data-font-stack="handwritten"></button> <button data-command="font-stack" data-font-stack="ui"></button></div></div></div><div composite><input class="treb-number-format" title="Number format"><div class="treb-menu"><button dropdown title="Number formats"></button><div class="treb-number-format-menu"></div></div></div><div class="treb-split"><button data-command="decrease-precision" title="Decrease precision"></button> <button data-command="increase-precision" title="Increase precision"></button></div><div class="treb-menu"><button data-icon="layout" title="Rows & columns"></button><div><button data-command="insert-row">Insert row</button> <button data-command="insert-column">Insert column</button> <button data-command="delete-row">Delete row</button> <button data-command="delete-column">Delete column</button><div separator add-remove-sheet></div><button data-command="insert-sheet" add-remove-sheet>Add sheet</button> <button data-command="delete-sheet" add-remove-sheet>Delete sheet</button></div></div><div composite chart-menu><button data-command="insert-column-chart" data-target="annotation" title="Insert column chart"></button><div class="treb-menu"><button dropdown title="Chart options"></button><div class="treb-icon-buttons" data-replace="annotation"><button data-command="insert-column-chart" title="Insert column chart"></button> <button data-command="insert-donut-chart" title="Insert donut chart"></button> <button data-command="insert-bar-chart" title="Insert bar chart"></button> <button data-command="insert-line-chart" title="Insert line chart"></button><div separator></div><button data-command="insert-image" title="Insert image"></button></div></div></div><button data-command="recalculate" title="Recalculate" recalculate-button></button>';var yn={close_dialog:"Close dialog",insert_function:"Insert function...",delete_sheet:"Delete current sheet",add_sheet:"Add sheet",document_modified:"This document has been modified from the original version.",recalculate:"Recalculate",toggle_toolbar:"Toggle toolbar",export:"Export as XLSX",revert:"Revert to original version",about:"What's this?",toggle_sidebar:"Toggle sidebar"},Ve=class{root;sheet;border_color;color_bar_elements={};replace_targets={};layout_element;views;revert_button;revert_state=!1;toolbar_controls={};swatch_lists={};DOM;constructor(e){typeof e=="string"&&(e=document.querySelector(e)),this.DOM=le.GetInstance(e?.ownerDocument),this.DOM.view&&e instanceof this.DOM.view.HTMLElement&&(this.root=e,this.DOM.doc?.head.querySelector("style[treb-stylesheet]")||this.DOM.doc?.head.prepend(this.DOM.Create("style",void 0,void 0,{text:fn,attrs:{"treb-stylesheet":""}})))}CoerceAttributeValue(e){if(e===null||e.toString().toLowerCase()==="true"||e==="")return!0;if(e.toLowerCase()==="false")return!1;{let t=Number(e);if(!isNaN(t))return t}return e||""}ParseOptionAttributes(){let e={};if(this.root){let t=this.root.getAttributeNames();for(let r of t){switch(r){case"class":case"style":case"id":continue;case"data-options":case"options":{let o=(this.root.getAttribute(r)||"").split(",");for(let i of o){let s=i.split(/=/);s.length===1?e[s[0]]=!0:e[s[0]]=this.CoerceAttributeValue(s[1])}}continue;case"data-treb":continue;case"inline-document":continue;case"src":e.document=this.root.getAttribute("src")||void 0;continue}e[r.replace(/-/g,"_")]=this.CoerceAttributeValue(this.root.getAttribute(r))}}return{...e}}AttachElement(e={}){if(e={...this.ParseOptionAttributes(),...e},this.root){if(!e.headless){let t=this.root.getBoundingClientRect();(!t.width||!t.height)&&this.root.classList.add("treb-default-size")}if(this.root.hasAttribute("inline-document")){let t=this.root.getAttribute("inline-document")||"";for(let r of Array.from(this.root.children))if(this.DOM.view&&r instanceof this.DOM.view.HTMLScriptElement&&r.type==="application/json"){let n=r.getAttribute("name")||"";if(n===t||!n&&t==="true"){let o=r.textContent;if(o)try{e.inline_document=JSON.parse(o)}catch(i){console.error(i)}break}}e.inline_document||console.warn("inline document failed")}this.root.innerHTML=gn,e.container=this.root.querySelector(".treb-layout-spreadsheet")}this.sheet=new dt(e),this.root&&this.CreateLayout(this.sheet,this.root)}CreateLayout(e,t){new ResizeObserver(()=>e.Resize()).observe(t),this.layout_element=t.querySelector(".treb-main");let n=t.querySelector(".treb-toggle-sidebar-button");if(n&&this.layout_element){let c=this.layout_element;n.addEventListener("click",()=>{let u=c.getAttribute("collapsed");typeof u=="string"&&(u===""||u==="true")?c.removeAttribute("collapsed"):c.setAttribute("collapsed","")})}(e.options.toolbar==="show"||e.options.toolbar==="show-narrow")&&this.layout_element?.setAttribute("toolbar",""),e.options.collapsed&&this.layout_element?.setAttribute("collapsed","");let o=t.querySelector("[data-command=revert-indicator]");this.DOM.view&&o instanceof this.DOM.view.HTMLElement&&(e.options.revert_indicator?o.addEventListener("click",()=>{e.HandleToolbarMessage({command:"revert-indicator"})}):o.style.display="none"),t.querySelector(".treb-layout-sidebar")?.addEventListener("click",c=>{let u=c.target;u.dataset.command&&(u.dataset.command==="toggle-toolbar"?this.ToggleToolbar():e.HandleToolbarMessage({command:u.dataset.command}))}),e.options.toolbar&&this.AttachToolbar(e,t);let s={"table-button":!!e.options.table_button,revert:!!e.options.revert_button,toolbar:!!e.options.toolbar,export:!!e.options.export,"insert-function":!!e.options.insert_function_button,resize:!!e.options.resizable,"add-tab":!!e.options.add_tab,"delete-tab":!!e.options.delete_tab||!!e.options.add_tab};for(let[c,u]of Object.entries(s))if(!u){let d=this.layout_element.querySelectorAll(`[data-conditional=${c}]`);for(let m of Array.from(d))m.style.display="none"}if(e.options.revert_button&&(this.revert_button=this.layout_element.querySelector("[data-command=revert]")||void 0),e.options.resizable){let c={width:0,height:0},u={x:0,y:0},d={x:0,y:0};this.views=t.querySelector(".treb-views")||void 0;let m,b,p=t.querySelector(".treb-layout-resize-handle"),h=()=>y(),f=(x=>{x.buttons===0?y():(d.x=x.screenX-u.x,d.y=x.screenY-u.y,b&&(b.style.width=c.width+d.x+"px",b.style.height=c.height+d.y+"px"))}),y=()=>{if(d.x||d.y){let x=t.getBoundingClientRect();e.options.constrain_width||(t.style.width=x.width+d.x+"px"),t.style.height=x.height+d.y+"px"}m&&(m.removeEventListener("mouseup",h),m.removeEventListener("mousemove",f),m.parentElement?.removeChild(m),m=void 0),b?.parentElement?.removeChild(b),b=void 0};p.addEventListener("mousedown",x=>{x.stopPropagation(),x.preventDefault();let v=t.querySelector(".treb-main");b=this.DOM.Div("treb-resize-rect",v),m=this.DOM.Div("treb-resize-mask",v,{attrs:{style:"cursor: nw-resize;"},events:{mouseup:h,mousemove:f}}),u.x=x.screenX,u.y=x.screenY,d.x=0,d.y=0;let w=this.views?.querySelectorAll(".treb-spreadsheet-body"),g=Array.from(w||[]).map(C=>C.getBoundingClientRect());if(g.length){let C=JSON.parse(JSON.stringify(g.shift()));for(let L of g)C.top=Math.min(L.top,C.top),C.left=Math.min(L.left,C.left),C.right=Math.max(L.right,C.right),C.bottom=Math.max(L.bottom,C.bottom);let U=C.right-C.left,V=C.bottom-C.top;b.style.top=C.top+"px",b.style.left=C.left+"px",b.style.width=U+"px",b.style.height=V+"px",c.width=U,c.height=V}})}let l=Array.from(this.layout_element.querySelectorAll("[data-title]"));for(let c of l)if(c instanceof HTMLElement){if(c.dataset.activeTitle)continue;c.dataset.title&&yn[c.dataset.title]&&(c.title=yn[c.dataset.title])}setTimeout(()=>this.layout_element?.setAttribute("animate",""),250)}ToggleToolbar(){if(this.layout_element){let e=this.layout_element.getAttribute("toolbar");typeof e=="string"&&(e===""||e==="true")?this.layout_element.removeAttribute("toolbar"):this.layout_element.setAttribute("toolbar","")}}UpdateSelectionStyle(e,t,r){let n=e.selection_state;r.value="";for(let l of Object.values(this.toolbar_controls))l&&(l.removeAttribute("active"),l.dataset.inactiveTitle&&(l.title=l.dataset.inactiveTitle));let o=l=>{l&&(l.setAttribute("active",""),l.dataset.activeTitle&&(l.title=l.dataset.activeTitle))};if(n.comment&&(o(this.toolbar_controls.comment),r.value=n.comment),n.style?.locked&&o(this.toolbar_controls.locked),n.frozen&&o(this.toolbar_controls.freeze),n.style?.wrap&&o(this.toolbar_controls.wrap),this.toolbar_controls.table&&(n.table?(o(this.toolbar_controls.table),this.toolbar_controls.table.dataset.command="remove-table"):this.toolbar_controls.table.dataset.command="insert-table"),this.toolbar_controls.merge&&(n.merge?(o(this.toolbar_controls.merge),this.toolbar_controls.merge.dataset.command="unmerge-cells"):this.toolbar_controls.merge.dataset.command="merge-cells"),this.toolbar_controls.stack)if(n.style?.font_face)if(n.style.font_face.startsWith("stack:")){let l=n.style.font_face.substring(6);this.toolbar_controls.stack.textContent=Pe[l]||"",this.toolbar_controls.stack.dataset.fontStack=l}else this.toolbar_controls.stack.textContent="",this.toolbar_controls.stack.dataset.fontStack="";else this.toolbar_controls.stack.textContent=Pe.default||"",this.toolbar_controls.stack.dataset.fontStack="default";let i=this.toolbar_controls.format;i&&(n.style?.number_format?i.value=R.SymbolicName(n.style.number_format)||n.style.number_format:i.value="General");let s=this.toolbar_controls.scale;switch(s&&(s.value=e.FormatNumber(n.relative_font_size||1,"0.00")),n.style?.horizontal_align){case"left":o(this.toolbar_controls.left);break;case"center":o(this.toolbar_controls.center);break;case"right":o(this.toolbar_controls.right);break}switch(n.style?.vertical_align){case"top":o(this.toolbar_controls.top);break;case"middle":o(this.toolbar_controls.middle);break;case"bottom":o(this.toolbar_controls.bottom);break}}UpdateDocumentStyles(e,t){{let s=this.DOM.Fragment(),l=e.document_styles.theme_colors.length,c=["Background","Text","Background","Text","Accent"];if(l){let b=e.document_styles.theme_colors[0].length;for(let p=0;p<b;p++)for(let h=0;h<l;h++){let f=e.document_styles.theme_colors[h][p],y=`background: ${f.resolved};`,x=c[h]||c[4];er(f.color)&&f.color.tint?x+=` (${(f.color.tint>0?"+":"")+f.color.tint*100}%)`:h===0?this.color_bar_elements.fill?.style.setProperty("--treb-default-color",f.resolved):h===1&&(this.color_bar_elements.text?.style.setProperty("--treb-default-color",f.resolved),this.color_bar_elements.border?.style.setProperty("--treb-default-color",f.resolved)),this.DOM.Create("button",void 0,s,{attrs:{style:y,title:x},data:{command:"set-color",color:JSON.stringify(f.color)}})}}this.swatch_lists.theme?.replaceChildren(s),s=this.DOM.Fragment();let u=["Black","White","Gray","Red","Orange","Yellow","Green","Blue","Indigo","Violet"],d=u.map(b=>b.toLowerCase()),m=e.document_styles.colors.filter(b=>!d.includes(b.toLowerCase()));for(let b of[...u,...m]){let p=`background: ${b.toLowerCase()};`;this.DOM.Create("button",void 0,s,{attrs:{style:p,title:b},data:{command:"set-color",color:JSON.stringify({text:b.toLowerCase()})}})}this.swatch_lists.other?.replaceChildren(s)}let r=["General","Number","Integer","Percent","Fraction","Accounting","Currency","Scientific"],n=["Timestamp","Long Date","Short Date"];for(let s of e.document_styles.number_formats){if(R.SymbolicName(R.Translate(s)))continue;R.Get(s).date_format?n.push(s):r.push(s)}let o=s=>this.DOM.Create("button",void 0,void 0,{text:s,data:{format:s,command:"number-format"}}),i=this.DOM.Fragment();i.append(...r.map(s=>o(s))),i.append(this.DOM.Div(void 0,void 0,{attrs:{separator:""}})),i.append(...n.map(s=>o(s))),t.textContent="",t.append(i)}UpdateRevertState(e){let t=e.can_revert;this.revert_state!==t&&(this.revert_state=t,(this.revert_button||e.options.revert_indicator)&&(this.revert_state?this.views?.classList.add("treb-can-revert"):this.views?.classList.remove("treb-can-revert"),this.revert_button&&(this.revert_button.dataset.canRevert=t?"true":"false",t?(this.revert_button.classList.remove("sidebar-disabled"),this.revert_button.title="Revert to original version"):(this.revert_button.classList.add("sidebar-disabled"),this.revert_button.title="This is the original version of the document"))))}ReplaceTemplate(e,t,r=!0){let n=e.querySelector(t);if(n&&n.parentElement){for(let o of Array.from(n.content.children))n.parentElement.insertBefore(o,n);r&&n.parentElement.removeChild(n)}else console.warn("template not found",t)}AttachToolbar(e,t){let r=t.querySelector(".treb-layout-header"),n=t.querySelector(".treb-toolbar");n.innerHTML=vn;let o=[];if(e.options.toolbar==="narrow"||e.options.toolbar==="show-narrow"?o.push(...Array.from(n.querySelectorAll("[wide]"))):o.push(...Array.from(n.querySelectorAll("[narrow]"))),e.options.file_menu||o.push(n.querySelector("[file-menu]")),e.options.indent_buttons||o.push(n.querySelector("[indent-group]")),e.options.font_scale||o.push(n.querySelector("[font-scale]")),!e.options.font_stack)o.push(n.querySelector("[font-stack]"));else{let v=n.querySelectorAll("[font-stack] button[data-font-stack]");for(let w of v)if(w.dataset.fontStack){let g=Pe[w.dataset.fontStack];w.textContent=g||""}}e.options.chart_menu||o.push(n.querySelector("[chart-menu]")),e.options.freeze_button||o.push(n.querySelector("[freeze-button]")),e.options.table_button||o.push(n.querySelector("[table-button]")),!e.options.add_tab&&!e.options.delete_tab&&o.push(...Array.from(n.querySelectorAll("[add-remove-sheet]"))),e.options.toolbar_recalculate_button||o.push(n.querySelector("[recalculate-button]"));for(let v of o)v&&v.parentElement?.removeChild(v);let i=n.querySelector(".treb-color-chooser"),s=n.querySelector(".treb-comment-box textarea");for(let[v,w]of Object.entries({top:"[wide] [data-command=align-top]",middle:"[wide] [data-command=align-middle]",bottom:"[wide] [data-command=align-bottom]",left:"[wide] [data-command=justify-left]",right:"[wide] [data-command=justify-right]",center:"[wide] [data-command=justify-center]",wrap:"[data-command=wrap-text]",merge:"[data-id=merge]",comment:"[data-icon=comment]",locked:"[data-command=lock-cells]",freeze:"[data-command=freeze-panes]",table:"[data-icon=table]",format:"input.treb-number-format",scale:"input.treb-font-scale",stack:"button.treb-font-stack"})){let g=n.querySelector(w);g&&(this.toolbar_controls[v]=g)}let l=i.querySelectorAll(".treb-swatches");this.swatch_lists={theme:l[0],other:l[1]};let c=t.querySelector("[data-command=increase-precision");c&&(c.textContent=this.sheet?.FormatNumber(0,"0.00")||""),c=t.querySelector("[data-command=decrease-precision"),c&&(c.textContent=this.sheet?.FormatNumber(0,"0.0")||""),c=n.querySelector("[data-command=update-comment]"),s.addEventListener("keydown",v=>{v.key==="Enter"&&(v.shiftKey||v.ctrlKey)&&c.click()});for(let v of["border","annotation","align","justify"])this.replace_targets[v]=n.querySelector(`[data-target=${v}`);for(let v of["fill","text","border"])this.color_bar_elements[v]=n.querySelector(`[data-color-bar=${v}]`);n.addEventListener("click",v=>{let w=v.target,g={format:w.dataset.format,scale:w.dataset.scale,font_stack:w.dataset.fontStack},C=w?.dataset.command;if(C){let U=w.parentElement?.dataset.replace;if(U){let V=this.replace_targets[U];V&&(V.dataset.command=C,V.title=w.title||"")}switch(/^border-/.test(C)&&(g.color=this.border_color||{}),C){case"text-color":case"fill-color":g.color={};try{g.color=JSON.parse(w.dataset.color||"{}")}catch(V){console.error(V)}break;case"set-color":C=i.dataset.colorCommand||"",g.color={};try{g.color=JSON.parse(w.dataset.color||"{}")}catch(V){console.error(V)}if(C==="border-color"&&(this.border_color=g.color),i.dataset.target){let V=this.color_bar_elements[i.dataset.target];V&&(V.style.setProperty("--treb-color-bar-color",w.style.backgroundColor),V.dataset.color=w.dataset.color||"{}")}break;case"update-comment":g.comment=s.value;break}e.HandleToolbarMessage({command:C,...g})}});let u=(v,w)=>{let g=n.querySelector(v);if(g){let C="";g.addEventListener("focusin",()=>C=g.value),g.addEventListener("keydown",U=>{switch(U.key){case"Escape":g.value=C,e.Focus();break;case"Enter":w(g.value)||(g.value=C,e.Focus());break;default:return}U.stopPropagation(),U.preventDefault()})}};u("input.treb-number-format",v=>v?(e.HandleToolbarMessage({command:"number-format",format:v}),!0):!1),u("input.treb-font-scale",v=>{let w=Number(v);return!w||isNaN(w)?(console.warn("invalid scale value"),!1):(e.HandleToolbarMessage({command:"font-scale",scale:w}),!0)});let d=i.querySelector("input"),m=i.querySelector("input + button");d.addEventListener("input",v=>{if(v instanceof InputEvent&&v.isComposing)return;m.style.background=d.value||"";let w=m.style.backgroundColor||"#fff",g=nr.MeasureColor(w),C=tr.RGBToHSL(g[0],g[1],g[2]);m.style.color=C.l>.5?"#000":"#fff",m.dataset.color=JSON.stringify(m.style.backgroundColor?{text:m.style.backgroundColor}:{})}),d.addEventListener("keydown",v=>{v.key==="Enter"&&(v.stopPropagation(),v.preventDefault(),m.click())}),/firefox/i.test(navigator.userAgent)?r.addEventListener("scroll",()=>{this.DOM.view&&this.DOM.doc?.activeElement instanceof this.DOM.view.HTMLElement&&this.DOM.doc.activeElement?.blur()}):r.addEventListener("scroll",()=>e.Focus());let b=!1,p=v=>{v.key==="Escape"&&(v.stopPropagation(),v.preventDefault(),Promise.resolve().then(()=>e.Focus()))},h=v=>{if(b){if(v.relatedTarget instanceof Node&&n.contains(v.relatedTarget))return;n.removeEventListener("keydown",p),n.removeEventListener("focusout",h),b=!1}},f=v=>{let w=v.target,g=w?.parentElement;if(w?.classList.contains("treb-menu")){g=w;for(let C of Array.from(g.children))if(C.tagName==="BUTTON"){w=C;break}}else if(!g?.classList.contains("treb-menu"))return;if(w&&g){if(b||(n.addEventListener("focusout",h),n.addEventListener("keydown",p),b=!0),g.dataset.colorCommand){i.querySelector(".treb-default-color")?.setAttribute("title",g.dataset.defaultColorText||"Default color");let j=i.querySelector(".treb-default-color-label");j&&(j.textContent=g.dataset.defaultColorText||"Default color"),g.appendChild(i),i.dataset.colorCommand=g.dataset.colorCommand,i.dataset.target=g.dataset.replaceColor||""}let C=g.querySelector("div"),U=r.getBoundingClientRect(),V=w.getBoundingClientRect(),{left:L}=V,M=g.parentElement;M?.hasAttribute("composite")&&(L=M.firstElementChild.getBoundingClientRect().left);let A=C.getBoundingClientRect();g.classList.contains("treb-submenu")?(C.style.top=V.top-A.height/2+"px",L+V.width+6+A.width>U.right?C.style.left=L-6-A.width+"px":C.style.left=L+V.width+6+"px"):(C.style.top=V.bottom+"px",L+A.width>U.right-6?C.style.left=V.right-A.width+"px":C.style.left=L+"px");let G=C.querySelector("textarea");G&&requestAnimationFrame(()=>G.focus())}},y=this.root?.querySelector(".treb-number-format-menu");y&&(this.UpdateDocumentStyles(e,y),this.UpdateSelectionStyle(e,n,s),e.Subscribe(v=>{switch(v.type){case"focus-view":break;case"data":case"document-change":case"load":case"reset":this.UpdateDocumentStyles(e,y),this.UpdateSelectionStyle(e,n,s),this.UpdateRevertState(e);break;case"theme-change":this.UpdateDocumentStyles(e,y),this.UpdateSelectionStyle(e,n,s);break;case"annotation-selection":case"selection":this.UpdateSelectionStyle(e,n,s);break}}));let x=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);if(n.addEventListener("focusin",v=>{f(v)}),x){let v=Array.from(n.querySelectorAll(".treb-menu"));for(let w of v)w.tabIndex=0;n.addEventListener("mousedown",w=>{f(w)})}}};var mt=class{version="36.1.2";CreateSpreadsheet(e){let t=e.container,r=new Ve(t);if(r.AttachElement(e),!r.sheet)throw new Error("construction failed");return r.sheet}},aa=new mt;if(typeof HTMLElement<"u"){class a extends HTMLElement{get sheet(){return this.instance.sheet}instance;constructor(){super(),this.instance=new Ve(this)}connectedCallback(){this.instance.AttachElement()}}typeof customElements<"u"&&(customElements.get("treb-spreadsheet")?console.info("custom element treb-spreadsheet is already defined."):customElements.define("treb-spreadsheet",a))}export{aa as TREB,mt as TREBGlobal};
|