jspsych 7.2.1 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +110 -110
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +110 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +110 -110
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/JsPsych.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var jsPsychModule=function(e){"use strict";function t(e){return t="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},t(e)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var r,n,s=[],o=!0,a=!1;try{for(i=i.call(e);!(o=(r=i.next()).done)&&(s.push(r.value),!t||s.length!==t);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==i.return||i.return()}finally{if(a)throw n}}return s}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function s(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=r(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}function o(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var a=function(e){var t=new Set;do{var i,r=s(Reflect.ownKeys(e));try{for(r.s();!(i=r.n()).done;){var n=i.value;t.add([e,n])}}catch(e){r.e(e)}finally{r.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},l=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.include,o=r.exclude,l=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return n?n.some(t):!o||!o.some(t)},c=s(a(e.constructor.prototype));try{for(c.s();!(t=c.n()).done;){var u=i(t.value,2),h=u[0],d=u[1];if("constructor"!==d&&l(d)){var p=Reflect.getOwnPropertyDescriptor(h,d);p&&"function"==typeof p.value&&(e[d]=e[d].bind(e))}}}catch(e){c.e(e)}finally{c.f()}return e};class c extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}}function u(e){return[...new Set(e)]}function h(e){if(!e)return e;let t;if(Array.isArray(e)){t=[];for(const i of e)t.push(h(i));return t}if("object"==typeof e&&null!==e){t={};for(const i in e)e.hasOwnProperty(i)&&(t[i]=h(e[i]));return t}return e}window.jsPsych={get init(){throw new c("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new c},get randomization(){throw new c},get turk(){throw new c},get pluginAPI(){throw new c},get ALL_KEYS(){throw new c('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new c('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var d,p=Object.freeze({__proto__:null,unique:u,deepCopy:h});class m{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){return this.sum()/this.count()}median(){if(0===this.values.length)return;const e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}min(){return Math.min.apply(null,this.values)}max(){return Math.max.apply(null,this.values)}count(){return this.values.length}variance(){const e=this.mean();let t=0;for(const i of this.values)t+=Math.pow(i-e,2);return t/(this.values.length-1)}sd(){const e=this.variance();return Math.sqrt(e)}frequencies(){const e={};for(const t of this.values)void 0===e[t]?e[t]=1:e[t]++;return e}all(e){for(const t of this.values)if(!e(t))return!1;return!0}subset(e){const t=[];for(const i of this.values)e(i)&&t.push(i);return new m(t)}}class f{constructor(e=[]){this.trials=e}push(e){return this.trials.push(e),this}join(e){return this.trials=this.trials.concat(e.values()),this}top(){return this.trials.length<=1?this:new f([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new f:(e>this.trials.length&&(e=this.trials.length),new f(this.trials.slice(0,e)))}last(e=1){if(e<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new f:(e>this.trials.length&&(e=this.trials.length),new f(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new f(h(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;t=Array.isArray(e)?h(e):h([e]);const i=[];for(const e of this.trials){let r=!1;for(const i of t){let t=!0;for(const r of Object.keys(i))void 0!==e[r]&&e[r]===i[r]||(t=!1);if(t){r=!0;break}}r&&i.push(e)}return new f(i)}filterCustom(e){return new f(this.trials.filter(e))}filterColumns(e){return new f(this.trials.map((t=>Object.fromEntries(e.filter((e=>e in t)).map((e=>[e,t[e]]))))))}select(e){const t=[];for(const i of this.trials)void 0!==i[e]&&t.push(i[e]);return new m(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=h(this.trials);for(const i of t)for(const t of e)delete i[t];return new f(t)}uniqueNames(){const e=[];for(const t of this.trials)for(const i of Object.keys(t))e.includes(i)||e.push(i);return e}csv(){return function(e){const t="object"!=typeof e?JSON.parse(e):e;let i="",r="";const n=[];for(const e of t)for(const t in e){let e=t+"";e='"'+e.replace(/"/g,'""')+'",',n.includes(t)||(n.push(t),i+=e)}i=i.slice(0,-1),r+=i+"\r\n";for(const e of t){i="";for(const t of n){let r=void 0===e[t]?"":e[t];"object"==typeof r&&(r=JSON.stringify(r)),i+='"'+(r+"").replace(/"/g,'""')+'",'}i=i.slice(0,-1),r+=i+"\r\n"}return r}(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}localSave(e,t){let i;if("json"===(e=e.toLowerCase()))i=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');i=this.csv()}!function(e,t){const i=new Blob([e],{type:"text/plain"});let r="";r=void 0!==window.webkitURL?window.webkitURL.createObjectURL(i):window.URL.createObjectURL(i);const n=document.createElement("a");n.id="jspsych-download-as-text-link",n.style.display="none",n.download=t,n.href=r,n.click()}(i,t)}}class g{constructor(e){this.jsPsych=e,this.dataProperties={},this.reset()}reset(){this.allData=new f,this.interactionData=new f}get(){return this.allData}getInteractionData(){return this.interactionData}write(e){const t=this.jsPsych.getProgress(),i=this.jsPsych.getCurrentTrial(),r={trial_type:i.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),i.data),r),this.dataProperties))}addProperties(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.allData.addToLast(e)}getDataByTimelineNode(e){return this.allData.filterCustom((t=>t.internal_node_id.slice(0,e.length)===e))}getLastTrialData(){return this.allData.top()}getLastTimelineData(){const e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new f;{const t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}}displayData(e="json"){"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t="json"===e?this.allData.json(!0):this.allData.csv();this.jsPsych.getDisplayElement().innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}urlVariables(){return void 0===this.query_string&&(this.query_string=function(){const e=window.location.search.substr(1).split("&"),t={};for(let i=0;i<e.length;++i){const r=e[i].split("=",2);1==r.length?t[r[0]]="":t[r[0]]=decodeURIComponent(r[1].replace(/\+/g," "))}return t}()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}createInteractionListeners(){window.addEventListener("blur",(()=>{const e={event:"blur",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)})),window.addEventListener("focus",(()=>{const e={event:"focus",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)}));const e=()=>{const e={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:this.jsPsych.getProgress().current_trial_global,time:this.jsPsych.getTotalTime()};this.interactionData.push(e),this.jsPsych.getInitSettings().on_interaction_data_update(e)};document.addEventListener("fullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("webkitfullscreenchange",e)}_customInsert(e){this.allData=new f(e)}_fullreset(){this.reset(),this.dataProperties={}}}class y{constructor(){this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(e=>{this.hardwareConnected=!0}))}hardware(e){const t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}class _{constructor(e,t=!1,i=0){this.getRootElement=e,this.areResponsesCaseSensitive=t,this.minimumValidRt=i,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,l(this),this.registerRootListeners()}registerRootListeners(){if(!this.areRootListenersRegistered){const e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}rootKeydownListener(e){for(const t of Array.from(this.listeners))t(e);this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}toLowerCaseIfInsensitive(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}rootKeyupListener(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}isResponseValid(e,t,i){return!(!t&&this.heldKeys.has(i))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(i))}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:i="performance",persist:r,audio_context:n,audio_context_start_time:s,allow_held_key:o=!1,minimum_valid_rt:a=this.minimumValidRt}){"performance"!==i&&"audio"!==i&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),i="performance");const l="performance"===i?performance.now():1e3*s;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof t||(t=t.map((e=>e.toLowerCase())));const c=s=>{const u=Math.round(("performance"==i?performance.now():1e3*n.currentTime)-l);if(u<a)return;const h=this.toLowerCaseIfInsensitive(s.key);this.isResponseValid(t,o,h)&&(s.preventDefault(),r||this.cancelKeyboardResponse(c),e({key:h,rt:u}))};return this.listeners.add(c),c}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}e.ParameterType=void 0,(d=e.ParameterType||(e.ParameterType={}))[d.BOOL=0]="BOOL",d[d.STRING=1]="STRING",d[d.INT=2]="INT",d[d.FLOAT=3]="FLOAT",d[d.FUNCTION=4]="FUNCTION",d[d.KEY=5]="KEY",d[d.KEYS=6]="KEYS",d[d.SELECT=7]="SELECT",d[d.HTML_STRING=8]="HTML_STRING",d[d.IMAGE=9]="IMAGE",d[d.AUDIO=10]="AUDIO",d[d.VIDEO=11]="VIDEO",d[d.OBJECT=12]="OBJECT",d[d.COMPLEX=13]="COMPLEX",d[d.TIMELINE=14]="TIMELINE";const b={data:{type:e.ParameterType.OBJECT,pretty_name:"Data",default:{}},on_start:{type:e.ParameterType.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:e.ParameterType.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:e.ParameterType.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:e.ParameterType.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:e.ParameterType.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:e.ParameterType.COMPLEX,default:null}},v=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO];class w{constructor(e,t){this.useWebaudio=e,this.webaudioContext=t,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null}getVideoBuffer(e){return this.video_buffers[e]}initAudio(){this.context=this.useWebaudio?this.webaudioContext:null}audioContext(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}getAudioBuffer(e){return new Promise(((t,i)=>{void 0===this.audio_buffers[e]||"tmp"==this.audio_buffers[e]?this.preloadAudio([e],(()=>{t(this.audio_buffers[e])}),(()=>{}),(e=>{i(e.error)})):t(this.audio_buffers[e])}))}preloadAudio(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=u(e.flat());let n=0;if(0==e.length)return void t();const s=(s,o=1)=>{const a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="arraybuffer",a.onload=()=>{this.context.decodeAudioData(a.response,(r=>{this.audio_buffers[s]=r,n++,i(s),n==e.length&&t()}),(e=>{r({source:s,error:e})}))},a.onerror=function(e){let t=e;404==this.status&&(t="404"),r({source:s,error:t})},a.onloadend=function(e){404==this.status&&r({source:s,error:"404"})},a.send(),this.preload_requests.push(a)},o=(s,o=1)=>{const a=new Audio,l=()=>{this.audio_buffers[s]=a,n++,i(s),n==e.length&&t(),a.removeEventListener("canplaythrough",l)};a.addEventListener("canplaythrough",l),a.addEventListener("error",(function e(t){r({source:a.src,error:t}),a.removeEventListener("error",e)})),a.addEventListener("abort",(function e(t){r({source:a.src,error:t}),a.removeEventListener("abort",e)})),a.src=s,this.preload_requests.push(a)};for(const r of e)void 0!==this.audio_buffers[r]?(n++,i(r),n==e.length&&t()):(this.audio_buffers[r]="tmp",null!==this.audioContext()?s(r):o(r))}preloadImages(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=u(e.flat());var n=0;if(0!==e.length)for(var s=0;s<e.length;s++){var o=new Image;o.onload=function(){n++,i(o.src),n===e.length&&t()},o.onerror=function(e){r({source:o.src,error:e})},o.src=e[s],this.img_cache[e[s]]=o,this.preload_requests.push(o)}else t()}preloadVideo(e,t=(()=>{}),i=(e=>{}),r=(e=>{})){e=u(e.flat());let n=0;if(0!==e.length)for(const s of e){const o=this.video_buffers,a=new XMLHttpRequest;a.open("GET",s,!0),a.responseType="blob",a.onload=function(){if(200===this.status||0===this.status){const r=this.response;o[s]=URL.createObjectURL(r),n++,i(s),n===e.length&&t()}},a.onerror=function(e){let t=e;404==this.status&&(t="404"),r({source:s,error:t})},a.onloadend=function(e){404==this.status&&r({source:s,error:"404"})},a.send(),this.preload_requests.push(a)}else t()}getAutoPreloadList(t){const i=Object.fromEntries(v.map((e=>[e,new Set]))),r=(e,t)=>{var n,s,o,a;if(void 0!==e.timeline)for(const i of e.timeline)r(i,null!==(n=e.type)&&void 0!==n?n:t);else if(null===(o=null!==(s=e.type)&&void 0!==s?s:t)||void 0===o?void 0:o.info){const{name:r,parameters:n}=(null!==(a=e.type)&&void 0!==a?a:t).info;this.preloadMap.has(r)||this.preloadMap.set(r,Object.fromEntries(Object.entries(n).filter((([e,{type:t,preload:i}])=>v.includes(t)&&(null==i||i))).map((([e,{type:t}])=>[e,t]))));for(const[t,n]of Object.entries(this.preloadMap.get(r))){const r=e[t],s=i[n];if("string"==typeof r)s.add(r);else if(Array.isArray(r))for(const e of r.flat())"string"==typeof e&&s.add(e)}}};return r({timeline:t}),{images:[...i[e.ParameterType.IMAGE]],audio:[...i[e.ParameterType.AUDIO]],video:[...i[e.ParameterType.VIDEO]]}}cancelPreloads(){for(const e of this.preload_requests)e.onload=()=>{},e.onerror=()=>{},e.oncanplaythrough=()=>{},e.onabort=()=>{};this.preload_requests=[]}initializeMicrophoneRecorder(e){const t=new MediaRecorder(e);this.microphone_recorder=t}getMicrophoneRecorder(){return this.microphone_recorder}}class T{dispatchEvent(e){document.body.dispatchEvent(e)}keyDown(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}keyUp(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}pressKey(e,t=0){t>0?setTimeout((()=>{this.keyDown(e),this.keyUp(e)}),t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?setTimeout((()=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}fillTextInput(e,t,i=0){i>0?setTimeout((()=>{e.value=t}),i):e.value=t}getValidKey(e){const t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];let i;if("NO_KEYS"==e)i=null;else if("ALL_KEYS"==e)i=t[Math.floor(Math.random()*t.length)];else{const t=e.flat();i=t[Math.floor(Math.random()*t.length)]}return i}mergeSimulationData(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}ensureSimulationDataConsistency(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){const i=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<i&&(t.rt=null,t.response=null)}}}class k{constructor(){this.timeout_handlers=[]}setTimeout(e,t){const i=window.setTimeout(e,t);return this.timeout_handlers.push(i),i}clearAllTimeouts(){for(const e of this.timeout_handlers)clearTimeout(e);this.timeout_handlers=[]}}var x=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function j(e){function t(){return e&&e.maxLength>1?function(){var t,r=!1;for(;!r;)(t=i()).length<=e.maxLength&&(r=!0);return t}():i()}function i(){return x[r(x.length)]}function r(e){return Math.floor(Math.random()*e)}if(void 0===e)return t();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=function(e){return e}),"string"!=typeof e.separator&&(e.separator=" ");for(var n=e.min+r(e.max+1-e.min),s=[],o="",a=0,l=0;l<n*e.wordsPerString;l++)a===e.wordsPerString-1?o+=e.formatter(t(),a):o+=e.formatter(t(),a)+e.separator,a++,(l+1)%e.wordsPerString==0&&(s.push(o),o="",a=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var P=j;j.wordList=x;var E={exports:{}};(function(e,i,r){function n(e){var t,i=this,r=(t=4022871197,function(e){e=String(e);for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});i.next=function(){var e=2091639*i.s0+2.3283064365386963e-10*i.c;return i.s0=i.s1,i.s1=i.s2,i.s2=e-(i.c=0|e)},i.c=1,i.s0=r(" "),i.s1=r(" "),i.s2=r(" "),i.s0-=r(e),i.s0<0&&(i.s0+=1),i.s1-=r(e),i.s1<0&&(i.s1+=1),i.s2-=r(e),i.s2<0&&(i.s2+=1),r=null}function s(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,i){var r=new n(e),o=i&&i.state,a=r.next;return a.int32=function(){return 4294967296*r.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,o&&("object"==t(o)&&s(o,r),a.state=function(){return s(r,{})}),a}i&&i.exports?i.exports=o:r&&r.amd?r((function(){return o})):this.alea=o})(0,E,!1);var O=E.exports;function A(e,t,i=!1){const r=Array.isArray(e),n=Array.isArray(t);if(r)if(n){if(e.length!=t.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),t.length<e.length){let i=[];for(let r=0;r<e.length;r++)i.push(t);t=i}else t=t.slice(0,e.length)}else{let i=[];for(let r=0;r<e.length;r++)i.push(t);t=i}else n?(t=[t[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],t=[t]);let s=[];for(let i=0;i<e.length;i++)for(let r=0;r<t[i];r++)null==e[i]||"object"!=typeof e[i]?s.push(e[i]):s.push(Object.assign({},e[i]));let o=I(s);return i&&(o=function(e){const t={};for(const i of e)for(const e of Object.keys(i))void 0===t[e]&&(t[e]=[]),t[e].push(i[e]);return t}(o)),o}function I(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");const t=e.slice(0);let i,r,n=t.length;for(;n;)r=Math.floor(Math.random()*n--),i=t[n],t[n]=t[r],t[r]=i;return t}function L(e,t=!1){const i=e.length;if(1==i)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),I(e[0]);let r=[];for(let e=0;e<i;e++)r.push(e);t&&(r=I(r));const n=[];let s=null;for(let t=0;t<i;t++)s=null===s?e[t].length:Math.min(s,e[t].length),n.push(I(e[t]));const o=[];for(let e=0;e<s;e++)for(let t=0;t<r.length;t++)o.push(n[r[t]][e]);return o}function M(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),I(e).slice(0,t)}function S(e,t,i){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");const r=[];if(void 0!==i){i.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let t=0;for(const e of i)t+=e;for(const e of i)r.push(e/t)}else for(let t=0;t<e.length;t++)r.push(1/e.length);const n=[r[0]];for(let e=1;e<r.length;e++)n.push(r[e]+n[e-1]);const s=[];for(let i=0;i<t;i++){const t=Math.random();let i=0;for(;t>n[i];)i++;s.push(e[i])}return s}function D(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function C(e){return-Math.log(Math.random())/e}var N=Object.freeze({__proto__:null,setSeed:function(e=Math.random().toString()){return Math.random=O(e),e},repeat:A,shuffle:I,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});const i=I(e);for(let e=0;e<i.length-1;e++)if(t(i[e],i[e+1])){let r=Math.floor(Math.random()*(i.length-2))+1;for(;t(i[e+1],i[r])||t(i[e+1],i[r+1])||t(i[e+1],i[r-1]);)r=Math.floor(Math.random()*(i.length-2))+1;const n=i[r];i[r]=i[e+1],i[e+1]=n}return i},shuffleAlternateGroups:L,sampleWithoutReplacement:M,sampleWithReplacement:S,factorial:function(e,t=1,i=!1){let r=[{}];for(const[t,i]of Object.entries(e)){const e=[];for(const n of i)for(const i of r)e.push(Object.assign(Object.assign({},i),{[t]:n}));r=e}return A(r,t,i)},randomID:function(e=32){let t="";const i="0123456789abcdefghjklmnopqrstuvwxyz";for(let r=0;r<e;r++)t+=i[Math.floor(Math.random()*i.length)];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleNormal:D,sampleExponential:C,sampleExGaussian:function(e,t,i,r=!1){let n=D(e,t)+C(i);if(r)for(;n<=0;)n=D(e,t)+C(i);return n},randomWords:function(e){return P(e)}});function R(){const e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const i=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==i?"":i[1]},i=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(r){e[r]=unescape(t(i,r))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var V=Object.freeze({__proto__:null,turkInfo:R,submitToTurk:function(e){const t=R(),i=t.assignmentId,r=t.turkSubmitTo;if(!i||!r)return;const n=document.createElement("form");n.method="POST",n.action=r+"/mturk/externalSubmit?assignmentId="+i;for(const t in e)if(e.hasOwnProperty(t)){const i=document.createElement("input");i.type="hidden",i.name=t,i.id=t,i.value=e[t],n.appendChild(i)}document.body.appendChild(n),n.submit()}});class q{constructor(e,t,i,r){if(this.jsPsych=e,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=i,this.relative_id=void 0===i?0:r,void 0!==t.timeline){this.timeline_parameters={timeline:[],loop_function:t.loop_function,conditional_function:t.conditional_function,sample:t.sample,randomize_order:void 0!==t.randomize_order&&t.randomize_order,repetitions:void 0===t.repetitions?1:t.repetitions,timeline_variables:void 0===t.timeline_variables?[{}]:t.timeline_variables,on_timeline_finish:t.on_timeline_finish,on_timeline_start:t.on_timeline_start},this.setTimelineVariablesOrder();var n=Object.assign({},t);delete n.timeline,delete n.conditional_function,delete n.loop_function,delete n.randomize_order,delete n.repetitions,delete n.timeline_variables,delete n.sample,delete n.on_timeline_start,delete n.on_timeline_finish,this.node_trial_data=n;for(var s=0;s<t.timeline.length;s++){var o=Object.assign({},n,t.timeline[s]);if("object"==typeof n.data&&"object"==typeof t.timeline[s].data){var a=Object.assign({},n.data,t.timeline[s].data);o.data=a}this.timeline_parameters.timeline.push(new q(this.jsPsych,o,this,s))}}else void 0===t.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(t)),this.trial_parameters=Object.assign({},t)}trial(){return void 0===this.timeline_parameters?h(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}markCurrentTrialComplete(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}nextRepetiton(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}setTimelineVariablesOrder(){const e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],i=0;i<e.timeline_variables.length;i++)t.push(i);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=S(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=M(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=A(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=L(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=I(t)),this.progress.order=t}}nextSet(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}advance(){const e=this.progress,t=this.timeline_parameters,i=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){i.call_immediate=!0;var r=t.conditional_function();if(i.call_immediate=!1,0==r)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var n=!1;e.current_location<t.timeline.length&&0==n;){if(!t.timeline[e.current_location].advance())return n=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(i.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),i.call_immediate=!1,this.parent_node.advance()):(e.done=!0,i.call_immediate=!1,!0)):(e.done=!0,!0))}}isComplete(){return this.progress.done}getTimelineVariableValue(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}findTimelineVariable(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}timelineVariable(e){if(void 0===this.timeline_parameters)return this.findTimelineVariable(e);var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].timelineVariable(e)}allTimelineVariables(){for(var e=this.allTimelineVariablesNames(),t={},i=0;i<e.length;i++)t[e[i]]=this.timelineVariable(e[i]);return t}allTimelineVariablesNames(e=[]){if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}length(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}percentComplete(){for(var e=this.length(),t=0,i=0;i<this.timeline_parameters.timeline.length;i++)this.timeline_parameters.timeline[i].isComplete()&&(t+=this.timeline_parameters.timeline[i].length());return t/e*100}reset(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}end(){this.progress.done=!0}endActiveNode(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}ID(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}activeID(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}generatedData(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}trialsOfType(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],i=0;i<this.timeline_parameters.timeline.length;i++){var r=this.timeline_parameters.timeline[i].trialsOfType(e);t=t.concat(r)}return t}insert(e){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new q(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),e),this,this.timeline_parameters.timeline.length))}}function z(e){return new Promise((t=>setTimeout(t,e)))}class K{constructor(e){this.extensions={},this.turk=V,this.randomization=N,this.utils=p,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,l(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new g(this),this.pluginAPI=function(e){const t=e.getInitSettings();return Object.assign({},...[new _(e.getDisplayContainerElement,t.case_sensitive_responses,t.minimum_valid_rt),new k,new w(t.use_webaudio,e.webaudio_context),new y,new T].map((e=>l(e))))}(this);for(const t of e.extensions)this.extensions[t.type.info.name]=new t.type(this);this.pluginAPI.initAudio()}version(){return"7.2.1"}run(e){return o(this,void 0,void 0,(function*(){void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new q(this,{timeline:e}),yield this.prepareDom(),yield this.checkExclusions(this.opts.exclusions),yield this.loadExtensions(this.opts.extensions),document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),yield this.finished}))}simulate(e,t="data-only",i={}){return o(this,void 0,void 0,(function*(){this.simulation_mode=t,this.simulation_options=i,yield this.run(e)}))}getProgress(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}getStartTime(){return this.exp_start_time}getTotalTime(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}getDisplayElement(){return this.DOM_target}getDisplayContainerElement(){return this.DOM_container}finishTrial(e={}){if(this.current_trial_finished)return;this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes)&&this.DOM_target.classList.remove(...this.current_trial.css_classes),this.data.write(e);const t=this.data.get().filter({trial_index:this.global_trial_index}).values()[0],i=this.current_trial;if("object"==typeof i.save_trial_parameters)for(const e of Object.keys(i.save_trial_parameters)){const r=i.save_trial_parameters[e];!0===r&&(void 0===i[e]?console.warn(`Invalid parameter specified in save_trial_parameters. Trial has no property called "${e}".`):"function"==typeof i[e]?t[e]=i[e].toString():t[e]=i[e]),!1===r&&"internal_node_id"!==e&&"trial_index"!==e&&delete t[e]}if(Array.isArray(i.extensions))for(const e of i.extensions){const i=this.extensions[e.type.info.name].on_finish(e.params);Object.assign(t,i)}this.internal.call_immediate=!0,"function"==typeof i.on_finish&&i.on_finish(t),this.opts.on_trial_finish(t),this.opts.on_data_update(t),this.internal.call_immediate=!1,"data-only"===this.simulation_mode?this.nextTrial():null===typeof i.post_trial_gap||void 0===i.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():i.post_trial_gap>0?setTimeout(this.nextTrial,i.post_trial_gap):this.nextTrial()}endExperiment(e="",t={}){this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}endCurrentTimeline(){this.timeline.endActiveNode()}getCurrentTrial(){return this.current_trial}getInitSettings(){return this.opts}getCurrentTimelineNodeID(){return this.timeline.activeID()}timelineVariable(e,t=!1){return this.internal.call_immediate||!0===t?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:()=>this.timeline.timelineVariable(e)}}getAllTimelineVariables(){return this.timeline.allTimelineVariables()}addNodeToEndOfTimeline(e,t){this.timeline.insert(e)}pauseExperiment(){this.paused=!0}resumeExperiment(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}loadFail(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}getSafeModeStatus(){return this.file_protocol}getTimeline(){return this.timelineDescription}prepareDom(){return o(this,void 0,void 0,(function*(){"complete"!==document.readyState&&(yield new Promise((e=>{window.addEventListener("load",e)})));const e=this.opts;if(void 0===e.display_element){null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",e.display_element=document.querySelector("body")}else{const t=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);null===t?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=t}e.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=e.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==e.experiment_width&&(this.DOM_target.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,-1===e.display_element.className.indexOf("jspsych-display-element")&&(e.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close)}))}loadExtensions(e){return o(this,void 0,void 0,(function*(){try{yield Promise.all(e.map((e=>this.extensions[e.type.info.name].initialize(e.params||{}))))}catch(e){throw console.error(e),new Error(e)}}))}startExperiment(){this.finished=new Promise((e=>{this.resolveFinishedPromise=e})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}finishExperiment(){const e=this.opts.on_finish(this.data.get()),t=()=>{void 0!==this.timeline.end_message&&(this.DOM_target.innerHTML=this.timeline.end_message),this.resolveFinishedPromise()};e?Promise.resolve(e).then(t):t()}nextTrial(){if(this.paused)return void(this.waiting=!0);this.global_trial_index++,this.timeline.markCurrentTrialComplete();const e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}doTrial(e){if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new c("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},l(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_start(t.params);this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&this.DOM_target.classList.add(...e.css_classes));const t=()=>{if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions))for(const t of e.extensions)this.extensions[t.type.info.name].on_load(t.params)};let i;if(this.simulation_mode||(i=e.type.trial(this.DOM_target,e,t)),this.simulation_mode)if(e.type.simulate){let r;e.simulation_options||(r=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?r=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log(`No matching simulation options found for "${e.simulation_options}". Using "default" options.`),r=this.simulation_options.default):(console.log(`No matching simulation options found for "${e.simulation_options}" and no "default" options provided. Using the default values provided by the plugin.`),r={}):r=e.simulation_options),r=this.utils.deepCopy(r),r=this.replaceFunctionsWithValues(r,null),i=!1===(null==r?void 0:r.simulate)?e.type.trial(this.DOM_target,e,t):e.type.simulate(e,(null==r?void 0:r.mode)||this.simulation_mode,r,t)}else i=e.type.trial(this.DOM_target,e,t);i&&"function"==typeof i.then||this.simulation_mode||t(),this.internal.call_immediate=!1}evaluateTimelineVariables(e){for(const t of Object.keys(e))"object"==typeof e[t]&&null!==e[t]&&void 0!==e[t].timelineVariablePlaceholder&&(e[t]=e[t].timelineVariableFunction()),"object"==typeof e[t]&&null!==e[t]&&this.evaluateTimelineVariables(e[t])}evaluateFunctionParameters(t){this.internal.call_immediate=!0;for(const i of Object.keys(t))"type"!==i&&(void 0!==b[i]&&b[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],null)),void 0!==t.type.info.parameters[i]&&t.type.info.parameters[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],t.type.info.parameters[i])));this.internal.call_immediate=!1}replaceFunctionsWithValues(t,i){if(null===t)return t;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=this.replaceFunctionsWithValues(t[e],i);else if("object"==typeof t)if(null!==i&&i.nested)for(const r of Object.keys(t))"object"==typeof i.nested[r]&&i.nested[r].type!==e.ParameterType.FUNCTION&&(t[r]=this.replaceFunctionsWithValues(t[r],i.nested[r]));else for(const e of Object.keys(t))"type"!==e&&(t[e]=this.replaceFunctionsWithValues(t[e],null));else if("function"==typeof t)return t();return t}setDefaultValues(t){for(const i in t.type.info.parameters)t.type.info.parameters[i].type===e.ParameterType.COMPLEX?!0===t.type.info.parameters[i].array&&t[i].forEach((function(e,r){for(const e in t.type.info.parameters[i].nested)void 0!==t[i][r][e]&&null!==t[i][r][e]||(void 0===t.type.info.parameters[i].nested[e].default?console.error("You must specify a value for the "+e+" parameter (nested in the "+i+" parameter) in the "+t.type+" plugin."):t[i][r][e]=t.type.info.parameters[i].nested[e].default)})):void 0!==t[i]&&null!==t[i]||(void 0===t.type.info.parameters[i].default?console.error("You must specify a value for the "+i+" parameter in the "+t.type.info.name+" plugin."):t[i]=t.type.info.parameters[i].default)}checkExclusions(e){return o(this,void 0,void 0,(function*(){if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),e.min_width||e.min_height){const t=e.min_width||0,i=e.min_height||0;if(window.innerWidth<t||window.innerHeight<i){for(this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+t+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+i+"px. Your current height is "+window.innerHeight+"px.</p>";window.innerWidth<t||window.innerHeight<i;)yield z(100);this.getDisplayElement().innerHTML=""}}if(void 0!==e.audio&&e.audio&&!window.hasOwnProperty("AudioContext")&&!window.hasOwnProperty("webkitAudioContext"))throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error}))}drawProgressBar(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}updateProgressBar(){this.setProgressBar(this.getProgress().percent_complete/100)}setProgressBar(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}getProgressBarCompleted(){return this.progress_bar_amount}}return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=K,e.initJsPsych=function(e){const t=new K(e);return Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((([e,t])=>[e,{get(){throw new c(t)}}])))),t},e.universalPluginParameters=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),initJsPsych=jsPsychModule.initJsPsych;
|
|
1
|
+
var jsPsychModule=function(e){"use strict";function t(e){return t="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},t(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=l()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&s(i,n.prototype),i},u.apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},c(e)}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function v(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var g=function(e){var t=new Set;do{var n,r=y(Reflect.ownKeys(e));try{for(r.s();!(n=r.n()).done;){var i=n.value;t.add([e,i])}}catch(e){r.e(e)}finally{r.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t},b=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.include,i=n.exclude,a=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return r?r.some(t):!i||!i.some(t)},o=y(g(e.constructor.prototype));try{for(o.s();!(t=o.n()).done;){var s=d(t.value,2),l=s[0],u=s[1];if("constructor"!==u&&a(u)){var c=Reflect.getOwnPropertyDescriptor(l,u);c&&"function"==typeof c.value&&(e[u]=e[u].bind(e))}}}catch(e){o.e(e)}finally{o.f()}return e},w=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(u,e);var t,r,a=(t=u,r=l(),function(){var e,n=o(t);if(r){var i=o(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return h(this,e)});function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The global `jsPsych` variable is no longer available in jsPsych v7.";return n(this,u),(e=a.call(this,"".concat(t," Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment."))).name="MigrationError",e}return i(u)}(c(Error));function _(e){return p(new Set(e))}function k(e){if(!e)return e;var n;if(Array.isArray(e)){n=[];var r,i=y(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;n.push(k(a))}}catch(e){i.e(e)}finally{i.f()}return n}if("object"===t(e)&&null!==e){for(var o in n={},e)e.hasOwnProperty(o)&&(n[o]=k(e[o]));return n}return e}window.jsPsych={get init(){throw new w("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new w},get randomization(){throw new w},get turk(){throw new w},get pluginAPI(){throw new w},get ALL_KEYS(){throw new w('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new w('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var x=Object.freeze({__proto__:null,unique:_,deepCopy:k}),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.values=t}return i(e,[{key:"sum",value:function(){var e,t=0,n=y(this.values);try{for(n.s();!(e=n.n()).done;){t+=e.value}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"mean",value:function(){return this.sum()/this.count()}},{key:"median",value:function(){if(0!==this.values.length){var e=this.values.slice(0).sort((function(e,t){return e-t})),t=Math.floor(e.length/2);return e.length%2==0?(e[t]+e[t-1])/2:e[t]}}},{key:"min",value:function(){return Math.min.apply(null,this.values)}},{key:"max",value:function(){return Math.max.apply(null,this.values)}},{key:"count",value:function(){return this.values.length}},{key:"variance",value:function(){var e,t=this.mean(),n=0,r=y(this.values);try{for(r.s();!(e=r.n()).done;){var i=e.value;n+=Math.pow(i-t,2)}}catch(e){r.e(e)}finally{r.f()}return n/(this.values.length-1)}},{key:"sd",value:function(){var e=this.variance();return Math.sqrt(e)}},{key:"frequencies",value:function(){var e,t={},n=y(this.values);try{for(n.s();!(e=n.n()).done;){var r=e.value;void 0===t[r]?t[r]=1:t[r]++}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"all",value:function(e){var t,n=y(this.values);try{for(n.s();!(t=n.n()).done;){if(!e(t.value))return!1}}catch(e){n.e(e)}finally{n.f()}return!0}},{key:"subset",value:function(t){var n,r=[],i=y(this.values);try{for(i.s();!(n=i.n()).done;){var a=n.value;t(a)&&r.push(a)}}catch(e){i.e(e)}finally{i.f()}return new e(r)}}]),e}();var j,P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.trials=t}return i(e,[{key:"push",value:function(e){return this.trials.push(e),this}},{key:"join",value:function(e){return this.trials=this.trials.concat(e.values()),this}},{key:"top",value:function(){return this.trials.length<=1?this:new e([this.trials[this.trials.length-1]])}},{key:"first",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(0,t)))}},{key:"last",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t<1)throw"You must query with a positive nonzero integer. Please use a\n different value for n.";return 0===this.trials.length?new e:(t>this.trials.length&&(t=this.trials.length),new e(this.trials.slice(this.trials.length-t,this.trials.length)))}},{key:"values",value:function(){return this.trials}},{key:"count",value:function(){return this.trials.length}},{key:"readOnly",value:function(){return new e(k(this.trials))}},{key:"addToAll",value:function(e){var t,n=y(this.trials);try{for(n.s();!(t=n.n()).done;){var r=t.value;Object.assign(r,e)}}catch(e){n.e(e)}finally{n.f()}return this}},{key:"addToLast",value:function(e){return 0!=this.trials.length&&Object.assign(this.trials[this.trials.length-1],e),this}},{key:"filter",value:function(t){var n;n=Array.isArray(t)?k(t):k([t]);var r,i=[],a=y(this.trials);try{for(a.s();!(r=a.n()).done;){var o,s=r.value,l=!1,u=y(n);try{for(u.s();!(o=u.n()).done;){for(var c=o.value,h=!0,d=0,p=Object.keys(c);d<p.length;d++){var f=p[d];void 0!==s[f]&&s[f]===c[f]||(h=!1)}if(h){l=!0;break}}}catch(e){u.e(e)}finally{u.f()}l&&i.push(s)}}catch(e){a.e(e)}finally{a.f()}return new e(i)}},{key:"filterCustom",value:function(t){return new e(this.trials.filter(t))}},{key:"filterColumns",value:function(t){return new e(this.trials.map((function(e){return Object.fromEntries(t.filter((function(t){return t in e})).map((function(t){return[t,e[t]]})))})))}},{key:"select",value:function(e){var t,n=[],r=y(this.trials);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i[e]&&n.push(i[e])}}catch(e){r.e(e)}finally{r.f()}return new T(n)}},{key:"ignore",value:function(t){Array.isArray(t)||(t=[t]);var n,r=k(this.trials),i=y(r);try{for(i.s();!(n=i.n()).done;){var a,o=n.value,s=y(t);try{for(s.s();!(a=s.n()).done;){delete o[a.value]}}catch(e){s.e(e)}finally{s.f()}}}catch(e){i.e(e)}finally{i.f()}return new e(r)}},{key:"uniqueNames",value:function(){var e,t=[],n=y(this.trials);try{for(n.s();!(e=n.n()).done;)for(var r=e.value,i=0,a=Object.keys(r);i<a.length;i++){var o=a[i];t.includes(o)||t.push(o)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"csv",value:function(){return function(e){var n,r="object"!=t(e)?JSON.parse(e):e,i="",a="",o=[],s=y(r);try{for(s.s();!(n=s.n()).done;){var l=n.value;for(var u in l){var c=u+"";c='"'+c.replace(/"/g,'""')+'",',o.includes(u)||(o.push(u),i+=c)}}}catch(e){s.e(e)}finally{s.f()}a+=(i=i.slice(0,-1))+"\r\n";var h,d=y(r);try{for(d.s();!(h=d.n()).done;){var p=h.value;i="";var f,m=y(o);try{for(m.s();!(f=m.n()).done;){var v=f.value,g=void 0===p[v]?"":p[v];"object"==t(g)&&(g=JSON.stringify(g)),i+='"'+(g+"").replace(/"/g,'""')+'",'}}catch(e){m.e(e)}finally{m.f()}a+=(i=i.slice(0,-1))+"\r\n"}}catch(e){d.e(e)}finally{d.f()}return a}(this.trials)}},{key:"json",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}},{key:"localSave",value:function(e,t){var n;if("json"===(e=e.toLowerCase()))n=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');n=this.csv()}!function(e,t){var n=new Blob([e],{type:"text/plain"}),r="";r=void 0!==window.webkitURL?window.webkitURL.createObjectURL(n):window.URL.createObjectURL(n);var i=document.createElement("a");i.id="jspsych-download-as-text-link",i.style.display="none",i.download=t,i.href=r,i.click()}(n,t)}}]),e}(),O=function(){function e(t){n(this,e),this.jsPsych=t,this.dataProperties={},this.reset()}return i(e,[{key:"reset",value:function(){this.allData=new P,this.interactionData=new P}},{key:"get",value:function(){return this.allData}},{key:"getInteractionData",value:function(){return this.interactionData}},{key:"write",value:function(e){var t=this.jsPsych.getProgress(),n=this.jsPsych.getCurrentTrial(),r={trial_type:n.type.info.name,trial_index:t.current_trial_global,time_elapsed:this.jsPsych.getTotalTime(),internal_node_id:this.jsPsych.getCurrentTimelineNodeID()};this.allData.push(Object.assign(Object.assign(Object.assign(Object.assign({},e),n.data),r),this.dataProperties))}},{key:"addProperties",value:function(e){this.allData.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}},{key:"addDataToLastTrial",value:function(e){this.allData.addToLast(e)}},{key:"getDataByTimelineNode",value:function(e){return this.allData.filterCustom((function(t){return t.internal_node_id.slice(0,e.length)===e}))}},{key:"getLastTrialData",value:function(){return this.allData.top()}},{key:"getLastTimelineData",value:function(){var e=this.getLastTrialData().select("internal_node_id").values[0];if(void 0===e)return new P;var t=e.substr(0,e.lastIndexOf("-"));return this.getDataByTimelineNode(t)}},{key:"displayData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"json";"json"!=(e=e.toLowerCase())&&"csv"!=e&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");var t="json"===e?this.allData.json(!0):this.allData.csv(),n=this.jsPsych.getDisplayElement();n.innerHTML='<pre id="jspsych-data-display"></pre>',document.getElementById("jspsych-data-display").textContent=t}},{key:"urlVariables",value:function(){return void 0===this.query_string&&(this.query_string=function(){for(var e=window.location.search.substr(1).split("&"),t={},n=0;n<e.length;++n){var r=e[n].split("=",2);1==r.length?t[r[0]]="":t[r[0]]=decodeURIComponent(r[1].replace(/\+/g," "))}return t}()),this.query_string}},{key:"getURLVariable",value:function(e){return this.urlVariables()[e]}},{key:"createInteractionListeners",value:function(){var e=this;window.addEventListener("blur",(function(){var t={event:"blur",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)})),window.addEventListener("focus",(function(){var t={event:"focus",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)}));var t=function(){var t={event:document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit",trial:e.jsPsych.getProgress().current_trial_global,time:e.jsPsych.getTotalTime()};e.interactionData.push(t),e.jsPsych.getInitSettings().on_interaction_data_update(t)};document.addEventListener("fullscreenchange",t),document.addEventListener("mozfullscreenchange",t),document.addEventListener("webkitfullscreenchange",t)}},{key:"_customInsert",value:function(e){this.allData=new P(e)}},{key:"_fullreset",value:function(){this.reset(),this.dataProperties={}}}]),e}(),E=function(){function e(){var t=this;n(this,e),this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(function(e){t.hardwareConnected=!0}))}return i(e,[{key:"hardware",value:function(e){var t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}]),e}(),A=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n(this,e),this.getRootElement=t,this.areResponsesCaseSensitive=r,this.minimumValidRt=i,this.listeners=new Set,this.heldKeys=new Set,this.areRootListenersRegistered=!1,b(this),this.registerRootListeners()}return i(e,[{key:"registerRootListeners",value:function(){if(!this.areRootListenersRegistered){var e=this.getRootElement();e&&(e.addEventListener("keydown",this.rootKeydownListener),e.addEventListener("keyup",this.rootKeyupListener),this.areRootListenersRegistered=!0)}}},{key:"rootKeydownListener",value:function(e){for(var t=0,n=Array.from(this.listeners);t<n.length;t++){(0,n[t])(e)}this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key))}},{key:"toLowerCaseIfInsensitive",value:function(e){return this.areResponsesCaseSensitive?e:e.toLowerCase()}},{key:"rootKeyupListener",value:function(e){this.heldKeys.delete(this.toLowerCaseIfInsensitive(e.key))}},{key:"isResponseValid",value:function(e,t,n){return!(!t&&this.heldKeys.has(n))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(n))}},{key:"getKeyboardResponse",value:function(e){var t=this,n=e.callback_function,r=e.valid_responses,i=void 0===r?"ALL_KEYS":r,a=e.rt_method,o=void 0===a?"performance":a,s=e.persist,l=e.audio_context,u=e.audio_context_start_time,c=e.allow_held_key,h=void 0!==c&&c,d=e.minimum_valid_rt,p=void 0===d?this.minimumValidRt:d;"performance"!==o&&"audio"!==o&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),o="performance");var f="performance"===o?performance.now():1e3*u;this.registerRootListeners(),this.areResponsesCaseSensitive||"string"==typeof i||(i=i.map((function(e){return e.toLowerCase()})));var m=function e(r){var a=Math.round(("performance"==o?performance.now():1e3*l.currentTime)-f);if(!(a<p)){var u=t.toLowerCaseIfInsensitive(r.key);t.isResponseValid(i,h,u)&&(r.preventDefault(),s||t.cancelKeyboardResponse(e),n({key:u,rt:a}))}};return this.listeners.add(m),m}},{key:"cancelKeyboardResponse",value:function(e){this.listeners.delete(e)}},{key:"cancelAllKeyboardResponses",value:function(){this.listeners.clear()}},{key:"compareKeys",value:function(e,t){if(!("string"!=typeof e&&null!==e||"string"!=typeof t&&null!==t))return"string"==typeof e&&"string"==typeof t?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():null===e&&null===t;console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.")}}]),e}();e.ParameterType=void 0,(j=e.ParameterType||(e.ParameterType={}))[j.BOOL=0]="BOOL",j[j.STRING=1]="STRING",j[j.INT=2]="INT",j[j.FLOAT=3]="FLOAT",j[j.FUNCTION=4]="FUNCTION",j[j.KEY=5]="KEY",j[j.KEYS=6]="KEYS",j[j.SELECT=7]="SELECT",j[j.HTML_STRING=8]="HTML_STRING",j[j.IMAGE=9]="IMAGE",j[j.AUDIO=10]="AUDIO",j[j.VIDEO=11]="VIDEO",j[j.OBJECT=12]="OBJECT",j[j.COMPLEX=13]="COMPLEX",j[j.TIMELINE=14]="TIMELINE";var I={data:{type:e.ParameterType.OBJECT,pretty_name:"Data",default:{}},on_start:{type:e.ParameterType.FUNCTION,pretty_name:"On start",default:function(){}},on_finish:{type:e.ParameterType.FUNCTION,pretty_name:"On finish",default:function(){}},on_load:{type:e.ParameterType.FUNCTION,pretty_name:"On load",default:function(){}},post_trial_gap:{type:e.ParameterType.INT,pretty_name:"Post trial gap",default:null},css_classes:{type:e.ParameterType.STRING,pretty_name:"Custom CSS classes",default:null},simulation_options:{type:e.ParameterType.COMPLEX,default:null}},S=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO],L=function(){function t(e,r){n(this,t),this.useWebaudio=e,this.webaudioContext=r,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null}return i(t,[{key:"getVideoBuffer",value:function(e){return this.video_buffers[e]}},{key:"initAudio",value:function(){this.context=this.useWebaudio?this.webaudioContext:null}},{key:"audioContext",value:function(){return null!==this.context&&"running"!==this.context.state&&this.context.resume(),this.context}},{key:"getAudioBuffer",value:function(e){var t=this;return new Promise((function(n,r){void 0===t.audio_buffers[e]||"tmp"==t.audio_buffers[e]?t.preloadAudio([e],(function(){n(t.audio_buffers[e])}),(function(){}),(function(e){r(e.error)})):n(t.audio_buffers[e])}))}},{key:"preloadAudio",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!=e.length){var o,s=function(o){var s=new XMLHttpRequest;s.open("GET",o,!0),s.responseType="arraybuffer",s.onload=function(){t.context.decodeAudioData(s.response,(function(i){t.audio_buffers[o]=i,a++,r(o),a==e.length&&n()}),(function(e){i({source:o,error:e})}))},s.onerror=function(e){var t=e;404==this.status&&(t="404"),i({source:o,error:t})},s.onloadend=function(e){404==this.status&&i({source:o,error:"404"})},s.send(),t.preload_requests.push(s)},l=function(o){var s=new Audio;s.addEventListener("canplaythrough",(function i(){t.audio_buffers[o]=s,a++,r(o),a==e.length&&n(),s.removeEventListener("canplaythrough",i)})),s.addEventListener("error",(function e(t){i({source:s.src,error:t}),s.removeEventListener("error",e)})),s.addEventListener("abort",(function e(t){i({source:s.src,error:t}),s.removeEventListener("abort",e)})),s.src=o,t.preload_requests.push(s)},u=y(e);try{for(u.s();!(o=u.n()).done;){var c=o.value;void 0!==this.audio_buffers[c]?(a++,r(c),a==e.length&&n()):(this.audio_buffers[c]="tmp",null!==this.audioContext()?s(c):l(c))}}catch(e){u.e(e)}finally{u.f()}}else n()}},{key:"preloadImages",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var i=0;if(0!==e.length)for(var a=0;a<e.length;a++){var o=new Image;o.onload=function(){i++,n(o.src),i===e.length&&t()},o.onerror=function(e){r({source:o.src,error:e})},o.src=e[a],this.img_cache[e[a]]=o,this.preload_requests.push(o)}else t()}},{key:"preloadVideo",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=_(e.flat());var a=0;if(0!==e.length){var o,s=y(e);try{var l=function(){var s=o.value,l=t.video_buffers,u=new XMLHttpRequest;u.open("GET",s,!0),u.responseType="blob",u.onload=function(){if(200===this.status||0===this.status){var t=this.response;l[s]=URL.createObjectURL(t),a++,r(s),a===e.length&&n()}},u.onerror=function(e){var t=e;404==this.status&&(t="404"),i({source:s,error:t})},u.onloadend=function(e){404==this.status&&i({source:s,error:"404"})},u.send(),t.preload_requests.push(u)};for(s.s();!(o=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}}else n()}},{key:"getAutoPreloadList",value:function(t){var n=this,r=Object.fromEntries(S.map((function(e){return[e,new Set]})));return function e(t,i){var a,o,s,l;if(void 0!==t.timeline){var u,c=y(t.timeline);try{for(c.s();!(u=c.n()).done;){e(u.value,null!==(a=t.type)&&void 0!==a?a:i)}}catch(e){c.e(e)}finally{c.f()}}else if(null===(s=null!==(o=t.type)&&void 0!==o?o:i)||void 0===s?void 0:s.info){var h=(null!==(l=t.type)&&void 0!==l?l:i).info,p=h.name,f=h.parameters;n.preloadMap.has(p)||n.preloadMap.set(p,Object.fromEntries(Object.entries(f).filter((function(e){var t=d(e,2);t[0];var n=t[1],r=n.type,i=n.preload;return S.includes(r)&&(null==i||i)})).map((function(e){var t=d(e,2);return[t[0],t[1].type]}))));for(var m=0,v=Object.entries(n.preloadMap.get(p));m<v.length;m++){var g=d(v[m],2),b=g[0],w=g[1],_=t[b],k=r[w];if("string"==typeof _)k.add(_);else if(Array.isArray(_)){var x,T=y(_.flat());try{for(T.s();!(x=T.n()).done;){var j=x.value;"string"==typeof j&&k.add(j)}}catch(e){T.e(e)}finally{T.f()}}}}}({timeline:t}),{images:p(r[e.ParameterType.IMAGE]),audio:p(r[e.ParameterType.AUDIO]),video:p(r[e.ParameterType.VIDEO])}}},{key:"cancelPreloads",value:function(){var e,t=y(this.preload_requests);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.onload=function(){},n.onerror=function(){},n.oncanplaythrough=function(){},n.onabort=function(){}}}catch(e){t.e(e)}finally{t.f()}this.preload_requests=[]}},{key:"initializeMicrophoneRecorder",value:function(e){var t=new MediaRecorder(e);this.microphone_recorder=t}},{key:"getMicrophoneRecorder",value:function(){return this.microphone_recorder}}]),t}(),M=function(){function e(){n(this,e)}return i(e,[{key:"dispatchEvent",value:function(e){document.body.dispatchEvent(e)}},{key:"keyDown",value:function(e){this.dispatchEvent(new KeyboardEvent("keydown",{key:e}))}},{key:"keyUp",value:function(e){this.dispatchEvent(new KeyboardEvent("keyup",{key:e}))}},{key:"pressKey",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n>0?setTimeout((function(){t.keyDown(e),t.keyUp(e)}),n):(this.keyDown(e),this.keyUp(e))}},{key:"clickTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t>0?setTimeout((function(){e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0}))}),t):(e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0})),e.dispatchEvent(new MouseEvent("click",{bubbles:!0})))}},{key:"fillTextInput",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n>0?setTimeout((function(){e.value=t}),n):e.value=t}},{key:"getValidKey",value:function(e){var t,n=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"," "];if("NO_KEYS"==e)t=null;else if("ALL_KEYS"==e)t=n[Math.floor(Math.random()*n.length)];else{var r=e.flat();t=r[Math.floor(Math.random()*r.length)]}return t}},{key:"mergeSimulationData",value:function(e,t){return Object.assign(Object.assign({},e),null==t?void 0:t.data)}},{key:"ensureSimulationDataConsistency",value:function(e,t){if(t.rt&&(t.rt=Math.round(t.rt)),e.trial_duration&&t.rt&&t.rt>e.trial_duration&&(t.rt=null,t.response&&(t.response=null),t.correct&&(t.correct=!1)),e.choices&&"NO_KEYS"==e.choices&&(t.rt&&(t.rt=null),t.response&&(t.response=null)),e.allow_response_before_complete&&e.sequence_reps&&e.frame_time){var n=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<n&&(t.rt=null,t.response=null)}}}]),e}(),D=function(){function e(){n(this,e),this.timeout_handlers=[]}return i(e,[{key:"setTimeout",value:function(e,t){var n=window.setTimeout(e,t);return this.timeout_handlers.push(n),n}},{key:"clearAllTimeouts",value:function(){var e,t=y(this.timeout_handlers);try{for(t.s();!(e=t.n()).done;){var n=e.value;clearTimeout(n)}}catch(e){t.e(e)}finally{t.f()}this.timeout_handlers=[]}}]),e}();var C=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function R(e){function t(){return e&&e.maxLength>1?function(){var t,r=!1;for(;!r;)(t=n()).length<=e.maxLength&&(r=!0);return t}():n()}function n(){return C[r(C.length)]}function r(e){return Math.floor(Math.random()*e)}if(void 0===e)return t();"number"==typeof e&&(e={exactly:e}),e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=function(e){return e}),"string"!=typeof e.separator&&(e.separator=" ");for(var i=e.min+r(e.max+1-e.min),a=[],o="",s=0,l=0;l<i*e.wordsPerString;l++)s===e.wordsPerString-1?o+=e.formatter(t(),s):o+=e.formatter(t(),s)+e.separator,s++,(l+1)%e.wordsPerString==0&&(a.push(o),o="",s=0);return"string"==typeof e.join&&(a=a.join(e.join)),a}var N=R;R.wordList=C;var V={exports:{}};(function(e,n,r){function i(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,n){var r=new i(e),o=n&&n.state,s=r.next;return s.int32=function(){return 4294967296*r.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==t(o)&&a(o,r),s.state=function(){return a(r,{})}),s}n&&n.exports?n.exports=o:r&&r.amd?r((function(){return o})):this.alea=o})(0,V,!1);var q=V.exports;function z(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Array.isArray(e),a=Array.isArray(n);if(i)if(a){if(e.length!=n.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),n.length<e.length){for(var o=[],s=0;s<e.length;s++)o.push(n);n=o}else n=n.slice(0,e.length)}else{for(var l=[],u=0;u<e.length;u++)l.push(n);n=l}else a?(n=[n[0]],console.log("Unclear parameters given to randomization.repeat. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.")):(e=[e],n=[n]);for(var c=[],h=0;h<e.length;h++)for(var d=0;d<n[h];d++)null==e[h]||"object"!=t(e[h])?c.push(e[h]):c.push(Object.assign({},e[h]));var p=K(c);return r&&(p=J(p)),p}function K(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");for(var t,n,r=e.slice(0),i=r.length;i;)n=Math.floor(Math.random()*i--),t=r[i],r[i]=r[n],r[n]=t;return r}function U(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.length;if(1==n)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),K(e[0]);for(var r=[],i=0;i<n;i++)r.push(i);t&&(r=K(r));for(var a=[],o=null,s=0;s<n;s++)o=null===o?e[s].length:Math.min(o,e[s].length),a.push(K(e[s]));for(var l=[],u=0;u<o;u++)for(var c=0;c<r.length;c++)l.push(a[r[c]][u]);return l}function F(e,t){return Array.isArray(e)||console.error("First argument to sampleWithoutReplacement() must be an array"),t>e.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),K(e).slice(0,t)}function Y(e,t,n){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");var r=[];if(void 0!==n){n.length!==e.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");var i,a=0,o=y(n);try{for(o.s();!(i=o.n()).done;){a+=i.value}}catch(e){o.e(e)}finally{o.f()}var s,l=y(n);try{for(l.s();!(s=l.n()).done;){var u=s.value;r.push(u/a)}}catch(e){l.e(e)}finally{l.f()}}else for(var c=0;c<e.length;c++)r.push(1/e.length);for(var h=[r[0]],d=1;d<r.length;d++)h.push(r[d]+h[d-1]);for(var p=[],f=0;f<t;f++){for(var m=Math.random(),v=0;m>h[v];)v++;p.push(e[v])}return p}function B(e,t){return function(){var e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}()*t+e}function W(e){return-Math.log(Math.random())/e}function J(e){var t,n={},r=y(e);try{for(r.s();!(t=r.n()).done;)for(var i=t.value,a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];void 0===n[s]&&(n[s]=[]),n[s].push(i[s])}}catch(e){r.e(e)}finally{r.f()}return n}var G=Object.freeze({__proto__:null,setSeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.random().toString();return Math.random=q(e),e},repeat:z,shuffle:K,shuffleNoRepeats:function(e,t){Array.isArray(e)||console.error("First argument to shuffleNoRepeats() must be an array."),void 0!==t&&"function"!=typeof t&&console.error("Second argument to shuffleNoRepeats() must be a function."),void 0===t&&(t=function(e,t){return e===t});for(var n=K(e),r=0;r<n.length-1;r++)if(t(n[r],n[r+1])){for(var i=Math.floor(Math.random()*(n.length-2))+1;t(n[r+1],n[i])||t(n[r+1],n[i+1])||t(n[r+1],n[i-1]);)i=Math.floor(Math.random()*(n.length-2))+1;var a=n[i];n[i]=n[r+1],n[r+1]=a}return n},shuffleAlternateGroups:U,sampleWithoutReplacement:F,sampleWithReplacement:Y,factorial:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{}],i=0,o=Object.entries(e);i<o.length;i++){var s,l=d(o[i],2),u=l[0],c=l[1],h=[],p=y(c);try{for(p.s();!(s=p.n()).done;){var f,m=s.value,v=y(r);try{for(v.s();!(f=v.n()).done;){var g=f.value;h.push(Object.assign(Object.assign({},g),a({},u,m)))}}catch(e){v.e(e)}finally{v.f()}}}catch(e){p.e(e)}finally{p.f()}r=h}return z(r,t,n)},randomID:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,t="",n="0123456789abcdefghjklmnopqrstuvwxyz",r=0;r<e;r++)t+=n[Math.floor(Math.random()*n.length)];return t},randomInt:function(e,t){if(t<e)throw new Error("Upper boundary must be less than or equal to lower boundary");return e+Math.floor(Math.random()*(t-e+1))},sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleNormal:B,sampleExponential:W,sampleExGaussian:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=B(e,t)+W(n);if(r)for(;i<=0;)i=B(e,t)+W(n);return i},randomWords:function(e){return N(e)}});function H(){var e={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},t=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==n?"":n[1]},n=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(r){e[r]=unescape(t(n,r))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var X=Object.freeze({__proto__:null,turkInfo:H,submitToTurk:function(e){var t=H(),n=t.assignmentId,r=t.turkSubmitTo;if(n&&r){var i=document.createElement("form");for(var a in i.method="POST",i.action=r+"/mturk/externalSubmit?assignmentId="+n,e)if(e.hasOwnProperty(a)){var o=document.createElement("input");o.type="hidden",o.name=a,o.id=a,o.value=e[a],i.appendChild(o)}document.body.appendChild(i),i.submit()}}}),$=function(){function e(r,i,a,o){if(n(this,e),this.jsPsych=r,this.progress={current_location:-1,current_variable_set:0,current_repetition:0,current_iteration:0,done:!1},this.parent_node=a,this.relative_id=void 0===a?0:o,void 0!==i.timeline){this.timeline_parameters={timeline:[],loop_function:i.loop_function,conditional_function:i.conditional_function,sample:i.sample,randomize_order:void 0!==i.randomize_order&&i.randomize_order,repetitions:void 0===i.repetitions?1:i.repetitions,timeline_variables:void 0===i.timeline_variables?[{}]:i.timeline_variables,on_timeline_finish:i.on_timeline_finish,on_timeline_start:i.on_timeline_start},this.setTimelineVariablesOrder();var s=Object.assign({},i);delete s.timeline,delete s.conditional_function,delete s.loop_function,delete s.randomize_order,delete s.repetitions,delete s.timeline_variables,delete s.sample,delete s.on_timeline_start,delete s.on_timeline_finish,this.node_trial_data=s;for(var l=0;l<i.timeline.length;l++){var u=Object.assign({},s,i.timeline[l]);if("object"==t(s.data)&&"object"==t(i.timeline[l].data)){var c=Object.assign({},s.data,i.timeline[l].data);u.data=c}this.timeline_parameters.timeline.push(new e(this.jsPsych,u,this,l))}}else void 0===i.type&&console.error('Trial level node is missing the "type" parameter. The parameters for the node are: '+JSON.stringify(i)),this.trial_parameters=Object.assign({},i)}return i(e,[{key:"trial",value:function(){return void 0===this.timeline_parameters?k(this.trial_parameters):this.progress.current_location>=this.timeline_parameters.timeline.length?null:this.timeline_parameters.timeline[this.progress.current_location].trial()}},{key:"markCurrentTrialComplete",value:function(){void 0===this.timeline_parameters?this.progress.done=!0:this.timeline_parameters.timeline[this.progress.current_location].markCurrentTrialComplete()}},{key:"nextRepetiton",value:function(){this.setTimelineVariablesOrder(),this.progress.current_location=-1,this.progress.current_variable_set=0,this.progress.current_repetition++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"setTimelineVariablesOrder",value:function(){var e=this.timeline_parameters;if(void 0!==e&&void 0!==e.timeline_variables){for(var t=[],n=0;n<e.timeline_variables.length;n++)t.push(n);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=Y(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=F(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=z(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=U(e.sample.groups,e.sample.randomize_group_order):console.error('Invalid type in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"')),e.randomize_order&&(t=K(t)),this.progress.order=t}}},{key:"nextSet",value:function(){this.progress.current_location=-1,this.progress.current_variable_set++;for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"advance",value:function(){var e=this.progress,t=this.timeline_parameters,n=this.jsPsych.internal;if(e.done)return!0;if(-1==e.current_location){if(void 0!==t){if(void 0!==t.conditional_function&&0==e.current_repetition&&0==e.current_variable_set){n.call_immediate=!0;var r=t.conditional_function();if(n.call_immediate=!1,0==r)return e.done=!0,!0}void 0!==t.on_timeline_start&&0==e.current_variable_set&&t.on_timeline_start()}return e.current_location=0,this.advance()}if(void 0!==t){for(var i=!1;e.current_location<t.timeline.length&&0==i;){if(!t.timeline[e.current_location].advance())return i=!0,!1;e.current_location++}return e.current_variable_set<e.order.length-1?(this.nextSet(),this.advance()):e.current_repetition<t.repetitions-1?(this.nextRepetiton(),void 0!==t.on_timeline_finish&&t.on_timeline_finish(),this.advance()):(void 0!==t.on_timeline_finish&&t.on_timeline_finish(),void 0!==t.loop_function?(n.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),n.call_immediate=!1,this.parent_node.advance()):(e.done=!0,n.call_immediate=!1,!0)):(e.done=!0,!0))}}},{key:"isComplete",value:function(){return this.progress.done}},{key:"getTimelineVariableValue",value:function(e){if(void 0!==this.timeline_parameters)return this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]][e]}},{key:"findTimelineVariable",value:function(e){var t=this.getTimelineVariableValue(e);return void 0===t?void 0!==this.parent_node?this.parent_node.findTimelineVariable(e):void 0:t}},{key:"timelineVariable",value:function(e){if(void 0===this.timeline_parameters)return this.findTimelineVariable(e);var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].timelineVariable(e)}},{key:"allTimelineVariables",value:function(){for(var e=this.allTimelineVariablesNames(),t={},n=0;n<e.length;n++)t[e[n]]=this.timelineVariable(e[n]);return t}},{key:"allTimelineVariablesNames",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(void 0!==this.timeline_parameters){e=e.concat(Object.keys(this.timeline_parameters.timeline_variables[this.progress.order[this.progress.current_variable_set]]));var t=Math.max(0,this.progress.current_location);return t==this.timeline_parameters.timeline.length&&(t-=1),this.timeline_parameters.timeline[t].allTimelineVariablesNames(e)}if(void 0===this.timeline_parameters)return e}},{key:"length",value:function(){var e=0;if(void 0===this.timeline_parameters)return 1;for(var t=0;t<this.timeline_parameters.timeline.length;t++)e+=this.timeline_parameters.timeline[t].length();return e}},{key:"percentComplete",value:function(){for(var e=this.length(),t=0,n=0;n<this.timeline_parameters.timeline.length;n++)this.timeline_parameters.timeline[n].isComplete()&&(t+=this.timeline_parameters.timeline[n].length());return t/e*100}},{key:"reset",value:function(){if(this.progress.current_location=-1,this.progress.current_repetition=0,this.progress.current_variable_set=0,this.progress.current_iteration++,this.progress.done=!1,this.setTimelineVariablesOrder(),void 0!==this.timeline_parameters)for(var e=0;e<this.timeline_parameters.timeline.length;e++)this.timeline_parameters.timeline[e].reset()}},{key:"end",value:function(){this.progress.done=!0}},{key:"endActiveNode",value:function(){void 0===this.timeline_parameters?(this.end(),this.parent_node.end()):this.timeline_parameters.timeline[this.progress.current_location].endActiveNode()}},{key:"ID",value:function(){var e="";return void 0===this.parent_node?"0."+this.progress.current_iteration:(e+=this.parent_node.ID()+"-",e+=this.relative_id+"."+this.progress.current_iteration)}},{key:"activeID",value:function(){return void 0===this.timeline_parameters?this.ID():this.timeline_parameters.timeline[this.progress.current_location].activeID()}},{key:"generatedData",value:function(){return this.jsPsych.data.getDataByTimelineNode(this.ID())}},{key:"trialsOfType",value:function(e){if(void 0===this.timeline_parameters)return this.trial_parameters.type==e?this.trial_parameters:[];for(var t=[],n=0;n<this.timeline_parameters.timeline.length;n++){var r=this.timeline_parameters.timeline[n].trialsOfType(e);t=t.concat(r)}return t}},{key:"insert",value:function(t){void 0===this.timeline_parameters?console.error("Cannot add new trials to a trial-level node."):this.timeline_parameters.timeline.push(new e(this.jsPsych,Object.assign(Object.assign({},this.node_trial_data),t),this,this.timeline_parameters.timeline.length))}}]),e}();function Q(e){return new Promise((function(t){return setTimeout(t,e)}))}var Z=function(){function r(e){var t,i;n(this,r),this.extensions={},this.turk=X,this.randomization=G,this.utils=x,this.opts={},this.global_trial_index=0,this.current_trial={},this.current_trial_finished=!1,this.paused=!1,this.waiting=!1,this.file_protocol=!1,this.simulation_mode=null,this.webaudio_context=null,this.internal={call_immediate:!1},this.progress_bar_amount=0,e=Object.assign({display_element:void 0,on_finish:function(){},on_trial_start:function(){},on_trial_finish:function(){},on_data_update:function(){},on_interaction_data_update:function(){},on_close:function(){},use_webaudio:!0,exclusions:{},show_progress_bar:!1,message_progress_bar:"Completion Progress",auto_update_progress_bar:!0,default_iti:0,minimum_valid_rt:0,experiment_width:null,override_safe_mode:!1,case_sensitive_responses:!1,extensions:[]},e),this.opts=e,b(this),this.webaudio_context="undefined"!=typeof window&&void 0!==window.AudioContext?new AudioContext:null,"file:"!=window.location.protocol||!1!==e.override_safe_mode&&void 0!==e.override_safe_mode||(e.use_webaudio=!1,this.file_protocol=!0,console.warn("jsPsych detected that it is running via the file:// protocol and not on a web server. To prevent issues with cross-origin requests, Web Audio and video preloading have been disabled. If you would like to override this setting, you can set 'override_safe_mode' to 'true' in initJsPsych. For more information, see: https://www.jspsych.org/overview/running-experiments")),this.data=new O(this),this.pluginAPI=(i=(t=this).getInitSettings(),Object.assign.apply(Object,[{}].concat(p([new A(t.getDisplayContainerElement,i.case_sensitive_responses,i.minimum_valid_rt),new D,new L(i.use_webaudio,t.webaudio_context),new E,new M].map((function(e){return b(e)}))))));var a,o=y(e.extensions);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.extensions[s.type.info.name]=new s.type(this)}}catch(e){o.e(e)}finally{o.f()}this.pluginAPI.initAudio()}return i(r,[{key:"version",value:function(){return"7.2.2"}},{key:"run",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&console.error("No timeline declared in jsPsych.run. Cannot start experiment."),0===e.length&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timelineDescription=e,this.timeline=new $(this,{timeline:e}),t.next=6,this.prepareDom();case 6:return t.next=8,this.checkExclusions(this.opts.exclusions);case 8:return t.next=10,this.loadExtensions(this.opts.extensions);case 10:return document.documentElement.setAttribute("jspsych","present"),this.startExperiment(),t.next=14,this.finished;case 14:case"end":return t.stop()}}),t,this)})))}},{key:"simulate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-only",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return v(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.simulation_mode=t,this.simulation_options=n,r.next=4,this.run(e);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"getProgress",value:function(){return{total_trials:void 0===this.timeline?void 0:this.timeline.length(),current_trial_global:this.global_trial_index,percent_complete:void 0===this.timeline?0:this.timeline.percentComplete()}}},{key:"getStartTime",value:function(){return this.exp_start_time}},{key:"getTotalTime",value:function(){return void 0===this.exp_start_time?0:(new Date).getTime()-this.exp_start_time.getTime()}},{key:"getDisplayElement",value:function(){return this.DOM_target}},{key:"getDisplayContainerElement",value:function(){return this.DOM_container}},{key:"finishTrial",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.current_trial_finished){var n;if(this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes))(n=this.DOM_target.classList).remove.apply(n,p(this.current_trial.css_classes));this.data.write(e);var r=this.data.getLastTrialData(),i=r.values()[0],a=this.current_trial;if("object"===t(a.save_trial_parameters))for(var o=0,s=Object.keys(a.save_trial_parameters);o<s.length;o++){var l=s[o],u=a.save_trial_parameters[l];!0===u&&(void 0===a[l]?console.warn('Invalid parameter specified in save_trial_parameters. Trial has no property called "'.concat(l,'".')):"function"==typeof a[l]?i[l]=a[l].toString():i[l]=a[l]),!1===u&&"internal_node_id"!==l&&"trial_index"!==l&&delete i[l]}if(Array.isArray(a.extensions)){var c,h=y(a.extensions);try{for(h.s();!(c=h.n()).done;){var d=c.value,f=this.extensions[d.type.info.name].on_finish(d.params);Object.assign(i,f)}}catch(e){h.e(e)}finally{h.f()}}this.internal.call_immediate=!0,"function"==typeof a.on_finish&&a.on_finish(i),this.opts.on_trial_finish(i),this.opts.on_data_update(i),this.internal.call_immediate=!1,"data-only"===this.simulation_mode?this.nextTrial():null===typeof a.post_trial_gap||void 0===a.post_trial_gap?this.opts.default_iti>0?setTimeout(this.nextTrial,this.opts.default_iti):this.nextTrial():a.post_trial_gap>0?setTimeout(this.nextTrial,a.post_trial_gap):this.nextTrial()}}},{key:"endExperiment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.timeline.end_message=e,this.timeline.end(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}},{key:"endCurrentTimeline",value:function(){this.timeline.endActiveNode()}},{key:"getCurrentTrial",value:function(){return this.current_trial}},{key:"getInitSettings",value:function(){return this.opts}},{key:"getCurrentTimelineNodeID",value:function(){return this.timeline.activeID()}},{key:"timelineVariable",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.internal.call_immediate||!0===n?this.timeline.timelineVariable(e):{timelineVariablePlaceholder:!0,timelineVariableFunction:function(){return t.timeline.timelineVariable(e)}}}},{key:"getAllTimelineVariables",value:function(){return this.timeline.allTimelineVariables()}},{key:"addNodeToEndOfTimeline",value:function(e,t){this.timeline.insert(e)}},{key:"pauseExperiment",value:function(){this.paused=!0}},{key:"resumeExperiment",value:function(){this.paused=!1,this.waiting&&(this.waiting=!1,this.nextTrial())}},{key:"loadFail",value:function(e){e=e||"<p>The experiment failed to load.</p>",this.DOM_target.innerHTML=e}},{key:"getSafeModeStatus",value:function(){return this.file_protocol}},{key:"getTimeline",value:function(){return this.timelineDescription}},{key:"prepareDom",value:function(){return v(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("complete"===document.readyState){e.next=3;break}return e.next=3,new Promise((function(e){window.addEventListener("load",e)}));case 3:void 0===(t=this.opts).display_element?(null===document.querySelector("body")&&document.documentElement.appendChild(document.createElement("body")),document.querySelector("html").style.height="100%",document.querySelector("body").style.margin="0px",document.querySelector("body").style.height="100%",document.querySelector("body").style.width="100%",t.display_element=document.querySelector("body")):null===(n=t.display_element instanceof Element?t.display_element:document.querySelector("#"+t.display_element))?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):t.display_element=n,t.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=t.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==t.experiment_width&&(this.DOM_target.style.width=t.experiment_width+"px"),t.display_element.tabIndex=0,-1===t.display_element.className.indexOf("jspsych-display-element")&&(t.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",t.on_close);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"loadExtensions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Promise.all(e.map((function(e){return n.extensions[e.type.info.name].initialize(e.params||{})})));case 3:t.next=9;break;case 5:throw t.prev=5,t.t0=t.catch(0),console.error(t.t0),new Error(t.t0);case 9:case"end":return t.stop()}}),t,null,[[0,5]])})))}},{key:"startExperiment",value:function(){var e=this;this.finished=new Promise((function(t){e.resolveFinishedPromise=t})),!0===this.opts.show_progress_bar&&this.drawProgressBar(this.opts.message_progress_bar),this.exp_start_time=new Date,this.timeline.advance(),this.doTrial(this.timeline.trial())}},{key:"finishExperiment",value:function(){var e=this,t=this.opts.on_finish(this.data.get()),n=function(){void 0!==e.timeline.end_message&&(e.DOM_target.innerHTML=e.timeline.end_message),e.resolveFinishedPromise()};t?Promise.resolve(t).then(n):n()}},{key:"nextTrial",value:function(){if(this.paused)this.waiting=!0;else{this.global_trial_index++,this.timeline.markCurrentTrialComplete();var e=this.timeline.advance();!0===this.opts.show_progress_bar&&!0===this.opts.auto_update_progress_bar&&this.updateProgressBar(),e?this.finishExperiment():this.doTrial(this.timeline.trial())}}},{key:"doTrial",value:function(e){var t,n=this;if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new w("A string was provided as the trial's `type` parameter. Since jsPsych v7, the `type` parameter needs to be a plugin object.");if(e.type=Object.assign(Object.assign({},b(new e.type(this))),{info:e.type.info}),this.evaluateFunctionParameters(e),this.setDefaultValues(e),this.internal.call_immediate=!0,this.opts.on_trial_start(e),"function"==typeof e.on_start&&e.on_start(e),Array.isArray(e.extensions)){var r,i=y(e.extensions);try{for(i.s();!(r=i.n()).done;){var a=r.value;this.extensions[a.type.info.name].on_start(a.params)}}catch(e){i.e(e)}finally{i.f()}}(this.DOM_container.focus(),this.DOM_target.scrollTop=0,void 0!==e.css_classes)&&(Array.isArray(e.css_classes)||"string"!=typeof e.css_classes||(e.css_classes=[e.css_classes]),Array.isArray(e.css_classes)&&(t=this.DOM_target.classList).add.apply(t,p(e.css_classes)));var o,s,l=function(){if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions)){var t,r=y(e.extensions);try{for(r.s();!(t=r.n()).done;){var i=t.value;n.extensions[i.type.info.name].on_load(i.params)}}catch(e){r.e(e)}finally{r.f()}}};(this.simulation_mode||(o=e.type.trial(this.DOM_target,e,l)),this.simulation_mode)&&(e.type.simulate?(e.simulation_options||(s=this.simulation_options.default),e.simulation_options&&("string"==typeof e.simulation_options?this.simulation_options[e.simulation_options]?s=this.simulation_options[e.simulation_options]:this.simulation_options.default?(console.log('No matching simulation options found for "'.concat(e.simulation_options,'". Using "default" options.')),s=this.simulation_options.default):(console.log('No matching simulation options found for "'.concat(e.simulation_options,'" and no "default" options provided. Using the default values provided by the plugin.')),s={}):s=e.simulation_options),s=this.utils.deepCopy(s),o=!1===(null==(s=this.replaceFunctionsWithValues(s,null))?void 0:s.simulate)?e.type.trial(this.DOM_target,e,l):e.type.simulate(e,(null==s?void 0:s.mode)||this.simulation_mode,s,l)):o=e.type.trial(this.DOM_target,e,l));o&&"function"==typeof o.then||this.simulation_mode||l(),this.internal.call_immediate=!1}},{key:"evaluateTimelineVariables",value:function(e){for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];"object"===t(e[i])&&null!==e[i]&&void 0!==e[i].timelineVariablePlaceholder&&(e[i]=e[i].timelineVariableFunction()),"object"===t(e[i])&&null!==e[i]&&this.evaluateTimelineVariables(e[i])}}},{key:"evaluateFunctionParameters",value:function(t){this.internal.call_immediate=!0;for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];"type"!==i&&(void 0!==I[i]&&I[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],null)),void 0!==t.type.info.parameters[i]&&t.type.info.parameters[i].type!==e.ParameterType.FUNCTION&&(t[i]=this.replaceFunctionsWithValues(t[i],t.type.info.parameters[i])))}this.internal.call_immediate=!1}},{key:"replaceFunctionsWithValues",value:function(n,r){if(null===n)return n;if(Array.isArray(n))for(var i=0;i<n.length;i++)n[i]=this.replaceFunctionsWithValues(n[i],r);else if("object"===t(n))if(null!==r&&r.nested)for(var a=0,o=Object.keys(n);a<o.length;a++){var s=o[a];"object"===t(r.nested[s])&&r.nested[s].type!==e.ParameterType.FUNCTION&&(n[s]=this.replaceFunctionsWithValues(n[s],r.nested[s]))}else for(var l=0,u=Object.keys(n);l<u.length;l++){var c=u[l];"type"!==c&&(n[c]=this.replaceFunctionsWithValues(n[c],null))}else if("function"==typeof n)return n();return n}},{key:"setDefaultValues",value:function(t){var n=function(n){t.type.info.parameters[n].type===e.ParameterType.COMPLEX?!0===t.type.info.parameters[n].array&&t[n].forEach((function(e,r){for(var i in t.type.info.parameters[n].nested)void 0!==t[n][r][i]&&null!==t[n][r][i]||(void 0===t.type.info.parameters[n].nested[i].default?console.error("You must specify a value for the "+i+" parameter (nested in the "+n+" parameter) in the "+t.type+" plugin."):t[n][r][i]=t.type.info.parameters[n].nested[i].default)})):void 0!==t[n]&&null!==t[n]||(void 0===t.type.info.parameters[n].default?console.error("You must specify a value for the "+n+" parameter in the "+t.type.info.name+" plugin."):t[n]=t.type.info.parameters[n].default)};for(var r in t.type.info.parameters)n(r)}},{key:"checkExclusions",value:function(e){return v(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e.min_width||e.min_height||e.audio)&&console.warn("The exclusions option in `initJsPsych()` is deprecated and will be removed in a future version. We recommend using the browser-check plugin instead. See https://www.jspsych.org/latest/plugins/browser-check/."),!e.min_width&&!e.min_height){t.next=12;break}if(n=e.min_width||0,r=e.min_height||0,!(window.innerWidth<n||window.innerHeight<r)){t.next=12;break}this.getDisplayElement().innerHTML="<p>Your browser window is too small to complete this experiment. Please maximize the size of your browser window. If your browser window is already maximized, you will not be able to complete this experiment.</p><p>The minimum width is "+n+"px. Your current width is "+window.innerWidth+"px.</p><p>The minimum height is "+r+"px. Your current height is "+window.innerHeight+"px.</p>";case 6:if(!(window.innerWidth<n||window.innerHeight<r)){t.next=11;break}return t.next=9,Q(100);case 9:t.next=6;break;case 11:this.getDisplayElement().innerHTML="";case 12:if(void 0===e.audio||!e.audio){t.next=16;break}if(window.hasOwnProperty("AudioContext")||window.hasOwnProperty("webkitAudioContext")){t.next=16;break}throw this.getDisplayElement().innerHTML="<p>Your browser does not support the WebAudio API, which means that you will not be able to complete the experiment.</p><p>Browsers that support the WebAudio API include Chrome, Firefox, Safari, and Edge.</p>",new Error;case 16:case"end":return t.stop()}}),t,this)})))}},{key:"drawProgressBar",value:function(e){document.querySelector(".jspsych-display-element").insertAdjacentHTML("afterbegin",'<div id="jspsych-progressbar-container"><span>'+e+'</span><div id="jspsych-progressbar-outer"><div id="jspsych-progressbar-inner"></div></div></div>')}},{key:"updateProgressBar",value:function(){this.setProgressBar(this.getProgress().percent_complete/100)}},{key:"setProgressBar",value:function(e){e=Math.max(Math.min(1,e),0),document.querySelector("#jspsych-progressbar-inner").style.width=100*e+"%",this.progress_bar_amount=e}},{key:"getProgressBarCompleted",value:function(){return this.progress_bar_amount}}]),r}();return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=Z,e.initJsPsych=function(e){var t=new Z(e);return Object.defineProperties(t,Object.fromEntries(Object.entries({init:"`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.",ALL_KEYS:'jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.',NO_KEYS:'jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.',currentTimelineNodeID:"`currentTimelineNodeID()` was renamed to `getCurrentTimelineNodeID()` in jsPsych v7.",progress:"`progress()` was renamed to `getProgress()` in jsPsych v7.",startTime:"`startTime()` was renamed to `getStartTime()` in jsPsych v7.",totalTime:"`totalTime()` was renamed to `getTotalTime()` in jsPsych v7.",currentTrial:"`currentTrial()` was renamed to `getCurrentTrial()` in jsPsych v7.",initSettings:"`initSettings()` was renamed to `getInitSettings()` in jsPsych v7.",allTimelineVariables:"`allTimelineVariables()` was renamed to `getAllTimelineVariables()` in jsPsych v7."}).map((function(e){var t=d(e,2),n=t[0],r=t[1];return[n,{get:function(){throw new w(r)}}]})))),t},e.universalPluginParameters=I,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),initJsPsych=jsPsychModule.initJsPsych;
|
|
2
2
|
//# sourceMappingURL=index.browser.min.js.map
|