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EACAlD,EACAyB,GAEJjE,EAAE,sBAAsByE,MAC5B,OAGoC,IAA7BsD,OAAOC,oBACdD,OAAOC,kBAAoB,CAAC,GAGhCD,OAAOC,kBAAkBC,eAAiB,SAAUtI,GAChD,OAAO,IAAIF,EAAUE,EACzB,EAMAK,EAAE+D,UAAUmE,GAAG,4BAA4BpD,iBACvC,IAAIqD,EAAepE,SAASkD,iBACxB,mCAEJ,IAAK,IAAImB,KAAMD,EACX,IACI,GAAgE,GAA5DnI,EAAEoI,GAAIC,QAAQ,oCAAoC5E,OAAa,CAE/D,IAAI6E,EAAM,IAAI7I,EAAU,CAAEQ,KAAMmI,UAC1BE,EAAIpH,YACd,CACJ,CAAE,MAAOqH,GACL7G,QAAQC,IAAI,gCAAgCyG,EAAGnH,yCACvBsH,KACxB7G,QAAQC,IAAI4G,EAAIC,MACpB,CAER,G","sources":["webpack://WebComponents/./runestone/selectquestion/js/selectone.js"],"sourcesContent":["/**\n * *******************************\n * |docname| - SelectOne Component\n * *******************************\n */\nimport {\n renderRunestoneComponent,\n createTimedComponent,\n} from \"../../common/js/renderComponent.js\";\nimport RunestoneBase from \"../../common/js/runestonebase.js\";\nimport \"../css/selectquestion.css\";\n\nexport default class SelectOne extends RunestoneBase {\n /**\n * constructor --\n * Making an instance of a selectone is a bit more complicated because it is\n * a kind of meta directive. That is, go to the server and randomly select\n * a question to display in this spot. Or, if a student has already seen this question\n * in the context of an exam retrieve the question they saw in the first place.\n * Making an API call and waiting for the response is handled asynchronously.\n * But lots of code is not written with that assumption. So we do the initialization in\n * two parts.\n * 1. Create the object with the usual constructor\n * 2. call initialize, which returns a promise. When that promise is resolved\n * the \"replacement\" component will replace the original selectone component in the DOM.\n *\n * @param {} opts\n */\n constructor(opts) {\n super(opts);\n this.origOpts = opts;\n this.questions = $(opts.orig).data(\"questionlist\");\n this.proficiency = $(opts.orig).data(\"proficiency\");\n this.minDifficulty = $(opts.orig).data(\"minDifficulty\");\n this.maxDifficulty = $(opts.orig).data(\"maxDifficulty\");\n this.points = $(opts.orig).data(\"points\");\n this.autogradable = $(opts.orig).data(\"autogradable\");\n this.not_seen_ever = $(opts.orig).data(\"not_seen_ever\");\n this.selector_id = $(opts.orig).first().attr(\"id\");\n this.primaryOnly = $(opts.orig).data(\"primary\");\n this.ABExperiment = $(opts.orig).data(\"ab\");\n this.toggleOptions = $(opts.orig).data(\"toggleoptions\");\n this.toggleLabels = $(opts.orig).data(\"togglelabels\");\n this.limitBaseCourse = $(opts.orig).data(\"limit-basecourse\");\n opts.orig.id = this.selector_id;\n }\n /**\n * initialize --\n * initialize is used so that the constructor does not have to be async.\n * Constructors should definitely not return promises that would seriously\n * mess things up.\n * @return {Promise} Will resolve after component from DB is reified\n */\n async initialize() {\n let self = this;\n let data = { selector_id: this.selector_id };\n if (this.questions) {\n data.questions = this.questions;\n } else if (this.proficiency) {\n data.proficiency = this.proficiency;\n }\n if (this.minDifficulty) {\n data.minDifficulty = this.minDifficulty;\n }\n if (this.maxDifficulty) {\n data.maxDifficulty = this.maxDifficulty;\n }\n if (this.points) {\n data.points = this.points;\n }\n if (this.autogradable) {\n data.autogradable = this.autogradable;\n }\n if (this.not_seen_ever) {\n data.not_seen_ever = this.not_seen_ever;\n }\n if (this.primaryOnly) {\n data.primary = this.primaryOnly;\n }\n if (this.ABExperiment) {\n data.AB = this.ABExperiment;\n }\n if (this.timedWrapper) {\n data.timedWrapper = this.timedWrapper;\n }\n if (this.toggleOptions) {\n data.toggleOptions = this.toggleOptions;\n }\n if (this.toggleLabels) {\n data.toggleLabels = this.toggleLabels;\n }\n if (this.limitBaseCourse) {\n data.limitBaseCourse = eBookConfig.basecourse;\n }\n let opts = this.origOpts;\n let selectorId = this.selector_id;\n console.log(\"getting question source\");\n let request = new Request(\n `${eBookConfig.new_server_prefix}/assessment/get_question_source`,\n {\n method: \"POST\",\n headers: this.jsonHeaders,\n body: JSON.stringify(data),\n }\n );\n let response = await fetch(request);\n let htmlsrc = await response.json();\n htmlsrc = htmlsrc.detail;\n if (htmlsrc.indexOf(\"No preview\") >= 0) {\n alert(\n `Error: Not able to find a question for ${selectorId} based on the criteria`\n );\n throw new Error(`Unable to find a question for ${selectorId}`);\n }\n let res;\n if (opts.timed) {\n // timed components are not rendered immediately, only when the student\n // starts the assessment and visits this particular entry.\n res = createTimedComponent(htmlsrc, {\n timed: true,\n selector_id: selectorId,\n assessmentTaken: opts.assessmentTaken,\n });\n // replace the entry in the timed assessment's list of components\n // with the component created by createTimedComponent\n for (let component of opts.rqa) {\n if (component.question == self) {\n component.question = res.question;\n break;\n }\n }\n self.realComponent = res.question;\n self.containerDiv = res.question.containerDiv;\n self.realComponent.selectorId = selectorId;\n } else {\n if (data.toggleOptions) {\n var toggleLabels = data.toggleLabels\n .replace(\"togglelabels:\", \"\")\n .trim();\n if (toggleLabels) {\n toggleLabels = toggleLabels.split(\",\");\n for (var t = 0; t < toggleLabels.length; t++) {\n toggleLabels[t] = toggleLabels[t].trim();\n }\n }\n var toggleQuestions = this.questions.split(\", \");\n var toggleUI = \"\";\n // check so that only the first toggle select question on the assignments page has a preview panel created, then all toggle select previews use this same panel\n if (!document.getElementById(\"component-preview\")) {\n toggleUI +=\n '