[d565449] | 1 | import _typeof from "./typeof.js";
|
---|
| 2 | function applyDecs2203Factory() {
|
---|
| 3 | function createAddInitializerMethod(e, t) {
|
---|
| 4 | return function (r) {
|
---|
| 5 | !function (e, t) {
|
---|
| 6 | if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
---|
| 7 | }(t), assertCallable(r, "An initializer"), e.push(r);
|
---|
| 8 | };
|
---|
| 9 | }
|
---|
| 10 | function memberDec(e, t, r, a, n, i, s, o) {
|
---|
| 11 | var c;
|
---|
| 12 | switch (n) {
|
---|
| 13 | case 1:
|
---|
| 14 | c = "accessor";
|
---|
| 15 | break;
|
---|
| 16 | case 2:
|
---|
| 17 | c = "method";
|
---|
| 18 | break;
|
---|
| 19 | case 3:
|
---|
| 20 | c = "getter";
|
---|
| 21 | break;
|
---|
| 22 | case 4:
|
---|
| 23 | c = "setter";
|
---|
| 24 | break;
|
---|
| 25 | default:
|
---|
| 26 | c = "field";
|
---|
| 27 | }
|
---|
| 28 | var l,
|
---|
| 29 | u,
|
---|
| 30 | f = {
|
---|
| 31 | kind: c,
|
---|
| 32 | name: s ? "#" + t : t,
|
---|
| 33 | "static": i,
|
---|
| 34 | "private": s
|
---|
| 35 | },
|
---|
| 36 | p = {
|
---|
| 37 | v: !1
|
---|
| 38 | };
|
---|
| 39 | 0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() {
|
---|
| 40 | return this[t];
|
---|
| 41 | }, u = function u(e) {
|
---|
| 42 | this[t] = e;
|
---|
| 43 | }) : 2 === n ? l = function l() {
|
---|
| 44 | return r.value;
|
---|
| 45 | } : (1 !== n && 3 !== n || (l = function l() {
|
---|
| 46 | return r.get.call(this);
|
---|
| 47 | }), 1 !== n && 4 !== n || (u = function u(e) {
|
---|
| 48 | r.set.call(this, e);
|
---|
| 49 | })), f.access = l && u ? {
|
---|
| 50 | get: l,
|
---|
| 51 | set: u
|
---|
| 52 | } : l ? {
|
---|
| 53 | get: l
|
---|
| 54 | } : {
|
---|
| 55 | set: u
|
---|
| 56 | };
|
---|
| 57 | try {
|
---|
| 58 | return e(o, f);
|
---|
| 59 | } finally {
|
---|
| 60 | p.v = !0;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | function assertCallable(e, t) {
|
---|
| 64 | if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
---|
| 65 | }
|
---|
| 66 | function assertValidReturnValue(e, t) {
|
---|
| 67 | var r = _typeof(t);
|
---|
| 68 | if (1 === e) {
|
---|
| 69 | if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
---|
| 70 | void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
---|
| 71 | } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
---|
| 72 | }
|
---|
| 73 | function applyMemberDec(e, t, r, a, n, i, s, o) {
|
---|
| 74 | var c,
|
---|
| 75 | l,
|
---|
| 76 | u,
|
---|
| 77 | f,
|
---|
| 78 | p,
|
---|
| 79 | d,
|
---|
| 80 | h = r[0];
|
---|
| 81 | if (s ? c = 0 === n || 1 === n ? {
|
---|
| 82 | get: r[3],
|
---|
| 83 | set: r[4]
|
---|
| 84 | } : 3 === n ? {
|
---|
| 85 | get: r[3]
|
---|
| 86 | } : 4 === n ? {
|
---|
| 87 | set: r[3]
|
---|
| 88 | } : {
|
---|
| 89 | value: r[3]
|
---|
| 90 | } : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = {
|
---|
| 91 | get: c.get,
|
---|
| 92 | set: c.set
|
---|
| 93 | } : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
---|
| 94 | get: p,
|
---|
| 95 | set: d
|
---|
| 96 | }) : u = f);else for (var v = h.length - 1; v >= 0; v--) {
|
---|
| 97 | var g;
|
---|
| 98 | void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
---|
| 99 | get: p,
|
---|
| 100 | set: d
|
---|
| 101 | }) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g)));
|
---|
| 102 | }
|
---|
| 103 | if (0 === n || 1 === n) {
|
---|
| 104 | if (void 0 === l) l = function l(e, t) {
|
---|
| 105 | return t;
|
---|
| 106 | };else if ("function" != typeof l) {
|
---|
| 107 | var y = l;
|
---|
| 108 | l = function l(e, t) {
|
---|
| 109 | for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r);
|
---|
| 110 | return r;
|
---|
| 111 | };
|
---|
| 112 | } else {
|
---|
| 113 | var m = l;
|
---|
| 114 | l = function l(e, t) {
|
---|
| 115 | return m.call(e, t);
|
---|
| 116 | };
|
---|
| 117 | }
|
---|
| 118 | e.push(l);
|
---|
| 119 | }
|
---|
| 120 | 0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) {
|
---|
| 121 | return u.get.call(e, t);
|
---|
| 122 | }), e.push(function (e, t) {
|
---|
| 123 | return u.set.call(e, t);
|
---|
| 124 | })) : 2 === n ? e.push(u) : e.push(function (e, t) {
|
---|
| 125 | return u.call(e, t);
|
---|
| 126 | }) : Object.defineProperty(t, a, c));
|
---|
| 127 | }
|
---|
| 128 | function pushInitializers(e, t) {
|
---|
| 129 | t && e.push(function (e) {
|
---|
| 130 | for (var r = 0; r < t.length; r++) t[r].call(e);
|
---|
| 131 | return e;
|
---|
| 132 | });
|
---|
| 133 | }
|
---|
| 134 | return function (e, t, r) {
|
---|
| 135 | var a = [];
|
---|
| 136 | return function (e, t, r) {
|
---|
| 137 | for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) {
|
---|
| 138 | var c = r[o];
|
---|
| 139 | if (Array.isArray(c)) {
|
---|
| 140 | var l,
|
---|
| 141 | u,
|
---|
| 142 | f = c[1],
|
---|
| 143 | p = c[2],
|
---|
| 144 | d = c.length > 3,
|
---|
| 145 | h = f >= 5;
|
---|
| 146 | if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) {
|
---|
| 147 | var v = h ? s : i,
|
---|
| 148 | g = v.get(p) || 0;
|
---|
| 149 | if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
---|
| 150 | !g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
---|
| 151 | }
|
---|
| 152 | applyMemberDec(e, l, c, p, f, h, d, u);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 | pushInitializers(e, a), pushInitializers(e, n);
|
---|
| 156 | }(a, e, t), function (e, t, r) {
|
---|
| 157 | if (r.length > 0) {
|
---|
| 158 | for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) {
|
---|
| 159 | var o = {
|
---|
| 160 | v: !1
|
---|
| 161 | };
|
---|
| 162 | try {
|
---|
| 163 | var c = r[s](n, {
|
---|
| 164 | kind: "class",
|
---|
| 165 | name: i,
|
---|
| 166 | addInitializer: createAddInitializerMethod(a, o)
|
---|
| 167 | });
|
---|
| 168 | } finally {
|
---|
| 169 | o.v = !0;
|
---|
| 170 | }
|
---|
| 171 | void 0 !== c && (assertValidReturnValue(10, c), n = c);
|
---|
| 172 | }
|
---|
| 173 | e.push(n, function () {
|
---|
| 174 | for (var e = 0; e < a.length; e++) a[e].call(n);
|
---|
| 175 | });
|
---|
| 176 | }
|
---|
| 177 | }(a, e, r), a;
|
---|
| 178 | };
|
---|
| 179 | }
|
---|
| 180 | var applyDecs2203Impl;
|
---|
| 181 | function applyDecs2203(e, t, r) {
|
---|
| 182 | return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r);
|
---|
| 183 | }
|
---|
| 184 | export { applyDecs2203 as default }; |
---|