qc-ui-lit 0.0.3 → 0.0.4

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.
@@ -0,0 +1,129 @@
1
+ import { LitElement as e, html as t } from "lit";
2
+ import { customElement as n, property as r, state as i } from "lit/decorators.js";
3
+ //#region \0@oxc-project+runtime@0.126.0/helpers/decorate.js
4
+ function a(e, t, n, r) {
5
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
6
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
7
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
8
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
9
+ }
10
+ //#endregion
11
+ //#region src/tools/loadAMap/loadAMap.ts
12
+ var o, s = {
13
+ version: "2.0",
14
+ key: "94af010abe03a5b2a2f98e6739a11d0c",
15
+ secret: "031abe8352fc9fa9ac8d14a86a5ec1cf"
16
+ };
17
+ function c() {
18
+ return new Promise((e) => {
19
+ let t = document.createElement("script");
20
+ t.innerHTML = `
21
+ window._AMapSecurityConfig = {
22
+ securityJsCode: '${o.secret}',
23
+ };`, document.head.appendChild(t), e(null);
24
+ });
25
+ }
26
+ function l() {
27
+ let e = `${o.url}?v=${o.version}&key=${o.key}&plugin=${o.plugins.join(",")}`;
28
+ return new Promise((t, n) => {
29
+ let r = document.createElement("script");
30
+ r.async = !1, r.src = e, r.onerror = n, r.onload = t, document.head.appendChild(r);
31
+ });
32
+ }
33
+ function u() {
34
+ let e = `${o.locaUrl}?v=${o.version}&key=${o.key}&plugin=${o.plugins.join(",")}`;
35
+ return new Promise((t, n) => {
36
+ let r = document.createElement("script");
37
+ r.async = !1, r.src = e, r.onerror = n, r.onload = t, document.head.appendChild(r);
38
+ });
39
+ }
40
+ var d = async (e) => {
41
+ o = {
42
+ ...e,
43
+ key: e.key || s.key,
44
+ secret: e.secret || s.secret,
45
+ plugins: e.plugins || []
46
+ };
47
+ try {
48
+ let t = window;
49
+ if (t.AMap && e.onLoad && e.onLoad(t.AMap), await c(), await l(), await u(), t.AMap) e.onLoad && e.onLoad(t.AMap);
50
+ else throw Error("AMap not loaded");
51
+ } catch (t) {
52
+ e.onError && e.onError(t);
53
+ }
54
+ }, f = class extends e {
55
+ createRenderRoot() {
56
+ return this;
57
+ }
58
+ constructor() {
59
+ super(), this.version = "2.0", this.key = "94af010abe03a5b2a2f98e6739a11d0c", this.secret = "031abe8352fc9fa9ac8d14a86a5ec1cf", this.AMapUrl = "https://webapi.amap.com/maps", this.AMapLocaUrl = "https://webapi.amap.com/loca", this.plugins = [], this.viewMode = "2D", this.zoom = 10, this.center = [116.397428, 39.90923], this.zooms = [3, 18], this.animateEnable = !0, this.loading = !0, this.operatingData = { timeoutFlag: null }, this.oncomplete = () => {
60
+ this.dispatchEvent(new CustomEvent("load", { detail: {
61
+ map: this.map,
62
+ AMap: this.AMap
63
+ } })), this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } })), setTimeout(() => {
64
+ this.loading = !1;
65
+ }, 100);
66
+ }, this.onStartOperating = () => {
67
+ this.dispatchEvent(new CustomEvent("startOperating"));
68
+ }, this.onEndOperating_timeout = () => {
69
+ this.operatingData.timeoutFlag && (clearTimeout(this.operatingData.timeoutFlag), this.operatingData.timeoutFlag = null), this.operatingData.timeoutFlag = setTimeout(() => {
70
+ this.dispatchEvent(new CustomEvent("endOperating")), this.operatingData.timeoutFlag = null;
71
+ }, 400);
72
+ }, this.onzoomchange = () => {
73
+ this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } }));
74
+ };
75
+ }
76
+ async connectedCallback() {
77
+ super.connectedCallback(), await d({
78
+ key: this.key,
79
+ secret: this.secret,
80
+ version: this.version,
81
+ url: this.AMapUrl,
82
+ locaUrl: this.AMapLocaUrl,
83
+ plugins: this.plugins,
84
+ onLoad: () => {
85
+ this.AMap = window.AMap, this.initAMap();
86
+ },
87
+ onError: (e) => {
88
+ console.error("AMap load error", e), this.loading = !1;
89
+ }
90
+ });
91
+ }
92
+ async firstUpdated() {
93
+ this.initAMap();
94
+ }
95
+ disconnectedCallback() {
96
+ super.disconnectedCallback(), this.removeEventListener(), this.operatingData.timeoutFlag && (clearTimeout(this.operatingData.timeoutFlag), this.operatingData.timeoutFlag = null), this.map &&= (this.map.destroy(), null);
97
+ }
98
+ initAMap() {
99
+ if (!this.AMap) return;
100
+ let e = this.querySelector(".a-map-container");
101
+ e && (this.map = new this.AMap.Map(e, {
102
+ resizeEnable: !0,
103
+ viewMode: this.viewMode,
104
+ zoom: this.zoom,
105
+ center: this.center,
106
+ zooms: this.zooms,
107
+ animateEnable: this.animateEnable
108
+ }), this.addEventListeners(), this.dispatchEvent(new CustomEvent("load", { detail: {
109
+ map: this.map,
110
+ AMap: this.AMap
111
+ } })));
112
+ }
113
+ addEventListeners() {
114
+ this.map && (this.map.on("complete", this.oncomplete), this.map.on("zoomstart", this.onStartOperating), this.map.on("zoomend", this.onEndOperating_timeout), this.map.on("zoomchange", this.onzoomchange), this.map.on("mousedown", this.onStartOperating), this.map.on("mouseup", this.onEndOperating_timeout), this.map.on("touchstart", this.onStartOperating), this.map.on("touchend", this.onEndOperating_timeout));
115
+ }
116
+ removeEventListener() {
117
+ this.map && (this.map.off("complete", this.oncomplete), this.map.off("zoomstart", this.onStartOperating), this.map.off("zoomend", this.onEndOperating_timeout), this.map.off("zoomchange", this.onzoomchange), this.map.off("mousedown", this.onStartOperating), this.map.off("mouseup", this.onEndOperating_timeout), this.map.off("touchstart", this.onStartOperating), this.map.off("touchend", this.onEndOperating_timeout));
118
+ }
119
+ render() {
120
+ return t`<section id="a-map">
121
+ <qc-loading .loading=${this.loading}>
122
+ <div class="a-map-container"></div>
123
+ </qc-loading>
124
+ </section>`;
125
+ }
126
+ };
127
+ a([r({ type: String })], f.prototype, "version", void 0), a([r({ type: String })], f.prototype, "key", void 0), a([r({ type: String })], f.prototype, "secret", void 0), a([r({ type: String })], f.prototype, "AMapUrl", void 0), a([r({ type: String })], f.prototype, "AMapLocaUrl", void 0), a([r({ type: Array })], f.prototype, "plugins", void 0), a([r({ type: String })], f.prototype, "viewMode", void 0), a([r({ type: Number })], f.prototype, "zoom", void 0), a([r({ type: Array })], f.prototype, "center", void 0), a([r({ type: Array })], f.prototype, "zooms", void 0), a([r({ type: Boolean })], f.prototype, "animateEnable", void 0), a([i()], f.prototype, "loading", void 0), f = a([n("a-map")], f);
128
+ //#endregion
129
+ export { d as n, a as r, f as t };
@@ -0,0 +1,105 @@
1
+ import { r as e } from "./AMap.js";
2
+ import { LitElement as t, css as n, html as r } from "lit";
3
+ import { customElement as i, property as a, state as o } from "lit/decorators.js";
4
+ import { classMap as s } from "lit/directives/class-map.js";
5
+ //#region src/components/Loading/qc-loading.ts
6
+ var c = class extends t {
7
+ constructor(...e) {
8
+ super(...e), this.loading = !0, this.classes = {
9
+ "qc-loading": !0,
10
+ loading: !0
11
+ };
12
+ }
13
+ willUpdate(e) {
14
+ e.has("loading") && (this.classes.loading = this.loading);
15
+ }
16
+ render() {
17
+ return r`<section id="qc-loading" class=${s(this.classes)}>
18
+ <slot></slot>
19
+ <div class="qc-loading-mask">
20
+ <div class="qc-loading-spinner">
21
+ <div class="qc-loading-spinner-cirlce cirlce1"></div>
22
+ <div class="qc-loading-spinner-cirlce cirlce2"></div>
23
+ <div class="qc-loading-spinner-cirlce cirlce3"></div>
24
+ <div class="qc-loading-spinner-cirlce cirlce4"></div>
25
+ </div>
26
+ </div>
27
+ </section>`;
28
+ }
29
+ static {
30
+ this.styles = n`
31
+ .qc-loading {
32
+ width: 100%;
33
+ height: 100%;
34
+ position: relative;
35
+ }
36
+ .qc-loading-mask {
37
+ content: '';
38
+ display: none;
39
+ width: 100%;
40
+ height: 100%;
41
+ background: rgba(255, 255, 255, 0.8);
42
+ position: absolute;
43
+ top: 0;
44
+ left: 0;
45
+ justify-content: center;
46
+ align-items: center;
47
+ }
48
+ .qc-loading-mask {
49
+ display: none;
50
+ }
51
+ .qc-loading-spinner {
52
+ width: 6%;
53
+ aspect-ratio: 1 / 1; /* 保持正方形 */
54
+ position: relative;
55
+ animation: route 1s linear infinite;
56
+ transform: rotate(90deg);
57
+ }
58
+ .loading .qc-loading-mask {
59
+ display: flex;
60
+ }
61
+ .qc-loading-spinner-cirlce {
62
+ position: absolute;
63
+ width: 60%;
64
+ height: 60%;
65
+ border-radius: 50%;
66
+ background-color: #1677ff;
67
+ transform: translate(-50%, -50%);
68
+ animation: hidden 1s linear infinite alternate;
69
+ opacity: 0.3;
70
+ }
71
+ .cirlce1 {
72
+ top: 0;
73
+ left: 0;
74
+ }
75
+ .cirlce2 {
76
+ top: 0;
77
+ left: 100%;
78
+ animation-delay: 0.25s;
79
+ }
80
+ .cirlce3 {
81
+ top: 100%;
82
+ left: 100%;
83
+ animation-delay: 0.5s;
84
+ }
85
+ .cirlce4 {
86
+ top: 100%;
87
+ left: 0;
88
+ animation-delay: 0.75s;
89
+ }
90
+ @keyframes route {
91
+ to {
92
+ transform: rotate(450deg);
93
+ }
94
+ }
95
+ @keyframes hidden {
96
+ to {
97
+ opacity: 1;
98
+ }
99
+ }
100
+ `;
101
+ }
102
+ };
103
+ e([a({ type: Boolean })], c.prototype, "loading", void 0), e([o()], c.prototype, "classes", void 0), c = e([i("qc-loading")], c);
104
+ //#endregion
105
+ export { c as t };
@@ -0,0 +1,2 @@
1
+ import "./AMap.js";
2
+ import "./Loading.js";
package/dist/index.css CHANGED
@@ -1 +1,2 @@
1
1
  #a-map{width:100%;height:100%;position:relative}#a-map .a-map-container{width:100%;height:100%}.amap-logo,.amap-copyright{display:none!important}
