code:
/**
 * Displays a list of the children in the Nursery
 * @returns {string}
 */
App.Facilities.Nursery.childList = function () {
	"use strict";
	const
		cribs = V.cribs;

	let
		r = ``;

	for (let i = 0; i < cribs.length; i++) {
		r += `<hr style="margin:0">`;
		const
			child = cribs[i],
			weeksOwned = V.week - child.weekAcquired,
			weeksLeft = (V.targetAgeNursery * 52) - weeksOwned,
			he = child.genes === "XX" ? `she` : `he`,
			him = child.genes === "XX" ? `her` : 'him',
			He = capFirstChar(he);

		if (child.actualAge < 3) {
			r += App.UI.passageLink(`${SlaveFullName(child)}`, "Infant Interact", `$activeChild = $cribs[${i}]`);	// FIXME: figure out why "V.activeChild = child" doesn't work
			r += App.Facilities.Nursery.InfantSummary(child);
		} else {
			r += App.UI.passageLink(`${SlaveFullName(child)}`, "Child Interact", `$activeChild = $cribs[${i}]`);
			r += App.Facilities.Nursery.ChildSummary(child);
		}

		if (child.actualAge >= 18) {
			V.nurseryOldID = child.ID;
			if (child.targetLocation === "freedom") {
				V.freedSlaves.push(cribs[i]);
			}
			V.readySlave = cribs.pluck([i], [i]);
			r += `<<goto "Nursery Retrieval Workaround">>`;
			return r;
		}

		if (child.growTime <= 0 || child.actualAge >= V.targetAgeNursery) {
			r += `<br>`;
			r += `${He} is ready to leave ${V.nurseryName} and ${child.targetLocation === "slavery" ? `join your ménage` : `become a free citizen`}. `;
			r += `<<link ${child.targetLocation === "slavery" ? `"Introduce ${him} to life as a slave"` : `"Set ${him} free"`} "Nursery Retrieval Workaround">>`;	// FIXME: figure out why App.UI.passageLink doesn't work here
			V.readySlave = cribs.pluck([i], [i]);
			r += `<</link>>`;
		} else {
			r += `<br>`;
			r += `${He} is to continue staying in ${V.nurseryName} for another ${years(weeksLeft)}.
				${He} is destined for ${child.targetLocation} once ${he} is of age. `;
		}
	}

	return r;
};

/**
 * Converts the infant object into a new child object
 * @param {object} child
 */
App.Facilities.Nursery.infantToChild = function infantToChild(child) {
	child.abortionTat = -1,
		child.accent = 0,
		child.addict = 0,
		child.ageImplant = 0,
		child.arm = {
			left: new App.Entity.LimbState(),
			right: new App.Entity.LimbState()
		},
		child.leg = {
			left: new App.Entity.LimbState(),
			right: new App.Entity.LimbState()
		},
		child.analArea = 0,
		child.anus = 0,
		child.anusPiercing = 0,
		child.anusTat = 0,
		child.aphrodisiacs = 0,
		child.areolae = 0,
		child.areolaePiercing = 0,
		child.areolaeShape = "circle",
		child.armAccessory = "none",
		child.armsTat = 0,
		child.attrKnown = 0,
		child.attrXX = 0,
		child.attrXY = 0,
		child.backAccessory = "none",
		child.backTat = 0,
		child.bald = 0,
		child.balls = 0,
		child.behavioralFlaw = "none",
		child.belly = 0,
		child.bellyAccessory = "none",
		child.bellyFluid = 0,
		child.bellyImplant = -1,
		child.bellyPreg = 0,
		child.bellySag = 0,
		child.bellySagPreg = 0,
		child.bellyTat = 0,
		child.bodySwap = 0,
		child.boobShape = "normal",
		child.boobs = jsRandom(200, 500),
		child.boobsImplant = 0,
		child.boobsImplantType = "none",
		child.boobsTat = 0,
		child.brand = {},
		child.breastMesh = 0,
		child.breedingMark = 0,
		child.butt = jsRandom(0, 3),
		child.buttImplant = 0,
		child.buttImplantType = "none",
		child.buttTat = 0,
		child.buttplug = "none",
		child.buttplugAttachment = "none",
		child.canRecruit = 0,
		child.chastityAnus = 0,
		child.chastityPenis = 0,
		child.chastityVagina = 0,
		child.chem = 0,
		child.childsFathered = 0,
		child.childsKnockedUp = 0,
		child.choosesOwnClothes = 0,
		child.clit = jsRandom(0, 2),
		child.clitPiercing = 0,
		child.clone = 0,
		child.clothes = "no clothing",
		child.collar = "none",
		child.corsetPiercing = 0,
		child.counter = {
			PCChildrenFathered: 0,
			PCKnockedUp: 0,
			anal: 0,
			births: 0,
			birthsTotal: 0,
			cum: 0,
			laborCount: 0,
			mammary: 0,
			milk: 0,
			oral: 0,
			penetrative: 0,
			pitKills: 0,
			publicUse: 0,
			slavesFathered: 0,
			slavesKnockedUp: 0,
			vaginal: 0
		},
		child.curatives = 0,
		child.custom = {
			desc: "",
			hairVector: "",
			image: null,
			label: "",
			tattoo: "",
			title: "",
			titleLisp: ""
		},
		child.daughters = 0,
		child.devotion = 40,	// TODO:
		child.dick = 0,
		child.dickAccessory = "none",
		child.dickPiercing = 0,
		child.dickTat = 0,
		child.diet = "healthy",
		child.dietCum = 0,
		child.dietMilk = 0,
		child.drugs = "no drugs",
		child.earImplant = 0,
		child.earPiercing = 0,
		child.earShape = "normal",
		child.earT = "none",
		child.earTColor = "hairless",
		child.earwear = "none",
		child.electrolarynx = 0,
		child.energy = 0,
		child.eyebrowFullness = "natural",
		child.eyebrowHStyle = "natural",
		child.eyebrowPiercing = 0,
		child.eyewear = "none",
		child.faceImplant = 0,
		child.fertKnown = 1,
		child.fertPeak = 0,
		child.fetishKnown = 0,
		child.fetishStrength = 0,
		child.foreskin = 0,
		child.geneMods = {
			NCS: 0,
			rapidCellGrowth: 0
		},
		child.geneticQuirks = {
			albinism: 0,
			androgyny: 0,
			dwarfism: 0,
			fertility: 0,
			gigantism: 0,
			gigantomastia: 0,
			heterochromia: 0,
			hyperFertility: 0,
			mGain: 0,
			mLoss: 0,
			macromastia: 0,
			pFace: 0,
			rearLipedema: 0,
			superfetation: 0,
			uFace: 0,
			wGain: 0,
			wLoss: 0,
			wellHung: 0
		},
		child.genetics = {},
		child.hLength = jsRandom(30, 70),
		child.hStyle = "long",
		child.haircuts = 0,
		child.headAccessory = "none",
		child.health = {};
	setHealth(child, jsRandom(80, 100), 0, 0, 0, 0);
	child.hears = 0,
		child.heels = 0,
		child.height = jsRandom(85, 105),
		child.hips = 0,
		child.hormoneBalance = 0,
		child.hormones = 0,
		child.horn = "none",
		child.hornColor = "none",
		child.induce = 0,
		child.induceLactation = 0,
		child.intelligence = 100,
		child.intelligenceImplant = 0,
		child.labia = jsRandom(0, 2),
		child.labor = 0,
		child.lactation = 0,
		child.lactationAdaptation = 0,
		child.lactationDuration = 0,
		child.rules = new App.Entity.RuleState(),
		child.rules.lactation = "none",
		child.legAccessory = "none",
		child.legsTat = 0,
		child.lips = jsRandom(10, 30),
		child.lipsImplant = 0,
		child.lipsPiercing = 0,
		child.lipsTat = 0,
		child.rules.living = "normal",
		child.makeup = 0,
		child.markings = "none",
		child.minorInjury = 0,
		child.mpreg = 0,
		child.muscles = jsRandom(-10, 10),
		child.nails = 0,
		child.navelPiercing = 0,
		child.need = 0,
		child.nipples = "cute",
		child.nipplesAccessory = "none",
		child.nipplesPiercing = 0,
		child.nosePiercing = 0,
		child.oldDevotion = 0,	// TODO:
		child.oldTrust = 0,		// TODO:
		child.onDiet = 0,
		child.origRace = child.race,
		child.eye = new App.Entity.EyeState(),
		child.eye.origColor = child.eyeColor,
		child.origHColor = child.hColor,
		child.origSkin = child.skin,
		child.ovaries = child.genes === "XX" ? 1 : 0,
		child.ovaryAge = child.actualAge,
		/* eslint-disable camelcase */
		child.override_Arm_H_Color = 0,
		child.override_Brow_H_Color = 0,
		child.override_Eye_Color = 0,
		child.override_H_Color = 0,
		child.override_Pubic_H_Color = 0,
		child.override_Race = 0,
		child.override_Skin = 0,
		/* eslint-enable camelcase */
		child.physicalAge = child.actualAge,
		child.porn = new App.Entity.SlavePornPerformanceState(),
		child.pregAdaptation = 50,
		child.pregControl = "none",
		child.pregData = {
			drugsEffect: 1,
			fetusRate: [1, 1, 1, 0.64, 0.6513, 0.6459, 0.644, 0.6393, 0.58, 0.51],
			fetusSize: [1, 3, 16, 25.6, 51, 60, 67.5, 71.6, 129.5, 130],
			fetusWeek: [0, 9, 20, 20, 40, 52, 64, 80, 384, 99999],
			minLiveBirth: 32,
			normalBirth: 40,
			normalOvaMax: 1,
			normalOvaMin: 1,
			sizeType: 0,
			type: "human"
		},
		child.pregKnown = 0,
		child.pregSource = 0,
		child.pregType = 0,
		child.pregWeek = 0,
		child.premature = 0,
		child.prematureBirth = 0,
		child.prestige = 0,
		child.prostate = 0,
		child.pubertyAgeXX = 10,
		child.pubertyAgeXY = 12,
		child.pubertyXX = 1,
		child.pubicHColor = "black",
		child.pubicHStyle = "bushy",
		child.readyOva = 0,
		child.rearAccessory = "none",
		child.relationship = 0,
		child.rules.relationship = "restrictive",	// TODO:
		child.relationshipTarget = 0,
		child.rules.release = new App.Entity.ReleaseRulesState(),	// TODO:
		child.rivalry = 0,
		child.rivalryTarget = 0,
		child.rudeTitle = 0,
		child.scars = 0,
		child.scrotum = 0,
		child.shoes = "none",
		child.shoulders = 0,
		child.shouldersTat = 0,
		child.sisters = 0,
		child.skill = {
			DJ: 0,
			anal: 0,
			attendant: 0,
			bodyguard: 0,
			combat: 0,
			entertainer: 0,
			entertainment: 0,
			farmer: 0,
			headGirl: 0,
			madam: 0,
			matron: 0,
			milkmaid: 0,
			nurse: 0,
			oral: 0,
			recruiter: 0,
			servant: 0,
			stewardess: 0,
			teacher: 0,
			vaginal: 0,
			wardeness: 0,
			whore: 0,
			whoring: 8
		},
		child.smells = 0,
		child.rules.speech = "restrictive",	// TODO:
		child.stampTat = 0,
		child.rules.punishment = "situational",	// TODO:
		child.rules.reward = "situational",	// TODO:
		child.tail = "none",
		child.tailColor = "none",
		child.tailShape = "none",
		child.tastes = 0,
		child.teeth = "baby",
		child.tonguePiercing = 0,
		child.training = 0,
		child.trust = 0,	// TODO:
		child.underArmHStyle = "natural",
		child.vagina = child.genes === "XX" ? 0 : -1,
		child.vaginaLube = 0,
		child.vaginaPiercing = 0,
		child.vaginaTat = 0,
		child.vaginalAccessory = "none",
		child.vaginalAttachment = "none",
		child.vaginalAttachments = "none",
		child.vasectomy = 0,
		child.visualAge = child.actualAge,
		child.voice = 1,
		child.voiceImplant = 0,
		child.waist = 0,
		child.weeksLeft = 0,
		child.weight = jsRandom(-10, 10),
		child.womb = [],
		child.wombImplant = "none";
	resetEyeColor(child, "both");
	generatePronouns(child);

	return child;
};

