diff --git a/.gitignore b/.gitignore index 18950ec..b08a951 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store */node_modules/* -*/localtest/* \ No newline at end of file +*/localtest/* +*/logs/log_* \ No newline at end of file diff --git a/README.md b/README.md index 0386606..f1f5be4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,26 @@ to get the development server running. That should pop up a webpage to: which will have the interface running. +To *rebuild* the the package for production-ready +------------------------------------------------- + +`npm run build` + + +To run during session +--------------------- + +To run at `http://localhost:3000/` (note the different localhost port) for the gaming session, AFTER building, run: + +`npm run server` + + +Logs +---- + +The server will always log to a new file every time it's run, named with the UNIX timestamp of when it started. They are under `../node/logs`. + + Notes ===== diff --git a/arduino/fsr_test/fsr_test.ino b/arduino/fsr_test/fsr_test.ino index d110921..82ed10e 100644 --- a/arduino/fsr_test/fsr_test.ino +++ b/arduino/fsr_test/fsr_test.ino @@ -7,7 +7,7 @@ http://www.arduino.cc/en/Tutorial/AnalogReadSerial */ // the setup routine runs once when you press reset: -int dPIN[5] = {12,11,9,8,7}; +int dPIN[6] = {12,11,9,8,7,6}; void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); @@ -48,6 +48,10 @@ void loop() { // } // digitalWrite(dPIN[4],HIGH); int sensorValue4 = analogRead(A4); + delay(10); + + int sensorValue5 = analogRead(A5); + // print out the value you read: Serial.print(sensorValue0); Serial.print("\t\t"); @@ -57,6 +61,8 @@ void loop() { Serial.print("\t\t"); Serial.print(sensorValue3); Serial.print("\t\t"); - Serial.println(sensorValue4); + Serial.print(sensorValue4); + Serial.print("\t\t"); + Serial.println(sensorValue5); delay(10); // delay in between reads for stability } diff --git a/matlab/align_interview.asv b/matlab/align_interview.asv new file mode 100644 index 0000000..4a4af4f --- /dev/null +++ b/matlab/align_interview.asv @@ -0,0 +1,119 @@ +%interview_filename = 'interview-17.csv'; + +%extract unique-timestamp interview data and timestamps +%and compile concise array +%name of interview file + +%trial_directory = get_trial_directory(); +%processed_directory = get_processed_directory(); +%processed_data = get_processed_data(); + +trial_directory = get_trial_directory(); +processed_directory = get_processed_directory(); +processed_data = get_processed_data(processed_directory); + +% if (~exist('processed_directory')) +% waitfor(warndlg('Unknown processed data directory. Please select processed data directory.')); +% processed_directory = uigetdir(path,"Select directory to save processed data in."); +% end +% if ~exist('aligned_data') +% data_file = dir(fullfile(processed_directory,'processed_data.mat')); +% if ~isempty(data_file) +% data_name = data_file.name; +% data_path = data_file.folder; +% else +% waitfor(warndlg('Unable to automatically locate processed data file for this trial. Please find it manually. The file is usually called processed_data.mat and in the processed data directory. If the data from this trial has not been processed, please process data instead of running this script alone.')); +% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file'); +% isdlg = 'No'; +% while (data_name(1) == 0) && strcmp(questdlg('No processed data matlab file was opened. If the data from this trial has not been processed, please process data instead of running this script alone. Do you want to keep looking for this file yourself?',''),'Yes') +% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file'); +% end +% if data_name(1) == 0 +% waitfor(errordlg('Aborting data processing: no processed data file')); +% throw(MException('Custom:Custom','Failure: unable to find processed data file to add interview timestamps to')); +% end +% end +% +% if ~contains(data_name,pathsep) +% data_name = fullfile(data_path,data_name); +% end +% load (data_name); +% end + +lavell = + +dir(fullfile(trial_directory,'interview*.csv')); +if ~isempty(interview_file) + interview_name = interview_file.name; + interview_path = interview_file.folder; +else + waitfor(warndlg('Unable to automatically locate interview data for this trial. Please find it manually. The file is usually called intervew-[number].csv and in the main trial directory.')); + [interview_name, interview_path] = uigetfile('*.csv','Find inteview csv'); + isdlg = 'No'; + while (interview_name(1) == 0) && strcmp(questdlg('No interview csv was opened. Do you want to keep looking for this file yourself?',''),'Yes') + [interview_name, interview_path] = uigetfile('*.csv','Find interview csv'); + end + if interview_name(1) == 0 + waitfor(errordlg('Aborting data processing: no valid interview csv file')); + throw(MException('Custom:Custom','Failure: unable to find valid interview csv file')); + end +end + +if ~contains(interview_name,pathsep) + interview_name = fullfile(interview_path,interview_name); +end + +f = waitbar(0.5,'Importing interview data','Name','Data Processing'); + +fid = fopen(interview_name, 'rt', 'n', 'UTF16LE'); +fread(fid, 2, '*uint8'); %adjust the 2 to fit the UTF encoding +filecontent = fread(fid, [1 inf], '*char'); +datacell = textscan(filecontent, '%s%s%s%s%s%s', 'Delimiter', ' ', 'HeaderLines', 1); +a = size(datacell{1}); +num_markers = a(1); +interview_comments = strings(num_markers); +interview_ms_timestamps = zeros(num_markers,1); +k = 1; +l = 1; +while k <= num_markers + if (~isempty(datacell{3}{k}) && ~(datacell{3}{k} == "")) + int_timestamp_strings = strsplit(datacell{3}{k}, ':'); + mins = int_timestamp_strings(2); + secs = int_timestamp_strings(3); + frames = int_timestamp_strings(4); + int_timestamp = round((str2num(mins{1})*60*1000) + (str2num(secs{1})*1000) + (str2num(frames{1})*1000/30)); + if ~(int_timestamp == 0) + interview_ms_timestamps(l) = int_timestamp; + interview_comments(l) = datacell{1}{l}; + l = l+1; + end + end + k = k+1; +end + +interview_ms_timestamps = interview_ms_timestamps(1:find(interview_ms_timestamps,1,'last')); +interview_comments = interview_comments(1:length(interview_ms_timestamps)); + + + +interview_ms_timestamps = round(interview_ms_timestamps - processed_data.scalars.sync_frame*1000 / processed_data.scalars.frame_rate); + +interview_table = table(interview_ms_timestamps, interview_comments.', 'VariableNames', {'timestamp_ms','label'}); +processed_data.interview = interview_table; +% %align feeltrace data to master array +% aligned_data(1).interview = []; +% l = 1; +% a = length(interview_ms_timestamps); +% for k=1:length([aligned_data.timestamp_ms]) +% if l > a +% break; +% end +% if interview_ms_timestamps(l) == aligned_data(k).timestamp_ms +% aligned_data(k).interview =interview_comments(l); +% l = l+1; +% else +% aligned_data(k).interview = []; +% end +% end + +save(fullfile(processed_directory, 'processed_data.mat'),'processed_data'); diff --git a/matlab/align_interview.m b/matlab/align_interview.m new file mode 100644 index 0000000..c44d2cb --- /dev/null +++ b/matlab/align_interview.m @@ -0,0 +1,100 @@ +%interview_filename = 'interview-17.csv'; + +%extract unique-timestamp interview data and timestamps +%and compile concise array +%name of interview file + +%trial_directory = get_trial_directory(); +%processed_directory = get_processed_directory(); +%processed_data = get_processed_data(); + +load_globals; + +% if (~exist('processed_directory')) +% waitfor(warndlg('Unknown processed data directory. Please select processed data directory.')); +% processed_directory = uigetdir(path,"Select directory to save processed data in."); +% end +% if ~exist('aligned_data') +% data_file = dir(fullfile(processed_directory,'processed_data.mat')); +% if ~isempty(data_file) +% data_name = data_file.name; +% data_path = data_file.folder; +% else +% waitfor(warndlg('Unable to automatically locate processed data file for this trial. Please find it manually. The file is usually called processed_data.mat and in the processed data directory. If the data from this trial has not been processed, please process data instead of running this script alone.')); +% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file'); +% isdlg = 'No'; +% while (data_name(1) == 0) && strcmp(questdlg('No processed data matlab file was opened. If the data from this trial has not been processed, please process data instead of running this script alone. Do you want to keep looking for this file yourself?',''),'Yes') +% [data_name, data_path] = uigetfile('*.mat','Find processed data .mat file'); +% end +% if data_name(1) == 0 +% waitfor(errordlg('Aborting data processing: no processed data file')); +% throw(MException('Custom:Custom','Failure: unable to find processed data file to add interview timestamps to')); +% end +% end +% +% if ~contains(data_name,pathsep) +% data_name = fullfile(data_path,data_name); +% end +% load (data_name); +% end + +interview_name = get_path_ui(pwd, 'interview*.csv', 'interview csv', 'The file is usually called intervew-[number].csv and in the main trial directory.', true); + +% if ~contains(interview_name,pathsep) +% interview_name = fullfile(interview_path,interview_name); +% end + +%f = waitbar(0.5,'Importing interview data','Name','Data Processing'); + +fid = fopen(interview_name, 'rt', 'n', 'UTF16LE'); +fread(fid, 2, '*uint8'); %adjust the 2 to fit the UTF encoding +filecontent = fread(fid, [1 inf], '*char'); +datacell = textscan(filecontent, '%s%s%s%s%s%s', 'Delimiter', ' ', 'HeaderLines', 1); +a = size(datacell{1}); +num_markers = a(1); +interview_comments = strings(num_markers); +interview_ms_timestamps = zeros(num_markers,1); +k = 1; +l = 1; +while k <= num_markers + if (~isempty(datacell{3}{k}) && ~(datacell{3}{k} == "")) + int_timestamp_strings = strsplit(datacell{3}{k}, ':'); + mins = int_timestamp_strings(2); + secs = int_timestamp_strings(3); + frames = int_timestamp_strings(4); + int_timestamp = round((str2num(mins{1})*60*1000) + (str2num(secs{1})*1000) + (str2num(frames{1})*1000/30)); + if ~(int_timestamp == 0) + interview_ms_timestamps(l) = int_timestamp; + interview_comments(l) = datacell{1}{l}; + l = l+1; + end + end + k = k+1; +end + +interview_ms_timestamps = interview_ms_timestamps(1:find(interview_ms_timestamps,1,'last')); +interview_comments = interview_comments(1:length(interview_ms_timestamps)); + + + +interview_ms_timestamps = round(interview_ms_timestamps - processed_data.scalars.sync_frame*1000 / processed_data.scalars.frame_rate); + +interview_table = table(interview_ms_timestamps, interview_comments.', 'VariableNames', {'timestamp_ms','label'}); +processed_data.interview = interview_table; +% %align feeltrace data to master array +% aligned_data(1).interview = []; +% l = 1; +% a = length(interview_ms_timestamps); +% for k=1:length([aligned_data.timestamp_ms]) +% if l > a +% break; +% end +% if interview_ms_timestamps(l) == aligned_data(k).timestamp_ms +% aligned_data(k).interview =interview_comments(l); +% l = l+1; +% else +% aligned_data(k).interview = []; +% end +% end + +%save(fullfile(processed_directory, 'processed_data.mat'),'processed_data'); diff --git a/matlab/big_plot.m b/matlab/big_plot.m new file mode 100644 index 0000000..47a8709 --- /dev/null +++ b/matlab/big_plot.m @@ -0,0 +1,176 @@ +%load_globals; +MS_PER_MIN = 60000; +LONGEST_TRIAL_LENGTH_MIN = 10; + +% If data to plot is not available, don't do anything +if ~any(ismember(fields(processed_data),{'feeltrace'})) || ~any(ismember(fields(processed_data),{'fsr'})) || ~any(ismember(fields(processed_data),{'interview'})) + waitfor(errordlg('Cannot plot data: missing one or more fields.', 'Cannot Plot Data')); +else + %% PREPARING STUFF TO PLOT + % array of ones for 1D interview plot at controlled height + interview_ones = ones(length(processed_data.interview.timestamp_ms),1); + % array of number + staggered space strings for interview x-labels + interview_nums_num = (1:length(processed_data.interview.timestamp_ms)).'; + interview_nums = arrayfun(@(x) strcat(num2str(x),convertCharsToStrings(blanks(mod(x,3)*2))), interview_nums_num,'UniformOutput',false); + + max_feeltrace = max(feeltrace_data); + max_keypress = max([max(processed_data.fsr.A0) max(processed_data.fsr.A1) max(processed_data.fsr.A2) max(processed_data.fsr.A3) max(processed_data.fsr.A4)]); + ratio = max_keypress/max_feeltrace; + + %% LET'S GET PLOTTING + clf; + fig = figure(1); + + %% FIRST SUBPLOT: A0 + %% In topmost (rightmost) position + %subplot(29,1,[1 2 3 4 5]); + hold on; + grid on; + % area plot the FSR + area(processed_data.fsr.timestamp_ms,processed_data.fsr.A0/ratio,'FaceColor',[239/255 49/255 86/255], 'EdgeColor',[239/255 49/255 86/255]); + % line plot the feeltrace + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',2); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A0',' Stress'}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; +% +% %% SUBPLOT A1 +% subplot(29,1,[6 7 8 9 10]); +% hold on; +% grid on; +% area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A1/ratio,'FaceColor',[244/255 93/255 1/255], 'EdgeColor',[244/255 93/255 1/255]); +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels({'','A1',''}); +% ytickangle(90); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); +% xticklabels([]); +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; +% +% %% SUBPLOT A2 +% subplot(29,1,[11 12 13 14 15]); +% hold on; +% grid on; +% area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A2/ratio,'FaceColor',[255/255 159/255 28/255], 'EdgeColor',[255/255 159/255 28/255]); +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels({'','A2',''}); +% ytickangle(90); +% ylabel(strcat("Participant ", trial_number)); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); +% xticklabels([]); +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; +% +% %% SUBPLOT A3 +% subplot(29,1,[16 17 18 19 20]); +% hold on; +% grid on; +% area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A3/ratio,'FaceColor',[86/255 188/255 3/255], 'EdgeColor',[86/255 188/255 3/255]); +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels({'','A3',''}); +% ytickangle(90); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); +% xticklabels([]); +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; +% +% %% SUBPLOT A4 +% subplot(29,1,[21 22 23 24 25]); +% hold on; +% grid on; +% area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A4/ratio,'FaceColor',[45/255 125/255 210/255], 'EdgeColor',[45/255 125/255 210/255]); +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels({'Relief ','A4',""}); +% ytickangle(90); +% starttick = max(floor(min(processed_data.fsr.timestamp_ms(1)/60000, processed_data.feeltrace.timestamp_ms(1)/60000)),0.25); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); +% xticklabels(vertcat(strings(1,starttick/0.25), datestr(datetime((starttick/24/60:1/24/60/60*15:1/24/60*ceil(processed_data.fsr.timestamp_ms(end)/60000)),'ConvertFrom','datenum'),'MM:SS'))); +% xtickangle(90); +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; +% +% %% SUBPLOT INTERVIEW +% subplot(29,1,29); +% scatter(processed_data.interview.timestamp_ms/60000,interview_ones, 17, 'black', '*'); +% ylim([0 2]); +% yticks([]); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(processed_data.interview.timestamp_ms/60000); +% xticklabels(interview_nums); +% xtickangle(90); +% ax = gca; +% ax.TickLength = [.001 .001]; +% set(gca,'FontSize',15); +% xstring = join(repmat(strcat(" P", trial_number),1,32)); +% xlabel(xstring,'FontSize', 11); +% + + + + + fig.PaperUnits = 'inches'; + fig.PaperPosition = [0 0 110 16]; + print(fullfile(processed_directory,['fsr_and_feeltrace-over' char(trial_number)]),'-dpng','-r0'); + %close(f); + %clf('reset'); + %clearvars fig; + %clearvars firsttime fsri xtick_arr starttick definput dims hSub max_feeltrace max_keypress pos1 prompt ratio_max_keypress_over_ft t f processed_data.feeltrace.timestamp_ms/60000 feeltrace_data processed_data.fsr.timestamp_ms processed_data.fsr.A0 processed_data.fsr.A1 processed_data.fsr.A2 processed_data.fsr.A3 processed_data.fsr.A4 k a0i fti; +end +% +% +% function a_subplot = plot_subplot(which_fsr,colour,plot_position, ylabels, hastimes) +% a_subplot = subplot(29,1,plot_position); +% hold on; +% grid on; +% % area plot the FSR +% area(processed_data.fsr.timestamp_ms,processed_data.fsr.which_fsr/ratio,'FaceColor',color, 'EdgeColor',colour); +% % line plot the feeltrace +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels(ylabels); +% ytickangle(90); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); +% if hastimes +% else +% xticklabels([]); +% end +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; \ No newline at end of file diff --git a/matlab/create_timestamped_video_excerpt.m b/matlab/create_timestamped_video_excerpt.m new file mode 100644 index 0000000..800b946 --- /dev/null +++ b/matlab/create_timestamped_video_excerpt.m @@ -0,0 +1,193 @@ +% cuts a video using a specified length and timestamp +% and superimposes a frame number on each frame +% useful for determining the sync frame of the gameplay recording video + +% watch the video in vlc and eyeball a start second and number of seconds +% to process surrounding the sync button changing color. then set the +% values in this script to cut out that part of the video and apply frame +% numbers to every frame. + +% video will be exported as: +%[video filename, no extension]-procvid-start-[start time]-len-[length].avi + + +% Automatically cues up processed video in VLC to review and extract +% timestamp if run on a 64-bit Windows PC with VLC installled. +% If VLC is not installed or a non-Windows computer is not run, does not +% cue up video. I am working remotely and do not have a non-Windows +% computer available for testing. If you do not have VLC download it. + +% If no trial directory variable, try current directory. +if ~exist('trial_directory', 'var') + global trial_directory; + trial_directory = get_path_ui(pwd, '', 'trial directory', 'This is the directory that contains one trial worth of raw data you downloaded from the server.', false); +end + +% Get video - find in directory or from UI dialog. +video_name = get_path_ui(trial_directory, 'gameplay*.mov', 'gameplay video', 'The file is usually called gameplay-[number].mov and in the main trial directory.',true); + +% video_file = dir(fullfile(trial_directory,'gameplay*.mov')); +% if ~isempty(video_file) +% video_name = video_file.name; +% video_path = video_file.folder; +% else +% waitfor(warndlg('Unable to automatically locate gameplay video for this trial. Please find it manually. The file is usually called gameplay-[number].mov and in the main trial directory.')); +% [video_name, video_path] = uigetfile('*.mov','Find gameplay mov'); +% isdlg = 'No'; +% while (video_name(1) == 0) && strcmp(questdlg('No gameplay video file was opened. Do you want to keep looking for this file yourself?',''),'Yes') +% [video_name, video_path] = uigetfile('*.mov','Find gameplay mov'); +% end +% if video_name(1) == 0 +% waitfor(errordlg('Aborting data processing: no valid gameplay video file')); +% throw(MException('Custom:Custom','Failure: unable to find valid gameplay video file')); +% end +% end +% +% if ~contains(video_name,pathsep) +% video_name = fullfile(video_path,video_name); +% end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% SET DURATION TO PROCESS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% initialize video reader +waitfor(helpdlg('Attempting to play video with VLC. Please watch the video carefully to determine if the sync button was pressed multiple times, and if so, determine which of th multiple button presses corresponds with the correct DIN in the EEG data. Please eyeball a start time in seconds and duration in seconds that would include the sync frame (when the sync button changes color, for the sync instance you want).')); + +%Attempting to play video. + + if convertCharsToStrings(computer) == "PCWIN64" + try + status = system(['start vlc ' video_name]); + catch ME + waitfor(errordlg(['Error trying to open video on VLC. Please open ' video_name '.mov, inside the raw data directory, manually to view video then return to Matlab.'])); + end +elseif convertCharsToStrings(computer) == "MACI64" + try + status = system(['open -a vlc ' video_name '.avi']); + catch ME + waitfor(errordlg(['Error trying to open video on VLC. Please open ' video_name '.avi manually to view video then return to Matlab.'])); + end +else + disp(['Video not automatically opened on this system type. Please open ' video_name '.avi manually to view video then return to Matlab.']); +end + +vid_reader = VideoReader(video_name); +processed_data.scalars.frame_rate = vid_reader.FrameRate; +seconds_to_process = []; +start_time_sec = []; +while isempty(seconds_to_process) || isempty(start_time_sec) || seconds_to_process < 0 || seconds_to_process > 60 || start_time_sec < 0 || start_time_sec > seconds_to_process + vid_reader.Duration + prompt = {'Enter time in seconds to start video processing:','Enter duration in seconds to process:', 'If multiple sync signals sent, enter the correct one to use (first = 1, second = 2, etc)'}; + title = 'Video parameters'; + dims = [1 35]; + definput = {'0','30', '1'}; + answer = inputdlg(prompt,title,dims,definput); + if ~isempty(answer) + start_time_sec = str2num(answer{1}); + seconds_to_process = str2num(answer{2}); + processed_data.scalars.which_gameplay_sync = str2num(answer{3}); + + end + if (isempty(answer) || isempty(seconds_to_process) || isempty(start_time_sec) || seconds_to_process < 0 || seconds_to_process > 60 || start_time_sec < 0 || start_time_sec > seconds_to_process + vid_reader.Duration) && ~strcmp(questdlg(['Invalid parameters for video excerpt. Please select a duration of <60 and a start second between 0 and ' num2str(vid_reader.Duration) '. Do you want to try entering different parameters'],''),'Yes') + waitfor(errordlg('No valid parameters available for video processing. Data processing aborted: cannot process video to extract timestamp.')); + throw(MException('Custom:Custom' ,'Failure: unable to excerpt video.')); + end +end + +quality_to_export = 50; % out of 100 + +frame_rate = 30; %% could move this to processed_data.scalars + + +f = waitbar(0.4,'Processing video','Name','Data Processing'); + +% initialize video reader +vid_reader = VideoReader(video_name); + + +% set time +%vid_reader.CurrentTime = start_time_sec; + +k = 1; +while k < start_time_sec * frame_rate && hasFrame(vid_reader) + readFrame(vid_reader); + k = k+1; +end + +% export video the same size as it's read +vid_height = vid_reader.Height; +vid_width = vid_reader.Width; +%offset text to right side of video +text_offset = vid_width - 300; + +% the following is adapted from matlab example code. +% create struct for storing excerpted video +temp_movie = struct('cdata',zeros(vid_height,vid_width,3,'uint8'),... + 'colormap',[]); + +% loop through read video for specified number of seconds, using frame rate. +% do not attempt to seek beyond the end of the video +l = 1; +while k < (start_time_sec + seconds_to_process) * frame_rate && hasFrame(vid_reader) + temp_movie(l).cdata = insertText(readFrame(vid_reader),[text_offset 1], ['frame ' num2str(k)], 'FontSize', 50, 'BoxColor', 'black', 'TextColor', 'white'); + k = k+1; + l = l+1; +end + +% initialize write object to save excerpt +if contains(video_name,pathsep) + video_name = video_name(strfind(video_name,pathsep):end); +end +proc_vid_name = strcat('gameplay-',processed_data.scalars.trial_number,'-procvid-start-',num2str(start_time_sec),'-len-',num2str(seconds_to_process)); +proc_vid_name = char(fullfile(processed_directory, proc_vid_name)); +% set quality +vid_out = VideoWriter(proc_vid_name); +vid_out.Quality = quality_to_export; +% open file +open(vid_out); +% write video +writeVideo(vid_out, temp_movie); +% close file +close(vid_out); + +clearvars seconds_to_process start_time quality_to_export vid_height vid_width text_offset temp_movie k vid_out; +close(f); +waitfor(helpdlg('Attempting to play the video we just processed. Please find the frame number for the FIRST FRAME WHEN THE SYNC BUTTON CHANGES COLOR (for the sync instance you want) then close the video player and return to Matlab.')); + +%This is only executed if you have a 64-bit Windows PC and VLC is on your +%path. +if convertCharsToStrings(computer) == "PCWIN64" + try + status = system(['start vlc ' proc_vid_name '.avi']); + catch ME + waitfor(errordlg(['Error trying to open video on VLC. Please open ' proc_vid_name '.avi manually to view video then return to Matlab.'])); + end +elseif convertCharsToStrings(computer) == "MACI64" + try + status = system(['open -a vlc ' fullfile(pwd,proc_vid_name) '.avi']); + catch ME + waitfor(errordlg(['Error trying to open video on VLC. Please open ' proc_vid_name '.avi manually to view video then return to Matlab.'])); + end +else + disp(['Video not automatically opened on this system type. Please open ' proc_vid_name '.avi manually to view video then return to Matlab.']); +end + +%%%% +sync_frame = -1; +while sync_frame < 0 || sync_frame > vid_reader.Duration*30 + prompt = {'Enter number for frame number for the FIRST FRAME WHEN THE SYNC BUTTON CHANGES COLOR (for the sync instance you want).'}; + title = 'Enter sync frame'; + dims = [1 35]; + definput =cellstr('0'); + answer = inputdlg(prompt,title,dims,definput); + if ~isempty(answer) + sync_frame = str2num(answer{1}); + end + if (sync_frame < 0 || sync_frame > vid_reader.Duration*30 || floor(sync_frame) ~= sync_frame) && ~strcmp(questdlg(['Invalid sync frame number. Please double-check the frame stamps in VLC and write the response as a positive integer between 0 and ' num2str(vid_reader.Duration*30) '. Do you want to try again?'],''),'Yes') + waitfor(errordlg('No valid sync frame available. Data processing aborted: no sync frame available.')); + throw(MException('Custom:Custom','Failure: no sync frame.')); + end +end + +processed_data.scalars.sync_frame = sync_frame; +waitfor(helpdlg('Sync frame saved.')); +%clearvars vid_reader status isdlg frame_rate video_path start_time_sec sync_frame prompt title dims definput answer vid_name proc_vid_name prompt title dims definput answer video_file video_name isdlg frame_rate oldpath; \ No newline at end of file diff --git a/matlab/eeg_align.asv b/matlab/eeg_align.asv new file mode 100644 index 0000000..8375bde --- /dev/null +++ b/matlab/eeg_align.asv @@ -0,0 +1,27 @@ +% If no trial directory variable, try current directory. +if ~exist('trial_directory', 'var') + global trial_directory; + trial_directory = get_path_ui(pwd, '', 'trial directory', 'This is the directory that contains one trial worth of raw data you downloaded from the server.', false); +end + +% get matlab EEG file - find in directory or from UI dialog. +eeg_name = get_path_ui(trial_directory, '*201*.mat', 'EEG Matlab data', 'The file is usually named with a date and time stamp with the extension .mat and in the main trial directory.',true); + +% load matlab EEG file +load(eeg_name); + +% find name of eeg data variable +% (the file has the eeg data in a matrix with an auto-generated name) +% this find the data and puts it in a var called 'eeg_data' +varnames = who('*mff'); +eeg_data_raw = eval(varnames{1}); + +% crop eeg data to din sync +eeg_data = eeg_data_raw(:,(processed_data.scalars.din_time_ms-processed_data.scalars.eeg_start_time_ms)/1000:end).'; + +% add a row for millisecond timestamp to synced eeg data +stamps = ones(length(processed_data.eeg(65,:)),1); +stamps(1) = 0; +stamps = cumsum(stamps); +eeg_table = table(stamps,eeg_da +processed_data.eeg = vertcat(stamps, processed_data.eeg); diff --git a/matlab/eeg_align.m b/matlab/eeg_align.m new file mode 100644 index 0000000..c36fef6 --- /dev/null +++ b/matlab/eeg_align.m @@ -0,0 +1,25 @@ +function eeg = eeg_align() +% If no trial directory variable, try current directory. +trial_directory = get_trial_directory(); + +% get matlab EEG file - find in directory or from UI dialog. +eeg_name = get_path_ui(trial_directory, '*201*.mat', 'EEG Matlab data', 'The file is usually named with a date and time stamp with the extension .mat and in the main trial directory.',true); + +% load matlab EEG file +load(eeg_name); + +% find name of eeg data variable +% (the file has the eeg data in a matrix with an auto-generated name) +% this find the data and puts it in a var called 'eeg_data' +varnames = who('*mff'); +eeg_data_raw = eval(varnames{1}); + +% crop eeg data to din sync +eeg_data = eeg_data_raw(:,(processed_data.scalars.din_time_ms-processed_data.scalars.eeg_start_time_ms)/1000:end).'; + +% add a row for millisecond timestamp to synced eeg data +stamps = ones(length(eeg_data),1); +stamps(1) = 0; +stamps = cumsum(stamps); +eeg_table = table(stamps,eeg_data,'VariableNames',{'timestamp_ms','eeg'}); +processed_data.eeg = eeg_table; \ No newline at end of file diff --git a/matlab/extract_csv_sync.m b/matlab/extract_csv_sync.m new file mode 100644 index 0000000..78c2f80 --- /dev/null +++ b/matlab/extract_csv_sync.m @@ -0,0 +1,24 @@ +% Gets sync index and sync epochtime from gameplay csv file +function [sync_index, sync_epochtime] = extract_csv_sync(file_name, which_sync) +delimiter = ','; +% Read columns of data as text: +formatSpec = '%s%[^\n\r]'; +% Open the csv text file. +fileID = fopen(file_name,'r'); +% Read columns of data according to the format. +dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'ReturnOnError', false); +% Close the csv text file. +fclose(fileID); +if (which_sync == 1) + sync_index = find(strlength(dataArray{1}) > 4); +else + sync_indices = find(strlength(dataArray{1}) > 4); + if which_sync > length(sync_indices) + throw(MException('Custom:Custom',['Failure: Sync index provided exceeds number of sync signals in csv file'])); + end + sync_index = sync_indices(which_sync); +end +sync_string = dataArray{1}(sync_index); +sync_epochtime_split = strsplit(sync_string,'t'); +sync_epochtime = str2double(sync_epochtime_split(end)); +end \ No newline at end of file diff --git a/matlab/extract_din_time.asv b/matlab/extract_din_time.asv new file mode 100644 index 0000000..001eac6 --- /dev/null +++ b/matlab/extract_din_time.asv @@ -0,0 +1,65 @@ +function [din_time_ms, eeg_start_time_ms] = extract_din_time() +%extract din time offset from netstation-generated XML files +%highly specific to our extraction settings +%times saved to processed_data.scalars.eeg_start_time_ms +%and processed_data.scalars.din_time_ms + +% If no trial directory variable, try current directory. +trial_directory = get_trial_directory; + +% Get DIN1 xml and info xml - find in directory or from UI dialog. +din_name = get_path_ui(trial_directory, fullfile('*mff','Events_DIN1.xml'), 'DIN1 xml file', 'The file is usually called Events_DIN1.xml and in a date-stamped folder ending with mff inside the main trial directory.',true); +info_name = get_path_ui(trial_directory, fullfile('*mff','info.xml'), 'info xml file', 'The file is usually called info.xml and in a date-stamped folder ending with mff inside the main trial directory.',true); + +fileID = fopen(din_name,'r'); +din_imp = textscan(fileID,'%s'); +din_imp = din_imp{1}; +has_time = find(contains(din_imp,"Time>")); +dins = []; %in microseconds +for k = 1:length(has_time) + tag = din_imp(has_time(k)); + tag = tag{1}; + cplace = strfind(tag,':'); + cplace = cplace(1); + mins = str2num(tag(cplace+1:cplace+2)); + secs = str2num(tag(cplace+4:cplace+5)); + microsecs = str2num(tag(cplace+7:cplace+12)); + dins = [dins microsecs + secs*1000000 + mins*60*1000000;]; +end +fclose(fileID); +fileID = fopen(info_name,'r'); +info_imp = textscan(fileID,'%s'); +info_imp = info_imp{1}; +has_time = find(contains(info_imp,"Time>")); +tag = info_imp(has_time); +tag = tag{1}; +cplace = strfind(tag,':'); +cplace = cplace(1); +mins = str2num(tag(cplace+1:cplace+2)); +secs = str2num(tag(cplace+4:cplace+5)); +microsecs = str2num(tag(cplace+7:cplace+12)); +which_din = 0; +if length(dins) > 1 +%%take user input on which din + while which_din < 1 || which_din > length(dins) + prompt = {['DIN log has multiple DIN1s for this trial. Which DIN to use (between 1 and ' num2str(length(dins)) ' inclusive?) Check notes for this trial if unsure.']}; + title = 'Select DIN'; + dims = [1 35]; + definput =cellstr('1'); + answer = inputdlg(prompt,title,dims,definput); + if ~isempty(answer) + which_din = str2num(answer{1}); + end + if (isempty(which_din) || which_din < 1 || which_din > length(dins) || which_din ~= floor(which_din) )&& ~strcmp(questdlg(['No valid DIN index entered. Please double check value and enter an integer between 1 and ' num2str(length(dins)) '. Do you want to try again?'],'Yes','No','Yes'),'Yes') + waitfor(errordlg('No valid DIN index available. Data processing aborted.')); + throw(MException('Custom:Custom','Failure: DIN index.')); + end + end +else + which_din = 1; +end + +din_time_ms = dins(which_din); +processed_data.scalars.din_time_ms = din_time_ms; +eeg_start_time_ms = microsecs + secs*1000000 + mins*1000000*60; +processed_data.scalars.eeg_start_time_ms = eeg_start_time_ms; diff --git a/matlab/extract_din_time.m b/matlab/extract_din_time.m new file mode 100644 index 0000000..fe17870 --- /dev/null +++ b/matlab/extract_din_time.m @@ -0,0 +1,66 @@ +function [din_time_ms, eeg_start_time_ms] = extract_din_time() +%extract din time offset from netstation-generated XML files +%highly specific to our extraction settings +%times saved to processed_data.scalars.eeg_start_time_ms +%and processed_data.scalars.din_time_ms + +% If no trial directory variable, try current directory. +trial_directory = get_trial_directory; + +% Get DIN1 xml and info xml - find in directory or from UI dialog. +din_name = get_path_ui(trial_directory, fullfile('*mff','Events_DIN1.xml'), 'DIN1 xml file', 'The file is usually called Events_DIN1.xml and in a date-stamped folder ending with mff inside the main trial directory.',true); +info_name = get_path_ui(trial_directory, fullfile('*mff','info.xml'), 'info xml file', 'The file is usually called info.xml and in a date-stamped folder ending with mff inside the main trial directory.',true); + +fileID = fopen(din_name,'r'); +din_imp = textscan(fileID,'%s'); +din_imp = din_imp{1}; +has_time = find(contains(din_imp,"Time>")); +dins = []; %in microseconds +for k = 1:length(has_time) + tag = din_imp(has_time(k)); + tag = tag{1}; + cplace = strfind(tag,':'); + cplace = cplace(1); + mins = str2num(tag(cplace+1:cplace+2)); + secs = str2num(tag(cplace+4:cplace+5)); + microsecs = str2num(tag(cplace+7:cplace+12)); + dins = [dins microsecs + secs*1000000 + mins*60*1000000;]; +end +fclose(fileID); +fileID = fopen(info_name,'r'); +info_imp = textscan(fileID,'%s'); +info_imp = info_imp{1}; +has_time = find(contains(info_imp,"Time>")); +tag = info_imp(has_time); +tag = tag{1}; +cplace = strfind(tag,':'); +cplace = cplace(1); +mins = str2num(tag(cplace+1:cplace+2)); +secs = str2num(tag(cplace+4:cplace+5)); +microsecs = str2num(tag(cplace+7:cplace+12)); +which_din = 0; +if length(dins) > 1 +%%take user input on which din + while which_din < 1 || which_din > length(dins) + prompt = {['DIN log has multiple DIN1s for this trial. Which DIN to use (between 1 and ' num2str(length(dins)) ' inclusive?) Check notes for this trial if unsure.']}; + title = 'Select DIN'; + dims = [1 35]; + definput =cellstr('1'); + answer = inputdlg(prompt,title,dims,definput); + if ~isempty(answer) + which_din = str2num(answer{1}); + end + while (isempty(which_din) || which_din < 1 || which_din > length(dins) || which_din ~= floor(which_din) )&& ~strcmp(questdlg(['No valid DIN index entered. Please double check value and enter an integer between 1 and ' num2str(length(dins)) '. Do you want to try again?'],'Invalid DIN Index','Yes','No','Yes'),'Yes') + waitfor(errordlg('No valid DIN index available. Data processing aborted.')); + throw(MException('Custom:Custom','Failure: DIN index.')); + end + end +else + which_din = 1; +end + +din_time_ms = dins(which_din); +processed_data.scalars.din_time_ms = din_time_ms; +eeg_start_time_ms = microsecs + secs*1000000 + mins*1000000*60; +processed_data.scalars.eeg_start_time_ms = eeg_start_time_ms; +end \ No newline at end of file diff --git a/matlab/feeltrace_align.m b/matlab/feeltrace_align.m new file mode 100644 index 0000000..5fd0e3d --- /dev/null +++ b/matlab/feeltrace_align.m @@ -0,0 +1,83 @@ +%extract unique-timestamp feeltrace data, sync feeltrace timestamps +%and compile concise array of feeltrace data and timestamps +%name of feeltrace file +% If no trial directory variable, try current directory. +if ~exist('trial_directory', 'var') + global trial_directory; + trial_directory = get_path_ui(pwd, '', 'trial directory', 'This is the directory that contains one trial worth of raw data you downloaded from the server.', false); +end + +% Get csv - find in directory or from UI dialog. +feeltrace_file = get_path_ui(trial_directory, 'feeltrace*.csv', 'feeltrace .csv file', 'The file is usually called feeltrace-[number].csv and in the main trial directory.',true); +filename = feeltrace_file; + +% Extract feeltrace and video timestamp columns from csv +feeltrace_joystick = get_numerical_csv_column(filename, 6); +feeltrace_videoTimestamp = get_numerical_csv_column(filename, 9); + +%copy over raw data, remove header row +feeltrace_joystick = feeltrace_joystick(2:end); +feeltrace_videoTimestamp = feeltrace_videoTimestamp(2:end); + + +% %find where video actually starts playing, remove data before +% vid_start_index = find(feeltrace_videoTimestamp > 0, 1)+1; +% feeltrace_joystick = feeltrace_joystick(vid_start_index:end); +% feeltrace_videoTimestamp = feeltrace_videoTimestamp(vid_start_index:end); + +vid_start_index = find(feeltrace_videoTimestamp >0, 1)+1; +feeltrace_joystick = feeltrace_joystick(vid_start_index:end); +feeltrace_videoTimestamp = feeltrace_videoTimestamp(vid_start_index:end) + +%convert to milliseconds, subtract sync offset and round to integer +feeltrace_round_times_ms = round((feeltrace_videoTimestamp*1000 - (processed_data.scalars.sync_frame*1000 / processed_data.scalars.frame_rate))); + +%transpose joystick data: subtract minimum +feeltrace_joystick = feeltrace_joystick - min(feeltrace_joystick); + +nodiffs = remove_time_nodiffs(horzcat(feeltrace_joystick, feeltrace_round_times_ms), feeltrace_round_times_ms); + +% %% DIFF REMOVE +% %array of indices where video timestamp is in differend millisecond +% feeltrace_vidTimeChanged = ischange(feeltrace_round_times_ms); +% +% %array of indices where video timestamp is in different millisecond +% changept_indices = vertcat(1, find(feeltrace_vidTimeChanged)); +% +% %prepare array of compiled joystick values for unique timestamps +% con_joystick = zeros(length(changept_indices),1); +% %and array of unique video timestamps +% con_vidTimestamp = zeros(length(changept_indices),1); +% +% %populate arrays +% for k = 1:length(changept_indices)-1 +% con_joystick(k) = median(feeltrace_joystick(changept_indices(k):changept_indices(k+1)-1)); +% con_vidTimestamp(k) = feeltrace_round_times_ms(changept_indices(k)); +% end +%% + +%collect data into table +%feeltrace_condensed = table(con_vidTimestamp, con_joystick, 'VariableNames', {'timestamp_ms' 'joystick'}); +feeltrace_condensed = table(nodiffs(:,2), nodiffs(:,1),'VariableNames', {'timestamp_ms' 'joystick'}); +%feeltrace_condensed = feeltrace_condensed(1:find(feeltrace_condensed.timestamp_ms == 0, 1)-1,:); + +processed_data.feeltrace = feeltrace_condensed; +%align feeltrace data to master array +% aligned_data(1).feeltrace = []; +% l = 1; +% a = length(feeltrace_condensed.joystick); +% for k=1:length([aligned_data.timestamp_ms]) +% if l > a +% break; +% end +% if feeltrace_condensed.timestamp_ms(l) == aligned_data(k).timestamp_ms +% aligned_data(k).feeltrace = feeltrace_condensed.joystick(l); +% l = l+1; +% else +% aligned_data(k).feeltrace = []; +% end +% end +% close(f); +% save(fullfile(processed_directory, 'processed_data.mat'),'aligned_data', 'processed_data.scalars'); +%clear excess variables +%clearvars f feeltrace_condensed feeltrace_file feeltrace_path k a isdlg feeltrace_name feeltrace feeltrace_joystick feeltrace_videoTimestamp vid_start_index feeltrace_round_times_ms feeltrace_vidTimeChanged changept_indices con_joystick con_vidTimestamp l; \ No newline at end of file diff --git a/matlab/fsr_gameplay_align.asv b/matlab/fsr_gameplay_align.asv new file mode 100644 index 0000000..25461d5 --- /dev/null +++ b/matlab/fsr_gameplay_align.asv @@ -0,0 +1,72 @@ +% Import FSR data and align to EEG. + +% If no trial directory variable, try current directory. +if ~exist('trial_directory') + trial_directory = pwd; +end + +% Get FSR gameplay csv - find in directory or from UI dialog. +fsr_file = get_path_ui(trial_directory, 'gameplay*.csv', 'gameplay .csv file', 'The file is usually called gameplay-[number].csv and in the main trial directory.', true); +filename = fsr_file; + +% Extract one column from CSV to get length. +A0_raw = get_numerical_csv_column(filename, 1); + +% Initialize matrix to hold raw data. +gameplay_fromsync = zeros(length(A0_raw), 6); + +% Extract remaining columns from csv. +gameplay_fromsync(:,6) = get_numerical_csv_column(filename, 10); +gameplay_fromsync(:,1) = A0_raw; +gameplay_fromsync(:,2) = get_numerical_csv_column(filename, 2); +gameplay_fromsync(:,3) = get_numerical_csv_column(filename, 3); +gameplay_fromsync(:,4) = get_numerical_csv_column(filename, 4); +gameplay_fromsync(:,5) = get_numerical_csv_column(filename, 5); + +% Extract sync time and sync index from csv. +% If more than one sync, get sync as specified in processed_data.scalars. +[processed_data.scalars.gameplay_sync_index, processed_data.scalars.gameplay_sync_epochtime] = extract_csv_sync(filename, processed_data.scalars.which_gameplay_sync); + +% Remove data from before sync. +% Subtract epoch time offset to get time = miliseconds from sync. +gameplay_fromsync = gameplay_fromsync(processed_data.scalars.gameplay_sync_index+1:end,:); +gameplay_fromsync(:,6) = gameplay_fromsync(:,6) - gameplay_fromsync(1,6); + +% Remove duplicate entries with same timestamp. +gameplay_fromsync = remove_time_nodiffs(gameplay_fromsync, gameplay_fromsync(:,6)); + +% Remove data from timestamps after end of EEG data. +eeg_stamps = processed_data.eeg(1,:); +eeg_endstamp = eeg_stamps(end); +ind_timestamp_after_eeg_end = find(gameplay_fromsync(:,6) > eeg_endstamp); +if ~isempty(ind_timestamp_after_eeg_end) + gameplay_fromsync = gameplay_fromsync(1:ind_timestamp_after_eeg_end,:); +end + +fsr_table = table(gameplay_fromsync(:,1 + +processed_data.fsr = gameplay_fromsync; + +% +% % Align data to master array +% l = 1; +% aligned_data(1).A0_fsr = 0; +% aligned_data(1).A1_fsr = 0; +% a1 = []; +% for k=1:length([aligned_data(:).timestamp_ms]) +% if (l > length(gameplay_fromsync(:,6))) +% break; +% end +% if gameplay_fromsync(l,6) == aligned_data(k).timestamp_ms +% aligned_data(k).A0_fsr = gameplay_fromsync(l,1); +% a1 = [a1 gameplay_fromsync(l,2)]; +% aligned_data(k).A1_fsr = gameplay_fromsync(l,2); +% aligned_data(k).A2_fsr = gameplay_fromsync(l,3); +% aligned_data(k).A3_fsr = gameplay_fromsync(l,4); +% aligned_data(k).A4_fsr = gameplay_fromsync(l,5); +% l = l+1; +% end +% end +% +% % +% clearvars f gameplay_fromsync a1 gameplay_A0 gameplay_A1 gameplay_A2 gameplay_A3 gameplay_A4 gameplay_time_epoch old_path fsr_file fsr_name fsr_path ind_timestamp_after_eeg_end time_diffs time_nodiffs nodiffs_vec k l m zind a b l averagel; diff --git a/matlab/fsr_gameplay_align.m b/matlab/fsr_gameplay_align.m new file mode 100644 index 0000000..bf55f8f --- /dev/null +++ b/matlab/fsr_gameplay_align.m @@ -0,0 +1,72 @@ +% Import FSR data and align to EEG. + +% If no trial directory variable, try current directory. +if ~exist('trial_directory') + trial_directory = pwd; +end + +% Get FSR gameplay csv - find in directory or from UI dialog. +fsr_file = get_path_ui(trial_directory, 'gameplay*.csv', 'gameplay .csv file', 'The file is usually called gameplay-[number].csv and in the main trial directory.', true); +filename = fsr_file; + +% Extract one column from CSV to get length. +A0_raw = get_numerical_csv_column(filename, 1); + +% Initialize matrix to hold raw data. +gameplay_fromsync = zeros(length(A0_raw), 6); + +% Extract remaining columns from csv. +gameplay_fromsync(:,6) = get_numerical_csv_column(filename, 10); +gameplay_fromsync(:,1) = A0_raw; +gameplay_fromsync(:,2) = get_numerical_csv_column(filename, 2); +gameplay_fromsync(:,3) = get_numerical_csv_column(filename, 3); +gameplay_fromsync(:,4) = get_numerical_csv_column(filename, 4); +gameplay_fromsync(:,5) = get_numerical_csv_column(filename, 5); + +% Extract sync time and sync index from csv. +% If more than one sync, get sync as specified in processed_data.scalars. +[processed_data.scalars.gameplay_sync_index, processed_data.scalars.gameplay_sync_epochtime] = extract_csv_sync(filename, processed_data.scalars.which_gameplay_sync); + +% Remove data from before sync. +% Subtract epoch time offset to get time = miliseconds from sync. +gameplay_fromsync = gameplay_fromsync(processed_data.scalars.gameplay_sync_index+1:end,:); +gameplay_fromsync(:,6) = gameplay_fromsync(:,6) - gameplay_fromsync(1,6); + +% Remove duplicate entries with same timestamp. +gameplay_fromsync = remove_time_nodiffs(gameplay_fromsync, gameplay_fromsync(:,6)); + +% Remove data from timestamps after end of EEG data. +eeg_stamps = processed_data.eeg(1,:); +eeg_endstamp = eeg_stamps(end); +ind_timestamp_after_eeg_end = find(gameplay_fromsync(:,6) > eeg_endstamp); +if ~isempty(ind_timestamp_after_eeg_end) + gameplay_fromsync = gameplay_fromsync(1:ind_timestamp_after_eeg_end,:); +end + +fsr_table = table(gameplay_fromsync(:,6), gameplay_fromsync(:,1), gameplay_fromsync(:,2), gameplay_fromsync(:,3), gameplay_fromsync(:,4), gameplay_fromsync(:,5), 'VariableNames', {'timestamp_ms', 'A0','A1','A2','A3','A4'}); + +processed_data.fsr = fsr_table; + +% +% % Align data to master array +% l = 1; +% aligned_data(1).A0_fsr = 0; +% aligned_data(1).A1_fsr = 0; +% a1 = []; +% for k=1:length([aligned_data(:).timestamp_ms]) +% if (l > length(gameplay_fromsync(:,6))) +% break; +% end +% if gameplay_fromsync(l,6) == aligned_data(k).timestamp_ms +% aligned_data(k).A0_fsr = gameplay_fromsync(l,1); +% a1 = [a1 gameplay_fromsync(l,2)]; +% aligned_data(k).A1_fsr = gameplay_fromsync(l,2); +% aligned_data(k).A2_fsr = gameplay_fromsync(l,3); +% aligned_data(k).A3_fsr = gameplay_fromsync(l,4); +% aligned_data(k).A4_fsr = gameplay_fromsync(l,5); +% l = l+1; +% end +% end +% +% % +% clearvars f gameplay_fromsync a1 gameplay_A0 gameplay_A1 gameplay_A2 gameplay_A3 gameplay_A4 gameplay_time_epoch old_path fsr_file fsr_name fsr_path ind_timestamp_after_eeg_end time_diffs time_nodiffs nodiffs_vec k l m zind a b l averagel; diff --git a/matlab/get_numerical_csv_column.m b/matlab/get_numerical_csv_column.m new file mode 100644 index 0000000..f0b5652 --- /dev/null +++ b/matlab/get_numerical_csv_column.m @@ -0,0 +1,30 @@ +% Gets column of numbers from CSV file. +% Non-numerical values are replaced by NaN. + +function the_column = get_numerical_csv_column(file_name, column_number) +delimiter = ','; + +% Status bar. +%f = waitbar(0.7,'Importing FSR data','Name','Data Processing'); + +% Read columns of data as text: +formatSpec = [repmat('%*s',1,column_number-1) '%s%[^\n\r]']; + +% Open the csv text file. +fileID = fopen(file_name,'r'); +% Read columns of data according to the format. +dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'ReturnOnError', false); +% Close the csv text file. +fclose(fileID); + +% Convert the contents of columns containing numeric text to numbers. +% Replace non-numeric text with NaN. +raw = repmat({''},length(dataArray{1}),length(dataArray)-1); +for col=1:length(dataArray)-1 + raw(1:length(dataArray{col}),col) = mat2cell(dataArray{col}, ones(length(dataArray{col}), 1)); +end +numericData = NaN(size(dataArray{1},1),size(dataArray,2)); +rawData = dataArray{1}; +raw = str2double(rawData); + +the_column = raw; \ No newline at end of file diff --git a/matlab/get_path_ui.m b/matlab/get_path_ui.m new file mode 100644 index 0000000..ef62c3c --- /dev/null +++ b/matlab/get_path_ui.m @@ -0,0 +1,42 @@ +function the_fullpath = get_path_ui(the_trial_directory, the_pattern, the_descript, help_message, isfile) + +the_fullpath = dir(fullfile(the_trial_directory, the_pattern)); +if (~isempty(the_fullpath) && isfile) + the_name = the_fullpath.name; + the_path = the_fullpath.folder; +else + if isfile + msg = ['Unable to automatically locate ' the_descript '. Please find it manually.']; + msg = [msg newline newline help_message]; + waitfor(warndlg(msg, 'Cannot Find Path')); + the_split = strsplit(the_pattern, '.'); + the_ext = the_split(end); + the_type = ['*.' char(the_ext)]; + [the_name, the_path] = uigetfile(the_type, ['Find ' the_descript]); + else + msg = ['Please select ' the_descript '.' newline newline help_message]; + waitfor(helpdlg(msg, 'Select Path')); + the_name = ''; + the_path = uigetdir(the_trial_directory, ['Find ' the_descript]); + end + %isdlg = 'No'; + while the_path(1) == 0 && strcmp(questdlg(['No ' the_descript ' was selected. Do you want to keep looking for this yourself?'],'Cannot Find Path','Yes','No','Yes'),'Yes') + if isfile + [the_name, the_path] = uigetfile(file_type,['Find ' the_descript]); + else + the_path = uigetdir(the_trial_directory, ['Find ' the_descript]); + end + end + if the_path(1) == 0 + waitfor(errordlg(['Aborting data processing: no valid ' the_descript ' found'], 'Path Not Available')); + throw(MException('Custom:Custom',['Failure: unable to find valid ' the_descript '.'])); + end +end + +if isfile + the_fullpath = fullfile(the_path,the_name); +else + the_fullpath = the_path; +end + +end \ No newline at end of file diff --git a/matlab/graph_bar.m b/matlab/graph_bar.m new file mode 100644 index 0000000..eeb0e0d --- /dev/null +++ b/matlab/graph_bar.m @@ -0,0 +1,115 @@ +f = waitbar(0.9,'Plotting FSR and feeltrace data','Name','Data Processing'); +clf('reset'); +clearvars fig; +hold off; +if ~exist('trial_directory') + trial_directory = uigetdir(path,"Select directory containg raw data from the trial"); +end +if ~exist('processed_directory') + processed_directory = uigetdir(path,"Select directory to save processed data in."); +end +if ~exist('trial_number') + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 35]; + definput = {'0'}; + trial_number = inputdlg(prompt,title,dims,definput); +end +feeltrace_timestamps = zeros(length([aligned_data(:).feeltrace]),1); +fsr_timestamps = zeros(length([aligned_data(:).A0_fsr]),1); +feeltrace_data = zeros(length([aligned_data(:).feeltrace]),1); +A0_data = zeros(length([aligned_data(:).A0_fsr]),1); +A1_data = zeros(length([aligned_data(:).A1_fsr]),1); +A2_data = zeros(length([aligned_data(:).A2_fsr]),1); +A3_data = zeros(length([aligned_data(:).A3_fsr]),1); +A4_data = zeros(length([aligned_data(:).A4_fsr]),1); + +fti = 1; +a0i = 1; + +for k = 1:length([aligned_data(:).timestamp_ms]) + if ~isempty(aligned_data(k).feeltrace) + feeltrace_timestamps(fti) = (k-1)/60000; + feeltrace_data(fti) = aligned_data(k).feeltrace; + fti = fti + 1; + end + if ~isempty(aligned_data(k).A0_fsr) + fsr_timestamps(a0i) = (k-1)/60000; + A0_data(a0i) = aligned_data(k).A0_fsr; + A1_data(a0i) = aligned_data(k).A1_fsr; + A2_data(a0i) = aligned_data(k).A2_fsr; + A3_data(a0i) = aligned_data(k).A3_fsr; + A4_data(a0i) = aligned_data(k).A4_fsr; + a0i = a0i + 1; + end +end + +clearvars title; +feeltrace_data = smooth(feeltrace_data, 101); + +A0_data = smooth(A0_data, 30); +A1_data = smooth(A1_data, 30); +A2_data = smooth(A2_data, 30); +A3_data = smooth(A3_data, 30); +A4_data = smooth(A4_data, 30); + +max_ft = max(feeltrace_data); +ratio = max([max(A0_data) max(A1_data) max(A2_data) max(A3_data) max(A4_data)])/max(feeltrace_data); +fig = figure(1); +pos1 = [0.1 0.1 0.7 0.8]; +subplot('Position',pos1); +title(strcat("FSR and Feeltrace data for participant ", trial_number)); +hold on; +%%%set(figure,'defaultAxesColorOrder',[[0 0 0]; [0 0 0]]); +area(fsr_timestamps,A0_data/ratio,'FaceColor',[0 1 0], 'EdgeColor', [0 1 0], 'FaceAlpha', 0.5, 'EdgeAlpha', 0.5); +area(fsr_timestamps,A1_data/ratio,'FaceColor',[0 0 1], 'EdgeColor',[0 0 1], 'FaceAlpha', 0.5, 'EdgeAlpha', 0.5); +area(fsr_timestamps,A2_data/ratio,'FaceColor',[1 1 0], 'EdgeColor',[1 1 0], 'FaceAlpha', 0.5, 'EdgeAlpha', 0.5); +area(fsr_timestamps,A3_data/ratio,'FaceColor',[0 1 1], 'EdgeColor',[0 1 1], 'FaceAlpha', 0.5, 'EdgeAlpha', 0.5); +area(fsr_timestamps,A4_data/ratio,'FaceColor',[1 0 1], 'EdgeColor',[1 0 1], 'FaceAlpha', 0.5, 'EdgeAlpha', 0.5); +ylabel('Intensity of keypress'); +%yticks([]) +%%%plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',1); +%plot(feeltrace_timestamps,feeltrace_data,'Color',[1 1 1],'LineWidth',6.5); +%plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',3); +%hold off; + +yyaxis right +ax = get(gcf,'CurrentAxes'); +ax.YAxis(2).Color = 'black'; +%plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0]); +yticks([0 max_ft]) +yticklabels({'Relief','Stress'}) +ylabel('Feeltrace from stres to relief') +xlabel('Time (min)'); + +pos1 = [0.8 0.1 0.2 0.8]; +hSub = subplot('Position',pos1); +hold on; +plot(1,nan,'Color',[0.2 1 0.2]); +plot(1,nan,'Color',[0.2 0.2 1]); +plot(1,nan,'Color',[1 1 0.2]); +plot(1,nan,'Color',[0.2 1 1]); +plot(1,nan,'Color',[1 0.2 1]); +plot(1,nan,'Color',[0 0 0], 'LineWidth', 2); +hold off; +set(hSub, 'Visible', 'off'); +legend('alt (grab) key','right key','down key','left key','up key','feeltrace'); +t = title('FSR and Feeltrace data from Participant'); +%gca.Ycolor = [0 0 0]; +%set(gca,'YTickLabel',[]); +%yyaxis left +%ylabel('Reported stress level'); +%set(gca,'YTickLabel',[]); +%title('Keypress FSR and stress-to-relief feeltrace during gameplay'); + + +saveas(gcf,fullfile(processed_directory,['fsr_and_feeltrace' char(trial_number) '.png'])); + +fig.PaperUnits = 'inches'; +orient(fig,'landscape') +fig.PaperPosition = [0 0 10 8]; +print(fullfile(processed_directory,['fsr_and_feeltrace-large' char(trial_number)]),'-dpng','-r0'); + +close(f); +%clf('reset'); +%clearvars f feeltrace_timestamps feeltrace_data fsr_timestamps A0_data A1_data A2_data A3_data A4_data k a0i fti; diff --git a/matlab/load_globals.m b/matlab/load_globals.m new file mode 100644 index 0000000..597f739 --- /dev/null +++ b/matlab/load_globals.m @@ -0,0 +1,66 @@ +%% LOAD TRIAL DIRECTORY +if ~exist('trial_directory', 'var') + directory_type = 'trial directory'; + directory_helpmessage = 'This is the directory that contains one trial worth of raw data you downloaded from the server.'; + trial_directory = get_path_ui(pwd, '', directory_type, directory_helpmessage,false); +end + +%% LOAD PROCESSED DIRECTORY +if ~exist('processed_directory', 'var') + directory_type = 'processed data directory'; + directory_helpmessage = 'This is the directory where processed data from this trial will be saved to.'; + processed_directory = get_path_ui(pwd, '', directory_type, directory_helpmessage,false); +end +[fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); +fclose(fid); +delete(fullfile(processed_directory,'not_a_real_file.txt')); +while strcmp(errormsg,'Permission denied') + msg = 'Cannot write to selected directory.'; + msg = [msg newline newline 'Please select different directory for saving processed data.']; + waitfor(warndlg(msg)); + processed_directory = get_path_ui(pwd, '', 'processed data directory', 'This is the directory where processed data from this trial will be saved to.', false); + [fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); + fclose(fid); + delete(fullfile(processed_directory,'not_a_real_file.txt')); +end + +%% LOAD PROCESSED DATA +if ~exist('processed_data','var') + processed_data = struct; +end +if ~exist('processed_directory','var') + get_processed_directory; +end +if isfile(fullfile(processed_directory,'processed_data.mat')) + t_processed_data = processed_data; + t_fieldnames = fieldnames(t_processed_data); + open(fullfile(processed_directory,'processed_data.mat')); + for i = numel(t_fieldnames) + if strcmp(t_fieldnames{i},'scalars'); + processed_data.(t_fieldnames{i}) = t_processed_data.(t_fieldnames{i}); + else + t_scalar_fieldnames = fields(t_processed_data.scalars); + for j = numel(t_scalar_fieldnames) + processed_data.scalars.(t_scalar_fieldnames{i}) = t_processed_data.scalars.(t_struct_fieldnames{i}); + end + end + end +end + +%% LOAD TRIAL NUMBER +if ~exist('trial_number', 'var') + if exist('processed_data','var') && any(ismember(fields(processed_data),{'scalars'})) && ~any(ismember(fields(processed_data.scalars),{'trial_number'})) + trial_number = processed_data.scalars.trial_number; + else + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 50]; + % put thing anticipating here + definput = {'0'}; + trial_response_cell = inputdlg(prompt,title,dims,definput); + trial_number = trial_response_cell{1}; + end +end +processed_data.scalars.trial_number = trial_number{1}; + + diff --git a/matlab/old/get_processed_data.m b/matlab/old/get_processed_data.m new file mode 100644 index 0000000..1491e22 --- /dev/null +++ b/matlab/old/get_processed_data.m @@ -0,0 +1,22 @@ +if ~exist('processed_data','var') + processed_data = struct; +end +if ~exist('processed_directory','var') + get_processed_directory; +end +if isfile(fullfile(processed_directory,'processed_data.mat'),) + t_processed_data = processed_data; + t_fieldnames = fieldnames(t_processed_data); + open(fullfile(processed_directory,'processed_data.mat')); + for i = numel(t_fieldnames) + if t_fieldnames{i} ~= 'scalars'; + processed_data.(t_fieldnames{i}) = t_processed_data.(t_fieldnames{i}); + else + t_struct_fieldnames = t_fieldnames(t_processed_data.scalars); + for j = numel(t_struct_fieldnames) + processed_data.(t_struct_fieldnames{i}) = t_processed_data.(t_struct_fieldnames{i}); + end + end + end + processed_data = [the_processed_data processed_data]; +end \ No newline at end of file diff --git a/matlab/old/get_processed_directory.m b/matlab/old/get_processed_directory.m new file mode 100644 index 0000000..15792cc --- /dev/null +++ b/matlab/old/get_processed_directory.m @@ -0,0 +1,17 @@ +if ~exist('processed_directory', 'var') + directory_type = 'processed data directory'; + directory_helpmessage = 'This is the directory where processed data from this trial will be saved to.'; + processed_directory = get_path_ui(pwd, '', directory_type, directory_helpmessage,false); +end +[fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); +fclose(fid); +delete(fullfile(processed_directory,'not_a_real_file.txt')); +while strcmp(errormsg,'Permission denied') + msg = 'Cannot write to selected directory.'; + msg = [msg newline newline 'Please select different directory for saving processed data.']; + waitfor(warndlg(msg)); + processed_directory = get_path_ui(pwd, '', 'processed data directory', 'This is the directory where processed data from this trial will be saved to.', false); + [fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); + fclose(fid); + delete(fullfile(processed_directory,'not_a_real_file.txt')); +end \ No newline at end of file diff --git a/matlab/old/load_trial.m b/matlab/old/load_trial.m new file mode 100644 index 0000000..bcda02b --- /dev/null +++ b/matlab/old/load_trial.m @@ -0,0 +1,12 @@ +if ~exist('trial_number', 'var') && exist('processed_data','var') && exist('processed_data.scalars','var') && exist ('processed_data.scalars.trial_number','var') + trial_number = processed_data.scalars.trial_number; +else + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 50]; + % put thing anticipating here + definput = {'0'}; + trial_response_cell = inputdlg(prompt,title,dims,definput); + trial_number = trial_response_cell{1}; +end +processed_data.scalars.trial_number = trial_number; diff --git a/matlab/old/plot_experiment.m b/matlab/old/plot_experiment.m new file mode 100644 index 0000000..2682db5 --- /dev/null +++ b/matlab/old/plot_experiment.m @@ -0,0 +1,164 @@ +f = waitbar(0.9,'Plotting FSR and feeltrace data','Name','Data Processing'); +clf('reset'); +clearvars fig; +hold off; +if ~exist('trial_directory') + trial_directory = uigetdir(path,"Select directory containg raw data from the trial"); +end +if ~exist('processed_directory') + processed_directory = uigetdir(path,"Select directory to save processed data in."); +end +if ~exist('trial_number') + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 35]; + definput = {'0'}; + trial_number = inputdlg(prompt,title,dims,definput); +end +feeltrace_timestamps = zeros(length([aligned_data(:).feeltrace]),1); +fsr_timestamps = zeros(length([aligned_data(:).A0_fsr]),1); +feeltrace_data = zeros(length([aligned_data(:).feeltrace]),1); +A0_data = zeros(length([aligned_data(:).A0_fsr]),1); +A1_data = zeros(length([aligned_data(:).A1_fsr]),1); +A2_data = zeros(length([aligned_data(:).A2_fsr]),1); +A3_data = zeros(length([aligned_data(:).A3_fsr]),1); +A4_data = zeros(length([aligned_data(:).A4_fsr]),1); + +fti = 1; +fsri = 1; + +for k = 1:length([aligned_data(:).timestamp_ms]) + if ~isempty(aligned_data(k).feeltrace) + feeltrace_timestamps(fti) = (k-1)/60000; + feeltrace_data(fti) = aligned_data(k).feeltrace; + fti = fti + 1; + end + if ~isempty(aligned_data(k).A0_fsr) + fsr_timestamps(fsri) = (k-1)/60000; + A0_data(fsri) = aligned_data(k).A0_fsr; + A1_data(fsri) = aligned_data(k).A1_fsr; + A2_data(fsri) = aligned_data(k).A2_fsr; + A3_data(fsri) = aligned_data(k).A3_fsr; + A4_data(fsri) = aligned_data(k).A4_fsr; + fsri = fsri + 1; + end +end + +clearvars title; +%feeltrace_data = smooth(feeltrace_data, 30); + +max_ft = max(feeltrace_data); +max_keypress = max([max(A0_data) max(A1_data) max(A2_data) max(A3_data) max(A4_data)]); +%ratio_max_keypress_over_ft = max_keypress/max_ft; +fig = figure(1); +%figure('DefaultAxesFontSize',18) +pos1 = [0.1 0.1 0.7 0.8]; +subplot(6,1,1); +title(strcat("Feeltrace and keypress data for participant ", trial_number)); +%plot(feeltrace_timestamps,feeltrace_data,'Color',[1 1 1],'LineWidth',4); +plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',1.5); +axis([0 feeltrace_timestamps(fti-1) 0 max_ft]); +yticks([0 max_ft]); +yticklabels({'Relief','Stress'}); +ylabel('Feeltrace'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); + +subplot(6,1,2); +area(fsr_timestamps,A0_data,'FaceColor',[239/255 49/255 86/255], 'EdgeColor',[239/255 49/255 86/255]); +axis([0 feeltrace_timestamps(fti-1) 0 max_keypress]); +yticks([0 max_keypress]); +yticklabels({'Min','Max'}); +ylabel('A0'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); + +subplot(6,1,3); +area(fsr_timestamps,A1_data,'FaceColor',[244/255 93/255 1/255], 'EdgeColor',[244/255 93/255 1/255]); +axis([0 feeltrace_timestamps(fti-1) 0 max_keypress]); +yticks([0 max_keypress]); +yticklabels({'Min','Max'}); +ylabel('A1'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); + +subplot(6,1,4); +area(fsr_timestamps,A2_data,'FaceColor',[255/255 159/255 28/255], 'EdgeColor',[255/255 159/255 28/255]); +axis([0 feeltrace_timestamps(fti-1) 0 max_keypress]); +yticks([0 max_keypress]); +yticklabels({'Min','Max'}); +ylabel('A2'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); + +subplot(6,1,5); +area(fsr_timestamps,A3_data,'FaceColor',[86/255 188/255 3/255], 'EdgeColor',[86/255 188/255 3/255]); +axis([0 feeltrace_timestamps(fti-1) 0 max_keypress]); +yticks([0 max_keypress]); +yticklabels({'Min','Max'}); +ylabel('A3'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); + +subplot(6,1,6); +area(fsr_timestamps,A4_data,'FaceColor',[45/255 125/255 210/255], 'EdgeColor',[45/255 125/255 210/255]); +axis([0 feeltrace_timestamps(fti-1) 0 max_keypress]); +yticks([0 max_keypress]); +yticklabels({'Min','Max'}); +ylabel('A4'); +set(gca,'FontSize',18); +set(gca,'linewidth',1); +%plot(fsr_timestamps,A1_data/ratio,'Color',[0.2 0.2 1]); +%plot(fsr_timestamps,A2_data/ratio,'Color',[1 1 0.2]); +%plot(fsr_timestamps,A3_data/ratio,'Color',[0.2 1 1]); +%plot(fsr_timestamps,A4_data/ratio,'Color',[1 0.2 1]); +%ylabel('Intensity of keypress'); +%yticks([]) +%plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',1); + + +%yyaxis right +%ax = get(gcf,'CurrentAxes'); +%ax.YAxis(2).Color = 'black'; +%plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0]); +%yticks([0 max_ft]) +%yticklabels({'Relief','Stress'}) +%ylabel('Feeltrace from stres to relief') +%xlabel('Time (min)'); + +%pos1 = [0.8 0.1 0.2 0.8]; +%hSub = subplot('Position',pos1); +%hold on; +%plot(1,nan,'Color',[0.2 1 0.2]); +%plot(1,nan,'Color',[0.2 0.2 1]); +%plot(1,nan,'Color',[1 1 0.2]); +%plot(1,nan,'Color',[0.2 1 1]); +%plot(1,nan,'Color',[1 0.2 1]); +%plot(1,nan,'Color',[0 0 0], 'LineWidth', 2); +%hold off; +%set(hSub, 'Visible', 'off'); +%legend('alt (grab) key','right key','down key','left key','up key','feeltrace'); +%t = title('FSR and Feeltrace data from Participant'); +%gca.Ycolor = [0 0 0]; +%set(gca,'YTickLabel',[]); +%yyaxis left +%ylabel('Reported stress level'); +%set(gca,'YTickLabel',[]); +%title('Keypress FSR and stress-to-relief feeltrace during gameplay'); + + +saveas(gcf,fullfile(processed_directory,['fsr_and_feeltrace-stacked' char(trial_number) '.png'])); + +fig.PaperUnits = 'inches'; +orient(fig,'landscape') +fig.PaperPosition = [0 0 10 8]; +print(fullfile(processed_directory,['fsr_and_feeltrace-large-stacked' char(trial_number)]),'-dpng','-r0'); + + +fig.PaperUnits = 'inches'; +orient(fig,'landscape') +fig.PaperPosition = [0 0 145 16]; +print(fullfile(processed_directory,['fsr_and_feeltrace-long-stacked' char(trial_number)]),'-dpng','-r0'); + +close(f); +%clearvars definput dims hSub max_ft max_keypress pos1 prompt ratio_max_keypress_over_ft t f feeltrace_timestamps feeltrace_data fsr_timestamps A0_data A1_data A2_data A3_data A4_data k a0i fti; diff --git a/matlab/old/remove_time_nodiffs.m b/matlab/old/remove_time_nodiffs.m new file mode 100644 index 0000000..1e8d4f4 --- /dev/null +++ b/matlab/old/remove_time_nodiffs.m @@ -0,0 +1,43 @@ +function nodiff_version = remove_time_nodiffs(value_matrix, times) + + +%time_diffs = diff(gameplay_fromsync(:,6)); +time_diffs = diff(times); +time_diffs(isnan(time_diffs))=0; +time_nodiffs = ~time_diffs; +%k = start of run where time is static +k = 1; +% l = end of run where time is static +l = 1; +% m = index in nodiffs vector +m = 1; +nodiffs_vec = zeros(length(time_nodiffs),2); +while ~isempty(k) + k = k+find(time_nodiffs(k:end),1)-1; + l = find(time_diffs(k:end),1)-1; + if ~isempty(k) && ~isempty(l) + nodiffs_vec(m,:) = [k k+l]; + end + k = k+l; + m = m+1; +end + +%crop nodiffs vector of trailing 0s +%zind = index of first trailing 0 +zind = find(nodiffs_vec(:,1) == 0,1); +if ~isempty(zind) + nodiffs_vec = nodiffs_vec(1:zind-1,:); +end + + +%remove duplicate timestamps +%b = running offset as all sensor data collected during a timestamp is +%averaged into a single datapoint +b = 0; +for k = 1:length(nodiffs_vec) + averagel = mean(value_matrix(nodiffs_vec(k,1)-b:nodiffs_vec(k,2)-b,:),1); + value_matrix = vertcat(value_matrix(1:nodiffs_vec(k,1)-1-b,:), averagel, value_matrix(nodiffs_vec(k,2)+1-b:end,:)); + b = b + nodiffs_vec(k,2) - nodiffs_vec(k,1); +end +nodiff_version = value_matrix; +end \ No newline at end of file diff --git a/matlab/plot_all_large.asv b/matlab/plot_all_large.asv new file mode 100644 index 0000000..727fd67 --- /dev/null +++ b/matlab/plot_all_large.asv @@ -0,0 +1,175 @@ +%load_globals; +MS_PER_MIN = 60000; +LONGEST_TRIAL_LENGTH_MIN = 22; + +% If data to plot is not available, don't do anything +if ~any(ismember(fields(processed_data),{'feeltrace'})) || ~any(ismember(fields(processed_data),{'fsr'})) || ~any(ismember(fields(processed_data),{'interview'})) + waitfor(errordlg('Cannot plot data: missing one or more fields.', 'Cannot Plot Data')); +else + %% PREPARING STUFF TO PLOT + % array of ones for 1D interview plot at controlled height + interview_ones = ones(length(processed_data.interview.timestamp_ms),1); + % array of number + staggered space strings for interview x-labels + interview_nums_num = (1:length(processed_data.interview.timestamp_ms)).'; + interview_nums = arrayfun(@(x) strcat(num2str(x),convertCharsToStrings(blanks(mod(x,3)*2))), interview_nums_num,'UniformOutput',false); + + max_feeltrace = max(feeltrace_data); + max_keypress = max([max(processed_data.fsr.A0) max(processed_data.fsr.A1) max(processed_data.fsr.A2) max(processed_data.fsr.A3) max(processed_data.fsr.A4)]); + ratio = max_keypress/max_feeltrace; + + %% LET'S GET PLOTTING + the_plot = figure(1); + + %% FIRST SUBPLOT: A0 + %% In topmost (rightmost) position + subplot(29,1,[1 2 3 4 5]); + hold on; + grid on; + % area plot the FSR + area(processed_data.fsr.timestamp_ms,processed_data.fsr.A0/ratio,'FaceColor',[239/255 49/255 86/255], 'EdgeColor',[239/255 49/255 86/255]); + % line plot the feeltrace + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A0',' Stress'}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A1 + subplot(29,1,[6 7 8 9 10]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A1/ratio,'FaceColor',[244/255 93/255 1/255], 'EdgeColor',[244/255 93/255 1/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A1',''}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A2 + subplot(29,1,[11 12 13 14 15]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A2/ratio,'FaceColor',[255/255 159/255 28/255], 'EdgeColor',[255/255 159/255 28/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A2',''}); + ytickangle(90); + ylabel(strcat("Participant ", trial_number)); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A3 + subplot(29,1,[16 17 18 19 20]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A3/ratio,'FaceColor',[86/255 188/255 3/255], 'EdgeColor',[86/255 188/255 3/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A3',''}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A4 + subplot(29,1,[21 22 23 24 25]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A4/ratio,'FaceColor',[45/255 125/255 210/255], 'EdgeColor',[45/255 125/255 210/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'Relief ','A4',""}); + ytickangle(90); + starttick = max(floor(min(processed_data.fsr.timestamp_ms(1)/60000, processed_data.feeltrace.timestamp_ms(1)/60000)),0.25); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); + xticklabels(vertcat(strings(1,starttick/0.25), datestr(datetime((starttick/24/60:1/24/60/60*15:1/24/60*ceil(processed_data.fsr.timestamp_ms(end)/60000)),'ConvertFrom','datenum'),'MM:SS'))); + xtickangle(90); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT INTERVIEW + subplot(29,1,29); + scatter(processed_data.interview.timestamp_ms/60000,interview_ones, 17, 'black', '*'); + ylim([0 2]); + yticks([]); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(processed_data.interview.timestamp_ms/60000); + xticklabels(interview_nums); + xtickangle(90); + ax = gca; + ax.TickLength = [.001 .001]; + set(gca,'FontSize',15); + xstring = join(repmat(strcat(" P", trial_number),1,32)); + xlabel(xstring,'FontSize', 11); + + + + + + fig.PaperUnits = 'inches'; + fig.PaperPosition = [0 0 110 16]; + print(fullfile(processed_directory,['fsr_and_feeltrace-over' char(trial_number)]),'-dpng','-r0'); + %close(f); + %clf('reset'); + %clearvars fig; + %clearvars firsttime fsri xtick_arr starttick definput dims hSub max_feeltrace max_keypress pos1 prompt ratio_max_keypress_over_ft t f processed_data.feeltrace.timestamp_ms/60000 feeltrace_data processed_data.fsr.timestamp_ms processed_data.fsr.A0 processed_data.fsr.A1 processed_data.fsr.A2 processed_data.fsr.A3 processed_data.fsr.A4 k a0i fti; +end +% +% +% function a_subplot = plot_subplot(which_fsr,colour,plot_position, ylabels, hastimes) +% a_subplot = subplot(29,1,plot_position); +% hold on; +% grid on; +% % area plot the FSR +% area(processed_data.fsr.timestamp_ms,processed_data.fsr.which_fsr/ratio,'FaceColor',color, 'EdgeColor',colour); +% % line plot the feeltrace +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels(ylabels); +% ytickangle(90); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); +% if hastimes +% else +% xticklabels([]); +% end +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; \ No newline at end of file diff --git a/matlab/plot_all_large.m b/matlab/plot_all_large.m new file mode 100644 index 0000000..754da23 --- /dev/null +++ b/matlab/plot_all_large.m @@ -0,0 +1,175 @@ +load_globals; +MS_PER_MIN = 60000; +LONGEST_TRIAL_LENGTH_MIN = 10; + +% If data to plot is not available, don't do anything +if ~any(ismember(fields(processed_data),{'feeltrace'})) || ~any(ismember(fields(processed_data),{'fsr'})) || ~any(ismember(fields(processed_data),{'interview'})) + waitfor(errordlg('Cannot plot data: missing one or more fields.', 'Cannot Plot Data')); +else + %% PREPARING STUFF TO PLOT + % array of ones for 1D interview plot at controlled height + interview_ones = ones(length(processed_data.interview.timestamp_ms),1); + % array of number + staggered space strings for interview x-labels + interview_nums_num = (1:length(processed_data.interview.timestamp_ms)).'; + interview_nums = arrayfun(@(x) strcat(num2str(x),convertCharsToStrings(blanks(mod(x,3)*2))), interview_nums_num,'UniformOutput',false); + + max_feeltrace = max(feeltrace_data); + max_keypress = max([max(processed_data.fsr.A0) max(processed_data.fsr.A1) max(processed_data.fsr.A2) max(processed_data.fsr.A3) max(processed_data.fsr.A4)]); + ratio = max_keypress/max_feeltrace; + + %% LET'S GET PLOTTING + fig = figure(1); + + %% FIRST SUBPLOT: A0 + %% In topmost (rightmost) position + subplot(29,1,[1 2 3 4 5]); + hold on; + grid on; + % area plot the FSR + area(processed_data.fsr.timestamp_ms,processed_data.fsr.A0/ratio,'FaceColor',[239/255 49/255 86/255], 'EdgeColor',[239/255 49/255 86/255]); + % line plot the feeltrace + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A0',' Stress'}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A1 + subplot(29,1,[6 7 8 9 10]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A1/ratio,'FaceColor',[244/255 93/255 1/255], 'EdgeColor',[244/255 93/255 1/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A1',''}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A2 + subplot(29,1,[11 12 13 14 15]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A2/ratio,'FaceColor',[255/255 159/255 28/255], 'EdgeColor',[255/255 159/255 28/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A2',''}); + ytickangle(90); + ylabel(strcat("Participant ", trial_number)); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A3 + subplot(29,1,[16 17 18 19 20]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A3/ratio,'FaceColor',[86/255 188/255 3/255], 'EdgeColor',[86/255 188/255 3/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'','A3',''}); + ytickangle(90); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); + xticklabels([]); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT A4 + subplot(29,1,[21 22 23 24 25]); + hold on; + grid on; + area(processed_data.fsr.timestamp_ms/60000,processed_data.fsr.A4/ratio,'FaceColor',[45/255 125/255 210/255], 'EdgeColor',[45/255 125/255 210/255]); + plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); + ax = gca; + ax.XGrid = 'off'; + ylim([0 max_feeltrace]); + yticks([0 max_feeltrace/2 max_feeltrace]); + yticklabels({'Relief ','A4',""}); + ytickangle(90); + starttick = max(floor(min(processed_data.fsr.timestamp_ms(1)/60000, processed_data.feeltrace.timestamp_ms(1)/60000)),0.25); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end)/60000)); + xticklabels(vertcat(strings(1,starttick/0.25), datestr(datetime((starttick/24/60:1/24/60/60*15:1/24/60*ceil(processed_data.fsr.timestamp_ms(end)/60000)),'ConvertFrom','datenum'),'MM:SS'))); + xtickangle(90); + set(gca,'FontSize',30); + set(gca,'linewidth',1); + hold off; + + %% SUBPLOT INTERVIEW + subplot(29,1,29); + scatter(processed_data.interview.timestamp_ms/60000,interview_ones, 17, 'black', '*'); + ylim([0 2]); + yticks([]); + xlim([0 LONGEST_TRIAL_LENGTH_MIN]); + xticks(processed_data.interview.timestamp_ms/60000); + xticklabels(interview_nums); + xtickangle(90); + ax = gca; + ax.TickLength = [.001 .001]; + set(gca,'FontSize',15); + xstring = join(repmat(strcat(" P", trial_number),1,32)); + xlabel(xstring,'FontSize', 11); + + + + + + fig.PaperUnits = 'inches'; + fig.PaperPosition = [0 0 110 16]; + print(fullfile(processed_directory,['fsr_and_feeltrace-over' char(trial_number)]),'-dpng','-r0'); + %close(f); + %clf('reset'); + %clearvars fig; + %clearvars firsttime fsri xtick_arr starttick definput dims hSub max_feeltrace max_keypress pos1 prompt ratio_max_keypress_over_ft t f processed_data.feeltrace.timestamp_ms/60000 feeltrace_data processed_data.fsr.timestamp_ms processed_data.fsr.A0 processed_data.fsr.A1 processed_data.fsr.A2 processed_data.fsr.A3 processed_data.fsr.A4 k a0i fti; +end +% +% +% function a_subplot = plot_subplot(which_fsr,colour,plot_position, ylabels, hastimes) +% a_subplot = subplot(29,1,plot_position); +% hold on; +% grid on; +% % area plot the FSR +% area(processed_data.fsr.timestamp_ms,processed_data.fsr.which_fsr/ratio,'FaceColor',color, 'EdgeColor',colour); +% % line plot the feeltrace +% plot(processed_data.feeltrace.timestamp_ms/60000,feeltrace_data,'Color',[0 0 0],'LineWidth',3.5); +% ax = gca; +% ax.XGrid = 'off'; +% ylim([0 max_feeltrace]); +% yticks([0 max_feeltrace/2 max_feeltrace]); +% yticklabels(ylabels); +% ytickangle(90); +% xlim([0 LONGEST_TRIAL_LENGTH_MIN]); +% xticks(0 : 0.25 : ceil(processed_data.fsr.timestamp_ms(end))); +% if hastimes +% else +% xticklabels([]); +% end +% set(gca,'FontSize',30); +% set(gca,'linewidth',1); +% hold off; \ No newline at end of file diff --git a/matlab/plot_eeg_raw.m b/matlab/plot_eeg_raw.m new file mode 100644 index 0000000..9ea5681 --- /dev/null +++ b/matlab/plot_eeg_raw.m @@ -0,0 +1,30 @@ +%plots 64 channels of eeg data with random colors, for some reason +f = waitbar(0.3,'Plotting EEG data','Name','Data Processing'); + +if (exist('eeg_data_synced') ~= 0) + eeg_to_plot = eeg_data_synced(2:end,:); + + en = length(eeg_to_plot(1,:))-100000; + ax = ones(1,length(eeg_to_plot(1,:)))/60000; + ax = cumsum(ax); + colors = rand(64,3); + hold on; + k = 1; + while k < 20 + plot(ax(1:en),eeg_to_plot(k,1:en),'Color',colors(k,:)); + k = k+1; + end + hold off; + + xlabel('Time (min)'); + ylabel('microvolts'); + %title('64-channel EEG potentials during gameplay'); + hold off; + saveas(gcf,fullfile(processed_directory,'eeg.png')); +else + close(f); + waitfor(warndlg('No EEG series found. Aborting.')); + clearvars f; +end + close(f); + clearvars f en ax colors k eeg_to_plot; \ No newline at end of file diff --git a/matlab/plot_fsr_and_feeltrace.m b/matlab/plot_fsr_and_feeltrace.m new file mode 100644 index 0000000..cde5a79 --- /dev/null +++ b/matlab/plot_fsr_and_feeltrace.m @@ -0,0 +1,110 @@ +%f = waitbar(0.9,'Plotting FSR and feeltrace data','Name','Data Processing'); + +clf('reset'); +clearvars fig; +hold off; +if ~exist('trial_directory') + trial_directory = uigetdir(path,"Select directory containg raw data from the trial"); +end +if ~exist('processed_directory') + processed_directory = uigetdir(path,"Select directory to save processed data in."); +end +if ~exist('trial_number') + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 35]; + definput = {'0'}; + trial_number = inputdlg(prompt,title,dims,definput); +end +feeltrace_timestamps = processed_data.feeltrace.timestamp_ms; +fsr_timestamps = processed_data.fsr(:,6); +feeltrace_data = processed_data.feeltrace.joystick; +A0_data = processed_data.fsr(:,1); +A1_data = processed_data.fsr(:,2); +A2_data = processed_data.fsr(:,3); +A3_data = processed_data.fsr(:,4); +A4_data = processed_data.fsr(:,5); +% +% fti = 1; +% a0i = 1; +% +% for k = 1:length([aligned_data(:).timestamp_ms]) +% if ~isempty(aligned_data(k).feeltrace) +% feeltrace_timestamps(fti) = (k-1)/60000; +% feeltrace_data(fti) = aligned_data(k).feeltrace; +% fti = fti + 1; +% end +% if ~isempty(aligned_data(k).A0_fsr) +% fsr_timestamps(a0i) = (k-1)/60000; +% A0_data(a0i) = aligned_data(k).A0_fsr; +% A1_data(a0i) = aligned_data(k).A1_fsr; +% A2_data(a0i) = aligned_data(k).A2_fsr; +% A3_data(a0i) = aligned_data(k).A3_fsr; +% A4_data(a0i) = aligned_data(k).A4_fsr; +% a0i = a0i + 1; +% end +% end + +clearvars title; +feeltrace_data = smooth(feeltrace_data, 101); + +max_ft = max(feeltrace_data); +ratio = max([max(A0_data) max(A1_data) max(A2_data) max(A3_data) max(A4_data)])/max(feeltrace_data); +fig = figure(1); +pos1 = [0.1 0.1 0.7 0.8]; +subplot('Position',pos1); +title(['FSR and Feeltrace data for participant ', trial_number]); +hold on; +%set(figure,'defaultAxesColorOrder',[[0 0 0]; [0 0 0]]); +plot(fsr_timestamps,A0_data/ratio,'Color',[0.2 1 0.2]); +plot(fsr_timestamps,A1_data/ratio,'Color',[0.2 0.2 1]); +plot(fsr_timestamps,A2_data/ratio,'Color',[1 1 0.2]); +plot(fsr_timestamps,A3_data/ratio,'Color',[0.2 1 1]); +plot(fsr_timestamps,A4_data/ratio,'Color',[1 0.2 1]); +ylabel('Intensity of keypress'); +yticks([]) +plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',1); +plot(feeltrace_timestamps,feeltrace_data,'Color',[1 1 1],'LineWidth',6.5); +plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',3); +hold off; + +yyaxis right +ax = get(gcf,'CurrentAxes'); +ax.YAxis(2).Color = 'black'; +plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0]); +yticks([0 max_ft]) +yticklabels({'Relief','Stress'}) +ylabel('Feeltrace from stres to relief') +xlabel('Time (min)'); + +pos1 = [0.8 0.1 0.2 0.8]; +hSub = subplot('Position',pos1); +hold on; +plot(1,nan,'Color',[0.2 1 0.2]); +plot(1,nan,'Color',[0.2 0.2 1]); +plot(1,nan,'Color',[1 1 0.2]); +plot(1,nan,'Color',[0.2 1 1]); +plot(1,nan,'Color',[1 0.2 1]); +plot(1,nan,'Color',[0 0 0], 'LineWidth', 2); +hold off; +set(hSub, 'Visible', 'off'); +legend('alt (grab) key','right key','down key','left key','up key','feeltrace'); +t = title('FSR and Feeltrace data from Participant'); +%gca.Ycolor = [0 0 0]; +%set(gca,'YTickLabel',[]); +%yyaxis left +%ylabel('Reported stress level'); +%set(gca,'YTickLabel',[]); +%title('Keypress FSR and stress-to-relief feeltrace during gameplay'); + + +saveas(gcf,fullfile(processed_directory,['fsr_and_feeltrace' char(trial_number) '.png'])); + +fig.PaperUnits = 'inches'; +orient(fig,'landscape') +fig.PaperPosition = [0 0 10 8]; +print(fullfile(processed_directory,['fsr_and_feeltrace-large' char(trial_number)]),'-dpng','-r0'); + +close(f); +%clf('reset'); +clearvars f feeltrace_timestamps feeltrace_data fsr_timestamps A0_data A1_data A2_data A3_data A4_data k a0i fti; diff --git a/matlab/plot_ftonly.m b/matlab/plot_ftonly.m new file mode 100644 index 0000000..9cd8f69 --- /dev/null +++ b/matlab/plot_ftonly.m @@ -0,0 +1,59 @@ +f = waitbar(0.9,'Plotting FSR and feeltrace data','Name','Data Processing'); +clf('reset'); +clearvars fig; +hold off; +if ~exist('trial_directory') + trial_directory = uigetdir(path,"Select directory containg raw data from the trial"); +end +if ~exist('processed_directory') + processed_directory = uigetdir(path,"Select directory to save processed data in."); +end +if ~exist('trial_number') + prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 35]; + definput = {'0'}; + trial_number = inputdlg(prompt,title,dims,definput); +end +feeltrace_timestamps = zeros(length([aligned_data(:).feeltrace]),1); +feeltrace_data = zeros(length([aligned_data(:).feeltrace]),1); + +fti = 1; + +for k = 1:length([aligned_data(:).timestamp_ms]) + if ~isempty(aligned_data(k).feeltrace) + feeltrace_timestamps(fti) = (k-1)/60000; + feeltrace_data(fti) = aligned_data(k).feeltrace; + fti = fti + 1; + end + end + +clearvars title; +%feeltrace_data = smooth(feeltrace_data, 30); + +max_ft = max(feeltrace_data); +max_keypress = max([max(A0_data) max(A1_data) max(A2_data) max(A3_data) max(A4_data)]); +fig = figure(1); +title(strcat("Feeltrace and keypress data for participant ", trial_number)); +plot(feeltrace_timestamps,feeltrace_data,'Color',[0 0 0],'LineWidth',2.5); +axis([0 feeltrace_timestamps(fti-1) 0 max_ft]); +yticks([0 max_ft]); +yticklabels({'Relief','Stress'}); +ylabel('Feeltrace'); +firsttime = feeltrace_timestamps(1); +starttick = floor(firsttime) + floor( (firsttime-floor(firsttime))/0.25) * 0.25; +xticks(starttick : 0.25 : floor(feeltrace_timestamps(fti-1))); +xticklabels(datestr(datetime((starttick/24/60:1/24/60/60*15:1/24/60*floor(feeltrace_timestamps(fti-1))),'ConvertFrom','datenum'),'MM:SS')); +set(gca,'FontSize',30); +set(gca,'linewidth',1); + + + + +fig.PaperUnits = 'inches'; +fig.PaperPosition = [0 0 143 16]; +print(fullfile(processed_directory,['fsr_and_feeltrace-long-ftonly' char(trial_number)]),'-dpng','-r0'); +close(f); +clf('reset'); +clearvars fig; +clearvars firsttime fsri xtick_arr starttick definput dims hSub max_ft max_keypress pos1 prompt ratio_max_keypress_over_ft t f feeltrace_timestamps feeltrace_data fsr_timestamps A0_data A1_data A2_data A3_data A4_data k a0i fti; diff --git a/matlab/process_data.asv b/matlab/process_data.asv new file mode 100644 index 0000000..158e90f --- /dev/null +++ b/matlab/process_data.asv @@ -0,0 +1,53 @@ +function processed_data = process_data() + +% initialize persistent variables +persistent trial_directory; +persistent processed_directory; +persistent trial_number; + + +% select trial directory and navigate to it +trial_directory = get_trial_directory(); +trial_directory = get_path_ui(pwd, '', 'trial directory', 'This is the directory that contains one trial worth of raw data you downloaded from the server.', false); +cd(trial_directory); + +% enter trial number +prompt = {'Enter trial number:'}; + title = 'Trial number'; + dims = [1 50]; + % put thing anticipating here + definput = {'0'}; + trial_response_cell = inputdlg(prompt,title,dims,definput); + trial_number = trial_response_cell{1}; +processed_data.scalars.trial_number = trial_number; + +% select processed data directory +processed_directory = get_path_ui(pwd, '', 'processed data directory', 'This is the directory where processed data from this trial will be saved to.', false); + +% prompt to select new directory if this one doesn't have write permission +[fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); +fclose(fid); +delete(fullfile(processed_directory,'not_a_real_file.txt')); +while strcmp(errormsg,'Permission denied') + msg = 'Cannot write to selected directory.'; + msg = [msg newline newline 'Please select different directory for saving processed data.']; + waitfor(warndlg(msg)); + processed_directory = get_path_ui(pwd, '', 'processed data directory', 'This is the directory where processed data from this trial will be saved to.', false); + [fid, errormsg] = fopen(fullfile(processed_directory,'not_a_real_file.txt'), 'a'); + fclose(fid); + delete(fullfile(processed_directory,'not_a_real_file.txt')); +end + +extract_din_time; +eeg_align; +%plot_eeg_raw; +create_timestamped_video_excerpt; +feeltrace_align; +align_interview; +fsr_gameplay_align; +plot_all_large; +%plot_fsr_and_feeltrace; +%save_file; +%video_face_align; +%clearvars trial_directory processed_directory trial_num +%exit_code = 0; diff --git a/matlab/process_data.m b/matlab/process_data.m new file mode 100644 index 0000000..3460022 --- /dev/null +++ b/matlab/process_data.m @@ -0,0 +1,34 @@ +% initialize persistent variables +% global trial_directory; +% global processed_directory; +% global trial_number; +% global processed_data; +% +% % select trial directory and navigate to it +% trial_directory = get_trial_directory(); +% processed_directory = get_processed_directory(); +% processed_data = get_processed_data(processed_directory); +% trial_number = get_trial_number(); + +load_globals; +cd(trial_directory); + + +[din_time_ms, eeg_start_time_ms] = extract_din_time(); +processed_data.scalars.din_time_ms = din_time_ms; +processed_data.scalars.eeg_start_time_ms = eeg_start_time_ms; + +eeg = eeg_align(); +processed_data.eeg = eeg; +%plot_eeg_raw; +create_timestamped_video_excerpt; +feeltrace_align; +align_interview; +fsr_gameplay_align; +plot_all_large; +save_file; +%plot_fsr_and_feeltrace; +%save_file; +%video_face_align; +%clearvars trial_directory processed_directory trial_num +%exit_code = 0; diff --git a/matlab/process_overall_data.m b/matlab/process_overall_data.m new file mode 100644 index 0000000..3c8d368 --- /dev/null +++ b/matlab/process_overall_data.m @@ -0,0 +1,9 @@ +extract_din_time; +eeg_align; +plot_eeg_raw; +create_timestamped_video_excerpt; +feeltrace_align; +fsr_gameplay_align; +plot_fsr_and_feeltrace; +save_file; +%video_face_align; \ No newline at end of file diff --git a/matlab/readme.md b/matlab/readme.md new file mode 100644 index 0000000..3dce8d5 --- /dev/null +++ b/matlab/readme.md @@ -0,0 +1,89 @@ + +Data Pre-Processing Scripts: + +These are used with matlab to pre-process raw data from the EEG study. +To use: + +1) Ensure Matlab is installed. Information on free licensing of Matlab for UBC: https://it.ubc.ca/services/desktop-print-services/software-licensing/matlab + +2) Navigate to the ubc/cs/research/imager/project/spin/proj/eeg/ directory on the UBC CS server. +Download the following data from one trial to a directory on your computer: +-Gameplay CSV (usually gameplay*.csv) +-Feeltrace CSV (usually feeltrace*.csv) +-Gameplay video (usually gameplay*.mov) +-EEG data in Matlab format (saved with datestamp, the only *.mat file in the directory) +-The entire subdirectory ending in .mff + +3) For best results, download VLC video player and ensure the VLC keyword is on your path. +Currently only supported for Windows and Mac. + +4) Clone this repository and open the /matlab/ directory within it in Matlab. + +5) Type "process_data" in the Matlab command line and press enter + +6) Follow the prompts + +7) Your data shoud process! + +When processing the video, please note that Matlab will attempt to automatically open VLC. This only works if VLC is on your path. If the videos do not automatically open when Matlab gives a "Attempting to play video..." prompt, please locate the file referred to in the prompt manually. + +The processed video, and the other processed data, is saved by default to a /#_processed_data/ subdirectory inside the raw data directory. If an error was encountered writing to this location, the script prompts for an alternate location. + +Please note that importing the FSR and Feeltrace data is a slow process. The progress bar on the pop-up may appear static while this process is taking place, but this does not mean the application has hung up. If you want to check the progress as the scripts run, press "Pause" in Matlab. + +*** + +Options + +*** + +This script does not align video of the participant's face by default. Video of the participant's face can be aligned if the "%" is removed from the "%video_face_align" line in process_data.m. Please note, processing and aligning video data is extremely time consuming, much more so than processsing and aligning Feeltrace and FSR data. + +*** + +What do you get? + +*** + +After data processing has completed, the /#_processed_data/ directory will contain: + +-A Matlab file containing the struct "aligned_data" containing aligned data from EEG, FSRs, and Feeltrace. (And video, if video option is enabled), and another struct "scalars" containing important scalar values like sync indices. + +-A PNG image of raw EEG data + +-A PNG image of Feeltrace data and keypresses + +-A processed video excerpt containing the sync frame + +This processed data directory can then be uploaded to the server into the processed data p directory. + +*** + +How do I know which DIN? + +*** + +If multiple DINS were recorded in the EEG data, you need to select which one to use as the sync signal. +If you are unsure which DIN is correct, check the "Participant trial overview" spreadsheet on the EEG Coord Google Drive. + +*** + +What's up with the video? + +*** + +This script has you find the sync frame of the video manually. First, watch the video carefully and ensure you've seen all times the sync button is pressed before gameplay begins. Determine which of the presses is the "relevant" sync. + +What's the relevant sync? + +If there is only one DIN signal in the EEG data, choose the sync that would correspond with this DIN. For example, if there is one sync button press before the EEG is recording and one after the EEG is recording, then the seond sync button press is the relevant sync and you should enter 2 in the "which sync" where you also enter the video start time and duration. + +Note that sync button presses are indexed from the FINAL time the Node server is started before gameplay begins. So if someone opened the server, pressed sync, closed the server, re-opened it, and then pressed sync again just once, enter "1" for which sync. + +If there were multiple DINs in the EEG data, make sure to enter the sync number (with 1 = the first sync button press) that corresponds with the DIN that was selected in the which DIN dialog. + +Then, note a start time and second duration that will contain the frame for the sync button press you have entered as the relevant sync. +Matlab will then process the video with frame numbers so that you can get the precise frame number for the sync. + +- + diff --git a/matlab/remove_time_nodiffs.m b/matlab/remove_time_nodiffs.m new file mode 100644 index 0000000..58167b7 --- /dev/null +++ b/matlab/remove_time_nodiffs.m @@ -0,0 +1,28 @@ +function nodiff_version = remove_time_nodiffs(value_matrix, times) + +% array where timestamp is in different millisecond +%time_ischanged = ischange(times,'Threshold',0.0000000001); +isdiff = diff(times) ~= 0; + +% array of indices where timestamp is in different millisecond +%changept_indices = vertcat(1, find(time_ischanged),length(times)+1); +changept_indices = vertcat(1, find(isdiff)+1, length(times)+1); + +[~,width] = size(value_matrix); + +% prepare array for compiled values of unique timestamps +con_values = zeros(length(changept_indices)-1,width); +%and array of unique video timestamps +con_times = zeros(length(changept_indices)-1,1); + +%populate arrays +for k = 1:length(changept_indices)-1 + con_values(k,:) = median(value_matrix(changept_indices(k):changept_indices(k+1)-1,:),1); + con_times(k) = times(changept_indices(k)); +end + +nodiff_version = con_values; +% nodiff_version = zeros(length(changept_indices)-1,width); +% +% nodiff_version(:,1) = con_values; +% nodiff_version(:,2) = con_times; diff --git a/matlab/save_file.m b/matlab/save_file.m new file mode 100644 index 0000000..f465790 --- /dev/null +++ b/matlab/save_file.m @@ -0,0 +1,2 @@ +save(fullfile(processed_directory, 'processed_data.mat'),'processed_data'); +%waitfor(helpdlg('Data processing completed.')); diff --git a/matlab/video_face_align.m b/matlab/video_face_align.m new file mode 100644 index 0000000..1e027cf --- /dev/null +++ b/matlab/video_face_align.m @@ -0,0 +1,41 @@ +quality_to_export = 100; + +%crop one frame to get the size +im2crop = readFrame(vid_reader); +[im2crop, rect] = imcrop(im2crop); +vid_width = fix(rect(3)); +vid_height = fix(rect(4)) + 30; +vid_reader = VideoReader(vid_name); + +%captioned (temp) and uncaptioned movie structs +temp_movie = struct('cdata',zeros(vid_height,vid_width,3,'uint8'),... + 'colormap',[]); +final_movie = struct('cdata',zeros(250,250,3,'uint8'),... + 'timestamp_ms',[]); + +%discards all frames before sync_frame +for k= 1:scalars.sync_frame-1 + readFrame(vid_reader); +end + +%now reads entire video +k = 1; +while hasFrame(vid_reader) + cropped_frame = imcrop(readFrame(vid_reader), rect); + temp_movie(k).cdata = insertText(cat(1,cropped_frame,zeros(20,ceil(rect(3)),3,'uint8')), [1 vid_height-25], ['frame ' num2str(k)], 'FontSize', 10, 'BoxColor', 'black', 'TextColor', 'white'); + final_movie(k).cdata = cat(2, cat(1, cropped_frame, zeros(250-(ceil(rect(4))), ceil(rect(3)),3,'uint8')),zeros(250, 250-ceil(rect(3)), 3, 'uint8')); + final_movie(k).timestamp_ms = round((k-1)*1000/30); + k = k+1; +end + +%saves captioned version to file +vid_out = VideoWriter([vid_name(1:end-4) '-cropvid-' num2str(vid_height) 'x' num2str(vid_width)]); +vid_out.Quality = quality_to_export; +open(vid_out); +writeVideo(vid_out, temp_movie); +close(vid_out); + +face_vid_data = final_movie; + +%clearvars temp_movie vid_name quality_to_export vid_reader rect vid_out im2crop cropped_img dummy k vid_height vid_width final_movie cropped_frame; + diff --git a/node/dist/assets/hack-this-poster.png b/node/dist/assets/hack-this-poster.png deleted file mode 100644 index f05ece3..0000000 Binary files a/node/dist/assets/hack-this-poster.png and /dev/null differ diff --git a/node/dist/assets/video.mov b/node/dist/assets/video.mov new file mode 100644 index 0000000..34b8ae8 Binary files /dev/null and b/node/dist/assets/video.mov differ diff --git a/node/dist/index.html b/node/dist/index.html index 0d7be49..a091dc5 100644 --- a/node/dist/index.html +++ b/node/dist/index.html @@ -1,15 +1,13 @@ - - - - - - - - - React and Webpack4 - - -
not yet loaded...
- - - \ No newline at end of file + + + + + + + Video Replay + + +
Loading. If this message persists, there may be an error.
+
+ + diff --git a/node/dist/js/bundle.js b/node/dist/js/bundle.js index 0da25e3..55b341f 100644 --- a/node/dist/js/bundle.js +++ b/node/dist/js/bundle.js @@ -1,4 +1,4 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=117)}([function(e,t,n){"use strict";e.exports=n(116)},function(e,t,n){e.exports=n(105)()},function(e,t,n){var r; +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=89)}([function(e,t,n){"use strict";var r=Math.PI,a=2*r,i=a-1e-6;function o(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function s(){return new o}o.prototype=s.prototype={constructor:o,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,a,i){this._+="C"+ +e+","+ +t+","+ +n+","+ +r+","+(this._x1=+a)+","+(this._y1=+i)},arcTo:function(e,t,n,a,i){e=+e,t=+t,n=+n,a=+a,i=+i;var o=this._x1,s=this._y1,c=n-e,u=a-t,l=o-e,d=s-t,f=l*l+d*d;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(f>1e-6)if(Math.abs(d*c-u*l)>1e-6&&i){var h=n-o,p=a-s,m=c*c+u*u,g=h*h+p*p,y=Math.sqrt(m),v=Math.sqrt(f),T=i*Math.tan((r-Math.acos((m+f-g)/(2*y*v)))/2),b=T/v,x=T/y;Math.abs(b-1)>1e-6&&(this._+="L"+(e+b*l)+","+(t+b*d)),this._+="A"+i+","+i+",0,0,"+ +(d*h>l*p)+","+(this._x1=e+x*c)+","+(this._y1=t+x*u)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,o,s,c){e=+e,t=+t;var u=(n=+n)*Math.cos(o),l=n*Math.sin(o),d=e+u,f=t+l,h=1^c,p=c?o-s:s-o;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+d+","+f:(Math.abs(this._x1-d)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+d+","+f),n&&(p<0&&(p=p%a+a),p>i?this._+="A"+n+","+n+",0,1,"+h+","+(e-u)+","+(t-l)+"A"+n+","+n+",0,1,"+h+","+(this._x1=d)+","+(this._y1=f):p>1e-6&&(this._+="A"+n+","+n+",0,"+ +(p>=r)+","+h+","+(this._x1=e+n*Math.cos(s))+","+(this._y1=t+n*Math.sin(s))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var c=s,u=function(e){return function(){return e}},l=Math.abs,d=Math.atan2,f=Math.cos,h=Math.max,p=Math.min,m=Math.sin,g=Math.sqrt,y=1e-12,v=Math.PI,T=v/2,b=2*v;function x(e){return e>=1?T:e<=-1?-T:Math.asin(e)}function _(e){return e.innerRadius}function k(e){return e.outerRadius}function w(e){return e.startAngle}function M(e){return e.endAngle}function S(e){return e&&e.padAngle}function E(e,t,n,r,a,i,o){var s=e-n,c=t-r,u=(o?i:-i)/g(s*s+c*c),l=u*c,d=-u*s,f=e+l,p=t+d,m=n+l,y=r+d,v=(f+m)/2,T=(p+y)/2,b=m-f,x=y-p,_=b*b+x*x,k=a-i,w=f*y-m*p,M=(x<0?-1:1)*g(h(0,k*k*_-w*w)),S=(w*x-b*M)/_,E=(-w*b-x*M)/_,C=(w*x+b*M)/_,O=(-w*b+x*M)/_,A=S-v,Z=E-T,F=C-v,N=O-T;return A*A+Z*Z>F*F+N*N&&(S=C,E=O),{cx:S,cy:E,x01:-l,y01:-d,x11:S*(a/k-1),y11:E*(a/k-1)}}var C=function(){var e=_,t=k,n=u(0),r=null,a=w,i=M,o=S,s=null;function h(){var u,h,_,k=+e.apply(this,arguments),w=+t.apply(this,arguments),M=a.apply(this,arguments)-T,S=i.apply(this,arguments)-T,C=l(S-M),O=S>M;if(s||(s=u=c()),wy)if(C>b-y)s.moveTo(w*f(M),w*m(M)),s.arc(0,0,w,M,S,!O),k>y&&(s.moveTo(k*f(S),k*m(S)),s.arc(0,0,k,S,M,O));else{var A,Z,F=M,N=S,z=M,D=S,I=C,P=C,U=o.apply(this,arguments)/2,H=U>y&&(r?+r.apply(this,arguments):g(k*k+w*w)),R=p(l(w-k)/2,+n.apply(this,arguments)),G=R,Y=R;if(H>y){var L=x(H/k*m(U)),B=x(H/w*m(U));(I-=2*L)>y?(z+=L*=O?1:-1,D-=L):(I=0,z=D=(M+S)/2),(P-=2*B)>y?(F+=B*=O?1:-1,N-=B):(P=0,F=N=(M+S)/2)}var j=w*f(F),K=w*m(F),J=k*f(D),V=k*m(D);if(R>y){var W=w*f(N),q=w*m(N),$=k*f(z),X=k*m(z);if(Cy?function(e,t,n,r,a,i,o,s){var c=n-e,u=r-t,l=o-a,d=s-i,f=(l*(t-i)-d*(e-a))/(d*c-l*u);return[e+f*c,t+f*u]}(j,K,$,X,W,q,J,V):[J,V],ee=j-Q[0],te=K-Q[1],ne=W-Q[0],re=q-Q[1],ae=1/m(((_=(ee*ne+te*re)/(g(ee*ee+te*te)*g(ne*ne+re*re)))>1?0:_<-1?v:Math.acos(_))/2),ie=g(Q[0]*Q[0]+Q[1]*Q[1]);G=p(R,(k-ie)/(ae-1)),Y=p(R,(w-ie)/(ae+1))}}P>y?Y>y?(A=E($,X,j,K,w,Y,O),Z=E(W,q,J,V,w,Y,O),s.moveTo(A.cx+A.x01,A.cy+A.y01),Yy&&I>y?G>y?(A=E(J,V,W,q,k,-G,O),Z=E(j,K,$,X,k,-G,O),s.lineTo(A.cx+A.x01,A.cy+A.y01),G=d;--f)s.point(y[f],v[f]);s.lineEnd(),s.areaEnd()}g&&(y[l]=+e(h,l,u),v[l]=+n(h,l,u),s.point(t?+t(h,l,u):y[l],r?+r(h,l,u):v[l]))}if(p)return s=null,p+""||null}function d(){return N().defined(a).curve(o).context(i)}return l.x=function(n){return arguments.length?(e="function"==typeof n?n:u(+n),t=null,l):e},l.x0=function(t){return arguments.length?(e="function"==typeof t?t:u(+t),l):e},l.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:u(+e),l):t},l.y=function(e){return arguments.length?(n="function"==typeof e?e:u(+e),r=null,l):n},l.y0=function(e){return arguments.length?(n="function"==typeof e?e:u(+e),l):n},l.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:u(+e),l):r},l.lineX0=l.lineY0=function(){return d().x(e).y(n)},l.lineY1=function(){return d().x(e).y(r)},l.lineX1=function(){return d().x(t).y(n)},l.defined=function(e){return arguments.length?(a="function"==typeof e?e:u(!!e),l):a},l.curve=function(e){return arguments.length?(o=e,null!=i&&(s=o(i)),l):o},l.context=function(e){return arguments.length?(null==e?i=s=null:s=o(i=e),l):i},l},D=function(e,t){return te?1:t>=e?0:NaN},I=function(e){return e},P=function(){var e=I,t=D,n=null,r=u(0),a=u(b),i=u(0);function o(o){var s,c,u,l,d,f=o.length,h=0,p=new Array(f),m=new Array(f),g=+r.apply(this,arguments),y=Math.min(b,Math.max(-b,a.apply(this,arguments)-g)),v=Math.min(Math.abs(y)/f,i.apply(this,arguments)),T=v*(y<0?-1:1);for(s=0;s0&&(h+=d);for(null!=t?p.sort(function(e,n){return t(m[e],m[n])}):null!=n&&p.sort(function(e,t){return n(o[e],o[t])}),s=0,u=h?(y-f*T)/h:0;s0?d*u:0)+T,m[c]={data:o[c],index:s,value:d,startAngle:g,endAngle:l,padAngle:v};return m}return o.value=function(t){return arguments.length?(e="function"==typeof t?t:u(+t),o):e},o.sortValues=function(e){return arguments.length?(t=e,n=null,o):t},o.sort=function(e){return arguments.length?(n=e,t=null,o):n},o.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:u(+e),o):r},o.endAngle=function(e){return arguments.length?(a="function"==typeof e?e:u(+e),o):a},o.padAngle=function(e){return arguments.length?(i="function"==typeof e?e:u(+e),o):i},o},U=R(A);function H(e){this._curve=e}function R(e){function t(t){return new H(e(t))}return t._curve=e,t}function G(e){var t=e.curve;return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e.curve=function(e){return arguments.length?t(R(e)):t()._curve},e}H.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};var Y=function(){return G(N().curve(U))},L=function(){var e=z().curve(U),t=e.curve,n=e.lineX0,r=e.lineX1,a=e.lineY0,i=e.lineY1;return e.angle=e.x,delete e.x,e.startAngle=e.x0,delete e.x0,e.endAngle=e.x1,delete e.x1,e.radius=e.y,delete e.y,e.innerRadius=e.y0,delete e.y0,e.outerRadius=e.y1,delete e.y1,e.lineStartAngle=function(){return G(n())},delete e.lineX0,e.lineEndAngle=function(){return G(r())},delete e.lineX1,e.lineInnerRadius=function(){return G(a())},delete e.lineY0,e.lineOuterRadius=function(){return G(i())},delete e.lineY1,e.curve=function(e){return arguments.length?t(R(e)):t()._curve},e},B=function(e,t){return[(t=+t)*Math.cos(e-=Math.PI/2),t*Math.sin(e)]},j=Array.prototype.slice;function K(e){return e.source}function J(e){return e.target}function V(e){var t=K,n=J,r=Z,a=F,i=null;function o(){var o,s=j.call(arguments),u=t.apply(this,s),l=n.apply(this,s);if(i||(i=o=c()),e(i,+r.apply(this,(s[0]=u,s)),+a.apply(this,s),+r.apply(this,(s[0]=l,s)),+a.apply(this,s)),o)return i=null,o+""||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r="function"==typeof e?e:u(+e),o):r},o.y=function(e){return arguments.length?(a="function"==typeof e?e:u(+e),o):a},o.context=function(e){return arguments.length?(i=null==e?null:e,o):i},o}function W(e,t,n,r,a){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,a,r,a)}function q(e,t,n,r,a){e.moveTo(t,n),e.bezierCurveTo(t,n=(n+a)/2,r,n,r,a)}function $(e,t,n,r,a){var i=B(t,n),o=B(t,n=(n+a)/2),s=B(r,n),c=B(r,a);e.moveTo(i[0],i[1]),e.bezierCurveTo(o[0],o[1],s[0],s[1],c[0],c[1])}function X(){return V(W)}function Q(){return V(q)}function ee(){var e=V($);return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e}var te={draw:function(e,t){var n=Math.sqrt(t/v);e.moveTo(n,0),e.arc(0,0,n,0,b)}},ne={draw:function(e,t){var n=Math.sqrt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},re=Math.sqrt(1/3),ae=2*re,ie={draw:function(e,t){var n=Math.sqrt(t/ae),r=n*re;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},oe=Math.sin(v/10)/Math.sin(7*v/10),se=Math.sin(b/10)*oe,ce=-Math.cos(b/10)*oe,ue={draw:function(e,t){var n=Math.sqrt(.8908130915292852*t),r=se*n,a=ce*n;e.moveTo(0,-n),e.lineTo(r,a);for(var i=1;i<5;++i){var o=b*i/5,s=Math.cos(o),c=Math.sin(o);e.lineTo(c*n,-s*n),e.lineTo(s*r-c*a,c*r+s*a)}e.closePath()}},le={draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},de=Math.sqrt(3),fe={draw:function(e,t){var n=-Math.sqrt(t/(3*de));e.moveTo(0,2*n),e.lineTo(-de*n,-n),e.lineTo(de*n,-n),e.closePath()}},he=Math.sqrt(3)/2,pe=1/Math.sqrt(12),me=3*(pe/2+1),ge={draw:function(e,t){var n=Math.sqrt(t/me),r=n/2,a=n*pe,i=r,o=n*pe+n,s=-i,c=o;e.moveTo(r,a),e.lineTo(i,o),e.lineTo(s,c),e.lineTo(-.5*r-he*a,he*r+-.5*a),e.lineTo(-.5*i-he*o,he*i+-.5*o),e.lineTo(-.5*s-he*c,he*s+-.5*c),e.lineTo(-.5*r+he*a,-.5*a-he*r),e.lineTo(-.5*i+he*o,-.5*o-he*i),e.lineTo(-.5*s+he*c,-.5*c-he*s),e.closePath()}},ye=[te,ne,ie,le,ue,fe,ge],ve=function(){var e=u(te),t=u(64),n=null;function r(){var r;if(n||(n=r=c()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(t){return arguments.length?(e="function"==typeof t?t:u(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:u(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r},Te=function(){};function be(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function xe(e){this._context=e}xe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:be(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:be(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var _e=function(e){return new xe(e)};function ke(e){this._context=e}ke.prototype={areaStart:Te,areaEnd:Te,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:be(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var we=function(e){return new ke(e)};function Me(e){this._context=e}Me.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:be(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var Se=function(e){return new Me(e)};function Ee(e,t){this._basis=new xe(e),this._beta=t}Ee.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,a=e[0],i=t[0],o=e[n]-a,s=t[n]-i,c=-1;++c<=n;)r=c/n,this._basis.point(this._beta*e[c]+(1-this._beta)*(a+r*o),this._beta*t[c]+(1-this._beta)*(i+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var Ce=function e(t){function n(e){return 1===t?new xe(e):new Ee(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function Oe(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Ae(e,t){this._context=e,this._k=(1-t)/6}Ae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Oe(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Oe(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ze=function e(t){function n(e){return new Ae(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Fe(e,t){this._context=e,this._k=(1-t)/6}Fe.prototype={areaStart:Te,areaEnd:Te,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Oe(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ne=function e(t){function n(e){return new Fe(e,t)}return n.tension=function(t){return e(+t)},n}(0);function ze(e,t){this._context=e,this._k=(1-t)/6}ze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Oe(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var De=function e(t){function n(e){return new ze(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Ie(e,t,n){var r=e._x1,a=e._y1,i=e._x2,o=e._y2;if(e._l01_a>y){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,a=(a*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>y){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,l=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*u+e._x1*e._l23_2a-t*e._l12_2a)/l,o=(o*u+e._y1*e._l23_2a-n*e._l12_2a)/l}e._context.bezierCurveTo(r,a,i,o,e._x2,e._y2)}function Pe(e,t){this._context=e,this._alpha=t}Pe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Ie(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ue=function e(t){function n(e){return t?new Pe(e,t):new Ae(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function He(e,t){this._context=e,this._alpha=t}He.prototype={areaStart:Te,areaEnd:Te,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Ie(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Re=function e(t){function n(e){return t?new He(e,t):new Fe(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ge(e,t){this._context=e,this._alpha=t}Ge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ie(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ye=function e(t){function n(e){return t?new Ge(e,t):new ze(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Le(e){this._context=e}Le.prototype={areaStart:Te,areaEnd:Te,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};var Be=function(e){return new Le(e)};function je(e){return e<0?-1:1}function Ke(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(je(i)+je(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function Je(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Ve(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,s=(i-r)/3;e._context.bezierCurveTo(r+s,a+s*t,i-s,o-s*n,i,o)}function We(e){this._context=e}function qe(e){this._context=new $e(e)}function $e(e){this._context=e}function Xe(e){return new We(e)}function Qe(e){return new qe(e)}function et(e){this._context=e}function tt(e){var t,n,r=e.length-1,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var at=function(e){return new rt(e,.5)};function it(e){return new rt(e,0)}function ot(e){return new rt(e,1)}var st=function(e,t){if((a=e.length)>1)for(var n,r,a,i=1,o=e[t[0]],s=o.length;i=0;)n[t]=t;return n};function ut(e,t){return e[t]}var lt=function(){var e=u([]),t=ct,n=st,r=ut;function a(a){var i,o,s=e.apply(this,arguments),c=a.length,u=s.length,l=new Array(u);for(i=0;i0){for(var n,r,a,i=0,o=e[0].length;i1)for(var n,r,a,i,o,s,c=0,u=e[t[0]].length;c=0?(r[0]=i,r[1]=i+=a):a<0?(r[1]=o,r[0]=o+=a):r[0]=i},ht=function(e,t){if((n=e.length)>0){for(var n,r=0,a=e[t[0]],i=a.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,a,i=0,o=1;o0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=Math.floor(e%60),r=Math.floor(e/60%60),o=Math.floor(e/3600),i=Math.floor(t/60%60),a=Math.floor(t/3600);(isNaN(e)||e===1/0)&&(o=r=n="-");return(o=o>0||a>0?o+":":"")+(r=((o||i>=10)&&r<10?"0"+r:r)+":")+(n=n<10?"0"+n:n)},t.isVideoChild=function(e){if(e.props&&e.props.isVideoChild)return!0;return"source"===e.type||"track"===e.type},t.mergeAndSortChildren=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=a.default.Children.toArray(t),l=r({},n);return i.filter(function(e){return!e.props.disabled}).concat(e.filter(function(e){return!u(i,function(t){return s(t,e)})})).map(function(t){var n=u(e,function(e){return s(e,t)});delete l.order;var o=n?n.props:{},i=r({},l,o,t.props),c=a.default.cloneElement(t,i,t.props.children);return c}).sort(function(e,t){return(e.props.order||o)-(t.props.order||o)})},t.deprecatedWarning=function(e,t){console.warn("WARNING: "+e+" will be deprecated soon! Please use "+t+" instead.")},t.throttle=function(e,t){var n=arguments,r=!1;return function(){r||(e.apply(null,n),r=!0,setTimeout(function(){r=!1},t))}};var o,i=n(0),a=(o=i)&&o.__esModule?o:{default:o};var u=function(e,t){return e.filter(t)[0]},s=function(e,t){var n=e.type,r=t.type;return"string"==typeof n||"string"==typeof r?n===r:"function"==typeof n&&"function"==typeof r&&n.displayName===r.displayName};t.mediaProperties=["error","src","srcObject","currentSrc","crossOrigin","networkState","preload","buffered","readyState","seeking","currentTime","duration","paused","defaultPlaybackRate","playbackRate","played","seekable","ended","autoplay","loop","mediaGroup","controller","controls","volume","muted","defaultMuted","audioTracks","videoTracks","textTracks","width","height","videoWidth","videoHeight","poster"]},function(e,t,n){(function(r){function o(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}(t=e.exports=n(85)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(i=++o)}),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=o,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(o())}).call(this,n(86))},function(e,t,n){(function(e){var r,o=n(78),i=n(27),a=n(72),u=n(71),s=n(70);e&&e.ArrayBuffer&&(r=n(68));var l="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),c="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),f=l||c;t.protocol=3;var d=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=o(d),h={type:"error",data:"parser error"},y=n(67);function v(e,t,n){for(var r=new Array(e.length),o=u(e.length,n),i=function(e,n,o){t(n,function(t,n){r[e]=n,o(t,r)})},a=0;a1?{type:p[o],data:e.substring(1)}:{type:p[o]}:h}o=new Uint8Array(e)[0];var i=a(e,1);return y&&"blob"===n&&(i=new y([i])),{type:p[o],data:i}},t.decodeBase64Packet=function(e,t){var n=p[e.charAt(0)];if(!r)return{type:n,data:{base64:!0,data:e.substr(1)}};var o=r.decode(e.substr(1));return"blob"===t&&y&&(o=new y([o])),{type:n,data:o}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var o=i(e);if(n&&o)return y&&!f?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");v(e,function(e,r){t.encodePacket(e,!!o&&n,!1,function(e){r(null,function(e){return e.length+":"+e}(e))})},function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var o;if("function"==typeof n&&(r=n,n=null),""===e)return r(h,0,1);for(var i,a,u="",s=0,l=e.length;s0;){for(var u=new Uint8Array(o),s=0===u[0],l="",c=1;255!==u[c];c++){if(l.length>310)return r(h,0,1);l+=u[c]}o=a(o,2+l.length),l=parseInt(l);var f=a(o,0,l);if(s)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(e){var d=new Uint8Array(f);f="";for(c=0;c0&&void 0!==arguments[0]?arguments[0]:{action:"play",source:""};return this.video.play(),{type:a,operation:e}},t.pause=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{action:"pause",source:""};return this.video.pause(),{type:a,operation:e}},t.togglePlay=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{action:"toggle-play",source:""};return this.video.togglePlay(),{type:a,operation:e}},t.seek=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:"seek",source:""};return this.video.seek(e),{type:a,operation:t}},t.forward=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:"forward-"+e,source:""};return this.video.forward(e),{type:a,operation:t}},t.replay=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:"replay-"+e,source:""};return this.video.replay(e),{type:a,operation:t}},t.changeRate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:"change-rate",source:""};return this.video.playbackRate=e,{type:a,operation:t}},t.changeVolume=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:"change-volume",source:""},n=e;e<0&&(n=0);e>1&&(n=1);return this.video.volume=n,{type:a,operation:t}},t.mute=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{action:e?"muted":"unmuted",source:""};return this.video.muted=e,{type:a,operation:t}},t.toggleFullscreen=function(e){if(i.default.enabled)return i.default.isFullscreen?i.default.exit():i.default.request(this.rootElement),{type:a,operation:{action:"toggle-fullscreen",source:""}};return{type:u,isFullscreen:!e.isFullscreen}};var r,o=n(57),i=(r=o)&&r.__esModule?r:{default:r};var a=t.OPERATE="video-react/OPERATE",u=t.FULLSCREEN_CHANGE="video-react/FULLSCREEN_CHANGE",s=t.PLAYER_ACTIVATE="video-react/PLAYER_ACTIVATE",l=t.USER_ACTIVATE="video-react/USER_ACTIVATE"},function(e,t){e.exports=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,o=n.length;r=0&&e0);return t}function c(){var e=l(+new Date);return e!==r?(u=0,r=e):e+"."+l(u++)}for(;s0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},p.prototype.cleanup=function(){l("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)l("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();l("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(l("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(l("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(l("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){(function(t){e.exports=function(e){return n&&t.Buffer.isBuffer(e)||r&&(e instanceof t.ArrayBuffer||o(e))};var n="function"==typeof t.Buffer&&"function"==typeof t.Buffer.isBuffer,r="function"==typeof t.ArrayBuffer,o=r&&"function"==typeof t.ArrayBuffer.isView?t.ArrayBuffer.isView:function(e){return e.buffer instanceof t.ArrayBuffer}}).call(this,n(3))},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,o=e.indexOf("["),i=e.indexOf("]");-1!=o&&-1!=i&&(e=e.substring(0,o)+e.substring(o,i).replace(/:/g,";")+e.substring(i,e.length));for(var a=n.exec(e||""),u={},s=14;s--;)u[r[s]]=a[s]||"";return-1!=o&&-1!=i&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t=1?1:n)+"%"}a>n&&(a=n),u.width=s(a,n);for(var l=[],c=0;c=1?1:o}},{key:"getNewTime",value:function(e){var t=this.props.player.duration,n=this.slider.calculateDistance(e)*t;return n===t?n-.1:n}},{key:"handleMouseDown",value:function(){}},{key:"handleMouseUp",value:function(e){var t=this.props.actions,n=this.getNewTime(e);t.seek(n),t.handleEndSeeking(n)}},{key:"handleMouseMove",value:function(e){var t=this.props.actions,n=this.getNewTime(e);t.handleSeekingTime(n)}},{key:"stepForward",value:function(){this.props.actions.forward(5)}},{key:"stepBack",value:function(){this.props.actions.replay(5)}},{key:"render",value:function(){var e=this,t=this.props,n=t.player,r=n.currentTime,o=n.seekingTime,i=n.duration,p=n.buffered,h=t.mouseTime,y=o||r;return a.default.createElement(s.default,{ref:function(t){e.slider=t},label:"video progress bar",className:(0,u.default)("video-react-progress-holder",this.props.className),valuenow:(100*this.getPercent()).toFixed(2),valuetext:(0,d.formatTime)(y,i),onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,getPercent:this.getPercent,stepForward:this.stepForward,stepBack:this.stepBack},a.default.createElement(c.default,{buffered:p,currentTime:y,duration:i}),a.default.createElement(f.default,{duration:i,mouseTime:h}),a.default.createElement(l.default,{currentTime:y,duration:i}))}}]),t}();t.default=y,y.propTypes=h,y.displayName="SeekBar"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t1&&(n=1),t.changeVolume(n,{action:"volume-up",source:"shortcut"})}},{keyCode:40,handle:function(e,t){var n=e.volume-.05;n<0&&(n=0);var r=n>0?"volume-down":"volume-off";t.changeVolume(n,{action:r,source:"shortcut"})}},{keyCode:190,shift:!0,handle:function(e,t){var n=e.playbackRate;n>=1.5?n=2:n>=1.25?n=1.5:n>=1?n=1.25:n>=.5?n=1:n>=.25?n=.5:n>=0&&(n=.25),t.changeRate(n,{action:"fast-forward",source:"shortcut"})}},{keyCode:188,shift:!0,handle:function(e,t){var n=e.playbackRate;n<=.5?n=.25:n<=1?n=.5:n<=1.25?n=1:n<=1.5?n=1.25:n<=2&&(n=1.5),t.changeRate(n,{action:"fast-rewind",source:"shortcut"})}}],r.shortcuts=[].concat(l(r.defaultShortcuts)),r.mergeShortcuts=r.mergeShortcuts.bind(r),r.handleKeyPress=r.handleKeyPress.bind(r),r.handleClick=r.handleClick.bind(r),r.handleDoubleClick=r.handleDoubleClick.bind(r),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.Component),o(t,[{key:"componentDidMount",value:function(){this.mergeShortcuts(),document.addEventListener("keydown",this.handleKeyPress),document.addEventListener("click",this.handleClick),document.addEventListener("dblclick",this.handleDoubleClick)}},{key:"componentDidUpdate",value:function(e){e.shortcuts!==this.props.shortcuts&&this.mergeShortcuts()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyPress)}},{key:"mergeShortcuts",value:function(){var e=function(e){var t=0;return["ctrl","shift","alt"].forEach(function(n){e[n]&&t++}),t},t=(this.props.shortcuts||[]).filter(function(e){return e.keyCode&&e.handle&&"function"==typeof e.handle});this.shortcuts=[].concat(l(t),l(this.defaultShortcuts)).sort(function(t,n){return e(n)-e(t)})}},{key:"togglePlay",value:function(e,t){e.paused?t.play({action:"play",source:"shortcut"}):t.pause({action:"pause",source:"shortcut"})}},{key:"toggleFullscreen",value:function(e,t){t.toggleFullscreen(e)}},{key:"handleKeyPress",value:function(e){var t=this.props,n=t.player,r=t.actions;if(n.isActive&&(!document.activeElement||!((0,s.hasClass)(document.activeElement,"video-react-control")||(0,s.hasClass)(document.activeElement,"video-react-menu-button-active")||(0,s.hasClass)(document.activeElement,"video-react-big-play-button")))){var o=e.keyCode||e.which,i=e.ctrlKey||e.metaKey,a=e.shiftKey,u=e.altKey,l=this.shortcuts.filter(function(e){return!(!e.keyCode||e.keyCode-o!=0)&&!(void 0!==e.ctrl&&e.ctrl!==i||void 0!==e.shift&&e.shift!==a||void 0!==e.alt&&e.alt!==u)})[0];l&&(l.handle(n,r),e.preventDefault())}}},{key:"canBeClicked",value:function(e,t){return!(!e.isActive||"VIDEO"!==t.target.nodeName||4!==e.readyState)}},{key:"handleClick",value:function(e){var t=this.props,n=t.player,r=t.actions;this.canBeClicked(n,e)&&this.togglePlay(n,r)}},{key:"handleDoubleClick",value:function(e){var t=this.props,n=t.player,r=t.actions;this.canBeClicked(n,e)&&this.toggleFullscreen(n,r)}},{key:"render",value:function(){return null}}]),t}();t.default=f,f.propTypes=c,f.displayName="Shortcut"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&(this.video.currentTime=r),t.handleLoadedMetaData(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleLoadedData",value:function(){var e=this.props,t=e.actions,n=e.onLoadedData;t.handleLoadedData(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleTimeUpdate",value:function(){var e=this.props,t=e.actions,n=e.onTimeUpdate;t.handleTimeUpdate(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleRateChange",value:function(){var e=this.props,t=e.actions,n=e.onRateChange;t.handleRateChange(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleVolumeChange",value:function(){var e=this.props,t=e.actions,n=e.onVolumeChange;t.handleVolumeChange(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleError",value:function(){var e=this.props,t=e.actions,n=e.onError;t.handleError(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleResize",value:function(){var e=this.props,t=e.actions,n=e.onResize;t.handleResize(this.getProperties()),n&&n.apply(void 0,arguments)}},{key:"handleKeypress",value:function(){}},{key:"renderChildren",value:function(){var e=this,t=r({},this.props,{video:this.video});return this.video?u.default.Children.toArray(this.props.children).filter(l.isVideoChild).map(function(n){var o=void 0;if("string"==typeof n.type){if("source"===n.type){var i=(o=r({},n.props)).onError;o.onError=function(){i&&i.apply(void 0,arguments),e.handleError.apply(e,arguments)}}}else o=t;return u.default.cloneElement(n,o)}):null}},{key:"render",value:function(){var e=this,t=this.props,n=t.loop,r=t.poster,o=t.preload,i=t.src,a=t.autoPlay,l=t.playsInline,c=t.muted,f=t.crossOrigin,d=t.videoId;return u.default.createElement("video",{className:(0,s.default)("video-react-video",this.props.className),id:d,crossOrigin:f,ref:function(t){e.video=t},muted:c,preload:o,loop:n,playsInline:l,autoPlay:a,poster:r,src:i,onLoadStart:this.handleLoadStart,onWaiting:this.handleWaiting,onCanPlay:this.handleCanPlay,onCanPlayThrough:this.handleCanPlayThrough,onPlaying:this.handlePlaying,onEnded:this.handleEnded,onSeeking:this.handleSeeking,onSeeked:this.handleSeeked,onPlay:this.handlePlay,onPause:this.handlePause,onProgress:this.handleProgress,onDurationChange:this.handleDurationChange,onError:this.handleError,onSuspend:this.handleSuspend,onAbort:this.handleAbort,onEmptied:this.handleEmptied,onStalled:this.handleStalled,onLoadedMetadata:this.handleLoadedMetaData,onLoadedData:this.handleLoadedData,onTimeUpdate:this.handleTimeUpdate,onRateChange:this.handleRateChange,onVolumeChange:this.handleVolumeChange},this.renderChildren())}},{key:"playbackRate",get:function(){return this.video.playbackRate},set:function(e){this.video.playbackRate=e}},{key:"muted",get:function(){return this.video.muted},set:function(e){this.video.muted=e}},{key:"volume",get:function(){return this.video.volume},set:function(e){e>1&&(e=1),e<0&&(e=0),this.video.volume=e}},{key:"videoWidth",get:function(){return this.video.videoWidth}},{key:"videoHeight",get:function(){return this.video.videoHeight}}]),t}();t.default=d,d.propTypes=f,d.defaultProps={preload:"auto"},d.displayName="Video"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(1)),o=a(n(0)),i=a(n(2));function a(e){return e&&e.__esModule?e:{default:e}}var u={poster:r.default.string,player:r.default.object,actions:r.default.object,className:r.default.string};function s(e){var t=e.poster,n=e.player,r=e.actions,a=e.className;return!t||n.hasStarted?null:o.default.createElement("div",{className:(0,i.default)("video-react-poster",a),style:{backgroundImage:'url("'+t+'")'},onClick:function(){n.paused&&r.play()}})}s.propTypes=u,s.displayName="PosterImage",t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=a(n(1)),o=a(n(0)),i=a(n(2));n(8);function a(e){return e&&e.__esModule?e:{default:e}}var u={player:r.default.object,className:r.default.string};function s(e){var t=e.player,n=e.className;return t.error?null:o.default.createElement("div",{className:(0,i.default)("video-react-loading-spinner",n)})}s.propTypes=u,s.displayName="LoadingSpinner"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];return{player:(0,r.default)(e.player,t),operation:(0,o.default)(e.operation,t)}};var r=i(n(100)),o=i(n(99));function i(e){return e&&e.__esModule?e:{default:e}}t.playerReducer=r.default,t.operationReducer=o.default},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict"; +!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n};function u(e){var t=e.top,n=void 0===t?0:t,r=e.left,i=void 0===r?0:r,u=e.transform,l=e.className,d=e.children,f=c(e,["top","left","transform","className","children"]);return a.a.createElement("g",s({className:o()("cx-group",l),transform:u||"translate("+i+", "+n+")"},f),d)}},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var n=0;n1e-6)if(Math.abs(d*c-u*l)>1e-6&&a){var h=n-i,p=r-o,m=c*c+u*u,g=h*h+p*p,y=Math.sqrt(m),v=Math.sqrt(f),T=a*Math.tan((s-Math.acos((m+f-g)/(2*y*v)))/2),b=T/v,x=T/y;Math.abs(b-1)>1e-6&&(this._+="L"+(e+b*l)+","+(t+b*d)),this._+="A"+a+","+a+",0,0,"+ +(d*h>l*p)+","+(this._x1=e+x*c)+","+(this._y1=t+x*u)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,r,a,i){e=+e,t=+t;var o=(n=+n)*Math.cos(r),l=n*Math.sin(r),d=e+o,f=t+l,h=1^i,p=i?r-a:a-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+d+","+f:(Math.abs(this._x1-d)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+d+","+f),n&&(p<0&&(p=p%c+c),p>u?this._+="A"+n+","+n+",0,1,"+h+","+(e-o)+","+(t-l)+"A"+n+","+n+",0,1,"+h+","+(this._x1=d)+","+(this._y1=f):p>1e-6&&(this._+="A"+n+","+n+",0,"+ +(p>=s)+","+h+","+(this._x1=e+n*Math.cos(a))+","+(this._y1=t+n*Math.sin(a))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var f=d,h=function(e){return function(){return e}},p=Math.abs,m=Math.atan2,g=Math.cos,y=Math.max,v=Math.min,T=Math.sin,b=Math.sqrt,x=1e-12,_=Math.PI,k=_/2,w=2*_;function M(e){return e>=1?k:e<=-1?-k:Math.asin(e)}function S(e){return e.innerRadius}function E(e){return e.outerRadius}function C(e){return e.startAngle}function O(e){return e.endAngle}function A(e){return e&&e.padAngle}function Z(e,t,n,r,a,i,o){var s=e-n,c=t-r,u=(o?i:-i)/b(s*s+c*c),l=u*c,d=-u*s,f=e+l,h=t+d,p=n+l,m=r+d,g=(f+p)/2,v=(h+m)/2,T=p-f,x=m-h,_=T*T+x*x,k=a-i,w=f*m-p*h,M=(x<0?-1:1)*b(y(0,k*k*_-w*w)),S=(w*x-T*M)/_,E=(-w*T-x*M)/_,C=(w*x+T*M)/_,O=(-w*T+x*M)/_,A=S-g,Z=E-v,F=C-g,N=O-v;return A*A+Z*Z>F*F+N*N&&(S=C,E=O),{cx:S,cy:E,x01:-l,y01:-d,x11:S*(a/k-1),y11:E*(a/k-1)}}var F=function(){var e=S,t=E,n=h(0),r=null,a=C,i=O,o=A,s=null;function c(){var c,u,l,d=+e.apply(this,arguments),h=+t.apply(this,arguments),y=a.apply(this,arguments)-k,S=i.apply(this,arguments)-k,E=p(S-y),C=S>y;if(s||(s=c=f()),hx)if(E>w-x)s.moveTo(h*g(y),h*T(y)),s.arc(0,0,h,y,S,!C),d>x&&(s.moveTo(d*g(S),d*T(S)),s.arc(0,0,d,S,y,C));else{var O,A,F=y,N=S,z=y,D=S,I=E,P=E,U=o.apply(this,arguments)/2,H=U>x&&(r?+r.apply(this,arguments):b(d*d+h*h)),R=v(p(h-d)/2,+n.apply(this,arguments)),G=R,Y=R;if(H>x){var L=M(H/d*T(U)),B=M(H/h*T(U));(I-=2*L)>x?(z+=L*=C?1:-1,D-=L):(I=0,z=D=(y+S)/2),(P-=2*B)>x?(F+=B*=C?1:-1,N-=B):(P=0,F=N=(y+S)/2)}var j=h*g(F),K=h*T(F),J=d*g(D),V=d*T(D);if(R>x){var W=h*g(N),q=h*T(N),$=d*g(z),X=d*T(z);if(E<_){var Q=I>x?function(e,t,n,r,a,i,o,s){var c=n-e,u=r-t,l=o-a,d=s-i,f=(l*(t-i)-d*(e-a))/(d*c-l*u);return[e+f*c,t+f*u]}(j,K,$,X,W,q,J,V):[J,V],ee=j-Q[0],te=K-Q[1],ne=W-Q[0],re=q-Q[1],ae=1/T(((l=(ee*ne+te*re)/(b(ee*ee+te*te)*b(ne*ne+re*re)))>1?0:l<-1?_:Math.acos(l))/2),ie=b(Q[0]*Q[0]+Q[1]*Q[1]);G=v(R,(d-ie)/(ae-1)),Y=v(R,(h-ie)/(ae+1))}}P>x?Y>x?(O=Z($,X,j,K,h,Y,C),A=Z(W,q,J,V,h,Y,C),s.moveTo(O.cx+O.x01,O.cy+O.y01),Yx&&I>x?G>x?(O=Z(J,V,W,q,d,-G,C),A=Z(j,K,$,X,d,-G,C),s.lineTo(O.cx+O.x01,O.cy+O.y01),G=l;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[u]=+e(h,u,c),v[u]=+n(h,u,c),s.point(t?+t(h,u,c):y[u],r?+r(h,u,c):v[u]))}if(p)return s=null,p+""||null}function u(){return P().defined(a).curve(o).context(i)}return c.x=function(n){return arguments.length?(e="function"==typeof n?n:h(+n),t=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:h(+t),c):e},c.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:h(+e),c):t},c.y=function(e){return arguments.length?(n="function"==typeof e?e:h(+e),r=null,c):n},c.y0=function(e){return arguments.length?(n="function"==typeof e?e:h(+e),c):n},c.y1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:h(+e),c):r},c.lineX0=c.lineY0=function(){return u().x(e).y(n)},c.lineY1=function(){return u().x(e).y(r)},c.lineX1=function(){return u().x(t).y(n)},c.defined=function(e){return arguments.length?(a="function"==typeof e?e:h(!!e),c):a},c.curve=function(e){return arguments.length?(o=e,null!=i&&(s=o(i)),c):o},c.context=function(e){return arguments.length?(null==e?i=s=null:s=o(i=e),c):i},c},H=function(e,t){return te?1:t>=e?0:NaN},R=function(e){return e},G=function(){var e=R,t=H,n=null,r=h(0),a=h(w),i=h(0);function o(o){var s,c,u,l,d,f=o.length,h=0,p=new Array(f),m=new Array(f),g=+r.apply(this,arguments),y=Math.min(w,Math.max(-w,a.apply(this,arguments)-g)),v=Math.min(Math.abs(y)/f,i.apply(this,arguments)),T=v*(y<0?-1:1);for(s=0;s0&&(h+=d);for(null!=t?p.sort(function(e,n){return t(m[e],m[n])}):null!=n&&p.sort(function(e,t){return n(o[e],o[t])}),s=0,u=h?(y-f*T)/h:0;s0?d*u:0)+T,m[c]={data:o[c],index:s,value:d,startAngle:g,endAngle:l,padAngle:v};return m}return o.value=function(t){return arguments.length?(e="function"==typeof t?t:h(+t),o):e},o.sortValues=function(e){return arguments.length?(t=e,n=null,o):t},o.sort=function(e){return arguments.length?(n=e,t=null,o):n},o.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:h(+e),o):r},o.endAngle=function(e){return arguments.length?(a="function"==typeof e?e:h(+e),o):a},o.padAngle=function(e){return arguments.length?(i="function"==typeof e?e:h(+e),o):i},o},Y=B(z);function L(e){this._curve=e}function B(e){function t(t){return new L(e(t))}return t._curve=e,t}function j(e){var t=e.curve;return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e.curve=function(e){return arguments.length?t(B(e)):t()._curve},e}L.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};var K=function(){return j(P().curve(Y))},J=function(e,t){return[(t=+t)*Math.cos(e-=Math.PI/2),t*Math.sin(e)]},V=Array.prototype.slice;function W(e){return e.source}function q(e){return e.target}function $(e){var t=W,n=q,r=D,a=I,i=null;function o(){var o,s=V.call(arguments),c=t.apply(this,s),u=n.apply(this,s);if(i||(i=o=f()),e(i,+r.apply(this,(s[0]=c,s)),+a.apply(this,s),+r.apply(this,(s[0]=u,s)),+a.apply(this,s)),o)return i=null,o+""||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r="function"==typeof e?e:h(+e),o):r},o.y=function(e){return arguments.length?(a="function"==typeof e?e:h(+e),o):a},o.context=function(e){return arguments.length?(i=null==e?null:e,o):i},o}function X(e,t,n,r,a){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,a,r,a)}function Q(e,t,n,r,a){e.moveTo(t,n),e.bezierCurveTo(t,n=(n+a)/2,r,n,r,a)}function ee(e,t,n,r,a){var i=J(t,n),o=J(t,n=(n+a)/2),s=J(r,n),c=J(r,a);e.moveTo(i[0],i[1]),e.bezierCurveTo(o[0],o[1],s[0],s[1],c[0],c[1])}Math.sqrt(1/3);var te=Math.sin(_/10)/Math.sin(7*_/10),ne=(Math.sin(w/10),Math.cos(w/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12),function(){});function re(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ae(e){this._context=e}ae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:re(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:re(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ie(e){this._context=e}ie.prototype={areaStart:ne,areaEnd:ne,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:re(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oe(e){this._context=e}oe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:re(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function se(e,t){this._basis=new ae(e),this._beta=t}se.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,a=e[0],i=t[0],o=e[n]-a,s=t[n]-i,c=-1;++c<=n;)r=c/n,this._basis.point(this._beta*e[c]+(1-this._beta)*(a+r*o),this._beta*t[c]+(1-this._beta)*(i+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};(function e(t){function n(e){return 1===t?new ae(e):new se(e,t)}return n.beta=function(t){return e(+t)},n})(.85);function ce(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function ue(e,t){this._context=e,this._k=(1-t)/6}ue.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ce(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:ce(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return new ue(e,t)}return n.tension=function(t){return e(+t)},n})(0);function le(e,t){this._context=e,this._k=(1-t)/6}le.prototype={areaStart:ne,areaEnd:ne,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:ce(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return new le(e,t)}return n.tension=function(t){return e(+t)},n})(0);function de(e,t){this._context=e,this._k=(1-t)/6}de.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ce(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return new de(e,t)}return n.tension=function(t){return e(+t)},n})(0);function fe(e,t,n){var r=e._x1,a=e._y1,i=e._x2,o=e._y2;if(e._l01_a>x){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,a=(a*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>x){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,l=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*u+e._x1*e._l23_2a-t*e._l12_2a)/l,o=(o*u+e._y1*e._l23_2a-n*e._l12_2a)/l}e._context.bezierCurveTo(r,a,i,o,e._x2,e._y2)}function he(e,t){this._context=e,this._alpha=t}he.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:fe(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return t?new he(e,t):new ue(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function pe(e,t){this._context=e,this._alpha=t}pe.prototype={areaStart:ne,areaEnd:ne,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:fe(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return t?new pe(e,t):new le(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function me(e,t){this._context=e,this._alpha=t}me.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fe(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(e){return t?new me(e,t):new de(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function ge(e){this._context=e}ge.prototype={areaStart:ne,areaEnd:ne,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ye(e){return e<0?-1:1}function ve(e,t,n){var r=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(r||a<0&&-0),o=(n-e._y1)/(a||r<0&&-0),s=(i*a+o*r)/(r+a);return(ye(i)+ye(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function Te(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function be(e,t,n){var r=e._x0,a=e._y0,i=e._x1,o=e._y1,s=(i-r)/3;e._context.bezierCurveTo(r+s,a+s*t,i-s,o-s*n,i,o)}function xe(e){this._context=e}function _e(e){this._context=new ke(e)}function ke(e){this._context=e}function we(e){this._context=e}function Me(e){var t,n,r=e.length-1,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var Ee=function(e,t){if((a=e.length)>1)for(var n,r,a,i=1,o=e[t[0]],s=o.length;i=0;)n[t]=t;return n};function Oe(e,t){return e[t]}var Ae=function(){var e=h([]),t=Ce,n=Ee,r=Oe;function a(a){var i,o,s=e.apply(this,arguments),c=a.length,u=s.length,l=new Array(u);for(i=0;i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n};function Ye(e){var t=e.className,n=e.data,r=e.centroid,i=e.innerRadius,s=e.outerRadius,c=e.cornerRadius,u=e.startAngle,l=e.endAngle,d=e.padAngle,f=e.padRadius,h=Ge(e,["className","data","centroid","innerRadius","outerRadius","cornerRadius","startAngle","endAngle","padAngle","padRadius"]),p=F();return r&&p.centroid(r),i&&p.innerRadius(i),s&&p.outerRadius(s),c&&p.cornerRadius(c),u&&p.startAngle(u),l&&p.endAngle(l),d&&p.padAngle(d),f&&p.padRadius(f),a.a.createElement("path",Re({className:o()("vx-arc",t),d:p(n)},He(h,n)))}function Le(e){var t=e.className,n=void 0===t?"":t,r=e.top,i=void 0===r?0:r,s=e.left,c=void 0===s?0:s,u=e.data,l=e.centroid,d=e.innerRadius,f=void 0===d?0:d,h=e.outerRadius,p=e.cornerRadius,m=e.startAngle,g=void 0===m?0:m,y=e.endAngle,v=e.padAngle,T=e.padRadius,b=e.pieSort,x=e.pieSortValues,_=e.pieValue,k=Ge(e,["className","top","left","data","centroid","innerRadius","outerRadius","cornerRadius","startAngle","endAngle","padAngle","padRadius","pieSort","pieSortValues","pieValue"]),w=F();w.innerRadius(f),h&&w.outerRadius(h),p&&w.cornerRadius(p),T&&w.padRadius(T);var M=G();b&&M.sort(b),x&&M.sortValues(x),_&&M.value(_),null!=v&&M.padAngle(v),null!=g&&M.startAngle(g),null!=y&&M.endAngle(y);var S=M(u);return a.a.createElement(Ne.Group,{className:"vx-pie-arcs-group",top:i,left:c},S.map(function(e,t){var r=void 0;return l&&(r=w.centroid(e)),a.a.createElement("g",{key:"pie-arc-"+t},a.a.createElement("path",Re({className:o()("vx-pie-arc",n),d:w(e)},He(k,Re({},e,{index:t,centroid:r})))),l&&l(r,e))}))}function Be(e){var t=e.from,n=void 0===t?new Ie.a({x:0,y:0}):t,r=e.to,i=void 0===r?new Ie.a({x:1,y:1}):r,s=e.stroke,c=void 0===s?"black":s,u=e.strokeWidth,l=void 0===u?1:u,d=e.strokeDasharray,f=void 0===d?"":d,h=e.transform,p=void 0===h?"":h,m=e.className,g=void 0===m?"":m,y=e.data,v=e.innerRef,T=Ge(e,["from","to","stroke","strokeWidth","strokeDasharray","transform","className","data","innerRef"]);return a.a.createElement("line",Re({ref:v,className:o()("vx-line",g),x1:n.x,y1:n.y,x2:i.x,y2:i.y,stroke:c,strokeWidth:l,strokeDasharray:f,transform:p},He(T,y)))}function je(e){var t=e.children,n=e.data,r=e.xScale,i=e.yScale,s=e.x,c=e.y,u=e.defined,l=void 0===u?function(){return!0}:u,d=e.className,f=e.stroke,h=void 0===f?"steelblue":f,p=e.strokeWidth,m=void 0===p?2:p,g=e.strokeDasharray,y=void 0===g?"":g,v=e.strokeDashoffset,T=void 0===v?0:v,b=e.fill,x=void 0===b?"none":b,_=e.curve,k=void 0===_?Pe.k:_,w=e.glyph,M=e.innerRef,S=Ge(e,["children","data","xScale","yScale","x","y","defined","className","stroke","strokeWidth","strokeDasharray","strokeDashoffset","fill","curve","glyph","innerRef"]),E=P().x(function(){return r(s.apply(void 0,arguments))}).y(function(){return i(c.apply(void 0,arguments))}).defined(l).curve(k);return t?t({path:E}):a.a.createElement("g",null,a.a.createElement("path",Re({ref:M,className:o()("vx-linepath",d),d:E(n),stroke:h,strokeWidth:m,strokeDasharray:y,strokeDashoffset:T,fill:x},He(S,n))),w&&a.a.createElement("g",{className:"vx-linepath-glyphs"},n.map(w)))}function Ke(e){var t=e.className,n=void 0===t?"":t,r=e.angle,i=e.radius,s=e.defined,c=e.curve,u=e.data,l=e.innerRef,d=Ge(e,["className","angle","radius","defined","curve","data","innerRef"]),f=K();return r&&f.angle(r),i&&f.radius(i),s&&f.defined(s),c&&f.curve(c),a.a.createElement("g",null,a.a.createElement("path",Re({ref:l,className:o()("vx-line-radial",n),d:f(u)},He(d,u))))}function Je(e){var t=e.children,n=e.x,r=e.x0,i=e.x1,s=e.y,c=e.y0,u=e.y1,l=e.xScale,d=e.yScale,f=e.data,h=void 0===f?[]:f,p=e.defined,m=void 0===p?function(){return!0}:p,g=e.className,y=e.strokeDasharray,v=e.strokeWidth,T=void 0===v?2:v,b=e.stroke,x=void 0===b?"black":b,_=e.fill,k=void 0===_?"rgba(0,0,0,0.3)":_,w=e.curve,M=e.innerRef,S=Ge(e,["children","x","x0","x1","y","y0","y1","xScale","yScale","data","defined","className","strokeDasharray","strokeWidth","stroke","fill","curve","innerRef"]),E=U();return n&&E.x(function(){return l(n.apply(void 0,arguments))}),r&&E.x0(function(){return l(r.apply(void 0,arguments))}),i&&E.x1(function(){return l(i.apply(void 0,arguments))}),s&&E.y(function(){return d(s.apply(void 0,arguments))}),c&&E.y0(function(){return d(c.apply(void 0,arguments))}),u&&E.y1(function(){return d(u.apply(void 0,arguments))}),m&&E.defined(m),w&&E.curve(w),t?t({path:E}):a.a.createElement("g",null,a.a.createElement("path",Re({ref:M,className:o()("vx-area",g),d:E(h),stroke:x,strokeWidth:T,strokeDasharray:y,fill:k},He(S,h))))}function Ve(e){var t=e.x,n=e.y,r=e.xScale,i=e.yScale,s=e.data,c=e.defined,u=void 0===c?function(){return!0}:c,l=e.className,d=e.strokeDasharray,f=e.strokeWidth,h=void 0===f?2:f,p=e.stroke,m=void 0===p?"black":p,g=e.fill,y=void 0===g?"rgba(0,0,0,0.3)":g,v=e.curve,T=e.innerRef,b=Ge(e,["x","y","xScale","yScale","data","defined","className","strokeDasharray","strokeWidth","stroke","fill","curve","innerRef"]),x=U().x(function(){return r(t.apply(void 0,arguments))}).y0(i.range()[0]).y1(function(){return i(n.apply(void 0,arguments))}).defined(u);return v&&x.curve(v),a.a.createElement("g",null,a.a.createElement("path",Re({ref:T,className:o()("vx-area-closed",l),d:x(s),stroke:m,strokeWidth:h,strokeDasharray:d,fill:y},He(b,s))))}function We(e){var t=e.className,n=(e.top,e.left,e.keys),r=e.data,i=e.curve,s=e.defined,c=e.x,u=e.x0,l=e.x1,d=e.y0,f=e.y1,h=e.glyph,p=e.reverse,m=void 0!==p&&p,g=Ge(e,["className","top","left","keys","data","curve","defined","x","x0","x1","y0","y1","glyph","reverse"]),y=Ae();n&&y.keys(n);var v=U();c&&v.x(c),u&&v.x0(u),l&&v.x1(l),d&&v.y0(d),f&&v.y1(f),i&&v.curve(i),s&&v.defined(s);var T=y(r);return m&&T.reverse(),a.a.createElement("g",null,T.map(function(e,n){return a.a.createElement("path",Re({className:o()("vx-area-stack",t),key:"area-stack-"+n+"-"+(e.key||""),d:v(e)},He(g,{datum:e[n],index:n,series:e})))}),!!h&&a.a.createElement("g",{className:"vx-area-stack-glyphs"},r.map(h)))}function qe(e){var t=e.className,n=e.innerRef,r=e.data,i=e.x,s=void 0===i?0:i,c=e.y,u=void 0===c?0:c,l=e.width,d=e.height,f=e.rx,h=e.ry,p=e.fill,m=void 0===p?"steelblue":p,g=e.fillOpacity,y=e.stroke,v=e.strokeWidth,T=e.strokeDasharray,b=e.strokeLinecap,x=e.strokeLinejoin,_=e.strokeMiterlimit,k=e.strokeOpacity,w=Ge(e,["className","innerRef","data","x","y","width","height","rx","ry","fill","fillOpacity","stroke","strokeWidth","strokeDasharray","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity"]);return a.a.createElement("rect",Re({ref:n,className:o()("vx-bar",t),x:s,y:u,width:l,height:d,rx:f,ry:h,fill:m,fillOpacity:g,stroke:y,strokeWidth:v,strokeDasharray:T,strokeLinecap:b,strokeLinejoin:x,strokeMiterlimit:_,strokeOpacity:k},He(w,r)))}function $e(e){var t=e.data,n=e.className,r=e.top,i=e.left,s=e.x0,c=e.x0Scale,u=e.x1Scale,l=e.yScale,d=e.zScale,f=e.keys,h=e.height,p=Ge(e,["data","className","top","left","x0","x0Scale","x1Scale","yScale","zScale","keys","height"]),m=c.tickFormat?c.tickFormat():function(e){return e};return a.a.createElement(Ne.Group,{className:o()("vx-bar-group",n),top:r,left:i},t&&t.map(function(e,t){return a.a.createElement(Ne.Group,{key:"bar-group-"+t+"-"+s(e),left:c(s(e))},f&&f.map(function(t,n){var r=e[t];return a.a.createElement(qe,Re({key:"bar-group-bar-"+n+"-"+r+"-"+t,x:u(t),y:l(r),width:u.bandwidth(),height:h-l(r),fill:d(t),data:{key:t,value:r,x:m(s(e)),data:e}},p))}))}))}function Xe(e){var t=e.data,n=e.className,r=e.top,i=e.left,s=e.x,c=e.xScale,u=e.yScale,l=e.zScale,d=e.keys,f=(e.height,Ge(e,["data","className","top","left","x","xScale","yScale","zScale","keys","height"])),h=Ae().keys(d)(t),p=c.tickFormat?c.tickFormat():function(e){return e},m=c.bandwidth(),g=c.step(),y=c.paddingInner(),v=c.paddingOuter();return a.a.createElement(Ne.Group,{className:o()("vx-bar-stack",n),top:r,left:i},h&&h.map(function(e,t){return a.a.createElement(Ne.Group,{key:"vx-bar-stack-"+t},e.map(function(n,r){var i=u(n[0])-u(n[1]);return a.a.createElement(qe,Re({key:"bar-group-bar-"+t+"-"+r+"-"+e.key,x:c(s(n.data)),y:u(n[1]),width:m,height:i,fill:l(e.key),data:{bandwidth:m,paddingInner:y,paddingOuter:v,step:g,key:e.key,value:n[1],height:i,width:m,x:s(n.data),xFormatted:p(s(n.data)),data:n.data}},f))}))}))}function Qe(e){var t=e.data,n=e.className,r=e.top,i=e.left,s=e.y,c=e.xScale,u=e.yScale,l=e.zScale,d=e.keys,f=(e.height,Ge(e,["data","className","top","left","y","xScale","yScale","zScale","keys","height"])),h=Ae().keys(d)(t),p=u.tickFormat?u.tickFormat():function(e){return e},m=u.bandwidth(),g=u.step(),y=u.paddingInner(),v=u.paddingOuter();return a.a.createElement(Ne.Group,{className:o()("vx-bar-stack-horizontal",n),top:r,left:i},h&&h.map(function(e,t){return a.a.createElement(Ne.Group,{key:"vx-bar-stack-horizontal-"+t},e.map(function(n,r){var i=c(n[1])-c(n[0]);return a.a.createElement(qe,Re({key:"bar-group-bar-"+t+"-"+r+"-"+e.key,x:c(n[0]),y:u(s(n.data)),width:i,height:m,fill:l(e.key),data:{bandwidth:m,paddingInner:y,paddingOuter:v,step:g,key:e.key,value:n[0],height:m,width:i,y:s(n.data),yFormatted:p(s(n.data)),data:n.data}},f))}))}))}Be.propTypes={innerRef:De.a.func},je.propTypes={innerRef:De.a.func,xScale:De.a.func,yScale:De.a.func,data:De.a.array,x:De.a.func,y:De.a.func,defined:De.a.func,stroke:De.a.string,strokeWidth:De.a.number,glyph:De.a.func,curve:De.a.func},Ke.propTypes={innerRef:De.a.func},Je.propTypes={x:De.a.func,x0:De.a.func,x1:De.a.func,y:De.a.func,y0:De.a.func,y1:De.a.func,xScale:De.a.func,yScale:De.a.func,data:De.a.array,defined:De.a.func,className:De.a.oneOfType([De.a.string,De.a.bool,De.a.object,De.a.array]),innerRef:De.a.func,strokeDasharray:De.a.string,strokeWidth:De.a.number,stroke:De.a.string,fill:De.a.string,curve:De.a.func},Ve.propTypes={innerRef:De.a.func},qe.propTypes={innerRef:De.a.func},$e.propTypes={data:De.a.array.isRequired,x0:De.a.func.isRequired,x0Scale:De.a.func.isRequired,x1Scale:De.a.func.isRequired,yScale:De.a.func.isRequired,zScale:De.a.func.isRequired,keys:De.a.array.isRequired,height:De.a.number.isRequired,className:De.a.string,top:De.a.number,left:De.a.number},Xe.propTypes={data:De.a.array.isRequired,x:De.a.func.isRequired,xScale:De.a.func.isRequired,yScale:De.a.func.isRequired,zScale:De.a.func.isRequired,keys:De.a.array.isRequired,className:De.a.string,top:De.a.number,left:De.a.number},Qe.propTypes={data:De.a.array.isRequired,y:De.a.func.isRequired,xScale:De.a.func.isRequired,yScale:De.a.func.isRequired,zScale:De.a.func.isRequired,keys:De.a.array.isRequired,className:De.a.string,top:De.a.number,left:De.a.number};var et={ascending:Ze,descending:function(e){return Ze(e).reverse()},insideout:function(e){var t,n,r=e.length,a=e.map(Fe),i=Ce(e).sort(function(e,t){return a[t]-a[e]}),o=0,s=0,c=[],u=[];for(t=0;t0){for(var n,r,a,i=0,o=e[0].length;i1)for(var n,r,a,i,o,s,c=0,u=e[t[0]].length;c=0?(r[0]=i,r[1]=i+=a):a<0?(r[1]=o,r[0]=o+=a):r[0]=i},none:Ee,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,a=e[t[0]],i=a.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,a,i=0,o=1;oMath.PI?h<=d:h>d)?1:0)+","+f*y+","+f*v+"\n L"+p*y+","+p*v+"\n "}}function At(e){var t=e.className,n=e.innerRef,r=e.data,i=e.path,s=e.x,c=void 0===s?function(e){return e.x}:s,u=e.y,l=void 0===u?function(e){return e.y}:u,d=e.source,f=void 0===d?function(e){return e.source}:d,h=e.target,p=void 0===h?function(e){return e.target}:h,m=Ge(e,["className","innerRef","data","path","x","y","source","target"]);return i=i||Ot({source:f,target:p,x:c,y:l}),a.a.createElement("path",Re({ref:n,className:o()("vx-link",t),d:i(r)},He(m,r)))}ct.propTypes={innerRef:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},lt.propTypes={innerRef:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},ft.propTypes={innerRef:De.a.func,angle:De.a.func,radius:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},pt.propTypes={innerRef:De.a.func,percent:De.a.number,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},gt.propTypes={innerRef:De.a.func,percent:De.a.number,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},vt.propTypes={innerRef:De.a.func,percent:De.a.number,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},bt.propTypes={innerRef:De.a.func,path:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func},_t.propTypes={innerRef:De.a.func,path:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func},wt.propTypes={innerRef:De.a.func,path:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func},St.propTypes={innerRef:De.a.func,percent:De.a.number,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},Ct.propTypes={innerRef:De.a.func,percent:De.a.number,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func},At.propTypes={innerRef:De.a.func,x:De.a.func,y:De.a.func,source:De.a.func,target:De.a.func,path:De.a.func}},function(e,t,n){(function(r){function a(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}(t=e.exports=n(62)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var a=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(i=++a)}),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=a,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(a())}).call(this,n(63))},function(e,t,n){(function(e){var r,a=n(55),i=n(25),o=n(49),s=n(48),c=n(47);e&&e.ArrayBuffer&&(r=n(45));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),l="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),d=u||l;t.protocol=3;var f=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},h=a(f),p={type:"error",data:"parser error"},m=n(44);function g(e,t,n){for(var r=new Array(e.length),a=s(e.length,n),i=function(e,n,a){t(n,function(t,n){r[e]=n,a(t,r)})},o=0;o1?{type:h[a],data:e.substring(1)}:{type:h[a]}:p}a=new Uint8Array(e)[0];var i=o(e,1);return m&&"blob"===n&&(i=new m([i])),{type:h[a],data:i}},t.decodeBase64Packet=function(e,t){var n=h[e.charAt(0)];if(!r)return{type:n,data:{base64:!0,data:e.substr(1)}};var a=r.decode(e.substr(1));return"blob"===t&&m&&(a=new m([a])),{type:n,data:a}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var a=i(e);if(n&&a)return m&&!d?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");g(e,function(e,r){t.encodePacket(e,!!a&&n,!1,function(e){r(null,function(e){return e.length+":"+e}(e))})},function(e,t){return r(t.join(""))})},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var a;if("function"==typeof n&&(r=n,n=null),""===e)return r(p,0,1);for(var i,o,s="",c=0,u=e.length;c0;){for(var s=new Uint8Array(a),c=0===s[0],u="",l=1;255!==s[l];l++){if(u.length>310)return r(p,0,1);u+=s[l]}a=o(a,2+u.length),u=parseInt(u);var d=o(a,0,u);if(c)try{d=String.fromCharCode.apply(null,new Uint8Array(d))}catch(e){var f=new Uint8Array(d);d="";for(l=0;ls)throw r=0,new Error("Call stack overflow for "+u);if(""===e)throw new Error(i+"(): '"+u+"' must contain a non-whitespace string");var l=function(e){var t=[],n=[],r=/[\.0-9]([%a-z]+)/gi,a=r.exec(e);for(;a;)a&&a[1]&&(-1===n.indexOf(a[1].toLowerCase())&&(t.push(a[1]),n.push(a[1].toLowerCase())),a=r.exec(e));return t}(e=function(e,t){var r,i="",o=e=e.replace(/((?:\-[a-z]+\-)?calc)/g,"");for(;r=c.exec(o);){r[0].index>0&&(i+=o.substring(0,r[0].index));var s=a("(",")",o.substring([0].index));if(""===s.body)throw new Error("'"+e+"' must contain a non-whitespace string");var u=n(s.body,"",t);i+=s.pre+u,o=s.post}return i+o}(e,u));if(l.length>1||e.indexOf("var(")>-1)return i+"("+e+")";var d=l[0]||"";"%"===d&&(e=e.replace(/\b[0-9\.]+%/g,function(e){return.01*parseFloat(e.slice(0,-1))}));var f,h=e.replace(new RegExp(d,"gi"),"");try{f=o.eval(h)}catch(t){return i+"("+e+")"}return"%"===d&&(f*=100),(i.length||"%"===d)&&(f=Math.round(f*t)/t),f+=d}return r=0,t=Math.pow(10,void 0===t?5:t),e=e.replace(/\n+/g," "),i(e,/((?:\-[a-z]+\-)?calc)\(/,n)}},function(e,t,n){var r=n(9),a=n(10);function i(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=i,a(i.prototype),i.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(e){var t=r.decodePacket(e,this.socket.binaryType);this.onPacket(t)},i.prototype.onPacket=function(e){this.emit("packet",e)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,n){(function(t){var r=n(57);e.exports=function(e){var n=e.xdomain,a=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||r))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!a&&i)return new XDomainRequest}catch(e){}if(!n)try{return new(t[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}}).call(this,n(6))},function(e,t,n){var r=n(8)("socket.io-parser"),a=n(10),i=n(60),o=n(30),s=n(29);function c(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=c,t.Decoder=d;var u=t.ERROR+'"encode error"';function l(e){var n=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(n+=e.nsp+","),null!=e.id&&(n+=e.id),null!=e.data){var a=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(e.data);if(!1===a)return u;n+=a}return r("encoded %j as %s",e,n),n}function d(){this.reconstructor=null}function f(e){this.reconPack=e,this.buffers=[]}function h(e){return{type:t.ERROR,data:"parser error: "+e}}c.prototype.encode=function(e,n){(r("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)?function(e,t){i.removeBlobs(e,function(e){var n=i.deconstructPacket(e),r=l(n.packet),a=n.buffers;a.unshift(r),t(a)})}(e,n):n([l(e)])},a(d.prototype),d.prototype.add=function(e){var n;if("string"==typeof e)n=function(e){var n=0,a={type:Number(e.charAt(0))};if(null==t.types[a.type])return h("unknown packet type "+a.type);if(t.BINARY_EVENT===a.type||t.BINARY_ACK===a.type){for(var i="";"-"!==e.charAt(++n)&&(i+=e.charAt(n),n!=e.length););if(i!=Number(i)||"-"!==e.charAt(n))throw new Error("Illegal attachments");a.attachments=Number(i)}if("/"===e.charAt(n+1))for(a.nsp="";++n;){var s=e.charAt(n);if(","===s)break;if(a.nsp+=s,n===e.length)break}else a.nsp="/";var c=e.charAt(n+1);if(""!==c&&Number(c)==c){for(a.id="";++n;){var s=e.charAt(n);if(null==s||Number(s)!=s){--n;break}if(a.id+=e.charAt(n),n===e.length)break}a.id=Number(a.id)}if(e.charAt(++n)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(n)),l=!1!==u&&(a.type===t.ERROR||o(u));if(!l)return h("invalid payload");a.data=u}return r("decoded %s as %j",e,a),a}(e),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new f(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!s(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",n))}},d.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},f.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=i.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},f.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){"use strict";function r(e){return function(){return e}}var a=function(){};a.thatReturns=r,a.thatReturnsFalse=r(!1),a.thatReturnsTrue=r(!0),a.thatReturnsNull=r(null),a.thatReturnsThis=function(){return this},a.thatReturnsArgument=function(e){return e},e.exports=a},function(e,t,n){"use strict";var r=function(e){};e.exports=function(e,t,n,a,i,o,s,c){if(r(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,a,i,o,s,c],d=0;(u=new Error(t.replace(/%s/g,function(){return l[d++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return Ge});var r=n(2),a=n.n(r),i=n(13),o=n.n(i),s="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function c(e){return function(){return e}}var u=function(){};u.thatReturns=c,u.thatReturnsFalse=c(!1),u.thatReturnsTrue=c(!0),u.thatReturnsNull=c(null),u.thatReturnsThis=function(){return this},u.thatReturnsArgument=function(e){return e};var l=u,d=function(e){};var f=function(e,t,n,r,a,i,o,s){if(d(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,a,i,o,s],l=0;(c=new Error(t.replace(/%s/g,function(){return u[l++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},h=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}})()&&Object.assign;var g="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";var y,v=(function(e){e.exports=function(){function e(e,t,n,r,a,i){i!==g&&f(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=l,n.PropTypes=n,n}()}(y={exports:{}},y.exports),y.exports),T="object"==typeof s&&s&&s.Object===Object&&s,b="object"==typeof self&&self&&self.Object===Object&&self,x=T||b||Function("return this")(),_=x.Symbol,k=Object.prototype,w=k.hasOwnProperty,M=k.toString,S=_?_.toStringTag:void 0;var E=function(e){var t=w.call(e,S),n=e[S];try{e[S]=void 0}catch(e){}var r=M.call(e);return t?e[S]=n:delete e[S],r},C=Object.prototype.toString;var O=function(e){return C.call(e)},A="[object Null]",Z="[object Undefined]",F=_?_.toStringTag:void 0;var N=function(e){return null==e?void 0===e?Z:A:F&&F in Object(e)?E(e):O(e)};var z=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},D="[object AsyncFunction]",I="[object Function]",P="[object GeneratorFunction]",U="[object Proxy]";var H,R=function(e){if(!z(e))return!1;var t=N(e);return t==I||t==P||t==D||t==U},G=x["__core-js_shared__"],Y=(H=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+H:"";var L=function(e){return!!Y&&Y in e},B=Function.prototype.toString;var j=function(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""},K=/^\[object .+?Constructor\]$/,J=Function.prototype,V=Object.prototype,W=J.toString,q=V.hasOwnProperty,$=RegExp("^"+W.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var X=function(e){return!(!z(e)||L(e))&&(R(e)?$:K).test(j(e))};var Q=function(e,t){return null==e?void 0:e[t]};var ee=function(e,t){var n=Q(e,t);return X(n)?n:void 0},te=ee(Object,"create");var ne=function(){this.__data__=te?te(null):{},this.size=0};var re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ae="__lodash_hash_undefined__",ie=Object.prototype.hasOwnProperty;var oe=function(e){var t=this.__data__;if(te){var n=t[e];return n===ae?void 0:n}return ie.call(t,e)?t[e]:void 0},se=Object.prototype.hasOwnProperty;var ce=function(e){var t=this.__data__;return te?void 0!==t[e]:se.call(t,e)},ue="__lodash_hash_undefined__";var le=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=te&&void 0===t?ue:t,this};function de(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1};var be=function(e,t){var n=this.__data__,r=me(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function xe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["dx","dy","textAnchor","verticalAnchor","scaleToFit","angle","lineHeight","capHeight"]),f=this.state.wordsByLines,h=d.x,p=d.y,m=void 0;switch(i){case"start":m=o()("calc("+l+")");break;case"middle":m=o()("calc("+(f.length-1)/2+" * -"+u+" + ("+l+" / 2))");break;default:m=o()("calc("+(f.length-1)+" * -"+u+")")}var g=[];if(s&&f.length){var y=f[0].width,v=this.props.width/y,T=v,b=h-v*h,x=p-T*p;g.push("matrix("+v+", 0, 0, "+T+", "+b+", "+x+")")}return c&&g.push("rotate("+c+", "+h+", "+p+")"),g.length&&(d.transform=g.join(" ")),a.a.createElement("svg",{x:t,y:n,fontSize:d.fontSize,style:{overflow:"visible"}},a.a.createElement("text",He({},d,{textAnchor:r}),f.map(function(e,t){return a.a.createElement("tspan",{x:h,dy:0===t?m:u,key:t},e.words.join(" "))})))}}]),t}();Ge.defaultProps={x:0,y:0,dx:0,dy:0,lineHeight:"1em",capHeight:"0.71em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end"},Ge.propTypes={scaleToFit:v.bool,angle:v.number,textAnchor:v.oneOf(["start","middle","end","inherit"]),verticalAnchor:v.oneOf(["start","middle","end"]),style:v.object}}).call(this,n(6))},function(e,t){var n=[].slice;e.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},function(e,t){e.exports=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}},function(e,t,n){var r=n(16),a=n(10),i=n(40),o=n(21),s=n(20),c=n(8)("socket.io-client:socket"),u=n(12),l=n(25);e.exports=h;var d={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},f=a.prototype.emit;function h(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}a(h.prototype),h.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[o(e,"open",s(this,"onopen")),o(e,"packet",s(this,"onpacket")),o(e,"close",s(this,"onclose"))]}},h.prototype.open=h.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},h.prototype.send=function(){var e=i(arguments);return e.unshift("message"),this.emit.apply(this,e),this},h.prototype.emit=function(e){if(d.hasOwnProperty(e))return f.apply(this,arguments),this;var t=i(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:l(t))?r.BINARY_EVENT:r.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},h.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},h.prototype.onopen=function(){if(c("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?u.encode(this.query):this.query;c("sending connect packet with query %s",e),this.packet({type:r.CONNECT,query:e})}else this.packet({type:r.CONNECT})},h.prototype.onclose=function(e){c("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},h.prototype.onpacket=function(e){var t=e.nsp===this.nsp,n=e.type===r.ERROR&&"/"===e.nsp;if(t||n)switch(e.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(e);break;case r.ACK:case r.BINARY_ACK:this.onack(e);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",e.data)}},h.prototype.onevent=function(e){var t=e.data||[];c("emitting event %j",t),null!=e.id&&(c("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?f.apply(this,t):this.receiveBuffer.push(t)},h.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var a=i(arguments);c("sending ack %j",a),t.packet({type:l(a)?r.BINARY_ACK:r.ACK,id:e,data:a})}}},h.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(c("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):c("bad ack %s",e.id)},h.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},h.prototype.emitBuffered=function(){var e;for(e=0;e0);return t}function l(){var e=u(+new Date);return e!==r?(s=0,r=e):e+"."+u(s++)}for(;c0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},h.prototype.cleanup=function(){u("cleanup");for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();u("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(u("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open(function(t){t?(u("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(u("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},h.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){(function(t){e.exports=function(e){return n&&t.Buffer.isBuffer(e)||r&&(e instanceof t.ArrayBuffer||a(e))};var n="function"==typeof t.Buffer&&"function"==typeof t.Buffer.isBuffer,r="function"==typeof t.ArrayBuffer,a=r&&"function"==typeof t.ArrayBuffer.isView?t.ArrayBuffer.isView:function(e){return e.buffer instanceof t.ArrayBuffer}}).call(this,n(6))},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,a=e.indexOf("["),i=e.indexOf("]");-1!=a&&-1!=i&&(e=e.substring(0,a)+e.substring(a,i).replace(/:/g,";")+e.substring(i,e.length));for(var o=n.exec(e||""),s={},c=14;c--;)s[r[c]]=o[c]||"";return-1!=a&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s}},function(e,t,n){"use strict";n.r(t);var r=n(0);n.d(t,"curveBasis",function(){return r.a}),n.d(t,"curveBasisClosed",function(){return r.b}),n.d(t,"curveBasisOpen",function(){return r.c}),n.d(t,"curveStep",function(){return r.p}),n.d(t,"curveStepAfter",function(){return r.q}),n.d(t,"curveStepBefore",function(){return r.r}),n.d(t,"curveBundle",function(){return r.d}),n.d(t,"curveLinear",function(){return r.k}),n.d(t,"curveLinearClosed",function(){return r.l}),n.d(t,"curveCardinal",function(){return r.e}),n.d(t,"curveCardinalClosed",function(){return r.f}),n.d(t,"curveCardinalOpen",function(){return r.g}),n.d(t,"curveCatmullRom",function(){return r.h}),n.d(t,"curveCatmullRomClosed",function(){return r.i}),n.d(t,"curveCatmullRomOpen",function(){return r.j}),n.d(t,"curveMonotoneX",function(){return r.m}),n.d(t,"curveMonotoneY",function(){return r.n}),n.d(t,"curveNatural",function(){return r.o})},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,u=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),s=1;s0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t){e.exports=function(e,t){for(var n=[],r=(t=t||0)||0;r';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),c(),e=e.replace(u,"\\\n"),this.area.value=e.replace(a,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&l()}:this.iframe.onload=l}}).call(this,n(3))},function(e,t,n){(function(t){var n=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function a(e){for(var t=0;t>2],i+=e[(3&r[n])<<4|r[n+1]>>4],i+=e[(15&r[n+1])<<2|r[n+2]>>6],i+=e[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},t.decode=function(e){var t,r,o,i,a,u=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(u--,"="===e[e.length-2]&&u--);var c=new ArrayBuffer(u),f=new Uint8Array(c);for(t=0;t>4,f[l++]=(15&o)<<4|i>>2,f[l++]=(3&i)<<6|63&a;return c}}()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(e,r){var o;/*! https://mths.be/utf8js v2.1.2 by @mathias */!function(i){var a="object"==typeof t&&t,u=("object"==typeof e&&e&&e.exports,"object"==typeof r&&r);u.global!==u&&u.window;var s,l,c,f=String.fromCharCode;function d(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function h(e,t){return f(e>>t&63|128)}function y(e,t){if(0==(4294967168&e))return f(e);var n="";return 0==(4294965248&e)?n=f(e>>6&31|192):0==(4294901760&e)?(p(e,t)||(e=65533),n=f(e>>12&15|224),n+=h(e,6)):0==(4292870144&e)&&(n=f(e>>18&7|240),n+=h(e,12),n+=h(e,6)),n+=f(63&e|128)}function v(){if(c>=l)throw Error("Invalid byte index");var e=255&s[c];if(c++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function m(e){var t,n;if(c>l)throw Error("Invalid byte index");if(c==l)return!1;if(t=255&s[c],c++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|v())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|v()<<6|v())>=2048)return p(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|v()<<12|v()<<6|v())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var g={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=d(e),o=r.length,i=-1,a="";++i65535&&(o+=f((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=f(t);return o}(o)}};void 0===(o=function(){return g}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(69)(e),n(3))},function(e,t){function n(){}e.exports=function(e,t,r){var o=!1;return r=r||n,i.count=e,0===e?t():i;function i(e,n){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(o=!0,t(e),t=r):0!==i.count||o||t(null,n)}}},function(e,t){e.exports=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(e),i=new Uint8Array(n-t),a=t,u=0;a>1,c=-7,f=n?o-1:0,d=n?-1:1,p=e[t+f];for(f+=d,i=p&(1<<-c)-1,p>>=-c,c+=u;c>0;i=256*i+e[t+f],f+=d,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=d,c-=8);if(0===i)i=1-l;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=l}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,u,s,l=8*i-o-1,c=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=c?(u=0,a=c):a+f>=1?(u=(t*s-1)*Math.pow(2,o),a+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&u,p+=h,u/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=h,a/=256,l-=8);e[n+p-h]|=128*y}},function(e,t,n){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=l(e),r=n[0],a=n[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,r,a)),s=0,c=a>0?r-4:r,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;2===a&&(t=o[e.charCodeAt(f)]<<2|o[e.charCodeAt(f+1)]>>4,u[s++]=255&t);1===a&&(t=o[e.charCodeAt(f)]<<10|o[e.charCodeAt(f+1)]<<4|o[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,u=n-o;au?u:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],u=t;u>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t,n){"use strict";(function(e){ +*/var r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,o,s=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},l=function(e){var t=e.id,n=e.children,r=u(e,["id","children"]);return a.a.createElement("defs",null,a.a.createElement("clipPath",c({id:t},r),n))};n.d(t,"Threshold",function(){return f});var d=Object.assign||function(e){for(var t=1;t1);return e+n*i*Math.sqrt(-2*Math.log(a)/a)}}return n.source=e,n}(r)),i=(function e(t){function n(){var e=a.source(t).apply(this,arguments);return function(){return Math.exp(e())}}return n.source=e,n}(r),function e(t){function n(e){return function(){for(var n=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:300;return[].concat(c(d(e,[l,1,0])),c(d(e,[-l,1,1])),c(d(e,[0,-1,2])))}var h=function(e,t){return Math.random()*(25*(t-e))},p=function(e,t){return 150*e};function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h;return Array(e).fill(1).reduce(function(r,a,i){return r.concat([{bin:t(i,e),count:n(i,e)}])},[])}function g(e,t,n,r){return Array(e).fill(1).reduce(function(e,a,i){return e.concat([{bin:i,bins:m(t,n,r)}])},[])}var y=a(4,3),v=function(){return 10*Math.random()},T=1e3;function b(e){var t=[],n=void 0,r=function(){var e=[],r=void 0,a=v();for(r=0;ru}),d=2*s*Math.pow(T-l.length,-1/3),f=Math.round((u-c)/d),h=(u-c)/f,p=Array(f+2).fill(0),m=Array(f+2).fill(c),g=1;g<=f;g+=1)m[g]+=h*(g-.5);m[m.length-1]=u,e.filter(function(e){return e>=c&&e<=u}).forEach(function(e){p[Math.floor((e-c)/h)+1]+=1});var b=m.map(function(e,t){return{value:e,count:p[t]}}),x={x:"Statistics "+n,min:c,firstQuartile:i,median:e[Math.round(T/2)],thirdQuartile:o,max:u,outliers:l};t.push({boxPlot:x,binData:b})};for(n=0;n0))return o;do{o.push(i=new Date(+n)),t(n,a),e(n)}while(i=t)for(;e(t),!n(t);)t.setTime(t-1)},function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(s.count=function(t,i){return r.setTime(+t),a.setTime(+i),e(r),e(a),Math.floor(n(r,a))},s.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?s.filter(o?function(t){return o(t)%e==0}:function(t){return s.count(0,t)%e==0}):s:null}),s}var o=i(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});o.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?i(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):o:null};o.range;var s=6e4,c=6048e5,u=i(function(e){e.setTime(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),l=(u.range,i(function(e){e.setTime(Math.floor(e/s)*s)},function(e,t){e.setTime(+e+t*s)},function(e,t){return(t-e)/s},function(e){return e.getMinutes()})),d=(l.range,i(function(e){var t=e.getTimezoneOffset()*s%36e5;t<0&&(t+=36e5),e.setTime(36e5*Math.floor((+e-t)/36e5)+t)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()})),f=(d.range,i(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*s)/864e5},function(e){return e.getDate()-1})),h=f;f.range;function p(e){return i(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*s)/c})}var m=p(0),g=p(1),y=p(2),v=p(3),T=p(4),b=p(5),x=p(6),_=(m.range,g.range,y.range,v.range,T.range,b.range,x.range,i(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()})),k=(_.range,i(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));k.every=function(e){return isFinite(e=Math.floor(e))&&e>0?i(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)}):null};var w=k,M=(k.range,i(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*s)},function(e,t){return(t-e)/s},function(e){return e.getUTCMinutes()})),S=(M.range,i(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()})),E=(S.range,i(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1})),C=E;E.range;function O(e){return i(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/c})}var A=O(0),Z=O(1),F=O(2),N=O(3),z=O(4),D=O(5),I=O(6),P=(A.range,Z.range,F.range,N.range,z.range,D.range,I.range,i(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()})),U=(P.range,i(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}));U.every=function(e){return isFinite(e=Math.floor(e))&&e>0?i(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null};var H=U;U.range;function R(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function G(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Y(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function L(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,u=te(a),l=ne(a),d=te(i),f=ne(i),p=te(o),m=ne(o),y=te(s),v=ne(s),T=te(c),b=ne(c),x={a:function(e){return o[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:_e,e:_e,f:Ee,H:ke,I:we,j:Me,L:Se,m:Ce,M:Oe,p:function(e){return a[+(e.getHours()>=12)]},Q:rt,s:at,S:Ae,u:Ze,U:Fe,V:Ne,w:ze,W:De,x:null,X:null,y:Ie,Y:Pe,Z:Ue,"%":nt},_={a:function(e){return o[e.getUTCDay()]},A:function(e){return i[e.getUTCDay()]},b:function(e){return c[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:He,e:He,f:Be,H:Re,I:Ge,j:Ye,L:Le,m:je,M:Ke,p:function(e){return a[+(e.getUTCHours()>=12)]},Q:rt,s:at,S:Je,u:Ve,U:We,V:qe,w:$e,W:Xe,x:null,X:null,y:Qe,Y:et,Z:tt,"%":nt},k={a:function(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=T.exec(t.slice(n));return r?(e.m=b[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return S(e,t,n,r)},d:fe,e:fe,f:ve,H:pe,I:pe,j:he,L:ye,m:de,M:me,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=l[r[0].toLowerCase()],n+r[0].length):-1},Q:be,s:xe,S:ge,u:ae,U:ie,V:oe,w:re,W:se,x:function(e,t,r){return S(e,n,t,r)},X:function(e,t,n){return S(e,r,t,n)},y:ue,Y:ce,Z:le,"%":Te};function w(e,t){return function(n){var r,a,i,o=[],s=-1,c=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in i||(i.w=1),"Z"in i?(r=(a=(r=G(Y(i.y))).getUTCDay())>4||0===a?Z.ceil(r):Z(r),r=C.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(r=(a=(r=t(Y(i.y))).getDay())>4||0===a?g.ceil(r):g(r),r=h.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),a="Z"in i?G(Y(i.y)).getUTCDay():t(Y(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(a+5)%7:i.w+7*i.U-(a+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,G(i)):t(i)}}function S(e,t,n,r){for(var a,i,o=0,s=t.length,c=n.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=k[a in W?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_),{format:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},parse:function(e){var t=M(e+="",R);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",_);return t.toString=function(){return e},t},utcParse:function(e){var t=M(e,G);return t.toString=function(){return e},t}}}var B,j,K,J,V,W={"-":"",_:" ",0:"0"},q=/^\s*\d+/,$=/^%/,X=/[\\^$*+?|[\]().{}]/g;function Q(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i68?1900:2e3),n+r[0].length):-1}function le(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function de(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function fe(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function he(e,t,n){var r=q.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function pe(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function me(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function ge(e,t,n){var r=q.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ye(e,t,n){var r=q.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ve(e,t,n){var r=q.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Te(e,t,n){var r=$.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function be(e,t,n){var r=q.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function xe(e,t,n){var r=q.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function _e(e,t){return Q(e.getDate(),t,2)}function ke(e,t){return Q(e.getHours(),t,2)}function we(e,t){return Q(e.getHours()%12||12,t,2)}function Me(e,t){return Q(1+h.count(w(e),e),t,3)}function Se(e,t){return Q(e.getMilliseconds(),t,3)}function Ee(e,t){return Se(e,t)+"000"}function Ce(e,t){return Q(e.getMonth()+1,t,2)}function Oe(e,t){return Q(e.getMinutes(),t,2)}function Ae(e,t){return Q(e.getSeconds(),t,2)}function Ze(e){var t=e.getDay();return 0===t?7:t}function Fe(e,t){return Q(m.count(w(e),e),t,2)}function Ne(e,t){var n=e.getDay();return e=n>=4||0===n?T(e):T.ceil(e),Q(T.count(w(e),e)+(4===w(e).getDay()),t,2)}function ze(e){return e.getDay()}function De(e,t){return Q(g.count(w(e),e),t,2)}function Ie(e,t){return Q(e.getFullYear()%100,t,2)}function Pe(e,t){return Q(e.getFullYear()%1e4,t,4)}function Ue(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Q(t/60|0,"0",2)+Q(t%60,"0",2)}function He(e,t){return Q(e.getUTCDate(),t,2)}function Re(e,t){return Q(e.getUTCHours(),t,2)}function Ge(e,t){return Q(e.getUTCHours()%12||12,t,2)}function Ye(e,t){return Q(1+C.count(H(e),e),t,3)}function Le(e,t){return Q(e.getUTCMilliseconds(),t,3)}function Be(e,t){return Le(e,t)+"000"}function je(e,t){return Q(e.getUTCMonth()+1,t,2)}function Ke(e,t){return Q(e.getUTCMinutes(),t,2)}function Je(e,t){return Q(e.getUTCSeconds(),t,2)}function Ve(e){var t=e.getUTCDay();return 0===t?7:t}function We(e,t){return Q(A.count(H(e),e),t,2)}function qe(e,t){var n=e.getUTCDay();return e=n>=4||0===n?z(e):z.ceil(e),Q(z.count(H(e),e)+(4===H(e).getUTCDay()),t,2)}function $e(e){return e.getUTCDay()}function Xe(e,t){return Q(Z.count(H(e),e),t,2)}function Qe(e,t){return Q(e.getUTCFullYear()%100,t,2)}function et(e,t){return Q(e.getUTCFullYear()%1e4,t,4)}function tt(){return"+0000"}function nt(){return"%"}function rt(e){return+e}function at(e){return Math.floor(+e/1e3)}function it(e){return B=L(e),j=B.format,K=B.parse,J=B.utcFormat,V=B.utcParse,B}it({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var ot=Date.prototype.toISOString?function(e){return e.toISOString()}:J("%Y-%m-%dT%H:%M:%S.%LZ");var st=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:V("%Y-%m-%dT%H:%M:%S.%LZ");n.d(t,"timeFormatDefaultLocale",function(){return it}),n.d(t,"timeFormat",function(){return j}),n.d(t,"timeParse",function(){return K}),n.d(t,"utcFormat",function(){return J}),n.d(t,"utcParse",function(){return V}),n.d(t,"timeFormatLocale",function(){return L}),n.d(t,"isoFormat",function(){return ot}),n.d(t,"isoParse",function(){return st})},function(e,t,n){"use strict";n.r(t);var r=function(e,t){return et?1:e>=t?0:NaN},a=function(e){var t;return 1===e.length&&(t=e,e=function(e,n){return r(t(e),n)}),{left:function(t,n,r,a){for(null==r&&(r=0),null==a&&(a=t.length);r>>1;e(t[i],n)<0?r=i+1:a=i}return r},right:function(t,n,r,a){for(null==r&&(r=0),null==a&&(a=t.length);r>>1;e(t[i],n)>0?a=i:r=i+1}return r}}};var i=a(r),o=i.right,s=(i.left,o);var c=function(e){return null===e?NaN:+e},u=Array.prototype,l=(u.slice,u.map,function(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r0)return[e];if((r=t0)for(e=Math.ceil(e/o),t=Math.floor(t/o),i=new Array(a=Math.ceil(t-e+1));++s=0?(i>=d?10:i>=f?5:i>=h?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(i>=d?10:i>=f?5:i>=h?2:1)}function g(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),a=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),i=r/a;return i>=d?a*=10:i>=f?a*=5:i>=h&&(a*=2),t=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,i=Math.floor(a),o=+n(e[i],i,e);return o+(+n(e[i+1],i+1,e)-o)*(a-i)}};function v(){}function T(e,t){var n=new v;if(e instanceof v)e.each(function(e,t){n.set(t,e)});else if(Array.isArray(e)){var r,a=-1,i=e.length;if(null==t)for(;++a>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=U.exec(e))?J(parseInt(t[1],16)):(t=H.exec(e))?new $(t[1],t[2],t[3],1):(t=R.exec(e))?new $(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=G.exec(e))?V(t[1],t[2],t[3],t[4]):(t=Y.exec(e))?V(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=L.exec(e))?Q(t[1],t[2]/100,t[3]/100,1):(t=B.exec(e))?Q(t[1],t[2]/100,t[3]/100,t[4]):j.hasOwnProperty(e)?J(j[e]):"transparent"===e?new $(NaN,NaN,NaN,0):null}function J(e){return new $(e>>16&255,e>>8&255,255&e,1)}function V(e,t,n,r){return r<=0&&(e=t=n=NaN),new $(e,t,n,r)}function W(e){return e instanceof N||(e=K(e)),e?new $((e=e.rgb()).r,e.g,e.b,e.opacity):new $}function q(e,t,n,r){return 1===arguments.length?W(e):new $(e,t,n,null==r?1:r)}function $(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function X(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Q(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new te(e,t,n,r)}function ee(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof te)return new te(e.h,e.s,e.l,e.opacity);if(e instanceof N||(e=K(e)),!e)return new te;if(e instanceof te)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,s=i-a,c=(i+a)/2;return s?(o=t===i?(n-r)/s+6*(n0&&c<1?0:o,new te(o,s,c,e.opacity)}(e):new te(e,t,n,null==r?1:r)}function te(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function ne(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Z(N,K,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Z($,q,F(N,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new $(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new $(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+X(this.r)+X(this.g)+X(this.b)},toString:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}})),Z(te,ee,F(N,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new te(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new te(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new $(ne(e>=240?e-240:e+120,a,r),ne(e,a,r),ne(e<120?e+240:e-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var re=Math.PI/180,ae=180/Math.PI,ie=.96422,oe=1,se=.82521,ce=4/29,ue=6/29,le=3*ue*ue,de=ue*ue*ue;function fe(e){if(e instanceof pe)return new pe(e.l,e.a,e.b,e.opacity);if(e instanceof xe){if(isNaN(e.h))return new pe(e.l,0,0,e.opacity);var t=e.h*re;return new pe(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}e instanceof $||(e=W(e));var n,r,a=ve(e.r),i=ve(e.g),o=ve(e.b),s=me((.2225045*a+.7168786*i+.0606169*o)/oe);return a===i&&i===o?n=r=s:(n=me((.4360747*a+.3850649*i+.1430804*o)/ie),r=me((.0139322*a+.0971045*i+.7141733*o)/se)),new pe(116*s-16,500*(n-s),200*(s-r),e.opacity)}function he(e,t,n,r){return 1===arguments.length?fe(e):new pe(e,t,n,null==r?1:r)}function pe(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function me(e){return e>de?Math.pow(e,1/3):e/le+ce}function ge(e){return e>ue?e*e*e:le*(e-ce)}function ye(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ve(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Te(e){if(e instanceof xe)return new xe(e.h,e.c,e.l,e.opacity);if(e instanceof pe||(e=fe(e)),0===e.a&&0===e.b)return new xe(NaN,0,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*ae;return new xe(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function be(e,t,n,r){return 1===arguments.length?Te(e):new xe(e,t,n,null==r?1:r)}function xe(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}Z(pe,he,F(N,{brighter:function(e){return new pe(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new pe(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new $(ye(3.1338561*(t=ie*ge(t))-1.6168667*(e=oe*ge(e))-.4906146*(n=se*ge(n))),ye(-.9787684*t+1.9161415*e+.033454*n),ye(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),Z(xe,be,F(N,{brighter:function(e){return new xe(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new xe(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return fe(this).rgb()}}));var _e=-.14861,ke=1.78277,we=-.29227,Me=-.90649,Se=1.97294,Ee=Se*Me,Ce=Se*ke,Oe=ke*we-Me*_e;function Ae(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Ze)return new Ze(e.h,e.s,e.l,e.opacity);e instanceof $||(e=W(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=(Oe*r+Ee*t-Ce*n)/(Oe+Ee-Ce),i=r-a,o=(Se*(n-a)-we*i)/Me,s=Math.sqrt(o*o+i*i)/(Se*a*(1-a)),c=s?Math.atan2(o,i)*ae-120:NaN;return new Ze(c<0?c+360:c,s,a,e.opacity)}(e):new Ze(e,t,n,null==r?1:r)}function Ze(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Fe(e,t,n,r,a){var i=e*e,o=i*e;return((1-3*e+3*i-o)*t+(4-6*i+3*o)*n+(1+3*e+3*i-3*o)*r+o*a)/6}Z(Ze,Ae,F(N,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Ze(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Ze(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*re,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new $(255*(t+n*(_e*r+ke*a)),255*(t+n*(we*r+Me*a)),255*(t+n*(Se*r)),this.opacity)}}));var Ne=function(e){return function(){return e}};function ze(e,t){return function(n){return e+n*t}}function De(e,t){var n=t-e;return n?ze(e,n>180||n<-180?n-360*Math.round(n/360):n):Ne(isNaN(e)?t:e)}function Ie(e){return 1==(e=+e)?Pe:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Ne(isNaN(t)?n:t)}}function Pe(e,t){var n=t-e;return n?ze(e,n):Ne(isNaN(e)?t:e)}var Ue=function e(t){var n=Ie(t);function r(e,t){var r=n((e=q(e)).r,(t=q(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=Pe(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function He(e){return function(t){var n,r,a=t.length,i=new Array(a),o=new Array(a),s=new Array(a);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),a=e[r],i=e[r+1],o=r>0?e[r-1]:2*a-i,s=ri&&(a=t.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,c.push({i:o,x:Re(n,r)})),i=Ye.lastIndex;return i180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(a(n)+"rotate(",null,r)-2,x:Re(e,t)})):t&&n.push(a(n)+"rotate("+t+r)}(i.rotate,o.rotate,s,c),function(e,t,n,i){e!==t?i.push({i:n.push(a(n)+"skewX(",null,r)-2,x:Re(e,t)}):t&&n.push(a(n)+"skewX("+t+r)}(i.skewX,o.skewX,s,c),function(e,t,n,r,i,o){if(e!==n||t!==r){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:Re(e,n)},{i:s-2,x:Re(t,r)})}else 1===n&&1===r||i.push(a(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,s,c),i=o=null,function(e){for(var t,n=-1,r=c.length;++n2?st:ot,r=a=null,l}function l(t){return(r||(r=n(i,o,c?function(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=t?0:e>=n?1:r(e)}}}(e):e,s)))(+t)}return l.invert=function(e){return(a||(a=n(o,i,it,c?function(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=0?t:e>=1?n:r(e)}}}(t):t)))(+e)},l.domain=function(e){return arguments.length?(i=M.call(e,rt),u()):i.slice()},l.range=function(e){return arguments.length?(o=S.call(e),u()):o.slice()},l.rangeRound=function(e){return o=S.call(e),s=Ve,u()},l.clamp=function(e){return arguments.length?(c=!!e,u()):c},l.interpolate=function(e){return arguments.length?(s=e,u()):s},u()}var lt=function(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]},dt=function(e){return(e=lt(Math.abs(e)))?e[1]:NaN},ft=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ht(e){return new pt(e)}function pt(e){if(!(t=ft.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}ht.prototype=pt.prototype,pt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var mt,gt,yt,vt,Tt=function(e){e:for(var t,n=e.length,r=1,a=-1;r0){if(!+e[r])break e;a=0}}return a>0?e.slice(0,a)+e.slice(t+1):e},bt=function(e,t){var n=lt(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")},xt={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return bt(100*e,t)},r:bt,s:function(e,t){var n=lt(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(mt=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+lt(e,Math.max(0,t+i-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},_t=function(e){return e},kt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];gt=function(e){var t,n,r=e.grouping&&e.thousands?(t=e.grouping,n=e.thousands,function(e,r){for(var a=e.length,i=[],o=0,s=t[0],c=0;a>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),i.push(e.substring(a-=s,a+s)),!((c+=s+1)>r));)s=t[o=(o+1)%t.length];return i.reverse().join(n)}):_t,a=e.currency,i=e.decimal,o=e.numerals?function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(e.numerals):_t,s=e.percent||"%";function c(e){var t=(e=ht(e)).fill,n=e.align,c=e.sign,u=e.symbol,l=e.zero,d=e.width,f=e.comma,h=e.precision,p=e.trim,m=e.type;"n"===m?(f=!0,m="g"):xt[m]||(null==h&&(h=12),p=!0,m="g"),(l||"0"===t&&"="===n)&&(l=!0,t="0",n="=");var g="$"===u?a[0]:"#"===u&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",y="$"===u?a[1]:/[%p]/.test(m)?s:"",v=xt[m],T=/[defgprs%]/.test(m);function b(e){var a,s,u,b=g,x=y;if("c"===m)x=v(e)+x,e="";else{var _=(e=+e)<0;if(e=v(Math.abs(e),h),p&&(e=Tt(e)),_&&0==+e&&(_=!1),b=(_?"("===c?c:"-":"-"===c||"("===c?"":c)+b,x=("s"===m?kt[8+mt/3]:"")+x+(_&&"("===c?")":""),T)for(a=-1,s=e.length;++a(u=e.charCodeAt(a))||u>57){x=(46===u?i+e.slice(a+1):e.slice(a))+x,e=e.slice(0,a);break}}f&&!l&&(e=r(e,1/0));var k=b.length+e.length+x.length,w=k>1)+b+e+x+w.slice(k);break;default:e=w+b+e+x}return o(e)}return h=null==h?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h)),b.toString=function(){return e+""},b}return{format:c,formatPrefix:function(e,t){var n=c(((e=ht(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(dt(t)/3))),a=Math.pow(10,-r),i=kt[8+r/3];return function(e){return n(a*e)+i}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),yt=gt.format,vt=gt.formatPrefix;var wt=function(e,t,n){var r,a=e[0],i=e[e.length-1],o=g(a,i,null==t?10:t);switch((n=ht(null==n?",f":n)).type){case"s":var s=Math.max(Math.abs(a),Math.abs(i));return null!=n.precision||isNaN(r=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(dt(t)/3)))-dt(Math.abs(e)))}(o,s))||(n.precision=r),vt(n,s);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(r=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,dt(t)-dt(e))+1}(o,Math.max(Math.abs(a),Math.abs(i))))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(r=function(e){return Math.max(0,-dt(Math.abs(e)))}(o))||(n.precision=r-2*("%"===n.type))}return yt(n)};function Mt(e){var t=e.domain;return e.ticks=function(e){var n=t();return p(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){return wt(t(),e,n)},e.nice=function(n){null==n&&(n=10);var r,a=t(),i=0,o=a.length-1,s=a[i],c=a[o];return c0?r=m(s=Math.floor(s/r)*r,c=Math.ceil(c/r)*r,n):r<0&&(r=m(s=Math.ceil(s*r)/r,c=Math.floor(c*r)/r,n)),r>0?(a[i]=Math.floor(s/r)*r,a[o]=Math.ceil(c/r)*r,t(a)):r<0&&(a[i]=Math.ceil(s*r)/r,a[o]=Math.floor(c*r)/r,t(a)),e},e}var St=function(e,t){var n,r=0,a=(e=e.slice()).length-1,i=e[r],o=e[a];return o0))return s;do{s.push(o=new Date(+n)),t(n,i),e(n)}while(o=t)for(;e(t),!n(t);)t.setTime(t-1)},function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(a.count=function(t,r){return Dt.setTime(+t),It.setTime(+r),e(Dt),e(It),Math.floor(n(Dt,It))},a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?a.filter(r?function(t){return r(t)%e==0}:function(t){return a.count(0,t)%e==0}):a:null}),a}var Ut=Pt(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Ut.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?Pt(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):Ut:null};var Ht=Ut,Rt=(Ut.range,6e4),Gt=6048e5,Yt=Pt(function(e){e.setTime(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),Lt=Yt,Bt=(Yt.range,Pt(function(e){e.setTime(Math.floor(e/Rt)*Rt)},function(e,t){e.setTime(+e+t*Rt)},function(e,t){return(t-e)/Rt},function(e){return e.getMinutes()})),jt=Bt,Kt=(Bt.range,Pt(function(e){var t=e.getTimezoneOffset()*Rt%36e5;t<0&&(t+=36e5),e.setTime(36e5*Math.floor((+e-t)/36e5)+t)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()})),Jt=Kt,Vt=(Kt.range,Pt(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Rt)/864e5},function(e){return e.getDate()-1})),Wt=Vt;Vt.range;function qt(e){return Pt(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Rt)/Gt})}var $t=qt(0),Xt=qt(1),Qt=qt(2),en=qt(3),tn=qt(4),nn=qt(5),rn=qt(6),an=($t.range,Xt.range,Qt.range,en.range,tn.range,nn.range,rn.range,Pt(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()})),on=an,sn=(an.range,Pt(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));sn.every=function(e){return isFinite(e=Math.floor(e))&&e>0?Pt(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)}):null};var cn=sn,un=(sn.range,Pt(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Rt)},function(e,t){return(t-e)/Rt},function(e){return e.getUTCMinutes()})),ln=un,dn=(un.range,Pt(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()})),fn=dn,hn=(dn.range,Pt(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1})),pn=hn;hn.range;function mn(e){return Pt(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/Gt})}var gn=mn(0),yn=mn(1),vn=mn(2),Tn=mn(3),bn=mn(4),xn=mn(5),_n=mn(6),kn=(gn.range,yn.range,vn.range,Tn.range,bn.range,xn.range,_n.range,Pt(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()})),wn=kn,Mn=(kn.range,Pt(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}));Mn.every=function(e){return isFinite(e=Math.floor(e))&&e>0?Pt(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null};var Sn=Mn;Mn.range;function En(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Cn(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function On(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}var An,Zn,Fn,Nn,zn={"-":"",_:" ",0:"0"},Dn=/^\s*\d+/,In=/^%/,Pn=/[\\^$*+?|[\]().{}]/g;function Un(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i68?1900:2e3),n+r[0].length):-1}function Wn(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function qn(e,t,n){var r=Dn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $n(e,t,n){var r=Dn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Xn(e,t,n){var r=Dn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Qn(e,t,n){var r=Dn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function er(e,t,n){var r=Dn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function tr(e,t,n){var r=Dn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function nr(e,t,n){var r=Dn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function rr(e,t,n){var r=Dn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ar(e,t,n){var r=In.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ir(e,t,n){var r=Dn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function or(e,t,n){var r=Dn.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function sr(e,t){return Un(e.getDate(),t,2)}function cr(e,t){return Un(e.getHours(),t,2)}function ur(e,t){return Un(e.getHours()%12||12,t,2)}function lr(e,t){return Un(1+Wt.count(cn(e),e),t,3)}function dr(e,t){return Un(e.getMilliseconds(),t,3)}function fr(e,t){return dr(e,t)+"000"}function hr(e,t){return Un(e.getMonth()+1,t,2)}function pr(e,t){return Un(e.getMinutes(),t,2)}function mr(e,t){return Un(e.getSeconds(),t,2)}function gr(e){var t=e.getDay();return 0===t?7:t}function yr(e,t){return Un($t.count(cn(e),e),t,2)}function vr(e,t){var n=e.getDay();return e=n>=4||0===n?tn(e):tn.ceil(e),Un(tn.count(cn(e),e)+(4===cn(e).getDay()),t,2)}function Tr(e){return e.getDay()}function br(e,t){return Un(Xt.count(cn(e),e),t,2)}function xr(e,t){return Un(e.getFullYear()%100,t,2)}function _r(e,t){return Un(e.getFullYear()%1e4,t,4)}function kr(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Un(t/60|0,"0",2)+Un(t%60,"0",2)}function wr(e,t){return Un(e.getUTCDate(),t,2)}function Mr(e,t){return Un(e.getUTCHours(),t,2)}function Sr(e,t){return Un(e.getUTCHours()%12||12,t,2)}function Er(e,t){return Un(1+pn.count(Sn(e),e),t,3)}function Cr(e,t){return Un(e.getUTCMilliseconds(),t,3)}function Or(e,t){return Cr(e,t)+"000"}function Ar(e,t){return Un(e.getUTCMonth()+1,t,2)}function Zr(e,t){return Un(e.getUTCMinutes(),t,2)}function Fr(e,t){return Un(e.getUTCSeconds(),t,2)}function Nr(e){var t=e.getUTCDay();return 0===t?7:t}function zr(e,t){return Un(gn.count(Sn(e),e),t,2)}function Dr(e,t){var n=e.getUTCDay();return e=n>=4||0===n?bn(e):bn.ceil(e),Un(bn.count(Sn(e),e)+(4===Sn(e).getUTCDay()),t,2)}function Ir(e){return e.getUTCDay()}function Pr(e,t){return Un(yn.count(Sn(e),e),t,2)}function Ur(e,t){return Un(e.getUTCFullYear()%100,t,2)}function Hr(e,t){return Un(e.getUTCFullYear()%1e4,t,4)}function Rr(){return"+0000"}function Gr(){return"%"}function Yr(e){return+e}function Lr(e){return Math.floor(+e/1e3)}!function(e){An=function(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,i=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,u=Rn(a),l=Gn(a),d=Rn(i),f=Gn(i),h=Rn(o),p=Gn(o),m=Rn(s),g=Gn(s),y=Rn(c),v=Gn(c),T={a:function(e){return o[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:sr,e:sr,f:fr,H:cr,I:ur,j:lr,L:dr,m:hr,M:pr,p:function(e){return a[+(e.getHours()>=12)]},Q:Yr,s:Lr,S:mr,u:gr,U:yr,V:vr,w:Tr,W:br,x:null,X:null,y:xr,Y:_r,Z:kr,"%":Gr},b={a:function(e){return o[e.getUTCDay()]},A:function(e){return i[e.getUTCDay()]},b:function(e){return c[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:wr,e:wr,f:Or,H:Mr,I:Sr,j:Er,L:Cr,m:Ar,M:Zr,p:function(e){return a[+(e.getUTCHours()>=12)]},Q:Yr,s:Lr,S:Fr,u:Nr,U:zr,V:Dr,w:Ir,W:Pr,x:null,X:null,y:Ur,Y:Hr,Z:Rr,"%":Gr},x={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return w(e,t,n,r)},d:$n,e:$n,f:rr,H:Qn,I:Qn,j:Xn,L:nr,m:qn,M:er,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=l[r[0].toLowerCase()],n+r[0].length):-1},Q:ir,s:or,S:tr,u:Ln,U:Bn,V:jn,w:Yn,W:Kn,x:function(e,t,r){return w(e,n,t,r)},X:function(e,t,n){return w(e,r,t,n)},y:Vn,Y:Jn,Z:Wn,"%":ar};function _(e,t){return function(n){var r,a,i,o=[],s=-1,c=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in i||(i.w=1),"Z"in i?(r=(a=(r=Cn(On(i.y))).getUTCDay())>4||0===a?yn.ceil(r):yn(r),r=pn.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(r=(a=(r=t(On(i.y))).getDay())>4||0===a?Xt.ceil(r):Xt(r),r=Wt.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),a="Z"in i?Cn(On(i.y)).getUTCDay():t(On(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(a+5)%7:i.w+7*i.U-(a+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,Cn(i)):t(i)}}function w(e,t,n,r){for(var a,i,o=0,s=t.length,c=n.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=x[a in zn?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return T.x=_(n,T),T.X=_(r,T),T.c=_(t,T),b.x=_(n,b),b.X=_(r,b),b.c=_(t,b),{format:function(e){var t=_(e+="",T);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",En);return t.toString=function(){return e},t},utcFormat:function(e){var t=_(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e,Cn);return t.toString=function(){return e},t}}}(e),Zn=An.format,An.parse,Fn=An.utcFormat,Nn=An.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||Fn("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||Nn("%Y-%m-%dT%H:%M:%S.%LZ");var Br=1e3,jr=60*Br,Kr=60*jr,Jr=24*Kr,Vr=7*Jr,Wr=30*Jr,qr=365*Jr;function $r(e){return new Date(e)}function Xr(e){return e instanceof Date?+e:+new Date(+e)}function Qr(e,t,n,r,i,o,s,c,u){var l=ut(it,Re),d=l.invert,f=l.domain,h=u(".%L"),p=u(":%S"),m=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),T=u("%b %d"),b=u("%B"),x=u("%Y"),_=[[s,1,Br],[s,5,5*Br],[s,15,15*Br],[s,30,30*Br],[o,1,jr],[o,5,5*jr],[o,15,15*jr],[o,30,30*jr],[i,1,Kr],[i,3,3*Kr],[i,6,6*Kr],[i,12,12*Kr],[r,1,Jr],[r,2,2*Jr],[n,1,Vr],[t,1,Wr],[t,3,3*Wr],[e,1,qr]];function k(a){return(s(a)0){for(;fc)break;g.push(d)}}else for(;f=1;--l)if(!((d=u*l)c)break;g.push(d)}}else g=p(f,h,Math.min(h-f,m)).map(i);return t?g.reverse():g},t.tickFormat=function(e,n){if(null==n&&(n=10===r?".0e":","),"function"!=typeof n&&(n=yt(n)),e===1/0)return n;null==e&&(e=10);var o=Math.max(1,r*e/t.ticks().length);return function(e){var t=e/i(Math.round(a(e)));return t*r=r?[a[r-1],n]:[a[o-1],a[o]]},o.copy=function(){return e().domain([t,n]).range(i)},Mt(o)}();return t&&c.range(t),n&&c.domain(n),o&&c.nice(),r&&c.ticks(r),a&&c.tickFormat(a),c},ua=function(e){var t=e.range,n=e.domain,a=function e(){var t=[],n=[],a=[];function i(){var e=0,r=Math.max(1,n.length);for(a=new Array(r-1);++e0?a[r-1]:t[0],r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n};function fa(e,t){var n=da(t,[]),r=e.copy();return Object.keys(n).forEach(function(e){r.hasOwnProperty(e)&&r[e](n[e])}),r}},function(e,t){function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t){e.exports=function(e,t){for(var n=[],r=(t=t||0)||0;r';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),l(),e=e.replace(s,"\\\n"),this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&u()}:this.iframe.onload=u}}).call(this,n(6))},function(e,t,n){(function(t){var n=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),a=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function o(e){for(var t=0;t>2],i+=e[(3&r[n])<<4|r[n+1]>>4],i+=e[(15&r[n+1])<<2|r[n+2]>>6],i+=e[63&r[n+2]];return a%3==2?i=i.substring(0,i.length-1)+"=":a%3==1&&(i=i.substring(0,i.length-2)+"=="),i},t.decode=function(e){var t,r,a,i,o,s=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),d=new Uint8Array(l);for(t=0;t>4,d[u++]=(15&a)<<4|i>>2,d[u++]=(3&i)<<6|63&o;return l}}()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(e,r){var a;/*! https://mths.be/utf8js v2.1.2 by @mathias */!function(i){var o="object"==typeof t&&t,s=("object"==typeof e&&e&&e.exports,"object"==typeof r&&r);s.global!==s&&s.window;var c,u,l,d=String.fromCharCode;function f(e){for(var t,n,r=[],a=0,i=e.length;a=55296&&t<=56319&&a=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function p(e,t){return d(e>>t&63|128)}function m(e,t){if(0==(4294967168&e))return d(e);var n="";return 0==(4294965248&e)?n=d(e>>6&31|192):0==(4294901760&e)?(h(e,t)||(e=65533),n=d(e>>12&15|224),n+=p(e,6)):0==(4292870144&e)&&(n=d(e>>18&7|240),n+=p(e,12),n+=p(e,6)),n+=d(63&e|128)}function g(){if(l>=u)throw Error("Invalid byte index");var e=255&c[l];if(l++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function y(e){var t,n;if(l>u)throw Error("Invalid byte index");if(l==u)return!1;if(t=255&c[l],l++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|g())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|g()<<6|g())>=2048)return h(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|g()<<12|g()<<6|g())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var v={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=f(e),a=r.length,i=-1,o="";++i65535&&(a+=d((t-=65536)>>>10&1023|55296),t=56320|1023&t),a+=d(t);return a}(a)}};void 0===(a=function(){return v}.call(t,n,t,e))||(e.exports=a)}()}).call(this,n(46)(e),n(6))},function(e,t){function n(){}e.exports=function(e,t,r){var a=!1;return r=r||n,i.count=e,0===e?t():i;function i(e,n){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(a=!0,t(e),t=r):0!==i.count||a||t(null,n)}}},function(e,t){e.exports=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var a=new Uint8Array(e),i=new Uint8Array(n-t),o=t,s=0;o>1,l=-7,d=n?a-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=256*o+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),i-=u}return(h?-1:1)*o*Math.pow(2,i-r)},t.write=function(e,t,n,r,a,i){var o,s,c,u=8*i-a-1,l=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(s=0,o=l):o+d>=1?(s=(t*c-1)*Math.pow(2,a),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;e[n+h]=255&s,h+=p,s/=256,a-=8);for(o=o<0;e[n+h]=255&o,h+=p,o/=256,u-=8);e[n+h-p]|=128*m}},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=u(e),r=n[0],o=n[1],s=new i(function(e,t,n){return 3*(t+n)/4-n}(0,r,o)),c=0,l=o>0?r-4:r,d=0;d>16&255,s[c++]=t>>8&255,s[c++]=255&t;2===o&&(t=a[e.charCodeAt(d)]<<2|a[e.charCodeAt(d+1)]>>4,s[c++]=255&t);1===o&&(t=a[e.charCodeAt(d)]<<10|a[e.charCodeAt(d+1)]<<4|a[e.charCodeAt(d+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,a=n%3,i=[],o=0,s=n-a;os?s:o+16383));1===a?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===a&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var a,i,o=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t,n){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var r=n(76),o=n(75),i=n(74);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,o);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,o){var i,a=1,u=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,u/=2,s/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;iu&&(n=u-s),i=n;i>=0;i--){for(var f=!0,d=0;do&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function P(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:l>223?3:l>191?2:1;if(o+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(i=e[o+1]))&&(s=(31&l)<<6|63&i)>127&&(c=s);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(s=(15&l)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[o+1],a=e[o+2],u=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&l)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(c=s)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=f}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return x(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,o){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var i=o-r,a=n-t,u=Math.min(i,a),l=this.slice(r,o),c=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return g(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return k(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function S(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,i){return i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),o.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),o.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),o.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),o.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=0,a=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=n-1,a=1,u=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/a>>0)-u&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(3))},function(e,t){e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t}},function(e,t,n){(function(t){var r=n(13),o=n(28),i=n(7),a=n(9),u=n(5)("engine.io-client:polling-xhr");function s(){}function l(e){if(o.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,t.location){var n="https:"===location.protocol,r=location.port;r||(r=n?443:80),this.xd=e.hostname!==t.location.hostname||r!==e.port,this.xs=e.secure!==n}}function c(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}function f(){for(var e in c.requests)c.requests.hasOwnProperty(e)&&c.requests[e].abort()}e.exports=l,e.exports.Request=c,a(l,o),l.prototype.supportsBinary=!0,l.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new c(e)},l.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),o=this;r.on("success",t),r.on("error",function(e){o.onError("xhr post error",e)}),this.sendXhr=r},l.prototype.doPoll=function(){u("xhr poll");var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},i(c.prototype),c.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var n=this.xhr=new r(e),o=this;try{u("xhr open %s: %s",this.method,this.uri),n.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this.extraHeaders[i])}catch(e){}if("POST"===this.method)try{this.isBinary?n.setRequestHeader("Content-type","application/octet-stream"):n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in n&&(n.withCredentials=!0),this.requestTimeout&&(n.timeout=this.requestTimeout),this.hasXDR()?(n.onload=function(){o.onLoad()},n.onerror=function(){o.onError(n.responseText)}):n.onreadystatechange=function(){if(2===n.readyState)try{var e=n.getResponseHeader("Content-Type");o.supportsBinary&&"application/octet-stream"===e&&(n.responseType="arraybuffer")}catch(e){}4===n.readyState&&(200===n.status||1223===n.status?o.onLoad():setTimeout(function(){o.onError(n.status)},0))},u("xhr data %s",this.data),n.send(this.data)}catch(e){return void setTimeout(function(){o.onError(e)},0)}t.document&&(this.index=c.requestsCount++,c.requests[this.index]=this)},c.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},c.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},c.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},c.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=s:this.xhr.onreadystatechange=s,e)try{this.xhr.abort()}catch(e){}t.document&&delete c.requests[this.index],this.xhr=null}},c.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},c.prototype.hasXDR=function(){return void 0!==t.XDomainRequest&&!this.xs&&this.enablesXDR},c.prototype.abort=function(){this.cleanup()},c.requestsCount=0,c.requests={},t.document&&(t.attachEvent?t.attachEvent("onunload",f):t.addEventListener&&t.addEventListener("beforeunload",f,!1))}).call(this,n(3))},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){e.exports=!1}},function(e,t,n){(function(t){var r=n(29),o=n(7),i=n(5)("engine.io-client:socket"),a=n(25),u=n(6),s=n(33),l=n(10);function c(e,n){if(!(this instanceof c))return new c(e,n);n=n||{},e&&"object"==typeof e&&(n=e,e=null),e?(e=s(e),n.hostname=e.host,n.secure="https"===e.protocol||"wss"===e.protocol,n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=s(n.host).host),this.secure=null!=n.secure?n.secure:t.location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.agent=n.agent||!1,this.hostname=n.hostname||(t.location?location.hostname:"localhost"),this.port=n.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=n.query||{},"string"==typeof this.query&&(this.query=l.decode(this.query)),this.upgrade=!1!==n.upgrade,this.path=(n.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!n.forceJSONP,this.jsonp=!1!==n.jsonp,this.forceBase64=!!n.forceBase64,this.enablesXDR=!!n.enablesXDR,this.timestampParam=n.timestampParam||"t",this.timestampRequests=n.timestampRequests,this.transports=n.transports||["polling","websocket"],this.transportOptions=n.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=n.policyPort||843,this.rememberUpgrade=n.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=n.onlyBinaryUpgrades,this.perMessageDeflate=!1!==n.perMessageDeflate&&(n.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=n.pfx||null,this.key=n.key||null,this.passphrase=n.passphrase||null,this.cert=n.cert||null,this.ca=n.ca||null,this.ciphers=n.ciphers||null,this.rejectUnauthorized=void 0===n.rejectUnauthorized||n.rejectUnauthorized,this.forceNode=!!n.forceNode;var r="object"==typeof t&&t;r.global===r&&(n.extraHeaders&&Object.keys(n.extraHeaders).length>0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=c,c.priorWebsocketSuccess=!1,o(c.prototype),c.protocol=u.protocol,c.Socket=c,c.Transport=n(12),c.transports=n(29),c.parser=n(6),c.prototype.createTransport=function(e){i('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=u.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0})},c.prototype.open=function(){var e;if(this.rememberUpgrade&&c.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},c.prototype.setTransport=function(e){i("setting transport %s",e.name);var t=this;this.transport&&(i("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},c.prototype.probe=function(e){i('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var o=!this.supportsBinary&&r.transport.supportsBinary;n=n||o}n||(i('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(i('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;c.priorWebsocketSuccess="websocket"===t.name,i('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(i("changing transport and sending upgrade packet"),d(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{i('probe transport "%s" failed',e);var a=new Error("probe error");a.transport=t.name,r.emit("upgradeError",a)}}))}function a(){n||(n=!0,d(),t.close(),t=null)}function u(n){var o=new Error("probe error: "+n);o.transport=t.name,a(),i('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",o)}function s(){u("transport closed")}function l(){u("socket closed")}function f(e){t&&e.name!==t.name&&(i('"%s" works - aborting "%s"',e.name,t.name),a())}function d(){t.removeListener("open",o),t.removeListener("error",u),t.removeListener("close",s),r.removeListener("close",l),r.removeListener("upgrading",f)}c.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",u),t.once("close",s),this.once("close",l),this.once("upgrading",f),t.open()},c.prototype.onOpen=function(){if(i("socket open"),this.readyState="open",c.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){i("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===l&&!1===isNaN(e))return t.long?u(s=e,i,"day")||u(s,o,"hour")||u(s,r,"minute")||u(s,n,"second")||s+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=r)return Math.round(e/r)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){function r(e){var n;function r(){if(r.enabled){var e=r,o=+new Date,i=o-(n||o);e.diff=i,e.prev=n,e.curr=o,n=o;for(var a=new Array(arguments.length),u=0;u1)for(var n=1;n=t.length&&(n=0),this.activateMenuItem(n)}}},{key:"handleTab",value:function(e){this.state.active&&(e.preventDefault(),this.commitSelection(this.state.activateIndex))}},{key:"handleReturn",value:function(e){e.preventDefault(),this.state.active?this.commitSelection(this.state.activateIndex):this.setState({active:!0})}},{key:"handleEscape",value:function(){this.setState({active:!1,activateIndex:0})}},{key:"handleKeyPress",value:function(e){27===e.which?this.handleEscape(e):9===e.which?this.handleTab(e):13===e.which?this.handleReturn(e):38===e.which?this.handleUpArrow(e):40===e.which&&this.handleDownArrow(e)}},{key:"handleSelectItem",value:function(e){this.commitSelection(e)}},{key:"renderMenu",value:function(){var e=this;if(!this.state.active)return null;var t=this.props.items;return a.default.createElement(s.default,null,t.map(function(t,n){return a.default.createElement(l.default,{item:t,index:n,onSelectItem:e.handleSelectItem,activateIndex:e.state.activateIndex,key:"item-"+n++})}))}},{key:"render",value:function(){var e=this,t=this.props,n=t.inline,r=t.className;return a.default.createElement(c.default,{className:(0,u.default)(r,{"video-react-menu-button-inline":!!n,"video-react-menu-button-popup":!n,"video-react-menu-button-active":this.state.active},"video-react-control video-react-button video-react-menu-button"),role:"presentation",tabIndex:"0",ref:function(t){e.menuButton=t},onClick:this.handleClick,onFocus:this.handleFocus,onBlur:this.handleBlur},this.props.children,this.renderMenu())}}]),t}();t.default=p,p.propTypes=d,p.displayName="MenuButton"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(1)),o=a(n(0)),i=a(n(2));function a(e){return e&&e.__esModule?e:{default:e}}var u={percentage:r.default.string,vertical:r.default.bool,className:r.default.string};function s(e){var t=e.percentage,n=e.vertical,r=e.className,a={};return n?a.height=t:a.width=t,o.default.createElement("div",{className:(0,i.default)(r,"video-react-volume-level"),style:a},o.default.createElement("span",{className:"video-react-control-text"}))}s.propTypes=u,s.defaultProps={percentage:"100%",vertical:!1},s.displayName="VolumeLevel",t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:i,t=arguments[1];switch(t.type){case o.OPERATE:return r({},e,{count:e.count+1,operation:r({},e.operation,t.operation)});default:return e}}t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:a,t=arguments[1];switch(t.type){case i.USER_ACTIVATE:return r({},e,{userActivity:t.activity});case i.PLAYER_ACTIVATE:return r({},e,{isActive:t.activity});case i.FULLSCREEN_CHANGE:return r({},e,{isFullscreen:!!t.isFullscreen});case o.SEEKING_TIME:return r({},e,{seekingTime:t.time});case o.END_SEEKING:return r({},e,{seekingTime:0});case o.LOAD_START:return r({},e,t.videoProps,{hasStarted:!1,ended:!1});case o.CAN_PLAY:return r({},e,t.videoProps,{waiting:!1});case o.WAITING:return r({},e,t.videoProps,{waiting:!0});case o.CAN_PLAY_THROUGH:case o.PLAYING:return r({},e,t.videoProps,{waiting:!1});case o.PLAY:return r({},e,t.videoProps,{ended:!1,paused:!1,autoPaused:!1,waiting:!1,hasStarted:!0});case o.PAUSE:return r({},e,t.videoProps,{paused:!0});case o.END:return r({},e,t.videoProps,{ended:!0});case o.SEEKING:return r({},e,t.videoProps,{seeking:!0});case o.SEEKED:return r({},e,t.videoProps,{seeking:!1});case o.ERROR:return r({},e,t.videoProps,{error:"UNKNOWN ERROR",ended:!0});case o.DURATION_CHANGE:case o.TIME_UPDATE:case o.VOLUME_CHANGE:case o.PROGRESS_CHANGE:case o.RATE_CHANGE:case o.SUSPEND:case o.ABORT:case o.EMPTIED:case o.STALLED:case o.LOADED_META_DATA:case o.LOADED_DATA:case o.RESIZE:var n=r({},e,t.videoProps);return!1===t.videoProps.paused&&(n.hasStarted=!0,n.waiting=!1),n;default:return e}}t.default=u},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";n.r(t),n.d(t,"createStore",function(){return s}),n.d(t,"combineReducers",function(){return c}),n.d(t,"bindActionCreators",function(){return d}),n.d(t,"applyMiddleware",function(){return h}),n.d(t,"compose",function(){return p}),n.d(t,"__DO_NOT_USE__ActionTypes",function(){return o});var r=n(21),o={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(u)throw u;for(var r=!1,o={},i=0;i=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return R(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,a);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,a){var i,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var l=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){for(var d=!0,f=0;fa&&(r=a):r=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var o=0;o>8,a=n%256,i.push(a),i.push(r);return i}(t,e.length-n),e,n,r)}function w(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a239?4:u>223?3:u>191?2:1;if(a+d<=n)switch(d){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[a+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[a+1],o=e[a+2],128==(192&i)&&128==(192&o)&&(c=(15&u)<<12|(63&i)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[a+1],o=e[a+2],s=e[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(c=(15&u)<<18|(63&i)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,d=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),a+=d}return function(e){var t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return w(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,a){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,a>>>=0,this===e)return 0;for(var i=a-r,o=n-t,s=Math.min(i,o),u=this.slice(r,a),l=e.slice(t,n),d=0;da)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":return b(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function E(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;ar)&&(n=r);for(var a="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,n,r,a,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-n,2);a>>8*(r?a:1-a)}function z(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-n,4);a>>8*(r?a:3-a)&255}function D(e,t,n,r,a,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(e,t,n,r,i){return i||D(e,0,n,4),a.write(e,t,n,r,23,4),n+4}function P(e,t,n,r,i){return i||D(e,0,n,8),a.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)r+=this[e+--t]*a;return r},c.prototype.readUInt8=function(e,t){return t||Z(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||Z(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||Z(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||Z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||Z(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Z(e,t,this.length);for(var r=this[e],a=1,i=0;++i=(a*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Z(e,t,this.length);for(var r=t,a=1,i=this[e+--r];r>0&&(a*=256);)i+=this[e+--r]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||Z(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||Z(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||Z(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||Z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||Z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||Z(e,4,this.length),a.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||Z(e,4,this.length),a.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||Z(e,8,this.length),a.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||Z(e,8,this.length),a.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||F(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):z(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):z(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);F(this,e,t,n,a-1,-a)}var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);F(this,e,t,n,a-1,-a)}var i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):z(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):z(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return I(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return I(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return P(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return P(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--a)e[a+t]=this[a+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){for(var a=0;a=t.length||a>=e.length);++a)t[a+n]=e[a];return a}}).call(this,n(6))},function(e,t){e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t}},function(e,t,n){(function(t){var r=n(15),a=n(26),i=n(10),o=n(11),s=n(8)("engine.io-client:polling-xhr");function c(){}function u(e){if(a.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,t.location){var n="https:"===location.protocol,r=location.port;r||(r=n?443:80),this.xd=e.hostname!==t.location.hostname||r!==e.port,this.xs=e.secure!==n}}function l(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}function d(){for(var e in l.requests)l.requests.hasOwnProperty(e)&&l.requests[e].abort()}e.exports=u,e.exports.Request=l,o(u,a),u.prototype.supportsBinary=!0,u.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new l(e)},u.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),a=this;r.on("success",t),r.on("error",function(e){a.onError("xhr post error",e)}),this.sendXhr=r},u.prototype.doPoll=function(){s("xhr poll");var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},i(l.prototype),l.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var n=this.xhr=new r(e),a=this;try{s("xhr open %s: %s",this.method,this.uri),n.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this.extraHeaders[i])}catch(e){}if("POST"===this.method)try{this.isBinary?n.setRequestHeader("Content-type","application/octet-stream"):n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in n&&(n.withCredentials=!0),this.requestTimeout&&(n.timeout=this.requestTimeout),this.hasXDR()?(n.onload=function(){a.onLoad()},n.onerror=function(){a.onError(n.responseText)}):n.onreadystatechange=function(){if(2===n.readyState)try{var e=n.getResponseHeader("Content-Type");a.supportsBinary&&"application/octet-stream"===e&&(n.responseType="arraybuffer")}catch(e){}4===n.readyState&&(200===n.status||1223===n.status?a.onLoad():setTimeout(function(){a.onError(n.status)},0))},s("xhr data %s",this.data),n.send(this.data)}catch(e){return void setTimeout(function(){a.onError(e)},0)}t.document&&(this.index=l.requestsCount++,l.requests[this.index]=this)},l.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},l.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},l.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},l.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=c:this.xhr.onreadystatechange=c,e)try{this.xhr.abort()}catch(e){}t.document&&delete l.requests[this.index],this.xhr=null}},l.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},l.prototype.hasXDR=function(){return void 0!==t.XDomainRequest&&!this.xs&&this.enablesXDR},l.prototype.abort=function(){this.cleanup()},l.requestsCount=0,l.requests={},t.document&&(t.attachEvent?t.attachEvent("onunload",d):t.addEventListener&&t.addEventListener("beforeunload",d,!1))}).call(this,n(6))},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){e.exports=!1}},function(e,t,n){(function(t){var r=n(27),a=n(10),i=n(8)("engine.io-client:socket"),o=n(23),s=n(9),c=n(31),u=n(12);function l(e,n){if(!(this instanceof l))return new l(e,n);n=n||{},e&&"object"==typeof e&&(n=e,e=null),e?(e=c(e),n.hostname=e.host,n.secure="https"===e.protocol||"wss"===e.protocol,n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=c(n.host).host),this.secure=null!=n.secure?n.secure:t.location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.agent=n.agent||!1,this.hostname=n.hostname||(t.location?location.hostname:"localhost"),this.port=n.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=n.query||{},"string"==typeof this.query&&(this.query=u.decode(this.query)),this.upgrade=!1!==n.upgrade,this.path=(n.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!n.forceJSONP,this.jsonp=!1!==n.jsonp,this.forceBase64=!!n.forceBase64,this.enablesXDR=!!n.enablesXDR,this.timestampParam=n.timestampParam||"t",this.timestampRequests=n.timestampRequests,this.transports=n.transports||["polling","websocket"],this.transportOptions=n.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=n.policyPort||843,this.rememberUpgrade=n.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=n.onlyBinaryUpgrades,this.perMessageDeflate=!1!==n.perMessageDeflate&&(n.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=n.pfx||null,this.key=n.key||null,this.passphrase=n.passphrase||null,this.cert=n.cert||null,this.ca=n.ca||null,this.ciphers=n.ciphers||null,this.rejectUnauthorized=void 0===n.rejectUnauthorized||n.rejectUnauthorized,this.forceNode=!!n.forceNode;var r="object"==typeof t&&t;r.global===r&&(n.extraHeaders&&Object.keys(n.extraHeaders).length>0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=l,l.priorWebsocketSuccess=!1,a(l.prototype),l.protocol=s.protocol,l.Socket=l,l.Transport=n(14),l.transports=n(27),l.parser=n(9),l.prototype.createTransport=function(e){i('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=s.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0})},l.prototype.open=function(){var e;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},l.prototype.setTransport=function(e){i("setting transport %s",e.name);var t=this;this.transport&&(i("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},l.prototype.probe=function(e){i('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function a(){if(r.onlyBinaryUpgrades){var a=!this.supportsBinary&&r.transport.supportsBinary;n=n||a}n||(i('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(a){if(!n)if("pong"===a.type&&"probe"===a.data){if(i('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;l.priorWebsocketSuccess="websocket"===t.name,i('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){n||"closed"!==r.readyState&&(i("changing transport and sending upgrade packet"),f(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())})}else{i('probe transport "%s" failed',e);var o=new Error("probe error");o.transport=t.name,r.emit("upgradeError",o)}}))}function o(){n||(n=!0,f(),t.close(),t=null)}function s(n){var a=new Error("probe error: "+n);a.transport=t.name,o(),i('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",a)}function c(){s("transport closed")}function u(){s("socket closed")}function d(e){t&&e.name!==t.name&&(i('"%s" works - aborting "%s"',e.name,t.name),o())}function f(){t.removeListener("open",a),t.removeListener("error",s),t.removeListener("close",c),r.removeListener("close",u),r.removeListener("upgrading",d)}l.priorWebsocketSuccess=!1,t.once("open",a),t.once("error",s),t.once("close",c),this.once("close",u),this.once("upgrading",d),t.open()},l.prototype.onOpen=function(){if(i("socket open"),this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){i("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*o;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*a;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===u&&!1===isNaN(e))return t.long?s(c=e,i,"day")||s(c,a,"hour")||s(c,r,"minute")||s(c,n,"second")||c+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=r)return Math.round(e/r)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){function r(e){var n;function r(){if(r.enabled){var e=r,a=+new Date,i=a-(n||a);e.diff=i,e.prev=n,e.curr=a,n=a;for(var o=new Array(arguments.length),s=0;s1)for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n};function f(e){var t=e.top,n=void 0===t?0:t,r=e.left,i=void 0===r?0:r,f=e.scale,h=e.width,p=e.stroke,m=void 0===p?"#eaf0f6":p,g=e.strokeWidth,y=void 0===g?1:g,v=e.strokeDasharray,T=e.className,b=e.numTicks,x=void 0===b?10:b,_=e.lineStyle,k=e.offset,w=d(e,["top","left","scale","width","stroke","strokeWidth","strokeDasharray","className","numTicks","lineStyle","offset"]),M=f.ticks?f.ticks(x):f.domain();return a.a.createElement(c.Group,{className:o()("vx-rows",T),top:n,left:i},M.map(function(e,t){var n=k?f(e)+k:f(e),r=new u.a({x:0,y:n}),i=new u.a({x:h,y:n});return a.a.createElement(s.Line,l({key:"row-line-"+e+"-"+t,from:r,to:i,stroke:m,strokeWidth:y,strokeDasharray:v,style:_},w))}))}function h(e){var t=e.top,n=void 0===t?0:t,r=e.left,i=void 0===r?0:r,f=e.scale,h=e.height,p=e.stroke,m=void 0===p?"#eaf0f6":p,g=e.strokeWidth,y=void 0===g?1:g,v=e.strokeDasharray,T=e.className,b=e.numTicks,x=void 0===b?10:b,_=e.lineStyle,k=e.offset,w=d(e,["top","left","scale","height","stroke","strokeWidth","strokeDasharray","className","numTicks","lineStyle","offset"]),M=f.ticks?f.ticks(x):f.domain();return a.a.createElement(c.Group,{className:o()("vx-columns",T),top:n,left:i},M.map(function(e,t){var n=k?f(e)+k:f(e),r=new u.a({x:n,y:0}),i=new u.a({x:n,y:h});return a.a.createElement(s.Line,l({key:"column-line-"+e+"-"+t,from:r,to:i,stroke:m,strokeWidth:y,strokeDasharray:v,style:_},w))}))}function p(e){var t=e.top,n=e.left,r=e.xScale,i=e.yScale,s=e.width,u=e.height,p=e.className,m=e.stroke,g=e.strokeWidth,y=e.strokeDasharray,v=e.numTicksRows,T=e.numTicksColumns,b=e.rowLineStyle,x=e.columnLineStyle,_=e.xOffset,k=e.yOffset,w=d(e,["top","left","xScale","yScale","width","height","className","stroke","strokeWidth","strokeDasharray","numTicksRows","numTicksColumns","rowLineStyle","columnLineStyle","xOffset","yOffset"]);return a.a.createElement(c.Group,{className:o()("vx-grid",p),top:t,left:n},a.a.createElement(f,l({className:p,scale:i,width:s,stroke:m,strokeWidth:g,strokeDasharray:y,numTicks:v,style:b,offset:k},w)),a.a.createElement(h,l({className:p,scale:r,height:u,stroke:m,strokeWidth:g,strokeDasharray:y,numTicks:T,style:x,offset:_},w)))}},function(e,t){var n=function(e){this.value=e};n.math={isDegree:!0,acos:function(e){return n.math.isDegree?180/Math.PI*Math.acos(e):Math.acos(e)},add:function(e,t){return e+t},asin:function(e){return n.math.isDegree?180/Math.PI*Math.asin(e):Math.asin(e)},atan:function(e){return n.math.isDegree?180/Math.PI*Math.atan(e):Math.atan(e)},acosh:function(e){return Math.log(e+Math.sqrt(e*e-1))},asinh:function(e){return Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){return Math.log((1+e)/(1-e))},C:function(e,t){var r=1,a=e-t,i=t;iv.length-2?v.length-1:k.length-i;y>0;y--)for(b=0;bn)s.push(e);else{for(;n>=a&&!l||l&&a1)throw new r.exception("Uncaught Syntax error");return i[0].value>1e15?"Infinity":parseFloat(i[0].value.toFixed(15))},r.eval=function(e,t,n){return void 0===t?this.lex(e).toPostfix().postfixEval():void 0===n?void 0!==t.length?this.lex(e,t).toPostfix().postfixEval():this.lex(e).toPostfix().postfixEval(t):this.lex(e,t).toPostfix().postfixEval(n)},e.exports=r},function(e,t,n){var r=n(71);r.prototype.formulaEval=function(){"use strict";for(var e,t,n,r=[],a=this.value,i=0;i"+t.value+""+a[i].show+""+e.value+"",type:10}):r.push({value:(1!=t.type?"(":"")+t.value+(1!=t.type?")":"")+""+e.value+"",type:1})):2===a[i].type||9===a[i].type?(e=r.pop(),t=r.pop(),r.push({value:(1!=t.type?"(":"")+t.value+(1!=t.type?")":"")+a[i].show+(1!=e.type?"(":"")+e.value+(1!=e.type?")":""),type:a[i].type})):12===a[i].type&&(e=r.pop(),t=r.pop(),n=r.pop(),r.push({value:a[i].show+"("+n.value+","+t.value+","+e.value+")",type:12}));return r[0].value},e.exports=r},function(e,t){function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var i=a(e,t,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+e.length,i[1]),post:n.slice(i[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}function a(e,t,n){var r,a,i,o,s,c=n.indexOf(e),u=n.indexOf(t,c+1),l=c;if(c>=0&&u>0){for(r=[],i=n.length;l>=0&&!s;)l==c?(r.push(l),c=n.indexOf(e,l+1)):1==r.length?s=[r.pop(),u]:((a=r.pop())=0?c:u;r.length&&(s=[i,o])}return s}e.exports=n,n.range=a},function(e,t,n){var r=n(73);function a(e,t,n){var i=e;return function(e,t){var n=[],a="string"==typeof t?new RegExp("\\b("+t+")\\("):t;do{var i=a.exec(e);if(!i)return n;if(void 0===i[1])throw new Error("Missing the first couple of parenthesis to get the function identifier in "+t);var o=i[1],s=i.index,c=r("(",")",e.substring(s));if(!c||c.start!==i[0].length-1)throw new SyntaxError(o+"(): missing closing ')' in the value '"+e+"'");n.push({matches:c,functionIdentifier:o}),e=c.post}while(a.test(e));return n}(e,t).reduce(function(e,r){return e.replace(r.functionIdentifier+"("+r.matches.body+")",function(e,t,n,r,i){return n(a(e,i,n),t,r)}(r.matches.body,r.functionIdentifier,n,i,t))},e)}e.exports=a},function(e,t){function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var i=a(e,t,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+e.length,i[1]),post:n.slice(i[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}function a(e,t,n){var r,a,i,o,s,c=n.indexOf(e),u=n.indexOf(t,c+1),l=c;if(c>=0&&u>0){for(r=[],i=n.length;l>=0&&!s;)l==c?(r.push(l),c=n.indexOf(e,l+1)):1==r.length?s=[r.pop(),u]:((a=r.pop())=0?c:u;r.length&&(s=[i,o])}return s}e.exports=n,n.range=a},function(e,t,n){"use strict";n.r(t),n.d(t,"Axis",function(){return v}),n.d(t,"AxisLeft",function(){return b}),n.d(t,"AxisRight",function(){return _}),n.d(t,"AxisTop",function(){return w}),n.d(t,"AxisBottom",function(){return S}),n.d(t,"Orientation",function(){return p});var r=n(2),a=n.n(r),i=n(1),o=n.n(i),s=n(3),c=n.n(s),u=n(7),l=n(5),d=n(4),f=n(19);function h(e){return e}var p={top:"top",left:"left",right:"right",bottom:"bottom"},m=Object.assign||function(e){for(var t=1;t520?10:5}),o.default.createElement(f.AxisLeft,{scale:v}),o.default.createElement("text",{x:"10",y:"10",transform:"rotate(0)",fontSize:10},"Valence"),o.default.createElement(l.Threshold,{data:a,x:p,y0:0,y1:m,xScale:y,yScale:v,clipAboveTo:0,clipBelowTo:g,curve:c.curveBasis,belowAreaProps:{fill:"red",fillOpacity:.4},aboveAreaProps:{fill:"green",fillOpacity:.4}}),o.default.createElement(u.LinePath,{data:a,curve:c.curveBasis,x:p,y:m,xScale:y,yScale:v,stroke:"#000",strokeWidth:1.5,strokeOpacity:.8,strokeDasharray:"1,2"}),o.default.createElement(u.LinePath,{data:a,curve:c.curveBasis,x:p,y:m,xScale:y,yScale:v,stroke:"#000",strokeWidth:1.5}))))}}]),t}();t.default=g},function(e,t,n){"use strict";e.exports=function(e){var t=(e?e.ownerDocument||e:document).defaultView||window;return!(!e||!("function"==typeof t.Node?e instanceof t.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}},function(e,t,n){"use strict";var r=n(80);e.exports=function(e){return r(e)&&3==e.nodeType}},function(e,t,n){"use strict";var r=n(81);e.exports=function e(t,n){return!(!t||!n)&&(t===n||!r(t)&&(r(n)?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function a(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}e.exports=function(e,t){if(a(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var o=0;othis.eventPool.length&&this.eventPool.push(e)}function Ce(e){e.eventPool=[],e.getPooled=ke,e.release=Ee}a(we.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=u.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=u.thatReturnsTrue)},persist:function(){this.isPersistent=u.thatReturnsTrue},isPersistent:u.thatReturnsFalse,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;for(t=0;t=xe),Ae=String.fromCharCode(32),Re={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},Me=!1;function je(e,t){switch(e){case"keyup":return-1!==Te.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function De(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Be=!1;var Fe={eventTypes:Re,extractEvents:function(e,t,n,r){var o=void 0,i=void 0;if(Se)e:{switch(e){case"compositionstart":o=Re.compositionStart;break e;case"compositionend":o=Re.compositionEnd;break e;case"compositionupdate":o=Re.compositionUpdate;break e}o=void 0}else Be?je(e,n)&&(o=Re.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Re.compositionStart);return o?(Ne&&(Be||o!==Re.compositionStart?o===Re.compositionEnd&&Be&&(i=ve()):(ye._root=r,ye._startText=me(),Be=!0)),o=_e.getPooled(o,t,n,r),i?o.data=i:null!==(i=De(n))&&(o.data=i),ee(o),i=o):i=null,(e=Oe?function(e,t){switch(e){case"compositionend":return De(t);case"keypress":return 32!==t.which?null:(Me=!0,Ae);case"textInput":return(e=t.data)===Ae&&Me?null:e;default:return null}}(e,n):function(e,t){if(Be)return"compositionend"===e||!Se&&je(e,t)?(e=ve(),ye._root=null,ye._startText=null,ye._fallbackText=null,Be=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1