text:
package com.codedisaster.steamworks;

import java.util.Collection;
import java.util.EnumSet;

public class SteamUGC extends SteamInterface {

	public enum UserUGCList {
		Published,
		VotedOn,
		VotedUp,
		VotedDown,
		WillVoteLater,
		Favorited,
		Subscribed,
		UsedOrPlayed,
		Followed
	}

	public enum MatchingUGCType {
		Items(0),
		ItemsMtx(1),
		ItemsReadyToUse(2),
		Collections(3),
		Artwork(4),
		Videos(5),
		Screenshots(6),
		AllGuides(7),
		WebGuides(8),
		IntegratedGuides(9),
		UsableInGame(10),
		ControllerBindings(11),
		GameManagedItems(12),
		All(~0);

		private final int value;

		MatchingUGCType(int value) {
			this.value = value;
		}
	}

	public enum UserUGCListSortOrder {
		CreationOrderDesc,
		CreationOrderAsc,
		TitleAsc,
		LastUpdatedDesc,
		SubscriptionDateDesc,
		VoteScoreDesc,
		ForModeration
	}

	public enum UGCQueryType {
		RankedByVote,
		RankedByPublicationDate,
		AcceptedForGameRankedByAcceptanceDate,
		RankedByTrend,
		FavoritedByFriendsRankedByPublicationDate,
		CreatedByFriendsRankedByPublicationDate,
		RankedByNumTimesReported,
		CreatedByFollowedUsersRankedByPublicationDate,
		NotYetRated,
		RankedByTotalVotesAsc,
		RankedByVotesUp,
		RankedByTextSearch,
		RankedByTotalUniqueSubscriptions,
		RankedByPlaytimeTrend,
		RankedByTotalPlaytime,
		RankedByAveragePlaytimeTrend,
		RankedByLifetimeAveragePlaytime,
		RankedByPlaytimeSessionsTrend,
		RankedByLifetimePlaytimeSessions
	}

	public enum ItemUpdateStatus {
		Invalid,
		PreparingConfig,
		PreparingContent,
		UploadingContent,
		UploadingPreviewFile,
		CommittingChanges;

		private static final ItemUpdateStatus[] values = values();

		static ItemUpdateStatus byOrdinal(int value) {
			return values[value];
		}
	}

	public static class ItemUpdateInfo {
		long bytesProcessed;
		long bytesTotal;

		public long getBytesProcessed() {
			return bytesProcessed;
		}

		public long getBytesTotal() {
			return bytesTotal;
		}
	}

	public enum ItemState {
		None(0),
		Subscribed(1),
		LegacyItem(2),
		Installed(4),
		NeedsUpdate(8),
		Downloading(16),
		DownloadPending(32);

		private final int bits;
		private static final ItemState[] values = values();

		ItemState(int bits) {
			this.bits = bits;
		}

		static Collection<ItemState> fromBits(int bits) {
			EnumSet<ItemState> itemStates = EnumSet.noneOf(ItemState.class);

			for (ItemState itemState : values) {
				if ((bits & itemState.bits) == itemState.bits) {
					itemStates.add(itemState);
				}
			}

			return itemStates;
		}
	}

	public enum ItemStatistic {
		NumSubscriptions,
		NumFavorites,
		NumFollowers,
		NumUniqueSubscriptions,
		NumUniqueFavorites,
		NumUniqueFollowers,
		NumUniqueWebsiteViews,
		ReportScore,
		NumSecondsPlayed,
		NumPlaytimeSessions,
		NumComments,
		NumSecondsPlayedDuringTimePeriod,
		NumPlaytimeSessionsDuringTimePeriod
	}

	public enum ItemPreviewType {
		Image(0),
		YouTubeVideo(1),
		Sketchfab(2),
		EnvironmentMap_HorizontalCross(3),
		EnvironmentMap_LatLong(4),
		ReservedMax(255),

		UnknownPreviewType_NotImplementedByAPI(-1);

		private final int value;
		private static final ItemPreviewType[] values = values();

		ItemPreviewType(int value) {
			this.value = value;
		}

		static ItemPreviewType byValue(int value) {
			for (ItemPreviewType type : values) {
				if (type.value == value) {
					return type;
				}
			}
			return UnknownPreviewType_NotImplementedByAPI;
		}
	}

	@SuppressWarnings("unused")
	public static class ItemInstallInfo {
		private String folder;
		private int sizeOnDisk;

		public String getFolder() {
			return folder;
		}

		public int getSizeOnDisk() {
			return sizeOnDisk;
		}
	}

	public static class ItemDownloadInfo {
		long bytesDownloaded;
		long bytesTotal;

		public long getBytesDownloaded() {
			return bytesDownloaded;
		}

		public long getBytesTotal() {
			return bytesTotal;
		}
	}

	@SuppressWarnings("unused")
	public static class ItemAdditionalPreview {
		private String urlOrVideoID;
		private String originalFileName;
		private int previewType;

		public String getUrlOrVideoID() {
			return urlOrVideoID;
		}

		public String getOriginalFileName() {
			return originalFileName;
		}

		public ItemPreviewType getPreviewType() {
			return ItemPreviewType.byValue(previewType);
		}
	}

	public SteamUGC(SteamUGCCallback callback) {
		super(SteamAPI.getSteamUGCPointer(), createCallback(new SteamUGCCallbackAdapter(callback)));
	}

	public SteamUGCQuery createQueryUserUGCRequest(int accountID, UserUGCList listType,
												   MatchingUGCType matchingType, UserUGCListSortOrder sortOrder,
												   int creatorAppID, int consumerAppID, int page) {

		return new SteamUGCQuery(createQueryUserUGCRequest(pointer, accountID, listType.ordinal(),
				matchingType.value, sortOrder.ordinal(), creatorAppID, consumerAppID, page));
	}

	public SteamUGCQuery createQueryAllUGCRequest(UGCQueryType queryType, MatchingUGCType matchingType,
												  int creatorAppID, int consumerAppID, int page) {

		return new SteamUGCQuery(createQueryAllUGCRequest(pointer, queryType.ordinal(), matchingType.value,
				creatorAppID, consumerAppID, page));
	}

	public SteamUGCQuery createQueryUGCDetailsRequest(SteamPublishedFileID publishedFileID) {
		long[] fileIDs = new long[1];
		fileIDs[0] = publishedFileID.handle;
		return new SteamUGCQuery(createQueryUGCDetailsRequest(pointer, fileIDs, 1));
	}

	public SteamUGCQuery createQueryUGCDetailsRequest(Collection<SteamPublishedFileID> publishedFileIDs) {
		int size = publishedFileIDs.size();
		long[] fileIDs = new long[size];

		int index = 0;
		for (SteamPublishedFileID fileID : publishedFileIDs) {
			fileIDs[index++] = fileID.handle;
		}

		return new SteamUGCQuery(createQueryUGCDetailsRequest(pointer, fileIDs, size));
	}

	public SteamAPICall sendQueryUGCRequest(SteamUGCQuery query) {
		return new SteamAPICall(sendQueryUGCRequest(pointer, callback, query.handle));
	}

	public boolean getQueryUGCResult(SteamUGCQuery query, int index, SteamUGCDetails details) {
		return getQueryUGCResult(pointer, query.handle, index, details);
	}

	public String getQueryUGCPreviewURL(SteamUGCQuery query, int index) {
		return getQueryUGCPreviewURL(pointer, query.handle, index);
	}

	public String getQueryUGCMetadata(SteamUGCQuery query, int index) {
		return getQueryUGCMetadata(pointer, query.handle, index);
	}

	public long getQueryUGCStatistic(SteamUGCQuery query, int index, ItemStatistic statType) {
		return getQueryUGCStatistic(pointer, query.handle, index, statType.ordinal());
	}

	public int getQueryUGCNumAdditionalPreviews(SteamUGCQuery query, int index) {
		return getQueryUGCNumAdditionalPreviews(pointer, query.handle, index);
	}

	public boolean getQueryUGCAdditionalPreview(SteamUGCQuery query, int index, int previewIndex,
												ItemAdditionalPreview previewInfo) {

		return getQueryUGCAdditionalPreview(pointer, query.handle, index, previewIndex, previewInfo);
	}

	public int getQueryUGCNumKeyValueTags(SteamUGCQuery query, int index) {
		return getQueryUGCNumKeyValueTags(pointer, query.handle, index);
	}

	public boolean getQueryUGCKeyValueTag(SteamUGCQuery query, int index, int keyValueTagIndex, String[] keyAndValue) {
		return getQueryUGCKeyValueTag(pointer, query.handle, index, keyValueTagIndex, keyAndValue);
	}

	public boolean releaseQueryUserUGCRequest(SteamUGCQuery query) {
		return releaseQueryUserUGCRequest(pointer, query.handle);
	}

	public boolean addRequiredTag(SteamUGCQuery query, String tagName) {
		return addRequiredTag(pointer, query.handle, tagName);
	}

	public boolean addExcludedTag(SteamUGCQuery query, String tagName) {
		return addExcludedTag(pointer, query.handle, tagName);
	}

	public boolean setReturnOnlyIDs(SteamUGCQuery query, boolean returnOnlyIDs) {
		return setReturnOnlyIDs(pointer, query.handle, returnOnlyIDs);
	}

	public boolean setReturnKeyValueTags(SteamUGCQuery query, boolean returnKeyValueTags) {
		return setReturnKeyValueTags(pointer, query.handle, returnKeyValueTags);
	}

	public boolean setReturnLongDescription(SteamUGCQuery query, boolean returnLongDescription) {
		return setReturnLongDescription(pointer, query.handle, returnLongDescription);
	}

	public boolean setReturnMetadata(SteamUGCQuery query, boolean returnMetadata) {
		return setReturnMetadata(pointer, query.handle, returnMetadata);
	}

	public boolean setReturnChildren(SteamUGCQuery query, boolean returnChildren) {
		return setReturnChildren(pointer, query.handle, returnChildren);
	}