/**
 * Allows the player to name the infant
 * FIXME: Does not currently work
 * @param {object} child
 * @returns {string}
 */
App.Facilities.Nursery.nameChild = function nameChild(child) {
	const
		PC = V.PC,
		arcology = V.arcologies[0],
		girl = child.genes === "XX" ? "girl" : "boy";

	let
		r = ``,
		father = 0,
		mother = 0;

	if (child.father === -1 && child.mother === -1) {
		father = PC;
		mother = PC;
	} else {
		if (child.father === -1) {
			father = PC;
			mother = getSlave(child.mother);
		} else if (child.mother === -1) {
			father = getSlave(child.father);
			mother = PC;
		} else {
			father = getSlave(child.father);
			mother = getSlave(child.mother);
		}
	}

	function newChildName(child) {
		const
			V = State.variable;

		child.birthName = generateName(child.nationality, child.race, child.genes === "XY");

		if (child.genes === "XY" && !V.allowMaleSlaveNames && isMaleName(child.birthName, child.nationality, child.race)) {
			child.slaveName = generateName(child.nationality, child.race, false);
		} else {
			child.slaveName = child.birthName;
		}
	}

	function parentNames(parent, child) {
		const
			slaves = V.slaves;

		let
			currentSlaveNames = slaves.map(s => s.slaveName),
			continentNationality;

		child.slaveName = generateName(parent.nationality, parent.race, parent.genes === "XY", sn => !currentSlaveNames.includes(sn));

		if (!child.slaveName) {
			for (let i = 0; i < 10; i++) {
				continentNationality = hashChoice(V.nationalities);
				child.slaveName = generateName(continentNationality, child.race, child.genes === "XY", sn => !currentSlaveNames.includes(sn));
			}
		}
		if (!child.slaveName) {
			child.slaveName = generateName(parent.nationality, parent.race, parent.genes === "XY");
		}
	}

	r += `You can name the new child, if you so desire. `;

	r += `<br><<textbox "${child.slaveName}" ${child.slaveName}>>`;
	r += App.UI.passageLink("Commit name", "Nursery Workaround", `${child.birthName = child.slaveName}, ${App.UI.replace("#naming", `You instruct ${V.assistant.name} to register the new ${girl} as "${child.slaveName}" in the slave registry.`)}`);
	r += `<br>`;
	r += App.UI.passageLink(`Have your PA assign ${him} a random name`, "Nursery Workaround", `${App.UI.replace("#naming", `${newChildName(child)}
${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.`)}`);

	if (arcology.FSPastoralist !== "unset") {
		if (child.lactation > 0) {
			r += `

			<<link "Have your PA assign ${him} a random cow name">>
			<<replace "#naming">>`;
			child.slaveName = setup.cowSlaveNames.random();
			child.birthName = child.slaveName;
			r += `${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
			<</link>>`;
		}
	}
	if (arcology.FSChattelReligionist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a random devotional name">>
			<<replace "#naming">>`;
		child.slaveName = setup.chattelReligionistSlaveNames.random();
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	}
	if (arcology.FSRomanRevivalist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a random Roman name">>
			<<replace "#naming">>`;
		child.slaveName = setup.romanSlaveNames.random();
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	} else if (arcology.FSAztecRevivalist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a random Aztec name">>
			<<replace "#naming">>`;
		child.slaveName = setup.aztecSlaveNames.random();
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	} else if (arcology.FSEgyptianRevivalist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a random ancient Egyptian name">>
			<<replace "#naming">>`;
		child.slaveName = setup.ancientEgyptianSlaveNames.random();
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	} else if (arcology.FSEdoRevivalist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a random feudal Japanese name">>
			<<replace "#naming">>`;
		child.slaveName = setup.edoSlaveNames.random();
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	}
	if (arcology.FSDegradationist !== "unset") {
		r += `

		<<link "Have your PA assign ${him} a degrading name">>
			<<replace "#naming">>`;
		DegradingName(child);
		child.birthName = child.slaveName;
		`${V.assistant.name} registers the new ${girl} as "${child.slaveName}" in your registry.
			<</replace>>
		<</link>>`;
	}
	if (mother !== PC && mother !== 0) {
		App.Utils.setLocalPronouns(mother, 2);
		if (jsDef(V.Concubine) && mother.ID === V.Concubine.ID) {
			r += `

			<<link "Permit your Concubine to name _his2 daughter">>
				<<replace "#naming">>`;
			parentNames(mother, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${mother.slaveName} picks a name ${he2} thinks you might find attractive; from now on ${his2} daughter will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		} else if (mother.relationship === -3 && mother.devotion >= -20) {
			r += `

			<<link "Permit your wife to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(mother, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${mother.slaveName} picks a name suitable for your daughter; from now on ${he2} will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		} else if (jsDef(V.Bodyguard) && mother.ID === V.Bodyguard.ID) {
			r += `

			<<link "Permit your bodyguard to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(mother, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${mother.slaveName} decides on "${child.slaveName}" for ${his2} daughter. ${He2} hopes you'll find it fitting ${his} station.
				<</replace>>
			<</link>>`;
		} else if (jsDef(V.Headgirl) && mother.ID === V.Headgirl.ID) {
			r += `

			<<link "Permit your Head Girl to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(mother, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${mother.slaveName} decides on "${child.slaveName}" for ${his2} daughter, and hopes it will be a name your other slaves will learn to respect.
				<</replace>>
			<</link>>`;
		} else if (mother.devotion > 50 && mother.trust > 50) {
			r += `

			<<link "Permit ${his} devoted mother to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(mother, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${mother.slaveName} picks a name ${he2} hopes you'll like; from now on ${his2} daughter will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		}
	}
	if (father !== PC && father !== 0 && father !== mother) {
		App.Utils.setLocalPronouns(father, 2);
		if (jsDef(V.Concubine) && father.ID === V.Concubine.ID) {
			r += `

			<<link "Permit your Concubine to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(father, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${father.slaveName} picks a name ${he2} thinks you might find attractive; from now on ${his2} daughter will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		} else if (father.relationship === -3 && father.devotion >= -20) {
			r += `

			<<link "Permit your wife to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(father, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${father.slaveName} picks a name suitable for your daughter; from now on ${he} will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		} else if (jsDef(V.Bodyguard) && father.ID === V.Bodyguard.ID) {
			r += `

			<<link "Permit your bodyguard to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(father, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${father.slaveName} decides on "${child.slaveName}" for ${his2} daughter. ${He2} hopes you'll find it fitting ${his} station.
				<</replace>>
			<</link>>`;
		} else if (jsDef(V.Headgirl) && father.ID === V.Headgirl.ID) {
			r += `

			<<link "Permit your Head Girl to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(father, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${father.slaveName} decides on "${child.slaveName}" for ${his2} daughter, and hopes it will be a name your other slaves will learn to respect.
				<</replace>>
			<</link>>`;
		} else if (father.devotion > 50 && father.trust > 50) {
			r += `

			<<link "Permit ${his} devoted father to name ${his2} daughter">>
				<<replace "#naming">>`;
			parentNames(father, child);
			child.birthName = child.slaveName;
			`After some careful consideration, ${father.slaveName} picks a name ${he2} hopes you'll like; from now on ${his2} daughter will be known as "${child.slaveName}".
				<</replace>>
			<</link>>`;
		}
	}

	return r;
};

/**
 * Adds an infant to a the cribs
 * @param {App.Entity.InfantState} child
 */
App.Facilities.Nursery.newChild = function newChild(child) {
	child.ID = generateSlaveID();

	child.actualAge = 0;
	child.birthWeek = 0;

	if (child.override_Race !== 1) {
		child.origRace = child.race;
	}

	if (child.override_H_Color !== 1) {
		child.hColor = getGeneticHairColor(child);
	}
	if (child.override_Arm_H_Color !== 1) {
		child.underArmHColor = getGeneticHairColor(child);
	}
	if (child.override_Pubic_H_Color !== 1) {
		child.pubicHColor = getGeneticHairColor(child);
	}
	if (child.override_Brow_H_Color !== 1) {
		child.eyebrowHColor = getGeneticHairColor(child);
	}
	if (child.override_Skin !== 1) {
		child.origSkin = getGeneticSkinColor(child);
	}
	/* eslint-disable camelcase*/
	child.override_Race = 0;
	child.override_H_Color = 0;
	child.override_Arm_H_Color = 0;
	child.override_Pubic_H_Color = 0;
	child.override_Brow_H_Color = 0;
	child.override_Skin = 0;
	child.override_Eye_Color = 0;
	/* eslint-enable */

	child.arm = {
		left: new App.Entity.LimbState(),
		right: new App.Entity.LimbState()
	};
	child.leg = {
		left: new App.Entity.LimbState(),
		right: new App.Entity.LimbState()
	};

	if (V.surnamesForbidden === 1) {
		child.childSurname = 0;
	}

	if (child.clone !== 0) {
		child.canRecruit = 0;
	}
	generatePronouns(child);
	child.origin = `$He was born and raised in your arcology. `;
	child.targetLocation = "slavery";
	child.growTime = V.targetAgeNursery * 52;
	V.cribs.push(child);
	V.cribsIndices = App.Facilities.Nursery.cribsToIndices();
	V.nurseryBabies++;
};

/**
 * @param {App.Entity.ChildState[]} [cribs]
 * @returns {Object.<number, number>}
 */
App.Facilities.Nursery.cribsToIndices = function cribsToIndices(cribs = V.cribs) {
	return cribs.reduce((acc, child, i) => { acc[child.ID] = i; return acc; }, {});
};

/**
 * Returns index in the children array for the given ID
 * @param {number} ID child's ID
 * @returns {number}
 */
App.Facilities.Nursery.childIndexForID = function childIndexForID(id) {
	return V.cribsIndices[id];
};

/**
 * Removes the child using the child's ID
 * @param {number} index
 * @returns {Array}
 */
App.Facilities.Nursery.removeChild = function removeChild(index) {
	return V.cribs.deleteAt(index);
};

/**
 * Displays a list of slaves with children eligible for the Nursery
 * FIXME: Does not currently work
 * @returns {string}
 */
App.Facilities.Nursery.nurserySort = function nurserySort() {
	"use strict";
	const
		PC = V.PC,
		SL = V.slaves.length,
		arcology = V.arcologies[0],
		freeCribs = (V.nursery - V.cribs.length);

	let
		r = ``,
		eligibility = 0,
		sortNurseryList = V.sortNurseryList || "Unsorted",
		childrenReservedNursery = false,	// TODO: rename this to avoid confusion
		reservedChildrenNursery = FetusGlobalReserveCount("nursery");

	r += `<br><i>Sorting:</i> <b><span id="qlNurserySort">${sortNurseryList}</span>.</b> `;
	r += `${App.UI.passageLink("Sort by Name", "Nursery", `${sortNurseryList = "Name"}, ${App.UI.replace(`#qlNurserySort`, sortNurseryList)}, ${byName()}`)} | `;
	r += `${App.UI.passageLink("Sort by Reserved Nursery Spots", "Nursery", `${sortNurseryList = "Reserved Nursery Spots"}, ${App.UI.replace(`#qlNurserySort`), sortNurseryList}, ${byReservedSpots()}`)} | `;
	r += `${App.UI.passageLink("Sort by Pregnancy Week", "Nursery", `${sortNurseryList = "Pregnancy Week"}, ${App.UI.replace(`#qlNurserySort`, sortNurseryList)}, ${byPregnancyWeek()}`)} | `;
	r += `${App.UI.passageLink("Sort by Number of Children", "Nursery", `${sortNurseryList = "Number of Children"}, ${App.UI.replace(`#qlNurserySort`, sortNurseryList)}, ${byPregnancyCount()}`)}`;
	r += `<br>`;

	r += `<div id="qlNursery">`;

	for (let i = 0; i < SL; i++) {
		const slave = V.slaves[i];

		App.Utils.setLocalPronouns(slave);

		if (slave.preg > 0 && !slave.broodmother && slave.pregKnown && slave.eggType === "human") {
			if (slave.assignment !== Job.DAIRY && V.dairyPregSetting <= 0) {
				const
					slaveID = "slave-" + slave.ID,
					WL = slave.womb.length,
					reservedNursery = WombReserveCount(slave, "nursery"),
					reservedIncubator = WombReserveCount(slave, "incubator"),
					pregWeek = slave.pregWeek,
					slaveName = SlaveFullName(slave);

				r += `<div class="possible" @id="${slaveID}" @data-preg-count="${WL}" @data-reserved-spots="${reservedNursery}" @data-preg-week="${pregWeek}" @data-name="${slaveName}">`;

				r += `${App.UI.passageLink(`${slaveName}`, "Long Slave Description", `${V.activeSlave = slave}, ${V.nextLink = passage()}`)} is ${pregWeek} weeks pregnant with `;

				switch (slave.pregSource) {
					case 0:
						r += `someone's${slave.preg <= 5 ? `, though it is too early to tell whose,` : ``}`;
						break;
					case -1:
						r += `your`;
						break;
					case -2:
						r += `a citizen's`;
						break;
					case -3:
						r += `your Master's`;
						break;
					case -4:
						r += `another arcology owner's`;
						break;
					case -5:
						r += `your client's`;
						break;
					case -6:
						r += `the Societal Elite's`;
						break;
					case -7:
						r += `the lab's`;
						break;
					case -9:
						r += `the Futanari Sister's`;
						break;
					default:
						if (slave.preg <= 5) {
							r += `someone's, though it is too early to tell whose,`;
						} else {
							let t = V.slaveIndices[slave.pregSource];
							if (jsDef(t)) {
								r += `${V.slaves[t].slaveName}'s`;
							}
						}
						break;
				}
				r += ` ${WL > 1 ? `babies` : `baby`}. `;

				if (reservedNursery > 0) {
					childrenReservedNursery = true;
					if (WL === 1) {
						r += `${His} child will be placed in ${V.nurseryName}. `;
					} else if (reservedNursery < WL) {
						r += `${reservedNursery} of ${his} children will be placed in ${V.nurseryName}. `;
					} else if (WL === 2) {
						r += `Both of ${his} children will be placed in ${V.nurseryName}. `;
					} else {
						r += `All ${reservedNursery} of ${his} children will be placed in ${V.nurseryName}. `;
					}

					if ((reservedIncubator + reservedNursery < WL) && (reservedChildrenNursery < freeCribs)) {
						r += `<br>    `;
						r += App.UI.passageLink("Keep another child", "Nursery", `${WombAddToGenericReserve(slave, "nursery", 1)}`);
						if (reservedNursery > 0) {
							r += ` | ${App.UI.passageLink("Keep one less child", "Nursery", `${WombCleanGenericReserve(slave, "nursery", 1)}`)}`;
						}
						if (reservedNursery > 1) {
							r += ` | ${App.UI.passageLink(`Keep none of ${his} children`, "Nursery", `${WombCleanGenericReserve(slave, "nursery", 9999)}`)}`;
						}
						if (reservedChildrenNursery + WL - reservedNursery <= freeCribs) {
							r += ` | ${App.UI.passageLink(`Keep the rest of ${his} children`, "Nursery", `${WombAddToGenericReserve(slave, "nursery", 9999)}`)}`;
						}
					} else if (reservedNursery === WL || reservedChildrenNursery === freeCribs || reservedIncubator + reservedNursery === WL) {
						r += `<br>    `;
						r += App.UI.passageLink("Keep one less child", "Nursery", `${WombCleanGenericReserve(slave, "nursery", 1)}`);
						if (reservedNursery > 1) {
							r += ` | ${App.UI.passageLink(`Keep none of ${his} children`, "Nursery", `${WombCleanGenericReserve(slave, "nursery", 9999)}`)}`;
						}
					}
				} else if (reservedChildrenNursery < freeCribs && freeCribs > WL) {
					if (WL - reservedIncubator === 0) {
						r += `<i>${His} children are already reserved for ${V.incubatorName}</i>`;
						r += `<br>    `;
						r += App.UI.passageLink(`Keep ${his} child${WL > 1 ? `ren` : ``} here instead`, "Nursery", `${WombAddToGenericReserve(slave, "nursery", 1)}`);
					} else {
						r += `You have ${freeCribs === 1 ? `an ` : ``}available room${freeCribs > 1 ? `s` : ``}. `;
						r += `<br>    `;
						r += App.UI.passageLink(`Keep ${WL > 1 ? `a` : `the`} child`, "Nursery", `${WombAddToGenericReserve(slave, "nursery", 1)}`);
						if (WL > 1 && (reservedChildrenNursery + WL - reservedNursery <= freeCribs)) {
							r += ` | ${App.UI.passageLink(`Keep all of ${his} children`, "Nursery", `${WombAddToGenericReserve(slave, "nursery", 9999)}`)}`;
						}
					}
				} else if (reservedChildrenNursery === freeCribs) {
					r += `<br>    `;
					r += `You have <span class="red">no room for ${his} offspring.</span> `;
				}

				eligibility = 1;
				r += `</div>`;
			}
		}
	}

	r += `</div>`;

	$('div#qlNursery').ready(byPreviousSort);

	if (!eligibility) {
		r += `<br>`;
		r += `<i>You have no pregnant slave bearing eligile children</i>`;
	}

	if (PC.pregKnown && (arcology.FSRestart === "unset" || V.eugenicsFullControl || (PC.pregSource !== -1 && PC.pregSource !== -6))) {
		const
			WL = PC.womb.length;

		let
			reservedIncubator = WombReserveCount(PC, "incubator"),
			reservedNursery = WombReserveCount(PC, "nursery");

		r += `<br><b><span class="pink">You're pregnant</span></b> and going to have ${WL === 1 ? `a baby. ` : pregNumberName(WL, 1)} `;

		if (reservedNursery > 0) {
			childrenReservedNursery = 1;
			if (WL === 1) {
				r += `Your child will be placed in ${V.nurseryName}.`;
			} else if (reservedNursery < WL) {
				r += `${reservedNursery} of your children will be placed in ${V.nurseryName}.`;
			} else if (WL === 2) {
				r += `Both of your children will be placed in ${V.nurseryName}.`;
			} else {
				r += `All ${reservedNursery} of your children will be placed in ${V.nurseryName}.`;
			}

			if (reservedNursery < WL && reservedChildrenNursery < freeCribs && reservedNursery - reservedIncubator > 0) {
				r += `<br>    `;
				r += App.UI.passageLink("Keep another child", "Nursery", `${reservedNursery += 1}, ${reservedChildrenNursery += 1}`);
				if (reservedNursery > 0) {
					r += ` | ${App.UI.passageLink("Keep one less child", "Nursery", `${reservedNursery -= 1}, ${reservedChildrenNursery -= 1}`)}`;
				}

				if (reservedNursery > 1) {
					r += ` | ${App.UI.passageLink("Keep none of your children", "Nursery", `${reservedChildrenNursery -= reservedNursery}, ${reservedChildrenNursery = 0}`)}`;
				}

				if (reservedChildrenNursery + WL - reservedNursery <= freeCribs) {
					r += ` | ${App.UI.passageLink("Keep the rest of your children", "Nursery", `${reservedChildrenNursery += (WL - reservedNursery)}, ${reservedNursery += (WL - reservedNursery)}`)}`;
				}
			} else if (reservedNursery === WL || reservedChildrenNursery === freeCribs || reservedNursery - reservedIncubator >= 0) {
				r += `<br>    `;
				r += App.UI.passageLink("Keep one less child", "Nursery", `${reservedNursery -= 1}, ${reservedChildrenNursery -= 1}`);
				if (reservedNursery > 1) {
					r += App.UI.passageLink("Keep none of your children", "Nursery", `${reservedChildrenNursery -= reservedNursery}, ${reservedNursery = 0}`);
				}
			}
		} else if (reservedChildrenNursery < freeCribs) {
			if (WL - reservedIncubator === 0) {
				r += `<i>Your child${WL > 1 ? `ren are` : ` is`} already reserved for ${V.incubatorName}</i>`;
				r += App.UI.passageLink(`Keep your child${WL > 1 ? `ren` : ``} here instead`, "Nursery", `${reservedNursery += WL}, ${reservedIncubator = 0}`);
			} else {
				r += `You have ${freeCribs === 1 ? `an ` : ``}available room${freeCribs > 1 ? `s` : ``}. `;
				r += `<br>    `;
				r += App.UI.passageLink(`Keep ${WL > 1 ? `a` : `your`} child`, "Nursery", `${reservedNursery += 1}, ${reservedChildrenNursery += 1}`);
				if (WL > 1 && (reservedChildrenNursery + WL - reservedNursery <= freeCribs)) {
					r += ` | ${App.UI.passageLink("Keep all of your children", "Nursery", `${reservedChildrenNursery += WL}, ${reservedNursery += WL}`)}`;
				}
			}
		} else if (reservedChildrenNursery === freeCribs) {
			r += `<br>    `;
			r += `You have <span class="red">no room for your offspring.</span> `;
		}
	}

	if (reservedChildrenNursery || childrenReservedNursery) {
		r += `<br>`;
		r += App.UI.passageLink("Clear all reserved children", "Nursery", `${V.slaves.forEach(WombCleanGenericReserve(slave, "nursery", 9999))}, ${WombCleanGenericReserve(PC, "nursery", 9999)}`);
	}

	function byName() {
		let sortedNurseryPossibles = $('#qlNursery div.possible').detach();
		sortedNurseryPossibles = sortDomObjects(sortedNurseryPossibles, 'data-name');
		$(sortedNurseryPossibles).appendTo($('#qlNursery'));
	}

	function byReservedSpots() {
		let sortedNurseryPossibles = $('#qlNursery div.possible').detach();
		sortedNurseryPossibles = sortDomObjects(sortedNurseryPossibles, 'data-reserved-spots');
		$(sortedNurseryPossibles).appendTo($('#qlNursery'));
	}

	function byPregnancyWeek() {
		let sortedNurseryPossibles = $('#qlNursery div.possible').detach();
		sortedNurseryPossibles = sortDomObjects(sortedNurseryPossibles, 'data-preg-week');
		$(sortedNurseryPossibles).appendTo($('#qlNursery'));
	}

	function byPregnancyCount() {
		let sortedNurseryPossibles = $('#qlNursery div.possible').detach();
		sortedNurseryPossibles = sortDomObjects(sortedNurseryPossibles, 'data-preg-count');
		$(sortedNurseryPossibles).appendTo($('#qlNursery'));
	}

	function byPreviousSort() {
		let sort = V.sortNurseryList;
		if (sort !== 'unsorted') {
			if (sort === 'Name') {
				sortNurseryPossiblesByName();
			} else if (sort === 'Reserved Nursery Spots') {
				sortNurseryPossiblesByReservedSpots();
			} else if (sort === 'Pregnancy Week') {
				sortNurseryPossiblesByPregnancyWeek();
			} else if (sort === 'Number of Children') {
				sortNurseryPossiblesByPregnancyCount();
			}
		}
	}

	return r;
};


code:
App.Data.Facilities.penthouse = {
	baseName: "penthouse",
	genericName: "Penthouse",
	jobs: {
		rest: {
			position: "Rest",
			assignment: Job.REST,
			publicSexUse: false,
			fuckdollAccepted: true
		},
		chooseOwn: {
			position: "Choose own",
			assignment: Job.CHOICE,
			publicSexUse: false,
			fuckdollAccepted: false,
			description: {
				rulesAssistant: {
					assigned:({pronouns:{his}})=>`select ${his} own assignments`,
					assignedType: "allowed"
				}
			}
		},
		fucktoy: {
			position: "Fucktoy",
			assignment: Job.FUCKTOY,
			publicSexUse: false,
			fuckdollAccepted: true
		},
		classes: {
			position: "Classes",
			assignment: Job.CLASSES,
			publicSexUse: false,
			fuckdollAccepted: false
		},
		houseServant: {
			position: "House Servant",
			assignment: Job.HOUSE,
			publicSexUse: false,
			fuckdollAccepted: false
		},
		whore: {
			position: "Whore",
			assignment: Job.WHORE,
			publicSexUse: true,
			fuckdollAccepted: false
		},
		publicServant: {
			position: "Public Servant",
			assignment: Job.PUBLIC,
			publicSexUse: true,
			fuckdollAccepted: false
		},
		subordinateSlave: {
			position: "Subordinate slave",
			assignment: Job.SUBORDINATE,
			publicSexUse: false,
			fuckdollAccepted: false
		},
		cow: {
			position: "Milked",
			assignment: Job.MILKED,
			publicSexUse: false,
			fuckdollAccepted: false
		},
		gloryhole: {
			position: "Gloryhole",
			assignment: Job.GLORYHOLE,
			publicSexUse: false,
			fuckdollAccepted: true
		},
		confinement: {
			position: "Confinement",
			assignment: Job.CONFINEMENT,
			publicSexUse: false,
			fuckdollAccepted: true
		}
	},
	defaultJob: "rest",
	manager: {
		position: "Recruiter",
		assignment: Job.RECRUITER,
		careers: App.Data.misc.recruiterCareers,
		skill: "recruiter",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: false,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: true,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.PenthouseJobs = {
	Classes: class extends App.Entity.Facilities.Job {
		checkRequirements(slave) {
			let r = super.checkRequirements(slave);
			if (slave.intelligenceImplant >= 15) {
				r.push(`${slave.slaveName} already has a basic education.`);
			}
			if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, -20, -51)) {
				r.push(`${slave.slaveName} is too resistant to learn.`);
			}

			if (slave.fetish === "mindbroken") {
				r.push(`${slave.slaveName}'s mind is fundamentally broken and can't learn.`);
			}
			return r;
		}
	},
	HouseServant: class extends App.Entity.Facilities.Job {
		checkRequirements(slave) {
			let r = super.checkRequirements(slave);

			if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, -19, -51)) {
				r.push(App.Entity.Facilities.Job._stdBreakageMessage(slave));
			}

			if (!canWalk(slave)) {
				r.push(`${slave.slaveName} can't walk and would be unable to properly clean.`);
			}
			if (!canSee(slave)) {
				r.push(`${slave.slaveName} is blind and would be unable to properly clean.`);
			}

			return r;
		}
	},

	SubordinateSlave: class extends App.Entity.Facilities.Job {
		checkRequirements(slave) {
			let r = super.checkRequirements(slave);
			if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, -19, -51)) {
				r.push(App.Entity.Facilities.Job._stdBreakageMessage(slave));
			}
			return r;
		}

		assignmentLinkElement(ID, passage, callback, linkText) {
			linkText = linkText || this.desc.position;
			return App.UI.DOM.assignmentLink(slaveStateById(ID), this.desc.assignment, "Subordinate Targeting",
				(slave, assignment) => {
					if (callback) {
						callback(slave, assignment);
					}
					V.activeSlave = slave;
					V.returnTo = passage;
				}, linkText);
		}
	},
	Cow: class extends App.Entity.Facilities.Job {
		checkRequirements(slave) {
			let r = super.checkRequirements(slave);

			if ((slave.lactation <= 0) && (slave.balls <= 0)) {
				r.push(`${slave.slaveName} is not lactating` + ((V.seeDicks > 0) ? ' or producing semen.' : '.'));
			}
			return r;
		}
	},
};