2
+ /*$vite$:1*/
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { n as e, t } from "./components/AMap.js";
2
+ import { t as n } from "./components/Loading.js";
3
+ import "./components/index.ts.js";
4
+ export { t as AMap, n as QCLoading, e as loadAMap };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qc-ui-lit",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "基于 Lit 的 Web Components 组件库",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -15,15 +15,18 @@
15
15
  "amap"
16
16
  ],
17
17
  "type": "module",
18
- "main": "./dist/qc-ui-lit.js",
19
- "module": "./dist/qc-ui-lit.js",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.js",
20
20
  "types": "./dist/index.d.ts",
21
21
  "exports": {
22
22
  ".": {
23
- "import": "./dist/qc-ui-lit.js",
23
+ "import": "./dist/index.js",
24
24
  "types": "./dist/index.d.ts"
25
25
  }
26
26
  },
27
+ "peerDependencies": {
28
+ "lit": "^3.0.0"
29
+ },
27
30
  "files": [
28
31
  "dist"
29
32
  ],
package/dist/qc-ui-lit.js DELETED
@@ -1,834 +0,0 @@
1
- //#region node_modules/@lit/reactive-element/css-tag.js
2
- var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, n = Symbol(), r = /* @__PURE__ */ new WeakMap(), i = class {
3
- constructor(e, t, r) {
4
- if (this._$cssResult$ = !0, r !== n) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
- this.cssText = e, this.t = t;
6
- }
7
- get styleSheet() {
8
- let e = this.o, n = this.t;
9
- if (t && e === void 0) {
10
- let t = n !== void 0 && n.length === 1;
11
- t && (e = r.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), t && r.set(n, e));
12
- }
13
- return e;
14
- }
15
- toString() {
16
- return this.cssText;
17
- }
18
- }, a = (e) => new i(typeof e == "string" ? e : e + "", void 0, n), o = (e, ...t) => new i(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
19
- if (!0 === e._$cssResult$) return e.cssText;
20
- if (typeof e == "number") return e;
21
- throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
22
- })(n) + e[r + 1], e[0]), e, n), s = (n, r) => {
23
- if (t) n.adoptedStyleSheets = r.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
24
- else for (let t of r) {
25
- let r = document.createElement("style"), i = e.litNonce;
26
- i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, n.appendChild(r);
27
- }
28
- }, c = t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
29
- let t = "";
30
- for (let n of e.cssRules) t += n.cssText;
31
- return a(t);
32
- })(e) : e, { is: l, defineProperty: u, getOwnPropertyDescriptor: d, getOwnPropertyNames: ee, getOwnPropertySymbols: te, getPrototypeOf: ne } = Object, f = globalThis, p = f.trustedTypes, re = p ? p.emptyScript : "", ie = f.reactiveElementPolyfillSupport, m = (e, t) => e, h = {
33
- toAttribute(e, t) {
34
- switch (t) {
35
- case Boolean:
36
- e = e ? re : null;
37
- break;
38
- case Object:
39
- case Array: e = e == null ? e : JSON.stringify(e);
40
- }
41
- return e;
42
- },
43
- fromAttribute(e, t) {
44
- let n = e;
45
- switch (t) {
46
- case Boolean:
47
- n = e !== null;
48
- break;
49
- case Number:
50
- n = e === null ? null : Number(e);
51
- break;
52
- case Object:
53
- case Array: try {
54
- n = JSON.parse(e);
55
- } catch {
56
- n = null;
57
- }
58
- }
59
- return n;
60
- }
61
- }, g = (e, t) => !l(e, t), _ = {
62
- attribute: !0,
63
- type: String,
64
- converter: h,
65
- reflect: !1,
66
- useDefault: !1,
67
- hasChanged: g
68
- };
69
- Symbol.metadata ??= Symbol("metadata"), f.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
70
- var v = class extends HTMLElement {
71
- static addInitializer(e) {
72
- this._$Ei(), (this.l ??= []).push(e);
73
- }
74
- static get observedAttributes() {
75
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
76
- }
77
- static createProperty(e, t = _) {
78
- if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
79
- let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
80
- r !== void 0 && u(this.prototype, e, r);
81
- }
82
- }
83
- static getPropertyDescriptor(e, t, n) {
84
- let { get: r, set: i } = d(this.prototype, e) ?? {
85
- get() {
86
- return this[t];
87
- },
88
- set(e) {
89
- this[t] = e;
90
- }
91
- };
92
- return {
93
- get: r,
94
- set(t) {
95
- let a = r?.call(this);
96
- i?.call(this, t), this.requestUpdate(e, a, n);
97
- },
98
- configurable: !0,
99
- enumerable: !0
100
- };
101
- }
102
- static getPropertyOptions(e) {
103
- return this.elementProperties.get(e) ?? _;
104
- }
105
- static _$Ei() {
106
- if (this.hasOwnProperty(m("elementProperties"))) return;
107
- let e = ne(this);
108
- e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
109
- }
110
- static finalize() {
111
- if (this.hasOwnProperty(m("finalized"))) return;
112
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(m("properties"))) {
113
- let e = this.properties, t = [...ee(e), ...te(e)];
114
- for (let n of t) this.createProperty(n, e[n]);
115
- }
116
- let e = this[Symbol.metadata];
117
- if (e !== null) {
118
- let t = litPropertyMetadata.get(e);
119
- if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
120
- }
121
- this._$Eh = /* @__PURE__ */ new Map();
122
- for (let [e, t] of this.elementProperties) {
123
- let n = this._$Eu(e, t);
124
- n !== void 0 && this._$Eh.set(n, e);
125
- }
126
- this.elementStyles = this.finalizeStyles(this.styles);
127
- }
128
- static finalizeStyles(e) {
129
- let t = [];
130
- if (Array.isArray(e)) {
131
- let n = new Set(e.flat(Infinity).reverse());
132
- for (let e of n) t.unshift(c(e));
133
- } else e !== void 0 && t.push(c(e));
134
- return t;
135
- }
136
- static _$Eu(e, t) {
137
- let n = t.attribute;
138
- return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
139
- }
140
- constructor() {
141
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
142
- }
143
- _$Ev() {
144
- this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
145
- }
146
- addController(e) {
147
- (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
148
- }
149
- removeController(e) {
150
- this._$EO?.delete(e);
151
- }
152
- _$E_() {
153
- let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
154
- for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
155
- e.size > 0 && (this._$Ep = e);
156
- }
157
- createRenderRoot() {
158
- let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
159
- return s(e, this.constructor.elementStyles), e;
160
- }
161
- connectedCallback() {
162
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
163
- }
164
- enableUpdating(e) {}
165
- disconnectedCallback() {
166
- this._$EO?.forEach((e) => e.hostDisconnected?.());
167
- }
168
- attributeChangedCallback(e, t, n) {
169
- this._$AK(e, n);
170
- }
171
- _$ET(e, t) {
172
- let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
173
- if (r !== void 0 && !0 === n.reflect) {
174
- let i = (n.converter?.toAttribute === void 0 ? h : n.converter).toAttribute(t, n.type);
175
- this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
176
- }
177
- }
178
- _$AK(e, t) {
179
- let n = this.constructor, r = n._$Eh.get(e);
180
- if (r !== void 0 && this._$Em !== r) {
181
- let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? h : e.converter;
182
- this._$Em = r;
183
- let a = i.fromAttribute(t, e.type);
184
- this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
185
- }
186
- }
187
- requestUpdate(e, t, n, r = !1, i) {
188
- if (e !== void 0) {
189
- let a = this.constructor;
190
- if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? g)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
191
- this.C(e, t, n);
192
- }
193
- !1 === this.isUpdatePending && (this._$ES = this._$EP());
194
- }
195
- C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
196
- n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
197
- }
198
- async _$EP() {
199
- this.isUpdatePending = !0;
200
- try {
201
- await this._$ES;
202
- } catch (e) {
203
- Promise.reject(e);
204
- }
205
- let e = this.scheduleUpdate();
206
- return e != null && await e, !this.isUpdatePending;
207
- }
208
- scheduleUpdate() {
209
- return this.performUpdate();
210
- }
211
- performUpdate() {
212
- if (!this.isUpdatePending) return;
213
- if (!this.hasUpdated) {
214
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
215
- for (let [e, t] of this._$Ep) this[e] = t;
216
- this._$Ep = void 0;
217
- }
218
- let e = this.constructor.elementProperties;
219
- if (e.size > 0) for (let [t, n] of e) {
220
- let { wrapped: e } = n, r = this[t];
221
- !0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
222
- }
223
- }
224
- let e = !1, t = this._$AL;
225
- try {
226
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
227
- } catch (t) {
228
- throw e = !1, this._$EM(), t;
229
- }
230
- e && this._$AE(t);
231
- }
232
- willUpdate(e) {}
233
- _$AE(e) {
234
- this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
235
- }
236
- _$EM() {
237
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
238
- }
239
- get updateComplete() {
240
- return this.getUpdateComplete();
241
- }
242
- getUpdateComplete() {
243
- return this._$ES;
244
- }
245
- shouldUpdate(e) {
246
- return !0;
247
- }
248
- update(e) {
249
- this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
250
- }
251
- updated(e) {}
252
- firstUpdated(e) {}
253
- };
254
- v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[m("elementProperties")] = /* @__PURE__ */ new Map(), v[m("finalized")] = /* @__PURE__ */ new Map(), ie?.({ ReactiveElement: v }), (f.reactiveElementVersions ??= []).push("2.1.2");
255
- //#endregion
256
- //#region node_modules/lit-html/lit-html.js
257
- var y = globalThis, b = (e) => e, x = y.trustedTypes, S = x ? x.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, C = "$lit$", w = `lit$${Math.random().toFixed(9).slice(2)}$`, T = "?" + w, ae = `<${T}>`, E = document, D = () => E.createComment(""), O = (e) => e === null || typeof e != "object" && typeof e != "function", k = Array.isArray, oe = (e) => k(e) || typeof e?.[Symbol.iterator] == "function", A = "[ \n\f\r]", j = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, se = /-->/g, ce = />/g, M = RegExp(`>|${A}(?:([^\\s"'>=/]+)(${A}*=${A}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), le = /'/g, N = /"/g, P = /^(?:script|style|textarea|title)$/i, F = ((e) => (t, ...n) => ({
258
- _$litType$: e,
259
- strings: t,
260
- values: n
261
- }))(1), I = Symbol.for("lit-noChange"), L = Symbol.for("lit-nothing"), R = /* @__PURE__ */ new WeakMap(), z = E.createTreeWalker(E, 129);
262
- function B(e, t) {
263
- if (!k(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
264
- return S === void 0 ? t : S.createHTML(t);
265
- }
266
- var ue = (e, t) => {
267
- let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = j;
268
- for (let t = 0; t < n; t++) {
269
- let n = e[t], s, c, l = -1, u = 0;
270
- for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === j ? c[1] === "!--" ? o = se : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = M) : (P.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = M) : o = ce : o === M ? c[0] === ">" ? (o = i ?? j, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? M : c[3] === "\"" ? N : le) : o === N || o === le ? o = M : o === se || o === ce ? o = j : (o = M, i = void 0);
271
- let d = o === M && e[t + 1].startsWith("/>") ? " " : "";
272
- a += o === j ? n + ae : l >= 0 ? (r.push(s), n.slice(0, l) + C + n.slice(l) + w + d) : n + w + (l === -2 ? t : d);
273
- }
274
- return [B(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
275
- }, V = class e {
276
- constructor({ strings: t, _$litType$: n }, r) {
277
- let i;
278
- this.parts = [];
279
- let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = ue(t, n);
280
- if (this.el = e.createElement(l, r), z.currentNode = this.el.content, n === 2 || n === 3) {
281
- let e = this.el.content.firstChild;
282
- e.replaceWith(...e.childNodes);
283
- }
284
- for (; (i = z.nextNode()) !== null && c.length < s;) {
285
- if (i.nodeType === 1) {
286
- if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(C)) {
287
- let t = u[o++], n = i.getAttribute(e).split(w), r = /([.?@])?(.*)/.exec(t);
288
- c.push({
289
- type: 1,
290
- index: a,
291
- name: r[2],
292
- strings: n,
293
- ctor: r[1] === "." ? fe : r[1] === "?" ? pe : r[1] === "@" ? me : W
294
- }), i.removeAttribute(e);
295
- } else e.startsWith(w) && (c.push({
296
- type: 6,
297
- index: a
298
- }), i.removeAttribute(e));
299
- if (P.test(i.tagName)) {
300
- let e = i.textContent.split(w), t = e.length - 1;
301
- if (t > 0) {
302
- i.textContent = x ? x.emptyScript : "";
303
- for (let n = 0; n < t; n++) i.append(e[n], D()), z.nextNode(), c.push({
304
- type: 2,
305
- index: ++a
306
- });
307
- i.append(e[t], D());
308
- }
309
- }
310
- } else if (i.nodeType === 8) if (i.data === T) c.push({
311
- type: 2,
312
- index: a
313
- });
314
- else {
315
- let e = -1;
316
- for (; (e = i.data.indexOf(w, e + 1)) !== -1;) c.push({
317
- type: 7,
318
- index: a
319
- }), e += w.length - 1;
320
- }
321
- a++;
322
- }
323
- }
324
- static createElement(e, t) {
325
- let n = E.createElement("template");
326
- return n.innerHTML = e, n;
327
- }
328
- };
329
- function H(e, t, n = e, r) {
330
- if (t === I) return t;
331
- let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = O(t) ? void 0 : t._$litDirective$;
332
- return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = H(e, i._$AS(e, t.values), i, r)), t;
333
- }
334
- var de = class {
335
- constructor(e, t) {
336
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
337
- }
338
- get parentNode() {
339
- return this._$AM.parentNode;
340
- }
341
- get _$AU() {
342
- return this._$AM._$AU;
343
- }
344
- u(e) {
345
- let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? E).importNode(t, !0);
346
- z.currentNode = r;
347
- let i = z.nextNode(), a = 0, o = 0, s = n[0];
348
- for (; s !== void 0;) {
349
- if (a === s.index) {
350
- let t;
351
- s.type === 2 ? t = new U(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new he(i, this, e)), this._$AV.push(t), s = n[++o];
352
- }
353
- a !== s?.index && (i = z.nextNode(), a++);
354
- }
355
- return z.currentNode = E, r;
356
- }
357
- p(e) {
358
- let t = 0;
359
- for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
360
- }
361
- }, U = class e {
362
- get _$AU() {
363
- return this._$AM?._$AU ?? this._$Cv;
364
- }
365
- constructor(e, t, n, r) {
366
- this.type = 2, this._$AH = L, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
367
- }
368
- get parentNode() {
369
- let e = this._$AA.parentNode, t = this._$AM;
370
- return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
371
- }
372
- get startNode() {
373
- return this._$AA;
374
- }
375
- get endNode() {
376
- return this._$AB;
377
- }
378
- _$AI(e, t = this) {
379
- e = H(this, e, t), O(e) ? e === L || e == null || e === "" ? (this._$AH !== L && this._$AR(), this._$AH = L) : e !== this._$AH && e !== I && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? oe(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
380
- }
381
- O(e) {
382
- return this._$AA.parentNode.insertBefore(e, this._$AB);
383
- }
384
- T(e) {
385
- this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
386
- }
387
- _(e) {
388
- this._$AH !== L && O(this._$AH) ? this._$AA.nextSibling.data = e : this.T(E.createTextNode(e)), this._$AH = e;
389
- }
390
- $(e) {
391
- let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = V.createElement(B(n.h, n.h[0]), this.options)), n);
392
- if (this._$AH?._$AD === r) this._$AH.p(t);
393
- else {
394
- let e = new de(r, this), n = e.u(this.options);
395
- e.p(t), this.T(n), this._$AH = e;
396
- }
397
- }
398
- _$AC(e) {
399
- let t = R.get(e.strings);
400
- return t === void 0 && R.set(e.strings, t = new V(e)), t;
401
- }
402
- k(t) {
403
- k(this._$AH) || (this._$AH = [], this._$AR());
404
- let n = this._$AH, r, i = 0;
405
- for (let a of t) i === n.length ? n.push(r = new e(this.O(D()), this.O(D()), this, this.options)) : r = n[i], r._$AI(a), i++;
406
- i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
407
- }
408
- _$AR(e = this._$AA.nextSibling, t) {
409
- for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
410
- let t = b(e).nextSibling;
411
- b(e).remove(), e = t;
412
- }
413
- }
414
- setConnected(e) {
415
- this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
416
- }
417
- }, W = class {
418
- get tagName() {
419
- return this.element.tagName;
420
- }
421
- get _$AU() {
422
- return this._$AM._$AU;
423
- }
424
- constructor(e, t, n, r, i) {
425
- this.type = 1, this._$AH = L, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = L;
426
- }
427
- _$AI(e, t = this, n, r) {
428
- let i = this.strings, a = !1;
429
- if (i === void 0) e = H(this, e, t, 0), a = !O(e) || e !== this._$AH && e !== I, a && (this._$AH = e);
430
- else {
431
- let r = e, o, s;
432
- for (e = i[0], o = 0; o < i.length - 1; o++) s = H(this, r[n + o], t, o), s === I && (s = this._$AH[o]), a ||= !O(s) || s !== this._$AH[o], s === L ? e = L : e !== L && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
433
- }
434
- a && !r && this.j(e);
435
- }
436
- j(e) {
437
- e === L ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
438
- }
439
- }, fe = class extends W {
440
- constructor() {
441
- super(...arguments), this.type = 3;
442
- }
443
- j(e) {
444
- this.element[this.name] = e === L ? void 0 : e;
445
- }
446
- }, pe = class extends W {
447
- constructor() {
448
- super(...arguments), this.type = 4;
449
- }
450
- j(e) {
451
- this.element.toggleAttribute(this.name, !!e && e !== L);
452
- }
453
- }, me = class extends W {
454
- constructor(e, t, n, r, i) {
455
- super(e, t, n, r, i), this.type = 5;
456
- }
457
- _$AI(e, t = this) {
458
- if ((e = H(this, e, t, 0) ?? L) === I) return;
459
- let n = this._$AH, r = e === L && n !== L || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== L && (n === L || r);
460
- r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
461
- }
462
- handleEvent(e) {
463
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
464
- }
465
- }, he = class {
466
- constructor(e, t, n) {
467
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
468
- }
469
- get _$AU() {
470
- return this._$AM._$AU;
471
- }
472
- _$AI(e) {
473
- H(this, e);
474
- }
475
- }, ge = y.litHtmlPolyfillSupport;
476
- ge?.(V, U), (y.litHtmlVersions ??= []).push("3.3.2");
477
- var _e = (e, t, n) => {
478
- let r = n?.renderBefore ?? t, i = r._$litPart$;
479
- if (i === void 0) {
480
- let e = n?.renderBefore ?? null;
481
- r._$litPart$ = i = new U(t.insertBefore(D(), e), e, void 0, n ?? {});
482
- }
483
- return i._$AI(e), i;
484
- }, G = globalThis, K = class extends v {
485
- constructor() {
486
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
487
- }
488
- createRenderRoot() {
489
- let e = super.createRenderRoot();
490
- return this.renderOptions.renderBefore ??= e.firstChild, e;
491
- }
492
- update(e) {
493
- let t = this.render();
494
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = _e(t, this.renderRoot, this.renderOptions);
495
- }
496
- connectedCallback() {
497
- super.connectedCallback(), this._$Do?.setConnected(!0);
498
- }
499
- disconnectedCallback() {
500
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
501
- }
502
- render() {
503
- return I;
504
- }
505
- };
506
- K._$litElement$ = !0, K.finalized = !0, G.litElementHydrateSupport?.({ LitElement: K });
507
- var ve = G.litElementPolyfillSupport;
508
- ve?.({ LitElement: K }), (G.litElementVersions ??= []).push("4.2.2");
509
- //#endregion
510
- //#region node_modules/@lit/reactive-element/decorators/custom-element.js
511
- var q = (e) => (t, n) => {
512
- n === void 0 ? customElements.define(e, t) : n.addInitializer(() => {
513
- customElements.define(e, t);
514
- });
515
- }, ye = {
516
- attribute: !0,
517
- type: String,
518
- converter: h,
519
- reflect: !1,
520
- hasChanged: g
521
- }, be = (e = ye, t, n) => {
522
- let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
523
- if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
524
- let { name: r } = n;
525
- return {
526
- set(n) {
527
- let i = t.get.call(this);
528
- t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
529
- },
530
- init(t) {
531
- return t !== void 0 && this.C(r, void 0, e, t), t;
532
- }
533
- };
534
- }
535
- if (r === "setter") {
536
- let { name: r } = n;
537
- return function(n) {
538
- let i = this[r];
539
- t.call(this, n), this.requestUpdate(r, i, e, !0, n);
540
- };
541
- }
542
- throw Error("Unsupported decorator location: " + r);
543
- };
544
- function J(e) {
545
- return (t, n) => typeof n == "object" ? be(e, t, n) : ((e, t, n) => {
546
- let r = t.hasOwnProperty(n);
547
- return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
548
- })(e, t, n);
549
- }
550
- //#endregion
551
- //#region node_modules/@lit/reactive-element/decorators/state.js
552
- function Y(e) {
553
- return J({
554
- ...e,
555
- state: !0,
556
- attribute: !1
557
- });
558
- }
559
- //#endregion
560
- //#region node_modules/lit-html/directive.js
561
- var xe = {
562
- ATTRIBUTE: 1,
563
- CHILD: 2,
564
- PROPERTY: 3,
565
- BOOLEAN_ATTRIBUTE: 4,
566
- EVENT: 5,
567
- ELEMENT: 6
568
- }, Se = (e) => (...t) => ({
569
- _$litDirective$: e,
570
- values: t
571
- }), Ce = class {
572
- constructor(e) {}
573
- get _$AU() {
574
- return this._$AM._$AU;
575
- }
576
- _$AT(e, t, n) {
577
- this._$Ct = e, this._$AM = t, this._$Ci = n;
578
- }
579
- _$AS(e, t) {
580
- return this.update(e, t);
581
- }
582
- update(e, t) {
583
- return this.render(...t);
584
- }
585
- }, we = Se(class extends Ce {
586
- constructor(e) {
587
- if (super(e), e.type !== xe.ATTRIBUTE || e.name !== "class" || e.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
588
- }
589
- render(e) {
590
- return " " + Object.keys(e).filter((t) => e[t]).join(" ") + " ";
591
- }
592
- update(e, [t]) {
593
- if (this.st === void 0) {
594
- this.st = /* @__PURE__ */ new Set(), e.strings !== void 0 && (this.nt = new Set(e.strings.join(" ").split(/\s/).filter((e) => e !== "")));
595
- for (let e in t) t[e] && !this.nt?.has(e) && this.st.add(e);
596
- return this.render(t);
597
- }
598
- let n = e.element.classList;
599
- for (let e of this.st) e in t || (n.remove(e), this.st.delete(e));
600
- for (let e in t) {
601
- let r = !!t[e];
602
- r === this.st.has(e) || this.nt?.has(e) || (r ? (n.add(e), this.st.add(e)) : (n.remove(e), this.st.delete(e)));
603
- }
604
- return I;
605
- }
606
- });
607
- //#endregion
608
- //#region \0@oxc-project+runtime@0.126.0/helpers/decorate.js
609
- function X(e, t, n, r) {
610
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
611
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
612
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
613
- return i > 3 && a && Object.defineProperty(t, n, a), a;
614
- }
615
- //#endregion
616
- //#region src/components/Loading/qc-loading.ts
617
- var Z = class extends K {
618
- constructor(...e) {
619
- super(...e), this.loading = !0, this.classes = {
620
- "qc-loading": !0,
621
- loading: !0
622
- };
623
- }
624
- willUpdate(e) {
625
- e.has("loading") && (this.classes.loading = this.loading);
626
- }
627
- render() {
628
- return F`<section id="qc-loading" class=${we(this.classes)}>
629
- <slot></slot>
630
- <div class="qc-loading-mask">
631
- <div class="qc-loading-spinner">
632
- <div class="qc-loading-spinner-cirlce cirlce1"></div>
633
- <div class="qc-loading-spinner-cirlce cirlce2"></div>
634
- <div class="qc-loading-spinner-cirlce cirlce3"></div>
635
- <div class="qc-loading-spinner-cirlce cirlce4"></div>
636
- </div>
637
- </div>
638
- </section>`;
639
- }
640
- static {
641
- this.styles = o`
642
- .qc-loading {
643
- width: 100%;
644
- height: 100%;
645
- position: relative;
646
- }
647
- .qc-loading-mask {
648
- content: '';
649
- display: none;
650
- width: 100%;
651
- height: 100%;
652
- background: rgba(255, 255, 255, 0.8);
653
- position: absolute;
654
- top: 0;
655
- left: 0;
656
- justify-content: center;
657
- align-items: center;
658
- }
659
- .qc-loading-mask {
660
- display: none;
661
- }
662
- .qc-loading-spinner {
663
- width: 6%;
664
- aspect-ratio: 1 / 1; /* 保持正方形 */
665
- position: relative;
666
- animation: route 1s linear infinite;
667
- transform: rotate(90deg);
668
- }
669
- .loading .qc-loading-mask {
670
- display: flex;
671
- }
672
- .qc-loading-spinner-cirlce {
673
- position: absolute;
674
- width: 60%;
675
- height: 60%;
676
- border-radius: 50%;
677
- background-color: #1677ff;
678
- transform: translate(-50%, -50%);
679
- animation: hidden 1s linear infinite alternate;
680
- opacity: 0.3;
681
- }
682
- .cirlce1 {
683
- top: 0;
684
- left: 0;
685
- }
686
- .cirlce2 {
687
- top: 0;
688
- left: 100%;
689
- animation-delay: 0.25s;
690
- }
691
- .cirlce3 {
692
- top: 100%;
693
- left: 100%;
694
- animation-delay: 0.5s;
695
- }
696
- .cirlce4 {
697
- top: 100%;
698
- left: 0;
699
- animation-delay: 0.75s;
700
- }
701
- @keyframes route {
702
- to {
703
- transform: rotate(450deg);
704
- }
705
- }
706
- @keyframes hidden {
707
- to {
708
- opacity: 1;
709
- }
710
- }
711
- `;
712
- }
713
- };
714
- X([J({ type: Boolean })], Z.prototype, "loading", void 0), X([Y()], Z.prototype, "classes", void 0), Z = X([q("qc-loading")], Z);
715
- //#endregion
716
- //#region src/tools/loadAMap/loadAMap.ts
717
- var Q, Te = {
718
- version: "2.0",
719
- key: "94af010abe03a5b2a2f98e6739a11d0c",
720
- secret: "031abe8352fc9fa9ac8d14a86a5ec1cf"
721
- };
722
- function Ee() {
723
- return new Promise((e) => {
724
- let t = document.createElement("script");
725
- t.innerHTML = `
726
- window._AMapSecurityConfig = {
727
- securityJsCode: '${Q.secret}',
728
- };`, document.head.appendChild(t), e(null);
729
- });
730
- }
731
- function De() {
732
- let e = `${Q.url}?v=${Q.version}&key=${Q.key}&plugin=${Q.plugins.join(",")}`;
733
- return new Promise((t, n) => {
734
- let r = document.createElement("script");
735
- r.async = !1, r.src = e, r.onerror = n, r.onload = t, document.head.appendChild(r);
736
- });
737
- }
738
- function Oe() {
739
- let e = `${Q.locaUrl}?v=${Q.version}&key=${Q.key}&plugin=${Q.plugins.join(",")}`;
740
- return new Promise((t, n) => {
741
- let r = document.createElement("script");
742
- r.async = !1, r.src = e, r.onerror = n, r.onload = t, document.head.appendChild(r);
743
- });
744
- }
745
- var ke = async (e) => {
746
- Q = {
747
- ...e,
748
- key: e.key || Te.key,
749
- secret: e.secret || Te.secret,
750
- plugins: e.plugins || []
751
- };
752
- try {
753
- let t = window;
754
- if (t.AMap && e.onLoad && e.onLoad(t.AMap), await Ee(), await De(), await Oe(), t.AMap) e.onLoad && e.onLoad(t.AMap);
755
- else throw Error("AMap not loaded");
756
- } catch (t) {
757
- e.onError && e.onError(t);
758
- }
759
- }, $ = class extends K {
760
- createRenderRoot() {
761
- return this;
762
- }
763
- constructor() {
764
- super(), this.version = "2.0", this.key = "94af010abe03a5b2a2f98e6739a11d0c", this.secret = "031abe8352fc9fa9ac8d14a86a5ec1cf", this.AMapUrl = "https://webapi.amap.com/maps", this.AMapLocaUrl = "https://webapi.amap.com/loca", this.plugins = [], this.viewMode = "2D", this.zoom = 10, this.center = [116.397428, 39.90923], this.zooms = [3, 18], this.animateEnable = !0, this.loading = !0, this.operatingData = { timeoutFlag: null }, this.oncomplete = () => {
765
- this.dispatchEvent(new CustomEvent("load", { detail: {
766
- map: this.map,
767
- AMap: this.AMap
768
- } })), this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } })), setTimeout(() => {
769
- this.loading = !1;
770
- }, 100);
771
- }, this.onStartOperating = () => {
772
- this.dispatchEvent(new CustomEvent("startOperating"));
773
- }, this.onEndOperating_timeout = () => {
774
- this.operatingData.timeoutFlag && (clearTimeout(this.operatingData.timeoutFlag), this.operatingData.timeoutFlag = null), this.operatingData.timeoutFlag = setTimeout(() => {
775
- this.dispatchEvent(new CustomEvent("endOperating")), this.operatingData.timeoutFlag = null;
776
- }, 400);
777
- }, this.onzoomchange = () => {
778
- this.dispatchEvent(new CustomEvent("zoomChange", { detail: { zoom: this.map.getZoom() } }));
779
- };
780
- }
781
- async connectedCallback() {
782
- super.connectedCallback(), await ke({
783
- key: this.key,
784
- secret: this.secret,
785
- version: this.version,
786
- url: this.AMapUrl,
787
- locaUrl: this.AMapLocaUrl,
788
- plugins: this.plugins,
789
- onLoad: () => {
790
- this.AMap = window.AMap, this.initAMap();
791
- },
792
- onError: (e) => {
793
- console.error("AMap load error", e), this.loading = !1;
794
- }
795
- });
796
- }
797
- async firstUpdated() {
798
- this.initAMap();
799
- }
800
- disconnectedCallback() {
801
- super.disconnectedCallback(), this.removeEventListener(), this.operatingData.timeoutFlag && (clearTimeout(this.operatingData.timeoutFlag), this.operatingData.timeoutFlag = null), this.map &&= (this.map.destroy(), null);
802
- }
803
- initAMap() {
804
- if (!this.AMap) return;
805
- let e = this.querySelector(".a-map-container");
806
- e && (this.map = new this.AMap.Map(e, {
807
- resizeEnable: !0,
808
- viewMode: this.viewMode,
809
- zoom: this.zoom,
810
- center: this.center,
811
- zooms: this.zooms,
812
- animateEnable: this.animateEnable
813
- }), this.addEventListeners(), this.dispatchEvent(new CustomEvent("load", { detail: {
814
- map: this.map,
815
- AMap: this.AMap
816
- } })));
817
- }
818
- addEventListeners() {
819
- this.map && (this.map.on("complete", this.oncomplete), this.map.on("zoomstart", this.onStartOperating), this.map.on("zoomend", this.onEndOperating_timeout), this.map.on("zoomchange", this.onzoomchange), this.map.on("mousedown", this.onStartOperating), this.map.on("mouseup", this.onEndOperating_timeout), this.map.on("touchstart", this.onStartOperating), this.map.on("touchend", this.onEndOperating_timeout));
820
- }
821
- removeEventListener() {
822
- this.map && (this.map.off("complete", this.oncomplete), this.map.off("zoomstart", this.onStartOperating), this.map.off("zoomend", this.onEndOperating_timeout), this.map.off("zoomchange", this.onzoomchange), this.map.off("mousedown", this.onStartOperating), this.map.off("mouseup", this.onEndOperating_timeout), this.map.off("touchstart", this.onStartOperating), this.map.off("touchend", this.onEndOperating_timeout));
823
- }
824
- render() {
825
- return F`<section id="a-map">
826
- <qc-loading .loading=${this.loading}>
827
- <div class="a-map-container"></div>
828
- </qc-loading>
829
- </section>`;
830
- }
831
- };
832
- X([J({ type: String })], $.prototype, "version", void 0), X([J({ type: String })], $.prototype, "key", void 0), X([J({ type: String })], $.prototype, "secret", void 0), X([J({ type: String })], $.prototype, "AMapUrl", void 0), X([J({ type: String })], $.prototype, "AMapLocaUrl", void 0), X([J({ type: Array })], $.prototype, "plugins", void 0), X([J({ type: String })], $.prototype, "viewMode", void 0), X([J({ type: Number })], $.prototype, "zoom", void 0), X([J({ type: Array })], $.prototype, "center", void 0), X([J({ type: Array })], $.prototype, "zooms", void 0), X([J({ type: Boolean })], $.prototype, "animateEnable", void 0), X([Y()], $.prototype, "loading", void 0), $ = X([q("a-map")], $);
833
- //#endregion
834
- export { $ as AMap, Z as QCLoading, ke as loadAMap };