text:
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import sideNav from '../../pageobjects/side-nav.page';
import flexTab from '../../pageobjects/flex-tab.page';
import admin from '../../pageobjects/administration.page';

// test data imports
import { checkIfUserIsAdmin } from '../../data/checks';
import { adminUsername, adminEmail, adminPassword } from '../../data/user.js';

describe('[Administration]', () => {
	before(() => {
		checkIfUserIsAdmin(adminUsername, adminEmail, adminPassword);
		// sideNav.spotlightSearch.waitForVisible(10000);
		// sideNav.general.waitForVisible(5000);
		// sideNav.general.click();
	});

	after(() => {
		sideNav.preferencesClose.waitForVisible(5000);
		sideNav.preferencesClose.click();
	});

	describe('[Admin View]', () => {
		before(() => {
			sideNav.sidebarMenu.click();
			sideNav.admin.waitForVisible(5000);
		});

		it('it should enter the admin view', () => {
			sideNav.admin.click();
			admin.flexNavContent.waitForVisible(5000);
		});

		describe('info:', () => {
			before(() => {
				admin.infoLink.waitForVisible(5000);
				admin.infoLink.click();
				admin.infoRocketChatTable.waitForVisible(5000);
			});
			it('the first title should be Rocket.Chat', () => {
				admin.infoRocketChatTableTitle.getText().should.equal('Rocket.Chat');
			});

			it('it should show the rocket chat table', () => {
				admin.infoRocketChatTable.isVisible().should.be.true;
			});

			it('the second title should be Commit', () => {
				admin.infoCommitTableTitle.getText().should.equal('Commit');
			});

			it('it should show the Commit table', () => {
				admin.infoCommitTable.isVisible().should.be.true;
			});

			it('the first title should be Runtime Environment', () => {
				admin.infoRuntimeTableTitle.moveToObject();
				admin.infoRuntimeTableTitle.getText().should.equal('Runtime Environment');
			});

			it('it should show the Runtime Environment table', () => {
				admin.infoRuntimeTable.isVisible().should.be.true;
			});

			it('the first title should be Build Environment', () => {
				admin.infoBuildTableTitle.moveToObject();
				admin.infoBuildTableTitle.getText().should.equal('Build Environment');
			});

			it('it should show the Build Environment table', () => {
				admin.infoBuildTable.isVisible().should.be.true;
			});
		});

		describe.skip('[Rooms]', () => {
			before(() => {
				admin.roomsLink.waitForVisible(5000);
				admin.roomsLink.click();
				admin.roomsFilter.waitForVisible(5000);
			});

			after(() => {
				admin.infoLink.click();
			});

			describe('render:', () => {
				it('it should show the search form', () => {
					admin.roomsSearchForm.isVisible().should.be.true;
				});

				it('it should show the rooms Filter', () => {
					admin.roomsFilter.isVisible().should.be.true;
				});

				it('it should show the channel checkbox', () => {
					admin.roomsChannelsCheckbox.isVisible().should.be.true;
				});

				it('it should show the direct messsage checkbox', () => {
					admin.roomsDirectCheckbox.isVisible().should.be.true;
				});

				it('it should show the Private channel checkbox', () => {
					admin.roomsPrivateCheckbox.isVisible().should.be.true;
				});

				it('it should show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.true;
				});
			});

			describe('filter text:', () => {
				before(() => {
					admin.roomsFilter.click();
					admin.roomsFilter.setValue('general');
				});

				after(() => {
					admin.roomsFilter.click();
					admin.roomsFilter.setValue('');
				});

				it('it should show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.true;
				});
			});

			describe('filter text with wrong channel:', () => {
				before(() => {
					admin.roomsFilter.click();
					admin.roomsFilter.setValue('something else');
				});

				after(() => {
					admin.roomsFilter.click();
					admin.roomsFilter.setValue('');
				});

				it('it should not show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.false;
				});
			});

			describe('filter checkbox:', () => {
				let checkbox = 1;
				before(() => {
					admin.roomsFilter.setValue('');
					// add value triggers a key event that changes search±±±±±±±±±
					admin.roomsFilter.addValue(' ');
					admin.roomsGeneralChannel.waitForVisible(5000);
				});
				beforeEach(() => {
					switch (checkbox) {
						case 1:
							admin.roomsChannelsCheckbox.click();
							break;
						case 2:
							admin.roomsDirectCheckbox.click();
							break;
						case 3:
							admin.roomsPrivateCheckbox.click();
							break;
					}
				});

				afterEach(() => {
					switch (checkbox) {
						case 1:
							admin.roomsChannelsCheckbox.click();
							checkbox ++;
							break;
						case 2:
							admin.roomsDirectCheckbox.click();
							checkbox ++;
							break;
						case 3:
							admin.roomsPrivateCheckbox.click();
							break;
					}
				});

				it('it should show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.true;
				});

				it('it should not show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.false;
				});

				it('it should not show the general channel', () => {
					admin.roomsGeneralChannel.isVisible().should.be.false;
				});
			});
		});

		describe.skip('[Users]', () => {
			before(() => {
				admin.usersLink.waitForVisible(5000);
				admin.usersLink.click();
				admin.usersFilter.waitForVisible(5000);
			});

			after(() => {
				admin.infoLink.click();
			});

			it('it should show the search form', () => {
				admin.usersFilter.isVisible().should.be.true;
			});

			it('it should show rocket.cat', () => {
			// it cant find the user if there is too many users
				admin.usersRocketCat.isVisible().should.be.true;
			});

			describe('filter text:', () => {
				before(() => {
					admin.usersFilter.click();
					admin.usersFilter.setValue('Rocket.Cat');
				});

				after(() => {
					admin.usersFilter.click();
					admin.usersFilter.setValue('');
				});

				it('it should show rocket.cat', () => {
					admin.usersRocketCat.waitForVisible();
					admin.usersRocketCat.isVisible().should.be.true;
				});
			});

			describe('filter text with wrong user:', () => {
				before(() => {
					admin.usersFilter.click();
					admin.usersFilter.setValue('something else');
				});

				after(() => {
					admin.usersFilter.click();
					admin.usersFilter.setValue('');
				});

				it('it should not show rocket.cat', () => {
					admin.usersRocketCat.isVisible().should.be.false;
				});
			});

			describe('[Flex Tab] ', () => {
				describe('send invitation:', () => {
					before(() => {
						flexTab.usersSendInvitationTab.waitForVisible(5000);
						flexTab.usersSendInvitationTab.click();
						flexTab.usersSendInvitationTextArea.waitForVisible(5000);
					});

					after(() => {
						flexTab.usersSendInvitationTab.waitForVisible(5000);
						flexTab.usersSendInvitationTab.click();
						flexTab.usersSendInvitationTextArea.waitForVisible(5000, true);
					});

					it('it should show the send invitation text area', () => {
						flexTab.usersSendInvitationTextArea.isVisible().should.be.true;
					});

					it('it should show the cancel button', () => {
						flexTab.usersButtonCancel.isVisible().should.be.true;
					});

					it('it should show the send button', () => {
						flexTab.usersSendInvitationSend.isVisible().should.be.true;
					});
				});

				describe('create user:', () => {
					before(() => {
						flexTab.usersAddUserTab.waitForVisible(5000);
						flexTab.usersAddUserTab.click();
						flexTab.usersAddUserName.waitForVisible(5000);
					});

					after(() => {
						flexTab.usersAddUserTab.waitForVisible(5000);
						flexTab.usersAddUserTab.click();
						flexTab.usersAddUserName.waitForVisible(5000, true);
					});

					it('it should show the name field', () => {
						flexTab.usersAddUserName.isVisible().should.be.true;
					});

					it('it should show the username field', () => {
						flexTab.usersAddUserUsername.isVisible().should.be.true;
					});

					it('it should show the email field', () => {
						flexTab.usersAddUserEmail.isVisible().should.be.true;
					});

					it('it should show the verified checkbox', () => {
						flexTab.usersAddUserVerifiedCheckbox.isVisible().should.be.true;
					});

					it('it should show the password field', () => {
						flexTab.usersAddUserPassword.isVisible().should.be.true;
					});

					it('it should show the random password button', () => {
						flexTab.usersAddUserRandomPassword.isVisible().should.be.true;
					});

					it('it should show the require password change button', () => {
						flexTab.usersAddUserChangePasswordCheckbox.isVisible().should.be.true;
					});

					it('it should show the role dropdown', () => {
						flexTab.usersAddUserRoleList.waitForVisible(5000);
						flexTab.usersAddUserRoleList.isVisible().should.be.true;
					});

					it('ít should show the add role button', () => {
						flexTab.usersAddUserRoleButton.waitForVisible(5000);
						flexTab.usersAddUserRoleButton.isVisible().should.be.true;
					});

					it('it should show the join default channel checkbox', () => {
						flexTab.usersAddUserDefaultChannelCheckbox.isVisible().should.be.true;
					});

					it('it should show the send welcome checkbox', () => {
						flexTab.usersAddUserWelcomeEmailCheckbox.isVisible().should.be.true;
					});

					it('it should show the save button', () => {
						flexTab.usersButtonSave.isVisible().should.be.true;
					});

					it('it should show the cancel button', () => {
						flexTab.usersButtonCancel.isVisible().should.be.true;
					});
				});
			});
		});

		describe('[Roles]', () => {
			before(() => {
				admin.permissionsLink.waitForVisible(5000);
				admin.permissionsLink.click();
				admin.rolesPermissionGrid.waitForVisible(5000);
			});

			after(() => {
				admin.infoLink.click();
			});

			it('it should show the permissions grid', () => {
				admin.rolesPermissionGrid.isVisible().should.be.true;
			});

			it('it should show the new role button', () => {
				admin.rolesNewRolesButton.isVisible().should.be.true;
			});

			it('it should show the admin link', () => {
				admin.rolesAdmin.isVisible().should.be.true;
			});

			describe('new role:', () => {
				before(() => {
					admin.rolesNewRolesButton.waitForVisible(5000);
					admin.rolesNewRolesButton.click();
					admin.rolesReturnLink.waitForVisible(5000);
				});

				after(() => {
					admin.rolesReturnLink.click();
				});

				it('it should show the return to permissions', () => {
					admin.rolesReturnLink.isVisible().should.be.true;
				});

				it('it should show the new role name field', () => {
					admin.rolesNewRoleName.isVisible().should.be.true;
				});

				it('it should show the new role description field', () => {
					admin.rolesNewRoleDesc.isVisible().should.be.true;
				});

				it('it should show the new role scope', () => {
					admin.rolesNewRoleScope.isVisible().should.be.true;
				});
			});

			describe('admin role:', () => {
				before(() => {
					admin.rolesAdmin.waitForVisible(5000);
					admin.rolesAdmin.click();
					admin.usersInternalAdmin.waitForVisible(5000);
				});

				after(() => {
					admin.rolesReturnLink.click();
				});

				it('it should show internal admin', () => {
					admin.usersInternalAdmin.isVisible().should.be.true;
				});
			});
		});

		describe('[General Settings]', () => {
			before(() => {
				admin.settingsSearch.setValue('general');
				admin.generalLink.waitForVisible(5000);
				admin.generalLink.click();
				admin.settingsSearch.setValue('');
				admin.generalSiteUrl.waitForVisible(5000);
			});

			describe('general:', () => {
				it('it should show site url field', () => {
					admin.generalSiteUrl.isVisible().should.be.true;
				});

				it('it should change site url field', () => {
					admin.generalSiteUrl.setValue('something');
				});

				it('it should show the reset button', () => {
					admin.generalSiteUrlReset.waitForVisible(5000);
					admin.generalSiteUrlReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalSiteUrlReset.click();
				});

				it('it should that the site url field is different from the last input', () => {
					admin.generalSiteUrl.getText().should.not.equal('something');
				});

				it('it should show site name field', () => {
					admin.generalSiteName.isVisible().should.be.true;
				});

				it('it should change site name field', () => {
					admin.generalSiteName.setValue('something');
				});

				it('it should show the reset button', () => {
					admin.generalSiteNameReset.waitForVisible(5000);
					admin.generalSiteNameReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalSiteNameReset.click();
				});

				it('it should be that the name field is different from the last input', () => {
					admin.generalSiteName.getText().should.not.equal('something');
				});

				it('it should show language field', () => {
					admin.generalLanguage.isVisible().should.be.true;
				});

				it('it should change the language ', () => {
					admin.generalLanguage.click();
					admin.generalLanguagePtOption.waitForVisible(5000);
					admin.generalLanguagePtOption.click();
				});

				it('it should show the reset button', () => {
					admin.generalLanguageReset.waitForVisible(5000);
					admin.generalLanguageReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalLanguageReset.click();
				});

				it('it should show invalid self signed certs checkboxes', () => {
					admin.generalSelfSignedCertsFalse.isVisible().should.be.true;
					admin.generalSelfSignedCertsTrue.isVisible().should.be.true;
				});

				it('it should change the invalid self signed certs checkboxes', () => {
					admin.generalSelfSignedCertsTrue.click();
				});

				it('it should show the reset button', () => {
					admin.generalSelfSignedCertsReset.waitForVisible(5000);
					admin.generalSelfSignedCertsReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalSelfSignedCertsReset.click();
				});

				it('it should show favorite rooms checkboxes', () => {
					admin.generalFavoriteRoomFalse.isVisible().should.be.true;
					admin.generalFavoriteRoomTrue.isVisible().should.be.true;
				});

				it('it should change the favorite rooms checkboxes', () => {
					admin.generalFavoriteRoomFalse.click();
				});

				it('it should show the reset button', () => {
					admin.generalFavoriteRoomReset.waitForVisible(5000);
					admin.generalFavoriteRoomReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalFavoriteRoomReset.click();
				});

				it('it should show open first channel field', () => {
					admin.generalOpenFirstChannel.isVisible().should.be.true;
				});

				it('it should change open first channel field', () => {
					admin.generalOpenFirstChannel.setValue('something');
				});

				it('it should show the reset button', () => {
					admin.generalOpenFirstChannelReset.waitForVisible(5000);
					admin.generalOpenFirstChannelReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalOpenFirstChannelReset.click();
				});

				it('it should show cdn prefix field', () => {
					admin.generalCdnPrefix.isVisible().should.be.true;
				});

				it('it should change site url field', () => {
					admin.generalCdnPrefix.setValue('something');
				});

				it('it should show the reset button', () => {
					admin.generalCdnPrefixReset.waitForVisible(5000);
					admin.generalCdnPrefixReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalCdnPrefixReset.click();
				});

				it('it should show the force SSL checkboxes', () => {
					admin.generalForceSSLTrue.isVisible().should.be.true;
					admin.generalForceSSLFalse.isVisible().should.be.true;
				});

				it('it should change the force ssl checkboxes', () => {
					admin.generalForceSSLTrue.click();
				});

				it('it should show the reset button', () => {
					admin.generalForceSSLReset.waitForVisible(5000);
					admin.generalForceSSLReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalForceSSLReset.click();
				});

				it('it should show google tag id field', () => {
					admin.generalGoogleTagId.isVisible().should.be.true;
				});

				it('it should change google tag id field', () => {
					admin.generalGoogleTagId.setValue('something');
				});

				it('it should show the reset button', () => {
					admin.generalGoogleTagIdReset.waitForVisible(5000);
					admin.generalGoogleTagIdReset.isVisible().should.be.true;
				});

				it('it should click the reset button', () => {
					admin.generalGoogleTagIdReset.click();
				});

				it.skip('it should show bugsnag key field', () => {
					admin.generalBugsnagKey.isVisible().should.be.true;
				});

				it.skip('it should change bugsnag key id field', () => {
					admin.generalBugsnagKey.setValue('something');
				});

				it.skip('it should show the reset button', () => {
					admin.generalBugsnagKeyReset.waitForVisible(5000);
					admin.generalBugsnagKeyReset.isVisible().should.be.true;
				});

				it.skip('it should click the reset button', () => {
					admin.generalBugsnagKeyReset.click();
				});
			});

			describe('iframe:', () => {
				before(() => {
					admin.generalButtonExpandIframe.waitForVisible(5000);
					admin.generalButtonExpandIframe.click();
					admin.generalIframeSendTrue.waitForVisible(5000);
					admin.generalIframeSendTrue.scroll();
				});

				it('it should show iframe send checkboxes', () => {
					admin.generalIframeSendTrue.isVisible().should.be.true;
					admin.generalIframeSendFalse.isVisible().should.be.true;
				});

				it('it should show send origin field', () => {
					admin.generalIframeSendTargetOrigin.isVisible().should.be.true;
				});

				it('it should show iframe send checkboxes', () => {
					admin.generalIframeRecieveFalse.isVisible().should.be.true;
					admin.generalIframeRecieveTrue.isVisible().should.be.true;
				});

				it('it should show send origin field', () => {
					admin.generalIframeRecieveOrigin.isVisible().should.be.true;
				});
			});

			describe('notifications:', () => {
				before(() => {
					admin.generalButtonExpandNotifications.waitForVisible(5000);
					admin.generalButtonExpandNotifications.click();
					admin.generalNotificationsMaxRoomMembers.waitForVisible(5000);
					admin.generalNotificationsMaxRoomMembers.scroll();
				});

				it('it should show the max room members field', () => {
					admin.generalNotificationsMaxRoomMembers.isVisible().should.be.true;
				});
			});

			describe('rest api:', () => {
				before(() => {
					admin.generalButtonExpandRest.waitForVisible(5000);
					admin.generalButtonExpandRest.click();
					admin.generalRestApiUserLimit.waitForVisible(5000);
					admin.generalRestApiUserLimit.scroll();
				});

				it('it should show the API user add limit field', () => {
					admin.generalRestApiUserLimit.isVisible().should.be.true;
				});
			});

			describe('reporting:', () => {
				before(() => {
					admin.generalButtonExpandReporting.waitForVisible(5000);
					admin.generalButtonExpandReporting.click();
					admin.generalReportingTrue.waitForVisible(5000);
					admin.generalReportingTrue.scroll();
				});

				it('it should show the report to rocket.chat checkboxes', () => {
					admin.generalReportingTrue.isVisible().should.be.true;
					admin.generalReportingFalse.isVisible().should.be.true;
				});
			});

			describe('stream cast:', () => {
				before(() => {
					admin.generalButtonExpandStreamCast.waitForVisible(5000);
					admin.generalButtonExpandStreamCast.click();
					admin.generalStreamCastAdress.waitForVisible(5000);
					admin.generalStreamCastAdress.scroll();
				});

				it('it should show the stream cast adress field', () => {
					admin.generalStreamCastAdress.isVisible().should.be.true;
				});
			});

			describe('stream cast:', () => {
				before(() => {
					admin.generalButtonExpandUTF8.waitForVisible(5000);
					admin.generalButtonExpandUTF8.click();
					admin.generalUTF8Regex.waitForVisible(5000);
					admin.generalUTF8Regex.scroll();
				});

				it('it should show the utf8 regex field', () => {
					admin.generalUTF8Regex.isVisible().should.be.true;
				});

				it('it should show the utf8 names slug checkboxes', () => {
					admin.generalUTF8NamesSlugTrue.isVisible().should.be.true;
					admin.generalUTF8NamesSlugFalse.isVisible().should.be.true;
				});
			});
		});

		describe('[Accounts]', () => {
			before(() => {
				admin.settingsSearch.setValue('accounts');
				admin.accountsLink.waitForVisible(5000);
				admin.accountsLink.click();
				admin.settingsSearch.setValue('');
			});

			describe('default user preferences', () => {
				before(() => {
					if (admin.accountsButtonCollapseDefaultUserPreferences.isVisible()) {
						admin.accountsButtonCollapseDefaultUserPreferences.click();
					}
					admin.accountsButtonExpandDefaultUserPreferences.waitForVisible(5000);
					admin.accountsButtonExpandDefaultUserPreferences.click();
					admin.accountsNotificationDuration.waitForVisible(5000);
				});

				it('it should show the enable auto away field', () => {
					admin.accountsEnableAutoAwayTrue.scroll();
					admin.accountsEnableAutoAwayTrue.isVisible().should.be.true;
					admin.accountsEnableAutoAwayFalse.isVisible().should.be.true;
				});
				it('the enable auto away field value should be true', () => {
					admin.accountsEnableAutoAwayTrue.isSelected().should.be.true;
					admin.accountsEnableAutoAwayFalse.isSelected().should.be.false;
				});

				it('it should show the idle timeout limit field', () => {
					admin.accountsidleTimeLimit.click();
					admin.accountsidleTimeLimit.isVisible().should.be.true;
				});
				it('the idle timeout limit field value should be 300', () => {
					admin.accountsidleTimeLimit.getValue().should.equal('300');
				});

				it('it should show the notifications durations field', () => {
					admin.accountsNotificationDuration.click();
					admin.accountsNotificationDuration.isVisible().should.be.true;
				});
				it('the notification duration field value should be 0', () => {
					admin.accountsNotificationDuration.getValue().should.equal('0');
				});

				it('it should show the audio notifications select field', () => {
					admin.accountsAudioNotifications.click();
					admin.accountsAudioNotifications.isVisible().should.be.true;
				});
				it('the audio notifications field value should be mentions', () => {
					admin.accountsAudioNotifications.getValue().should.equal('mentions');
				});

				it('it should show the desktop audio notifications select field', () => {
					admin.accountsDesktopNotifications.click();
					admin.accountsDesktopNotifications.isVisible().should.be.true;
				});
				it('the desktop audio notifications field value should be mentions', () => {
					admin.accountsDesktopNotifications.getValue().should.equal('mentions');
				});

				it('it should show the mobile audio notifications select field', () => {
					admin.accountsMobileNotifications.click();
					admin.accountsMobileNotifications.isVisible().should.be.true;
				});
				it('the mobile audio notifications field value should be mentions', () => {
					admin.accountsMobileNotifications.getValue().should.equal('mentions');
				});

				it('it should show the unread tray icon alert field', () => {
					admin.accountsUnreadAlertTrue.scroll();
					admin.accountsUnreadAlertTrue.isVisible().should.be.true;
					admin.accountsUnreadAlertFalse.isVisible().should.be.true;
				});
				it('the unread tray icon alert field value should be true', () => {
					admin.accountsUnreadAlertTrue.isSelected().should.be.true;
					admin.accountsUnreadAlertFalse.isSelected().should.be.false;
				});

				it('it should show the use emojis field', () => {
					admin.accountsUseEmojisTrue.scroll();
					admin.accountsUseEmojisTrue.isVisible().should.be.true;
					admin.accountsUseEmojisFalse.isVisible().should.be.true;
				});
				it('the use emojis field value should be true', () => {
					admin.accountsUseEmojisTrue.isSelected().should.be.true;
					admin.accountsUseEmojisFalse.isSelected().should.be.false;
				});

				it('it should show the convert ascii to emoji field', () => {
					admin.accountsConvertAsciiEmojiTrue.scroll();
					admin.accountsConvertAsciiEmojiTrue.isVisible().should.be.true;
					admin.accountsConvertAsciiEmojiFalse.isVisible().should.be.true;
				});
				it('the convert ascii to emoji field value should be true', () => {
					admin.accountsConvertAsciiEmojiTrue.isSelected().should.be.true;
					admin.accountsConvertAsciiEmojiFalse.isSelected().should.be.false;
				});

				it('it should show the auto load images field', () => {
					admin.accountsAutoImageLoadTrue.scroll();
					admin.accountsAutoImageLoadTrue.isVisible().should.be.true;
					admin.accountsAutoImageLoadFalse.isVisible().should.be.true;
				});
				it('the auto load images field value should be true', () => {
					admin.accountsAutoImageLoadTrue.isSelected().should.be.true;
					admin.accountsAutoImageLoadFalse.isSelected().should.be.false;
				});

				it('it should show the save mobile bandwidth field', () => {
					admin.accountsSaveMobileBandwidthTrue.scroll();
					admin.accountsSaveMobileBandwidthTrue.isVisible().should.be.true;
					admin.accountsSaveMobileBandwidthFalse.isVisible().should.be.true;
				});
				it('the save mobile bandwidth field value should be true', () => {
					admin.accountsSaveMobileBandwidthTrue.isSelected().should.be.true;
					admin.accountsSaveMobileBandwidthFalse.isSelected().should.be.false;
				});

				it('it should show the collapse embedded media by default field', () => {
					admin.accountsCollapseMediaByDefaultTrue.scroll();
					admin.accountsCollapseMediaByDefaultTrue.isVisible().should.be.true;
					admin.accountsCollapseMediaByDefaultFalse.isVisible().should.be.true;
				});
				it('the collapse embedded media by default field value should be false', () => {
					admin.accountsCollapseMediaByDefaultTrue.isSelected().should.be.false;
					admin.accountsCollapseMediaByDefaultFalse.isSelected().should.be.true;
				});

				it('it should show the hide usernames field', () => {
					admin.accountsHideUsernamesTrue.scroll();
					admin.accountsHideUsernamesTrue.isVisible().should.be.true;
					admin.accountsHideUsernamesFalse.isVisible().should.be.true;
				});
				it('the hide usernames field value should be false', () => {
					admin.accountsHideUsernamesTrue.isSelected().should.be.false;
					admin.accountsHideUsernamesFalse.isSelected().should.be.true;
				});

				it('it should show the hide roles field', () => {
					admin.accountsHideRolesTrue.scroll();
					admin.accountsHideRolesTrue.isVisible().should.be.true;
					admin.accountsHideRolesFalse.isVisible().should.be.true;
				});
				it('the hide roles field value should be false', () => {
					admin.accountsHideRolesTrue.isSelected().should.be.false;
					admin.accountsHideRolesFalse.isSelected().should.be.true;
				});

				it('it should show the hide right sidebar with click field', () => {
					admin.accountsHideFlexTabTrue.scroll();
					admin.accountsHideFlexTabTrue.isVisible().should.be.true;
					admin.accountsHideFlexTabFalse.isVisible().should.be.true;
				});
				it('the hide right sidebar with click field value should be false', () => {
					admin.accountsHideFlexTabTrue.isSelected().should.be.false;
					admin.accountsHideFlexTabFalse.isSelected().should.be.true;
				});

				it('it should show the hide avatars field', () => {
					admin.accountsHideAvatarsTrue.scroll();
					admin.accountsHideAvatarsTrue.isVisible().should.be.true;
					admin.accountsHideAvatarsFalse.isVisible().should.be.true;
				});
				it('the hide avatars field value should be false', () => {
					admin.accountsHideAvatarsTrue.isSelected().should.be.false;
					admin.accountsHideAvatarsFalse.isSelected().should.be.true;
				});

				it('it should show the enter key behavior field', () => {
					admin.accountsSendOnEnter.click();
					admin.accountsSendOnEnter.isVisible().should.be.true;
				});
				it('the enter key behavior field value should be normal', () => {
					admin.accountsSendOnEnter.getValue().should.equal('normal');
				});

				it('it should show the messagebox view mode field', () => {
					admin.accountsMessageViewMode.click();
					admin.accountsMessageViewMode.isVisible().should.be.true;
				});
				it('the view mode field value should be 0', () => {
					admin.accountsMessageViewMode.getValue().should.equal('0');
				});

				it('it should show the offline email notification field', () => {
					admin.accountsEmailNotificationMode.click();
					admin.accountsEmailNotificationMode.isVisible().should.be.true;
				});
				it('the offline email notification field value should be all', () => {
					admin.accountsEmailNotificationMode.getValue().should.equal('mentions');
				});

				it('it should show the room counter sidebar field', () => {
					admin.accountsRoomCounterSidebarTrue.scroll();
					admin.accountsRoomCounterSidebarTrue.isVisible().should.be.true;
					admin.accountsRoomCounterSidebarFalse.isVisible().should.be.true;
				});
				it('the room counter sidebar field value should be false', () => {
					admin.accountsRoomCounterSidebarTrue.isSelected().should.be.false;
					admin.accountsRoomCounterSidebarFalse.isSelected().should.be.true;
				});

				it('it should show the new room notification field', () => {
					admin.accountsNewRoomNotification.click();
					admin.accountsNewRoomNotification.isVisible().should.be.true;
				});
				it('the new room notification field value should be door', () => {
					admin.accountsNewRoomNotification.getValue().should.equal('door');
				});

				it('it should show the new message notification field', () => {
					admin.accountsNewMessageNotification.click();
					admin.accountsNewMessageNotification.isVisible().should.be.true;
				});
				it('the new message notification field value should be chime', () => {
					admin.accountsNewMessageNotification.getValue().should.equal('chime');
				});

				it('it should show the notification sound volume field', () => {
					admin.accountsNotificationsSoundVolume.click();
					admin.accountsNotificationsSoundVolume.isVisible().should.be.true;
				});
				it('the notification sound volume field value should be 100', () => {
					admin.accountsNotificationsSoundVolume.getValue().should.equal('100');
				});
			});
		});
	});
});