App.Entity.Facilities.Penthouse = class extends App.Entity.Facilities.Facility {
	constructor() {
		super(App.Data.Facilities.penthouse, {
			classes: new App.Entity.Facilities.PenthouseJobs.Classes(),
			houseServant: new App.Entity.Facilities.PenthouseJobs.HouseServant(),
			subordinateSlave: new App.Entity.Facilities.PenthouseJobs.SubordinateSlave(),
			cow: new App.Entity.Facilities.PenthouseJobs.Cow(),
		});
	}

	/** Facility slave capacity
	 * @override
	 * @returns {number} */
	get capacity() {
		return V.dormitory;
	}

	/** Number of already hosted slaves
	 * @returns {number} */
	get hostedSlaves() {
		return V.dormitoryPopulation;
	}

	/** Penthouse can be overcrowded, so it always has free space
	 * @returns {boolean} */
	get hasFreeSpace() {
		return true;
	}
};

App.Entity.facilities.penthouse = new App.Entity.Facilities.Penthouse();

repo_name: KnightBoulegard/fc

license: mit


code:
App.Data.Facilities.pit = {
	baseName: "pit",
	genericName: null,
	jobs: {
		fighter: {
			position: "fighter",
			assignment: Job.PIT, /* pseudo-assignment for assignmentTransition/assignJob/removeJob */
			publicSexUse: false,
			fuckdollAccepted: false,
			partTime: true
		}
	},
	defaultJob: "fighter",
	manager: null
};

