<commit_before>/**
	_moon.Drawers_ is a container kind designed to hold a set of
	[moon.Drawer](#moon.Drawer) objects and client content. The _drawers_ property
	accepts an array of _moon.Drawer_ controls. The associated [drawer
	handles](#moon.DrawerHandle) are positioned in their own small drawer,
	centered at the top of the "dresser"--the region containing the array of
	Drawer controls and the activator nub.

	When a handle is selected, it opens the corresponding Drawer object's main
	drawer or control drawer, depending on how the Drawer object is configured.

	The control's child components may be of any kind.

		{
			kind: "moon.Drawers",
			drawers: [
				{
					name: "musicDrawer",
					kind: "moon.Drawer",
					handle: {kind: "moon.DrawerHandle", content: "Handle"},
					components: [
						{content: "Drawer Content"}
					],
					controlDrawerComponents: [
						{content: "Controls"}
					]
				}
			],
			components: [
				{content: "Content Area"}
			]
		}
*/
enyo.kind({
	name: "moon.Drawers",
	kind: "enyo.Control",
	//* @protected
	classes: "moon-drawers enyo-fit",
	//* @public
	published: {
		//* Populate with an array of _moon.Drawer_ components
		drawers: null
	},
	//* @protected
	handlers: {
		//* Handlers to update the activator when the state of the contained drawers changes
		onActivate: "drawerActivated",
		onDeactivate: "drawerDeactivated",
		onSpotlightDown:"spotDown",
		onSpotlightUp:"spotUp"
	},
	components: [
		{name:"activatorWrapper", classes:"moon-drawers-activator-wrapper", spotlight:true, ontap:"activatorHandler", components: [
			{name:"activator", classes:"moon-drawers-activator", components:[
				{classes:"moon-drawers-activator-nub", components:[
					{name:"nubArrow", classes:"nub-arrow down"}
				]}
			]}
		]},
		{name:"handleContainer", classes:"moon-drawers-handle-container", kind:"enyo.Drawer", resizeContainer:false, open:false, spotlightDisabled: true, onpostresize:"resizeHandleContainer", components:[
			{name:"handles", classes:"moon-neutral moon-drawers-handles"}
		]},
		{name: "drawers", classes:"moon-drawers-drawer-container"},
		{name: "client", classes:"moon-drawers-client"}
	],
	eventsToCapture: {
		ontap: "captureTapSelect", 
		onSpotlightFocus: "captureSpotFocus", 
		onSpotlightSelect: "captureTapSelect"
	},
	create: function() {
		this.inherited(arguments);
		this.$.drawers.createComponents(this.drawers, {kind: "moon.Drawer", owner:this.owner});
		this.setupHandles();
	},
	rendered: function() {
		this.inherited(arguments);
		var dh = document.body.getBoundingClientRect().height;
		this.waterfall("onDrawersRendered", {drawersHeight: dh});
	},
	setupHandles: function() {
		var handles = []
			, controls, index;

		// cover the case where one is not defined
		for (index = 0; index < this.drawers.length; ++index) {
			handles.push(this.drawers[index].handle || {});
		}
		this.$.handles.createComponents(handles, {kind: "moon.DrawerHandle", owner:this});
		controls = this.$.handles.getControls();
		enyo.forEach(handles, function (handle, idx) {
			controls[idx].addClass('moon-drawers-handle');
			controls[idx].tap = this.bindSafely(this.handleTapped);
		}, this);
	},
	activatorHandler: function(){
		if (this.drawerOpen()) {
			this.closeDrawers();
		} else {
			if (this.$.handles.getControls().length == 1) {
				this.openDrawer(this.$.handles.getControls()[0]);
			} else {
				if (this.$.handleContainer.getOpen()) {
					this.closeHandleContainer();
				} else {
					this.openHandleContainer();
				}
			}
		}
	},
	openHandleContainer: function() {
		this.$.handleContainer.spotlightDisabled = false;
		this.$.handleContainer.setOpen(true);
		enyo.Spotlight.spot(this.$.handleContainer);
		this.updateActivator(true);
		enyo.dispatcher.capture(this.$.handleContainer, this.eventsToCapture, this);
	},
	closeHandleContainer: function() {
		enyo.dispatcher.release(this.$.handleContainer);
		this.$.handleContainer.spotlightDisabled = true;
		this.$.handleContainer.setOpen(false);
		this.updateActivator(false);
	},
	handleTapped: function(inSender, inEvent) {<commit_msg>BHV-8206: Protect against non-existent drawers property.<commit_after>/**
	_moon.Drawers_ is a container kind designed to hold a set of
	[moon.Drawer](#moon.Drawer) objects and client content. The _drawers_ property
	accepts an array of _moon.Drawer_ controls. The associated [drawer
	handles](#moon.DrawerHandle) are positioned in their own small drawer,
	centered at the top of the "dresser"--the region containing the array of
	Drawer controls and the activator nub.

	When a handle is selected, it opens the corresponding Drawer object's main
	drawer or control drawer, depending on how the Drawer object is configured.

	The control's child components may be of any kind.

		{
			kind: "moon.Drawers",
			drawers: [
				{
					name: "musicDrawer",
					kind: "moon.Drawer",
					handle: {kind: "moon.DrawerHandle", content: "Handle"},
					components: [
						{content: "Drawer Content"}
					],
					controlDrawerComponents: [
						{content: "Controls"}
					]
				}
			],
			components: [
				{content: "Content Area"}
			]
		}
*/
enyo.kind({
	name: "moon.Drawers",
	kind: "enyo.Control",
	//* @protected
	classes: "moon-drawers enyo-fit",
	//* @public
	published: {
		//* Populate with an array of _moon.Drawer_ components
		drawers: null
	},
	//* @protected
	handlers: {
		//* Handlers to update the activator when the state of the contained drawers changes
		onActivate: "drawerActivated",
		onDeactivate: "drawerDeactivated",
		onSpotlightDown:"spotDown",
		onSpotlightUp:"spotUp"
	},
	components: [
		{name:"activatorWrapper", classes:"moon-drawers-activator-wrapper", spotlight:true, ontap:"activatorHandler", components: [
			{name:"activator", classes:"moon-drawers-activator", components:[
				{classes:"moon-drawers-activator-nub", components:[
					{name:"nubArrow", classes:"nub-arrow down"}
				]}
			]}
		]},
		{name:"handleContainer", classes:"moon-drawers-handle-container", kind:"enyo.Drawer", resizeContainer:false, open:false, spotlightDisabled: true, onpostresize:"resizeHandleContainer", components:[
			{name:"handles", classes:"moon-neutral moon-drawers-handles"}
		]},
		{name: "drawers", classes:"moon-drawers-drawer-container"},
		{name: "client", classes:"moon-drawers-client"}
	],
	eventsToCapture: {
		ontap: "captureTapSelect", 
		onSpotlightFocus: "captureSpotFocus", 
		onSpotlightSelect: "captureTapSelect"
	},
	create: function() {
		this.inherited(arguments);
		this.$.drawers.createComponents(this.drawers, {kind: "moon.Drawer", owner:this.owner});
		this.setupHandles();
	},
	rendered: function() {
		this.inherited(arguments);
		var dh = document.body.getBoundingClientRect().height;
		this.waterfall("onDrawersRendered", {drawersHeight: dh});
	},
	setupHandles: function() {
		var handles = []
			, controls, index;

		// cover the case where one is not defined
		if (this.drawers) {
			for (index = 0; index < this.drawers.length; ++index) {
				handles.push(this.drawers[index].handle || {});
			}
			this.$.handles.createComponents(handles, {kind: "moon.DrawerHandle", owner:this});
			controls = this.$.handles.getControls();
			enyo.forEach(handles, function (handle, idx) {
				controls[idx].addClass('moon-drawers-handle');
				controls[idx].tap = this.bindSafely(this.handleTapped);
			}, this);
		}
	},
	activatorHandler: function(){
		if (this.drawerOpen()) {
			this.closeDrawers();
		} else {
			if (this.$.handles.getControls().length == 1) {
				this.openDrawer(this.$.handles.getControls()[0]);
			} else {
				if (this.$.handleContainer.getOpen()) {
					this.closeHandleContainer();
				} else {
					this.openHandleContainer();
				}
			}
		}
	},
	openHandleContainer: function() {
		this.$.handleContainer.spotlightDisabled = false;
		this.$.handleContainer.setOpen(true);
		enyo.Spotlight.spot(this.$.handleContainer);
		this.updateActivator(true);
		enyo.dispatcher.capture(this.$.handleContainer, this.eventsToCapture, this);
	},
	closeHandleContainer: function() {
		enyo.dispatcher.release(this.$.handleContainer);
		this.$.handleContainer.spotlightDisabled = true;
		this.$.handleContainer.setOpen(false);
		this.updateActivator(false);
	},
	handleTapped: function(inSender, inEvent) {
{'fraction_non_alphanumeric': 0.14679456046624575, 'fraction_numerical': 0.0012141816415735794, 'mean_word_length': 4.345230369889682, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2049655', 'n_tokens_mistral': 3067, 'n_tokens_neox': 2676, 'n_words': 565}