text:
package org.apache.nifi.web.api.cookie;

import org.apache.nifi.web.security.http.SecurityCookieName;

/**
 * Application Cookie Names
 */
public enum ApplicationCookieName {
    AUTHORIZATION_BEARER(SecurityCookieName.AUTHORIZATION_BEARER.getName()),

    LOGOUT_REQUEST_IDENTIFIER("nifi-logout-request-identifier"),

    OIDC_REQUEST_IDENTIFIER("nifi-oidc-request-identifier"),

    SAML_REQUEST_IDENTIFIER("nifi-saml-request-identifier");

    private final String cookieName;

    ApplicationCookieName(final String cookieName) {
        this.cookieName = cookieName;
    }

    public String getCookieName() {
        return cookieName;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.pentaho.di.repository.kdr.delegates;

import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.RepositoryAttributeInterface;

public class KettleDatabaseRepositoryJobAttribute implements RepositoryAttributeInterface {

	private KettleDatabaseRepositoryConnectionDelegate	connectionDelegate;
	private ObjectId	jobObjectId;

	public KettleDatabaseRepositoryJobAttribute(KettleDatabaseRepositoryConnectionDelegate connectionDelegate, ObjectId jobObjectId) {
		this.connectionDelegate = connectionDelegate;
		this.jobObjectId = jobObjectId;
	}

	public boolean getAttributeBoolean(String code) throws KettleException {
		return connectionDelegate.getJobAttributeBoolean(jobObjectId, 0, code);
	}

	public long getAttributeInteger(String code) throws KettleException {
		return connectionDelegate.getJobAttributeInteger(jobObjectId, 0, code);
	}

	public String getAttributeString(String code) throws KettleException {
		return connectionDelegate.getJobAttributeString(jobObjectId, 0, code);
	}

	public void setAttribute(String code, String value) throws KettleException {
		connectionDelegate.insertJobAttribute(jobObjectId, 0, code, 0, value);
	}

	public void setAttribute(String code, boolean value) throws KettleException {
		connectionDelegate.insertJobAttribute(jobObjectId, 0, code, 0, value?"Y":"N");
	}

	public void setAttribute(String code, long value) throws KettleException {
		connectionDelegate.insertJobAttribute(jobObjectId, 0, code, value, null);
	}
}


text:
package androidx.room.integration.testapp.vo;

import androidx.room.Entity;
import androidx.room.PrimaryKey;

@Entity
public class BlobEntity {
    @PrimaryKey
    public long id;
    public byte[] content;

    public BlobEntity(long id, byte[] content) {
        this.id = id;
        this.content = content;
    }
}


text:
function port = getSrcPorts(block)
	% Initialize of return variables
	port = {};

	% Correction of arguments
	if( nargin < 1 )
		block = gcb;
	end

	% Get the block handles
	block_handle = n3.sl.getParam(block, 'Handle');

	% Get the source port handles of block
	block_type = n3.sl.getParam(block_handle, 'BlockType');
	switch( lower(block_type) )
		case 'inport'
			ports = n3.sl.getInport( parent_block );
		case 'outport'
			ports = n3.sl.getOutport( parent_block );
		case 'enableport'
			ports = n3.sl.getEnable( parent_block );
		case 'triggerport'
			ports = n3.sl.getTrigger( parent_block );
		case 'actionport'
			ports = n3.sl.getIfaction( parent_block );
		otherwise
			ports = [];
	end

	% Get the outport number of block
	size_of_outport = numel(port_handle);

	% Change the return value to cell
	port = cell( size(port_handle) );

	% Get the destination ports
	for iPort=1:size_of_outport
		% Get the destination ports from the port
		port{iPort} = get_destination_port( port_handle(iPort) );
	end
end % getDstPorts

function h = get_destination_port(port)
	h = {};
	l = n3.sl.getParam( port, 'Line' );
	if( 0 < l )
		dst_ports = n3.sl.getParam( l, 'DstPortHandle' );
		flg = false( size(dst_ports) );
		for iPort=1:numel(dst_ports)
			if( 0 < dst_ports(iPort) )
				flg(iPort) = true;
			end
		end
		h = n3.Util.convertToCell( dst_ports(flg) );
	end
end % get_destination_port


text:
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "react", "@uifabric/example-app-base", "./examples/Link.Basic.Example"], function (require, exports, React, example_app_base_1, Link_Basic_Example_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var LinkBasicExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/Link/examples/Link.Basic.Example.tsx');
    var LinkPage = (function (_super) {
        __extends(LinkPage, _super);
        function LinkPage() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        LinkPage.prototype.render = function () {
            return (React.createElement(example_app_base_1.ComponentPage, { title: 'Link', componentName: 'LinkExample', exampleCards: React.createElement(example_app_base_1.ExampleCard, { title: 'Link', code: LinkBasicExampleCode },
                    React.createElement(Link_Basic_Example_1.LinkBasicExample, null)), propertiesTables: React.createElement(example_app_base_1.PropertiesTableSet, { sources: [
                        require('!raw-loader!office-ui-fabric-react/src/components/Link/Link.Props.ts')
                    ] }), overview: React.createElement("div", null,
                    React.createElement("p", null, "With a Link, users can navigate to another page, window, or Help topic; display a definition; initiate a command; or choose an option. A Link indicates that it can be clicked, typically by being displayed using the visited or unvisited link system colors. Traditionally, Links are underlined as well, but that approach is often unnecessary and falling out of favor to reduce visual clutter."),
                    React.createElement("p", null, "A Link is the lightest weight clickable control, and is often used to reduce the visual complexity of a design.")), bestPractices: React.createElement("div", null), dos: React.createElement("div", null,
                    React.createElement("ul", null,
                        React.createElement("li", null, "Use to navigate to another page, window, or help topic; display a definition; initiate a command; or choose an option."),
                        React.createElement("li", null, "Make Links discoverable by visual inspection alone. Users shouldn't have to interact with your program to find links."),
                        React.createElement("li", null, "Use Links that give specific descriptive information about the result of clicking on the link, using as much text as necessary. Users should be able to accurately predict the result of a link from its link text and optional Tooltip."),
                        React.createElement("li", null, "Use text that suggests clicking, such as a command starting with an imperative verb like \"Show\", \"Print\", \"Copy\", or \"Delete\"."))), donts: React.createElement("div", null,
                    React.createElement("ul", null,
                        React.createElement("li", null, "Use if the action is destructive or irreversible. Because users associate links with navigation (and the ability to back out), Links aren't appropriate for commands with significant consequences."))), related: React.createElement("a", { href: 'https://dev.office.com/fabric-js/Components/Link/Link.html' }, "Fabric JS"), isHeaderVisible: this.props.isHeaderVisible }));
        };
        return LinkPage;
    }(React.Component));
    exports.LinkPage = LinkPage;
});