App.Entity.Facilities.PitFighterJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);
		if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset") {
			r.push(`${slave.slaveName} may not participate in combat.`);
		}
		if (slave.indentureRestrictions > 1) {
			r.push(`${slave.slaveName}'s indenture forbids fighting.`);
		}
		if ((slave.indentureRestrictions > 0) && (this.facility.option("Lethal") === 1)) {
			r.push(`${slave.slaveName}'s indenture forbids lethal fights.`);
		}
		return r;
	}
};

App.Entity.Facilities.Pit = class extends App.Entity.Facilities.SingleJobFacility {
	constructor() {
		super(App.Data.Facilities.pit,
			{
				fighter: new App.Entity.Facilities.PitFighterJob()
			});
	}

	get capacity() {
		return super.capacity > 0 ? Number.MAX_VALUE : 0;
	}

	/** @override */
	occupancyReport(long) {
		return `${this.hostedSlaves}${long ? ` ${this.job().desc.position}s` : ""}`;
	}
};

App.Entity.facilities.pit = new App.Entity.Facilities.Pit();


code:
App.Data.Facilities.schoolroom = {
	baseName: "schoolroom",
	genericName: null,
	jobs: {
		student: {
			position: "student",
			assignment: Job.SCHOOL,
			publicSexUse: false,
			fuckdollAccepted: false,
			description: {
				rulesAssistant: {
					assigned:()=> `study in ${V.schoolroomName}`
				}
			}
		}
	},
	defaultJob: "student",
	manager: {
		position: "schoolteacher",
		assignment: Job.TEACHER,
		careers: App.Data.misc.schoolteacherCareers,
		skill: "teacher",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: false,
		shouldHold: false,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: true,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.SchoolroomStudentJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, -20, -51)) {
			r.push(`${slave.slaveName} is too resistant to learn.`);
		}

		const maxSkill = 10 + this.facility.upgrade("Skills") * 20; // maximal skill value the school can teach
		if (((slave.intelligenceImplant >= 30 && V.schoolroomRemodelBimbo !== 1) || (slave.intelligenceImplant <= -15 && V.schoolroomRemodelBimbo === 1)) &&
			(slave.voice === 0 || slave.accent + this.facility.upgrade("Language") <= 2) &&
			(slave.skill.oral > maxSkill) && (slave.skill.whoring > maxSkill) && (slave.skill.entertainment > maxSkill) &&
			(slave.skill.anal > maxSkill) && ((slave.vagina < 0) || (slave.skill.vaginal > maxSkill))) {
			r.push(`${slave.slaveName} has nothing left to learn.`);
		}

		if (slave.fetish === "mindbroken") {
			r.push(`${slave.slaveName}'s mind is fundamentally broken and can't learn`);
		}

		return r;
	}
};

App.Entity.facilities.schoolroom = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.schoolroom,
	{
		student: new App.Entity.Facilities.SchoolroomStudentJob()
	}
);


code:
App.Data.Facilities.servantsQuarters = {
	baseName: "servantsQuarters",
	genericName: "Servants' Quarters",
	jobs: {
		servant: {
			position: "servant",
			assignment: Job.QUARTER,
			publicSexUse: false,
			fuckdollAccepted: false,
			description: {
				rulesAssistant: {
					assigned:()=> `work in ${V.servantsQuartersName}`
				}
			}
		}
	},
	defaultJob: "servant",
	manager: {
		position: "stewardess",
		assignment: Job.STEWARD,
		careers: App.Data.misc.stewardessCareers,
		skill: "stewardess",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: true,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.ServantsQuartersServantJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, 20, -21)) {
			r.push(App.Entity.Facilities.Job._stdBreakageMessage(slave));
		}
		if (!canWalk(slave)) {
			r.push(`${slave.slaveName} can't walk and would be unable to properly clean.`);
		}
		if (!canSee(slave)) {
			r.push(`${slave.slaveName} is blind and would be unable to properly clean.`);
		}
		return r;
	}
};

App.Entity.Facilities.ServantsQuartersStewardessJob = class extends App.Entity.Facilities.ManagingJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);
		if (slave.intelligence + slave.intelligenceImplant < -50) {
			r.push(`${slave.slaveName} is not intelligent enough.`);
		}
		return r;
	}
};

App.Entity.facilities.servantsQuarters = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.servantsQuarters,
	{
		servant: new App.Entity.Facilities.ServantsQuartersServantJob()
	},
	new App.Entity.Facilities.ServantsQuartersStewardessJob()
);


code:
App.Data.Facilities.spa = {
	baseName: "spa",
	genericName: null,
	jobs: {
		assignee: {
			position: "bather",
			assignment: Job.SPA,
			publicSexUse: false,
			fuckdollAccepted: false,
			description: {
				rulesAssistant: {
					assigned:()=> `rest in ${V.spaName}`
				}
			}
		}
	},
	defaultJob: "assignee",
	manager: {
		position: "attendant",
		assignment: Job.ATTENDANT,
		careers: App.Data.misc.attendantCareers,
		skill: "attendant",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: false,
		shouldHear: true,
		shouldTalk: false,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.SpaAssigneeJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if (
			slave.fetish !== "mindbroken" &&
			(
				slave.devotion < -20 ||
				(
					slave.health.tired < 20 &&
					slave.trust > 60 &&
					slave.devotion > 60 &&
					slave.sexualFlaw === "none" &&
					slave.behavioralFlaw === "none"
				)
			)
		) {
			r.push(`${slave.slaveName} will not benefit from time at ${this.facility.name}.`);
		}

		return r;
	}
};

App.Entity.facilities.spa = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.spa,
	{
		assignee: new App.Entity.Facilities.SpaAssigneeJob()
	}
);


code:
:: FacilityMiscWidgets [nobr widget]

/* Call as removeFacilityWorkers <facilityName> <managerAssignment> <workerAssignment> */
<<widget "removeFacilityWorkers">>
	<<set _facility = App.Entity.facilities[$args[0]]>>
	<<set _count = _facility.totalEmployeesCount>>
	<<set _NewPop = _count+$dormitoryPopulation>>
	<<if _count > 0>>
		<<set _passage = passage()>>
		<<link "Remove all slaves" _passage>>
			<<run App.Utils.moveFacilityWorkers(_facility, $args[1], $args[2])>>
		<</link>>
		<<if _NewPop > $dormitory>>
			@@.red;Dormitory capacity will be exceeded.@@
		<</if>>
	<</if>>
<</widget>>


code:
.encyclopedia.topic {
	font-weight: bold;
}


code:
App.Encyclopedia.Dialog = (function() {
	/** Create a link to an encyclopedia dialog for a given article with the given text
	 * @param {string} text Text for link
	 * @param {string} article Encyclopdia article to link to
	 * @returns {string} SugarCube link markup
	 */
	function makeLinkSC(text, article) {
		return App.UI.link(text, () => showArticleInDialog(article));
	}

	/** Create a link to an encyclopedia dialog for a given article with the given text
	 * @param {string} text Text for link
	 * @param {string} article Encyclopdia article to link to
	 * @returns {HTMLElement} DOM link element
	 */
	function makeLinkDOM(text, article) {
		return App.UI.DOM.link(text, () => showArticleInDialog(article));
	}

	/** Show a given encyclopedia article in the encyclopedia dialog
	 * @param {string} article
	 */
	function showArticleInDialog(article) {
		let origEncyclopedia = V.encyclopedia;
		if (Dialog.isOpen()) {
			Dialog.close();
		}
		Dialog.setup("Encyclopedia", "encyclopedia");
		V.encyclopedia = article;
		$(Dialog.body()).empty().wiki(jsInclude("Encyclopedia"));
		Dialog.open();
		V.encyclopedia = origEncyclopedia;
	}

	return {
		linkSC: makeLinkSC,
		linkDOM: makeLinkDOM
	};
})();


code:
/* TODO: add entries for Nursery */