	public boolean setReturnAdditionalPreviews(SteamUGCQuery query, boolean returnAdditionalPreviews) {
		return setReturnAdditionalPreviews(pointer, query.handle, returnAdditionalPreviews);
	}

	public boolean setReturnTotalOnly(SteamUGCQuery query, boolean returnTotalOnly) {
		return setReturnTotalOnly(pointer, query.handle, returnTotalOnly);
	}

	public boolean setReturnPlaytimeStats(SteamUGCQuery query, int days) {
		return setReturnPlaytimeStats(pointer, query.handle, days);
	}

	public boolean setLanguage(SteamUGCQuery query, String language) {
		return setLanguage(pointer, query.handle, language);
	}

	public boolean setAllowCachedResponse(SteamUGCQuery query, int maxAgeSeconds) {
		return setAllowCachedResponse(pointer, query.handle, maxAgeSeconds);
	}

	public boolean setCloudFileNameFilter(SteamUGCQuery query, String matchCloudFileName) {
		return setCloudFileNameFilter(pointer, query.handle, matchCloudFileName);
	}

	public boolean setMatchAnyTag(SteamUGCQuery query, boolean matchAnyTag) {
		return setMatchAnyTag(pointer, query.handle, matchAnyTag);
	}

	public boolean setSearchText(SteamUGCQuery query, String searchText) {
		return setSearchText(pointer, query.handle, searchText);
	}

	public boolean setRankedByTrendDays(SteamUGCQuery query, int days) {
		return setRankedByTrendDays(pointer, query.handle, days);
	}

	public boolean addRequiredKeyValueTag(SteamUGCQuery query, String key, String value) {
		return addRequiredKeyValueTag(pointer, query.handle, key, value);
	}

	@Deprecated // API docs: use createQueryUGCDetailsRequest call instead
	public SteamAPICall requestUGCDetails(SteamPublishedFileID publishedFileID, int maxAgeSeconds) {
		return new SteamAPICall(requestUGCDetails(pointer, callback, publishedFileID.handle, maxAgeSeconds));
	}

	public SteamAPICall createItem(int consumerAppID, SteamRemoteStorage.WorkshopFileType fileType) {
		return new SteamAPICall(createItem(pointer, callback, consumerAppID, fileType.ordinal()));
	}

	public SteamUGCUpdateHandle startItemUpdate(int consumerAppID, SteamPublishedFileID publishedFileID) {
		return new SteamUGCUpdateHandle(startItemUpdate(pointer, consumerAppID, publishedFileID.handle));
	}

	public boolean setItemTitle(SteamUGCUpdateHandle update, String title) {
		return setItemTitle(pointer, update.handle, title);
	}

	public boolean setItemDescription(SteamUGCUpdateHandle update, String description) {
		return setItemDescription(pointer, update.handle, description);
	}

	public boolean setItemUpdateLanguage(SteamUGCUpdateHandle update, String language) {
		return setItemUpdateLanguage(pointer, update.handle, language);
	}

	public boolean setItemMetadata(SteamUGCUpdateHandle update, String metaData) {
		return setItemMetadata(pointer, update.handle, metaData);
	}

	public boolean setItemVisibility(SteamUGCUpdateHandle update,
									 SteamRemoteStorage.PublishedFileVisibility visibility) {

		return setItemVisibility(pointer, update.handle, visibility.ordinal());
	}

	public boolean setItemTags(SteamUGCUpdateHandle update, String[] tags) {
		return setItemTags(pointer, update.handle, tags, tags.length);
	}

	public boolean setItemContent(SteamUGCUpdateHandle update, String contentFolder) {
		return setItemContent(pointer, update.handle, contentFolder);
	}

	public boolean setItemPreview(SteamUGCUpdateHandle update, String previewFile) {
		return setItemPreview(pointer, update.handle, previewFile);
	}

	public boolean removeItemKeyValueTags(SteamUGCUpdateHandle update, String key) {
		return removeItemKeyValueTags(pointer, update.handle, key);
	}

	public boolean addItemKeyValueTag(SteamUGCUpdateHandle update, String key, String value) {
		return addItemKeyValueTag(pointer, update.handle, key, value);
	}

	public SteamAPICall submitItemUpdate(SteamUGCUpdateHandle update, String changeNote) {
		return new SteamAPICall(submitItemUpdate(pointer, callback, update.handle, changeNote));
	}

	public ItemUpdateStatus getItemUpdateProgress(SteamUGCUpdateHandle update, ItemUpdateInfo updateInfo) {
		long[] values = new long[2];
		ItemUpdateStatus status = ItemUpdateStatus.byOrdinal(getItemUpdateProgress(pointer, update.handle, values));
		updateInfo.bytesProcessed = values[0];
		updateInfo.bytesTotal = values[1];
		return status;
	}

	public SteamAPICall setUserItemVote(SteamPublishedFileID publishedFileID, boolean voteUp) {
		return new SteamAPICall(setUserItemVote(pointer, callback, publishedFileID.handle, voteUp));
	}

	public SteamAPICall getUserItemVote(SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(getUserItemVote(pointer, callback, publishedFileID.handle));
	}

	public SteamAPICall addItemToFavorites(int appID, SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(addItemToFavorites(pointer, callback, appID, publishedFileID.handle));
	}

	public SteamAPICall removeItemFromFavorites(int appID, SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(removeItemFromFavorites(pointer, callback, appID, publishedFileID.handle));
	}

	public SteamAPICall subscribeItem(SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(subscribeItem(pointer, callback, publishedFileID.handle));
	}

	public SteamAPICall unsubscribeItem(SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(unsubscribeItem(pointer, callback, publishedFileID.handle));
	}

	public int getNumSubscribedItems() {
		return getNumSubscribedItems(pointer);
	}

	public int getSubscribedItems(SteamPublishedFileID[] publishedFileIds) {
		long[] ids = new long[publishedFileIds.length];
		int nb = getSubscribedItems(pointer, ids, publishedFileIds.length);

		for (int i = 0; i < nb; i++) {
			publishedFileIds[i] = new SteamPublishedFileID(ids[i]);
		}

		return nb;
	}

	public Collection<ItemState> getItemState(SteamPublishedFileID publishedFileID) {
		return ItemState.fromBits(getItemState(pointer, publishedFileID.handle));
	}

	public boolean getItemInstallInfo(SteamPublishedFileID publishedFileID, ItemInstallInfo installInfo) {
		return getItemInstallInfo(pointer, publishedFileID.handle, installInfo);
	}

	public boolean getItemDownloadInfo(SteamPublishedFileID publishedFileID, ItemDownloadInfo downloadInfo) {
		long[] values = new long[2];
		if (getItemDownloadInfo(pointer, publishedFileID.handle, values)) {
			downloadInfo.bytesDownloaded = values[0];
			downloadInfo.bytesTotal = values[1];
			return true;
		}
		return false;
	}

	public SteamAPICall deleteItem(SteamPublishedFileID publishedFileID) {
		return new SteamAPICall(deleteItem(pointer, callback, publishedFileID.handle));
	}

	public boolean downloadItem(SteamPublishedFileID publishedFileID, boolean highPriority) {
		return downloadItem(pointer, publishedFileID.handle, highPriority);
	}

	public boolean initWorkshopForGameServer(int workshopDepotID, String folder) {
		return initWorkshopForGameServer(pointer, workshopDepotID, folder);
	}

	public void suspendDownloads(boolean suspend) {
		suspendDownloads(pointer, suspend);
	}

	public SteamAPICall startPlaytimeTracking(SteamPublishedFileID[] publishedFileIDs) {
		long[] ids = new long[publishedFileIDs.length];

		for (int i = 0; i < ids.length; i++) {
			ids[i] = publishedFileIDs[i].handle;
		}

		return new SteamAPICall(startPlaytimeTracking(pointer, callback, ids, ids.length));
	}

	public SteamAPICall stopPlaytimeTracking(SteamPublishedFileID[] publishedFileIDs) {
		long[] ids = new long[publishedFileIDs.length];

		for (int i = 0; i < ids.length; i++) {
			ids[i] = publishedFileIDs[i].handle;
		}

		return new SteamAPICall(stopPlaytimeTracking(pointer, callback, ids, ids.length));
	}

	public SteamAPICall stopPlaytimeTrackingForAllItems() {
		return new SteamAPICall(stopPlaytimeTrackingForAllItems(pointer, callback));
	}

	// @off

	/*JNI
		#include "SteamUGCCallback.h"
	*/

	private static native long createCallback(SteamUGCCallbackAdapter javaCallback); /*
		return (intp) new SteamUGCCallback(env, javaCallback);
	*/

	private static native long createQueryUserUGCRequest(long pointer, int accountID, int listType,
														 int matchingType, int sortOrder,
														 int creatorAppID, int consumerAppID, int page); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		UGCQueryHandle_t query = ugc->CreateQueryUserUGCRequest(accountID, (EUserUGCList) listType,
			(EUGCMatchingUGCType) matchingType, (EUserUGCListSortOrder) sortOrder, creatorAppID, consumerAppID, page);
		return (intp) query;
	*/

	private static native long createQueryAllUGCRequest(long pointer, int queryType, int matchingType,
														int creatorAppID, int consumerAppID, int page); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		UGCQueryHandle_t query = ugc->CreateQueryAllUGCRequest((EUGCQuery) queryType,
			(EUGCMatchingUGCType) matchingType, creatorAppID, consumerAppID, page);
		return (intp) query;
	*/

	private static native long createQueryUGCDetailsRequest(long pointer, long[] publishedFileIDs, int numPublishedFileIDs); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		UGCQueryHandle_t query = ugc->CreateQueryUGCDetailsRequest((PublishedFileId_t*) publishedFileIDs, numPublishedFileIDs);
		return (intp) query;
	*/

