| 41215 | verbose(s, ...o) { |
| 41216 | 'verbose' === this.debugLevel && console.log(`[${s}] `, ...o) |
| 41217 | } |
| 41218 | wrapPlugin(s, o) { |
| 41219 | const { pathDiscriminator: i } = this |
| 41220 | let a, |
| 41221 | u = null |
| 41222 | return ( |
| 41223 | s[this.pluginProp] |
| 41224 | ? ((u = s), (a = s[this.pluginProp])) |
| 41225 | : Wo.isFunction(s) |
| 41226 | ? (a = s) |
| 41227 | : Wo.isObject(s) && |
| 41228 | (a = (function createKeyBasedPlugin(s) { |
| 41229 | const isSubPath = (s, o) => !Array.isArray(s) || s.every((s, i) => s === o[i]) |
| 41230 | return function* generator(o, a) { |
| 41231 | const u = {} |
| 41232 | for (const [s, i] of o.filter(Wo.isAdditiveMutation).entries()) { |
| 41233 | if (!(s < Bl)) return |
| 41234 | yield* traverse(i.value, i.path, i) |
| 41235 | } |
| 41236 | function* traverse(o, _, w) { |
| 41237 | if (Wo.isObject(o)) { |
| 41238 | const x = _.length - 1, |
| 41239 | C = _[x], |
| 41240 | j = _.indexOf('properties'), |
| 41241 | L = 'properties' === C && x === j, |
| 41242 | B = a.allowMetaPatches && u[o.$$ref] |
| 41243 | for (const x of Object.keys(o)) { |
| 41244 | const C = o[x], |
| 41245 | j = _.concat(x), |
| 41246 | $ = Wo.isObject(C), |
| 41247 | U = o.$$ref |
| 41248 | if ( |
| 41249 | (B || |
| 41250 | ($ && |
| 41251 | (a.allowMetaPatches && U && isSubPath(i, j) && (u[U] = !0), |
| 41252 | yield* traverse(C, j, w))), |
| 41253 | !L && x === s.key) |
| 41254 | ) { |
| 41255 | const o = isSubPath(i, _) |
| 41256 | ;(i && !o) || (yield s.plugin(C, x, j, a, w)) |
| 41257 | } |
| 41258 | } |
| 41259 | } else s.key === _[_.length - 1] && (yield s.plugin(o, s.key, _, a)) |
| 41260 | } |
| 41261 | } |
| 41262 | })(s)), |
| 41263 | Object.assign(a.bind(u), { pluginName: s.name || o, isGenerator: Wo.isGenerator(a) }) |
| 41264 | ) |
| 41265 | } |
| 41266 | nextPlugin() { |
| 41267 | return this.wrappedPlugins.find((s) => this.getMutationsForPlugin(s).length > 0) |