App.Encyclopedia.Entries = (function() {
	/**
	 * @param {string} topic
	 * @returns {HTMLElement}
	 */
	function topic(topic) {
		return App.UI.DOM.makeElement("span", topic, ["encyclopedia", "topic"]);
	}

	/**
	 * @param {string} linkText
	 * @param {string} topic
	 * @returns {HTMLElement}
	 */
	function encyLink(linkText, topic) {
		return App.Encyclopedia.Dialog.linkDOM(linkText, topic);
	}

	const entries = {};

	entries.attendingClasses = () =>
		App.UI.DOM.combineNodes(topic("Attending classes"),
			" is an assignment which educates the slave, raising intelligence if possible. Being educated raises value and is useful for some jobs and leadership positions.");

	entries.confinement = () =>
		App.UI.DOM.combineNodes(topic("Confinement"),
			" is an assignment which accelerates breaking for disobedient slaves. If a slave isn't obedient enough to work and isn't ",
			encyLink("unhealthy", "Health"), " enough to need rest, this will make them useful sooner.");

	entries.fucktoy = () =>
		App.UI.DOM.combineNodes(topic("Fucktoy service"),
			" is an assignment which keeps the slave close and under the player's eye. It's mostly just for fun, but fucktoys can improve reputation based on their beauty, and the player character's attention can be targeted to areas of the slave's body with possible fetish effects on happy slaves.");

	entries.gloryHole = () =>
		App.UI.DOM.combineNodes(topic("Occupying a glory hole"),
			" is an assignment which makes money off of slaves regardless of their beauty, skills, or feelings; it's not fun or ",
			encyLink("healthy", "Health"), " but very powerful for extracting ¤ out of otherwise useless slaves.");

	entries.milking = () => {
		const fragment = document.createDocumentFragment();

		fragment.append(topic("Getting milked"),
			" is an assignment which makes money from lactation based on a slave's breasts, ", encyLink("health", "Health"),
			" and hormonal status.");
		if (V.seeDicks > 0) {
			fragment.append(" Cows with balls will also give semen.");
		}
		fragment.append(` Creates profit quickly from slaves with big tits${V.seeDicks ? " or balls" : ""}.`);

		return fragment;
	};

	entries.farming = function() {
		const fragment = document.createDocumentFragment();
		fragment.append(topic("Farming"), " is an assignment which produces ", encyLink("food", "Food"),
			" from your slaves' hard work");
		if (V.seeBestiality) {
			fragment.append(" and allows you to breed slaves with animals");
		}
		fragment.append(". Can also reduce arcology upkeep with upgrades in the ",
			encyLink("Farmyard", "Farmyard"));
		return fragment;
	};

	entries.publicService = () =>
		App.UI.DOM.combineNodes(topic("Public Service"),
			" is an assignment which increases reputation based on a slave's beauty, sexual appeal, and skills. Very similar to whoring, but for reputation rather than money.");

	entries.rest = () =>
		App.UI.DOM.combineNodes(topic("Rest"), " is an assignment mostly used to improve ", encyLink("health", "Health"),
			". It can be useful to order slaves you wish to intensively modify to rest, since most modifications damage health. It will synergize with curative treatments, providing bonus healing when both are simultaneously applied.");

	entries.sexualServitude = () =>
		App.UI.DOM.combineNodes(topic("Sexual servitude"),
			" is an assignment which pleases other slaves by forcing the slave to service them sexually. Useful for driving the targeted slave's ",
			encyLink("devotion", "Devotion"), " up quickly.");

	entries.servitude = () =>
		App.UI.DOM.combineNodes(topic("Servitude"), " is an assignment which reduces your upkeep based on the slave's ",
			encyLink("devotion", "Devotion"),
			" Available at lower obedience than other jobs, is insensitive to the quality of a slave's body, and doesn't require skills; a good transitional assignment. Unusually, low sex drive is advantageous as a servant, since it reduces distraction. Lactating slaves are slightly better at this job, since they can contribute to their fellow slaves' nutrition.");

	entries.whoring = () =>
		App.UI.DOM.combineNodes(topic("Whoring"), " is an assignment which makes money based on a slave's beauty, sexual appeal, and skills. Good whores take a long time to train and beautify but become very profitable.");

	return entries;
})();


code:
:: Related Links [nobr]

/* pages asking the player to click a link for more information have no section heading */
<<if !["Being in Charge", "Body", "Fetishes", "Game Mods", "Inflation", "Leadership Positions", "Lolimod", "Lore", "Obtaining Slaves", "Paraphilias", "Playing Free Cities", "Skills", "Slave Assignments", "Slave Modification", "Slaves", "Terrain Types", "The X-Series Arcology"].includes($encyclopedia)>>

Related Links

<</if>>

<<switch $encyclopedia>>

/**********
PLAYING FREE CITIES
**********/
<<case "Design Your Master" "First Game Guide" "How to Play" "Keyboard Shortcuts" "Playing Free Cities" "The Arcology Interface" "Tips and Tricks">>
	<<= App.Encyclopedia.Dialog.linkSC("First Game Guide", "First Game Guide")>>
	| <<= App.Encyclopedia.Dialog.linkSC("How to Play", "How to Play")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Keyboard Shortcuts", "Keyboard Shortcuts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Arcology Interface", "The Arcology Interface")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Tips and Tricks", "Tips and Tricks")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Design Your Master", "Design Your Master")>>

/**********
BEING IN CHARGE
**********/
<<case "Arcologies and Reputation" "Being in Charge" "Costs Summary" "PC Skills" "Random Events" "Rules Assistant" "Sexual Energy" "The Corporation">>
	<<= App.Encyclopedia.Dialog.linkSC("Arcologies and Reputation", "Arcologies and Reputation")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Random Events", "Random Events")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Costs Summary", "Costs Summary")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Rules Assistant", "Rules Assistant")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Corporation", "The Corporation")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Sexual Energy", "Sexual Energy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("PC Skills", "PC Skills")>>

/**********
SLAVES
**********/
<<case "Demand for Sex" "Devotion" "Drugs and Their Effects" "Enslaving People" "From Rebellious to Devoted" "Fuckdolls" "Gender" "Health" "Indentured Servants" "Lingua Franca" "Living Conditions" "Menial Slaves" "Nymphomania" "Slave Score (Attractiveness)" "Slave Score (Sexual)" "Slaves" "Trust">>
	<<= App.Encyclopedia.Dialog.linkSC("Enslaving People", "Enslaving People")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Living Conditions", "Living Conditions")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Health", "Health")>>
	| @@.hotpink;<<= App.Encyclopedia.Dialog.linkSC("Devotion", "From Rebellious to Devoted")>>@@
	| @@.mediumaquamarine;<<= App.Encyclopedia.Dialog.linkSC("Trust", "Trust")>>@@
	| <<= App.Encyclopedia.Dialog.linkSC("Drugs and Their Effects", "Drugs and Their Effects")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gender", "Gender")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Nymphomania", "Nymphomania")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Indentured Servants", "Indentured Servants")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Menial Slaves", "Menial Slaves")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fuckdolls", "Fuckdolls")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Lingua Franca", "Lingua Franca")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Score (Attractiveness)", "Slave Score (Attractiveness)")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Score (Sexual)", "Slave Score (Sexual)")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Demand for Sex", "Demand for Sex")>>

/**********
OBTAINING SLAVES
**********/
<<case "Direct Sales" "Household Liquidations" "Kidnapped Slaves" "Obtaining Slaves" "Pre-Owned Slaves" "Slave Schools" "Stables" "The Flesh Heap" "The Job Fulfillment Center">>
	<<= App.Encyclopedia.Dialog.linkSC("Kidnapped Slaves", "Kidnapped Slaves")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Schools", "Slave Schools")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Stables", "Stables")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Household Liquidations", "Household Liquidations")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Direct Sales", "Direct Sales")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pre-Owned Slaves", "Pre-Owned Slaves")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Random Events", "Random Events")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Flesh Heap", "The Flesh Heap")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Job Fulfillment Center", "The Job Fulfillment Center")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Wetware CPUs", "Wetware CPUs")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Corporation", "The Corporation")>>

/**********
SLAVE LEADERS:
**********/
<<case "Attendant" "Bodyguard" "Career Experience" "Concubine" "DJ" "Farmer" "Head Girl" "Leadership Positions" "Madam" "Matron" "Milkmaid" "Nurse" "Recruiter" "Schoolteacher" "Slave Assignments" "Stewardess" "Wardeness">>
	<<= App.Encyclopedia.Dialog.linkSC("Common Assignments", "Slave Assignments")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Career Experience", "Career Experience")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Attendant", "Attendant")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Bodyguard", "Bodyguard")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Concubine", "Concubine")>>
	| <<= App.Encyclopedia.Dialog.linkSC("DJ", "DJ")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Farmer", "Farmer")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Head Girl", "Head Girl")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Madam", "Madam")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Matron", "Matron")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Milkmaid", "Milkmaid")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Nurse", "Nurse")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Recruiter", "Recruiter")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Schoolteacher", "Schoolteacher")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Stewardess", "Stewardess")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Wardeness", "Wardeness")>>

/**********
SLAVE ASSIGNMENTS (COMMON):
**********/
<<case "Attending Classes" "Confinement" "Fucktoy" "Glory Hole" "Milking" "Farming" "Public Service" "Rest" "Sexual Servitude" "Servitude" "Whoring">>
	<<= App.Encyclopedia.Dialog.linkSC("Leadership Positions", "Leadership Positions")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Career Experience", "Career Experience")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Attending Classes", "Attending Classes")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Confinement", "Confinement")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Farming", "Farming")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fucktoy", "Fucktoy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Glory Hole", "Glory Hole")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Milking", "Milking")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Public Service", "Public Service")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Rest", "Rest")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Servitude, Sexual", "Sexual Servitude")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Servitude", "Servitude")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Whoring", "Whoring")>>

/**********
SLAVE BODY:
**********/
<<case "Anuses" "Areolae" "Body" "Breasts" "Butts" "Clits" "Dicks" "Ethnicity" "Faces" "Height" "Hips" "Lactation" "Lips" "Musculature" "Nipples" "Ovaries" "Skin Distinctions" "Teeth" "Testicles" "Vaginas" "Waist" "Weight" "Hormones (XX)" "Hormones (XY)">>
	<<= App.Encyclopedia.Dialog.linkSC("Anuses", "Anuses")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Areolae", "Areolae")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Breasts", "Breasts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Butts", "Butts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Clits", "Clits")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Dicks", "Dicks")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Ethnicity", "Ethnicity")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Faces", "Faces")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Height", "Height")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hips", "Hips")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Lactation", "Lactation")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Lips", "Lips")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Musculature", "Musculature")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Nipples", "Nipples")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Ovaries", "Ovaries")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pregnancy", "Pregnancy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Skin Distinctions", "Skin Distinctions")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Teeth", "Teeth")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Testicles", "Testicles")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Vaginas", "Vaginas")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Waist", "Waist")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Weight", "Weight")>>
	| <<= App.Encyclopedia.Dialog.linkSC("XX", "Hormones (XX)")>>
	| <<= App.Encyclopedia.Dialog.linkSC("XY", "Hormones (XY)")>>

/**********
SLAVE SKILLS
**********/
<<case "Anal Skill" "Combat Skill" "Entertainment Skill" "Oral Skill" "Skills" "Vaginal Skill" "Whoring Skill">>
	<<= App.Encyclopedia.Dialog.linkSC("Anal Skill", "Anal Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Combat Skill", "Combat Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Entertainment Skill", "Entertainment Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Oral Skill", "Oral Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Vaginal Skill", "Vaginal Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Whoring Skill", "Whoring Skill")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Career Experience", "Career Experience")>>

/**********
SLAVE FETISHES:
**********/
<<case "Boob Fetishists" "Buttsluts" "Cumsluts" "Doms" "Fetishes" "Humiliation Fetishists" "Masochists" "Pregnancy Fetishists" "Sadists" "Submissives">>
	<<= App.Encyclopedia.Dialog.linkSC("Boob Fetishists", "Boob Fetishists")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Buttsluts", "Buttsluts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cumsluts", "Cumsluts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Doms", "Doms")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Humiliation Fetishists", "Humiliation Fetishists")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Masochists", "Masochists")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pregnancy Fetishists", "Pregnancy Fetishists")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Sadists", "Sadists")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Submissives", "Submissives")>>

/**********
SLAVE PARAPHILIAS
**********/
<<case "Abusiveness" "Anal Addicts" "Attention Whores" "Breast Obsession" "Breeding Obsession" "Cum Addicts" "Maliciousness" "Paraphilias" "Self Hatred" "Self Neglect">>
	<<= App.Encyclopedia.Dialog.linkSC("Abusiveness", "Abusiveness")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Anal Addicts", "Anal Addicts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Attention Whores", "Attention Whores")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Breast Obsession", "Breast Obsession")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Breeding Obsession", "Breeding Obsession")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cum Addicts", "Cum Addicts")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Maliciousness", "Maliciousness")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Self Hatred", "Self Hatred")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Self Neglect", "Self Neglect")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fetishes", "Fetishes")>>