	private static native long sendQueryUGCRequest(long pointer, long callback, long query); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->SendQueryUGCRequest(query);
		cb->onUGCQueryCompletedCall.Set(handle, cb, &SteamUGCCallback::onUGCQueryCompleted);
		return handle;
	*/

	private static native boolean getQueryUGCResult(long pointer, long query, int index, SteamUGCDetails details); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCDetails_t result;

		if (ugc->GetQueryUGCResult(query, index, &result)) {
			jclass clazz = env->GetObjectClass(details);

			jfieldID field = env->GetFieldID(clazz, "publishedFileID", "J");
			env->SetLongField(details, field, (jlong) result.m_nPublishedFileId);

			field = env->GetFieldID(clazz, "result", "I");
			env->SetIntField(details, field, (jint) result.m_eResult);

			field = env->GetFieldID(clazz, "fileType", "I");
			env->SetIntField(details, field, (jint) result.m_eFileType);

			jstring title = env->NewStringUTF(result.m_rgchTitle);
			field = env->GetFieldID(clazz, "title", "Ljava/lang/String;");
			env->SetObjectField(details, field, title);

			jstring description = env->NewStringUTF(result.m_rgchDescription);
			field = env->GetFieldID(clazz, "description", "Ljava/lang/String;");
			env->SetObjectField(details, field, description);

			field = env->GetFieldID(clazz, "ownerID", "J");
			env->SetLongField(details, field, (jlong) result.m_ulSteamIDOwner);

			field = env->GetFieldID(clazz, "timeCreated", "I");
			env->SetIntField(details, field, (jint) result.m_rtimeCreated);

			field = env->GetFieldID(clazz, "timeUpdated", "I");
			env->SetIntField(details, field, (jint) result.m_rtimeUpdated);

			field = env->GetFieldID(clazz, "tagsTruncated", "Z");
			env->SetBooleanField(details, field, (jboolean) result.m_bTagsTruncated);

			jstring tags = env->NewStringUTF(result.m_rgchTags);
			field = env->GetFieldID(clazz, "tags", "Ljava/lang/String;");
			env->SetObjectField(details, field, tags);

			field = env->GetFieldID(clazz, "fileHandle", "J");
			env->SetLongField(details, field, (jlong) result.m_hFile);

			field = env->GetFieldID(clazz, "previewFileHandle", "J");
			env->SetLongField(details, field, (jlong) result.m_hPreviewFile);

			jstring fileName = env->NewStringUTF(result.m_pchFileName);
			field = env->GetFieldID(clazz, "fileName", "Ljava/lang/String;");
			env->SetObjectField(details, field, fileName);

			field = env->GetFieldID(clazz, "fileSize", "I");
			env->SetIntField(details, field, (jint) result.m_nFileSize);

			field = env->GetFieldID(clazz, "previewFileSize", "I");
			env->SetIntField(details, field, (jint) result.m_nPreviewFileSize);

			jstring url = env->NewStringUTF(result.m_rgchURL);
			field = env->GetFieldID(clazz, "url", "Ljava/lang/String;");
			env->SetObjectField(details, field, url);

			field = env->GetFieldID(clazz, "votesUp", "I");
			env->SetIntField(details, field, (jint) result.m_unVotesUp);

			field = env->GetFieldID(clazz, "votesDown", "I");
			env->SetIntField(details, field, (jint) result.m_unVotesDown);

			return true;
		}

		return false;
	*/

	private static native String getQueryUGCPreviewURL(long pointer, long query, int index); /*
		char url[1024];

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		if (ugc->GetQueryUGCPreviewURL(query, index, url, 1024)) {
			return env->NewStringUTF(url);
		}

		return nullptr;
	*/

	private static native String getQueryUGCMetadata(long pointer, long query, int index); /*
		char metadata[k_cchDeveloperMetadataMax];

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		if (ugc->GetQueryUGCMetadata(query, index, metadata, k_cchDeveloperMetadataMax)) {
			return env->NewStringUTF(metadata);
		}

		return nullptr;
	*/

//	private static native boolean getQueryUGCChildren(long pointer, long query, int index,
//													  long[] publishedFileIDs, long maxEntries);

	private static native long getQueryUGCStatistic(long pointer, long query, int index, int statType); /*
		uint64 statValue;

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		if (ugc->GetQueryUGCStatistic(query, index, (EItemStatistic) statType, &statValue)) {
			return statValue;
		}

		return 0;
	*/

	private static native int getQueryUGCNumAdditionalPreviews(long pointer, long query, int index); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->GetQueryUGCNumAdditionalPreviews(query, index);
	*/

	private static native boolean getQueryUGCAdditionalPreview(long pointer, long query, int index,
															   int previewIndex, ItemAdditionalPreview previewData); /*
		char url[1024];
		char fileName[1024];
		EItemPreviewType type;

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		bool success = ugc->GetQueryUGCAdditionalPreview(query, index, previewIndex, url, 1024, fileName, 1024, &type);

		if (success) {
			jclass clazz = env->GetObjectClass(previewData);

			jstring urlOrVideoID = env->NewStringUTF(url);
			jfieldID field = env->GetFieldID(clazz, "urlOrVideoID", "Ljava/lang/String;");
			env->SetObjectField(previewData, field, urlOrVideoID);

			jstring originalFileName = env->NewStringUTF(fileName);
			field = env->GetFieldID(clazz, "originalFileName", "Ljava/lang/String;");
			env->SetObjectField(previewData, field, originalFileName);

			field = env->GetFieldID(clazz, "previewType", "I");
			env->SetIntField(previewData, field, (jint) type);
		}

		return success;
	*/

	private static native int getQueryUGCNumKeyValueTags(long pointer, long query, int index); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->GetQueryUGCNumKeyValueTags(query, index);
	*/

	private static native boolean getQueryUGCKeyValueTag(long pointer, long query, int index, int keyValueTagIndex, String[] keyAndValue); /*
		char key[1024];
		char value[1024];

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		bool success = ugc->GetQueryUGCKeyValueTag(query, index, keyValueTagIndex, key, 1024, value, 1024);

		if (success) {
			env->SetObjectArrayElement(keyAndValue, 0, env->NewStringUTF(key));
			env->SetObjectArrayElement(keyAndValue, 1, env->NewStringUTF(value));
		}

		return success;
	*/

	private static native boolean releaseQueryUserUGCRequest(long pointer, long query); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->ReleaseQueryUGCRequest(query);
	*/

	private static native boolean addRequiredTag(long pointer, long query, String tagName); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->AddRequiredTag(query, tagName);
	*/

	private static native boolean addExcludedTag(long pointer, long query, String tagName); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->AddExcludedTag(query, tagName);
	*/

	private static native boolean setReturnOnlyIDs(long pointer, long query, boolean returnOnlyIDs); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnOnlyIDs(query, returnOnlyIDs);
	*/

	private static native boolean setReturnKeyValueTags(long pointer, long query, boolean returnKeyValueTags); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnKeyValueTags(query, returnKeyValueTags);
	*/

	private static native boolean setReturnLongDescription(long pointer, long query, boolean returnLongDescription); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnLongDescription(query, returnLongDescription);
	*/

	private static native boolean setReturnMetadata(long pointer, long query, boolean returnMetadata); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnMetadata(query, returnMetadata);
	*/

	private static native boolean setReturnChildren(long pointer, long query, boolean returnChildren); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnChildren(query, returnChildren);
	*/

	private static native boolean setReturnAdditionalPreviews(long pointer, long query, boolean returnAdditionalPreviews); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnAdditionalPreviews(query, returnAdditionalPreviews);
	*/

	private static native boolean setReturnTotalOnly(long pointer, long query, boolean returnTotalOnly); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnTotalOnly(query, returnTotalOnly);
	*/

	private static native boolean setReturnPlaytimeStats(long pointer, long query, int days); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetReturnPlaytimeStats(query, (uint32) days);
	*/

	private static native boolean setLanguage(long pointer, long query, String language); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetLanguage(query, language);
	*/

	private static native boolean setAllowCachedResponse(long pointer, long query, int maxAgeSeconds); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetAllowCachedResponse(query, maxAgeSeconds);
	*/

	private static native boolean setCloudFileNameFilter(long pointer, long query, String matchCloudFileName); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetCloudFileNameFilter(query, matchCloudFileName);
	*/

	private static native boolean setMatchAnyTag(long pointer, long query, boolean matchAnyTag); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetMatchAnyTag(query, matchAnyTag);
	*/

	private static native boolean setSearchText(long pointer, long query, String searchText); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetSearchText(query, searchText);
	*/

	private static native boolean setRankedByTrendDays(long pointer, long query, int days); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetRankedByTrendDays(query, days);
	*/

	private static native boolean addRequiredKeyValueTag(long pointer, long query, String key, String value); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->AddRequiredKeyValueTag(query, key, value);
	*/

	private static native long requestUGCDetails(long pointer, long callback, long publishedFileID, int maxAgeSeconds); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->RequestUGCDetails(publishedFileID, maxAgeSeconds);
		cb->onRequestUGCDetailsCall.Set(handle, cb, &SteamUGCCallback::onRequestUGCDetails);
		return handle;
	*/

	private static native long createItem(long pointer, long callback, int consumerAppID, int fileType); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->CreateItem(consumerAppID, (EWorkshopFileType) fileType);
		cb->onCreateItemCall.Set(handle, cb, &SteamUGCCallback::onCreateItem);
		return handle;
	*/

