{"version":3,"file":"tablist.min.js","sources":["https:\/\/2023.qmplus.qmul.ac.uk\/course\/format\/qmulgrid\/amd\/src\/tablist.js"],"sourcesContent":["import {BaseComponent} from 'core\/reactive';\nimport {getCurrentCourseEditor} from 'core_courseformat\/courseeditor';\nimport $ from 'jquery';\n\nexport default class extends BaseComponent {\n static init(target) {\n return new this({\n element: document.getElementById(target),\n reactive: getCurrentCourseEditor()\n });\n }\n\n getWatchers() {\n return [\n {watch: `state:updated`, handler: this._setActiveTab},\n ];\n }\n\n _setActiveTab() {\n var state = getCurrentCourseEditor().state;\n\n for (let key in state.tabs.list) {\n if (!state.tabs.list.hasOwnProperty(key)) { continue; }\n\n let tab = state.tabs.list[key];\n let activetab = tab.number === parseInt(state.tabs.activetab);\n\n for (let sectionkey in tab.sectionnumbers) {\n $('.thegrid #section-' + tab.sectionnumbers[sectionkey] + '')\n .toggleClass('d-none', !activetab);\n }\n }\n }\n}"],"names":["BaseComponent","target","this","element","document","getElementById","reactive","getWatchers","watch","handler","_setActiveTab","state","key","tabs","list","hasOwnProperty","tab","activetab","number","parseInt","sectionkey","sectionnumbers","toggleClass"],"mappings":"kUAI6BA,oCACbC,eACD,IAAIC,KAAK,CACZC,QAASC,SAASC,eAAeJ,QACjCK,UAAU,4CAIlBC,oBACW,CACH,CAACC,sBAAwBC,QAASP,KAAKQ,gBAI\/CA,oBACQC,OAAQ,0CAAyBA,UAEhC,IAAIC,OAAOD,MAAME,KAAKC,KAAM,KACxBH,MAAME,KAAKC,KAAKC,eAAeH,kBAEhCI,IAAML,MAAME,KAAKC,KAAKF,KACtBK,UAAYD,IAAIE,SAAWC,SAASR,MAAME,KAAKI,eAE9C,IAAIG,cAAcJ,IAAIK,mCACrB,qBAAuBL,IAAIK,eAAeD,aACvCE,YAAY,UAAWL"}