/**********
SLAVE QUIRKS
**********/
<<case "Adores Men" "Adores Women" "Advocate" "Confident" "Cutting" "Fitness" "Funny" "Insecure" "Sinful" "Caring" "Gagfuck Queen" "Painal Queen" "Perverted" "Quirks" "Romantic" "Size Queen" "Strugglefuck Queen" "Tease" "Unflinching">>
	//Behavioral <<= App.Encyclopedia.Dialog.linkSC("Quirks", "Quirks")>>://
	<<= App.Encyclopedia.Dialog.linkSC("Adores men", "Adores Men")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Adores women", "Adores Women")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Advocate", "Advocate")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Confident", "Confident")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cutting", "Cutting")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fitness", "Fitness")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Funny", "Funny")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Insecure", "Insecure")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Sinful", "Sinful")>>

	//Sexual <<= App.Encyclopedia.Dialog.linkSC("Quirks", "Quirks")>>://
	<<= App.Encyclopedia.Dialog.linkSC("Caring", "Caring")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gagfuck Queen", "Gagfuck Queen")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Painal Queen", "Painal Queen")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Perverted", "Perverted")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Romantic", "Romantic")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Size Queen", "Size Queen")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Strugglefuck Queen", "Strugglefuck Queen")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Tease", "Tease")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Unflinching", "Unflinching")>>

/**********
SLAVE FLAWS
**********/
<<case "Anorexic" "Arrogant" "Bitchy" "Devout" "Flaws" "Gluttonous" "Hates Men" "Hates Women" "Liberated" "Odd" "Apathetic" "Crude" "Hates Anal" "Hates Oral" "Hates Penetration" "Idealistic" "Judgemental" "Repressed" "Shamefast">>
	//Behavioral <<= App.Encyclopedia.Dialog.linkSC("Flaws", "Flaws")>>://
	<<= App.Encyclopedia.Dialog.linkSC("Anorexic", "Anorexic")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Arrogant", "Arrogant")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Bitchy", "Bitchy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Devout", "Devout")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gluttonous", "Gluttonous")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hates men", "Hates Men")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hates women", "Hates Women")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Liberated", "Liberated")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Odd", "Odd")>>

	//Sexual <<= App.Encyclopedia.Dialog.linkSC("Flaws", "Flaws")>>://
	<<= App.Encyclopedia.Dialog.linkSC("Apathetic", "Apathetic")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Crude", "Crude")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hates anal", "Hates Anal")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hates oral", "Hates Oral")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hates penetration", "Hates Penetration")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Idealistic", "Idealistic")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Judgemental", "Judgemental")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Repressed", "Repressed")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Shamefast", "Shamefast")>>

/**********
SLAVE RELATIONSHIPS
**********/
<<case "Emotional Slut" "Emotionally Bonded" "Relationships" "Rivalries" "Romances" "Slave Marriages" "Slaveowner Marriages">>
	<<= App.Encyclopedia.Dialog.linkSC("Relationships", "Relationships")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Rivalries", "Rivalries")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Romances", "Romances")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Emotionally Bonded", "Emotionally Bonded")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Emotional Slut", "Emotional Slut")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Marriages", "Slave Marriages")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slaveowner Marriages", "Slaveowner Marriages")>>

/**********
PREGNANCY
**********/
<<case "Artificial Insemination" "Breeders Dietary Blend" "Childbirth and C-Secs" "Cloning" "Fertility Mix" "Gestation Drugs and Labor Suppressants" "Hyper-Pregnancy" "Ova Transplantation" "Player Pregnancy" "Pregnancy" "Pregnancy Generator" "Slave Fertility" "Super Fertility Drugs" "Surrogacy">>
	<<= App.Encyclopedia.Dialog.linkSC("Pregnancy", "Pregnancy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Fertility", "Slave Fertility")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Player Pregnancy", "Player Pregnancy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hyper-Pregnancy", "Hyper-Pregnancy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Super Fertility Drugs", "Super Fertility Drugs")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fertility Mix", "Fertility Mix")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Breeders Dietary Blend", "Breeders Dietary Blend")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pregnancy Generator", "Pregnancy Generator")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Childbirth and C-Secs", "Childbirth and C-Secs")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gestation Drugs and Labor Suppressants", "Gestation Drugs and Labor Suppressants")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Artificial Insemination", "Artificial Insemination")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Surrogacy", "Surrogacy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cloning", "Cloning")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Ova Transplantation", "Ova Transplantation")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Eugenics Breeding Proposal", "Eugenics Breeding Proposal")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Repopulationist Breeding School", "Repopulationist Breeding School")>>

/**********
INFLATION
**********/
<<case "Belly Implants" "Cervix Micropump Filter" "Enemas and Force-Feeding" "Inflation" "Organic Mesh Breast Implant">>
	<<= App.Encyclopedia.Dialog.linkSC("Inflation", "Inflation")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Enemas and Force-Feeding", "Enemas and Force-Feeding")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Belly Implants", "Belly Implants")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cervix Micropump Filter", "Cervix Micropump Filter")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Organic Mesh Breast Implant", "Organic Mesh Breast Implant")>>

/**********
SLAVE MODIFICATION
**********/
<<case "Slave Modification">>
	<<= App.Encyclopedia.Dialog.linkSC("Slave Modification", "Slave Modification")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Corrective Diet", "Corrective Diet")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Nipple Conversion — Penetratable", "Nipple Conversion — Penetratable")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Ejaculation Boosting Prostate Implant", "Ejaculation Boosting Prostate Implant")>>

/**********
THE X-SERIES ARCOLOGY
**********/
<<case "Personal Assistant" "Security Drones" "Slave Nutrition" "The Auto Salon" "The Pharmaceutical Fab." "The Remote Surgery" "The Studio" "The Wardrobe" "The X-Series Arcology" "Water Filtration" "What the Upgrades Do">>
	<<= App.Encyclopedia.Dialog.linkSC("What the Upgrades Do", "What the Upgrades Do")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Personal Assistant", "Personal Assistant")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Wardrobe", "The Wardrobe")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Auto Salon", "The Auto Salon")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Body Mod Studio", "The Studio")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Remote Surgery", "The Remote Surgery")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Pharmaceutical Fab.", "The Pharmaceutical Fab.")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Security Drones", "Security Drones")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Water Filtration", "Water Filtration")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Nutrition", "Slave Nutrition")>>

/**********
ARCOLOGY FACILITIES
**********/
<<case "Advertising" "Arcade" "Brothel" "Cellblock" "Clinic" "Club" "Dairy" "Facilities" "Farmyard" "Head Girl Suite" "Master Suite" "Nursery" "Pit" "Schoolroom" "Servants' Quarters" "Spa" "The Incubation Facility" "Variety">>
	//Arcology <<= App.Encyclopedia.Dialog.linkSC("Facilities", "Facilities")>>://
	<<= App.Encyclopedia.Dialog.linkSC("Arcade", "Arcade")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Brothel", "Brothel")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cellblock", "Cellblock")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Clinic", "Clinic")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Club", "Club")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Dairy", "Dairy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Head Girl Suite", "Head Girl Suite")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Master Suite", "Master Suite")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pit", "Pit")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Schoolroom", "Schoolroom")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Servants' Quarters", "Servants' Quarters")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Spa", "Spa")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Nursery", "Nursery")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Farmyard", "Farmyard")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Incubation Facility ", "The Incubation Facility")>>

	//Facility Bonuses://
	<<= App.Encyclopedia.Dialog.linkSC("Advertising", "Advertising")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Variety", "Variety")>>

/**********
TERRAIN TYPES
**********/
<<case "Terrain Types" "Urban Terrain" "Rural Terrain" "Marine Terrain" "Oceanic Terrain">>
	<<= App.Encyclopedia.Dialog.linkSC("Urban", "Urban Terrain")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Rural", "Rural Terrain")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Marine", "Marine Terrain")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Oceanic", "Oceanic Terrain")>>

/**********
FUTURE SOCIETIES
**********/
<<case "Arabian Revivalism" "Asset Expansionism" "Aztec Revivalism" "Body Purism" "Chattel Religionism" "Chinese Revivalism" "Degradationism" "Edo Revivalism" "Egyptian Revivalism" "Ethnic Subjugationism" "Ethnic Supremacy" "Eugenics Focus" "Future Societies" "Gender Fundamentalism" "Gender Radicalism" "Hedonistic Decadence" "Intellectual Dependency" "Maturity Preferentialism" "Multiculturalism" "Pastoralism" "Paternalism" "Petite Admiration" "Physical Idealism" "Repopulationism" "Roman Revivalism" "Slave Professionalism" "Slimness Enthusiasm" "Statuesque Glorification" "Transformation Fetishism" "Youth Preferentialism">>
	//Vanilla Future Societies://
	<<= App.Encyclopedia.Dialog.linkSC("Ethnic Supremacy", "Ethnic Supremacy")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Ethnic Subjugationism", "Ethnic Subjugationism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gender Radicalism", "Gender Radicalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gender Fundamentalism", "Gender Fundamentalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Paternalism", "Paternalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Degradationism", "Degradationism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Body Purism", "Body Purism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Transformation Fetishism", "Transformation Fetishism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Maturity Preferentialism", "Maturity Preferentialism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Youth Preferentialism", "Youth Preferentialism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slimness Enthusiasm", "Slimness Enthusiasm")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Asset Expansionism", "Asset Expansionism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Pastoralism", "Pastoralism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Physical Idealism", "Physical Idealism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Chattel Religionism", "Chattel Religionism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Multiculturalism", "Multiculturalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Roman Revivalism", "Roman Revivalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Egyptian Revivalism", "Egyptian Revivalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Edo Revivalism", "Edo Revivalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Arabian Revivalism", "Arabian Revivalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Chinese Revivalism", "Chinese Revivalism")>>

	//Modded Future Societies://
	<<= App.Encyclopedia.Dialog.linkSC("Repopulationism", "Repopulationism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Eugenics Focus", "Eugenics Focus")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Professionalism", "Slave Professionalism")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Intellectual Dependency", "Intellectual Dependency")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Petite Admiration", "Petite Admiration")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Statuesque Glorification", "Statuesque Glorification")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hedonistic Decadence", "Hedonistic Decadence")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Aztec Revivalism", "Aztec Revivalism")>>

/**********
LORE: THE FREE CITIES TODAY
**********/
<<case "Lore" "Money" "Food" "Disease in the Free Cities" "Free Cities Justice" "Modern Anal" "Slave Couture" "Slave Marriage" "The Ejaculate Market" "Gingering" "Dyes"
/**********
LORE: FREE CITIES CULTURE TOMORROW
**********/
"The New Rome" "Naked, Barefoot, and Pregnant" "The Top" "The Bottom" "The Purity of the Human Form" "A World Built on Implants" "Slaves as Stock" "Slavery and the Physical Ideal" "Faith in the Free Cities"
/**********
LORE: INTERVIEWS
**********/
"Slave Whore, Arcology K-2" "Slave Acolyte, Arcology V-7" "Public Slave, Arcology A-3" "Mercenary, Arcology B-2" "Slave Trainer, Arcology D-10">>
	//The Free Cities today://
	@@.yellowgreen; <<= App.Encyclopedia.Dialog.linkSC("Money", "Money")>>@@
	| <<= App.Encyclopedia.Dialog.linkSC("Disease in the Free Cities", "Disease in the Free Cities")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Free Cities Justice", "Free Cities Justice")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Modern Anal", "Modern Anal")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Couture", "Slave Couture")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Marriage", "Slave Marriage")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Ejaculate Market", "The Ejaculate Market")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gingering", "Gingering")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Dyes", "Dyes")>>

//Free Cities culture tomorrow://
	<<= App.Encyclopedia.Dialog.linkSC("The New Rome", "The New Rome")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Naked, Barefoot, and Pregnant", "Naked, Barefoot, and Pregnant")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Top", "The Top")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Bottom", "The Bottom")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Purity of the Human Form", "The Purity of the Human Form")>>
	| <<= App.Encyclopedia.Dialog.linkSC("A World Built on Implants", "A World Built on Implants")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slaves as Stock", "Slaves as Stock")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slavery and the Physical Ideal", "Slavery and the Physical Ideal")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Faith in the Free Cities", "Faith in the Free Cities")>>