//# sourceMappingURL=LinkPage.js.map


text:
id: recommendations
title: "Recommendations"
---

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

## Some general guidelines

JVM Flags:

```
-Duser.timezone=UTC
-Dfile.encoding=UTF-8
-Djava.io.tmpdir=<something other than /tmp which might be mounted to volatile tmpfs file system>
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
-Dorg.jboss.logging.provider=slf4j
-Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.SLF4JLogger
-Dlog4j.shutdownCallbackRegistry=org.apache.druid.common.config.Log4jShutdown
-Dlog4j.shutdownHookEnabled=true
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCApplicationConcurrentTime
-Xloggc:/var/logs/druid/historical.gc.log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=50
-XX:GCLogFileSize=10m
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/var/logs/druid/historical.hprof
-XX:MaxDirectMemorySize=10240g
```

`ExitOnOutOfMemoryError` flag is only supported starting JDK 8u92 . For older versions, `-XX:OnOutOfMemoryError='kill -9 %p'` can be used.

`MaxDirectMemorySize` restricts JVM from allocating more than specified limit, by setting it to unlimited JVM restriction is lifted and OS level memory limits would still be effective. It's still important to make sure that Druid is not configured to allocate more off-heap memory than your machine has available. Important settings here include druid.processing.numThreads, druid.processing.numMergeBuffers, and druid.processing.buffer.sizeBytes.

