open-grid 1.2.0 → 1.2.1
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/OpenGrid-0r_543Kj.cjs +7192 -0
- package/dist/OpenGrid-HmhGVC2V.js +7203 -0
- package/dist/open-grid-react.cjs +27 -1
- package/dist/open-grid-react.js +22 -82
- package/dist/open-grid-vue.cjs +31 -1
- package/dist/open-grid-vue.js +29 -79
- package/dist/open-grid.cjs +272 -6
- package/dist/open-grid.js +177 -266
- package/dist/types/core/CellEditManager.d.ts +73 -0
- package/dist/types/core/CellEventHandler.d.ts +99 -2
- package/dist/types/core/ChartManager.d.ts +51 -3
- package/dist/types/core/ContextMenu.d.ts +43 -2
- package/dist/types/core/CrossGridController.d.ts +86 -15
- package/dist/types/core/CrossGridRegistry.d.ts +36 -2
- package/dist/types/core/DetailManager.d.ts +106 -15
- package/dist/types/core/ExportManager.d.ts +66 -1
- package/dist/types/core/ExtensionPointRegistry.d.ts +160 -14
- package/dist/types/core/FilterPanel.d.ts +17 -2
- package/dist/types/core/FilterSelect.d.ts +37 -13
- package/dist/types/core/FindBarManager.d.ts +26 -0
- package/dist/types/core/FlatRowModel.d.ts +54 -11
- package/dist/types/core/FooterManager.d.ts +53 -1
- package/dist/types/core/FormulaController.d.ts +139 -10
- package/dist/types/core/GridComposer.d.ts +54 -6
- package/dist/types/core/GridShuttle.d.ts +44 -4
- package/dist/types/core/GroupTreeManager.d.ts +86 -2
- package/dist/types/core/IconRegistry.d.ts +56 -9
- package/dist/types/core/KeyboardManager.d.ts +88 -4
- package/dist/types/core/MaskingEngine.d.ts +10 -9
- package/dist/types/core/MutationService.d.ts +113 -10
- package/dist/types/core/OrgChart.d.ts +56 -1
- package/dist/types/core/OverrideKernel.d.ts +59 -15
- package/dist/types/core/Pagination.d.ts +38 -4
- package/dist/types/core/RangeSelectionManager.d.ts +121 -7
- package/dist/types/core/RenderController.d.ts +56 -0
- package/dist/types/core/RowManager.d.ts +55 -0
- package/dist/types/core/SkinRegistry.d.ts +51 -15
- package/dist/types/core/SortFilterManager.d.ts +80 -1
- package/dist/types/core/TriggerManager.d.ts +46 -0
- package/dist/types/core/WorksheetManager.d.ts +61 -2
- package/dist/types/core/XmlConverter.d.ts +56 -23
- package/dist/types/core/chart/types.d.ts +107 -10
- package/dist/types/core/editors/CellEditor.d.ts +29 -2
- package/dist/types/core/formula/types.d.ts +71 -8
- package/dist/types/core/range/RangeQuery.d.ts +24 -2
- package/dist/types/core/renderers/CellRenderer.d.ts +100 -8
- package/dist/xlsx.min-BQ1o3sB6.cjs +11793 -0
- package/dist/{xlsx.min-Wavxcamn.js → xlsx.min-Bbz2ZypC.js} +453 -566
- package/package.json +2 -1
- package/dist/OpenGrid-B0Spm0rU.js +0 -10404
- package/dist/OpenGrid-CuXj0isp.cjs +0 -97
- package/dist/xlsx.min-Bx-LxWOf.cjs +0 -138
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";class Ds{constructor(){this.listeners=new Map}on(e,t){const s=this.listeners.get(e)??[];return s.push({handler:t,once:!1}),this.listeners.set(e,s),this}once(e,t){const s=this.listeners.get(e)??[];return s.push({handler:t,once:!0}),this.listeners.set(e,s),this}off(e,t){if(!t)return this.listeners.delete(e),this;const s=this.listeners.get(e);if(s){const o=s.filter(i=>i.handler!==t);o.length===0?this.listeners.delete(e):this.listeners.set(e,o)}return this}emit(e,...t){const s=this.listeners.get(e);if(!s||s.length===0)return!1;const o=[];for(const i of s)i.handler(...t),i.once||o.push(i);return o.length!==s.length&&(o.length===0?this.listeners.delete(e):this.listeners.set(e,o)),!0}removeAllListeners(e){return e?this.listeners.delete(e):this.listeners.clear(),this}listenerCount(e){var t;return((t=this.listeners.get(e))==null?void 0:t.length)??0}}class Os{constructor(e,t){this._totalRows=0,this._scrollTop=0,this._viewportHeight=0,this._rafId=null,this._onScroll=()=>{this._scrollTop=this.container.scrollTop,this._scheduleRender()},this.container=e,this.rowHeight=t.rowHeight,this.overscan=t.overscan??5,this.onRender=t.onRender,this.container.addEventListener("scroll",this._onScroll,{passive:!0})}_scheduleRender(){this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{this._rafId=null;const e=this.getVisibleRange();this.onRender(e.startIndex,e.endIndex)}))}getVisibleRange(){const e=Math.ceil(this._viewportHeight/this.rowHeight),t=Math.max(0,Math.floor(this._scrollTop/this.rowHeight)-this.overscan),s=Math.min(this._totalRows-1,t+e+this.overscan*2),o=t*this.rowHeight;return{startIndex:t,endIndex:s,offsetY:o}}setTotalRows(e){this._totalRows=e,this._updateSpacerHeight(),this._scheduleRender()}setViewportHeight(e){this._viewportHeight=e,this._scheduleRender()}setRowHeight(e){this.rowHeight=e,this._updateSpacerHeight(),this._scheduleRender()}scrollToRow(e){const t=e*this.rowHeight,s=t+this.rowHeight,o=this._scrollTop+this._viewportHeight;if(t<this._scrollTop)this._scrollTop=t,this.container.scrollTop=t;else if(s>o){const i=s-this._viewportHeight;this._scrollTop=i,this.container.scrollTop=i}}getTotalHeight(){return this._totalRows*this.rowHeight}_updateSpacerHeight(){const e=this.container.querySelector(".og-spacer");e&&(e.style.height=`${this.getTotalHeight()}px`)}destroy(){this.container.removeEventListener("scroll",this._onScroll),this._rafId!==null&&cancelAnimationFrame(this._rafId)}}class rs{constructor(e,t=0){this._flatLeaves=[],this._maxDepth=1,this._frozenCount=0,this._columns=e,this._frozenCount=t,this._process()}_process(){const e=[];let t=0;const s=(o,i)=>{for(const r of o)r.children&&r.children.length>0?(s(r.children,i+1),this._maxDepth=Math.max(this._maxDepth,i+1)):e.push({...r,_colIndex:t++,_depth:i,_leaf:!0})};this._maxDepth=1,s(this._columns,1),this._flatLeaves=e}get leaves(){return this._flatLeaves}get visibleLeaves(){return this._flatLeaves.filter(e=>!e.hidden)}get headerDepth(){return this._maxDepth}get frozenCount(){return this._frozenCount}setFrozen(e){this._frozenCount=e}setColumns(e){this._columns=e,this._process()}hideColumn(e){const t=Array.isArray(e)?e:[e];this._flatLeaves.forEach(s=>{t.includes(s.field)&&(s.hidden=!0)})}showColumn(e){const t=Array.isArray(e)?e:[e];this._flatLeaves.forEach(s=>{t.includes(s.field)&&(s.hidden=!1)})}addColumn(e,t="last"){t==="last"?this._columns.push(e):t==="first"?this._columns.unshift(e):this._columns.splice(t,0,e),this._process()}removeColumn(e){const t=s=>s.filter(o=>o.field===e?!1:(o.children&&(o.children=t(o.children)),!0));this._columns=t(this._columns),this._process()}getColumnByField(e){return this._flatLeaves.find(t=>t.field===e)}getColumnByIndex(e){return this._flatLeaves[e]}getColumnIndex(e){return this._flatLeaves.findIndex(t=>t.field===e)}buildHeaderCells(){const e=Array.from({length:this._maxDepth},()=>[]);let t=0;const s=(o,i)=>{let r=0;for(const a of o)if(!a.hidden)if(a.children&&a.children.length>0){const l=s(a.children,i+1);l>0&&(e[i-1].push({column:a,colIndex:t,depth:i,colSpan:l,rowSpan:1}),r+=l)}else e[i-1].push({column:a,colIndex:t++,depth:i,colSpan:1,rowSpan:this._maxDepth-i+1}),r++;return r};return s(this._columns,1),e}computeWidths(e,t=100){const s=this.visibleLeaves,o=s.filter(l=>l.flex),i=s.filter(l=>!l.flex&&l.width).reduce((l,d)=>l+d.width,0),r=o.reduce((l,d)=>l+(d.flex??1),0),a=Math.max(0,e-i);return s.map(l=>l.flex?Math.round(l.flex/r*a):l.width??t)}}function $s(n,e){return n.indexOf("{")===-1?n:n.replace(/\{\{|\}\}|\{(\w+)\}/g,(t,s)=>{if(t==="{{")return"{";if(t==="}}")return"}";const o=e?e[s]:void 0;return o===void 0?t:String(o)})}const zs={contextMenu:{sortAsc:"오름차순 정렬",sortDesc:"내림차순 정렬",find:"찾기",exportExcel:"Excel로 저장",exportCsv:"CSV로 저장",print:"인쇄"},filter:{title:"필터",opContains:"포함",opEq:"같음",opNe:"같지 않음",opStartsWith:"시작",opEndsWith:"끝남",opGt:"보다 큼",opLt:"보다 작음",opGte:"이상",opLte:"이하",valuePlaceholder:"필터 값 입력...",clear:"초기화",apply:"적용",legend:"필터",clearAria:"필터 초기화",all:"전체"},findBar:{label:"찾기",placeholder:"검색어 입력...",searchAria:"그리드 내 검색",closeAria:"찾기 닫기",countBadge:"{n}건"},pagination:{rowsPerPage:"행/페이지:",rangeBadge:"{from}–{to} / {total}건",empty:"0건"},drag:{rowCount:"{count}개 행 이동"},crossGrid:{overlayAria:"그리드 필드 매핑",title:"필드 매핑",desc1:"두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. ",desc2:"아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.",emptyOption:"(비움)",scriptTitle:"생성된 변환 스크립트",copy:"복사",copied:"복사됨!",copyFailed:"복사 실패",cancel:"취소",applyMove:"적용 후 이동",scriptComment:"// crossGridMapping 옵션에 이 함수를 그대로 지정하세요."},shuttle:{toRight:"체크한 행을 오른쪽 그리드로 이동",toLeft:"체크한 행을 왼쪽 그리드로 이동",allRight:"왼쪽 전체를 오른쪽으로 이동",allLeft:"오른쪽 전체를 왼쪽으로 이동"},tree:{collapse:"접기",expand:"펼치기"},detail:{glyphLabel:"▤ 상세",glyphTooltip:"상세 보기",expandAria:"상세 패널 펼치기",collapseAria:"상세 패널 접기",expandedAnnounce:"행 상세 패널을 펼쳤습니다.",collapsedAnnounce:"행 상세 패널을 접었습니다.",collapsedAllAnnounce:"모든 상세 패널을 접었습니다.",depthLimitOpen:"중첩 깊이 한계({max})로 상세 패널을 열 수 없습니다.",depthLimitSubgrid:"중첩 깊이 한계({max})로 서브 그리드를 생성하지 않습니다."},worksheet:{addAria:"새 워크시트 추가"},editor:{datePick:"날짜 선택",select:"선택",cellPositionAnnounce:"{row}행 {col}열, {header}: {value}"},cell:{emptyValue:"빈 값",revealTooltip:"클릭하면 원문 표시",revealAria:"마스킹 해제",radioAria:"선택",barcodeAria:"바코드: {value}"},row:{selectAllAria:"전체 행 선택",selectAria:"{n}행 선택",moveAnnounce:"행 {from}을(를) {to}번째 위치로 이동"},group:{badge:"{label} ({count}건)",nullLabel:"(없음)"},pivot:{totalLabel:"합계"},data:{loadedAnnounce:"{count}행 데이터 로드됨",skippedCellsAnnounce:"쓰기 대상이 아닌 셀 {count}개를 건너뛰었습니다"},range:{selectionAnnounce:"{r1}행 {c1}열 ~ {r2}행 {c2}열, {n}개 셀 선택",formulaPreserved:"수식 셀 {count}개 보존",fillSkipped:"채우기 대상이 아닌 셀 {count}개를 건너뛰었습니다",fillHandleAria:"채우기 핸들"},sort:{asc:"오름차순",desc:"내림차순",none:"정렬 해제",announce:"{field} {dir} 정렬"},chart:{defaultTitle:"차트",badgeSampled:"샘플링됨 {to}/{from}행",badgeAggregated:"category 집계됨 ({op})",badgePieFirstSeries:"파이: 첫 시리즈만 표시",badgeNegativesAbs:"음수→절대값 표시 · bar 권장",badgeRangeFallback:"범위 소스 없음 · 선택 행으로 대체",badgeEngineFallback:"{engine} 미설치 · 내장 차트로 대체",announcePrefix:"차트 안내: {badges}",a11ySummary:"{title}: 카테고리 {categories}개, 시리즈 {series}",a11ySummaryNoTitle:"카테고리 {categories}개, 시리즈 {series}",a11yAltText:"{title}: {categories}개 카테고리별 {series} — 상세 값은 아래 표를 참고하세요",a11yNoData:"데이터 없음",tooltipEmpty:"없음",canvasDefault:"차트"},formulaError:{err:"수식 오류",ref:"참조 대상이 삭제됨",cycle:"순환 참조",div0:"0으로 나눔",name:"알 수 없는 함수/이름",value:"숫자가 아닌 값에 산술 연산",num:"수치 도메인 오류",fallback:"수식 오류"},formula:{cellErrorAnnounce:"{field} 셀 오류: {message}",ariaError:"수식 {src}, 오류: {message}",ariaValue:"수식 {src}, 값 {value}{approx}",approxSuffix:" (근사값)"},grid:{containerAria:"OPEN_GRID 데이터 그리드",emptyMessage:"데이터가 없습니다.",filterTooltip:"필터",detailRegion:"상세 내용"},export:{printSummary:"{rows}행 × {cols}열 · {date}"}},Hs={intlLocale:"ko-KR",dir:"ltr",exportFont:"맑은 고딕"},Bs={contextMenu:{sortAsc:"Sort ascending",sortDesc:"Sort descending",find:"Find",exportExcel:"Save as Excel",exportCsv:"Save as CSV",print:"Print"},filter:{title:"Filter",opContains:"Contains",opEq:"Equals",opNe:"Not equal",opStartsWith:"Starts with",opEndsWith:"Ends with",opGt:"Greater than",opLt:"Less than",opGte:"At least",opLte:"At most",valuePlaceholder:"Enter filter value...",clear:"Reset",apply:"Apply",legend:"Filter",clearAria:"Reset filter",all:"All"},findBar:{label:"Find",placeholder:"Enter search term...",searchAria:"Search within grid",closeAria:"Close find",countBadge:n=>n.n===1?"1 match":`${n.n} matches`},pagination:{rowsPerPage:"Rows per page:",rangeBadge:"{from}–{to} of {total}",empty:"0 rows"},drag:{rowCount:n=>n.count===1?"Move 1 row":`Move ${n.count} rows`},crossGrid:{overlayAria:"Grid field mapping",title:"Field mapping",desc1:"The two grids have different field structures. For each <b>target field</b>, choose which <b>source field</b> to pull its value from. ",desc2:"Copy the script below and bake it into <code>crossGridMapping</code> to convert automatically without this dialog next time.",emptyOption:"(none)",scriptTitle:"Generated conversion script",copy:"Copy",copied:"Copied!",copyFailed:"Copy failed",cancel:"Cancel",applyMove:"Apply and move",scriptComment:"// Assign this function to the crossGridMapping option as-is."},shuttle:{toRight:"Move checked rows to the right grid",toLeft:"Move checked rows to the left grid",allRight:"Move all from left to right",allLeft:"Move all from right to left"},tree:{collapse:"Collapse",expand:"Expand"},detail:{glyphLabel:"▤ Detail",glyphTooltip:"View detail",expandAria:"Expand detail panel",collapseAria:"Collapse detail panel",expandedAnnounce:"Row detail panel expanded.",collapsedAnnounce:"Row detail panel collapsed.",collapsedAllAnnounce:"All detail panels collapsed.",depthLimitOpen:"Nesting depth limit ({max}) reached — cannot open the detail panel.",depthLimitSubgrid:"Nesting depth limit ({max}) reached — subgrid will not be created."},worksheet:{addAria:"Add new worksheet"},editor:{datePick:"Pick a date",select:"Select",cellPositionAnnounce:"Row {row}, column {col}, {header}: {value}"},cell:{emptyValue:"empty",revealTooltip:"Click to reveal the original",revealAria:"Reveal masked value",radioAria:"Select",barcodeAria:"Barcode: {value}"},row:{selectAllAria:"Select all rows",selectAria:"Select row {n}",moveAnnounce:"Move row {from} to position {to}"},group:{badge:"{label} ({count})",nullLabel:"(none)"},pivot:{totalLabel:"Total"},data:{loadedAnnounce:n=>n.count===1?"1 row loaded":`${n.count} rows loaded`,skippedCellsAnnounce:n=>n.count===1?"Skipped 1 non-writable cell":`Skipped ${n.count} non-writable cells`},range:{selectionAnnounce:"Selected {n} cells from row {r1} column {c1} to row {r2} column {c2}",formulaPreserved:n=>n.count===1?"1 formula cell preserved":`${n.count} formula cells preserved`,fillSkipped:n=>n.count===1?"Skipped 1 non-fillable cell":`Skipped ${n.count} non-fillable cells`,fillHandleAria:"Fill handle"},sort:{asc:"ascending",desc:"descending",none:"unsorted",announce:"{field} sorted {dir}"},chart:{defaultTitle:"Chart",badgeSampled:"Sampled {to}/{from} rows",badgeAggregated:"Category aggregated ({op})",badgePieFirstSeries:"Pie: first series only",badgeNegativesAbs:"Negatives shown as absolute · bar recommended",badgeRangeFallback:"No range source · using selected rows",badgeEngineFallback:"{engine} not installed · using built-in chart",announcePrefix:"Chart notice: {badges}",a11ySummary:"{title}: {categories} categories, series {series}",a11ySummaryNoTitle:"{categories} categories, series {series}",a11yAltText:"{title}: {series} across {categories} categories — see the table below for detailed values",a11yNoData:"No data",tooltipEmpty:"none",canvasDefault:"Chart"},formulaError:{err:"Formula error",ref:"Reference was deleted",cycle:"Circular reference",div0:"Division by zero",name:"Unknown function/name",value:"Arithmetic on a non-numeric value",num:"Numeric domain error",fallback:"Formula error"},formula:{cellErrorAnnounce:"{field} cell error: {message}",ariaError:"Formula {src}, error: {message}",ariaValue:"Formula {src}, value {value}{approx}",approxSuffix:" (approx.)"},grid:{containerAria:"OPEN_GRID data grid",emptyMessage:"No data.",filterTooltip:"Filter",detailRegion:"Detail"},export:{printSummary:"{rows} rows × {cols} cols · {date}"}},Vs={intlLocale:"en-US",dir:"ltr",exportFont:"Calibri"};function ns(n){const e=n.indexOf(".");return e<0?[n,""]:[n.slice(0,e),n.slice(e+1)]}function Ye(n,e){if(!n)return;const[t,s]=ns(e),o=n[t];return o?o[s]:void 0}function At(n,e){const t={};for(const s of Object.keys(n))t[s]={...n[s]};for(const s of Object.keys(e))t[s]={...t[s]??{},...e[s]};return t}class et{constructor(e){this._locales=new Map,this._meta=new Map,this._extends=new Map,this._overrides={},this._cache=new Map,this._warned=new Set,this._parent=e,this._active=e?e._active:"ko"}register(e,t,s){return this._locales.set(e,t),s!=null&&s.extends&&this._extends.set(e,s.extends),this._cache.clear(),{missingKeys:this._allDotKeys().filter(r=>Ye(t,r)===void 0)}}extend(e,t){const s=this._locales.get(e)??{};return this._locales.set(e,At(s,t)),this._cache.clear(),this}has(e){var t;return this._locales.has(e)||(((t=this._parent)==null?void 0:t.has(e))??!1)}get(e){return this._locales.get(e)}list(){const e=new Set(this._locales.keys());if(this._parent)for(const t of this._parent.list())e.add(t);return[...e]}setActive(e){if(!this.has(e)&&e!=="ko"){typeof console<"u"&&console.warn(`[LocaleRegistry] 미등록 로케일 "${e}" — 무시하고 현재 로케일 유지. / unknown locale, keeping current.`);return}this._active=e}active(){return this._active}child(){return new et(this)}setOverride(e,t){var r;const[s,o]=ns(e),i=(r=this._overrides)[s]??(r[s]={});return i[o]=t,this._cache.clear(),this}applyOverrides(e){return this._overrides=At(this._overrides,e),this._cache.clear(),this}t(e,t){const s=this._resolveCached(e);return s===void 0?(this._warned.has(e)||(this._warned.add(e),typeof console<"u"&&console.warn(`[LocaleRegistry] 미등록 메시지 키 "${e}" — 키 원문 반환. / unknown message key, returning the key.`)),e):typeof s=="function"?s(t??{}):$s(s,t)}meta(){return this._resolveMeta(this._active)??this._resolveMeta("ko")??{intlLocale:this._active}}_resolveCached(e){const t=`${this._active}\0${e}`,s=this._cache.get(t);if(s!==void 0)return s===null?void 0:s;const o=this._resolve(e);return this._cache.set(t,o===void 0?null:o),o}_resolve(e){const t=this._active;for(let o=this;o;o=o._parent){const i=Ye(o._overrides,e);if(i!==void 0)return i;const r=Ye(o._locales.get(t),e);if(r!==void 0)return r}const s=this._extendsOf(t);if(s&&s!==t&&this._resolveLocale(s)!==void 0){const i=Lt(this,s,e);if(i!==void 0)return i}if(t!=="ko"){const o=Lt(this,"ko",e);if(o!==void 0)return o}}_resolveLocale(e){for(let t=this;t;t=t._parent){const s=t._locales.get(e);if(s)return s}}_extendsOf(e){for(let t=this;t;t=t._parent){const s=t._extends.get(e);if(s)return s}}_resolveMeta(e){for(let t=this;t;t=t._parent){const s=t._meta.get(e);if(s)return s}}_allDotKeys(){const e=this._resolveLocale("ko");if(!e)return[];const t=[];for(const s of Object.keys(e)){const o=e[s];if(o)for(const i of Object.keys(o))t.push(`${s}.${i}`)}return t}_seed(e,t,s){this._locales.set(e,t),this._meta.set(e,s)}}function Lt(n,e,t){for(let s=n;s;s=s._parent){const o=Ye(s._locales.get(e),t);if(o!==void 0)return o}}const ne=new et;ne._seed("ko",zs,Hs);ne._seed("en",Bs,Vs);function z(n,e){return ne.t(n,e)}class Ps{constructor(e,t,s,o){this._field="",this._outsideHandler=null,this._onApply=t,this._onClear=s,this._t=o??z,this._el=document.createElement("div"),this._el.className="og-filter-panel",this._el.style.cssText=`
|
|
2
|
-
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
3
|
-
background:var(--og-row-bg,#fff);border:1px solid var(--og-border-color,#e0e0e0);
|
|
4
|
-
border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,0.15);
|
|
5
|
-
padding:10px;box-sizing:border-box;display:none;font-size:13px;
|
|
6
|
-
`,e.appendChild(this._el)}open(e,t,s){var p;this._field=e,this._el.innerHTML="";const o=document.createElement("div");o.textContent=this._t("filter.title"),o.style.cssText="font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);",this._el.appendChild(o);const i=document.createElement("div");i.style.cssText="display:flex;gap:4px;margin-bottom:6px;";const r=document.createElement("select");r.style.cssText="flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";const a=[{label:this._t("filter.opContains"),value:"contains"},{label:this._t("filter.opEq"),value:"="},{label:this._t("filter.opNe"),value:"!="},{label:this._t("filter.opStartsWith"),value:"startsWith"},{label:this._t("filter.opEndsWith"),value:"endsWith"},{label:this._t("filter.opGt"),value:">"},{label:this._t("filter.opLt"),value:"<"},{label:this._t("filter.opGte"),value:">="},{label:this._t("filter.opLte"),value:"<="}];for(const f of a){const w=document.createElement("option");w.value=f.value,w.textContent=f.label,r.appendChild(w)}s[0]&&(r.value=s[0].operator),i.appendChild(r),this._el.appendChild(i);const l=document.createElement("input");l.type="text",l.placeholder=this._t("filter.valuePlaceholder"),l.value=((p=s[0])==null?void 0:p.value)??"",l.style.cssText=`
|
|
7
|
-
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
8
|
-
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
9
|
-
outline:none;
|
|
10
|
-
`,l.addEventListener("keydown",f=>{f.key==="Enter"?h.click():f.key==="Escape"&&this.close()}),this._el.appendChild(l);const d=document.createElement("div");d.style.cssText="display:flex;gap:6px;justify-content:flex-end;";const c=document.createElement("button");c.textContent=this._t("filter.clear"),c.style.cssText=`
|
|
11
|
-
padding:3px 10px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
12
|
-
border-radius:3px;background:#fff;cursor:pointer;font-size:12px;color:#666;
|
|
13
|
-
`,c.addEventListener("click",()=>{this._onClear(this._field),this.close()});const h=document.createElement("button");h.textContent=this._t("filter.apply"),h.style.cssText=`
|
|
14
|
-
padding:3px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
15
|
-
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
16
|
-
color:#fff;cursor:pointer;font-size:12px;
|
|
17
|
-
`,h.addEventListener("click",()=>{const f=l.value.trim();f?this._onApply(this._field,[{operator:r.value,value:f}]):this._onClear(this._field),this.close()}),d.appendChild(c),d.appendChild(h),this._el.appendChild(d);const u=t.getBoundingClientRect(),g=this._el.parentElement.getBoundingClientRect();this._el.style.top=`${u.bottom-g.top+2}px`,this._el.style.left=`${Math.min(u.left-g.left,g.width-220)}px`,this._el.style.display="block",requestAnimationFrame(()=>l.focus()),this._outsideHandler&&document.removeEventListener("mousedown",this._outsideHandler),this._outsideHandler=f=>{!this._el.contains(f.target)&&f.target!==t&&this.close()},setTimeout(()=>document.addEventListener("mousedown",this._outsideHandler),0)}close(){this._el.style.display="none",this._outsideHandler&&(document.removeEventListener("mousedown",this._outsideHandler),this._outsideHandler=null)}get isOpen(){return this._el.style.display!=="none"}destroy(){this.close(),this._el.remove()}}const Ns=10;function Ws(n,e=Ns){const t=Math.pow(10,e);return Math.round(n*t)/t}class v{constructor(e,t){this._c=e,this._s=t<0?0:t}static from(e){if(e instanceof v)return e;if(typeof e=="bigint")return new v(e,0);const t=String(e).trim();if(!t||t==="null"||t==="undefined"||t==="NaN")return new v(0n,0);const s=t.startsWith("-"),o=s?t.slice(1):t,i=o.indexOf(".");let r,a;if(i===-1)r=BigInt(o),a=0;else{const l=o.slice(i+1);r=BigInt(o.slice(0,i)+l),a=l.length}return new v(s?-r:r,a)}static zero(){return new v(0n,0)}static one(){return new v(1n,0)}static _align(e,t){return e._s===t._s?[e._c,t._c,e._s]:e._s>t._s?[e._c,t._c*10n**BigInt(e._s-t._s),e._s]:[e._c*10n**BigInt(t._s-e._s),t._c,t._s]}add(e){const[t,s,o]=v._align(this,v.from(e));return new v(t+s,o)}sub(e){const[t,s,o]=v._align(this,v.from(e));return new v(t-s,o)}mul(e){const t=v.from(e);return new v(this._c*t._c,this._s+t._s)}div(e,t=20){const s=v.from(e);if(s._c===0n)throw new Error("OGDecimal: division by zero");const i=this._c*10n**BigInt(t+s._s)/s._c;return new v(i,t+this._s)}mod(e){const t=v.from(e),[s,o,i]=v._align(this,t);return new v(s%o,i)}neg(){return new v(-this._c,this._s)}abs(){return new v(this._c<0n?-this._c:this._c,this._s)}eq(e){const[t,s]=v._align(this,v.from(e));return t===s}gt(e){const[t,s]=v._align(this,v.from(e));return t>s}lt(e){const[t,s]=v._align(this,v.from(e));return t<s}gte(e){return!this.lt(e)}lte(e){return!this.gt(e)}isZero(){return this._c===0n}isNeg(){return this._c<0n}isPos(){return this._c>0n}toFixed(e){let t=this._c,s=this._s;if(s<e)t=t*10n**BigInt(e-s);else if(s>e){const c=10n**BigInt(s-e),h=c/2n,u=t<0n,g=u?-t:t,p=g%c;let f=g/c;p>=h&&(f+=1n),t=u?-f:f}s=e;const o=t<0n,r=(o?-t:t).toString().padStart(e+1,"0"),a=r.slice(0,r.length-e)||"0",l=e>0?"."+r.slice(r.length-e):"";return(o?"-":"")+a+l}toString(){if(this._s===0)return this._c.toString();let e=this._c,t=this._s;for(;t>0&&e!==0n&&e%10n===0n;)e/=10n,t--;return new v(e,t).toFixed(t)}toNumber(){return parseFloat(this.toFixed(20))}static sum(e){return e.reduce((t,s)=>t.add(s),v.zero())}static avg(e,t=20){return e.length?v.sum(e).div(e.length,t):v.zero()}static min(e){if(!e.length)throw new Error("OGDecimal.min: empty array");return e.map(v.from).reduce((t,s)=>t.lt(s)?t:s)}static max(e){if(!e.length)throw new Error("OGDecimal.max: empty array");return e.map(v.from).reduce((t,s)=>t.gt(s)?t:s)}}function as(n,e,t=30){return new Ks(n,e,t).parse()}class Ks{constructor(e,t,s){this._ctx=t,this._prec=s,this._pos=0,this._src=e.trim()}parse(){const e=this._additive();if(this._skip(),this._pos<this._src.length)throw new SyntaxError(`FormulaEngine: 예상치 못한 토큰 '${this._src[this._pos]}' (위치 ${this._pos})`);return e}_additive(){let e=this._multiplicative();for(this._skip();this._pos<this._src.length;){const t=this._src[this._pos];if(t!=="+"&&t!=="-")break;this._pos++,this._skip();const s=this._multiplicative();e=t==="+"?e.add(s):e.sub(s),this._skip()}return e}_multiplicative(){let e=this._unary();for(this._skip();this._pos<this._src.length;){const t=this._src[this._pos];if(t!=="*"&&t!=="/"&&t!=="%")break;this._pos++,this._skip();const s=this._unary();t==="*"?e=e.mul(s):t==="/"?e=e.div(s,this._prec):e=e.mod(s),this._skip()}return e}_unary(){return this._skip(),this._src[this._pos]==="-"?(this._pos++,this._unary().neg()):this._primary()}_primary(){this._skip();const e=this._src[this._pos];if(e==="("){this._pos++;const t=this._additive();if(this._skip(),this._src[this._pos]!==")")throw new SyntaxError("FormulaEngine: 닫는 괄호 ) 누락");return this._pos++,t}return e==="["?this._fieldRef():this._literal()}_fieldRef(){this._pos++;const e=this._pos;for(;this._pos<this._src.length&&this._src[this._pos]!=="]";)this._pos++;if(this._pos>=this._src.length)throw new SyntaxError("FormulaEngine: 닫는 ] 누락");const t=this._src.slice(e,this._pos);this._pos++;const s=this._ctx[t];if(s==null)throw new ReferenceError(`FormulaEngine: 필드 '[${t}]'가 행 데이터에 없습니다`);return v.from(s)}_literal(){const e=this._pos;for(;this._pos<this._src.length&&/[0-9.]/.test(this._src[this._pos]);)this._pos++;const t=this._src.slice(e,this._pos);if(!t)throw new SyntaxError(`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos]??"EOF"}' 발견 (위치 ${e})`);return v.from(t)}_skip(){for(;this._pos<this._src.length&&/\s/.test(this._src[this._pos]);)this._pos++}}function pt(n,e){if(n==null||n==="")return n??"";const t=typeof e=="string"?{type:e}:e,s=t.char??"*";switch(t.type){case"ssn":return Us(n,s);case"phone":case"mobile":return qs(n,s);case"email":return js(n,s);case"credit":return Gs(n,s);case"account":return Ys(n,s,t.visiblePrefix??3,t.visibleSuffix??4);case"password":return s.repeat(Math.max(n.length,6));case"name":return Xs(n,s);case"ip":return Zs(n,s);case"partial":return We(n,s,t.visiblePrefix??0,t.visibleSuffix??4);default:return n}}function Us(n,e){const t=n.replace(/[^0-9]/g,"");if(t.length<7){const r=n.includes("-")?"-":"",a=n.indexOf("-")>=0?n.indexOf("-"):6;return n.slice(0,a)+r+e.repeat(Math.max(1,n.length-a-r.length))}const s=t.slice(0,6),o=t[6],i=t.length-7;return`${s}-${o}${e.repeat(i)}`}function qs(n,e){const t=n.replace(/[^0-9]/g,"");return t.length===11?`${t.slice(0,3)}-${e.repeat(4)}-${t.slice(7)}`:t.length===10?t.startsWith("02")?`${t.slice(0,2)}-${e.repeat(4)}-${t.slice(6)}`:`${t.slice(0,3)}-${e.repeat(3)}-${t.slice(6)}`:t.length===9?`${t.slice(0,2)}-${e.repeat(3)}-${t.slice(5)}`:We(n,e,3,4)}function js(n,e){const t=n.indexOf("@");if(t<0)return We(n,e,2,0);const s=n.slice(0,t),o=n.slice(t),i=Math.min(2,s.length),r=s.slice(0,i),a=Math.max(s.length-i,3);return`${r}${e.repeat(a)}${o}`}function Gs(n,e){const t=n.replace(/[^0-9]/g,"");if(t.length<8)return n;const s=t.slice(0,4),o=t.slice(-4),i=t.length-8,r=e.repeat(Math.max(i,8)),a=[s];for(let l=0;l<r.length;l+=4){const d=r.slice(l,l+4);d&&a.push(d)}return a.push(o),a.join("-")}function Ys(n,e,t,s){const o=n.replace(/[^0-9]/g,"");if(o.length<=t+s)return We(o,e,t,s);const i=o.slice(0,t),r=o.slice(-s),a=o.length-t-s;return`${i}-${e.repeat(a)}-${r}`}function Xs(n,e){const t=n.trim();return t.length===0?n:t.length===1?e:t.length===2?`${t[0]}${e}`:`${t[0]}${e.repeat(t.length-2)}${t[t.length-1]}`}function Zs(n,e){const t=n.split(".");if(t.length!==4)return We(n,e,3,0);const s=o=>e.repeat(Math.max(o.length,3));return`${t[0]}.${t[1]}.${s(t[2])}.${s(t[3])}`}function We(n,e,t,s){if(n.length<=t+s)return n;const o=n.slice(0,t),i=s>0?n.slice(-s):"",r=n.length-t-s;return`${o}${e.repeat(r)}${i}`}const Js="#e0e0e0";class Ze{constructor(e="default",t="default"){this.theme=e,this.skin=t}}class vt{constructor(e=new Ze){this._ctx=e}get context(){return this._ctx}_skinActive(){return this._ctx.skin!=="default"}setSkin(e){this._ctx=new Ze(this._ctx.theme,e)}_borderColorVar(){return`var(--og-border-color,${Js})`}border(e){let t=(e==null?void 0:e.style)??"solid";if(e!=null&&e.state&&(t="solid"),this._skinActive()){const s="var(--og-border-width, 1px)",o=e!=null&&e.state?"solid":`var(--og-border-style, ${t})`;return`${s} ${o} ${this._borderColorVar()}`}return`1px ${t} ${this._borderColorVar()}`}divider(){return this._skinActive()?`var(--og-border-width, 1px) var(--og-divider-style, solid) ${this._borderColorVar()}`:this.border()}texture(e){return e==="data"||e==="status"||e==="range"||e==="merge"||e==="focus"?"none":"var(--og-texture-bg, none)"}radius(e){return`${e}px`}cellPadding(){return"2px 8px"}elevation(e="md"){const t={sm:"0 1px 2px",md:"0 2px 6px",lg:"0 8px 24px"},s={sm:"0.07",md:"0.10",lg:"0.14"};return`var(--og-elevation-${e}, ${t[e]}) rgba(var(--og-shadow-ink, 0 0 0), var(--og-elevation-alpha-${e}, ${s[e]}))`}focusRing(e){let t=(e==null?void 0:e.width)??2,s=(e==null?void 0:e.style)??"solid";t<2&&(t=2),s==="none"&&(s="solid");const o=(e==null?void 0:e.color)??"var(--og-focus-border,var(--og-primary,#1976d2))";return this._skinActive()&&(e==null?void 0:e.width)===void 0&&(e==null?void 0:e.style)===void 0?`var(--og-focus-width, 2px) var(--og-focus-style, solid) ${o}`:`${t}px ${s} ${o}`}}const Ie=new vt,Qs="0 0 16 16",gt={"sort-up":'<path d="M3.5 12.5a.5.5 0 0 1-1 0V3.707L1.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.5.5 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L3.5 3.707zm3.5-9a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"/>',"sort-down":'<path d="M3.5 2.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 11.293zm3.5 1a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"/>',"chevron-expand":'<path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/>',funnel:'<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/>',"funnel-fill":'<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5z"/>',filter:'<path d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m-2-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"/>',search:'<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/>',"chevron-left":'<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/>',"chevron-right":'<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/>',"chevron-up":'<path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/>',"chevron-down":'<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/>',"chevron-double-left":'<path fill-rule="evenodd" d="M8.354 1.646a.5.5 0 0 1 0 .708L2.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/><path fill-rule="evenodd" d="M12.354 1.646a.5.5 0 0 1 0 .708L6.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/>',"chevron-double-right":'<path fill-rule="evenodd" d="M3.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L9.293 8 3.646 2.354a.5.5 0 0 1 0-.708"/><path fill-rule="evenodd" d="M7.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L13.293 8 7.646 2.354a.5.5 0 0 1 0-.708"/>',"arrow-up":'<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5"/>',"arrow-down":'<path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1"/>',"arrow-left":'<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>',"arrow-right":'<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>',"arrow-clockwise":'<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/><path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>',"plus-lg":'<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/>',"plus-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>',trash3:'<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"/>',"grip-vertical":'<path d="M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>',"grip-horizontal":'<path d="M2 8a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2m0-3a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>',"pin-angle":'<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146m.122 2.112v-.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a5 5 0 0 0-.288-.076 5 5 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a5 5 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034q.172.002.343-.04L9.927 2.028q-.042.172-.04.343a1.8 1.8 0 0 0 .062.46z"/>',"pin-angle-fill":'<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146"/>',eye:'<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z"/><path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0"/>',"eye-slash":'<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7 7 0 0 0-2.79.588l.77.771A6 6 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755q-.247.248-.517.486z"/><path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829"/><path d="M3.35 5.47q-.27.24-.518.487A13 13 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7 7 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12z"/>',pencil:'<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325"/>',"check-lg":'<path d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425z"/>',"x-lg":'<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/>',clipboard:'<path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/>',"clipboard-check":'<path fill-rule="evenodd" d="M10.854 7.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.793l2.646-2.647a.5.5 0 0 1 .708 0"/><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z"/>',eraser:'<path d="M8.086 2.207a2 2 0 0 1 2.828 0l3.879 3.879a2 2 0 0 1 0 2.828l-5.5 5.5A2 2 0 0 1 7.879 15H5.12a2 2 0 0 1-1.414-.586l-2.5-2.5a2 2 0 0 1 0-2.828zm2.121.707a1 1 0 0 0-1.414 0L4.16 7.547l5.293 5.293 4.633-4.633a1 1 0 0 0 0-1.414zM8.746 13.547 3.453 8.254 1.914 9.793a1 1 0 0 0 0 1.414l2.5 2.5a1 1 0 0 0 .707.293H7.88a1 1 0 0 0 .707-.293z"/>',square:'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>',"check-square":'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>',"dash-square":'<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/>',"check-all":'<path d="M8.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L2.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093L8.95 4.992zm-.92 5.14.92.92a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 1 0-1.091-1.028L9.477 9.417l-.485-.486z"/>',"filetype-csv":'<path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.517 14.841a1.13 1.13 0 0 0 .401.823q.195.162.478.252.284.091.665.091.507 0 .859-.158.354-.158.539-.44.187-.284.187-.656 0-.336-.134-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.566-.21l-.621-.144a1 1 0 0 1-.404-.176.37.37 0 0 1-.144-.299q0-.234.185-.384.188-.152.512-.152.214 0 .37.068a.6.6 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.439 0-.776.15-.337.149-.527.421-.19.273-.19.639 0 .302.122.524.124.223.352.367.228.143.539.213l.618.144q.31.073.463.193a.39.39 0 0 1 .152.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193q-.167.07-.413.07-.175 0-.32-.04a.8.8 0 0 1-.248-.115.58.58 0 0 1-.255-.384zM.806 13.693q0-.373.102-.633a.87.87 0 0 1 .302-.399.8.8 0 0 1 .475-.137q.225 0 .398.097a.7.7 0 0 1 .272.26.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964 1.4 1.4 0 0 0-.489-.272 1.8 1.8 0 0 0-.606-.097q-.534 0-.911.223-.375.222-.572.632-.195.41-.196.979v.498q0 .568.193.976.197.407.572.626.375.217.914.217.439 0 .785-.164t.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.8.8 0 0 1-.118.363.7.7 0 0 1-.272.25.9.9 0 0 1-.401.087.85.85 0 0 1-.478-.132.83.83 0 0 1-.299-.392 1.7 1.7 0 0 1-.102-.627zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879z"/>',"filetype-xlsx":'<path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM7.86 14.841a1.13 1.13 0 0 0 .401.823q.195.162.479.252.284.091.665.091.507 0 .858-.158.355-.158.54-.44a1.17 1.17 0 0 0 .187-.656q0-.336-.135-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.565-.21l-.621-.144a1 1 0 0 1-.405-.176.37.37 0 0 1-.143-.299q0-.234.184-.384.188-.152.513-.152.214 0 .37.068a.6.6 0 0 1 .245.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.199-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.44 0-.777.15-.336.149-.527.421-.19.273-.19.639 0 .302.123.524t.351.367q.229.143.54.213l.618.144q.31.073.462.193a.39.39 0 0 1 .153.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193q-.168.07-.413.07-.176 0-.32-.04a.8.8 0 0 1-.249-.115.58.58 0 0 1-.255-.384zm-3.726-2.909h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415H1.5l1.24-2.016-1.228-1.983h.931l.832 1.438h.036zm1.923 3.325h1.697v.674H5.266v-3.999h.791zm7.636-3.325h.893l-1.274 2.007 1.254 1.992h-.908l-.85-1.415h-.035l-.853 1.415h-.861l1.24-2.016-1.228-1.983h.931l.832 1.438h.036z"/>',"filetype-pdf":'<path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38.57.57 0 0 1-.238.241.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181.185.183.185.522m1.217-1.333v3.999h1.46q.602 0 .998-.237a1.45 1.45 0 0 0 .595-.689q.196-.45.196-1.084 0-.63-.196-1.075a1.43 1.43 0 0 0-.589-.68q-.396-.234-1.005-.234zm.791.645h.563q.371 0 .609.152a.9.9 0 0 1 .354.454q.118.302.118.753a2.3 2.3 0 0 1-.068.592 1.1 1.1 0 0 1-.196.422.8.8 0 0 1-.334.252 1.3 1.3 0 0 1-.483.082h-.563zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638z"/>',"filetype-json":'<path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM4.151 15.29a1.2 1.2 0 0 1-.111-.449h.764a.58.58 0 0 0 .255.384q.105.073.25.114.142.041.319.041.245 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .084-.29.39.39 0 0 0-.152-.326q-.152-.12-.463-.193l-.618-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.352-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.192-.272.528-.422.337-.15.777-.149.456 0 .779.152.326.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.246-.181.9.9 0 0 0-.37-.068q-.324 0-.512.152a.47.47 0 0 0-.185.384q0 .18.144.3a1 1 0 0 0 .404.175l.621.143q.326.075.566.211a1 1 0 0 1 .375.358q.135.222.135.56 0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m-3.104-.033a1.3 1.3 0 0 1-.082-.466h.764a.6.6 0 0 0 .074.27.5.5 0 0 0 .454.246q.285 0 .422-.164.137-.165.137-.466v-2.745h.791v2.725q0 .66-.357 1.005-.355.345-.985.345a1.6 1.6 0 0 1-.568-.094 1.15 1.15 0 0 1-.407-.266 1.1 1.1 0 0 1-.243-.39m9.091-1.585v.522q0 .384-.117.641a.86.86 0 0 1-.322.387.9.9 0 0 1-.47.126.9.9 0 0 1-.47-.126.87.87 0 0 1-.32-.387 1.55 1.55 0 0 1-.117-.641v-.522q0-.386.117-.641a.87.87 0 0 1 .32-.387.87.87 0 0 1 .47-.129q.265 0 .47.129a.86.86 0 0 1 .322.387q.117.255.117.641m.803.519v-.513q0-.565-.205-.973a1.46 1.46 0 0 0-.59-.63q-.38-.22-.916-.22-.534 0-.92.22a1.44 1.44 0 0 0-.589.628q-.205.407-.205.975v.513q0 .562.205.973.205.407.589.626.386.217.92.217.536 0 .917-.217.384-.22.589-.626.204-.41.205-.973m1.29-.935v2.675h-.746v-3.999h.662l1.752 2.66h.032v-2.66h.75v4h-.656l-1.761-2.676z"/>',printer:'<path d="M2.5 8a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1"/><path d="M5 1a2 2 0 0 0-2 2v2H2a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h1v1a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-1h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1V3a2 2 0 0 0-2-2zM4 3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2H4zm1 5a2 2 0 0 0-2 2v1H2a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v-1a2 2 0 0 0-2-2zm7 2v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1"/>',download:'<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z"/>',upload:'<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708z"/>',table:'<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"/>',"bar-chart":'<path d="M4 11H2v3h2zm5-4H7v7h2zm5-5v12h-2V2zm-2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM6 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm-5 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1z"/>',"graph-up":'<path fill-rule="evenodd" d="M0 0h1v15h15v1H0zm14.817 3.113a.5.5 0 0 1 .07.704l-4.5 5.5a.5.5 0 0 1-.74.037L7.06 6.767l-3.656 5.027a.5.5 0 0 1-.808-.588l4-5.5a.5.5 0 0 1 .758-.06l2.609 2.61 4.15-5.073a.5.5 0 0 1 .704-.07"/>',"pie-chart":'<path d="M7.5 1.018a7 7 0 0 0-4.79 11.566L7.5 7.793zm1 0V7.5h6.482A7 7 0 0 0 8.5 1.018M14.982 8.5H8.207l-4.79 4.79A7 7 0 0 0 14.982 8.5M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8"/>',"check-circle-fill":'<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>',"exclamation-triangle-fill":'<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>',"x-circle-fill":'<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z"/>',"info-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/>',"lock-fill":'<path fill-rule="evenodd" d="M8 0a4 4 0 0 1 4 4v2.05a2.5 2.5 0 0 1 2 2.45v5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 13.5v-5a2.5 2.5 0 0 1 2-2.45V4a4 4 0 0 1 4-4m0 1a3 3 0 0 0-3 3v2h6V4a3 3 0 0 0-3-3"/>',unlock:'<path fill-rule="evenodd" d="M12 0a4 4 0 0 1 4 4v2.5h-1V4a3 3 0 1 0-6 0v2h.5A2.5 2.5 0 0 1 12 8.5v5A2.5 2.5 0 0 1 9.5 16h-7A2.5 2.5 0 0 1 0 13.5v-5A2.5 2.5 0 0 1 2.5 6H8V4a4 4 0 0 1 4-4M2.5 7A1.5 1.5 0 0 0 1 8.5v5A1.5 1.5 0 0 0 2.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 9.5 7z"/>',asterisk:'<path d="M8 0a1 1 0 0 1 1 1v5.268l4.562-2.634a1 1 0 1 1 1 1.732L10 8l4.562 2.634a1 1 0 1 1-1 1.732L9 9.732V15a1 1 0 1 1-2 0V9.732l-4.562 2.634a1 1 0 1 1-1-1.732L6 8 1.438 5.366a1 1 0 0 1 1-1.732L7 6.268V1a1 1 0 0 1 1-1"/>',calculator:'<path d="M12 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/><path d="M4 2.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5zm0 4a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z"/>',gear:'<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"/>',list:'<path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5"/>',"three-dots-vertical":'<path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>',"three-dots":'<path d="M3 9.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>',plus:'<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>',dash:'<path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8"/>',"question-circle":'<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286m1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94"/>',"eye-reveal":'<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8z"/><path d="M8 5.5A2.5 2.5 0 1 0 8 10.5 2.5 2.5 0 0 0 8 5.5zm0 4A1.5 1.5 0 1 1 8 6.5a1.5 1.5 0 0 1 0 3z" fill="#fff"/>'};Object.keys(gt).length;const ls={"sort.asc":"sort-up","sort.desc":"sort-down","sort.none":"chevron-expand",filter:"funnel","filter.active":"funnel-fill",search:"search","row.add":"plus-lg","row.delete":"trash3",delete:"trash3","row.drag":"grip-vertical","column.drag":"grip-horizontal",expand:"chevron-right",collapse:"chevron-down","tree.expand":"chevron-right","tree.collapse":"chevron-down","mask.reveal":"eye-reveal","mask.show":"eye","mask.hide":"eye-slash","export.excel":"filetype-xlsx","export.csv":"filetype-csv","export.pdf":"filetype-pdf","export.json":"filetype-json",export:"download",import:"upload",print:"printer",table:"table",edit:"pencil",copy:"clipboard",paste:"clipboard-check",clear:"eraser",check:"check-lg",close:"x-lg",add:"plus",remove:"dash","select.all":"check-all","select.none":"square","select.check":"check-square","select.indeterminate":"dash-square",pin:"pin-angle","pin.active":"pin-angle-fill","status.error":"x-circle-fill","status.warning":"exclamation-triangle-fill","status.success":"check-circle-fill","status.info":"info-circle","status.lock":"lock-fill","status.unlock":"unlock",required:"asterisk",chart:"bar-chart","chart.bar":"bar-chart","chart.line":"graph-up","chart.pie":"pie-chart",formula:"calculator","nav.first":"chevron-double-left","nav.prev":"chevron-left","nav.next":"chevron-right","nav.last":"chevron-double-right","nav.up":"arrow-up","nav.down":"arrow-down",refresh:"arrow-clockwise",menu:"list",more:"three-dots-vertical","more.horizontal":"three-dots",settings:"gear",help:"question-circle"},ei="";function ti(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}class tt{constructor(e,t){if(this._roles=new Map,this._parent=t,e)for(const[s,o]of Object.entries(e))this.register(s,o)}register(e,t){const s=Object.prototype.hasOwnProperty.call(gt,t)?gt[t]:t;return this._roles.set(e,s),this}has(e){var t;return this._roles.has(e)||(((t=this._parent)==null?void 0:t.has(e))??!1)}resolveBody(e){const t=this._roles.get(e);return t!==void 0?t:this._parent?this._parent.resolveBody(e):null}child(){return new tt(void 0,this)}render(e,t){const s=this.resolveBody(e)??ei,o=t==null?void 0:t.size,i=o!=null?` width="${o}" height="${o}"`:"",r=t==null?void 0:t.title,a=r?`<title>${ti(r)}</title>`:"",d=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Qs}"${i} fill="currentColor"${r?' role="img"':""} style="stroke-linejoin:var(--og-icon-corner, miter)">${a}${s}</svg>`;return t!=null&&t.el?new DOMParser().parseFromString(d,"image/svg+xml").documentElement:d}roles(){return[...this._roles.keys()]}}const Me=new tt(ls);function si(n,e){return Me.render(n,e)}function Te(n,e,t){return n.t?n.t(e,t):z(e,t)}function ds(n){if(n.hasCellFormula)return null;const e=n.column;if(!e.formula)return null;const t=e.formulaPrecision??30;try{let s;return typeof e.formula=="function"?s=e.formula(n.row,v):s=as(e.formula,n.row,t),s instanceof v?e.precision!=null?s.toFixed(e.precision):s.toString():typeof s=="string"?s:e.precision!=null?v.from(s).toFixed(e.precision):String(s)}catch(s){return console.warn("[OpenGrid] Formula error:",s),"#ERR"}}function ii(n,e,t,s,o,i){if(n==null||n==="")return"";let r=Number(n);if(isNaN(r))return String(n);if(t!=null&&(r=Ws(r,t)),s)try{return new Intl.NumberFormat(void 0,{style:"currency",currency:s,...t!=null?{minimumFractionDigits:t,maximumFractionDigits:t}:{}}).format(r)}catch{}if(!e)return t!=null?r.toFixed(t):String(r);const a=e.indexOf(";"),l=a>=0?e.slice(a+1):null,d=r<0&&l!=null?l:a>=0?e.slice(0,a):e,c=r<0&&l!=null?Math.abs(r):r,h=d.match(/[#0][#0,]*(?:\.[#0]+)?/);if(!h)return String(r);const u=h[0],g=d.slice(0,h.index),p=d.slice(h.index+u.length),f=u.includes(","),w=u.includes(".")?u.split(".")[1].length:t??0,m=c.toLocaleString("ko-KR",{minimumFractionDigits:w,maximumFractionDigits:w,useGrouping:f});return g+m+p}function cs(n,e="yyyy-MM-dd",t,s){if(!n)return"";const o=n instanceof Date?n:new Date(n);if(isNaN(o.getTime()))return String(n);const i=o.getFullYear(),r=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");return e.replace("yyyy",String(i)).replace("MM",r).replace("dd",a)}function oi(n,e,t,s){const o=pt(n,e.mask),i=document.createElement("span");i.style.cssText="display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";const r=document.createElement("span");r.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:monospace;letter-spacing:0.4px;color:var(--og-mask-text,#888);",r.textContent=o;const a=document.createElement("button");return a.title=Te(s,"cell.revealTooltip"),a.setAttribute("aria-label",Te(s,"cell.revealAria")),a.innerHTML=Me.render("mask.reveal",{size:13}),a.style.cssText=`flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:${Ie.radius(3)};display:flex;align-items:center;`,a.addEventListener("mouseover",()=>{a.style.color="var(--og-primary,#1976d2)",a.style.background="rgba(25,118,210,0.08)"}),a.addEventListener("mouseout",()=>{a.style.color="#c0c0c0",a.style.background="none"}),a.addEventListener("click",l=>{l.stopPropagation(),r.textContent=n,r.style.fontFamily="",r.style.letterSpacing="",r.style.color="",a.remove(),(e._maskRevealedRows??(e._maskRevealedRows=new Set)).add(t)}),i.appendChild(r),i.appendChild(a),i}class De{render(e){var l;const t=document.createElement("span");t.className="og-cell-text";const s=ds(e);if(s!==null)return t.textContent=s,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t;const{value:o,column:i,rowIndex:r}=e;if(e.displayValue!=null)return t.textContent=e.displayValue,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t;let a;if(i.valueMap&&o!=null&&i.valueMap[o]?a=i.valueMap[o]:a=o==null?"":String(o),i.mask){const d=i._maskRevealed===!0,c=((l=i._maskRevealedRows)==null?void 0:l.has(r))===!0;if(!d&&!c)return oi(a,i,r,e)}return t.textContent=a,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t}}class ri{constructor(e=[],t){this._opts=e.map(s=>typeof s=="string"?{label:s,value:s}:{label:s.label??s.text??String(s.value??""),value:s.value}),this._fn=t??null}render(e){const t=document.createElement("span");t.className="og-cell-text",t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";const s=e.value;if(s==null||s==="")return t;const o=String(s),r=(this._fn?this._fn(e.row,e.rowIndex).map(a=>typeof a=="string"?{label:a,value:a}:{label:a.label??a.text??String(a.value??""),value:a.value}):this._opts).find(a=>String(a.value)===o);return t.textContent=r?r.label:o,t}}class ni{render(e){const t=document.createElement("span");t.className="og-cell-number";const s=ds(e);if(s!==null)return t.textContent=s,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t;if(e.displayFormatter){const o=e.displayFormatter(e.value,e.column.field??"",e.row);if(o!=null)return t.textContent=o,t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t}return t.textContent=ii(e.value,e.column.format??"#,##0",e.column.precision,e.column.currency,e.column.field,e.row),t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",t}}class ai{render(e){const t=document.createElement("span");t.className="og-cell-date";const s=e.displayFormatter?e.displayFormatter(e.value,e.column.field??"",e.row):null;return s!=null?t.textContent=s:t.textContent=cs(e.value,e.column.format,e.column.field,e.row),t.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",t}}class hs{render(e){const t=document.createElement("span");t.className="og-cell-checkbox",t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("input");return s.type="checkbox",s.checked=!!e.value,s.disabled=!0,s.style.cssText+="cursor:pointer;pointer-events:none;",t.appendChild(s),t}}class li{constructor(e){this.def=e}render(e){var r,a,l,d;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("button");s.className=`og-cell-btn${(r=this.def)!=null&&r.buttonClass?" "+this.def.buttonClass:""}`;const o=(a=this.def)==null?void 0:a.label,i=typeof o=="function"?o(e.value,e.row):o??String(e.value??"btn");if(s.style.cssText=`
|
|
18
|
-
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
19
|
-
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
20
|
-
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
21
|
-
${((l=this.def)==null?void 0:l.style)??""}
|
|
22
|
-
`,(d=this.def)!=null&&d.icon){s.style.display="inline-flex",s.style.alignItems="center",s.style.gap="4px";const c=document.createElement("span");c.style.cssText="display:inline-flex;flex-shrink:0;",c.innerHTML=Me.render(this.def.icon,{size:13});const h=document.createElement("span");h.textContent=i,this.def.iconPos==="right"?(s.appendChild(h),s.appendChild(c)):(s.appendChild(c),s.appendChild(h))}else s.textContent=i;return s.addEventListener("mouseover",()=>s.style.background="var(--og-primary-light,#e3f2fd)"),s.addEventListener("mouseout",()=>s.style.background="var(--og-row-bg,#fff)"),t.appendChild(s),t}}class di{constructor(e,t){this.colorMap=e,this.labelMap=t}render(e){var a,l,d;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;height:100%;";const s=document.createElement("span"),o=e.value==null?"":String(e.value),i=((a=this.labelMap)==null?void 0:a[o])??((l=e.column.valueMap)==null?void 0:l[o])??o;s.textContent=i;const r=((d=this.colorMap)==null?void 0:d[o])??"#666";return s.style.cssText=`
|
|
23
|
-
display:inline-block;padding:2px 8px;border-radius:${Ie.radius(12)};font-size:11px;
|
|
24
|
-
background:${r}22;color:${r};border:1px solid ${r}66;
|
|
25
|
-
white-space:nowrap;
|
|
26
|
-
`,t.appendChild(s),t}}class ci{constructor(e,t){this.hrefFn=e,this.target=t}render(e){const t=document.createElement("a");return t.className="og-cell-link",t.textContent=e.value==null?"":String(e.value),t.href=this.hrefFn?this.hrefFn(e.value,e.row):"#",this.target&&(t.target=this.target),t.style.cssText="color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",this.hrefFn||t.addEventListener("click",s=>s.preventDefault()),t}}class hi{constructor(e){this.templateFn=e}render(e){const t=document.createElement("div");return t.className="og-cell-template",t.style.cssText="display:flex;align-items:center;height:100%;overflow:hidden;",t.innerHTML=this.templateFn(e.value,e.row,e.rowIndex),t}}class ui{constructor(e){this.def=e}render(e){var d,c,h,u,g;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("img"),o=(d=this.def)!=null&&d.srcFn?this.def.srcFn(e.value,e.row):String(e.value??"");s.src=o;const i=((c=this.def)==null?void 0:c.width)??28,r=((h=this.def)==null?void 0:h.height)??28,a=((u=this.def)==null?void 0:u.radius)??4;s.style.cssText=`width:${i}px;height:${r}px;object-fit:cover;border-radius:${Ie.radius(a)};display:block;`;const l=(g=this.def)==null?void 0:g.alt;return s.alt=typeof l=="function"?l(e.value,e.row):l??"",s.onerror=()=>{s.style.display="none"},t.appendChild(s),t}}class pi{constructor(e){this.def=e}render(e){var d,c,h,u;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";const s=((d=this.def)==null?void 0:d.max)??100,o=Number(e.value)||0,i=Math.min(100,Math.max(0,o/s*100)),r=(c=this.def)!=null&&c.colorFn?this.def.colorFn(o):((h=this.def)==null?void 0:h.color)??"var(--og-primary,#1976d2)",a=document.createElement("div");a.className="og-progress-track",a.style.cssText=`flex:1;height:10px;background:#e0e0e0;border-radius:${Ie.radius(5)};overflow:hidden;`;const l=document.createElement("div");if(l.className="og-progress-fill",l.style.cssText=`width:${i}%;height:100%;background:${r};border-radius:${Ie.radius(5)};`,a.appendChild(l),t.appendChild(a),((u=this.def)==null?void 0:u.showLabel)!==!1){const g=document.createElement("span");g.style.cssText="font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;",g.textContent=`${Math.round(i)}%`,t.appendChild(g)}return t}}class gi{constructor(e){this.def=e}render(e){var c,h,u,g;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=Array.isArray(e.value)?e.value.map(Number):[];if(!s.length)return t.textContent="-",t;const o=((c=this.def)==null?void 0:c.width)??80,i=((h=this.def)==null?void 0:h.height)??22,r=((u=this.def)==null?void 0:u.color)??"#1976d2",a=((g=this.def)==null?void 0:g.chartType)??"bar",l=document.createElement("canvas");l.width=o,l.height=i,l.style.cssText="display:block;";const d=l.getContext("2d");if(d){const p=Math.max(...s,1),f=Math.min(...s,0),w=p-f||1,m=s.length;if(a==="bar"){const _=o/m;s.forEach((y,M)=>{const k=(y-f)/w*(i-2);d.fillStyle=r,d.fillRect(M*_+1,i-k-1,_-2,k)})}else{const _=s.map((y,M)=>({x:M/(m-1||1)*o,y:i-(y-f)/w*(i-4)-2}));a==="area"&&(d.fillStyle=r+"33",d.beginPath(),d.moveTo(_[0].x,i),_.forEach(y=>d.lineTo(y.x,y.y)),d.lineTo(_[_.length-1].x,i),d.closePath(),d.fill()),d.strokeStyle=r,d.lineWidth=1.5,d.beginPath(),_.forEach((y,M)=>M===0?d.moveTo(y.x,y.y):d.lineTo(y.x,y.y)),d.stroke()}}return t.appendChild(l),t}}class fi{render(e){const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=!!e.value,o=document.createElement("span");o.className="og-switch"+(s?" og-switch--on":""),o.style.cssText=`display:inline-block;width:34px;height:18px;border-radius:${Ie.radius(9)};
|
|
27
|
-
background:${s?"var(--og-primary,#1976d2)":"#bdbdbd"};
|
|
28
|
-
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;const i=document.createElement("span");return i.style.cssText=`position:absolute;top:2px;left:${s?"16px":"2px"};
|
|
29
|
-
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
30
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,o.appendChild(i),t.appendChild(o),t}}class _i{constructor(e){this.def=e}render(e){var r,a;const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:1px;height:100%;";const s=((r=this.def)==null?void 0:r.max)??5,o=Math.round(Number(e.value)||0),i=((a=this.def)==null?void 0:a.color)??"#ffa000";for(let l=1;l<=s;l++){const d=document.createElement("span");d.textContent="★",d.style.cssText=`font-size:14px;color:${l<=o?i:"#e0e0e0"};line-height:1;`,t.appendChild(d)}return t}}class mi{render(e){const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";const s=document.createElement("input");return s.type="radio",s.checked=!!e.value,s.setAttribute("aria-checked",e.value?"true":"false"),s.setAttribute("aria-label",e.column.header??Te(e,"cell.radioAria")),e.column.group&&(s.name=`og-radio-${e.rowIndex}-${e.column.group}`),s.style.cssText="width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);",t.appendChild(s),t}}class wi{render(e){const t=document.createElement("span");if(t.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;",!e.value)return t;const s=document.createElement("img");return s.src=String(e.value),s.alt=e.column.alt??e.column.field,s.style.cssText="max-width:100%;max-height:100%;object-fit:contain;display:block;",s.setAttribute("role","img"),t.appendChild(s),t}}function yi(n){const e=document.createElement("div");return e.innerHTML=n,e.querySelectorAll("script,iframe,object,embed").forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(const s of[...t.attributes])s.name.startsWith("on")&&t.removeAttribute(s.name);if(t.tagName==="A"){const s=t.getAttribute("href")??"";/^javascript:/i.test(s)&&t.removeAttribute("href")}}),e.innerHTML}class vi{render(e){const t=document.createElement("span");t.style.cssText="display:block;overflow:hidden;width:100%;";const s=e.column.sanitize!==!1,o=String(e.value??"");return t.innerHTML=s?yi(o):o,t}}const bi=["212222","222122","222221","121223","121322","131222","122213","122312","132212","221213","221312","231212","112232","122132","122231","113222","123122","123221","223211","221132","221231","213212","223112","312131","311222","321122","321221","312212","322112","322211","212123","212321","232121","111323","131123","131321","112313","132113","132311","211313","231113","231311","112133","112331","132131","113123","113321","133121","313121","211331","231131","213113","213311","213131","311123","311321","331121","312113","312311","332111","314111","221411","431111","111224","111422","121124","121421","141122","141221","112214","112412","122114","122411","142112","142211","241211","221114","413111","241112","134111","111242","121142","121241","114212","124112","124211","411212","421112","421211","212141","214121","412121","111143","111341","131141","114113","114311","411113","411311","113141","114131","311141","411131","211412","211214","211232"],xi="2331112";function It(n){let e="",t=!0;for(const s of n)e+=(t?"1":"0").repeat(+s),t=!t;return e}function Ci(n){const e=[104];for(const s of n){const o=s.charCodeAt(0)-32;o>=0&&o<=94&&e.push(o)}let t=104;for(let s=1;s<e.length;s++)t+=e[s]*s;return e.push(t%103),e.map(s=>It(bi[s])).join("")+It(xi)+"11"}class Ri{render(e){const t=String(e.value??""),s=e.column.barcodeHeight??28,o=document.createElement("div");o.style.cssText="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;",o.setAttribute("role","img"),o.setAttribute("aria-label",Te(e,"cell.barcodeAria",{value:t})),o.innerHTML=Mi(t,s);const i=document.createElement("span");return i.textContent=t,i.style.cssText="font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;",o.appendChild(i),o}}function Mi(n,e){if(!n)return"";const t=Ci(n),s=1.4,o=6,i=t.length*s+o*2,r=[];let a=0,l=o;for(;a<t.length;)if(t[a]==="1"){let d=0;for(;a+d<t.length&&t[a+d]==="1";)d++;r.push(`<rect x="${l.toFixed(2)}" y="0" width="${(d*s).toFixed(2)}" height="${e}"/>`),l+=d*s,a+=d}else l+=s,a++;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i.toFixed(2)} ${e}" width="${i.toFixed(2)}" height="${e}" style="display:block" aria-hidden="true"><g fill="currentColor">${r.join("")}</g></svg>`}const us=new Map;function Y(n,e){us.set(n,e)}Y("number",()=>new ni);Y("date",()=>new ai);Y("boolean",()=>new hs);Y("checkbox",()=>new hs);Y("radio",()=>new mi);Y("img",()=>new wi);Y("html",()=>new vi);Y("barcode",()=>new Ri);Y("switch",()=>new fi);Y("select",n=>new ri(n.options??[],n.optionsFn));Y("button",(n,e)=>new li(e));Y("link",(n,e)=>new ci(e==null?void 0:e.hrefFn,e==null?void 0:e.target));Y("badge",(n,e)=>new di(e==null?void 0:e.colorMap,e?e.labelMap??e.valueMap:void 0));Y("image",(n,e)=>e?new ui(e):new De);Y("progress",(n,e)=>e?new pi(e):new De);Y("sparkline",(n,e)=>e?new gi(e):new De);Y("rating",(n,e)=>e?new _i(e):new De);Y("template",(n,e)=>e?new hi(e.templateFn):new De);function ki(n){const e=n.renderer;let t,s;e?typeof e=="string"?(t=e,s=void 0):(t=e.type,s=e):(t=String(n.type??""),s=void 0);const o=us.get(t);return o?o(n,s):new De}const Ei={"#ERR":"formulaError.err","#REF":"formulaError.ref","#CYCLE":"formulaError.cycle","#DIV0":"formulaError.div0","#NAME":"formulaError.name","#VALUE":"formulaError.value","#NUM":"formulaError.num"};class Fi{constructor(e,t,s,o){this._cellMap=new Map,this._root=e,this._opts=t,this._cbs=s,this._ap=o??new vt(new Ze(t.theme??"default")),this._header=T("div","og-header"),this._header.style.cssText=`flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:${this._ap.divider()};scrollbar-width:none;`,this._bodyWrap=T("div","og-body-wrapper"),this._bodyWrap.style.cssText="flex:1;overflow:auto;position:relative;",this._bodyWrap.style.setProperty("--scrollbar-size","8px"),this._body=T("div","og-body"),this._body.style.cssText="position:relative;",this._bodyWrap.appendChild(this._body),e.appendChild(this._header),e.appendChild(this._bodyWrap),this._bodyWrap.addEventListener("scroll",()=>{this._header.scrollLeft=this._bodyWrap.scrollLeft},{passive:!0})}get bodyWrapper(){return this._bodyWrap}_t(e,t){return this._cbs.t?this._cbs.t(e,t):z(e,t)}updateSize(e,t){this._bodyWrap.style.height=`${e-t}px`}getHeaderHeight(){return this._header.offsetHeight}renderHeader(e,t,s,o,i){var w,m,_,y;this._header.innerHTML="";const r=this._ap,a=i._frozenCount??0,l=!!((w=i.masterDetail)!=null&&w.enabled)&&(((m=i.masterDetail)==null?void 0:m.toggle)??"expander-col")==="expander-col",d=28;let c=0;i.stateColumn&&(c+=24),i.draggable&&(c+=18),i.rowNumber&&(c+=44),i.checkColumn&&(c+=36),l&&(c+=d);const h=c+t.reduce((M,k,b)=>M+(s[b]??i.defaultColumnWidth),0);this._header.style.background="var(--og-header-bg,#f5f5f5)";const u=T("table","og-header-table");u.setAttribute("role","presentation"),u.style.cssText=`table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${h}px;background:var(--og-header-bg,#f5f5f5);`;const g=e.length;let p=0;const f=(M,k,b,x="")=>{const F=T("th",`og-header-cell og-extra-col ${x}`);F.setAttribute("rowspan",String(g)),F.textContent=b,Dt(F,{width:`${k}px`,minWidth:`${k}px`,textAlign:"center",borderRight:r.border(),borderBottom:r.border(),borderTop:"0",borderLeft:"0",lineHeight:"normal",verticalAlign:"middle",padding:"0",fontSize:"11px",color:"#999",userSelect:"none",boxSizing:"border-box",background:"var(--og-header-bg,#f5f5f5)"}),a>0&&(F.style.position="sticky",F.style.left=`${p}px`,F.style.zIndex="4"),p+=k,M.appendChild(F)};for(let M=0;M<e.length;M++){const k=T("tr","og-header-row");if(k.style.height=`${i.headerHeight}px`,M===0){if(i.stateColumn&&f(k,24,""),i.draggable&&f(k,18,""),i.rowNumber&&f(k,44,"No"),i.checkColumn){const b=T("th","og-header-cell og-extra-col");b.setAttribute("rowspan",String(g)),b.style.cssText=`width:36px;min-width:36px;text-align:center;border-right:${r.border()};border-bottom:${r.border()};border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;`,a>0&&(b.style.position="sticky",b.style.left=`${p}px`,b.style.zIndex="4"),p+=36;const x=document.createElement("input");x.type="checkbox",x.setAttribute("aria-label",this._t("row.selectAllAria")),x.style.cssText="width:16px;height:16px;",x.addEventListener("change",()=>this._cbs.onAllCheck(x.checked)),b.appendChild(x),k.appendChild(b)}l&&f(k,d,"","og-detail-toggle-col")}for(const b of e[M]??[]){const x=T("th","og-header-cell"),F=b.column;b.colSpan>1&&(x.colSpan=b.colSpan),b.rowSpan>1&&(x.rowSpan=b.rowSpan);const S=b.colSpan===1?t.findIndex(E=>E.field===F.field):-1;if(b.colSpan===1){const E=S>=0?s[S]??i.defaultColumnWidth:F.width??i.defaultColumnWidth;x.style.width=`${E}px`,x.style.minWidth=`${E}px`}const P=o.find(E=>E.field===F.field),re=F.sortable!==!1&&i.sortable&&b.colSpan===1;if(x.setAttribute("role","columnheader"),x.setAttribute("scope","col"),re&&(x.setAttribute("aria-sort",P?P.dir==="asc"?"ascending":"descending":"none"),x.tabIndex=S===0?0:-1,x.addEventListener("keydown",E=>{if(E.key==="Enter"||E.key===" ")E.preventDefault(),this._cbs.onHeaderClick(F.field,E.shiftKey);else if(E.key==="ArrowRight"){E.preventDefault();const O=x.nextElementSibling;(O==null?void 0:O.tagName)==="TH"&&O.focus()}else if(E.key==="ArrowLeft"){E.preventDefault();const O=x.previousElementSibling;(O==null?void 0:O.tagName)==="TH"&&O.focus()}})),S>=0&&S<a){let E=0;i.stateColumn&&(E+=24),i.draggable&&(E+=18),i.rowNumber&&(E+=44),i.checkColumn&&(E+=36),l&&(E+=d);for(let O=0;O<S;O++)E+=s[O]??i.defaultColumnWidth;x.classList.add("og-frozen"),S===a-1&&x.classList.add("og-frozen-last"),x.style.left=`${E}px`}const ae=F.header??F.field,ye=typeof ae=="string"&&ae.indexOf(`
|
|
31
|
-
`)>=0,H=F.headerWrap===!0||ye;Dt(x,{padding:"4px 8px",boxSizing:"border-box",background:"var(--og-header-bg)",color:"var(--og-header-color)",lineHeight:H?"1.3":"normal",verticalAlign:"middle",fontSize:"var(--og-font-size)",textAlign:F.headerAlign??"center",borderTop:"0",borderLeft:"0",borderRight:r.border(),borderBottom:r.border(),userSelect:"none",cursor:re?"pointer":"default",whiteSpace:H?"normal":"nowrap",overflow:H?"visible":"hidden",textOverflow:H?"clip":"ellipsis",wordBreak:H?"break-word":"normal",position:"relative"}),x.title=(typeof F.tooltip=="string"?F.tooltip:ae)??"";const V=T("span");if(H?(V.style.cssText="overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;",String(ae).split(`
|
|
32
|
-
`).forEach((O,le)=>{le>0&&V.appendChild(document.createElement("br")),V.appendChild(document.createTextNode(O))})):(V.textContent=ae,V.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"),x.appendChild(V),P){x.classList.add("og-sorted");const E=T("span","og-sort-icon");E.textContent=P.dir==="asc"?" ↑":" ↓",x.appendChild(E)}if(F.filterable!==!1&&i.filterable&&b.colSpan===1){const E=T("span","og-filter-icon"),O=(((y=(_=i._activeFilters)==null?void 0:_[F.field])==null?void 0:y.length)??0)>0;E.textContent=O?"⊿":"▿",E.title=this._t("grid.filterTooltip"),E.style.cssText="margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;",O&&E.classList.add("og-filter-icon--active"),E.addEventListener("click",le=>{le.stopPropagation(),this._cbs.onFilterIconClick(F.field,E)}),x.appendChild(E)}if(F.resizable!==!1){const E=T("div","og-resize-handle");E.style.cssText="position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;",x.appendChild(E);const O=S;Si(E,x,le=>{O>=0&&this._cbs.onColResize(O,le)})}i.columnReorder&&S>=0&&b.colSpan===1&&(x.draggable=!0,x.addEventListener("dragstart",E=>{var O;this._cbs.onColDragStart(S),x.classList.add("og-col-dragging"),(O=E.dataTransfer)==null||O.setData("text/plain",String(S))}),x.addEventListener("dragend",()=>{x.classList.remove("og-col-dragging"),this._header.querySelectorAll(".og-col-drop-over").forEach(E=>E.classList.remove("og-col-drop-over"))}),x.addEventListener("dragover",E=>{E.preventDefault();const O=this._cbs.getColDragIdx();O!==null&&O!==S&&(this._header.querySelectorAll(".og-col-drop-over").forEach(le=>le.classList.remove("og-col-drop-over")),x.classList.add("og-col-drop-over"))}),x.addEventListener("dragleave",()=>{x.classList.remove("og-col-drop-over")}),x.addEventListener("drop",E=>{E.preventDefault(),x.classList.remove("og-col-drop-over"),this._cbs.onColDrop(S)})),re&&x.addEventListener("click",E=>{E.target.classList.contains("og-resize-handle")||this._cbs.onHeaderClick(F.field,E.shiftKey)}),k.appendChild(x)}u.appendChild(k)}this._header.appendChild(u)}renderBody(e){var P,re,ae,ye,H,V,ee,E,O,le,$e,ke,Ee,Ke,Ue;const{startIndex:t,endIndex:s,data:o,leaves:i,widths:r,offsetY:a,totalHeight:l,selectedRows:d,checkedRows:c,groupFlatRows:h=null,onGroupToggle:u,onTreeToggle:g,extraOpts:p={},mergeEngine:f,detailApi:w}=e;let m=e.opts;const _=this._ap;Object.keys(p).length&&(m={...m,...p}),w==null||w.onBeforeTeardown(),this._body.innerHTML="",this._cellMap.clear();const y=m.autoHeight===!0;this._body.classList.toggle("og-autoheight",y),this._body.style.height=y?"":`${l}px`;const M=m._frozenCount??0,k=!!w&&(w.toggleMode??"expander-col")==="expander-col",b=28;let x=0;m.stateColumn&&(x+=24),m.draggable&&(x+=18),m.rowNumber&&(x+=44),m.checkColumn&&(x+=36),k&&(x+=b);const F=x+i.reduce((L,W,Fe)=>L+(r[Fe]??m.defaultColumnWidth),0);if(this._body.style.minWidth=`${F}px`,s<t)return;const S=document.createDocumentFragment();if(h&&w)for(let L=t-1;L>=0;L--){const W=h[L];if(!(W&&W._isDetailFiller===!0)){if(W&&W._isDetailHead===!0&&L+W._span-1>=t){const Fe=a+(L-t)*m.rowHeight;this._appendDetailPanel(S,W._rowId,Fe,W._span*m.rowHeight,F,w)}break}}for(let L=t;L<=s;L++){const W=h?h[L]:null;if(W&&W._isDetailFiller===!0)continue;if(W&&W._isDetailHead===!0&&w){const R=W,I=a+(L-t)*m.rowHeight;this._appendDetailPanel(S,R._rowId,I,R._span*m.rowHeight,F,w);continue}if(W&&W._isDetailHead===!0)continue;const Fe=W&&W._isGroup===!0,Rt=W&&W._isTree===!0;if(Fe){const R=W,I=`__${R._groupField}:${R._groupValue}`,N=T("div","og-group-row"),me=a+(L-t)*m.rowHeight;N.style.cssText=[y?"":`top:${me}px;height:${m.rowHeight}px;`,"display:flex;align-items:stretch;cursor:pointer;",`padding-left:${4+R._depth*12}px;`,"background:var(--og-header-bg,#f5f5f5);",`border:0;border-bottom:${_.divider()};`].join(""),N.setAttribute("role","row"),N.setAttribute("aria-expanded",R._expanded?"true":"false"),N.setAttribute("aria-rowindex",String(L+1)),N.setAttribute("aria-level",String(R._depth+1));let q=0;if(m.stateColumn&&(q+=24),m.draggable&&(q+=18),m.rowNumber&&(q+=44),m.checkColumn&&(q+=36),k&&(q+=b),q>0){const C=T("div","og-group-state-cell");C.style.cssText=[`width:${q}px;min-width:${q}px;flex-shrink:0;`,"display:flex;align-items:center;justify-content:center;","font-size:10px;font-weight:700;gap:2px;",`border-right:${_.border()};`].join("");const G=R._states??{added:0,edited:0,removed:0};if(G.added>0){const B=T("span");B.textContent=`+${G.added}`,B.style.cssText=`color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(B)}if(G.edited>0){const B=T("span");B.textContent=`M${G.edited}`,B.style.cssText=`color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(B)}if(G.removed>0){const B=T("span");B.textContent=`D${G.removed}`,B.style.cssText=`color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:${_.radius(3)};`,C.appendChild(B)}N.appendChild(C)}let J=!1;for(let C=0;C<i.length;C++){const G=i[C],B=r[C]??m.defaultColumnWidth,qe=R._summaryFmt!==void 0&&G.field in(R._summaryFmt??{}),se=T("div","og-group-cell");if(se.style.cssText=[`width:${B}px;min-width:${B}px;flex-shrink:0;`,`padding:${_.cellPadding()};box-sizing:border-box;overflow:hidden;`,`border-right:${_.border()};`,"display:flex;align-items:center;","white-space:nowrap;text-overflow:ellipsis;"].join(""),qe){const pe=R._summaryFmt[G.field];se.textContent=pe!==""?pe:"-",se.style.justifyContent="flex-end",se.style.color="var(--og-primary,#1976d2)",se.style.fontWeight="600"}else if(!J){J=!0;const pe=T("span","og-group-arrow");pe.textContent=R._expanded?"▾ ":"▸ ",pe.style.cssText="color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;",se.appendChild(pe);const ce=T("span","og-group-label");ce.textContent=this._t("group.badge",{label:R._groupLabel,count:R._childCount}),ce.style.cssText="overflow:hidden;text-overflow:ellipsis;font-weight:600;",se.appendChild(ce),se.style.gap="0"}N.appendChild(se)}N.addEventListener("click",()=>u==null?void 0:u(I)),S.appendChild(N);continue}const Z=Rt?W:null,de=Z?Z.data:h?W:o.getRowByIndex(L);if(!de)continue;const he=Rt||Fe?"none":o.getRowState(L),U=T("div","og-row");if(U.setAttribute("role","row"),U.setAttribute("aria-rowindex",String(L+1)),!y){const R=a+(L-t)*m.rowHeight;U.style.top=`${R}px`,U.style.height=`${m.rowHeight}px`}let te=L%2===0?"var(--og-row-bg,#fff)":"var(--og-row-alt-bg,#fafafa)";U.style.background=te,he==="added"&&U.classList.add("og-state-added"),he==="edited"&&U.classList.add("og-state-edited"),he==="removed"&&U.classList.add("og-state-removed"),d.has(L)&&U.classList.add("og-selected"),U.setAttribute("aria-selected",d.has(L)?"true":"false"),he==="added"&&(te="var(--og-row-added-bg,#e8f5e9)"),he==="edited"&&(te="var(--og-row-edited-bg,#fff8e1)"),he==="removed"&&(te="var(--og-row-removed-bg,#ffebee)"),d.has(L)&&(te="var(--og-row-selected-bg,#bbdefb)");const Is=L;U.addEventListener("click",R=>{this._cbs.onCellClick(Is,-1,R)});const Mt=new Map;let ue=0;if(m.stateColumn){const R=T("div","og-cell og-col-state"),I={added:"✚",edited:"✎",removed:"✖",none:""},N={added:"#2e7d32",edited:"#bf360c",removed:"#c62828",none:""};R.textContent=I[he]??"",R.style.color=N[he]??"",R.title=he,M>0&&(R.style.position="sticky",R.style.left=`${ue}px`,R.style.zIndex="2",R.style.background=te),ue+=24,U.appendChild(R)}const kt=this._cbs.getDndManager();if(m.draggable&&kt){const R=kt.attachHandle(U,L,m._totalRows??s+1);M>0&&(R.style.position="sticky",R.style.left=`${ue}px`,R.style.zIndex="2",R.style.background=te),ue+=18,U.appendChild(R)}if(m.rowNumber){const R=T("div","og-cell og-col-rownum");R.textContent=String(L+1),M>0&&(R.style.position="sticky",R.style.left=`${ue}px`,R.style.zIndex="2",R.style.background=te),ue+=44,U.appendChild(R)}if(m.checkColumn){const R=T("div","og-cell og-col-check"),I=document.createElement("input");I.type="checkbox",I.checked=c.has(L),I.setAttribute("aria-label",this._t("row.selectAria",{n:L+1})),I.addEventListener("click",N=>N.stopPropagation()),I.addEventListener("change",N=>{N.stopPropagation(),this._cbs.onRowCheck(L,I.checked)}),R.appendChild(I),M>0&&(R.style.position="sticky",R.style.left=`${ue}px`,R.style.zIndex="2",R.style.background=te),ue+=36,U.appendChild(R)}if(k){const R=T("div","og-cell og-col-detail-toggle");R.style.cssText="display:flex;align-items:center;justify-content:center;flex-shrink:0;box-sizing:border-box;";const I=w.getRowId(de),N=!!I&&w.isExpanded(I),me=w.getGlyph(N),q=T("span","og-detail-expander");q.textContent=me.glyph,q.title=me.title,q.setAttribute("role","button"),q.setAttribute("tabindex","0"),q.setAttribute("aria-label",me.ariaLabel),I&&q.setAttribute("aria-controls",`og-detail-${I}`),q.style.cssText="cursor:pointer;display:inline-flex;align-items:center;justify-content:center;min-width:22px;min-height:22px;user-select:none;line-height:1;";const J=I,C=L,G=B=>{B.stopPropagation(),J&&w.onToggle(C,J)};q.addEventListener("click",G),q.addEventListener("keydown",B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),G(B))}),R.appendChild(q),M>0&&(R.style.position="sticky",R.style.left=`${ue}px`,R.style.zIndex="2",R.style.background=te),R.style.width=`${b}px`,R.style.minWidth=`${b}px`,ue+=b,U.appendChild(R),I&&U.setAttribute("aria-expanded",N?"true":"false")}for(let R=0;R<i.length;R++){const I=i[R],N=r[R]??m.defaultColumnWidth,me=m.editable&&I.editable!==!1,q=R===0,J=f&&!f.isEmpty?f.getInfo(L,R):null;if(J!=null&&J.hidden){const A=T("div","og-cell og-cell--merge-ph");A.style.cssText=`width:${N}px;min-width:${N}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`,U.appendChild(A);continue}const C=T("div","og-cell");C.setAttribute("role","gridcell"),C.setAttribute("aria-colindex",String(R+1));const G=(J==null?void 0:J.rowSpan)??1,B=(J==null?void 0:J.colSpan)??1,qe=G>1?G*m.rowHeight:m.rowHeight;let se=N;if(B>1)for(let A=1;A<B;A++)se+=r[R+A]??m.defaultColumnWidth;const pe=R<M;let ce=0;if(pe){m.stateColumn&&(ce+=24),m.draggable&&(ce+=18),m.rowNumber&&(ce+=44),m.checkColumn&&(ce+=36),k&&(ce+=b);for(let A=0;A<R;A++)ce+=r[A]??m.defaultColumnWidth;C.classList.add("og-frozen-cell"),R===M-1&&C.classList.add("og-frozen-last")}C.style.width=`${se}px`,C.style.minWidth=`${se}px`,C.style.maxWidth=`${se}px`,G>1&&(C.style.height=`${qe}px`),pe&&(C.style.background=te),Z&&q&&(C.style.padding="0"),C.style.overflow="hidden",G>1?(C.style.height=`${qe}px`,C.style.position="absolute",C.style.zIndex="3",C.style.background=te&&te!=="inherit"?te:"var(--og-row-bg, #fff)",C.style.borderTop="0",C.style.borderLeft="0",C.style.borderBottom="1px solid var(--og-border-color, #e0e0e0)"):pe&&(C.style.position="sticky",C.style.left=`${ce}px`,C.style.zIndex="1"),I.type==="number"||I.align==="right"?C.classList.add("og-cell--right"):I.align==="center"&&C.classList.add("og-cell--center"),me&&C.classList.add("og-cell--editable"),I.wrap&&C.classList.add("og-cell--wrap"),me||C.setAttribute("aria-readonly","true"),B>1&&C.setAttribute("aria-colspan",String(B)),G>1&&C.setAttribute("aria-rowspan",String(G)),((P=m._focusCell)==null?void 0:P.ri)===L&&((re=m._focusCell)==null?void 0:re.ci)===R&&(C.classList.add("og-cell-focused"),C.tabIndex=-1);const it=m._rangeRects;it!=null&&it.some(A=>L>=A.startRow&&L<=A.endRow&&R>=A.startCol&&R<=A.endCol)&&(C.classList.add("og-range-selected"),C.style.background="var(--og-range-bg, rgba(25,118,210,0.12))");const we=de?de[I.field]:null;C.setAttribute("aria-label",`${I.header}: ${we==null?"":String(we)}`),I.tooltip!=null?C.title=typeof I.tooltip=="function"?String(I.tooltip(we,de)??""):String(I.tooltip):m.tooltips&&we!=null&&we!==""&&(C.title=String(we));const ge=((ye=(ae=this._cbs).getFormulaMeta)==null?void 0:ye.call(ae,L,I.field))??null;if(ge){const A=we==null?this._t("cell.emptyValue"):String(we);if(ge.error){const j=Ei[ge.error],fe=j?this._t(j):this._t("formulaError.fallback");C.setAttribute("aria-label",this._t("formula.ariaError",{src:ge.src,message:fe})),C.title=`${ge.error} — ${fe}`,C.style.color="var(--og-formula-error-color, #c62828)"}else{const j=ge.approx?this._t("formula.approxSuffix"):"";C.setAttribute("aria-label",this._t("formula.ariaValue",{src:ge.src,value:A,approx:j})),C.title=`${ge.src}${j}`}if(((H=m.formula)==null?void 0:H.cellMarker)!==!1){C.classList.add("og-formula-cell");const j=ge.error?"var(--og-formula-error-color, #c62828)":"var(--og-formula-marker-color, #1976d2)",fe=C.style.background||C.style.backgroundColor;C.style.backgroundImage=`linear-gradient(135deg, ${j} 0 6px, transparent 6px)`,C.style.backgroundRepeat="no-repeat",C.style.backgroundPosition="top right",C.style.backgroundSize="8px 8px",fe&&(C.style.backgroundColor=fe)}}const Et=(ee=(V=this._cbs).resolveRenderHook)==null?void 0:ee.call(V,"cellClass",L,I.field);Et&&(C.className+=" "+Et);const Ft=(O=(E=this._cbs).resolveRenderHook)==null?void 0:O.call(E,"ariaLabel",L,I.field);Ft!=null&&C.setAttribute("aria-label",String(Ft));let St=C;if(Z&&q){const A=T("div","og-tree-cell"),j=Z._ancestorHasMore??[];for(let oe=0;oe<Z._depth;oe++){const _e=T("span","og-tree-guide");j[oe]&&_e.classList.add("og-tree-guide--line"),A.appendChild(_e)}if(Z._depth>0){const oe=T("span","og-tree-connector");oe.classList.add(Z._isLastChild?"og-tree-connector--last":"og-tree-connector--mid"),A.appendChild(oe)}const fe=T("span","og-tree-toggle-wrap");if(!Z._hasChildren){const oe=T("span","og-tree-leaf-dot");fe.appendChild(oe)}A.appendChild(fe);const ie=document.createElement("i");if(Z._hasChildren){const oe=Tt(I.treeNodeIcon,de,!0,Z._expanded);ie.className=Z._expanded?`${oe} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle`:`${oe} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`,ie.setAttribute("role","button"),ie.setAttribute("tabindex","0"),ie.setAttribute("aria-expanded",Z._expanded?"true":"false"),ie.setAttribute("aria-label",this._t(Z._expanded?"tree.collapse":"tree.expand")),ie.addEventListener("click",_e=>{_e.stopPropagation(),g==null||g(Z._treeId)}),ie.addEventListener("keydown",_e=>{(_e.key==="Enter"||_e.key===" ")&&(_e.preventDefault(),_e.stopPropagation(),g==null||g(Z._treeId))})}else{const oe=Tt(I.treeNodeIcon,de,!1,!1);ie.setAttribute("aria-hidden","true"),ie.className=`${oe} og-tree-node-icon og-tree-node-icon--leaf`}A.appendChild(ie),C.appendChild(A),St=A}if(I.cellStyle){const A=de[I.field],j=typeof I.cellStyle=="function"?I.cellStyle(A,de,L):I.cellStyle;Object.assign(C.style,j)}const Ts=ki(I).render({value:de[I.field],row:de,rowIndex:L,column:I,colIndex:R,isSelected:d.has(L),rowState:he,displayValue:(($e=(le=this._cbs).resolveRenderHook)==null?void 0:$e.call(le,"displayText",L,I.field))??((Ee=(ke=this._cbs).getDisplayText)==null?void 0:Ee.call(ke,L,I.field))??null,displayFormatter:((Ue=(Ke=this._cbs).getDisplayFormatter)==null?void 0:Ue.call(Ke))??null,hasCellFormula:ge!=null,t:(A,j)=>this._t(A,j)});St.appendChild(Ts);const ve=L,be=R;if(C.addEventListener("click",A=>{A.stopPropagation(),this._cbs.onCellClick(ve,be,A)}),C.addEventListener("dblclick",A=>{A.stopPropagation(),this._cbs.onCellDblClick(ve,be,A)}),C.addEventListener("mouseover",A=>{A.stopPropagation(),this._cbs.onCellMouseOver(ve,be,A)}),C.addEventListener("mouseout",A=>{A.stopPropagation(),this._cbs.onCellMouseOut(ve,be,A)}),C.addEventListener("mousedown",A=>{A.stopPropagation(),this._cbs.onCellMouseDown(ve,be,A)}),C.addEventListener("mouseup",A=>{A.stopPropagation(),this._cbs.onCellMouseUp(ve,be,A)}),C.addEventListener("mousemove",A=>{A.stopPropagation(),this._cbs.onCellMouseMove(ve,be,A)}),Mt.set(R,C),G>1){const A=document.createElement("div");A.style.cssText=[`width:${N}px;min-width:${N}px;height:${m.rowHeight}px;`,"flex-shrink:0;box-sizing:border-box;",`border-right:${_.border()};`].join(""),U.appendChild(A);let j=0;m.stateColumn&&(j+=24),m.draggable&&(j+=18),m.rowNumber&&(j+=44),m.checkColumn&&(j+=36),k&&(j+=b);for(let ie=0;ie<R;ie++)j+=r[ie]??m.defaultColumnWidth;const fe=a+(L-t)*m.rowHeight;C.style.left=`${j}px`,C.style.top=`${fe}px`,S.appendChild(C)}else U.appendChild(C)}this._cellMap.set(L,Mt),S.appendChild(U)}if(o.rowCount===0){const L=T("div","og-empty-message");L.textContent=this._t("grid.emptyMessage"),L.style.cssText="width:100%;",S.appendChild(L)}this._body.appendChild(S)}getCellEl(e,t){var s;return(s=this._cellMap.get(e))==null?void 0:s.get(t)}_appendDetailPanel(e,t,s,o,i,r){const a=T("div","og-detail-panel og-detail-panel-intro");a.dataset.ogRowId=t,a.id=`og-detail-${t}`,a.setAttribute("role","region"),a.setAttribute("aria-label",r.ariaLabel),a.style.cssText=["position:absolute;left:0;",`top:${s}px;width:${i}px;height:${o}px;`,"box-sizing:border-box;","overflow-y:auto;overflow-x:auto;","overscroll-behavior:contain;","background:var(--og-detail-bg,#fff);",`border:0;border-bottom:${this._ap.divider()};`,"z-index:var(--og-z-detail,2);"].join("");const l=r.getPanelHost(t);a.appendChild(l),e.appendChild(a)}destroy(){this._root.innerHTML=""}}function Tt(n,e,t,s){let o;return n?typeof n=="function"?o=n(e,t,s):t?o=s?n.branchOpen??"bi-folder2-open":n.branch??"bi-folder2":o=n.leaf??"bi-file-earmark":o=t?s?"bi-folder2-open":"bi-folder2":"bi-file-earmark",o.startsWith("bi ")?o:`bi ${o}`}function T(n,e){const t=document.createElement(n);return e&&(t.className=e),t}function Dt(n,e){Object.assign(n.style,e)}function Ot(n,e,t="text/plain;charset=utf-8"){const s=new Blob([n],{type:t}),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=e,i.click(),URL.revokeObjectURL(o)}function Si(n,e,t){let s=0,o=0;n.addEventListener("mousedown",i=>{i.stopPropagation(),i.preventDefault(),s=i.clientX,o=e.offsetWidth;const r=l=>{const d=Math.max(40,o+l.clientX-s);e.style.width=`${d}px`,e.style.minWidth=`${d}px`},a=l=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),t(Math.max(40,o+l.clientX-s))};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)})}const Ai=new Set(["--og-radius-none","--og-radius-sm","--og-radius-md","--og-radius-lg","--og-radius-pill","--og-radius-container","--og-radius-control","--og-radius-widget","--og-container-radius","--og-border-width","--og-border-width-strong","--og-border-style","--og-divider-style","--og-divider-repeat","--og-elevation-sm","--og-elevation-md","--og-elevation-lg","--og-elevation-alpha-sm","--og-elevation-alpha-md","--og-elevation-alpha-lg","--og-elevation-inset","--og-cell-padding-x","--og-cell-padding-y","--og-density-row-height","--og-density-header-height","--og-density-footer-height","--og-scrollbar-size","--og-texture-bg","--og-texture-size","--og-texture-opacity","--og-focus-width","--og-focus-style","--og-focus-offset","--og-focus-radius","--og-icon-size","--og-icon-fill","--og-icon-stroke-width","--og-icon-corner","--og-transition-fast","--og-transition-base","--og-row-accent-width"]),Li=/#[0-9a-fA-F]{3,8}\b/,Ii=/\b(?:rgba?|hsla?)\(\s*\d/,Ti=/\b(?:red|green|blue|black|white|gray|grey|yellow|orange|purple|pink|brown|cyan|magenta)\b/i;function $t(n,e){for(const[t,s]of Object.entries(e)){const o=t;if(!Ai.has(o))throw new Error(`[SkinRegistry] 스킨 "${n}" 의 토큰 "${o}" 은 FORM 토큰이 아닙니다. 스킨은 형태(radius/border/elevation/…)만 소유하며 색 토큰은 data-og-theme 축입니다(색⊥형태 직교성).`);const i=String(s??"");if(Li.test(i)||Ii.test(i)||Ti.test(i))throw new Error(`[SkinRegistry] 스킨 "${n}" 토큰 "${o}: ${i}" 에 색 리터럴이 있습니다. 스킨 델타는 색을 담을 수 없습니다(Rule 2). 색이 필요하면 COLOR 토큰(예: var(--og-texture-ink))을 참조하세요.`)}}function zt(n,e){const t={...e},s=[],o=t["--og-focus-width"];if(o!=null){const i=parseFloat(String(o));!Number.isNaN(i)&&i<2&&(t["--og-focus-width"]="2px",s.push(`focus-width ${o} → 2px (가시 포커스 최소 2px, HANMS)`))}return t["--og-focus-style"]==="none"&&(t["--og-focus-style"]="solid",s.push("focus-style none → solid (가시 포커스 비협상, HANMS)")),{delta:t,warnings:s}}class ps{constructor(){this._skins=new Map,this._styleEl=null}registerBuiltin(e,t){$t(e,t);const{delta:s}=zt(e,t);this._skins.set(e,s)}define(e,t){$t(e,t);const s=zt(e,t);this._skins.set(e,s.delta);for(const o of s.warnings)typeof console<"u"&&console.warn(`[SkinRegistry] "${e}": ${o}`);return this._inject(e,s.delta),s}has(e){return this._skins.has(e)}get(e){return this._skins.get(e)}list(){return[...this._skins.keys()]}_inject(e,t){if(typeof document>"u")return;this._styleEl||(this._styleEl=document.createElement("style"),this._styleEl.setAttribute("data-og-skins","runtime"),document.head.appendChild(this._styleEl));const s=Object.entries(t).map(([o,i])=>` ${o}: ${i};`).join(`
|
|
33
|
-
`);this._styleEl.appendChild(document.createTextNode(`
|
|
34
|
-
.og-container[data-og-skin="${e}"] {
|
|
35
|
-
${s}
|
|
36
|
-
}
|
|
37
|
-
`))}}const Di={"--og-radius-sm":"0","--og-radius-md":"0","--og-radius-lg":"0","--og-radius-pill":"0","--og-radius-container":"0","--og-container-radius":"0","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"none","--og-elevation-lg":"0 1px 2px","--og-cell-padding-x":"6px","--og-density-row-height":"28","--og-density-header-height":"28","--og-focus-width":"2px","--og-focus-style":"solid","--og-focus-radius":"0","--og-icon-fill":"0","--og-icon-corner":"miter"},Oi={"--og-radius-sm":"4px","--og-radius-md":"8px","--og-radius-lg":"12px","--og-radius-pill":"999px","--og-radius-container":"12px","--og-container-radius":"12px","--og-radius-control":"8px","--og-radius-widget":"6px","--og-border-width":"1px","--og-border-style":"solid","--og-elevation-sm":"0 1px 3px","--og-elevation-md":"0 4px 12px","--og-elevation-lg":"0 12px 32px","--og-elevation-alpha-sm":"0.06","--og-elevation-alpha-md":"0.10","--og-elevation-alpha-lg":"0.16","--og-cell-padding-x":"12px","--og-cell-padding-y":"2px","--og-density-row-height":"40","--og-density-header-height":"42","--og-focus-width":"2px","--og-focus-offset":"2px","--og-focus-radius":"8px","--og-icon-fill":"0","--og-icon-corner":"round"},$i={"--og-radius-sm":"2px","--og-radius-md":"3px","--og-radius-lg":"4px","--og-container-radius":"3px","--og-border-width":"1px","--og-border-style":"dashed","--og-divider-style":"dashed","--og-divider-repeat":"2","--og-texture-bg":"repeating-linear-gradient(45deg, rgba(var(--og-texture-ink),0.04) 0 2px, transparent 2px 6px)","--og-texture-size":"6px 6px","--og-texture-opacity":"1","--og-elevation-sm":"0 1px 2px","--og-elevation-md":"0 2px 4px","--og-elevation-lg":"0 4px 10px","--og-cell-padding-x":"10px","--og-density-row-height":"36","--og-focus-style":"dashed","--og-icon-fill":"0","--og-icon-corner":"round"},zi={"--og-radius-sm":"2px","--og-radius-md":"3px","--og-radius-lg":"4px","--og-container-radius":"4px","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"none","--og-elevation-lg":"none","--og-elevation-inset":"none","--og-cell-padding-x":"10px","--og-density-row-height":"34","--og-focus-width":"2px","--og-focus-style":"solid","--og-icon-fill":"0","--og-icon-corner":"round"},Hi={"--og-radius-sm":"0","--og-radius-md":"2px","--og-radius-lg":"2px","--og-container-radius":"2px","--og-border-width":"2px","--og-border-width-strong":"3px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"none","--og-elevation-md":"0 2px 4px","--og-elevation-lg":"0 4px 8px","--og-elevation-alpha-md":"0.30","--og-elevation-alpha-lg":"0.40","--og-cell-padding-x":"10px","--og-density-row-height":"40","--og-focus-width":"3px","--og-focus-style":"solid","--og-focus-offset":"2px","--og-focus-radius":"0","--og-icon-size":"18px","--og-icon-fill":"1","--og-icon-stroke-width":"2","--og-icon-corner":"miter"},Bi={"--og-radius-sm":"2px","--og-radius-md":"4px","--og-radius-lg":"8px","--og-container-radius":"8px","--og-radius-control":"4px","--og-radius-widget":"4px","--og-border-width":"1px","--og-border-style":"solid","--og-divider-style":"solid","--og-elevation-sm":"0 1px 2px","--og-elevation-md":"0 2px 6px","--og-elevation-lg":"0 8px 24px","--og-elevation-alpha-sm":"0.12","--og-elevation-alpha-md":"0.16","--og-elevation-alpha-lg":"0.20","--og-cell-padding-x":"8px","--og-density-row-height":"36","--og-focus-width":"2px","--og-focus-style":"solid","--og-focus-offset":"1px","--og-icon-fill":"0","--og-icon-corner":"round"},Vi=[["sharp",Di],["rounded",Oi],["stitch",$i],["flat",zi],["high-contrast",Hi],["material",Bi]],bt=new ps;for(const[n,e]of Vi)bt.registerBuiltin(n,e);class Pi{constructor(e){this._autoHeightWarned=!1,this._deps=e}_paginationHeight(){return this._deps.getOptions().pagination?38:0}onResize(){const{width:e}=this._deps.getContainer().getBoundingClientRect();e&&(this.recalcWidths(e),this.renderHeader(),this.doRender(...this.visRange()))}recalcWidths(e){const t=this._deps.getColLayout(),s=this._deps.getOptions(),o=t.computeWidths(e-(s.stateColumn?24:0)-(s.draggable?18:0)-(s.rowNumber?44:0)-(s.checkColumn?36:0),s.defaultColumnWidth),i=this._deps.getUserWidths();i.size&&t.visibleLeaves.forEach((r,a)=>{const l=i.get(r.field);l!=null&&(o[a]=l)}),this._deps.setColWidths(o)}renderHeader(){const e=this._deps.getRenderer(),t=this._deps.getColLayout(),s=this._deps.getSfMgr(),o=this._deps.getOptions();e==null||e.renderHeader(t.buildHeaderCells(),t.visibleLeaves,this._deps.getColWidths(),s.sortList,{...o,_activeFilters:s.filters,_frozenCount:t.frozenCount}),this.syncHeaderLayout()}syncHeaderLayout(){const e=this._deps.getRenderer(),t=this._deps.getVs();if(!e||!t)return;const s=this._deps.getOptions(),{height:o}=this._deps.getContainer().getBoundingClientRect();if(!o)return;const i=e.getHeaderHeight(),r=i>s.headerHeight?i:s.headerHeight;e.updateSize(o-this._paginationHeight(),r);let a=o-r-this._paginationHeight();const l=s.fallbackViewportHeight;if(l&&l>0){const d=t.getTotalHeight();a>=d&&a>l&&(a=l)}t.setViewportHeight(a)}doRender(e,t){var p;const s=this._deps.getRenderer(),o=this._deps.getVs();if(!s||!o)return;const i=this._deps.getOptions(),r=o.getVisibleRange(),a=i.autoHeight===!0;a&&([e,t]=this.visRange(),!this._autoHeightWarned&&t-e+1>2e3&&(this._autoHeightWarned=!0,console.warn(`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${t-e+1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`)));const l=this._deps.getGrpMgr(),c=l.isGroupMode||l.isTreeMode||this._deps.getDetailMgr().isActive?this._deps.getFlatModel().getFlatArray():null,h=this._deps.getColLayout(),u=this._deps.getData(),g=this._deps.getRowMgr();s.renderBody({startIndex:e,endIndex:t,data:u,leaves:h.visibleLeaves,widths:this._deps.getColWidths(),opts:i,offsetY:a?0:r.offsetY,totalHeight:a?0:o.getTotalHeight(),selectedRows:g.selectedRows,checkedRows:g.checkedRows,groupFlatRows:c,onGroupToggle:f=>l.handleGroupToggle(f),onTreeToggle:l.isTreeMode?f=>l.handleTreeToggle(f):void 0,extraOpts:{_totalRows:u.rowCount,_frozenCount:h.frozenCount,_focusCell:this._deps.getEditMgr().focusCell,...this._deps.getRangeMgr().getOverlayExtraOpts()},mergeEngine:this._deps.getMergeEngine(),detailApi:this._deps.buildDetailRenderContext()}),(p=i.footer)!=null&&p.length&&this._deps.renderFooterEl(),this._deps.getRangeMgr().repaint()}visRange(){var i;const e=this._deps.getOptions(),t=this._deps.getPagination();if(e.pagination&&t){const{start:r,end:a}=t.getRange();return[r,a]}const s=this._deps.getFlatModel().count();if(e.autoHeight)return[0,s-1];const o=(i=this._deps.getVs())==null?void 0:i.getVisibleRange();return[(o==null?void 0:o.startIndex)??0,Math.min(((o==null?void 0:o.endIndex)??30)+this._visCount()+5,s-1)]}_visCount(){const e=this._deps.getOptions(),t=this._deps.getContainer().getBoundingClientRect().height;return Math.ceil((t-e.headerHeight-this._paginationHeight())/e.rowHeight)+5}}let Ni=0;function Ht(){return`og-r-${++Ni}`}class Wi{constructor(e="_ogRowId"){this._data=[],this._original=[],this._meta=new Map,this._displayIndexes=[],this._idMap=new Map,this._findQuery="",this._findFields=[],this._getStrategy=(t,s)=>s,this._idField=e}getDataIndexByRowId(e){return this._idMap.get(e)}setStrategyResolver(e){this._getStrategy=e}setData(e){this._data=e.map(t=>{const s=Ht(),o={...t,[this._idField]:s};return this._meta.set(s,{state:"none",rowId:s}),o}),this._original=this._data.map(t=>({...t})),this._rebuildIdMap(),this._displayIndexes=this._data.map((t,s)=>s)}getData(){return this._displayIndexes.map(e=>this._data[e])}getOriginalData(){return[...this._original]}getAllData(){return[...this._data]}clearData(){this._data=[],this._original=[],this._meta.clear(),this._idMap.clear(),this._displayIndexes=[]}get rowCount(){return this._displayIndexes.length}get totalRowCount(){return this._data.length}addRow(e,t="last"){const s=Ht(),o={...e,[this._idField]:s};if(this._meta.set(s,{state:"added",rowId:s}),t==="last"){const i=this._data.push(o)-1;this._idMap.set(s,i),this._displayIndexes.push(i)}else if(t==="first")this._data.unshift(o),this._rebuildIdMap(),this._displayIndexes.unshift(0);else{const i=Math.min(t,this._displayIndexes.length),r=i<this._displayIndexes.length?this._displayIndexes[i]:this._data.length;this._data.splice(r,0,o),this._rebuildIdMap(),this._displayIndexes=this._data.map((a,l)=>l)}}removeRow(e){const t=this._displayIndexes[e];if(t===void 0)return;const s=this._data[t],o=s[this._idField],i=this._meta.get(o);return(i==null?void 0:i.state)==="added"?(this._data.splice(t,1),this._meta.delete(o)):this._meta.set(o,{...i,state:"removed"}),this._rebuildIdMap(),this._displayIndexes=this._data.map((r,a)=>({r,i:a})).filter(({r})=>{var a;return((a=this._meta.get(r[this._idField]))==null?void 0:a.state)!=="removed"}).map(({i:r})=>r),s}moveRow(e,t){const s=this._displayIndexes[e],o=this._displayIndexes[t];if(s===void 0||o===void 0)return;const[i]=this._data.splice(s,1),r=s<o?o-1:o;this._data.splice(r,0,i),this._rebuildIdMap(),this._displayIndexes=this._data.map((a,l)=>({r:a,i:l})).filter(({r:a})=>{var l;return((l=this._meta.get(a[this._idField]))==null?void 0:l.state)!=="removed"}).map(({i:a})=>a)}updateCell(e,t,s){const o=this._displayIndexes[e];if(o===void 0)return!1;const r=this._data[o][this._idField],a=this._meta.get(r);return(a==null?void 0:a.state)==="none"&&this._meta.set(r,{...a,state:"edited",original:{...this._original[o]}}),this._data[o][t]=s,!0}getRowByIndex(e){const t=this._displayIndexes[e];return t!==void 0?this._data[t]:void 0}getCellValue(e,t){var s;return(s=this.getRowByIndex(e))==null?void 0:s[t]}hasRow(e){var s;return this._idMap.get(e)===void 0?!1:((s=this._meta.get(e))==null?void 0:s.state)!=="removed"}getRowById(e){if(!this.hasRow(e))return;const t=this._idMap.get(e);return this._data[t]}getCellValueByRowId(e,t){var s;return(s=this.getRowById(e))==null?void 0:s[t]}setComputedValueByRowId(e,t,s){const o=this._idMap.get(e);o!==void 0&&(this._data[o][t]=s)}getEditedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="edited"})}getChangedRows(){return this.getEditedRows()}getAddedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="added"})}getRemovedRows(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="removed"})}getChanges(){const e=[],t=[],s=[];for(const o of this._data){const i=o[this._idField],r=this._meta.get(i),a=(r==null?void 0:r.state)??"none";if(a==="added")e.push({...o});else if(a==="removed")s.push({...o});else if(a==="edited"){const l=r.original??{},d=Object.keys(o).filter(c=>c!==this._idField&&o[c]!==l[c]);t.push({...o,_changedFields:d})}}return{added:e,edited:t,removed:s}}getChangedColumns(){return this._data.filter(e=>{var t;return((t=this._meta.get(e[this._idField]))==null?void 0:t.state)==="edited"}).map(e=>{var o;const t=((o=this._meta.get(e[this._idField]))==null?void 0:o.original)??{},s=[];for(const i of Object.keys(e))i!==this._idField&&e[i]!==t[i]&&s.push({field:i,oldValue:t[i],newValue:e[i]});return{row:{...e},fields:s.map(i=>i.field),diff:s}})}getOriginalRow(e){const t=this._displayIndexes[e];if(t===void 0)return;const s=this._data[t],o=this._meta.get(s[this._idField]);if(!(!o||o.state==="added"))return o.state==="edited"&&o.original?{...o.original}:{...this._original[t]}}getRowsWithState(e){return this._data.map(t=>{var o;const s=((o=this._meta.get(t[this._idField]))==null?void 0:o.state)??"none";return{...t,[e]:s}})}getRowState(e){var s;const t=this.getRowByIndex(e);return t?((s=this._meta.get(t[this._idField]))==null?void 0:s.state)??"none":"none"}applySort(e){const t=i=>{var r,a;return((a=this._meta.get((r=this._data[i])==null?void 0:r[this._idField]))==null?void 0:a.state)!=="removed"};if(e.length===0){this._displayIndexes=this._data.map((i,r)=>r).filter(t);return}const s=this._displayIndexes.filter(t).map(i=>{const r=this._data[i];return{idx:i,keys:e.map(a=>r[a.field])}}),o=this._getStrategy("sortComparator",(i,r,a,l)=>{if(i==null&&r==null)return 0;if(i==null)return-1;if(r==null)return 1;if(typeof i=="number"&&typeof r=="number")return i-r;const d=String(i),c=String(r);return d<c?-1:d>c?1:0});s.sort((i,r)=>{for(let a=0;a<e.length;a++){const l=e[a].dir,d=e[a].field,c=i.keys[a],h=r.keys[a],u=o(c,h,d,l);if(u!==0)return l==="asc"?u:-u}return 0}),this._displayIndexes=s.map(i=>i.idx)}applyFilter(e){const t=Object.keys(e),s=this._getStrategy("filterPredicate",(o,i,r)=>Ki(o,i));this._displayIndexes=this._data.map((o,i)=>({r:o,i})).filter(({r:o})=>{var i;if(((i=this._meta.get(o[this._idField]))==null?void 0:i.state)==="removed"||t.length>0&&!t.every(r=>{const a=o[r];return e[r].every(l=>s(a,l,r))}))return!1;if(this._findQuery&&this._findFields.length>0){const r=this._findQuery;if(!this._findFields.some(l=>{const d=o[l];return d!=null&&String(d).toLowerCase().includes(r)}))return!1}return!0}).map(({i:o})=>o)}setFindFilter(e,t){this._findQuery=e.toLowerCase(),this._findFields=t}_rebuildIdMap(){this._idMap.clear(),this._data.forEach((e,t)=>{this._idMap.set(e[this._idField],t)})}}function Ki(n,e){const t=n,s=e.value;switch(e.operator){case"=":return t==s;case"!=":return t!=s;case">":return t>s;case">=":return t>=s;case"<":return t<s;case"<=":return t<=s;case"contains":return String(t).includes(String(s));case"startsWith":return String(t).startsWith(String(s));case"endsWith":return String(t).endsWith(String(s));default:return!0}}function Je(n){return n&&n._isGroup===!0}function Bt(n,e,t=[],s=new Set,o,i){return e.length?gs(n,e,0,t,s,"",o,i):[]}function gs(n,e,t,s,o,i,r,a){const l=e[t],d=new Map;for(const h of n){const u=a?a(h,e.slice(t)):h[l];d.has(u)||d.set(u,[]),d.get(u).push(h)}const c=[];for(const[h,u]of d){const g=`${i}__${l}:${h}`,p=o.has(g);let f;t<e.length-1?f=gs(u,e,t+1,s,o,g,r,a):f=u;const{summary:w,summaryFmt:m}=Ui(u,s),_=qi(u,r);c.push({_isGroup:!0,_groupField:l,_groupValue:h,_groupLabel:h==null?z("group.nullLabel"):String(h),_depth:t,_expanded:p,_childCount:u.length,_summary:w,_summaryFmt:m,_states:_,children:f})}return c}function Ui(n,e){const t={},s={};for(const o of e){const i=n.map(d=>d[o.field]).filter(d=>d!=null&&d!=="");let r=null;const a=o.op.toUpperCase();if(a==="SUM")r=i.length>0?v.sum(i.map(String)):null;else if(a==="AVG")r=i.length>0?v.sum(i.map(String)).div(v.from(String(i.length))):null;else if(a==="COUNT"){t[o.field]=n.length,s[o.field]=n.length.toLocaleString("ko-KR");continue}else a==="MAX"?r=i.length>0?v.max(i.map(String)):null:a==="MIN"&&(r=i.length>0?v.min(i.map(String)):null);if(!r){t[o.field]=null,s[o.field]="";continue}const l=r.toNumber();t[o.field]=l,s[o.field]=ji(l,o.format)}return{summary:t,summaryFmt:s}}function qi(n,e){if(!e)return{added:0,edited:0,removed:0};let t=0,s=0,o=0;for(const i of n){const r=e(i);r==="added"?t++:r==="edited"?s++:r==="removed"&&o++}return{added:t,edited:s,removed:o}}function ji(n,e){if(e==null)return n%1===0?n.toLocaleString("ko-KR"):parseFloat(n.toFixed(6)).toLocaleString("ko-KR",{minimumFractionDigits:2,maximumFractionDigits:6});const t=e.includes("#")||e.includes(","),s=e.match(/\.(\d+)$/),o=s?parseInt(s[1],10):/^\d+$/.test(e)?parseInt(e,10):0,i=Math.abs(n).toFixed(o),[r="0",a]=i.split("."),l=t?r.replace(/\B(?=(\d{3})+(?!\d))/g,","):r,d=a!==void 0?`${l}.${a}`:l;return n<0?`-${d}`:d}function fs(n){const e=[];for(const t of n)if(e.push(t),t._expanded)for(const s of t.children)Je(s)?e.push(...fs([s])):e.push(s);return e}function _s(n,e=""){const t=[];for(const s of n){const o=`${e}__${s._groupField}:${s._groupValue}`;t.push(o);const i=s.children.filter(r=>Je(r));i.length&&t.push(..._s(i,o))}return t}function Vt(n){return n!=null&&n._isTree===!0}function ft(n,e,t=new Set){const{idField:s,parentIdField:o,expandOnLoad:i=!1}=e,r=new Map,a=[];for(const c of n){const h=c[s],u={_isTree:!0,_treeId:h,_treeParentId:c[o],_depth:0,_expanded:i||t.has(h),_hasChildren:!1,_childCount:0,_isLastChild:!1,_ancestorHasMore:[],data:c,children:[]};r.set(h,u)}for(const c of r.values()){const h=c._treeParentId;if(h==null||h===""||!r.has(h))a.push(c);else{const g=r.get(h);g.children.push(c),g._hasChildren=!0}}function l(c,h){for(const u of c)u._depth=h,u._childCount=ms(u),l(u.children,h+1)}l(a,0);function d(c,h){for(let u=0;u<c.length;u++){const g=c[u],p=u===c.length-1;g._isLastChild=p,g._ancestorHasMore=h,g.children.length>0&&d(g.children,[...h,!p])}}return d(a,[]),a}function ms(n){let e=n.children.length;for(const t of n.children)e+=ms(t);return e}function ws(n){const e=[];for(const t of n)e.push(t),t._expanded&&t.children.length>0&&e.push(...ws(t.children));return e}function Gi(n,e){n.has(e)?n.delete(e):n.add(e)}function _t(n){const e=[];for(const t of n)e.push(t._treeId),t.children.length&&e.push(..._t(t.children));return e}class Yi{constructor(e){this._backing=null,this._splices=[],this._revIndex=null,this._revIndexSrc=null,this._d=e}setBacking(e){this._backing=e,this._invalidate()}registerSplice(e){this._splices.push(e),this._invalidate()}count(){return this._flat().length}getFlatArray(){return this._flat()}resolveFlatRow(e){const t=this._flat()[e];if(t==null)return{kind:"data"};if(t._isDetailFiller===!0)return{kind:"detailFiller",rowId:t._rowId};if(t._isDetailHead===!0)return{kind:"detailHead",rowId:t._rowId};if(Je(t))return{kind:"group"};if(Vt(t)){const r=t.data;return{kind:"tree",rowId:r==null?void 0:r[this._d.rowIdField]}}const s=t[this._d.rowIdField],o=this._d.getDataLayer().getDataIndexByRowId(s),i={kind:"data",rowId:s};return o!==void 0&&(i.dataIndex=o),this._backing||(i.displayIndex=e),i}flatIndexOfRowId(e){return this._ensureRevIndex(),this._revIndex.get(e)??-1}rowIdOfFlat(e){const t=this.resolveFlatRow(e);return t.kind==="data"||t.kind==="tree"?t.rowId??null:null}_flat(){let e=this._backing?this._backing():this._d.getDataLayer().getData();for(const t of this._splices)e=t(e);return e}_invalidate(){this._revIndex=null,this._revIndexSrc=null}_ensureRevIndex(){const e=this._flat();if(this._revIndex&&this._revIndexSrc===e)return;const t=new Map;for(let s=0;s<e.length;s++){const o=e[s];if(o==null||Je(o)||o._isDetailHead===!0||o._isDetailFiller===!0)continue;const i=Vt(o)?o.data:o,r=i==null?void 0:i[this._d.rowIdField];r!=null&&t.set(r,s)}this._revIndex=t,this._revIndexSrc=e}}class Xi{constructor(e){this._selectedRows=new Set,this._checkedRows=new Set,this._data=e}get selectedRows(){return this._selectedRows}get checkedRows(){return this._checkedRows}selectSingle(e){this._selectedRows.clear(),this._selectedRows.add(e)}selectToggle(e){this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e)}clearSelection(){this._selectedRows.clear()}check(e,t){t?this._checkedRows.add(e):this._checkedRows.delete(e)}checkAll(e,t){if(e)for(let s=0;s<t;s++)this._checkedRows.add(s);else this._checkedRows.clear()}checkByValue(e,t){for(let s=0;s<this._data.rowCount;s++)t.includes(this._data.getCellValue(s,e))&&this._checkedRows.add(s)}uncheckAll(){this._checkedRows.clear()}checkById(e){}addCheckById(e){}uncheckById(e){}getSelections(){return[...this._selectedRows].map(e=>this._data.getRowByIndex(e)).filter(Boolean)}getChecked(){return[...this._checkedRows].map(e=>({row:this._data.getRowByIndex(e),rowIndex:e}))}getAllChecked(){return this.getChecked().map(e=>e.row)}getActiveRow(){return this._selectedRows.size>0?[...this._selectedRows][0]:-1}activate(e){this._selectedRows.clear(),this._selectedRows.add(e)}deselect(){this._selectedRows.clear()}reset(){this._selectedRows.clear(),this._checkedRows.clear()}}function Q(n,e){return`${n}:${e}`}function Re(n){const e=n.indexOf(":");return e===-1?{rowId:n,field:""}:{rowId:n.slice(0,e),field:n.slice(e+1)}}const Zi=new Set(["#ERR","#REF","#CYCLE","#DIV0","#NAME","#VALUE","#NUM"]);function st(n){return typeof n=="string"&&Zi.has(n)?n:null}const Ji=500,Qi={"#REF":"formulaError.ref","#CYCLE":"formulaError.cycle","#VALUE":"formulaError.value","#DIV0":"formulaError.div0","#NAME":"formulaError.name","#NUM":"formulaError.num"};class eo{constructor(e){this._deps=e}flushRecalc(){const e=this._deps.getDirtySeeds();if(e.size===0)return;const t=[...e];e.clear(),this.afterRecalc(this._deps.getRecalc().onValuesChanged(t),{skipRender:!0})}afterRecalc(e,t={}){var s,o;if(e.changed.length>0||e.cycles>0){const i={changed:e.changed,cycles:e.cycles,ms:e.ms,large:e.changed.length>Ji};this._deps.emit("formulaRecalc",i),(o=(s=this._deps.getOptions().formula)==null?void 0:s.onFormulaRecalc)==null||o.call(s,i)}t.skipRender||this._deps.doRenderWindow()}handleFormulaError(e,t,s){var r,a;const i={rowIndex:this._deps.getFlatModel().flatIndexOfRowId(e),field:t,error:s};this._deps.emit("formulaError",i),(a=(r=this._deps.getOptions().formula)==null?void 0:r.onFormulaError)==null||a.call(r,i),this._deps.announce(this._deps.t("formula.cellErrorAnnounce",{field:t,message:this._formulaErrorMessageKo(s)}))}_formulaErrorMessageKo(e){const t=Qi[e]??"formulaError.fallback";return this._deps.t(t)}buildAccessor(){return{visibleFields:()=>this._deps.getColLayout().visibleLeaves.map(e=>e.field),rowIdAtFlat:e=>{const t=this._deps.getFlatModel().resolveFlatRow(e);return t.kind==="data"?t.rowId??null:null},flatIndexOfRowId:e=>this._deps.getFlatModel().flatIndexOfRowId(e),displayedRowIds:()=>{const e=[],t=this._deps.getFlatModel(),s=t.count();for(let o=0;o<s;o++){const i=t.resolveFlatRow(o);i.kind==="data"&&i.rowId&&e.push(i.rowId)}return e},getCellValue:(e,t)=>this._deps.getData().getCellValueByRowId(e,t),hasRow:e=>this._deps.getData().hasRow(e),hasField:e=>this._deps.getColLayout().getColumnByField(e)!=null}}setCellFormula(e,t,s){const o=this._deps.getFlatModel().resolveFlatRow(e);o.kind!=="data"||!o.rowId||this.setCellFormulaByRowId(o.rowId,t,s,e)}setCellFormulaByRowId(e,t,s,o){var c,h;const i=o??this._deps.getFlatModel().flatIndexOfRowId(e),r=this._deps.getRecalc(),a=r.getCellFormula(e,t),l=r.setCellFormula(e,t,s),d={rowIndex:i,field:t,formula:s,oldFormula:a};this._deps.emit("formulaChange",d),(h=(c=this._deps.getOptions().formula)==null?void 0:c.onFormulaChange)==null||h.call(c,d),this.afterRecalc(l)}getCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind!=="data"||!s.rowId?null:this._deps.getRecalc().getCellFormula(s.rowId,t)}hasCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind==="data"&&!!s.rowId&&this._deps.getRecalc().hasCellFormula(s.rowId,t)}clearCellFormula(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return;const o=this._deps.getRecalc(),i=o.clearCellFormula(s.rowId,t);i.length?this.afterRecalc(o.onValuesChanged(i)):this._deps.doRenderWindow()}getCellError(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);return s.kind!=="data"||!s.rowId?null:this._deps.getRecalc().getCellError(s.rowId,t)}getDependents(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return[];const o=this._deps.getFlatModel();return this._deps.getRecalc().getDependents(s.rowId,t).map(({rowId:i,field:r})=>({rowIndex:o.flatIndexOfRowId(i),field:r}))}getPrecedents(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return[];const o=this._deps.getFlatModel();return this._deps.getRecalc().graph.getPrecedents(Q(s.rowId,t)).map(Re).map(({rowId:i,field:r})=>({rowIndex:o.flatIndexOfRowId(i),field:r}))}recalculate(){this.afterRecalc(this._deps.getRecalc().recalculateAll())}recalculateCell(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);s.kind!=="data"||!s.rowId||this.afterRecalc(this._deps.getRecalc().onValuesChanged([Q(s.rowId,t)]))}offsetFormula(e,t,s,o){return this._deps.getRecalc().offsetFormula(e,t,s,o)}getFormulaMeta(e,t){const s=this._deps.getFlatModel().resolveFlatRow(e);if(s.kind!=="data"||!s.rowId)return null;const o=this._deps.getRecalc().store.getFormula(s.rowId,t);return o?{src:o.src,error:o.error,approx:!!o.approx}:null}recalcRangeBearingFormulas(){this.afterRecalc(this._deps.getRecalc().recalcRangeBearing())}}const xt=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function ys(n){const e=n.trim(),t=/^([+-]?)(\d*)(?:\.(\d*))?[eE]([+-]?\d+)$/.exec(e);if(!t)return e;const[,s,o,i="",r]=t,a=o||"0",l=parseInt(r,10);let d=a+i,c=a.length+l;d===""&&(d="0"),c<=0?(d="0".repeat(-c+1)+d,c=1):c>d.length&&(d=d+"0".repeat(c-d.length));const h=d.slice(0,c)||"0",u=d.slice(c);return s+h+(u?"."+u:"")}function to(n){const e=n.startsWith("=")?n.slice(1):n,t=new so(e),s=t.parseComparison();if(t.skip(),!t.eof())throw new SyntaxError(`FormulaParser: 예상치 못한 토큰 '${t.peekChar()}' (위치 ${t.pos})`);return s}class so{constructor(e){this.pos=0,this.src=e}eof(){return this.pos>=this.src.length}peekChar(){return this.src[this.pos]??""}skip(){for(;!this.eof()&&/\s/.test(this.peekChar());)this.pos++}_tryOp(...e){this.skip();for(const t of e.sort((s,o)=>o.length-s.length))if(this.src.startsWith(t,this.pos))return this.pos+=t.length,t;return null}parseComparison(){let e=this.parseConcat();for(;;){const t=this._tryOp("<=",">=","<>","=","<",">");if(!t)break;const s=this.parseConcat();e={t:"bin",op:t,left:e,right:s}}return e}parseConcat(){let e=this.parseAdditive();for(;this._tryOp("&");){const s=this.parseAdditive();e={t:"bin",op:"&",left:e,right:s}}return e}parseAdditive(){let e=this.parseMultiplicative();for(;;){this.skip();const t=this.peekChar();if(t!=="+"&&t!=="-")break;this.pos++;const s=this.parseMultiplicative();e={t:"bin",op:t,left:e,right:s}}return e}parseMultiplicative(){let e=this.parsePower();for(;;){this.skip();const t=this.peekChar();if(t!=="*"&&t!=="/"&&t!=="%")break;this.pos++;const s=this.parsePower();e={t:"bin",op:t,left:e,right:s}}return e}parsePower(){const e=this.parseUnary();if(this.skip(),this.peekChar()==="^"){this.pos++;const t=this.parsePower();return{t:"bin",op:"^",left:e,right:t}}return e}parseUnary(){this.skip();const e=this.peekChar();return e==="-"||e==="+"?(this.pos++,{t:"unary",op:e,arg:this.parseUnary()}):this.parsePrimary()}parsePrimary(){this.skip();const e=this.peekChar();if(e==="("){this.pos++;const t=this.parseComparison();if(this.skip(),this.peekChar()!==")")throw new SyntaxError("FormulaParser: 닫는 괄호 ) 누락");return this.pos++,t}if(e==="[")return this._fieldRef();if(e==='"')return this._stringLit();if(/[A-Za-z$]/.test(e))return this._identifierLike();if(/[0-9.]/.test(e))return this._number();throw new SyntaxError(`FormulaParser: 예상치 못한 문자 '${e||"EOF"}' (위치 ${this.pos})`)}_fieldRef(){this.pos++;const e=this.pos;for(;!this.eof()&&this.peekChar()!=="]";)this.pos++;if(this.eof())throw new SyntaxError("FormulaParser: 닫는 ] 누락");const t=this.src.slice(e,this.pos);return this.pos++,{t:"field",field:t}}_stringLit(){this.pos++;let e="";for(;!this.eof();){const t=this.peekChar();if(t==='"'){if(this.src[this.pos+1]==='"'){e+='"',this.pos+=2;continue}return this.pos++,{t:"str",v:e}}e+=t,this.pos++}throw new SyntaxError('FormulaParser: 닫는 " 누락')}_identifierLike(){const e=this.pos;let t=!1;this.peekChar()==="$"&&(t=!0,this.pos++);const s=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const o=this.src.slice(s,this.pos);if(!o)throw new SyntaxError(`FormulaParser: 식별자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);if(!t){if(this.skip(),this.peekChar()==="("){this.pos++;const c=[];if(this.skip(),this.peekChar()!==")")for(c.push(this.parseComparison()),this.skip();this.peekChar()===",";)this.pos++,c.push(this.parseComparison()),this.skip();if(this.peekChar()!==")")throw new SyntaxError(`FormulaParser: 함수 '${o}' 닫는 ) 누락`);return this.pos++,{t:"call",name:o.toUpperCase(),args:c}}const d=o.toUpperCase();if(this.peekChar()!=="$"&&!/[0-9]/.test(this.peekChar())){if(d==="TRUE")return{t:"bool",v:!0};if(d==="FALSE")return{t:"bool",v:!1}}}let i=!1;this.peekChar()==="$"&&(i=!0,this.pos++);const r=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===r){if(t||i)throw new SyntaxError(`FormulaParser: 셀참조 행번호 누락 (위치 ${this.pos})`);return{t:"error",code:"#NAME"}}const a=parseInt(this.src.slice(r,this.pos),10),l={t:"rawRef",colLetters:o.toUpperCase(),row:a,dollarCol:t,dollarRow:i};return this._maybeRange(l)}_maybeRange(e){const t=this.pos;if(this.skip(),this.peekChar()===":"){this.pos++,this.skip();let s=!1,o=!1;this.peekChar()==="$"&&(s=!0,this.pos++);const i=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const r=this.src.slice(i,this.pos).toUpperCase();if(!r)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 열문자 누락 (위치 ${this.pos})`);this.peekChar()==="$"&&(o=!0,this.pos++);const a=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===a)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 행번호 누락 (위치 ${this.pos})`);const l=parseInt(this.src.slice(a,this.pos),10);return{t:"rawRange",a:e,b:{t:"rawRef",colLetters:r,row:l,dollarCol:s,dollarRow:o}}}return this.pos=t,e}_number(){const e=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.peekChar()===".")for(this.pos++;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.peekChar()==="e"||this.peekChar()==="E"){const s=this.pos;this.pos++,(this.peekChar()==="+"||this.peekChar()==="-")&&this.pos++;const o=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;this.pos===o&&(this.pos=s)}const t=this.src.slice(e,this.pos);if(!t||t===".")throw new SyntaxError(`FormulaParser: 숫자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${e})`);return{t:"num",v:ys(t)}}}function io(n){let e=0;for(const t of n.toUpperCase())e=e*26+(t.charCodeAt(0)-64);return e-1}function oo(n){let e=n+1,t="";for(;e>0;){const s=(e-1)%26;t=String.fromCharCode(65+s)+t,e=Math.floor((e-1)/26)}return t||"A"}function ot(n,e){const{accessor:t,host:s,refMode:o}=e,i=io(n.colLetters),a=t.visibleFields()[i];if(a===void 0)return null;const l=n.row-1,d=t.rowIdAtFlat(l);if(d===null)return null;if(o==="relative"&&!n.dollarRow){const c=t.flatIndexOfRowId(s.rowId);return{kind:"rel",dRow:c===-1?0:l-c,field:a,dollarRow:n.dollarRow,dollarCol:n.dollarCol}}return{kind:"abs",rowId:d,field:a,dollarRow:n.dollarRow,dollarCol:n.dollarCol}}function ro(n,e,t,s="stable"){const o={host:e,accessor:t,refMode:s};function i(r){switch(r.t){case"rawRef":{const a=ot(r,o);return a?{t:"ref",ref:a}:{t:"error",code:"#REF"}}case"rawRange":{const a=ot(r.a,o),l=ot(r.b,o);return!a||!l?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:l}}}case"call":return{t:"call",name:r.name,args:r.args.map(i)};case"unary":return{t:"unary",op:r.op,arg:i(r.arg)};case"bin":return{t:"bin",op:r.op,left:i(r.left),right:i(r.right)};default:return r}}return i(n)}function Be(n){switch(n.t){case"range":return!0;case"call":return n.args.some(Be);case"unary":return Be(n.arg);case"bin":return Be(n.left)||Be(n.right);default:return!1}}class D extends Error{constructor(e){super(e),this.code=e}}function Pt(n,e,t,s={}){const o=new Set,i={v:!1},r=s.divisionPrecision??30;try{return{value:K(n,e,t,o,i,r),error:null,approx:i.v,touched:o}}catch(a){const l=a instanceof D?a.code:"#ERR";return{value:l,error:l,approx:i.v,touched:o}}}function mt(n,e,t){if(n.kind==="abs")return n.rowId;const s=t.flatIndexOfRowId(e.rowId);return s===-1?null:t.rowIdAtFlat(s+n.dRow)}function no(n,e,t,s){const o=mt(n,e,t);if(o===null||!t.hasRow(o))throw new D("#REF");if(!t.hasField(n.field))throw new D("#REF");s.add(Q(o,n.field));const i=t.getCellValue(o,n.field),r=st(i);if(r)throw new D(r);return i}function ao(n,e,t,s){const o=mt(n.a,e,t),i=mt(n.b,e,t);if(o===null||i===null||!t.hasRow(o)||!t.hasRow(i))throw new D("#REF");if(!t.hasField(n.a.field)||!t.hasField(n.b.field))throw new D("#REF");const r=t.displayedRowIds(),a=r.indexOf(o),l=r.indexOf(i);if(a===-1||l===-1)throw new D("#REF");const d=Math.min(a,l),c=Math.max(a,l),h=r.slice(d,c+1),u=t.visibleFields(),g=u.indexOf(n.a.field),p=u.indexOf(n.b.field),[f,w]=g===-1||p===-1?[null,null]:[Math.min(g,p),Math.max(g,p)],m=[];for(const _ of h){if(f===null||w===null){s.add(Q(_,n.a.field)),m.push(t.getCellValue(_,n.a.field));continue}for(let y=f;y<=w;y++){const M=u[y];s.add(Q(_,M)),m.push(t.getCellValue(_,M))}}return m}function $(n){if(n==null||n==="")return v.zero();if(n instanceof v)return n;if(typeof n=="boolean")return v.from(n?"1":"0");if(typeof n=="number")return v.from(n);if(typeof n=="string"){const e=n.trim();if(!xt.test(e))throw new D("#VALUE");return v.from(ys(e))}throw new D("#VALUE")}function Pe(n){return n==null?"":n instanceof v?n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":String(n)}function je(n){return typeof n=="boolean"?n:n instanceof v?!n.isZero():typeof n=="number"?n!==0:typeof n=="string"?n.trim().toUpperCase()==="TRUE"||xt.test(n.trim())&&n.trim()!=="0":!1}function lo(n){return n<=0?v.from("1"):v.from("0."+"0".repeat(n-1)+"1")}function vs(n,e,t){const s=Math.max(e,0),o=n.toFixed(s+20),i=o.startsWith("-"),r=i?o.slice(1):o,[a,l=""]=r.split("."),d=l.slice(0,s),c=l.slice(s),h=/[1-9]/.test(c),u=(i?"-":"")+a+(s>0?"."+d:"");let g=v.from(u);if(h&&t==="up"){const p=lo(s);g=i?g.sub(p):g.add(p)}return g}function bs(n){const e=vs(n,0,"down");return n.isNeg()&&!n.eq(e)?e.sub("1"):e}function co(n,e){return v.from(n.toFixed(Math.max(e,0)))}function xs(n,e,t,s){const o=bs(e);if(e.eq(o)){const i=Number(o.toFixed(0));if(!Number.isFinite(i)||Math.abs(i)>1e5)return s.v=!0,v.from(String(Math.pow(n.toNumber(),e.toNumber())));if(i===0)return v.one();let r=v.one();for(let a=0;a<Math.abs(i);a++)r=r.mul(n);if(i<0){if(r.isZero())throw new D("#DIV0");r=v.one().div(r,t)}return r}return s.v=!0,v.from(String(Math.pow(n.toNumber(),e.toNumber())))}function ho(n,e,t,s,o){switch(n){case"+":return $(e).add($(t));case"-":return $(e).sub($(t));case"*":return $(e).mul($(t));case"/":{const i=$(t);if(i.isZero())throw new D("#DIV0");return $(e).div(i,s)}case"%":{const i=$(t);if(i.isZero())throw new D("#DIV0");return $(e).mod(i)}case"^":return xs($(e),$(t),s,o);case"&":return Pe(e)+Pe(t);case"=":case"<>":{const i=uo(e,t);return n==="="?i:!i}case"<":case"<=":case">":case">=":{const i=$(e),r=$(t);return n==="<"?i.lt(r):n==="<="?i.lte(r):n===">"?i.gt(r):i.gte(r)}default:throw new D("#ERR")}}function uo(n,e){try{return $(n).eq($(e))}catch{return Pe(n)===Pe(e)}}function po(n,e){return n.t==="range"?ao(n.ref,e.host,e.accessor,e.touched):[K(n,e.host,e.accessor,e.touched,e.approxBox,e.prec)]}function Se(n,e){const t=[];for(const s of n)for(const o of po(s,e))st(o)||t.push(o);return t}function rt(n){return n==null||n===""?!1:n instanceof v||typeof n=="number"?!0:typeof n=="string"?xt.test(n.trim()):!1}function go(n,e,t){switch(n){case"SUM":{const s=Se(e,t);return v.sum(s.map(o=>$(o)))}case"AVG":case"AVERAGE":{const o=Se(e,t).filter(i=>i!=null&&i!=="").map(i=>$(i));if(o.length===0)throw new D("#ERR");return v.avg(o,t.prec)}case"MIN":{const s=Se(e,t).filter(rt);if(s.length===0)throw new D("#ERR");return v.min(s.map(o=>$(o)))}case"MAX":{const s=Se(e,t).filter(rt);if(s.length===0)throw new D("#ERR");return v.max(s.map(o=>$(o)))}case"COUNT":{const s=Se(e,t);return v.from(String(s.filter(rt).length))}case"COUNTA":{const s=Se(e,t);return v.from(String(s.filter(o=>o!=null&&o!=="").length))}case"IF":{if(e.length<2)throw new D("#ERR");const s=K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec);return je(s)?K(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec):e.length>2?K(e[2],t.host,t.accessor,t.touched,t.approxBox,t.prec):!1}case"AND":return e.every(s=>je(K(s,t.host,t.accessor,t.touched,t.approxBox,t.prec)));case"OR":return e.some(s=>je(K(s,t.host,t.accessor,t.touched,t.approxBox,t.prec)));case"NOT":if(e.length!==1)throw new D("#ERR");return!je(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec));case"ROUND":{if(e.length!==2)throw new D("#ERR");const s=$(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=Number($(K(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec)).toFixed(0));return co(s,o)}case"ROUNDUP":case"ROUNDDOWN":{if(e.length!==2)throw new D("#ERR");const s=$(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=Number($(K(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec)).toFixed(0));return vs(s,o,n==="ROUNDUP"?"up":"down")}case"ABS":{if(e.length!==1)throw new D("#ERR");return $(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)).abs()}case"INT":{if(e.length!==1)throw new D("#ERR");return bs($(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)))}case"MOD":{if(e.length!==2)throw new D("#ERR");const s=$(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=$(K(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec));if(o.isZero())throw new D("#DIV0");return s.mod(o)}case"POWER":{if(e.length!==2)throw new D("#ERR");const s=$(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec)),o=$(K(e[1],t.host,t.accessor,t.touched,t.approxBox,t.prec));return xs(s,o,t.prec,t.approxBox)}case"SQRT":{if(e.length!==1)throw new D("#ERR");const s=$(K(e[0],t.host,t.accessor,t.touched,t.approxBox,t.prec));if(s.isNeg())throw new D("#NUM");return t.approxBox.v=!0,v.from(String(Math.sqrt(s.toNumber())))}case"CONCAT":return e.map(s=>Pe(K(s,t.host,t.accessor,t.touched,t.approxBox,t.prec))).join("");default:throw new D("#NAME")}}function K(n,e,t,s,o,i){switch(n.t){case"num":return v.from(n.v);case"str":return n.v;case"bool":return n.v;case"error":throw new D(n.code);case"field":{if(!t.hasField(n.field))throw new D("#REF");s.add(Q(e.rowId,n.field));const r=t.getCellValue(e.rowId,n.field),a=st(r);if(a)throw new D(a);return Nt(r)}case"ref":{const r=no(n.ref,e,t,s);return Nt(r)}case"range":throw new D("#VALUE");case"call":return go(n.name,n.args,{host:e,accessor:t,touched:s,prec:i,approxBox:o});case"unary":{const r=$(K(n.arg,e,t,s,o,i));return n.op==="-"?r.neg():r}case"bin":return ho(n.op,K(n.left,e,t,s,o,i),K(n.right,e,t,s,o,i),i,o);default:throw new D("#ERR")}}function Nt(n){return n==null?null:n instanceof v||typeof n=="string"||typeof n=="boolean"?n:typeof n=="number"?v.from(n):String(n)}class fo{constructor(){this._cells=new Map}setFormula(e,t,s){this._cells.set(Q(e,t),s)}getFormula(e,t){return this._cells.get(Q(e,t))}clearFormula(e,t){this._cells.delete(Q(e,t))}hasFormula(e,t){return this._cells.has(Q(e,t))}getFormulaByKey(e){return this._cells.get(e)}getAllFormulaCells(){const e=[];for(const[t,s]of this._cells){const o=t.indexOf(":");e.push({rowId:t.slice(0,o),field:t.slice(o+1),cell:s})}return e}getRangeBearingKeys(){const e=[];for(const[t,s]of this._cells)s.hasRangeRef&&e.push(t);return e}size(){return this._cells.size}}class _o{constructor(){this._precedents=new Map,this._dependents=new Map,this._byRowId=new Map,this._byField=new Map}_addEdge(e,t){let s=this._dependents.get(e);s||(s=new Set,this._dependents.set(e,s)),s.add(t);const{rowId:o,field:i}=Re(e);let r=this._byRowId.get(o);r||(r=new Set,this._byRowId.set(o,r)),r.add(t);let a=this._byField.get(i);a||(a=new Set,this._byField.set(i,a)),a.add(t)}_removeEdgesFrom(e){const t=this._precedents.get(e);if(t)for(const s of t){const o=this._dependents.get(s);o&&(o.delete(e),o.size===0&&this._dependents.delete(s));const{rowId:i,field:r}=Re(s),a=this._byRowId.get(i);a&&(a.delete(e),a.size===0&&this._byRowId.delete(i));const l=this._byField.get(r);l&&(l.delete(e),l.size===0&&this._byField.delete(r))}}addFormula(e,t){this._removeEdgesFrom(e),this._precedents.set(e,new Set(t));for(const s of t)this._addEdge(s,e)}removeFormula(e){this._removeEdgesFrom(e),this._precedents.delete(e)}isFormula(e){return this._precedents.has(e)}getPrecedents(e){return[...this._precedents.get(e)??[]]}getDependents(e){return[...this._dependents.get(e)??[]]}getDependentsClosure(e){const t=new Set;for(const i of e)this.isFormula(i)&&t.add(i);const s=[...e];let o=0;for(;o<s.length;){const i=s[o++],r=this._dependents.get(i);if(r)for(const a of r)t.has(a)||(t.add(a),s.push(a))}return[...t]}topoOrder(e){const t=new Set(e),s=new Map;for(const d of e){const c=this._precedents.get(d);let h=0;if(c)for(const u of c)t.has(u)&&h++;s.set(d,h)}const o=[];for(const[d,c]of s)c===0&&o.push(d);let i=0;const r=[];for(;i<o.length;){const d=o[i++];r.push(d);const c=this._dependents.get(d);if(c)for(const h of c){if(!t.has(h))continue;const u=(s.get(h)??0)-1;s.set(h,u),u===0&&o.push(h)}}const a=new Set(r),l=e.filter(d=>!a.has(d));return{order:r,cycles:l}}formulasReferencing(e,t){return t!==void 0?[...this._dependents.get(Q(e,t))??[]]:[...this._byRowId.get(e)??[]]}formulasReferencingField(e){return[...this._byField.get(e)??[]]}allFormulaKeys(){return[...this._precedents.keys()]}}function nt(n,e,t){let s;if(n.kind==="abs")s=n.rowId;else{const l=t.flatIndexOfRowId(e.rowId);s=l===-1?null:t.rowIdAtFlat(l+n.dRow)}if(s===null||!t.hasRow(s)||!t.hasField(n.field))return"#REF!";const o=t.flatIndexOfRowId(s),i=t.visibleFields().indexOf(n.field);if(o===-1||i===-1)return"#REF!";const r=(n.dollarCol?"$":"")+oo(i),a=(n.dollarRow?"$":"")+(o+1);return r+a}function mo(n){return'"'+n.replace(/"/g,'""')+'"'}const wo={"+":"+","-":"-","*":"*","/":"/","%":"%","^":"^","&":"&","=":"=","<>":"<>","<":"<","<=":"<=",">":">",">=":">="};function yo(n,e,t){return"="+Ve(n,e,t)}function Ve(n,e,t){switch(n.t){case"num":return n.v;case"str":return mo(n.v);case"bool":return n.v?"TRUE":"FALSE";case"field":return`[${n.field}]`;case"error":return"#REF!";case"ref":return nt(n.ref,e,t);case"range":return`${nt(n.ref.a,e,t)}:${nt(n.ref.b,e,t)}`;case"call":return`${n.name}(${n.args.map(s=>Ve(s,e,t)).join(",")})`;case"unary":return`${n.op}${Ve(n.arg,e,t)}`;case"bin":return`(${Ve(n.left,e,t)}${wo[n.op]}${Ve(n.right,e,t)})`;default:return"#REF!"}}class Cs{constructor(e){this.store=new fo,this.graph=new _o,this._accessor=e.accessor,this._setComputedValue=e.setComputedValue,this._onFormulaError=e.onFormulaError,this._refMode=e.refMode??"stable",this._prec=e.divisionPrecision??30}compile(e,t){let s;try{s=to(e)}catch{s={t:"error",code:"#ERR"}}const o=ro(s,t,this._accessor,this._refMode);return{ast:o,hasRangeRef:Be(o)}}setCellFormula(e,t,s){const o={rowId:e,field:t},{ast:i,hasRangeRef:r}=this.compile(s,o),a={src:s,ast:i,hasRangeRef:r,value:null,error:null};this.store.setFormula(e,t,a);const l=Q(e,t),d=Pt(i,o,this._accessor,{divisionPrecision:this._prec});return this.graph.addFormula(l,d.touched),this.onValuesChanged([l])}getCellFormula(e,t){var s;return((s=this.store.getFormula(e,t))==null?void 0:s.src)??null}hasCellFormula(e,t){return this.store.hasFormula(e,t)}clearCellFormula(e,t){const s=Q(e,t),o=this.graph.getDependents(s);return this.store.clearFormula(e,t),this.graph.removeFormula(s),o}getCellError(e,t){var s;return((s=this.store.getFormula(e,t))==null?void 0:s.error)??null}getDependents(e,t){return this.graph.getDependents(Q(e,t)).map(Re)}onValuesChanged(e){var r;const t=Ge(),s=this.graph.getDependentsClosure(e),{order:o,cycles:i}=this.graph.topoOrder(s);for(const a of i){const{rowId:l,field:d}=Re(a),c=this.store.getFormula(l,d);c&&(c.value="#CYCLE",c.error="#CYCLE"),this._setComputedValue(l,d,"#CYCLE"),(r=this._onFormulaError)==null||r.call(this,l,d,"#CYCLE")}for(const a of o)this._evaluateOne(a);return{changed:[...o,...i],cycles:i.length,ms:Ge()-t}}_evaluateOne(e){var r;const{rowId:t,field:s}=Re(e),o=this.store.getFormula(t,s);if(!o)return;const i=Pt(o.ast,{rowId:t,field:s},this._accessor,{divisionPrecision:this._prec});this.graph.addFormula(e,i.touched),o.value=i.value,o.error=i.error,o.approx=i.approx,this._setComputedValue(t,s,i.value),i.error&&((r=this._onFormulaError)==null||r.call(this,t,s,i.error))}recalculateAll(){var i;const e=Ge(),t=this.graph.allFormulaKeys(),{order:s,cycles:o}=this.graph.topoOrder(t);for(const r of o){const{rowId:a,field:l}=Re(r),d=this.store.getFormula(a,l);d&&(d.value="#CYCLE",d.error="#CYCLE"),this._setComputedValue(a,l,"#CYCLE"),(i=this._onFormulaError)==null||i.call(this,a,l,"#CYCLE")}for(const r of s)this._evaluateOne(r);return{changed:[...s,...o],cycles:o.length,ms:Ge()-e}}recalcRangeBearing(){return this.onValuesChanged(this.store.getRangeBearingKeys())}invalidateRow(e){return this.onValuesChanged(this.graph.formulasReferencing(e))}invalidateField(e){return this.onValuesChanged(this.graph.formulasReferencingField(e))}offsetFormula(e,t,s,o){const i=this.store.getFormula(e,t);if(!i)return"";const r=(()=>{const l=this._accessor.flatIndexOfRowId(e);return l===-1?e:this._accessor.rowIdAtFlat(l+s)??e})();(()=>{const l=this._accessor.visibleFields(),d=l.indexOf(t);return d===-1?t:l[d+o]??t})();const a=this._shiftAst(i.ast,s,o);return yo(a,{rowId:r},this._accessor)}_shiftAst(e,t,s){const o=r=>{if(r.kind==="rel")return{...r,dRow:r.dollarRow?r.dRow:r.dRow+t};let a=r.field;if(!r.dollarCol&&s!==0){const d=this._accessor.visibleFields(),c=d.indexOf(r.field),h=c===-1?void 0:d[c+s];if(!h)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:r.dollarRow,dollarCol:r.dollarCol};a=h}let l=r.rowId;if(!r.dollarRow&&t!==0){const d=this._accessor.flatIndexOfRowId(r.rowId),c=d===-1?null:this._accessor.rowIdAtFlat(d+t);if(c===null)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:r.dollarRow,dollarCol:r.dollarCol};l=c}return{kind:"abs",rowId:l,field:a,dollarRow:r.dollarRow,dollarCol:r.dollarCol}},i=r=>{switch(r.t){case"ref":{const a=o(r.ref);return a.kind==="abs"&&a.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"ref",ref:a}}case"range":{const a=o(r.ref.a),l=o(r.ref.b);return a.kind==="abs"&&a.rowId==="__dead__"||l.kind==="abs"&&l.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"range",ref:{a,b:l}}}case"call":return{t:"call",name:r.name,args:r.args.map(i)};case"unary":return{t:"unary",op:r.op,arg:i(r.arg)};case"bin":return{t:"bin",op:r.op,left:i(r.left),right:i(r.right)};default:return r}};return i(e)}}function Ge(){return typeof performance<"u"?performance.now():Date.now()}class vo{constructor(){this._onKeyDown=e=>{e.stopPropagation(),e.key==="Enter"?(e.preventDefault(),this._onCommit(this.input.value)):e.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(e,t,s,o){this._container=e,this._onCommit=s,this._onCancel=o,e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","true"),this.input=document.createElement("input"),this.input.type="date",this.input.className="og-cell-input",this.input.setAttribute("aria-label",t.column.header??Te(t,"editor.datePick"));const i=t.value;if(i){const r=i instanceof Date?i:new Date(i);isNaN(r.getTime())||(this.input.value=cs(r,"yyyy-MM-dd"))}this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),e.appendChild(this.input)}getValue(){var e;return(e=this.input)==null?void 0:e.value}focus(){var e;(e=this.input)==null||e.focus()}destroy(){var e,t,s;(e=this._container)==null||e.setAttribute("aria-expanded","false"),(t=this.input)==null||t.removeEventListener("keydown",this._onKeyDown),(s=this.input)==null||s.removeEventListener("blur",this._onBlur)}}function Wt(n){return n.map(e=>typeof e=="string"?{label:e,value:e}:{label:e.label??e.text??String(e.value??""),value:e.value})}class bo{constructor(e=[],t){this._options=Wt(e),this._optionsFn=t??null}mount(e,t,s,o){this._container=e,this._onCommit=s,this._onCancel=o,e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-expanded","true"),this.select=document.createElement("select"),this.select.className="og-cell-select",this.select.setAttribute("aria-label",t.column.header??Te(t,"editor.select"));const i=this._optionsFn?Wt(this._optionsFn(t.row,t.rowIndex)):this._options;for(const a of i){const l=document.createElement("option");l.value=String(a.value),l.textContent=a.label,this.select.appendChild(l)}const r=t.value==null?"":String(t.value);i.some(a=>String(a.value)===r)&&(this.select.value=r),this.select.addEventListener("change",()=>s(this.select.value)),this.select.addEventListener("blur",()=>s(this.select.value)),this.select.addEventListener("keydown",a=>{a.key==="Escape"&&o()}),e.appendChild(this.select)}getValue(){var e;return(e=this.select)==null?void 0:e.value}focus(){var e;(e=this.select)==null||e.focus()}destroy(){var e;(e=this._container)==null||e.setAttribute("aria-expanded","false")}}class xo{constructor(){this._onKeyDown=e=>{e.stopPropagation(),e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),this._onCommit(this.input.value)):e.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(e,t,s,o){this._onCommit=s,this._onCancel=o,this.input=document.createElement("input"),this.input.type="text",this.input.value=t.value==null?"":String(t.value),this.input.style.cssText=`
|
|
38
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
39
|
-
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
40
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
41
|
-
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),e.appendChild(this.input)}getValue(){var e;return(e=this.input)==null?void 0:e.value}focus(){var e,t;(e=this.input)==null||e.focus(),(t=this.input)==null||t.select()}destroy(){var e,t;(e=this.input)==null||e.removeEventListener("keydown",this._onKeyDown),(t=this.input)==null||t.removeEventListener("blur",this._onBlur)}}class Co{constructor(e){this._onKeyDown=t=>{t.stopPropagation(),t.key==="Enter"||t.key==="Tab"?(t.preventDefault(),this._commit()):t.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._commit()},this.min=e==null?void 0:e.min,this.max=e==null?void 0:e.max,this.step=e==null?void 0:e.step}mount(e,t,s,o){this._onCommit=s,this._onCancel=o,this.input=document.createElement("input"),this.input.type="number",this.input.value=t.value==null?"":String(t.value),this.min!=null&&(this.input.min=String(this.min)),this.max!=null&&(this.input.max=String(this.max)),this.step!=null&&(this.input.step=String(this.step)),this.input.style.cssText=`
|
|
42
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
43
|
-
font-size:var(--og-font-size,13px);text-align:right;
|
|
44
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
45
|
-
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),e.appendChild(this.input)}_commit(){const e=this.input.value===""?null:Number(this.input.value);this._onCommit(e)}getValue(){var e,t;return((e=this.input)==null?void 0:e.value)===""?null:Number((t=this.input)==null?void 0:t.value)}focus(){var e,t;(e=this.input)==null||e.focus(),(t=this.input)==null||t.select()}destroy(){var e,t;(e=this.input)==null||e.removeEventListener("keydown",this._onKeyDown),(t=this.input)==null||t.removeEventListener("blur",this._onBlur)}}class Rs{mount(e,t,s,o){this._onCommit=s,e.style.cssText+="display:flex;align-items:center;justify-content:center;",this.chk=document.createElement("input"),this.chk.type="checkbox",this.chk.checked=!!t.value,this.chk.style.cursor="pointer",this.chk.addEventListener("change",()=>s(this.chk.checked)),e.appendChild(this.chk)}getValue(){var e;return(e=this.chk)==null?void 0:e.checked}focus(){var e;(e=this.chk)==null||e.focus()}destroy(){}}const Ms=new Map;function Oe(n,e){Ms.set(n,e)}Oe("number",(n,e)=>{const t={};return e&&(e.min!=null&&(t.min=e.min),e.max!=null&&(t.max=e.max),e.step!=null&&(t.step=e.step)),new Co(t)});Oe("date",()=>new vo);Oe("boolean",()=>new Rs);Oe("checkbox",()=>new Rs);Oe("select",(n,e)=>new bo((e?e.options:n.options)??[],n.optionsFn));function Kt(n){const e=n.editor;let t,s;e?typeof e=="string"?(t=e,s=void 0):(t=e.type,s=e):(t=String(n.type??""),s=void 0);const o=Ms.get(t);return o?o(n,s):new xo}function Ne(n){const e=typeof n.renderer=="string"?n.renderer:n.renderer&&typeof n.renderer=="object"?n.renderer.type:"";return n.type==="boolean"||n.type==="checkbox"||e==="checkbox"||e==="switch"}class Ro{constructor(e){this._activeEditor=null,this._editCell=null,this._focusCell=null,this._dragColIdx=null,this._d=e}get activeEditor(){return this._activeEditor}get editCell(){return this._editCell}get focusCell(){return this._focusCell}get dragColIdx(){return this._dragColIdx}set dragColIdx(e){this._dragColIdx=e}setFocusCell(e,t){this._focusCell={ri:e,ci:t},this._d.scrollToRow(e),this._d.doRender();const s=this._d.getVisibleLeaves()[t],o=this._d.data.getRowByIndex(e);if(s&&o){const i=o[s.field];this._d.announce(this._d.t("editor.cellPositionAnnounce",{row:e+1,col:t+1,header:s.header,value:i==null?this._d.t("cell.emptyValue"):String(i)}))}}clearFocusCell(){this._focusCell=null}startEditByKey(e,t){var c,h,u,g,p,f,w;const s=this._d.getVisibleLeaves()[t];if(!s)return;if(Ne(s)){const m=this._d.getOptions();if(s.editable!==!1&&(s.editable!==void 0||m.editable)){const y=this._d.data.getRowByIndex(e);y&&this._d.writeCell(e,s.field,!y[s.field])}return}const o=this._d.data.getRowByIndex(e);if(s.editable===!1||typeof s.editable=="function"&&!s.editable(o,e))return;this.commitEdit();const i=(c=this._d.getRenderer())==null?void 0:c.getCellEl(e,t);if(!i)return;i.innerHTML="";const r=Kt(s);this._activeEditor=r,this._editCell={ri:e,ci:t};const a={type:"editStart",rowIndex:e,columnIndex:t,field:s.field,oldValue:o==null?void 0:o[s.field],newValue:o==null?void 0:o[s.field],row:o,column:s};this._d.emit("editStart",a),(u=(h=this._d.getOptions()).onEditStart)==null||u.call(h,a),i.classList.add("og-editing");const d={value:((p=(g=this._d).hasCellFormula)!=null&&p.call(g,e,s.field)?(w=(f=this._d).getCellFormula)==null?void 0:w.call(f,e,s.field):null)??(o==null?void 0:o[s.field]),row:o,rowIndex:e,column:s,colIndex:t,isSelected:!0,rowState:"none",t:(m,_)=>this._d.t(m,_)};r.mount(i,d,m=>this.commitEditWithValue(e,t,m),()=>this.cancelEdit()),requestAnimationFrame(()=>r.focus())}startEdit(e,t,s){var u,g,p,f,w,m;const o=this._d.getOptions();if(!o.editable)return;const i=this._d.getVisibleLeaves()[t];if(!i||Ne(i))return;const r=this._d.data.getRowByIndex(e);if(i.editable===!1||typeof i.editable=="function"&&!i.editable(r,e)||!i.editable&&!o.editable)return;this.commitEdit();const a=(u=this._d.getRenderer())==null?void 0:u.getCellEl(e,t);if(!a)return;a.innerHTML="";const l=Kt(i);this._activeEditor=l,this._editCell={ri:e,ci:t};const d={type:"editStart",rowIndex:e,columnIndex:t,field:i.field,oldValue:r==null?void 0:r[i.field],newValue:r==null?void 0:r[i.field],row:r,column:i};this._d.emit("editStart",d),(g=o.onEditStart)==null||g.call(o,d),a.classList.add("og-editing");const h={value:((f=(p=this._d).hasCellFormula)!=null&&f.call(p,e,i.field)?(m=(w=this._d).getCellFormula)==null?void 0:m.call(w,e,i.field):null)??(r==null?void 0:r[i.field]),row:r,rowIndex:e,column:i,colIndex:t,isSelected:!0,rowState:"none",t:(_,y)=>this._d.t(_,y)};l.mount(a,h,_=>this.commitEditWithValue(e,t,_),()=>this.cancelEdit()),requestAnimationFrame(()=>l.focus())}commitEdit(){if(!this._activeEditor||!this._editCell)return;const e=this._activeEditor.getValue(),{ri:t,ci:s}=this._editCell;this._finishEdit(t,s,e,!1)}commitEditWithValue(e,t,s){this._finishEdit(e,t,s,!1)}cancelEdit(){if(!this._editCell)return;const{ri:e,ci:t}=this._editCell;this._finishEdit(e,t,void 0,!0)}_finishEdit(e,t,s,o){var a,l,d,c,h,u,g,p,f,w,m;if(!this._activeEditor)return;const i=this._d.getVisibleLeaves()[t],r=(a=this._d.getRenderer())==null?void 0:a.getCellEl(e,t);if(r&&(this._activeEditor.destroy(),r.classList.remove("og-editing")),this._activeEditor=null,this._editCell=null,!o&&i){const _=this._d.data.getCellValue(e,i.field),y=((d=(l=this._d).hasCellFormula)==null?void 0:d.call(l,e,i.field))??!1;if(typeof s=="string"&&s.trimStart().startsWith("=")){(h=(c=this._d).setCellFormula)==null||h.call(c,e,i.field,s);const k=this._d.data.getRowByIndex(e),b=this._d.getOptions(),x={type:"editEnd",rowIndex:e,columnIndex:t,field:i.field,oldValue:_,newValue:s,row:k,column:i};this._d.emit("editEnd",x),(u=b.onEditEnd)==null||u.call(b,x),this._d.emit("dataChange",this._d.data.getData()),(g=b.onDataChange)==null||g.call(b,this._d.data.getData())}else if(s!==_||y){y&&((f=(p=this._d).clearCellFormula)==null||f.call(p,e,i.field)),this._d.data.updateCell(e,i.field,s);const k=this._d.data.getRowByIndex(e),b=this._d.getOptions(),x={type:"editEnd",rowIndex:e,columnIndex:t,field:i.field,oldValue:_,newValue:s,row:k,column:i};this._d.emit("editEnd",x),(w=b.onEditEnd)==null||w.call(b,x),this._d.emit("dataChange",this._d.data.getData()),(m=b.onDataChange)==null||m.call(b,this._d.data.getData())}}this._d.doRender(),requestAnimationFrame(()=>this._d.getContainer().focus({preventScroll:!0}))}}class Mo{constructor(e){this._d=e}_readCssVar(e){return getComputedStyle(this._d.getContainer()).getPropertyValue(e).trim()}_hexToXlsxRgb(e){const t=e.trim(),s=t.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);if(s)return[s[1],s[2],s[3]].map(i=>parseInt(i).toString(16).padStart(2,"0")).join("").toUpperCase();const o=t.replace("#","").toUpperCase();return o.length===3?o[0]+o[0]+o[1]+o[1]+o[2]+o[2]:o.length===6?o:""}exportExcel(e){const t=typeof e=="string"?{filename:e}:e??{};let s=t.filename??"export";s.toLowerCase().endsWith(".xlsx")||(s+=".xlsx");const o=t.sheetName??(this._d.getOptions().ariaLabel||"Sheet1"),i=this._d.getData(),r=this._d.getColLayout().visibleLeaves.filter(d=>{var c;return!((c=t.exceptFields)!=null&&c.includes(d.field))}),a=t.includeHeader!==!1,l=(this._d.getStrategy??((d,c)=>c))("cellSerializer",(d,c,h)=>c.type==="number"&&typeof d=="number"?d:typeof d=="boolean"?d?"✓":"":typeof d=="object"?"":String(d));Promise.resolve().then(()=>require("./xlsx.min-Bx-LxWOf.cjs")).then(d=>d.xlsx_min).then(({utils:d,writeFile:c})=>{var re,ae,ye;const h=[];a&&h.push(r.map(H=>H.header));for(const H of i)h.push(r.map(V=>{const ee=H[V.field];if(t.maskOnExport&&V.mask&&this._d.getMaskEnabled(V.field))return pt(ee==null?"":String(ee),V.mask);const E=ee;return E==null||E===""?"":l(E,V,H)}));const u=d.aoa_to_sheet(h),g=this._d.getColWidths(),p=this._d.getColLayout();u["!cols"]=r.map(H=>({wpx:g[p.getColumnIndex(H.field)]??100})),u["!rows"]=h.map((H,V)=>({hpx:V===0&&a?22:19}));const f=t.styleMode??"theme";let w="1565C0",m="FFFFFF",_="FFFFFF",y="EEF2FF",M="212121",k="BDBDBD",b=10;if(f==="theme"){const H=ee=>this._hexToXlsxRgb(ee);w=H(this._readCssVar("--og-header-bg"))||w,m=H(this._readCssVar("--og-header-color"))||m,_=H(this._readCssVar("--og-row-bg"))||_,y=H(this._readCssVar("--og-row-alt-bg"))||y,M=H(this._readCssVar("--og-row-color"))||M,k=H(this._readCssVar("--og-border-color"))||k;const V=this._readCssVar("--og-font-size");V&&(b=Math.max(8,Math.round(parseFloat(V)*.75)))}const x=f==="none",F=((ae=(re=this._d).getMeta)==null?void 0:ae.call(re).exportFont)??"맑은 고딕",S={hdrFont:x?{}:{bold:!0,color:{rgb:m},sz:b,name:F},dataFont:x?{}:{sz:b,color:{rgb:M},name:F},hdrFill:x?{}:{patternType:"solid",fgColor:{rgb:w}},evenFill:x?{}:{patternType:"solid",fgColor:{rgb:_}},oddFill:x?{}:{patternType:"solid",fgColor:{rgb:y}},hdrBorder:x?{}:{top:{style:"medium",color:{rgb:w}},bottom:{style:"medium",color:{rgb:w}},left:{style:"thin",color:{rgb:w}},right:{style:"thin",color:{rgb:w}}},dataBorder:x?{}:{top:{style:"thin",color:{rgb:k}},bottom:{style:"thin",color:{rgb:k}},left:{style:"thin",color:{rgb:k}},right:{style:"thin",color:{rgb:k}}}};h.forEach((H,V)=>{const ee=a&&V===0,O=(a?V-1:V)%2===0;H.forEach((le,$e)=>{const ke=d.encode_cell({r:V,c:$e});u[ke]||(u[ke]={t:"s",v:""});const Ee=r[$e],Ke=Ee.type==="number"||Ee.align==="right",Ue=ee?"center":Ke?"right":Ee.align??"left";u[ke].s={font:ee?S.hdrFont:S.dataFont,fill:ee?S.hdrFill:O?S.evenFill:S.oddFill,border:ee?S.hdrBorder:S.dataBorder,alignment:{horizontal:Ue,vertical:"center",wrapText:!1}}})});const P=d.book_new();d.book_append_sheet(P,u,o),c(P,s,{cellStyles:!0}),(ye=t.onAfter)==null||ye.call(t,new Blob([]))}).catch(()=>{console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.")})}exportCsv(e){const t=typeof e=="string"?{filename:e}:e??{},s=this._d.getData(),o=this._d.getColLayout().visibleLeaves,i=o.map(l=>`"${l.header}"`).join(","),r=s.map(l=>o.map(d=>{const c=l[d.field]??"";if(t.maskOnExport&&d.mask&&this._d.getMaskEnabled(d.field))return pt(String(c),d.mask);const h=c;return typeof h=="string"&&h.includes(",")?`"${h}"`:h}).join(",")),a=t.filename??"export.csv";Ot("\uFEFF"+[i,...r].join(`
|
|
46
|
-
`),a)}exportJson(e){const t=typeof e=="string"?e:(e==null?void 0:e.filename)??"export.json";Ot(JSON.stringify(this._d.getData(),null,2),t,"application/json")}print(e){var p,f;const t=(e==null?void 0:e.title)??"OPEN_GRID",s=(e==null?void 0:e.footerText)??"",o=this._d.getData(),i=this._d.getColLayout().visibleLeaves.filter(w=>{var m;return!((m=e==null?void 0:e.excludeFields)!=null&&m.includes(w.field))}),r=i.map(w=>`<th>${w.header??w.field}</th>`).join(""),a=o.map(w=>`<tr>${i.map(m=>`<td>${String(w[m.field]??"")}</td>`).join("")}</tr>`).join(""),l=s?`<div class="og-print-footer">${s}</div>`:"",c=(((f=(p=this._d).getMeta)==null?void 0:f.call(p))??{intlLocale:"ko-KR"}).intlLocale,h=this._d.t?this._d.t("export.printSummary",{rows:o.length,cols:i.length,date:new Date().toLocaleString(c)}):`${o.length}행 × ${i.length}열 · ${new Date().toLocaleString(c)}`,u=`<!DOCTYPE html>
|
|
47
|
-
<html lang="${c}"><head>
|
|
48
|
-
<meta charset="UTF-8"><title>${t}</title>
|
|
49
|
-
<style>
|
|
50
|
-
@page{margin:0;}
|
|
51
|
-
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;margin:0;padding:1cm;}
|
|
52
|
-
h2{margin:0 0 10px;font-size:14px;color:#333;}
|
|
53
|
-
p{margin:0 0 8px;font-size:11px;color:#999;}
|
|
54
|
-
table{border-collapse:collapse;width:100%;}
|
|
55
|
-
th,td{border:1px solid #ccc;padding:5px 8px;text-align:left;white-space:nowrap;}
|
|
56
|
-
th{background:#f5f5f5;font-weight:600;color:#333;}
|
|
57
|
-
tr:nth-child(even) td{background:#fafafa;}
|
|
58
|
-
.og-print-footer{position:fixed;bottom:0;left:0;right:0;padding:6px 1cm;font-size:10px;color:#888;border-top:1px solid #e5e7eb;background:#fff;text-align:center;}
|
|
59
|
-
</style>
|
|
60
|
-
</head><body>
|
|
61
|
-
<h2>${t}</h2>
|
|
62
|
-
<p>${h}</p>
|
|
63
|
-
<table>
|
|
64
|
-
<thead><tr>${r}</tr></thead>
|
|
65
|
-
<tbody>${a}</tbody>
|
|
66
|
-
</table>
|
|
67
|
-
${l}
|
|
68
|
-
<script>window.addEventListener('load',()=>{window.print();window.addEventListener('afterprint',()=>window.close());});<\/script>
|
|
69
|
-
</body></html>`,g=window.open("","_blank","width=960,height=640");g&&(g.document.write(u),g.document.close())}exportSheetsExcel(e){const t=this._d.getWsManager();if(!t){this.exportExcel(e??"workbook");return}const s=e??"workbook.xlsx",o=(this._d.getStrategy??((i,r)=>r))("cellSerializer",(i,r,a)=>typeof i=="boolean"?i?"✓":"":r.type==="number"&&typeof i=="number"?i:String(i));Promise.resolve().then(()=>require("./xlsx.min-Bx-LxWOf.cjs")).then(i=>i.xlsx_min).then(({utils:i,writeFile:r})=>{const a=i.book_new(),l=this._d.getOptions();for(const d of t.getNames()){const c=t.get(d),h=c.columns.length?c.columns:l.columns,u=[h.map(p=>p.header)];for(const p of c.data)u.push(h.map(f=>{const w=p[f.field];return w==null?"":o(w,f,p)}));const g=i.aoa_to_sheet(u);g["!cols"]=h.map(()=>({wpx:100})),i.book_append_sheet(a,g,d)}r(a,s.endsWith(".xlsx")?s:s+".xlsx",{cellStyles:!0})}).catch(()=>console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."))}}class ko{constructor(e){this._d=e}fmtNum(e,t){if(!t)return Math.round(e).toLocaleString("ko-KR");const s=t.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),o=s?t.slice(0,s.index):"",i=s?t.slice(s.index+s[0].length):"",r=s?s[0]:t,a=r.includes("#")||r.includes(","),l=r.match(/\.(\d+)$/),d=l?parseInt(l[1],10):/^\d+$/.test(r)?parseInt(r,10):0,c=Math.abs(e).toFixed(d),[h="0",u]=c.split("."),g=a?h.replace(/\B(?=(\d{3})+(?!\d))/g,","):h,p=u!==void 0?`${g}.${u}`:g,f=`${o}${p}${i}`;return e<0?`-${f}`:f}computeValues(){const e=this._d.getOptions().footer;if(!e||e.length===0)return[];const t=this._d.getData();return e.filter(s=>s.field&&s.op).map(s=>{const o=s.field,i=s.op,r=t.map(u=>u[o]).filter(u=>u!=null&&u!==""&&!st(u));let a=null;const l=i.toUpperCase(),d=(this._d.getStrategy??((u,g)=>g))("summaryOp",null);if(d){const u=d(l,r,o);if(u!=null)return{_field:o,_value:u,_formatted:this.fmtNum(u,s.format)}}if(l==="SUM")a=r.length>0?v.sum(r.map(u=>String(u))):null;else if(l==="AVG")a=r.length>0?v.sum(r.map(u=>String(u))).div(v.from(String(r.length))):null;else if(l==="COUNT"){const u=r.length;return{_field:o,_value:u,_formatted:u.toLocaleString("ko-KR")}}else l==="MAX"?a=r.length>0?v.max(r.map(u=>String(u))):null:l==="MIN"&&(a=r.length>0?v.min(r.map(u=>String(u))):null);if(!a)return{_field:o,_value:null,_formatted:""};const c=a.toNumber(),h=this.fmtNum(c,s.format);return{_field:o,_value:c,_formatted:h}})}render(){var h;const e=this._d.getContainer(),t=e.querySelector(".og-footer-bar");t==null||t.remove();const s=this._d.getOptions(),o=s.footer;if(!o||o.length===0)return;const i=this._d.getColLayout().visibleLeaves,r=this._d.getColWidths()??i.map(u=>u.width??100),a=new Map(this.computeValues().map(u=>[u._field,u])),l=document.createElement("div");l.className="og-footer-bar",l.style.cssText=["display:flex;align-items:stretch;",`min-height:${s.footerHeight}px;`,"border-top:2px solid var(--og-primary,#1976d2);","background:var(--og-header-bg,#f5f5f5);","overflow:hidden;flex-shrink:0;font-size:13px;font-weight:600;"].join("");let d=0;if(s.stateColumn&&(d+=24),s.draggable&&(d+=18),s.rowNumber&&(d+=44),s.checkColumn&&(d+=36),d>0){const u=document.createElement("div");u.style.cssText=`width:${d}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`,l.appendChild(u)}let c=0;for(const u of o){const g=Math.max(1,u.colspan??1);let p=0;for(let y=0;y<g;y++)p+=r[c+y]??100;const f=i[c];c+=g;const w=document.createElement("div");w.style.cssText=[`width:${p}px;min-width:${p}px;flex-shrink:0;`,"padding:4px 8px;box-sizing:border-box;overflow:hidden;","border-right:1px solid var(--og-border-color,#e0e0e0);","white-space:nowrap;text-overflow:ellipsis;"].join("");const m=u.field,_=m?a.get(m):null;if(_){const y=_._formatted??String(_._value??""),M=u.label?`${u.label}: `:"";w.textContent=M+y,w.title=`${((h=u.op)==null?void 0:h.toUpperCase())??""} = ${y}`,w.style.color="var(--og-primary,#1976d2)",w.style.textAlign=u.align??((f==null?void 0:f.type)==="number","right")}else u.label&&(w.textContent=u.label,w.style.textAlign=u.align??"left",w.style.color="var(--og-row-color,#212121)");l.appendChild(w)}s.footerPosition==="top"?e.insertBefore(l,e.firstChild):e.appendChild(l)}}class Eo{constructor(e){this._d=e}handleKeyDown(e){var d,c,h,u,g;const t=this._d.getEditMgr();if(t.activeEditor)return;this._d.handleCellKeyEvt("cellKeyDown",e);const s=this._d.getData(),o=this._d.getColLayout(),i=s.rowCount,r=o.visibleLeaves.length;if(i===0||r===0)return;if((e.ctrlKey||e.metaKey)&&e.key==="c"){e.preventDefault(),this._copyToClipboard();return}if((e.ctrlKey||e.metaKey)&&e.key==="v"){e.preventDefault(),this._pasteFromClipboard();return}const a=((c=(d=this._d).getRangeHooks)==null?void 0:c.call(d))??null;if((e.ctrlKey||e.metaKey)&&(a!=null&&a.isEnabled())&&(e.key==="d"||e.key==="D")){e.preventDefault(),a.ctrlFill("down");return}if((e.ctrlKey||e.metaKey)&&(a!=null&&a.isEnabled())&&(e.key==="r"||e.key==="R")){e.preventDefault(),a.ctrlFill("right");return}if(e.shiftKey&&(a!=null&&a.isEnabled())&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")){e.preventDefault();const p=e.key==="ArrowDown"?"down":e.key==="ArrowUp"?"up":e.key==="ArrowLeft"?"left":"right";a.extendFocus(p);return}const l=this._d.getOptions();if((e.ctrlKey||e.metaKey)&&l.draggable&&t.focusCell){if(e.key==="ArrowDown"){e.preventDefault();const p=t.focusCell.ci!==void 0?t.focusCell.ri:0;p<i-1&&(this._d.handleRowDrop(p,p+1),this._d.setFocusCell(p+1,t.focusCell.ci),this._d.announce(this._d.t("row.moveAnnounce",{from:p+1,to:p+2})));return}if(e.key==="ArrowUp"){e.preventDefault();const p=t.focusCell.ri;p>0&&(this._d.handleRowDrop(p,p-1),this._d.setFocusCell(p-1,t.focusCell.ci),this._d.announce(this._d.t("row.moveAnnounce",{from:p+1,to:p})));return}}switch(e.key){case"ArrowDown":{e.preventDefault();const p=t.focusCell,f=p?Math.min(p.ri+1,i-1):0;this._d.setFocusCell(f,(p==null?void 0:p.ci)??0);break}case"ArrowUp":{e.preventDefault();const p=t.focusCell,f=p?Math.max(p.ri-1,0):0;this._d.setFocusCell(f,(p==null?void 0:p.ci)??0);break}case"ArrowRight":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}p.ci<r-1?this._d.setFocusCell(p.ri,p.ci+1):p.ri<i-1&&this._d.setFocusCell(p.ri+1,0);break}case"ArrowLeft":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}p.ci>0?this._d.setFocusCell(p.ri,p.ci-1):p.ri>0&&this._d.setFocusCell(p.ri-1,r-1);break}case"Tab":{e.preventDefault();const p=t.focusCell;if(!p){this._d.setFocusCell(0,0);break}e.shiftKey?p.ci>0?this._d.setFocusCell(p.ri,p.ci-1):p.ri>0&&this._d.setFocusCell(p.ri-1,r-1):p.ci<r-1?this._d.setFocusCell(p.ri,p.ci+1):p.ri<i-1&&this._d.setFocusCell(p.ri+1,0);break}case"Home":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this._d.setFocusCell(0,0);else{const p=t.focusCell;this._d.setFocusCell((p==null?void 0:p.ri)??0,0)}break}case"End":{if(e.preventDefault(),e.ctrlKey||e.metaKey)this._d.setFocusCell(i-1,r-1);else{const p=t.focusCell;this._d.setFocusCell((p==null?void 0:p.ri)??0,r-1)}break}case"PageDown":{e.preventDefault();const p=t.focusCell,f=this._d.getOptions().pageSize??10,w=Math.min(p?p.ri+f:f-1,i-1);this._d.setFocusCell(w,(p==null?void 0:p.ci)??0);break}case"PageUp":{e.preventDefault();const p=t.focusCell,f=this._d.getOptions().pageSize??10,w=p?Math.max(p.ri-f,0):0;this._d.setFocusCell(w,(p==null?void 0:p.ci)??0);break}case" ":{if(t.focusCell){e.preventDefault();const p=t.focusCell.ri,f=this._d.getRowMgr();this._d.getOptions().checkColumn?(f.check(p,!f.checkedRows.has(p)),this._d.doRender()):(f.selectToggle(p),this._d.doRender())}break}case"F2":case"Enter":{t.focusCell&&this._d.getOptions().editable&&(e.preventDefault(),t.startEditByKey(t.focusCell.ri,t.focusCell.ci));break}case"Escape":{(g=(u=(h=this._d).getRangeHooks)==null?void 0:u.call(h))==null||g.clear(),t.clearFocusCell(),this._d.doRender();break}}}_copyToClipboard(){var a,l,d,c;if(!this._d.getOptions().clipboard)return;const t=(l=(a=this._d).getRangeHooks)==null?void 0:l.call(a);if(t!=null&&t.isEnabled()&&t.hasSelection()){const h=t.copyText();if(h!=null){(d=navigator.clipboard)==null||d.writeText(h).catch(()=>{});return}}const s=this._d.getEditMgr(),o=this._d.getColLayout(),i=this._d.getData();let r="";if(s.focusCell){const{ri:h,ci:u}=s.focusCell,g=o.visibleLeaves[u];g&&(r=String(i.getCellValue(h,g.field)??""))}else if(this._d.getRowMgr().selectedRows.size>0){const h=o.visibleLeaves;r=[...this._d.getRowMgr().selectedRows].sort((g,p)=>g-p).map(g=>{const p=i.getRowByIndex(g);return h.map(f=>String((p==null?void 0:p[f.field])??"")).join(" ")}).join(`
|
|
70
|
-
`)}r&&((c=navigator.clipboard)==null||c.writeText(r).catch(()=>{}))}_pasteFromClipboard(){var o,i,r;const e=this._d.getOptions();if(!e.clipboard||!e.editable)return;const t=this._d.getEditMgr(),s=(i=(o=this._d).getRangeHooks)==null?void 0:i.call(o);(r=navigator.clipboard)==null||r.readText().then(a=>{var p,f;if(!a||s!=null&&s.isEnabled()&&s.hasSelection()&&s.pasteText(a)||!t.focusCell)return;const{ri:l,ci:d}=t.focusCell,c=a.split(`
|
|
71
|
-
`),h=this._d.getColLayout().visibleLeaves,u=this._d.getData(),g=[];for(let w=0;w<c.length;w++){const m=c[w].split(" ");for(let _=0;_<m.length;_++){const y=l+w,M=d+_,k=h[M];k&&y<u.rowCount&&g.push({rowIndex:y,field:k.field,value:m[_]})}}g.length&&((f=(p=this._d).writeCells)==null||f.call(p,g))}).catch(()=>{})}}class Fo{constructor(e){this._sortList=[],this._filters={},this._d=e}get sortList(){return this._sortList}get filters(){return this._filters}handleSortClick(e,t){var a,l,d;const s=this._d.getOptions();if(!s.sortable)return;const o=this._sortList.findIndex(c=>c.field===e);if(o>=0){const c=this._sortList[o];c.dir==="asc"?c.dir="desc":this._sortList.splice(o,1)}else(!t||!s.multiSort)&&(this._sortList=[]),this._sortList.push({field:e,dir:"asc"});this._d.getData().applySort(this._sortList),(l=(a=this._d).onReproject)==null||l.call(a),this._d.renderHeader(),this._d.doRender();const i=this._sortList.find(c=>c.field===e),r=this._d.t(i?i.dir==="asc"?"sort.asc":"sort.desc":"sort.none");this._d.announce(this._d.t("sort.announce",{field:e,dir:r})),this._d.emit("sortChange",{sortList:this._sortList}),(d=s.onSortChange)==null||d.call(s,{field:e,dir:(i==null?void 0:i.dir)??"asc",sortList:this._sortList})}sort(e,t="asc"){var s,o;if(Array.isArray(e))this._sortList=e;else{const i=this._sortList.findIndex(r=>r.field===e);i>=0?this._sortList[i].dir=t:this._sortList=[{field:e,dir:t}],this._d.getOptions().multiSort||(this._sortList=this._sortList.slice(-1))}this._d.getData().applySort(this._sortList),(o=(s=this._d).onReproject)==null||o.call(s),this._d.renderHeader(),this._d.doRender(),this._d.emit("sortChange",{sortList:this._sortList})}resetSort(){var e,t;this._sortList=[],this._d.getData().applySort([]),(t=(e=this._d).onReproject)==null||t.call(e),this._d.renderHeader(),this._d.doRender()}initSort(e){var t,s;this._sortList=[...e],this._d.getData().applySort(this._sortList),(s=(t=this._d).onReproject)==null||s.call(t)}getSortState(){return[...this._sortList]}setFilter(e,t){var s,o;this._filters[e]=t,this.applyFilters(),this._d.renderHeader(),this._d.doRender(),this._d.emit("filterChange",{field:e,filterItems:t,allFilters:this._filters}),(o=(s=this._d.getOptions()).onFilterChange)==null||o.call(s,{field:e,filterItems:t,allFilters:this._filters})}resetFilter(e){e?delete this._filters[e]:this._filters={},this.applyFilters(),this._d.renderHeader(),this._d.doRender()}getFilterState(){return{...this._filters}}restoreFilter(e){this._filters={...e},this.applyFilters()}applyFilters(){var s,o,i,r;const e=this._d.getData();e.setFindFilter(this._d.getFindFilter(),this._d.getColLayout().visibleLeaves.map(a=>a.field)),e.applyFilter(this._filters),(o=(s=this._d).onReproject)==null||o.call(s);const t=e.rowCount;(i=this._d.getVs())==null||i.setTotalRows(t),(r=this._d.getPagination())==null||r.setTotalRows(t)}}class So{constructor(e){this._bar=null,this._input=null,this._count=null,this._lbl=null,this._close=null,this._filter="",this._d=e}get findFilter(){return this._filter}init(e){const t=document.createElement("div");t.className="og-find-bar",t.hidden=!0;const s=document.createElement("span");s.className="og-find-label",s.textContent=this._d.t("findBar.label");const o=document.createElement("input");o.type="text",o.className="og-find-input",o.placeholder=this._d.t("findBar.placeholder"),o.setAttribute("aria-label",this._d.t("findBar.searchAria"));const i=document.createElement("span");i.className="og-find-count";const r=document.createElement("button");r.className="og-find-close",r.textContent="✕",r.setAttribute("aria-label",this._d.t("findBar.closeAria")),t.appendChild(s),t.appendChild(o),t.appendChild(i),t.appendChild(r),e.insertBefore(t,e.firstChild),o.addEventListener("input",()=>{this._filter=o.value.trim(),this._apply()}),o.addEventListener("keydown",a=>{a.key==="Escape"&&this.close()}),r.addEventListener("click",()=>this.close()),this._bar=t,this._input=o,this._count=i,this._lbl=s,this._close=r}refreshLabels(){this._lbl&&(this._lbl.textContent=this._d.t("findBar.label")),this._input&&(this._input.placeholder=this._d.t("findBar.placeholder"),this._input.setAttribute("aria-label",this._d.t("findBar.searchAria"))),this._close&&this._close.setAttribute("aria-label",this._d.t("findBar.closeAria")),this._count&&this._filter&&(this._count.textContent=this._d.t("findBar.countBadge",{n:this._d.getData().rowCount}))}open(){this._bar&&(this._bar.hidden=!1,this._input.focus(),this._input.select())}close(){this._bar&&(this._bar.hidden=!0,this._filter="",this._input.value="",this._count&&(this._count.textContent=""),this._apply())}_apply(){var o,i;const e=this._d.getData(),t=this._d.getColLayout().visibleLeaves.map(r=>r.field);e.setFindFilter(this._filter,t),e.applyFilter(this._d.getFilters());const s=e.rowCount;(o=this._d.getVs())==null||o.setTotalRows(s),(i=this._d.getPagination())==null||i.setTotalRows(s),this._count&&(this._count.textContent=this._filter?this._d.t("findBar.countBadge",{n:s}):""),this._d.doRender()}}class Ao{constructor(e){this._d=e}handleCellClick(e,t,s){var d,c,h,u,g,p,f,w,m;const o=this._d.getOptions(),i=this._d.getRowMgr(),r=this._d.getEditMgr();o.selection==="single"||o.selection==="row"?i.selectSingle(e):o.selection==="multiple"?s.ctrlKey||s.metaKey?i.selectToggle(e):i.selectSingle(e):o.selection==="cells"&&t>=0&&((c=(d=this._d).onCellsClick)==null||c.call(d,e,t,s.shiftKey));const a=this._d.getData().getRowByIndex(e),l=this._d.getColLayout().visibleLeaves[t];if(a&&l){const _=l.editable!==!1&&(l.editable!==void 0||o.editable);if(Ne(l)&&_){const F=a[l.field];this._d.writeCell(e,l.field,!F)}if(l.type==="radio"){const F=l.group;for(const S of this._d.getColLayout().visibleLeaves)S.type==="radio"&&S.field!==l.field&&(!F||S.group===F)&&this._d.getData().updateCell(e,S.field,!1);this._d.writeCell(e,l.field,!0)}let y=a[l.field];if(y===void 0&&l.formula)try{const F=l.formulaPrecision??30,S=as(l.formula,a,F);y=S instanceof v?l.precision!=null?S.toFixed(l.precision):S.toString():String(S)}catch{}const M={type:"cellClick",rowIndex:e,columnIndex:t,field:l.field,value:y,row:a,column:l,target:s.target,originalEvent:s};this._d.emit("cellClick",M),(h=o.onCellClick)==null||h.call(o,M);const k={type:"rowClick",rowIndex:e,row:a,target:s.target,originalEvent:s};this._d.emit("rowClick",k),(u=o.onRowClick)==null||u.call(o,k);const b=l.type==="select";!(r.activeEditor!=null&&((g=r.editCell)==null?void 0:g.ri)===e&&((p=r.editCell)==null?void 0:p.ci)===t)&&(o.editMode==="click"||b)&&!Ne(l)&&r.startEdit(e,t,s)}r.activeEditor&&((f=r.editCell)==null?void 0:f.ri)===e&&((w=r.editCell)==null?void 0:w.ci)===t||o.selection!=="cells"&&(this._d.doRender(),this._d.emit("selectionChange",{rows:i.getSelections(),rowIndexes:[...i.selectedRows]}),(m=o.onSelectionChange)==null||m.call(o,{rows:i.getSelections(),rowIndexes:[...i.selectedRows],cells:[]}))}handleCellDblClick(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellDblClick",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellDblClick",a),(d=r.onCellDblClick)==null||d.call(r,a);const l={type:"rowDblClick",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowDblClick",l),(c=r.onRowDblClick)==null||c.call(r,l),r.editMode==="dblclick"&&this._d.getEditMgr().startEdit(e,t,s)}handleCellMouseOver(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellMouseOver",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseOver",a),(d=r.onCellMouseOver)==null||d.call(r,a);const l={type:"rowMouseOver",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseOver",l),(c=r.onRowMouseOver)==null||c.call(r,l)}handleCellMouseOut(e,t,s){var d,c;const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellMouseOut",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseOut",a),(d=r.onCellMouseOut)==null||d.call(r,a);const l={type:"rowMouseOut",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseOut",l),(c=r.onRowMouseOut)==null||c.call(r,l)}handleCellMouseDown(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseDown)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellMouseDown",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseDown",a),(h=r.onCellMouseDown)==null||h.call(r,a);const l={type:"rowMouseDown",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseDown",l),(u=r.onRowMouseDown)==null||u.call(r,l)}handleCellMouseUp(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseUp)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellMouseUp",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseUp",a),(h=r.onCellMouseUp)==null||h.call(r,a);const l={type:"rowMouseUp",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseUp",l),(u=r.onRowMouseUp)==null||u.call(r,l)}handleCellMouseMove(e,t,s){var d,c,h,u;(c=(d=this._d).rangeMouseMove)==null||c.call(d,e,t,s);const o=this._d.getData().getRowByIndex(e),i=this._d.getColLayout().visibleLeaves[t];if(!o||!i)return;const r=this._d.getOptions(),a={type:"cellMouseMove",rowIndex:e,columnIndex:t,field:i.field,value:o[i.field],row:o,column:i,target:s.target,originalEvent:s};this._d.emit("cellMouseMove",a),(h=r.onCellMouseMove)==null||h.call(r,a);const l={type:"rowMouseMove",rowIndex:e,row:o,target:s.target,originalEvent:s};this._d.emit("rowMouseMove",l),(u=r.onRowMouseMove)==null||u.call(r,l)}handleCellKeyEvt(e,t){var c,h,u;const s=this._d.getEditMgr();if(!s.focusCell||s.activeEditor)return;const{ri:o,ci:i}=s.focusCell,r=this._d.getData().getRowByIndex(o),a=this._d.getColLayout().visibleLeaves[i];if(!r||!a)return;const l=this._d.getOptions(),d={type:e,rowIndex:o,columnIndex:i,field:a.field,value:r[a.field],row:r,column:a,key:t.key,target:this._d.getContainer(),originalEvent:t};this._d.emit(e,d),e==="cellKeyDown"?(c=l.onCellKeyDown)==null||c.call(l,d):e==="cellKeyUp"?(h=l.onCellKeyUp)==null||h.call(l,d):(u=l.onCellKeyPress)==null||u.call(l,d)}}function Lo(n,e){return{startRow:Math.min(n.ri,e.ri),endRow:Math.max(n.ri,e.ri),startCol:Math.min(n.ci,e.ci),endCol:Math.max(n.ci,e.ci)}}class Io{constructor(e){this._anchor={ri:0,ci:0},this._focus={ri:0,ci:0},this._identity={rowIds:[],fields:[]},this._rects=[],this._hasSelection=!1,this._additive=!1,this._host=e}get hasSelection(){return this._hasSelection}getAnchor(){return{...this._anchor}}getFocus(){return{...this._focus}}getIdentity(){return{rowIds:[...this._identity.rowIds],fields:[...this._identity.fields]}}getRangeSelection(){return this._rects.map(e=>({...e}))}getActiveRange(){return this._rects[0]?{...this._rects[0]}:null}getPrimaryRect(){return this.getActiveRange()}getProjectedFlatRows(){return this._identity.rowIds.map(e=>this._host.flatIndexOfRowId(e)).filter(e=>e>=0).sort((e,t)=>e-t)}beginDrag(e,t,s={}){s.shift&&this._hasSelection?this._focus={ri:e,ci:t}:(this._anchor={ri:e,ci:t},this._focus={ri:e,ci:t}),this._hasSelection=!0,this._additive=!!s.additive,this._recompute()}updateFocus(e,t){this._hasSelection&&(this._focus={ri:e,ci:t},this._recompute())}endDrag(){this._hasSelection&&this.snapshotIdentity()}get additive(){return this._additive}click(e,t){this._anchor={ri:e,ci:t},this._focus={ri:e,ci:t},this._hasSelection=!0,this._recompute(),this.snapshotIdentity()}shiftClickExtend(e,t){if(!this._hasSelection){this.click(e,t);return}this._focus={ri:e,ci:t},this._recompute(),this.snapshotIdentity()}extendFocus(e){if(!this._hasSelection)return;const t=Math.max(0,this._host.count()-1),s=Math.max(0,this._host.visibleFields().length-1);let{ri:o,ci:i}=this._focus;switch(e){case"up":o=Math.max(0,o-1);break;case"down":o=Math.min(t,o+1);break;case"left":i=Math.max(0,i-1);break;case"right":i=Math.min(s,i+1);break}this._focus={ri:o,ci:i},this._recompute(),this.snapshotIdentity()}setRect(e){this._anchor={ri:e.startRow,ci:e.startCol},this._focus={ri:e.endRow,ci:e.endCol},this._hasSelection=!0,this._rects=[{...e}],this.snapshotIdentity()}clear(){this._hasSelection=!1,this._rects=[],this._identity={rowIds:[],fields:[]}}snapshotIdentity(){const e=this._rects[0];if(!e){this._identity={rowIds:[],fields:[]};return}const t=[];for(let i=e.startRow;i<=e.endRow;i++){const r=this._host.rowIdOfFlat(i);r&&t.push(r)}const o=this._host.visibleFields().slice(e.startCol,e.endCol+1);this._identity={rowIds:t,fields:o}}reproject(){if(!this._hasSelection)return;if(this._identity.rowIds.length===0||this._identity.fields.length===0){this._rects=[];return}const e=this._identity.rowIds.map(l=>this._host.flatIndexOfRowId(l)).filter(l=>l>=0),t=this._host.visibleFields(),s=this._identity.fields.map(l=>t.indexOf(l)).filter(l=>l>=0);if(e.length===0||s.length===0){this._rects=[];return}const o=Math.min(...e),i=Math.max(...e),r=Math.min(...s),a=Math.max(...s);this._rects=[{startRow:o,endRow:i,startCol:r,endCol:a}],this._anchor={ri:o,ci:r},this._focus={ri:i,ci:a}}_recompute(){this._rects=[Lo(this._anchor,this._focus)]}}const To=/^-?\d+(\.\d+)?$/,Do=/^(.*?)(\d+)$/;function Oo(n){const e=String(n??"").trim();if(e===""||!To.test(e))return null;try{return v.from(e)}catch{return null}}function $o(n){const e=n.length;if(e===0)return{kind:"copy"};const t=n.map(Oo);if(t.every(s=>s!==null)){if(e===1)return{kind:"copy"};const s=t,o=s.slice(1).map((r,a)=>r.sub(s[a]));return o.every(r=>r.eq(o[0]))?{kind:"arith",step:o[0],values:s}:{kind:"copy"}}if(e>=2){const s=n.map(o=>Do.exec(String(o??"")));if(s.every(o=>o!==null)){const o=s.map(r=>r[1]);if(o.every(r=>r===o[0])){const r=s.map(d=>v.from(d[2])),a=r.slice(1).map((d,c)=>d.sub(r[c]));if(a.every(d=>d.eq(a[0])))return{kind:"text-suffix",step:a[0],values:r,prefix:o[0]}}}}return{kind:"copy"}}function ks(n,e,t){return t<=0?0:n==="down"||n==="right"?(e-1)%t:(t-e%t)%t}function zo(n,e,t,s){const o=e.length;if(n.kind==="copy"||!n.values||!n.step)return e[ks(t,s,o)];const i=t==="down"||t==="right",r=i?n.values[n.values.length-1]:n.values[0],a=i?n.step:n.step.neg(),l=r.add(a.mul(s));return n.kind==="text-suffix"?`${n.prefix}${l.toNumber()}`:l.toNumber()}function Ae(n,e){const t=[];for(let s=n;s<=e;s++)t.push(s);return t}function Ho(n,e,t,s,o){var a;const i=n.resolveFlatRow(e);return i.kind!=="data"||!i.rowId?{rowIndex:e,field:t,action:"skip",reason:"non-data-row"}:n.isEditable&&!n.isEditable(i.rowId,t)?{rowIndex:e,field:t,action:"skip",reason:"not-editable"}:!!((a=n.hasCellFormula)!=null&&a.call(n,i.rowId,t))&&!n.overwriteFormula?(o(),{rowIndex:e,field:t,action:"skip",reason:"formula-preserved"}):{rowIndex:e,field:t,action:"value",value:s}}function Bo(n,e,t,s,o,i,r,a){var g,p;const l=n.resolveFlatRow(e);if(l.kind!=="data"||!l.rowId)return{rowIndex:e,field:s,action:"skip",reason:"non-data-row"};if(n.isEditable&&!n.isEditable(l.rowId,s))return{rowIndex:e,field:s,action:"skip",reason:"not-editable"};const d=n.resolveFlatRow(o),c=!!(d.rowId&&((g=n.hasCellFormula)!=null&&g.call(n,d.rowId,r)));if(c&&d.rowId){if(n.forceCopyFormula){const f=n.getCellValue(o,r);return{rowIndex:e,field:s,action:"setFormula",formula:String(f)}}if(n.offsetFormula){const f=n.offsetFormula(d.rowId,r,e-o,t-i);return{rowIndex:e,field:s,action:"setFormula",formula:f}}}const h=!!((p=n.hasCellFormula)!=null&&p.call(n,l.rowId,s));if(!c&&h&&!n.overwriteFormula)return a(),{rowIndex:e,field:s,action:"skip",reason:"formula-preserved"};const u=n.getCellValue(o,r);return{rowIndex:e,field:s,action:"value",value:u}}function Vo(n,e,t,s,o){const i=t==="up"||t==="down",r=[];let a=0;const l=()=>{a++},d=i?Ae(n.startCol,n.endCol):Ae(n.startRow,n.endRow);for(const c of d){const h=i?o.fieldAt(c):void 0,u=i?Ae(n.startRow,n.endRow).map(m=>({ri:m,ci:c})):Ae(n.startCol,n.endCol).map(m=>({ri:c,ci:m})),g=u.map(m=>{const _=i?h:o.fieldAt(m.ci);return _?o.getCellValue(m.ri,_):void 0}),p=s==="series"?$o(g):{kind:"copy"},f=i?Ae(e.startRow,e.endRow):Ae(e.startCol,e.endCol);(t==="down"||t==="right"?f:[...f].reverse()).forEach((m,_)=>{const y=_+1,M=i?m:c,k=i?c:m,b=i?h:o.fieldAt(m);if(!b)return;if(p.kind!=="copy"){const P=zo(p,g,t,y);r.push(Ho(o,M,b,P,l));return}const x=ks(t,y,u.length),F=u[x],S=i?h:o.fieldAt(F.ci);S&&r.push(Bo(o,M,k,b,F.ri,F.ci,S,l))})}return{items:r,skippedFormula:a}}function Po(n,e){return e==="down"?n.endRow<=n.startRow?null:{source:{startRow:n.startRow,endRow:n.startRow,startCol:n.startCol,endCol:n.endCol},target:{startRow:n.startRow+1,endRow:n.endRow,startCol:n.startCol,endCol:n.endCol}}:n.endCol<=n.startCol?null:{source:{startRow:n.startRow,endRow:n.endRow,startCol:n.startCol,endCol:n.startCol},target:{startRow:n.startRow,endRow:n.endRow,startCol:n.startCol+1,endCol:n.endCol}}}function No(n,e){const t=[];for(let s=n.startRow;s<=n.endRow;s++){const o=[];for(let i=n.startCol;i<=n.endCol;i++){const r=e.fieldAt(i);if(!r){o.push("");continue}const a=e.getDisplayText?e.getDisplayText(s,r):String(e.getCellValue(s,r)??"");o.push(a)}t.push(o.join(" "))}return t.join(`
|
|
72
|
-
`)}function Wo(n){return n===""?[[""]]:n.split(`
|
|
73
|
-
`).map(e=>e.split(" "))}function Ko(n,e,t){var c;const s=n.length,o=s>0?Math.max(...n.map(h=>h.length)):0;if(s===0||o===0)return[];const i=e.endRow-e.startRow+1,r=e.endCol-e.startCol+1,a=Math.max(i,s),l=Math.max(r,o),d=[];for(let h=0;h<a;h++)for(let u=0;u<l;u++){const g=e.startRow+h,p=e.startCol+u,f=t.fieldAt(p);if(!f)continue;const w=t.resolveFlatRow(g);if(w.kind!=="data"||!w.rowId){d.push({rowIndex:g,field:f,action:"skip",reason:"non-data-row"});continue}if(t.isEditable&&!t.isEditable(w.rowId,f)){d.push({rowIndex:g,field:f,action:"skip",reason:"not-editable"});continue}const m=((c=n[h%s])==null?void 0:c[u%o])??"";d.push({rowIndex:g,field:f,action:"value",value:m})}return d}function Es(n,e){const t=[];for(let s=n.startRow;s<=n.endRow;s++){const o=[];for(let i=n.startCol;i<=n.endCol;i++){const r=e.fieldAt(i);o.push(r?e.getCellValue(s,r):void 0)}t.push(o)}return t}function Uo(n,e){const t=Es(n,e).flat(),s=[];for(const o of t){const i=String(o??"").trim();i===""||!/^-?\d+(\.\d+)?$/.test(i)||s.push(v.from(i))}return s.length===0?null:{sum:v.sum(s).toString(),avg:v.avg(s).toString(),count:s.length,min:v.min(s).toString(),max:v.max(s).toString()}}class qo{constructor(e){this._isDragging=!1,this._fillDragSource=null,this._fillDragStart=null,this._fillPreview=null,this._handlePointerId=null,this._autoScrollRAF=null,this._autoScrollVX=0,this._autoScrollVY=0,this._overlayEl=null,this._borderEl=null,this._previewEl=null,this._handleEl=null,this._mountedWrap=null,this._d=e;const t={count:()=>this._d.getFlatModel().count(),resolveFlatRow:s=>this._d.getFlatModel().resolveFlatRow(s),flatIndexOfRowId:s=>this._d.getFlatModel().flatIndexOfRowId(s),rowIdOfFlat:s=>this._d.getFlatModel().rowIdOfFlat(s),visibleFields:()=>this._d.getColLayout().visibleLeaves.map(s=>s.field)};this._model=new Io(t)}isEnabled(){var t;const e=this._d.getOptions();return((t=e.rangeSelection)==null?void 0:t.enabled)??e.selection==="cells"}_rangeOpts(){const e=this._d.getOptions().rangeSelection;return{fillHandle:(e==null?void 0:e.fillHandle)??!0,multiRange:(e==null?void 0:e.multiRange)??!1,autoScrollEdge:(e==null?void 0:e.autoScrollEdge)??24,seriesFill:(e==null?void 0:e.seriesFill)??!0,enabledInTreeGroup:(e==null?void 0:e.enabledInTreeGroup)??!1,fillOverwriteFormula:(e==null?void 0:e.fillOverwriteFormula)??!1}}_editorActive(){return this._d.getEditMgr().activeEditor!=null}hasSelection(){return this._model.hasSelection}getRangeSelection(){return this._model.getRangeSelection()}getActiveRange(){return this._model.getActiveRange()}getFillPreview(){return this._fillPreview}getRangeValues(){const e=this.getActiveRange();return e?Es(e,this._queryCtx()):[]}getRangeStats(){const e=this.getActiveRange();return e?Uo(e,this._queryCtx()):null}_queryCtx(){return{fieldAt:e=>{var t;return(t=this._d.getColLayout().visibleLeaves[e])==null?void 0:t.field},getCellValue:(e,t)=>this._d.getData().getCellValue(e,t)}}handleCellMouseDown(e,t,s){if(!this.isEnabled()||this._editorActive()||e<0||t<0)return;this._model.beginDrag(e,t,{additive:s.ctrlKey||s.metaKey,shift:s.shiftKey}),this._isDragging=!0,this._d.setFocusCell(e,t),this._d.doRender();const o=()=>{document.removeEventListener("mouseup",o),this.handleCellMouseUp(-1,-1,s)};document.addEventListener("mouseup",o)}handleCellMouseMove(e,t,s){this._isDragging&&(e>=0&&t>=0&&(this._model.updateFocus(e,t),this._d.doRender()),this._maybeAutoscroll(s))}handleCellMouseUp(e,t,s){this._isDragging&&(this._isDragging=!1,this._stopAutoscroll(),this._model.endDrag(),this._afterModelChange(!0))}handleClick(e,t,s){if(!this.isEnabled()||this._editorActive())return;s?this._model.shiftClickExtend(e,t):this._model.click(e,t);const o=this._model.getFocus();this._d.setFocusCell(o.ri,o.ci),this._afterModelChange(!0)}extendFocus(e){if(!this.isEnabled()||!this._model.hasSelection)return;this._model.extendFocus(e);const t=this._model.getFocus();this._d.setFocusCell(t.ri,t.ci),this._afterModelChange(!0)}clear(){this._model.hasSelection&&(this._model.clear(),this._afterModelChange(!0))}clearRangeSelection(){this.clear()}setRangeSelection(e){const t=Array.isArray(e)?e[0]:e;if(!t){this.clear();return}this._model.setRect(t);const s=this._model.getFocus();this._d.setFocusCell(s.ri,s.ci),this._afterModelChange(!0)}reproject(){var t,s;if(!this._model.hasSelection)return;this._model.reproject();const e=this._model.getActiveRange();this._d.emit("rangeChange",{range:e}),(s=(t=this._d.getOptions()).onRangeChange)==null||s.call(t,{range:e})}_afterModelChange(e){var i,r;if(this._d.doRender(),!e)return;const t=this._model.getRangeSelection(),s=this._model.getActiveRange(),o=this._d.getOptions();this._d.emit("selectionChange",{rows:[],rowIndexes:[],cells:t}),(i=o.onSelectionChange)==null||i.call(o,{rows:[],rowIndexes:[],cells:t}),this._d.emit("rangeChange",{range:s}),(r=o.onRangeChange)==null||r.call(o,{range:s}),this._announceSelection()}_announceSelection(){const e=this.getActiveRange();if(!e)return;const t=e.endRow-e.startRow+1,s=e.endCol-e.startCol+1;this._d.announce(this._d.t("range.selectionAnnounce",{r1:e.startRow+1,c1:e.startCol+1,r2:e.endRow+1,c2:e.endCol+1,n:t*s}))}ctrlFill(e){if(!this.isEnabled())return;const t=this.getActiveRange();if(!t)return;const s=Po(t,e);s&&this._commitFill(s.source,s.target,e,"copy")}fillRange(e,t,s="copy"){let o;t.startRow<e.startRow?o="up":t.endRow>e.endRow?o="down":t.startCol<e.startCol?o="left":o="right",this._commitFill(e,t,o,s)}_isEditable(e,t){const s=this._d.getColLayout().getColumnByField(t);if(!s||s.editable===!1)return!1;const o=this._d.getOptions();if(typeof s.editable=="function"){const i=this._d.getFlatModel().flatIndexOfRowId(e),r=i>=0?this._d.getData().getRowByIndex(i):void 0;return r?!!s.editable(r,i):!1}return s.editable!==void 0?!0:!!o.editable}_commitFill(e,t,s,o){var p,f,w,m;const i=this._rangeOpts(),r=i.seriesFill?o:"copy",a={resolveFlatRow:_=>this._d.getFlatModel().resolveFlatRow(_),fieldAt:_=>{var y;return(y=this._d.getColLayout().visibleLeaves[_])==null?void 0:y.field},getCellValue:(_,y)=>this._d.getData().getCellValue(_,y),isEditable:(_,y)=>this._isEditable(_,y),hasCellFormula:(_,y)=>{var M,k;return((k=(M=this._d).hasCellFormula)==null?void 0:k.call(M,_,y))??!1},offsetFormula:(_,y,M,k)=>{var b,x;return((x=(b=this._d).offsetFormula)==null?void 0:x.call(b,_,y,M,k))??""},overwriteFormula:i.fillOverwriteFormula},l=Vo(e,t,s,r,a),d=[],c=[],h=[];for(const _ of l.items)if(_.action==="value"){const y=this._d.getData().getCellValue(_.rowIndex,_.field);d.push({rowIndex:_.rowIndex,field:_.field,oldValue:y,newValue:_.value}),c.push({rowIndex:_.rowIndex,field:_.field,value:_.value})}else if(_.action==="setFormula"&&_.formula!=null){const y=this._d.getFlatModel().resolveFlatRow(_.rowIndex);y.kind==="data"&&y.rowId&&(h.push({rowId:y.rowId,field:_.field,formula:_.formula}),d.push({rowIndex:_.rowIndex,field:_.field,oldValue:this._d.getData().getCellValue(_.rowIndex,_.field),newValue:_.formula}))}const u={source:e,target:t,mode:r,written:d,skippedFormula:l.skippedFormula,cancel:!1};if(this._d.emit("rangeFill",u),(f=(p=this._d.getOptions()).onRangeFill)==null||f.call(p,u),u.cancel)return;c.length&&this._d.writeCells(c);for(const _ of h)(m=(w=this._d).setCellFormulaByRowId)==null||m.call(w,_.rowId,_.field,_.formula);l.skippedFormula>0&&this._d.announce(this._d.t("range.formulaPreserved",{count:l.skippedFormula}));const g=l.items.filter(_=>_.action==="skip"&&_.reason!=="formula-preserved").length;g>0&&this._d.announce(this._d.t("range.fillSkipped",{count:g}))}copyText(){var o,i;const e=this.getActiveRange();if(!e)return null;const s=No(e,{fieldAt:r=>{var a;return(a=this._d.getColLayout().visibleLeaves[r])==null?void 0:a.field},getCellValue:(r,a)=>this._d.getData().getCellValue(r,a),getDisplayText:(r,a)=>this._d.getDisplayValue(r,a)});return this._d.emit("rangeCopy",{range:e,text:s}),(i=(o=this._d.getOptions()).onRangeCopy)==null||i.call(o,{range:e,text:s}),s}pasteText(e){const t=this.getActiveRange();if(!t)return!1;const s=Wo(e),r=Ko(s,t,{resolveFlatRow:a=>this._d.getFlatModel().resolveFlatRow(a),fieldAt:a=>{var l;return(l=this._d.getColLayout().visibleLeaves[a])==null?void 0:l.field},isEditable:(a,l)=>this._isEditable(a,l)}).filter(a=>a.action==="value").map(a=>({rowIndex:a.rowIndex,field:a.field,value:a.value}));return this._d.writeCells(r),!0}_maybeAutoscroll(e){const t=this._d.getRenderer();if(!t)return;const o=t.bodyWrapper.getBoundingClientRect(),i=this._rangeOpts().autoScrollEdge;let r=0,a=0;const l=e.clientY-o.top,d=o.bottom-e.clientY,c=e.clientX-o.left,h=o.right-e.clientX;if(l<i?a=-this._scrollSpeed(i-l):d<i&&(a=this._scrollSpeed(i-d)),c<i?r=-this._scrollSpeed(i-c):h<i&&(r=this._scrollSpeed(i-h)),r===0&&a===0){this._stopAutoscroll();return}this._autoScrollVX=r,this._autoScrollVY=a,this._autoScrollRAF==null&&this._runAutoscroll()}_scrollSpeed(e){return Math.max(2,Math.min(20,e))}_runAutoscroll(){const e=this._d.getRenderer();if(!e){this._autoScrollRAF=null;return}e.bodyWrapper.scrollTop+=this._autoScrollVY,e.bodyWrapper.scrollLeft+=this._autoScrollVX,this._autoScrollRAF=requestAnimationFrame(()=>this._runAutoscroll())}_stopAutoscroll(){this._autoScrollRAF!=null&&(cancelAnimationFrame(this._autoScrollRAF),this._autoScrollRAF=null),this._autoScrollVX=0,this._autoScrollVY=0}mount(e){if(this._mountedWrap===e)return;this._mountedWrap=e;const t=document.createElement("div");t.className="og-range-overlay",t.style.cssText="position:sticky;top:0;left:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:6;";const s=document.createElement("div");s.className="og-range-border",s.style.cssText="position:absolute;box-sizing:border-box;border:2px solid var(--og-range-border,#1976d2);pointer-events:none;display:none;";const o=document.createElement("div");o.className="og-range-fill-preview",o.style.cssText="position:absolute;box-sizing:border-box;border:1px dashed var(--og-range-border,#1976d2);pointer-events:none;display:none;";const i=document.createElement("div");i.className="og-range-fill-handle",i.setAttribute("role","button"),i.setAttribute("aria-label",this._d.t("range.fillHandleAria")),i.style.cssText="position:absolute;display:none;pointer-events:auto;background-color:var(--og-fill-handle-bg,#1976d2);",i.addEventListener("pointerdown",r=>this._onHandlePointerDown(r)),t.appendChild(s),t.appendChild(o),t.appendChild(i),e.insertBefore(t,e.firstChild),e.addEventListener("scroll",()=>this.repaint(),{passive:!0}),this._overlayEl=t,this._borderEl=s,this._previewEl=o,this._handleEl=i}repaint(){if(!this._overlayEl)return;const e=this._d.getRenderer(),t=this.getActiveRange();if(!e||!t){this._hideOverlay();return}const s=e.bodyWrapper.getBoundingClientRect(),o=e.getCellEl(t.startRow,t.startCol),i=e.getCellEl(t.endRow,t.endCol);if(!o||!i){this._hideOverlay();return}const r=o.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Math.min(r.left,a.left)-s.left,d=Math.min(r.top,a.top)-s.top,c=Math.max(r.right,a.right)-s.left,h=Math.max(r.bottom,a.bottom)-s.top;if(Object.assign(this._borderEl.style,{display:"block",left:`${l}px`,top:`${d}px`,width:`${Math.max(0,c-l)}px`,height:`${Math.max(0,h-d)}px`}),this._rangeOpts().fillHandle?Object.assign(this._handleEl.style,{display:"block",left:`${c}px`,top:`${h}px`}):this._handleEl.style.display="none",this._fillPreview){const u=this._fillPreview.target,g=e.getCellEl(u.startRow,u.startCol),p=e.getCellEl(u.endRow,u.endCol);if(g&&p){const f=g.getBoundingClientRect(),w=p.getBoundingClientRect(),m=Math.min(f.left,w.left)-s.left,_=Math.min(f.top,w.top)-s.top,y=Math.max(f.right,w.right)-s.left,M=Math.max(f.bottom,w.bottom)-s.top;Object.assign(this._previewEl.style,{display:"block",left:`${m}px`,top:`${_}px`,width:`${Math.max(0,y-m)}px`,height:`${Math.max(0,M-_)}px`});return}}this._previewEl.style.display="none"}_hideOverlay(){this._borderEl&&(this._borderEl.style.display="none"),this._handleEl&&(this._handleEl.style.display="none"),this._previewEl&&(this._previewEl.style.display="none")}getOverlayExtraOpts(){return{_rangeRects:this._model.getRangeSelection()}}_resolveCellAtPoint(e,t){const s=typeof document.elementFromPoint=="function"?document.elementFromPoint(e,t):null,o=s==null?void 0:s.closest(".og-cell"),i=o==null?void 0:o.closest(".og-row");if(!o||!i)return null;const r=o.getAttribute("aria-colindex"),a=i.getAttribute("aria-rowindex");return r==null||a==null?null:{ri:Number(a)-1,ci:Number(r)-1}}_onHandlePointerDown(e){var i;const t=this.getActiveRange();if(!t)return;e.stopPropagation(),e.preventDefault(),this._handlePointerId=e.pointerId;try{(i=this._handleEl)==null||i.setPointerCapture(e.pointerId)}catch{}this._fillDragSource=t,this._fillDragStart={x:e.clientX,y:e.clientY};const s=r=>this._onHandlePointerMove(r),o=r=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o),this._onHandlePointerUp(r)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",o)}_onHandlePointerMove(e){const t=this._fillDragSource,s=this._fillDragStart;if(!t||!s)return;const o=this._resolveCellAtPoint(e.clientX,e.clientY);if(!o)return;const i=e.clientX-s.x,r=e.clientY-s.y,a=Math.abs(r)>=Math.abs(i);let l,d;if(a)if(o.ri>t.endRow)l="down",d={startRow:t.endRow+1,endRow:o.ri,startCol:t.startCol,endCol:t.endCol};else if(o.ri<t.startRow)l="up",d={startRow:o.ri,endRow:t.startRow-1,startCol:t.startCol,endCol:t.endCol};else{this._fillPreview=null,this.repaint();return}else if(o.ci>t.endCol)l="right",d={startRow:t.startRow,endRow:t.endRow,startCol:t.endCol+1,endCol:o.ci};else if(o.ci<t.startCol)l="left",d={startRow:t.startRow,endRow:t.endRow,startCol:o.ci,endCol:t.startCol-1};else{this._fillPreview=null,this.repaint();return}const h=this._rangeOpts().seriesFill?"series":"copy",g=e.ctrlKey||e.metaKey?h==="series"?"copy":"series":h;this._fillPreview={source:t,target:d,axis:l,mode:g},this.repaint()}_onHandlePointerUp(e){const t=this._fillPreview;this._fillDragSource=null,this._fillDragStart=null,this._fillPreview=null,this._handlePointerId=null,t&&this._commitFill(t.source,t.target,t.axis,t.mode),this.repaint()}}class jo{constructor(e){this._groupFields=[],this._groupExpandedKeys=new Set,this._groupFlatRows=[],this._isGroupMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys=new Set,this._isTreeMode=!1,this._d=e}get isGroupMode(){return this._isGroupMode}get isTreeMode(){return this._isTreeMode}get groupFlatRows(){return this._groupFlatRows}get treeFlatRows(){return this._treeFlatRows}groupBy(e){this._groupFields=e,this._groupExpandedKeys.clear(),this._isGroupMode=e.length>0,this.rebuildGroups()}clearGroup(){var e;this._groupFields=[],this._groupExpandedKeys.clear(),this._isGroupMode=!1,this._groupFlatRows=[],this._d.setFlatBacking(null),(e=this._d.getVs())==null||e.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandAll(){if(!this._isGroupMode)return;const e=Bt(this._d.getData(),this._groupFields,this._getSummaryDefs(),void 0,void 0,this._groupKeyFn());_s(e).forEach(t=>this._groupExpandedKeys.add(t)),this.rebuildGroups()}_groupKeyFn(){return this._d.getStrategy?this._d.getStrategy("groupKeyFn",void 0):void 0}collapseAll(){this._groupExpandedKeys.clear(),this._isGroupMode&&this.rebuildGroups()}handleGroupToggle(e){this._groupExpandedKeys.has(e)?this._groupExpandedKeys.delete(e):this._groupExpandedKeys.add(e),this.rebuildGroups()}rebuildGroups(){var r;const e=this._d.getData(),t=this._d.getDataLayer(),s=a=>{const l=e.indexOf(a);return l>=0?t.getRowState(l):"none"},o=Bt(e,this._groupFields,this._getSummaryDefs(),this._groupExpandedKeys,s,this._groupKeyFn());this._groupFlatRows=fs(o),this._d.setFlatBacking(()=>this._groupFlatRows);const i=this._d.getFlatCount();(r=this._d.getVs())==null||r.setTotalRows(i),this._d.doRenderFull(i)}enableTree(){this._isTreeMode=!0,this._isGroupMode=!1;const e=this._d.getOptions();if(e.expandOnLoad){const t=ft(this._d.getData(),{idField:e.treeId,parentIdField:e.treeParentId});_t(t).forEach(s=>this._treeExpandedKeys.add(s))}this.rebuildTree()}disableTree(){var e;this._isTreeMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys.clear(),this._d.setFlatBacking(null),(e=this._d.getVs())==null||e.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandNodes(e,t=!0){const s=Array.isArray(e)?e:[e];for(const o of s)t?this._treeExpandedKeys.add(o):this._treeExpandedKeys.delete(o);this._isTreeMode&&this.rebuildTree()}expandAllNodes(){this._isTreeMode&&(_t(this._treeRoots).forEach(e=>this._treeExpandedKeys.add(e)),this.rebuildTree())}collapseAllNodes(){this._isTreeMode&&(this._treeExpandedKeys.clear(),this.rebuildTree())}handleTreeToggle(e){Gi(this._treeExpandedKeys,e),this.rebuildTree()}rebuildTree(){var s;const e=this._d.getOptions();this._treeRoots=ft(this._d.getData(),{idField:e.treeId,parentIdField:e.treeParentId,expandOnLoad:e.expandOnLoad},this._treeExpandedKeys),this._treeFlatRows=ws(this._treeRoots),this._d.setFlatBacking(()=>this._treeFlatRows);const t=this._d.getFlatCount();(s=this._d.getVs())==null||s.setTotalRows(t),this._d.doRenderFull(t)}_getSummaryDefs(){const e=this._d.getOptions().summary;if(!e)return[];if(e.rows&&e.rows.length>0)return e.fields.flatMap(s=>e.rows.map(o=>({field:s,op:o.op,format:o.format})));const t=Array.isArray(e.ops)?e.ops:e.ops?[e.ops]:["SUM"];return e.fields.map(s=>({field:s,op:t[0]??"SUM",format:e.format}))}}class Go{constructor(e={}){this._expanded=new Set,this._maxDepth=e.maxDepth??2,this._expandMultiple=e.expandMultiple??!0,this._depth=e.depth??0}get expandedRowIds(){return this._expanded}get size(){return this._expanded.size}get depth(){return this._depth}get maxDepth(){return this._maxDepth}get expandMultiple(){return this._expandMultiple}isExpanded(e){return this._expanded.has(e)}canExpand(){return this._depth<this._maxDepth}expand(e){return this._expanded.has(e)?!0:this.canExpand()?(this._expandMultiple||this._expanded.clear(),this._expanded.add(e),!0):!1}collapse(e){return this._expanded.delete(e)}toggle(e){return this._expanded.has(e)?(this.collapse(e),"collapsed"):this.expand(e)?"expanded":"rejected"}collapseAll(){const e=Array.from(this._expanded);return this._expanded.clear(),e}buildEventPayload(e,t,s,o){return{rowIndex:t,rowId:e,row:s,host:o}}}function Yo(n){return!!n&&n._isGroup===!0}function Xo(n){return!!n&&n._isTree===!0}function Zo(n){return!!n&&(n._isDetailHead===!0||n._isDetailFiller===!0)}function Jo(n){return!(n==null||Zo(n)||Yo(n))}function Qo(n){return Xo(n)?n.data:n}function er(n,e,t){if(t.getSlotCount){const i=Math.floor(t.getSlotCount(n,e));return Number.isFinite(i)&&i>0?i:1}const s=t.height??200,o=t.rowHeight>0?t.rowHeight:1;return Math.max(1,Math.ceil(s/o))}function tr(n,e){const t=[];if(e.expandedRowIds.size===0){for(const s of n)t.push(s);return t}for(const s of n){if(t.push(s),!Jo(s))continue;const o=Qo(s),i=o!=null?e.getRowId(o):null;if(i==null||!e.expandedRowIds.has(i))continue;const r=er(o,i,e),a={_isDetailHead:!0,_rowId:i,_masterFlatBase:s,_span:r};t.push(a);for(let l=1;l<r;l++)t.push({_isDetailFiller:!0,_rowId:i})}return t}class sr{constructor(e){this.adapter=e,this._entries=new Map}get size(){return this._entries.size}has(e){return this._entries.has(e)}getOrCreate(e,t){const s=this._entries.get(e);if(s)return s.attached=!0,s;const o=t(),i=this.adapter.create(e,o),r={host:o,instance:i,attached:!0};return this._entries.set(e,r),r}reattach(e){const t=this._entries.get(e);return!t||t.attached?!1:(this.adapter.reattach(t.instance,t.host),t.attached=!0,!0)}detach(e){const t=this._entries.get(e);return!t||!t.attached?!1:(this.adapter.detach(t.instance,t.host),t.attached=!1,!0)}detachAll(){for(const e of this._entries.keys())this.detach(e)}remove(e,t={}){const s=this._entries.get(e);if(s){if(t.cache){s.attached&&this.adapter.detach(s.instance,s.host),s.attached=!1;return}this.adapter.destroy(s.instance,s.host),this._entries.delete(e)}}getInstance(e){var t;return(t=this._entries.get(e))==null?void 0:t.instance}getHost(e){var t;return(t=this._entries.get(e))==null?void 0:t.host}isAttached(e){var t;return((t=this._entries.get(e))==null?void 0:t.attached)===!0}isEditing(e,t){if(!t)return!1;const s=this._entries.get(e);return!!s&&t(s.instance)}destroyAll(){for(const e of this._entries.values())this.adapter.destroy(e.instance,e.host);this._entries.clear()}}let Ut=!1;class ir{constructor(e){this._hosts=new Map,this._focusPendingRestore=null,this._d=e;const t=this._mdOpts();this._state=new Go({maxDepth:t.maxDepth??2,expandMultiple:t.expandMultiple??!0,depth:e.getDepth()});const s={create:(i,r)=>this._buildInstance(i,r),detach:(i,r)=>{r.remove()},reattach:()=>{},destroy:(i,r)=>{var a;try{(a=i==null?void 0:i.destroy)==null||a.call(i)}catch{}r.remove()}};this._cache=new sr(s),e.getFlatModel().registerSplice(i=>this._splice(i)),t.heightMode==="auto"&&!Ut&&(Ut=!0,console.warn("[OpenGrid] masterDetail.heightMode:'auto' 는 Spike-B(가변높이 VirtualScroll) 통과 전까지 미공개 기능입니다. 'fixed' 로 동작합니다(11_design_F2_v2.md §2.2/C12.2)."))}_mdOpts(){var e;return((e=this._d.getOptions())==null?void 0:e.masterDetail)??{}}get enabled(){return this._mdOpts().enabled===!0}get isActive(){return this.enabled&&this._state.size>0}get maxDepth(){return this._state.maxDepth}_resolveRowId(e){if(typeof e=="number"){const t=this._d.getFlatModel().resolveFlatRow(e);return t.kind==="data"||t.kind==="tree"?t.rowId??null:null}return(e==null?void 0:e.id)??null}isExpandedId(e){return this._state.isExpanded(e)}isRowExpanded(e){const t=this._resolveRowId(e);return t!=null&&this._state.isExpanded(t)}expandRow(e){if(!this.enabled)return;const t=this._resolveRowId(e);if(t==null||this._state.isExpanded(t))return;if(!this._state.expand(t)){this._d.announce(this._d.t("detail.depthLimitOpen",{max:this._state.maxDepth}));return}this._afterToggle(t,"expanded")}collapseRow(e){const t=this._resolveRowId(e);if(t==null||!this._state.isExpanded(t))return;const s=this._hosts.get(t);s&&document.activeElement&&s.contains(document.activeElement)&&(this._focusPendingRestore=t),this._state.collapse(t),this._releaseInstance(t),this._afterToggle(t,"collapsed")}toggleRow(e){const t=this._resolveRowId(e);t!=null&&(this._state.isExpanded(t)?this.collapseRow(e):this.expandRow(e))}collapseAllDetails(){const e=this._state.collapseAll();if(e.length!==0){for(const t of e)this._releaseInstance(t);this._rebuildAndRender();for(const t of e)this._d.emit("rowCollapse",{rowIndex:this._d.getFlatModel().flatIndexOfRowId(t),rowId:t,row:this._d.getRowById(t),host:null});this._d.announce(this._d.t("detail.collapsedAllAnnounce"))}}getDetailInstance(e){const t=this._resolveRowId(e);if(t!=null)return this._cache.getInstance(t)}resyncPanelWidths(){this.isActive&&this._rebuildAndRender()}getPanelHost(e){let t=this._hosts.get(e);return t||(t=document.createElement("div"),t.className="og-detail-host",t.style.cssText="width:100%;height:100%;box-sizing:border-box;overflow:auto;",this._hosts.set(e,t)),this._cache.getOrCreate(e,()=>t),this._focusPendingRestore===e&&(this._focusPendingRestore=null),t}_buildInstance(e,t){const s=this._mdOpts(),o=this._d.getRowById(e),i=this._d.getDepth(),r={grid:this._d.getGridInstance(),rowId:e,depth:i,collapse:()=>this.collapseRow({id:e}),refresh:()=>{var a,l;try{(l=(a=this._cache.getInstance(e))==null?void 0:a.refresh)==null||l.call(a)}catch{}}};if(typeof s.renderer=="function"){const a=s.renderer(o,t,r);return a instanceof HTMLElement&&a!==t&&t.appendChild(a),{destroy:()=>{}}}if(s.subgridOptions){if(i+1>this._state.maxDepth)return this._d.announce(this._d.t("detail.depthLimitSubgrid",{max:this._state.maxDepth})),{destroy:()=>{}};if(this._d.createSubgrid)return this._d.createSubgrid(t,s.subgridOptions,i+1)}return{destroy:()=>{}}}onBeforeTeardown(){for(const[e,t]of this._hosts)if(this._cache.isAttached(e)){if(this.isEditing(e)){document.body.appendChild(t);continue}this._cache.detach(e)}}isEditing(e){const t=this._cache.getInstance(e);return!!t&&typeof t.isEditing=="function"&&!!t.isEditing()}consumePendingFocusRestore(){const e=this._focusPendingRestore;return this._focusPendingRestore=null,e}_releaseInstance(e){const t=this._mdOpts();this._cache.remove(e,{cache:t.cache===!0}),t.cache!==!0&&this._hosts.delete(e)}_splice(e){var i;if(!this.isActive)return e;const t=this._mdOpts(),s=((i=this._d.getOptions())==null?void 0:i.rowHeight)??32,o={expandedRowIds:this._state.expandedRowIds,getRowId:r=>this._d.getRowId(r),rowHeight:s,height:t.height??200};if(typeof t.detailRowCount=="number"){const r=t.detailRowCount;o.getSlotCount=()=>r}return tr(e,o)}_afterToggle(e,t){this._rebuildAndRender();const o=this._d.getFlatModel().flatIndexOfRowId(e),i=t==="expanded"?this._hosts.get(e)??null:null,r={rowIndex:o,rowId:e,row:this._d.getRowById(e),host:i};this._d.emit(t==="expanded"?"rowExpand":"rowCollapse",r),this._d.announce(this._d.t(t==="expanded"?"detail.expandedAnnounce":"detail.collapsedAnnounce"))}_rebuildAndRender(){var t;const e=this._d.getFlatModel().count();(t=this._d.getVs())==null||t.setTotalRows(e),this._d.doRenderFull(e)}destroy(){this._cache.destroyAll(),this._hosts.clear()}}function or(n,e){return n==null||Number.isNaN(n)?"":e?e(n,{axis:"tooltip"}):String(n)}function Fs(n,e={}){const{categories:t,series:s}=n,o=["category",...s.map(d=>d.name)],i=t.map((d,c)=>[d,...s.map(h=>or(h.data[c]??null,e.numberFormat))]),a=s.map(d=>d.name).join(", ")||z("chart.tooltipEmpty");return{caption:e.title?z("chart.a11ySummary",{title:e.title,categories:t.length,series:a}):z("chart.a11ySummaryNoTitle",{categories:t.length,series:a}),colHeaders:o,rows:i}}const rr=.8,nr=50;function Ss(n){if(n==null||n==="")return null;if(typeof n=="number")return Number.isFinite(n)?n:null;const e=Number(n);return Number.isFinite(e)?e:null}function qt(n,e,t){if((n==null?void 0:n.type)==="number")return!0;if(n!=null&&n.type)return!1;let s=0,o=0;for(const i of e){if(s>=nr)break;const r=i[t];r==null||r===""||(s++,Ss(r)!==null&&o++)}return s===0?!1:o/s>=rr}function ar(n){return typeof n=="string"?n:n.field}function lr(n,e){return typeof n=="string"?e:n.name??e}function dr(n,e){let t=null;for(const o of e)if(!qt(o,n,o.field)){t=o;break}const s=e.filter(o=>o!==t&&qt(o,n,o.field));return{categoryField:(t==null?void 0:t.field)??null,seriesCols:s}}function cr(n,e,t){if(typeof t=="function")return t(n,e);if(!n.length)return 0;switch(t){case"sum":return v.sum(n).toNumber();case"avg":return v.avg(n).toNumber();case"min":return v.min(n).toNumber();case"max":return v.max(n).toNumber();case"count":return n.length;default:return v.sum(n).toNumber()}}function hr(n,e){var t;switch(n.kind){case"all":case"columns":return{rows:e.getAllRows(),effectiveKind:n.kind,rangeFallback:!1};case"selection":return{rows:e.getSelectedRows(),effectiveKind:"selection",rangeFallback:!1};case"checked":return{rows:e.getCheckedRows(),effectiveKind:"checked",rangeFallback:!1};case"range":{const s=n.range??((t=e.getActiveRange)==null?void 0:t.call(e))??null;return!s||!e.getRangeRows?{rows:e.getSelectedRows(),effectiveKind:"selection",rangeFallback:!0}:{rows:e.getRangeRows(s),effectiveKind:"range",rangeFallback:!1}}}}function ur(n,e,t){return n.kind==="range"&&e==="range"&&n.range&&t.getRangeColumns?t.getRangeColumns(n.range):t.getVisibleColumns()}function pr(n,e,t={}){const{rows:s,effectiveKind:o,rangeFallback:i}=hr(n,e),r=ur(n,o,e);let a=null,l;if(n.kind==="columns")a=t.category??n.category??null,l=t.series??n.series;else if(t.series)a=t.category??null,l=t.series;else{const _=dr(s,r);a=t.category??_.categoryField,l=_.seriesCols.map(y=>y.field)}const d=new Map(r.map(_=>[_.field,_])),c=a?s.map(_=>String(_[a]??"")):s.map((_,y)=>String(y+1)),h=l.map(_=>{const y=ar(_),M=d.get(y),k=lr(_,(M==null?void 0:M.header)??y),b=s.map(P=>Ss(P[y])),x=typeof _=="string"?void 0:_.pattern,F=typeof _=="string"?void 0:_.color,S={name:k,data:b};return x&&(S.pattern=x),F&&(S.color=F),S}),u=s.length;let g=c,p=h,f,w=!1;if(t.aggregate&&c.length>0){const _=[],y=new Map;for(let M=0;M<c.length;M++){const k=c[M];y.has(k)?y.get(k).push(M):(y.set(k,[M]),_.push(k))}_.length<c.length&&(g=_,p=h.map(M=>({...M,data:_.map(k=>{const x=y.get(k).map(F=>M.data[F]).filter(F=>F!==null);return x.length?cr(x,k,t.aggregate):null})})),f=typeof t.aggregate=="function"?"custom":t.aggregate,w=!0)}const m={categories:g,series:p,meta:{sourceKind:o,total:u,sampled:w,a11yTable:Fs({categories:g,series:p},{title:t.title,numberFormat:t.numberFormat})}};return f&&(m.meta.aggregatedOp=f),{model:m,rangeFallback:i}}function gr(n){return n==="line"||n==="area"}function Ct(n){return n==null||Number.isNaN(n)?null:n}function jt(n){let e=-1,t=-1,s=1/0,o=-1/0;for(let r=0;r<n.length;r++){const a=Ct(n[r]);a!=null&&(a<s&&(s=a,e=r),a>o&&(o=a,t=r))}const i=[];return e>=0&&i.push(e),t>=0&&i.push(t),i}function fr(n,e){const t=n.length;if(e>=t||e<=2)return Array.from({length:t},(a,l)=>l);const s=a=>Ct(n[a])??0,o=[0],i=(t-2)/(e-2);let r=0;for(let a=0;a<e-2;a++){let l=0,d=0;const c=Math.floor((a+1)*i)+1;let h=Math.floor((a+2)*i)+1;h=Math.min(h,t);const u=h-c;for(let y=c;y<h;y++)l+=y,d+=s(y);u>0&&(l/=u,d/=u);const g=Math.floor(a*i)+1,p=Math.floor((a+1)*i)+1,f=r,w=s(r);let m=-1,_=g;for(let y=g;y<p&&y<t;y++){const M=Math.abs((f-l)*(s(y)-w)-(f-y)*(d-w))*.5;M>m&&(m=M,_=y)}o.push(_),r=_}return o.push(t-1),o}function _r(n,e,t,s={}){var l;const o=n.categories.length;if(!Number.isFinite(e)||e<=0||o<=e)return{model:n,sampled:!1};let i,r;if(gr(t)){const d=((l=n.series[0])==null?void 0:l.data)??new Array(o).fill(0),c=new Set([0,o-1]);for(const p of n.series)for(const f of jt(p.data))c.add(f);const h=new Set(c),u=fr(d,e);for(const p of u){if(h.size>=e)break;h.add(p)}let g=[...h].sort((p,f)=>p-f);if(g.length>e){const p=new Set([0,o-1]),f=n.series.map(m=>jt(m.data));let w=!0;for(;w&&p.size<e;){w=!1;for(const m of f){if(p.size>=e)break;const _=m.find(y=>!p.has(y));_!==void 0&&(p.add(_),w=!0)}}g=[...p].sort((m,_)=>m-_).slice(0,e)}i=g.map(p=>n.categories[p]),r=n.series.map(p=>({...p,data:g.map(f=>p.data[f])}))}else{const d=e,c=o/d;i=[];const h=[];for(let u=0;u<d;u++){const g=Math.floor(u*c),p=Math.min(Math.floor((u+1)*c),o);if(g>=p)continue;h.push([g,p]);const f=n.categories[g],w=n.categories[p-1];i.push(p-g>1?`${f}…${w}`:f)}r=n.series.map(u=>({...u,data:h.map(([g,p])=>{let f=0,w=!1;for(let m=g;m<p;m++){const _=Ct(u.data[m]);_!=null&&(f+=_,w=!0)}return w?f:null})}))}return{model:{categories:i,series:r,meta:{...n.meta,sampled:!0,sampledFrom:o,sampledTo:i.length,a11yTable:Fs({categories:i,series:r},{title:s.title,numberFormat:s.numberFormat})}},sampled:!0}}const As=["#0072B2","#E69F00","#009E73","#CC79A7","#F0E442","#56B4E9","#D55E00","#999999"],Gt=["solid","hatch","dot","cross"];function at(n){return Math.min(255,Math.max(0,n))}function wt(n){const e=n.trim(),t=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(t)return{r:at(+t[1]),g:at(+t[2]),b:at(+t[3])};const s=e.replace("#","");return/^[0-9a-f]{3}$/i.test(s)?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16)}:/^[0-9a-f]{6}$/i.test(s)?{r:parseInt(s.slice(0,2),16),g:parseInt(s.slice(2,4),16),b:parseInt(s.slice(4,6),16)}:null}function lt(n){const e=n/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Yt(n){return .2126*lt(n.r)+.7152*lt(n.g)+.0722*lt(n.b)}function mr(n,e){const t=wt(n),s=wt(e);if(!t||!s)return 1;const o=Yt(t),i=Yt(s),[r,a]=o>=i?[o,i]:[i,o];return(r+.05)/(a+.05)}function wr(n,e={}){var s;const t=(e.palette&&e.palette.length?e.palette:As).slice();return!((s=e.palette)!=null&&s.length)&&e.primary&&wt(e.primary)&&(t.length<2||mr(e.primary,t[1])>=3)&&(t[0]=e.primary),n.map((o,i)=>({color:o.color??t[i%t.length],pattern:o.pattern??Gt[i%Gt.length]}))}function Xt(n,e){if(n===0)return 0;const t=Math.abs(n),s=Math.floor(Math.log10(t)),o=t/Math.pow(10,s);let i;return e?o<1.5?i=1:o<3?i=2:o<7?i=5:i=10:o<=1?i=1:o<=2?i=2:o<=5?i=5:i=10,i*Math.pow(10,s)}function dt(n,e){const t=Math.max(0,-Math.floor(Math.log10(e))+6),s=Math.pow(10,t),o=Math.round(n*s)/s;return o===0?0:o}function Zt(n,e,t=6){let s=n,o=e;if(s>o&&([s,o]=[o,s]),s===o)if(s===0)s=-1,o=1;else{const u=Math.abs(s)*.5;s-=u,o+=u}const i=Math.max(2,t),r=Xt(o-s,!1),a=Xt(r/(i-1),!0),l=dt(Math.floor(s/a)*a,a),d=dt(Math.ceil(o/a)*a,a),c=[],h=Math.round((d-l)/a)+1;for(let u=0;u<h;u++)c.push(dt(l+u*a,a));return{min:l,max:d,step:a,ticks:c}}function yr(n,e,t){for(const s of n){const o=Math.min(s.x,s.x+s.w),i=Math.max(s.x,s.x+s.w),r=Math.min(s.y,s.y+s.h),a=Math.max(s.y,s.y+s.h);if(e>=o&&e<=i&&t>=r&&t<=a)return s}return null}function vr(n,e,t){if(!n.length)return null;let s=-1,o=1/0;for(const a of n){const l=Math.abs(a.cx-e);l<o&&(o=l,s=a.categoryIndex)}let i=null,r=1/0;for(const a of n){if(a.categoryIndex!==s)continue;const l=Math.abs(a.cy-t);l<r&&(r=l,i=a)}return i}function Jt(n,e,t,s){return n.length?s==="line"||s==="area"?vr(n,e,t):yr(n,e,t):null}const Qt="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;padding:0;margin:-1px;",Le={top:26,right:14,bottom:34,left:52},ze=3.5;let br=0;function ct(n,e,t){return n==null||Number.isNaN(n)?"":e.numberFormat?e.numberFormat(n,{axis:t}):String(n)}class es{constructor(){this.id="builtin-canvas",this._host=null,this._canvas=null,this._a11yTable=null,this._legend=null,this._tooltip=null,this._live=null,this._model=null,this._w=480,this._h=300,this._geoms=[],this._hidden=new Set,this._cursor={cat:0,series:0},this._onPoint=null,this._onMouseMove=e=>{if(this._spec.tooltip===!1)return;const{x:t,y:s}=this._localXY(e),o=Jt(this._geoms,t,s,this._spec.type);o?this._showTooltip(o,t,s):this._hideTooltip()},this._onMouseLeave=()=>this._hideTooltip(),this._onClick=e=>{const{x:t,y:s}=this._localXY(e),o=Jt(this._geoms,t,s,this._spec.type);o&&this._emitPoint(o)},this._onKeyDown=e=>{const t=this._model;if(!t)return;const s=t.categories.length,o=t.series.length;let i=!0;switch(e.key){case"ArrowRight":this._cursor.cat=Math.min(s-1,this._cursor.cat+1);break;case"ArrowLeft":this._cursor.cat=Math.max(0,this._cursor.cat-1);break;case"ArrowDown":this._cursor.series=Math.min(o-1,this._cursor.series+1);break;case"ArrowUp":this._cursor.series=Math.max(0,this._cursor.series-1);break;case"Enter":case" ":{const r=this._cursorPoint();r&&this._emitPoint(r);break}default:i=!1}i&&(e.preventDefault(),this._announceCursor())}}async init(e,t){this._host=e,this._spec=t,e.classList.add("og-chart"),getComputedStyle(e).position==="static"&&(e.style.position="relative");const s=document.createElement("canvas");s.className="og-chart-canvas",s.style.cssText="display:block;",s.setAttribute("role","img"),s.tabIndex=0,s.setAttribute("aria-label",t.title??z("chart.canvasDefault")),this._canvas=s;const o=document.createElement("table");o.className="og-chart-a11y",o.style.cssText=Qt;const i=`og-chart-a11y-${++br}`;o.id=i,s.setAttribute("aria-describedby",i),this._a11yTable=o;const r=document.createElement("div");r.className="og-chart-legend",r.style.cssText="display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;",this._legend=r;const a=document.createElement("div");a.className="og-chart-tooltip",a.style.cssText="position:absolute;pointer-events:none;display:none;z-index:5;padding:4px 8px;font-size:12px;border-radius:4px;background:#333;color:#fff;white-space:nowrap;",this._tooltip=a;const l=document.createElement("div");l.className="og-chart-live",l.setAttribute("aria-live","polite"),l.style.cssText=Qt,this._live=l,e.appendChild(s),e.appendChild(o),e.appendChild(r),e.appendChild(a),e.appendChild(l),s.addEventListener("mousemove",this._onMouseMove),s.addEventListener("mouseleave",this._onMouseLeave),s.addEventListener("click",this._onClick),s.addEventListener("keydown",this._onKeyDown)}render(e,t){var s;this._model=e,this._spec=t,this._cursor.cat=e.categories.length?Math.min(Math.max(this._cursor.cat,0),e.categories.length-1):0,this._cursor.series=e.series.length?Math.min(Math.max(this._cursor.series,0),e.series.length-1):0,this._canvas&&this._canvas.setAttribute("aria-label",((s=t.a11y)==null?void 0:s.caption)??t.title??z("chart.canvasDefault")),this._renderA11yTable(e,t),this._renderLegend(e,t),this._computeGeometry(e,t),this._paint(e,t),this._hideTooltip()}resize(e,t){this._w=Math.max(80,Math.floor(e)),this._h=Math.max(60,Math.floor(t)),this._model&&this.render(this._model,this._spec)}onPointClick(e){this._onPoint=e}destroy(){var t,s,o,i,r,a;const e=this._canvas;e&&(e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("mouseleave",this._onMouseLeave),e.removeEventListener("click",this._onClick),e.removeEventListener("keydown",this._onKeyDown)),(t=this._a11yTable)==null||t.remove(),(s=this._canvas)==null||s.remove(),(o=this._legend)==null||o.remove(),(i=this._tooltip)==null||i.remove(),(r=this._live)==null||r.remove(),(a=this._host)==null||a.classList.remove("og-chart"),this._host=this._canvas=this._a11yTable=this._legend=this._tooltip=this._live=null,this._geoms=[],this._onPoint=null}getGeometry(){return this._geoms}_renderA11yTable(e,t){const s=this._a11yTable;if(!s)return;const o=e.meta.a11yTable;s.innerHTML="";const i=document.createElement("caption");i.textContent=o.caption,s.appendChild(i);const r=document.createElement("thead"),a=document.createElement("tr");for(const d of o.colHeaders){const c=document.createElement("th");c.scope="col",c.textContent=d,a.appendChild(c)}r.appendChild(a),s.appendChild(r);const l=document.createElement("tbody");for(const d of o.rows){const c=document.createElement("tr");d.forEach((h,u)=>{const g=document.createElement(u===0?"th":"td");u===0&&(g.scope="row"),g.textContent=h,c.appendChild(g)}),l.appendChild(c)}s.appendChild(l)}_renderLegend(e,t){const s=this._legend;if(!s)return;if(t.legend===!1){s.style.display="none";return}s.style.display="flex";const o=this._styles(e,t),i=Array.from(s.querySelectorAll("button.og-chart-legend-item"));if(i.length===e.series.length&&i.every((d,c)=>d.dataset.seriesName===e.series[c].name)){e.series.forEach((d,c)=>{const h=i[c],u=!this._hidden.has(c);this._updateLegendButton(h,e.series[c],o[c],u)});return}const a=document.activeElement,l=a instanceof HTMLButtonElement?i.indexOf(a):-1;if(s.innerHTML="",e.series.forEach((d,c)=>{const h=document.createElement("button");h.type="button",h.className="og-chart-legend-item",h.dataset.seriesName=d.name,h.style.cssText="display:inline-flex;align-items:center;gap:5px;min-height:24px;padding:2px 6px;font-size:12px;cursor:pointer;background:none;border:1px solid transparent;border-radius:4px;";const u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.cssText="display:inline-block;width:12px;height:12px;border-radius:2px;";const g=document.createElement("span");h.appendChild(u),h.appendChild(g),this._updateLegendButton(h,d,o[c],!this._hidden.has(c)),h.addEventListener("click",()=>{const p=!this._hidden.has(c);p?this._hidden.add(c):this._hidden.delete(c),this._updateLegendButton(h,d,o[c],!p),this._computeGeometry(this._model,this._spec),this._paint(this._model,this._spec)}),s.appendChild(h)}),l>=0){const d=s.querySelectorAll("button.og-chart-legend-item"),c=d[l]??d[d.length-1];c==null||c.focus()}}_updateLegendButton(e,t,s,o){e.setAttribute("aria-pressed",String(o)),e.style.opacity=o?"1":"0.45";const i=e.querySelector("span[aria-hidden]");i&&(i.style.background=s.color);const r=e.querySelector("span:not([aria-hidden])");r&&(r.textContent=`${t.name} (${s.pattern})`)}_styles(e,t){var s,o;return wr(e.series.map(i=>({color:i.color,pattern:i.pattern})),{palette:t.palette??((s=t.theme)==null?void 0:s.palette),primary:(o=t.theme)==null?void 0:o.primary})}_plotRect(){return{x:Le.left,y:Le.top,w:Math.max(1,this._w-Le.left-Le.right),h:Math.max(1,this._h-Le.top-Le.bottom)}}_valueExtent(e){let t=1/0,s=-1/0;return e.series.forEach((o,i)=>{if(!this._hidden.has(i))for(const r of o.data)r==null||Number.isNaN(r)||(r<t&&(t=r),r>s&&(s=r))}),(!Number.isFinite(t)||!Number.isFinite(s))&&(t=0,s=1),(this._spec.type==="bar"||this._spec.type==="bar-stacked"||this._spec.type==="bar-grouped")&&(t=Math.min(0,t),s=Math.max(0,s)),{min:t,max:s}}_computeGeometry(e,t){const s=[],o=this._plotRect(),r=e.categories.length||1,{min:a,max:l}=this._valueExtent(e),d=Zt(a,l,6),c=f=>{const w=(f-d.min)/(d.max-d.min||1);return o.y+o.h-w*o.h},h=c(0<d.min?d.min:0>d.max?d.max:0),u=o.w/r,g=t.type==="line"||t.type==="area",p=e.series.map((f,w)=>({s:f,si:w})).filter(({si:f})=>!this._hidden.has(f));if(g)for(const{s:f,si:w}of p)f.data.forEach((m,_)=>{const y=o.x+u*_+u/2,M=m==null?NaN:c(m);Number.isNaN(M)||s.push({seriesIndex:w,categoryIndex:_,x:y-ze,y:M-ze,w:ze*2,h:ze*2,cx:y,cy:M})});else{const f=p.length||1,w=u*.72,m=w/f;p.forEach(({s:_,si:y},M)=>{_.data.forEach((k,b)=>{if(k==null||Number.isNaN(k))return;const F=o.x+u*b+(u-w)/2+m*M,S=c(k),P=Math.min(S,h),re=Math.abs(h-S);s.push({seriesIndex:y,categoryIndex:b,x:F,y:P,w:m,h:re,cx:F+m/2,cy:P+re/2})})})}this._geoms=s}_paint(e,t){const s=this._canvas;if(!s)return;const o=Rr();s.width=Math.floor(this._w*o),s.height=Math.floor(this._h*o),s.style.width=`${this._w}px`,s.style.height=`${this._h}px`;const i=s.getContext?s.getContext("2d"):null;if(!i)return;i.setTransform(o,0,0,o,0,0),i.clearRect(0,0,this._w,this._h);const r=t.theme,a=this._plotRect(),{min:l,max:d}=this._valueExtent(e),c=Zt(l,d,6),h=f=>{const w=(f-c.min)/(c.max-c.min||1);return a.y+a.h-w*a.h};i.strokeStyle=(r==null?void 0:r.gridLine)||(r==null?void 0:r.border)||"#e0e0e0",i.fillStyle=(r==null?void 0:r.text)||"#212121",i.lineWidth=1,i.font=`${(r==null?void 0:r.fontSize)||12}px ${(r==null?void 0:r.fontFamily)||"sans-serif"}`,i.textAlign="right",i.textBaseline="middle";for(const f of c.ticks){const w=h(f);i.beginPath(),i.moveTo(a.x,w),i.lineTo(a.x+a.w,w),i.stroke(),i.fillText(ct(f,t,"y"),a.x-6,w)}i.textAlign="center",i.textBaseline="top";const u=a.w/(e.categories.length||1);e.categories.forEach((f,w)=>{const m=a.x+u*w+u/2;i.fillText(String(f),m,a.y+a.h+6)});const g=this._styles(e,t);if(t.type==="line"||t.type==="area"){const f=new Map;for(const w of this._geoms){let m=f.get(w.seriesIndex);m||(m=[],f.set(w.seriesIndex,m)),m.push(w)}for(const[w,m]of f){m.sort((_,y)=>_.categoryIndex-y.categoryIndex),i.strokeStyle=g[w].color,i.lineWidth=2,i.setLineDash(xr(g[w].pattern)),i.beginPath(),m.forEach((_,y)=>y===0?i.moveTo(_.cx,_.cy):i.lineTo(_.cx,_.cy)),i.stroke(),i.setLineDash([]),i.fillStyle=g[w].color;for(const _ of m)i.beginPath(),i.arc(_.cx,_.cy,ze,0,Math.PI*2),i.fill()}}else for(const f of this._geoms)i.fillStyle=g[f.seriesIndex].color,i.fillRect(f.x,f.y,f.w,f.h),Cr(i,f,g[f.seriesIndex].pattern)}_localXY(e){var i;const t=(i=this._canvas)==null?void 0:i.getBoundingClientRect();if(!t||t.width===0&&t.height===0)return{x:e.offsetX??0,y:e.offsetY??0};const s=t.width>0?this._w/t.width:1,o=t.height>0?this._h/t.height:1;return{x:(e.clientX-t.left)*s,y:(e.clientY-t.top)*o}}_cursorPoint(){return this._geoms.find(e=>e.categoryIndex===this._cursor.cat&&e.seriesIndex===this._cursor.series)??null}_announceCursor(){const e=this._model;if(!e)return;const t=e.series[this._cursor.series],s=e.categories[this._cursor.cat],o=(t==null?void 0:t.data[this._cursor.cat])??null,i=`${(t==null?void 0:t.name)??""}, ${s??""}: ${ct(o,this._spec,"tooltip")||z("chart.tooltipEmpty")}`;this._live&&(this._live.textContent=i);const r=this._cursorPoint();r&&this._showTooltip(r,r.cx,r.cy)}_pointOf(e){var s,o;const t=this._model;return{seriesName:((s=t.series[e.seriesIndex])==null?void 0:s.name)??"",category:t.categories[e.categoryIndex]??"",value:((o=t.series[e.seriesIndex])==null?void 0:o.data[e.categoryIndex])??null,index:e.categoryIndex}}_emitPoint(e){var t;(t=this._onPoint)==null||t.call(this,this._pointOf(e))}_showTooltip(e,t,s){const o=this._tooltip;if(!o||this._spec.tooltip===!1)return;const i=this._pointOf(e);o.textContent=`${i.seriesName} · ${i.category}: ${ct(i.value,this._spec,"tooltip")}`,o.style.display="block",o.style.left=`${t+10}px`,o.style.top=`${s+10}px`}_hideTooltip(){this._tooltip&&(this._tooltip.style.display="none")}}function xr(n){switch(n){case"hatch":return[6,3];case"dot":return[2,3];case"cross":return[8,3,2,3];default:return[]}}function Cr(n,e,t){if(t==="solid"||!t)return;n.save(),n.beginPath(),n.rect(e.x,e.y,e.w,e.h),n.clip(),n.strokeStyle="rgba(255,255,255,0.55)",n.lineWidth=1;const s=5;if(t==="hatch"||t==="cross")for(let o=-e.h;o<e.w;o+=s)n.beginPath(),n.moveTo(e.x+o,e.y+e.h),n.lineTo(e.x+o+e.h,e.y),n.stroke();if(t==="cross")for(let o=0;o<e.w+e.h;o+=s)n.beginPath(),n.moveTo(e.x+o,e.y),n.lineTo(e.x+o-e.h,e.y+e.h),n.stroke();if(t==="dot"){n.fillStyle="rgba(255,255,255,0.6)";for(let o=e.y+s;o<e.y+e.h;o+=s)for(let i=e.x+s;i<e.x+e.w;i+=s)n.beginPath(),n.arc(i,o,1,0,Math.PI*2),n.fill()}n.restore()}function Rr(){return typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1}const Mr=500,kr=50,Er=100,ht={width:480,height:300};let Fr=0;class Sr{constructor(e){this._charts=new Map,this._d=e}createChart(e){var u;const t=`chart-${++Fr}`,s=this._d.getContainer(),o=this._snapshotRange(e),{adapter:i,engineFallback:r}=this._resolveAdapter(e),{panel:a,host:l,badgeBox:d,backdrop:c}=this._buildPanel(e,s),h={id:t,config:e,adapter:i,panel:a,badgeBox:d,host:l,backdrop:c,model:null,spec:null,snapshot:o,liveHandler:null,debounceTimer:null,resizeObserver:null,resizeDebounceTimer:null,renderSize:{...ht},localEvents:new Map,destroyed:!1,instance:null};try{this._charts.set(t,h);const{model:g,rangeFallback:p}=this._extract(h);h.model=g,h.spec=this._buildSpec(e,g),h.renderSize=this._resolveRenderSize(e,l),i.init(l,h.spec),i.resize(h.renderSize.width,h.renderSize.height),i.render(g,h.spec),(u=i.onPointClick)==null||u.call(i,w=>this._onPointClick(h,w)),this._renderBadges(h,p,r),e.live!==!1&&this._subscribeLive(h),this._attachResizeObserver(h);const f=this._makeInstance(h);return this._bindOptionCallbacks(h),this._emit(h,"chartCreate",f),this._d.emit("chartCreate",f),f}catch(g){try{this._destroy(h)}catch{}throw g}}_resolveRenderSize(e,t){var r;const s=e.size??ht,o=t.clientWidth;return{width:((r=e.size)==null?void 0:r.width)??(o>0?o:s.width),height:s.height}}_attachResizeObserver(e){if(typeof ResizeObserver>"u")return;const t=Er,s=new ResizeObserver(()=>{e.destroyed||(clearTimeout(e.resizeDebounceTimer),e.resizeDebounceTimer=setTimeout(()=>{if(e.destroyed)return;const o=e.host.clientWidth;o>0&&o!==e.renderSize.width&&(e.renderSize={width:o,height:e.renderSize.height},e.adapter.resize(e.renderSize.width,e.renderSize.height))},t))});s.observe(e.host),e.resizeObserver=s}getCharts(){return[...this._charts.values()].filter(e=>!e.destroyed).map(e=>this._makeInstance(e))}destroyCharts(){for(const e of[...this._charts.values()])this._destroy(e)}_snapshotRange(e){var a,l;if(e.source.kind!=="range")return null;const t=e.source.range??((l=(a=this._d).getActiveRange)==null?void 0:l.call(a))??null;if(!t)return null;const s=this._d.getFlatModel(),o=this._d.getVisibleColumns(),i=[];for(let d=t.startRow;d<=t.endRow;d++){const c=s.rowIdOfFlat(d);c!=null&&i.push(c)}const r=[];for(let d=t.startCol;d<=t.endCol;d++){const c=o[d];c&&r.push(c.field)}return{rowIds:i,fields:r}}_extract(e){var d;const t=e.config,s=((d=this._d.getOptions())==null?void 0:d.chart)??{},o=t.numberFormat??s.numberFormat,i=this._extractDeps(e),r=pr(t.source,i,{category:t.category,series:t.series??(t.source.kind==="columns"?t.source.series:void 0),aggregate:t.aggregate,title:t.title,numberFormat:o}),a=t.maxPoints??s.maxPoints??Mr;return{model:_r(r.model,a,t.type,{title:t.title,numberFormat:o}).model,rangeFallback:r.rangeFallback}}_extractDeps(e){const t=e.snapshot;return{getAllRows:()=>this._d.getAllRows(),getSelectedRows:()=>this._d.getSelectedRows(),getCheckedRows:()=>this._d.getCheckedRows(),getVisibleColumns:()=>this._d.getVisibleColumns(),getActiveRange:this._d.getActiveRange?()=>this._d.getActiveRange():void 0,getRangeRows:t?()=>t.rowIds.map(s=>this._d.getRowById(s)).filter(s=>!!s):void 0,getRangeColumns:t?()=>{const s=this._d.getVisibleColumns(),o=new Set(t.fields),i=s.filter(r=>o.has(r.field));return i.length?i:s}:void 0}}_buildSpec(e,t){var a;const s=((a=this._d.getOptions())==null?void 0:a.chart)??{},o=this._snapshotTheme(),i={type:e.type,theme:o,a11y:t.meta.a11yTable,palette:e.palette??s.palette??o.palette};e.title!==void 0&&(i.title=e.title),e.legend!==void 0&&(i.legend=e.legend),e.tooltip!==void 0&&(i.tooltip=e.tooltip),e.axis!==void 0&&(i.axis=e.axis);const r=e.numberFormat??s.numberFormat;return r&&(i.numberFormat=r),i}_readVar(e,t,s){return getComputedStyle(e).getPropertyValue(t).trim()||s}_snapshotTheme(){var r;const e=this._d.getContainer(),t=((r=this._d.getOptions())==null?void 0:r.chart)??{},s=this._readVar(e,"--og-primary","#1976d2"),o=this._readVar(e,"--og-font-size","13px"),i=parseInt(o,10)||13;return{primary:s,border:this._readVar(e,"--og-border-color","#e0e0e0"),text:this._readVar(e,"--og-row-color","#212121"),bg:this._readVar(e,"--og-row-bg","#ffffff"),gridLine:this._readVar(e,"--og-border-color","#e0e0e0"),fontFamily:getComputedStyle(e).fontFamily||"sans-serif",fontSize:i,palette:(t.palette&&t.palette.length?t.palette:As).slice()}}_buildPanel(e,t){var u,g;const s=e.placement??((g=(u=this._d.getOptions())==null?void 0:u.chart)==null?void 0:g.placement)??"docked",o=e.size??ht,i=document.createElement("div");i.className="og-chart-panel",i.setAttribute("data-placement",s),i.setAttribute("role","group"),i.setAttribute("aria-label",e.title??this._d.t("chart.defaultTitle"));const r=document.createElement("div");r.className="og-chart-badges",r.style.cssText="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px;";const a=document.createElement("div");a.className="og-chart-host",a.style.cssText=`position:relative;width:${o.width}px;max-width:100%;`;let l=null;const d=this._readVar(t,"--og-row-bg","#ffffff"),c=this._readVar(t,"--og-border-color","#e0e0e0"),h=`box-sizing:border-box;padding:10px;background:${d};border:1px solid ${c};border-radius:6px;`;return s==="modal"?(l=document.createElement("div"),l.className="og-chart-backdrop",l.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1000;display:flex;align-items:center;justify-content:center;",i.style.cssText=h+"max-width:90vw;max-height:90vh;overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,0.3);",l.appendChild(i),l.addEventListener("click",p=>{p.target===l&&this._destroyById(i)}),document.body.appendChild(l)):s==="inline"?(i.style.cssText=h+"width:100%;",(e.mount??t).appendChild(i)):s==="floating"?(i.style.cssText=h+"position:absolute;top:12px;right:12px;z-index:20;box-shadow:0 4px 16px rgba(0,0,0,0.18);",t.appendChild(i)):(i.style.cssText=h+"width:100%;margin-top:8px;",t.appendChild(i)),i.appendChild(r),i.appendChild(a),{panel:i,host:a,badgeBox:r,backdrop:l}}_renderBadges(e,t,s){var a;const o=e.badgeBox;o.innerHTML="";const i=e.model.meta,r=[];i.sampled&&i.sampledFrom&&r.push(this._d.t("chart.badgeSampled",{to:(a=i.sampledTo)==null?void 0:a.toLocaleString(),from:i.sampledFrom.toLocaleString()})),i.aggregatedOp&&r.push(this._d.t("chart.badgeAggregated",{op:i.aggregatedOp})),i.pieReducedToFirst&&r.push(this._d.t("chart.badgePieFirstSeries")),i.negativesAbsInPie&&r.push(this._d.t("chart.badgeNegativesAbs")),t&&r.push(this._d.t("chart.badgeRangeFallback")),s&&r.push(this._d.t("chart.badgeEngineFallback",{engine:s}));for(const l of r){const d=document.createElement("span");d.className="og-chart-badge",d.style.cssText="display:inline-block;padding:2px 8px;font-size:11px;border-radius:10px;background:#fff3cd;color:#8a6d3b;border:1px solid #ffe08a;",d.textContent=l,o.appendChild(d)}o.style.display=r.length?"flex":"none",r.length&&this._d.announce(this._d.t("chart.announcePrefix",{badges:r.join(", ")}))}_subscribeLive(e){var i;const s=(((i=this._d.getOptions())==null?void 0:i.chart)??{}).debounceMs??kr,o=()=>{e.destroyed||(clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout(()=>{e.destroyed||this._refresh(e)},s))};e.liveHandler=o,this._d.on("dataChange",o),this._d.on("formulaRecalc",o)}_refresh(e){if(e.destroyed)return;const{model:t,rangeFallback:s}=this._extract(e);e.model=t,e.spec=this._buildSpec(e.config,t),e.adapter.render(t,e.spec),this._renderBadges(e,s,null),this._emit(e,"chartRender",{id:e.id,model:t}),this._d.emit("chartRender",{id:e.id,model:t})}_resolveAdapter(e){var s,o;const t=e.engine??((o=(s=this._d.getOptions())==null?void 0:s.chart)==null?void 0:o.defaultEngine)??"builtin";return t&&typeof t=="object"?{adapter:t,engineFallback:null}:t==="chartjs"||t==="echarts"?{adapter:new es,engineFallback:t}:{adapter:new es,engineFallback:null}}_onPointClick(e,t){this._emit(e,"chartPointClick",{id:e.id,point:t}),this._d.emit("chartPointClick",{id:e.id,point:t})}_makeInstance(e){if(e.instance)return e.instance;const t={id:e.id,update:s=>{e.destroyed||(s&&(e.config={...e.config,...s}),s&&(s.source||s.category||s.series)&&(e.snapshot=this._snapshotRange(e.config)),this._refresh(e))},refresh:()=>this._refresh(e),setType:s=>{e.destroyed||(e.config={...e.config,type:s},this._refresh(e))},destroy:()=>this._destroy(e),toBlob:s=>e.adapter.toBlob?e.adapter.toBlob(s):Promise.resolve(null),getModel:()=>e.model,on:(s,o)=>this._on(e,s,o)};return e.instance=t,t}_bindOptionCallbacks(e){var o;const t=((o=this._d.getOptions())==null?void 0:o.chart)??{},s=this._makeInstance(e);typeof t.onChartCreate=="function"&&t.onChartCreate(s),typeof t.onChartRender=="function"&&this._on(e,"chartRender",t.onChartRender),typeof t.onChartPointClick=="function"&&this._on(e,"chartPointClick",t.onChartPointClick),typeof t.onChartDestroy=="function"&&this._on(e,"chartDestroy",t.onChartDestroy)}_on(e,t,s){const o=e.localEvents.get(t)??[];o.push(s),e.localEvents.set(t,o)}_emit(e,t,...s){for(const o of e.localEvents.get(t)??[])try{o(...s)}catch{}}_destroyById(e){for(const t of this._charts.values())if(t.panel===e){this._destroy(t);return}}_destroy(e){var t;if(!e.destroyed){e.destroyed=!0,e.liveHandler&&(this._d.off("dataChange",e.liveHandler),this._d.off("formulaRecalc",e.liveHandler)),clearTimeout(e.debounceTimer),clearTimeout(e.resizeDebounceTimer);try{(t=e.resizeObserver)==null||t.disconnect()}catch{}try{e.adapter.destroy()}catch{}(e.backdrop??e.panel).remove(),this._emit(e,"chartDestroy",{id:e.id}),this._d.emit("chartDestroy",{id:e.id}),e.localEvents.clear(),this._charts.delete(e.id)}}}class Ar{constructor(e,t){this._originals=new Map,this._hadOwn=new Map,this._stack=new Map,this._strategies=new Map,this._callPath=[],this._host=e,this._strict=(t==null?void 0:t.strict)??!0,this._maxDepth=(t==null?void 0:t.maxDepth)??32}override(e,t,s={}){if(typeof t!="function")throw new TypeError(`OverrideKernel.override: fn for "${e}" must be a function`);if(!this._originals.has(e)){const i=this._host[e];if(typeof i!="function")throw new TypeError(`OverrideKernel.override: host["${e}"] is not a function`);this._hadOwn.set(e,Object.prototype.hasOwnProperty.call(this._host,e)),this._originals.set(e,i.bind(this._host))}const o=this._stack.get(e)??[];return o.push({fn:t,opts:s}),this._stack.set(e,o),this._host[e]=this._buildDispatcher(e),this._host}_buildDispatcher(e){var d;const t=this._originals.get(e),s=this._stack.get(e)??[],o=s.reduce((c,h)=>(...u)=>h.fn(c,...u),t),i=((d=s[s.length-1])==null?void 0:d.opts)??{},r=i.reentrant===!0,a=i.onError==="fallback",l=this;return function(...c){if(!r&&l._callPath.indexOf(e)!==-1)return t(...c);if(l._callPath.length>=l._maxDepth){if(l._strict&&!a)throw new Error(`OverrideKernel: max override depth (${l._maxDepth}) exceeded at "${e}"`);return t(...c)}l._callPath.push(e);try{return o(...c)}catch(h){if(a&&!l._strict)return console.warn(`[og.override:${e}]`,h),t(...c);if(a&&l._strict)return console.warn(`[og.override:${e}]`,h),t(...c);throw h}finally{l._callPath.pop()}}}strategy(e,t){if(typeof t!="function")throw new TypeError(`OverrideKernel.strategy: fn for "${e}" must be a function`);return this._strategies.set(e,t),this._host}getStrategy(e,t){return this._strategies.get(e)??t}hasStrategy(e){return this._strategies.has(e)}restore(e){return this._originals.has(e)?(this._hadOwn.get(e)?this._host[e]=this._originals.get(e):delete this._host[e],this._originals.delete(e),this._hadOwn.delete(e),this._stack.delete(e),this._host):this._host}restoreAll(){for(const e of[...this._originals.keys()])this.restore(e);return this._strategies.clear(),this._callPath=[],this._host}hasOverride(e){return this._originals.has(e)}getOverrideNames(){return[...this._originals.keys()]}}const ut="_ogRowId";class xe{static compose(e,t,s,o){const i=xe.buildCoreServices(e,t,s),r=xe.buildFormula(e,i),a=xe.buildManagers(e,i,r,o),l=xe.buildOverrideKernel(e,a);return{mounted:xe.mount(e,l)}}static buildCoreServices(e,t,s){const o=typeof t=="string"?document.querySelector(t):t;if(!o)throw new Error(`OpenGrid: container not found: ${t}`);if(e._container=o,e._options={height:"100%",width:"100%",rowHeight:32,headerHeight:34,footerHeight:30,autoHeight:!1,fillWidth:!1,defaultColumnWidth:100,editable:!1,editMode:"dblclick",history:!0,historySize:100,selection:"single",clipboard:!0,sortable:!0,multiSort:!0,filterable:!0,defaultSort:[],frozenColumns:0,frozenRows:0,rowNumber:!1,stateColumn:!1,checkColumn:!1,draggable:!1,crossGrid:!1,crossGridMapping:"auto",mergeCells:!1,groupBy:[],summary:void 0,treeMode:"auto",treeId:"id",treeParentId:"parentId",expandOnLoad:!1,pagination:!1,pageSize:50,footer:void 0,footerPosition:"bottom",theme:"default",skin:"default",cssVars:{},ariaLabel:"OPEN_GRID 데이터 그리드",...s},e._data=new Wi(ut),e._flatModel=new Yi({getDataLayer:()=>e._data,rowIdField:ut}),e._rowMgr=new Xi(e._data),e._colLayout=new rs(e._options.columns,e._options.frozenColumns),s.locale||s.messages){const i=ne.child();s.messages&&i.applyOverrides(s.messages),s.locale&&(i.setActive(s.locale),e._container.setAttribute("lang",i.meta().intlLocale)),e._locales=i}else e._locales=null;return{_phase:"core"}}static buildFormula(e,t){var s,o;return e._formula=new eo({getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRecalc:()=>e._recalc,getDirtySeeds:()=>e._formulaDirtySeeds,getOptions:()=>e._options,emit:(i,r)=>{e.emit(i,r)},announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),doRenderWindow:()=>e._doRender(...e._visRange())}),e._recalc=new Cs({accessor:e._formula.buildAccessor(),setComputedValue:(i,r,a)=>e._data.setComputedValueByRowId(i,r,a),onFormulaError:(i,r,a)=>e._formula.handleFormulaError(i,r,a),refMode:((s=e._options.formula)==null?void 0:s.refMode)??"stable",divisionPrecision:((o=e._options.formula)==null?void 0:o.divisionPrecision)??30}),{_phase:"formula"}}static buildManagers(e,t,s,o){return e._editMgr=new Ro({data:e._data,colLayout:e._colLayout,getRenderer:()=>e._renderer,getContainer:()=>e._container,getOptions:()=>e._options,emit:(i,...r)=>e.emit(i,...r),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),writeCell:(i,r,a)=>e.writeCell(i,r,a),scrollToRow:i=>{var r;return(r=e._vs)==null?void 0:r.scrollToRow(i)},getVisibleLeaves:()=>e._colLayout.visibleLeaves,hasCellFormula:(i,r)=>e.hasCellFormula(i,r),getCellFormula:(i,r)=>e.getCellFormula(i,r),setCellFormula:(i,r,a)=>e.setCellFormula(i,r,a),clearCellFormula:(i,r)=>e.clearCellFormula(i,r)}),e._exportMgr=new Mo({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getOptions:()=>e._options,getContainer:()=>e._container,getMaskEnabled:i=>e.getMaskEnabled(i),getWsManager:()=>e._wsManager,getStrategy:(i,r)=>e._ovk.getStrategy(i,r),t:(i,r)=>e.t(i,r),getMeta:()=>(e._locales??ne).meta()}),e._footerMgr=new ko({getData:()=>e._data.getData(),getColLayout:()=>e._colLayout,getColWidths:()=>e._colWidths,getOptions:()=>e._options,getContainer:()=>e._container,getStrategy:(i,r)=>e._ovk.getStrategy(i,r)}),e._kbdMgr=new Eo({getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,setFocusCell:(i,r)=>e._setFocusCell(i,r),handleRowDrop:(i,r)=>e._handleRowDrop(i,r),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),emit:(i,...r)=>e.emit(i,...r),visRange:()=>e._visRange(),handleCellKeyEvt:(i,r)=>e._handleCellKeyEvt(i,r),writeCells:i=>e.writeCells(i),getRangeHooks:()=>e._rangeMgr}),e._sfMgr=new Fo({getData:()=>e._data,getColLayout:()=>e._colLayout,getFindFilter:()=>e._findMgr.findFilter,getVs:()=>e._vs,getPagination:()=>e._pagination,getOptions:()=>e._options,renderHeader:()=>e._renderHeader(),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),emit:(i,...r)=>e.emit(i,...r),onReproject:()=>e._rangeMgr.reproject()}),e._findMgr=new So({getColLayout:()=>e._colLayout,getData:()=>e._data,getFilters:()=>e._sfMgr.filters,getVs:()=>e._vs,getPagination:()=>e._pagination,doRender:()=>e._doRender(...e._visRange()),t:(i,r)=>e.t(i,r)}),e._cellEvt=new Ao({getData:()=>e._data,getColLayout:()=>e._colLayout,getOptions:()=>e._options,getEditMgr:()=>e._editMgr,getRowMgr:()=>e._rowMgr,emit:(i,...r)=>e.emit(i,...r),writeCell:(i,r,a)=>e.writeCell(i,r,a),doRender:()=>e._doRender(...e._visRange()),getContainer:()=>e._container,onCellsClick:(i,r,a)=>e._rangeMgr.handleClick(i,r,a),rangeMouseDown:(i,r,a)=>e._rangeMgr.handleCellMouseDown(i,r,a),rangeMouseMove:(i,r,a)=>e._rangeMgr.handleCellMouseMove(i,r,a),rangeMouseUp:(i,r,a)=>e._rangeMgr.handleCellMouseUp(i,r,a)}),e._rangeMgr=new qo({getOptions:()=>e._options,getData:()=>e._data,getColLayout:()=>e._colLayout,getFlatModel:()=>e._flatModel,getRenderer:()=>e._renderer,getEditMgr:()=>e._editMgr,setFocusCell:(i,r)=>e._setFocusCell(i,r),writeCells:i=>e.writeCells(i),getDisplayValue:(i,r)=>e.getDisplayValue(i,r),emit:(i,...r)=>e.emit(i,...r),doRender:()=>e._doRender(...e._visRange()),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),hasCellFormula:(i,r)=>e._recalc.hasCellFormula(i,r),offsetFormula:(i,r,a,l)=>e._recalc.offsetFormula(i,r,a,l),setCellFormulaByRowId:(i,r,a)=>e._formula.setCellFormulaByRowId(i,r,a)}),e._grpMgr=new jo({getData:()=>e._data.getData(),getDataLayer:()=>e._data,getOptions:()=>e._options,getVs:()=>e._vs,doRenderFull:i=>e._doRender(0,i-1),doRender:()=>e._doRender(...e._visRange()),getStrategy:(i,r)=>e._ovk.getStrategy(i,r),setFlatBacking:i=>e._flatModel.setBacking(i),getFlatCount:()=>e._flatModel.count()}),e._detailMgr=new ir({getOptions:()=>e._options,getFlatModel:()=>e._flatModel,getVs:()=>e._vs,getRowId:i=>i[ut],getRowById:i=>e._data.getRowById(i),doRenderFull:i=>e._doRender(0,i-1),emit:(i,r)=>e.emit(i,r),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r),getDepth:()=>e._options._detailDepth??0,getGridInstance:()=>e,createSubgrid:(i,r,a)=>o.createSubgrid(i,r,a)}),e._chartMgr=new Sr({getContainer:()=>e._container,getOptions:()=>e._options,getAllRows:()=>e._data.getData(),getSelectedRows:()=>e._rowMgr.getSelections(),getCheckedRows:()=>e._rowMgr.getChecked().map(i=>i.row),getVisibleColumns:()=>e._colLayout.visibleLeaves.map(i=>({field:i.field,header:i.header,type:i.type})),getFlatModel:()=>e._flatModel,getRowById:i=>e._data.getRowById(i),getActiveRange:()=>e._rangeMgr.getActiveRange(),on:(i,r)=>{e.on(i,r)},off:(i,r)=>{e.off(i,r)},emit:(i,...r)=>e.emit(i,...r),announce:i=>e._announce(i),t:(i,r)=>e.t(i,r)}),{_phase:"managers"}}static buildOverrideKernel(e,t){if(e._ovk=new Ar(e,{strict:e._options.overrideStrict??!0}),e._data.setStrategyResolver((s,o)=>e._ovk.getStrategy(s,o)),e._ovk==null)throw new Error("[OpenGrid] 초기화 순서 위반: OverrideKernel(_ovk)은 _mount() 이전에 생성돼야 합니다 — 매니저 strategy 슬롯(footer/group 등)이 초기 렌더에서 _ovk.getStrategy 를 참조합니다.");return{_phase:"ovk"}}static mount(e,t){return e._mount(),{_phase:"mounted"}}}class Lr{constructor(e){this._batchDepth=0,this._batchDirty=!1,this._deps=e}commit(e){var i,r,a,l,d;if(e.coalescable&&this._batchDepth>0){this._batchDirty=!0;return}const t=this._deps.getData();e.totals==="count"?((i=this._deps.getVs())==null||i.setTotalRows(this._deps.getFlatModel().count()),(r=this._deps.getPagination())==null||r.setTotalRows(t.rowCount)):e.totals==="zero"&&((a=this._deps.getVs())==null||a.setTotalRows(0),(l=this._deps.getPagination())==null||l.setTotalRows(0)),(d=e.preRender)==null||d.call(e),e.flushFormula&&this._deps.flushFormula();const s=()=>{e.renderMode==="sync-window"?this._deps.doRenderWindow():e.renderMode==="full"&&this._deps.doRenderFull()},o=()=>{var c,h;this._deps.emit("dataChange",e.emitPayload()),e.fireOnDataChangeExplicitly&&((h=(c=this._deps.getOptions()).onDataChange)==null||h.call(c,e.emitPayload()))};e.emitBeforeRender?(o(),s()):(s(),o())}setData(e){var a;const t=this._deps.getTrigMgr(),s=t.mkCtx("setData",[e]);if(!t.exec("before:setData",s))return;this._deps.getRowMgr().reset();const o=this._deps.getData();o.setData(e),this._deps.resetFormulaState(),this._deps.applyFilters();const i=this._deps.getGrpMgr();i.isTreeMode?i.rebuildTree():i.isGroupMode?i.rebuildGroups():(a=this._deps.getVs())==null||a.setTotalRows(this._deps.getFlatModel().count());const r=this._deps.getContainer();r.setAttribute("aria-rowcount",String(o.rowCount)),r.setAttribute("aria-colcount",String(this._deps.getColLayout().visibleLeaves.length)),this._deps.announce(this._deps.t("data.loadedAnnounce",{count:o.rowCount})),this.commit({renderMode:"async-vs",emitPayload:()=>o.getData()}),s.result=e.length,t.exec("after:setData",s)}insertRow(e,t="last"){const s=this._deps.getTrigMgr(),o=s.mkCtx("insertRow",[e,t]);if(!s.exec("before:insertRow",o))return;const i=this._deps.getData(),r=t==="before"?0:t==="after"?i.rowCount:t;i.addRow(e,r);const a=i.rowCount;this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>i.getData(),fireOnDataChangeExplicitly:!0}),o.result={rowCount:a,item:e},s.exec("after:insertRow",o)}pushRow(e){const t=Array.isArray(e)?e:[e],s=this._deps.getData();t.forEach(o=>s.addRow(o,"last")),this.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>s.getData(),fireOnDataChangeExplicitly:!0})}deleteRow(e){const t=this._deps.getTrigMgr(),s=this._deps.getData(),o=t.mkCtx("deleteRow",[e]),i=Array.isArray(e)?[...e]:[e];if(o.extra={rows:i.map(d=>s.getRowByIndex(d))},!t.exec("before:deleteRow",o))return;const r=i.sort((d,c)=>c-d),a=r.map(d=>this._deps.getRowIdAt(d)).filter(d=>d!=null);r.forEach(d=>s.removeRow(d));const l=s.rowCount;this.commit({totals:"count",renderMode:"sync-window",preRender:()=>this._deps.invalidateRemovedRows(a),emitPayload:()=>s.getData(),fireOnDataChangeExplicitly:!0}),o.result={deleted:r.length,rowCount:l},t.exec("after:deleteRow",o)}writeCell(e,t,s){var g,p;const o=this._deps.getData(),i=o.getCellValue(e,t),r=this._deps.getTrigMgr(),a=r.mkCtx("writeCell",[e,t,s]);if(a.extra={oldValue:i,rowIndex:e,field:t},!r.exec("before:writeCell",a))return;o.updateCell(e,t,s);const l=o.getRowByIndex(e),d=this._deps.getColLayout(),c=d.getColumnByField(t),h=d.getColumnIndex(t),u={type:"editEnd",rowIndex:e,columnIndex:h,field:t,oldValue:i,newValue:s,row:l,column:c};this._deps.emit("editEnd",u),(p=(g=this._deps.getOptions()).onEditEnd)==null||p.call(g,u),this._deps.seedFormulaDirty(e,t),this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>o.getData(),fireOnDataChangeExplicitly:!0,coalescable:!0}),a.result={rowIndex:e,field:t,oldValue:i,newValue:s},r.exec("after:writeCell",a)}beginBatch(){this._batchDepth++}endBatch(){this._batchDepth!==0&&(this._batchDepth--,this._batchDepth===0&&this._batchDirty&&(this._batchDirty=!1,this.commit({renderMode:"sync-window",flushFormula:!0,emitBeforeRender:!0,emitPayload:()=>this._deps.getData().getData(),fireOnDataChangeExplicitly:!0})))}writeCells(e){this.beginBatch();let t=0;const s=this._deps.getFlatModel();for(const o of e){if(s.resolveFlatRow(o.rowIndex).kind!=="data"){t++;continue}this.writeCell(o.rowIndex,o.field,o.value)}return this.endBatch(),t>0&&(this._deps.announce(this._deps.t("data.skippedCellsAnnounce",{count:t})),this._deps.emit("writeCellsSkip",{skipped:t,total:e.length})),t}}const Qe="";function Ls(n){const e=Object.entries(n).filter(([,t])=>t!==Qe).map(([t,s])=>` ${JSON.stringify(t)}: src[${JSON.stringify(s)}],`);return z("crossGrid.scriptComment")+`
|
|
74
|
-
function mapRow(src) {
|
|
75
|
-
return {
|
|
76
|
-
`+e.join(`
|
|
77
|
-
`)+(e.length?`
|
|
78
|
-
`:"")+` };
|
|
79
|
-
}`}function Ir(n){return e=>{const t={};for(const[s,o]of Object.entries(n))o!==Qe&&(t[s]=e[o]);return t}}function Tr(n,e){if(n.length!==e.length)return!1;const t=new Set(e);return n.every(s=>t.has(s))}function Dr(n,e){return new Promise(t=>{const s=new Set(n.map(b=>b.field)),o={};for(const b of e)o[b.field]=s.has(b.field)?b.field:Qe;const i=document.createElement("div");i.className="og-mapper-overlay",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",z("crossGrid.overlayAria")),i.style.cssText="position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;font-family:var(--og-font-family,-apple-system,sans-serif);";const r=document.createElement("div");r.style.cssText="background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,0.3);width:min(620px,92vw);max-height:88vh;overflow:auto;color:#222;",i.appendChild(r);const a=document.createElement("div");a.style.cssText="padding:18px 20px 8px;",a.innerHTML='<div style="font-size:16px;font-weight:700;">'+z("crossGrid.title")+'</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">'+z("crossGrid.desc1")+z("crossGrid.desc2")+"</div>",r.appendChild(a);const l=document.createElement("div");l.style.cssText="padding:6px 20px;";const d=`<option value="">${z("crossGrid.emptyOption")}</option>`+n.map(b=>`<option value="${He(b.field)}">${He(b.header)} <${He(b.field)}></option>`).join("");for(const b of e){const x=document.createElement("div");x.style.cssText="display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";const F=document.createElement("div");F.style.cssText="flex:1;font-size:13px;min-width:0;",F.innerHTML=`<span style="font-weight:600;">${He(b.header)}</span><span style="color:#999;font-size:11.5px;"> <${He(b.field)}></span>`;const S=document.createElement("span");S.textContent="←",S.style.cssText="color:#888;flex-shrink:0;";const P=document.createElement("select");P.style.cssText="flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;",P.innerHTML=d,P.value=o[b.field]??Qe,P.addEventListener("change",()=>{o[b.field]=P.value,f()}),x.append(F,S,P),l.appendChild(x)}r.appendChild(l);const c=document.createElement("div");c.style.cssText="padding:10px 20px 4px;";const h=document.createElement("div");h.style.cssText="display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;",h.innerHTML='<span style="font-size:12.5px;font-weight:600;color:#444;">'+z("crossGrid.scriptTitle")+"</span>";const u=document.createElement("button");u.type="button",u.textContent=z("crossGrid.copy"),u.style.cssText="font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;",h.appendChild(u);const g=document.createElement("pre");g.style.cssText="margin:0;background:#0d1117;color:#c9d1d9;padding:12px;border-radius:8px;font-family:ui-monospace,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto;max-height:180px;",c.append(h,g),r.appendChild(c);function p(){return Ls(o)}function f(){g.textContent=p()}f(),u.addEventListener("click",()=>{var x;const b=p();(x=navigator.clipboard)==null||x.writeText(b).then(()=>{u.textContent=z("crossGrid.copied"),setTimeout(()=>u.textContent=z("crossGrid.copy"),1200)},()=>{u.textContent=z("crossGrid.copyFailed"),setTimeout(()=>u.textContent=z("crossGrid.copy"),1200)})});const w=document.createElement("div");w.style.cssText="display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";const m=document.createElement("button");m.type="button",m.textContent=z("crossGrid.cancel"),m.style.cssText="font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";const _=document.createElement("button");_.type="button",_.textContent=z("crossGrid.applyMove"),_.style.cssText="font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;",w.append(m,_),r.appendChild(w);let y=!1;function M(b){y||(y=!0,document.removeEventListener("keydown",k),i.remove(),t(b))}function k(b){b.key==="Escape"&&M(null)}m.addEventListener("click",()=>M(null)),i.addEventListener("mousedown",b=>{b.target===i&&M(null)}),_.addEventListener("click",()=>M({mapping:{...o},script:p()})),document.addEventListener("keydown",k),document.body.appendChild(i),_.focus()})}function He(n){return String(n).replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e])}class Or{constructor(){this._map=new Map}register(e,t){this._map.set(e,t)}unregister(e){this._map.delete(e)}get(e){return this._map.get(e)}get size(){return this._map.size}resolveAt(e,t,s){const o=document.elementFromPoint(e,t),i=o==null?void 0:o.closest(".og-body-wrapper");if(!i)return null;const r=this._map.get(i);return!r||r===s?null:r}}const Xe=new Or,$r="_ogRowId";class zr{constructor(e){this._deps=e}getSelf(){return this._deps.getSelf()}_rowCount(){return this._deps.getData().rowCount}_insertRow(e,t){this._deps.insertRow(e,t)}_visibleLeafInfos(){return this._deps.getColLayout().visibleLeaves.map(e=>({field:e.field,header:e.header}))}handleCrossGridDrop(e,t,s){const o=Xe.get(t);!o||o===this._deps.getSelf()||this.moveRowsTo(o,this._deps.dragRowSet(e),s)}async moveRowsTo(e,t,s){const o=this._deps.getSelf();if(!e||e===o||!t.length)return!1;const i=this._deps.getPeerController(e);if(!i)return!1;const r=[...new Set(t)].sort((h,u)=>h-u),a=s??i._rowCount();let l=r.map(h=>{const u={...this._deps.getData().getRowByIndex(h)};return delete u[$r],u});const d=await this._resolveCrossTransform(i);if(d===!1)return!1;d&&(l=l.map(h=>d(h)));const c={sourceGrid:o,targetGrid:e,rows:l,sourceIndexes:r,targetIndex:a};return this.fireGridDropBefore(c)===!1||c.cancel||i.fireGridDropBefore(c)===!1||c.cancel?!1:(l.forEach((h,u)=>i._insertRow(h,a+u)),[...r].sort((h,u)=>u-h).forEach(h=>this._deps.deleteRow(h)),this.fireGridDropAfter(c),i.fireGridDropAfter(c),this.fireGridDropComplete(c),i.fireGridDropComplete(c),!0)}async moveCheckedTo(e){const t=this._deps.getChecked().map(s=>s.rowIndex);return t.length?(this._deps.uncheckAll(),this.moveRowsTo(e,t)):!1}async _resolveCrossTransform(e){var a,l;const t=this._deps.getOptions().crossGridMapping;if(typeof t=="function")return t;if(t!=="interactive")return null;const s=this._visibleLeafInfos(),o=e._visibleLeafInfos();if(Tr(s.map(d=>d.field),o.map(d=>d.field)))return null;const i=await Dr(s,o);if(!i)return!1;const r={sourceGrid:this._deps.getSelf(),targetGrid:e.getSelf(),mapping:i.mapping,script:i.script};return this._deps.emit("gridDropMapping",r),(l=(a=this._deps.getOptions()).onGridDropMapping)==null||l.call(a,r),console.log(`[OpenGrid] cross-grid mapping script:
|
|
80
|
-
`+Ls(i.mapping)),Ir(i.mapping)}fireGridDropBefore(e){var t,s;return this._deps.emit("gridDropBefore",e),(s=(t=this._deps.getOptions()).onGridDropBefore)==null?void 0:s.call(t,e)}fireGridDropAfter(e){var t,s;this._deps.emit("gridDropAfter",e),(s=(t=this._deps.getOptions()).onGridDropAfter)==null||s.call(t,e)}fireGridDropComplete(e){var t,s;this._deps.emit("gridDropComplete",e),(s=(t=this._deps.getOptions()).onGridDropComplete)==null||s.call(t,e)}}const Hr="⊕",Br="⊖";function Vr(n,e=z){return{glyph:n?Br:Hr,ariaLabel:e(n?"detail.collapseAria":"detail.expandAria"),title:e("detail.glyphTooltip")}}class Pr{constructor(e,t,s,o,i,r){this._selects=new Map,this._selected={},this._config=t,this._onFilter=s,this._onReset=o,this._t=r??z,this._el=document.createElement("fieldset"),this._el.className="og-filter-select";const a=document.createElement("legend");a.className="og-filter-select-legend",a.textContent=t.legend??this._t("filter.legend"),this._el.appendChild(a);const l=document.createElement("div");l.className="og-filter-select-row";for(const c of t.columns){const h=`og-fsel-${c.field}`,u=document.createElement("div");u.className="og-filter-select-group";const g=document.createElement("label");g.htmlFor=h,g.textContent=c.label,g.className="og-filter-select-label";const p=document.createElement("select");p.id=h,p.className="og-filter-select-sel",p.setAttribute("aria-label",c.label),i&&p.setAttribute("aria-controls",i),c.dependsOn?this._fill(p,[],!1):this._fill(p,this._resolve(c,""),!0),p.addEventListener("change",()=>this._onChange(c.field,p.value)),u.appendChild(g),u.appendChild(p),l.appendChild(u),this._selects.set(c.field,p)}const d=document.createElement("button");d.type="button",d.textContent=this._t("filter.clear"),d.className="og-filter-select-reset",d.setAttribute("aria-label",this._t("filter.clearAria")),d.addEventListener("click",()=>this._reset()),this._el.appendChild(l),this._el.appendChild(d),e.insertBefore(this._el,e.firstChild)}_resolve(e,t){if(e.options)return e.options;let s=e.data??[];e.dependsOn&&e.dependsOnKey&&t&&(s=s.filter(r=>String(r[e.dependsOnKey]??"")===t));const o=e.valueKey??"value",i=e.textKey??o;return s.map(r=>({value:String(r[o]??""),text:String(r[i]??r[o]??"")}))}_fill(e,t,s){e.innerHTML="";const o=document.createElement("option");o.value="",o.textContent=this._t("filter.all"),e.appendChild(o);for(const i of t){const r=document.createElement("option");r.value=i.value,r.textContent=i.text,e.appendChild(r)}e.disabled=!s}_onChange(e,t){const s=this._config.columns.find(i=>i.field===e),o=s.filterKey??s.field;t?(this._selected[e]=t,this._onFilter(o,[{operator:"=",value:t}])):(delete this._selected[e],this._onReset(o)),this._cascade(e)}_cascade(e){const t=this._selected[e]??"";for(const s of this._config.columns){if(s.dependsOn!==e)continue;const o=this._selects.get(s.field);if(!o)continue;const i=s.filterKey??s.field;t?(this._fill(o,this._resolve(s,t),!0),o.value="",delete this._selected[s.field],this._onReset(i)):(this._fill(o,[],!1),delete this._selected[s.field],this._onReset(i),this._cascade(s.field))}}_reset(){this._selected={};for(const e of this._config.columns){const t=this._selects.get(e.field),s=e.filterKey??e.field;t&&(e.dependsOn?this._fill(t,[],!1):(t.value="",t.disabled=!1),this._onReset(s))}}reset(){this._reset()}destroy(){this._el.remove()}}const Nr={"pagination.rowsPerPage":"행/페이지:","pagination.empty":"0건"};function Wr(n,e){return n==="pagination.rangeBadge"?`${e==null?void 0:e.from}–${e==null?void 0:e.to} / ${e==null?void 0:e.total}건`:Nr[n]??n}class Kr{constructor(e,t,s,o){this._page=1,this._totalRows=0,this._pageSize=t,this._onChange=s,this._t=o??Wr,this._el=document.createElement("div"),this._el.className="og-pagination",this._el.style.cssText=`
|
|
81
|
-
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
82
|
-
padding:6px 8px;border-top:1px solid var(--og-border-color,#e0e0e0);
|
|
83
|
-
background:var(--og-header-bg,#f5f5f5);flex-shrink:0;user-select:none;
|
|
84
|
-
font-size:12px;color:var(--og-text-color,#333);
|
|
85
|
-
`,e.appendChild(this._el),this._render()}get page(){return this._page}get pageSize(){return this._pageSize}get totalPages(){return Math.max(1,Math.ceil(this._totalRows/this._pageSize))}setTotalRows(e){this._totalRows=e,this._page>this.totalPages&&(this._page=this.totalPages),this._render()}setPageSize(e){this._pageSize=e,this._page=1,this._render(),this._emit()}goTo(e){const t=Math.max(1,Math.min(e,this.totalPages));t!==this._page&&(this._page=t,this._render(),this._emit())}getRange(){const e=(this._page-1)*this._pageSize,t=Math.min(e+this._pageSize-1,this._totalRows-1);return{start:e,end:t}}_emit(){this._onChange({page:this._page,pageSize:this._pageSize,totalRows:this._totalRows,totalPages:this.totalPages})}_render(){this._el.innerHTML="";const e=this.totalPages,t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:3px;margin-right:8px;";const s=document.createElement("span");s.textContent=this._t("pagination.rowsPerPage"),s.style.color="#888";const o=document.createElement("select");o.style.cssText="padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";for(const c of[10,20,50,100,200]){const h=document.createElement("option");h.value=String(c),h.textContent=String(c),c===this._pageSize&&(h.selected=!0),o.appendChild(h)}o.addEventListener("change",()=>this.setPageSize(Number(o.value))),t.appendChild(s),t.appendChild(o),this._el.appendChild(t);const i=document.createElement("span"),{start:r,end:a}=this.getRange();i.textContent=this._totalRows>0?this._t("pagination.rangeBadge",{from:r+1,to:a+1,total:this._totalRows}):this._t("pagination.empty"),i.style.cssText="margin-right:8px;color:#888;",this._el.appendChild(i);const l=(c,h,u)=>{const g=document.createElement("button");return g.textContent=c,g.disabled=u,g.style.cssText=`
|
|
86
|
-
min-width:28px;height:24px;padding:0 6px;
|
|
87
|
-
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
88
|
-
background:${u?"#f5f5f5":"#fff"};
|
|
89
|
-
color:${u?"#bbb":"var(--og-text-color,#333)"};
|
|
90
|
-
cursor:${u?"default":"pointer"};font-size:12px;
|
|
91
|
-
`,u||g.addEventListener("click",()=>this.goTo(h)),g};this._el.appendChild(l("«",1,this._page===1)),this._el.appendChild(l("‹",this._page-1,this._page===1));const d=Ur(this._page,e);for(const c of d)if(c===-1){const h=document.createElement("span");h.textContent="…",h.style.padding="0 3px",this._el.appendChild(h)}else{const h=l(String(c),c,c===this._page);c===this._page&&(h.style.background="var(--og-primary,#1976d2)",h.style.color="#fff",h.style.borderColor="var(--og-primary,#1976d2)"),this._el.appendChild(h)}this._el.appendChild(l("›",this._page+1,this._page===e)),this._el.appendChild(l("»",e,this._page===e))}refreshLabels(){this._render()}destroy(){this._el.remove()}}function Ur(n,e){if(e<=7)return Array.from({length:e},(s,o)=>o+1);const t=[1];n>3&&t.push(-1);for(let s=Math.max(2,n-1);s<=Math.min(e-1,n+1);s++)t.push(s);return n<e-2&&t.push(-1),t.push(e),t}class qr{constructor(e,t,s,o){this._dx=t-e.left,this._dy=s-e.top;const i=document.createElement("div");i.className="og-drag-ghost",i.style.cssText=`position:fixed;left:0;top:0;width:${e.width}px;height:${Math.min(e.height,40)}px;transform:translate(${e.left}px,${e.top}px);background:rgba(25,118,210,0.12);border:2px dashed #1976d2;box-sizing:border-box;pointer-events:none;z-index:10000;border-radius:3px;opacity:0.92;display:flex;align-items:center;padding-left:10px;font-size:12px;color:#1565c0;font-weight:600;white-space:nowrap;overflow:hidden;`,o>1&&(i.textContent=z("drag.rowCount",{count:o})),document.body.appendChild(i),this._el=i}move(e,t){this._el.style.transform=`translate(${e-this._dx}px,${t-this._dy}px)`}destroy(){this._el.remove()}}class ts{constructor(e="#1976d2"){const t=document.createElement("div");t.className="og-drop-indicator",t.style.cssText="position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";const s=i=>{const r=document.createElement("div"),a=i==="left"?`border-left:7px solid ${e}`:`border-right:7px solid ${e}`;return r.style.cssText=`width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${a};`,r},o=document.createElement("div");o.style.cssText=`flex:1;height:3px;background:${e};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`,t.append(s("left"),o,s("right")),this._el=t}showIn(e,t){this._el.parentElement!==e&&(this._el.remove(),e.appendChild(this._el)),this._el.style.display="flex",this._el.style.top=`${t}px`}hide(){this._el.style.display="none"}destroy(){this._el.remove()}}const ss=(n,e,t)=>Math.max(e,Math.min(t,n));class jr{constructor(e,t,s,o=null,i=()=>1){this._bodyEl=e,this._rowHeight=t,this._onDrop=s,this._cross=o,this._getDragCount=i,this._drag=null,this._selfIndicator=new ts("#1976d2"),this._crossIndicator=new ts("#2e7d32"),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this)}attachHandle(e,t,s){const o=document.createElement("div");return o.className="og-drag-handle",o.innerHTML="⠿",o.style.cssText=`
|
|
92
|
-
width:18px;min-width:18px;height:100%;
|
|
93
|
-
display:flex;align-items:center;justify-content:center;
|
|
94
|
-
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
95
|
-
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
96
|
-
`,o.addEventListener("mousedown",i=>{i.preventDefault(),i.stopPropagation(),this._startDrag(i,e,t,s)}),o}_startDrag(e,t,s,o){const i=t.getBoundingClientRect(),r=this._getDragCount(s);this._drag={fromIndex:s,bodyEl:this._bodyEl,rowHeight:this._rowHeight,totalRows:o,ghost:new qr(i,e.clientX,e.clientY,r),currentTarget:s,crossTarget:null},document.addEventListener("mousemove",this._onMouseMove,!0),document.addEventListener("mouseup",this._onMouseUp,!0)}_onMouseMove(e){if(!this._drag)return;const t=this._drag;if(t.ghost.move(e.clientX,e.clientY),this._cross){const i=this._cross.resolveTarget(e.clientX,e.clientY);if(i&&i.bodyEl!==t.bodyEl){const r=i.bodyEl.getBoundingClientRect(),a=e.clientY-r.top+i.bodyEl.scrollTop,l=ss(Math.round(a/i.rowHeight),0,i.totalRows);t.crossTarget={bodyEl:i.bodyEl,index:l},this._selfIndicator.hide(),this._crossIndicator.showIn(i.bodyEl,l*i.rowHeight);return}}t.crossTarget=null,this._crossIndicator.hide();const s=t.bodyEl.getBoundingClientRect(),o=e.clientY-s.top+t.bodyEl.scrollTop;t.currentTarget=ss(Math.round(o/t.rowHeight),0,t.totalRows-1),this._selfIndicator.showIn(t.bodyEl,t.currentTarget*t.rowHeight)}_onMouseUp(e){if(document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),!this._drag)return;const{fromIndex:t,currentTarget:s,ghost:o,crossTarget:i}=this._drag;this._drag=null,o.destroy(),this._selfIndicator.hide(),this._crossIndicator.hide(),i&&this._cross?this._cross.onCrossDrop(t,i.bodyEl,i.index):t!==s&&this._onDrop(t,s)}destroy(){var e;document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),(e=this._drag)==null||e.ghost.destroy(),this._selfIndicator.destroy(),this._crossIndicator.destroy(),this._drag=null}}class Ce{constructor(){this._map=new Map}static _key(e,t){return`${e}:${t}`}applyMergeCells(e){this._map.clear();for(const t of e){const s=Math.max(1,t.rowSpan??1),o=Math.max(1,t.colSpan??1);this._map.set(Ce._key(t.row,t.col),{rowSpan:s,colSpan:o,hidden:!1});for(let i=0;i<s;i++)for(let r=0;r<o;r++)i===0&&r===0||this._map.set(Ce._key(t.row+i,t.col+r),{rowSpan:1,colSpan:1,hidden:!0})}}applyAutoMerge(e,t,s){var o,i;this._map.clear();for(let r=0;r<t.length;r++){const a=t[r],l=s[r];let d=0;for(let c=1;c<=e.length;c++){const h=(o=e[c-1])==null?void 0:o[l],u=c<e.length?(i=e[c])==null?void 0:i[l]:void 0;if(c===e.length||u!==h){const g=c-d;if(g>1){this._map.set(Ce._key(d,a),{rowSpan:g,colSpan:1,hidden:!1});for(let p=d+1;p<c;p++)this._map.set(Ce._key(p,a),{rowSpan:1,colSpan:1,hidden:!0})}d=c}}}}getInfo(e,t){return this._map.get(Ce._key(e,t))??null}clear(){this._map.clear()}get isEmpty(){return this._map.size===0}}const Gr=[{id:"sort-asc",labelKey:"contextMenu.sortAsc",icon:"↑",action:"sortAsc"},{id:"sort-desc",labelKey:"contextMenu.sortDesc",icon:"↓",action:"sortDesc"},{type:"divider"},{id:"find",labelKey:"contextMenu.find",icon:"🔍",action:"find"},{type:"divider"},{id:"excel",labelKey:"contextMenu.exportExcel",icon:"📊",action:"excel"},{id:"csv",labelKey:"contextMenu.exportCsv",icon:"📄",action:"csv"},{id:"print",labelKey:"contextMenu.print",icon:"🖨",action:"print"}],Yr=[{id:"sort-asc",label:"오름차순 정렬",icon:"↑",action:"sortAsc"},{id:"sort-desc",label:"내림차순 정렬",icon:"↓",action:"sortDesc"},{type:"divider"},{id:"find",label:"찾기",icon:"🔍",action:"find"},{type:"divider"},{id:"excel",label:"Excel로 저장",icon:"📊",action:"excel"},{id:"csv",label:"CSV로 저장",icon:"📄",action:"csv"},{id:"print",label:"인쇄",icon:"🖨",action:"print"}];function Xr(n){return n?Gr.map(e=>"type"in e?{type:"divider"}:{id:e.id,label:n(e.labelKey),icon:e.icon,action:e.action}):Yr}class Zr{constructor(e,t,s){this._anchor=e,this._actions=t,this._t=s,this._el=null,this._docClick=null,this._docKey=null,this._docScroll=null,this._docMouseMove=null,this._focusIdx=-1}open(e,t){this.close();const s=t??Xr(this._t),o=document.createElement("div");o.className="og-context-menu",o.setAttribute("role","menu");for(const d of s){if(d.type==="divider"){const u=document.createElement("div");u.className="og-cm-divider",u.setAttribute("role","separator"),o.appendChild(u);continue}const c=document.createElement("button");if(c.className="og-cm-item",c.setAttribute("role","menuitem"),c.setAttribute("tabindex","-1"),d.disabled&&(c.classList.add("og-cm-disabled"),c.setAttribute("aria-disabled","true")),d.icon){const u=document.createElement("span");if(u.className="og-cm-icon",/^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(d.icon.trim())){const g=document.createElement("i");g.className=d.icon,u.appendChild(g)}else u.textContent=d.icon;u.setAttribute("aria-hidden","true"),c.appendChild(u)}const h=document.createElement("span");h.className="og-cm-label",h.textContent=d.label??"",c.appendChild(h),c.addEventListener("click",u=>{u.stopPropagation(),d.disabled||this._runAction(d),this.close()}),o.appendChild(c)}const i=this._anchor.closest("[data-og-theme]"),r=i==null?void 0:i.getAttribute("data-og-theme");r&&o.setAttribute("data-og-theme",r);const a=this._anchor.closest("[data-og-skin]"),l=a==null?void 0:a.getAttribute("data-og-skin");l&&o.setAttribute("data-og-skin",l),document.body.appendChild(o),this._el=o,this._docMouseMove=d=>{if(!this._el)return;const c=this._el.getBoundingClientRect();(d.clientX<c.left-4||d.clientX>c.right+4||d.clientY<c.top-4||d.clientY>c.bottom+4)&&this.close()},this._position(o,e.clientX,e.clientY,()=>{this._el===o&&document.addEventListener("mousemove",this._docMouseMove,{capture:!0,passive:!0})}),this._docClick=d=>{o.contains(d.target)||this.close()},this._docKey=d=>{if(d.key==="Escape"){this.close();return}if(d.key==="ArrowDown"){d.preventDefault(),this._moveFocus(1);return}if(d.key==="ArrowUp"){d.preventDefault(),this._moveFocus(-1);return}if(d.key==="Enter"){const c=o.querySelector(".og-cm-item:focus");c==null||c.click()}},this._docScroll=()=>this.close(),setTimeout(()=>{document.addEventListener("click",this._docClick),document.addEventListener("keydown",this._docKey),window.addEventListener("scroll",this._docScroll,{passive:!0})},0),this._focusIdx=-1,this._moveFocus(1)}close(){var e;(e=this._el)==null||e.remove(),this._el=null,this._docClick&&document.removeEventListener("click",this._docClick),this._docKey&&document.removeEventListener("keydown",this._docKey),this._docScroll&&window.removeEventListener("scroll",this._docScroll),this._docMouseMove&&document.removeEventListener("mousemove",this._docMouseMove,{capture:!0}),this._docClick=this._docKey=this._docScroll=this._docMouseMove=null,this._focusIdx=-1}destroy(){this.close()}_position(e,t,s,o){e.style.cssText="position:fixed;visibility:hidden;left:0;top:0;",requestAnimationFrame(()=>{const{width:i,height:r}=e.getBoundingClientRect(),a=window.innerWidth,l=window.innerHeight,d=t+i>a?Math.max(0,t-i):t,c=s+r>l?Math.max(0,s-r):s;e.style.cssText=`position:fixed;left:${d}px;top:${c}px;z-index:9999;`,o==null||o()})}_moveFocus(e){var s;if(!this._el)return;const t=Array.from(this._el.querySelectorAll(".og-cm-item:not(.og-cm-disabled)"));t.length&&(this._focusIdx=(this._focusIdx+e+t.length)%t.length,(s=t[this._focusIdx])==null||s.focus())}_runAction(e){if(typeof e.action=="function"){e.action();return}switch(e.action){case"sortAsc":this._actions.onSortAsc();break;case"sortDesc":this._actions.onSortDesc();break;case"find":this._actions.onFind();break;case"excel":this._actions.onExcel();break;case"csv":this._actions.onCsv();break;case"print":this._actions.onPrint();break}}}class is{constructor(e,t,s){this._sheets=new Map,this._active="",this._onSwitch=t,this._t=s??z,this._tabBar=this._buildTabBar(e)}add(e,t=[],s=[]){if(this._sheets.has(e))throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);this._sheets.set(e,{name:e,columns:t,data:s}),this._renderTabs(),this._sheets.size===1&&this.switch(e)}remove(e){if(!this._sheets.has(e))return;if(this._sheets.size===1)throw new Error("WorksheetManager: 마지막 시트는 삭제할 수 없습니다");const t=this._active===e;this._sheets.delete(e),this._renderTabs(),t&&this.switch(this._sheets.keys().next().value)}rename(e,t){if(!this._sheets.has(e))return;if(this._sheets.has(t))throw new Error(`WorksheetManager: 시트 '${t}'이 이미 존재합니다`);this._sheets.get(e);const s=Array.from(this._sheets.entries()).map(([o,i])=>o===e?[t,{...i,name:t}]:[o,i]);this._sheets=new Map(s),this._active===e&&(this._active=t),this._renderTabs()}switch(e){const t=this._sheets.get(e);if(!t)throw new Error(`WorksheetManager: 시트 '${e}'을 찾을 수 없습니다`);this._active=e,this._renderTabs(),this._onSwitch(e,t)}get(e){return this._sheets.get(e)}getNames(){return Array.from(this._sheets.keys())}getActive(){return this._active}syncData(e,t){const s=this._sheets.get(e);s&&(s.data=t)}destroy(){this._tabBar.remove()}_buildTabBar(e){const t=document.createElement("div");return t.className="og-sheet-tabs",e.appendChild(t),t}_renderTabs(){this._tabBar.innerHTML="";for(const t of this._sheets.keys()){const s=document.createElement("button");s.className="og-sheet-tab",s.textContent=t,s.setAttribute("role","tab"),s.setAttribute("aria-selected",t===this._active?"true":"false"),t===this._active&&s.classList.add("og-sheet-tab--active"),s.addEventListener("click",()=>{t!==this._active&&this.switch(t)}),s.addEventListener("dblclick",()=>this._startRename(s,t)),this._tabBar.appendChild(s)}const e=document.createElement("button");e.className="og-sheet-add",e.textContent="+",e.setAttribute("aria-label",this._t("worksheet.addAria")),e.addEventListener("click",()=>{const t=`Sheet${this._sheets.size+1}`;this.add(t,[],[]),this.switch(t)}),this._tabBar.appendChild(e)}_startRename(e,t){const s=document.createElement("input");s.className="og-sheet-tab-rename",s.value=t,e.replaceWith(s),s.focus(),s.select();const o=()=>{const i=s.value.trim()||t;try{i!==t?this.rename(t,i):this._renderTabs()}catch{this._renderTabs()}};s.addEventListener("blur",o),s.addEventListener("keydown",i=>{i.key==="Enter"&&s.blur(),i.key==="Escape"&&(s.value=t,s.blur())})}}class Jr{constructor(){this._triggers=new Map}add(e,t){this._triggers.has(e)||this._triggers.set(e,[]),this._triggers.get(e).push(t)}remove(e,t){const s=this._triggers.get(e);if(s){const o=s.indexOf(t);o>=0&&s.splice(o,1)}}clear(e){e?this._triggers.delete(e):this._triggers.clear()}mkCtx(e,t){let s=!1;return{operation:e,args:t,result:void 0,extra:{},timestamp:Date.now(),get cancelled(){return s},cancel(){s=!0}}}exec(e,t){const s=this._triggers.get(e)??[];for(const o of s)if(o(t),t.cancelled)return!1;if(e.startsWith("after:")){const o=this._triggers.get("complete")??[];for(const i of o)i(t)}return!0}}class Qr{constructor(){this._order=[],this._hooks=new Map}register(e){this._hooks.has(e.id)||this._order.push(e.id),this._hooks.set(e.id,e)}get(e){return this._hooks.get(e)}has(e){return this._hooks.has(e)}ids(){return[...this._order]}resolve(e,t,s){const o=this._hooks.get(e);return!o||!o.gate()?null:o.resolve(t,s)}activeIds(){return this._order.filter(e=>this._hooks.get(e).gate())}}class en{constructor(e){this._renderHooks=new Qr,this._deps=e}get renderHooks(){return this._renderHooks}registerRenderHook(e){this._renderHooks.register(e)}resolveRenderHook(e,t,s){return this._renderHooks.resolve(e,t,s)}strategy(e,t){this._deps.kernel.strategy(e,t)}getStrategy(e,t){return this._deps.kernel.getStrategy(e,t)}hasStrategy(e){return this._deps.kernel.hasStrategy(e)}override(e,t,s={}){this._deps.kernel.override(e,t,s)}beforeMutation(e,t){this._deps.getTrigMgr().add(`before:${e}`,t)}afterMutation(e,t){this._deps.getTrigMgr().add(`after:${e}`,t)}offMutation(e,t,s){this._deps.getTrigMgr().remove(`${e}:${t}`,s)}catalog(){const e=[["sortComparator","(a,b,field,dir)=>number"],["filterPredicate","(value,fi,field)=>boolean"],["displayFormatter","(value,field,row)=>string"],["cellSerializer","(value,col,row)=>any"],["groupKeyFn","(row,remainingFields)=>any"],["summaryOp","(op,nums,field)=>number|null"],["cellClassResolver","(value,field,row)=>string|null"],["ariaLabelResolver","(value,field,row)=>string|null"],["skinResolver","(skinId)=>SkinTokenDelta|null"]].map(([r,a])=>({name:r,category:"strategy",signature:a})),t=this._renderHooks.ids().map(r=>({name:r,category:"renderHook",signature:"(rowIndex,field)=>value|null"})),s=[{name:"before:mutation",category:"lifecycle",signature:"(ctx)=>void — cancelable"},{name:"after:mutation",category:"lifecycle",signature:"(ctx)=>void — observe"}],o=[{name:"getDisplayValue",category:"override",signature:"(orig,rowIndex,field)=>string"},{name:"readCell",category:"override",signature:"(orig,rowIndex,field)=>any"}],i=[{name:"override(name,fn)",category:"escapeHatch",signature:"best-effort arbitrary method wrap (UC-11)"}];return[...e,...t,...s,...o,...i]}}const os="_ogRowId",X=class X extends Ds{constructor(e,t){var o;super(),this._vs=null,this._ro=null,this._renderer=null,this._appearance=null,this._icons=null,this._locales=null,this._trigMgr=new Jr,this._destroyed=!1,this._colWidths=[],this._userWidths=new Map,this._filterPanel=null,this._filterSelect=null,this._pagination=null,this._dnd=null,this._mergeEngine=new Ce,this._liveRegion=null,this._ctxMenu=null,this._cmHandler=null,this._cmKbdHandler=null,this._wsManager=null,this._formulaDirtySeeds=new Set,xe.compose(this,e,t,{createSubgrid:(i,r,a)=>new X(i,{...r,_detailDepth:a})}),this._bindOptionEvents(),(o=this._options.defaultSort)!=null&&o.length&&this._sfMgr.initSort(this._options.defaultSort),this.override=Object.assign((i,r,a)=>this._ovk.override(i,r,a),{strategy:(i,r)=>this._ovk.strategy(i,r)});const s=this.destroy.bind(this);this.destroy=()=>{try{s()}finally{this._ovk.restoreAll()}};for(const[i,r]of X._defaultStrategies)this._ovk.strategy(i,r);for(const[i,r,a]of X._defaultOverrides)this._ovk.override(i,r,a);requestAnimationFrame(()=>{var i,r;this.emit("ready",this),(r=(i=this._options).onReady)==null||r.call(i,this)})}get extensions(){return this._extensions}static defaultOverride(e,t,s={}){return X._defaultOverrides.push([e,t,s]),X}static registerRenderer(e,t){return Y(e,t),X}static registerEditor(e,t){return Oe(e,t),X}static defineSkin(e,t){return bt.define(e,t),X}static defineIconSet(e){for(const[t,s]of Object.entries(e))Me.register(t,s);return X}static defineLocale(e,t,s){return ne.register(e,t,s),X}restore(e){return this._ovk.restore(e),this}restoreAll(){return this._ovk.restoreAll(),this}hasOverride(e){return this._ovk.hasOverride(e)}getOverrideNames(){return this._ovk.getOverrideNames()}getStrategy(e,t){return this._ovk.getStrategy(e,t)}_mount(){var s,o;this._extensions=new en({kernel:this._ovk,getTrigMgr:()=>this._trigMgr}),this._extensions.registerRenderHook({id:"displayText",gate:()=>this.hasOverride("getDisplayValue")||this._ovk.hasStrategy("displayFormatter"),resolve:(i,r)=>this.getDisplayValue(i,r)}),this._extensions.registerRenderHook({id:"cellClass",gate:()=>this._ovk.hasStrategy("cellClassResolver"),resolve:(i,r)=>{const a=this._ovk.getStrategy("cellClassResolver",null);return a?a(this.readCell(i,r),r,this._data.getRowByIndex(i)):null}}),this._extensions.registerRenderHook({id:"ariaLabel",gate:()=>this._ovk.hasStrategy("ariaLabelResolver"),resolve:(i,r)=>{const a=this._ovk.getStrategy("ariaLabelResolver",null);return a?a(this.readCell(i,r),r,this._data.getRowByIndex(i)):null}}),this._container.classList.add("og-container");const e=this._options.height,t=this._options.width;this._container.style.height=typeof e=="number"?`${e}px`:String(e),this._container.style.width=typeof t=="number"?`${t}px`:String(t),this._container.style.display="flex",this._container.style.flexDirection="column",this._container.style.overflow="hidden",this._container.style.boxSizing="border-box",this._container.style.border="1px solid var(--og-border-color, #e0e0e0)",this._container.style.fontFamily="var(--og-font-family, -apple-system, sans-serif)",this._container.style.fontSize="var(--og-font-size, 13px)",this._container.setAttribute("data-og-theme",this._options.theme),this._container.setAttribute("data-og-skin",this._options.skin??"default");for(const[i,r]of Object.entries(this._options.cssVars))this._container.style.setProperty(i,r);this._appearance=new vt(new Ze(this._options.theme,this._options.skin??"default")),this._renderer=new Fi(this._container,this._options,{onHeaderClick:(i,r)=>this._handleSortClick(i,r),onCellClick:(i,r,a)=>this._handleCellClick(i,r,a),onCellDblClick:(i,r,a)=>this._handleCellDblClick(i,r,a),onCellMouseOver:(i,r,a)=>this._handleCellMouseOver(i,r,a),onCellMouseOut:(i,r,a)=>this._handleCellMouseOut(i,r,a),onCellMouseDown:(i,r,a)=>this._handleCellMouseDown(i,r,a),onCellMouseUp:(i,r,a)=>this._handleCellMouseUp(i,r,a),onCellMouseMove:(i,r,a)=>this._handleCellMouseMove(i,r,a),onRowCheck:(i,r)=>this._handleRowCheck(i,r),onAllCheck:i=>this._handleAllCheck(i),onColResize:(i,r)=>this._handleColResize(i,r),onFilterIconClick:(i,r)=>this._handleFilterIconClick(i,r),getDndManager:()=>this._dnd,onColDragStart:i=>{this._editMgr.dragColIdx=i},onColDrop:i=>{this._editMgr.dragColIdx!==null&&this._editMgr.dragColIdx!==i&&this._reorderColumn(this._editMgr.dragColIdx,i),this._editMgr.dragColIdx=null},getColDragIdx:()=>this._editMgr.dragColIdx,resolveRenderHook:(i,r,a)=>this._extensions.resolveRenderHook(i,r,a),getDisplayFormatter:()=>this._ovk.getStrategy("displayFormatter",null)??null,getFormulaMeta:(i,r)=>this._formula.getFormulaMeta(i,r),t:(i,r)=>this.t(i,r)},this._appearance),this._render=new Pi({getContainer:()=>this._container,getOptions:()=>this._options,getRenderer:()=>this._renderer,getVs:()=>this._vs,getPagination:()=>this._pagination,getData:()=>this._data,getColLayout:()=>this._colLayout,getFlatModel:()=>this._flatModel,getMergeEngine:()=>this._mergeEngine,getColWidths:()=>this._colWidths,setColWidths:i=>{this._colWidths=i},getUserWidths:()=>this._userWidths,getSfMgr:()=>this._sfMgr,getRowMgr:()=>this._rowMgr,getEditMgr:()=>this._editMgr,getGrpMgr:()=>this._grpMgr,getDetailMgr:()=>this._detailMgr,getRangeMgr:()=>this._rangeMgr,buildDetailRenderContext:()=>this._buildDetailRenderContext(),renderFooterEl:()=>this._renderFooterEl()}),this._mutation=new Lr({getData:()=>this._data,getVs:()=>this._vs,getPagination:()=>this._pagination,getFlatModel:()=>this._flatModel,getColLayout:()=>this._colLayout,getContainer:()=>this._container,getTrigMgr:()=>this._trigMgr,getRowMgr:()=>this._rowMgr,getGrpMgr:()=>this._grpMgr,getOptions:()=>this._options,emit:(i,r)=>{this.emit(i,r)},announce:i=>this._announce(i),t:(i,r)=>this.t(i,r),applyFilters:()=>this._applyFilters(),flushFormula:()=>this._formula.flushRecalc(),doRenderWindow:()=>this._doRender(...this._visRange()),doRenderFull:()=>this._doRender(0,-1),resetFormulaState:()=>{var i,r;this._formulaDirtySeeds.clear(),this._recalc=new Cs({accessor:this._formula.buildAccessor(),setComputedValue:(a,l,d)=>this._data.setComputedValueByRowId(a,l,d),onFormulaError:(a,l,d)=>this._formula.handleFormulaError(a,l,d),refMode:((i=this._options.formula)==null?void 0:i.refMode)??"stable",divisionPrecision:((r=this._options.formula)==null?void 0:r.divisionPrecision)??30})},seedFormulaDirty:(i,r)=>{const a=this._flatModel.resolveFlatRow(i);a.kind==="data"&&a.rowId&&this._formulaDirtySeeds.add(Q(a.rowId,r))},invalidateRemovedRows:i=>{for(const r of i)this._formula.afterRecalc(this._recalc.invalidateRow(r),{skipRender:!0})},getRowIdAt:i=>{var r;return(r=this._data.getRowByIndex(i))==null?void 0:r[os]}}),this._rangeMgr.mount(this._renderer.bodyWrapper),this._filterPanel=new Ps(this._container,(i,r)=>this.setFilter(i,r),i=>this.resetFilter(i),(i,r)=>this.t(i,r)),this._container.setAttribute("role","grid"),this._container.setAttribute("aria-label",this._options.ariaLabel??((s=this._options.cssVars)==null?void 0:s["aria-label"])??this.t("grid.containerAria")),this._container.setAttribute("aria-rowcount","0"),this._container.setAttribute("aria-colcount",String(this._options.columns.filter(i=>!i.hidden).length)),this._liveRegion=document.createElement("div"),this._liveRegion.setAttribute("aria-live","polite"),this._liveRegion.setAttribute("aria-atomic","true"),this._liveRegion.className="og-live-region",Object.assign(this._liveRegion.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:"0"}),this._container.appendChild(this._liveRegion),this._container.tabIndex=0,this._container.addEventListener("keydown",i=>this._handleKeyDown(i)),this._container.addEventListener("keyup",i=>this._handleCellKeyEvt("cellKeyUp",i)),this._container.addEventListener("keypress",i=>this._handleCellKeyEvt("cellKeyPress",i)),this._vs=new Os(this._renderer.bodyWrapper,{rowHeight:this._options.rowHeight,onRender:(i,r)=>this._doRender(i,r)}),Xe.register(this._renderer.bodyWrapper,this),this._cross=new zr({getSelf:()=>this,getData:()=>this._data,getColLayout:()=>this._colLayout,getOptions:()=>this._options,emit:(i,r)=>{this.emit(i,r)},insertRow:(i,r)=>this.insertRow(i,r),deleteRow:i=>this.deleteRow(i),getChecked:()=>this._rowMgr.getChecked(),uncheckAll:()=>this._rowMgr.uncheckAll(),dragRowSet:i=>this._dragRowSet(i),getPeerController:i=>i._cross}),this._options.draggable&&(this._dnd=new jr(this._renderer.bodyWrapper,this._options.rowHeight,(i,r)=>this._handleRowDrop(i,r),this._options.crossGrid?{resolveTarget:(i,r)=>{const a=Xe.resolveAt(i,r,this);return!a||!a._options.crossGrid?null:{bodyEl:a._crossBodyEl(),rowHeight:a._options.rowHeight,totalRows:a._data.rowCount}},onCrossDrop:(i,r,a)=>this._cross.handleCrossGridDrop(i,r,a)}:void 0,i=>this._dragRowSet(i).length)),this._options.pagination&&(this._pagination=new Kr(this._container,this._options.pageSize,i=>{this.emit("pageChange",i),this._doRender(...this._visRange())},(i,r)=>this.t(i,r))),this._findMgr.init(this._container),this._initContextMenu(),(o=this._options.worksheets)!=null&&o.length&&this._initWorksheets(),this._ro=new ResizeObserver(()=>this._onResize()),this._ro.observe(this._container),this._onResize()}_initContextMenu(){const e=this._options.contextMenu;e!==!1&&(this._cmHandler&&this._container.removeEventListener("contextmenu",this._cmHandler),this._cmKbdHandler&&this._container.removeEventListener("keydown",this._cmKbdHandler),this._cmHandler=this._cmKbdHandler=null,this._ctxMenu=new Zr(this._container,{onSortAsc:()=>{const t=this._colLayout.visibleLeaves[0];t&&this.orderBy(t.field,"asc")},onSortDesc:()=>{const t=this._colLayout.visibleLeaves[0];t&&this.orderBy(t.field,"desc")},onFind:()=>this._findMgr.open(),onExcel:()=>this.exportExcel(),onCsv:()=>this.exportCsv(),onPrint:()=>this.print()},(t,s)=>this.t(t,s)),this._cmHandler=t=>{var a;const s=t.target.closest(".og-cell");if(!s)return;t.preventDefault();const o=Number(s.dataset.colIndex??-1),i=this._colLayout.visibleLeaves[o];i&&this._ctxMenu&&(this._ctxMenu._actions.onSortAsc=()=>this.orderBy(i.field,"asc"),this._ctxMenu._actions.onSortDesc=()=>this.orderBy(i.field,"desc"));const r=Array.isArray(e)?e:void 0;(a=this._ctxMenu)==null||a.open(t,r)},this._container.addEventListener("contextmenu",this._cmHandler),this._cmKbdHandler=t=>{var s;if(t.shiftKey&&t.key==="F10"){t.preventDefault();const o=this._container.getBoundingClientRect(),i={clientX:o.left+80,clientY:o.top+40};(s=this._ctxMenu)==null||s.open(i)}},this._container.addEventListener("keydown",this._cmKbdHandler))}openContextMenu(e,t){var s;(s=this._ctxMenu)==null||s.open(e,t)}closeContextMenu(){var e;(e=this._ctxMenu)==null||e.close()}setFilterSelect(e){var t;(t=this._filterSelect)==null||t.destroy(),this._filterSelect=null,e&&(this._container.id||(this._container.id=`og-${Math.random().toString(36).slice(2,7)}`),this._filterSelect=new Pr(this._container,e,(s,o)=>this.setFilter(s,o),s=>this.resetFilter(s),this._container.id,(s,o)=>this.t(s,o)))}setOptions(e){var t;if(Object.assign(this._options,e),"contextMenu"in e&&((t=this._ctxMenu)==null||t.destroy(),this._ctxMenu=null,this._initContextMenu()),"groupBy"in e||"summary"in e){const s=e.groupBy??[];s.length>0?this._grpMgr.groupBy(s):this.clearGroup();return}this._renderHeader(),this._doRender(...this._visRange())}setMaskEnabled(e,t){var o;const s=this._colLayout.getColumnByField(e);s&&(t?(s._maskRevealed=!1,(o=s._maskRevealedRows)==null||o.clear()):s._maskRevealed=!0,this._doRender(...this._visRange()))}getMaskEnabled(e){const t=this._colLayout.getColumnByField(e);return t?t._maskRevealed!==!0:!1}_initWorksheets(){const e=this._options.worksheets;this._wsManager=new is(this._container,(t,s)=>this._loadWorksheetState(s),(t,s)=>this.t(t,s));for(const t of e)this._wsManager.add(t.name,t.columns??this._options.columns,t.data??[])}_loadWorksheetState(e){var s,o;this._rowMgr.reset(),this._data.setData(e.data),this._colLayout=new rs(e.columns.length?e.columns:this._options.columns,this._options.frozenColumns),(s=this._vs)==null||s.setTotalRows(this._data.rowCount),(o=this._pagination)==null||o.setTotalRows(this._data.rowCount),this._container.setAttribute("aria-rowcount",String(this._data.rowCount)),this._container.setAttribute("aria-colcount",String(this._colLayout.visibleLeaves.length));const{width:t}=this._container.getBoundingClientRect();t&&this._recalcWidths(t),this._renderHeader(),this._doRender(...this._visRange())}addWorksheet(e,t,s){this._wsManager||(this._wsManager=new is(this._container,(o,i)=>this._loadWorksheetState(i),(o,i)=>this.t(o,i))),this._wsManager.add(e,t??this._options.columns,s??[])}removeWorksheet(e){var t;(t=this._wsManager)==null||t.remove(e)}switchWorksheet(e){var t;(t=this._wsManager)==null||t.switch(e)}renameWorksheet(e,t){var s;(s=this._wsManager)==null||s.rename(e,t)}getWorksheet(e){var t;return(t=this._wsManager)==null?void 0:t.get(e)}getWorksheetNames(){var e;return((e=this._wsManager)==null?void 0:e.getNames())??[]}exportSheetsExcel(e){this._exportMgr.exportSheetsExcel(e)}_onResize(){this._render.onResize()}_recalcWidths(e){this._render.recalcWidths(e)}_renderHeader(){this._render.renderHeader()}_syncHeaderLayout(){this._render.syncHeaderLayout()}_doRender(e,t){this._render.doRender(e,t)}_buildDetailRenderContext(){if(!this._detailMgr.enabled)return;const e=this._options.masterDetail??{};return{toggleMode:e.toggle??"expander-col",ariaLabel:e.ariaLabel??this.t("grid.detailRegion"),getRowId:t=>t==null?void 0:t[os],isExpanded:t=>this._detailMgr.isExpandedId(t),onToggle:(t,s)=>this._detailMgr.toggleRow({id:s}),getGlyph:t=>Vr(t,(s,o)=>this.t(s,o)),getPanelHost:t=>this._detailMgr.getPanelHost(t),onBeforeTeardown:()=>this._detailMgr.onBeforeTeardown()}}_handleGroupToggle(e){this._grpMgr.handleGroupToggle(e)}_visRange(){return this._render.visRange()}_handleSortClick(e,t){this._sfMgr.handleSortClick(e,t)}_isToggleCol(e){return Ne(e)}_handleCellClick(e,t,s){this._cellEvt.handleCellClick(e,t,s)}_handleCellDblClick(e,t,s){this._cellEvt.handleCellDblClick(e,t,s)}_handleCellMouseOver(e,t,s){this._cellEvt.handleCellMouseOver(e,t,s)}_handleCellMouseOut(e,t,s){this._cellEvt.handleCellMouseOut(e,t,s)}_handleCellMouseDown(e,t,s){this._cellEvt.handleCellMouseDown(e,t,s)}_handleCellMouseUp(e,t,s){this._cellEvt.handleCellMouseUp(e,t,s)}_handleCellMouseMove(e,t,s){this._cellEvt.handleCellMouseMove(e,t,s)}_handleCellKeyEvt(e,t){this._cellEvt.handleCellKeyEvt(e,t)}_handleRowCheck(e,t){this._rowMgr.check(e,t),this._doRender(...this._visRange()),this.emit("rowCheck",{rowIndex:e,checked:t,row:this._data.getRowByIndex(e)})}_handleFilterIconClick(e,t){var o,i;if((o=this._filterPanel)!=null&&o.isOpen){this._filterPanel.close();return}const s=this._sfMgr.filters[e]??[];(i=this._filterPanel)==null||i.open(e,t,s)}_handleAllCheck(e){this._rowMgr.checkAll(e,this._data.rowCount),this._doRender(...this._visRange()),this.emit("allCheck",{checked:e})}_handleRowDrop(e,t){var s,o;this._data.moveRow(e,t),this._doRender(...this._visRange()),this.emit("rowDrop",{fromIndex:e,toIndex:t}),(o=(s=this._options).onRowDrop)==null||o.call(s,{fromIndex:e,toIndex:t})}_crossBodyEl(){return this._renderer.bodyWrapper}_dragRowSet(e){const t=[...this._rowMgr.selectedRows];return t.length>1&&t.includes(e)?t.sort((s,o)=>s-o):[e]}moveRowsTo(e,t,s){return this._cross.moveRowsTo(e,t,s)}moveCheckedTo(e){return this._cross.moveCheckedTo(e)}reorderRow(e,t){this._data.moveRow(e,t),this._doRender(...this._visRange())}_handleColResize(e,t){this._colWidths[e]!==void 0&&(this._colWidths[e]=t);const s=this._colLayout.visibleLeaves[e];s&&this._userWidths.set(s.field,t),this._renderHeader(),this._doRender(...this._visRange())}_handleKeyDown(e){this._kbdMgr.handleKeyDown(e)}_setFocusCell(e,t){this._rowMgr.selectSingle(e),this._editMgr.setFocusCell(e,t)}_announce(e){this._liveRegion&&(this._liveRegion.textContent="",setTimeout(()=>{this._liveRegion&&(this._liveRegion.textContent=e)},50))}_bindOptionEvents(){this._options.onCellClick&&this.on("cellClick",this._options.onCellClick),this._options.onCellDblClick&&this.on("cellDblClick",this._options.onCellDblClick),this._options.onRowClick&&this.on("rowClick",this._options.onRowClick),this._options.onEditStart&&this.on("editStart",this._options.onEditStart),this._options.onEditEnd&&this.on("editEnd",this._options.onEditEnd),this._options.onSortChange&&this.on("sortChange",this._options.onSortChange),this._options.onFilterChange&&this.on("filterChange",this._options.onFilterChange),this._options.onScroll&&this.on("scroll",this._options.onScroll),this._options.onDataChange&&this.on("dataChange",this._options.onDataChange),this._options.onSelectionChange&&this.on("selectionChange",this._options.onSelectionChange),this._options.onRowDblClick&&this.on("rowDblClick",this._options.onRowDblClick),this._options.onRowMouseOver&&this.on("rowMouseOver",this._options.onRowMouseOver),this._options.onRowMouseOut&&this.on("rowMouseOut",this._options.onRowMouseOut),this._options.onRowMouseDown&&this.on("rowMouseDown",this._options.onRowMouseDown),this._options.onRowMouseUp&&this.on("rowMouseUp",this._options.onRowMouseUp),this._options.onRowMouseMove&&this.on("rowMouseMove",this._options.onRowMouseMove),this._options.onCellMouseOver&&this.on("cellMouseOver",this._options.onCellMouseOver),this._options.onCellMouseOut&&this.on("cellMouseOut",this._options.onCellMouseOut),this._options.onCellMouseDown&&this.on("cellMouseDown",this._options.onCellMouseDown),this._options.onCellMouseUp&&this.on("cellMouseUp",this._options.onCellMouseUp),this._options.onCellMouseMove&&this.on("cellMouseMove",this._options.onCellMouseMove),this._options.onCellKeyDown&&this.on("cellKeyDown",this._options.onCellKeyDown),this._options.onCellKeyUp&&this.on("cellKeyUp",this._options.onCellKeyUp),this._options.onCellKeyPress&&this.on("cellKeyPress",this._options.onCellKeyPress),this._options.onRowExpand&&this.on("rowExpand",this._options.onRowExpand),this._options.onRowCollapse&&this.on("rowCollapse",this._options.onRowCollapse)}setData(e){this._mutation.setData(e)}getData(){return this._data.getData()}getSourceRows(){return this._data.getOriginalData()}pushData(e){var o,i;const t=[...this._data.getAllData(),...e];this._data.setData(t);const s=this._data.rowCount;(o=this._vs)==null||o.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(s)}prefixData(e){var o,i;const t=[...e,...this._data.getAllData()];this._data.setData(t);const s=this._data.rowCount;(o=this._vs)==null||o.setTotalRows(this._flatModel.count()),(i=this._pagination)==null||i.setTotalRows(s)}clearData(){this._rowMgr.reset(),this._data.clearData(),this._mutation.commit({totals:"zero",renderMode:"full",emitPayload:()=>[]})}insertRow(e,t="last"){this._mutation.insertRow(e,t)}pushRow(e){this._mutation.pushRow(e)}appendRows(e){this.pushRow(e)}unshiftRow(e){(Array.isArray(e)?e:[e]).forEach(s=>this._data.addRow(s,"first")),this._mutation.commit({totals:"count",renderMode:"sync-window",emitPayload:()=>this._data.getData(),fireOnDataChangeExplicitly:!0})}prependRows(e){this.unshiftRow(e)}deleteRow(e){this._mutation.deleteRow(e)}deleteById(e){}readCell(e,t){return this._data.getCellValue(e,t)}getDisplayValue(e,t){const s=this.readCell(e,t);return this._ovk.getStrategy("displayFormatter",(i,r,a)=>i==null?"":String(i))(s,t,this._data.getRowByIndex(e))}writeCell(e,t,s){this._mutation.writeCell(e,t,s)}getRowAt(e){return this._data.getRowByIndex(e)}getFlatRowModel(){return this._flatModel}beginBatch(){this._mutation.beginBatch()}endBatch(){this._mutation.endBatch()}setCellFormula(e,t,s){this._formula.setCellFormula(e,t,s)}getCellFormula(e,t){return this._formula.getCellFormula(e,t)}hasCellFormula(e,t){return this._formula.hasCellFormula(e,t)}clearCellFormula(e,t){this._formula.clearCellFormula(e,t)}getCellError(e,t){return this._formula.getCellError(e,t)}getDependents(e,t){return this._formula.getDependents(e,t)}getPrecedents(e,t){return this._formula.getPrecedents(e,t)}recalculate(){this._formula.recalculate()}recalculateCell(e,t){this._formula.recalculateCell(e,t)}offsetFormula(e,t,s,o){return this._formula.offsetFormula(e,t,s,o)}writeCells(e){return this._mutation.writeCells(e)}getRangeSelection(){return this._rangeMgr.getRangeSelection()}getActiveRange(){return this._rangeMgr.getActiveRange()}setRangeSelection(e){this._rangeMgr.setRangeSelection(e)}clearRangeSelection(){this._rangeMgr.clearRangeSelection()}getRangeValues(){return this._rangeMgr.getRangeValues()}getRangeStats(){return this._rangeMgr.getRangeStats()}fillRange(e,t,s="copy"){this._rangeMgr.fillRange(e,t,s)}createChart(e){return this._chartMgr.createChart(e)}getCharts(){return this._chartMgr.getCharts()}destroyCharts(){this._chartMgr.destroyCharts()}getChanges(){return this._data.getChanges()}getEditedRows(){return this._data.getEditedRows()}getChangedRows(){return this._data.getChangedRows()}getChangedColumns(){return this._data.getChangedColumns()}getAddedRows(){return this._data.getAddedRows()}getRemovedRows(){return this._data.getRemovedRows()}getOriginalRow(e){return this._data.getOriginalRow(e)}getRowsWithState(e){return this._data.getRowsWithState(e)}undo(){}redo(){}clearHistory(){}getColumnDefs(){return this._colLayout.visibleLeaves}getAllColumnDefs(){return this._colLayout.leaves}getColumnCount(){return this._colLayout.visibleLeaves.length}applyColumns(e){const t=this._trigMgr.mkCtx("applyColumns",[e]);this._trigMgr.exec("before:applyColumns",t)&&(this._colLayout.setColumns(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange()),t.result={columnCount:e.length},this._trigMgr.exec("after:applyColumns",t))}insertColumn(e,t){this._colLayout.addColumn(e,t),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}deleteColumn(e){this._colLayout.removeColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._formula.afterRecalc(this._recalc.invalidateField(e),{skipRender:!0}),this._renderHeader(),this._doRender(...this._visRange())}_reorderColumn(e,t){var r,a;const s=this._colLayout.visibleLeaves.map(l=>l);if(e<0||t<0||e>=s.length||t>=s.length)return;const o=[...this._options.columns],[i]=o.splice(e,1);o.splice(t,0,i),this._options.columns=o,this.applyColumns(o),(a=(r=this._options).onColumnReorder)==null||a.call(r,{fromIndex:e,toIndex:t,field:i.field??""})}hideColumn(e){this._colLayout.hideColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}showColumn(e){this._colLayout.showColumn(e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}getColumnIndex(e){return this._colLayout.getColumnIndex(e)}getFieldAt(e){var t;return((t=this._colLayout.getColumnByIndex(e))==null?void 0:t.field)??""}getColValues(e,t=!1){return this._data.getData().map(s=>s[e])}getUniqueValues(e,t=!1){return[...new Set(this.getColValues(e,t))]}setColWidths(e){}calcColWidths(e=!1){return[]}getSelections(){return this._rowMgr.getSelections()}getActiveRow(){return this._rowMgr.getActiveRow()}activate(e){this._rowMgr.activate(e),this._doRender(...this._visRange())}deselect(){this._rowMgr.deselect(),this._doRender(...this._visRange())}getChecked(){return this._rowMgr.getChecked()}getAllChecked(){return this._rowMgr.getAllChecked()}checkById(e){}addCheckById(e){}checkByValue(e,t){this._rowMgr.checkByValue(e,t),this._doRender(...this._visRange())}uncheckById(e){}uncheckAll(){this._rowMgr.uncheckAll(),this._doRender(...this._visRange())}orderBy(e,t="asc"){const s=this._trigMgr.mkCtx("orderBy",[e,t]);this._trigMgr.exec("before:orderBy",s)&&(this._sfMgr.sort(e,t),this._recalcRangeBearingFormulas(),s.result={sortList:this._sfMgr.sortList},this._trigMgr.exec("after:orderBy",s))}resetOrder(){this._sfMgr.resetSort(),this._recalcRangeBearingFormulas()}setFilter(e,t){const s=this._trigMgr.mkCtx("setFilter",[e,t]);this._trigMgr.exec("before:setFilter",s)&&(this._sfMgr.setFilter(e,t),this._recalcRangeBearingFormulas(),s.result={field:e,filteredCount:this._data.rowCount},this._trigMgr.exec("after:setFilter",s))}resetFilter(e){this._sfMgr.resetFilter(e),this._recalcRangeBearingFormulas()}_recalcRangeBearingFormulas(){this._formula.recalcRangeBearingFormulas()}getFilterState(){return this._sfMgr.getFilterState()}restoreFilter(e){this._sfMgr.restoreFilter(e)}_applyFilters(){this._sfMgr.applyFilters()}freeze(e){this._colLayout.setFrozen(e),this._renderHeader(),this._doRender(...this._visRange())}mergeCells(e){this._mergeEngine.applyMergeCells(e),this._doRender(...this._visRange())}autoMerge(e){const t=this._colLayout.visibleLeaves,s=[],o=[];for(const i of e){const r=t.findIndex(a=>a.field===i);r>=0&&(s.push(r),o.push(i))}this._mergeEngine.applyAutoMerge(this._data.getData(),s,o),this._doRender(...this._visRange())}clearMerge(){this._mergeEngine.clear(),this._doRender(...this._visRange())}freezeRows(e){}groupBy(e){const t=this._trigMgr.mkCtx("groupBy",[e]);this._trigMgr.exec("before:groupBy",t)&&(this._grpMgr.groupBy(e),t.result={fields:e},this._trigMgr.exec("after:groupBy",t))}clearGroup(){this._grpMgr.clearGroup()}expandAll(){this._grpMgr.expandAll()}collapseAll(){this._grpMgr.collapseAll()}enableTree(){this._grpMgr.enableTree()}disableTree(){this._grpMgr.disableTree()}expandNodes(e,t=!0){this._grpMgr.expandNodes(e,t)}expandAllNodes(){this._grpMgr.expandAllNodes()}collapseAllNodes(){this._grpMgr.collapseAllNodes()}expandRow(e){this._detailMgr.expandRow(e)}collapseRow(e){this._detailMgr.collapseRow(e)}toggleRow(e){this._detailMgr.toggleRow(e)}isRowExpanded(e){return this._detailMgr.isRowExpanded(e)}collapseAllDetails(){this._detailMgr.collapseAllDetails()}getDetailInstance(e){return this._detailMgr.getDetailInstance(e)}resyncPanelWidths(){this._detailMgr.resyncPanelWidths()}addTreeRow(e,t,s){}exportExcel(e){this._exportMgr.exportExcel(e)}exportCsv(e){this._exportMgr.exportCsv(e)}exportJson(e){this._exportMgr.exportJson(e)}print(e){this._exportMgr.print(e)}toArray(e=!0){const t=this._data.getData();if(e)return t;const s=this._colLayout.visibleLeaves;return t.map(o=>s.map(i=>o[i.field]))}jumpToRow(e){var t;this._rowMgr.selectSingle(e),(t=this._vs)==null||t.scrollToRow(e),this._doRender(...this._visRange())}jumpToCol(e){}getScrollPos(){var e,t;return{x:((e=this._renderer)==null?void 0:e.bodyWrapper.scrollLeft)??0,y:((t=this._renderer)==null?void 0:t.bodyWrapper.scrollTop)??0}}setFooter(e){this._options.footer=e,this._renderFooterEl()}getFooterData(){return this._footerMgr.computeValues()}getFooterValue(e){var t;return((t=this._footerMgr.computeValues().find(s=>s._field===e))==null?void 0:t._value)??null}_renderFooterEl(){this._footerMgr.render()}resize(e,t){e&&(this._container.style.width=`${e}px`),t&&(this._container.style.height=`${t}px`),this._onResize()}setTheme(e){this._container.setAttribute("data-og-theme",e)}setThemeVar(e,t){this._container.style.setProperty(e,t)}setSkin(e){var t;this._options.skin=e,this._container.setAttribute("data-og-skin",e),(t=this._appearance)==null||t.setSkin(e),this._container.style.border=e==="default"?"1px solid var(--og-border-color, #e0e0e0)":this._appearance?this._appearance.border():"1px solid var(--og-border-color, #e0e0e0)",this._renderHeader(),this._doRender(...this._visRange())}getSkin(){return this._options.skin??"default"}setIcon(e,t){var s;this._icons||(this._icons=Me.child()),this._icons.register(e,t);try{(s=this._extensions)==null||s.strategy("iconResolver",(o,i)=>this._icons.render(o,i))}catch{}return this}renderIcon(e,t){return(this._icons??Me).render(e,t)}setLocale(e){var s,o;const t=this.getLocale();(this._locales??(this._locales=ne.child())).setActive(e),this._options.locale=e,this._container.setAttribute("lang",(this._locales??ne).meta().intlLocale),(s=this._pagination)==null||s.refreshLabels(),(o=this._findMgr)==null||o.refreshLabels(),this._filterPanel=null,this._renderHeader(),this._doRender(...this._visRange()),this.emit("localeChange",{locale:e,prev:t})}getLocale(){return(this._locales??ne).active()}setMessage(e,t){return(this._locales??(this._locales=ne.child())).setOverride(e,t),this}t(e,t){return(this._locales??ne).t(e,t)}setSkinVar(e,t){if(/#[0-9a-fA-F]{3,8}\b/.test(t)||/\b(?:rgba?|hsla?)\(\s*\d/.test(t))throw new Error(`[OpenGrid.setSkinVar] "${e}: ${t}" 에 색 리터럴 — 색은 setThemeVar 축입니다(색⊥형태).`);this._container.style.setProperty(e,t)}addTrigger(e,t){return this._trigMgr.add(e,t),this}removeTrigger(e,t){return this._trigMgr.remove(e,t),this}clearTriggers(e){return this._trigMgr.clear(e),this}_mkCtx(e,t){return this._trigMgr.mkCtx(e,t)}_trig(e,t){return this._trigMgr.exec(e,t)}destroy(){var e,t,s,o,i,r,a,l,d,c;this._destroyed||(this._destroyed=!0,this._renderer&&Xe.unregister(this._renderer.bodyWrapper),this._trigMgr.clear(),(e=this._ro)==null||e.disconnect(),(t=this._vs)==null||t.destroy(),(s=this._chartMgr)==null||s.destroyCharts(),(o=this._detailMgr)==null||o.destroy(),(i=this._filterPanel)==null||i.destroy(),(r=this._dnd)==null||r.destroy(),this._cmHandler&&this._container.removeEventListener("contextmenu",this._cmHandler),this._cmKbdHandler&&this._container.removeEventListener("keydown",this._cmKbdHandler),this._cmHandler=this._cmKbdHandler=null,(a=this._ctxMenu)==null||a.destroy(),(l=this._wsManager)==null||l.destroy(),(d=this._renderer)==null||d.destroy(),(c=this._liveRegion)==null||c.remove(),this._liveRegion=null,this._container.innerHTML="",this._container.classList.remove("og-container"),this.removeAllListeners())}};X._defaultOverrides=[],X._defaultStrategies=[],X.defaults={strategy(e,t){return X._defaultStrategies.push([e,t]),X}};let yt=X;exports.DEFAULT_ICON_ROLES=ls;exports.IconRegistry=tt;exports.LocaleRegistry=et;exports.OpenGrid=yt;exports.SkinRegistry=ps;exports.buildTree=ft;exports.iconRegistry=Me;exports.localeRegistry=ne;exports.renderIcon=si;exports.skinRegistry=bt;exports.t=z;
|
|
97
|
-
//# sourceMappingURL=OpenGrid-CuXj0isp.cjs.map
|