//Interviews://
	<<= App.Encyclopedia.Dialog.linkSC("Slave Whore, Arcology K-2", "Slave Whore, Arcology K-2")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Acolyte, Arcology V-7", "Slave Acolyte, Arcology V-7")>>
	<<if $seeExtreme != 0>>
		| <<= App.Encyclopedia.Dialog.linkSC("Public Slave, Arcology A-3", "Public Slave, Arcology A-3")>>
	<</if>>
	| <<= App.Encyclopedia.Dialog.linkSC("Mercenary, Arcology B-2", "Mercenary, Arcology B-2")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Trainer, Arcology D-10", "Slave Trainer, Arcology D-10")>>

/**********
BLACK MARKET
**********/
<<case "The Black Market" "Contraband and Illegal Goods" "Gender Radicalism Research" "Slave Professionalism Research" "Transformation Fetishism Research" "Asset Expansionist Research" "Slimness Enthusiast Research" "Hedonistic Decadence Research" "Eugenics Breeding Proposal" "Youth Preferentialism Research" "Repopulationist Breeding School">>
	<<= App.Encyclopedia.Dialog.linkSC("The Black Market", "The Black Market")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Contraband and Illegal Goods", "Contraband and Illegal Goods")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Gender Radicalism Research", "Gender Radicalism Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slave Professionalism Research", "Slave Professionalism Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Transformation Fetishism Research", "Transformation Fetishism Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Asset Expansionist Research", "Asset Expansionist Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Slimness Enthusiast Research", "Slimness Enthusiast Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Youth Preferentialism Research", "Youth Preferentialism Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Hedonistic Decadence Research", "Hedonistic Decadence Research")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Childhood Fertility Induced NCS", "Childhood Fertility Induced NCS")>>

/**********
MODS
**********/
<<case "Game Mods">>
	<<= App.Encyclopedia.Dialog.linkSC("Lolimod", "Lolimod")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Special Force Mod", "Special Force")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Security Expansion Mod", "Security Expansion")>>
	| <<= App.Encyclopedia.Dialog.linkSC("FCTV", "FCTV")>>

<<case "Lolimod" "Lolis and the Free Cities" "Fertility Age" "Male Fertility" "Cradle Robbers" "Precocious Puberty" "Childhood Fertility Induced NCS">>
	<<= App.Encyclopedia.Dialog.linkSC("Lolis and the Free Cities", "Lolis and the Free Cities")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Fertility Age", "Fertility Age")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Male Fertility", "Male Fertility")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Precocious Puberty", "Precocious Puberty")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Cradle Robbers", "Cradle Robbers")>>
	| <<= App.Encyclopedia.Dialog.linkSC("The Incubation Facility", "The Incubation Facility")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Childhood Fertility Induced NCS", "Childhood Fertility Induced NCS")>>

<<case "Security Expansion" "Battles">>
	<<= App.Encyclopedia.Dialog.linkSC("The Security Expansion Mod", "Security Expansion")>>
	| <<= App.Encyclopedia.Dialog.linkSC("Battles", "Battles")>>

<<case "FCTV" "FCTVReceiver">>
	<<= App.Encyclopedia.Dialog.linkSC("FCTV", "FCTV")>>
	| <<= App.Encyclopedia.Dialog.linkSC("FCTVReceiver", "FCTVReceiver")>>

<</switch>>


code:
:: PassageDone

<<if window.savedColorMap>>
	<<addclass "body" "lightTheme">>
<</if>>


code:
/* Accordion 000-250-006 */

button.accordion {
	cursor: pointer;
	padding: 5px;
	width: 100%;
	margin-bottom: 10px;
	border-bottom: 3px double;
	border-right: 3px double;
	border-left: none;
	border-top: none;
	text-align: left;
	outline: none;
	transition: 0.2s;
	background-color: transparent;
}

button.accordion.active, button.accordion:hover {
	background-color: transparent;
}

button.accordion:before {
	content: '\002B';
	color: #777;
	font-weight: bold;
	float: left;
	margin-right: 5px;
}

.unStaffed {
	background-color: transparent;
	padding: .5em .2em;
	margin-bottom: 1em;
	border-bottom: thin inset grey;
}

.unStaffed:before {
	content: '\00D7';
	color: #777;
	font-weight: bold;
	color: red;
	float: left;
	margin-right: 5px;
}

.unStaffed:after {
	content: attr(data-after);
	float: right;
	margin-left: 2em;
	font-weight: strong;
	color: green;
}

button.accordion:after {
	content: attr(data-after);
	float: right;
	margin-left: 2em;
	font-weight: normal;
	color: green;
}

button.accordion.active:before {
	content: "\2212";
}

.accHidden {
	padding: 0 18px;
	margin-top: 5px;
	margin-bottom: 5px;
	max-height: 0;
	overflow: hidden;
}

div.accordion:before {
	content: '\002B';
	color: #777;
	font-weight: bold;
	float: left;
	margin-right: 5px;
}
div.accordion.active:before {
	content: "\2212";
}


code:
#graph .linage {
	fill: none;
	stroke: white;
}
#graph .marriage {
	fill: none;
	stroke: white;
}
#graph .node {
	background-color: lightblue;
	border-style: solid;
	border-width: 1px;
}
#graph .nodeText{
	font: 10px sans-serif;
	margin: 0;
	padding: 0;
	color: black;
}
#graph {
	font: 10px sans-serif;
	margin: -20px 0;
	padding: 0;
	color: black;
}

#graph div {
	border-style: solid;
	border-width: 1px;
}

#graph .XY {
	background-color: lightblue;
}

#graph div.XX {
	background-color: pink;
}

#graph div.unknown {
	background-color: gray;
}

#graph div.unknownXY {
	background-color: #808080;
}

#graph div.unknownXX {
	background-color: #808080;
}

#graph .you {
	background-color: red;
}

#graph .emphasis {
	font-style: italic;
	font-weight: bold;
	margin: 0;
	background: #ffffff88;
	border: 2px solid Gold;
	white-space: nowrap;
}

#editFamily {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

#editFamily #familyTable {
}


code:
body {
	overflow-x: hidden;
}

/* makes HR colorflip compatible */
hr {
	background:#ccc;
	border:0;
}

/* clears SugarCube's default transition */
.passage {
	transition: none;
	-webkit-transition: none;
}

.passage-in {
	opacity: 1 !important;
}

/* default is 54em */
#passages {
	max-width: 100%;
}

/* small trick to hide broken images */
img {
	text-indent: -10000px;
}

.imageColumn { /* TODO: this is mostly a copy of imageRef to get its flex features working properly. They can probably be removed from imageRef at some point */
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-items: flex-start;
	position: relative;
	float: right;
}

.imageRef {
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-items: flex-start;
	position: relative;
	background-color: rgba(80, 80, 80, 0.5);
	margin: 2px;
}

.tinyImg {
	height: 120px;
	width: 120px;
	float: left;
}

.smlImg {
	height: 150px;
	width: 150px;
	float: left;
}

.smlImg > img, .smlImg > video {
	height: auto;
}

.medImg {
	height: 300px;
	width: 300px;
	float: right;
}

.medImg > img, .medImg > video {
	height: auto;
}

.lrgRender {
	height: 531px;
	width: 531px;
	margin-right: -50px;
	margin-left: -50px;
	float: right;
	z-index: -1;
}

.lrgVector {
	height: 600px;
	width: 600px;
	margin-right: -125px;
	margin-left: -125px;
	float: right;
	z-index: -1;
}

.lrgRender > div.mask {
	width: 150px;
	height: 100%;
	background: linear-gradient(90deg, rgba(17,17,17,1), rgba(17,17,17,0.8) 60%, rgba(17,17,17,0));
	z-index: 1;
	/*position: absolute;*/
}

.lrgRender > img, .lrgRender > video {
	margin-left: -150px;
	height: 531px;
	width: auto;
}

.lrgVector > div.mask {
	width: 150px;
	height: 100%;
	background: linear-gradient(90deg, rgba(17,17,17,1), rgba(17,17,17,0.8) 60%, rgba(17,17,17,0));
	z-index: 1;
}

.lrgVector > img, .lrgVector > video {
	margin-left: -150px;
	height: 600px;
	width: auto;
}

.lrgVector svg {
	width: 336px;
}

object {
	object-fit: scale-down;
	position: absolute;
	top: 0;
	left: 0;
}

img.paperdoll {
	position: absolute;
	top: 0;
	left: 0;
	margin-left: 0;
}

span.plusButton {
	display: inline-block;
	line-height: 25px;
	width: 20px;
	text-align: center;
	border: 1px solid rgba(0, 139, 0, 0.3);
	background: rgba(0, 139, 0, 0.2);
	margin: 2px 0;
}

span.minusButton {
	display: inline-block;
	line-height: 25px;
	width: 20px;
	text-align: center;
	border: 1px solid rgba(184, 0, 0, 0.3);
	background: rgba(184, 0, 0, 0.2);
	margin: 2px 0;
}

span.zeroButton {
	display: inline-block;
	line-height: 25px;
	width: 20px;
	text-align: center;
	border: 1px solid rgba(0, 0, 255, 0.3);
	background: rgba(0, 0, 255, 0.2);
	margin: 2px 0;
}

span.plusButton:hover { background: rgba(0, 139, 0, 0.4); }
span.minusButton:hover { background: rgba(184, 0, 0, 0.4); }
span.zeroButton:hover { background: rgba(0, 0, 255, 0.4); }

span.plusButton > a { display: block; }
span.minusButton > a { display: block; }
span.zeroButton > a { display: block; }

span.plusButton > a:hover { text-decoration: none; }
span.minusButton > a:hover { text-decoration: none; }
span.zeroButton > a:hover { text-decoration: none; }

/* Colors are made as css classes, to allow them to be changed for a light color scheme (for example). */
/* a version is for this case: text */
.link, .link a { color: var(--link-color) } /* link color */
.aquamarine, .aquamarine a, .skill, .skill a { color: aquamarine }
.coral, .coral a, .fetish.loss, .fetish.loss a { color: coral }
.cyan, .cyan a { color: cyan } /* used for aphrodisiac & neighbor arcs */
.darkgoldenrod, .darkgoldenrod a, .trust.extremely-terrified, .trust.extremely-terrified a { color: darkgoldenrod }
.darkred, .darkred a, .defiant.full, .defiant.full a { color: darkred }
.darkviolet, .darkviolet a, .devotion.hateful, .devotion.hateful a { color: darkviolet }
.deeppink, .deeppink a, .devotion.devoted, .devotion.devoted a { color: deeppink } /* used for devotion once & agent */
.steelblue, .steelblue a { color: steelblue }
.deepskyblue, .deepskyblue a, .intelligent, .intelligent a { color: deepskyblue }
.dodgerblue, .dodgerblue a { color: dodgerblue }
.blue, .blue a { color: blue }
.gold, .gold a, .trust.dec, .trust.dec a, .trust.frightened, .trust.frightened a { color: gold }
.goldenrod, .goldenrod a, .trust.terrified, .trust.terrified a { color: goldenrod }
.gray, .gray a { color: gray }
.green, .green a, .reputation.inc, .reputation.inc a, .improvement, .improvement a, .flaw.break, .flaw.break a, .skill.inc, .skill.inc a, .positive, .positive a { color: green }
.hotpink, .hotpink a, .devotion.inc, .devotion.inc a, .devotion.accept, .devotion.accept a { color: hotpink }
.lawngreen, .lawngreen a { color: lawngreen }
.lightblue, .lightblue a { color: lightblue }
.lightcoral, .lightcoral a, .fetish.gain, .fetish.gain a { color: lightcoral } /* compare pink for fetish */
.lightgreen, .lightgreen a, .relationship, .relationship a { color: lightgreen }
.lightpink, .lightpink a { color: lightpink }
.lightsalmon, .lightsalmon a, .fetish.inc, .fetish.inc a { color: lightsalmon }
.lime, .lime a, .change.positive, .change.positive a, .virginity.loss, .virginity.loss a, .pregnant, .pregnant a { color: lime } /* tight orifices, breast changes, take virginity, not sure on good aliases */
.limegreen, .limegreen a { color: limegreen } /* multiple questionable uses */
.magenta, .magenta a, .devotion.worship, .devotion.worship a { color: magenta }
.mediumaquamarine, .mediumaquamarine a, .trust.inc, .trust.inc a, .trust.careful, .trust.careful a { color: mediumaquamarine }
.mediumorchid, .mediumorchid a, .devotion.dec, .devotion.dec a, .devotion.resistant, .devotion.resistant a { color: mediumorchid }
.mediumseagreen, .mediumseagreen a, .trust.trusting, .trust.trusting a { color: mediumseagreen }
.orange, .orange a, .stupid, .stupid a, .change.negative, .change.negative a, .defiant.careful, .defiant.careful a, .intro.question { color: orange } /* generally between red and green, and a lot of other places */
.orangered, .orangered a, .defiant.inc, .defiant.inc a, .defiant.bold, .defiant.bold, .education.neg a { color: orangered }
.orchid, .orchid a { color: orchid } /* used once (wrong? */
.pink, .pink a, .slave.name.simple { color: pink } /* also fetish start ??? , and a lot of other stuff */
.red, .red a, .health.dec, .health.dec a, .cash.dec, .cash.dec a, .flaw.gain, .flaw.gain a, .error, .error a, .elites.loss, .elites.loss a, .reputation.dec, .reputation.dec a, .warning, .warning a { color: red } /* also generally bad stuff */
/* note: .error is for unexpected behaviour, .warning for player feedback */
.seagreen, .seagreen a, .trust.prof-trusting, .trust.prof-trusting a { color: seagreen }
.springgreen, .springgreen a, .skill.player, .skill.player a { color: springgreen }
.tan, .tan a { color: tan } /* some ethnicity */
.chocolate, .chocolate a { color: chocolate }
.saddlebrown, .saddlebrown a { color: saddlebrown }
.teal, .teal a { color: teal }
.yellow, .yellow a, .noteworthy, .noteworthy a, .devotion.ambivalent, .devotion.ambivalent a, .trust.fearful, .trust.fearful a { color: yellow }
.yellowgreen, .yellowgreen a, .cash.inc, .cash.inc a, .cash, .cash a { color: yellowgreen }