Please note that above flags are general guidelines only. Be cautious and feel free to change them if necessary for the specific deployment.

Additionally, for large JVM heaps, here are a few Garbage Collection efficiency guidelines that have been known to help in some cases.

- Mount /tmp on tmpfs ( See http://www.evanjones.ca/jvm-mmap-pause.html )
- On Disk-IO intensive processes (e.g. Historical and MiddleManager), GC and Druid logs should be written to a different disk than where data is written.
- Disable Transparent Huge Pages ( See https://blogs.oracle.com/linux/performance-issues-with-transparent-huge-pages-thp )
- Try disabling biased locking by using `-XX:-UseBiasedLocking` JVM flag. ( See https://dzone.com/articles/logging-stop-world-pauses-jvm )

## Use UTC timezone

We recommend using UTC timezone for all your events and across your hosts, not just for Druid, but for all data infrastructure. This can greatly mitigate potential query problems with inconsistent timezones. To query in a non-UTC timezone see [query granularities](../querying/granularities.html#period-granularities)

## SSDs

SSDs are highly recommended for Historical and real-time processes if you are not running a cluster that is entirely in memory. SSDs can greatly mitigate the time required to page data in and out of memory.

## JBOD vs RAID

Historical processes store large number of segments on Disk and support specifying multiple paths for storing those. Typically, hosts have multiple disks configured with RAID which makes them look like a single disk to OS. RAID might have overheads specially if its not hardware controller based but software based. So, Historicals might get improved disk throughput with JBOD.

## Use Timeseries and TopN queries instead of GroupBy where possible

Timeseries and TopN queries are much more optimized and significantly faster than groupBy queries for their designed use cases. Issuing multiple topN or timeseries queries from your application can potentially be more efficient than a single groupBy query.

## Segment sizes matter

Segments should generally be between 300MB-700MB in size. Too many small segments results in inefficient CPU utilization and
too many large segments impacts query performance, most notably with TopN queries.

## FAQs and Guides

1) The [ingestion FAQ](../ingestion/faq.md) provides help with common ingestion problems.

2) The [basic cluster tuning guide](../operations/basic-cluster-tuning.md) offers introductory guidelines for tuning your Druid cluster.


text:
exports.getClientIP = function (req) {
	var ipAddress;
	var headers = req.headers;
	var forwardedIpsStr = headers['x-real-ip'] || headers['x-forwarded-for'];
	forwardedIpsStr ? ipAddress = forwardedIpsStr : ipAddress = null;
	if (!ipAddress) {
		ipAddress = req.connection.remoteAddress;
	}
	return ipAddress;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true">

    <scale
        android:duration="100"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXScale="1.0"
        android:toYScale="1.0" />

</set>


text:
var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var pkg = require(path.join(process.cwd(), 'package.json'));

var assetsPath = path.join(__dirname, "public","js");
var publicPath = "/public/";

var commonLoaders = [
    {
        test: /\.js$|\.jsx$/,
        loaders: ["babel"],
        include: path.join(__dirname, "app")
    },
    {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract(
          'css?sourceMap&-restructuring!' +
          'autoprefixer-loader'
        )
    },
    {
        test: /\.less$/,
        loader: ExtractTextPlugin.extract(
          'css?sourceMap!' +
          'autoprefixer-loader!' +
          'less?{"sourceMap":true,"modifyVars":' + JSON.stringify(pkg.theme || {})+'}'
        )
    }
];

module.exports = {
    // The configuration for the client
    name: "browser",
    /* The entry point of the bundle
     * Entry points for multi page app could be more complex
     * A good example of entry points would be:
     * entry: {
     *   pageA: "./pageA",
     *   pageB: "./pageB",
     *   pageC: "./pageC",
     *   adminPageA: "./adminPageA",
     *   adminPageB: "./adminPageB",
     *   adminPageC: "./adminPageC"
     * }
     *
     * We can then proceed to optimize what are the common chunks
     * plugins: [
     *  new CommonsChunkPlugin("admin-commons.js", ["adminPageA", "adminPageB"]),
     *  new CommonsChunkPlugin("common.js", ["pageA", "pageB", "admin-commons.js"], 2),
     *  new CommonsChunkPlugin("c-commons.js", ["pageC", "adminPageC"]);
     * ]
     */
    context: path.join(__dirname, "app"),
    entry: {
      app: "./app.js"
    },
    output: {
      // The output directory as absolute path
      path: assetsPath,
      // The filename of the entry chunk as relative path inside the output.path directory
      filename: "bundle.js",
      // The output path from the view of the Javascript
      publicPath: publicPath

    },
    module: {
      loaders: commonLoaders
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new ExtractTextPlugin('ant.css', {
            disable: false,
            allChunks: true
        }),
    ]
};


text:
import abc
from typing import Union

class DataType(metaclass=abc.ABCMeta):
    """
    Abstract parent class for all data types.
    """

    # Constants for all data types.
    INT = 1
    STRING = 2
    ARRAY = 3

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def debug(self, indent: int = 0) -> str:
        """
        Returns a string for debugging.

        :param int indent: The indentation level.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def dereference(self):
        """
        Returns a clone of this data type.

        :rtype: sdoc.sdoc1.data_type.DataType.DataType
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def get_value(self) -> Union[int, str]:
        """
        Returns the underling value of this data type.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def get_type_id(self) -> int:
        """
        Returns the ID of this data type.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def is_constant(self) -> bool:
        """
        Returns True if this data type is a constant. Returns False otherwise.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def is_defined(self) -> bool:
        """
        Returns True if this data type is defined, i.e. has a value. Returns False otherwise.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def is_scalar(self) -> bool:
        """
        Returns True if this data type is a scalar. Returns False otherwise.
        """
        raise NotImplementedError

    # ------------------------------------------------------------------------------------------------------------------
    @abc.abstractmethod
    def is_true(self) -> bool:
        """
        Returns True if this data type evaluates to True. Returns False otherwise.
        """
        raise NotImplementedError

# ----------------------------------------------------------------------------------------------------------------------


text:
module OpenXml
  module Pptx
    module Properties
      class EmbeddedFont < SimplePropertyContainerProperty
        namespace :p
        tag :embeddedFont

        value_property :font, required: true, default_value: "Calibri"

        property :regular, as: :font_reference_regular
        property :bold, as: :font_reference_bold
        property :italic, as: :font_reference_italic
        property :bold_italic, as: :font_reference_italic

      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright [2016] [zhi]
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<resources>

    <!-- standard metrics -->
    <dimen name="spacing_normal">8dp</dimen>
    <dimen name="spacing_micro">4dp</dimen>
    <dimen name="padding_normal">16dp</dimen>

    <dimen name="keyline_1">16dp</dimen>
    <dimen name="keyline_1_minus_8dp">8dp</dimen>
    <dimen name="keyline_2">72dp</dimen>
    <dimen name="keyline_2_minus_16dp">56dp</dimen>

    <item name="aspect_phi" format="float" type="dimen">1.618</item>
    <item name="aspect_4_3" format="float" type="dimen">1.3333</item>
    <item name="aspect_16_9" format="float" type="dimen">1.7778</item>

    <dimen name="avatar_size">64dp</dimen>

    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>

    <!-- StatusBar size, do not access it directly, use ?attr/statusBarSize instead-->
    <dimen name="statusBarSize">0dp</dimen>

    <dimen name="appBarSize">180dp</dimen>
    <dimen name="fab_margin">16dp</dimen>
</resources>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace VisualRust.Cargo
{
    static class SafeNativeMethods
    {
        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void global_init();

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void free_strbox(Utf8String s);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void free_strbox_array(Utf8StringArray s);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void free_dependencies_result(DependenciesQueryResult s);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void free_output_targets_result(OutputTargetsQueryResult s);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern ParseResult load_from_utf16(IntPtr data, int length);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void free_manifest(IntPtr manifest);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern StringQueryResult get_string(IntPtr manifest, RawSlice slice);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern StringArrayQueryResult get_string_array(IntPtr manifest, RawSlice slice);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern DependenciesQueryResult get_dependencies(IntPtr manifest);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern OutputTargetsQueryResult get_output_targets(IntPtr manifest);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void remove_output_target(IntPtr manifest, UIntPtr handle, Utf8String kind);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern UIntPtr add_output_target(IntPtr manifest, RawOutputTarget target);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern UIntPtr set_output_target(IntPtr manifest, RawOutputTarget target);

        [DllImport("vist_toml.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern Utf8String manifest_to_string(IntPtr manifest);
    }
}


text:
<CodeTemplates version="3.0">
  <CodeTemplate version="2.0">

      <_Group>C#</_Group>
      <Version />
      <MimeType>text/x-csharp</MimeType>
      <Shortcut>scrollViewDecelerationStarted</Shortcut>
      <_Description />
      <TemplateType>Unknown</TemplateType>

    <![CDATA[[Export("scrollViewWillBeginDecelerating:")]
public void DecelerationStarted (UIScrollView scrollView)
{
	$end$
}]]>
  </CodeTemplate>
</CodeTemplates>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#229999ff"
    android:minHeight="70dp">

    <android.support.constraint.ConstraintLayout
        android:id="@+id/constraintLayout"
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:background="#33000044"
        android:paddingLeft="@dimen/list_item_padding_horizontal"
        android:paddingRight="@dimen/list_item_padding_horizontal"
        app:layout_constraintBottom_toTopOf="@+id/shadow"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0">

        <ImageView
            android:id="@+id/hourly_weather_icon"
            android:layout_width="38dp"
            android:layout_height="38dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/hourly_date"
            app:layout_constraintVertical_bias="0.4"
            tools:src="@drawable/art_clouds" />

        <TextView
            android:id="@+id/hourly_date"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:fontFamily="sans-serif-condensed"
            android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintBottom_toTopOf="@+id/hourly_weather_icon"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.923"
            tools:text="13:59" />

        <TextView
            android:id="@+id/hourly_weather_description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:fontFamily="sans-serif-condensed"
            android:textAppearance="@style/TextAppearance.AppCompat.Body1"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.19"
            app:layout_constraintLeft_toRightOf="@+id/hourly_weather_icon"
            app:layout_constraintRight_toLeftOf="@+id/hourly_temperature"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="Scattered Clouds" />

        <TextView
            android:id="@+id/hourly_temperature"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:fontFamily="sans-serif-smallcaps"
            android:gravity="end"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="1.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="10\u00b0" />

        <TextView
            android:id="@+id/hourly_precip_intensity"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:fontFamily="sans-serif-condensed"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/hourly_temperature"
            app:layout_constraintHorizontal_bias="0.66"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.19"
            tools:text="Heavy  Shower" />

        <TextView
            android:id="@+id/hourly_wind_speed"
            android:layout_width="wrap_content"
            android:layout_height="18dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:fontFamily="sans-serif-condensed"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.33"
            app:layout_constraintStart_toEndOf="@+id/hourly_precip_intensity"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="4.5Km/h" />

        <TextView
            android:id="@+id/hourly_precip_intensity_value"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-condensed"
            android:textColor="@color/white"
            android:textSize="@dimen/forecast_secondary_text_size"
            app:layout_constraintEnd_toEndOf="@+id/hourly_precip_intensity"
            app:layout_constraintTop_toBottomOf="@+id/hourly_precip_intensity"
            tools:text="1.9mm" />

        <View
            android:id="@+id/hourly_no_precip"
            android:layout_width="25dp"
            android:layout_height="0.5dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:background="@color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.6"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <!--<android.support.constraint.Guideline-->
        <!--android:id="@+id/guideline"-->
        <!--android:layout_width="wrap_content"-->
        <!--android:layout_height="wrap_content"-->
        <!--android:orientation="horizontal"-->
        <!--app:layout_constraintGuide_percent="0.5" />-->

    </android.support.constraint.ConstraintLayout>

    <View
        android:id="@+id/shadow"
        android:layout_width="0dp"
        android:layout_height="10dp"
        android:background="@drawable/shadow_drawable"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

</android.support.constraint.ConstraintLayout>


text:
<?xml version="1.0" encoding="UTF-8"?>
<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
    <!-- The controller elements that are common to all OFBiz components
         can be found in the following xml file. A component can override the
         elements found in the common-controller.xml file. -->
    <include location="component://common/webcommon/WEB-INF/common-controller.xml"/>

    <description>DemoSuite Component Site Configuration File</description>

    <!-- Events to run on every request before security (chains exempt) -->
    <!--
    <preprocessor>
    </preprocessor>
    -->
    <!-- Events to run on every request after all other processing (chains exempt) -->
    <!--
    <postprocessor>
        <event name="test" type="java" path="org.ofbiz.webapp.event.TestEvent" invoke="test"/>
    </postprocessor>
    -->

    <!-- Request Mappings -->
    <request-map uri="main"><security https="true" auth="true"/><response name="success" type="view" value="main"/></request-map>

    <!-- View Mappings -->
    <view-map name="main" type="screen" page="component://demosuite/widget/DemoSuiteScreens.xml#main"/>
</site-conf>