open-grid 1.0.7 → 1.1.0
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 +34 -0
- package/dist/OpenGrid-5flQwc3W.js +8434 -0
- package/dist/OpenGrid-DahxRY7C.cjs +92 -0
- package/dist/open-grid-base.css +61 -0
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-themes.css +96 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +1 -1
- package/dist/open-grid.js +2 -2
- package/dist/types/core/CellEditManager.d.ts +4 -0
- package/dist/types/core/CellEventHandler.d.ts +6 -0
- package/dist/types/core/ChartManager.d.ts +58 -0
- package/dist/types/core/DataLayer.d.ts +17 -0
- package/dist/types/core/DetailManager.d.ts +72 -0
- package/dist/types/core/FlatRowModel.d.ts +56 -0
- package/dist/types/core/GridRenderer.d.ts +34 -1
- package/dist/types/core/GroupTreeManager.d.ts +13 -0
- package/dist/types/core/KeyboardManager.d.ts +19 -0
- package/dist/types/core/OpenGrid.d.ts +109 -1
- package/dist/types/core/RangeSelectionManager.d.ts +95 -0
- package/dist/types/core/SortFilterManager.d.ts +2 -0
- package/dist/types/core/chart/CanvasAdapter.d.ts +52 -0
- package/dist/types/core/chart/DataExtractor.d.ts +49 -0
- package/dist/types/core/chart/a11y.d.ts +21 -0
- package/dist/types/core/chart/downsample.d.ts +25 -0
- package/dist/types/core/chart/hittest.d.ts +20 -0
- package/dist/types/core/chart/palette.d.ts +56 -0
- package/dist/types/core/chart/scales.d.ts +24 -0
- package/dist/types/core/chart/types.d.ts +181 -0
- package/dist/types/core/detail/DetailGlyph.d.ts +48 -0
- package/dist/types/core/detail/DetailSplice.d.ts +67 -0
- package/dist/types/core/detail/DetailState.d.ts +67 -0
- package/dist/types/core/detail/SubgridCache.d.ts +73 -0
- package/dist/types/core/detail/index.d.ts +14 -0
- package/dist/types/core/formula/FormulaEvaluator.d.ts +15 -0
- package/dist/types/core/formula/FormulaGraph.d.ts +43 -0
- package/dist/types/core/formula/FormulaParser.d.ts +6 -0
- package/dist/types/core/formula/FormulaStore.d.ts +17 -0
- package/dist/types/core/formula/RecalcCoordinator.d.ts +85 -0
- package/dist/types/core/formula/normalizeRefs.d.ts +15 -0
- package/dist/types/core/formula/numericLiteral.d.ts +7 -0
- package/dist/types/core/formula/serializeFormula.d.ts +6 -0
- package/dist/types/core/formula/types.d.ts +104 -0
- package/dist/types/core/range/ClipboardCodec.d.ts +30 -0
- package/dist/types/core/range/FillEngine.d.ts +63 -0
- package/dist/types/core/range/RangeModel.d.ts +53 -0
- package/dist/types/core/range/RangeQuery.d.ts +16 -0
- package/dist/types/core/range/types.d.ts +47 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +3 -0
- package/dist/types/core/types.d.ts +242 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/OpenGrid-tdspERot.cjs +0 -90
- package/dist/OpenGrid-zBt01Yim.js +0 -4867
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";class us{constructor(){this.listeners=new Map}on(t,e){const s=this.listeners.get(t)??[];return s.push({handler:e,once:!1}),this.listeners.set(t,s),this}once(t,e){const s=this.listeners.get(t)??[];return s.push({handler:e,once:!0}),this.listeners.set(t,s),this}off(t,e){if(!e)return this.listeners.delete(t),this;const s=this.listeners.get(t);if(s){const i=s.filter(n=>n.handler!==e);i.length===0?this.listeners.delete(t):this.listeners.set(t,i)}return this}emit(t,...e){const s=this.listeners.get(t);if(!s||s.length===0)return!1;const i=[];for(const n of s)n.handler(...e),n.once||i.push(n);return i.length!==s.length&&(i.length===0?this.listeners.delete(t):this.listeners.set(t,i)),!0}removeAllListeners(t){return t?this.listeners.delete(t):this.listeners.clear(),this}listenerCount(t){var e;return((e=this.listeners.get(t))==null?void 0:e.length)??0}}let fs=0;function _e(){return`og-r-${++fs}`}class ps{constructor(t="_ogRowId"){this._data=[],this._original=[],this._meta=new Map,this._displayIndexes=[],this._idMap=new Map,this._findQuery="",this._findFields=[],this._getStrategy=(e,s)=>s,this._idField=t}getDataIndexByRowId(t){return this._idMap.get(t)}setStrategyResolver(t){this._getStrategy=t}setData(t){this._data=t.map(e=>{const s=_e(),i={...e,[this._idField]:s};return this._meta.set(s,{state:"none",rowId:s}),i}),this._original=this._data.map(e=>({...e})),this._rebuildIdMap(),this._displayIndexes=this._data.map((e,s)=>s)}getData(){return this._displayIndexes.map(t=>this._data[t])}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(t,e="last"){const s=_e(),i={...t,[this._idField]:s};if(this._meta.set(s,{state:"added",rowId:s}),e==="last"){const n=this._data.push(i)-1;this._idMap.set(s,n),this._displayIndexes.push(n)}else if(e==="first")this._data.unshift(i),this._rebuildIdMap(),this._displayIndexes.unshift(0);else{const n=Math.min(e,this._displayIndexes.length),o=n<this._displayIndexes.length?this._displayIndexes[n]:this._data.length;this._data.splice(o,0,i),this._rebuildIdMap(),this._displayIndexes=this._data.map((l,a)=>a)}}removeRow(t){const e=this._displayIndexes[t];if(e===void 0)return;const s=this._data[e],i=s[this._idField],n=this._meta.get(i);return(n==null?void 0:n.state)==="added"?(this._data.splice(e,1),this._meta.delete(i)):this._meta.set(i,{...n,state:"removed"}),this._rebuildIdMap(),this._displayIndexes=this._data.map((o,l)=>({r:o,i:l})).filter(({r:o})=>{var l;return((l=this._meta.get(o[this._idField]))==null?void 0:l.state)!=="removed"}).map(({i:o})=>o),s}moveRow(t,e){const s=this._displayIndexes[t],i=this._displayIndexes[e];if(s===void 0||i===void 0)return;const[n]=this._data.splice(s,1),o=s<i?i-1:i;this._data.splice(o,0,n),this._rebuildIdMap(),this._displayIndexes=this._data.map((l,a)=>({r:l,i:a})).filter(({r:l})=>{var a;return((a=this._meta.get(l[this._idField]))==null?void 0:a.state)!=="removed"}).map(({i:l})=>l)}updateCell(t,e,s){const i=this._displayIndexes[t];if(i===void 0)return!1;const o=this._data[i][this._idField],l=this._meta.get(o);return(l==null?void 0:l.state)==="none"&&this._meta.set(o,{...l,state:"edited",original:{...this._original[i]}}),this._data[i][e]=s,!0}getRowByIndex(t){const e=this._displayIndexes[t];return e!==void 0?this._data[e]:void 0}getCellValue(t,e){var s;return(s=this.getRowByIndex(t))==null?void 0:s[e]}hasRow(t){var s;return this._idMap.get(t)===void 0?!1:((s=this._meta.get(t))==null?void 0:s.state)!=="removed"}getRowById(t){if(!this.hasRow(t))return;const e=this._idMap.get(t);return this._data[e]}getCellValueByRowId(t,e){var s;return(s=this.getRowById(t))==null?void 0:s[e]}setComputedValueByRowId(t,e,s){const i=this._idMap.get(t);i!==void 0&&(this._data[i][e]=s)}getEditedRows(){return this._data.filter(t=>{var e;return((e=this._meta.get(t[this._idField]))==null?void 0:e.state)==="edited"})}getChangedRows(){return this.getEditedRows()}getAddedRows(){return this._data.filter(t=>{var e;return((e=this._meta.get(t[this._idField]))==null?void 0:e.state)==="added"})}getRemovedRows(){return this._data.filter(t=>{var e;return((e=this._meta.get(t[this._idField]))==null?void 0:e.state)==="removed"})}getChanges(){const t=[],e=[],s=[];for(const i of this._data){const n=i[this._idField],o=this._meta.get(n),l=(o==null?void 0:o.state)??"none";if(l==="added")t.push({...i});else if(l==="removed")s.push({...i});else if(l==="edited"){const a=o.original??{},d=Object.keys(i).filter(c=>c!==this._idField&&i[c]!==a[c]);e.push({...i,_changedFields:d})}}return{added:t,edited:e,removed:s}}getChangedColumns(){return this._data.filter(t=>{var e;return((e=this._meta.get(t[this._idField]))==null?void 0:e.state)==="edited"}).map(t=>{var i;const e=((i=this._meta.get(t[this._idField]))==null?void 0:i.original)??{},s=[];for(const n of Object.keys(t))n!==this._idField&&t[n]!==e[n]&&s.push({field:n,oldValue:e[n],newValue:t[n]});return{row:{...t},fields:s.map(n=>n.field),diff:s}})}getOriginalRow(t){const e=this._displayIndexes[t];if(e===void 0)return;const s=this._data[e],i=this._meta.get(s[this._idField]);if(!(!i||i.state==="added"))return i.state==="edited"&&i.original?{...i.original}:{...this._original[e]}}getRowsWithState(t){return this._data.map(e=>{var i;const s=((i=this._meta.get(e[this._idField]))==null?void 0:i.state)??"none";return{...e,[t]:s}})}getRowState(t){var s;const e=this.getRowByIndex(t);return e?((s=this._meta.get(e[this._idField]))==null?void 0:s.state)??"none":"none"}applySort(t){const e=n=>{var o,l;return((l=this._meta.get((o=this._data[n])==null?void 0:o[this._idField]))==null?void 0:l.state)!=="removed"};if(t.length===0){this._displayIndexes=this._data.map((n,o)=>o).filter(e);return}const s=this._displayIndexes.filter(e).map(n=>{const o=this._data[n];return{idx:n,keys:t.map(l=>o[l.field])}}),i=this._getStrategy("sortComparator",(n,o,l,a)=>{if(n==null&&o==null)return 0;if(n==null)return-1;if(o==null)return 1;if(typeof n=="number"&&typeof o=="number")return n-o;const d=String(n),c=String(o);return d<c?-1:d>c?1:0});s.sort((n,o)=>{for(let l=0;l<t.length;l++){const a=t[l].dir,d=t[l].field,c=n.keys[l],h=o.keys[l],u=i(c,h,d,a);if(u!==0)return a==="asc"?u:-u}return 0}),this._displayIndexes=s.map(n=>n.idx)}applyFilter(t){const e=Object.keys(t),s=this._getStrategy("filterPredicate",(i,n,o)=>gs(i,n));this._displayIndexes=this._data.map((i,n)=>({r:i,i:n})).filter(({r:i})=>{var n;if(((n=this._meta.get(i[this._idField]))==null?void 0:n.state)==="removed"||e.length>0&&!e.every(o=>{const l=i[o];return t[o].every(a=>s(l,a,o))}))return!1;if(this._findQuery&&this._findFields.length>0){const o=this._findQuery;if(!this._findFields.some(a=>{const d=i[a];return d!=null&&String(d).toLowerCase().includes(o)}))return!1}return!0}).map(({i})=>i)}setFindFilter(t,e){this._findQuery=t.toLowerCase(),this._findFields=e}_rebuildIdMap(){this._idMap.clear(),this._data.forEach((t,e)=>{this._idMap.set(t[this._idField],e)})}}function gs(r,t){const e=r,s=t.value;switch(t.operator){case"=":return e==s;case"!=":return e!=s;case">":return e>s;case">=":return e>=s;case"<":return e<s;case"<=":return e<=s;case"contains":return String(e).includes(String(s));case"startsWith":return String(e).startsWith(String(s));case"endsWith":return String(e).endsWith(String(s));default:return!0}}class _s{constructor(t,e){this._totalRows=0,this._scrollTop=0,this._viewportHeight=0,this._rafId=null,this._onScroll=()=>{this._scrollTop=this.container.scrollTop,this._scheduleRender()},this.container=t,this.rowHeight=e.rowHeight,this.overscan=e.overscan??5,this.onRender=e.onRender,this.container.addEventListener("scroll",this._onScroll,{passive:!0})}_scheduleRender(){this._rafId===null&&(this._rafId=requestAnimationFrame(()=>{this._rafId=null;const t=this.getVisibleRange();this.onRender(t.startIndex,t.endIndex)}))}getVisibleRange(){const t=Math.ceil(this._viewportHeight/this.rowHeight),e=Math.max(0,Math.floor(this._scrollTop/this.rowHeight)-this.overscan),s=Math.min(this._totalRows-1,e+t+this.overscan*2),i=e*this.rowHeight;return{startIndex:e,endIndex:s,offsetY:i}}setTotalRows(t){this._totalRows=t,this._updateSpacerHeight(),this._scheduleRender()}setViewportHeight(t){this._viewportHeight=t,this._scheduleRender()}setRowHeight(t){this.rowHeight=t,this._updateSpacerHeight(),this._scheduleRender()}scrollToRow(t){const e=t*this.rowHeight,s=e+this.rowHeight,i=this._scrollTop+this._viewportHeight;if(e<this._scrollTop)this._scrollTop=e,this.container.scrollTop=e;else if(s>i){const n=s-this._viewportHeight;this._scrollTop=n,this.container.scrollTop=n}}getTotalHeight(){return this._totalRows*this.rowHeight}_updateSpacerHeight(){const t=this.container.querySelector(".og-spacer");t&&(t.style.height=`${this.getTotalHeight()}px`)}destroy(){this.container.removeEventListener("scroll",this._onScroll),this._rafId!==null&&cancelAnimationFrame(this._rafId)}}class me{constructor(t,e=0){this._flatLeaves=[],this._maxDepth=1,this._frozenCount=0,this._columns=t,this._frozenCount=e,this._process()}_process(){const t=[];let e=0;const s=(i,n)=>{for(const o of i)o.children&&o.children.length>0?(s(o.children,n+1),this._maxDepth=Math.max(this._maxDepth,n+1)):t.push({...o,_colIndex:e++,_depth:n,_leaf:!0})};this._maxDepth=1,s(this._columns,1),this._flatLeaves=t}get leaves(){return this._flatLeaves}get visibleLeaves(){return this._flatLeaves.filter(t=>!t.hidden)}get headerDepth(){return this._maxDepth}get frozenCount(){return this._frozenCount}setFrozen(t){this._frozenCount=t}setColumns(t){this._columns=t,this._process()}hideColumn(t){const e=Array.isArray(t)?t:[t];this._flatLeaves.forEach(s=>{e.includes(s.field)&&(s.hidden=!0)})}showColumn(t){const e=Array.isArray(t)?t:[t];this._flatLeaves.forEach(s=>{e.includes(s.field)&&(s.hidden=!1)})}addColumn(t,e="last"){e==="last"?this._columns.push(t):e==="first"?this._columns.unshift(t):this._columns.splice(e,0,t),this._process()}removeColumn(t){const e=s=>s.filter(i=>i.field===t?!1:(i.children&&(i.children=e(i.children)),!0));this._columns=e(this._columns),this._process()}getColumnByField(t){return this._flatLeaves.find(e=>e.field===t)}getColumnByIndex(t){return this._flatLeaves[t]}getColumnIndex(t){return this._flatLeaves.findIndex(e=>e.field===t)}buildHeaderCells(){const t=Array.from({length:this._maxDepth},()=>[]);let e=0;const s=(i,n)=>{let o=0;for(const l of i)if(!l.hidden)if(l.children&&l.children.length>0){const a=s(l.children,n+1);a>0&&(t[n-1].push({column:l,colIndex:e,depth:n,colSpan:a,rowSpan:1}),o+=a)}else t[n-1].push({column:l,colIndex:e++,depth:n,colSpan:1,rowSpan:this._maxDepth-n+1}),o++;return o};return s(this._columns,1),t}computeWidths(t,e=100){const s=this.visibleLeaves,i=s.filter(a=>a.flex),n=s.filter(a=>!a.flex&&a.width).reduce((a,d)=>a+d.width,0),o=i.reduce((a,d)=>a+(d.flex??1),0),l=Math.max(0,t-n);return s.map(a=>a.flex?Math.round(a.flex/o*l):a.width??e)}}class ms{constructor(t,e,s){this._field="",this._outsideHandler=null,this._onApply=e,this._onClear=s,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
|
+
`,t.appendChild(this._el)}open(t,e,s){var f;this._field=t,this._el.innerHTML="";const i=document.createElement("div");i.textContent="필터",i.style.cssText="font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);",this._el.appendChild(i);const n=document.createElement("div");n.style.cssText="display:flex;gap:4px;margin-bottom:6px;";const o=document.createElement("select");o.style.cssText="flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";const l=[{label:"포함",value:"contains"},{label:"같음",value:"="},{label:"같지 않음",value:"!="},{label:"시작",value:"startsWith"},{label:"끝남",value:"endsWith"},{label:"보다 큼",value:">"},{label:"보다 작음",value:"<"},{label:"이상",value:">="},{label:"이하",value:"<="}];for(const g of l){const m=document.createElement("option");m.value=g.value,m.textContent=g.label,o.appendChild(m)}s[0]&&(o.value=s[0].operator),n.appendChild(o),this._el.appendChild(n);const a=document.createElement("input");a.type="text",a.placeholder="필터 값 입력...",a.value=((f=s[0])==null?void 0:f.value)??"",a.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
|
+
`,a.addEventListener("keydown",g=>{g.key==="Enter"?h.click():g.key==="Escape"&&this.close()}),this._el.appendChild(a);const d=document.createElement("div");d.style.cssText="display:flex;gap:6px;justify-content:flex-end;";const c=document.createElement("button");c.textContent="초기화",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="적용",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 g=a.value.trim();g?this._onApply(this._field,[{operator:o.value,value:g}]):this._onClear(this._field),this.close()}),d.appendChild(c),d.appendChild(h),this._el.appendChild(d);const u=e.getBoundingClientRect(),p=this._el.parentElement.getBoundingClientRect();this._el.style.top=`${u.bottom-p.top+2}px`,this._el.style.left=`${Math.min(u.left-p.left,p.width-220)}px`,this._el.style.display="block",requestAnimationFrame(()=>a.focus()),this._outsideHandler&&document.removeEventListener("mousedown",this._outsideHandler),this._outsideHandler=g=>{!this._el.contains(g.target)&&g.target!==e&&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 ws=10;function ys(r,t=ws){const e=Math.pow(10,t);return Math.round(r*e)/e}class v{constructor(t,e){this._c=t,this._s=e<0?0:e}static from(t){if(t instanceof v)return t;if(typeof t=="bigint")return new v(t,0);const e=String(t).trim();if(!e||e==="null"||e==="undefined"||e==="NaN")return new v(0n,0);const s=e.startsWith("-"),i=s?e.slice(1):e,n=i.indexOf(".");let o,l;if(n===-1)o=BigInt(i),l=0;else{const a=i.slice(n+1);o=BigInt(i.slice(0,n)+a),l=a.length}return new v(s?-o:o,l)}static zero(){return new v(0n,0)}static one(){return new v(1n,0)}static _align(t,e){return t._s===e._s?[t._c,e._c,t._s]:t._s>e._s?[t._c,e._c*10n**BigInt(t._s-e._s),t._s]:[t._c*10n**BigInt(e._s-t._s),e._c,e._s]}add(t){const[e,s,i]=v._align(this,v.from(t));return new v(e+s,i)}sub(t){const[e,s,i]=v._align(this,v.from(t));return new v(e-s,i)}mul(t){const e=v.from(t);return new v(this._c*e._c,this._s+e._s)}div(t,e=20){const s=v.from(t);if(s._c===0n)throw new Error("OGDecimal: division by zero");const n=this._c*10n**BigInt(e+s._s)/s._c;return new v(n,e+this._s)}mod(t){const e=v.from(t),[s,i,n]=v._align(this,e);return new v(s%i,n)}neg(){return new v(-this._c,this._s)}abs(){return new v(this._c<0n?-this._c:this._c,this._s)}eq(t){const[e,s]=v._align(this,v.from(t));return e===s}gt(t){const[e,s]=v._align(this,v.from(t));return e>s}lt(t){const[e,s]=v._align(this,v.from(t));return e<s}gte(t){return!this.lt(t)}lte(t){return!this.gt(t)}isZero(){return this._c===0n}isNeg(){return this._c<0n}isPos(){return this._c>0n}toFixed(t){let e=this._c,s=this._s;if(s<t)e=e*10n**BigInt(t-s);else if(s>t){const c=10n**BigInt(s-t),h=c/2n,u=e<0n,p=u?-e:e,f=p%c;let g=p/c;f>=h&&(g+=1n),e=u?-g:g}s=t;const i=e<0n,o=(i?-e:e).toString().padStart(t+1,"0"),l=o.slice(0,o.length-t)||"0",a=t>0?"."+o.slice(o.length-t):"";return(i?"-":"")+l+a}toString(){if(this._s===0)return this._c.toString();let t=this._c,e=this._s;for(;e>0&&t!==0n&&t%10n===0n;)t/=10n,e--;return new v(t,e).toFixed(e)}toNumber(){return parseFloat(this.toFixed(20))}static sum(t){return t.reduce((e,s)=>e.add(s),v.zero())}static avg(t,e=20){return t.length?v.sum(t).div(t.length,e):v.zero()}static min(t){if(!t.length)throw new Error("OGDecimal.min: empty array");return t.map(v.from).reduce((e,s)=>e.lt(s)?e:s)}static max(t){if(!t.length)throw new Error("OGDecimal.max: empty array");return t.map(v.from).reduce((e,s)=>e.gt(s)?e:s)}}function je(r,t,e=30){return new bs(r,t,e).parse()}class bs{constructor(t,e,s){this._ctx=e,this._prec=s,this._pos=0,this._src=t.trim()}parse(){const t=this._additive();if(this._skip(),this._pos<this._src.length)throw new SyntaxError(`FormulaEngine: 예상치 못한 토큰 '${this._src[this._pos]}' (위치 ${this._pos})`);return t}_additive(){let t=this._multiplicative();for(this._skip();this._pos<this._src.length;){const e=this._src[this._pos];if(e!=="+"&&e!=="-")break;this._pos++,this._skip();const s=this._multiplicative();t=e==="+"?t.add(s):t.sub(s),this._skip()}return t}_multiplicative(){let t=this._unary();for(this._skip();this._pos<this._src.length;){const e=this._src[this._pos];if(e!=="*"&&e!=="/"&&e!=="%")break;this._pos++,this._skip();const s=this._unary();e==="*"?t=t.mul(s):e==="/"?t=t.div(s,this._prec):t=t.mod(s),this._skip()}return t}_unary(){return this._skip(),this._src[this._pos]==="-"?(this._pos++,this._unary().neg()):this._primary()}_primary(){this._skip();const t=this._src[this._pos];if(t==="("){this._pos++;const e=this._additive();if(this._skip(),this._src[this._pos]!==")")throw new SyntaxError("FormulaEngine: 닫는 괄호 ) 누락");return this._pos++,e}return t==="["?this._fieldRef():this._literal()}_fieldRef(){this._pos++;const t=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 e=this._src.slice(t,this._pos);this._pos++;const s=this._ctx[e];if(s==null)throw new ReferenceError(`FormulaEngine: 필드 '[${e}]'가 행 데이터에 없습니다`);return v.from(s)}_literal(){const t=this._pos;for(;this._pos<this._src.length&&/[0-9.]/.test(this._src[this._pos]);)this._pos++;const e=this._src.slice(t,this._pos);if(!e)throw new SyntaxError(`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos]??"EOF"}' 발견 (위치 ${t})`);return v.from(e)}_skip(){for(;this._pos<this._src.length&&/\s/.test(this._src[this._pos]);)this._pos++}}function oe(r,t){if(r==null||r==="")return r??"";const e=typeof t=="string"?{type:t}:t,s=e.char??"*";switch(e.type){case"ssn":return vs(r,s);case"phone":case"mobile":return xs(r,s);case"email":return Cs(r,s);case"credit":return Rs(r,s);case"account":return Ms(r,s,e.visiblePrefix??3,e.visibleSuffix??4);case"password":return s.repeat(Math.max(r.length,6));case"name":return Es(r,s);case"ip":return ks(r,s);case"partial":return St(r,s,e.visiblePrefix??0,e.visibleSuffix??4);default:return r}}function vs(r,t){const e=r.replace(/[^0-9]/g,"");if(e.length<7){const o=r.includes("-")?"-":"",l=r.indexOf("-")>=0?r.indexOf("-"):6;return r.slice(0,l)+o+t.repeat(Math.max(1,r.length-l-o.length))}const s=e.slice(0,6),i=e[6],n=e.length-7;return`${s}-${i}${t.repeat(n)}`}function xs(r,t){const e=r.replace(/[^0-9]/g,"");return e.length===11?`${e.slice(0,3)}-${t.repeat(4)}-${e.slice(7)}`:e.length===10?e.startsWith("02")?`${e.slice(0,2)}-${t.repeat(4)}-${e.slice(6)}`:`${e.slice(0,3)}-${t.repeat(3)}-${e.slice(6)}`:e.length===9?`${e.slice(0,2)}-${t.repeat(3)}-${e.slice(5)}`:St(r,t,3,4)}function Cs(r,t){const e=r.indexOf("@");if(e<0)return St(r,t,2,0);const s=r.slice(0,e),i=r.slice(e),n=Math.min(2,s.length),o=s.slice(0,n),l=Math.max(s.length-n,3);return`${o}${t.repeat(l)}${i}`}function Rs(r,t){const e=r.replace(/[^0-9]/g,"");if(e.length<8)return r;const s=e.slice(0,4),i=e.slice(-4),n=e.length-8,o=t.repeat(Math.max(n,8)),l=[s];for(let a=0;a<o.length;a+=4){const d=o.slice(a,a+4);d&&l.push(d)}return l.push(i),l.join("-")}function Ms(r,t,e,s){const i=r.replace(/[^0-9]/g,"");if(i.length<=e+s)return St(i,t,e,s);const n=i.slice(0,e),o=i.slice(-s),l=i.length-e-s;return`${n}-${t.repeat(l)}-${o}`}function Es(r,t){const e=r.trim();return e.length===0?r:e.length===1?t:e.length===2?`${e[0]}${t}`:`${e[0]}${t.repeat(e.length-2)}${e[e.length-1]}`}function ks(r,t){const e=r.split(".");if(e.length!==4)return St(r,t,3,0);const s=i=>t.repeat(Math.max(i.length,3));return`${e[0]}.${e[1]}.${s(e[2])}.${s(e[3])}`}function St(r,t,e,s){if(r.length<=e+s)return r;const i=r.slice(0,e),n=s>0?r.slice(-s):"",o=r.length-e-s;return`${i}${t.repeat(o)}${n}`}let Et=null;function Fs(r){Et=r}function Ge(r){if(r.hasCellFormula)return null;const t=r.column;if(!t.formula)return null;const e=t.formulaPrecision??30;try{let s;return typeof t.formula=="function"?s=t.formula(r.row,v):s=je(t.formula,r.row,e),s instanceof v?t.precision!=null?s.toFixed(t.precision):s.toString():typeof s=="string"?s:t.precision!=null?v.from(s).toFixed(t.precision):String(s)}catch(s){return console.warn("[OpenGrid] Formula error:",s),"#ERR"}}function Ss(r,t,e,s,i,n){if(Et){const _=Et(r,i??"",n);if(_!=null)return _}if(r==null||r==="")return"";let o=Number(r);if(isNaN(o))return String(r);if(e!=null&&(o=ys(o,e)),s)try{return new Intl.NumberFormat(void 0,{style:"currency",currency:s,...e!=null?{minimumFractionDigits:e,maximumFractionDigits:e}:{}}).format(o)}catch{}if(!t)return e!=null?o.toFixed(e):String(o);const l=t.indexOf(";"),a=l>=0?t.slice(l+1):null,d=o<0&&a!=null?a:l>=0?t.slice(0,l):t,c=o<0&&a!=null?Math.abs(o):o,h=d.match(/[#0][#0,]*(?:\.[#0]+)?/);if(!h)return String(o);const u=h[0],p=d.slice(0,h.index),f=d.slice(h.index+u.length),g=u.includes(","),m=u.includes(".")?u.split(".")[1].length:e??0,b=c.toLocaleString("ko-KR",{minimumFractionDigits:m,maximumFractionDigits:m,useGrouping:g});return p+b+f}function qe(r,t="yyyy-MM-dd",e,s){if(Et){const a=Et(r,e??"",s);if(a!=null)return a}if(!r)return"";const i=r instanceof Date?r:new Date(r);if(isNaN(i.getTime()))return String(r);const n=i.getFullYear(),o=String(i.getMonth()+1).padStart(2,"0"),l=String(i.getDate()).padStart(2,"0");return t.replace("yyyy",String(n)).replace("MM",o).replace("dd",l)}function Is(r,t,e){const s=oe(r,t.mask),i=document.createElement("span");i.style.cssText="display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";const n=document.createElement("span");n.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);",n.textContent=s;const o=document.createElement("button");return o.title="클릭하면 원문 표시",o.setAttribute("aria-label","마스킹 해제"),o.innerHTML='<svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><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"/></svg>',o.style.cssText="flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:3px;display:flex;align-items:center;",o.addEventListener("mouseover",()=>{o.style.color="var(--og-primary,#1976d2)",o.style.background="rgba(25,118,210,0.08)"}),o.addEventListener("mouseout",()=>{o.style.color="#c0c0c0",o.style.background="none"}),o.addEventListener("click",l=>{l.stopPropagation(),n.textContent=r,n.style.fontFamily="",n.style.letterSpacing="",n.style.color="",o.remove(),(t._maskRevealedRows??(t._maskRevealedRows=new Set)).add(e)}),i.appendChild(n),i.appendChild(o),i}class zt{render(t){var a;const e=document.createElement("span");e.className="og-cell-text";const s=Ge(t);if(s!==null)return e.textContent=s,e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",e;const{value:i,column:n,rowIndex:o}=t;if(t.displayValue!=null)return e.textContent=t.displayValue,e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",e;let l;if(n.valueMap&&i!=null&&n.valueMap[i]?l=n.valueMap[i]:l=i==null?"":String(i),n.mask){const d=n._maskRevealed===!0,c=((a=n._maskRevealedRows)==null?void 0:a.has(o))===!0;if(!d&&!c)return Is(l,n,o)}return e.textContent=l,e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",e}}class Ls{constructor(t=[],e){this._opts=t.map(s=>typeof s=="string"?{label:s,value:s}:{label:s.label??s.text??String(s.value??""),value:s.value}),this._fn=e??null}render(t){const e=document.createElement("span");e.className="og-cell-text",e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";const s=t.value;if(s==null||s==="")return e;const i=String(s),o=(this._fn?this._fn(t.row,t.rowIndex).map(l=>typeof l=="string"?{label:l,value:l}:{label:l.label??l.text??String(l.value??""),value:l.value}):this._opts).find(l=>String(l.value)===i);return e.textContent=o?o.label:i,e}}class Nt{render(t){const e=document.createElement("span");e.className="og-cell-number";const s=Ge(t);return s!==null?(e.textContent=s,e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",e):(e.textContent=Ss(t.value,t.column.format??"#,##0",t.column.precision,t.column.currency,t.column.field,t.row),e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;",e)}}class Pt{render(t){const e=document.createElement("span");return e.className="og-cell-date",e.textContent=qe(t.value,t.column.format,t.column.field,t.row),e.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",e}}class Ht{render(t){const e=document.createElement("span");e.className="og-cell-checkbox",e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("input");return s.type="checkbox",s.checked=!!t.value,s.disabled=!0,s.style.cssText+="cursor:pointer;pointer-events:none;",e.appendChild(s),e}}class we{constructor(t){this.def=t}render(t){var n,o,l;const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("button");s.className=`og-cell-btn${(n=this.def)!=null&&n.buttonClass?" "+this.def.buttonClass:""}`;const i=(o=this.def)==null?void 0:o.label;return typeof i=="function"?s.textContent=i(t.value,t.row):s.textContent=i??String(t.value??"btn"),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
|
+
`,s.addEventListener("mouseover",()=>s.style.background="var(--og-primary-light,#e3f2fd)"),s.addEventListener("mouseout",()=>s.style.background="var(--og-row-bg,#fff)"),e.appendChild(s),e}}class ye{constructor(t,e){this.colorMap=t,this.labelMap=e}render(t){var l,a,d;const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;height:100%;";const s=document.createElement("span"),i=t.value==null?"":String(t.value),n=((l=this.labelMap)==null?void 0:l[i])??((a=t.column.valueMap)==null?void 0:a[i])??i;s.textContent=n;const o=((d=this.colorMap)==null?void 0:d[i])??"#666";return s.style.cssText=`
|
|
23
|
+
display:inline-block;padding:2px 8px;border-radius:12px;font-size:11px;
|
|
24
|
+
background:${o}22;color:${o};border:1px solid ${o}66;
|
|
25
|
+
white-space:nowrap;
|
|
26
|
+
`,e.appendChild(s),e}}class be{constructor(t,e){this.hrefFn=t,this.target=e}render(t){const e=document.createElement("a");return e.className="og-cell-link",e.textContent=t.value==null?"":String(t.value),e.href=this.hrefFn?this.hrefFn(t.value,t.row):"#",this.target&&(e.target=this.target),e.style.cssText="color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;",this.hrefFn||e.addEventListener("click",s=>s.preventDefault()),e}}class Ts{constructor(t){this.templateFn=t}render(t){const e=document.createElement("div");return e.className="og-cell-template",e.style.cssText="display:flex;align-items:center;height:100%;overflow:hidden;",e.innerHTML=this.templateFn(t.value,t.row,t.rowIndex),e}}class Ds{constructor(t){this.def=t}render(t){var d,c,h,u,p;const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=document.createElement("img"),i=(d=this.def)!=null&&d.srcFn?this.def.srcFn(t.value,t.row):String(t.value??"");s.src=i;const n=((c=this.def)==null?void 0:c.width)??28,o=((h=this.def)==null?void 0:h.height)??28,l=((u=this.def)==null?void 0:u.radius)??4;s.style.cssText=`width:${n}px;height:${o}px;object-fit:cover;border-radius:${l}px;display:block;`;const a=(p=this.def)==null?void 0:p.alt;return s.alt=typeof a=="function"?a(t.value,t.row):a??"",s.onerror=()=>{s.style.display="none"},e.appendChild(s),e}}class As{constructor(t){this.def=t}render(t){var d,c,h,u;const e=document.createElement("span");e.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,i=Number(t.value)||0,n=Math.min(100,Math.max(0,i/s*100)),o=(c=this.def)!=null&&c.colorFn?this.def.colorFn(i):((h=this.def)==null?void 0:h.color)??"var(--og-primary,#1976d2)",l=document.createElement("div");l.className="og-progress-track",l.style.cssText="flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";const a=document.createElement("div");if(a.className="og-progress-fill",a.style.cssText=`width:${n}%;height:100%;background:${o};border-radius:5px;`,l.appendChild(a),e.appendChild(l),((u=this.def)==null?void 0:u.showLabel)!==!1){const p=document.createElement("span");p.style.cssText="font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;",p.textContent=`${Math.round(n)}%`,e.appendChild(p)}return e}}class $s{constructor(t){this.def=t}render(t){var c,h,u,p;const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=Array.isArray(t.value)?t.value.map(Number):[];if(!s.length)return e.textContent="-",e;const i=((c=this.def)==null?void 0:c.width)??80,n=((h=this.def)==null?void 0:h.height)??22,o=((u=this.def)==null?void 0:u.color)??"#1976d2",l=((p=this.def)==null?void 0:p.chartType)??"bar",a=document.createElement("canvas");a.width=i,a.height=n,a.style.cssText="display:block;";const d=a.getContext("2d");if(d){const f=Math.max(...s,1),g=Math.min(...s,0),m=f-g||1,b=s.length;if(l==="bar"){const _=i/b;s.forEach((w,x)=>{const E=(w-g)/m*(n-2);d.fillStyle=o,d.fillRect(x*_+1,n-E-1,_-2,E)})}else{const _=s.map((w,x)=>({x:x/(b-1||1)*i,y:n-(w-g)/m*(n-4)-2}));l==="area"&&(d.fillStyle=o+"33",d.beginPath(),d.moveTo(_[0].x,n),_.forEach(w=>d.lineTo(w.x,w.y)),d.lineTo(_[_.length-1].x,n),d.closePath(),d.fill()),d.strokeStyle=o,d.lineWidth=1.5,d.beginPath(),_.forEach((w,x)=>x===0?d.moveTo(w.x,w.y):d.lineTo(w.x,w.y)),d.stroke()}}return e.appendChild(a),e}}class ve{render(t){const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;";const s=!!t.value,i=document.createElement("span");i.className="og-switch"+(s?" og-switch--on":""),i.style.cssText=`display:inline-block;width:34px;height:18px;border-radius:9px;
|
|
27
|
+
background:${s?"var(--og-primary,#1976d2)":"#bdbdbd"};
|
|
28
|
+
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;const n=document.createElement("span");return n.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);`,i.appendChild(n),e.appendChild(i),e}}class Os{constructor(t){this.def=t}render(t){var o,l;const e=document.createElement("span");e.style.cssText="display:flex;align-items:center;gap:1px;height:100%;";const s=((o=this.def)==null?void 0:o.max)??5,i=Math.round(Number(t.value)||0),n=((l=this.def)==null?void 0:l.color)??"#ffa000";for(let a=1;a<=s;a++){const d=document.createElement("span");d.textContent="★",d.style.cssText=`font-size:14px;color:${a<=i?n:"#e0e0e0"};line-height:1;`,e.appendChild(d)}return e}}class Vt{render(t){const e=document.createElement("span");e.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=!!t.value,s.setAttribute("aria-checked",t.value?"true":"false"),s.setAttribute("aria-label",t.column.header??"선택"),t.column.group&&(s.name=`og-radio-${t.rowIndex}-${t.column.group}`),s.style.cssText="width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);",e.appendChild(s),e}}class Wt{render(t){const e=document.createElement("span");if(e.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;",!t.value)return e;const s=document.createElement("img");return s.src=String(t.value),s.alt=t.column.alt??t.column.field,s.style.cssText="max-width:100%;max-height:100%;object-fit:contain;display:block;",s.setAttribute("role","img"),e.appendChild(s),e}}function Bs(r){const t=document.createElement("div");return t.innerHTML=r,t.querySelectorAll("script,iframe,object,embed").forEach(e=>e.remove()),t.querySelectorAll("*").forEach(e=>{for(const s of[...e.attributes])s.name.startsWith("on")&&e.removeAttribute(s.name);if(e.tagName==="A"){const s=e.getAttribute("href")??"";/^javascript:/i.test(s)&&e.removeAttribute("href")}}),t.innerHTML}class Kt{render(t){const e=document.createElement("span");e.style.cssText="display:block;overflow:hidden;width:100%;";const s=t.column.sanitize!==!1,i=String(t.value??"");return e.innerHTML=s?Bs(i):i,e}}const zs=["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"],Ns="2331112";function xe(r){let t="",e=!0;for(const s of r)t+=(e?"1":"0").repeat(+s),e=!e;return t}function Ps(r){const t=[104];for(const s of r){const i=s.charCodeAt(0)-32;i>=0&&i<=94&&t.push(i)}let e=104;for(let s=1;s<t.length;s++)e+=t[s]*s;return t.push(e%103),t.map(s=>xe(zs[s])).join("")+xe(Ns)+"11"}class Ut{render(t){const e=String(t.value??""),s=t.column.barcodeHeight??28,i=document.createElement("div");i.style.cssText="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;",i.setAttribute("role","img"),i.setAttribute("aria-label",`바코드: ${e}`),i.innerHTML=Hs(e,s);const n=document.createElement("span");return n.textContent=e,n.style.cssText="font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;",i.appendChild(n),i}}function Hs(r,t){if(!r)return"";const e=Ps(r),s=1.4,i=6,n=e.length*s+i*2,o=[];let l=0,a=i;for(;l<e.length;)if(e[l]==="1"){let d=0;for(;l+d<e.length&&e[l+d]==="1";)d++;o.push(`<rect x="${a.toFixed(2)}" y="0" width="${(d*s).toFixed(2)}" height="${t}"/>`),a+=d*s,l+=d}else a+=s,l++;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${n.toFixed(2)} ${t}" width="${n.toFixed(2)}" height="${t}" style="display:block" aria-hidden="true"><g fill="currentColor">${o.join("")}</g></svg>`}function Vs(r){const t=r.renderer;if(!t)switch(r.type){case"number":return new Nt;case"date":return new Pt;case"boolean":return new Ht;case"radio":return new Vt;case"img":return new Wt;case"html":return new Kt;case"barcode":return new Ut;case"select":return new Ls(r.options??[],r.optionsFn);default:return new zt}if(typeof t=="string")switch(t){case"number":return new Nt;case"date":return new Pt;case"checkbox":return new Ht;case"button":return new we;case"link":return new be;case"badge":return new ye;case"switch":return new ve;case"radio":return new Vt;case"img":return new Wt;case"html":return new Kt;case"barcode":return new Ut;default:return new zt}switch(t.type){case"button":return new we(t);case"checkbox":return new Ht;case"link":return new be(t.hrefFn,t.target);case"template":return new Ts(t.templateFn);case"badge":return new ye(t.colorMap,t.labelMap??t.valueMap);case"image":return new Ds(t);case"progress":return new As(t);case"sparkline":return new $s(t);case"switch":return new ve;case"rating":return new Os(t);case"number":return new Nt;case"date":return new Pt;case"radio":return new Vt;case"img":return new Wt;case"html":return new Kt;case"barcode":return new Ut;default:return new zt}}const Ws={"#ERR":"수식 오류","#REF":"참조 대상이 삭제됨","#CYCLE":"순환 참조","#DIV0":"0으로 나눔","#NAME":"알 수 없는 함수/이름","#VALUE":"숫자가 아닌 값에 산술 연산","#NUM":"수치 도메인 오류"};class Ks{constructor(t,e,s){this._cellMap=new Map,this._root=t,this._opts=e,this._cbs=s,this._header=D("div","og-header"),this._header.style.cssText="flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);scrollbar-width:none;",this._bodyWrap=D("div","og-body-wrapper"),this._bodyWrap.style.cssText="flex:1;overflow:auto;position:relative;",this._bodyWrap.style.setProperty("--scrollbar-size","8px"),this._body=D("div","og-body"),this._body.style.cssText="position:relative;",this._bodyWrap.appendChild(this._body),t.appendChild(this._header),t.appendChild(this._bodyWrap),this._bodyWrap.addEventListener("scroll",()=>{this._header.scrollLeft=this._bodyWrap.scrollLeft},{passive:!0})}get bodyWrapper(){return this._bodyWrap}updateSize(t,e){this._bodyWrap.style.height=`${t-e}px`}getHeaderHeight(){return this._header.offsetHeight}renderHeader(t,e,s,i,n){var g,m,b,_;this._header.innerHTML="";const o=n._frozenCount??0,l=!!((g=n.masterDetail)!=null&&g.enabled)&&(((m=n.masterDetail)==null?void 0:m.toggle)??"expander-col")==="expander-col",a=28;let d=0;n.stateColumn&&(d+=24),n.draggable&&(d+=18),n.rowNumber&&(d+=44),n.checkColumn&&(d+=36),l&&(d+=a);const c=d+e.reduce((w,x,E)=>w+(s[E]??n.defaultColumnWidth),0);this._header.style.background="var(--og-header-bg,#f5f5f5)";const h=D("table","og-header-table");h.setAttribute("role","presentation"),h.style.cssText=`table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${c}px;background:var(--og-header-bg,#f5f5f5);`;const u=t.length;let p=0;const f=(w,x,E,y="")=>{const k=D("th",`og-header-cell og-extra-col ${y}`);k.setAttribute("rowspan",String(u)),k.textContent=E,Re(k,{width:`${x}px`,minWidth:`${x}px`,textAlign:"center",borderRight:"1px solid var(--og-border-color,#e0e0e0)",borderBottom:"1px solid var(--og-border-color,#e0e0e0)",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)"}),o>0&&(k.style.position="sticky",k.style.left=`${p}px`,k.style.zIndex="4"),p+=x,w.appendChild(k)};for(let w=0;w<t.length;w++){const x=D("tr","og-header-row");if(x.style.height=`${n.headerHeight}px`,w===0){if(n.stateColumn&&f(x,24,""),n.draggable&&f(x,18,""),n.rowNumber&&f(x,44,"No"),n.checkColumn){const E=D("th","og-header-cell og-extra-col");E.setAttribute("rowspan",String(u)),E.style.cssText="width:36px;min-width:36px;text-align:center;border-right:1px solid var(--og-border-color,#e0e0e0);border-bottom:1px solid var(--og-border-color,#e0e0e0);border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;",o>0&&(E.style.position="sticky",E.style.left=`${p}px`,E.style.zIndex="4"),p+=36;const y=document.createElement("input");y.type="checkbox",y.setAttribute("aria-label","전체 행 선택"),y.style.cssText="width:16px;height:16px;",y.addEventListener("change",()=>this._cbs.onAllCheck(y.checked)),E.appendChild(y),x.appendChild(E)}l&&f(x,a,"","og-detail-toggle-col")}for(const E of t[w]??[]){const y=D("th","og-header-cell"),k=E.column;E.colSpan>1&&(y.colSpan=E.colSpan),E.rowSpan>1&&(y.rowSpan=E.rowSpan);const S=E.colSpan===1?e.findIndex(M=>M.field===k.field):-1;if(E.colSpan===1){const M=S>=0?s[S]??n.defaultColumnWidth:k.width??n.defaultColumnWidth;y.style.width=`${M}px`,y.style.minWidth=`${M}px`}const A=i.find(M=>M.field===k.field),P=k.sortable!==!1&&n.sortable&&E.colSpan===1;if(y.setAttribute("role","columnheader"),y.setAttribute("scope","col"),P&&(y.setAttribute("aria-sort",A?A.dir==="asc"?"ascending":"descending":"none"),y.tabIndex=S===0?0:-1,y.addEventListener("keydown",M=>{if(M.key==="Enter"||M.key===" ")M.preventDefault(),this._cbs.onHeaderClick(k.field,M.shiftKey);else if(M.key==="ArrowRight"){M.preventDefault();const T=y.nextElementSibling;(T==null?void 0:T.tagName)==="TH"&&T.focus()}else if(M.key==="ArrowLeft"){M.preventDefault();const T=y.previousElementSibling;(T==null?void 0:T.tagName)==="TH"&&T.focus()}})),S>=0&&S<o){let M=0;n.stateColumn&&(M+=24),n.draggable&&(M+=18),n.rowNumber&&(M+=44),n.checkColumn&&(M+=36),l&&(M+=a);for(let T=0;T<S;T++)M+=s[T]??n.defaultColumnWidth;y.classList.add("og-frozen"),S===o-1&&y.classList.add("og-frozen-last"),y.style.left=`${M}px`}const B=k.header??k.field,K=typeof B=="string"&&B.indexOf(`
|
|
31
|
+
`)>=0,U=k.headerWrap===!0||K;Re(y,{padding:"4px 8px",boxSizing:"border-box",background:"var(--og-header-bg)",color:"var(--og-header-color)",lineHeight:U?"1.3":"normal",verticalAlign:"middle",fontSize:"var(--og-font-size)",textAlign:k.headerAlign??"center",borderTop:"0",borderLeft:"0",borderRight:"1px solid var(--og-border-color,#e0e0e0)",borderBottom:"1px solid var(--og-border-color,#e0e0e0)",userSelect:"none",cursor:P?"pointer":"default",whiteSpace:U?"normal":"nowrap",overflow:U?"visible":"hidden",textOverflow:U?"clip":"ellipsis",wordBreak:U?"break-word":"normal",position:"relative"}),y.title=(typeof k.tooltip=="string"?k.tooltip:B)??"";const Z=D("span");if(U?(Z.style.cssText="overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;",String(B).split(`
|
|
32
|
+
`).forEach((T,J)=>{J>0&&Z.appendChild(document.createElement("br")),Z.appendChild(document.createTextNode(T))})):(Z.textContent=B,Z.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"),y.appendChild(Z),A){y.classList.add("og-sorted");const M=D("span","og-sort-icon");M.textContent=A.dir==="asc"?" ↑":" ↓",y.appendChild(M)}if(k.filterable!==!1&&n.filterable&&E.colSpan===1){const M=D("span","og-filter-icon"),T=((_=(b=n._activeFilters)==null?void 0:b[k.field])==null?void 0:_.length)>0;M.textContent=T?"⊿":"▿",M.title="필터",M.style.cssText="margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;",T&&M.classList.add("og-filter-icon--active"),M.addEventListener("click",J=>{J.stopPropagation(),this._cbs.onFilterIconClick(k.field,M)}),y.appendChild(M)}if(k.resizable!==!1){const M=D("div","og-resize-handle");M.style.cssText="position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;",y.appendChild(M);const T=S;Us(M,y,J=>{T>=0&&this._cbs.onColResize(T,J)})}n.columnReorder&&S>=0&&E.colSpan===1&&(y.draggable=!0,y.addEventListener("dragstart",M=>{var T;this._cbs.onColDragStart(S),y.classList.add("og-col-dragging"),(T=M.dataTransfer)==null||T.setData("text/plain",String(S))}),y.addEventListener("dragend",()=>{y.classList.remove("og-col-dragging"),this._header.querySelectorAll(".og-col-drop-over").forEach(M=>M.classList.remove("og-col-drop-over"))}),y.addEventListener("dragover",M=>{M.preventDefault();const T=this._cbs.getColDragIdx();T!==null&&T!==S&&(this._header.querySelectorAll(".og-col-drop-over").forEach(J=>J.classList.remove("og-col-drop-over")),y.classList.add("og-col-drop-over"))}),y.addEventListener("dragleave",()=>{y.classList.remove("og-col-drop-over")}),y.addEventListener("drop",M=>{M.preventDefault(),y.classList.remove("og-col-drop-over"),this._cbs.onColDrop(S)})),P&&y.addEventListener("click",M=>{M.target.classList.contains("og-resize-handle")||this._cbs.onHeaderClick(k.field,M.shiftKey)}),x.appendChild(y)}h.appendChild(x)}this._header.appendChild(h)}renderBody(t,e,s,i,n,o,l,a,d,c,h=null,u,p,f={},g,m){var S,A,P,B,K,U,Z;Object.keys(f).length&&(o={...o,...f}),m==null||m.onBeforeTeardown(),this._body.innerHTML="",this._cellMap.clear();const b=o.autoHeight===!0;this._body.classList.toggle("og-autoheight",b),this._body.style.height=b?"":`${a}px`;const _=o._frozenCount??0,w=!!m&&(m.toggleMode??"expander-col")==="expander-col",x=28;let E=0;o.stateColumn&&(E+=24),o.draggable&&(E+=18),o.rowNumber&&(E+=44),o.checkColumn&&(E+=36),w&&(E+=x);const y=E+i.reduce((I,M,T)=>I+(n[T]??o.defaultColumnWidth),0);if(this._body.style.minWidth=`${y}px`,e<t)return;const k=document.createDocumentFragment();if(h&&m)for(let I=t-1;I>=0;I--){const M=h[I];if(!(M&&M._isDetailFiller===!0)){if(M&&M._isDetailHead===!0&&I+M._span-1>=t){const T=l+(I-t)*o.rowHeight;this._appendDetailPanel(k,M._rowId,T,M._span*o.rowHeight,y,m)}break}}for(let I=t;I<=e;I++){const M=h?h[I]:null;if(M&&M._isDetailFiller===!0)continue;if(M&&M._isDetailHead===!0&&m){const C=M,L=l+(I-t)*o.rowHeight;this._appendDetailPanel(k,C._rowId,L,C._span*o.rowHeight,y,m);continue}if(M&&M._isDetailHead===!0)continue;const T=M&&M._isGroup===!0,J=M&&M._isTree===!0;if(T){const C=M,L=`__${C._groupField}:${C._groupValue}`,N=D("div","og-group-row"),ht=l+(I-t)*o.rowHeight;N.style.cssText=[b?"":`top:${ht}px;height:${o.rowHeight}px;`,"display:flex;align-items:stretch;cursor:pointer;",`padding-left:${4+C._depth*12}px;`,"background:var(--og-header-bg,#f5f5f5);","border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"].join(""),N.setAttribute("role","row"),N.setAttribute("aria-expanded",C._expanded?"true":"false"),N.setAttribute("aria-rowindex",String(I+1)),N.setAttribute("aria-level",String(C._depth+1));let W=0;if(o.stateColumn&&(W+=24),o.draggable&&(W+=18),o.rowNumber&&(W+=44),o.checkColumn&&(W+=36),w&&(W+=x),W>0){const R=D("div","og-group-state-cell");R.style.cssText=[`width:${W}px;min-width:${W}px;flex-shrink:0;`,"display:flex;align-items:center;justify-content:center;","font-size:10px;font-weight:700;gap:2px;","border-right:1px solid var(--og-border-color,#e0e0e0);"].join("");const G=C._states??{added:0,edited:0,removed:0};if(G.added>0){const z=D("span");z.textContent=`+${G.added}`,z.style.cssText="color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;",R.appendChild(z)}if(G.edited>0){const z=D("span");z.textContent=`M${G.edited}`,z.style.cssText="color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;",R.appendChild(z)}if(G.removed>0){const z=D("span");z.textContent=`D${G.removed}`,z.style.cssText="color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;",R.appendChild(z)}N.appendChild(R)}let Y=!1;for(let R=0;R<i.length;R++){const G=i[R],z=n[R]??o.defaultColumnWidth,It=C._summaryFmt!==void 0&&G.field in(C._summaryFmt??{}),tt=D("div","og-group-cell");if(tt.style.cssText=[`width:${z}px;min-width:${z}px;flex-shrink:0;`,"padding:2px 8px;box-sizing:border-box;overflow:hidden;","border-right:1px solid var(--og-border-color,#e0e0e0);","display:flex;align-items:center;","white-space:nowrap;text-overflow:ellipsis;"].join(""),It){const at=C._summaryFmt[G.field];tt.textContent=at!==""?at:"-",tt.style.justifyContent="flex-end",tt.style.color="var(--og-primary,#1976d2)",tt.style.fontWeight="600"}else if(!Y){Y=!0;const at=D("span","og-group-arrow");at.textContent=C._expanded?"▾ ":"▸ ",at.style.cssText="color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;",tt.appendChild(at);const rt=D("span","og-group-label");rt.textContent=`${C._groupLabel} (${C._childCount}건)`,rt.style.cssText="overflow:hidden;text-overflow:ellipsis;font-weight:600;",tt.appendChild(rt),tt.style.gap="0"}N.appendChild(tt)}N.addEventListener("click",()=>u==null?void 0:u(L)),k.appendChild(N);continue}const j=J?M:null,st=j?j.data:h?M:s.getRowByIndex(I);if(!st)continue;const nt=J||T?"none":s.getRowState(I),V=D("div","og-row");if(V.setAttribute("role","row"),V.setAttribute("aria-rowindex",String(I+1)),!b){const C=l+(I-t)*o.rowHeight;V.style.top=`${C}px`,V.style.height=`${o.rowHeight}px`}let Q=I%2===0?"var(--og-row-bg,#fff)":"var(--og-row-alt-bg,#fafafa)";V.style.background=Q,nt==="added"&&V.classList.add("og-state-added"),nt==="edited"&&V.classList.add("og-state-edited"),nt==="removed"&&V.classList.add("og-state-removed"),d.has(I)&&V.classList.add("og-selected"),V.setAttribute("aria-selected",d.has(I)?"true":"false"),nt==="added"&&(Q="var(--og-row-added-bg,#e8f5e9)"),nt==="edited"&&(Q="var(--og-row-edited-bg,#fff8e1)"),nt==="removed"&&(Q="var(--og-row-removed-bg,#ffebee)"),d.has(I)&&(Q="var(--og-row-selected-bg,#bbdefb)");const cs=I;V.addEventListener("click",C=>{this._cbs.onCellClick(cs,-1,C)});const fe=new Map;let lt=0;if(o.stateColumn){const C=D("div","og-cell og-col-state"),L={added:"✚",edited:"✎",removed:"✖",none:""},N={added:"#2e7d32",edited:"#bf360c",removed:"#c62828",none:""};C.textContent=L[nt]??"",C.style.color=N[nt]??"",C.title=nt,_>0&&(C.style.position="sticky",C.style.left=`${lt}px`,C.style.zIndex="2",C.style.background=Q),lt+=24,V.appendChild(C)}const pe=this._cbs.getDndManager();if(o.draggable&&pe){const C=pe.attachHandle(V,I,o._totalRows??e+1);_>0&&(C.style.position="sticky",C.style.left=`${lt}px`,C.style.zIndex="2",C.style.background=Q),lt+=18,V.appendChild(C)}if(o.rowNumber){const C=D("div","og-cell og-col-rownum");C.textContent=String(I+1),_>0&&(C.style.position="sticky",C.style.left=`${lt}px`,C.style.zIndex="2",C.style.background=Q),lt+=44,V.appendChild(C)}if(o.checkColumn){const C=D("div","og-cell og-col-check"),L=document.createElement("input");L.type="checkbox",L.checked=c.has(I),L.setAttribute("aria-label",`${I+1}행 선택`),L.addEventListener("click",N=>N.stopPropagation()),L.addEventListener("change",N=>{N.stopPropagation(),this._cbs.onRowCheck(I,L.checked)}),C.appendChild(L),_>0&&(C.style.position="sticky",C.style.left=`${lt}px`,C.style.zIndex="2",C.style.background=Q),lt+=36,V.appendChild(C)}if(w){const C=D("div","og-cell og-col-detail-toggle");C.style.cssText="display:flex;align-items:center;justify-content:center;flex-shrink:0;box-sizing:border-box;";const L=m.getRowId(st),N=!!L&&m.isExpanded(L),ht=m.getGlyph(N),W=D("span","og-detail-expander");W.textContent=ht.glyph,W.title=ht.title,W.setAttribute("role","button"),W.setAttribute("tabindex","0"),W.setAttribute("aria-label",ht.ariaLabel),L&&W.setAttribute("aria-controls",`og-detail-${L}`),W.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 Y=L,R=I,G=z=>{z.stopPropagation(),Y&&m.onToggle(R,Y)};W.addEventListener("click",G),W.addEventListener("keydown",z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),G(z))}),C.appendChild(W),_>0&&(C.style.position="sticky",C.style.left=`${lt}px`,C.style.zIndex="2",C.style.background=Q),C.style.width=`${x}px`,C.style.minWidth=`${x}px`,lt+=x,V.appendChild(C),L&&V.setAttribute("aria-expanded",N?"true":"false")}for(let C=0;C<i.length;C++){const L=i[C],N=n[C]??o.defaultColumnWidth,ht=o.editable&&L.editable!==!1,W=C===0,Y=g&&!g.isEmpty?g.getInfo(I,C):null;if(Y!=null&&Y.hidden){const F=D("div","og-cell og-cell--merge-ph");F.style.cssText=`width:${N}px;min-width:${N}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`,V.appendChild(F);continue}const R=D("div","og-cell");R.setAttribute("role","gridcell"),R.setAttribute("aria-colindex",String(C+1));const G=(Y==null?void 0:Y.rowSpan)??1,z=(Y==null?void 0:Y.colSpan)??1,It=G>1?G*o.rowHeight:o.rowHeight;let tt=N;if(z>1)for(let F=1;F<z;F++)tt+=n[C+F]??o.defaultColumnWidth;const at=C<_;let rt=0;if(at){o.stateColumn&&(rt+=24),o.draggable&&(rt+=18),o.rowNumber&&(rt+=44),o.checkColumn&&(rt+=36),w&&(rt+=x);for(let F=0;F<C;F++)rt+=n[F]??o.defaultColumnWidth;R.classList.add("og-frozen-cell"),C===_-1&&R.classList.add("og-frozen-last")}R.style.width=`${tt}px`,R.style.minWidth=`${tt}px`,R.style.maxWidth=`${tt}px`,G>1&&(R.style.height=`${It}px`),at&&(R.style.background=Q),j&&W&&(R.style.padding="0"),R.style.overflow="hidden",G>1?(R.style.height=`${It}px`,R.style.position="absolute",R.style.zIndex="3",R.style.background=Q&&Q!=="inherit"?Q:"var(--og-row-bg, #fff)",R.style.borderTop="0",R.style.borderLeft="0",R.style.borderBottom="1px solid var(--og-border-color, #e0e0e0)"):at&&(R.style.position="sticky",R.style.left=`${rt}px`,R.style.zIndex="1"),L.type==="number"||L.align==="right"?R.classList.add("og-cell--right"):L.align==="center"&&R.classList.add("og-cell--center"),ht&&R.classList.add("og-cell--editable"),L.wrap&&R.classList.add("og-cell--wrap"),ht||R.setAttribute("aria-readonly","true"),z>1&&R.setAttribute("aria-colspan",String(z)),G>1&&R.setAttribute("aria-rowspan",String(G)),((S=o._focusCell)==null?void 0:S.ri)===I&&((A=o._focusCell)==null?void 0:A.ci)===C&&(R.classList.add("og-cell-focused"),R.tabIndex=-1);const Bt=o._rangeRects;Bt!=null&&Bt.some(F=>I>=F.startRow&&I<=F.endRow&&C>=F.startCol&&C<=F.endCol)&&(R.classList.add("og-range-selected"),R.style.background="var(--og-range-bg, rgba(25,118,210,0.12))");const ut=st?st[L.field]:null;R.setAttribute("aria-label",`${L.header}: ${ut==null?"":String(ut)}`),L.tooltip!=null?R.title=typeof L.tooltip=="function"?String(L.tooltip(ut,st)??""):String(L.tooltip):o.tooltips&&ut!=null&&ut!==""&&(R.title=String(ut));const dt=((B=(P=this._cbs).getFormulaMeta)==null?void 0:B.call(P,I,L.field))??null;if(dt){const F=ut==null?"빈 값":String(ut);if(dt.error){const q=Ws[dt.error]??"수식 오류";R.setAttribute("aria-label",`수식 ${dt.src}, 오류: ${q}`),R.title=`${dt.error} — ${q}`,R.style.color="var(--og-formula-error-color, #c62828)"}else{const q=dt.approx?" (근사값)":"";R.setAttribute("aria-label",`수식 ${dt.src}, 값 ${F}${q}`),R.title=`${dt.src}${q}`}if(((K=o.formula)==null?void 0:K.cellMarker)!==!1){R.classList.add("og-formula-cell");const q=dt.error?"var(--og-formula-error-color, #c62828)":"var(--og-formula-marker-color, #1976d2)",gt=R.style.background||R.style.backgroundColor;R.style.backgroundImage=`linear-gradient(135deg, ${q} 0 6px, transparent 6px)`,R.style.backgroundRepeat="no-repeat",R.style.backgroundPosition="top right",R.style.backgroundSize="8px 8px",gt&&(R.style.backgroundColor=gt)}}let ge=R;if(j&&W){const F=D("div","og-tree-cell"),q=j._ancestorHasMore??[];for(let it=0;it<j._depth;it++){const ct=D("span","og-tree-guide");q[it]&&ct.classList.add("og-tree-guide--line"),F.appendChild(ct)}if(j._depth>0){const it=D("span","og-tree-connector");it.classList.add(j._isLastChild?"og-tree-connector--last":"og-tree-connector--mid"),F.appendChild(it)}const gt=D("span","og-tree-toggle-wrap");if(!j._hasChildren){const it=D("span","og-tree-leaf-dot");gt.appendChild(it)}F.appendChild(gt);const et=document.createElement("i");if(j._hasChildren){const it=Ce(L.treeNodeIcon,st,!0,j._expanded);et.className=j._expanded?`${it} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle`:`${it} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`,et.setAttribute("role","button"),et.setAttribute("tabindex","0"),et.setAttribute("aria-expanded",j._expanded?"true":"false"),et.setAttribute("aria-label",j._expanded?"접기":"펼치기"),et.addEventListener("click",ct=>{ct.stopPropagation(),p==null||p(j._treeId)}),et.addEventListener("keydown",ct=>{(ct.key==="Enter"||ct.key===" ")&&(ct.preventDefault(),ct.stopPropagation(),p==null||p(j._treeId))})}else{const it=Ce(L.treeNodeIcon,st,!1,!1);et.setAttribute("aria-hidden","true"),et.className=`${it} og-tree-node-icon og-tree-node-icon--leaf`}F.appendChild(et),R.appendChild(F),ge=F}if(L.cellStyle){const F=st[L.field],q=typeof L.cellStyle=="function"?L.cellStyle(F,st,I):L.cellStyle;Object.assign(R.style,q)}const hs=Vs(L).render({value:st[L.field],row:st,rowIndex:I,column:L,colIndex:C,isSelected:d.has(I),rowState:nt,displayValue:((Z=(U=this._cbs).getDisplayText)==null?void 0:Z.call(U,I,L.field))??null,hasCellFormula:dt!=null});ge.appendChild(hs);const ft=I,pt=C;if(R.addEventListener("click",F=>{F.stopPropagation(),this._cbs.onCellClick(ft,pt,F)}),R.addEventListener("dblclick",F=>{F.stopPropagation(),this._cbs.onCellDblClick(ft,pt,F)}),R.addEventListener("mouseover",F=>{F.stopPropagation(),this._cbs.onCellMouseOver(ft,pt,F)}),R.addEventListener("mouseout",F=>{F.stopPropagation(),this._cbs.onCellMouseOut(ft,pt,F)}),R.addEventListener("mousedown",F=>{F.stopPropagation(),this._cbs.onCellMouseDown(ft,pt,F)}),R.addEventListener("mouseup",F=>{F.stopPropagation(),this._cbs.onCellMouseUp(ft,pt,F)}),R.addEventListener("mousemove",F=>{F.stopPropagation(),this._cbs.onCellMouseMove(ft,pt,F)}),fe.set(C,R),G>1){const F=document.createElement("div");F.style.cssText=[`width:${N}px;min-width:${N}px;height:${o.rowHeight}px;`,"flex-shrink:0;box-sizing:border-box;","border-right:1px solid var(--og-border-color,#e0e0e0);"].join(""),V.appendChild(F);let q=0;o.stateColumn&&(q+=24),o.draggable&&(q+=18),o.rowNumber&&(q+=44),o.checkColumn&&(q+=36),w&&(q+=x);for(let et=0;et<C;et++)q+=n[et]??o.defaultColumnWidth;const gt=l+(I-t)*o.rowHeight;R.style.left=`${q}px`,R.style.top=`${gt}px`,k.appendChild(R)}else V.appendChild(R)}this._cellMap.set(I,fe),k.appendChild(V)}if(s.rowCount===0){const I=D("div","og-empty-message");I.textContent="데이터가 없습니다.",I.style.cssText="width:100%;",k.appendChild(I)}this._body.appendChild(k)}getCellEl(t,e){var s;return(s=this._cellMap.get(t))==null?void 0:s.get(e)}_appendDetailPanel(t,e,s,i,n,o){const l=D("div","og-detail-panel og-detail-panel-intro");l.dataset.ogRowId=e,l.id=`og-detail-${e}`,l.setAttribute("role","region"),l.setAttribute("aria-label",o.ariaLabel),l.style.cssText=["position:absolute;left:0;",`top:${s}px;width:${n}px;height:${i}px;`,"box-sizing:border-box;","overflow-y:auto;overflow-x:auto;","overscroll-behavior:contain;","background:var(--og-detail-bg,#fff);","border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);","z-index:var(--og-z-detail,2);"].join("");const a=o.getPanelHost(e);l.appendChild(a),t.appendChild(l)}destroy(){this._root.innerHTML=""}}function Ce(r,t,e,s){let i;return r?typeof r=="function"?i=r(t,e,s):e?i=s?r.branchOpen??"bi-folder2-open":r.branch??"bi-folder2":i=r.leaf??"bi-file-earmark":i=e?s?"bi-folder2-open":"bi-folder2":"bi-file-earmark",i.startsWith("bi ")?i:`bi ${i}`}function D(r,t){const e=document.createElement(r);return t&&(e.className=t),e}function Re(r,t){Object.assign(r.style,t)}function Me(r,t,e="text/plain;charset=utf-8"){const s=new Blob([r],{type:e}),i=URL.createObjectURL(s),n=document.createElement("a");n.href=i,n.download=t,n.click(),URL.revokeObjectURL(i)}function Us(r,t,e){let s=0,i=0;r.addEventListener("mousedown",n=>{n.stopPropagation(),n.preventDefault(),s=n.clientX,i=t.offsetWidth;const o=a=>{const d=Math.max(40,i+a.clientX-s);t.style.width=`${d}px`,t.style.minWidth=`${d}px`},l=a=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l),e(Math.max(40,i+a.clientX-s))};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)})}class js{constructor(t={}){this._expanded=new Set,this._maxDepth=t.maxDepth??2,this._expandMultiple=t.expandMultiple??!0,this._depth=t.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(t){return this._expanded.has(t)}canExpand(){return this._depth<this._maxDepth}expand(t){return this._expanded.has(t)?!0:this.canExpand()?(this._expandMultiple||this._expanded.clear(),this._expanded.add(t),!0):!1}collapse(t){return this._expanded.delete(t)}toggle(t){return this._expanded.has(t)?(this.collapse(t),"collapsed"):this.expand(t)?"expanded":"rejected"}collapseAll(){const t=Array.from(this._expanded);return this._expanded.clear(),t}buildEventPayload(t,e,s,i){return{rowIndex:e,rowId:t,row:s,host:i}}}function Gs(r){return!!r&&r._isGroup===!0}function qs(r){return!!r&&r._isTree===!0}function Ys(r){return!!r&&(r._isDetailHead===!0||r._isDetailFiller===!0)}function Xs(r){return!(r==null||Ys(r)||Gs(r))}function Zs(r){return qs(r)?r.data:r}function Js(r,t,e){if(e.getSlotCount){const n=Math.floor(e.getSlotCount(r,t));return Number.isFinite(n)&&n>0?n:1}const s=e.height??200,i=e.rowHeight>0?e.rowHeight:1;return Math.max(1,Math.ceil(s/i))}function Qs(r,t){const e=[];if(t.expandedRowIds.size===0){for(const s of r)e.push(s);return e}for(const s of r){if(e.push(s),!Xs(s))continue;const i=Zs(s),n=i!=null?t.getRowId(i):null;if(n==null||!t.expandedRowIds.has(n))continue;const o=Js(i,n,t),l={_isDetailHead:!0,_rowId:n,_masterFlatBase:s,_span:o};e.push(l);for(let a=1;a<o;a++)e.push({_isDetailFiller:!0,_rowId:n})}return e}class ti{constructor(t){this.adapter=t,this._entries=new Map}get size(){return this._entries.size}has(t){return this._entries.has(t)}getOrCreate(t,e){const s=this._entries.get(t);if(s)return s.attached=!0,s;const i=e(),n=this.adapter.create(t,i),o={host:i,instance:n,attached:!0};return this._entries.set(t,o),o}reattach(t){const e=this._entries.get(t);return!e||e.attached?!1:(this.adapter.reattach(e.instance,e.host),e.attached=!0,!0)}detach(t){const e=this._entries.get(t);return!e||!e.attached?!1:(this.adapter.detach(e.instance,e.host),e.attached=!1,!0)}detachAll(){for(const t of this._entries.keys())this.detach(t)}remove(t,e={}){const s=this._entries.get(t);if(s){if(e.cache){s.attached&&this.adapter.detach(s.instance,s.host),s.attached=!1;return}this.adapter.destroy(s.instance,s.host),this._entries.delete(t)}}getInstance(t){var e;return(e=this._entries.get(t))==null?void 0:e.instance}getHost(t){var e;return(e=this._entries.get(t))==null?void 0:e.host}isAttached(t){var e;return((e=this._entries.get(t))==null?void 0:e.attached)===!0}isEditing(t,e){if(!e)return!1;const s=this._entries.get(t);return!!s&&e(s.instance)}destroyAll(){for(const t of this._entries.values())this.adapter.destroy(t.instance,t.host);this._entries.clear()}}let Ee=!1;class ei{constructor(t){this._hosts=new Map,this._focusPendingRestore=null,this._d=t;const e=this._mdOpts();this._state=new js({maxDepth:e.maxDepth??2,expandMultiple:e.expandMultiple??!0,depth:t.getDepth()});const s={create:(n,o)=>this._buildInstance(n,o),detach:(n,o)=>{o.remove()},reattach:()=>{},destroy:(n,o)=>{var l;try{(l=n==null?void 0:n.destroy)==null||l.call(n)}catch{}o.remove()}};this._cache=new ti(s),t.getFlatModel().registerSplice(n=>this._splice(n)),e.heightMode==="auto"&&!Ee&&(Ee=!0,console.warn("[OpenGrid] masterDetail.heightMode:'auto' 는 Spike-B(가변높이 VirtualScroll) 통과 전까지 미공개 기능입니다. 'fixed' 로 동작합니다(11_design_F2_v2.md §2.2/C12.2)."))}_mdOpts(){var t;return((t=this._d.getOptions())==null?void 0:t.masterDetail)??{}}get enabled(){return this._mdOpts().enabled===!0}get isActive(){return this.enabled&&this._state.size>0}get maxDepth(){return this._state.maxDepth}_resolveRowId(t){if(typeof t=="number"){const e=this._d.getFlatModel().resolveFlatRow(t);return e.kind==="data"||e.kind==="tree"?e.rowId??null:null}return(t==null?void 0:t.id)??null}isExpandedId(t){return this._state.isExpanded(t)}isRowExpanded(t){const e=this._resolveRowId(t);return e!=null&&this._state.isExpanded(e)}expandRow(t){if(!this.enabled)return;const e=this._resolveRowId(t);if(e==null||this._state.isExpanded(e))return;if(!this._state.expand(e)){this._d.announce(`중첩 깊이 한계(${this._state.maxDepth})로 상세 패널을 열 수 없습니다.`);return}this._afterToggle(e,"expanded")}collapseRow(t){const e=this._resolveRowId(t);if(e==null||!this._state.isExpanded(e))return;const s=this._hosts.get(e);s&&document.activeElement&&s.contains(document.activeElement)&&(this._focusPendingRestore=e),this._state.collapse(e),this._releaseInstance(e),this._afterToggle(e,"collapsed")}toggleRow(t){const e=this._resolveRowId(t);e!=null&&(this._state.isExpanded(e)?this.collapseRow(t):this.expandRow(t))}collapseAllDetails(){const t=this._state.collapseAll();if(t.length!==0){for(const e of t)this._releaseInstance(e);this._rebuildAndRender();for(const e of t)this._d.emit("rowCollapse",{rowIndex:this._d.getFlatModel().flatIndexOfRowId(e),rowId:e,row:this._d.getRowById(e),host:null});this._d.announce("모든 상세 패널을 접었습니다.")}}getDetailInstance(t){const e=this._resolveRowId(t);if(e!=null)return this._cache.getInstance(e)}resyncPanelWidths(){this.isActive&&this._rebuildAndRender()}getPanelHost(t){let e=this._hosts.get(t);return e||(e=document.createElement("div"),e.className="og-detail-host",e.style.cssText="width:100%;height:100%;box-sizing:border-box;overflow:auto;",this._hosts.set(t,e)),this._cache.getOrCreate(t,()=>e),this._focusPendingRestore===t&&(this._focusPendingRestore=null),e}_buildInstance(t,e){const s=this._mdOpts(),i=this._d.getRowById(t),n=this._d.getDepth(),o={grid:this._d.getGridInstance(),rowId:t,depth:n,collapse:()=>this.collapseRow({id:t}),refresh:()=>{var l,a;try{(a=(l=this._cache.getInstance(t))==null?void 0:l.refresh)==null||a.call(l)}catch{}}};if(typeof s.renderer=="function"){const l=s.renderer(i,e,o);return l instanceof HTMLElement&&l!==e&&e.appendChild(l),{destroy:()=>{}}}if(s.subgridOptions){if(n+1>this._state.maxDepth)return this._d.announce(`중첩 깊이 한계(${this._state.maxDepth})로 서브 그리드를 생성하지 않습니다.`),{destroy:()=>{}};if(this._d.createSubgrid)return this._d.createSubgrid(e,s.subgridOptions,n+1)}return{destroy:()=>{}}}onBeforeTeardown(){for(const[t,e]of this._hosts)if(this._cache.isAttached(t)){if(this.isEditing(t)){document.body.appendChild(e);continue}this._cache.detach(t)}}isEditing(t){const e=this._cache.getInstance(t);return!!e&&typeof e.isEditing=="function"&&!!e.isEditing()}consumePendingFocusRestore(){const t=this._focusPendingRestore;return this._focusPendingRestore=null,t}_releaseInstance(t){const e=this._mdOpts();this._cache.remove(t,{cache:e.cache===!0}),e.cache!==!0&&this._hosts.delete(t)}_splice(t){var n;if(!this.isActive)return t;const e=this._mdOpts(),s=((n=this._d.getOptions())==null?void 0:n.rowHeight)??32,i={expandedRowIds:this._state.expandedRowIds,getRowId:o=>this._d.getRowId(o),rowHeight:s,height:e.height??200};if(typeof e.detailRowCount=="number"){const o=e.detailRowCount;i.getSlotCount=()=>o}return Qs(t,i)}_afterToggle(t,e){this._rebuildAndRender();const i=this._d.getFlatModel().flatIndexOfRowId(t),n=e==="expanded"?this._hosts.get(t)??null:null,o={rowIndex:i,rowId:t,row:this._d.getRowById(t),host:n};this._d.emit(e==="expanded"?"rowExpand":"rowCollapse",o),this._d.announce(e==="expanded"?"행 상세 패널을 펼쳤습니다.":"행 상세 패널을 접었습니다.")}_rebuildAndRender(){var e;const t=this._d.getFlatModel().count();(e=this._d.getVs())==null||e.setTotalRows(t),this._d.doRenderFull(t)}destroy(){this._cache.destroyAll(),this._hosts.clear()}}const si="⊕",ii="⊖",ni="상세 보기";function oi(r){return{glyph:r?ii:si,ariaLabel:r?"상세 패널 접기":"상세 패널 펼치기",title:ni}}class ri{constructor(t){this._selectedRows=new Set,this._checkedRows=new Set,this._data=t}get selectedRows(){return this._selectedRows}get checkedRows(){return this._checkedRows}selectSingle(t){this._selectedRows.clear(),this._selectedRows.add(t)}selectToggle(t){this._selectedRows.has(t)?this._selectedRows.delete(t):this._selectedRows.add(t)}clearSelection(){this._selectedRows.clear()}check(t,e){e?this._checkedRows.add(t):this._checkedRows.delete(t)}checkAll(t,e){if(t)for(let s=0;s<e;s++)this._checkedRows.add(s);else this._checkedRows.clear()}checkByValue(t,e){for(let s=0;s<this._data.rowCount;s++)e.includes(this._data.getCellValue(s,t))&&this._checkedRows.add(s)}uncheckAll(){this._checkedRows.clear()}checkById(t){}addCheckById(t){}uncheckById(t){}getSelections(){return[...this._selectedRows].map(t=>this._data.getRowByIndex(t)).filter(Boolean)}getChecked(){return[...this._checkedRows].map(t=>({row:this._data.getRowByIndex(t),rowIndex:t}))}getAllChecked(){return this.getChecked().map(t=>t.row)}getActiveRow(){return this._selectedRows.size>0?[...this._selectedRows][0]:-1}activate(t){this._selectedRows.clear(),this._selectedRows.add(t)}deselect(){this._selectedRows.clear()}reset(){this._selectedRows.clear(),this._checkedRows.clear()}}class jt{constructor(){this._onKeyDown=t=>{t.stopPropagation(),t.key==="Enter"?(t.preventDefault(),this._onCommit(this.input.value)):t.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(t,e,s,i){this._container=t,this._onCommit=s,this._onCancel=i,t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","true"),this.input=document.createElement("input"),this.input.type="date",this.input.className="og-cell-input",this.input.setAttribute("aria-label",e.column.header??"날짜 선택");const n=e.value;if(n){const o=n instanceof Date?n:new Date(n);isNaN(o.getTime())||(this.input.value=qe(o,"yyyy-MM-dd"))}this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),t.appendChild(this.input)}getValue(){var t;return(t=this.input)==null?void 0:t.value}focus(){var t;(t=this.input)==null||t.focus()}destroy(){var t,e,s;(t=this._container)==null||t.setAttribute("aria-expanded","false"),(e=this.input)==null||e.removeEventListener("keydown",this._onKeyDown),(s=this.input)==null||s.removeEventListener("blur",this._onBlur)}}function ke(r){return r.map(t=>typeof t=="string"?{label:t,value:t}:{label:t.label??t.text??String(t.value??""),value:t.value})}class Gt{constructor(t=[],e){this._options=ke(t),this._optionsFn=e??null}mount(t,e,s,i){this._container=t,this._onCommit=s,this._onCancel=i,t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-expanded","true"),this.select=document.createElement("select"),this.select.className="og-cell-select",this.select.setAttribute("aria-label",e.column.header??"선택");const n=this._optionsFn?ke(this._optionsFn(e.row,e.rowIndex)):this._options;for(const l of n){const a=document.createElement("option");a.value=String(l.value),a.textContent=l.label,this.select.appendChild(a)}const o=e.value==null?"":String(e.value);n.some(l=>String(l.value)===o)&&(this.select.value=o),this.select.addEventListener("change",()=>s(this.select.value)),this.select.addEventListener("blur",()=>s(this.select.value)),this.select.addEventListener("keydown",l=>{l.key==="Escape"&&i()}),t.appendChild(this.select)}getValue(){var t;return(t=this.select)==null?void 0:t.value}focus(){var t;(t=this.select)==null||t.focus()}destroy(){var t;(t=this._container)==null||t.setAttribute("aria-expanded","false")}}class qt{constructor(){this._onKeyDown=t=>{t.stopPropagation(),t.key==="Enter"||t.key==="Tab"?(t.preventDefault(),this._onCommit(this.input.value)):t.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._onCommit(this.input.value)}}mount(t,e,s,i){this._onCommit=s,this._onCancel=i,this.input=document.createElement("input"),this.input.type="text",this.input.value=e.value==null?"":String(e.value),this.input.style.cssText=`
|
|
33
|
+
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
34
|
+
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
35
|
+
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
36
|
+
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),t.appendChild(this.input)}getValue(){var t;return(t=this.input)==null?void 0:t.value}focus(){var t,e;(t=this.input)==null||t.focus(),(e=this.input)==null||e.select()}destroy(){var t,e;(t=this.input)==null||t.removeEventListener("keydown",this._onKeyDown),(e=this.input)==null||e.removeEventListener("blur",this._onBlur)}}class Yt{constructor(t){this._onKeyDown=e=>{e.stopPropagation(),e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),this._commit()):e.key==="Escape"&&this._onCancel()},this._onBlur=()=>{this._commit()},this.min=t==null?void 0:t.min,this.max=t==null?void 0:t.max,this.step=t==null?void 0:t.step}mount(t,e,s,i){this._onCommit=s,this._onCancel=i,this.input=document.createElement("input"),this.input.type="number",this.input.value=e.value==null?"":String(e.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=`
|
|
37
|
+
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
38
|
+
font-size:var(--og-font-size,13px);text-align:right;
|
|
39
|
+
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
40
|
+
`,this.input.addEventListener("keydown",this._onKeyDown),this.input.addEventListener("blur",this._onBlur),t.appendChild(this.input)}_commit(){const t=this.input.value===""?null:Number(this.input.value);this._onCommit(t)}getValue(){var t,e;return((t=this.input)==null?void 0:t.value)===""?null:Number((e=this.input)==null?void 0:e.value)}focus(){var t,e;(t=this.input)==null||t.focus(),(e=this.input)==null||e.select()}destroy(){var t,e;(t=this.input)==null||t.removeEventListener("keydown",this._onKeyDown),(e=this.input)==null||e.removeEventListener("blur",this._onBlur)}}class Xt{mount(t,e,s,i){this._onCommit=s,t.style.cssText+="display:flex;align-items:center;justify-content:center;",this.chk=document.createElement("input"),this.chk.type="checkbox",this.chk.checked=!!e.value,this.chk.style.cursor="pointer",this.chk.addEventListener("change",()=>s(this.chk.checked)),t.appendChild(this.chk)}getValue(){var t;return(t=this.chk)==null?void 0:t.checked}focus(){var t;(t=this.chk)==null||t.focus()}destroy(){}}function Fe(r){const t=r.editor;if(!t)switch(r.type){case"number":return new Yt;case"date":return new jt;case"boolean":return new Xt;case"select":return new Gt(r.options??[],r.optionsFn);default:return new qt}if(typeof t=="string")switch(t){case"number":return new Yt;case"date":return new jt;case"select":return new Gt(r.options??[],r.optionsFn);case"checkbox":return new Xt;default:return new qt}switch(t.type){case"number":{const e={};return t.min!=null&&(e.min=t.min),t.max!=null&&(e.max=t.max),t.step!=null&&(e.step=t.step),new Yt(e)}case"date":return new jt;case"select":return new Gt(t.options??[],r.optionsFn);case"checkbox":return new Xt;default:return new qt}}function kt(r){const t=typeof r.renderer=="string"?r.renderer:r.renderer&&typeof r.renderer=="object"?r.renderer.type:"";return r.type==="boolean"||r.type==="checkbox"||t==="checkbox"||t==="switch"}class li{constructor(t){this._activeEditor=null,this._editCell=null,this._focusCell=null,this._dragColIdx=null,this._d=t}get activeEditor(){return this._activeEditor}get editCell(){return this._editCell}get focusCell(){return this._focusCell}get dragColIdx(){return this._dragColIdx}set dragColIdx(t){this._dragColIdx=t}setFocusCell(t,e){this._focusCell={ri:t,ci:e},this._d.scrollToRow(t),this._d.doRender();const s=this._d.getVisibleLeaves()[e],i=this._d.data.getRowByIndex(t);if(s&&i){const n=i[s.field];this._d.announce(`${t+1}행 ${e+1}열, ${s.header}: ${n==null?"빈 값":String(n)}`)}}clearFocusCell(){this._focusCell=null}startEditByKey(t,e){var c,h,u,p,f,g,m;const s=this._d.getVisibleLeaves()[e];if(!s)return;if(kt(s)){const b=this._d.getOptions();if(s.editable!==!1&&(s.editable!==void 0||b.editable)){const w=this._d.data.getRowByIndex(t);w&&this._d.writeCell(t,s.field,!w[s.field])}return}const i=this._d.data.getRowByIndex(t);if(s.editable===!1||typeof s.editable=="function"&&!s.editable(i,t))return;this.commitEdit();const n=(c=this._d.getRenderer())==null?void 0:c.getCellEl(t,e);if(!n)return;n.innerHTML="";const o=Fe(s);this._activeEditor=o,this._editCell={ri:t,ci:e};const l={type:"editStart",rowIndex:t,columnIndex:e,field:s.field,oldValue:i==null?void 0:i[s.field],newValue:i==null?void 0:i[s.field],row:i,column:s};this._d.emit("editStart",l),(u=(h=this._d.getOptions()).onEditStart)==null||u.call(h,l),n.classList.add("og-editing");const d={value:((f=(p=this._d).hasCellFormula)!=null&&f.call(p,t,s.field)?(m=(g=this._d).getCellFormula)==null?void 0:m.call(g,t,s.field):null)??(i==null?void 0:i[s.field]),row:i,rowIndex:t,column:s,colIndex:e,isSelected:!0,rowState:"none"};o.mount(n,d,b=>this.commitEditWithValue(t,e,b),()=>this.cancelEdit()),requestAnimationFrame(()=>o.focus())}startEdit(t,e,s){var u,p,f,g,m,b;const i=this._d.getOptions();if(!i.editable)return;const n=this._d.getVisibleLeaves()[e];if(!n||kt(n))return;const o=this._d.data.getRowByIndex(t);if(n.editable===!1||typeof n.editable=="function"&&!n.editable(o,t)||!n.editable&&!i.editable)return;this.commitEdit();const l=(u=this._d.getRenderer())==null?void 0:u.getCellEl(t,e);if(!l)return;l.innerHTML="";const a=Fe(n);this._activeEditor=a,this._editCell={ri:t,ci:e};const d={type:"editStart",rowIndex:t,columnIndex:e,field:n.field,oldValue:o==null?void 0:o[n.field],newValue:o==null?void 0:o[n.field],row:o,column:n};this._d.emit("editStart",d),(p=i.onEditStart)==null||p.call(i,d),l.classList.add("og-editing");const h={value:((g=(f=this._d).hasCellFormula)!=null&&g.call(f,t,n.field)?(b=(m=this._d).getCellFormula)==null?void 0:b.call(m,t,n.field):null)??(o==null?void 0:o[n.field]),row:o,rowIndex:t,column:n,colIndex:e,isSelected:!0,rowState:"none"};a.mount(l,h,_=>this.commitEditWithValue(t,e,_),()=>this.cancelEdit()),requestAnimationFrame(()=>a.focus())}commitEdit(){if(!this._activeEditor||!this._editCell)return;const t=this._activeEditor.getValue(),{ri:e,ci:s}=this._editCell;this._finishEdit(e,s,t,!1)}commitEditWithValue(t,e,s){this._finishEdit(t,e,s,!1)}cancelEdit(){if(!this._editCell)return;const{ri:t,ci:e}=this._editCell;this._finishEdit(t,e,void 0,!0)}_finishEdit(t,e,s,i){var l,a,d,c,h,u,p,f,g,m,b;if(!this._activeEditor)return;const n=this._d.getVisibleLeaves()[e],o=(l=this._d.getRenderer())==null?void 0:l.getCellEl(t,e);if(o&&(this._activeEditor.destroy(),o.classList.remove("og-editing")),this._activeEditor=null,this._editCell=null,!i&&n){const _=this._d.data.getCellValue(t,n.field),w=((d=(a=this._d).hasCellFormula)==null?void 0:d.call(a,t,n.field))??!1;if(typeof s=="string"&&s.trimStart().startsWith("=")){(h=(c=this._d).setCellFormula)==null||h.call(c,t,n.field,s);const E=this._d.data.getRowByIndex(t),y=this._d.getOptions(),k={type:"editEnd",rowIndex:t,columnIndex:e,field:n.field,oldValue:_,newValue:s,row:E,column:n};this._d.emit("editEnd",k),(u=y.onEditEnd)==null||u.call(y,k),this._d.emit("dataChange",this._d.data.getData()),(p=y.onDataChange)==null||p.call(y,this._d.data.getData())}else if(s!==_||w){w&&((g=(f=this._d).clearCellFormula)==null||g.call(f,t,n.field)),this._d.data.updateCell(t,n.field,s);const E=this._d.data.getRowByIndex(t),y=this._d.getOptions(),k={type:"editEnd",rowIndex:t,columnIndex:e,field:n.field,oldValue:_,newValue:s,row:E,column:n};this._d.emit("editEnd",k),(m=y.onEditEnd)==null||m.call(y,k),this._d.emit("dataChange",this._d.data.getData()),(b=y.onDataChange)==null||b.call(y,this._d.data.getData())}}this._d.doRender(),requestAnimationFrame(()=>this._d.getContainer().focus({preventScroll:!0}))}}class ai{constructor(t,e,s,i,n){this._selects=new Map,this._selected={},this._config=e,this._onFilter=s,this._onReset=i,this._el=document.createElement("fieldset"),this._el.className="og-filter-select";const o=document.createElement("legend");o.className="og-filter-select-legend",o.textContent=e.legend??"필터",this._el.appendChild(o);const l=document.createElement("div");l.className="og-filter-select-row";for(const d of e.columns){const c=`og-fsel-${d.field}`,h=document.createElement("div");h.className="og-filter-select-group";const u=document.createElement("label");u.htmlFor=c,u.textContent=d.label,u.className="og-filter-select-label";const p=document.createElement("select");p.id=c,p.className="og-filter-select-sel",p.setAttribute("aria-label",d.label),n&&p.setAttribute("aria-controls",n),d.dependsOn?this._fill(p,[],!1):this._fill(p,this._resolve(d,""),!0),p.addEventListener("change",()=>this._onChange(d.field,p.value)),h.appendChild(u),h.appendChild(p),l.appendChild(h),this._selects.set(d.field,p)}const a=document.createElement("button");a.type="button",a.textContent="초기화",a.className="og-filter-select-reset",a.setAttribute("aria-label","필터 초기화"),a.addEventListener("click",()=>this._reset()),this._el.appendChild(l),this._el.appendChild(a),t.insertBefore(this._el,t.firstChild)}_resolve(t,e){if(t.options)return t.options;let s=t.data??[];t.dependsOn&&t.dependsOnKey&&e&&(s=s.filter(o=>String(o[t.dependsOnKey]??"")===e));const i=t.valueKey??"value",n=t.textKey??i;return s.map(o=>({value:String(o[i]??""),text:String(o[n]??o[i]??"")}))}_fill(t,e,s){t.innerHTML="";const i=document.createElement("option");i.value="",i.textContent="전체",t.appendChild(i);for(const n of e){const o=document.createElement("option");o.value=n.value,o.textContent=n.text,t.appendChild(o)}t.disabled=!s}_onChange(t,e){const s=this._config.columns.find(n=>n.field===t),i=s.filterKey??s.field;e?(this._selected[t]=e,this._onFilter(i,[{operator:"=",value:e}])):(delete this._selected[t],this._onReset(i)),this._cascade(t)}_cascade(t){const e=this._selected[t]??"";for(const s of this._config.columns){if(s.dependsOn!==t)continue;const i=this._selects.get(s.field);if(!i)continue;const n=s.filterKey??s.field;e?(this._fill(i,this._resolve(s,e),!0),i.value="",delete this._selected[s.field],this._onReset(n)):(this._fill(i,[],!1),delete this._selected[s.field],this._onReset(n),this._cascade(s.field))}}_reset(){this._selected={};for(const t of this._config.columns){const e=this._selects.get(t.field),s=t.filterKey??t.field;e&&(t.dependsOn?this._fill(e,[],!1):(e.value="",e.disabled=!1),this._onReset(s))}}reset(){this._reset()}destroy(){this._el.remove()}}class di{constructor(t,e,s){this._page=1,this._totalRows=0,this._pageSize=e,this._onChange=s,this._el=document.createElement("div"),this._el.className="og-pagination",this._el.style.cssText=`
|
|
41
|
+
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
42
|
+
padding:6px 8px;border-top:1px solid var(--og-border-color,#e0e0e0);
|
|
43
|
+
background:var(--og-header-bg,#f5f5f5);flex-shrink:0;user-select:none;
|
|
44
|
+
font-size:12px;color:var(--og-text-color,#333);
|
|
45
|
+
`,t.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(t){this._totalRows=t,this._page>this.totalPages&&(this._page=this.totalPages),this._render()}setPageSize(t){this._pageSize=t,this._page=1,this._render(),this._emit()}goTo(t){const e=Math.max(1,Math.min(t,this.totalPages));e!==this._page&&(this._page=e,this._render(),this._emit())}getRange(){const t=(this._page-1)*this._pageSize,e=Math.min(t+this._pageSize-1,this._totalRows-1);return{start:t,end:e}}_emit(){this._onChange({page:this._page,pageSize:this._pageSize,totalRows:this._totalRows,totalPages:this.totalPages})}_render(){this._el.innerHTML="";const t=this.totalPages,e=document.createElement("span");e.style.cssText="display:flex;align-items:center;gap:3px;margin-right:8px;";const s=document.createElement("span");s.textContent="행/페이지:",s.style.color="#888";const i=document.createElement("select");i.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),i.appendChild(h)}i.addEventListener("change",()=>this.setPageSize(Number(i.value))),e.appendChild(s),e.appendChild(i),this._el.appendChild(e);const n=document.createElement("span"),{start:o,end:l}=this.getRange();n.textContent=this._totalRows>0?`${o+1}–${l+1} / ${this._totalRows}건`:"0건",n.style.cssText="margin-right:8px;color:#888;",this._el.appendChild(n);const a=(c,h,u)=>{const p=document.createElement("button");return p.textContent=c,p.disabled=u,p.style.cssText=`
|
|
46
|
+
min-width:28px;height:24px;padding:0 6px;
|
|
47
|
+
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
48
|
+
background:${u?"#f5f5f5":"#fff"};
|
|
49
|
+
color:${u?"#bbb":"var(--og-text-color,#333)"};
|
|
50
|
+
cursor:${u?"default":"pointer"};font-size:12px;
|
|
51
|
+
`,u||p.addEventListener("click",()=>this.goTo(h)),p};this._el.appendChild(a("«",1,this._page===1)),this._el.appendChild(a("‹",this._page-1,this._page===1));const d=ci(this._page,t);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=a(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(a("›",this._page+1,this._page===t)),this._el.appendChild(a("»",t,this._page===t))}destroy(){this._el.remove()}}function ci(r,t){if(t<=7)return Array.from({length:t},(s,i)=>i+1);const e=[1];r>3&&e.push(-1);for(let s=Math.max(2,r-1);s<=Math.min(t-1,r+1);s++)e.push(s);return r<t-2&&e.push(-1),e.push(t),e}class hi{constructor(t,e,s,i){this._dx=e-t.left,this._dy=s-t.top;const n=document.createElement("div");n.className="og-drag-ghost",n.style.cssText=`position:fixed;left:0;top:0;width:${t.width}px;height:${Math.min(t.height,40)}px;transform:translate(${t.left}px,${t.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;`,i>1&&(n.textContent=`${i}개 행 이동`),document.body.appendChild(n),this._el=n}move(t,e){this._el.style.transform=`translate(${t-this._dx}px,${e-this._dy}px)`}destroy(){this._el.remove()}}class Se{constructor(t="#1976d2"){const e=document.createElement("div");e.className="og-drop-indicator",e.style.cssText="position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";const s=n=>{const o=document.createElement("div"),l=n==="left"?`border-left:7px solid ${t}`:`border-right:7px solid ${t}`;return o.style.cssText=`width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${l};`,o},i=document.createElement("div");i.style.cssText=`flex:1;height:3px;background:${t};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`,e.append(s("left"),i,s("right")),this._el=e}showIn(t,e){this._el.parentElement!==t&&(this._el.remove(),t.appendChild(this._el)),this._el.style.display="flex",this._el.style.top=`${e}px`}hide(){this._el.style.display="none"}destroy(){this._el.remove()}}const Ie=(r,t,e)=>Math.max(t,Math.min(e,r));class ui{constructor(t,e,s,i=null,n=()=>1){this._bodyEl=t,this._rowHeight=e,this._onDrop=s,this._cross=i,this._getDragCount=n,this._drag=null,this._selfIndicator=new Se("#1976d2"),this._crossIndicator=new Se("#2e7d32"),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this)}attachHandle(t,e,s){const i=document.createElement("div");return i.className="og-drag-handle",i.innerHTML="⠿",i.style.cssText=`
|
|
52
|
+
width:18px;min-width:18px;height:100%;
|
|
53
|
+
display:flex;align-items:center;justify-content:center;
|
|
54
|
+
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
55
|
+
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
56
|
+
`,i.addEventListener("mousedown",n=>{n.preventDefault(),n.stopPropagation(),this._startDrag(n,t,e,s)}),i}_startDrag(t,e,s,i){const n=e.getBoundingClientRect(),o=this._getDragCount(s);this._drag={fromIndex:s,bodyEl:this._bodyEl,rowHeight:this._rowHeight,totalRows:i,ghost:new hi(n,t.clientX,t.clientY,o),currentTarget:s,crossTarget:null},document.addEventListener("mousemove",this._onMouseMove,!0),document.addEventListener("mouseup",this._onMouseUp,!0)}_onMouseMove(t){if(!this._drag)return;const e=this._drag;if(e.ghost.move(t.clientX,t.clientY),this._cross){const n=this._cross.resolveTarget(t.clientX,t.clientY);if(n&&n.bodyEl!==e.bodyEl){const o=n.bodyEl.getBoundingClientRect(),l=t.clientY-o.top+n.bodyEl.scrollTop,a=Ie(Math.round(l/n.rowHeight),0,n.totalRows);e.crossTarget={bodyEl:n.bodyEl,index:a},this._selfIndicator.hide(),this._crossIndicator.showIn(n.bodyEl,a*n.rowHeight);return}}e.crossTarget=null,this._crossIndicator.hide();const s=e.bodyEl.getBoundingClientRect(),i=t.clientY-s.top+e.bodyEl.scrollTop;e.currentTarget=Ie(Math.round(i/e.rowHeight),0,e.totalRows-1),this._selfIndicator.showIn(e.bodyEl,e.currentTarget*e.rowHeight)}_onMouseUp(t){if(document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),!this._drag)return;const{fromIndex:e,currentTarget:s,ghost:i,crossTarget:n}=this._drag;this._drag=null,i.destroy(),this._selfIndicator.hide(),this._crossIndicator.hide(),n&&this._cross?this._cross.onCrossDrop(e,n.bodyEl,n.index):e!==s&&this._onDrop(e,s)}destroy(){var t;document.removeEventListener("mousemove",this._onMouseMove,!0),document.removeEventListener("mouseup",this._onMouseUp,!0),(t=this._drag)==null||t.ghost.destroy(),this._selfIndicator.destroy(),this._crossIndicator.destroy(),this._drag=null}}class _t{constructor(){this._map=new Map}static _key(t,e){return`${t}:${e}`}applyMergeCells(t){this._map.clear();for(const e of t){const s=Math.max(1,e.rowSpan??1),i=Math.max(1,e.colSpan??1);this._map.set(_t._key(e.row,e.col),{rowSpan:s,colSpan:i,hidden:!1});for(let n=0;n<s;n++)for(let o=0;o<i;o++)n===0&&o===0||this._map.set(_t._key(e.row+n,e.col+o),{rowSpan:1,colSpan:1,hidden:!0})}}applyAutoMerge(t,e,s){var i,n;this._map.clear();for(let o=0;o<e.length;o++){const l=e[o],a=s[o];let d=0;for(let c=1;c<=t.length;c++){const h=(i=t[c-1])==null?void 0:i[a],u=c<t.length?(n=t[c])==null?void 0:n[a]:void 0;if(c===t.length||u!==h){const p=c-d;if(p>1){this._map.set(_t._key(d,l),{rowSpan:p,colSpan:1,hidden:!1});for(let f=d+1;f<c;f++)this._map.set(_t._key(f,l),{rowSpan:1,colSpan:1,hidden:!0})}d=c}}}}getInfo(t,e){return this._map.get(_t._key(t,e))??null}clear(){this._map.clear()}get isEmpty(){return this._map.size===0}}const fi=[{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"}];class pi{constructor(t,e){this._anchor=t,this._actions=e,this._el=null,this._docClick=null,this._docKey=null,this._docScroll=null,this._docMouseMove=null,this._focusIdx=-1}open(t,e){this.close();const s=e??fi,i=document.createElement("div");i.className="og-context-menu",i.setAttribute("role","menu");for(const l of s){if(l.type==="divider"){const c=document.createElement("div");c.className="og-cm-divider",c.setAttribute("role","separator"),i.appendChild(c);continue}const a=document.createElement("button");if(a.className="og-cm-item",a.setAttribute("role","menuitem"),a.setAttribute("tabindex","-1"),l.disabled&&(a.classList.add("og-cm-disabled"),a.setAttribute("aria-disabled","true")),l.icon){const c=document.createElement("span");if(c.className="og-cm-icon",/^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(l.icon.trim())){const h=document.createElement("i");h.className=l.icon,c.appendChild(h)}else c.textContent=l.icon;c.setAttribute("aria-hidden","true"),a.appendChild(c)}const d=document.createElement("span");d.className="og-cm-label",d.textContent=l.label??"",a.appendChild(d),a.addEventListener("click",c=>{c.stopPropagation(),l.disabled||this._runAction(l),this.close()}),i.appendChild(a)}const n=this._anchor.closest("[data-og-theme]"),o=n==null?void 0:n.getAttribute("data-og-theme");o&&i.setAttribute("data-og-theme",o),document.body.appendChild(i),this._el=i,this._docMouseMove=l=>{if(!this._el)return;const a=this._el.getBoundingClientRect();(l.clientX<a.left-4||l.clientX>a.right+4||l.clientY<a.top-4||l.clientY>a.bottom+4)&&this.close()},this._position(i,t.clientX,t.clientY,()=>{this._el===i&&document.addEventListener("mousemove",this._docMouseMove,{capture:!0,passive:!0})}),this._docClick=l=>{i.contains(l.target)||this.close()},this._docKey=l=>{if(l.key==="Escape"){this.close();return}if(l.key==="ArrowDown"){l.preventDefault(),this._moveFocus(1);return}if(l.key==="ArrowUp"){l.preventDefault(),this._moveFocus(-1);return}if(l.key==="Enter"){const a=i.querySelector(".og-cm-item:focus");a==null||a.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 t;(t=this._el)==null||t.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(t,e,s,i){t.style.cssText="position:fixed;visibility:hidden;left:0;top:0;",requestAnimationFrame(()=>{const{width:n,height:o}=t.getBoundingClientRect(),l=window.innerWidth,a=window.innerHeight,d=e+n>l?Math.max(0,e-n):e,c=s+o>a?Math.max(0,s-o):s;t.style.cssText=`position:fixed;left:${d}px;top:${c}px;z-index:9999;`,i==null||i()})}_moveFocus(t){var s;if(!this._el)return;const e=Array.from(this._el.querySelectorAll(".og-cm-item:not(.og-cm-disabled)"));e.length&&(this._focusIdx=(this._focusIdx+t+e.length)%e.length,(s=e[this._focusIdx])==null||s.focus())}_runAction(t){if(typeof t.action=="function"){t.action();return}switch(t.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 Le{constructor(t,e){this._sheets=new Map,this._active="",this._onSwitch=e,this._tabBar=this._buildTabBar(t)}add(t,e=[],s=[]){if(this._sheets.has(t))throw new Error(`WorksheetManager: 시트 '${t}'이 이미 존재합니다`);this._sheets.set(t,{name:t,columns:e,data:s}),this._renderTabs(),this._sheets.size===1&&this.switch(t)}remove(t){if(!this._sheets.has(t))return;if(this._sheets.size===1)throw new Error("WorksheetManager: 마지막 시트는 삭제할 수 없습니다");const e=this._active===t;this._sheets.delete(t),this._renderTabs(),e&&this.switch(this._sheets.keys().next().value)}rename(t,e){if(!this._sheets.has(t))return;if(this._sheets.has(e))throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);this._sheets.get(t);const s=Array.from(this._sheets.entries()).map(([i,n])=>i===t?[e,{...n,name:e}]:[i,n]);this._sheets=new Map(s),this._active===t&&(this._active=e),this._renderTabs()}switch(t){const e=this._sheets.get(t);if(!e)throw new Error(`WorksheetManager: 시트 '${t}'을 찾을 수 없습니다`);this._active=t,this._renderTabs(),this._onSwitch(t,e)}get(t){return this._sheets.get(t)}getNames(){return Array.from(this._sheets.keys())}getActive(){return this._active}syncData(t,e){const s=this._sheets.get(t);s&&(s.data=e)}destroy(){this._tabBar.remove()}_buildTabBar(t){const e=document.createElement("div");return e.className="og-sheet-tabs",t.appendChild(e),e}_renderTabs(){this._tabBar.innerHTML="";for(const e of this._sheets.keys()){const s=document.createElement("button");s.className="og-sheet-tab",s.textContent=e,s.setAttribute("role","tab"),s.setAttribute("aria-selected",e===this._active?"true":"false"),e===this._active&&s.classList.add("og-sheet-tab--active"),s.addEventListener("click",()=>{e!==this._active&&this.switch(e)}),s.addEventListener("dblclick",()=>this._startRename(s,e)),this._tabBar.appendChild(s)}const t=document.createElement("button");t.className="og-sheet-add",t.textContent="+",t.setAttribute("aria-label","새 워크시트 추가"),t.addEventListener("click",()=>{const e=`Sheet${this._sheets.size+1}`;this.add(e,[],[]),this.switch(e)}),this._tabBar.appendChild(t)}_startRename(t,e){const s=document.createElement("input");s.className="og-sheet-tab-rename",s.value=e,t.replaceWith(s),s.focus(),s.select();const i=()=>{const n=s.value.trim()||e;try{n!==e?this.rename(e,n):this._renderTabs()}catch{this._renderTabs()}};s.addEventListener("blur",i),s.addEventListener("keydown",n=>{n.key==="Enter"&&s.blur(),n.key==="Escape"&&(s.value=e,s.blur())})}}class gi{constructor(t){this._d=t}_readCssVar(t){return getComputedStyle(this._d.getContainer()).getPropertyValue(t).trim()}_hexToXlsxRgb(t){const e=t.trim(),s=e.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);if(s)return[s[1],s[2],s[3]].map(n=>parseInt(n).toString(16).padStart(2,"0")).join("").toUpperCase();const i=e.replace("#","").toUpperCase();return i.length===3?i[0]+i[0]+i[1]+i[1]+i[2]+i[2]:i.length===6?i:""}exportExcel(t){const e=typeof t=="string"?{filename:t}:t??{};let s=e.filename??"export";s.toLowerCase().endsWith(".xlsx")||(s+=".xlsx");const i=e.sheetName??(this._d.getOptions().ariaLabel||"Sheet1"),n=this._d.getData(),o=this._d.getColLayout().visibleLeaves.filter(d=>{var c;return!((c=e.exceptFields)!=null&&c.includes(d.field))}),l=e.includeHeader!==!1,a=(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 P;const h=[];l&&h.push(o.map(B=>B.header));for(const B of n)h.push(o.map(K=>{const U=B[K.field];if(e.maskOnExport&&K.mask&&this._d.getMaskEnabled(K.field))return oe(U==null?"":String(U),K.mask);const Z=U;return Z==null||Z===""?"":a(Z,K,B)}));const u=d.aoa_to_sheet(h),p=this._d.getColWidths(),f=this._d.getColLayout();u["!cols"]=o.map(B=>({wpx:p[f.getColumnIndex(B.field)]??100})),u["!rows"]=h.map((B,K)=>({hpx:K===0&&l?22:19}));const g=e.styleMode??"theme";let m="1565C0",b="FFFFFF",_="FFFFFF",w="EEF2FF",x="212121",E="BDBDBD",y=10;if(g==="theme"){const B=U=>this._hexToXlsxRgb(U);m=B(this._readCssVar("--og-header-bg"))||m,b=B(this._readCssVar("--og-header-color"))||b,_=B(this._readCssVar("--og-row-bg"))||_,w=B(this._readCssVar("--og-row-alt-bg"))||w,x=B(this._readCssVar("--og-row-color"))||x,E=B(this._readCssVar("--og-border-color"))||E;const K=this._readCssVar("--og-font-size");K&&(y=Math.max(8,Math.round(parseFloat(K)*.75)))}const k=g==="none",S={hdrFont:k?{}:{bold:!0,color:{rgb:b},sz:y,name:"맑은 고딕"},dataFont:k?{}:{sz:y,color:{rgb:x},name:"맑은 고딕"},hdrFill:k?{}:{patternType:"solid",fgColor:{rgb:m}},evenFill:k?{}:{patternType:"solid",fgColor:{rgb:_}},oddFill:k?{}:{patternType:"solid",fgColor:{rgb:w}},hdrBorder:k?{}:{top:{style:"medium",color:{rgb:m}},bottom:{style:"medium",color:{rgb:m}},left:{style:"thin",color:{rgb:m}},right:{style:"thin",color:{rgb:m}}},dataBorder:k?{}:{top:{style:"thin",color:{rgb:E}},bottom:{style:"thin",color:{rgb:E}},left:{style:"thin",color:{rgb:E}},right:{style:"thin",color:{rgb:E}}}};h.forEach((B,K)=>{const U=l&&K===0,I=(l?K-1:K)%2===0;B.forEach((M,T)=>{const J=d.encode_cell({r:K,c:T});u[J]||(u[J]={t:"s",v:""});const j=o[T],st=j.type==="number"||j.align==="right",nt=U?"center":st?"right":j.align??"left";u[J].s={font:U?S.hdrFont:S.dataFont,fill:U?S.hdrFill:I?S.evenFill:S.oddFill,border:U?S.hdrBorder:S.dataBorder,alignment:{horizontal:nt,vertical:"center",wrapText:!1}}})});const A=d.book_new();d.book_append_sheet(A,u,i),c(A,s,{cellStyles:!0}),(P=e.onAfter)==null||P.call(e,new Blob([]))}).catch(()=>{console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.")})}exportCsv(t){const e=typeof t=="string"?{filename:t}:t??{},s=this._d.getData(),i=this._d.getColLayout().visibleLeaves,n=i.map(a=>`"${a.header}"`).join(","),o=s.map(a=>i.map(d=>{const c=a[d.field]??"";if(e.maskOnExport&&d.mask&&this._d.getMaskEnabled(d.field))return oe(String(c),d.mask);const h=c;return typeof h=="string"&&h.includes(",")?`"${h}"`:h}).join(",")),l=e.filename??"export.csv";Me("\uFEFF"+[n,...o].join(`
|
|
57
|
+
`),l)}exportJson(t){const e=typeof t=="string"?t:(t==null?void 0:t.filename)??"export.json";Me(JSON.stringify(this._d.getData(),null,2),e,"application/json")}print(t){const e=(t==null?void 0:t.title)??"OPEN_GRID",s=(t==null?void 0:t.footerText)??"",i=this._d.getData(),n=this._d.getColLayout().visibleLeaves.filter(h=>{var u;return!((u=t==null?void 0:t.excludeFields)!=null&&u.includes(h.field))}),o=n.map(h=>`<th>${h.header??h.field}</th>`).join(""),l=i.map(h=>`<tr>${n.map(u=>`<td>${String(h[u.field]??"")}</td>`).join("")}</tr>`).join(""),a=s?`<div class="og-print-footer">${s}</div>`:"",d=`<!DOCTYPE html>
|
|
58
|
+
<html lang="ko"><head>
|
|
59
|
+
<meta charset="UTF-8"><title>${e}</title>
|
|
60
|
+
<style>
|
|
61
|
+
@page{margin:0;}
|
|
62
|
+
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;margin:0;padding:1cm;}
|
|
63
|
+
h2{margin:0 0 10px;font-size:14px;color:#333;}
|
|
64
|
+
p{margin:0 0 8px;font-size:11px;color:#999;}
|
|
65
|
+
table{border-collapse:collapse;width:100%;}
|
|
66
|
+
th,td{border:1px solid #ccc;padding:5px 8px;text-align:left;white-space:nowrap;}
|
|
67
|
+
th{background:#f5f5f5;font-weight:600;color:#333;}
|
|
68
|
+
tr:nth-child(even) td{background:#fafafa;}
|
|
69
|
+
.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;}
|
|
70
|
+
</style>
|
|
71
|
+
</head><body>
|
|
72
|
+
<h2>${e}</h2>
|
|
73
|
+
<p>${i.length}행 × ${n.length}열 · ${new Date().toLocaleString("ko-KR")}</p>
|
|
74
|
+
<table>
|
|
75
|
+
<thead><tr>${o}</tr></thead>
|
|
76
|
+
<tbody>${l}</tbody>
|
|
77
|
+
</table>
|
|
78
|
+
${a}
|
|
79
|
+
<script>window.addEventListener('load',()=>{window.print();window.addEventListener('afterprint',()=>window.close());});<\/script>
|
|
80
|
+
</body></html>`,c=window.open("","_blank","width=960,height=640");c&&(c.document.write(d),c.document.close())}exportSheetsExcel(t){const e=this._d.getWsManager();if(!e){this.exportExcel(t??"workbook");return}const s=t??"workbook.xlsx",i=(this._d.getStrategy??((n,o)=>o))("cellSerializer",(n,o,l)=>typeof n=="boolean"?n?"✓":"":o.type==="number"&&typeof n=="number"?n:String(n));Promise.resolve().then(()=>require("./xlsx.min-Bx-LxWOf.cjs")).then(n=>n.xlsx_min).then(({utils:n,writeFile:o})=>{const l=n.book_new(),a=this._d.getOptions();for(const d of e.getNames()){const c=e.get(d),h=c.columns.length?c.columns:a.columns,u=[h.map(f=>f.header)];for(const f of c.data)u.push(h.map(g=>{const m=f[g.field];return m==null?"":i(m,g,f)}));const p=n.aoa_to_sheet(u);p["!cols"]=h.map(()=>({wpx:100})),n.book_append_sheet(l,p,d)}o(l,s.endsWith(".xlsx")?s:s+".xlsx",{cellStyles:!0})}).catch(()=>console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."))}}function X(r,t){return`${r}:${t}`}function mt(r){const t=r.indexOf(":");return t===-1?{rowId:r,field:""}:{rowId:r.slice(0,t),field:r.slice(t+1)}}const _i=new Set(["#ERR","#REF","#CYCLE","#DIV0","#NAME","#VALUE","#NUM"]);function Ot(r){return typeof r=="string"&&_i.has(r)?r:null}class mi{constructor(t){this._d=t}fmtNum(t,e){if(!e)return Math.round(t).toLocaleString("ko-KR");const s=e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),i=s?e.slice(0,s.index):"",n=s?e.slice(s.index+s[0].length):"",o=s?s[0]:e,l=o.includes("#")||o.includes(","),a=o.match(/\.(\d+)$/),d=a?parseInt(a[1],10):/^\d+$/.test(o)?parseInt(o,10):0,c=Math.abs(t).toFixed(d),[h="0",u]=c.split("."),p=l?h.replace(/\B(?=(\d{3})+(?!\d))/g,","):h,f=u!==void 0?`${p}.${u}`:p,g=`${i}${f}${n}`;return t<0?`-${g}`:g}computeValues(){const t=this._d.getOptions().footer;if(!t||t.length===0)return[];const e=this._d.getData();return t.filter(s=>s.field&&s.op).map(s=>{const i=s.field,n=s.op,o=e.map(u=>u[i]).filter(u=>u!=null&&u!==""&&!Ot(u));let l=null;const a=n.toUpperCase(),d=(this._d.getStrategy??((u,p)=>p))("summaryOp",null);if(d){const u=d(a,o,i);if(u!=null)return{_field:i,_value:u,_formatted:this.fmtNum(u,s.format)}}if(a==="SUM")l=o.length>0?v.sum(o.map(u=>String(u))):null;else if(a==="AVG")l=o.length>0?v.sum(o.map(u=>String(u))).div(v.from(String(o.length))):null;else if(a==="COUNT"){const u=o.length;return{_field:i,_value:u,_formatted:u.toLocaleString("ko-KR")}}else a==="MAX"?l=o.length>0?v.max(o.map(u=>String(u))):null:a==="MIN"&&(l=o.length>0?v.min(o.map(u=>String(u))):null);if(!l)return{_field:i,_value:null,_formatted:""};const c=l.toNumber(),h=this.fmtNum(c,s.format);return{_field:i,_value:c,_formatted:h}})}render(){var h;const t=this._d.getContainer(),e=t.querySelector(".og-footer-bar");e==null||e.remove();const s=this._d.getOptions(),i=s.footer;if(!i||i.length===0)return;const n=this._d.getColLayout().visibleLeaves,o=this._d.getColWidths()??n.map(u=>u.width??100),l=new Map(this.computeValues().map(u=>[u._field,u])),a=document.createElement("div");a.className="og-footer-bar",a.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);`,a.appendChild(u)}let c=0;for(const u of i){const p=Math.max(1,u.colspan??1);let f=0;for(let w=0;w<p;w++)f+=o[c+w]??100;const g=n[c];c+=p;const m=document.createElement("div");m.style.cssText=[`width:${f}px;min-width:${f}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 b=u.field,_=b?l.get(b):null;if(_){const w=_._formatted??String(_._value??""),x=u.label?`${u.label}: `:"";m.textContent=x+w,m.title=`${((h=u.op)==null?void 0:h.toUpperCase())??""} = ${w}`,m.style.color="var(--og-primary,#1976d2)",m.style.textAlign=u.align??((g==null?void 0:g.type)==="number","right")}else u.label&&(m.textContent=u.label,m.style.textAlign=u.align??"left",m.style.color="var(--og-row-color,#212121)");a.appendChild(m)}s.footerPosition==="top"?t.insertBefore(a,t.firstChild):t.appendChild(a)}}class wi{constructor(t){this._d=t}handleKeyDown(t){var d,c,h,u,p;const e=this._d.getEditMgr();if(e.activeEditor)return;this._d.handleCellKeyEvt("cellKeyDown",t);const s=this._d.getData(),i=this._d.getColLayout(),n=s.rowCount,o=i.visibleLeaves.length;if(n===0||o===0)return;if((t.ctrlKey||t.metaKey)&&t.key==="c"){t.preventDefault(),this._copyToClipboard();return}if((t.ctrlKey||t.metaKey)&&t.key==="v"){t.preventDefault(),this._pasteFromClipboard();return}const l=((c=(d=this._d).getRangeHooks)==null?void 0:c.call(d))??null;if((t.ctrlKey||t.metaKey)&&(l!=null&&l.isEnabled())&&(t.key==="d"||t.key==="D")){t.preventDefault(),l.ctrlFill("down");return}if((t.ctrlKey||t.metaKey)&&(l!=null&&l.isEnabled())&&(t.key==="r"||t.key==="R")){t.preventDefault(),l.ctrlFill("right");return}if(t.shiftKey&&(l!=null&&l.isEnabled())&&(t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="ArrowLeft"||t.key==="ArrowRight")){t.preventDefault();const f=t.key==="ArrowDown"?"down":t.key==="ArrowUp"?"up":t.key==="ArrowLeft"?"left":"right";l.extendFocus(f);return}const a=this._d.getOptions();if((t.ctrlKey||t.metaKey)&&a.draggable&&e.focusCell){if(t.key==="ArrowDown"){t.preventDefault();const f=e.focusCell.ci!==void 0?e.focusCell.ri:0;f<n-1&&(this._d.handleRowDrop(f,f+1),this._d.setFocusCell(f+1,e.focusCell.ci),this._d.announce(`행 ${f+1}을(를) ${f+2}번째 위치로 이동`));return}if(t.key==="ArrowUp"){t.preventDefault();const f=e.focusCell.ri;f>0&&(this._d.handleRowDrop(f,f-1),this._d.setFocusCell(f-1,e.focusCell.ci),this._d.announce(`행 ${f+1}을(를) ${f}번째 위치로 이동`));return}}switch(t.key){case"ArrowDown":{t.preventDefault();const f=e.focusCell,g=f?Math.min(f.ri+1,n-1):0;this._d.setFocusCell(g,(f==null?void 0:f.ci)??0);break}case"ArrowUp":{t.preventDefault();const f=e.focusCell,g=f?Math.max(f.ri-1,0):0;this._d.setFocusCell(g,(f==null?void 0:f.ci)??0);break}case"ArrowRight":{t.preventDefault();const f=e.focusCell;if(!f){this._d.setFocusCell(0,0);break}f.ci<o-1?this._d.setFocusCell(f.ri,f.ci+1):f.ri<n-1&&this._d.setFocusCell(f.ri+1,0);break}case"ArrowLeft":{t.preventDefault();const f=e.focusCell;if(!f){this._d.setFocusCell(0,0);break}f.ci>0?this._d.setFocusCell(f.ri,f.ci-1):f.ri>0&&this._d.setFocusCell(f.ri-1,o-1);break}case"Tab":{t.preventDefault();const f=e.focusCell;if(!f){this._d.setFocusCell(0,0);break}t.shiftKey?f.ci>0?this._d.setFocusCell(f.ri,f.ci-1):f.ri>0&&this._d.setFocusCell(f.ri-1,o-1):f.ci<o-1?this._d.setFocusCell(f.ri,f.ci+1):f.ri<n-1&&this._d.setFocusCell(f.ri+1,0);break}case"Home":{if(t.preventDefault(),t.ctrlKey||t.metaKey)this._d.setFocusCell(0,0);else{const f=e.focusCell;this._d.setFocusCell((f==null?void 0:f.ri)??0,0)}break}case"End":{if(t.preventDefault(),t.ctrlKey||t.metaKey)this._d.setFocusCell(n-1,o-1);else{const f=e.focusCell;this._d.setFocusCell((f==null?void 0:f.ri)??0,o-1)}break}case"PageDown":{t.preventDefault();const f=e.focusCell,g=this._d.getOptions().pageSize??10,m=Math.min(f?f.ri+g:g-1,n-1);this._d.setFocusCell(m,(f==null?void 0:f.ci)??0);break}case"PageUp":{t.preventDefault();const f=e.focusCell,g=this._d.getOptions().pageSize??10,m=f?Math.max(f.ri-g,0):0;this._d.setFocusCell(m,(f==null?void 0:f.ci)??0);break}case" ":{if(e.focusCell){t.preventDefault();const f=e.focusCell.ri,g=this._d.getRowMgr();this._d.getOptions().checkColumn?(g.check(f,!g.checkedRows.has(f)),this._d.doRender()):(g.selectToggle(f),this._d.doRender())}break}case"F2":case"Enter":{e.focusCell&&this._d.getOptions().editable&&(t.preventDefault(),e.startEditByKey(e.focusCell.ri,e.focusCell.ci));break}case"Escape":{(p=(u=(h=this._d).getRangeHooks)==null?void 0:u.call(h))==null||p.clear(),e.clearFocusCell(),this._d.doRender();break}}}_copyToClipboard(){var l,a,d,c;if(!this._d.getOptions().clipboard)return;const e=(a=(l=this._d).getRangeHooks)==null?void 0:a.call(l);if(e!=null&&e.isEnabled()&&e.hasSelection()){const h=e.copyText();if(h!=null){(d=navigator.clipboard)==null||d.writeText(h).catch(()=>{});return}}const s=this._d.getEditMgr(),i=this._d.getColLayout(),n=this._d.getData();let o="";if(s.focusCell){const{ri:h,ci:u}=s.focusCell,p=i.visibleLeaves[u];p&&(o=String(n.getCellValue(h,p.field)??""))}else if(this._d.getRowMgr().selectedRows.size>0){const h=i.visibleLeaves;o=[...this._d.getRowMgr().selectedRows].sort((p,f)=>p-f).map(p=>{const f=n.getRowByIndex(p);return h.map(g=>String((f==null?void 0:f[g.field])??"")).join(" ")}).join(`
|
|
81
|
+
`)}o&&((c=navigator.clipboard)==null||c.writeText(o).catch(()=>{}))}_pasteFromClipboard(){var i,n,o;const t=this._d.getOptions();if(!t.clipboard||!t.editable)return;const e=this._d.getEditMgr(),s=(n=(i=this._d).getRangeHooks)==null?void 0:n.call(i);(o=navigator.clipboard)==null||o.readText().then(l=>{var f,g;if(!l||s!=null&&s.isEnabled()&&s.hasSelection()&&s.pasteText(l)||!e.focusCell)return;const{ri:a,ci:d}=e.focusCell,c=l.split(`
|
|
82
|
+
`),h=this._d.getColLayout().visibleLeaves,u=this._d.getData(),p=[];for(let m=0;m<c.length;m++){const b=c[m].split(" ");for(let _=0;_<b.length;_++){const w=a+m,x=d+_,E=h[x];E&&w<u.rowCount&&p.push({rowIndex:w,field:E.field,value:b[_]})}}p.length&&((g=(f=this._d).writeCells)==null||g.call(f,p))}).catch(()=>{})}}class yi{constructor(t){this._bar=null,this._input=null,this._count=null,this._filter="",this._d=t}get findFilter(){return this._filter}init(t){const e=document.createElement("div");e.className="og-find-bar",e.hidden=!0;const s=document.createElement("span");s.className="og-find-label",s.textContent="찾기";const i=document.createElement("input");i.type="text",i.className="og-find-input",i.placeholder="검색어 입력...",i.setAttribute("aria-label","그리드 내 검색");const n=document.createElement("span");n.className="og-find-count";const o=document.createElement("button");o.className="og-find-close",o.textContent="✕",o.setAttribute("aria-label","찾기 닫기"),e.appendChild(s),e.appendChild(i),e.appendChild(n),e.appendChild(o),t.insertBefore(e,t.firstChild),i.addEventListener("input",()=>{this._filter=i.value.trim(),this._apply()}),i.addEventListener("keydown",l=>{l.key==="Escape"&&this.close()}),o.addEventListener("click",()=>this.close()),this._bar=e,this._input=i,this._count=n}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 i,n;const t=this._d.getData(),e=this._d.getColLayout().visibleLeaves.map(o=>o.field);t.setFindFilter(this._filter,e),t.applyFilter(this._d.getFilters());const s=t.rowCount;(i=this._d.getVs())==null||i.setTotalRows(s),(n=this._d.getPagination())==null||n.setTotalRows(s),this._count&&(this._count.textContent=this._filter?`${s}건`:""),this._d.doRender()}}function At(r){return r&&r._isGroup===!0}function Te(r,t,e=[],s=new Set,i,n){return t.length?Ye(r,t,0,e,s,"",i,n):[]}function Ye(r,t,e,s,i,n,o,l){const a=t[e],d=new Map;for(const h of r){const u=l?l(h,t.slice(e)):h[a];d.has(u)||d.set(u,[]),d.get(u).push(h)}const c=[];for(const[h,u]of d){const p=`${n}__${a}:${h}`,f=i.has(p);let g;e<t.length-1?g=Ye(u,t,e+1,s,i,p,o,l):g=u;const{summary:m,summaryFmt:b}=bi(u,s),_=vi(u,o);c.push({_isGroup:!0,_groupField:a,_groupValue:h,_groupLabel:h==null?"(없음)":String(h),_depth:e,_expanded:f,_childCount:u.length,_summary:m,_summaryFmt:b,_states:_,children:g})}return c}function bi(r,t){const e={},s={};for(const i of t){const n=r.map(d=>d[i.field]).filter(d=>d!=null&&d!=="");let o=null;const l=i.op.toUpperCase();if(l==="SUM")o=n.length>0?v.sum(n.map(String)):null;else if(l==="AVG")o=n.length>0?v.sum(n.map(String)).div(v.from(String(n.length))):null;else if(l==="COUNT"){e[i.field]=r.length,s[i.field]=r.length.toLocaleString("ko-KR");continue}else l==="MAX"?o=n.length>0?v.max(n.map(String)):null:l==="MIN"&&(o=n.length>0?v.min(n.map(String)):null);if(!o){e[i.field]=null,s[i.field]="";continue}const a=o.toNumber();e[i.field]=a,s[i.field]=xi(a,i.format)}return{summary:e,summaryFmt:s}}function vi(r,t){if(!t)return{added:0,edited:0,removed:0};let e=0,s=0,i=0;for(const n of r){const o=t(n);o==="added"?e++:o==="edited"?s++:o==="removed"&&i++}return{added:e,edited:s,removed:i}}function xi(r,t){if(t==null)return r%1===0?r.toLocaleString("ko-KR"):parseFloat(r.toFixed(6)).toLocaleString("ko-KR",{minimumFractionDigits:2,maximumFractionDigits:6});const e=t.includes("#")||t.includes(","),s=t.match(/\.(\d+)$/),i=s?parseInt(s[1],10):/^\d+$/.test(t)?parseInt(t,10):0,n=Math.abs(r).toFixed(i),[o="0",l]=n.split("."),a=e?o.replace(/\B(?=(\d{3})+(?!\d))/g,","):o,d=l!==void 0?`${a}.${l}`:a;return r<0?`-${d}`:d}function Xe(r){const t=[];for(const e of r)if(t.push(e),e._expanded)for(const s of e.children)At(s)?t.push(...Xe([s])):t.push(s);return t}function Ze(r,t=""){const e=[];for(const s of r){const i=`${t}__${s._groupField}:${s._groupValue}`;e.push(i);const n=s.children.filter(o=>At(o));n.length&&e.push(...Ze(n,i))}return e}function De(r){return r!=null&&r._isTree===!0}function re(r,t,e=new Set){const{idField:s,parentIdField:i,expandOnLoad:n=!1}=t,o=new Map,l=[];for(const c of r){const h=c[s],u={_isTree:!0,_treeId:h,_treeParentId:c[i],_depth:0,_expanded:n||e.has(h),_hasChildren:!1,_childCount:0,_isLastChild:!1,_ancestorHasMore:[],data:c,children:[]};o.set(h,u)}for(const c of o.values()){const h=c._treeParentId;if(h==null||h===""||!o.has(h))l.push(c);else{const p=o.get(h);p.children.push(c),p._hasChildren=!0}}function a(c,h){for(const u of c)u._depth=h,u._childCount=Je(u),a(u.children,h+1)}a(l,0);function d(c,h){for(let u=0;u<c.length;u++){const p=c[u],f=u===c.length-1;p._isLastChild=f,p._ancestorHasMore=h,p.children.length>0&&d(p.children,[...h,!f])}}return d(l,[]),l}function Je(r){let t=r.children.length;for(const e of r.children)t+=Je(e);return t}function Qe(r){const t=[];for(const e of r)t.push(e),e._expanded&&e.children.length>0&&t.push(...Qe(e.children));return t}function Ci(r,t){r.has(t)?r.delete(t):r.add(t)}function le(r){const t=[];for(const e of r)t.push(e._treeId),e.children.length&&t.push(...le(e.children));return t}class Ri{constructor(t){this._groupFields=[],this._groupExpandedKeys=new Set,this._groupFlatRows=[],this._isGroupMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys=new Set,this._isTreeMode=!1,this._d=t}get isGroupMode(){return this._isGroupMode}get isTreeMode(){return this._isTreeMode}get groupFlatRows(){return this._groupFlatRows}get treeFlatRows(){return this._treeFlatRows}groupBy(t){this._groupFields=t,this._groupExpandedKeys.clear(),this._isGroupMode=t.length>0,this.rebuildGroups()}clearGroup(){var t;this._groupFields=[],this._groupExpandedKeys.clear(),this._isGroupMode=!1,this._groupFlatRows=[],this._d.setFlatBacking(null),(t=this._d.getVs())==null||t.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandAll(){if(!this._isGroupMode)return;const t=Te(this._d.getData(),this._groupFields,this._getSummaryDefs(),void 0,void 0,this._groupKeyFn());Ze(t).forEach(e=>this._groupExpandedKeys.add(e)),this.rebuildGroups()}_groupKeyFn(){return this._d.getStrategy?this._d.getStrategy("groupKeyFn",void 0):void 0}collapseAll(){this._groupExpandedKeys.clear(),this._isGroupMode&&this.rebuildGroups()}handleGroupToggle(t){this._groupExpandedKeys.has(t)?this._groupExpandedKeys.delete(t):this._groupExpandedKeys.add(t),this.rebuildGroups()}rebuildGroups(){var o;const t=this._d.getData(),e=this._d.getDataLayer(),s=l=>{const a=t.indexOf(l);return a>=0?e.getRowState(a):"none"},i=Te(t,this._groupFields,this._getSummaryDefs(),this._groupExpandedKeys,s,this._groupKeyFn());this._groupFlatRows=Xe(i),this._d.setFlatBacking(()=>this._groupFlatRows);const n=this._d.getFlatCount();(o=this._d.getVs())==null||o.setTotalRows(n),this._d.doRenderFull(n)}enableTree(){this._isTreeMode=!0,this._isGroupMode=!1;const t=this._d.getOptions();if(t.expandOnLoad){const e=re(this._d.getData(),{idField:t.treeId,parentIdField:t.treeParentId});le(e).forEach(s=>this._treeExpandedKeys.add(s))}this.rebuildTree()}disableTree(){var t;this._isTreeMode=!1,this._treeRoots=[],this._treeFlatRows=[],this._treeExpandedKeys.clear(),this._d.setFlatBacking(null),(t=this._d.getVs())==null||t.setTotalRows(this._d.getFlatCount()),this._d.doRender()}expandNodes(t,e=!0){const s=Array.isArray(t)?t:[t];for(const i of s)e?this._treeExpandedKeys.add(i):this._treeExpandedKeys.delete(i);this._isTreeMode&&this.rebuildTree()}expandAllNodes(){this._isTreeMode&&(le(this._treeRoots).forEach(t=>this._treeExpandedKeys.add(t)),this.rebuildTree())}collapseAllNodes(){this._isTreeMode&&(this._treeExpandedKeys.clear(),this.rebuildTree())}handleTreeToggle(t){Ci(this._treeExpandedKeys,t),this.rebuildTree()}rebuildTree(){var s;const t=this._d.getOptions();this._treeRoots=re(this._d.getData(),{idField:t.treeId,parentIdField:t.treeParentId,expandOnLoad:t.expandOnLoad},this._treeExpandedKeys),this._treeFlatRows=Qe(this._treeRoots),this._d.setFlatBacking(()=>this._treeFlatRows);const e=this._d.getFlatCount();(s=this._d.getVs())==null||s.setTotalRows(e),this._d.doRenderFull(e)}_getSummaryDefs(){const t=this._d.getOptions().summary;if(!t)return[];if(t.rows&&t.rows.length>0)return t.fields.flatMap(s=>t.rows.map(i=>({field:s,op:i.op,format:i.format})));const e=Array.isArray(t.ops)?t.ops:t.ops?[t.ops]:["SUM"];return t.fields.map(s=>({field:s,op:e[0]??"SUM",format:t.format}))}}class Mi{constructor(t){this._backing=null,this._splices=[],this._revIndex=null,this._revIndexSrc=null,this._d=t}setBacking(t){this._backing=t,this._invalidate()}registerSplice(t){this._splices.push(t),this._invalidate()}count(){return this._flat().length}getFlatArray(){return this._flat()}resolveFlatRow(t){const e=this._flat()[t];if(e==null)return{kind:"data"};if(e._isDetailFiller===!0)return{kind:"detailFiller",rowId:e._rowId};if(e._isDetailHead===!0)return{kind:"detailHead",rowId:e._rowId};if(At(e))return{kind:"group"};if(De(e)){const o=e.data;return{kind:"tree",rowId:o==null?void 0:o[this._d.rowIdField]}}const s=e[this._d.rowIdField],i=this._d.getDataLayer().getDataIndexByRowId(s),n={kind:"data",rowId:s};return i!==void 0&&(n.dataIndex=i),this._backing||(n.displayIndex=t),n}flatIndexOfRowId(t){return this._ensureRevIndex(),this._revIndex.get(t)??-1}rowIdOfFlat(t){const e=this.resolveFlatRow(t);return e.kind==="data"||e.kind==="tree"?e.rowId??null:null}_flat(){let t=this._backing?this._backing():this._d.getDataLayer().getData();for(const e of this._splices)t=e(t);return t}_invalidate(){this._revIndex=null,this._revIndexSrc=null}_ensureRevIndex(){const t=this._flat();if(this._revIndex&&this._revIndexSrc===t)return;const e=new Map;for(let s=0;s<t.length;s++){const i=t[s];if(i==null||At(i)||i._isDetailHead===!0||i._isDetailFiller===!0)continue;const n=De(i)?i.data:i,o=n==null?void 0:n[this._d.rowIdField];o!=null&&e.set(o,s)}this._revIndex=e,this._revIndexSrc=t}}class Ei{constructor(t){this._sortList=[],this._filters={},this._d=t}get sortList(){return this._sortList}get filters(){return this._filters}handleSortClick(t,e){var l,a,d;const s=this._d.getOptions();if(!s.sortable)return;const i=this._sortList.findIndex(c=>c.field===t);if(i>=0){const c=this._sortList[i];c.dir==="asc"?c.dir="desc":this._sortList.splice(i,1)}else(!e||!s.multiSort)&&(this._sortList=[]),this._sortList.push({field:t,dir:"asc"});this._d.getData().applySort(this._sortList),(a=(l=this._d).onReproject)==null||a.call(l),this._d.renderHeader(),this._d.doRender();const n=this._sortList.find(c=>c.field===t),o=n?n.dir==="asc"?"오름차순":"내림차순":"정렬 해제";this._d.announce(`${t} ${o} 정렬`),this._d.emit("sortChange",{sortList:this._sortList}),(d=s.onSortChange)==null||d.call(s,{field:t,dir:(n==null?void 0:n.dir)??"asc",sortList:this._sortList})}sort(t,e="asc"){var s,i;if(Array.isArray(t))this._sortList=t;else{const n=this._sortList.findIndex(o=>o.field===t);n>=0?this._sortList[n].dir=e:this._sortList=[{field:t,dir:e}],this._d.getOptions().multiSort||(this._sortList=this._sortList.slice(-1))}this._d.getData().applySort(this._sortList),(i=(s=this._d).onReproject)==null||i.call(s),this._d.renderHeader(),this._d.doRender(),this._d.emit("sortChange",{sortList:this._sortList})}resetSort(){var t,e;this._sortList=[],this._d.getData().applySort([]),(e=(t=this._d).onReproject)==null||e.call(t),this._d.renderHeader(),this._d.doRender()}initSort(t){var e,s;this._sortList=[...t],this._d.getData().applySort(this._sortList),(s=(e=this._d).onReproject)==null||s.call(e)}getSortState(){return[...this._sortList]}setFilter(t,e){var s,i;this._filters[t]=e,this.applyFilters(),this._d.renderHeader(),this._d.doRender(),this._d.emit("filterChange",{field:t,filterItems:e,allFilters:this._filters}),(i=(s=this._d.getOptions()).onFilterChange)==null||i.call(s,{field:t,filterItems:e,allFilters:this._filters})}resetFilter(t){t?delete this._filters[t]:this._filters={},this.applyFilters(),this._d.renderHeader(),this._d.doRender()}getFilterState(){return{...this._filters}}restoreFilter(t){this._filters={...t},this.applyFilters()}applyFilters(){var s,i,n,o;const t=this._d.getData();t.setFindFilter(this._d.getFindFilter(),this._d.getColLayout().visibleLeaves.map(l=>l.field)),t.applyFilter(this._filters),(i=(s=this._d).onReproject)==null||i.call(s);const e=t.rowCount;(n=this._d.getVs())==null||n.setTotalRows(e),(o=this._d.getPagination())==null||o.setTotalRows(e)}}class ki{constructor(t){this._d=t}handleCellClick(t,e,s){var d,c,h,u,p,f,g,m,b;const i=this._d.getOptions(),n=this._d.getRowMgr(),o=this._d.getEditMgr();i.selection==="single"||i.selection==="row"?n.selectSingle(t):i.selection==="multiple"?s.ctrlKey||s.metaKey?n.selectToggle(t):n.selectSingle(t):i.selection==="cells"&&e>=0&&((c=(d=this._d).onCellsClick)==null||c.call(d,t,e,s.shiftKey));const l=this._d.getData().getRowByIndex(t),a=this._d.getColLayout().visibleLeaves[e];if(l&&a){const _=a.editable!==!1&&(a.editable!==void 0||i.editable);if(kt(a)&&_){const S=l[a.field];this._d.writeCell(t,a.field,!S)}if(a.type==="radio"){const S=a.group;for(const A of this._d.getColLayout().visibleLeaves)A.type==="radio"&&A.field!==a.field&&(!S||A.group===S)&&this._d.getData().updateCell(t,A.field,!1);this._d.writeCell(t,a.field,!0)}let w=l[a.field];if(w===void 0&&a.formula)try{const S=a.formulaPrecision??30,A=je(a.formula,l,S);w=A instanceof v?a.precision!=null?A.toFixed(a.precision):A.toString():String(A)}catch{}const x={type:"cellClick",rowIndex:t,columnIndex:e,field:a.field,value:w,row:l,column:a,target:s.target,originalEvent:s};this._d.emit("cellClick",x),(h=i.onCellClick)==null||h.call(i,x);const E={type:"rowClick",rowIndex:t,row:l,target:s.target,originalEvent:s};this._d.emit("rowClick",E),(u=i.onRowClick)==null||u.call(i,E);const y=a.type==="select";!(o.activeEditor!=null&&((p=o.editCell)==null?void 0:p.ri)===t&&((f=o.editCell)==null?void 0:f.ci)===e)&&(i.editMode==="click"||y)&&!kt(a)&&o.startEdit(t,e,s)}o.activeEditor&&((g=o.editCell)==null?void 0:g.ri)===t&&((m=o.editCell)==null?void 0:m.ci)===e||i.selection!=="cells"&&(this._d.doRender(),this._d.emit("selectionChange",{rows:n.getSelections(),rowIndexes:[...n.selectedRows]}),(b=i.onSelectionChange)==null||b.call(i,{rows:n.getSelections(),rowIndexes:[...n.selectedRows],cells:[]}))}handleCellDblClick(t,e,s){var d,c;const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellDblClick",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellDblClick",l),(d=o.onCellDblClick)==null||d.call(o,l);const a={type:"rowDblClick",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowDblClick",a),(c=o.onRowDblClick)==null||c.call(o,a),o.editMode==="dblclick"&&this._d.getEditMgr().startEdit(t,e,s)}handleCellMouseOver(t,e,s){var d,c;const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellMouseOver",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellMouseOver",l),(d=o.onCellMouseOver)==null||d.call(o,l);const a={type:"rowMouseOver",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowMouseOver",a),(c=o.onRowMouseOver)==null||c.call(o,a)}handleCellMouseOut(t,e,s){var d,c;const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellMouseOut",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellMouseOut",l),(d=o.onCellMouseOut)==null||d.call(o,l);const a={type:"rowMouseOut",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowMouseOut",a),(c=o.onRowMouseOut)==null||c.call(o,a)}handleCellMouseDown(t,e,s){var d,c,h,u;(c=(d=this._d).rangeMouseDown)==null||c.call(d,t,e,s);const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellMouseDown",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellMouseDown",l),(h=o.onCellMouseDown)==null||h.call(o,l);const a={type:"rowMouseDown",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowMouseDown",a),(u=o.onRowMouseDown)==null||u.call(o,a)}handleCellMouseUp(t,e,s){var d,c,h,u;(c=(d=this._d).rangeMouseUp)==null||c.call(d,t,e,s);const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellMouseUp",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellMouseUp",l),(h=o.onCellMouseUp)==null||h.call(o,l);const a={type:"rowMouseUp",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowMouseUp",a),(u=o.onRowMouseUp)==null||u.call(o,a)}handleCellMouseMove(t,e,s){var d,c,h,u;(c=(d=this._d).rangeMouseMove)==null||c.call(d,t,e,s);const i=this._d.getData().getRowByIndex(t),n=this._d.getColLayout().visibleLeaves[e];if(!i||!n)return;const o=this._d.getOptions(),l={type:"cellMouseMove",rowIndex:t,columnIndex:e,field:n.field,value:i[n.field],row:i,column:n,target:s.target,originalEvent:s};this._d.emit("cellMouseMove",l),(h=o.onCellMouseMove)==null||h.call(o,l);const a={type:"rowMouseMove",rowIndex:t,row:i,target:s.target,originalEvent:s};this._d.emit("rowMouseMove",a),(u=o.onRowMouseMove)==null||u.call(o,a)}handleCellKeyEvt(t,e){var c,h,u;const s=this._d.getEditMgr();if(!s.focusCell||s.activeEditor)return;const{ri:i,ci:n}=s.focusCell,o=this._d.getData().getRowByIndex(i),l=this._d.getColLayout().visibleLeaves[n];if(!o||!l)return;const a=this._d.getOptions(),d={type:t,rowIndex:i,columnIndex:n,field:l.field,value:o[l.field],row:o,column:l,key:e.key,target:this._d.getContainer(),originalEvent:e};this._d.emit(t,d),t==="cellKeyDown"?(c=a.onCellKeyDown)==null||c.call(a,d):t==="cellKeyUp"?(h=a.onCellKeyUp)==null||h.call(a,d):(u=a.onCellKeyPress)==null||u.call(a,d)}}function Fi(r,t){return{startRow:Math.min(r.ri,t.ri),endRow:Math.max(r.ri,t.ri),startCol:Math.min(r.ci,t.ci),endCol:Math.max(r.ci,t.ci)}}class Si{constructor(t){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=t}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(t=>({...t}))}getActiveRange(){return this._rects[0]?{...this._rects[0]}:null}getPrimaryRect(){return this.getActiveRange()}getProjectedFlatRows(){return this._identity.rowIds.map(t=>this._host.flatIndexOfRowId(t)).filter(t=>t>=0).sort((t,e)=>t-e)}beginDrag(t,e,s={}){s.shift&&this._hasSelection?this._focus={ri:t,ci:e}:(this._anchor={ri:t,ci:e},this._focus={ri:t,ci:e}),this._hasSelection=!0,this._additive=!!s.additive,this._recompute()}updateFocus(t,e){this._hasSelection&&(this._focus={ri:t,ci:e},this._recompute())}endDrag(){this._hasSelection&&this.snapshotIdentity()}get additive(){return this._additive}click(t,e){this._anchor={ri:t,ci:e},this._focus={ri:t,ci:e},this._hasSelection=!0,this._recompute(),this.snapshotIdentity()}shiftClickExtend(t,e){if(!this._hasSelection){this.click(t,e);return}this._focus={ri:t,ci:e},this._recompute(),this.snapshotIdentity()}extendFocus(t){if(!this._hasSelection)return;const e=Math.max(0,this._host.count()-1),s=Math.max(0,this._host.visibleFields().length-1);let{ri:i,ci:n}=this._focus;switch(t){case"up":i=Math.max(0,i-1);break;case"down":i=Math.min(e,i+1);break;case"left":n=Math.max(0,n-1);break;case"right":n=Math.min(s,n+1);break}this._focus={ri:i,ci:n},this._recompute(),this.snapshotIdentity()}setRect(t){this._anchor={ri:t.startRow,ci:t.startCol},this._focus={ri:t.endRow,ci:t.endCol},this._hasSelection=!0,this._rects=[{...t}],this.snapshotIdentity()}clear(){this._hasSelection=!1,this._rects=[],this._identity={rowIds:[],fields:[]}}snapshotIdentity(){const t=this._rects[0];if(!t){this._identity={rowIds:[],fields:[]};return}const e=[];for(let n=t.startRow;n<=t.endRow;n++){const o=this._host.rowIdOfFlat(n);o&&e.push(o)}const i=this._host.visibleFields().slice(t.startCol,t.endCol+1);this._identity={rowIds:e,fields:i}}reproject(){if(!this._hasSelection)return;if(this._identity.rowIds.length===0||this._identity.fields.length===0){this._rects=[];return}const t=this._identity.rowIds.map(a=>this._host.flatIndexOfRowId(a)).filter(a=>a>=0),e=this._host.visibleFields(),s=this._identity.fields.map(a=>e.indexOf(a)).filter(a=>a>=0);if(t.length===0||s.length===0){this._rects=[];return}const i=Math.min(...t),n=Math.max(...t),o=Math.min(...s),l=Math.max(...s);this._rects=[{startRow:i,endRow:n,startCol:o,endCol:l}],this._anchor={ri:i,ci:o},this._focus={ri:n,ci:l}}_recompute(){this._rects=[Fi(this._anchor,this._focus)]}}const Ii=/^-?\d+(\.\d+)?$/,Li=/^(.*?)(\d+)$/;function Ti(r){const t=String(r??"").trim();if(t===""||!Ii.test(t))return null;try{return v.from(t)}catch{return null}}function Di(r){const t=r.length;if(t===0)return{kind:"copy"};const e=r.map(Ti);if(e.every(s=>s!==null)){if(t===1)return{kind:"copy"};const s=e,i=s.slice(1).map((o,l)=>o.sub(s[l]));return i.every(o=>o.eq(i[0]))?{kind:"arith",step:i[0],values:s}:{kind:"copy"}}if(t>=2){const s=r.map(i=>Li.exec(String(i??"")));if(s.every(i=>i!==null)){const i=s.map(o=>o[1]);if(i.every(o=>o===i[0])){const o=s.map(d=>v.from(d[2])),l=o.slice(1).map((d,c)=>d.sub(o[c]));if(l.every(d=>d.eq(l[0])))return{kind:"text-suffix",step:l[0],values:o,prefix:i[0]}}}}return{kind:"copy"}}function ts(r,t,e){return e<=0?0:r==="down"||r==="right"?(t-1)%e:(e-t%e)%e}function Ai(r,t,e,s){const i=t.length;if(r.kind==="copy"||!r.values||!r.step)return t[ts(e,s,i)];const n=e==="down"||e==="right",o=n?r.values[r.values.length-1]:r.values[0],l=n?r.step:r.step.neg(),a=o.add(l.mul(s));return r.kind==="text-suffix"?`${r.prefix}${a.toNumber()}`:a.toNumber()}function wt(r,t){const e=[];for(let s=r;s<=t;s++)e.push(s);return e}function $i(r,t,e,s,i){var l;const n=r.resolveFlatRow(t);return n.kind!=="data"||!n.rowId?{rowIndex:t,field:e,action:"skip",reason:"non-data-row"}:r.isEditable&&!r.isEditable(n.rowId,e)?{rowIndex:t,field:e,action:"skip",reason:"not-editable"}:!!((l=r.hasCellFormula)!=null&&l.call(r,n.rowId,e))&&!r.overwriteFormula?(i(),{rowIndex:t,field:e,action:"skip",reason:"formula-preserved"}):{rowIndex:t,field:e,action:"value",value:s}}function Oi(r,t,e,s,i,n,o,l){var p,f;const a=r.resolveFlatRow(t);if(a.kind!=="data"||!a.rowId)return{rowIndex:t,field:s,action:"skip",reason:"non-data-row"};if(r.isEditable&&!r.isEditable(a.rowId,s))return{rowIndex:t,field:s,action:"skip",reason:"not-editable"};const d=r.resolveFlatRow(i),c=!!(d.rowId&&((p=r.hasCellFormula)!=null&&p.call(r,d.rowId,o)));if(c&&d.rowId){if(r.forceCopyFormula){const g=r.getCellValue(i,o);return{rowIndex:t,field:s,action:"setFormula",formula:String(g)}}if(r.offsetFormula){const g=r.offsetFormula(d.rowId,o,t-i,e-n);return{rowIndex:t,field:s,action:"setFormula",formula:g}}}const h=!!((f=r.hasCellFormula)!=null&&f.call(r,a.rowId,s));if(!c&&h&&!r.overwriteFormula)return l(),{rowIndex:t,field:s,action:"skip",reason:"formula-preserved"};const u=r.getCellValue(i,o);return{rowIndex:t,field:s,action:"value",value:u}}function Bi(r,t,e,s,i){const n=e==="up"||e==="down",o=[];let l=0;const a=()=>{l++},d=n?wt(r.startCol,r.endCol):wt(r.startRow,r.endRow);for(const c of d){const h=n?i.fieldAt(c):void 0,u=n?wt(r.startRow,r.endRow).map(b=>({ri:b,ci:c})):wt(r.startCol,r.endCol).map(b=>({ri:c,ci:b})),p=u.map(b=>{const _=n?h:i.fieldAt(b.ci);return _?i.getCellValue(b.ri,_):void 0}),f=s==="series"?Di(p):{kind:"copy"},g=n?wt(t.startRow,t.endRow):wt(t.startCol,t.endCol);(e==="down"||e==="right"?g:[...g].reverse()).forEach((b,_)=>{const w=_+1,x=n?b:c,E=n?c:b,y=n?h:i.fieldAt(b);if(!y)return;if(f.kind!=="copy"){const P=Ai(f,p,e,w);o.push($i(i,x,y,P,a));return}const k=ts(e,w,u.length),S=u[k],A=n?h:i.fieldAt(S.ci);A&&o.push(Oi(i,x,E,y,S.ri,S.ci,A,a))})}return{items:o,skippedFormula:l}}function zi(r,t){return t==="down"?r.endRow<=r.startRow?null:{source:{startRow:r.startRow,endRow:r.startRow,startCol:r.startCol,endCol:r.endCol},target:{startRow:r.startRow+1,endRow:r.endRow,startCol:r.startCol,endCol:r.endCol}}:r.endCol<=r.startCol?null:{source:{startRow:r.startRow,endRow:r.endRow,startCol:r.startCol,endCol:r.startCol},target:{startRow:r.startRow,endRow:r.endRow,startCol:r.startCol+1,endCol:r.endCol}}}function Ni(r,t){const e=[];for(let s=r.startRow;s<=r.endRow;s++){const i=[];for(let n=r.startCol;n<=r.endCol;n++){const o=t.fieldAt(n);if(!o){i.push("");continue}const l=t.getDisplayText?t.getDisplayText(s,o):String(t.getCellValue(s,o)??"");i.push(l)}e.push(i.join(" "))}return e.join(`
|
|
83
|
+
`)}function Pi(r){return r===""?[[""]]:r.split(`
|
|
84
|
+
`).map(t=>t.split(" "))}function Hi(r,t,e){var c;const s=r.length,i=s>0?Math.max(...r.map(h=>h.length)):0;if(s===0||i===0)return[];const n=t.endRow-t.startRow+1,o=t.endCol-t.startCol+1,l=Math.max(n,s),a=Math.max(o,i),d=[];for(let h=0;h<l;h++)for(let u=0;u<a;u++){const p=t.startRow+h,f=t.startCol+u,g=e.fieldAt(f);if(!g)continue;const m=e.resolveFlatRow(p);if(m.kind!=="data"||!m.rowId){d.push({rowIndex:p,field:g,action:"skip",reason:"non-data-row"});continue}if(e.isEditable&&!e.isEditable(m.rowId,g)){d.push({rowIndex:p,field:g,action:"skip",reason:"not-editable"});continue}const b=((c=r[h%s])==null?void 0:c[u%i])??"";d.push({rowIndex:p,field:g,action:"value",value:b})}return d}function es(r,t){const e=[];for(let s=r.startRow;s<=r.endRow;s++){const i=[];for(let n=r.startCol;n<=r.endCol;n++){const o=t.fieldAt(n);i.push(o?t.getCellValue(s,o):void 0)}e.push(i)}return e}function Vi(r,t){const e=es(r,t).flat(),s=[];for(const i of e){const n=String(i??"").trim();n===""||!/^-?\d+(\.\d+)?$/.test(n)||s.push(v.from(n))}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 Wi{constructor(t){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=t;const e={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 Si(e)}isEnabled(){var e;const t=this._d.getOptions();return((e=t.rangeSelection)==null?void 0:e.enabled)??t.selection==="cells"}_rangeOpts(){const t=this._d.getOptions().rangeSelection;return{fillHandle:(t==null?void 0:t.fillHandle)??!0,multiRange:(t==null?void 0:t.multiRange)??!1,autoScrollEdge:(t==null?void 0:t.autoScrollEdge)??24,seriesFill:(t==null?void 0:t.seriesFill)??!0,enabledInTreeGroup:(t==null?void 0:t.enabledInTreeGroup)??!1,fillOverwriteFormula:(t==null?void 0:t.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 t=this.getActiveRange();return t?es(t,this._queryCtx()):[]}getRangeStats(){const t=this.getActiveRange();return t?Vi(t,this._queryCtx()):null}_queryCtx(){return{fieldAt:t=>{var e;return(e=this._d.getColLayout().visibleLeaves[t])==null?void 0:e.field},getCellValue:(t,e)=>this._d.getData().getCellValue(t,e)}}handleCellMouseDown(t,e,s){if(!this.isEnabled()||this._editorActive()||t<0||e<0)return;this._model.beginDrag(t,e,{additive:s.ctrlKey||s.metaKey,shift:s.shiftKey}),this._isDragging=!0,this._d.setFocusCell(t,e),this._d.doRender();const i=()=>{document.removeEventListener("mouseup",i),this.handleCellMouseUp(-1,-1,s)};document.addEventListener("mouseup",i)}handleCellMouseMove(t,e,s){this._isDragging&&(t>=0&&e>=0&&(this._model.updateFocus(t,e),this._d.doRender()),this._maybeAutoscroll(s))}handleCellMouseUp(t,e,s){this._isDragging&&(this._isDragging=!1,this._stopAutoscroll(),this._model.endDrag(),this._afterModelChange(!0))}handleClick(t,e,s){if(!this.isEnabled()||this._editorActive())return;s?this._model.shiftClickExtend(t,e):this._model.click(t,e);const i=this._model.getFocus();this._d.setFocusCell(i.ri,i.ci),this._afterModelChange(!0)}extendFocus(t){if(!this.isEnabled()||!this._model.hasSelection)return;this._model.extendFocus(t);const e=this._model.getFocus();this._d.setFocusCell(e.ri,e.ci),this._afterModelChange(!0)}clear(){this._model.hasSelection&&(this._model.clear(),this._afterModelChange(!0))}clearRangeSelection(){this.clear()}setRangeSelection(t){const e=Array.isArray(t)?t[0]:t;if(!e){this.clear();return}this._model.setRect(e);const s=this._model.getFocus();this._d.setFocusCell(s.ri,s.ci),this._afterModelChange(!0)}reproject(){var e,s;if(!this._model.hasSelection)return;this._model.reproject();const t=this._model.getActiveRange();this._d.emit("rangeChange",{range:t}),(s=(e=this._d.getOptions()).onRangeChange)==null||s.call(e,{range:t})}_afterModelChange(t){var n,o;if(this._d.doRender(),!t)return;const e=this._model.getRangeSelection(),s=this._model.getActiveRange(),i=this._d.getOptions();this._d.emit("selectionChange",{rows:[],rowIndexes:[],cells:e}),(n=i.onSelectionChange)==null||n.call(i,{rows:[],rowIndexes:[],cells:e}),this._d.emit("rangeChange",{range:s}),(o=i.onRangeChange)==null||o.call(i,{range:s}),this._announceSelection()}_announceSelection(){const t=this.getActiveRange();if(!t)return;const e=t.endRow-t.startRow+1,s=t.endCol-t.startCol+1;this._d.announce(`${t.startRow+1}행 ${t.startCol+1}열 ~ ${t.endRow+1}행 ${t.endCol+1}열, ${e*s}개 셀 선택`)}ctrlFill(t){if(!this.isEnabled())return;const e=this.getActiveRange();if(!e)return;const s=zi(e,t);s&&this._commitFill(s.source,s.target,t,"copy")}fillRange(t,e,s="copy"){let i;e.startRow<t.startRow?i="up":e.endRow>t.endRow?i="down":e.startCol<t.startCol?i="left":i="right",this._commitFill(t,e,i,s)}_isEditable(t,e){const s=this._d.getColLayout().getColumnByField(e);if(!s||s.editable===!1)return!1;const i=this._d.getOptions();if(typeof s.editable=="function"){const n=this._d.getFlatModel().flatIndexOfRowId(t),o=n>=0?this._d.getData().getRowByIndex(n):void 0;return o?!!s.editable(o,n):!1}return s.editable!==void 0?!0:!!i.editable}_commitFill(t,e,s,i){var f,g,m,b;const n=this._rangeOpts(),o=n.seriesFill?i:"copy",l={resolveFlatRow:_=>this._d.getFlatModel().resolveFlatRow(_),fieldAt:_=>{var w;return(w=this._d.getColLayout().visibleLeaves[_])==null?void 0:w.field},getCellValue:(_,w)=>this._d.getData().getCellValue(_,w),isEditable:(_,w)=>this._isEditable(_,w),hasCellFormula:(_,w)=>{var x,E;return((E=(x=this._d).hasCellFormula)==null?void 0:E.call(x,_,w))??!1},offsetFormula:(_,w,x,E)=>{var y,k;return((k=(y=this._d).offsetFormula)==null?void 0:k.call(y,_,w,x,E))??""},overwriteFormula:n.fillOverwriteFormula},a=Bi(t,e,s,o,l),d=[],c=[],h=[];for(const _ of a.items)if(_.action==="value"){const w=this._d.getData().getCellValue(_.rowIndex,_.field);d.push({rowIndex:_.rowIndex,field:_.field,oldValue:w,newValue:_.value}),c.push({rowIndex:_.rowIndex,field:_.field,value:_.value})}else if(_.action==="setFormula"&&_.formula!=null){const w=this._d.getFlatModel().resolveFlatRow(_.rowIndex);w.kind==="data"&&w.rowId&&(h.push({rowId:w.rowId,field:_.field,formula:_.formula}),d.push({rowIndex:_.rowIndex,field:_.field,oldValue:this._d.getData().getCellValue(_.rowIndex,_.field),newValue:_.formula}))}const u={source:t,target:e,mode:o,written:d,skippedFormula:a.skippedFormula,cancel:!1};if(this._d.emit("rangeFill",u),(g=(f=this._d.getOptions()).onRangeFill)==null||g.call(f,u),u.cancel)return;c.length&&this._d.writeCells(c);for(const _ of h)(b=(m=this._d).setCellFormulaByRowId)==null||b.call(m,_.rowId,_.field,_.formula);a.skippedFormula>0&&this._d.announce(`수식 셀 ${a.skippedFormula}개 보존`);const p=a.items.filter(_=>_.action==="skip"&&_.reason!=="formula-preserved").length;p>0&&this._d.announce(`채우기 대상이 아닌 셀 ${p}개를 건너뛰었습니다`)}copyText(){var i,n;const t=this.getActiveRange();if(!t)return null;const s=Ni(t,{fieldAt:o=>{var l;return(l=this._d.getColLayout().visibleLeaves[o])==null?void 0:l.field},getCellValue:(o,l)=>this._d.getData().getCellValue(o,l),getDisplayText:(o,l)=>this._d.getDisplayValue(o,l)});return this._d.emit("rangeCopy",{range:t,text:s}),(n=(i=this._d.getOptions()).onRangeCopy)==null||n.call(i,{range:t,text:s}),s}pasteText(t){const e=this.getActiveRange();if(!e)return!1;const s=Pi(t),o=Hi(s,e,{resolveFlatRow:l=>this._d.getFlatModel().resolveFlatRow(l),fieldAt:l=>{var a;return(a=this._d.getColLayout().visibleLeaves[l])==null?void 0:a.field},isEditable:(l,a)=>this._isEditable(l,a)}).filter(l=>l.action==="value").map(l=>({rowIndex:l.rowIndex,field:l.field,value:l.value}));return this._d.writeCells(o),!0}_maybeAutoscroll(t){const e=this._d.getRenderer();if(!e)return;const i=e.bodyWrapper.getBoundingClientRect(),n=this._rangeOpts().autoScrollEdge;let o=0,l=0;const a=t.clientY-i.top,d=i.bottom-t.clientY,c=t.clientX-i.left,h=i.right-t.clientX;if(a<n?l=-this._scrollSpeed(n-a):d<n&&(l=this._scrollSpeed(n-d)),c<n?o=-this._scrollSpeed(n-c):h<n&&(o=this._scrollSpeed(n-h)),o===0&&l===0){this._stopAutoscroll();return}this._autoScrollVX=o,this._autoScrollVY=l,this._autoScrollRAF==null&&this._runAutoscroll()}_scrollSpeed(t){return Math.max(2,Math.min(20,t))}_runAutoscroll(){const t=this._d.getRenderer();if(!t){this._autoScrollRAF=null;return}t.bodyWrapper.scrollTop+=this._autoScrollVY,t.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(t){if(this._mountedWrap===t)return;this._mountedWrap=t;const e=document.createElement("div");e.className="og-range-overlay",e.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 i=document.createElement("div");i.className="og-range-fill-preview",i.style.cssText="position:absolute;box-sizing:border-box;border:1px dashed var(--og-range-border,#1976d2);pointer-events:none;display:none;";const n=document.createElement("div");n.className="og-range-fill-handle",n.setAttribute("role","button"),n.setAttribute("aria-label","채우기 핸들"),n.style.cssText="position:absolute;display:none;pointer-events:auto;background-color:var(--og-fill-handle-bg,#1976d2);",n.addEventListener("pointerdown",o=>this._onHandlePointerDown(o)),e.appendChild(s),e.appendChild(i),e.appendChild(n),t.insertBefore(e,t.firstChild),t.addEventListener("scroll",()=>this.repaint(),{passive:!0}),this._overlayEl=e,this._borderEl=s,this._previewEl=i,this._handleEl=n}repaint(){if(!this._overlayEl)return;const t=this._d.getRenderer(),e=this.getActiveRange();if(!t||!e){this._hideOverlay();return}const s=t.bodyWrapper.getBoundingClientRect(),i=t.getCellEl(e.startRow,e.startCol),n=t.getCellEl(e.endRow,e.endCol);if(!i||!n){this._hideOverlay();return}const o=i.getBoundingClientRect(),l=n.getBoundingClientRect(),a=Math.min(o.left,l.left)-s.left,d=Math.min(o.top,l.top)-s.top,c=Math.max(o.right,l.right)-s.left,h=Math.max(o.bottom,l.bottom)-s.top;if(Object.assign(this._borderEl.style,{display:"block",left:`${a}px`,top:`${d}px`,width:`${Math.max(0,c-a)}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,p=t.getCellEl(u.startRow,u.startCol),f=t.getCellEl(u.endRow,u.endCol);if(p&&f){const g=p.getBoundingClientRect(),m=f.getBoundingClientRect(),b=Math.min(g.left,m.left)-s.left,_=Math.min(g.top,m.top)-s.top,w=Math.max(g.right,m.right)-s.left,x=Math.max(g.bottom,m.bottom)-s.top;Object.assign(this._previewEl.style,{display:"block",left:`${b}px`,top:`${_}px`,width:`${Math.max(0,w-b)}px`,height:`${Math.max(0,x-_)}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(t,e){const s=typeof document.elementFromPoint=="function"?document.elementFromPoint(t,e):null,i=s==null?void 0:s.closest(".og-cell"),n=i==null?void 0:i.closest(".og-row");if(!i||!n)return null;const o=i.getAttribute("aria-colindex"),l=n.getAttribute("aria-rowindex");return o==null||l==null?null:{ri:Number(l)-1,ci:Number(o)-1}}_onHandlePointerDown(t){var n;const e=this.getActiveRange();if(!e)return;t.stopPropagation(),t.preventDefault(),this._handlePointerId=t.pointerId;try{(n=this._handleEl)==null||n.setPointerCapture(t.pointerId)}catch{}this._fillDragSource=e,this._fillDragStart={x:t.clientX,y:t.clientY};const s=o=>this._onHandlePointerMove(o),i=o=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",i),this._onHandlePointerUp(o)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",i)}_onHandlePointerMove(t){const e=this._fillDragSource,s=this._fillDragStart;if(!e||!s)return;const i=this._resolveCellAtPoint(t.clientX,t.clientY);if(!i)return;const n=t.clientX-s.x,o=t.clientY-s.y,l=Math.abs(o)>=Math.abs(n);let a,d;if(l)if(i.ri>e.endRow)a="down",d={startRow:e.endRow+1,endRow:i.ri,startCol:e.startCol,endCol:e.endCol};else if(i.ri<e.startRow)a="up",d={startRow:i.ri,endRow:e.startRow-1,startCol:e.startCol,endCol:e.endCol};else{this._fillPreview=null,this.repaint();return}else if(i.ci>e.endCol)a="right",d={startRow:e.startRow,endRow:e.endRow,startCol:e.endCol+1,endCol:i.ci};else if(i.ci<e.startCol)a="left",d={startRow:e.startRow,endRow:e.endRow,startCol:i.ci,endCol:e.startCol-1};else{this._fillPreview=null,this.repaint();return}const h=this._rangeOpts().seriesFill?"series":"copy",p=t.ctrlKey||t.metaKey?h==="series"?"copy":"series":h;this._fillPreview={source:e,target:d,axis:a,mode:p},this.repaint()}_onHandlePointerUp(t){const e=this._fillPreview;this._fillDragSource=null,this._fillDragStart=null,this._fillPreview=null,this._handlePointerId=null,e&&this._commitFill(e.source,e.target,e.axis,e.mode),this.repaint()}}function Ki(r,t){return r==null||Number.isNaN(r)?"":t?t(r,{axis:"tooltip"}):String(r)}function ss(r,t={}){const{categories:e,series:s}=r,i=["category",...s.map(a=>a.name)],n=e.map((a,d)=>[a,...s.map(c=>Ki(c.data[d]??null,t.numberFormat))]),o=s.map(a=>a.name).join(", ");return{caption:t.title?`${t.title}: 카테고리 ${e.length}개, 시리즈 ${o||"없음"}`:`카테고리 ${e.length}개, 시리즈 ${o||"없음"}`,colHeaders:i,rows:n}}const Ui=.8,ji=50;function is(r){if(r==null||r==="")return null;if(typeof r=="number")return Number.isFinite(r)?r:null;const t=Number(r);return Number.isFinite(t)?t:null}function Ae(r,t,e){if((r==null?void 0:r.type)==="number")return!0;if(r!=null&&r.type)return!1;let s=0,i=0;for(const n of t){if(s>=ji)break;const o=n[e];o==null||o===""||(s++,is(o)!==null&&i++)}return s===0?!1:i/s>=Ui}function Gi(r){return typeof r=="string"?r:r.field}function qi(r,t){return typeof r=="string"?t:r.name??t}function Yi(r,t){let e=null;for(const i of t)if(!Ae(i,r,i.field)){e=i;break}const s=t.filter(i=>i!==e&&Ae(i,r,i.field));return{categoryField:(e==null?void 0:e.field)??null,seriesCols:s}}function Xi(r,t,e){if(typeof e=="function")return e(r,t);if(!r.length)return 0;switch(e){case"sum":return v.sum(r).toNumber();case"avg":return v.avg(r).toNumber();case"min":return v.min(r).toNumber();case"max":return v.max(r).toNumber();case"count":return r.length;default:return v.sum(r).toNumber()}}function Zi(r,t){var e;switch(r.kind){case"all":case"columns":return{rows:t.getAllRows(),effectiveKind:r.kind,rangeFallback:!1};case"selection":return{rows:t.getSelectedRows(),effectiveKind:"selection",rangeFallback:!1};case"checked":return{rows:t.getCheckedRows(),effectiveKind:"checked",rangeFallback:!1};case"range":{const s=r.range??((e=t.getActiveRange)==null?void 0:e.call(t))??null;return!s||!t.getRangeRows?{rows:t.getSelectedRows(),effectiveKind:"selection",rangeFallback:!0}:{rows:t.getRangeRows(s),effectiveKind:"range",rangeFallback:!1}}}}function Ji(r,t,e){return r.kind==="range"&&t==="range"&&r.range&&e.getRangeColumns?e.getRangeColumns(r.range):e.getVisibleColumns()}function Qi(r,t,e={}){const{rows:s,effectiveKind:i,rangeFallback:n}=Zi(r,t),o=Ji(r,i,t);let l=null,a;if(r.kind==="columns")l=e.category??r.category??null,a=e.series??r.series;else if(e.series)l=e.category??null,a=e.series;else{const _=Yi(s,o);l=e.category??_.categoryField,a=_.seriesCols.map(w=>w.field)}const d=new Map(o.map(_=>[_.field,_])),c=l?s.map(_=>String(_[l]??"")):s.map((_,w)=>String(w+1)),h=a.map(_=>{const w=Gi(_),x=d.get(w),E=qi(_,(x==null?void 0:x.header)??w),y=s.map(P=>is(P[w])),k=typeof _=="string"?void 0:_.pattern,S=typeof _=="string"?void 0:_.color,A={name:E,data:y};return k&&(A.pattern=k),S&&(A.color=S),A}),u=s.length;let p=c,f=h,g,m=!1;if(e.aggregate&&c.length>0){const _=[],w=new Map;for(let x=0;x<c.length;x++){const E=c[x];w.has(E)?w.get(E).push(x):(w.set(E,[x]),_.push(E))}_.length<c.length&&(p=_,f=h.map(x=>({...x,data:_.map(E=>{const k=w.get(E).map(S=>x.data[S]).filter(S=>S!==null);return k.length?Xi(k,E,e.aggregate):null})})),g=typeof e.aggregate=="function"?"custom":e.aggregate,m=!0)}const b={categories:p,series:f,meta:{sourceKind:i,total:u,sampled:m,a11yTable:ss({categories:p,series:f},{title:e.title,numberFormat:e.numberFormat})}};return g&&(b.meta.aggregatedOp=g),{model:b,rangeFallback:n}}function tn(r){return r==="line"||r==="area"}function he(r){return r==null||Number.isNaN(r)?null:r}function $e(r){let t=-1,e=-1,s=1/0,i=-1/0;for(let o=0;o<r.length;o++){const l=he(r[o]);l!=null&&(l<s&&(s=l,t=o),l>i&&(i=l,e=o))}const n=[];return t>=0&&n.push(t),e>=0&&n.push(e),n}function en(r,t){const e=r.length;if(t>=e||t<=2)return Array.from({length:e},(l,a)=>a);const s=l=>he(r[l])??0,i=[0],n=(e-2)/(t-2);let o=0;for(let l=0;l<t-2;l++){let a=0,d=0;const c=Math.floor((l+1)*n)+1;let h=Math.floor((l+2)*n)+1;h=Math.min(h,e);const u=h-c;for(let w=c;w<h;w++)a+=w,d+=s(w);u>0&&(a/=u,d/=u);const p=Math.floor(l*n)+1,f=Math.floor((l+1)*n)+1,g=o,m=s(o);let b=-1,_=p;for(let w=p;w<f&&w<e;w++){const x=Math.abs((g-a)*(s(w)-m)-(g-w)*(d-m))*.5;x>b&&(b=x,_=w)}i.push(_),o=_}return i.push(e-1),i}function sn(r,t,e,s={}){var a;const i=r.categories.length;if(!Number.isFinite(t)||t<=0||i<=t)return{model:r,sampled:!1};let n,o;if(tn(e)){const d=((a=r.series[0])==null?void 0:a.data)??new Array(i).fill(0),c=new Set([0,i-1]);for(const f of r.series)for(const g of $e(f.data))c.add(g);const h=new Set(c),u=en(d,t);for(const f of u){if(h.size>=t)break;h.add(f)}let p=[...h].sort((f,g)=>f-g);if(p.length>t){const f=new Set([0,i-1]),g=r.series.map(b=>$e(b.data));let m=!0;for(;m&&f.size<t;){m=!1;for(const b of g){if(f.size>=t)break;const _=b.find(w=>!f.has(w));_!==void 0&&(f.add(_),m=!0)}}p=[...f].sort((b,_)=>b-_).slice(0,t)}n=p.map(f=>r.categories[f]),o=r.series.map(f=>({...f,data:p.map(g=>f.data[g])}))}else{const d=t,c=i/d;n=[];const h=[];for(let u=0;u<d;u++){const p=Math.floor(u*c),f=Math.min(Math.floor((u+1)*c),i);if(p>=f)continue;h.push([p,f]);const g=r.categories[p],m=r.categories[f-1];n.push(f-p>1?`${g}…${m}`:g)}o=r.series.map(u=>({...u,data:h.map(([p,f])=>{let g=0,m=!1;for(let b=p;b<f;b++){const _=he(u.data[b]);_!=null&&(g+=_,m=!0)}return m?g:null})}))}return{model:{categories:n,series:o,meta:{...r.meta,sampled:!0,sampledFrom:i,sampledTo:n.length,a11yTable:ss({categories:n,series:o},{title:s.title,numberFormat:s.numberFormat})}},sampled:!0}}const ns=["#0072B2","#E69F00","#009E73","#CC79A7","#F0E442","#56B4E9","#D55E00","#999999"],Oe=["solid","hatch","dot","cross"];function Zt(r){return Math.min(255,Math.max(0,r))}function ae(r){const t=r.trim(),e=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(e)return{r:Zt(+e[1]),g:Zt(+e[2]),b:Zt(+e[3])};const s=t.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 Jt(r){const t=r/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Be(r){return .2126*Jt(r.r)+.7152*Jt(r.g)+.0722*Jt(r.b)}function nn(r,t){const e=ae(r),s=ae(t);if(!e||!s)return 1;const i=Be(e),n=Be(s),[o,l]=i>=n?[i,n]:[n,i];return(o+.05)/(l+.05)}function on(r,t={}){var s;const e=(t.palette&&t.palette.length?t.palette:ns).slice();return!((s=t.palette)!=null&&s.length)&&t.primary&&ae(t.primary)&&(e.length<2||nn(t.primary,e[1])>=3)&&(e[0]=t.primary),r.map((i,n)=>({color:i.color??e[n%e.length],pattern:i.pattern??Oe[n%Oe.length]}))}function ze(r,t){if(r===0)return 0;const e=Math.abs(r),s=Math.floor(Math.log10(e)),i=e/Math.pow(10,s);let n;return t?i<1.5?n=1:i<3?n=2:i<7?n=5:n=10:i<=1?n=1:i<=2?n=2:i<=5?n=5:n=10,n*Math.pow(10,s)}function Qt(r,t){const e=Math.max(0,-Math.floor(Math.log10(t))+6),s=Math.pow(10,e),i=Math.round(r*s)/s;return i===0?0:i}function Ne(r,t,e=6){let s=r,i=t;if(s>i&&([s,i]=[i,s]),s===i)if(s===0)s=-1,i=1;else{const u=Math.abs(s)*.5;s-=u,i+=u}const n=Math.max(2,e),o=ze(i-s,!1),l=ze(o/(n-1),!0),a=Qt(Math.floor(s/l)*l,l),d=Qt(Math.ceil(i/l)*l,l),c=[],h=Math.round((d-a)/l)+1;for(let u=0;u<h;u++)c.push(Qt(a+u*l,l));return{min:a,max:d,step:l,ticks:c}}function rn(r,t,e){for(const s of r){const i=Math.min(s.x,s.x+s.w),n=Math.max(s.x,s.x+s.w),o=Math.min(s.y,s.y+s.h),l=Math.max(s.y,s.y+s.h);if(t>=i&&t<=n&&e>=o&&e<=l)return s}return null}function ln(r,t,e){if(!r.length)return null;let s=-1,i=1/0;for(const l of r){const a=Math.abs(l.cx-t);a<i&&(i=a,s=l.categoryIndex)}let n=null,o=1/0;for(const l of r){if(l.categoryIndex!==s)continue;const a=Math.abs(l.cy-e);a<o&&(o=a,n=l)}return n}function Pe(r,t,e,s){return r.length?s==="line"||s==="area"?ln(r,t,e):rn(r,t,e):null}const He="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;",yt={top:26,right:14,bottom:34,left:52},xt=3.5;let an=0;function te(r,t,e){return r==null||Number.isNaN(r)?"":t.numberFormat?t.numberFormat(r,{axis:e}):String(r)}class Ve{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=t=>{if(this._spec.tooltip===!1)return;const{x:e,y:s}=this._localXY(t),i=Pe(this._geoms,e,s,this._spec.type);i?this._showTooltip(i,e,s):this._hideTooltip()},this._onMouseLeave=()=>this._hideTooltip(),this._onClick=t=>{const{x:e,y:s}=this._localXY(t),i=Pe(this._geoms,e,s,this._spec.type);i&&this._emitPoint(i)},this._onKeyDown=t=>{const e=this._model;if(!e)return;const s=e.categories.length,i=e.series.length;let n=!0;switch(t.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(i-1,this._cursor.series+1);break;case"ArrowUp":this._cursor.series=Math.max(0,this._cursor.series-1);break;case"Enter":case" ":{const o=this._cursorPoint();o&&this._emitPoint(o);break}default:n=!1}n&&(t.preventDefault(),this._announceCursor())}}async init(t,e){this._host=t,this._spec=e,t.classList.add("og-chart"),getComputedStyle(t).position==="static"&&(t.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",e.title??"차트"),this._canvas=s;const i=document.createElement("table");i.className="og-chart-a11y",i.style.cssText=He;const n=`og-chart-a11y-${++an}`;i.id=n,s.setAttribute("aria-describedby",n),this._a11yTable=i;const o=document.createElement("div");o.className="og-chart-legend",o.style.cssText="display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;",this._legend=o;const l=document.createElement("div");l.className="og-chart-tooltip",l.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=l;const a=document.createElement("div");a.className="og-chart-live",a.setAttribute("aria-live","polite"),a.style.cssText=He,this._live=a,t.appendChild(s),t.appendChild(i),t.appendChild(o),t.appendChild(l),t.appendChild(a),s.addEventListener("mousemove",this._onMouseMove),s.addEventListener("mouseleave",this._onMouseLeave),s.addEventListener("click",this._onClick),s.addEventListener("keydown",this._onKeyDown)}render(t,e){var s;this._model=t,this._spec=e,this._cursor.cat=t.categories.length?Math.min(Math.max(this._cursor.cat,0),t.categories.length-1):0,this._cursor.series=t.series.length?Math.min(Math.max(this._cursor.series,0),t.series.length-1):0,this._canvas&&this._canvas.setAttribute("aria-label",((s=e.a11y)==null?void 0:s.caption)??e.title??"차트"),this._renderA11yTable(t,e),this._renderLegend(t,e),this._computeGeometry(t,e),this._paint(t,e),this._hideTooltip()}resize(t,e){this._w=Math.max(80,Math.floor(t)),this._h=Math.max(60,Math.floor(e)),this._model&&this.render(this._model,this._spec)}onPointClick(t){this._onPoint=t}destroy(){var e,s,i,n,o,l;const t=this._canvas;t&&(t.removeEventListener("mousemove",this._onMouseMove),t.removeEventListener("mouseleave",this._onMouseLeave),t.removeEventListener("click",this._onClick),t.removeEventListener("keydown",this._onKeyDown)),(e=this._a11yTable)==null||e.remove(),(s=this._canvas)==null||s.remove(),(i=this._legend)==null||i.remove(),(n=this._tooltip)==null||n.remove(),(o=this._live)==null||o.remove(),(l=this._host)==null||l.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(t,e){const s=this._a11yTable;if(!s)return;const i=t.meta.a11yTable;s.innerHTML="";const n=document.createElement("caption");n.textContent=i.caption,s.appendChild(n);const o=document.createElement("thead"),l=document.createElement("tr");for(const d of i.colHeaders){const c=document.createElement("th");c.scope="col",c.textContent=d,l.appendChild(c)}o.appendChild(l),s.appendChild(o);const a=document.createElement("tbody");for(const d of i.rows){const c=document.createElement("tr");d.forEach((h,u)=>{const p=document.createElement(u===0?"th":"td");u===0&&(p.scope="row"),p.textContent=h,c.appendChild(p)}),a.appendChild(c)}s.appendChild(a)}_renderLegend(t,e){const s=this._legend;if(!s)return;if(e.legend===!1){s.style.display="none";return}s.style.display="flex";const i=this._styles(t,e),n=Array.from(s.querySelectorAll("button.og-chart-legend-item"));if(n.length===t.series.length&&n.every((d,c)=>d.dataset.seriesName===t.series[c].name)){t.series.forEach((d,c)=>{const h=n[c],u=!this._hidden.has(c);this._updateLegendButton(h,t.series[c],i[c],u)});return}const l=document.activeElement,a=l instanceof HTMLButtonElement?n.indexOf(l):-1;if(s.innerHTML="",t.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 p=document.createElement("span");h.appendChild(u),h.appendChild(p),this._updateLegendButton(h,d,i[c],!this._hidden.has(c)),h.addEventListener("click",()=>{const f=!this._hidden.has(c);f?this._hidden.add(c):this._hidden.delete(c),this._updateLegendButton(h,d,i[c],!f),this._computeGeometry(this._model,this._spec),this._paint(this._model,this._spec)}),s.appendChild(h)}),a>=0){const d=s.querySelectorAll("button.og-chart-legend-item"),c=d[a]??d[d.length-1];c==null||c.focus()}}_updateLegendButton(t,e,s,i){t.setAttribute("aria-pressed",String(i)),t.style.opacity=i?"1":"0.45";const n=t.querySelector("span[aria-hidden]");n&&(n.style.background=s.color);const o=t.querySelector("span:not([aria-hidden])");o&&(o.textContent=`${e.name} (${s.pattern})`)}_styles(t,e){var s,i;return on(t.series.map(n=>({color:n.color,pattern:n.pattern})),{palette:e.palette??((s=e.theme)==null?void 0:s.palette),primary:(i=e.theme)==null?void 0:i.primary})}_plotRect(){return{x:yt.left,y:yt.top,w:Math.max(1,this._w-yt.left-yt.right),h:Math.max(1,this._h-yt.top-yt.bottom)}}_valueExtent(t){let e=1/0,s=-1/0;return t.series.forEach((i,n)=>{if(!this._hidden.has(n))for(const o of i.data)o==null||Number.isNaN(o)||(o<e&&(e=o),o>s&&(s=o))}),(!Number.isFinite(e)||!Number.isFinite(s))&&(e=0,s=1),(this._spec.type==="bar"||this._spec.type==="bar-stacked"||this._spec.type==="bar-grouped")&&(e=Math.min(0,e),s=Math.max(0,s)),{min:e,max:s}}_computeGeometry(t,e){const s=[],i=this._plotRect(),o=t.categories.length||1,{min:l,max:a}=this._valueExtent(t),d=Ne(l,a,6),c=g=>{const m=(g-d.min)/(d.max-d.min||1);return i.y+i.h-m*i.h},h=c(0<d.min?d.min:0>d.max?d.max:0),u=i.w/o,p=e.type==="line"||e.type==="area",f=t.series.map((g,m)=>({s:g,si:m})).filter(({si:g})=>!this._hidden.has(g));if(p)for(const{s:g,si:m}of f)g.data.forEach((b,_)=>{const w=i.x+u*_+u/2,x=b==null?NaN:c(b);Number.isNaN(x)||s.push({seriesIndex:m,categoryIndex:_,x:w-xt,y:x-xt,w:xt*2,h:xt*2,cx:w,cy:x})});else{const g=f.length||1,m=u*.72,b=m/g;f.forEach(({s:_,si:w},x)=>{_.data.forEach((E,y)=>{if(E==null||Number.isNaN(E))return;const S=i.x+u*y+(u-m)/2+b*x,A=c(E),P=Math.min(A,h),B=Math.abs(h-A);s.push({seriesIndex:w,categoryIndex:y,x:S,y:P,w:b,h:B,cx:S+b/2,cy:P+B/2})})})}this._geoms=s}_paint(t,e){const s=this._canvas;if(!s)return;const i=hn();s.width=Math.floor(this._w*i),s.height=Math.floor(this._h*i),s.style.width=`${this._w}px`,s.style.height=`${this._h}px`;const n=s.getContext?s.getContext("2d"):null;if(!n)return;n.setTransform(i,0,0,i,0,0),n.clearRect(0,0,this._w,this._h);const o=e.theme,l=this._plotRect(),{min:a,max:d}=this._valueExtent(t),c=Ne(a,d,6),h=g=>{const m=(g-c.min)/(c.max-c.min||1);return l.y+l.h-m*l.h};n.strokeStyle=(o==null?void 0:o.gridLine)||(o==null?void 0:o.border)||"#e0e0e0",n.fillStyle=(o==null?void 0:o.text)||"#212121",n.lineWidth=1,n.font=`${(o==null?void 0:o.fontSize)||12}px ${(o==null?void 0:o.fontFamily)||"sans-serif"}`,n.textAlign="right",n.textBaseline="middle";for(const g of c.ticks){const m=h(g);n.beginPath(),n.moveTo(l.x,m),n.lineTo(l.x+l.w,m),n.stroke(),n.fillText(te(g,e,"y"),l.x-6,m)}n.textAlign="center",n.textBaseline="top";const u=l.w/(t.categories.length||1);t.categories.forEach((g,m)=>{const b=l.x+u*m+u/2;n.fillText(String(g),b,l.y+l.h+6)});const p=this._styles(t,e);if(e.type==="line"||e.type==="area"){const g=new Map;for(const m of this._geoms){let b=g.get(m.seriesIndex);b||(b=[],g.set(m.seriesIndex,b)),b.push(m)}for(const[m,b]of g){b.sort((_,w)=>_.categoryIndex-w.categoryIndex),n.strokeStyle=p[m].color,n.lineWidth=2,n.setLineDash(dn(p[m].pattern)),n.beginPath(),b.forEach((_,w)=>w===0?n.moveTo(_.cx,_.cy):n.lineTo(_.cx,_.cy)),n.stroke(),n.setLineDash([]),n.fillStyle=p[m].color;for(const _ of b)n.beginPath(),n.arc(_.cx,_.cy,xt,0,Math.PI*2),n.fill()}}else for(const g of this._geoms)n.fillStyle=p[g.seriesIndex].color,n.fillRect(g.x,g.y,g.w,g.h),cn(n,g,p[g.seriesIndex].pattern)}_localXY(t){var n;const e=(n=this._canvas)==null?void 0:n.getBoundingClientRect();if(!e||e.width===0&&e.height===0)return{x:t.offsetX??0,y:t.offsetY??0};const s=e.width>0?this._w/e.width:1,i=e.height>0?this._h/e.height:1;return{x:(t.clientX-e.left)*s,y:(t.clientY-e.top)*i}}_cursorPoint(){return this._geoms.find(t=>t.categoryIndex===this._cursor.cat&&t.seriesIndex===this._cursor.series)??null}_announceCursor(){const t=this._model;if(!t)return;const e=t.series[this._cursor.series],s=t.categories[this._cursor.cat],i=(e==null?void 0:e.data[this._cursor.cat])??null,n=`${(e==null?void 0:e.name)??""}, ${s??""}: ${te(i,this._spec,"tooltip")||"없음"}`;this._live&&(this._live.textContent=n);const o=this._cursorPoint();o&&this._showTooltip(o,o.cx,o.cy)}_pointOf(t){var s,i;const e=this._model;return{seriesName:((s=e.series[t.seriesIndex])==null?void 0:s.name)??"",category:e.categories[t.categoryIndex]??"",value:((i=e.series[t.seriesIndex])==null?void 0:i.data[t.categoryIndex])??null,index:t.categoryIndex}}_emitPoint(t){var e;(e=this._onPoint)==null||e.call(this,this._pointOf(t))}_showTooltip(t,e,s){const i=this._tooltip;if(!i||this._spec.tooltip===!1)return;const n=this._pointOf(t);i.textContent=`${n.seriesName} · ${n.category}: ${te(n.value,this._spec,"tooltip")}`,i.style.display="block",i.style.left=`${e+10}px`,i.style.top=`${s+10}px`}_hideTooltip(){this._tooltip&&(this._tooltip.style.display="none")}}function dn(r){switch(r){case"hatch":return[6,3];case"dot":return[2,3];case"cross":return[8,3,2,3];default:return[]}}function cn(r,t,e){if(e==="solid"||!e)return;r.save(),r.beginPath(),r.rect(t.x,t.y,t.w,t.h),r.clip(),r.strokeStyle="rgba(255,255,255,0.55)",r.lineWidth=1;const s=5;if(e==="hatch"||e==="cross")for(let i=-t.h;i<t.w;i+=s)r.beginPath(),r.moveTo(t.x+i,t.y+t.h),r.lineTo(t.x+i+t.h,t.y),r.stroke();if(e==="cross")for(let i=0;i<t.w+t.h;i+=s)r.beginPath(),r.moveTo(t.x+i,t.y),r.lineTo(t.x+i-t.h,t.y+t.h),r.stroke();if(e==="dot"){r.fillStyle="rgba(255,255,255,0.6)";for(let i=t.y+s;i<t.y+t.h;i+=s)for(let n=t.x+s;n<t.x+t.w;n+=s)r.beginPath(),r.arc(n,i,1,0,Math.PI*2),r.fill()}r.restore()}function hn(){return typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1}const un=500,fn=50,pn=100,ee={width:480,height:300};let gn=0;class _n{constructor(t){this._charts=new Map,this._d=t}createChart(t){var u;const e=`chart-${++gn}`,s=this._d.getContainer(),i=this._snapshotRange(t),{adapter:n,engineFallback:o}=this._resolveAdapter(t),{panel:l,host:a,badgeBox:d,backdrop:c}=this._buildPanel(t,s),h={id:e,config:t,adapter:n,panel:l,badgeBox:d,host:a,backdrop:c,model:null,spec:null,snapshot:i,liveHandler:null,debounceTimer:null,resizeObserver:null,resizeDebounceTimer:null,renderSize:{...ee},localEvents:new Map,destroyed:!1,instance:null};try{this._charts.set(e,h);const{model:p,rangeFallback:f}=this._extract(h);h.model=p,h.spec=this._buildSpec(t,p),h.renderSize=this._resolveRenderSize(t,a),n.init(a,h.spec),n.resize(h.renderSize.width,h.renderSize.height),n.render(p,h.spec),(u=n.onPointClick)==null||u.call(n,m=>this._onPointClick(h,m)),this._renderBadges(h,f,o),t.live!==!1&&this._subscribeLive(h),this._attachResizeObserver(h);const g=this._makeInstance(h);return this._bindOptionCallbacks(h),this._emit(h,"chartCreate",g),this._d.emit("chartCreate",g),g}catch(p){try{this._destroy(h)}catch{}throw p}}_resolveRenderSize(t,e){var o;const s=t.size??ee,i=e.clientWidth;return{width:((o=t.size)==null?void 0:o.width)??(i>0?i:s.width),height:s.height}}_attachResizeObserver(t){if(typeof ResizeObserver>"u")return;const e=pn,s=new ResizeObserver(()=>{t.destroyed||(clearTimeout(t.resizeDebounceTimer),t.resizeDebounceTimer=setTimeout(()=>{if(t.destroyed)return;const i=t.host.clientWidth;i>0&&i!==t.renderSize.width&&(t.renderSize={width:i,height:t.renderSize.height},t.adapter.resize(t.renderSize.width,t.renderSize.height))},e))});s.observe(t.host),t.resizeObserver=s}getCharts(){return[...this._charts.values()].filter(t=>!t.destroyed).map(t=>this._makeInstance(t))}destroyCharts(){for(const t of[...this._charts.values()])this._destroy(t)}_snapshotRange(t){var l,a;if(t.source.kind!=="range")return null;const e=t.source.range??((a=(l=this._d).getActiveRange)==null?void 0:a.call(l))??null;if(!e)return null;const s=this._d.getFlatModel(),i=this._d.getVisibleColumns(),n=[];for(let d=e.startRow;d<=e.endRow;d++){const c=s.rowIdOfFlat(d);c!=null&&n.push(c)}const o=[];for(let d=e.startCol;d<=e.endCol;d++){const c=i[d];c&&o.push(c.field)}return{rowIds:n,fields:o}}_extract(t){var d;const e=t.config,s=((d=this._d.getOptions())==null?void 0:d.chart)??{},i=e.numberFormat??s.numberFormat,n=this._extractDeps(t),o=Qi(e.source,n,{category:e.category,series:e.series??(e.source.kind==="columns"?e.source.series:void 0),aggregate:e.aggregate,title:e.title,numberFormat:i}),l=e.maxPoints??s.maxPoints??un;return{model:sn(o.model,l,e.type,{title:e.title,numberFormat:i}).model,rangeFallback:o.rangeFallback}}_extractDeps(t){const e=t.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:e?()=>e.rowIds.map(s=>this._d.getRowById(s)).filter(s=>!!s):void 0,getRangeColumns:e?()=>{const s=this._d.getVisibleColumns(),i=new Set(e.fields),n=s.filter(o=>i.has(o.field));return n.length?n:s}:void 0}}_buildSpec(t,e){var l;const s=((l=this._d.getOptions())==null?void 0:l.chart)??{},i=this._snapshotTheme(),n={type:t.type,theme:i,a11y:e.meta.a11yTable,palette:t.palette??s.palette??i.palette};t.title!==void 0&&(n.title=t.title),t.legend!==void 0&&(n.legend=t.legend),t.tooltip!==void 0&&(n.tooltip=t.tooltip),t.axis!==void 0&&(n.axis=t.axis);const o=t.numberFormat??s.numberFormat;return o&&(n.numberFormat=o),n}_readVar(t,e,s){return getComputedStyle(t).getPropertyValue(e).trim()||s}_snapshotTheme(){var o;const t=this._d.getContainer(),e=((o=this._d.getOptions())==null?void 0:o.chart)??{},s=this._readVar(t,"--og-primary","#1976d2"),i=this._readVar(t,"--og-font-size","13px"),n=parseInt(i,10)||13;return{primary:s,border:this._readVar(t,"--og-border-color","#e0e0e0"),text:this._readVar(t,"--og-row-color","#212121"),bg:this._readVar(t,"--og-row-bg","#ffffff"),gridLine:this._readVar(t,"--og-border-color","#e0e0e0"),fontFamily:getComputedStyle(t).fontFamily||"sans-serif",fontSize:n,palette:(e.palette&&e.palette.length?e.palette:ns).slice()}}_buildPanel(t,e){var u,p;const s=t.placement??((p=(u=this._d.getOptions())==null?void 0:u.chart)==null?void 0:p.placement)??"docked",i=t.size??ee,n=document.createElement("div");n.className="og-chart-panel",n.setAttribute("data-placement",s),n.setAttribute("role","group"),n.setAttribute("aria-label",t.title??"차트");const o=document.createElement("div");o.className="og-chart-badges",o.style.cssText="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px;";const l=document.createElement("div");l.className="og-chart-host",l.style.cssText=`position:relative;width:${i.width}px;max-width:100%;`;let a=null;const d=this._readVar(e,"--og-row-bg","#ffffff"),c=this._readVar(e,"--og-border-color","#e0e0e0"),h=`box-sizing:border-box;padding:10px;background:${d};border:1px solid ${c};border-radius:6px;`;return s==="modal"?(a=document.createElement("div"),a.className="og-chart-backdrop",a.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1000;display:flex;align-items:center;justify-content:center;",n.style.cssText=h+"max-width:90vw;max-height:90vh;overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,0.3);",a.appendChild(n),a.addEventListener("click",f=>{f.target===a&&this._destroyById(n)}),document.body.appendChild(a)):s==="inline"?(n.style.cssText=h+"width:100%;",(t.mount??e).appendChild(n)):s==="floating"?(n.style.cssText=h+"position:absolute;top:12px;right:12px;z-index:20;box-shadow:0 4px 16px rgba(0,0,0,0.18);",e.appendChild(n)):(n.style.cssText=h+"width:100%;margin-top:8px;",e.appendChild(n)),n.appendChild(o),n.appendChild(l),{panel:n,host:l,badgeBox:o,backdrop:a}}_renderBadges(t,e,s){var l;const i=t.badgeBox;i.innerHTML="";const n=t.model.meta,o=[];n.sampled&&n.sampledFrom&&o.push(`샘플링됨 ${(l=n.sampledTo)==null?void 0:l.toLocaleString()}/${n.sampledFrom.toLocaleString()}행`),n.aggregatedOp&&o.push(`category 집계됨 (${n.aggregatedOp})`),n.pieReducedToFirst&&o.push("파이: 첫 시리즈만 표시"),n.negativesAbsInPie&&o.push("음수→절대값 표시 · bar 권장"),e&&o.push("범위 소스 없음 · 선택 행으로 대체"),s&&o.push(`${s} 미설치 · 내장 차트로 대체`);for(const a of o){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=a,i.appendChild(d)}i.style.display=o.length?"flex":"none",o.length&&this._d.announce(`차트 안내: ${o.join(", ")}`)}_subscribeLive(t){var n;const s=(((n=this._d.getOptions())==null?void 0:n.chart)??{}).debounceMs??fn,i=()=>{t.destroyed||(clearTimeout(t.debounceTimer),t.debounceTimer=setTimeout(()=>{t.destroyed||this._refresh(t)},s))};t.liveHandler=i,this._d.on("dataChange",i),this._d.on("formulaRecalc",i)}_refresh(t){if(t.destroyed)return;const{model:e,rangeFallback:s}=this._extract(t);t.model=e,t.spec=this._buildSpec(t.config,e),t.adapter.render(e,t.spec),this._renderBadges(t,s,null),this._emit(t,"chartRender",{id:t.id,model:e}),this._d.emit("chartRender",{id:t.id,model:e})}_resolveAdapter(t){var s,i;const e=t.engine??((i=(s=this._d.getOptions())==null?void 0:s.chart)==null?void 0:i.defaultEngine)??"builtin";return e&&typeof e=="object"?{adapter:e,engineFallback:null}:e==="chartjs"||e==="echarts"?{adapter:new Ve,engineFallback:e}:{adapter:new Ve,engineFallback:null}}_onPointClick(t,e){this._emit(t,"chartPointClick",{id:t.id,point:e}),this._d.emit("chartPointClick",{id:t.id,point:e})}_makeInstance(t){if(t.instance)return t.instance;const e={id:t.id,update:s=>{t.destroyed||(s&&(t.config={...t.config,...s}),s&&(s.source||s.category||s.series)&&(t.snapshot=this._snapshotRange(t.config)),this._refresh(t))},refresh:()=>this._refresh(t),setType:s=>{t.destroyed||(t.config={...t.config,type:s},this._refresh(t))},destroy:()=>this._destroy(t),toBlob:s=>t.adapter.toBlob?t.adapter.toBlob(s):Promise.resolve(null),getModel:()=>t.model,on:(s,i)=>this._on(t,s,i)};return t.instance=e,e}_bindOptionCallbacks(t){var i;const e=((i=this._d.getOptions())==null?void 0:i.chart)??{},s=this._makeInstance(t);typeof e.onChartCreate=="function"&&e.onChartCreate(s),typeof e.onChartRender=="function"&&this._on(t,"chartRender",e.onChartRender),typeof e.onChartPointClick=="function"&&this._on(t,"chartPointClick",e.onChartPointClick),typeof e.onChartDestroy=="function"&&this._on(t,"chartDestroy",e.onChartDestroy)}_on(t,e,s){const i=t.localEvents.get(e)??[];i.push(s),t.localEvents.set(e,i)}_emit(t,e,...s){for(const i of t.localEvents.get(e)??[])try{i(...s)}catch{}}_destroyById(t){for(const e of this._charts.values())if(e.panel===t){this._destroy(e);return}}_destroy(t){var e;if(!t.destroyed){t.destroyed=!0,t.liveHandler&&(this._d.off("dataChange",t.liveHandler),this._d.off("formulaRecalc",t.liveHandler)),clearTimeout(t.debounceTimer),clearTimeout(t.resizeDebounceTimer);try{(e=t.resizeObserver)==null||e.disconnect()}catch{}try{t.adapter.destroy()}catch{}(t.backdrop??t.panel).remove(),this._emit(t,"chartDestroy",{id:t.id}),this._d.emit("chartDestroy",{id:t.id}),t.localEvents.clear(),this._charts.delete(t.id)}}}class mn{constructor(){this._triggers=new Map}add(t,e){this._triggers.has(t)||this._triggers.set(t,[]),this._triggers.get(t).push(e)}remove(t,e){const s=this._triggers.get(t);if(s){const i=s.indexOf(e);i>=0&&s.splice(i,1)}}clear(t){t?this._triggers.delete(t):this._triggers.clear()}mkCtx(t,e){let s=!1;return{operation:t,args:e,result:void 0,extra:{},timestamp:Date.now(),get cancelled(){return s},cancel(){s=!0}}}exec(t,e){const s=this._triggers.get(t)??[];for(const i of s)if(i(e),e.cancelled)return!1;if(t.startsWith("after:")){const i=this._triggers.get("complete")??[];for(const n of i)n(e)}return!0}}const $t="";function os(r){const t=Object.entries(r).filter(([,e])=>e!==$t).map(([e,s])=>` ${JSON.stringify(e)}: src[${JSON.stringify(s)}],`);return`// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
85
|
+
function mapRow(src) {
|
|
86
|
+
return {
|
|
87
|
+
`+t.join(`
|
|
88
|
+
`)+(t.length?`
|
|
89
|
+
`:"")+` };
|
|
90
|
+
}`}function wn(r){return t=>{const e={};for(const[s,i]of Object.entries(r))i!==$t&&(e[s]=t[i]);return e}}function yn(r,t){if(r.length!==t.length)return!1;const e=new Set(t);return r.every(s=>e.has(s))}function bn(r,t){return new Promise(e=>{const s=new Set(r.map(y=>y.field)),i={};for(const y of t)i[y.field]=s.has(y.field)?y.field:$t;const n=document.createElement("div");n.className="og-mapper-overlay",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","그리드 필드 매핑"),n.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 o=document.createElement("div");o.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;",n.appendChild(o);const l=document.createElement("div");l.style.cssText="padding:18px 20px 8px;",l.innerHTML='<div style="font-size:16px;font-weight:700;">필드 매핑</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. 아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.</div>',o.appendChild(l);const a=document.createElement("div");a.style.cssText="padding:6px 20px;";const d='<option value="">(비움)</option>'+r.map(y=>`<option value="${Ct(y.field)}">${Ct(y.header)} <${Ct(y.field)}></option>`).join("");for(const y of t){const k=document.createElement("div");k.style.cssText="display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";const S=document.createElement("div");S.style.cssText="flex:1;font-size:13px;min-width:0;",S.innerHTML=`<span style="font-weight:600;">${Ct(y.header)}</span><span style="color:#999;font-size:11.5px;"> <${Ct(y.field)}></span>`;const A=document.createElement("span");A.textContent="←",A.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=i[y.field]??$t,P.addEventListener("change",()=>{i[y.field]=P.value,g()}),k.append(S,A,P),a.appendChild(k)}o.appendChild(a);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;">생성된 변환 스크립트</span>';const u=document.createElement("button");u.type="button",u.textContent="복사",u.style.cssText="font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;",h.appendChild(u);const p=document.createElement("pre");p.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,p),o.appendChild(c);function f(){return os(i)}function g(){p.textContent=f()}g(),u.addEventListener("click",()=>{var k;const y=f();(k=navigator.clipboard)==null||k.writeText(y).then(()=>{u.textContent="복사됨!",setTimeout(()=>u.textContent="복사",1200)},()=>{u.textContent="복사 실패",setTimeout(()=>u.textContent="복사",1200)})});const m=document.createElement("div");m.style.cssText="display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";const b=document.createElement("button");b.type="button",b.textContent="취소",b.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="적용 후 이동",_.style.cssText="font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;",m.append(b,_),o.appendChild(m);let w=!1;function x(y){w||(w=!0,document.removeEventListener("keydown",E),n.remove(),e(y))}function E(y){y.key==="Escape"&&x(null)}b.addEventListener("click",()=>x(null)),n.addEventListener("mousedown",y=>{y.target===n&&x(null)}),_.addEventListener("click",()=>x({mapping:{...i},script:f()})),document.addEventListener("keydown",E),document.body.appendChild(n),_.focus()})}function Ct(r){return String(r).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}class vn{constructor(){this._map=new Map}register(t,e){this._map.set(t,e)}unregister(t){this._map.delete(t)}get(t){return this._map.get(t)}get size(){return this._map.size}resolveAt(t,e,s){const i=document.elementFromPoint(t,e),n=i==null?void 0:i.closest(".og-body-wrapper");if(!n)return null;const o=this._map.get(n);return!o||o===s?null:o}}const Lt=new vn;class xn{constructor(t,e){this._originals=new Map,this._hadOwn=new Map,this._stack=new Map,this._strategies=new Map,this._callPath=[],this._host=t,this._strict=(e==null?void 0:e.strict)??!0,this._maxDepth=(e==null?void 0:e.maxDepth)??32}override(t,e,s={}){if(typeof e!="function")throw new TypeError(`OverrideKernel.override: fn for "${t}" must be a function`);if(!this._originals.has(t)){const n=this._host[t];if(typeof n!="function")throw new TypeError(`OverrideKernel.override: host["${t}"] is not a function`);this._hadOwn.set(t,Object.prototype.hasOwnProperty.call(this._host,t)),this._originals.set(t,n.bind(this._host))}const i=this._stack.get(t)??[];return i.push({fn:e,opts:s}),this._stack.set(t,i),this._host[t]=this._buildDispatcher(t),this._host}_buildDispatcher(t){var d;const e=this._originals.get(t),s=this._stack.get(t)??[],i=s.reduce((c,h)=>(...u)=>h.fn(c,...u),e),n=((d=s[s.length-1])==null?void 0:d.opts)??{},o=n.reentrant===!0,l=n.onError==="fallback",a=this;return function(...c){if(!o&&a._callPath.indexOf(t)!==-1)return e(...c);if(a._callPath.length>=a._maxDepth){if(a._strict&&!l)throw new Error(`OverrideKernel: max override depth (${a._maxDepth}) exceeded at "${t}"`);return e(...c)}a._callPath.push(t);try{return i(...c)}catch(h){if(l&&!a._strict)return console.warn(`[og.override:${t}]`,h),e(...c);if(l&&a._strict)return console.warn(`[og.override:${t}]`,h),e(...c);throw h}finally{a._callPath.pop()}}}strategy(t,e){if(typeof e!="function")throw new TypeError(`OverrideKernel.strategy: fn for "${t}" must be a function`);return this._strategies.set(t,e),this._host}getStrategy(t,e){return this._strategies.get(t)??e}hasStrategy(t){return this._strategies.has(t)}restore(t){return this._originals.has(t)?(this._hadOwn.get(t)?this._host[t]=this._originals.get(t):delete this._host[t],this._originals.delete(t),this._hadOwn.delete(t),this._stack.delete(t),this._host):this._host}restoreAll(){for(const t of[...this._originals.keys()])this.restore(t);return this._strategies.clear(),this._callPath=[],this._host}hasOverride(t){return this._originals.has(t)}getOverrideNames(){return[...this._originals.keys()]}}const ue=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function rs(r){const t=r.trim(),e=/^([+-]?)(\d*)(?:\.(\d*))?[eE]([+-]?\d+)$/.exec(t);if(!e)return t;const[,s,i,n="",o]=e,l=i||"0",a=parseInt(o,10);let d=l+n,c=l.length+a;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 Cn(r){const t=r.startsWith("=")?r.slice(1):r,e=new Rn(t),s=e.parseComparison();if(e.skip(),!e.eof())throw new SyntaxError(`FormulaParser: 예상치 못한 토큰 '${e.peekChar()}' (위치 ${e.pos})`);return s}class Rn{constructor(t){this.pos=0,this.src=t}eof(){return this.pos>=this.src.length}peekChar(){return this.src[this.pos]??""}skip(){for(;!this.eof()&&/\s/.test(this.peekChar());)this.pos++}_tryOp(...t){this.skip();for(const e of t.sort((s,i)=>i.length-s.length))if(this.src.startsWith(e,this.pos))return this.pos+=e.length,e;return null}parseComparison(){let t=this.parseConcat();for(;;){const e=this._tryOp("<=",">=","<>","=","<",">");if(!e)break;const s=this.parseConcat();t={t:"bin",op:e,left:t,right:s}}return t}parseConcat(){let t=this.parseAdditive();for(;this._tryOp("&");){const s=this.parseAdditive();t={t:"bin",op:"&",left:t,right:s}}return t}parseAdditive(){let t=this.parseMultiplicative();for(;;){this.skip();const e=this.peekChar();if(e!=="+"&&e!=="-")break;this.pos++;const s=this.parseMultiplicative();t={t:"bin",op:e,left:t,right:s}}return t}parseMultiplicative(){let t=this.parsePower();for(;;){this.skip();const e=this.peekChar();if(e!=="*"&&e!=="/"&&e!=="%")break;this.pos++;const s=this.parsePower();t={t:"bin",op:e,left:t,right:s}}return t}parsePower(){const t=this.parseUnary();if(this.skip(),this.peekChar()==="^"){this.pos++;const e=this.parsePower();return{t:"bin",op:"^",left:t,right:e}}return t}parseUnary(){this.skip();const t=this.peekChar();return t==="-"||t==="+"?(this.pos++,{t:"unary",op:t,arg:this.parseUnary()}):this.parsePrimary()}parsePrimary(){this.skip();const t=this.peekChar();if(t==="("){this.pos++;const e=this.parseComparison();if(this.skip(),this.peekChar()!==")")throw new SyntaxError("FormulaParser: 닫는 괄호 ) 누락");return this.pos++,e}if(t==="[")return this._fieldRef();if(t==='"')return this._stringLit();if(/[A-Za-z$]/.test(t))return this._identifierLike();if(/[0-9.]/.test(t))return this._number();throw new SyntaxError(`FormulaParser: 예상치 못한 문자 '${t||"EOF"}' (위치 ${this.pos})`)}_fieldRef(){this.pos++;const t=this.pos;for(;!this.eof()&&this.peekChar()!=="]";)this.pos++;if(this.eof())throw new SyntaxError("FormulaParser: 닫는 ] 누락");const e=this.src.slice(t,this.pos);return this.pos++,{t:"field",field:e}}_stringLit(){this.pos++;let t="";for(;!this.eof();){const e=this.peekChar();if(e==='"'){if(this.src[this.pos+1]==='"'){t+='"',this.pos+=2;continue}return this.pos++,{t:"str",v:t}}t+=e,this.pos++}throw new SyntaxError('FormulaParser: 닫는 " 누락')}_identifierLike(){const t=this.pos;let e=!1;this.peekChar()==="$"&&(e=!0,this.pos++);const s=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const i=this.src.slice(s,this.pos);if(!i)throw new SyntaxError(`FormulaParser: 식별자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${t})`);if(!e){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: 함수 '${i}' 닫는 ) 누락`);return this.pos++,{t:"call",name:i.toUpperCase(),args:c}}const d=i.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 n=!1;this.peekChar()==="$"&&(n=!0,this.pos++);const o=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===o){if(e||n)throw new SyntaxError(`FormulaParser: 셀참조 행번호 누락 (위치 ${this.pos})`);return{t:"error",code:"#NAME"}}const l=parseInt(this.src.slice(o,this.pos),10),a={t:"rawRef",colLetters:i.toUpperCase(),row:l,dollarCol:e,dollarRow:n};return this._maybeRange(a)}_maybeRange(t){const e=this.pos;if(this.skip(),this.peekChar()===":"){this.pos++,this.skip();let s=!1,i=!1;this.peekChar()==="$"&&(s=!0,this.pos++);const n=this.pos;for(;!this.eof()&&/[A-Za-z]/.test(this.peekChar());)this.pos++;const o=this.src.slice(n,this.pos).toUpperCase();if(!o)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 열문자 누락 (위치 ${this.pos})`);this.peekChar()==="$"&&(i=!0,this.pos++);const l=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;if(this.pos===l)throw new SyntaxError(`FormulaParser: 범위 두번째 코너 행번호 누락 (위치 ${this.pos})`);const a=parseInt(this.src.slice(l,this.pos),10);return{t:"rawRange",a:t,b:{t:"rawRef",colLetters:o,row:a,dollarCol:s,dollarRow:i}}}return this.pos=e,t}_number(){const t=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 i=this.pos;for(;!this.eof()&&/[0-9]/.test(this.peekChar());)this.pos++;this.pos===i&&(this.pos=s)}const e=this.src.slice(t,this.pos);if(!e||e===".")throw new SyntaxError(`FormulaParser: 숫자를 기대했지만 '${this.peekChar()||"EOF"}' (위치 ${t})`);return{t:"num",v:rs(e)}}}function Mn(r){let t=0;for(const e of r.toUpperCase())t=t*26+(e.charCodeAt(0)-64);return t-1}function En(r){let t=r+1,e="";for(;t>0;){const s=(t-1)%26;e=String.fromCharCode(65+s)+e,t=Math.floor((t-1)/26)}return e||"A"}function se(r,t){const{accessor:e,host:s,refMode:i}=t,n=Mn(r.colLetters),l=e.visibleFields()[n];if(l===void 0)return null;const a=r.row-1,d=e.rowIdAtFlat(a);if(d===null)return null;if(i==="relative"&&!r.dollarRow){const c=e.flatIndexOfRowId(s.rowId);return{kind:"rel",dRow:c===-1?0:a-c,field:l,dollarRow:r.dollarRow,dollarCol:r.dollarCol}}return{kind:"abs",rowId:d,field:l,dollarRow:r.dollarRow,dollarCol:r.dollarCol}}function kn(r,t,e,s="stable"){const i={host:t,accessor:e,refMode:s};function n(o){switch(o.t){case"rawRef":{const l=se(o,i);return l?{t:"ref",ref:l}:{t:"error",code:"#REF"}}case"rawRange":{const l=se(o.a,i),a=se(o.b,i);return!l||!a?{t:"error",code:"#REF"}:{t:"range",ref:{a:l,b:a}}}case"call":return{t:"call",name:o.name,args:o.args.map(n)};case"unary":return{t:"unary",op:o.op,arg:n(o.arg)};case"bin":return{t:"bin",op:o.op,left:n(o.left),right:n(o.right)};default:return o}}return n(r)}function Rt(r){switch(r.t){case"range":return!0;case"call":return r.args.some(Rt);case"unary":return Rt(r.arg);case"bin":return Rt(r.left)||Rt(r.right);default:return!1}}class $ extends Error{constructor(t){super(t),this.code=t}}function We(r,t,e,s={}){const i=new Set,n={v:!1},o=s.divisionPrecision??30;try{return{value:H(r,t,e,i,n,o),error:null,approx:n.v,touched:i}}catch(l){const a=l instanceof $?l.code:"#ERR";return{value:a,error:a,approx:n.v,touched:i}}}function de(r,t,e){if(r.kind==="abs")return r.rowId;const s=e.flatIndexOfRowId(t.rowId);return s===-1?null:e.rowIdAtFlat(s+r.dRow)}function Fn(r,t,e,s){const i=de(r,t,e);if(i===null||!e.hasRow(i))throw new $("#REF");if(!e.hasField(r.field))throw new $("#REF");s.add(X(i,r.field));const n=e.getCellValue(i,r.field),o=Ot(n);if(o)throw new $(o);return n}function Sn(r,t,e,s){const i=de(r.a,t,e),n=de(r.b,t,e);if(i===null||n===null||!e.hasRow(i)||!e.hasRow(n))throw new $("#REF");if(!e.hasField(r.a.field)||!e.hasField(r.b.field))throw new $("#REF");const o=e.displayedRowIds(),l=o.indexOf(i),a=o.indexOf(n);if(l===-1||a===-1)throw new $("#REF");const d=Math.min(l,a),c=Math.max(l,a),h=o.slice(d,c+1),u=e.visibleFields(),p=u.indexOf(r.a.field),f=u.indexOf(r.b.field),[g,m]=p===-1||f===-1?[null,null]:[Math.min(p,f),Math.max(p,f)],b=[];for(const _ of h){if(g===null||m===null){s.add(X(_,r.a.field)),b.push(e.getCellValue(_,r.a.field));continue}for(let w=g;w<=m;w++){const x=u[w];s.add(X(_,x)),b.push(e.getCellValue(_,x))}}return b}function O(r){if(r==null||r==="")return v.zero();if(r instanceof v)return r;if(typeof r=="boolean")return v.from(r?"1":"0");if(typeof r=="number")return v.from(r);if(typeof r=="string"){const t=r.trim();if(!ue.test(t))throw new $("#VALUE");return v.from(rs(t))}throw new $("#VALUE")}function Ft(r){return r==null?"":r instanceof v?r.toString():typeof r=="boolean"?r?"TRUE":"FALSE":String(r)}function Tt(r){return typeof r=="boolean"?r:r instanceof v?!r.isZero():typeof r=="number"?r!==0:typeof r=="string"?r.trim().toUpperCase()==="TRUE"||ue.test(r.trim())&&r.trim()!=="0":!1}function In(r){return r<=0?v.from("1"):v.from("0."+"0".repeat(r-1)+"1")}function ls(r,t,e){const s=Math.max(t,0),i=r.toFixed(s+20),n=i.startsWith("-"),o=n?i.slice(1):i,[l,a=""]=o.split("."),d=a.slice(0,s),c=a.slice(s),h=/[1-9]/.test(c),u=(n?"-":"")+l+(s>0?"."+d:"");let p=v.from(u);if(h&&e==="up"){const f=In(s);p=n?p.sub(f):p.add(f)}return p}function as(r){const t=ls(r,0,"down");return r.isNeg()&&!r.eq(t)?t.sub("1"):t}function Ln(r,t){return v.from(r.toFixed(Math.max(t,0)))}function ds(r,t,e,s){const i=as(t);if(t.eq(i)){const n=Number(i.toFixed(0));if(!Number.isFinite(n)||Math.abs(n)>1e5)return s.v=!0,v.from(String(Math.pow(r.toNumber(),t.toNumber())));if(n===0)return v.one();let o=v.one();for(let l=0;l<Math.abs(n);l++)o=o.mul(r);if(n<0){if(o.isZero())throw new $("#DIV0");o=v.one().div(o,e)}return o}return s.v=!0,v.from(String(Math.pow(r.toNumber(),t.toNumber())))}function Tn(r,t,e,s,i){switch(r){case"+":return O(t).add(O(e));case"-":return O(t).sub(O(e));case"*":return O(t).mul(O(e));case"/":{const n=O(e);if(n.isZero())throw new $("#DIV0");return O(t).div(n,s)}case"%":{const n=O(e);if(n.isZero())throw new $("#DIV0");return O(t).mod(n)}case"^":return ds(O(t),O(e),s,i);case"&":return Ft(t)+Ft(e);case"=":case"<>":{const n=Dn(t,e);return r==="="?n:!n}case"<":case"<=":case">":case">=":{const n=O(t),o=O(e);return r==="<"?n.lt(o):r==="<="?n.lte(o):r===">"?n.gt(o):n.gte(o)}default:throw new $("#ERR")}}function Dn(r,t){try{return O(r).eq(O(t))}catch{return Ft(r)===Ft(t)}}function An(r,t){return r.t==="range"?Sn(r.ref,t.host,t.accessor,t.touched):[H(r,t.host,t.accessor,t.touched,t.approxBox,t.prec)]}function bt(r,t){const e=[];for(const s of r)for(const i of An(s,t))Ot(i)||e.push(i);return e}function ie(r){return r==null||r===""?!1:r instanceof v||typeof r=="number"?!0:typeof r=="string"?ue.test(r.trim()):!1}function $n(r,t,e){switch(r){case"SUM":{const s=bt(t,e);return v.sum(s.map(i=>O(i)))}case"AVG":case"AVERAGE":{const i=bt(t,e).filter(n=>n!=null&&n!=="").map(n=>O(n));if(i.length===0)throw new $("#ERR");return v.avg(i,e.prec)}case"MIN":{const s=bt(t,e).filter(ie);if(s.length===0)throw new $("#ERR");return v.min(s.map(i=>O(i)))}case"MAX":{const s=bt(t,e).filter(ie);if(s.length===0)throw new $("#ERR");return v.max(s.map(i=>O(i)))}case"COUNT":{const s=bt(t,e);return v.from(String(s.filter(ie).length))}case"COUNTA":{const s=bt(t,e);return v.from(String(s.filter(i=>i!=null&&i!=="").length))}case"IF":{if(t.length<2)throw new $("#ERR");const s=H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec);return Tt(s)?H(t[1],e.host,e.accessor,e.touched,e.approxBox,e.prec):t.length>2?H(t[2],e.host,e.accessor,e.touched,e.approxBox,e.prec):!1}case"AND":return t.every(s=>Tt(H(s,e.host,e.accessor,e.touched,e.approxBox,e.prec)));case"OR":return t.some(s=>Tt(H(s,e.host,e.accessor,e.touched,e.approxBox,e.prec)));case"NOT":if(t.length!==1)throw new $("#ERR");return!Tt(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec));case"ROUND":{if(t.length!==2)throw new $("#ERR");const s=O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)),i=Number(O(H(t[1],e.host,e.accessor,e.touched,e.approxBox,e.prec)).toFixed(0));return Ln(s,i)}case"ROUNDUP":case"ROUNDDOWN":{if(t.length!==2)throw new $("#ERR");const s=O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)),i=Number(O(H(t[1],e.host,e.accessor,e.touched,e.approxBox,e.prec)).toFixed(0));return ls(s,i,r==="ROUNDUP"?"up":"down")}case"ABS":{if(t.length!==1)throw new $("#ERR");return O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)).abs()}case"INT":{if(t.length!==1)throw new $("#ERR");return as(O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)))}case"MOD":{if(t.length!==2)throw new $("#ERR");const s=O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)),i=O(H(t[1],e.host,e.accessor,e.touched,e.approxBox,e.prec));if(i.isZero())throw new $("#DIV0");return s.mod(i)}case"POWER":{if(t.length!==2)throw new $("#ERR");const s=O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec)),i=O(H(t[1],e.host,e.accessor,e.touched,e.approxBox,e.prec));return ds(s,i,e.prec,e.approxBox)}case"SQRT":{if(t.length!==1)throw new $("#ERR");const s=O(H(t[0],e.host,e.accessor,e.touched,e.approxBox,e.prec));if(s.isNeg())throw new $("#NUM");return e.approxBox.v=!0,v.from(String(Math.sqrt(s.toNumber())))}case"CONCAT":return t.map(s=>Ft(H(s,e.host,e.accessor,e.touched,e.approxBox,e.prec))).join("");default:throw new $("#NAME")}}function H(r,t,e,s,i,n){switch(r.t){case"num":return v.from(r.v);case"str":return r.v;case"bool":return r.v;case"error":throw new $(r.code);case"field":{if(!e.hasField(r.field))throw new $("#REF");s.add(X(t.rowId,r.field));const o=e.getCellValue(t.rowId,r.field),l=Ot(o);if(l)throw new $(l);return Ke(o)}case"ref":{const o=Fn(r.ref,t,e,s);return Ke(o)}case"range":throw new $("#VALUE");case"call":return $n(r.name,r.args,{host:t,accessor:e,touched:s,prec:n,approxBox:i});case"unary":{const o=O(H(r.arg,t,e,s,i,n));return r.op==="-"?o.neg():o}case"bin":return Tn(r.op,H(r.left,t,e,s,i,n),H(r.right,t,e,s,i,n),n,i);default:throw new $("#ERR")}}function Ke(r){return r==null?null:r instanceof v||typeof r=="string"||typeof r=="boolean"?r:typeof r=="number"?v.from(r):String(r)}class On{constructor(){this._cells=new Map}setFormula(t,e,s){this._cells.set(X(t,e),s)}getFormula(t,e){return this._cells.get(X(t,e))}clearFormula(t,e){this._cells.delete(X(t,e))}hasFormula(t,e){return this._cells.has(X(t,e))}getFormulaByKey(t){return this._cells.get(t)}getAllFormulaCells(){const t=[];for(const[e,s]of this._cells){const i=e.indexOf(":");t.push({rowId:e.slice(0,i),field:e.slice(i+1),cell:s})}return t}getRangeBearingKeys(){const t=[];for(const[e,s]of this._cells)s.hasRangeRef&&t.push(e);return t}size(){return this._cells.size}}class Bn{constructor(){this._precedents=new Map,this._dependents=new Map,this._byRowId=new Map,this._byField=new Map}_addEdge(t,e){let s=this._dependents.get(t);s||(s=new Set,this._dependents.set(t,s)),s.add(e);const{rowId:i,field:n}=mt(t);let o=this._byRowId.get(i);o||(o=new Set,this._byRowId.set(i,o)),o.add(e);let l=this._byField.get(n);l||(l=new Set,this._byField.set(n,l)),l.add(e)}_removeEdgesFrom(t){const e=this._precedents.get(t);if(e)for(const s of e){const i=this._dependents.get(s);i&&(i.delete(t),i.size===0&&this._dependents.delete(s));const{rowId:n,field:o}=mt(s),l=this._byRowId.get(n);l&&(l.delete(t),l.size===0&&this._byRowId.delete(n));const a=this._byField.get(o);a&&(a.delete(t),a.size===0&&this._byField.delete(o))}}addFormula(t,e){this._removeEdgesFrom(t),this._precedents.set(t,new Set(e));for(const s of e)this._addEdge(s,t)}removeFormula(t){this._removeEdgesFrom(t),this._precedents.delete(t)}isFormula(t){return this._precedents.has(t)}getPrecedents(t){return[...this._precedents.get(t)??[]]}getDependents(t){return[...this._dependents.get(t)??[]]}getDependentsClosure(t){const e=new Set;for(const n of t)this.isFormula(n)&&e.add(n);const s=[...t];let i=0;for(;i<s.length;){const n=s[i++],o=this._dependents.get(n);if(o)for(const l of o)e.has(l)||(e.add(l),s.push(l))}return[...e]}topoOrder(t){const e=new Set(t),s=new Map;for(const d of t){const c=this._precedents.get(d);let h=0;if(c)for(const u of c)e.has(u)&&h++;s.set(d,h)}const i=[];for(const[d,c]of s)c===0&&i.push(d);let n=0;const o=[];for(;n<i.length;){const d=i[n++];o.push(d);const c=this._dependents.get(d);if(c)for(const h of c){if(!e.has(h))continue;const u=(s.get(h)??0)-1;s.set(h,u),u===0&&i.push(h)}}const l=new Set(o),a=t.filter(d=>!l.has(d));return{order:o,cycles:a}}formulasReferencing(t,e){return e!==void 0?[...this._dependents.get(X(t,e))??[]]:[...this._byRowId.get(t)??[]]}formulasReferencingField(t){return[...this._byField.get(t)??[]]}allFormulaKeys(){return[...this._precedents.keys()]}}function ne(r,t,e){let s;if(r.kind==="abs")s=r.rowId;else{const a=e.flatIndexOfRowId(t.rowId);s=a===-1?null:e.rowIdAtFlat(a+r.dRow)}if(s===null||!e.hasRow(s)||!e.hasField(r.field))return"#REF!";const i=e.flatIndexOfRowId(s),n=e.visibleFields().indexOf(r.field);if(i===-1||n===-1)return"#REF!";const o=(r.dollarCol?"$":"")+En(n),l=(r.dollarRow?"$":"")+(i+1);return o+l}function zn(r){return'"'+r.replace(/"/g,'""')+'"'}const Nn={"+":"+","-":"-","*":"*","/":"/","%":"%","^":"^","&":"&","=":"=","<>":"<>","<":"<","<=":"<=",">":">",">=":">="};function Pn(r,t,e){return"="+Mt(r,t,e)}function Mt(r,t,e){switch(r.t){case"num":return r.v;case"str":return zn(r.v);case"bool":return r.v?"TRUE":"FALSE";case"field":return`[${r.field}]`;case"error":return"#REF!";case"ref":return ne(r.ref,t,e);case"range":return`${ne(r.ref.a,t,e)}:${ne(r.ref.b,t,e)}`;case"call":return`${r.name}(${r.args.map(s=>Mt(s,t,e)).join(",")})`;case"unary":return`${r.op}${Mt(r.arg,t,e)}`;case"bin":return`(${Mt(r.left,t,e)}${Nn[r.op]}${Mt(r.right,t,e)})`;default:return"#REF!"}}class Ue{constructor(t){this.store=new On,this.graph=new Bn,this._accessor=t.accessor,this._setComputedValue=t.setComputedValue,this._onFormulaError=t.onFormulaError,this._refMode=t.refMode??"stable",this._prec=t.divisionPrecision??30}compile(t,e){let s;try{s=Cn(t)}catch{s={t:"error",code:"#ERR"}}const i=kn(s,e,this._accessor,this._refMode);return{ast:i,hasRangeRef:Rt(i)}}setCellFormula(t,e,s){const i={rowId:t,field:e},{ast:n,hasRangeRef:o}=this.compile(s,i),l={src:s,ast:n,hasRangeRef:o,value:null,error:null};this.store.setFormula(t,e,l);const a=X(t,e),d=We(n,i,this._accessor,{divisionPrecision:this._prec});return this.graph.addFormula(a,d.touched),this.onValuesChanged([a])}getCellFormula(t,e){var s;return((s=this.store.getFormula(t,e))==null?void 0:s.src)??null}hasCellFormula(t,e){return this.store.hasFormula(t,e)}clearCellFormula(t,e){const s=X(t,e),i=this.graph.getDependents(s);return this.store.clearFormula(t,e),this.graph.removeFormula(s),i}getCellError(t,e){var s;return((s=this.store.getFormula(t,e))==null?void 0:s.error)??null}getDependents(t,e){return this.graph.getDependents(X(t,e)).map(mt)}onValuesChanged(t){var o;const e=Dt(),s=this.graph.getDependentsClosure(t),{order:i,cycles:n}=this.graph.topoOrder(s);for(const l of n){const{rowId:a,field:d}=mt(l),c=this.store.getFormula(a,d);c&&(c.value="#CYCLE",c.error="#CYCLE"),this._setComputedValue(a,d,"#CYCLE"),(o=this._onFormulaError)==null||o.call(this,a,d,"#CYCLE")}for(const l of i)this._evaluateOne(l);return{changed:[...i,...n],cycles:n.length,ms:Dt()-e}}_evaluateOne(t){var o;const{rowId:e,field:s}=mt(t),i=this.store.getFormula(e,s);if(!i)return;const n=We(i.ast,{rowId:e,field:s},this._accessor,{divisionPrecision:this._prec});this.graph.addFormula(t,n.touched),i.value=n.value,i.error=n.error,i.approx=n.approx,this._setComputedValue(e,s,n.value),n.error&&((o=this._onFormulaError)==null||o.call(this,e,s,n.error))}recalculateAll(){var n;const t=Dt(),e=this.graph.allFormulaKeys(),{order:s,cycles:i}=this.graph.topoOrder(e);for(const o of i){const{rowId:l,field:a}=mt(o),d=this.store.getFormula(l,a);d&&(d.value="#CYCLE",d.error="#CYCLE"),this._setComputedValue(l,a,"#CYCLE"),(n=this._onFormulaError)==null||n.call(this,l,a,"#CYCLE")}for(const o of s)this._evaluateOne(o);return{changed:[...s,...i],cycles:i.length,ms:Dt()-t}}recalcRangeBearing(){return this.onValuesChanged(this.store.getRangeBearingKeys())}invalidateRow(t){return this.onValuesChanged(this.graph.formulasReferencing(t))}invalidateField(t){return this.onValuesChanged(this.graph.formulasReferencingField(t))}offsetFormula(t,e,s,i){const n=this.store.getFormula(t,e);if(!n)return"";const o=(()=>{const a=this._accessor.flatIndexOfRowId(t);return a===-1?t:this._accessor.rowIdAtFlat(a+s)??t})();(()=>{const a=this._accessor.visibleFields(),d=a.indexOf(e);return d===-1?e:a[d+i]??e})();const l=this._shiftAst(n.ast,s,i);return Pn(l,{rowId:o},this._accessor)}_shiftAst(t,e,s){const i=o=>{if(o.kind==="rel")return{...o,dRow:o.dollarRow?o.dRow:o.dRow+e};let l=o.field;if(!o.dollarCol&&s!==0){const d=this._accessor.visibleFields(),c=d.indexOf(o.field),h=c===-1?void 0:d[c+s];if(!h)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:o.dollarRow,dollarCol:o.dollarCol};l=h}let a=o.rowId;if(!o.dollarRow&&e!==0){const d=this._accessor.flatIndexOfRowId(o.rowId),c=d===-1?null:this._accessor.rowIdAtFlat(d+e);if(c===null)return{kind:"abs",rowId:"__dead__",field:"__dead__",dollarRow:o.dollarRow,dollarCol:o.dollarCol};a=c}return{kind:"abs",rowId:a,field:l,dollarRow:o.dollarRow,dollarCol:o.dollarCol}},n=o=>{switch(o.t){case"ref":{const l=i(o.ref);return l.kind==="abs"&&l.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"ref",ref:l}}case"range":{const l=i(o.ref.a),a=i(o.ref.b);return l.kind==="abs"&&l.rowId==="__dead__"||a.kind==="abs"&&a.rowId==="__dead__"?{t:"error",code:"#REF"}:{t:"range",ref:{a:l,b:a}}}case"call":return{t:"call",name:o.name,args:o.args.map(n)};case"unary":return{t:"unary",op:o.op,arg:n(o.arg)};case"bin":return{t:"bin",op:o.op,left:n(o.left),right:n(o.right)};default:return o}};return n(t)}}function Dt(){return typeof performance<"u"?performance.now():Date.now()}const Hn=500,vt="_ogRowId",ot=class ot extends us{constructor(t,e){var n,o,l;super(),this._vs=null,this._ro=null,this._renderer=null,this._trigMgr=new mn,this._destroyed=!1,this._autoHeightWarned=!1,this._colWidths=[],this._userWidths=new Map,this._filterPanel=null,this._filterSelect=null,this._pagination=null,this._dnd=null,this._mergeEngine=new _t,this._liveRegion=null,this._ctxMenu=null,this._cmHandler=null,this._cmKbdHandler=null,this._wsManager=null,this._formulaDirtySeeds=new Set,this._batchDepth=0,this._batchDirty=!1;const s=typeof t=="string"?document.querySelector(t):t;if(!s)throw new Error(`OpenGrid: container not found: ${t}`);this._container=s,this._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",cssVars:{},ariaLabel:"OPEN_GRID 데이터 그리드",...e},this._data=new ps(vt),this._flatModel=new Mi({getDataLayer:()=>this._data,rowIdField:vt}),this._rowMgr=new ri(this._data),this._colLayout=new me(this._options.columns,this._options.frozenColumns),this._recalc=new Ue({accessor:this._buildFormulaAccessor(),setComputedValue:(a,d,c)=>this._data.setComputedValueByRowId(a,d,c),onFormulaError:(a,d,c)=>this._handleFormulaError(a,d,c),refMode:((n=this._options.formula)==null?void 0:n.refMode)??"stable",divisionPrecision:((o=this._options.formula)==null?void 0:o.divisionPrecision)??30}),this._editMgr=new li({data:this._data,colLayout:this._colLayout,getRenderer:()=>this._renderer,getContainer:()=>this._container,getOptions:()=>this._options,emit:(a,...d)=>this.emit(a,...d),doRender:()=>this._doRender(...this._visRange()),announce:a=>this._announce(a),writeCell:(a,d,c)=>this.writeCell(a,d,c),scrollToRow:a=>{var d;return(d=this._vs)==null?void 0:d.scrollToRow(a)},getVisibleLeaves:()=>this._colLayout.visibleLeaves,hasCellFormula:(a,d)=>this.hasCellFormula(a,d),getCellFormula:(a,d)=>this.getCellFormula(a,d),setCellFormula:(a,d,c)=>this.setCellFormula(a,d,c),clearCellFormula:(a,d)=>this.clearCellFormula(a,d)}),this._exportMgr=new gi({getData:()=>this._data.getData(),getColLayout:()=>this._colLayout,getColWidths:()=>this._colWidths,getOptions:()=>this._options,getContainer:()=>this._container,getMaskEnabled:a=>this.getMaskEnabled(a),getWsManager:()=>this._wsManager,getStrategy:(a,d)=>this._ovk.getStrategy(a,d)}),this._footerMgr=new mi({getData:()=>this._data.getData(),getColLayout:()=>this._colLayout,getColWidths:()=>this._colWidths,getOptions:()=>this._options,getContainer:()=>this._container,getStrategy:(a,d)=>this._ovk.getStrategy(a,d)}),this._kbdMgr=new wi({getEditMgr:()=>this._editMgr,getRowMgr:()=>this._rowMgr,getData:()=>this._data,getColLayout:()=>this._colLayout,getOptions:()=>this._options,setFocusCell:(a,d)=>this._setFocusCell(a,d),handleRowDrop:(a,d)=>this._handleRowDrop(a,d),doRender:()=>this._doRender(...this._visRange()),announce:a=>this._announce(a),emit:(a,...d)=>this.emit(a,...d),visRange:()=>this._visRange(),handleCellKeyEvt:(a,d)=>this._handleCellKeyEvt(a,d),writeCells:a=>this.writeCells(a),getRangeHooks:()=>this._rangeMgr}),this._sfMgr=new Ei({getData:()=>this._data,getColLayout:()=>this._colLayout,getFindFilter:()=>this._findMgr.findFilter,getVs:()=>this._vs,getPagination:()=>this._pagination,getOptions:()=>this._options,renderHeader:()=>this._renderHeader(),doRender:()=>this._doRender(...this._visRange()),announce:a=>this._announce(a),emit:(a,...d)=>this.emit(a,...d),onReproject:()=>this._rangeMgr.reproject()}),this._findMgr=new yi({getColLayout:()=>this._colLayout,getData:()=>this._data,getFilters:()=>this._sfMgr.filters,getVs:()=>this._vs,getPagination:()=>this._pagination,doRender:()=>this._doRender(...this._visRange())}),this._cellEvt=new ki({getData:()=>this._data,getColLayout:()=>this._colLayout,getOptions:()=>this._options,getEditMgr:()=>this._editMgr,getRowMgr:()=>this._rowMgr,emit:(a,...d)=>this.emit(a,...d),writeCell:(a,d,c)=>this.writeCell(a,d,c),doRender:()=>this._doRender(...this._visRange()),getContainer:()=>this._container,onCellsClick:(a,d,c)=>this._rangeMgr.handleClick(a,d,c),rangeMouseDown:(a,d,c)=>this._rangeMgr.handleCellMouseDown(a,d,c),rangeMouseMove:(a,d,c)=>this._rangeMgr.handleCellMouseMove(a,d,c),rangeMouseUp:(a,d,c)=>this._rangeMgr.handleCellMouseUp(a,d,c)}),this._rangeMgr=new Wi({getOptions:()=>this._options,getData:()=>this._data,getColLayout:()=>this._colLayout,getFlatModel:()=>this._flatModel,getRenderer:()=>this._renderer,getEditMgr:()=>this._editMgr,setFocusCell:(a,d)=>this._setFocusCell(a,d),writeCells:a=>this.writeCells(a),getDisplayValue:(a,d)=>this.getDisplayValue(a,d),emit:(a,...d)=>this.emit(a,...d),doRender:()=>this._doRender(...this._visRange()),announce:a=>this._announce(a),hasCellFormula:(a,d)=>this._recalc.hasCellFormula(a,d),offsetFormula:(a,d,c,h)=>this._recalc.offsetFormula(a,d,c,h),setCellFormulaByRowId:(a,d,c)=>this._setCellFormulaByRowId(a,d,c)}),this._grpMgr=new Ri({getData:()=>this._data.getData(),getDataLayer:()=>this._data,getOptions:()=>this._options,getVs:()=>this._vs,doRenderFull:a=>this._doRender(0,a-1),doRender:()=>this._doRender(...this._visRange()),getStrategy:(a,d)=>this._ovk.getStrategy(a,d),setFlatBacking:a=>this._flatModel.setBacking(a),getFlatCount:()=>this._flatModel.count()}),this._detailMgr=new ei({getOptions:()=>this._options,getFlatModel:()=>this._flatModel,getVs:()=>this._vs,getRowId:a=>a[vt],getRowById:a=>this._data.getRowById(a),doRenderFull:a=>this._doRender(0,a-1),emit:(a,d)=>this.emit(a,d),announce:a=>this._announce(a),getDepth:()=>this._options._detailDepth??0,getGridInstance:()=>this,createSubgrid:(a,d,c)=>new ot(a,{...d,_detailDepth:c})}),this._chartMgr=new _n({getContainer:()=>this._container,getOptions:()=>this._options,getAllRows:()=>this._data.getData(),getSelectedRows:()=>this._rowMgr.getSelections(),getCheckedRows:()=>this._rowMgr.getChecked().map(a=>a.row),getVisibleColumns:()=>this._colLayout.visibleLeaves.map(a=>({field:a.field,header:a.header,type:a.type})),getFlatModel:()=>this._flatModel,getRowById:a=>this._data.getRowById(a),getActiveRange:()=>this._rangeMgr.getActiveRange(),on:(a,d)=>{this.on(a,d)},off:(a,d)=>{this.off(a,d)},emit:(a,...d)=>this.emit(a,...d),announce:a=>this._announce(a)}),this._ovk=new xn(this,{strict:this._options.overrideStrict??!0}),this._data.setStrategyResolver((a,d)=>this._ovk.getStrategy(a,d)),Fs((a,d,c)=>{var h;return((h=this._ovk.getStrategy("displayFormatter",null))==null?void 0:h(a,d,c))??null}),this._mount(),this._bindOptionEvents(),(l=this._options.defaultSort)!=null&&l.length&&this._sfMgr.initSort(this._options.defaultSort),this.override=Object.assign((a,d,c)=>this._ovk.override(a,d,c),{strategy:(a,d)=>this._ovk.strategy(a,d)});const i=this.destroy.bind(this);this.destroy=()=>{try{i()}finally{this._ovk.restoreAll()}};for(const[a,d]of ot._defaultStrategies)this._ovk.strategy(a,d);for(const[a,d,c]of ot._defaultOverrides)this._ovk.override(a,d,c);requestAnimationFrame(()=>{var a,d;this.emit("ready",this),(d=(a=this._options).onReady)==null||d.call(a,this)})}static defaultOverride(t,e,s={}){return ot._defaultOverrides.push([t,e,s]),ot}restore(t){return this._ovk.restore(t),this}restoreAll(){return this._ovk.restoreAll(),this}hasOverride(t){return this._ovk.hasOverride(t)}getOverrideNames(){return this._ovk.getOverrideNames()}getStrategy(t,e){return this._ovk.getStrategy(t,e)}_mount(){var s,i;this._container.classList.add("og-container");const t=this._options.height,e=this._options.width;this._container.style.height=typeof t=="number"?`${t}px`:String(t),this._container.style.width=typeof e=="number"?`${e}px`:String(e),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);for(const[n,o]of Object.entries(this._options.cssVars))this._container.style.setProperty(n,o);this._renderer=new Ks(this._container,this._options,{onHeaderClick:(n,o)=>this._handleSortClick(n,o),onCellClick:(n,o,l)=>this._handleCellClick(n,o,l),onCellDblClick:(n,o,l)=>this._handleCellDblClick(n,o,l),onCellMouseOver:(n,o,l)=>this._handleCellMouseOver(n,o,l),onCellMouseOut:(n,o,l)=>this._handleCellMouseOut(n,o,l),onCellMouseDown:(n,o,l)=>this._handleCellMouseDown(n,o,l),onCellMouseUp:(n,o,l)=>this._handleCellMouseUp(n,o,l),onCellMouseMove:(n,o,l)=>this._handleCellMouseMove(n,o,l),onRowCheck:(n,o)=>this._handleRowCheck(n,o),onAllCheck:n=>this._handleAllCheck(n),onColResize:(n,o)=>this._handleColResize(n,o),onFilterIconClick:(n,o)=>this._handleFilterIconClick(n,o),getDndManager:()=>this._dnd,onColDragStart:n=>{this._editMgr.dragColIdx=n},onColDrop:n=>{this._editMgr.dragColIdx!==null&&this._editMgr.dragColIdx!==n&&this._reorderColumn(this._editMgr.dragColIdx,n),this._editMgr.dragColIdx=null},getColDragIdx:()=>this._editMgr.dragColIdx,getDisplayText:(n,o)=>this.hasOverride("getDisplayValue")||this._ovk.hasStrategy("displayFormatter")?this.getDisplayValue(n,o):null,getFormulaMeta:(n,o)=>this._getFormulaMeta(n,o)}),this._rangeMgr.mount(this._renderer.bodyWrapper),this._filterPanel=new ms(this._container,(n,o)=>this.setFilter(n,o),n=>this.resetFilter(n)),this._container.setAttribute("role","grid"),this._container.setAttribute("aria-label",this._options.ariaLabel??((s=this._options.cssVars)==null?void 0:s["aria-label"])??"OPEN_GRID 데이터 그리드"),this._container.setAttribute("aria-rowcount","0"),this._container.setAttribute("aria-colcount",String(this._options.columns.filter(n=>!n.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",n=>this._handleKeyDown(n)),this._container.addEventListener("keyup",n=>this._handleCellKeyEvt("cellKeyUp",n)),this._container.addEventListener("keypress",n=>this._handleCellKeyEvt("cellKeyPress",n)),this._vs=new _s(this._renderer.bodyWrapper,{rowHeight:this._options.rowHeight,onRender:(n,o)=>this._doRender(n,o)}),Lt.register(this._renderer.bodyWrapper,this),this._options.draggable&&(this._dnd=new ui(this._renderer.bodyWrapper,this._options.rowHeight,(n,o)=>this._handleRowDrop(n,o),this._options.crossGrid?{resolveTarget:(n,o)=>{const l=Lt.resolveAt(n,o,this);return!l||!l._options.crossGrid?null:{bodyEl:l._crossBodyEl(),rowHeight:l._options.rowHeight,totalRows:l._data.rowCount}},onCrossDrop:(n,o,l)=>this._handleCrossGridDrop(n,o,l)}:void 0,n=>this._dragRowSet(n).length)),this._options.pagination&&(this._pagination=new di(this._container,this._options.pageSize,n=>{this.emit("pageChange",n),this._doRender(...this._visRange())})),this._findMgr.init(this._container),this._initContextMenu(),(i=this._options.worksheets)!=null&&i.length&&this._initWorksheets(),this._ro=new ResizeObserver(()=>this._onResize()),this._ro.observe(this._container),this._onResize()}_initContextMenu(){const t=this._options.contextMenu;t!==!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 pi(this._container,{onSortAsc:()=>{const e=this._colLayout.visibleLeaves[0];e&&this.orderBy(e.field,"asc")},onSortDesc:()=>{const e=this._colLayout.visibleLeaves[0];e&&this.orderBy(e.field,"desc")},onFind:()=>this._findMgr.open(),onExcel:()=>this.exportExcel(),onCsv:()=>this.exportCsv(),onPrint:()=>this.print()}),this._cmHandler=e=>{var l;const s=e.target.closest(".og-cell");if(!s)return;e.preventDefault();const i=Number(s.dataset.colIndex??-1),n=this._colLayout.visibleLeaves[i];n&&this._ctxMenu&&(this._ctxMenu._actions.onSortAsc=()=>this.orderBy(n.field,"asc"),this._ctxMenu._actions.onSortDesc=()=>this.orderBy(n.field,"desc"));const o=Array.isArray(t)?t:void 0;(l=this._ctxMenu)==null||l.open(e,o)},this._container.addEventListener("contextmenu",this._cmHandler),this._cmKbdHandler=e=>{var s;if(e.shiftKey&&e.key==="F10"){e.preventDefault();const i=this._container.getBoundingClientRect(),n={clientX:i.left+80,clientY:i.top+40};(s=this._ctxMenu)==null||s.open(n)}},this._container.addEventListener("keydown",this._cmKbdHandler))}openContextMenu(t,e){var s;(s=this._ctxMenu)==null||s.open(t,e)}closeContextMenu(){var t;(t=this._ctxMenu)==null||t.close()}setFilterSelect(t){var e;(e=this._filterSelect)==null||e.destroy(),this._filterSelect=null,t&&(this._container.id||(this._container.id=`og-${Math.random().toString(36).slice(2,7)}`),this._filterSelect=new ai(this._container,t,(s,i)=>this.setFilter(s,i),s=>this.resetFilter(s),this._container.id))}setOptions(t){var e;if(Object.assign(this._options,t),"contextMenu"in t&&((e=this._ctxMenu)==null||e.destroy(),this._ctxMenu=null,this._initContextMenu()),"groupBy"in t||"summary"in t){const s=t.groupBy??[];s.length>0?this._grpMgr.groupBy(s):this.clearGroup();return}this._renderHeader(),this._doRender(...this._visRange())}setMaskEnabled(t,e){var i;const s=this._colLayout.getColumnByField(t);s&&(e?(s._maskRevealed=!1,(i=s._maskRevealedRows)==null||i.clear()):s._maskRevealed=!0,this._doRender(...this._visRange()))}getMaskEnabled(t){const e=this._colLayout.getColumnByField(t);return e?e._maskRevealed!==!0:!1}_initWorksheets(){const t=this._options.worksheets;this._wsManager=new Le(this._container,(e,s)=>this._loadWorksheetState(s));for(const e of t)this._wsManager.add(e.name,e.columns??this._options.columns,e.data??[])}_loadWorksheetState(t){var s,i;this._rowMgr.reset(),this._data.setData(t.data),this._colLayout=new me(t.columns.length?t.columns:this._options.columns,this._options.frozenColumns),(s=this._vs)==null||s.setTotalRows(this._data.rowCount),(i=this._pagination)==null||i.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:e}=this._container.getBoundingClientRect();e&&this._recalcWidths(e),this._renderHeader(),this._doRender(...this._visRange())}addWorksheet(t,e,s){this._wsManager||(this._wsManager=new Le(this._container,(i,n)=>this._loadWorksheetState(n))),this._wsManager.add(t,e??this._options.columns,s??[])}removeWorksheet(t){var e;(e=this._wsManager)==null||e.remove(t)}switchWorksheet(t){var e;(e=this._wsManager)==null||e.switch(t)}renameWorksheet(t,e){var s;(s=this._wsManager)==null||s.rename(t,e)}getWorksheet(t){var e;return(e=this._wsManager)==null?void 0:e.get(t)}getWorksheetNames(){var t;return((t=this._wsManager)==null?void 0:t.getNames())??[]}exportSheetsExcel(t){this._exportMgr.exportSheetsExcel(t)}_paginationHeight(){return this._options.pagination?38:0}_onResize(){const{width:t}=this._container.getBoundingClientRect();t&&(this._recalcWidths(t),this._renderHeader(),this._doRender(...this._visRange()))}_recalcWidths(t){this._colWidths=this._colLayout.computeWidths(t-(this._options.stateColumn?24:0)-(this._options.draggable?18:0)-(this._options.rowNumber?44:0)-(this._options.checkColumn?36:0),this._options.defaultColumnWidth),this._userWidths.size&&this._colLayout.visibleLeaves.forEach((e,s)=>{const i=this._userWidths.get(e.field);i!=null&&(this._colWidths[s]=i)})}_renderHeader(){var t;(t=this._renderer)==null||t.renderHeader(this._colLayout.buildHeaderCells(),this._colLayout.visibleLeaves,this._colWidths,this._sfMgr.sortList,{...this._options,_activeFilters:this._sfMgr.filters,_frozenCount:this._colLayout.frozenCount}),this._syncHeaderLayout()}_syncHeaderLayout(){if(!this._renderer||!this._vs)return;const{height:t}=this._container.getBoundingClientRect();if(!t)return;const e=this._renderer.getHeaderHeight(),s=e>this._options.headerHeight?e:this._options.headerHeight;this._renderer.updateSize(t-this._paginationHeight(),s);let i=t-s-this._paginationHeight();const n=this._options.fallbackViewportHeight;if(n&&n>0){const o=this._vs.getTotalHeight();i>=o&&i>n&&(i=n)}this._vs.setViewportHeight(i)}_doRender(t,e){var l;if(!this._renderer||!this._vs)return;const s=this._vs.getVisibleRange(),i=this._options.autoHeight===!0;i&&([t,e]=this._visRange(),!this._autoHeightWarned&&e-t+1>2e3&&(this._autoHeightWarned=!0,console.warn(`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${e-t+1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`)));const o=this._grpMgr.isGroupMode||this._grpMgr.isTreeMode||this._detailMgr.isActive?this._flatModel.getFlatArray():null;this._renderer.renderBody(t,e,this._data,this._colLayout.visibleLeaves,this._colWidths,this._options,i?0:s.offsetY,i?0:this._vs.getTotalHeight(),this._rowMgr.selectedRows,this._rowMgr.checkedRows,o,a=>this._grpMgr.handleGroupToggle(a),this._grpMgr.isTreeMode?a=>this._grpMgr.handleTreeToggle(a):void 0,{_totalRows:this._data.rowCount,_frozenCount:this._colLayout.frozenCount,_focusCell:this._editMgr.focusCell,...this._rangeMgr.getOverlayExtraOpts()},this._mergeEngine,this._buildDetailRenderContext()),(l=this._options.footer)!=null&&l.length&&this._renderFooterEl(),this._rangeMgr.repaint()}_buildDetailRenderContext(){if(!this._detailMgr.enabled)return;const t=this._options.masterDetail??{};return{toggleMode:t.toggle??"expander-col",ariaLabel:t.ariaLabel??"상세 내용",getRowId:e=>e==null?void 0:e[vt],isExpanded:e=>this._detailMgr.isExpandedId(e),onToggle:(e,s)=>this._detailMgr.toggleRow({id:s}),getGlyph:e=>oi(e),getPanelHost:e=>this._detailMgr.getPanelHost(e),onBeforeTeardown:()=>this._detailMgr.onBeforeTeardown()}}_handleGroupToggle(t){this._grpMgr.handleGroupToggle(t)}_visRange(){var s;if(this._options.pagination&&this._pagination){const{start:i,end:n}=this._pagination.getRange();return[i,n]}const t=this._flatModel.count();if(this._options.autoHeight)return[0,t-1];const e=(s=this._vs)==null?void 0:s.getVisibleRange();return[(e==null?void 0:e.startIndex)??0,Math.min(((e==null?void 0:e.endIndex)??30)+this._visCount()+5,t-1)]}_visCount(){const t=this._container.getBoundingClientRect().height;return Math.ceil((t-this._options.headerHeight-this._paginationHeight())/this._options.rowHeight)+5}_handleSortClick(t,e){this._sfMgr.handleSortClick(t,e)}_isToggleCol(t){return kt(t)}_handleCellClick(t,e,s){this._cellEvt.handleCellClick(t,e,s)}_handleCellDblClick(t,e,s){this._cellEvt.handleCellDblClick(t,e,s)}_handleCellMouseOver(t,e,s){this._cellEvt.handleCellMouseOver(t,e,s)}_handleCellMouseOut(t,e,s){this._cellEvt.handleCellMouseOut(t,e,s)}_handleCellMouseDown(t,e,s){this._cellEvt.handleCellMouseDown(t,e,s)}_handleCellMouseUp(t,e,s){this._cellEvt.handleCellMouseUp(t,e,s)}_handleCellMouseMove(t,e,s){this._cellEvt.handleCellMouseMove(t,e,s)}_handleCellKeyEvt(t,e){this._cellEvt.handleCellKeyEvt(t,e)}_handleRowCheck(t,e){this._rowMgr.check(t,e),this._doRender(...this._visRange()),this.emit("rowCheck",{rowIndex:t,checked:e,row:this._data.getRowByIndex(t)})}_handleFilterIconClick(t,e){var i,n;if((i=this._filterPanel)!=null&&i.isOpen){this._filterPanel.close();return}const s=this._sfMgr.filters[t]??[];(n=this._filterPanel)==null||n.open(t,e,s)}_handleAllCheck(t){this._rowMgr.checkAll(t,this._data.rowCount),this._doRender(...this._visRange()),this.emit("allCheck",{checked:t})}_handleRowDrop(t,e){var s,i;this._data.moveRow(t,e),this._doRender(...this._visRange()),this.emit("rowDrop",{fromIndex:t,toIndex:e}),(i=(s=this._options).onRowDrop)==null||i.call(s,{fromIndex:t,toIndex:e})}_crossBodyEl(){return this._renderer.bodyWrapper}_dragRowSet(t){const e=[...this._rowMgr.selectedRows];return e.length>1&&e.includes(t)?e.sort((s,i)=>s-i):[t]}_handleCrossGridDrop(t,e,s){const i=Lt.get(e);!i||i===this||this.moveRowsTo(i,this._dragRowSet(t),s)}async moveRowsTo(t,e,s){const i=t;if(!i||i===this||!e.length)return!1;const n=[...new Set(e)].sort((c,h)=>c-h),o=s??i._data.rowCount;let l=n.map(c=>{const h={...this._data.getRowByIndex(c)};return delete h[vt],h});const a=await this._resolveCrossTransform(i);if(a===!1)return!1;a&&(l=l.map(c=>a(c)));const d={sourceGrid:this,targetGrid:i,rows:l,sourceIndexes:n,targetIndex:o};return this._fireGridDropBefore(d)===!1||d.cancel||i._fireGridDropBefore(d)===!1||d.cancel?!1:(l.forEach((c,h)=>i.insertRow(c,o+h)),[...n].sort((c,h)=>h-c).forEach(c=>this.deleteRow(c)),this._fireGridDropAfter(d),i._fireGridDropAfter(d),this._fireGridDropComplete(d),i._fireGridDropComplete(d),!0)}async moveCheckedTo(t){const e=this._rowMgr.getChecked().map(s=>s.rowIndex);return e.length?(this._rowMgr.uncheckAll(),this.moveRowsTo(t,e)):!1}async _resolveCrossTransform(t){var l,a;const e=this._options.crossGridMapping;if(typeof e=="function")return e;if(e!=="interactive")return null;const s=this._colLayout.visibleLeaves.map(d=>({field:d.field,header:d.header})),i=t._colLayout.visibleLeaves.map(d=>({field:d.field,header:d.header}));if(yn(s.map(d=>d.field),i.map(d=>d.field)))return null;const n=await bn(s,i);if(!n)return!1;const o={sourceGrid:this,targetGrid:t,mapping:n.mapping,script:n.script};return this.emit("gridDropMapping",o),(a=(l=this._options).onGridDropMapping)==null||a.call(l,o),console.log(`[OpenGrid] cross-grid mapping script:
|
|
91
|
+
`+os(n.mapping)),wn(n.mapping)}_fireGridDropBefore(t){var e,s;return this.emit("gridDropBefore",t),(s=(e=this._options).onGridDropBefore)==null?void 0:s.call(e,t)}_fireGridDropAfter(t){var e,s;this.emit("gridDropAfter",t),(s=(e=this._options).onGridDropAfter)==null||s.call(e,t)}_fireGridDropComplete(t){var e,s;this.emit("gridDropComplete",t),(s=(e=this._options).onGridDropComplete)==null||s.call(e,t)}reorderRow(t,e){this._data.moveRow(t,e),this._doRender(...this._visRange())}_handleColResize(t,e){this._colWidths[t]!==void 0&&(this._colWidths[t]=e);const s=this._colLayout.visibleLeaves[t];s&&this._userWidths.set(s.field,e),this._renderHeader(),this._doRender(...this._visRange())}_handleKeyDown(t){this._kbdMgr.handleKeyDown(t)}_setFocusCell(t,e){this._rowMgr.selectSingle(t),this._editMgr.setFocusCell(t,e)}_announce(t){this._liveRegion&&(this._liveRegion.textContent="",setTimeout(()=>{this._liveRegion&&(this._liveRegion.textContent=t)},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(t){var s,i,n;const e=this._trigMgr.mkCtx("setData",[t]);this._trigMgr.exec("before:setData",e)&&(this._rowMgr.reset(),this._data.setData(t),this._formulaDirtySeeds.clear(),this._recalc=new Ue({accessor:this._buildFormulaAccessor(),setComputedValue:(o,l,a)=>this._data.setComputedValueByRowId(o,l,a),onFormulaError:(o,l,a)=>this._handleFormulaError(o,l,a),refMode:((s=this._options.formula)==null?void 0:s.refMode)??"stable",divisionPrecision:((i=this._options.formula)==null?void 0:i.divisionPrecision)??30}),this._applyFilters(),this._grpMgr.isTreeMode?this._grpMgr.rebuildTree():this._grpMgr.isGroupMode?this._grpMgr.rebuildGroups():(n=this._vs)==null||n.setTotalRows(this._flatModel.count()),this._container.setAttribute("aria-rowcount",String(this._data.rowCount)),this._container.setAttribute("aria-colcount",String(this._colLayout.visibleLeaves.length)),this._announce(`${this._data.rowCount}행 데이터 로드됨`),this.emit("dataChange",this._data.getData()),e.result=t.length,this._trigMgr.exec("after:setData",e))}getData(){return this._data.getData()}getSourceRows(){return this._data.getOriginalData()}pushData(t){var i,n;const e=[...this._data.getAllData(),...t];this._data.setData(e);const s=this._data.rowCount;(i=this._vs)==null||i.setTotalRows(this._flatModel.count()),(n=this._pagination)==null||n.setTotalRows(s)}prefixData(t){var i,n;const e=[...t,...this._data.getAllData()];this._data.setData(e);const s=this._data.rowCount;(i=this._vs)==null||i.setTotalRows(this._flatModel.count()),(n=this._pagination)==null||n.setTotalRows(s)}clearData(){var t,e;this._rowMgr.reset(),this._data.clearData(),(t=this._vs)==null||t.setTotalRows(0),(e=this._pagination)==null||e.setTotalRows(0),this._doRender(0,-1),this.emit("dataChange",[])}insertRow(t,e="last"){var o,l,a,d;const s=this._trigMgr.mkCtx("insertRow",[t,e]);if(!this._trigMgr.exec("before:insertRow",s))return;const i=e==="before"?0:e==="after"?this._data.rowCount:e;this._data.addRow(t,i);const n=this._data.rowCount;(o=this._vs)==null||o.setTotalRows(this._flatModel.count()),(l=this._pagination)==null||l.setTotalRows(n),this._doRender(...this._visRange()),this.emit("dataChange",this._data.getData()),(d=(a=this._options).onDataChange)==null||d.call(a,this._data.getData()),s.result={rowCount:n,item:t},this._trigMgr.exec("after:insertRow",s)}pushRow(t){var i,n,o,l;(Array.isArray(t)?t:[t]).forEach(a=>this._data.addRow(a,"last"));const s=this._data.rowCount;(i=this._vs)==null||i.setTotalRows(this._flatModel.count()),(n=this._pagination)==null||n.setTotalRows(s),this._doRender(...this._visRange()),this.emit("dataChange",this._data.getData()),(l=(o=this._options).onDataChange)==null||l.call(o,this._data.getData())}appendRows(t){this.pushRow(t)}unshiftRow(t){var i,n,o,l;(Array.isArray(t)?t:[t]).forEach(a=>this._data.addRow(a,"first"));const s=this._data.rowCount;(i=this._vs)==null||i.setTotalRows(this._flatModel.count()),(n=this._pagination)==null||n.setTotalRows(s),this._doRender(...this._visRange()),this.emit("dataChange",this._data.getData()),(l=(o=this._options).onDataChange)==null||l.call(o,this._data.getData())}prependRows(t){this.unshiftRow(t)}deleteRow(t){var l,a,d,c;const e=this._trigMgr.mkCtx("deleteRow",[t]),s=Array.isArray(t)?[...t]:[t];if(e.extra={rows:s.map(h=>this._data.getRowByIndex(h))},!this._trigMgr.exec("before:deleteRow",e))return;const i=s.sort((h,u)=>u-h),n=i.map(h=>{var u;return(u=this._data.getRowByIndex(h))==null?void 0:u[vt]}).filter(h=>h!=null);i.forEach(h=>this._data.removeRow(h));const o=this._data.rowCount;(l=this._vs)==null||l.setTotalRows(this._flatModel.count()),(a=this._pagination)==null||a.setTotalRows(o);for(const h of n)this._afterRecalc(this._recalc.invalidateRow(h),{skipRender:!0});this._doRender(...this._visRange()),this.emit("dataChange",this._data.getData()),(c=(d=this._options).onDataChange)==null||c.call(d,this._data.getData()),e.result={deleted:i.length,rowCount:o},this._trigMgr.exec("after:deleteRow",e)}deleteById(t){}readCell(t,e){return this._data.getCellValue(t,e)}getDisplayValue(t,e){const s=this.readCell(t,e);return this._ovk.getStrategy("displayFormatter",(n,o,l)=>n==null?"":String(n))(s,e,this._data.getRowByIndex(t))}writeCell(t,e,s){var h,u,p,f;const i=this.readCell(t,e),n=this._trigMgr.mkCtx("writeCell",[t,e,s]);if(n.extra={oldValue:i,rowIndex:t,field:e},!this._trigMgr.exec("before:writeCell",n))return;this._data.updateCell(t,e,s);const o=this._data.getRowByIndex(t),l=this._colLayout.getColumnByField(e),a=this._colLayout.getColumnIndex(e),d={type:"editEnd",rowIndex:t,columnIndex:a,field:e,oldValue:i,newValue:s,row:o,column:l};this.emit("editEnd",d),(u=(h=this._options).onEditEnd)==null||u.call(h,d);const c=this._flatModel.resolveFlatRow(t);c.kind==="data"&&c.rowId&&this._formulaDirtySeeds.add(X(c.rowId,e)),this._batchDepth>0?this._batchDirty=!0:(this._flushFormulaRecalc(),this.emit("dataChange",this._data.getData()),(f=(p=this._options).onDataChange)==null||f.call(p,this._data.getData()),this._doRender(...this._visRange())),n.result={rowIndex:t,field:e,oldValue:i,newValue:s},this._trigMgr.exec("after:writeCell",n)}getRowAt(t){return this._data.getRowByIndex(t)}getFlatRowModel(){return this._flatModel}beginBatch(){this._batchDepth++}endBatch(){var t,e;this._batchDepth!==0&&(this._batchDepth--,this._batchDepth===0&&this._batchDirty&&(this._batchDirty=!1,this._flushFormulaRecalc(),this.emit("dataChange",this._data.getData()),(e=(t=this._options).onDataChange)==null||e.call(t,this._data.getData()),this._doRender(...this._visRange())))}_flushFormulaRecalc(){if(this._formulaDirtySeeds.size===0)return;const t=[...this._formulaDirtySeeds];this._formulaDirtySeeds.clear(),this._afterRecalc(this._recalc.onValuesChanged(t),{skipRender:!0})}_afterRecalc(t,e={}){var s,i;if(t.changed.length>0||t.cycles>0){const n={changed:t.changed,cycles:t.cycles,ms:t.ms,large:t.changed.length>Hn};this.emit("formulaRecalc",n),(i=(s=this._options.formula)==null?void 0:s.onFormulaRecalc)==null||i.call(s,n)}e.skipRender||this._doRender(...this._visRange())}_handleFormulaError(t,e,s){var o,l;const n={rowIndex:this._flatModel.flatIndexOfRowId(t),field:e,error:s};this.emit("formulaError",n),(l=(o=this._options.formula)==null?void 0:o.onFormulaError)==null||l.call(o,n),this._announce(`${e} 셀 오류: ${this._formulaErrorMessageKo(s)}`)}_formulaErrorMessageKo(t){switch(t){case"#REF":return"참조 대상이 삭제됨";case"#CYCLE":return"순환 참조";case"#VALUE":return"숫자가 아닌 값에 산술 연산";case"#DIV0":return"0으로 나눔";case"#NAME":return"알 수 없는 함수/이름";case"#NUM":return"수치 도메인 오류";default:return"수식 오류"}}_buildFormulaAccessor(){return{visibleFields:()=>this._colLayout.visibleLeaves.map(t=>t.field),rowIdAtFlat:t=>{const e=this._flatModel.resolveFlatRow(t);return e.kind==="data"?e.rowId??null:null},flatIndexOfRowId:t=>this._flatModel.flatIndexOfRowId(t),displayedRowIds:()=>{const t=[],e=this._flatModel.count();for(let s=0;s<e;s++){const i=this._flatModel.resolveFlatRow(s);i.kind==="data"&&i.rowId&&t.push(i.rowId)}return t},getCellValue:(t,e)=>this._data.getCellValueByRowId(t,e),hasRow:t=>this._data.hasRow(t),hasField:t=>this._colLayout.getColumnByField(t)!=null}}setCellFormula(t,e,s){const i=this._flatModel.resolveFlatRow(t);i.kind!=="data"||!i.rowId||this._setCellFormulaByRowId(i.rowId,e,s,t)}_setCellFormulaByRowId(t,e,s,i){var d,c;const n=i??this._flatModel.flatIndexOfRowId(t),o=this._recalc.getCellFormula(t,e),l=this._recalc.setCellFormula(t,e,s),a={rowIndex:n,field:e,formula:s,oldFormula:o};this.emit("formulaChange",a),(c=(d=this._options.formula)==null?void 0:d.onFormulaChange)==null||c.call(d,a),this._afterRecalc(l)}getCellFormula(t,e){const s=this._flatModel.resolveFlatRow(t);return s.kind!=="data"||!s.rowId?null:this._recalc.getCellFormula(s.rowId,e)}hasCellFormula(t,e){const s=this._flatModel.resolveFlatRow(t);return s.kind==="data"&&!!s.rowId&&this._recalc.hasCellFormula(s.rowId,e)}clearCellFormula(t,e){const s=this._flatModel.resolveFlatRow(t);if(s.kind!=="data"||!s.rowId)return;const i=this._recalc.clearCellFormula(s.rowId,e);i.length?this._afterRecalc(this._recalc.onValuesChanged(i)):this._doRender(...this._visRange())}getCellError(t,e){const s=this._flatModel.resolveFlatRow(t);return s.kind!=="data"||!s.rowId?null:this._recalc.getCellError(s.rowId,e)}getDependents(t,e){const s=this._flatModel.resolveFlatRow(t);return s.kind!=="data"||!s.rowId?[]:this._recalc.getDependents(s.rowId,e).map(({rowId:i,field:n})=>({rowIndex:this._flatModel.flatIndexOfRowId(i),field:n}))}getPrecedents(t,e){const s=this._flatModel.resolveFlatRow(t);return s.kind!=="data"||!s.rowId?[]:this._recalc.graph.getPrecedents(X(s.rowId,e)).map(mt).map(({rowId:i,field:n})=>({rowIndex:this._flatModel.flatIndexOfRowId(i),field:n}))}recalculate(){this._afterRecalc(this._recalc.recalculateAll())}recalculateCell(t,e){const s=this._flatModel.resolveFlatRow(t);s.kind!=="data"||!s.rowId||this._afterRecalc(this._recalc.onValuesChanged([X(s.rowId,e)]))}offsetFormula(t,e,s,i){return this._recalc.offsetFormula(t,e,s,i)}_getFormulaMeta(t,e){const s=this._flatModel.resolveFlatRow(t);if(s.kind!=="data"||!s.rowId)return null;const i=this._recalc.store.getFormula(s.rowId,e);return i?{src:i.src,error:i.error,approx:!!i.approx}:null}writeCells(t){this.beginBatch();let e=0;for(const s of t){if(this._flatModel.resolveFlatRow(s.rowIndex).kind!=="data"){e++;continue}this.writeCell(s.rowIndex,s.field,s.value)}return this.endBatch(),e>0&&(this._announce(`쓰기 대상이 아닌 셀 ${e}개를 건너뛰었습니다`),this.emit("writeCellsSkip",{skipped:e,total:t.length})),e}getRangeSelection(){return this._rangeMgr.getRangeSelection()}getActiveRange(){return this._rangeMgr.getActiveRange()}setRangeSelection(t){this._rangeMgr.setRangeSelection(t)}clearRangeSelection(){this._rangeMgr.clearRangeSelection()}getRangeValues(){return this._rangeMgr.getRangeValues()}getRangeStats(){return this._rangeMgr.getRangeStats()}fillRange(t,e,s="copy"){this._rangeMgr.fillRange(t,e,s)}createChart(t){return this._chartMgr.createChart(t)}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(t){return this._data.getOriginalRow(t)}getRowsWithState(t){return this._data.getRowsWithState(t)}undo(){}redo(){}clearHistory(){}getColumnDefs(){return this._colLayout.visibleLeaves}getAllColumnDefs(){return this._colLayout.leaves}getColumnCount(){return this._colLayout.visibleLeaves.length}applyColumns(t){const e=this._trigMgr.mkCtx("applyColumns",[t]);this._trigMgr.exec("before:applyColumns",e)&&(this._colLayout.setColumns(t),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange()),e.result={columnCount:t.length},this._trigMgr.exec("after:applyColumns",e))}insertColumn(t,e){this._colLayout.addColumn(t,e),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}deleteColumn(t){this._colLayout.removeColumn(t),this._recalcWidths(this._container.getBoundingClientRect().width),this._afterRecalc(this._recalc.invalidateField(t),{skipRender:!0}),this._renderHeader(),this._doRender(...this._visRange())}_reorderColumn(t,e){var o,l;const s=this._colLayout.visibleLeaves.map(a=>a);if(t<0||e<0||t>=s.length||e>=s.length)return;const i=[...this._options.columns],[n]=i.splice(t,1);i.splice(e,0,n),this._options.columns=i,this.applyColumns(i),(l=(o=this._options).onColumnReorder)==null||l.call(o,{fromIndex:t,toIndex:e,field:n.field??""})}hideColumn(t){this._colLayout.hideColumn(t),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}showColumn(t){this._colLayout.showColumn(t),this._recalcWidths(this._container.getBoundingClientRect().width),this._renderHeader(),this._doRender(...this._visRange())}getColumnIndex(t){return this._colLayout.getColumnIndex(t)}getFieldAt(t){var e;return((e=this._colLayout.getColumnByIndex(t))==null?void 0:e.field)??""}getColValues(t,e=!1){return this._data.getData().map(s=>s[t])}getUniqueValues(t,e=!1){return[...new Set(this.getColValues(t,e))]}setColWidths(t){}calcColWidths(t=!1){return[]}getSelections(){return this._rowMgr.getSelections()}getActiveRow(){return this._rowMgr.getActiveRow()}activate(t){this._rowMgr.activate(t),this._doRender(...this._visRange())}deselect(){this._rowMgr.deselect(),this._doRender(...this._visRange())}getChecked(){return this._rowMgr.getChecked()}getAllChecked(){return this._rowMgr.getAllChecked()}checkById(t){}addCheckById(t){}checkByValue(t,e){this._rowMgr.checkByValue(t,e),this._doRender(...this._visRange())}uncheckById(t){}uncheckAll(){this._rowMgr.uncheckAll(),this._doRender(...this._visRange())}orderBy(t,e="asc"){const s=this._trigMgr.mkCtx("orderBy",[t,e]);this._trigMgr.exec("before:orderBy",s)&&(this._sfMgr.sort(t,e),this._recalcRangeBearingFormulas(),s.result={sortList:this._sfMgr.sortList},this._trigMgr.exec("after:orderBy",s))}resetOrder(){this._sfMgr.resetSort(),this._recalcRangeBearingFormulas()}setFilter(t,e){const s=this._trigMgr.mkCtx("setFilter",[t,e]);this._trigMgr.exec("before:setFilter",s)&&(this._sfMgr.setFilter(t,e),this._recalcRangeBearingFormulas(),s.result={field:t,filteredCount:this._data.rowCount},this._trigMgr.exec("after:setFilter",s))}resetFilter(t){this._sfMgr.resetFilter(t),this._recalcRangeBearingFormulas()}_recalcRangeBearingFormulas(){this._afterRecalc(this._recalc.recalcRangeBearing())}getFilterState(){return this._sfMgr.getFilterState()}restoreFilter(t){this._sfMgr.restoreFilter(t)}_applyFilters(){this._sfMgr.applyFilters()}freeze(t){this._colLayout.setFrozen(t),this._renderHeader(),this._doRender(...this._visRange())}mergeCells(t){this._mergeEngine.applyMergeCells(t),this._doRender(...this._visRange())}autoMerge(t){const e=this._colLayout.visibleLeaves,s=[],i=[];for(const n of t){const o=e.findIndex(l=>l.field===n);o>=0&&(s.push(o),i.push(n))}this._mergeEngine.applyAutoMerge(this._data.getData(),s,i),this._doRender(...this._visRange())}clearMerge(){this._mergeEngine.clear(),this._doRender(...this._visRange())}freezeRows(t){}groupBy(t){const e=this._trigMgr.mkCtx("groupBy",[t]);this._trigMgr.exec("before:groupBy",e)&&(this._grpMgr.groupBy(t),e.result={fields:t},this._trigMgr.exec("after:groupBy",e))}clearGroup(){this._grpMgr.clearGroup()}expandAll(){this._grpMgr.expandAll()}collapseAll(){this._grpMgr.collapseAll()}enableTree(){this._grpMgr.enableTree()}disableTree(){this._grpMgr.disableTree()}expandNodes(t,e=!0){this._grpMgr.expandNodes(t,e)}expandAllNodes(){this._grpMgr.expandAllNodes()}collapseAllNodes(){this._grpMgr.collapseAllNodes()}expandRow(t){this._detailMgr.expandRow(t)}collapseRow(t){this._detailMgr.collapseRow(t)}toggleRow(t){this._detailMgr.toggleRow(t)}isRowExpanded(t){return this._detailMgr.isRowExpanded(t)}collapseAllDetails(){this._detailMgr.collapseAllDetails()}getDetailInstance(t){return this._detailMgr.getDetailInstance(t)}resyncPanelWidths(){this._detailMgr.resyncPanelWidths()}addTreeRow(t,e,s){}exportExcel(t){this._exportMgr.exportExcel(t)}exportCsv(t){this._exportMgr.exportCsv(t)}exportJson(t){this._exportMgr.exportJson(t)}print(t){this._exportMgr.print(t)}toArray(t=!0){const e=this._data.getData();if(t)return e;const s=this._colLayout.visibleLeaves;return e.map(i=>s.map(n=>i[n.field]))}jumpToRow(t){var e;this._rowMgr.selectSingle(t),(e=this._vs)==null||e.scrollToRow(t),this._doRender(...this._visRange())}jumpToCol(t){}getScrollPos(){var t,e;return{x:((t=this._renderer)==null?void 0:t.bodyWrapper.scrollLeft)??0,y:((e=this._renderer)==null?void 0:e.bodyWrapper.scrollTop)??0}}setFooter(t){this._options.footer=t,this._renderFooterEl()}getFooterData(){return this._footerMgr.computeValues()}getFooterValue(t){var e;return((e=this._footerMgr.computeValues().find(s=>s._field===t))==null?void 0:e._value)??null}_renderFooterEl(){this._footerMgr.render()}resize(t,e){t&&(this._container.style.width=`${t}px`),e&&(this._container.style.height=`${e}px`),this._onResize()}setTheme(t){this._container.setAttribute("data-og-theme",t)}setThemeVar(t,e){this._container.style.setProperty(t,e)}addTrigger(t,e){return this._trigMgr.add(t,e),this}removeTrigger(t,e){return this._trigMgr.remove(t,e),this}clearTriggers(t){return this._trigMgr.clear(t),this}_mkCtx(t,e){return this._trigMgr.mkCtx(t,e)}_trig(t,e){return this._trigMgr.exec(t,e)}destroy(){var t,e,s,i,n,o,l,a,d,c;this._destroyed||(this._destroyed=!0,this._renderer&&Lt.unregister(this._renderer.bodyWrapper),this._trigMgr.clear(),(t=this._ro)==null||t.disconnect(),(e=this._vs)==null||e.destroy(),(s=this._chartMgr)==null||s.destroyCharts(),(i=this._detailMgr)==null||i.destroy(),(n=this._filterPanel)==null||n.destroy(),(o=this._dnd)==null||o.destroy(),this._cmHandler&&this._container.removeEventListener("contextmenu",this._cmHandler),this._cmKbdHandler&&this._container.removeEventListener("keydown",this._cmKbdHandler),this._cmHandler=this._cmKbdHandler=null,(l=this._ctxMenu)==null||l.destroy(),(a=this._wsManager)==null||a.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())}};ot._defaultOverrides=[],ot._defaultStrategies=[],ot.defaults={strategy(t,e){return ot._defaultStrategies.push([t,e]),ot}};let ce=ot;exports.OpenGrid=ce;exports.buildTree=re;
|
|
92
|
+
//# sourceMappingURL=OpenGrid-DahxRY7C.cjs.map
|