UNPKG

jobsys-mpower

Version:

Enhanced component based on Taro & NutUI

1,775 lines 106 kB
function Ds(s) { return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; } function kn(s) { if (s.__esModule) return s; var t = s.default; if (typeof t == "function") { var e = function n() { return this instanceof n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; e.prototype = t.prototype; } else e = {}; return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(s).forEach(function(n) { var i = Object.getOwnPropertyDescriptor(s, n); Object.defineProperty(e, n, i.get ? i : { enumerable: !0, get: function() { return s[n]; } }); }), e; } var Pn = { exports: {} }; const yt = "[]", c = "", vt = "!0", g = "!1", rt = { bindTouchStart: c, bindTouchMove: c, bindTouchEnd: c, bindTouchCancel: c, bindLongTap: c }, Xt = { animation: c, bindAnimationStart: c, bindAnimationIteration: c, bindAnimationEnd: c, bindTransitionEnd: c }; function v(s) { return `'${s}'`; } const Us = Object.assign(Object.assign({ "hover-class": v("none"), "hover-stop-propagation": g, "hover-start-time": "50", "hover-stay-time": "400" }, rt), Xt), js = { type: c, size: "23", color: c }, $s = Object.assign({ longitude: c, latitude: c, scale: "16", markers: yt, covers: c, polyline: yt, circles: yt, controls: yt, "include-points": yt, "show-location": c, "layer-style": "1", bindMarkerTap: c, bindControlTap: c, bindCalloutTap: c, bindUpdated: c }, rt), Ws = { percent: c, "stroke-width": "6", color: v("#09BB07"), activeColor: v("#09BB07"), backgroundColor: v("#EBEBEB"), active: g, "active-mode": v("backwards"), "show-info": g }, Vs = { nodes: yt }, Fs = { selectable: g, space: c, decode: g }, Hs = Object.assign({ size: v("default"), type: c, plain: g, disabled: c, loading: g, "form-type": c, "open-type": c, "hover-class": v("button-hover"), "hover-stop-propagation": g, "hover-start-time": "20", "hover-stay-time": "70", name: c, bindagreeprivacyauthorization: c }, rt), Gs = { value: c, disabled: c, checked: g, color: v("#09BB07"), name: c }, zs = { bindChange: c, name: c }, Ys = { "report-submit": g, bindSubmit: c, bindReset: c, name: c }, qs = { value: c, type: v(c), password: g, placeholder: c, "placeholder-style": c, "placeholder-class": v("input-placeholder"), disabled: c, maxlength: "140", "cursor-spacing": "0", focus: g, "confirm-type": v("done"), "confirm-hold": g, cursor: "-1", "selection-start": "-1", "selection-end": "-1", bindInput: c, bindFocus: c, bindBlur: c, bindConfirm: c, name: c }, Qs = { for: c, name: c }, Js = { mode: v("selector"), disabled: c, range: c, "range-key": c, value: c, start: c, end: c, fields: v("day"), "custom-item": c, name: c, bindCancel: c, bindChange: c, bindColumnChange: c }, Ks = { value: c, "indicator-style": c, "indicator-class": c, "mask-style": c, "mask-class": c, bindChange: c, name: c }, Zs = { name: c }, Xs = { value: c, checked: g, disabled: c, color: v("#09BB07"), name: c }, ti = { bindChange: c, name: c }, ei = { min: "0", max: "100", step: "1", disabled: c, value: "0", activeColor: v("#1aad19"), backgroundColor: v("#e9e9e9"), "block-size": "28", "block-color": v("#ffffff"), "show-value": g, bindChange: c, bindChanging: c, name: c }, ni = { checked: g, disabled: c, type: v("switch"), color: v("#04BE02"), bindChange: c, name: c }, si = { value: c, placeholder: c, "placeholder-style": c, "placeholder-class": v("textarea-placeholder"), disabled: c, maxlength: "140", "auto-focus": g, focus: g, "auto-height": g, fixed: g, "cursor-spacing": "0", cursor: "-1", "selection-start": "-1", "selection-end": "-1", bindFocus: c, bindBlur: c, bindLineChange: c, bindInput: c, bindConfirm: c, name: c }, ii = { src: c, bindLoad: "eh", bindError: "eh" }, ri = Object.assign({ "scroll-top": g }, rt), oi = { "scale-area": g }, ai = Object.assign(Object.assign({ direction: "none", inertia: g, "out-of-bounds": g, x: c, y: c, damping: "20", friction: "2", disabled: c, scale: g, "scale-min": "0.5", "scale-max": "10", "scale-value": "1", bindChange: c, bindScale: c, bindHTouchMove: c, bindVTouchMove: c, width: v("10px"), height: v("10px") }, rt), Xt), ci = Object.assign(Object.assign({ "scroll-x": g, "scroll-y": g, "upper-threshold": "50", "lower-threshold": "50", "scroll-top": c, "scroll-left": c, "scroll-into-view": c, "scroll-with-animation": g, "enable-back-to-top": g, bindScrollToUpper: c, bindScrollToLower: c, bindScroll: c }, rt), Xt), li = Object.assign({ "indicator-dots": g, "indicator-color": v("rgba(0, 0, 0, .3)"), "indicator-active-color": v("#000000"), autoplay: g, current: "0", interval: "5000", duration: "500", circular: g, vertical: g, "previous-margin": v("0px"), "next-margin": v("0px"), "display-multiple-items": "1", bindChange: c, bindTransition: c, bindAnimationFinish: c }, rt), hi = { "item-id": c }, ui = { url: c, "open-type": v("navigate"), delta: "1", "hover-class": v("navigator-hover"), "hover-stop-propagation": g, "hover-start-time": "50", "hover-stay-time": "600", bindSuccess: c, bindFail: c, bindComplete: c }, di = { id: c, src: c, loop: g, controls: g, poster: c, name: c, author: c, bindError: c, bindPlay: c, bindPause: c, bindTimeUpdate: c, bindEnded: c }, fi = { "device-position": v("back"), flash: v("auto"), bindStop: c, bindError: c }, pi = Object.assign({ src: c, mode: v("scaleToFill"), "lazy-load": g, bindError: c, bindLoad: c }, rt), mi = Object.assign({ src: c, autoplay: g, muted: g, orientation: v("vertical"), "object-fit": v("contain"), "background-mute": g, "min-cache": "1", "max-cache": "3", bindStateChange: c, bindFullScreenChange: c, bindNetStatus: c }, Xt), gi = Object.assign({ src: c, duration: c, controls: vt, "danmu-list": c, "danmu-btn": c, "enable-danmu": c, autoplay: g, loop: g, muted: g, "initial-time": "0", "page-gesture": g, direction: c, "show-progress": vt, "show-fullscreen-btn": vt, "show-play-btn": vt, "show-center-play-btn": vt, "enable-progress-gesture": vt, "object-fit": v("contain"), poster: c, "show-mute-btn": g, bindPlay: c, bindPause: c, bindEnded: c, bindTimeUpdate: c, bindFullScreenChange: c, bindWaiting: c, bindError: c }, Xt), bi = Object.assign({ "canvas-id": c, "disable-scroll": g, bindError: c }, rt), Ei = { "unit-id": c, "ad-intervals": c, bindLoad: c, bindError: c, bindClose: c }, vi = { src: c, bindMessage: c, bindLoad: c, bindError: c }, _i = {}, yi = { name: c }, Ti = { name: c }, wi = { name: c }, Ye = { View: Us, Icon: js, Progress: Ws, RichText: Vs, Text: Fs, Button: Hs, Checkbox: Gs, CheckboxGroup: zs, Form: Ys, Input: qs, Label: Qs, Picker: Js, PickerView: Ks, PickerViewColumn: Zs, Radio: Xs, RadioGroup: ti, Slider: ei, Switch: ni, CoverImage: ii, Textarea: si, CoverView: ri, MovableArea: oi, MovableView: ai, ScrollView: ci, Swiper: li, SwiperItem: hi, Navigator: ui, Audio: di, Camera: fi, Image: pi, LivePlayer: mi, Video: gi, Canvas: bi, Ad: Ei, WebView: vi, Block: _i, Map: $s, Slot: Ti, SlotView: yi, NativeSlot: wi }, Si = /* @__PURE__ */ new Set([ "input", "checkbox", "picker", "picker-view", "radio", "slider", "switch", "textarea" ]); var mt; (function(s) { s.MINI = "mini", s.WEB = "web", s.RN = "rn", s.HARMONY = "harmony", s.QUICK = "quickapp"; })(mt || (mt = {})); mt.WEB, mt.HARMONY, mt.MINI, mt.RN, mt.QUICK; class W { constructor(t) { var e; this.callbacks = (e = t == null ? void 0 : t.callbacks) !== null && e !== void 0 ? e : {}; } on(t, e, n) { let i, r, o; if (!e) return this; typeof t == "symbol" ? o = [t] : o = t.split(W.eventSplitter), this.callbacks || (this.callbacks = {}); const a = this.callbacks; for (; i = o.shift(); ) { const l = a[i], u = l ? l.tail : {}; u.next = r = {}, u.context = n, u.callback = e, a[i] = { tail: r, next: l ? l.next : u }; } return this; } once(t, e, n) { const i = (...r) => { e.apply(this, r), this.off(t, i, n); }; return this.on(t, i, n), this; } off(t, e, n) { let i, r, o; if (!(r = this.callbacks)) return this; if (!(t || e || n)) return delete this.callbacks, this; for (typeof t == "symbol" ? o = [t] : o = t ? t.split(W.eventSplitter) : Object.keys(r); i = o.shift(); ) { let a = r[i]; if (delete r[i], !a || !(e || n)) continue; const l = a.tail; for (; (a = a.next) !== l; ) { const u = a.callback, d = a.context; (e && u !== e || n && d !== n) && this.on(i, u, d); } } return this; } trigger(t, ...e) { let n, i, r, o; if (!(r = this.callbacks)) return this; for (typeof t == "symbol" ? o = [t] : o = t.split(W.eventSplitter); n = o.shift(); ) if (i = r[n]) { const a = i.tail; for (; (i = i.next) !== a; ) i.callback.apply(i.context || this, e); } return this; } } W.eventSplitter = ","; function A(s) { return typeof s == "string"; } function M(s) { return typeof s > "u"; } function Vt(s) { return s === null; } function Rn(s) { return s !== null && typeof s == "object"; } function z(s) { return typeof s == "function"; } function Bn(s) { return typeof s == "number"; } const it = Array.isArray, ft = () => process.env.TARO_ENV === "h5" || process.env.TARO_PLATFORM === "web"; var E; (function(s) { s[s.SINGLE = 0] = "SINGLE", s[s.MULTI = 1] = "MULTI", s[s.WATERFALL = 2] = "WATERFALL"; })(E || (E = {})); const Ni = { app: [ "onLaunch", "onShow", "onHide" ], page: [ "onLoad", "onUnload", "onReady", "onShow", "onHide", [ "onPullDownRefresh", "onReachBottom", "onPageScroll", "onResize", "defer:onTabItemTap", "onTitleClick", "onOptionMenuClick", "onPopMenuClick", "onPullIntercept", "onAddToFavorites" ], [ "onShareAppMessage", "onShareTimeline" ] ], component: [ "attached", "detached" ] }; function S(s, t) { return { type: s, initial: t || null }; } class Ci extends W { constructor(t, e) { super(e), this.hooks = t; for (const n in t) { const { initial: i } = t[n]; z(i) && this.on(n, i); } } tapOneOrMany(t, e) { (z(e) ? [e] : e).forEach((i) => this.on(t, i)); } tap(t, e) { const n = this.hooks, { type: i, initial: r } = n[t]; i === E.SINGLE ? (this.off(t), this.on(t, z(e) ? e : e[e.length - 1])) : (r && this.off(t, r), this.tapOneOrMany(t, e)); } call(t, ...e) { var n; const i = this.hooks[t]; if (!i) return; const { type: r } = i, o = this.callbacks; if (!o) return; const a = o[t]; if (a) { const l = a.tail; let u = a.next, d = e, p; for (; u !== l; ) p = (n = u.callback) === null || n === void 0 ? void 0 : n.apply(u.context || this, d), r === E.WATERFALL && (d = [p]), u = u.next; return p; } } isExist(t) { var e; return !!(!((e = this.callbacks) === null || e === void 0) && e[t]); } } const T = new Ci({ getMiniLifecycle: S(E.SINGLE, (s) => s), getMiniLifecycleImpl: S(E.SINGLE, function() { return this.call("getMiniLifecycle", Ni); }), getLifecycle: S(E.SINGLE, (s, t) => s[t]), modifyRecursiveComponentConfig: S(E.SINGLE, (s) => s), getPathIndex: S(E.SINGLE, (s) => `[${s}]`), getEventCenter: S(E.SINGLE, (s) => new s()), isBubbleEvents: S(E.SINGLE, (s) => (/* @__PURE__ */ new Set([ "touchstart", "touchmove", "touchcancel", "touchend", "touchforcechange", "tap", "longpress", "longtap", "transitionend", "animationstart", "animationiteration", "animationend" ])).has(s)), getSpecialNodes: S(E.SINGLE, () => ["view", "text", "image"]), onRemoveAttribute: S(E.SINGLE), batchedEventUpdates: S(E.SINGLE), mergePageInstance: S(E.SINGLE), modifyPageObject: S(E.SINGLE), createPullDownComponent: S(E.SINGLE), getDOMNode: S(E.SINGLE), modifyHydrateData: S(E.SINGLE), transferHydrateData: S(E.SINGLE), modifySetAttrPayload: S(E.SINGLE), modifyRmAttrPayload: S(E.SINGLE), onAddEvent: S(E.SINGLE), proxyToRaw: S(E.SINGLE, function(s) { return s; }), modifyMpEvent: S(E.MULTI), modifyMpEventImpl: S(E.SINGLE, function(s) { try { this.call("modifyMpEvent", s); } catch (t) { console.warn("[Taro modifyMpEvent hook Error]: " + (t == null ? void 0 : t.message)); } }), injectNewStyleProperties: S(E.SINGLE), modifyTaroEvent: S(E.MULTI), dispatchTaroEvent: S(E.SINGLE, (s, t) => { t.dispatchEvent(s); }), dispatchTaroEventFinish: S(E.MULTI), modifyDispatchEvent: S(E.MULTI), initNativeApi: S(E.MULTI), patchElement: S(E.MULTI), modifyAddEventListener: S(E.SINGLE), modifyRemoveEventListener: S(E.SINGLE) }), Et = {}, we = (...s) => { }; function Mn(s) { return s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); } function G(s) { let t = "", e = !1; for (let n = 0; n < s.length; n++) s[n] !== "-" ? (t += e ? s[n].toUpperCase() : s[n], e = !1) : e = !0; return t; } function qe(s, t) { if (!s) if (process.env.NODE_ENV !== "production") { const e = ` 如有疑问,请提交 issue 至:https://github.com/nervjs/taro/issues`; throw new Error(t + e); } else throw new Error(t); } function xt(s, t) { process.env.NODE_ENV !== "production" && s && console.warn(`[taro warn] ${t}`); } (/* @__PURE__ */ new Date()).getTime().toString(); function Dn(s) { const t = {}, e = s.View, n = { "#text": {}, StaticView: e, StaticImage: s.Image, StaticText: s.Text, PureView: e, CatchView: e }; return s = Object.assign(Object.assign({}, s), n), Object.keys(s).sort((i, r) => { const o = /^(Static|Pure|Catch)*(View|Image|Text)$/, a = o.test(i), l = o.test(r); return a && l ? i > r ? 1 : -1 : a ? -1 : l || i >= r ? 1 : -1; }).forEach((i, r) => { const o = { _num: String(r) }; Object.keys(s[i]).filter((a) => !/^bind/.test(a) && !["focus", "blur"].includes(a)).sort().forEach((a, l) => { o[G(a)] = "p" + l; }), t[Mn(i)] = o; }), t; } const Qe = 2046, Oi = "Taro runtime", Ai = "taro-app", Un = "小程序 setData", me = "页面初始化", Ot = "root", jn = "html", $n = "head", Wn = "body", xe = "app", Vn = "container", Fn = "#document", Je = "document-fragment", At = "id", Hn = "uid", Jt = "class", K = "style", ie = "focus", Z = "view", Le = "static-view", Ke = "pure-view", Gn = "props", zn = "dataset", Yn = "object", Ie = "value", Ze = "input", qn = "change", Xe = "custom-wrapper", Qn = "target", Jn = "currentTarget", he = "type", Kn = "confirm", Zn = "timeStamp", Xn = "keyCode", ts = "touchmove", xi = "Date", Li = "setTimeout", Kt = "catchMove", tn = "catch-view", en = "comment", nn = "onLoad", sn = "onReady", rn = "onShow", on = "onHide", es = "options", ns = "externalClasses", ue = "e_result", ss = "behaviors", is = "a"; var x; (function(s) { s.INIT = "0", s.RESTORE = "1", s.RECOVER = "2", s.DESTORY = "3"; })(x || (x = {})); const Ft = []; class Ii { constructor(t) { this.records = [], this.callback = t; } /** * Configures the MutationObserver * to begin receiving notifications * through its callback function * when DOM changes matching the given options occur. * * Options matching is to be implemented. */ observe(t, e) { this.disconnect(), this.target = t, this.options = e || {}, Ft.push(this); } /** * Stop the MutationObserver instance * from receiving further notifications * until and unless observe() is called again. */ disconnect() { this.target = null; const t = Ft.indexOf(this); t >= 0 && Ft.splice(t, 1); } /** * Removes all pending notifications * from the MutationObserver's notification queue * and returns them in a new Array of MutationRecord objects. */ takeRecords() { return this.records.splice(0, this.records.length); } } const ki = (s, t) => !!s && s.sid === (t == null ? void 0 : t.sid), Pi = (s, t) => { const { characterData: e, characterDataOldValue: n, attributes: i, attributeOldValue: r, childList: o } = t; switch (s.type) { case "characterData": return e ? (n || (s.oldValue = null), !0) : !1; case "attributes": return i ? (r || (s.oldValue = null), !0) : !1; case "childList": return !!o; } }; let Se = !1; function Ri(s, t) { s.records.push(t), Se || (Se = !0, Promise.resolve().then(() => { Se = !1, Ft.forEach((e) => e.callback(e.takeRecords())); })); } function Bi(s) { Ft.forEach((t) => { const { options: e } = t; for (let n = s.target; n; n = n.parentNode) { if (ki(t.target, n) && Pi(s, e)) { Ri(t, s); break; } if (!e.subtree) break; } }); } class ht { constructor(t) { ENABLE_MUTATION_OBSERVER ? this.core = new Ii(t) : (process.env.NODE_ENV !== "production" && console.warn("[Taro Warning] 若要使用 MutationObserver,请在 Taro 编译配置中设置 'mini.runtime.enableMutationObserver: true'"), this.core = { observe: we, disconnect: we, takeRecords: we }); } observe(...t) { this.core.observe(...t); } disconnect() { this.core.disconnect(); } takeRecords() { return this.core.takeRecords(); } static record(t) { Bi(t); } } const an = () => { const s = []; for (let n = 65; n <= 90; n++) s.push(n); for (let n = 97; n <= 122; n++) s.push(n); const t = s.length - 1, e = [0, 0]; return () => { const n = e.map((o) => s[o]), i = String.fromCharCode(...n); let r = e.length - 1; for (e[r]++; e[r] > t; ) { if (e[r] = 0, r = r - 1, r < 0) { e.push(0); break; } e[r]++; } return i; }; }; function Mi(s) { return s.nodeType === 1; } function Di(s) { return s.nodeType === 3; } function Ht(s) { return s.nodeName === en; } function lt(s) { return !!Object.keys(s.props).find((e) => !(/^(class|style|id)$/.test(e) || e.startsWith("data-"))); } function Ui(s, t) { for (var e; s = (s == null ? void 0 : s.parentElement) || null; ) { if (!s || s.nodeName === Ot || s.nodeName === "root-portal") return !1; if (!((e = s.__handlers[t]) === null || e === void 0) && e.length) return !0; } return !1; } function pn(s) { switch (s) { case K: return "st"; case At: return Hn; case Jt: return "cl"; default: return s; } } const ke = /* @__PURE__ */ new Map(); function rs(s, t, e) { z(e) && (e = { value: e }), Object.defineProperty(s.prototype, t, Object.assign({ configurable: !0, enumerable: !0 }, e)); } let Ne; function pt() { return Ne || (Ne = Dn(Ye)), Ne; } class ji { constructor(t, e) { this.tokenList = [], this.el = e, t.trim().split(/\s+/).forEach((n) => this.tokenList.push(n)); } get value() { return this.toString(); } get length() { return this.tokenList.length; } add() { let t = 0, e = !1; const n = arguments, i = n.length, r = this.tokenList; do { const o = n[t]; this.checkTokenIsValid(o) && !~r.indexOf(o) && (r.push(o), e = !0); } while (++t < i); e && this._update(); } remove() { let t = 0, e = !1; const n = arguments, i = n.length, r = this.tokenList; do { const o = n[t] + ""; if (!this.checkTokenIsValid(o)) continue; const a = r.indexOf(o); ~r.indexOf(o) && (r.splice(a, 1), e = !0); } while (++t < i); e && this._update(); } contains(t) { return this.checkTokenIsValid(t) ? !!~this.tokenList.indexOf(t) : !1; } toggle(t, e) { const n = this.contains(t), i = n ? e !== !0 && "remove" : e !== !1 && "add"; return i && this[i](t), e === !0 || e === !1 ? e : !n; } replace(t, e) { if (!this.checkTokenIsValid(t) || !this.checkTokenIsValid(e)) return; const n = this.tokenList.indexOf(t); ~n && (this.tokenList.splice(n, 1, e), this._update()); } toString() { return this.tokenList.filter((t) => t !== "").join(" "); } checkTokenIsValid(t) { return !(t === "" || /\s/.test(t)); } _update() { this.el.className = this.value; } } class $i extends Map { removeNode(t) { const { sid: e, uid: n } = t; this.delete(e), n !== e && n && this.delete(n); } removeNodeTree(t) { this.removeNode(t); const { childNodes: e } = t; e.forEach((n) => this.removeNodeTree(n)); } } const Lt = new $i(), mn = ft(), I = { window: mn ? window : Et, document: mn ? document : Et }; let Ce, se; function de(s) { var t; se || (se = pt()), Ce || (Ce = T.call("getSpecialNodes")); const e = s.nodeName; if (Di(s)) return { sid: s.sid, v: s.nodeValue, nn: ((t = se[e]) === null || t === void 0 ? void 0 : t._num) || "8" }; const n = { nn: e, sid: s.sid }; s.uid !== s.sid && (n.uid = s.uid), !s.isAnyEventBinded() && Ce.indexOf(e) > -1 && (n.nn = `static-${e}`, e === Z && !lt(s) && (n.nn = Ke)); const { props: i } = s; for (const d in i) { const p = G(d); !d.startsWith("data-") && // 在 node.dataset 的数据 d !== Jt && d !== K && d !== At && p !== Kt && (n[p] = i[d]), e === Z && p === Kt && i[d] !== !1 && (n.nn = tn); } let { childNodes: r } = s; r = r.filter((d) => !Ht(d)), r.length > 0 ? n.cn = r.map(de) : n.cn = [], s.className !== "" && (n.cl = s.className); const o = s.cssText; o !== "" && e !== "swiper-item" && (n.st = o), T.call("modifyHydrateData", n, s); const a = n.nn, l = se[a]; if (l) { n.nn = l._num; for (const d in n) d in l && (n[l[d]] = n[d], delete n[d]); } return T.call("transferHydrateData", n, s, l) || n; } class Wi { constructor() { this.__handlers = {}; } addEventListener(t, e, n) { if (t = t.toLowerCase(), T.call("onAddEvent", t, e, n, this), t === "regionchange") { this.addEventListener("begin", e, n), this.addEventListener("end", e, n); return; } let i = !!n, r = !1; if (Rn(n) && (i = !!n.capture, r = !!n.once), r) { const l = function() { e.apply(this, arguments), this.removeEventListener(t, l); }; this.addEventListener(t, l, Object.assign(Object.assign({}, n), { once: !1 })); return; } process.env.NODE_ENV !== "production" && xt(i, "Taro 暂未实现 event 的 capture 特性。"); const o = e; e = function() { return o.apply(this, arguments); }, e.oldHandler = o; const a = this.__handlers[t]; it(a) ? a.push(e) : this.__handlers[t] = [e]; } removeEventListener(t, e) { if (t = t.toLowerCase(), t === "regionchange") { this.removeEventListener("begin", e), this.removeEventListener("end", e); return; } if (!e) return; const n = this.__handlers[t]; if (!it(n)) return; const i = n.findIndex((r) => { if (r === e || r.oldHandler === e) return !0; }); process.env.NODE_ENV !== "production" && xt(i === -1, `事件: '${t}' 没有注册在 DOM 中,因此不会被移除。`), n.splice(i, 1); } isAnyEventBinded() { const t = this.__handlers; return !!Object.keys(t).find((n) => t[n].length); } } const gn = "cn", Vi = an(); class nt extends Wi { constructor() { super(), this.parentNode = null, this.childNodes = [], this.hydrate = (t) => () => de(t), this.uid = "_" + Vi(), this.sid = this.uid, Lt.set(this.sid, this); } updateChildNodes(t) { const e = () => [], n = () => this.childNodes.filter((r) => !Ht(r)).map(de); this.enqueueUpdate({ path: `${this._path}.${gn}`, value: t ? e : n }); } updateSingleChild(t) { this.childNodes.forEach((e, n) => { Ht(e) || t && n < t || this.enqueueUpdate({ path: e._path, value: this.hydrate(e) }); }); } get _root() { var t; return ((t = this.parentNode) === null || t === void 0 ? void 0 : t._root) || null; } findIndex(t) { const e = this.childNodes.indexOf(t); return qe(e !== -1, "The node to be replaced is not a child of this node."), e; } get _path() { const t = this.parentNode; if (t) { const n = t.childNodes.filter((r) => !Ht(r)).indexOf(this), i = T.call("getPathIndex", n); return `${t._path}.${gn}.${i}`; } return ""; } get nextSibling() { const t = this.parentNode; return (t == null ? void 0 : t.childNodes[t.findIndex(this) + 1]) || null; } get previousSibling() { const t = this.parentNode; return (t == null ? void 0 : t.childNodes[t.findIndex(this) - 1]) || null; } get parentElement() { const t = this.parentNode; return (t == null ? void 0 : t.nodeType) === 1 ? t : null; } get firstChild() { return this.childNodes[0] || null; } get lastChild() { const t = this.childNodes; return t[t.length - 1] || null; } /** * @textContent 目前只能置空子元素 * @TODO 等待完整 innerHTML 实现 */ // eslint-disable-next-line accessor-pairs set textContent(t) { const e = this.childNodes.slice(), n = []; for (; this.firstChild; ) this.removeChild(this.firstChild, { doUpdate: !1 }); if (t === "") this.updateChildNodes(!0); else { const i = I.document.createTextNode(t); n.push(i), this.appendChild(i), this.updateChildNodes(); } ht.record({ type: "childList", target: this, removedNodes: e, addedNodes: n }); } /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore * @scenario * [A,B,C] * 1. insert D before C, D has no parent * 2. insert D before C, D has the same parent of C * 3. insert D before C, D has the different parent of C */ insertBefore(t, e, n) { if (t.nodeName === Je) return t.childNodes.reduceRight((o, a) => (this.insertBefore(a, o), a), e), t; t.remove({ cleanRef: !1 }); let i = 0; t.parentNode = this, e ? (i = this.findIndex(e), this.childNodes.splice(i, 0, t)) : this.childNodes.push(t); const r = this.childNodes.length; return this._root && (e ? n ? this.enqueueUpdate({ path: t._path, value: this.hydrate(t) }) : r * 2 / 3 > i ? this.updateChildNodes() : this.updateSingleChild(i) : r === 1 ? this.updateChildNodes() : this.enqueueUpdate({ path: t._path, value: this.hydrate(t) })), ht.record({ type: "childList", target: this, addedNodes: [t], removedNodes: n ? [e] : [], nextSibling: n ? e.nextSibling : e || null, previousSibling: t.previousSibling }), t; } /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/appendChild * @scenario * [A,B,C] * 1. append C, C has no parent * 2. append C, C has the same parent of B * 3. append C, C has the different parent of B */ appendChild(t) { return this.insertBefore(t); } /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild * @scenario * [A,B,C] * 1. replace B with C, C has no parent * 2. replace B with C, C has no parent, C has the same parent of B * 3. replace B with C, C has no parent, C has the different parent of B */ replaceChild(t, e) { if (e.parentNode === this) return this.insertBefore(t, e, !0), e.remove({ doUpdate: !1 }), e; } /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/removeChild * @scenario * [A,B,C] * 1. remove A or B * 2. remove C */ removeChild(t, e = {}) { const { cleanRef: n, doUpdate: i } = e; n !== !1 && i !== !1 && ht.record({ type: "childList", target: this, removedNodes: [t], nextSibling: t.nextSibling, previousSibling: t.previousSibling }); const r = this.findIndex(t); return this.childNodes.splice(r, 1), t.parentNode = null, n !== !1 && Lt.removeNodeTree(t), this._root && i !== !1 && this.updateChildNodes(), t; } remove(t) { var e; (e = this.parentNode) === null || e === void 0 || e.removeChild(this, t); } hasChildNodes() { return this.childNodes.length > 0; } enqueueUpdate(t) { var e; (e = this._root) === null || e === void 0 || e.enqueueUpdate(t); } get ownerDocument() { return I.document; } static extend(t, e) { rs(nt, t, e); } } const os = "webkit", re = [ "all", "appearance", "blockOverflow", "blockSize", "bottom", "clear", "contain", "content", "continue", "cursor", "direction", "display", "filter", "float", "gap", "height", "inset", "isolation", "left", "letterSpacing", "lightingColor", "markerSide", "mixBlendMode", "opacity", "order", "position", "quotes", "resize", "right", "rowGap", "tabSize", "tableLayout", "top", "userSelect", "verticalAlign", "visibility", "voiceFamily", "volume", "whiteSpace", "widows", "width", "zIndex", "pointerEvents", "aspectRatio" /** 非常用 style */ // 'azimuth', // 'backfaceVisibility', // 'baselineShift', // 'captionSide', // 'chains', // 'dominantBaseline', // 'elevation', // 'emptyCells', // 'forcedColorAdjust', // 'glyphOrientationVertical', // 'hangingPunctuation', // 'hyphenateCharacter', // 'hyphens', // 'imageOrientation', // 'imageResolution', // 'orphans', // 'playDuring', // 'pointerEvents', // 'regionFragment', // 'richness', // 'running', // 'scrollBehavior', // 'speechRate', // 'stress', // 'stringSet', // 'unicodeBidi', // 'willChange', // 'writingMode', ]; function f(s, t, e) { !e && re.push(s), t.forEach((n) => { re.push(s + n), s === os && re.push("Webkit" + n); }); } const ge = "Color", te = "Style", Pt = "Width", ee = "Image", be = "Size", ot = [ge, te, Pt], as = ["FitLength", "FitWidth", ee], Ee = [...as, "Radius"], ve = [...ot, ...as], cs = ["EndRadius", "StartRadius"], _e = ["Bottom", "Left", "Right", "Top"], U = ["End", "Start"], ls = ["Content", "Items", "Self"], hs = ["BlockSize", "Height", "InlineSize", Pt], ne = ["After", "Before"]; f("borderBlock", ot); f("borderBlockEnd", ot); f("borderBlockStart", ot); f("outline", [...ot, "Offset"]); f("border", [...ot, "Boundary", "Break", "Collapse", "Radius", "Spacing"]); f("borderFit", ["Length", Pt]); f("borderInline", ot); f("borderInlineEnd", ot); f("borderInlineStart", ot); f("borderLeft", ve); f("borderRight", ve); f("borderTop", ve); f("borderBottom", ve); f("textDecoration", [ge, te, "Line"]); f("textEmphasis", [ge, te, "Position"]); f("scrollMargin", _e); f("scrollPadding", _e); f("padding", _e); f("margin", [..._e, "Trim"]); f("scrollMarginBlock", U); f("scrollMarginInline", U); f("scrollPaddingBlock", U); f("scrollPaddingInline", U); f("gridColumn", U); f("gridRow", U); f("insetBlock", U); f("insetInline", U); f("marginBlock", U); f("marginInline", U); f("paddingBlock", U); f("paddingInline", U); f("pause", ne); f("cue", ne); f("mask", ["Clip", "Composite", ee, "Mode", "Origin", "Position", "Repeat", be, "Type"]); f("borderImage", ["Outset", "Repeat", "Slice", "Source", "Transform", Pt]); f("maskBorder", ["Mode", "Outset", "Repeat", "Slice", "Source", Pt]); f("font", ["Family", "FeatureSettings", "Kerning", "LanguageOverride", "MaxSize", "MinSize", "OpticalSizing", "Palette", be, "SizeAdjust", "Stretch", te, "Weight", "VariationSettings"]); f("transform", ["Box", "Origin", te]); f("background", [ge, ee, "Attachment", "BlendMode", "Clip", "Origin", "Position", "Repeat", be]); f("listStyle", [ee, "Position", "Type"]); f("scrollSnap", ["Align", "Stop", "Type"]); f("grid", ["Area", "AutoColumns", "AutoFlow", "AutoRows"]); f("gridTemplate", ["Areas", "Columns", "Rows"]); f("overflow", ["Block", "Inline", "Wrap", "X", "Y"]); f("transition", ["Delay", "Duration", "Property", "TimingFunction"]); f("color", ["Adjust", "InterpolationFilters", "Scheme"]); f("textAlign", ["All", "Last"]); f("page", ["BreakAfter", "BreakBefore", "BreakInside"]); f("animation", ["Delay", "Direction", "Duration", "FillMode", "IterationCount", "Name", "PlayState", "TimingFunction"]); f("flex", ["Basis", "Direction", "Flow", "Grow", "Shrink", "Wrap"]); f("offset", [...ne, ...U, "Anchor", "Distance", "Path", "Position", "Rotate"]); f("perspective", ["Origin"]); f("clip", ["Path", "Rule"]); f("flow", ["From", "Into"]); f("align", ["Content", "Items", "Self"], !0); f("alignment", ["Adjust", "Baseline"], !0); f("borderStart", cs, !0); f("borderEnd", cs, !0); f("borderCorner", ["Fit", ee, "ImageTransform"], !0); f("borderTopLeft", Ee, !0); f("borderTopRight", Ee, !0); f("borderBottomLeft", Ee, !0); f("borderBottomRight", Ee, !0); f("column", ["s", "Count", "Fill", "Gap", "Rule", "RuleColor", "RuleStyle", "RuleWidth", "Span", Pt], !0); f("break", [...ne, "Inside"], !0); f("wrap", [...ne, "Flow", "Inside", "Through"], !0); f("justify", ls, !0); f("place", ls, !0); f("max", [...hs, "Lines"], !0); f("min", hs, !0); f("line", ["Break", "Clamp", "Grid", "Height", "Padding", "Snap"], !0); f("inline", ["BoxAlign", be, "Sizing"], !0); f("text", ["CombineUpright", "GroupAlign", "Height", "Indent", "Justify", "Orientation", "Overflow", "Shadow", "SpaceCollapse", "SpaceTrim", "Spacing", "Transform", "UnderlinePosition", "Wrap"], !0); f("shape", ["ImageThreshold", "Inside", "Margin", "Outside"], !0); f("word", ["Break", "Spacing", "Wrap"], !0); f("object", ["Fit", "Position"], !0); f("box", ["DecorationBreak", "Shadow", "Sizing", "Snap"], !0); f(os, ["LineClamp", "BoxOrient", "TextFillColor", "TextStroke", "TextStrokeColor", "TextStrokeWidth"], !0); function us(s) { ht.record({ type: "attributes", target: s._element, attributeName: "style", oldValue: s.cssText }); } function Pe(s) { const t = s._element; t._root && t.enqueueUpdate({ path: `${t._path}.st`, value: s.cssText }); } function ds(s, t) { process.env.NODE_ENV !== "production" && xt(A(s) && s.length > Qe, `Style 属性 ${t} 的值数据量过大,可能会影响渲染性能,考虑使用 CSS 类或其它方案替代。`), this[t] !== s && (!this._pending && us(this), Vt(s) || M(s) || s === "" ? (this._usedStyleProp.delete(t), delete this._value[t]) : (this._usedStyleProp.add(t), this._value[t] = s), !this._pending && Pe(this)); } function Re(s, t) { const e = {}; for (let n = 0; n < t.length; n++) { const i = t[n]; if (s[i]) return; e[i] = { get() { const r = this._value[i]; return Vt(r) || M(r) ? "" : r; }, set(r) { ds.call(this, r, i); } }; } Object.defineProperties(s.prototype, e); } function Fi(s) { return /^--/.test(s); } class Zt { constructor(t) { this._element = t, this._usedStyleProp = /* @__PURE__ */ new Set(), this._value = {}; } setCssVariables(t) { this.hasOwnProperty(t) || Object.defineProperty(this, t, { enumerable: !0, configurable: !0, get: () => this._value[t] || "", set: (e) => { ds.call(this, e, t); } }); } get cssText() { if (!this._usedStyleProp.size) return ""; const t = []; return this._usedStyleProp.forEach((e) => { const n = this[e]; if (Vt(n) || M(n)) return; let i = Fi(e) ? e : Mn(e); (i.indexOf("webkit") === 0 || i.indexOf("Webkit") === 0) && (i = `-${i}`), t.push(`${i}: ${n};`); }), t.join(" "); } set cssText(t) { if (this._pending = !0, us(this), this._usedStyleProp.forEach((n) => { this.removeProperty(n); }), t === "" || M(t) || Vt(t)) { this._pending = !1, Pe(this); return; } const e = t.split(";"); for (let n = 0; n < e.length; n++) { const i = e[n].trim(); if (i === "") continue; const [r, ...o] = i.split(":"), a = o.join(":"); M(a) || this.setProperty(r.trim(), a.trim()); } this._pending = !1, Pe(this); } setProperty(t, e) { t[0] === "-" ? this.setCssVariables(t) : t = G(t), Vt(e) || M(e) ? this.removeProperty(t) : this[t] = e; } removeProperty(t) { if (t = G(t), !this._usedStyleProp.has(t)) return ""; const e = this[t]; return this[t] = void 0, e; } getPropertyValue(t) { t = G(t); const e = this[t]; return e || ""; } } Re(Zt, re); T.tap("injectNewStyleProperties", (s) => { if (it(s)) Re(Zt, s); else { if (typeof s != "string") return; Re(Zt, [s]); } }); function Hi() { return !0; } function bn(s, t) { const e = [], n = t ?? Hi; let i = s; for (; i; ) i.nodeType === 1 && n(i) && e.push(i), i = Gi(i, s); return e; } function Gi(s, t) { const e = s.firstChild, n = s.nodeType === 1 || s.nodeType === 9; if (e && n) return e; let i = s; do { if (i === t) return null; const r = i.nextSibling; if (r) return r; i = i.parentElement; } while (i); return null; } class V extends nt { constructor() { super(), this.props = {}, this.dataset = Et, this.nodeType = 1, this.style = new Zt(this), T.call("patchElement", this); } _stopPropagation(t) { let e = this; for (; e = e.parentNode; ) { const n = e.__handlers[t.type]; if (it(n)) for (let i = n.length; i--; ) { const r = n[i]; r._stop = !0; } } } get id() { return this.getAttribute(At); } set id(t) { this.setAttribute(At, t); } get className() { return this.getAttribute(Jt) || ""; } set className(t) { this.setAttribute(Jt, t); } get cssText() { return this.getAttribute(K) || ""; } get classList() { return new ji(this.className, this); } get children() { return this.childNodes.filter(Mi); } get attributes() { const t = this.props, e = Object.keys(t), n = this.style.cssText; return e.map((r) => ({ name: r, value: t[r] })).concat(n ? { name: K, value: n } : []); } get textContent() { let t = ""; const e = this.childNodes; for (let n = 0; n < e.length; n++) t += e[n].textContent; return t; } set textContent(t) { super.textContent = t; } hasAttribute(t) { return !M(this.props[t]); } hasAttributes() { return this.attributes.length > 0; } get focus() { return function() { this.setAttribute(ie, !0); }; } // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579 set focus(t) { this.setAttribute(ie, t); } blur() { this.setAttribute(ie, !1); } setAttribute(t, e) { process.env.NODE_ENV !== "production" && xt(A(e) && e.length > Qe, `元素 ${this.nodeName} 的 ${t} 属性值数据量过大,可能会影响渲染性能。考虑降低图片转为 base64 的阈值或在 CSS 中使用 base64。`); const n = this.nodeName === Z && !lt(this) && !this.isAnyEventBinded(); switch (t !== K && ht.record({ target: this, type: "attributes", attributeName: t, oldValue: this.getAttribute(t) }), t) { case K: this.style.cssText = e; break; case At: this.uid !== this.sid && Lt.delete(this.uid), e = String(e), this.props[t] = this.uid = e, Lt.set(e, this); break; default: this.props[t] = e, t.startsWith("data-") && (this.dataset === Et && (this.dataset = /* @__PURE__ */ Object.create(null)), this.dataset[G(t.replace(/^data-/, ""))] = e); break; } if (!this._root) return; const i = pt(), r = i[this.nodeName], o = i[Z]._num, a = i[Le]._num, l = i[tn]._num, u = this._path; t = pn(t); const d = G(t), p = { path: `${u}.${d}`, value: z(e) ? () => e : e }; if (T.call("modifySetAttrPayload", this, t, p, i), r) { const m = r[d] || t; p.path = `${u}.${G(m)}`; } this.enqueueUpdate(p), this.nodeName === Z && (d === Kt ? this.enqueueUpdate({ path: `${u}.nn`, value: e ? l : this.isAnyEventBinded() ? o : a }) : n && lt(this) && this.enqueueUpdate({ path: `${u}.nn`, value: a })); } removeAttribute(t) { const e = this.nodeName === Z && lt(this) && !this.isAnyEventBinded(); if (ht.record({ target: this, type: "attributes", attributeName: t, oldValue: this.getAttribute(t) }), t === K) this.style.cssText = ""; else { if (T.call("onRemoveAttribute", this, t) || !this.props.hasOwnProperty(t)) return; delete this.props[t]; } if (!this._root) return; const n = pt(), i = n[this.nodeName], r = n[Z]._num, o = n[Le]._num, a = n[Ke]._num, l = this._path; t = pn(t); const u = G(t), d = { path: `${l}.${u}`, value: "" }; if (T.call("modifyRmAttrPayload", this, t, d, n), i) { const p = i[u] || t; d.path = `${l}.${G(p)}`; } this.enqueueUpdate(d), this.nodeName === Z && (u === Kt ? this.enqueueUpdate({ path: `${l}.nn`, value: this.isAnyEventBinded() ? r : lt(this) ? o : a }) : e && !lt(this) && this.enqueueUpdate({ path: `${l}.nn`, value: a })); } getAttribute(t) { const e = t === K ? this.style.cssText : this.props[t]; return e ?? ""; } getElementsByTagName(t) { return bn(this, (e) => e.nodeName === t || t === "*" && this !== e); } getElementsByClassName(t) { const e = t.trim().split(/\s+/); return bn(this, (n) => { const i = n.classList; return e.every((r) => i.contains(r)); }); } dispatchEvent(t) { const e = t.cancelable, n = this.__handlers[t.type]; if (!it(n)) return !1; for (let i = n.length; i--; ) { const r = n[i]; let o; if (r._stop ? r._stop = !1 : (T.call("modifyDispatchEvent", t, this), o = r.call(this, t)), (o === !1 || t._end) && e && (t.defaultPrevented = !0), !M(o) && t.mpEvent && (t.mpEvent[ue] = o), t._end && t._stop) break; } return t._stop ? this._stopPropagation(t) : t._stop = !0, n != null; } addEventListener(t, e, n) { const i = this.nodeName, r = T.call("getSpecialNodes"); let o = !0; if (Rn(n) && n.sideEffect === !1 && (o = !1, delete n.sideEffect), T.call("modifyAddEventListener", this, o, pt), o !== !1 && !this.isAnyEventBinded() && r.indexOf(i) > -1) { const l = pt()[i]._num; this.enqueueUpdate({ path: `${this._path}.nn`, value: l }); } super.addEventListener(t, e, n); } removeEventListener(t, e, n = !0) { super.removeEventListener(t, e); const i = this.nodeName, r = T.call("getSpecialNodes"); if (T.call("modifyRemoveEventListener", this, n, pt), n !== !1 && !this.isAnyEventBinded() && r.indexOf(i) > -1) { const o = pt(), a = lt(this) ? `static-${i}` : `pure-${i}`, l = o[a]._num; this.enqueueUpdate({ path: `${this._path}.nn`, value: l }); } } static extend(t, e) { rs(V, t, e); } } const L = { prerender: !0, debug: !1 }; function zi() { return { index: 0, column: 0, line: 0 }; } function oe(s, t, e) { const n = s.index, i = s.index = n + e; for (let r = n; r < i; r++) t.charAt(r) === ` ` ? (s.line++, s.column = 0) : s.column++; } function Rt(s, t, e) { const n = e - s.index; return oe(s, t, n); } function _t(s) { return { index: s.index, line: s.line, column: s.column }; } const Yi = /\s/; function Gt(s) { return Yi.test(s); } const qi = /=/; function En(s) { return qi.test(s); } function Qi(s) { const t = s.toLowerCase(); return !!L.html.skipElements.has(t); } const Ji = /[A-Za-z0-9]/; function Ki(s, t) { for (; ; ) { const e = s.indexOf("<", t); if (e === -1) return e; const n = s.charAt(e + 1); if (n === "/" || n === "!" || Ji.test(n)) return e; t = e + 1; } } function Zi(s, t, e) { if (!Gt(e.charAt(s))) return !1; const n = e.length; for (let i = s - 1; i > t; i--) { const r = e.charAt(i); if (!Gt(r)) { if (En(r)) return !1; break; } } for (let i = s + 1; i < n; i++) { const r = e.charAt(i); if (!Gt(r)) return !En(r); } } class Xi { constructor(t) { this.tokens = [], this.position = zi(), this.html = t; } scan() { const { html: t, position: e } = this, n = t.length; for (; e.index < n; ) { const i = e.index; if (this.scanText(), e.index === i) if (t.startsWith("!--", i + 1)) this.scanComment(); else { const o = this.scanTag(); Qi(o) && this.scanSkipTag(o); } } return this.tokens; } scanText() { const t = "text", { html: e, position: n } = this; let i = Ki(e, n.index); if (i === n.index) return; i === -1 && (i = e.length); const r = _t(n), o = e.slice(n.index, i); Rt(n, e, i); const a = _t(n); this.tokens.push({ type: t, content: o, position: { start: r, end: a } }); } scanComment() { const t = "comment", { html: e, position: n } = this, i = _t(n); oe(n, e, 4); let r = e.indexOf("-->", n.index), o = r + 3; r === -1 && (r = o = e.length); const a = e.slice(n.index, r); Rt(n, e, o), this.tokens.push({ type: t, content: a, position: { start: i, end: _t(n) } }); } scanTag() { this.scanTagStart(); const t = this.scanTagName(); return this.scanAttrs(), this.scanTagEnd(), t; } scanTagStart() { const t = "tag-start", { html: e, position: n } = this, r = e.charAt(n.index + 1) === "/", o = _t(n); oe(n, e, r ? 2 : 1), this.tokens.push({ type: t, close: r, position: { start: o } }); } scanTagEnd() { const t = "tag-end", { html: e, position: n } = this, r = e.charAt(n.index) === "/"; oe(n, e, r ? 2 : 1); const o = _t(n); this.tokens.push({ type: t, close: r, position: { end: o } }); } scanTagName() { const t = "tag", { html: e, position: n } = this, i = e.length; let r = n.index; for (; r < i; ) { const l = e.charAt(r); if (!(Gt(l) || l === "/" || l === ">")) break; r++; } let o = r + 1; for (; o < i; ) { const l = e.charAt(o); if (!!(Gt(l) || l === "/" || l === ">")) break; o++; } Rt(n, e, o); const a = e.slice(r, o); return this.tokens.push({ type: t, content: a }), a; } scanAttrs() { const { html: t, position: e, tokens: n } = this; let i = e.index, r = null, o = i; const a = [], l = t.length; for (; i < l; ) { const p = t.charAt(i); if (r) { p === r && (r = null), i++; continue; } if (p === "/" || p === ">") { i !== o && a.push(t.slice(o, i)); break; } if (Zi(i, o, t)) { i !== o && a.push(t.slice(o, i)), o = i + 1, i++; continue; } if (p === "'" || p === '"') { r = p, i++; continue; } i++; } Rt(e, t, i); const u = a.length, d = "attribute"; for (let p = 0; p < u; p++) { const m = a[p]; if (m.includes("=")) { const b = a[p + 1]; if (b && b.startsWith("=")) { if (b.length > 1) { const C = m + b; n.push({ type: d, content: C }), p += 1; continue; } const k = a[p + 2]; if (p += 1, k) { const C = m + "=" + k; n.push({ type: d, content: C }), p += 1; continue; } } } if (m.endsWith("=")) { const b = a[p + 1]; if (b && !b.includes("=")) { const C = m + b; n.push({ type: d, content: C }), p += 1; continue; } const k = m.slice(0, -1); n.push({ type: d, content: k }); continue; } n.push({ type: d, content: m }); } } scanSkipTag(t) { const { html: e, position: n } = this, i = t.toLowerCase(), r = e.length; for (; n.index < r; ) { const o = e.indexOf("</", n.index); if (o === -1) { this.scanText(); break; } Rt(n, e, o); const a = this.scanTag(); if (i === a.toLowerCase()) break; } } } function Be(s) { const t = s.charAt(0), e = s.length - 1; return (t === '"' || t === "'") && t === s.charAt(e) ? s.slice(1, e) : s; } const vn = "{", tr = "}", er = ".", nr = "#", sr = ">", ir = "~", rr = "+"; class or { constructor() { this.styles = []; } extractStyle(t) { const e = /<style\s?[^>]*>((.|\n|\s)+?)<\/style>/g; let n = t; return n = n.replace(e, (i, r) => { const o = r.trim(); return this.stringToSelector(o), ""; }), n.trim(); } stringToSelector(t) { let e = t.indexOf(vn); for (; e > -1; ) { const n = t.indexOf(tr), i = t.slice(0, e).trim(); let r = t.slice(e + 1, n); r = r.replace(/:(.*);/g, function(o, a) { return `:${a.trim().replace(/ +/g, "+++")};`; }), r = r.replace(/ /g, ""), r = r.replace(/\+\+\+/g, " "), /;$/.test(r) || (r += ";"), i.split(",").forEach((o) => { const a = this.parseSelector(o); this.styles.push({ content: r, selectorList: a }); }), t = t.slice(n + 1), e = t.indexOf(vn); } } parseSelector(t) { return t.trim().replace(/ *([>~+]) */g, " $1").replace(/ +/g, " ").replace(/\[\s*([^[\]=\s]+)\s*=\s*([^[\]=\s]+)\s*\]/g, "[$1=$2]").split(" ").map((i) => { const r = i.charAt(0), o = { isChild: r === sr, isGeneralSibling: r === ir, isAdjacentSibling: r === rr, tag: null, id: null, class: [], attrs: [] }; return i = i.replace(/^[>~+]/, ""), i = i.replace(/\[(.+?)\]/g, function(a, l) { const [u, d] = l.split("="), p = l.indexOf("=") === -1, m = { all: p, key: u, value: p ? null : d }; return o.attrs.push(m), ""; }), i = i.repl