@things-factory/kpi 9.0.29 → 9.0.31

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.
Files changed (73) hide show
  1. package/client/charts/kpi-mini-trend-chart.ts +125 -0
  2. package/client/charts/kpi-trend-chart.ts +163 -0
  3. package/client/google-map/common-google-map.ts +370 -0
  4. package/client/google-map/google-map-loader.ts +29 -0
  5. package/client/pages/kpi-dashboard/cards/kpi-level1-card.ts +248 -0
  6. package/client/pages/kpi-dashboard/cards/kpi-level2-comparison.ts +369 -0
  7. package/client/pages/kpi-dashboard/cards/kpi-level3-comparison.ts +443 -0
  8. package/client/pages/kpi-dashboard/components/kpi-chart-toggle.ts +72 -0
  9. package/client/pages/kpi-dashboard/components/kpi-left-panel.ts +399 -0
  10. package/client/pages/kpi-dashboard/components/kpi-map-panel.ts +302 -0
  11. package/client/pages/kpi-dashboard/components/kpi-region-popup.ts +355 -0
  12. package/client/pages/kpi-dashboard/kpi-dashboard-map.ts +243 -0
  13. package/client/pages/kpi-dashboard/kpi-dashboard.ts +416 -0
  14. package/client/route.ts +4 -0
  15. package/dist-client/charts/kpi-mini-trend-chart.d.ts +14 -0
  16. package/dist-client/charts/kpi-mini-trend-chart.js +148 -0
  17. package/dist-client/charts/kpi-mini-trend-chart.js.map +1 -0
  18. package/dist-client/charts/kpi-trend-chart.d.ts +25 -0
  19. package/dist-client/charts/kpi-trend-chart.js +186 -0
  20. package/dist-client/charts/kpi-trend-chart.js.map +1 -0
  21. package/dist-client/google-map/common-google-map.d.ts +34 -0
  22. package/dist-client/google-map/common-google-map.js +333 -0
  23. package/dist-client/google-map/common-google-map.js.map +1 -0
  24. package/dist-client/google-map/google-map-loader.d.ts +6 -0
  25. package/dist-client/google-map/google-map-loader.js +22 -0
  26. package/dist-client/google-map/google-map-loader.js.map +1 -0
  27. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +17 -0
  28. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +279 -0
  29. package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -0
  30. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +19 -0
  31. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +385 -0
  32. package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -0
  33. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +23 -0
  34. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +465 -0
  35. package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -0
  36. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +8 -0
  37. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +78 -0
  38. package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +1 -0
  39. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +22 -0
  40. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +404 -0
  41. package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -0
  42. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +28 -0
  43. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +298 -0
  44. package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -0
  45. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.d.ts +23 -0
  46. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +368 -0
  47. package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -0
  48. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +29 -0
  49. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +271 -0
  50. package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -0
  51. package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +21 -0
  52. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +398 -0
  53. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -1
  54. package/dist-client/route.d.ts +1 -1
  55. package/dist-client/route.js +3 -0
  56. package/dist-client/route.js.map +1 -1
  57. package/dist-client/tsconfig.tsbuildinfo +1 -1
  58. package/dist-server/index.d.ts +1 -0
  59. package/dist-server/index.js +1 -0
  60. package/dist-server/index.js.map +1 -1
  61. package/dist-server/migrations/index.d.ts +1 -0
  62. package/dist-server/migrations/index.js +12 -0
  63. package/dist-server/migrations/index.js.map +1 -0
  64. package/dist-server/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +2 -2
  66. package/server/index.ts +1 -0
  67. package/server/migrations/index.ts +9 -0
  68. package/things-factory.config.js +2 -1
  69. package/translations/en.json +1 -0
  70. package/translations/ja.json +1 -0
  71. package/translations/ko.json +1 -0
  72. package/translations/ms.json +1 -0
  73. package/translations/zh.json +1 -0
