jspsych 7.3.4 → 8.0.0
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/README.md +1 -1
- package/css/jspsych.css +18 -8
- package/dist/index.browser.js +3080 -4286
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +6 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +2314 -4066
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +984 -6
- package/dist/index.js +2313 -4066
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/src/ExtensionManager.spec.ts +123 -0
- package/src/ExtensionManager.ts +81 -0
- package/src/JsPsych.ts +195 -690
- package/src/ProgressBar.spec.ts +60 -0
- package/src/ProgressBar.ts +60 -0
- package/src/index.scss +29 -8
- package/src/index.ts +4 -9
- package/src/modules/data/DataCollection.ts +1 -1
- package/src/modules/data/DataColumn.ts +12 -1
- package/src/modules/data/index.ts +92 -103
- package/src/modules/extensions.ts +4 -0
- package/src/modules/plugin-api/AudioPlayer.ts +101 -0
- package/src/modules/plugin-api/KeyboardListenerAPI.ts +1 -1
- package/src/modules/plugin-api/MediaAPI.ts +48 -106
- package/src/modules/plugin-api/__mocks__/AudioPlayer.ts +38 -0
- package/src/modules/plugin-api/index.ts +11 -14
- package/src/modules/plugins.ts +26 -27
- package/src/modules/randomization.ts +1 -1
- package/src/timeline/Timeline.spec.ts +921 -0
- package/src/timeline/Timeline.ts +342 -0
- package/src/timeline/TimelineNode.ts +174 -0
- package/src/timeline/Trial.spec.ts +897 -0
- package/src/timeline/Trial.ts +419 -0
- package/src/timeline/index.ts +232 -0
- package/src/timeline/util.spec.ts +124 -0
- package/src/timeline/util.ts +146 -0
- package/dist/JsPsych.d.ts +0 -112
- package/dist/TimelineNode.d.ts +0 -34
- package/dist/migration.d.ts +0 -3
- package/dist/modules/data/DataCollection.d.ts +0 -46
- package/dist/modules/data/DataColumn.d.ts +0 -15
- package/dist/modules/data/index.d.ts +0 -25
- package/dist/modules/data/utils.d.ts +0 -3
- package/dist/modules/extensions.d.ts +0 -22
- package/dist/modules/plugin-api/HardwareAPI.d.ts +0 -15
- package/dist/modules/plugin-api/KeyboardListenerAPI.d.ts +0 -34
- package/dist/modules/plugin-api/MediaAPI.d.ts +0 -32
- package/dist/modules/plugin-api/SimulationAPI.d.ts +0 -44
- package/dist/modules/plugin-api/TimeoutAPI.d.ts +0 -17
- package/dist/modules/plugin-api/index.d.ts +0 -8
- package/dist/modules/plugins.d.ts +0 -136
- package/dist/modules/randomization.d.ts +0 -42
- package/dist/modules/turk.d.ts +0 -40
- package/dist/modules/utils.d.ts +0 -13
- package/src/TimelineNode.ts +0 -544
- package/src/modules/plugin-api/HardwareAPI.ts +0 -32
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
var jsPsychModule=function(e){"use strict";function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof g?t:g,o=Object.create(i.prototype),s=new A(n||[]);return a(o,"_invoke",{value:P(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var d="suspendedStart",p="suspendedYield",m="executing",v="completed",y={};function g(){}function w(){}function b(){}var _={};c(_,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(I([])));x&&x!==n&&i.call(x,s)&&(_=x);var j=b.prototype=g.prototype=Object.create(_);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(n,a,o,s){var l=f(e[n],e,a);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(c).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,s)}))}s(l.arg)}var n;a(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(a,a):a()}})}function P(t,r,n){var i=d;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:e,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var l=O(s,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var u=f(t,r,n);if("normal"===u.type){if(i=n.done?v:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=v,n.method="throw",n.arg=u.arg)}}}function O(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(i,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function I(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(i.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return w.prototype=b,a(j,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:w,configurable:!0}),w.displayName=c(b,u,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,u,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},T(E.prototype),c(E.prototype,l,(function(){return this})),r.AsyncIterator=E,r.async=function(e,t,n,i,a){void 0===a&&(a=Promise);var o=new E(h(e,t,n,i),a);return r.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},T(j),c(j,u,"Generator"),c(j,s,(function(){return this})),c(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=I,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function r(e){return r="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},r(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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,r){return u=l()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&s(i,r.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||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;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 f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||p(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 d(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)||p(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 p(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=p(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function y(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function b(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}!function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof g?t:g,o=Object.create(i.prototype),s=new A(n||[]);return a(o,"_invoke",{value:P(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var d="suspendedStart",p="suspendedYield",m="executing",v="completed",y={};function g(){}function w(){}function b(){}var _={};c(_,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(I([])));x&&x!==n&&i.call(x,s)&&(_=x);var j=b.prototype=g.prototype=Object.create(_);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(a,o,s,l){var u=f(e[a],e,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"===r(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(h).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,l)}))}l(u.arg)}var o;a(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function P(e,r,n){var i=d;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var l=O(s,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var u=f(e,r,n);if("normal"===u.type){if(i=n.done?v:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=v,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(i,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a<e.length;)if(i.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=b,a(j,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:w,configurable:!0}),w.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,u,"GeneratorFunction")),e.prototype=Object.create(j),e},e.awrap=function(e){return{__await:e}},T(E.prototype),c(E.prototype,l,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new E(h(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},T(j),c(j,u,"Generator"),c(j,s,(function(){return this})),c(j,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}({exports:{}}),"function"==typeof SuppressedError&&SuppressedError;var _=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.include,i=r.exclude,a=function(e){var t=function(t){return"string"==typeof t?e===t:t.test(e)};return n?n.some(t):!i||!i.some(t)},o=v(function(e){var t=new Set;do{var r,n=v(Reflect.ownKeys(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;t.add([e,i])}}catch(e){n.e(e)}finally{n.f()}}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t}(e.constructor.prototype));try{for(o.s();!(t=o.n()).done;){var s=f(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},k=w(_),x=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,i=(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=i.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 a(u)}(c(Error));function j(e){return d(new Set(e))}function T(e){if(!e)return e;var t;if(Array.isArray(e)){t=[];var n,i=v(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;t.push(T(a))}}catch(e){i.e(e)}finally{i.f()}return t}if("object"===r(e)&&null!==e){for(var o in t={},e)e.hasOwnProperty(o)&&(t[o]=T(e[o]));return t}return e}window.jsPsych={get init(){throw new x("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new x},get randomization(){throw new x},get turk(){throw new x},get pluginAPI(){throw new x},get ALL_KEYS(){throw new x('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new x('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};var E=Object.freeze({__proto__:null,deepCopy:T,deepMerge:function e(t,n){var i={};for(var a in t)t.hasOwnProperty(a)&&("object"===r(t[a])&&n.hasOwnProperty(a)?i[a]=e(t[a],n[a]):i[a]=t[a]);for(var o in n)n.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&"object"===r(n[o])?i[o]=e(i[o],n[o]):i[o]=n[o]);return i},unique:j}),P=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.values=t}return a(e,[{key:"sum",value:function(){var e,t=0,r=v(this.values);try{for(r.s();!(e=r.n()).done;){t+=e.value}}catch(e){r.e(e)}finally{r.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(),r=0,n=v(this.values);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=Math.pow(i-t,2)}}catch(e){n.e(e)}finally{n.f()}return r/(this.values.length-1)}},{key:"sd",value:function(){var e=this.variance();return Math.sqrt(e)}},{key:"frequencies",value:function(){var e,t={},r=v(this.values);try{for(r.s();!(e=r.n()).done;){var n=e.value;void 0===t[n]?t[n]=1:t[n]++}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"all",value:function(e){var t,r=v(this.values);try{for(r.s();!(t=r.n()).done;){if(!e(t.value))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"subset",value:function(t){var r,n=[],i=v(this.values);try{for(i.s();!(r=i.n()).done;){var a=r.value;t(a)&&n.push(a)}}catch(e){i.e(e)}finally{i.f()}return new e(n)}}]),e}();var O,L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.trials=t}return a(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(T(this.trials))}},{key:"addToAll",value:function(e){var t,r=v(this.trials);try{for(r.s();!(t=r.n()).done;){var n=t.value;Object.assign(n,e)}}catch(e){r.e(e)}finally{r.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 r;r=Array.isArray(t)?T(t):T([t]);var n,i=[],a=v(this.trials);try{for(a.s();!(n=a.n()).done;){var o,s=n.value,l=!1,u=v(r);try{for(u.s();!(o=u.n()).done;){for(var c=o.value,h=!0,f=0,d=Object.keys(c);f<d.length;f++){var p=d[f];void 0!==s[p]&&s[p]===c[p]||(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,r=[],n=v(this.trials);try{for(n.s();!(t=n.n()).done;){var i=t.value;void 0!==i[e]&&r.push(i[e])}}catch(e){n.e(e)}finally{n.f()}return new P(r)}},{key:"ignore",value:function(t){Array.isArray(t)||(t=[t]);var r,n=T(this.trials),i=v(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,s=v(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(n)}},{key:"uniqueNames",value:function(){var e,t=[],r=v(this.trials);try{for(r.s();!(e=r.n()).done;)for(var n=e.value,i=0,a=Object.keys(n);i<a.length;i++){var o=a[i];t.includes(o)||t.push(o)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"csv",value:function(){return function(e){var t,n="object"!=r(e)?JSON.parse(e):e,i="",a="",o=[],s=v(n);try{for(s.s();!(t=s.n()).done;){var l=t.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,f=v(n);try{for(f.s();!(h=f.n()).done;){var d=h.value;i="";var p,m=v(o);try{for(m.s();!(p=m.n()).done;){var y=p.value,g=void 0===d[y]?"":d[y];"object"==r(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){f.e(e)}finally{f.f()}return a}(this.trials)}},{key:"json",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?JSON.stringify(this.trials,null,"\t"):JSON.stringify(this.trials)}},{key:"localSave",value:function(e,t){var r;if("json"===(e=e.toLowerCase()))r=this.json();else{if("csv"!==e)throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');r=this.csv()}!function(e,t){var r=new Blob([e],{type:"text/plain"}),n="";n=void 0!==window.webkitURL?window.webkitURL.createObjectURL(r):window.URL.createObjectURL(r);var i=document.createElement("a");i.id="jspsych-download-as-text-link",i.style.display="none",i.download=t,i.href=n,i.click()}(r,t)}}]),e}(),S=function(){function e(t){n(this,e),this.jsPsych=t,this.dataProperties={},this.reset()}return a(e,[{key:"reset",value:function(){this.allData=new L,this.interactionData=new L}},{key:"get",value:function(){return this.allData}},{key:"getInteractionData",value:function(){return this.interactionData}},{key:"write",value:function(e){var t=this.jsPsych.getProgress(),r=this.jsPsych.getCurrentTrial(),n={trial_type:r.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),r.data),n),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 L;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();this.jsPsych.getDisplayElement().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={},r=0;r<e.length;++r){var n=e[r].split("=",2);1==n.length?t[n[0]]="":t[n[0]]=decodeURIComponent(n[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 L(e)}},{key:"_fullreset",value:function(){this.reset(),this.dataProperties={}}}]),e}(),A=function(){function e(){var t=this;n(this,e),this.hardwareConnected=!1,document.addEventListener("jspsych-activate",(function(e){t.hardwareConnected=!0}))}return a(e,[{key:"hardware",value:function(e){var t=new CustomEvent("jspsych",{detail:e});document.dispatchEvent(t)}}]),e}(),I=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,k(this),this.registerRootListeners()}return a(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,r=Array.from(this.listeners);t<r.length;t++){(0,r[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,r){return!(!t&&this.heldKeys.has(r))&&("ALL_KEYS"===e||"NO_KEYS"!==e&&e.includes(r))}},{key:"getKeyboardResponse",value:function(e){var t=this,r=e.callback_function,n=e.valid_responses,i=void 0===n?"ALL_KEYS":n,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,f=e.minimum_valid_rt,d=void 0===f?this.minimumValidRt:f;"performance"!==o&&"audio"!==o&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),o="performance");var p="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(n){var a=Math.round(("performance"==o?performance.now():1e3*l.currentTime)-p);if(!(a<d)){var u=t.toLowerCaseIfInsensitive(n.key);t.isResponseValid(i,h,u)&&(n.preventDefault(),s||t.cancelKeyboardResponse(e),r({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,(O=e.ParameterType||(e.ParameterType={}))[O.BOOL=0]="BOOL",O[O.STRING=1]="STRING",O[O.INT=2]="INT",O[O.FLOAT=3]="FLOAT",O[O.FUNCTION=4]="FUNCTION",O[O.KEY=5]="KEY",O[O.KEYS=6]="KEYS",O[O.SELECT=7]="SELECT",O[O.HTML_STRING=8]="HTML_STRING",O[O.IMAGE=9]="IMAGE",O[O.AUDIO=10]="AUDIO",O[O.VIDEO=11]="VIDEO",O[O.OBJECT=12]="OBJECT",O[O.COMPLEX=13]="COMPLEX",O[O.TIMELINE=14]="TIMELINE";var M={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}},C=[e.ParameterType.AUDIO,e.ParameterType.IMAGE,e.ParameterType.VIDEO],D=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,this.camera_stream=null,this.camera_recorder=null}return a(t,[{key:"getVideoBuffer",value:function(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),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(r,n){void 0===t.audio_buffers[e]||"tmp"==t.audio_buffers[e]?t.preloadAudio([e],(function(){r(t.audio_buffers[e])}),(function(){}),(function(e){n(e.error)})):r(t.audio_buffers[e])}))}},{key:"preloadAudio",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=j(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++,n(o),a==e.length&&r()}),(function(e){i({source:o,error:e})}))},s.onerror=function(e){var t=e;404==s.status&&(t="404"),i({source:o,error:t})},s.onloadend=function(e){404==s.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++,n(o),a==e.length&&r(),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=v(e);try{for(u.s();!(o=u.n()).done;){var c=o.value;void 0!==this.audio_buffers[c]?(a++,n(c),a==e.length&&r()):(this.audio_buffers[c]="tmp",null!==this.audioContext()?s(c):l(c))}}catch(e){u.e(e)}finally{u.f()}}else r()}},{key:"preloadImages",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=j(e.flat());var a=0;if(0!==e.length)for(var o=function(){var o=new Image,l=e[s];o.onload=function(){a++,n(l),a===e.length&&r()},o.onerror=function(e){i({source:l,error:e})},o.src=l,t.img_cache[l]=o,t.preload_requests.push(o)},s=0;s<e.length;s++)o();else r()}},{key:"preloadVideo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){};e=j(e.flat());var a=0;if(0!==e.length){var o,s=v(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===u.status||0===u.status){var t=u.response;l[s]=URL.createObjectURL(t),a++,n(s),a===e.length&&r()}},u.onerror=function(e){var t=e;404==u.status&&(t="404"),i({source:s,error:t})},u.onloadend=function(e){404==u.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 r()}},{key:"getAutoPreloadList",value:function(t){var r=this,n=Object.fromEntries(C.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=v(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,d=h.name,p=h.parameters;r.preloadMap.has(d)||r.preloadMap.set(d,Object.fromEntries(Object.entries(p).filter((function(e){var t=f(e,2);t[0];var r=t[1],n=r.type,i=r.preload;return C.includes(n)&&(null==i||i)})).map((function(e){var t=f(e,2);return[t[0],t[1].type]}))));for(var m=0,y=Object.entries(r.preloadMap.get(d));m<y.length;m++){var g=f(y[m],2),w=g[0],b=g[1],_=t[w],k=n[b];if("string"==typeof _)k.add(_);else if(Array.isArray(_)){var x,j=v(_.flat());try{for(j.s();!(x=j.n()).done;){var T=x.value;"string"==typeof T&&k.add(T)}}catch(e){j.e(e)}finally{j.f()}}}}}({timeline:t}),{images:d(n[e.ParameterType.IMAGE]),audio:d(n[e.ParameterType.AUDIO]),video:d(n[e.ParameterType.VIDEO])}}},{key:"cancelPreloads",value:function(){var e,t=v(this.preload_requests);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.onload=function(){},r.onerror=function(){},r.oncanplaythrough=function(){},r.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}},{key:"initializeCameraRecorder",value:function(e,t){this.camera_stream=e;var r=new MediaRecorder(e,t);this.camera_recorder=r}},{key:"getCameraStream",value:function(){return this.camera_stream}},{key:"getCameraRecorder",value:function(){return this.camera_recorder}}]),t}(),N=function(){function e(t,r){n(this,e),this.getDisplayContainerElement=t,this.setJsPsychTimeout=r}return a(e,[{key:"dispatchEvent",value:function(e){this.getDisplayContainerElement().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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r>0?this.setJsPsychTimeout((function(){t.keyDown(e),t.keyUp(e)}),r):(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?this.setJsPsychTimeout((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 r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r>0?this.setJsPsychTimeout((function(){e.value=t}),r):e.value=t}},{key:"getValidKey",value:function(e){var t,r=["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=r[Math.floor(Math.random()*r.length)];else{var n=e.flat();t=n[Math.floor(Math.random()*n.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 r=e.sequence_reps*e.frame_time*e.stimuli.length;t.rt<r&&(t.rt=null,t.response=null)}}}]),e}(),R=function(){function e(){n(this,e),this.timeout_handlers=[]}return a(e,[{key:"setTimeout",value:function(e,t){var r=window.setTimeout(e,t);return this.timeout_handlers.push(r),r}},{key:"clearAllTimeouts",value:function(){var e,t=v(this.timeout_handlers);try{for(t.s();!(e=t.n()).done;){var r=e.value;clearTimeout(r)}}catch(e){t.e(e)}finally{t.f()}this.timeout_handlers=[]}}]),e}();var V={exports:{}};(function(e,t,n){function i(e){var t=this,r=function(){var e=4022871197,t=function(t){t=String(t);for(var r=0;r<t.length;r++){var n=.02519603282416938*(e+=t.charCodeAt(r));n-=e=n>>>0,e=(n*=e)>>>0,e+=4294967296*(n-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.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,t){var n=new i(e),o=t&&t.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,o&&("object"==r(o)&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.alea=o})(0,V,!1);var q=V.exports,z=w(q),F={exports:{}};!function(e){!function(e,t,n){function i(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==r(o)&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor128=o}(0,e,!1)}(F);var K=F.exports,U={exports:{}};!function(e){!function(e,t,n){function i(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),n==r.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==r(o)&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorwow=o}(0,e,!1)}(U);var Y=U.exports,G={exports:{}};!function(e){!function(e,t,r){function n(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r<t.length;++r)n[7&r]=n[7&r]<<15^t.charCodeAt(r)+n[r+1&7]<<13;for(;n.length<8;)n.push(0);for(r=0;r<8&&0===n[r];++r);for(8==r?n[7]=-1:n[r],e.x=n,e.i=0,r=256;r>0;--r)e.next()}(t,e)}function i(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){null==e&&(e=+new Date);var r=new n(e),a=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&(a.x&&i(a,r),o.state=function(){return i(r,{})}),o}t&&t.exports?t.exports=a:r&&r.amd?r((function(){return a})):this.xorshift7=a}(0,e,!1)}(G);var B=G.exports,W={exports:{}};!function(e){!function(e,t,r){function n(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,a=t.i;return t.w=n=n+1640531527|0,r=i[a+34&127],e=i[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[a]=r^e,t.i=a,r+(n^n>>>16)|0},function(e,t){var r,n,i,a,o,s=[],l=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,l=Math.max(l,t.length)),i=0,a=-32;a<l;++a)t&&(n^=t.charCodeAt((a+32)%t.length)),0===a&&(o=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+1640531527|0,i=0==(r=s[127&a]^=n+o)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,a=512;a>0;--a)n=s[i+34&127],r=s[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[i]=n^r;e.w=o,e.X=s,e.i=i}(t,e)}function i(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){null==e&&(e=+new Date);var r=new n(e),a=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,a&&(a.X&&i(a,r),o.state=function(){return i(r,{})}),o}t&&t.exports?t.exports=a:r&&r.amd?r((function(){return a})):this.xor4096=a}(0,e,!1)}(W);var J=W.exports,H={exports:{}};!function(e){!function(e,t,n){function i(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n<r.length+20;n++)t.b^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function o(e,t){var n=new i(e),o=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,o&&("object"==r(o)&&a(o,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.tychei=o}(0,e,!1)}(H);var X=H.exports,$={exports:{}};!function(e){!function(t,n,i){var a,o=256,s="random",l=i.pow(o,6),u=i.pow(2,52),c=2*u,h=o-1;function f(e,r,h){var f=[],g=v(m((r=1==r?{entropy:!0}:r||{}).entropy?[e,y(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(o):(e=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(e)),y(e)}catch(e){var r=t.navigator,i=r&&r.plugins;return[+new Date,t,i,t.screen,y(n)]}}():e,3),f),w=new d(f),b=function(){for(var e=w.g(6),t=l,r=0;e<u;)e=(e+r)*o,t*=o,r=w.g(1);for(;e>=c;)e/=2,t/=2,r>>>=1;return(e+r)/t};return b.int32=function(){return 0|w.g(4)},b.quick=function(){return w.g(4)/4294967296},b.double=b,v(y(w.S),n),(r.pass||h||function(e,t,r,n){return n&&(n.S&&p(n,w),e.state=function(){return p(w,{})}),r?(i[s]=e,t):e})(b,g,"global"in r?r.global:this==i,r.state)}function d(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,s=n.S=[];for(r||(e=[r++]);i<o;)s[i]=i++;for(i=0;i<o;i++)s[i]=s[a=h&a+e[i%r]+(t=s[i])],s[a]=t;(n.g=function(e){for(var t,r=0,i=n.i,a=n.j,s=n.S;e--;)t=s[i=h&i+1],r=r*o+s[h&(s[i]=s[a=h&a+t])+(s[a]=t)];return n.i=i,n.j=a,r})(o)}function p(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function m(e,t){var n,i=[],a=r(e);if(t&&"object"==a)for(n in e)try{i.push(m(e[n],t-1))}catch(e){}return i.length?i:"string"==a?e:e+"\0"}function v(e,t){for(var r,n=e+"",i=0;i<n.length;)t[h&i]=h&(r^=19*t[h&i])+n.charCodeAt(i++);return y(t)}function y(e){return String.fromCharCode.apply(0,e)}if(v(i.random(),n),e.exports){e.exports=f;try{a=require("crypto")}catch(e){}}else i["seed"+s]=f}("undefined"!=typeof self?self:g,[],Math)}($);var Q=q,Z=K,ee=Y,te=B,re=J,ne=X,ie=$.exports;ie.alea=Q,ie.xor128=Z,ie.xorwow=ee,ie.xorshift7=te,ie.xor4096=re,ie.tychei=ne;var ae=ie,oe=["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 se(e){var t,r=null!==(t=e)&&void 0!==t&&t.seed?new ae(e.seed):null;function n(){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 oe[a(oe.length)]}function a(e){var t=r?r():Math.random();return Math.floor(t*e)}if(void 0===e)return n();"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 o=e.min+a(e.max+1-e.min),s=[],l="",u=0,c=0;c<o*e.wordsPerString;c++)u===e.wordsPerString-1?l+=e.formatter(n(),u):l+=e.formatter(n(),u)+e.separator,u++,(c+1)%e.wordsPerString==0&&(s.push(l),l="",u=0);return"string"==typeof e.join&&(s=s.join(e.join)),s}var le=se;se.wordList=oe;var ue=w(le);function ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Array.isArray(e),a=Array.isArray(t);if(i)if(a){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){for(var o=[],s=0;s<e.length;s++)o.push(t);t=o}else t=t.slice(0,e.length)}else{for(var l=[],u=0;u<e.length;u++)l.push(t);t=l}else a?(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]);for(var c=[],h=0;h<e.length;h++)for(var f=0;f<t[h];f++)null==e[h]||"object"!=r(e[h])?c.push(e[h]):c.push(Object.assign({},e[h]));var d=he(c);return n&&(d=function(e){var t,r={},n=v(e);try{for(n.s();!(t=n.n()).done;)for(var i=t.value,a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];void 0===r[s]&&(r[s]=[]),r[s].push(i[s])}}catch(e){n.e(e)}finally{n.f()}return r}(d)),d}function he(e){Array.isArray(e)||console.error("Argument to shuffle() must be an array.");for(var t,r,n=e.slice(0),i=n.length;i;)r=Math.floor(Math.random()*i--),t=n[i],n[i]=n[r],n[r]=t;return n}function fe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.length;if(1==r)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),he(e[0]);for(var n=[],i=0;i<r;i++)n.push(i);t&&(n=he(n));for(var a=[],o=null,s=0;s<r;s++)o=null===o?e[s].length:Math.min(o,e[s].length),a.push(he(e[s]));for(var l=[],u=0;u<o;u++)for(var c=0;c<n.length;c++)l.push(a[n[c]][u]);return l}function de(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."),he(e).slice(0,t)}function pe(e,t,r){Array.isArray(e)||console.error("First argument to sampleWithReplacement() must be an array");var n=[];if(void 0!==r){r.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=v(r);try{for(o.s();!(i=o.n()).done;){a+=i.value}}catch(e){o.e(e)}finally{o.f()}var s,l=v(r);try{for(l.s();!(s=l.n()).done;){var u=s.value;n.push(u/a)}}catch(e){l.e(e)}finally{l.f()}}else for(var c=0;c<e.length;c++)n.push(1/e.length);for(var h=[n[0]],f=1;f<n.length;f++)h.push(n[f]+h[f-1]);for(var d=[],p=0;p<t;p++){for(var m=Math.random(),y=0;m>h[y];)y++;d.push(e[y])}return d}function me(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 ve(e){return-Math.log(Math.random())/e}var ye=Object.freeze({__proto__:null,factorial:function(e){for(var t,r,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=[{}],s=0,l=Object.entries(e);s<l.length;s++){var u,c=f(l[s],2),h=c[0],d=[],p=v(c[1]);try{for(p.s();!(u=p.n()).done;){var m,g=u.value,w=v(o);try{for(w.s();!(m=w.n()).done;){var b=m.value;d.push(Object.assign(Object.assign({},b),(t={},n=g,(r=y(r=h))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t)))}}catch(e){w.e(e)}finally{w.f()}}}catch(e){p.e(e)}finally{p.f()}o=d}return ce(o,i,a)},randomID:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,t="",r="0123456789abcdefghjklmnopqrstuvwxyz",n=0;n<e;n++)t+=r[Math.floor(35*Math.random())];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))},randomWords:function(e){return ue(e)},repeat:ce,sampleBernoulli:function(e){return Math.random()<=e?1:0},sampleExGaussian:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=me(e,t)+ve(r);if(n)for(;i<=0;)i=me(e,t)+ve(r);return i},sampleExponential:ve,sampleNormal:me,sampleWithReplacement:pe,sampleWithoutReplacement:de,setSeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.random().toString();return Math.random=z(e),e},shuffle:he,shuffleAlternateGroups:fe,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 r=he(e),n=0;n<r.length-1;n++)if(t(r[n],r[n+1])){for(var i=Math.floor(Math.random()*(r.length-2))+1;t(r[n+1],r[i])||t(r[n+1],r[i+1])||t(r[n+1],r[i-1])||t(r[n],r[i]);)i=Math.floor(Math.random()*(r.length-2))+1;var a=r[i];r[i]=r[n+1],r[n+1]=a}return r}});function ge(){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 r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null==r?"":r[1]},r=t(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map((function(n){e[n]=unescape(t(r,n))})),e.previewMode="ASSIGNMENT_ID_NOT_AVAILABLE"==e.assignmentId,e.outsideTurk=!e.previewMode&&""===e.hitId&&""==e.assignmentId&&""==e.workerId,e}var we=Object.freeze({__proto__:null,submitToTurk:function(e){var t=ge(),r=t.assignmentId,n=t.turkSubmitTo;if(r&&n){var i=document.createElement("form");for(var a in i.method="POST",i.action=n+"/mturk/externalSubmit?assignmentId="+r,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()}},turkInfo:ge}),be=function(){function e(t,i,a,o){if(n(this,e),this.jsPsych=t,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"==r(s.data)&&"object"==r(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 a(e,[{key:"trial",value:function(){return void 0===this.timeline_parameters?T(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=[],r=0;r<e.timeline_variables.length;r++)t.push(r);void 0!==e.sample&&("custom"==e.sample.type?t=e.sample.fn(t):"with-replacement"==e.sample.type?t=pe(t,e.sample.size,e.sample.weights):"without-replacement"==e.sample.type?t=de(t,e.sample.size):"fixed-repetitions"==e.sample.type?t=ce(t,e.sample.size,!1):"alternate-groups"==e.sample.type?t=fe(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=he(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,r=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){r.call_immediate=!0;var n=t.conditional_function();if(r.call_immediate=!1,0==n)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?(r.call_immediate=!0,t.loop_function(this.generatedData())?(this.reset(),r.call_immediate=!1,this.parent_node.advance()):(e.done=!0,r.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){var t=this.findTimelineVariable(e);return void 0===t&&console.warn("Timeline variable "+e+" not found."),t}var r=Math.max(0,this.progress.current_location);r==this.timeline_parameters.timeline.length&&(r-=1);var n=this.timeline_parameters.timeline[r].timelineVariable(e);return void 0===n&&console.warn("Timeline variable "+e+" not found."),n}},{key:"allTimelineVariables",value:function(){for(var e=this.allTimelineVariablesNames(),t={},r=0;r<e.length;r++)t[e[r]]=this.timelineVariable(e[r]);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,r=0;r<this.timeline_parameters.timeline.length;r++)this.timeline_parameters.timeline[r].isComplete()&&(t+=this.timeline_parameters.timeline[r].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=[],r=0;r<this.timeline_parameters.timeline.length;r++){var n=this.timeline_parameters.timeline[r].trialsOfType(e);t=t.concat(n)}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 _e(e){return new Promise((function(t){return setTimeout(t,e)}))}var ke=function(){function i(e){var t,r,a,o,s,l,u;n(this,i),this.extensions={},this.turk=we,this.randomization=ye,this.utils=E,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,k(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 S(this),this.pluginAPI=(r=(t=this).getInitSettings(),a=k(new I(t.getDisplayContainerElement,r.case_sensitive_responses,r.minimum_valid_rt)),o=k(new R),s=k(new D(r.use_webaudio,t.webaudio_context)),l=k(new A),u=k(new N(t.getDisplayContainerElement,o.setTimeout)),Object.assign.apply(Object,[{}].concat([a,o,s,l,u])));var c,h=v(e.extensions);try{for(h.s();!(c=h.n()).done;){var f=c.value;this.extensions[f.type.info.name]=new f.type(this)}}catch(e){h.e(e)}finally{h.f()}this.pluginAPI.initAudio()}return a(i,[{key:"version",value:function(){return"7.3.4"}},{key:"run",value:function(e){return b(this,void 0,void 0,t().mark((function r(){return t().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 be(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()}}),r,this)})))}},{key:"simulate",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-only",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return b(this,void 0,void 0,t().mark((function i(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.simulation_mode=r,this.simulation_options=n,t.next=4,this.run(e);case 4:case"end":return t.stop()}}),i,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,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.current_trial_finished){var i;if(this.current_trial_finished=!0,void 0!==this.current_trial.css_classes&&Array.isArray(this.current_trial.css_classes))(i=this.DOM_target.classList).remove.apply(i,d(this.current_trial.css_classes));this.data.write(n);var a=this.data.getLastTrialData().values()[0],o=this.current_trial;if("object"===r(o.save_trial_parameters))for(var s=0,l=Object.keys(o.save_trial_parameters);s<l.length;s++){var u=l[s],c=o.save_trial_parameters[u];!0===c&&(void 0===o[u]?console.warn('Invalid parameter specified in save_trial_parameters. Trial has no property called "'.concat(u,'".')):"function"==typeof o[u]?a[u]=o[u].toString():a[u]=o[u]),!1===c&&"internal_node_id"!==u&&"trial_index"!==u&&delete a[u]}var h=(null!==(e=o.extensions)&&void 0!==e?e:[]).map((function(e){return t.extensions[e.type.info.name].on_finish(e.params)})),f=function(){t.internal.call_immediate=!0,"function"==typeof o.on_finish&&o.on_finish(a),t.opts.on_trial_finish(a),t.opts.on_data_update(a),t.internal.call_immediate=!1,"data-only"===t.simulation_mode?t.nextTrial():null===r(o.post_trial_gap)||void 0===o.post_trial_gap?t.opts.default_iti>0?setTimeout(t.nextTrial,t.opts.default_iti):t.nextTrial():o.post_trial_gap>0?setTimeout(t.nextTrial,o.post_trial_gap):t.nextTrial()};if(h.some((function(e){return"function"==typeof e.then})))Promise.all(h.map((function(e){return Promise.resolve(e).then((function(e){Object.assign(a,e)}))}))).then(f);else{var p,m=v(h);try{for(m.s();!(p=m.n()).done;){var y=p.value;Object.assign(a,y)}}catch(e){m.e(e)}finally{m.f()}f()}}}},{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,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.internal.call_immediate||!0===r?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 b(this,void 0,void 0,t().mark((function e(){var r,n;return t().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===(r=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%",r.display_element=document.querySelector("body")):null===(n=r.display_element instanceof Element?r.display_element:document.querySelector("#"+r.display_element))?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):r.display_element=n,r.display_element.innerHTML='<div class="jspsych-content-wrapper"><div id="jspsych-content"></div></div>',this.DOM_container=r.display_element,this.DOM_target=document.querySelector("#jspsych-content"),null!==r.experiment_width&&(this.DOM_target.style.width=r.experiment_width+"px"),r.display_element.tabIndex=0,-1===r.display_element.className.indexOf("jspsych-display-element")&&(r.display_element.className+=" jspsych-display-element"),this.DOM_target.className+="jspsych-content",this.data.createInteractionListeners(),window.addEventListener("beforeunload",r.on_close);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"loadExtensions",value:function(e){return b(this,void 0,void 0,t().mark((function r(){var n=this;return t().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()}}),r,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()),r=function(){void 0!==e.timeline.end_message&&(e.DOM_target.innerHTML=e.timeline.end_message),e.resolveFinishedPromise()};t?Promise.resolve(t).then(r):r()}},{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,r=this;if(this.current_trial=e,this.current_trial_finished=!1,this.evaluateTimelineVariables(e),"string"==typeof e.type)throw new x("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({},k(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 n,i=v(e.extensions);try{for(i.s();!(n=i.n()).done;){var a=n.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,d(e.css_classes)));var o,s,l,u=function(){if("function"==typeof e.on_load&&e.on_load(),Array.isArray(e.extensions)){var t,n=v(e.extensions);try{for(n.s();!(t=n.n()).done;){var i=t.value;r.extensions[i.type.info.name].on_load(i.params)}}catch(e){n.e(e)}finally{n.f()}}};this.simulation_mode||(o=e.type.trial(this.DOM_target,e,u)),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),l=this.utils.deepMerge(this.simulation_options.default,s),l=this.utils.deepCopy(l),o=!1===(null==(l=this.replaceFunctionsWithValues(l,null))?void 0:l.simulate)?e.type.trial(this.DOM_target,e,u):e.type.simulate(e,(null==l?void 0:l.mode)||this.simulation_mode,l,u)):o=e.type.trial(this.DOM_target,e,u)),o&&"function"==typeof o.then||this.simulation_mode&&(!this.simulation_mode||!1!==(null==l?void 0:l.simulate))||u(),this.internal.call_immediate=!1}},{key:"evaluateTimelineVariables",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];"object"===r(e[i])&&null!==e[i]&&void 0!==e[i].timelineVariablePlaceholder&&(e[i]=e[i].timelineVariableFunction()),"object"===r(e[i])&&null!==e[i]&&"timeline"!==i&&"timeline_variables"!==i&&this.evaluateTimelineVariables(e[i])}}},{key:"evaluateFunctionParameters",value:function(t){this.internal.call_immediate=!0;for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];"type"!==i&&(void 0!==M[i]&&M[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(t,n){if(null===t)return t;if(Array.isArray(t))for(var i=0;i<t.length;i++)t[i]=this.replaceFunctionsWithValues(t[i],n);else if("object"===r(t))if(null!==n&&n.nested)for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];"object"===r(n.nested[s])&&n.nested[s].type!==e.ParameterType.FUNCTION&&(t[s]=this.replaceFunctionsWithValues(t[s],n.nested[s]))}else for(var l=0,u=Object.keys(t);l<u.length;l++){var c=u[l];"type"!==c&&"timeline"!==c&&"timeline_variables"!==c&&(t[c]=this.replaceFunctionsWithValues(t[c],null))}else if("function"==typeof t)return t();return t}},{key:"setDefaultValues",value:function(t){var r=function(r){t.type.info.parameters[r].type===e.ParameterType.COMPLEX?(void 0===t[r]&&t.type.info.parameters[r].default&&(t[r]=t.type.info.parameters[r].default),!0===t.type.info.parameters[r].array&&Array.isArray(t[r])&&t[r].forEach((function(e,n){for(var i in t.type.info.parameters[r].nested)void 0!==t[r][n][i]&&null!==t[r][n][i]||(void 0===t.type.info.parameters[r].nested[i].default?console.error("You must specify a value for the ".concat(i," parameter (nested in the ").concat(r," parameter) in the ").concat(t.type.info.name," plugin.")):t[r][n][i]=t.type.info.parameters[r].nested[i].default)}))):void 0!==t[r]&&null!==t[r]||(void 0===t.type.info.parameters[r].default?console.error("You must specify a value for the ".concat(r," parameter in the ").concat(t.type.info.name," plugin.")):t[r]=t.type.info.parameters[r].default)};for(var n in t.type.info.parameters)r(n)}},{key:"checkExclusions",value:function(e){return b(this,void 0,void 0,t().mark((function r(){var n,i;return t().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,i=e.min_height||0,!(window.innerWidth<n||window.innerHeight<i)){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 "+i+"px. Your current height is "+window.innerHeight+"px.</p>";case 6:if(!(window.innerWidth<n||window.innerHeight<i)){t.next=11;break}return t.next=9,_e(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()}}),r,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}}]),i}();return"undefined"!=typeof window&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext),e.JsPsych=ke,e.initJsPsych=function(e){var t=new ke(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=f(e,2),r=t[0],n=t[1];return[r,{get:function(){throw new x(n)}}]})))),t},e.universalPluginParameters=M,e}({}),initJsPsych=jsPsychModule.initJsPsych;
|
|
2
|
-
|
|
1
|
+
var jsPsychModule=function(E){"use strict";var we=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function O(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}const ve=r=>{const e=new Set;do for(const t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};var Pe=(r,{include:e,exclude:t}={})=>{const i=n=>{const l=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(l):t?!t.some(l):!0};for(const[n,l]of ve(r.constructor.prototype)){if(l==="constructor"||!i(l))continue;const o=Reflect.getOwnPropertyDescriptor(n,l);o&&typeof o.value=="function"&&(r[l]=r[l].bind(r))}return r},A=O(Pe),Ee={name:"jspsych",version:"8.0.0",description:"Behavioral experiments in a browser",type:"module",main:"dist/index.cjs",exports:{".":{import:"./dist/index.js",require:"./dist/index.cjs"},"./css/*":"./css/*"},typings:"dist/index.d.ts",unpkg:"dist/index.browser.min.js",files:["src","dist","css"],source:"src/index.ts",scripts:{test:"jest","test:watch":"npm test -- --watch",tsc:"tsc","build:js":"rollup --config","build:styles":"webpack-cli",build:"run-p build:js build:styles","build:watch":'run-p "build:js -- --watch" "build:styles watch"',prepack:"cp ../../README.md ."},repository:{type:"git",url:"git+https://github.com/jspsych/jsPsych.git",directory:"packages/jspsych"},author:"Josh de Leeuw",license:"MIT",bugs:{url:"https://github.com/jspsych/jsPsych/issues"},homepage:"https://www.jspsych.org",dependencies:{"auto-bind":"^4.0.0","random-words":"^1.1.1",seedrandom:"^3.0.5","type-fest":"^2.9.0"},devDependencies:{"@fontsource/open-sans":"4.5.3","@jspsych/config":"^3.0.0","@types/dom-mediacapture-record":"^1.0.11","base64-inline-loader":"^2.0.1","css-loader":"^6.6.0","mini-css-extract-plugin":"^2.5.3","npm-run-all":"^4.1.5","replace-in-file-webpack-plugin":"^1.0.6",sass:"^1.43.5","sass-loader":"^12.4.0",webpack:"^5.76.0","webpack-cli":"^4.9.2","webpack-remove-empty-scripts":"^0.7.2"}},K=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});class _{constructor(e,t){this.dependencies=e,this.extensionsConfiguration=t,this.extensions=Object.fromEntries(t.map(i=>[_.getExtensionNameByClass(i.type),this.dependencies.instantiateExtension(i.type)]))}static getExtensionNameByClass(e){return e.info.name}getExtensionInstanceByClass(e){return this.extensions[_.getExtensionNameByClass(e)]}initializeExtensions(){return K(this,null,function*(){yield Promise.all(this.extensionsConfiguration.map(({type:e,params:t={}})=>this.getExtensionInstanceByClass(e).initialize(t)))})}onStart(e=[]){var t;for(const{type:i,params:n}of e)(t=this.getExtensionInstanceByClass(i))==null||t.on_start(n)}onLoad(e=[]){var t;for(const{type:i,params:n}of e)(t=this.getExtensionInstanceByClass(i))==null||t.on_load(n)}onFinish(){return K(this,arguments,function*(e=[]){const t=yield Promise.all(e.map(({type:n,params:l})=>{var o;return Promise.resolve((o=this.getExtensionInstanceByClass(n))==null?void 0:o.on_finish(l))})),i=e.length?{extension_type:t.map(n=>n.extension_type),extension_version:t.map(n=>n.extension_version)}:{};return t.push(i),Object.assign({},...t)})}}function k(r){return[...new Set(r)]}function f(r){if(!r)return r;let e;if(Array.isArray(r)){e=[];for(const t of r)e.push(f(t));return e}else if(typeof r=="object"&&r!==null){e={};for(const t in r)r.hasOwnProperty(t)&&(e[t]=f(r[t]));return e}else return r}function x(r,e){let t={};for(const i in r)r.hasOwnProperty(i)&&(typeof r[i]=="object"&&e.hasOwnProperty(i)?t[i]=x(r[i],e[i]):t[i]=r[i]);for(const i in e)e.hasOwnProperty(i)&&(t.hasOwnProperty(i)&&typeof e[i]=="object"?t[i]=x(t[i],e[i]):t[i]=e[i]);return t}var _e=Object.freeze({__proto__:null,unique:k,deepCopy:f,deepMerge:x});class I{constructor(e=[]){this.values=e}sum(){let e=0;for(const t of this.values)e+=t;return e}mean(){let e=0,t=0;for(const i of this.values)typeof i!="undefined"&&i!==null&&(e+=i,t++);if(t!==0)return e/t}median(){if(this.values.length===0)return;const e=this.values.slice(0).sort(function(i,n){return i-n}),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)typeof e[t]=="undefined"?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 I(t)}}function ke(r,e){const t=new Blob([r],{type:"text/plain"});let i="";typeof window.webkitURL!="undefined"?i=window.webkitURL.createObjectURL(t):i=window.URL.createObjectURL(t);const n=document.createElement("a");n.id="jspsych-download-as-text-link",n.style.display="none",n.download=e,n.href=i,n.click()}function xe(r){const e=typeof r!="object"?JSON.parse(r):r;let t="",i="";const n=[];for(const l of e)for(const o in l){let a=o+"";a='"'+a.replace(/"/g,'""')+'",',n.includes(o)||(n.push(o),t+=a)}t=t.slice(0,-1),i+=t+`\r
|
|
2
|
+
`;for(const l of e){t="";for(const o of n){let a=typeof l[o]=="undefined"?"":l[o];typeof a=="object"&&(a=JSON.stringify(a));const s=a+"";t+='"'+s.replace(/"/g,'""')+'",'}t=t.slice(0,-1),i+=t+`\r
|
|
3
|
+
`}return i}function Te(){const r=window.location.search.substr(1).split("&"),e={};for(let t=0;t<r.length;++t){const i=r[t].split("=",2);i.length==1?e[i[0]]="":e[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return e}class p{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 p([this.trials[this.trials.length-1]])}first(e=1){if(e<1)throw`You must query with a positive nonzero integer. Please use a
|
|
4
|
+
different value for n.`;return this.trials.length===0?new p:(e>this.trials.length&&(e=this.trials.length),new p(this.trials.slice(0,e)))}last(e=1){if(e<1)throw`You must query with a positive nonzero integer. Please use a
|
|
5
|
+
different value for n.`;return this.trials.length===0?new p:(e>this.trials.length&&(e=this.trials.length),new p(this.trials.slice(this.trials.length-e,this.trials.length)))}values(){return this.trials}count(){return this.trials.length}readOnly(){return new p(f(this.trials))}addToAll(e){for(const t of this.trials)Object.assign(t,e);return this}addToLast(e){return this.trials.length>0&&Object.assign(this.trials[this.trials.length-1],e),this}filter(e){let t;Array.isArray(e)?t=f(e):t=f([e]);const i=[];for(const n of this.trials){let l=!1;for(const o of t){let a=!0;for(const s of Object.keys(o))typeof n[s]!="undefined"&&n[s]===o[s]||(a=!1);if(a){l=!0;break}}l&&i.push(n)}return new p(i)}filterCustom(e){return new p(this.trials.filter(e))}filterColumns(e){return new p(this.trials.map(t=>Object.fromEntries(e.filter(i=>i in t).map(i=>[i,t[i]]))))}select(e){const t=[];for(const i of this.trials)typeof i[e]!="undefined"&&t.push(i[e]);return new I(t)}ignore(e){Array.isArray(e)||(e=[e]);const t=f(this.trials);for(const i of t)for(const n of e)delete i[n];return new p(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 xe(this.trials)}json(e=!1){return e?JSON.stringify(this.trials,null," "):JSON.stringify(this.trials)}localSave(e,t){e=e.toLowerCase();let i;if(e==="json")i=this.json();else if(e==="csv")i=this.csv();else throw new Error('Invalid format specified for localSave. Must be "json" or "csv".');ke(i,t)}}var je=Object.defineProperty,U=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,F=(r,e,t)=>e in r?je(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ie=(r,e)=>{for(var t in e||(e={}))Oe.call(e,t)&&F(r,t,e[t]);if(U)for(var t of U(e))Ae.call(e,t)&&F(r,t,e[t]);return r};class Le{constructor(e){this.dependencies=e,this.dataProperties={},this.interactionListeners={blur:()=>{this.addInteractionRecord("blur")},focus:()=>{this.addInteractionRecord("focus")},fullscreenchange:()=>{this.addInteractionRecord(document.isFullScreen||document.webkitIsFullScreen||document.mozIsFullScreen||document.fullscreenElement?"fullscreenenter":"fullscreenexit")}},this.reset()}reset(){this.results=new p,this.resultToTrialMap=new WeakMap,this.interactionRecords=new p}get(){return this.results}getInteractionData(){return this.interactionRecords}write(e){const t=e.getResult();Object.assign(t,this.dataProperties),this.results.push(t),this.resultToTrialMap.set(t,e)}addProperties(e){this.results.addToAll(e),this.dataProperties=Object.assign({},this.dataProperties,e)}addDataToLastTrial(e){this.results.addToLast(e)}getLastTrialData(){return this.results.top()}getLastTimelineData(){const e=this.getLastTrialData().values()[0];return new p(e?this.resultToTrialMap.get(e).parent.getResults():[])}displayData(e="json"){e=e.toLowerCase(),e!=="json"&&e!=="csv"&&(console.log("Invalid format declared for displayData function. Using json as default."),e="json");const t=document.createElement("pre");t.id="jspsych-data-display",t.textContent=e==="json"?this.results.json(!0):this.results.csv(),this.dependencies.getDisplayElement().replaceChildren(t)}urlVariables(){return typeof this.query_string=="undefined"&&(this.query_string=Te()),this.query_string}getURLVariable(e){return this.urlVariables()[e]}addInteractionRecord(e){const t=Ie({event:e},this.dependencies.getProgress());this.interactionRecords.push(t),this.dependencies.onInteractionRecordAdded(t)}createInteractionListeners(){window.addEventListener("blur",this.interactionListeners.blur),window.addEventListener("focus",this.interactionListeners.focus),document.addEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.addEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}removeInteractionListeners(){window.removeEventListener("blur",this.interactionListeners.blur),window.removeEventListener("focus",this.interactionListeners.focus),document.removeEventListener("fullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("mozfullscreenchange",this.interactionListeners.fullscreenchange),document.removeEventListener("webkitfullscreenchange",this.interactionListeners.fullscreenchange)}}class Ce{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,A(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)?!1:e==="ALL_KEYS"?!0:e==="NO_KEYS"?!1:e.includes(i)}getKeyboardResponse({callback_function:e,valid_responses:t="ALL_KEYS",rt_method:i="performance",persist:n,audio_context:l,audio_context_start_time:o,allow_held_key:a=!1,minimum_valid_rt:s=this.minimumValidRt}){i!=="performance"&&i!=="audio"&&(console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "performance" method.'),i="performance");const u=i==="performance"?performance.now():o*1e3;this.registerRootListeners(),!this.areResponsesCaseSensitive&&typeof t!="string"&&(t=t.map(d=>d.toLowerCase()));const c=d=>{const h=Math.round((i=="performance"?performance.now():l.currentTime*1e3)-u);if(h<s)return;const y=this.toLowerCaseIfInsensitive(d.key);this.isResponseValid(t,a,y)&&(d.preventDefault(),n||this.cancelKeyboardResponse(c),e({key:d.key,rt:h}))};return this.listeners.add(c),c}cancelKeyboardResponse(e){this.listeners.delete(e)}cancelAllKeyboardResponses(){this.listeners.clear()}compareKeys(e,t){if(typeof e!="string"&&e!==null||typeof t!="string"&&t!==null){console.error("Error in jsPsych.pluginAPI.compareKeys: arguments must be key strings or null.");return}return typeof e=="string"&&typeof t=="string"?this.areResponsesCaseSensitive?e===t:e.toLowerCase()===t.toLowerCase():e===null&&t===null}}var g=(r=>(r[r.BOOL=0]="BOOL",r[r.STRING=1]="STRING",r[r.INT=2]="INT",r[r.FLOAT=3]="FLOAT",r[r.FUNCTION=4]="FUNCTION",r[r.KEY=5]="KEY",r[r.KEYS=6]="KEYS",r[r.SELECT=7]="SELECT",r[r.HTML_STRING=8]="HTML_STRING",r[r.IMAGE=9]="IMAGE",r[r.AUDIO=10]="AUDIO",r[r.VIDEO=11]="VIDEO",r[r.OBJECT=12]="OBJECT",r[r.COMPLEX=13]="COMPLEX",r[r.TIMELINE=14]="TIMELINE",r))(g||{}),L=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});class T{constructor(e,t={useWebAudio:!1}){this.src=e,this.useWebAudio=t.useWebAudio,this.audioContext=t.audioContext||null}load(){return L(this,null,function*(){this.useWebAudio?this.webAudioBuffer=yield this.preloadWebAudio(this.src):this.audio=yield this.preloadHTMLAudio(this.src)})}play(){this.audio instanceof HTMLAudioElement?this.audio.play():(this.audio||(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.start())}stop(){this.audio instanceof HTMLAudioElement?(this.audio.pause(),this.audio.currentTime=0):(this.audio.stop(),this.audio=this.getAudioSourceNode(this.webAudioBuffer))}addEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.addEventListener(e,t)}removeEventListener(e,t){!this.audio&&this.webAudioBuffer&&(this.audio=this.getAudioSourceNode(this.webAudioBuffer)),this.audio.removeEventListener(e,t)}getAudioSourceNode(e){const t=this.audioContext.createBufferSource();return t.buffer=e,t.connect(this.audioContext.destination),t}preloadWebAudio(e){return L(this,null,function*(){const t=yield(yield fetch(e)).arrayBuffer(),i=yield this.audioContext.decodeAudioData(t),n=this.audioContext.createBufferSource();return n.buffer=i,n.connect(this.audioContext.destination),i})}preloadHTMLAudio(e){return L(this,null,function*(){return new Promise((t,i)=>{const n=new Audio(e);n.addEventListener("canplaythrough",()=>{t(n)}),n.addEventListener("error",l=>{i(l)}),n.addEventListener("abort",l=>{i(l)})})})}}var Se=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});const G=[g.AUDIO,g.IMAGE,g.VIDEO];class Me{constructor(e){this.useWebaudio=e,this.video_buffers={},this.context=null,this.audio_buffers=[],this.preload_requests=[],this.img_cache={},this.preloadMap=new Map,this.microphone_recorder=null,this.camera_stream=null,this.camera_recorder=null,this.useWebaudio&&typeof window!="undefined"&&typeof window.AudioContext!="undefined"&&(this.context=new AudioContext)}getVideoBuffer(e){return e.startsWith("blob:")&&(this.video_buffers[e]=e),this.video_buffers[e]}audioContext(){return this.context&&this.context.state!=="running"&&this.context.resume(),this.context}getAudioPlayer(e){return Se(this,null,function*(){return this.audio_buffers[e]instanceof T?this.audio_buffers[e]:(this.audio_buffers[e]=new T(e,{useWebAudio:this.useWebaudio,audioContext:this.context}),yield this.audio_buffers[e].load(),this.audio_buffers[e])})}preloadAudio(e,t=()=>{},i=l=>{},n=l=>{}){e=k(e.flat());let l=0;if(e.length==0){t();return}for(const o of e)this.audio_buffers[o]instanceof T?(l++,i(o),l==e.length&&t()):(this.audio_buffers[o]=new T(o,{useWebAudio:this.useWebaudio,audioContext:this.context}),this.audio_buffers[o].load().then(()=>{l++,i(o),l==e.length&&t()}).catch(a=>{n(a)}))}preloadImages(e,t=()=>{},i=l=>{},n=l=>{}){e=k(e.flat());var l=0;if(e.length===0){t();return}for(let o=0;o<e.length;o++){const a=new Image,s=e[o];a.onload=()=>{l++,i(s),l===e.length&&t()},a.onerror=u=>{n({source:s,error:u})},a.src=s,this.img_cache[s]=a,this.preload_requests.push(a)}}preloadVideo(e,t=()=>{},i=l=>{},n=l=>{}){e=k(e.flat());let l=0;if(e.length===0){t();return}for(const o of e){const a=this.video_buffers,s=new XMLHttpRequest;s.open("GET",o,!0),s.responseType="blob",s.onload=()=>{if(s.status===200||s.status===0){const u=s.response;a[o]=URL.createObjectURL(u),l++,i(o),l===e.length&&t()}},s.onerror=u=>{let c=u;s.status==404&&(c="404"),n({source:o,error:c})},s.onloadend=u=>{s.status==404&&n({source:o,error:"404"})},s.send(),this.preload_requests.push(s)}}getAutoPreloadList(e){const t=Object.fromEntries(G.map(n=>[n,new Set])),i=(n,l)=>{var o,a,s,u;if(typeof n.timeline!="undefined")for(const c of n.timeline)i(c,(o=n.type)!=null?o:l);else if((s=(a=n.type)!=null?a:l)!=null&&s.info){const{name:c,parameters:d}=((u=n.type)!=null?u:l).info;this.preloadMap.has(c)||this.preloadMap.set(c,Object.fromEntries(Object.entries(d).filter(([h,{type:y,preload:P}])=>G.includes(y)&&(P!=null?P:!0)).map(([h,{type:y}])=>[h,y])));for(const[h,y]of Object.entries(this.preloadMap.get(c))){const P=n[h],ye=t[y];if(typeof P=="string")ye.add(P);else if(Array.isArray(P))for(const be of P.flat())typeof be=="string"&&ye.add(be)}}};return i({timeline:e}),{images:[...t[g.IMAGE]],audio:[...t[g.AUDIO]],video:[...t[g.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}initializeCameraRecorder(e,t){this.camera_stream=e;const i=new MediaRecorder(e,t);this.camera_recorder=i}getCameraStream(){return this.camera_stream}getCameraRecorder(){return this.camera_recorder}}var Ne=Object.defineProperty,W=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,Y=(r,e,t)=>e in r?Ne(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,J=(r,e)=>{for(var t in e||(e={}))Re.call(e,t)&&Y(r,t,e[t]);if(W)for(var t of W(e))De.call(e,t)&&Y(r,t,e[t]);return r};class Ve{constructor(e,t){this.getDisplayContainerElement=e,this.setJsPsychTimeout=t}dispatchEvent(e){this.getDisplayContainerElement().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?this.setJsPsychTimeout(()=>{this.keyDown(e),this.keyUp(e)},t):(this.keyDown(e),this.keyUp(e))}clickTarget(e,t=0){t>0?this.setJsPsychTimeout(()=>{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?this.setJsPsychTimeout(()=>{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(e=="NO_KEYS")i=null;else if(e=="ALL_KEYS")i=t[Math.floor(Math.random()*t.length)];else{const n=e.flat();i=n[Math.floor(Math.random()*n.length)]}return i}mergeSimulationData(e,t){return J(J({},e),t==null?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&&e.choices=="NO_KEYS"&&(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 ze{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=[]}}function Be(r){const e=r.getInitSettings(),t=new Ce(r.getDisplayContainerElement,e.case_sensitive_responses,e.minimum_valid_rt),i=new ze,n=new Me(e.use_webaudio),l=new Ve(r.getDisplayContainerElement,i.setTimeout.bind(i));return Object.assign({},...[t,i,n,l].map(o=>A(o)))}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 H(r){function e(){return r&&r.maxLength>1?t():i()}function t(){for(var c=!1,d;!c;)d=i(),d.length<=r.maxLength&&(c=!0);return d}function i(){return C[n(C.length)]}function n(c){return Math.floor(Math.random()*c)}if(typeof r=="undefined")return e();typeof r=="number"&&(r={exactly:r}),r.exactly&&(r.min=r.exactly,r.max=r.exactly),typeof r.wordsPerString!="number"&&(r.wordsPerString=1),typeof r.formatter!="function"&&(r.formatter=c=>c),typeof r.separator!="string"&&(r.separator=" ");for(var l=r.min+n(r.max+1-r.min),o=[],a="",s=0,u=0;u<l*r.wordsPerString;u++)s===r.wordsPerString-1?a+=r.formatter(e(),s):a+=r.formatter(e(),s)+r.separator,s++,(u+1)%r.wordsPerString===0&&(o.push(a),a="",s=0);return typeof r.join=="string"&&(o=o.join(r.join)),o}var qe=H;H.wordList=C;var $e=O(qe),S={exports:{}};S.exports,function(r){(function(e,t,i){function n(s){var u=this,c=a();u.next=function(){var d=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=d-(u.c=d|0)},u.c=1,u.s0=c(" "),u.s1=c(" "),u.s2=c(" "),u.s0-=c(s),u.s0<0&&(u.s0+=1),u.s1-=c(s),u.s1<0&&(u.s1+=1),u.s2-=c(s),u.s2<0&&(u.s2+=1),c=null}function l(s,u){return u.c=s.c,u.s0=s.s0,u.s1=s.s1,u.s2=s.s2,u}function o(s,u){var c=new n(s),d=u&&u.state,h=c.next;return h.int32=function(){return c.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,d&&(typeof d=="object"&&l(d,c),h.state=function(){return l(c,{})}),h}function a(){var s=4022871197,u=function(c){c=String(c);for(var d=0;d<c.length;d++){s+=c.charCodeAt(d);var h=.02519603282416938*s;s=h>>>0,h-=s,h*=s,s=h>>>0,h-=s,s+=h*4294967296}return(s>>>0)*23283064365386963e-26};return u}t&&t.exports?t.exports=o:i&&i.amd?i(function(){return o}):this.alea=o})(we,r,!1)}(S);var Ke=S.exports,Ue=O(Ke),Fe=Object.defineProperty,Ge=Object.defineProperties,We=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Q=(r,e,t)=>e in r?Fe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,He=(r,e)=>{for(var t in e||(e={}))Ye.call(e,t)&&Q(r,t,e[t]);if(X)for(var t of X(e))Je.call(e,t)&&Q(r,t,e[t]);return r},Xe=(r,e)=>Ge(r,We(e));function Qe(r=Math.random().toString()){return Math.random=Ue(r),r}function M(r,e,t=!1){const i=Array.isArray(r),n=Array.isArray(e);if(!i)n?(e=[e[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.")):(r=[r],e=[e]);else if(n){if(r.length!=e.length)if(console.warn("Unclear parameters given to randomization.repeat. Items and repetitions are unequal lengths. Behavior may not be as expected."),e.length<r.length){let a=[];for(let s=0;s<r.length;s++)a.push(e);e=a}else e=e.slice(0,r.length)}else{let a=[];for(let s=0;s<r.length;s++)a.push(e);e=a}let l=[];for(let a=0;a<r.length;a++)for(let s=0;s<e[a];s++)r[a]==null||typeof r[a]!="object"?l.push(r[a]):l.push(Object.assign({},r[a]));let o=b(l);return t&&(o=ot(o)),o}function b(r){Array.isArray(r)||console.error("Argument to shuffle() must be an array.");const e=r.slice(0);let t=e.length,i,n;for(;t;)n=Math.floor(Math.random()*t--),i=e[t],e[t]=e[n],e[n]=i;return e}function Ze(r,e){Array.isArray(r)||console.error("First argument to shuffleNoRepeats() must be an array."),typeof e!="undefined"&&typeof e!="function"&&console.error("Second argument to shuffleNoRepeats() must be a function."),typeof e=="undefined"&&(e=function(i,n){return i===n});const t=b(r);for(let i=0;i<t.length-1;i++)if(e(t[i],t[i+1])){let n=Math.floor(Math.random()*(t.length-2))+1;for(;e(t[i+1],t[n])||e(t[i+1],t[n+1])||e(t[i+1],t[n-1])||e(t[i],t[n]);)n=Math.floor(Math.random()*(t.length-2))+1;const l=t[n];t[n]=t[i+1],t[i+1]=l}return t}function Z(r,e=!1){const t=r.length;if(t==1)return console.warn("shuffleAlternateGroups() was called with only one group. Defaulting to simple shuffle."),b(r[0]);let i=[];for(let a=0;a<t;a++)i.push(a);e&&(i=b(i));const n=[];let l=null;for(let a=0;a<t;a++)l=l===null?r[a].length:Math.min(l,r[a].length),n.push(b(r[a]));const o=[];for(let a=0;a<l;a++)for(let s=0;s<i.length;s++)o.push(n[i[s]][a]);return o}function ee(r,e){return Array.isArray(r)||console.error("First argument to sampleWithoutReplacement() must be an array"),e>r.length&&console.error("Cannot take a sample larger than the size of the set of items to sample."),b(r).slice(0,e)}function te(r,e,t){Array.isArray(r)||console.error("First argument to sampleWithReplacement() must be an array");const i=[];if(typeof t!="undefined"){t.length!==r.length&&console.error("The length of the weights array must equal the length of the array to be sampled from.");let o=0;for(const a of t)o+=a;for(const a of t)i.push(a/o)}else for(let o=0;o<r.length;o++)i.push(1/r.length);const n=[i[0]];for(let o=1;o<i.length;o++)n.push(i[o]+n[o-1]);const l=[];for(let o=0;o<e;o++){const a=Math.random();let s=0;for(;a>n[s];)s++;l.push(r[s])}return l}function et(r,e=1,t=!1){let i=[{}];for(const[n,l]of Object.entries(r)){const o=[];for(const a of l)for(const s of i)o.push(Xe(He({},s),{[n]:a}));i=o}return M(i,e,t)}function tt(r=32){let e="";const t="0123456789abcdefghjklmnopqrstuvwxyz";for(let i=0;i<r;i++)e+=t[Math.floor(Math.random()*t.length)];return e}function rt(r,e){if(e<r)throw new Error("Upper boundary must be greater than or equal to lower boundary");return r+Math.floor(Math.random()*(e-r+1))}function it(r){return Math.random()<=r?1:0}function N(r,e){return at()*e+r}function R(r){return-Math.log(Math.random())/r}function nt(r,e,t,i=!1){let n=N(r,e)+R(t);if(i)for(;n<=0;)n=N(r,e)+R(t);return n}function st(r){return $e(r)}function at(){for(var r=0,e=0;r===0;)r=Math.random();for(;e===0;)e=Math.random();return Math.sqrt(-2*Math.log(r))*Math.cos(2*Math.PI*e)}function ot(r){const e={};for(const t of r)for(const i of Object.keys(t))typeof e[i]=="undefined"&&(e[i]=[]),e[i].push(t[i]);return e}var lt=Object.freeze({__proto__:null,setSeed:Qe,repeat:M,shuffle:b,shuffleNoRepeats:Ze,shuffleAlternateGroups:Z,sampleWithoutReplacement:ee,sampleWithReplacement:te,factorial:et,randomID:tt,randomInt:rt,sampleBernoulli:it,sampleNormal:N,sampleExponential:R,sampleExGaussian:nt,randomWords:st});function re(){const r={previewMode:!1,outsideTurk:!1,hitId:"INVALID_URL_PARAMETER",assignmentId:"INVALID_URL_PARAMETER",workerId:"INVALID_URL_PARAMETER",turkSubmitTo:"INVALID_URL_PARAMETER"},e=function(i,n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const l="[\\?&]"+n+"=([^&#]*)",o=new RegExp(l).exec(i);return o==null?"":o[1]},t=e(window.location.href,"assignmentId")?window.location.href:document.referrer;return["assignmentId","hitId","workerId","turkSubmitTo"].map(function(i){r[i]=unescape(e(t,i))}),r.previewMode=r.assignmentId=="ASSIGNMENT_ID_NOT_AVAILABLE",r.outsideTurk=!r.previewMode&&r.hitId===""&&r.assignmentId==""&&r.workerId=="",r}function ut(r){const e=re(),t=e.assignmentId,i=e.turkSubmitTo;if(!t||!i)return;const n=document.createElement("form");n.method="POST",n.action=i+"/mturk/externalSubmit?assignmentId="+t;for(const l in r)if(r.hasOwnProperty(l)){const o=document.createElement("input");o.type="hidden",o.name=l,o.id=l,o.value=r[l],n.appendChild(o)}document.body.appendChild(n),n.submit()}var ct=Object.freeze({__proto__:null,turkInfo:re,submitToTurk:ut});class ht{constructor(e,t){this.containerElement=e,this.message=t,this._progress=0,this.setupElements()}setupElements(){this.messageSpan=document.createElement("span"),this.innerDiv=document.createElement("div"),this.innerDiv.id="jspsych-progressbar-inner",this.update();const e=document.createElement("div");e.id="jspsych-progressbar-outer",e.appendChild(this.innerDiv),this.containerElement.appendChild(this.messageSpan),this.containerElement.appendChild(e)}update(){this.innerDiv.style.width=this._progress*100+"%",typeof this.message=="function"?this.messageSpan.innerHTML=this.message(this._progress):this.messageSpan.innerHTML=this.message}set progress(e){if(typeof e!="number"||e<0||e>1)throw new Error("jsPsych.progressBar.progress must be a number between 0 and 1");this._progress=e,this.update()}get progress(){return this._progress}}class D{constructor(e){this.name=e}}const dt=["timeline","timeline_variables","name","repetitions","loop_function","conditional_function","randomize_order","sample","on_timeline_start","on_timeline_finish"];function pt(r){return!V(r)}function V(r){return Boolean(r.timeline)||Array.isArray(r)}var m=(r=>(r[r.PENDING=0]="PENDING",r[r.RUNNING=1]="RUNNING",r[r.PAUSED=2]="PAUSED",r[r.COMPLETED=3]="COMPLETED",r[r.ABORTED=4]="ABORTED",r))(m||{});class ie{constructor(){this.reset()}reset(){this.promise=new Promise(e=>{this.resolvePromise=e})}get(){return this.promise}resolve(e){this.resolvePromise(e),this.reset()}}function mt(r){return r&&typeof r.then=="function"}function ft(r){return new Promise(e=>setTimeout(e,r))}function ne([r,...e]){let t=r!=null?r:"";for(const i of e)t+=Number.isNaN(Number.parseInt(i))?`.${i}`:`[${i}]`;return t}function gt(r){return typeof r=="object"&&r!==null}class z{constructor(){this.cache=new Map}static lookupChild(e,t){let i=!1,n;return Number.isNaN(Number.parseInt(t))?Object.hasOwn(e,t)&&(i=!0,n=e[t]):Number.parseInt(t)<e.length&&(i=!0,n=e[t]),{doesPathExist:i,value:n}}get(e){return this.cache.get(e.join("."))}has(e){return this.cache.has(e.join("."))}initialize(e){this.rootObject=e,this.cache.set("",e)}reset(){this.cache.clear(),this.cache.set("",this.rootObject)}set(e,t){this.cache.set(e.join("."),t)}lookup(e){if(this.has(e))return{doesPathExist:!0,value:this.get(e)};const t=i=>{const n=i.slice(0,-1),l=i[i.length-1];if(!this.has(n)&&n.length>0&&!t(n).doesPathExist)return{doesPathExist:!1};const o=this.get(n);if(!gt(o))return{doesPathExist:!1};const a=z.lookupChild(o,l);return a.doesPathExist&&this.set(i,a.value),a};return t(e)}}var yt=Object.defineProperty,se=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,ae=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oe=(r,e)=>{for(var t in e||(e={}))bt.call(e,t)&&ae(r,t,e[t]);if(se)for(var t of se(e))wt.call(e,t)&&ae(r,t,e[t]);return r};class le{constructor(e){this.dependencies=e,this.status=m.PENDING,this.parameterValueCache=new z}getStatus(){return this.status}initializeParameterValueCache(){this.parameterValueCache.initialize(this.description)}resetParameterValueCache(){var e;this.parameterValueCache.reset(),(e=this.parent)==null||e.resetParameterValueCache()}getParameterValue(e,t={}){const{evaluateFunctions:i=!0,recursive:n=!0,cacheResult:l=!0,replaceResult:o}=t;typeof e=="string"&&(e=[e]);let{doesPathExist:a,value:s}=this.parameterValueCache.lookup(e);return!a&&n&&this.parent&&(s=this.parent.getParameterValue(e,t)),typeof s=="function"&&i&&(s=s()),s instanceof D&&(s=this.evaluateTimelineVariable(s)),typeof o=="function"&&(s=o(s)),l&&this.parameterValueCache.set(e,s),s}getDataParameter(){var e;const t=this.getParameterValue("data",{recursive:!1});return oe(oe({},Object.fromEntries(typeof t=="object"?Object.keys(t).map(i=>[i,this.getParameterValue(["data",i])]):[])),(e=this.parent)==null?void 0:e.getDataParameter())}}var vt=Object.defineProperty,Pt=Object.defineProperties,Et=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,ce=(r,e,t)=>e in r?vt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,B=(r,e)=>{for(var t in e||(e={}))_t.call(e,t)&&ce(r,t,e[t]);if(ue)for(var t of ue(e))kt.call(e,t)&&ce(r,t,e[t]);return r},xt=(r,e)=>Pt(r,Et(e)),q=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});class j extends le{constructor(e,t,i){super(e),this.description=t,this.parent=i,this.onLoad=()=>{this.runParameterCallback("on_load"),this.dependencies.runOnLoadExtensionCallbacks(this.getParameterValue("extensions"))},this.initializeParameterValueCache(),this.trialObject=f(t),this.pluginClass=this.getParameterValue("type",{evaluateFunctions:!1}),this.pluginInfo=this.pluginClass.info,!("version"in this.pluginInfo)&&!("data"in this.pluginInfo)?console.warn(this.pluginInfo.name,"is missing the 'version' and 'data' fields. Please update plugin as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):"version"in this.pluginInfo?"data"in this.pluginInfo||console.warn(this.pluginInfo.name,"is missing the 'data' field. Please update plugin as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details."):console.warn(this.pluginInfo.name,"is missing the 'version' field. Please update plugin as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/plugin-development/ for more details.")}run(){return q(this,null,function*(){var e;this.status=m.RUNNING,this.processParameters(),this.onStart(),this.addCssClasses(),this.pluginInstance=this.dependencies.instantiatePlugin(this.pluginClass),this.result=this.processResult(yield this.executeTrial()),this.dependencies.onTrialResultAvailable(this),this.status=m.COMPLETED,yield this.onFinish(),this.removeCssClasses();const t=(e=this.getParameterValue("post_trial_gap"))!=null?e:this.dependencies.getDefaultIti();t!==0&&this.dependencies.getSimulationMode()!=="data-only"&&(yield ft(t)),this.resetParameterValueCache()})}executeTrial(){return q(this,null,function*(){const e=this.dependencies.finishTrialPromise.get();let t=!1;e.then(()=>{t=!0});const{trialReturnValue:i,hasTrialBeenSimulated:n}=this.invokeTrialMethod();let l;return mt(i)?(l=yield Promise.race([i,e]),t&&(l=yield e)):(n||this.onLoad(),l=yield e),this.cleanupTrial(),l})}invokeTrialMethod(){var e;const t=this.dependencies.getSimulationMode();if(t&&typeof this.pluginInstance.simulate=="function"){const i=this.getSimulationOptions();if(i.simulate!==!1)return{hasTrialBeenSimulated:!0,trialReturnValue:this.pluginInstance.simulate(this.trialObject,(e=i.mode)!=null?e:t,i,this.onLoad)}}return{hasTrialBeenSimulated:!1,trialReturnValue:this.pluginInstance.trial(this.dependencies.getDisplayElement(),this.trialObject,this.onLoad)}}cleanupTrial(){this.dependencies.clearAllTimeouts(),this.dependencies.getDisplayElement().innerHTML=""}addCssClasses(){const e=this.getParameterValue("css_classes"),t=this.dependencies.getDisplayElement().classList;typeof e=="string"?t.add(e):Array.isArray(e)&&t.add(...e)}removeCssClasses(){const e=this.getParameterValue("css_classes");e&&this.dependencies.getDisplayElement().classList.remove(...typeof e=="string"?[e]:e)}processResult(e){var t;e||(e={});for(const[n,l]of Object.entries((t=this.getParameterValue("save_trial_parameters"))!=null?t:{}))if(this.pluginInfo.parameters[n])if(l&&!Object.hasOwn(e,n)){let o=this.trialObject[n];typeof o=="function"&&(o=o.toString()),e[n]=o}else!l&&Object.hasOwn(e,n)&&delete e[n];else console.warn(`Non-existent parameter "${n}" specified in save_trial_parameters.`);e=xt(B(B({},this.getDataParameter()),e),{trial_type:this.pluginInfo.name,trial_index:this.index,plugin_version:this.pluginInfo.version?this.pluginInfo.version:null});const i=this.getParameterValue("save_timeline_variables");return i===!0?e.timeline_variables=B({},this.parent.getAllTimelineVariables()):Array.isArray(i)&&(e.timeline_variables=Object.fromEntries(Object.entries(this.parent.getAllTimelineVariables()).filter(([n,l])=>i.includes(n)))),e}runParameterCallback(e,...t){const i=this.getParameterValue(e,{evaluateFunctions:!1});if(i)return i(...t)}onStart(){this.dependencies.onTrialStart(this),this.runParameterCallback("on_start",this.trialObject),this.dependencies.runOnStartExtensionCallbacks(this.getParameterValue("extensions"))}onFinish(){return q(this,null,function*(){const e=yield this.dependencies.runOnFinishExtensionCallbacks(this.getParameterValue("extensions"));Object.assign(this.result,e),yield Promise.resolve(this.runParameterCallback("on_finish",this.getResult())),this.dependencies.onTrialFinished(this)})}evaluateTimelineVariable(e){var t;return(t=this.parent)==null?void 0:t.evaluateTimelineVariable(e)}getParameterValue(e,t={}){return dt.includes(typeof e=="string"?e:e[0])&&(t.recursive=!1),super.getParameterValue(e,t)}getSimulationOptions(){const e=this.getParameterValue("simulation_options",{replaceResult:(t={})=>{var i,n;if(typeof t=="string"){const l=this.dependencies.getGlobalSimulationOptions();t=(n=(i=l[t])!=null?i:l.default)!=null?n:{}}return x(f(this.dependencies.getGlobalSimulationOptions().default),f(t))}});return typeof e=="undefined"?{}:(e.mode=this.getParameterValue(["simulation_options","mode"]),e.simulate=this.getParameterValue(["simulation_options","simulate"]),e.data=this.getParameterValue(["simulation_options","data"]),typeof e.data=="object"&&(e.data=Object.fromEntries(Object.keys(e.data).map(t=>[t,this.getParameterValue(["simulation_options","data",t])]))),e)}getResult(){return this.getParameterValue("record_data")===!1?void 0:this.result}getResults(){const e=this.getResult();return e?[e]:[]}processParameters(){const e=(i,n,l=[])=>{for(const[o,a]of Object.entries(n)){const s=[...l,o];let u=this.getParameterValue(s,{evaluateFunctions:a.type!==g.FUNCTION,replaceResult:c=>{if(typeof c=="undefined"){if(typeof a.default=="undefined")throw new Error(`You must specify a value for the "${ne(s)}" parameter in the "${this.pluginInfo.name}" plugin.`);return a.default}else return c}});if(a.array&&!Array.isArray(u)){const c=ne(s);throw new Error(`A non-array value (\`${u}\`) was provided for the array parameter "${c}" in the "${this.pluginInfo.name}" plugin. Please make sure that "${c}" is an array.`)}a.type===g.COMPLEX&&a.nested&&(a.array?u=u.map((c,d)=>{const h=[...s,d.toString()],y=this.getParameterValue(h);return e(y,a.nested,h),y}):e(u,a.nested,s)),i[o]=u}},t=f(this.description);e(t,this.pluginInfo.parameters),this.trialObject=t}getLatestNode(){return this}getActiveTimelineByName(e){}}var Tt=Object.defineProperty,he=Object.getOwnPropertySymbols,jt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,de=(r,e,t)=>e in r?Tt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pe=(r,e)=>{for(var t in e||(e={}))jt.call(e,t)&&de(r,t,e[t]);if(he)for(var t of he(e))Ot.call(e,t)&&de(r,t,e[t]);return r},At=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});class w extends le{constructor(e,t,i){super(e),this.parent=i,this.children=[],this.shouldAbort=!1,this.resumePromise=new ie,this.description=Array.isArray(t)?{timeline:t}:t,this.initializeParameterValueCache()}run(){return At(this,null,function*(){typeof this.index=="undefined"&&(this.index=0),this.status=m.RUNNING;const{conditional_function:e,loop_function:t,repetitions:i=1}=this.description;let n=this.generateTimelineVariableOrder();this.setCurrentTimelineVariablesByIndex(n[0]);let l=!0,o;if(!e||e()){this.onStart();for(let a=0;a<i;a++)do{o=[],l?l=!1:n=this.generateTimelineVariableOrder();for(const s of n){this.setCurrentTimelineVariablesByIndex(s);for(const u of this.instantiateChildNodes()){const c=this.currentChild;if(this.currentChild=u,u.index=c?c.getLatestNode().index+1:this.index,yield u.run(),this.status===m.PAUSED&&(yield this.resumePromise.get()),this.shouldAbort){this.status=m.ABORTED;return}o.push(...this.currentChild.getResults())}}}while(t&&t(new p(o)));this.onFinish()}this.status=m.COMPLETED})}onStart(){this.description.on_timeline_start&&this.description.on_timeline_start()}onFinish(){this.description.on_timeline_finish&&this.description.on_timeline_finish()}pause(){this.currentChild instanceof w&&this.currentChild.pause(),this.status=m.PAUSED}resume(){this.status==m.PAUSED&&(this.currentChild instanceof w&&this.currentChild.resume(),this.status=m.RUNNING,this.resumePromise.resolve())}abort(){(this.status===m.RUNNING||this.status===m.PAUSED)&&(this.currentChild instanceof w&&this.currentChild.abort(),this.shouldAbort=!0,this.status===m.PAUSED&&this.resume())}instantiateChildNodes(){const e=this.description.timeline.map(t=>V(t)?new w(this.dependencies,t,this):new j(this.dependencies,t,this));return this.children.push(...e),e}setCurrentTimelineVariablesByIndex(e){var t;this.currentTimelineVariables=pe(pe({},(t=this.parent)==null?void 0:t.getAllTimelineVariables()),e===null?void 0:this.description.timeline_variables[e])}generateTimelineVariableOrder(){var e;const t=(e=this.description.timeline_variables)==null?void 0:e.length;if(!t)return[null];let i=[...Array(t).keys()];const n=this.description.sample;if(n)switch(n.type){case"custom":i=n.fn(i);break;case"with-replacement":i=te(i,n.size,n.weights);break;case"without-replacement":i=ee(i,n.size);break;case"fixed-repetitions":i=M(i,n.size);break;case"alternate-groups":i=Z(n.groups,n.randomize_group_order);break;default:throw new Error(`Invalid type "${n.type}" in timeline sample parameters. Valid options for type are "custom", "with-replacement", "without-replacement", "fixed-repetitions", and "alternate-groups"`)}return this.description.randomize_order&&(i=b(i)),i}getAllTimelineVariables(){return this.currentTimelineVariables}evaluateTimelineVariable(e){var t;if((t=this.currentTimelineVariables)!=null&&t.hasOwnProperty(e.name))return this.currentTimelineVariables[e.name];throw new Error(`Timeline variable ${e.name} not found.`)}getResults(){const e=[];for(const t of this.children)if(t instanceof j){const i=t.getResult();i&&e.push(i)}else t instanceof w&&e.push(...t.getResults());return e}getNaiveProgress(){if(this.status===m.PENDING)return 0;const e=this.getLatestNode();if(!e)return 1;let t=e.index;return e.getStatus()===m.COMPLETED&&t++,Math.min(t/this.getNaiveTrialCount(),1)}getNaiveTrialCount(){const e=t=>{var i,n,l;const o=a=>a.map(s=>e(s)).reduce((s,u)=>s+u);if(Array.isArray(t))return o(t);if(pt(t))return 1;if(V(t)){let a=((i=t.timeline_variables)==null?void 0:i.length)||1;switch((n=t.sample)==null?void 0:n.type){case"with-replacement":case"without-replacement":a=t.sample.size;break;case"fixed-repetitions":a*=t.sample.size;break;case"alternate-groups":a=t.sample.groups.map(s=>s.length).reduce((s,u)=>s+u,0);break}return o(t.timeline)*((l=t.repetitions)!=null?l:1)*a}return 0};return e(this.description)}getLatestNode(){var e,t;return(t=(e=this.currentChild)==null?void 0:e.getLatestNode())!=null?t:this}getActiveTimelineByName(e){var t;return this.description.name===e?this:(t=this.currentChild)==null?void 0:t.getActiveTimelineByName(e)}}var It=Object.defineProperty,me=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,fe=(r,e,t)=>e in r?It(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,St=(r,e)=>{for(var t in e||(e={}))Lt.call(e,t)&&fe(r,t,e[t]);if(me)for(var t of me(e))Ct.call(e,t)&&fe(r,t,e[t]);return r},$=(r,e,t)=>new Promise((i,n)=>{var l=s=>{try{a(t.next(s))}catch(u){n(u)}},o=s=>{try{a(t.throw(s))}catch(u){n(u)}},a=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,o);a((t=t.apply(r,e)).next())});class ge{constructor(e){this.turk=ct,this.randomization=lt,this.utils=_e,this.options={},this.isFileProtocolUsed=!1,this.finishTrialPromise=new ie,this.timelineDependencies={onTrialStart:t=>{this.options.on_trial_start(t.trialObject),this.getDisplayContainerElement().focus(),this.getDisplayElement().scrollTop=0},onTrialResultAvailable:t=>{const i=t.getResult();i&&(i.time_elapsed=this.getTotalTime(),this.data.write(t))},onTrialFinished:t=>{const i=t.getResult();this.options.on_trial_finish(i),i&&this.options.on_data_update(i),this.progressBar&&this.options.auto_update_progress_bar&&(this.progressBar.progress=this.timeline.getNaiveProgress())},runOnStartExtensionCallbacks:t=>this.extensionManager.onStart(t),runOnLoadExtensionCallbacks:t=>this.extensionManager.onLoad(t),runOnFinishExtensionCallbacks:t=>this.extensionManager.onFinish(t),getSimulationMode:()=>this.simulationMode,getGlobalSimulationOptions:()=>this.simulationOptions,instantiatePlugin:t=>new t(this),getDisplayElement:()=>this.getDisplayElement(),getDefaultIti:()=>this.getInitSettings().default_iti,finishTrialPromise:this.finishTrialPromise,clearAllTimeouts:()=>this.pluginAPI.clearAllTimeouts()},this.extensionManagerDependencies={instantiateExtension:t=>new t(this)},this.dataDependencies={getProgress:()=>{var t,i;return{time:this.getTotalTime(),trial:(i=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?i:0}},onInteractionRecordAdded:t=>{this.options.on_interaction_data_update(t)},getDisplayElement:()=>this.getDisplayElement()},e=St({display_element:void 0,on_finish:()=>{},on_trial_start:()=>{},on_trial_finish:()=>{},on_data_update:()=>{},on_interaction_data_update:()=>{},on_close:()=>{},use_webaudio:!0,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.options=e,A(this),window.location.protocol=="file:"&&(e.override_safe_mode===!1||typeof e.override_safe_mode=="undefined")&&(e.use_webaudio=!1,this.isFileProtocolUsed=!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 Le(this.dataDependencies),this.pluginAPI=Be(this),this.extensionManager=new _(this.extensionManagerDependencies,e.extensions)}version(){return Ee.version}run(e){return $(this,null,function*(){typeof e=="undefined"&&console.error("No timeline declared in jsPsych.run(). Cannot start experiment."),e.length===0&&console.error("No trials have been added to the timeline (the timeline is an empty array). Cannot start experiment."),this.timeline=new w(this.timelineDependencies,e),yield this.prepareDom(),yield this.extensionManager.initializeExtensions(),document.documentElement.setAttribute("jspsych","present"),this.experimentStartTime=new Date,yield this.timeline.run(),yield Promise.resolve(this.options.on_finish(this.data.get())),this.endMessage&&(this.getDisplayElement().innerHTML=this.endMessage),this.data.removeInteractionListeners()})}simulate(e){return $(this,arguments,function*(t,i="data-only",n={}){this.simulationMode=i,this.simulationOptions=n,yield this.run(t)})}getProgress(){var e,t,i,n;return{total_trials:(e=this.timeline)==null?void 0:e.getNaiveTrialCount(),current_trial_global:(i=(t=this.timeline)==null?void 0:t.getLatestNode().index)!=null?i:0,percent_complete:((n=this.timeline)==null?void 0:n.getNaiveProgress())*100}}getStartTime(){return this.experimentStartTime}getTotalTime(){return this.experimentStartTime?new Date().getTime()-this.experimentStartTime.getTime():0}getDisplayElement(){return this.displayElement}getDisplayContainerElement(){return this.displayContainerElement}abortExperiment(e,t={}){this.endMessage=e,this.timeline.abort(),this.pluginAPI.cancelAllKeyboardResponses(),this.pluginAPI.clearAllTimeouts(),this.finishTrial(t)}abortCurrentTimeline(){var e;let t=(e=this.timeline)==null?void 0:e.getLatestNode();t instanceof j&&(t=t.parent),t instanceof w&&t.abort()}abortTimelineByName(e){var t;const i=(t=this.timeline)==null?void 0:t.getActiveTimelineByName(e);i&&i.abort()}getCurrentTrial(){var e;const t=(e=this.timeline)==null?void 0:e.getLatestNode();if(t instanceof j)return t.description}getInitSettings(){return this.options}timelineVariable(e){return new D(e)}evaluateTimelineVariable(e){var t,i;return(i=(t=this.timeline)==null?void 0:t.getLatestNode())==null?void 0:i.evaluateTimelineVariable(new D(e))}pauseExperiment(){var e;(e=this.timeline)==null||e.pause()}resumeExperiment(){var e;(e=this.timeline)==null||e.resume()}getSafeModeStatus(){return this.isFileProtocolUsed}getTimeline(){var e;return(e=this.timeline)==null?void 0:e.description.timeline}get extensions(){var e,t;return(t=(e=this.extensionManager)==null?void 0:e.extensions)!=null?t:{}}prepareDom(){return $(this,null,function*(){document.readyState!=="complete"&&(yield new Promise(n=>{window.addEventListener("load",n)}));const e=this.options;if(typeof e.display_element=="undefined"){let n=document.body;n||(n=document.createElement("body"),document.documentElement.appendChild(n)),document.querySelector("html").style.height="100%",n.style.margin="0px",n.style.height="100%",n.style.width="100%",e.display_element=n}else{const n=e.display_element instanceof Element?e.display_element:document.querySelector("#"+e.display_element);n===null?console.error("The display_element specified in initJsPsych() does not exist in the DOM."):e.display_element=n}const t=document.createElement("div");t.id="jspsych-content";const i=document.createElement("div");if(i.className="jspsych-content-wrapper",i.appendChild(t),this.displayContainerElement=e.display_element,this.displayContainerElement.appendChild(i),this.displayElement=t,e.experiment_width!==null&&(this.displayElement.style.width=e.experiment_width+"px"),e.display_element.tabIndex=0,this.displayContainerElement.classList.add("jspsych-display-element"),this.displayElement.classList.add("jspsych-content"),this.data.createInteractionListeners(),window.addEventListener("beforeunload",e.on_close),this.options.show_progress_bar){const n=document.createElement("div");n.id="jspsych-progressbar-container",this.progressBar=new ht(n,this.options.message_progress_bar),this.getDisplayContainerElement().insertAdjacentElement("afterbegin",n)}})}finishTrial(e){this.finishTrialPromise.resolve(e)}}class v 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"}}window.jsPsych={get init(){throw new v("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new v},get randomization(){throw new v},get turk(){throw new v},get pluginAPI(){throw new v},get ALL_KEYS(){throw new v('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new v('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}},typeof window!="undefined"&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);function Mt(r){const e=new ge(r);return Object.defineProperties(e,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(([t,i])=>[t,{get(){throw new v(i)}}]))),e}return E.DataCollection=p,E.JsPsych=ge,E.ParameterType=g,E.initJsPsych=Mt,E}({}),initJsPsych=jsPsychModule.initJsPsych;
|
|
6
|
+
//# sourceMappingURL=https://unpkg.com/jspsych@8.0.0/dist/index.browser.min.js.map
|