<commit_before>enyo.kind({
	name: "Ares.App",
	classes: "enyo-fit",
	id: "aresApp",
	handlers: {
		ondragleave: "iframeDragleave",
		onWebkitTransitionEnd: "prerenderMoveComplete" // TODO
	},
	published: {
		containerItem: null,
		beforeItem: null,
		currentDropTarget: null,
		createPaletteItem: null
	},
	components: [
		{name: "client", classes:"enyo-fit"},
		{name: "cloneArea", style: "background:rgba(0,200,0,0.5); display:none; opacity: 0;", classes: "enyo-fit enyo-clip"},
		{name: "flightArea", style: "display:none;", classes: "enyo-fit"},
		{name: "serializer", kind: "Ares.Serializer"},
		{name: "communicator", kind: "RPCCommunicator", onMessage: "receiveMessage"},
		{name: "selectHighlight", classes: "iframe-highlight iframe-select-highlight", showing: false},
		{name: "dropHighlight", classes: "iframe-highlight iframe-drop-highlight"},
		
		//* Resize handles
		{name: "topLeftResizeHandle",     classes: "iframe-resize-handle", showing: false, sides: {top: true, left: true},     style: "top: 0px; left: 0px;"},
		{name: "topRightResizeHandle",    classes: "iframe-resize-handle", showing: false, sides: {top: true, right: true},    style: "top: 0px; right: 0px;"},
		{name: "bottomLeftResizeHandle",  classes: "iframe-resize-handle", showing: false, sides: {bottom: true, left: true},  style: "bottom: 0px; left: 0px;"},
		{name: "bottomRightResizeHandle", classes: "iframe-resize-handle", showing: false, sides: {bottom: true, right: true}, style: "bottom: 0px; right: 0px;"}
	],
	
	selection: null,
	parentInstance: null,
	containerData: null,
	aresComponents: [],
	prevX: null,
	prevY: null,
	dragoverTimeout: null,
	holdoverTimeout: null,
	moveControlSecs: 0.2,
	edgeThresholdPx: 10,
	debug: false,
	
	create: function() {
		this.inherited(arguments);
		this.addHandlers();
		this.addDispatcherFeature();
	},
	rendered: function() {
		this.inherited(arguments);
		this.adjustFrameworkFeatures();
		enyo.load("$enyo/../source/package.js", enyo.bind(this, function() {
			this.sendMessage({op: "state", val: "initialized"});
		}));
	},
	//* Any core features of the framework that need to be overridden/diesabled happens here
	adjustFrameworkFeatures: function() {
		// Allow overriding kind definitions
		enyo.kind.allowOverride = true;
		// Disable autoStart/autoRender features of enyo.Application
		if (enyo.Application) {
			enyo.Application.prototype.start = enyo.nop;
			enyo.Application.prototype.render = enyo.nop;
		}
		// Disable controller instancing
		enyo.Control.prototype.controllerFindAndInstance = enyo.nop;
	},
	currentDropTargetChanged: function() {
		if (this.getCurrentDropTarget()) {
			this.highlightDropTarget(this.getCurrentDropTarget());
		}
		this.syncDropTargetHighlighting();
	},
	//* Add dispatch handling for native drag events
	addHandlers: function(inSender, inEvent) {
		document.ondragstart = enyo.dispatch;
		document.ondrag =      enyo.dispatch;
		document.ondragenter = enyo.dispatch;
		document.ondragleave = enyo.dispatch;
		document.ondragover =  enyo.dispatch;
		document.ondrop =      enyo.dispatch;
		document.ondragend =   enyo.dispatch;
	},
	/**
		Add feature to dispatcher to catch drag-and-drop-related events, and
		to stop any/all DOM events from being handled by the app.
	*/
	addDispatcherFeature: function() {
		var _this = this;
		
		enyo.dispatcher.features.push(
			function(e) {
				if (_this[e.type]) {
					_this[e.type](e)
				}
				e.preventDispatch = true;
				return true;
			}
		);
	},
	//* Send message to Deimos via _this.$.communicator_
	sendMessage: function(inMessage) {
		this.$.communicator.sendMessage(inMessage);
	},
	//* Receive message from Deimos
	receiveMessage: function(inSender, inEvent) {

		var msg = inEvent.message;

		if (!msg || !msg.op) {
			enyo.warn("Deimos iframe received invalid message data:", msg);
			return;
		}		
			
		switch (msg.op) {
			case "containerData":
				this.setContainerData(msg.val);
				break;
			case "render":
				// Add "$app" for image path (src attribute) resolution when the app is running into Ares Designer.
				enyo.path.addPath("app", enyo.path.rewrite("$enyo/.."));

				this.renderKind(msg.val);
				break;
			case "select":
				this.selectItem(msg.val);
				break;
			case "highlight":
				this.highlightDropTarget(this.getControlById(msg.val.aresId));
				break;
			case "unhighlight":
				this.unhighlightDropTargets(msg.val);
				break;
			case "modify":
				this.modifyProperty(msg.val);
				break;
			case "codeUpdate":
				this.codeUpdate(msg.val);
				break;
			case "cssUpdate":
				this.cssUpdate(msg.val);
				break;
			case "cleanUp":
				this.cleanUpKind();
				break;
			case "resize":
				this.resized();<commit_msg>ENYO-2558: Add "$app" to enyo.path for image path (src attribute) resolution when the app is running into Ares Designer.<commit_after>enyo.kind({
	name: "Ares.App",
	classes: "enyo-fit",
	id: "aresApp",
	handlers: {
		ondragleave: "iframeDragleave",
		onWebkitTransitionEnd: "prerenderMoveComplete" // TODO
	},
	published: {
		containerItem: null,
		beforeItem: null,
		currentDropTarget: null,
		createPaletteItem: null
	},
	components: [
		{name: "client", classes:"enyo-fit"},
		{name: "cloneArea", style: "background:rgba(0,200,0,0.5); display:none; opacity: 0;", classes: "enyo-fit enyo-clip"},
		{name: "flightArea", style: "display:none;", classes: "enyo-fit"},
		{name: "serializer", kind: "Ares.Serializer"},
		{name: "communicator", kind: "RPCCommunicator", onMessage: "receiveMessage"},
		{name: "selectHighlight", classes: "iframe-highlight iframe-select-highlight", showing: false},
		{name: "dropHighlight", classes: "iframe-highlight iframe-drop-highlight"},
		
		//* Resize handles
		{name: "topLeftResizeHandle",     classes: "iframe-resize-handle", showing: false, sides: {top: true, left: true},     style: "top: 0px; left: 0px;"},
		{name: "topRightResizeHandle",    classes: "iframe-resize-handle", showing: false, sides: {top: true, right: true},    style: "top: 0px; right: 0px;"},
		{name: "bottomLeftResizeHandle",  classes: "iframe-resize-handle", showing: false, sides: {bottom: true, left: true},  style: "bottom: 0px; left: 0px;"},
		{name: "bottomRightResizeHandle", classes: "iframe-resize-handle", showing: false, sides: {bottom: true, right: true}, style: "bottom: 0px; right: 0px;"}
	],
	
	selection: null,
	parentInstance: null,
	containerData: null,
	aresComponents: [],
	prevX: null,
	prevY: null,
	dragoverTimeout: null,
	holdoverTimeout: null,
	moveControlSecs: 0.2,
	edgeThresholdPx: 10,
	debug: false,
	
	create: function() {
		this.inherited(arguments);
		this.addHandlers();
		this.addDispatcherFeature();
	},
	rendered: function() {
		this.inherited(arguments);
		this.adjustFrameworkFeatures();
		enyo.load("$enyo/../source/package.js", enyo.bind(this, function() {
			this.sendMessage({op: "state", val: "initialized"});
		}));
	},
	//* Any core features of the framework that need to be overridden/diesabled happens here
	adjustFrameworkFeatures: function() {
		// Allow overriding kind definitions
		enyo.kind.allowOverride = true;
		// Disable autoStart/autoRender features of enyo.Application
		if (enyo.Application) {
			enyo.Application.prototype.start = enyo.nop;
			enyo.Application.prototype.render = enyo.nop;
		}
		// Disable controller instancing
		enyo.Control.prototype.controllerFindAndInstance = enyo.nop;
	},
	currentDropTargetChanged: function() {
		if (this.getCurrentDropTarget()) {
			this.highlightDropTarget(this.getCurrentDropTarget());
		}
		this.syncDropTargetHighlighting();
	},
	//* Add dispatch handling for native drag events
	addHandlers: function(inSender, inEvent) {
		document.ondragstart = enyo.dispatch;
		document.ondrag =      enyo.dispatch;
		document.ondragenter = enyo.dispatch;
		document.ondragleave = enyo.dispatch;
		document.ondragover =  enyo.dispatch;
		document.ondrop =      enyo.dispatch;
		document.ondragend =   enyo.dispatch;
	},
	/**
		Add feature to dispatcher to catch drag-and-drop-related events, and
		to stop any/all DOM events from being handled by the app.
	*/
	addDispatcherFeature: function() {
		var _this = this;
		
		enyo.dispatcher.features.push(
			function(e) {
				if (_this[e.type]) {
					_this[e.type](e)
				}
				e.preventDispatch = true;
				return true;
			}
		);
	},
	//* Send message to Deimos via _this.$.communicator_
	sendMessage: function(inMessage) {
		this.$.communicator.sendMessage(inMessage);
	},
	//* Receive message from Deimos
	receiveMessage: function(inSender, inEvent) {

		var msg = inEvent.message;

		if (!msg || !msg.op) {
			enyo.warn("Deimos iframe received invalid message data:", msg);
			return;
		}		
			
		switch (msg.op) {
			case "containerData":
				this.setContainerData(msg.val);
				break;
			case "render":
				// Add "$app" to enyo.path for image path (src attribute) resolution when the app is running into Ares Designer.
				enyo.path.addPath("app", enyo.path.rewrite("$enyo/.."));

				this.renderKind(msg.val);
				break;
			case "select":
				this.selectItem(msg.val);
				break;
			case "highlight":
				this.highlightDropTarget(this.getControlById(msg.val.aresId));
				break;
			case "unhighlight":
				this.unhighlightDropTargets(msg.val);
				break;
			case "modify":
				this.modifyProperty(msg.val);
				break;
			case "codeUpdate":
				this.codeUpdate(msg.val);
				break;
			case "cssUpdate":
				this.cssUpdate(msg.val);
				break;
			case "cleanUp":
				this.cleanUpKind();
				break;
			case "resize":
				this.resized();
{'fraction_non_alphanumeric': 0.14623338257016247, 'fraction_numerical': 0.0046423296054019835, 'mean_word_length': 4.109973045822103, 'pattern_counts': {'":': 20, '<': 3, '<?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': '2543062', 'n_tokens_mistral': 3597, 'n_tokens_neox': 3134, 'n_words': 733}