/*! <<checkvars>> macro for SugarCube 2.x */
#ui-dialog-body.checkvars{padding:1em}#ui-dialog-body.checkvars h1{font-size:1em;margin-top:0}#ui-dialog-body.checkvars table{border-collapse:collapse;border-spacing:0}#ui-dialog-body.checkvars thead tr{border-bottom:2px solid #444}#ui-dialog-body.checkvars tr:not(:first-child){border-top:1px solid #444}#ui-dialog-body.checkvars td,#ui-dialog-body.checkvars th{padding:.25em 1em}#ui-dialog-body.checkvars td:first-child,#ui-dialog-body.checkvars th:first-child{padding-left:.5em;border-right:1px solid #444}#ui-dialog-body.checkvars td:last-child,#ui-dialog-body.checkvars th:last-child{padding-right:.5em}#ui-dialog-body.checkvars th:first-child{text-align:center}#ui-dialog-body.checkvars td:first-child{font-weight:700;text-align:right}#ui-dialog-body.checkvars td{font-family:monospace,monospace;vertical-align:top;white-space:pre-wrap}#ui-dialog-body.checkvars .scroll-pad{margin:0;padding:0}

/*! <<bugreport>> macro for SugarCube 2.x */
#ui-dialog-body.bugreport #bugreport-info{margin-bottom:1em}#ui-dialog-body.bugreport #bugreport-data{display:block;overflow:auto;font-family:monospace,monospace;background-color:transparent;border:1px solid #444;margin:0;padding:6px;height:auto;min-height:200px;white-space:normal}#ui-dialog-body.bugreport .scroll-pad{margin:0;padding:0}

div.output{
width: 100%;
width: 100vw;
max-width: 100%;
word-break: break-all;
white-space: normal;
}
/* css rules for rules assistant */
.rajs-listitem {
	display: inline-block;
	color: var(--link-color);
	margin-right: 1em;
}
.rajs-listitem.selected {
	color: gray;
	text-decoration: none;
}
.rajs-listitem:last-of-type { margin-right: 0; }
.rajs-listitem:hover {
	cursor: pointer;
	text-decoration: underline;
}
.rajs-listitem.selected:hover {
	cursor: default;
	text-decoration: none;
}
.rajs-list strong:first-of-type, .rajs-list input {
	margin-right: 2em;
}
.rajs-listitem input {
	margin: 0.25em;
}
.rajs-section h1 {
	border-bottom: 1px solid white;
	cursor: pointer;
}
.rajs-section h1:hover { text-decoration: underline; }

.scroll {
	overflow: auto;
}

h1, h2, h3 {
	margin-bottom: 0;
	margin-top: 0.25em;
}
.founding {
	font-size: 0.8em;
	margin-top: -0.8em;
	margin-left: 0.5em;
	font-style: italic;
}
table.corporate {
	border: 3px darkgreen double;
	border-collapse: collapse;
	min-width: 33%;
}
table.corporate tbody tr:nth-child(even) {
	background-color: rgb(0, 30, 0);
}
table.corporate tbody tr:nth-child(odd) {
	background-color: rgb(15, 40, 15);
}
table.corporate td {
	vertical-align: top;
}
.minor-note {
	font-size: 0.75em;
	font-style: italic;
}
.majorText {
	margin-top: 0.5em;
	margin-bottom: 1.5em;
}
.tab {
	margin-left: 2em;
}
div.slave-report {
	margin-top: 1em;
	margin-bottom: 1em;
}
div.indent, p.indent {
	text-indent: 2em;
}
div.double-indent, p.double-indent {
	text-indent: 4em;
}
div.choices, p.choices {
	margin-left: 2em;
}
div.double-choices, p.double-choices {
	margin-left: 4em;
}

/* setting at the beginning of a scene / subscene */
.scene-intro {
	font-style: italic;
}

/* adds detail to an option: Do something. Sentence that explains the effect/conditions */
.detail {
	font-style: italic;
}

/* additional information not related to a specific option */
.note {
	font-style: italic;
}

.story-label {
	text-decoration: underline;
}

/* Note: Do not do a linebreak after span in HTML, because it will underline the automatic space it inserts: "Matilda_is a cow" */
.slave-name {
	color: pink;
	font-weight: bold;
	text-decoration: underline;
	text-decoration-color: white;
}

.name {
	font-weight: bold;
}

div.cheat-menu {
	font-style: italic;
	position: absolute;
	right: 50px;
}

h1 + p {
	margin-top: 0;
}
h2 + p {
	margin-top: 0;
}
h3 + p {
	margin-top: 0;
}

.main-fcnn {
	text-align: center;
	margin: 0 auto;
}

.major-link {
	font-weight: bold;
}

.clear-formatting {
	color: white;
	font-weight: normal;
	font-style: normal;
}

.hotkey {
	color: cyan;
}

.major-warning {
	font-weight: bold;
	color: red;
}

div.center {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

div.flex-container {
	display: flex;
}


code:
div.options-group {
	display: grid;
	grid-template-columns: max-content auto;
	align-items: center;
}

@media only screen and (min-width: 1600px) {
	div.options-group.double {
		grid-template-columns: max-content auto max-content auto;
    }
}

/* left side */
div.options-group div.description {
	margin-right: 10px;
}

/* right side */
div.options-group div.button-group {
	margin: 6px 0;
}

div.options-group span.comment {
	color: gray;
	font-style: italic;
	margin-left: 10px;
}

div.options-group button {
	color: var(--link-color);
	background-color: var(--button-color);
	border: none; /* outline instead of border */
	/* left & right outline overlap each other so we don't have a double border */
	outline: solid 2px var(--button-border-color);
	margin-left: 2px;
}

div.options-group button:hover {
	background-color: var(--button-hover-color);
}

div.options-group button.selected {
	background-color: var(--button-selected-color);
}

div.options-group button.disabled {
	color: white;
	pointer-events: none;
	cursor: default;
}

div.options-group button.selected.on {
	background-color: #103d10;
}

div.options-group button.on:hover {
	background-color: #1b651b;
}

div.options-group button.selected.off {
	background-color: #40100d;
}

div.options-group button.off:hover {
	background-color: #6a1b16;
}

div.options-group button.selected.neutral {
	background-color: #4d4d00;
}

div.options-group button.neutral:hover {
	background-color: #666600;
}

/* input box */
div.options-group input {
	border: 2px solid var(--button-border-color);
	min-width: unset; /* remove SC styling */
	width: 140px;
}

div.options-group input.number {
	width: 50px;
}


code:
.optionMacro {
	margin-top: 8px;
	display: flex;
}

.optionDescription {
	display: inline-block;
	width: 50%;
	margin-right: 10px;
	text-align: right;
}

.optionValue {
	display: inline-flex;
	flex-wrap: wrap;
	width: 50%;
}

@media only screen and (max-width: 1200px) {
	.optionDescription {
		display: block;
		width: unset;
		text-align: left;
	}

	.optionValue {
		width: unset;
	}

	.optionMacro {
		margin-top: 30px;
	}

}

.optionMacroOption {
	border: #555 solid 0.5px;
	border-top-width: 0;
	vertical-align: top;
	-moz-user-select: none;
	min-width: 79px; /* 80px - 1px for border */
	max-height: 30px;
	display: inline-block;
	text-align: center;
}

.optionComment {
	vertical-align: top;
	color: gray;
}

/* But don't add the | after the last one */
.optionMacroOption:last-child {
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
	border-right-width: 0;
}

.optionMacroOption:first-child {
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px;
}

.optionMacroOption a {
	padding: 0 10px;
	box-sizing: border-box;
	width: 100%;
	display: block;
}

.optionMacroOption:hover {
	background: #2F2F2F;
}

body.lightTheme .optionMacroOption:hover {
	background: #DDDDDD;
}

body.lightTheme .optionMacroSelected {
	background: #DDDDDD;
}

.optionMacroSelected {
	background: #2F2F2F;
	padding: 0 10px;
	min-width: 80px;
	cursor: pointer;
	box-sizing: border-box;
}

.optionValue input {
	padding: 3px 3px 3px 10px;
	background: transparent;
	border: #555 solid 0.5px;
	border-top-width: 0;
	min-width: unset;
	width: 140px;
	height: 22px;
}

.optionMacroNumber input {
	width: 50px;
}

.optionValue input:last-child {
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
	border-right-width: 0;
}

.optionValue input:first-child {
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px;
}

.optionMacroSelected.optionMacroEnable {
	color: rgb(230,255,230);
	background-image: linear-gradient(rgba(0, 255,0, 0.12), transparent);
}

.optionMacroSelected.optionMacroDisable {
	color: rgb(255,240,240);
	background-image: linear-gradient(rgba(255, 100, 0, 0.2), transparent);
}


code:
.hidden
{
	display:none;
}

div.quicklist.devotion button.mindbroken
{
	background-color:red;
}
div.quicklist.devotion button.very-hateful
{
	background-color:darkviolet;
}
div.quicklist.devotion button.hateful
{
	background-color:darkviolet;
}
div.quicklist.devotion button.resistant
{
	background-color:mediumorchid;
}
div.quicklist.devotion button.ambivalent
{
	background-color: yellow;
	color: #444444;
}
div.quicklist.devotion button.accepting
{
	background-color: hotpink;
}
div.quicklist.devotion button.devoted
{
	background-color: deeppink;
}
div.quicklist.devotion button.worshipful
{
	background-color: magenta;
}
div.quicklist.trust button.mindbroken
{
	background-color:red;
}
div.quicklist.trust button.extremely-terrified
{
	background-color: darkgoldenrod;
}
div.quicklist.trust button.terrified
{
	background-color: goldenrod;
}
div.quicklist.trust button.frightened
{
	background-color: gold;
	color: coral;
}
div.quicklist.trust button.fearful
{
	background-color: yellow;
	color: green;
}
div.quicklist.trust button.hate-careful
{
	background-color: orange;
}
div.quicklist.trust button.careful
{
	background-color: mediumaquamarine;
	color: forestgreen;
}
div.quicklist.trust button.bold
{
	background-color: orangered;
}
div.quicklist.trust button.trusting
{
	background-color: mediumseagreen;
}
div.quicklist.trust button.defiant
{
	background-color: darkred;
}
div.quicklist.trust button.profoundly-trusting
{
	background-color: seagreen;
}
div.quicklist
{
	table-layout: fixed;
	text-align: center;
	border-collapse: separate;
	border-spacing: 2px;
	border-style: hidden;
	empty-cells: hide;
	width: 70%;
}
div.quicklist button
{
	margin-top: 15px;
	margin-right: 20px;
	white-space: nowrap;
}