	private static native long startItemUpdate(long pointer, int consumerAppID, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->StartItemUpdate(consumerAppID, publishedFileID);
	*/

	private static native boolean setItemTitle(long pointer, long update, String title); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemTitle(update, title);
	*/

	private static native boolean setItemDescription(long pointer, long update, String description); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemDescription(update, description);
	*/

	private static native boolean setItemUpdateLanguage(long pointer, long update, String language); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemUpdateLanguage(update, language);
	*/

	private static native boolean setItemMetadata(long pointer, long update, String metaData); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemMetadata(update, metaData);
	*/

	private static native boolean setItemVisibility(long pointer, long update, int visibility); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemVisibility(update, (ERemoteStoragePublishedFileVisibility) visibility);
	*/

	private static native boolean setItemTags(long pointer, long update, String[] tags, int numTags); /*
		SteamParamStringArray_t arrayTags;
		arrayTags.m_ppStrings = (numTags > 0) ? new const char*[numTags] : NULL;
		arrayTags.m_nNumStrings = numTags;
		for (int t = 0; t < numTags; t++) {
			arrayTags.m_ppStrings[t] = env->GetStringUTFChars((jstring) env->GetObjectArrayElement(tags, t), 0);
		}

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		bool result = ugc->SetItemTags(update, &arrayTags);

		for (int t = 0; t < numTags; t++) {
			env->ReleaseStringUTFChars((jstring) env->GetObjectArrayElement(tags, t), arrayTags.m_ppStrings[t]);
		}
		delete[] arrayTags.m_ppStrings;

		return result;
	*/

	private static native boolean setItemContent(long pointer, long update, String contentFolder); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemContent(update, contentFolder);
	*/

	private static native boolean setItemPreview(long pointer, long update, String previewFile); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->SetItemPreview(update, previewFile);
	*/

	private static native boolean removeItemKeyValueTags(long pointer, long update, String key); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->RemoveItemKeyValueTags(update, key);
	*/

	private static native boolean addItemKeyValueTag(long pointer, long update, String key, String value); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->AddItemKeyValueTag(update, key, value);
	*/

	private static native long submitItemUpdate(long pointer, long callback, long update, String changeNote); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->SubmitItemUpdate(update, changeNote);
		cb->onSubmitItemUpdateCall.Set(handle, cb, &SteamUGCCallback::onSubmitItemUpdate);
		return handle;
	*/

	private static native int getItemUpdateProgress(long pointer, long update, long[] bytesProcessedAndTotal); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		uint64* values = (uint64*) bytesProcessedAndTotal;
		return ugc->GetItemUpdateProgress(update, &values[0], &values[1]);
	*/

	private static native long setUserItemVote(long pointer, long callback, long publishedFileID, boolean voteUp); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->SetUserItemVote(publishedFileID, voteUp);
		cb->onSetUserItemVoteCall.Set(handle, cb, &SteamUGCCallback::onSetUserItemVote);
		return handle;
	*/

	private static native long getUserItemVote(long pointer, long callback, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->GetUserItemVote(publishedFileID);
		cb->onGetUserItemVoteCall.Set(handle, cb, &SteamUGCCallback::onGetUserItemVote);
		return handle;
	*/

	private static native long addItemToFavorites(long pointer, long callback, int appID, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->AddItemToFavorites(appID, publishedFileID);
		cb->onUserFavoriteItemsListChangedCall.Set(handle, cb, &SteamUGCCallback::onUserFavoriteItemsListChanged);
		return handle;
	*/

	private static native long removeItemFromFavorites(long pointer, long callback, int appID, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->RemoveItemFromFavorites(appID, publishedFileID);
		cb->onUserFavoriteItemsListChangedCall.Set(handle, cb, &SteamUGCCallback::onUserFavoriteItemsListChanged);
		return handle;
	*/

	private static native long subscribeItem(long pointer, long callback, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->SubscribeItem(publishedFileID);
		cb->onSubscribeItemCall.Set(handle, cb, &SteamUGCCallback::onSubscribeItem);
		return handle;
	 */

	private static native long unsubscribeItem(long pointer, long callback, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->UnsubscribeItem(publishedFileID);
		cb->onUnsubscribeItemCall.Set(handle, cb, &SteamUGCCallback::onUnsubscribeItem);
		return handle;
	 */

	private static native int getNumSubscribedItems(long pointer); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->GetNumSubscribedItems();
	*/

	private static native int getSubscribedItems(long pointer, long[] files, int maxEntries); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->GetSubscribedItems((PublishedFileId_t*) files, maxEntries);
	*/

	private static native int getItemState(long pointer, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->GetItemState(publishedFileID);
	*/

	private static native boolean getItemInstallInfo(long pointer, long publishedFileID, ItemInstallInfo installInfo); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;

		char folder[1024];
		uint64 sizeOnDisk;
		uint32 timeStamp;

		if (ugc->GetItemInstallInfo(publishedFileID, &sizeOnDisk, folder, 1024, &timeStamp)) {

			jclass clzz = env->GetObjectClass(installInfo);

			jstring folderString = env->NewStringUTF(folder);
			jfieldID field = env->GetFieldID(clzz, "folder", "Ljava/lang/String;");
			env->SetObjectField(installInfo, field, folderString);

			field = env->GetFieldID(clzz, "sizeOnDisk", "I");
			env->SetIntField(installInfo, field, (jint) sizeOnDisk);

			return true;
		}

		return false;
	*/

	private static native boolean getItemDownloadInfo(long pointer, long publishedFileID,
													  long[] bytesDownloadedAndTotal); /*

		ISteamUGC* ugc = (ISteamUGC*) pointer;
		uint64* values = (uint64*) bytesDownloadedAndTotal;
		return ugc->GetItemDownloadInfo(publishedFileID, &values[0], &values[1]);
	*/

	private static native long deleteItem(long pointer, long callback, long publishedFileID); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->DeleteItem(publishedFileID);
		cb->onDeleteItemCall.Set(handle, cb, &SteamUGCCallback::onDeleteItem);
		return handle;
	*/

	private static native boolean downloadItem(long pointer, long publishedFileID, boolean highPriority); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->DownloadItem(publishedFileID, highPriority);
	*/

	private static native boolean initWorkshopForGameServer(long pointer, int workshopDepotID, String folder); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		return ugc->BInitWorkshopForGameServer(workshopDepotID, folder);
	*/

	private static native void suspendDownloads(long pointer, boolean suspend); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		ugc->SuspendDownloads(suspend);
	*/

	private static native long startPlaytimeTracking(long pointer, long callback, long[] publishedFileIDs, int numPublishedFileIDs); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->StartPlaytimeTracking((PublishedFileId_t*) publishedFileIDs, numPublishedFileIDs);
		cb->onStartPlaytimeTrackingCall.Set(handle, cb, &SteamUGCCallback::onStartPlaytimeTracking);
		return handle;
	*/

	private static native long stopPlaytimeTracking(long pointer, long callback, long[] publishedFileIDs, int numPublishedFileIDs); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->StopPlaytimeTracking((PublishedFileId_t*) publishedFileIDs, numPublishedFileIDs);
		cb->onStopPlaytimeTrackingCall.Set(handle, cb, &SteamUGCCallback::onStopPlaytimeTracking);
		return handle;
	*/

	private static native long stopPlaytimeTrackingForAllItems(long pointer, long callback); /*
		ISteamUGC* ugc = (ISteamUGC*) pointer;
		SteamUGCCallback* cb = (SteamUGCCallback*) callback;
		SteamAPICall_t handle = ugc->StopPlaytimeTrackingForAllItems();
		cb->onStopPlaytimeTrackingForAllItemsCall.Set(handle, cb, &SteamUGCCallback::onStopPlaytimeTrackingForAllItems);
		return handle;
	*/

}


text:
namespace UiLib
{

	LPCTSTR CCheckBoxUI::GetClass() const
	{
		return _T("CheckBoxUI");
	}

	void CCheckBoxUI::SetCheck(bool bCheck)
	{
		Selected(bCheck);
	}

	bool  CCheckBoxUI::GetCheck() const
	{
		return IsSelected();
	}
}

redpajama_set_name: RedPajamaGithub


text:
package com.lynn.filepicker.entity;

import android.os.Parcel;
import android.os.Parcelable;

public class AudioFile extends BaseFile implements Parcelable {
    private long duration;

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(getId());
        dest.writeString(getName());
        dest.writeString(getPath());
        dest.writeLong(getSize());
        dest.writeString(getBucketId());
        dest.writeString(getBucketName());
        dest.writeLong(getDate());
        dest.writeByte((byte) (isSelected() ? 1 : 0));
        dest.writeLong(getDuration());
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<AudioFile> CREATOR = new Creator<AudioFile>() {
        @Override
        public AudioFile[] newArray(int size) {
            return new AudioFile[size];
        }

        @Override
        public AudioFile createFromParcel(Parcel in) {
            AudioFile file = new AudioFile();
            file.setId(in.readLong());
            file.setName(in.readString());
            file.setPath(in.readString());
            file.setSize(in.readLong());
            file.setBucketId(in.readString());
            file.setBucketName(in.readString());
            file.setDate(in.readLong());
            file.setSelected(in.readByte() != 0);
            file.setDuration(in.readLong());
            return file;
        }
    };
}


text:
import React from "react"

/**
 * DSC contact form
 */

const ContactForm = () => (

      For questions, comments, or suggestions, please send us an email

        (dictystocks@northwestern.edu)

      .

We will be adding a working contact form soon.

)

export default ContactForm


text:
import { call, put, takeEvery, spawn, take } from 'redux-saga/effects';

// App
import channelHelper from './channel-helper';
import { addCheckin, deleteCheckin, clearCheckins, receiveCheckins } from '../reducers/checkin.reducer';
import { logout, receiveUser } from '../reducers/user.reducer';

import * as api from '../api';

const channels = channelHelper(ref => emit => {
  ref.on('value', snap => emit({
    teamId: snap.key,
    checkins: snap.val()
  }));

  return () => ref.off();
});

const getTeams = ({ teams } = {}) => teams ? teams : {};

const getPaths = payload => Object.keys(getTeams(payload)).map(teamId => `checkins/${teamId}`);

export function* checkinsListener(channel) {
  try {
    while (true) {
      const payload = yield take(channel);
      if (payload.checkins) {
        yield put(receiveCheckins(payload));
      }
    }
  } catch ({ message }) {
    console.error(message);
  }
};

export function* handleUserLogout() {
  try {
    yield put(clearCheckins());
    yield call(channels.destroy);
  } catch ({ message }) {
    console.error(message);
  }
};

export function* handleAddCheckin(action) {
  try {
    yield call(api.saveCheckin, action.payload);
  } catch ({ message }) {
    console.error(message);
  }
};

export function* handleDeleteCheckin(action) {
  try {
    yield call(api.deleteCheckin, action.payload);
  } catch ({ message }) {
    console.error(message);
  }
};

export function* handleReceiveUser({ payload } = {}) {
  try {
    yield* channels.init(getPaths(payload)).map(channel => spawn(checkinsListener, channel));
  } catch ({ message }) {
    console.error(message);
  }
};

function* checkinRootSaga() {
  yield takeEvery(logout().type, handleUserLogout);
  yield takeEvery(receiveUser().type, handleReceiveUser);
  yield takeEvery(addCheckin().type, handleAddCheckin);
  yield takeEvery(deleteCheckin().type, handleDeleteCheckin);
};

export default checkinRootSaga;


text:
#ifndef USBDEVICE_H
#define USBDEVICE_H

#include <QtCore/QObject>
#include <QtCore/QSharedDataPointer>

class libusb_device;

namespace UsbNotifier {

class UsbDevicePrivate;

/**
 * @class UsbDevice
 * @brief rappresentation of a UsbDevice
 *
 * A class used to rappresent a usb device detected by libusb
 *
 * @author Francesco Nwokeka <francesco.nwokeka@gmail.com>
 */

class UsbDevice : public QObject
{
    Q_OBJECT

public:
    UsbDevice(const UsbDevice &dev);
    UsbDevice(int address
            , int busNumber
            , int vendorId
            , int portNumber
            , int productId
            , char *manufacturer
            , char *product
            , libusb_device *device
            , QObject *parent = 0);
    UsbDevice(QObject* parent = 0);

    virtual ~UsbDevice();

    /** @return the usb address for the device */
    int address() const;

    /** @return the usb bus number of the device */
    int busNumber() const;

    /** @return the manufacturer of the device */
    QString manufacturer() const;

    /** @return the usb port number */
    int portNumber() const;

    /** @return the device product name */
    QString product() const;

    /** @return the device product id */
    int productId() const;

    /** @return the device vendor id */
    int vendorId() const;

private:
    QSharedDataPointer<UsbDevicePrivate> d;
};

};

#endif  // USBDEVICE_H


text:
(function () {
    'use strict';

    angular.module('ServerApp')
        .controller('adminCountdownReEnableController', adminCountdownReEnableController);

    function adminCountdownReEnableController(changeConfigFactory, $scope, hotkeys, connectFactory) {
        var self = this;
        self.reEnable = false;
        changeConfigFactory.onChangeConfigAdmin(onChangeConfigAdmin);
        connectFactory.onHelloAck(addHotkey);
        $scope.$watch('reEnableCtrl.reEnable', onChangeReEnable);

        function addHotkey(){
            hotkeys.add({
                combo: 'o',
                description: 'enable/disable auto enabling of buzzers after end of countdown',
                callback: function() {
                    self.reEnable = !self.reEnable;
                }
            });
        }

        function onChangeConfigAdmin(data) {
            self.reEnable = data.buzzersAutoEnable;
        }

        function onChangeReEnable(newValue, oldValue) {
            if(newValue == undefined){
                return
            }
            if (newValue != oldValue) {
                changeConfigFactory.changeBuzzReEnable(newValue);
            }
        }
    }
})();


text:
<!doctype html>

  <title>React Redux Starter Kit</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">


text:
package unnamed.sync;

import java.util.Set;

public interface ISyncListener {
    void onSync(Set<ISyncableObject> changes);
}


text:
mainApp.factory('busObjFns', businessObjFns);

function businessObjFns() { // extend the highcharts data with this angular service
    function propertySort(tableData, entireDataObj) {
        tableData.sort(function(a, b) {  // sorts the table data by the category or name order
            var propertyA = entireDataObj.businessLogic.nameSort ? a.name.toLowerCase() : a.category.toLowerCase(),
                propertyB = entireDataObj.businessLogic.nameSort ? b.name.toLowerCase() : b.category.toLowerCase();

            if (propertyA < propertyB) {
                return -1;
            }

            if (propertyA > propertyB) {
                return 1;
            }

            return 0; // default value no sorting
        });
    }

    function moveToEnd(entireDataObj, tableData) { // http://stackoverflow.com/questions/5306680/move-an-array-element-from-one-array-position-to-another
        var busLogArray = entireDataObj.businessLogic.moveToEnd; // business logic names to be moved

        function moveDataToEnd (dataArray, old_index) {
            if (dataArray.length-1 >= dataArray.length) {
                var k = (dataArray.length-1) - dataArray.length;
                while ((k--) + 1) {
                    dataArray.push(undefined);
                }
            }
            // dataArray.splice(old_index, 1)[0] splices out the old element and then the dataArray.push(); adds it to the end of the array
            // 'splice' returns the element that was spliced out, but it's in an array. So we take the first index of that array to get the value we want.
            dataArray.push(dataArray.splice(old_index, 1)[0]);
        }

        var x = tableData.length;

        while (x--) { // iterate through the array backwards because of the splicing
            if (busLogArray.indexOf(tableData[x].name) > -1) {
                moveDataToEnd(tableData, x);
            }
        }

        return tableData;
    }

    return {
        propertySort: propertySort,
        moveToEnd: moveToEnd
    };
}


text:
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Analytics.Synapse.Artifacts.Models;
using Azure.Core;
using Azure.Core.Pipeline;

namespace Azure.Analytics.Synapse.Artifacts
{
    internal partial class PipelineRestClient
    {
        private string endpoint;
        private string apiVersion;
        private ClientDiagnostics _clientDiagnostics;
        private HttpPipeline _pipeline;

        /// <summary> Initializes a new instance of PipelineRestClient. </summary>
        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
        /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. </param>
        /// <param name="apiVersion"> Api Version. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="apiVersion"/> is null. </exception>
        public PipelineRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2019-06-01-preview")
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (apiVersion == null)
            {
                throw new ArgumentNullException(nameof(apiVersion));
            }

            this.endpoint = endpoint;
            this.apiVersion = apiVersion;
            _clientDiagnostics = clientDiagnostics;
            _pipeline = pipeline;
        }

        internal HttpMessage CreateGetPipelinesByWorkspaceRequest()
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/pipelines", false);
            uri.AppendQuery("api-version", apiVersion, true);
            request.Uri = uri;
            request.Headers.Add("Accept", "application/json");
            return message;
        }

        /// <summary> Lists pipelines. </summary>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public async Task<Response<PipelineListResponse>> GetPipelinesByWorkspaceAsync(CancellationToken cancellationToken = default)
        {
            using var message = CreateGetPipelinesByWorkspaceRequest();
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineListResponse value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Lists pipelines. </summary>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public Response<PipelineListResponse> GetPipelinesByWorkspace(CancellationToken cancellationToken = default)
        {
            using var message = CreateGetPipelinesByWorkspaceRequest();
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineListResponse value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal HttpMessage CreateCreateOrUpdatePipelineRequest(string pipelineName, PipelineResource pipeline, string ifMatch)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Put;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/pipelines/", false);
            uri.AppendPath(pipelineName, true);
            uri.AppendQuery("api-version", apiVersion, true);
            request.Uri = uri;
            if (ifMatch != null)
            {
                request.Headers.Add("If-Match", ifMatch);
            }
            request.Headers.Add("Content-Type", "application/json");
            request.Headers.Add("Accept", "application/json");
            var content = new Utf8JsonRequestContent();
            content.JsonWriter.WriteObjectValue(pipeline);
            request.Content = content;
            return message;
        }

        /// <summary> Creates or updates a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="pipeline"> Pipeline resource definition. </param>
        /// <param name="ifMatch"> ETag of the pipeline entity.  Should only be specified for update, for which it should match existing entity or can be * for unconditional update. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> or <paramref name="pipeline"/> is null. </exception>
        public async Task<Response> CreateOrUpdatePipelineAsync(string pipelineName, PipelineResource pipeline, string ifMatch = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }
            if (pipeline == null)
            {
                throw new ArgumentNullException(nameof(pipeline));
            }

            using var message = CreateCreateOrUpdatePipelineRequest(pipelineName, pipeline, ifMatch);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                case 202:
                    return message.Response;
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Creates or updates a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="pipeline"> Pipeline resource definition. </param>
        /// <param name="ifMatch"> ETag of the pipeline entity.  Should only be specified for update, for which it should match existing entity or can be * for unconditional update. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> or <paramref name="pipeline"/> is null. </exception>
        public Response CreateOrUpdatePipeline(string pipelineName, PipelineResource pipeline, string ifMatch = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }
            if (pipeline == null)
            {
                throw new ArgumentNullException(nameof(pipeline));
            }

            using var message = CreateCreateOrUpdatePipelineRequest(pipelineName, pipeline, ifMatch);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                case 202:
                    return message.Response;
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal HttpMessage CreateGetPipelineRequest(string pipelineName, string ifNoneMatch)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/pipelines/", false);
            uri.AppendPath(pipelineName, true);
            uri.AppendQuery("api-version", apiVersion, true);
            request.Uri = uri;
            if (ifNoneMatch != null)
            {
                request.Headers.Add("If-None-Match", ifNoneMatch);
            }
            request.Headers.Add("Accept", "application/json");
            return message;
        }

        /// <summary> Gets a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public async Task<Response<PipelineResource>> GetPipelineAsync(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateGetPipelineRequest(pipelineName, ifNoneMatch);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineResource value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        value = PipelineResource.DeserializePipelineResource(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                case 304:
                    return Response.FromValue<PipelineResource>(null, message.Response);
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Gets a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public Response<PipelineResource> GetPipeline(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateGetPipelineRequest(pipelineName, ifNoneMatch);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineResource value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        value = PipelineResource.DeserializePipelineResource(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                case 304:
                    return Response.FromValue<PipelineResource>(null, message.Response);
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal HttpMessage CreateDeletePipelineRequest(string pipelineName)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Delete;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/pipelines/", false);
            uri.AppendPath(pipelineName, true);
            uri.AppendQuery("api-version", apiVersion, true);
            request.Uri = uri;
            request.Headers.Add("Accept", "application/json");
            return message;
        }

        /// <summary> Deletes a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public async Task<Response> DeletePipelineAsync(string pipelineName, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateDeletePipelineRequest(pipelineName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                case 202:
                case 204:
                    return message.Response;
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Deletes a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public Response DeletePipeline(string pipelineName, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateDeletePipelineRequest(pipelineName);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                case 202:
                case 204:
                    return message.Response;
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal HttpMessage CreateCreatePipelineRunRequest(string pipelineName, string referencePipelineRunId, bool? isRecovery, string startActivityName, IDictionary<string, object> parameters)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Post;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/pipelines/", false);
            uri.AppendPath(pipelineName, true);
            uri.AppendPath("/createRun", false);
            uri.AppendQuery("api-version", apiVersion, true);
            if (referencePipelineRunId != null)
            {
                uri.AppendQuery("referencePipelineRunId", referencePipelineRunId, true);
            }
            if (isRecovery != null)
            {
                uri.AppendQuery("isRecovery", isRecovery.Value, true);
            }
            if (startActivityName != null)
            {
                uri.AppendQuery("startActivityName", startActivityName, true);
            }
            request.Uri = uri;
            request.Headers.Add("Content-Type", "application/json");
            request.Headers.Add("Accept", "application/json");
            if (parameters != null)
            {
                var content = new Utf8JsonRequestContent();
                content.JsonWriter.WriteStartObject();
                foreach (var item in parameters)
                {
                    content.JsonWriter.WritePropertyName(item.Key);
                    content.JsonWriter.WriteObjectValue(item.Value);
                }
                content.JsonWriter.WriteEndObject();
                request.Content = content;
            }
            return message;
        }

        /// <summary> Creates a run of a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of the specified run will be used to create a new run. </param>
        /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipeline run and the new run will be grouped under the same groupId. </param>
        /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified, all activities will run. </param>
        /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is not specified. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public async Task<Response<CreateRunResponse>> CreatePipelineRunAsync(string pipelineName, string referencePipelineRunId = null, bool? isRecovery = null, string startActivityName = null, IDictionary<string, object> parameters = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateCreatePipelineRunRequest(pipelineName, referencePipelineRunId, isRecovery, startActivityName, parameters);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 202:
                    {
                        CreateRunResponse value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        value = CreateRunResponse.DeserializeCreateRunResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Creates a run of a pipeline. </summary>
        /// <param name="pipelineName"> The pipeline name. </param>
        /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of the specified run will be used to create a new run. </param>
        /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipeline run and the new run will be grouped under the same groupId. </param>
        /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified, all activities will run. </param>
        /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is not specified. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception>
        public Response<CreateRunResponse> CreatePipelineRun(string pipelineName, string referencePipelineRunId = null, bool? isRecovery = null, string startActivityName = null, IDictionary<string, object> parameters = null, CancellationToken cancellationToken = default)
        {
            if (pipelineName == null)
            {
                throw new ArgumentNullException(nameof(pipelineName));
            }

            using var message = CreateCreatePipelineRunRequest(pipelineName, referencePipelineRunId, isRecovery, startActivityName, parameters);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 202:
                    {
                        CreateRunResponse value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        value = CreateRunResponse.DeserializeCreateRunResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal HttpMessage CreateGetPipelinesByWorkspaceNextPageRequest(string nextLink)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();
            uri.AppendRaw(endpoint, false);
            uri.AppendRawNextLink(nextLink, false);
            request.Uri = uri;
            request.Headers.Add("Accept", "application/json");
            return message;
        }

        /// <summary> Lists pipelines. </summary>
        /// <param name="nextLink"> The URL to the next page of results. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
        public async Task<Response<PipelineListResponse>> GetPipelinesByWorkspaceNextPageAsync(string nextLink, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

            using var message = CreateGetPipelinesByWorkspaceNextPageRequest(nextLink);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineListResponse value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Lists pipelines. </summary>
        /// <param name="nextLink"> The URL to the next page of results. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
        public Response<PipelineListResponse> GetPipelinesByWorkspaceNextPage(string nextLink, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

            using var message = CreateGetPipelinesByWorkspaceNextPageRequest(nextLink);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        PipelineListResponse value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement);
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
    }
}


text:
var chatSetAttr = chatSetAttr || (function () {
	'use strict';
	const version = '1.1.5',
		schemaVersion = 2,
		replacers = [
			['<', '[', /</g, /\[/g],
			['>', ']', />/g, /\]/g],
			['~', '-', /\~/g, /\-/g],
			[';', '?', /\;/g, /\?/g],
			['`', '@', /`/g, /@/g]
		],
		checkInstall = function () {
			log(`-=> ChatSetAttr v${version} <=-`);
			if (!_.has(state, 'ChatSetAttr') || state.ChatSetAttr.version !== schemaVersion) {
				log(` > Updating ChatSetAttr Schema to v${schemaVersion} <`);
				state.ChatSetAttr = {
					version: schemaVersion,
					globalconfigCache: {
						lastsaved: 0
					},
					playersCanModify: false,
					playersCanEvaluate: false
				};
			}
			checkGlobalConfig();
		},
		isDef = function (value) {
			return !_.isUndefined(value);
		},
		getWhisperPrefix = function (playerid) {
			let player = getObj('player', playerid);
			if (player && player.get('_displayname')) {
				return '/w "' + player.get('_displayname') + '" ';
			} else {
				return '/w GM ';
			}
		},
		checkGlobalConfig = function () {
			let s = state.ChatSetAttr,
				g = globalconfig && globalconfig.chatsetattr;
			if (g && g.lastsaved && g.lastsaved > s.globalconfigCache.lastsaved) {
				log(' > Updating ChatSetAttr from Global Config < [' +
					(new Date(g.lastsaved * 1000)) + ']');
				s.playersCanModify = 'playersCanModify' === g['Players can modify all characters'];
				s.playersCanEvaluate = 'playersCanEvaluate' === g['Players can use --evaluate'];
				s.globalconfigCache = globalconfig.chatsetattr;
			}
		},
		handleErrors = function (whisper, errors) {
			if (errors.length) {
				let output = whisper + '<div style="border:1px solid black;' +
					`background-color:#FFBABA;padding:3px"><h4>Errors</h4>` +
					`<p>${errors.join('<br>')}</p></div>`;
				sendChat('ChatSetAttr', output);
				errors.splice(0, errors.length);
			}
		},
		showConfig = function (whisper) {
			let optionsText = _.map([{
				name: 'playersCanModify',
				command: 'players-can-modify',
				desc: 'Determines if players can use --name and --charid to ' +
					'change attributes of characters they do not control.'
			}, {
				name: 'playersCanEvaluate',
				command: 'players-can-evaluate',
				desc: 'Determines if players can use the --evaluate option. ' +
					'Be careful in giving players access to this option, because ' +
					'it potentially gives players access to your full API sandbox.'
			}], getConfigOptionText).join('');
			let output = whisper + '
ChatSetAttr Configuration
' +
				'
!setattr-config can be invoked in the following format:

!setattr-config --option
' +
				'
Specifying an option toggles the current setting. There are currently two' +
				' configuration options:
' + optionsText + '

';
			sendChat('ChatSetAttr', output);
		},
		getConfigOptionText = function (o) {
			let button = (state.ChatSetAttr[o.name] ?
				'ON' :
				'OFF'
			);
			return '

' +
				'
' +
				'<div style="float:right;width:40px;border:1px solid black;' +
				`background-color:#ffc;text-align:center;">${button}</div><b>` +
				`<span style="font-family: serif;">${o.command}</span></b>${htmlReplace('-')}` +
				`${o.desc}</li></ul></div><div><b>${o.name}</b> is currently ${button}` +
				`<a href="!setattr-config --${o.command}">Toggle</a></div>`;
		},
		getCharNameById = function (id) {
			let character = getObj('character', id);
			return (character) ? character.get('name') : '';
		},
		escapeRegExp = function (str) {
			return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
		},
		htmlReplace = function (str) {
			let entities = {
				'<': 'lt',
				'>': 'gt',
				"'": '#39',
				'@': '#64',
				'{': '#123',
				'|': '#124',
				'}': '#125',
				'[': '#91',
				']': '#93',
				'"': 'quot',
				'-': 'mdash',
				' ': 'nbsp'
			};
			return _.chain(str.split(''))
				.map(c => (_.has(entities, c)) ? ('&' + entities[c] + ';') : c)
				.value()
				.join('');
		},
		processInlinerolls = function (msg) {
			if (_.has(msg, 'inlinerolls')) {
				return _.chain(msg.inlinerolls)
					.reduce(function (m, v, k) {
						let ti = _.reduce(v.results.rolls, function (m2, v2) {
							if (_.has(v2, 'table')) {
								m2.push(_.reduce(v2.results, function (m3, v3) {
									m3.push(v3.tableItem.name);
									return m3;
								}, []).join(', '));
							}
							return m2;
						}, []).join(', ');
						m['$[[' + k + ']]'] = (ti.length && ti) || v.results.total || 0;
						return m;
					}, {})
					.reduce((m, v, k) => m.replace(k, v), msg.content)
					.value();
			} else {
				return msg.content;
			}
		},
		getCIKey = function (obj, name) {
			let nameLower = name.toLowerCase(),
				result = false;
			_.each(obj, function (v, k) {
				if (k.toLowerCase() === nameLower) {
					result = k;
				}
			});
			return result;
		},
		generateUUID = function () {
			"use strict";
			var a = 0,
				b = [];
			return function () {
				var c = (new Date()).getTime() + 0,
					d = c === a;
				a = c;
				for (var e = new Array(8), f = 7; 0 <= f; f--) {
					e[f] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(c % 64);
					c = Math.floor(c / 64);
				}
				c = e.join("");
				if (d) {
					for (f = 11; 0 <= f && 63 === b[f]; f--) {
						b[f] = 0;
					}
					b[f]++;
				} else {
					for (f = 0; 12 > f; f++) {
						b[f] = Math.floor(64 * Math.random());
					}
				}
				for (f = 0; 12 > f; f++) {
					c += "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(b[f]);
				}
				return c;
			};
		}(),
		generateRowID = function () {
			"use strict";
			return generateUUID().replace(/_/g, "Z");
		},
		// Getting attributes from parsed options. Repeating attributes need special treatment
		// in order to parse row index and not create defective repeating rows.
		addRepeatingAttributes = function (list, attrNames, allAttrs, errors, createMissing, failSilently) {
			let allRepAttrs = {},
				repRowIds = {},
				repRowIdsLo = {},
				rowsToCreate = [],
				repSections = [];
			// Read attribute names, determine row number or id or creation of new row.
			let attrNamesRead = _.reduce(attrNames, function (prev, attrName) {
				let match = attrName.match(/_(\$\d+|-[-A-Za-z0-9]+?|\d+)_/);
				if (match && match[1][0] === '$') {
					prev[attrName] = {
						rowNum: parseInt(match[1].slice(1))
					};
				} else if (match) {
					prev[attrName] = {
						rowIdLo: match[1].toLowerCase()
					};
				} else {
					errors.push(`Could not understand repeating attribute` +
						` name ${attrName}.`);
					return;
				}
				prev[attrName]['sName'] = attrName.split(match[0]);
				repSections.push(prev[attrName]['sName'][0]);
				if (prev[attrName].rowIdLo === '-create') {
					rowsToCreate.push(prev[attrName]['sName'][0]);
				}
				return prev;
			}, {});
			repSections = _.uniq(repSections);
			let repSectionsRegex = _.map(repSections, function (s) {
				return new RegExp('^' + escapeRegExp(s) + '_(-[-A-Za-z0-9]+?|\\d+)_', 'i');
			});
			// Get attributes
			_.each(list, function (charid) {
				allRepAttrs[charid] = {};
				_.each(repSections, prefix => allRepAttrs[charid][prefix] = {});
			});
			filterObjs(function (o) {
				let charid, attrName;
				if (o.get('_type') === 'attribute') {
					charid = o.get('_characterid');
					attrName = o.get('name');
					if (_.contains(list, charid)) {
						_.each(repSections, function (prefix, k) {
							if (attrName.search(repSectionsRegex[k]) !== -1) {
								allRepAttrs[charid][prefix][attrName] = o;
							}
						});
					}
				}
			});
			// Get list of repeating row ids by charid and prefix from allRepAttrs
			_.each(list, function (charid) {
				repRowIds[charid] = {};
				_.each(repSections, function (prefix, k) {
					repRowIds[charid][prefix] = _.chain(allRepAttrs[charid][prefix])
						.keys()
						.map(n => n.match(repSectionsRegex[k]))
						.compact()
						.map(a => a[1])
						.uniq()
						.value();
				});
				repRowIdsLo[charid] = _.mapObject(repRowIds[charid],
					l => _.map(l, n => n.toLowerCase()));
				_.each(_.uniq(rowsToCreate), function (prefix) {
					repRowIds[charid][prefix].push(generateRowID());
				});
			});
			// Get correct attribute names and store attributes in allAttrs
			_.each(list, function (charid) {
				_.each(attrNamesRead, function (p, attrName) {
					let finalId;
					if (isDef(p.rowNum) && isDef(repRowIds[charid][p.sName[0]][p.rowNum])) {
						finalId = repRowIds[charid][p.sName[0]][p.rowNum];
					} else if (p.rowIdLo === '-create') {
						finalId = _.last(repRowIds[charid][p.sName[0]]);
					} else if (isDef(p.rowIdLo) && _.contains(repRowIdsLo[charid][p.sName[0]], p.rowIdLo)) {
						let index = _.indexOf(repRowIdsLo[charid][p.sName[0]], p.rowIdLo);
						finalId = repRowIds[charid][p.sName[0]][index];
					} else if (isDef(p.rowNum)) {
						errors.push(`Repeating row number ${p.rowNum} invalid for` +
							` character ${getCharNameById(charid)}` +
							` and repeating section ${p.sName[0]}.`);
					} else {
						errors.push(`Repeating row id ${p.rowIdLo} invalid for` +
							` character ${getCharNameById(charid)}` +
							` and repeating section ${p.sName[0]}.`);
					}
					if (finalId) {
						let finalName = p.sName[0] + '_' + finalId + '_' + p.sName[1];
						let attrNameCased = getCIKey(allRepAttrs[charid][p.sName[0]], finalName);
						if (attrNameCased) {
							allAttrs[charid][attrName] = allRepAttrs[charid][p.sName[0]][attrNameCased];
						} else if (createMissing) {
							allAttrs[charid][attrName] = createObj('attribute', {
								characterid: charid,
								name: finalName
							});
						} else if (!failSilently) {
							errors.push(`Missing attribute ${finalName} not created` +
								` for character ${getCharNameById(charid)}.`);
						}
					}
				});
			});
			return;
		},
		addStandardAttributes = function (list, attrNames, allAttrs, errors, createMissing, failSilently) {
			let attrNamesUpper = attrNames.map(x => x.toUpperCase()),
				name, id;
			filterObjs(function (o) {
				if (o.get('_type') === 'attribute') {
					id = o.get('_characterid');
					name = o.get('name');
					if (_.contains(list, id) && _.contains(attrNamesUpper, name.toUpperCase())) {
						allAttrs[id][attrNames[_.indexOf(attrNamesUpper, name.toUpperCase())]] = o;
						return true;
					}
				}
			});
			_.each(list, function (charid) {
				_.each(_.difference(attrNames, _.keys(allAttrs[charid])), function (key) {
					if (createMissing) {
						allAttrs[charid][key] = createObj('attribute', {
							characterid: charid,
							name: key
						});
					} else if (!failSilently) {
						errors.push(`Missing attribute ${key} not created for` +
							` character ${getCharNameById(charid)}.`);
					}
				});
			});
		},
		getAllAttributes = function (list, attrNames, errors, createMissing, failSilently) {
			let allAttrs = {},
				attrNamesRepeating = _.filter(attrNames, str => (str.search(/^repeating_/) !== -1));
			_.each(list, charid => allAttrs[charid] = {});
			addStandardAttributes(list, _.difference(attrNames, attrNamesRepeating), allAttrs,
				errors, createMissing, failSilently);
			addRepeatingAttributes(list, attrNamesRepeating, allAttrs, errors, createMissing, failSilently);
			return allAttrs;
		},
		// Setting attributes happens in a delayed recursive way to prevent the sandbox
		// from overheating.
		delayedSetAttributes = function (whisper, list, setting, errors, allAttrs, fillInAttrs, opts) {
			let cList = _.clone(list),
				feedback = [],
				dWork = function (charid) {
					setCharAttributes(charid, setting, errors, feedback, allAttrs[charid],
						fillInAttrs, opts);
					if (cList.length) {
						_.delay(dWork, 50, cList.shift());
					} else {
						handleErrors(whisper, errors);
						(opts.silent) ? null: sendFeedback(whisper, feedback);
					}
				}
			dWork(cList.shift());
		},
		setCharAttributes = function (charid, setting, errors, feedback, attrs, fillInAttrs, opts) {
			let charFeedback = {};
			_.each(attrs, function (attr, attrName) {
				let attrNew;
				if (opts.reset) {
					attrNew = {
						current: attr.get('max')
					};
				} else {
					attrNew = (fillInAttrs[attrName]) ?
						_.mapObject(setting[attrName], v => fillInAttrValues(charid, v)) :
						_.clone(setting[attrName]);
				}
				if (opts.evaluate) {
					try {
						attrNew = _.mapObject(attrNew, function (v) {
							let parsed = eval(v);
							if (_.isString(parsed) || _.isFinite(parsed) || _.isBoolean(parsed)) {
								return parsed.toString();
							} else return v;
						});
					} catch (err) {
						errors.push(`Something went wrong with --evaluate` +
							` for the character ${getCharNameById(charid)}.` +
							` You were warned. The error message was: ${err}.` +
							` Attribute ${attrName} left unchanged.`);
						return;
					}
				}
				if (opts.mod || opts.modb) {
					_.each(attrNew, function (v, k) {
						let moddedValue = parseFloat(v) + parseFloat(attr.get(k) || '0');
						if (!_.isNaN(moddedValue)) {
							if (opts.modb && k === 'current') {
								moddedValue = Math.min(Math.max(moddedValue, 0),
									parseFloat(attr.get('max') || Infinity));
							}
							attrNew[k] = moddedValue.toString();
						} else {
							delete attrNew[k];
							let type = (k === 'max') ? 'maximum ' : '';
							errors.push(`Attribute ${type}${attrName} is not number-valued` +
								` for character ${getCharNameById(charid)}.` +
								` Attribute ${type}left unchanged.`);
						}
					});
				}
				charFeedback[attrName] = attrNew;
				attr.set(attrNew);
			});
			// Feedback
			if (!opts.silent) {
				charFeedback = _.chain(charFeedback)
					.map(function (o, k) {
						if (isDef(o.max) && isDef(o.current))
							return `${k} to ${htmlReplace(o.current) || '<i>(empty)</i>'} / ${htmlReplace(o.max) || '<i>(empty)</i>'}`;
						else if (isDef(o.current)) return `${k} to ${htmlReplace(o.current) || '<i>(empty)</i>'}`;
						else if (isDef(o.max)) return `${k} to ${htmlReplace(o.max) || '<i>(empty)</i>'} (max)`;
						else return null;
					})
					.compact()
					.value();
				if (!_.isEmpty(charFeedback)) {
					feedback.push(`Setting ${charFeedback.join(', ')} for` +
						` character ${getCharNameById(charid)}.`);
				} else {
					feedback.push(`Nothing to do for character` +
						` ${getCharNameById(charid)}.`);
				}
			}
			return;
		},
		fillInAttrValues = function (charid, expression) {
			let match = expression.match(/%(\S.*?)(?:_(max))?%/),
				replacer;
			while (match) {
				replacer = getAttrByName(charid, match[1], match[2] || 'current') || '';
				expression = expression.replace(/%(\S.*?)(?:_(max))?%/, replacer);
				match = expression.match(/%(\S.*?)(?:_(max))?%/);
			}
			return expression;
		},
		deleteAttributes = function (whisper, allAttrs, silent) {
			let feedback = {};
			_.each(allAttrs, function (charAttrs, charid) {
				feedback[charid] = [];
				_.each(charAttrs, function (attr, name) {
					attr.remove();
					feedback[charid].push(name);
				});
			});
			silent ? null : sendDeleteFeedback(whisper, feedback);
		},
		//  These functions parse the chat input.
		parseOpts = function (content, hasValue) {
			// Input:	content - string of the form command --opts1 --opts2  value --opts3.
			//					values come separated by whitespace.
			//			hasValue - array of all options which come with a value
			// Output:	object containing key:true if key is not in hasValue. and containing
			//			key:value otherwise
			let opts = {};
			let args = _.rest(content.replace(/
\n/g, ' ')
				.replace(/\s*$/g, '')
				.replace(/({{(.*?)\s*}}$)/g, '$2')
				.split(/\s+--/));
			_.each(args, function (arg) {
				let kv = arg.split(/\s(.+)/);
				if (_.contains(hasValue, kv[0])) {
					opts[kv[0]] = kv[1];
				} else {
					opts[arg] = true;
				}
			});
			return opts;
		},
		parseAttributes = function (args, replace, fillInAttrs) {
			// Input:	args - array containing comma-separated list of strings, every one of which contains
			//				an expression of the form key|value or key|value|maxvalue
			//			replace - true if characters from the replacers array should be replaced
			// Output:	Object containing key|value for all expressions.
			let setting = _.chain(args)
				.map(str => str.split(/(\\?(?:#|\|))/g))
				.map(function (split) {
					_.each(split, function (str, k) {
						if ((str === '#' || str === '|')) {
							split[k] = null;
						} else if ((str === '\\#' || str === '\\|')) {
							split[k] = (split[k - 1] || '') + str.slice(-1) + (split[k + 1] || '');
							(k > 0) ? (split[k - 1] = null) : null;
							(k < split.length - 1) ? (split[k + 1] = null) : null;
						}
					});
					return _.reject(split, _.isNull);
				})
				.compact()
				.map(readAttribute)
				.reduce(function (p, c) {
					p[c[0]] = _.extend(p[c[0]] || {}, c[1])
					return p;
				}, {})
				.value();
			if (replace) {
				setting = _.mapObject(setting, function (obj) {
					return _.mapObject(obj, function (str) {
						_.each(replacers, function (rep) {
							str = str.replace(rep[2], rep[1]);
						});
						return str;
					});
				});
			}
			_.extend(fillInAttrs, _.mapObject(setting, obj =>
				(obj.current && obj.current.search(/%(\S.*?)(?:_(max))?%/) !== -1) ||
				(obj.max && obj.max.search(/%(\S.*?)(?:_(max))?%/) !== -1)
			));
			return setting;
		},
		readAttribute = function (arr) {
			let value = {};
			if (arr.length < 3 || arr[1] !== '') {
				value.current = arr[1] || '';
			}
			if (arr.length > 2) {
				value.max = arr[2];
			}
			return [arr[0], _.mapObject(value, str => str.replace(/^'(.*)'$/, '$1'))];
		},
		// These functions are used to get a list of character ids from the input,
		// and check for permissions.
		checkPermissions = function (list, errors, playerid, isGM) {
			let control, character;
			_.each(list, function (id, k) {
				character = getObj('character', id);
				if (character) {
					control = character.get('controlledby').split(/,/);
					if (!(state.ChatSetAttr.playersCanModify || isGM || _.contains(control, 'all') || _.contains(control, playerid))) {
						list[k] = null;
						errors.push(`Permission error for character ${character.get('name')}.`);
					}
				} else {
					errors.push(`Invalid character id ${id}.`);
					list[k] = null;
				}
			});
			return _.compact(list);
		},
		getIDsFromTokens = function (selected) {
			return _.chain(selected)
				.map(obj => getObj('graphic', obj._id))
				.compact()
				.map(token => token.get('represents'))
				.compact()
				.filter(id => getObj('character', id))
				.value();
		},
		getIDsFromNames = function (charNames, errors) {
			return _.chain(charNames.split(/\s*,\s*/))
				.map(function (name) {
					let character = findObjs({
						'type': 'character',
						'name': name
					}, {
						caseInsensitive: true
					})[0];
					if (character) {
						return character.id;
					} else {
						errors.push('No character named ' + name + ' found.');
						return null;
					}
				})
				.compact()
				.value();
		},
		sendFeedback = function (whisper, feedback) {
			let output = whisper + '

Setting attributes

' +
				(feedback.join('
') || 'Nothing to do.') + '

';
			sendChat('ChatSetAttr', output);
		},
		sendDeleteFeedback = function (whisper, feedback) {
			let output = whisper + '

Deleting attributes

';
			output += _.chain(feedback)
				.omit(arr => _.isEmpty(arr))
				.map(function (arr, charid) {
					return `Deleting attribute(s) ${arr.join(', ')} for character` +
						` ${getCharNameById(charid)}.`;
				})
				.join('
')
				.value() || 'Nothing to do.';
			output += '

';
			sendChat('ChatSetAttr', output);
		},
		// Main function, called after chat message input
		handleInput = function (msg) {
			if (msg.type !== 'api') {
				return;
			}
			const mode = msg.content.match(/^!(reset|set|del|mod)attr\b(?:-|\s|$)(config)?/),
				whisper = getWhisperPrefix(msg.playerid);
			if (mode && mode[2]) {
				if (playerIsGM(msg.playerid)) {
					let opts = parseOpts(msg.content, []);
					if (opts['players-can-modify']) {
						state.ChatSetAttr.playersCanModify = !state.ChatSetAttr.playersCanModify;
					}
					if (opts['players-can-evaluate']) {
						state.ChatSetAttr.playersCanEvaluate = !state.ChatSetAttr.playersCanEvaluate;
					}
					showConfig(whisper);
				}
			} else if (mode) {
				// Parsing input
				let charIDList = [],
					fillInAttrs = {},
					errors = [];
				const hasValue = ['charid', 'name'],
					optsArray = ['all', 'allgm', 'charid', 'name', 'allplayers', 'sel',
						'replace', 'nocreate', 'mod', 'modb', 'evaluate', 'silent', 'reset'
					],
					opts = parseOpts(processInlinerolls(msg), hasValue),
					setting = parseAttributes(_.chain(opts).omit(optsArray).keys().value(),
						opts.replace, fillInAttrs),
					deleteMode = (mode[1] === 'del'),
					isGM = msg.playerid === 'API' || playerIsGM(msg.playerid);
				opts.mod = opts.mod || (mode[1] === 'mod');
				opts.reset = opts.reset || (mode[1] === 'reset');
				if (opts.evaluate && !isGM && !state.ChatSetAttr.playersCanEvaluate) {
					handleErrors(whisper, ['The --evaluate option is only available to the GM.']);
					return;
				}
				// Get list of character IDs
				if (opts.all && isGM) {
					charIDList = _.map(findObjs({
						_type: 'character'
					}), c => c.id);
				} else if (opts.allgm && isGM) {
					charIDList = _.chain(findObjs({
							_type: 'character'
						}))
						.filter(c => c.get('controlledby') === '')
						.map(c => c.id)
						.value();
				} else if (opts.allplayers && isGM) {
					charIDList = _.chain(findObjs({
							_type: 'character'
						}))
						.filter(c => c.get('controlledby') !== '')
						.map(c => c.id)
						.value();
				} else {
					(opts.charid) ? charIDList.push(...charid.split(/\s*,\s*/)): null;
					(opts.name) ? charIDList.push(...getIDsFromNames(opts.name, errors)): null;
					(opts.sel) ? charIDList.push(...getIDsFromTokens(msg.selected)): null;
					charIDList = checkPermissions(_.uniq(charIDList), errors, msg.playerid, isGM);
				}
				if (_.isEmpty(charIDList)) {
					errors.push('No target characters. You need to supply one of --all, --allgm, --sel,' +
						' --allplayers, --charid, or --name.');
				}
				if (_.isEmpty(setting)) {
					errors.push('No attributes supplied.');
				}
				// Get attributes
				let allAttrs = getAllAttributes(charIDList, _.keys(setting), errors, !opts.nocreate && !deleteMode, deleteMode);
				handleErrors(whisper, errors);
				// Set or delete attributes
				if (!_.isEmpty(charIDList) && !_.isEmpty(setting)) {
					if (deleteMode) {
						deleteAttributes(whisper, allAttrs, opts.silent);
					} else {
						delayedSetAttributes(whisper, charIDList, setting, errors, allAttrs,
							fillInAttrs, _.pick(opts, optsArray));
					}
				}
			}
			return;
		},
		registerEventHandlers = function () {
			on('chat:message', handleInput);
		};
	return {
		CheckInstall: checkInstall,
		RegisterEventHandlers: registerEventHandlers
	};
}());
on('ready', function () {
	'use strict';
	chatSetAttr.CheckInstall();
	chatSetAttr.RegisterEventHandlers();
});


text:
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
    container: {
        alignItems: 'center',
        justifyContent: 'center',
        flex: 1
    },
});