@@ -0,0 +1,186 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { LitElement, html, css } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import * as d3 from 'd3';
5
+ let KpiTrendChart = class KpiTrendChart extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.data = [];
9
+ this.valueKey = 'value';
10
+ this.dateKey = 'date';
11
+ this.width = 400;
12
+ this.height = 200;
13
+ this.lineColor = '#2196f3';
14
+ this.strokeWidth = 2;
15
+ this.showPoints = true;
16
+ this.pointRadius = 4;
17
+ this.chartWidth = 0;
18
+ this.chartHeight = 0;
19
+ }
20
+ static { this.styles = css `
21
+ :host {
22
+ display: block;
23
+ width: 100%;
24
+ height: 100%;
25
+ }
26
+
27
+ .chart-container {
28
+ width: 100%;
29
+ height: 100%;
30
+ }
31
+
32
+ .trend-line {
33
+ fill: none;
34
+ stroke-linecap: round;
35
+ stroke-linejoin: round;
36
+ }
37
+
38
+ .data-point {
39
+ fill: white;
40
+ stroke-width: 2;
41
+ }
42
+
43
+ .axis line,
44
+ .axis path {
45
+ stroke: #ddd;
46
+ }
47
+
48
+ .axis text {
49
+ font-size: 10px;
50
+ fill: #666;
51
+ }
52
+ `; }
53
+ render() {
54
+ return html `
55
+ <div class="chart-container">
56
+ <svg
57
+ id="trend-chart"
58
+ width=${this.chartWidth || this.width}
59
+ height=${this.chartHeight || this.height}
60
+ viewBox="0 0 ${this.chartWidth || this.width} ${this.chartHeight || this.height}"
61
+ preserveAspectRatio="xMidYMid meet"
62
+ ></svg>
63
+ </div>
64
+ `;
65
+ }
66
+ connectedCallback() {
67
+ super.connectedCallback();
68
+ this.resizeObserver = new ResizeObserver(entries => {
69
+ for (const entry of entries) {
70
+ const rect = entry.contentRect;
71
+ this.chartWidth = rect.width;
72
+ this.chartHeight = rect.height;
73
+ this.requestUpdate();
74
+ }
75
+ });
76
+ this.resizeObserver.observe(this);
77
+ }
78
+ disconnectedCallback() {
79
+ this.resizeObserver?.disconnect();
80
+ super.disconnectedCallback();
81
+ }
82
+ updated() {
83
+ this.drawTrendChart();
84
+ }
85
+ drawTrendChart() {
86
+ if (!this.data || this.data.length === 0)
87
+ return;
88
+ const svg = d3.select(this.renderRoot.querySelector('#trend-chart'));
89
+ svg.selectAll('*').remove();
90
+ const margin = { top: 20, right: 20, bottom: 30, left: 40 };
91
+ const width = this.chartWidth || this.width;
92
+ const height = this.chartHeight || this.height;
93
+ const chartWidth = width - margin.left - margin.right;
94
+ const chartHeight = height - margin.top - margin.bottom;
95
+ // 데이터 파싱
96
+ const parsedData = this.data.map(d => ({
97
+ date: new Date(d[this.dateKey]),
98
+ value: +d[this.valueKey],
99
+ color: d.color || this.lineColor
100
+ }));
101
+ // 스케일 설정
102
+ const xScale = d3
103
+ .scaleTime()
104
+ .domain(d3.extent(parsedData, d => d.date))
105
+ .range([0, chartWidth]);
106
+ const yScale = d3
107
+ .scaleLinear()
108
+ .domain([0, d3.max(parsedData, d => d.value) || 100])
109
+ .range([chartHeight, 0]);
110
+ // SVG 설정
111
+ svg.attr('width', width).attr('height', height);
112
+ const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`);
113
+ // 축 생성
114
+ const xAxis = d3.axisBottom(xScale).tickFormat(d3.timeFormat('%m/%d')).ticks(5);
115
+ const yAxis = d3.axisLeft(yScale).ticks(5);
116
+ g.append('g').attr('class', 'axis').attr('transform', `translate(0,${chartHeight})`).call(xAxis);
117
+ g.append('g').attr('class', 'axis').call(yAxis);
118
+ // 라인 생성기
119
+ const line = d3
120
+ .line()
121
+ .x(d => xScale(d.date))
122
+ .y(d => yScale(d.value))
123
+ .curve(d3.curveMonotoneX);
124
+ // 트렌드 라인 그리기
125
+ g.append('path')
126
+ .datum(parsedData)
127
+ .attr('class', 'trend-line')
128
+ .attr('d', line)
129
+ .attr('stroke', this.lineColor)
130
+ .attr('stroke-width', this.strokeWidth);
131
+ // 데이터 포인트 그리기
132
+ if (this.showPoints) {
133
+ g.selectAll('.data-point')
134
+ .data(parsedData)
135
+ .enter()
136
+ .append('circle')
137
+ .attr('class', 'data-point')
138
+ .attr('cx', d => xScale(d.date))
139
+ .attr('cy', d => yScale(d.value))
140
+ .attr('r', this.pointRadius)
141
+ .attr('stroke', d => d.color)
142
+ .attr('fill', 'white');
143
+ }
144
+ }
145
+ };
146
+ __decorate([
147
+ property({ type: Array }),
148
+ __metadata("design:type", Array)
149
+ ], KpiTrendChart.prototype, "data", void 0);
150
+ __decorate([
151
+ property({ type: String }),
152
+ __metadata("design:type", String)
153
+ ], KpiTrendChart.prototype, "valueKey", void 0);
154
+ __decorate([
155
+ property({ type: String }),
156
+ __metadata("design:type", String)
157
+ ], KpiTrendChart.prototype, "dateKey", void 0);
158
+ __decorate([
159
+ property({ type: Number }),
160
+ __metadata("design:type", Number)
161
+ ], KpiTrendChart.prototype, "width", void 0);
162
+ __decorate([
163
+ property({ type: Number }),
164
+ __metadata("design:type", Number)
165
+ ], KpiTrendChart.prototype, "height", void 0);
166
+ __decorate([
167
+ property({ type: String }),
168
+ __metadata("design:type", String)
169
+ ], KpiTrendChart.prototype, "lineColor", void 0);
170
+ __decorate([
171
+ property({ type: Number }),
172
+ __metadata("design:type", Number)
173
+ ], KpiTrendChart.prototype, "strokeWidth", void 0);
174
+ __decorate([
175
+ property({ type: Boolean }),
176
+ __metadata("design:type", Boolean)
177
+ ], KpiTrendChart.prototype, "showPoints", void 0);
178
+ __decorate([
179
+ property({ type: Number }),
180
+ __metadata("design:type", Number)
181
+ ], KpiTrendChart.prototype, "pointRadius", void 0);
182
+ KpiTrendChart = __decorate([
183
+ customElement('kpi-trend-chart')
184
+ ], KpiTrendChart);
185
+ export { KpiTrendChart };
186
+ //# sourceMappingURL=kpi-trend-chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-trend-chart.js","sourceRoot":"","sources":["../../client/charts/kpi-trend-chart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGjB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACsB,SAAI,GAAsD,EAAE,CAAA;QAC3D,aAAQ,GAAW,OAAO,CAAA;QAC1B,YAAO,GAAW,MAAM,CAAA;QACxB,UAAK,GAAW,GAAG,CAAA;QACnB,WAAM,GAAW,GAAG,CAAA;QACpB,cAAS,GAAW,SAAS,CAAA;QAC7B,gBAAW,GAAW,CAAC,CAAA;QACtB,eAAU,GAAY,IAAI,CAAA;QAC3B,gBAAW,GAAW,CAAC,CAAA;QAE3C,eAAU,GAAG,CAAC,CAAA;QACd,gBAAW,GAAG,CAAC,CAAA;IAiJzB,CAAC;aA9IQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgClB,AAhCY,CAgCZ;IAED,MAAM;QACJ,OAAO,IAAI,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AAE,MAAM,EAAE,CAAC;;kDAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;iDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAwB;AATxC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA6JzB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\n@customElement('kpi-trend-chart')\nexport class KpiTrendChart extends LitElement {\n @property({ type: Array }) data: { date: string; value: number; color?: string }[] = []\n @property({ type: String }) valueKey: string = 'value'\n @property({ type: String }) dateKey: string = 'date'\n @property({ type: Number }) width: number = 400\n @property({ type: Number }) height: number = 200\n @property({ type: String }) lineColor: string = '#2196f3'\n @property({ type: Number }) strokeWidth: number = 2\n @property({ type: Boolean }) showPoints: boolean = true\n @property({ type: Number }) pointRadius: number = 4\n\n private chartWidth = 0\n private chartHeight = 0\n private resizeObserver?: ResizeObserver\n\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .chart-container {\n width: 100%;\n height: 100%;\n }\n\n .trend-line {\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n\n .data-point {\n fill: white;\n stroke-width: 2;\n }\n\n .axis line,\n .axis path {\n stroke: #ddd;\n }\n\n .axis text {\n font-size: 10px;\n fill: #666;\n }\n `\n\n render() {\n return html`\n <div class=\"chart-container\">\n <svg\n id=\"trend-chart\"\n width=${this.chartWidth || this.width}\n height=${this.chartHeight || this.height}\n viewBox=\"0 0 ${this.chartWidth || this.width} ${this.chartHeight || this.height}\"\n preserveAspectRatio=\"xMidYMid meet\"\n ></svg>\n </div>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n const rect = entry.contentRect\n this.chartWidth = rect.width\n this.chartHeight = rect.height\n this.requestUpdate()\n }\n })\n this.resizeObserver.observe(this)\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect()\n super.disconnectedCallback()\n }\n\n updated() {\n this.drawTrendChart()\n }\n\n drawTrendChart() {\n if (!this.data || this.data.length === 0) return\n\n const svg = d3.select(this.renderRoot.querySelector('#trend-chart'))\n svg.selectAll('*').remove()\n\n const margin = { top: 20, right: 20, bottom: 30, left: 40 }\n const width = this.chartWidth || this.width\n const height = this.chartHeight || this.height\n const chartWidth = width - margin.left - margin.right\n const chartHeight = height - margin.top - margin.bottom\n\n // 데이터 파싱\n const parsedData = this.data.map(d => ({\n date: new Date(d[this.dateKey]),\n value: +d[this.valueKey],\n color: d.color || this.lineColor\n }))\n\n // 스케일 설정\n const xScale = d3\n .scaleTime()\n .domain(d3.extent(parsedData, d => d.date) as [Date, Date])\n .range([0, chartWidth])\n\n const yScale = d3\n .scaleLinear()\n .domain([0, d3.max(parsedData, d => d.value) || 100])\n .range([chartHeight, 0])\n\n // SVG 설정\n svg.attr('width', width).attr('height', height)\n const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`)\n\n // 축 생성\n const xAxis = d3.axisBottom(xScale).tickFormat(d3.timeFormat('%m/%d')).ticks(5)\n\n const yAxis = d3.axisLeft(yScale).ticks(5)\n\n g.append('g').attr('class', 'axis').attr('transform', `translate(0,${chartHeight})`).call(xAxis)\n\n g.append('g').attr('class', 'axis').call(yAxis)\n\n // 라인 생성기\n const line = d3\n .line<{ date: Date; value: number; color: string }>()\n .x(d => xScale(d.date))\n .y(d => yScale(d.value))\n .curve(d3.curveMonotoneX)\n\n // 트렌드 라인 그리기\n g.append('path')\n .datum(parsedData)\n .attr('class', 'trend-line')\n .attr('d', line as any)\n .attr('stroke', this.lineColor)\n .attr('stroke-width', this.strokeWidth)\n\n // 데이터 포인트 그리기\n if (this.showPoints) {\n g.selectAll('.data-point')\n .data(parsedData)\n .enter()\n .append('circle')\n .attr('class', 'data-point')\n .attr('cx', d => xScale(d.date))\n .attr('cy', d => yScale(d.value))\n .attr('r', this.pointRadius)\n .attr('stroke', d => d.color)\n .attr('fill', 'white')\n }\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { LitElement } from 'lit';
2
+ declare global {
3
+ interface Window {
4
+ google: any;
5
+ markerClusterer?: any;
6
+ }
7
+ }
8
+ export declare class CommonGoogleMap extends LitElement {
9
+ static styles: import("lit").CSSResult[];
10
+ center: any;
11
+ zoom: any;
12
+ locations: any[];
13
+ focused: any;
14
+ polygons: any;
15
+ polylines: any;
16
+ markers: any;
17
+ boundCoords: any;
18
+ controls: any;
19
+ clusterZoom: number;
20
+ map: any;
21
+ defaultCenter: any;
22
+ private _infoWindow;
23
+ private _markerClusterer;
24
+ get anchor(): Element | null;
25
+ readyMap(): Promise<void>;
26
+ buildMarkers(locations?: any[]): Promise<void>;
27
+ get infoWindow(): any;
28
+ setFocus(focus: any, icon: any): void;
29
+ resetFocus(focus: any, icon: any): void;
30
+ changeFocus(after: any, before: any): Promise<void>;
31
+ updated(changes: any): Promise<void>;
32
+ render(): import("lit-html").TemplateResult<1>;
33
+ resetBounds(): void;
34
+ }
@@ -0,0 +1,333 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { LitElement, html, css } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { ScrollbarStyles } from '@operato/styles';
5
+ import GoogleMapLoader from './google-map-loader.js';
6
+ let CommonGoogleMap = class CommonGoogleMap extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.locations = [];
10
+ this.clusterZoom = 10;
11
+ this.map = null;
12
+ this.defaultCenter = { lat: 36.5, lng: 127.5 };
13
+ this._infoWindow = null;
14
+ this._markerClusterer = null;
15
+ }
16
+ static { this.styles = [
17
+ ScrollbarStyles,
18
+ css `
19
+ :host {
20
+ display: flex;
21
+ }
22
+
23
+ [map] {
24
+ flex: 1;
25
+ }
26
+
27
+ .gm-style .gm-style-iw-c {
28
+ padding: 0;
29
+ }
30
+
31
+ .gm-style .gm-style-iw-d {
32
+ overflow: auto !important;
33
+ }
34
+ .gm-style .gm-style-iw-d + button {
35
+ top: 0 !important;
36
+ right: 0 !important;
37
+ }
38
+ `
39
+ ]; }
40
+ get anchor() {
41
+ return this.renderRoot.querySelector('[map]');
42
+ }
43
+ async readyMap() {
44
+ await GoogleMapLoader.load();
45
+ // MarkerClusterer 라이브러리 로드
46
+ if (!window.markerClusterer) {
47
+ await GoogleMapLoader.loadMarkerClusterer();
48
+ }
49
+ if (this.map) {
50
+ return;
51
+ }
52
+ // DOM이 준비될 때까지 기다림
53
+ await this.updateComplete;
54
+ // anchor가 준비될 때까지 기다림
55
+ let attempts = 0;
56
+ const maxAttempts = 20;
57
+ while (attempts < maxAttempts) {
58
+ const anchor = this.anchor;
59
+ if (anchor && anchor.offsetWidth > 0) {
60
+ break;
61
+ }
62
+ await new Promise(resolve => setTimeout(resolve, 50));
63
+ attempts++;
64
+ }
65
+ if (!this.anchor) {
66
+ console.error('Map anchor element not found');
67
+ return;
68
+ }
69
+ var show = async (center, zoom) => {
70
+ try {
71
+ // Google Maps 최신 API 사용
72
+ const { Map } = (await google.maps.importLibrary('maps'));
73
+ const mapOptions = {
74
+ zoom,
75
+ center,
76
+ mapId: 'DEMO_MAP_ID'
77
+ };
78
+ // controls 속성이 있으면 지도 옵션에 추가
79
+ if (this.controls) {
80
+ Object.assign(mapOptions, this.controls);
81
+ }
82
+ const map = new Map(this.anchor, mapOptions);
83
+ this.markers && this.markers.forEach(marker => marker.setMap(map));
84
+ this.map = map;
85
+ this.dispatchEvent(new CustomEvent('map-change', {
86
+ detail: this.map
87
+ }));
88
+ this.resetBounds();
89
+ }
90
+ catch (e) {
91
+ console.error(e);
92
+ }
93
+ };
94
+ var { center, zoom = 10 } = this;
95
+ /* center 속성이 설정되어있지 않으면, 현재 위치를 구해서 지도의 center로 설정한다. */
96
+ if (!center && 'geolocation' in navigator && !this.boundCoords?.length) {
97
+ navigator.geolocation.getCurrentPosition(({ coords: { latitude: lat, longitude: lng } }) => show({ lat, lng }, zoom), err => {
98
+ console.warn(`navigator.geolocation.getCurrentPosition failed. (${err.code}): ${err.message}`);
99
+ show(this.defaultCenter, zoom);
100
+ }, {
101
+ /* https://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt */
102
+ timeout: 500
103
+ });
104
+ }
105
+ else {
106
+ show(center, zoom);
107
+ }
108
+ }
109
+ async buildMarkers(locations = []) {
110
+ if (!this.map) {
111
+ return;
112
+ }
113
+ if (this.markers) {
114
+ this.markers.forEach(marker => marker.setMap(null));
115
+ this.markers = [];
116
+ }
117
+ // 기존 클러스터 제거
118
+ if (this._markerClusterer) {
119
+ this._markerClusterer.clearMarkers();
120
+ this._markerClusterer = null;
121
+ }
122
+ // Google Maps 최신 API 사용
123
+ const { AdvancedMarkerElement, PinElement } = (await google.maps.importLibrary('marker'));
124
+ this.markers = locations
125
+ .map(location => {
126
+ // location 객체가 유효한지 확인
127
+ if (!location || typeof location !== 'object') {
128
+ console.warn('Invalid location object:', location);
129
+ return null;
130
+ }
131
+ // lat, lng 값이 유효한지 확인
132
+ const lat = parseFloat(location.lat);
133
+ const lng = parseFloat(location.lng);
134
+ if (isNaN(lat) || isNaN(lng)) {
135
+ console.warn('Invalid lat/lng values:', location);
136
+ return null;
137
+ }
138
+ // LatLng 객체 생성
139
+ const position = new google.maps.LatLng(lat, lng);
140
+ // 커스텀 마커 콘텐츠가 있으면 사용
141
+ let markerElement;
142
+ if (location.markerContent) {
143
+ // HTML 문자열을 DOM 요소로 변환
144
+ const tempDiv = document.createElement('div');
145
+ tempDiv.innerHTML = location.markerContent;
146
+ markerElement = tempDiv.firstElementChild;
147
+ }
148
+ else {
149
+ // 기본 핀 사용
150
+ markerElement = new PinElement({
151
+ background: '#1976d2',
152
+ borderColor: '#1565c0',
153
+ glyphColor: '#ffffff',
154
+ scale: 1.2
155
+ });
156
+ }
157
+ // AdvancedMarkerElement 사용
158
+ const marker = new AdvancedMarkerElement({
159
+ position: position,
160
+ map: null, // 클러스터에서 관리하므로 지도에 직접 추가하지 않음
161
+ content: markerElement
162
+ });
163
+ marker.addListener('click', () => {
164
+ // InfoWindow 대신 커스텀 이벤트 발생
165
+ if (location?.region) {
166
+ this.dispatchEvent(new CustomEvent('region-click', {
167
+ detail: { region: location.region },
168
+ bubbles: true,
169
+ composed: true
170
+ }));
171
+ }
172
+ });
173
+ return marker;
174
+ })
175
+ .filter(marker => marker !== null); // null 마커 제거
176
+ // Google Maps 공식 MarkerClusterer 사용 (예시와 동일한 방식)
177
+ if (this.markers.length > 0 && window.markerClusterer) {
178
+ this._markerClusterer = new window.markerClusterer.MarkerClusterer({
179
+ markers: this.markers,
180
+ map: this.map
181
+ });
182
+ }
183
+ }
184
+ get infoWindow() {
185
+ if (!this._infoWindow && this.map) {
186
+ this._infoWindow = new google.maps.InfoWindow({
187
+ content: 'loading...'
188
+ });
189
+ }
190
+ return this._infoWindow;
191
+ }
192
+ setFocus(focus, icon) {
193
+ focus.setZIndex(1);
194
+ focus.setIcon(icon);
195
+ }
196
+ resetFocus(focus, icon) {
197
+ focus.setZIndex(0);
198
+ focus.setIcon(icon);
199
+ }
200
+ async changeFocus(after, before) {
201
+ await this.readyMap();
202
+ // map이 준비되지 않았으면 포커스 변경하지 않음
203
+ if (!this.map) {
204
+ return;
205
+ }
206
+ var locations = this.locations || [];
207
+ if (before) {
208
+ var idx = locations.findIndex(location => {
209
+ // location 객체의 구조를 안전하게 확인
210
+ const beforePos = before?.position;
211
+ const locationPos = location?.position;
212
+ return (location?.name == before?.name && locationPos?.lat == beforePos?.lat && locationPos?.lng == beforePos?.lng);
213
+ });
214
+ idx !== -1 && this.markers && this.resetFocus(this.markers[idx], locations[idx]?.icon);
215
+ }
216
+ if (after) {
217
+ var idx = locations.findIndex(location => {
218
+ // location 객체의 구조를 안전하게 확인
219
+ const afterPos = after?.position;
220
+ const locationPos = location?.position;
221
+ return location?.name == after?.name && locationPos?.lat == afterPos?.lat && locationPos?.lng == afterPos?.lng;
222
+ });
223
+ idx !== -1 && this.markers && this.setFocus(this.markers[idx], after?.icon);
224
+ }
225
+ }
226
+ async updated(changes) {
227
+ if (!this.map) {
228
+ await this.readyMap();
229
+ }
230
+ if (changes.has('locations')) {
231
+ this.buildMarkers(this.locations);
232
+ }
233
+ if (changes.has('focused')) {
234
+ this.changeFocus(this.focused, changes.get('focused'));
235
+ }
236
+ if (changes.has('center')) {
237
+ this.map.setCenter(this.center);
238
+ }
239
+ if (changes.has('controls')) {
240
+ // controls가 변경되면 기존 지도의 옵션만 업데이트
241
+ if (this.map && this.controls) {
242
+ // Google Maps API의 setOptions 메서드 사용
243
+ this.map.setOptions(this.controls);
244
+ }
245
+ }
246
+ if (changes.has('polygons')) {
247
+ ;
248
+ (changes.get('polygons') || []).forEach(geofence => geofence.setMap(null));
249
+ (this.polygons || []).forEach(geofence => geofence.setMap(this.map));
250
+ }
251
+ if (changes.has('polylines')) {
252
+ ;
253
+ (changes.get('polylines') || []).forEach(polyline => polyline.setMap(null));
254
+ (this.polylines || []).forEach(polyline => polyline.setMap(this.map));
255
+ }
256
+ if (changes.has('markers')) {
257
+ ;
258
+ (changes.get('markers') || []).forEach(marker => marker.setMap(null));
259
+ (this.markers || []).forEach(marker => marker.setMap(this.map));
260
+ }
261
+ if (changes.has('boundCoords')) {
262
+ this.resetBounds();
263
+ }
264
+ // 클러스터링 설정 변경 시 마커 재구성
265
+ if (changes.has('clusterZoom')) {
266
+ this.buildMarkers(this.locations);
267
+ }
268
+ }
269
+ render() {
270
+ return html ` <div map></div> `;
271
+ }
272
+ resetBounds() {
273
+ if (!this.boundCoords || this.boundCoords.length < 1 || !this.map) {
274
+ return;
275
+ }
276
+ var bounds = new google.maps.LatLngBounds();
277
+ this.boundCoords.forEach(coord => bounds.extend(coord));
278
+ this.map.fitBounds(bounds);
279
+ }
280
+ };
281
+ __decorate([
282
+ property({ type: Object }),
283
+ __metadata("design:type", Object)
284
+ ], CommonGoogleMap.prototype, "center", void 0);
285
+ __decorate([
286
+ property({ type: Number }),
287
+ __metadata("design:type", Object)
288
+ ], CommonGoogleMap.prototype, "zoom", void 0);
289
+ __decorate([
290
+ property({ type: Array }),
291
+ __metadata("design:type", Array)
292
+ ], CommonGoogleMap.prototype, "locations", void 0);
293
+ __decorate([
294
+ property({ type: Object }),
295
+ __metadata("design:type", Object)
296
+ ], CommonGoogleMap.prototype, "focused", void 0);
297
+ __decorate([
298
+ property({ type: Array }),
299
+ __metadata("design:type", Object)
300
+ ], CommonGoogleMap.prototype, "polygons", void 0);
301
+ __decorate([
302
+ property({ type: Array }),
303
+ __metadata("design:type", Object)
304
+ ], CommonGoogleMap.prototype, "polylines", void 0);
305
+ __decorate([
306
+ property({ type: Array }),
307
+ __metadata("design:type", Object)
308
+ ], CommonGoogleMap.prototype, "markers", void 0);
309
+ __decorate([
310
+ property({ type: Array }),
311
+ __metadata("design:type", Object)
312
+ ], CommonGoogleMap.prototype, "boundCoords", void 0);
313
+ __decorate([
314
+ property({ type: Object }),
315
+ __metadata("design:type", Object)
316
+ ], CommonGoogleMap.prototype, "controls", void 0);
317
+ __decorate([
318
+ property({ type: Number }),
319
+ __metadata("design:type", Object)
320
+ ], CommonGoogleMap.prototype, "clusterZoom", void 0);
321
+ __decorate([
322
+ state(),
323
+ __metadata("design:type", Object)
324
+ ], CommonGoogleMap.prototype, "map", void 0);
325
+ __decorate([
326
+ state(),
327
+ __metadata("design:type", Object)
328
+ ], CommonGoogleMap.prototype, "defaultCenter", void 0);
329
+ CommonGoogleMap = __decorate([
330
+ customElement('common-google-map')
331
+ ], CommonGoogleMap);
332
+ export { CommonGoogleMap };
333
+ //# sourceMappingURL=common-google-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-google-map.js","sourceRoot":"","sources":["../../client/google-map/common-google-map.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;A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AC;;iDAAS;AACR;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAU;AACT;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAQ;AACP;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAY;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAS;AACR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAiB;AAEnC;IAAR,KAAK,EAAE;;4CAAgB;AACf;IAAR,KAAK,EAAE;;sDAA+C;AAtC5C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAqV3B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport GoogleMapLoader from './google-map-loader.js'\n\ndeclare global {\n interface Window {\n google: any\n markerClusterer?: any\n }\n}\n\ndeclare const google: any\n\ndeclare namespace google.maps {\n interface MapsLibrary {\n Map: any\n InfoWindow: any\n }\n\n interface MarkerLibrary {\n AdvancedMarkerElement: any\n PinElement: any\n }\n}\n\n@customElement('common-google-map')\nexport class CommonGoogleMap extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n }\n\n [map] {\n flex: 1;\n }\n\n .gm-style .gm-style-iw-c {\n padding: 0;\n }\n\n .gm-style .gm-style-iw-d {\n overflow: auto !important;\n }\n .gm-style .gm-style-iw-d + button {\n top: 0 !important;\n right: 0 !important;\n }\n `\n ]\n\n @property({ type: Object }) center\n @property({ type: Number }) zoom\n @property({ type: Array }) locations: any[] = []\n @property({ type: Object }) focused\n @property({ type: Array }) polygons\n @property({ type: Array }) polylines\n @property({ type: Array }) markers\n @property({ type: Array }) boundCoords\n @property({ type: Object }) controls\n @property({ type: Number }) clusterZoom = 10\n\n @state() map: any = null\n @state() defaultCenter: any = { lat: 36.5, lng: 127.5 }\n private _infoWindow: any = null\n private _markerClusterer: any = null\n\n get anchor() {\n return this.renderRoot.querySelector('[map]')\n }\n\n async readyMap() {\n await GoogleMapLoader.load()\n\n // MarkerClusterer 라이브러리 로드\n if (!window.markerClusterer) {\n await GoogleMapLoader.loadMarkerClusterer()\n }\n\n if (this.map) {\n return\n }\n\n // DOM이 준비될 때까지 기다림\n await this.updateComplete\n\n // anchor가 준비될 때까지 기다림\n let attempts = 0\n const maxAttempts = 20\n while (attempts < maxAttempts) {\n const anchor = this.anchor as HTMLElement\n if (anchor && anchor.offsetWidth > 0) {\n break\n }\n await new Promise(resolve => setTimeout(resolve, 50))\n attempts++\n }\n\n if (!this.anchor) {\n console.error('Map anchor element not found')\n return\n }\n\n var show = async (center, zoom) => {\n try {\n // Google Maps 최신 API 사용\n const { Map } = (await google.maps.importLibrary('maps')) as google.maps.MapsLibrary\n\n const mapOptions = {\n zoom,\n center,\n mapId: 'DEMO_MAP_ID'\n }\n\n // controls 속성이 있으면 지도 옵션에 추가\n if (this.controls) {\n Object.assign(mapOptions, this.controls)\n }\n\n const map = new Map(this.anchor, mapOptions)\n\n this.markers && this.markers.forEach(marker => marker.setMap(map))\n\n this.map = map\n\n this.dispatchEvent(\n new CustomEvent('map-change', {\n detail: this.map\n })\n )\n\n this.resetBounds()\n } catch (e) {\n console.error(e)\n }\n }\n\n var { center, zoom = 10 } = this\n\n /* center 속성이 설정되어있지 않으면, 현재 위치를 구해서 지도의 center로 설정한다. */\n if (!center && 'geolocation' in navigator && !this.boundCoords?.length) {\n navigator.geolocation.getCurrentPosition(\n ({ coords: { latitude: lat, longitude: lng } }) => show({ lat, lng }, zoom),\n err => {\n console.warn(`navigator.geolocation.getCurrentPosition failed. (${err.code}): ${err.message}`)\n show(this.defaultCenter, zoom)\n },\n {\n /* https://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt */\n timeout: 500\n }\n )\n } else {\n show(center, zoom)\n }\n }\n\n async buildMarkers(locations: any[] = []) {\n if (!this.map) {\n return\n }\n\n if (this.markers) {\n this.markers.forEach(marker => marker.setMap(null))\n this.markers = []\n }\n\n // 기존 클러스터 제거\n if (this._markerClusterer) {\n this._markerClusterer.clearMarkers()\n this._markerClusterer = null\n }\n\n // Google Maps 최신 API 사용\n const { AdvancedMarkerElement, PinElement } = (await google.maps.importLibrary(\n 'marker'\n )) as google.maps.MarkerLibrary\n\n this.markers = locations\n .map(location => {\n // location 객체가 유효한지 확인\n if (!location || typeof location !== 'object') {\n console.warn('Invalid location object:', location)\n return null\n }\n\n // lat, lng 값이 유효한지 확인\n const lat = parseFloat(location.lat)\n const lng = parseFloat(location.lng)\n\n if (isNaN(lat) || isNaN(lng)) {\n console.warn('Invalid lat/lng values:', location)\n return null\n }\n\n // LatLng 객체 생성\n const position = new google.maps.LatLng(lat, lng)\n\n // 커스텀 마커 콘텐츠가 있으면 사용\n let markerElement\n if (location.markerContent) {\n // HTML 문자열을 DOM 요소로 변환\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = location.markerContent\n markerElement = tempDiv.firstElementChild\n } else {\n // 기본 핀 사용\n markerElement = new PinElement({\n background: '#1976d2',\n borderColor: '#1565c0',\n glyphColor: '#ffffff',\n scale: 1.2\n })\n }\n\n // AdvancedMarkerElement 사용\n const marker = new AdvancedMarkerElement({\n position: position,\n map: null, // 클러스터에서 관리하므로 지도에 직접 추가하지 않음\n content: markerElement\n })\n\n marker.addListener('click', () => {\n // InfoWindow 대신 커스텀 이벤트 발생\n if (location?.region) {\n this.dispatchEvent(\n new CustomEvent('region-click', {\n detail: { region: location.region },\n bubbles: true,\n composed: true\n })\n )\n }\n })\n\n return marker\n })\n .filter(marker => marker !== null) // null 마커 제거\n\n // Google Maps 공식 MarkerClusterer 사용 (예시와 동일한 방식)\n if (this.markers.length > 0 && window.markerClusterer) {\n this._markerClusterer = new window.markerClusterer.MarkerClusterer({\n markers: this.markers,\n map: this.map\n })\n }\n }\n\n get infoWindow() {\n if (!this._infoWindow && this.map) {\n this._infoWindow = new google.maps.InfoWindow({\n content: 'loading...'\n })\n }\n\n return this._infoWindow\n }\n\n setFocus(focus, icon) {\n focus.setZIndex(1)\n focus.setIcon(icon)\n }\n\n resetFocus(focus, icon) {\n focus.setZIndex(0)\n focus.setIcon(icon)\n }\n\n async changeFocus(after, before) {\n await this.readyMap()\n\n // map이 준비되지 않았으면 포커스 변경하지 않음\n if (!this.map) {\n return\n }\n\n var locations = this.locations || []\n\n if (before) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const beforePos = before?.position\n const locationPos = location?.position\n\n return (\n location?.name == before?.name && locationPos?.lat == beforePos?.lat && locationPos?.lng == beforePos?.lng\n )\n })\n idx !== -1 && this.markers && this.resetFocus(this.markers[idx], locations[idx]?.icon)\n }\n\n if (after) {\n var idx = locations.findIndex(location => {\n // location 객체의 구조를 안전하게 확인\n const afterPos = after?.position\n const locationPos = location?.position\n\n return location?.name == after?.name && locationPos?.lat == afterPos?.lat && locationPos?.lng == afterPos?.lng\n })\n idx !== -1 && this.markers && this.setFocus(this.markers[idx], after?.icon)\n }\n }\n\n async updated(changes) {\n if (!this.map) {\n await this.readyMap()\n }\n\n if (changes.has('locations')) {\n this.buildMarkers(this.locations)\n }\n\n if (changes.has('focused')) {\n this.changeFocus(this.focused, changes.get('focused'))\n }\n\n if (changes.has('center')) {\n this.map.setCenter(this.center)\n }\n\n if (changes.has('controls')) {\n // controls가 변경되면 기존 지도의 옵션만 업데이트\n if (this.map && this.controls) {\n // Google Maps API의 setOptions 메서드 사용\n this.map.setOptions(this.controls)\n }\n }\n\n if (changes.has('polygons')) {\n ;(changes.get('polygons') || []).forEach(geofence => geofence.setMap(null))\n ;(this.polygons || []).forEach(geofence => geofence.setMap(this.map))\n }\n\n if (changes.has('polylines')) {\n ;(changes.get('polylines') || []).forEach(polyline => polyline.setMap(null))\n ;(this.polylines || []).forEach(polyline => polyline.setMap(this.map))\n }\n\n if (changes.has('markers')) {\n ;(changes.get('markers') || []).forEach(marker => marker.setMap(null))\n ;(this.markers || []).forEach(marker => marker.setMap(this.map))\n }\n\n if (changes.has('boundCoords')) {\n this.resetBounds()\n }\n\n // 클러스터링 설정 변경 시 마커 재구성\n if (changes.has('clusterZoom')) {\n this.buildMarkers(this.locations)\n }\n }\n\n render() {\n return html` <div map></div> `\n }\n\n resetBounds() {\n if (!this.boundCoords || this.boundCoords.length < 1 || !this.map) {\n return\n }\n\n var bounds = new google.maps.LatLngBounds()\n this.boundCoords.forEach(coord => bounds.extend(coord))\n this.map.fitBounds(bounds)\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export default class GoogleMapLoader {
2
+ static loaded: boolean;
3
+ static markerClustererLoaded: boolean;
4
+ static load(): Promise<void>;
5
+ static loadMarkerClusterer(): Promise<void>;
6
+ }
@@ -0,0 +1,22 @@
1
+ import ScriptLoader from '@operato/utils/script-loader.js';
2
+ export default class GoogleMapLoader {
3
+ static { this.loaded = false; }
4
+ static { this.markerClustererLoaded = false; }
5
+ static async load() {
6
+ if (GoogleMapLoader.loaded) {
7
+ return;
8
+ }
9
+ var key = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA';
10
+ await ScriptLoader.load('https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '') + '&libraries=places');
11
+ GoogleMapLoader.loaded = true;
12
+ }
13
+ static async loadMarkerClusterer() {
14
+ if (GoogleMapLoader.markerClustererLoaded) {
15
+ return;
16
+ }
17
+ // Google Maps 공식 MarkerClusterer 라이브러리 로드
18
+ await ScriptLoader.load('https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js');
19
+ GoogleMapLoader.markerClustererLoaded = true;
20
+ }
21
+ }
22
+ //# sourceMappingURL=google-map-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-map-loader.js","sourceRoot":"","sources":["../../client/google-map/google-map-loader.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAE1D,MAAM,CAAC,OAAO,OAAO,eAAe;aAC3B,WAAM,GAAG,KAAK,CAAA;aACd,0BAAqB,GAAG,KAAK,CAAA;IAEpC,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,IAAI,eAAe,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QACD,IAAI,GAAG,GAAG,yCAAyC,CAAA;QAEnD,MAAM,YAAY,CAAC,IAAI,CACrB,yCAAyC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAC7F,CAAA;QACD,eAAe,CAAC,MAAM,GAAG,IAAI,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB;QAC9B,IAAI,eAAe,CAAC,qBAAqB,EAAE,CAAC;YAC1C,OAAM;QACR,CAAC;QAED,0CAA0C;QAC1C,MAAM,YAAY,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAA;QAE1F,eAAe,CAAC,qBAAqB,GAAG,IAAI,CAAA;IAC9C,CAAC","sourcesContent":["import ScriptLoader from '@operato/utils/script-loader.js'\n\nexport default class GoogleMapLoader {\n static loaded = false\n static markerClustererLoaded = false\n\n static async load() {\n if (GoogleMapLoader.loaded) {\n return\n }\n var key = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA'\n\n await ScriptLoader.load(\n 'https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '') + '&libraries=places'\n )\n GoogleMapLoader.loaded = true\n }\n\n static async loadMarkerClusterer() {\n if (GoogleMapLoader.markerClustererLoaded) {\n return\n }\n\n // Google Maps 공식 MarkerClusterer 라이브러리 로드\n await ScriptLoader.load('https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js')\n\n GoogleMapLoader.markerClustererLoaded = true\n }\n}\n"]}