LearnPress – WordPress LMS Plugin - Version 4.0.6

Version Description

~ Fixed: Page profile not show login/register form ~ Fixed: translated text on js function "Quiz" ~ Fixed: js scroll to item viewing ~ Fixed: show html title question ~ Fixed: Order change status from "completed" to "pending" => user can't learn courses in this order ~ Added: Option "Logout Redirect" ~ Fixed: Set default sidebar curriculumn will be hide on mobile ~ Modify: Remove course on Overview tab when enable "Publish Profile" ~ Fixed: Elementor pro make archive course show wrong

Download this release

Release Info

Developer ThimPress
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 4.0.6
Comparing to
See all releases

Code changes from version 4.0.5 to 4.0.6

Files changed (52) hide show
  1. assets/css/learnpress.css +72 -23
  2. assets/js/dist/admin/pages/tools.js +4 -3
  3. assets/js/dist/admin/pages/tools.min.js +1 -1
  4. assets/js/dist/frontend/config.min.js +1 -1
  5. assets/js/dist/frontend/custom.min.js +1 -1
  6. assets/js/dist/frontend/lesson.min.js +1 -1
  7. assets/js/dist/frontend/modal.js +2 -2
  8. assets/js/dist/frontend/modal.min.js +1 -1
  9. assets/js/dist/frontend/question-types.js +1 -1
  10. assets/js/dist/frontend/question-types.min.js +1 -1
  11. assets/js/dist/frontend/quiz.js +22 -8
  12. assets/js/dist/frontend/quiz.min.js +2 -2
  13. assets/js/dist/frontend/single-course.js +25 -27
  14. assets/js/dist/frontend/single-course.min.js +1 -1
  15. assets/js/dist/frontend/single-curriculum.js +35 -37
  16. assets/js/dist/frontend/single-curriculum.min.js +1 -1
  17. assets/js/dist/js/data-controls.min.js +1 -1
  18. assets/src/apps/js/admin/pages/tools/database/create_indexs.js +4 -4
  19. assets/src/apps/js/frontend/modal/index.js +3 -15
  20. assets/src/apps/js/frontend/question-types/components/question-base/index.js +1 -1
  21. assets/src/apps/js/frontend/quiz/components/attempts/index.js +1 -1
  22. assets/src/apps/js/frontend/quiz/components/buttons/button-check.js +2 -2
  23. assets/src/apps/js/frontend/quiz/components/buttons/index.js +3 -3
  24. assets/src/apps/js/frontend/quiz/components/questions/question.js +1 -1
  25. assets/src/apps/js/frontend/quiz/components/result/index.js +11 -3
  26. assets/src/apps/js/frontend/single-course/index.js +1 -1
  27. assets/src/apps/js/frontend/single-curriculum/components/items-progress.js +4 -0
  28. assets/src/apps/js/frontend/single-curriculum/components/sidebar.js +22 -27
  29. assets/src/apps/js/frontend/single-curriculum/index.js +1 -1
  30. assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js +7 -8
  31. inc/abstracts/abstract-object-data.php +4 -6
  32. inc/admin/settings/class-lp-settings-general.php +13 -5
  33. inc/admin/views/meta-boxes/course/settings.php +1 -6
  34. inc/admin/views/meta-boxes/order/details.php +9 -0
  35. inc/admin/views/meta-boxes/order/exports-invoice.php +61 -61
  36. inc/class-lp-assets.php +9 -1
  37. inc/class-lp-session-handler.php +7 -0
  38. inc/curds/class-lp-course-curd.php +1 -2
  39. inc/lp-core-functions.php +13 -4
  40. inc/lp-template-functions.php +21 -2
  41. inc/lp-template-hooks.php +13 -1
  42. inc/order/lp-order-functions.php +8 -8
  43. inc/question/class-lp-question.php +1 -1
  44. inc/templates/class-lp-template-profile.php +24 -0
  45. inc/user/class-lp-profile.php +16 -4
  46. inc/user/class-lp-user-factory.php +56 -8
  47. languages/learnpress.pot +599 -536
  48. learnpress.php +22 -26
  49. readme.txt +15 -4
  50. templates/content-single-item.php +6 -7
  51. templates/pages/profile.php +3 -8
  52. templates/profile/sidebar.php +6 -0
assets/css/learnpress.css CHANGED
@@ -3591,6 +3591,10 @@ body .lp-quiz-buttons .form-button-finish-course {
3591
  background: var(--lp-secondary-color);
3592
  }
3593
 
 
 
 
 
3594
  /***********/
3595
  .course-meta {
3596
  display: flex;
@@ -4342,8 +4346,8 @@ button[data-counter]::after {
4342
  .quiz-status > div {
4343
  display: flex;
4344
  box-sizing: border-box;
4345
- width: 792px;
4346
- max-width: 100%;
4347
  height: 60px;
4348
  margin: 0 auto;
4349
  padding: 5px 10px 5px 30px;
@@ -4353,6 +4357,14 @@ button[data-counter]::after {
4353
  align-items: center;
4354
  }
4355
 
 
 
 
 
 
 
 
 
4356
  .quiz-status > div > div {
4357
  display: flex;
4358
  flex-direction: row-reverse;
@@ -4380,8 +4392,8 @@ button[data-counter]::after {
4380
  .quiz-status .countdown {
4381
  position: relative;
4382
  min-width: 120px;
4383
- padding: 12px 29px;
4384
  margin-right: 5px;
 
4385
  color: #333;
4386
  background: #fff;
4387
  font-size: 14px;
@@ -4437,9 +4449,9 @@ button[data-counter]::after {
4437
 
4438
  .quiz-status .submit-quiz button {
4439
  margin: 0 0 0 10px;
4440
- background: #fff;
4441
  border: none;
4442
  border-radius: 0;
 
4443
  text-transform: uppercase;
4444
  }
4445
 
@@ -4530,6 +4542,15 @@ button[data-counter]::after {
4530
  margin: 0 0 20px;
4531
  padding: 0;
4532
  list-style: none;
 
 
 
 
 
 
 
 
 
4533
  }
4534
 
4535
  .quiz-intro-item {
@@ -4538,6 +4559,12 @@ button[data-counter]::after {
4538
  align-items: center;
4539
  }
4540
 
 
 
 
 
 
 
4541
  .quiz-intro-item::before {
4542
  position: relative;
4543
  top: -2px;
@@ -4839,6 +4866,11 @@ button[data-counter]::after {
4839
  line-height: 26px;
4840
  }
4841
 
 
 
 
 
 
4842
  .question .question-response {
4843
  margin-bottom: 10px;
4844
  font-size: 14px;
@@ -7745,6 +7777,11 @@ input[type="radio"]:nth-child(19):checked ~ .switch-btn:nth-child(20)::before {
7745
  cursor: pointer;
7746
  transition: 0.25s;
7747
  -webkit-appearance: none;
 
 
 
 
 
7748
  }
7749
 
7750
  #popup-course #sidebar-toggle::before {
@@ -7766,25 +7803,6 @@ input[type="radio"]:nth-child(19):checked ~ .switch-btn:nth-child(20)::before {
7766
  outline: 0;
7767
  }
7768
 
7769
- #popup-course #sidebar-toggle:checked {
7770
- left: 0;
7771
- /*background: #5383f7;
7772
- border-color: #5383f7;*/
7773
- }
7774
-
7775
- #popup-course #sidebar-toggle:checked::before {
7776
- content: "\f0da";
7777
- }
7778
-
7779
- #popup-course #sidebar-toggle:checked ~ #popup-sidebar {
7780
- flex: 0 0 0;
7781
- }
7782
-
7783
- #popup-course #sidebar-toggle:checked ~ #popup-footer,
7784
- #popup-course #sidebar-toggle:checked ~ #popup-header {
7785
- left: 0;
7786
- }
7787
-
7788
  #popup-course .lp-quiz-buttons .complete-quiz,
7789
  #popup-course .lp-quiz-buttons .back-quiz,
7790
  #popup-course .lp-quiz-buttons .review-quiz {
@@ -8178,6 +8196,37 @@ body.admin-bar #popup-course {
8178
  top: 32px;
8179
  }
8180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8181
  .course-curriculum .section-header .section-meta {
8182
  position: relative;
8183
  }
3591
  background: var(--lp-secondary-color);
3592
  }
3593
 
3594
+ .viewing-course-item #learn-press-course-curriculum .section-header .section-desc {
3595
+ display: none;
3596
+ }
3597
+
3598
  /***********/
3599
  .course-meta {
3600
  display: flex;
4346
  .quiz-status > div {
4347
  display: flex;
4348
  box-sizing: border-box;
4349
+ width: 100%;
4350
+ max-width: 792px;
4351
  height: 60px;
4352
  margin: 0 auto;
4353
  padding: 5px 10px 5px 30px;
4357
  align-items: center;
4358
  }
4359
 
4360
+ @media (max-width: 480px) {
4361
+ .quiz-status > div {
4362
+ display: block;
4363
+ height: auto;
4364
+ text-align: center;
4365
+ }
4366
+ }
4367
+
4368
  .quiz-status > div > div {
4369
  display: flex;
4370
  flex-direction: row-reverse;
4392
  .quiz-status .countdown {
4393
  position: relative;
4394
  min-width: 120px;
 
4395
  margin-right: 5px;
4396
+ padding: 12px 29px;
4397
  color: #333;
4398
  background: #fff;
4399
  font-size: 14px;
4449
 
4450
  .quiz-status .submit-quiz button {
4451
  margin: 0 0 0 10px;
 
4452
  border: none;
4453
  border-radius: 0;
4454
+ background: #fff;
4455
  text-transform: uppercase;
4456
  }
4457
 
4542
  margin: 0 0 20px;
4543
  padding: 0;
4544
  list-style: none;
4545
+ flex-flow: row wrap;
4546
+ }
4547
+
4548
+ @media (max-width: 768px) {
4549
+ .quiz-intro {
4550
+ padding-right: 10px;
4551
+ padding-left: 10px;
4552
+ justify-content: space-between;
4553
+ }
4554
  }
4555
 
4556
  .quiz-intro-item {
4559
  align-items: center;
4560
  }
4561
 
4562
+ @media (max-width: 768px) {
4563
+ .quiz-intro-item {
4564
+ margin: 0 20px 0 0;
4565
+ }
4566
+ }
4567
+
4568
  .quiz-intro-item::before {
4569
  position: relative;
4570
  top: -2px;
4866
  line-height: 26px;
4867
  }
4868
 
4869
+ .question .question-content img {
4870
+ width: 100%;
4871
+ max-width: 100%;
4872
+ }
4873
+
4874
  .question .question-response {
4875
  margin-bottom: 10px;
4876
  font-size: 14px;
7777
  cursor: pointer;
7778
  transition: 0.25s;
7779
  -webkit-appearance: none;
7780
+ border: none;
7781
+ }
7782
+
7783
+ #popup-course #sidebar-toggle:after {
7784
+ display: none;
7785
  }
7786
 
7787
  #popup-course #sidebar-toggle::before {
7803
  outline: 0;
7804
  }
7805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7806
  #popup-course .lp-quiz-buttons .complete-quiz,
7807
  #popup-course .lp-quiz-buttons .back-quiz,
7808
  #popup-course .lp-quiz-buttons .review-quiz {
8196
  top: 32px;
8197
  }
8198
 
8199
+ body.lp-sidebar-toggle__close #popup-course > #sidebar-toggle {
8200
+ left: 0;
8201
+ }
8202
+
8203
+ body.lp-sidebar-toggle__close #popup-course > #sidebar-toggle::before {
8204
+ content: "\f0da";
8205
+ }
8206
+
8207
+ body.lp-sidebar-toggle__close #popup-course #popup-sidebar {
8208
+ flex: 0 0 0;
8209
+ }
8210
+
8211
+ body.lp-sidebar-toggle__close #popup-course #popup-header, body.lp-sidebar-toggle__close #popup-course #popup-footer {
8212
+ left: 0;
8213
+ }
8214
+
8215
+ @media (max-width: 768px) {
8216
+ body:not(.lp-sidebar-toggle__open) #popup-course > #sidebar-toggle {
8217
+ left: 0;
8218
+ }
8219
+ body:not(.lp-sidebar-toggle__open) #popup-course > #sidebar-toggle::before {
8220
+ content: "\f0da";
8221
+ }
8222
+ body:not(.lp-sidebar-toggle__open) #popup-course #popup-sidebar {
8223
+ flex: 0 0 0;
8224
+ }
8225
+ body:not(.lp-sidebar-toggle__open) #popup-course #popup-header, body:not(.lp-sidebar-toggle__open) #popup-course #popup-footer {
8226
+ left: 0;
8227
+ }
8228
+ }
8229
+
8230
  .course-curriculum .section-header .section-meta {
8231
  position: relative;
8232
  }
assets/js/dist/admin/pages/tools.js CHANGED
@@ -281,7 +281,6 @@ var createIndexes = function createIndexes() {
281
 
282
  var scrollToStepCurrent = function scrollToStepCurrent(stepCurrent) {
283
  var elItemStepCurrent = elGroupStep.querySelector('input[value=' + stepCurrent + ']').closest('.lp-item-step');
284
- console.log(elItemStepCurrent.offsetTop, _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].offsetTop);
285
  var offset = elItemStepCurrent.offsetTop - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].offsetTop + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].scrollTop;
286
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent.stop().animate({
287
  scrollTop: offset
@@ -298,7 +297,7 @@ var createIndexes = function createIndexes() {
298
  }
299
 
300
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
301
- var url = '/lp/v1/tools/admin/create-indexs';
302
  var params = {
303
  tables: tables,
304
  table: table
@@ -325,7 +324,9 @@ var createIndexes = function createIndexes() {
325
  }
326
 
327
  if ('success' === status) {
328
- Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, params, functions);
 
 
329
  } else if ('finished' === status) {
330
  console.log('finished');
331
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].style.display = 'inline-block';
281
 
282
  var scrollToStepCurrent = function scrollToStepCurrent(stepCurrent) {
283
  var elItemStepCurrent = elGroupStep.querySelector('input[value=' + stepCurrent + ']').closest('.lp-item-step');
 
284
  var offset = elItemStepCurrent.offsetTop - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].offsetTop + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].scrollTop;
285
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent.stop().animate({
286
  scrollTop: offset
297
  }
298
 
299
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
300
+ var url = '/lp/v1/admin/tools/create-indexs';
301
  var params = {
302
  tables: tables,
303
  table: table
324
  }
325
 
326
  if ('success' === status) {
327
+ setTimeout(function () {
328
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, params, functions);
329
+ }, 2000);
330
  } else if ('finished' === status) {
331
  console.log('finished');
332
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].style.display = 'inline-block';
assets/js/dist/admin/pages/tools.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}({13:function(e,t,n){"use strict";n.r(t);var r=jQuery,a=null,l={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(a=this.elLPOverlay,this.elMainContent=a.find(".main-content"),this.elTitle=a.find(".modal-title"),this.elBtnYes=a.find(".btn-yes"),this.elBtnNo=a.find(".btn-no"),this.elFooter=a.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){a.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof l.callBackYes&&l.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},s=l,o=function(e,t,n){wp.apiFetch({path:e,method:"POST",data:t}).then((function(e){"function"==typeof n.success&&n.success(e)})).catch((function(e){"function"==typeof n.error&&n.error(e)})).then((function(){"function"==typeof n.completed&&n.completed()}))},i=jQuery,c=i("#lp-tool-upgrade-db"),u=function(){var e=0,t=c.find(".wrapper-terms-upgrade"),n=c.find(".wrapper-lp-status-upgrade"),r=c.find(".wrapper-lp-upgrade-message"),a=null;if(t.length){s.setContentModal(t.html());var l=s.elLPOverlay.find(".terms-upgrade"),u=l.find("input[name=lp-agree-term]"),d=l.find(".error"),p=i("input[name=message-when-upgrading]").val();a=function(){return d.hide(),d.removeClass("learn-press-message"),u.is(":checked")?(o("/lp/v1/database/agree_terms",{agree_terms:1},{}),s.elFooter.find(".learn-press-notice").remove(),s.elFooter.prepend('<span class="learn-press-notice">'+p+"</span>"),s.setContentModal(n.html()),!0):(d.show(),d.addClass("learn-press-message"),s.elMainContent.animate({scrollTop:d.offset().top}),!1)}}else s.setContentModal(n.html()),a=function(){return!0};s.setTitleModal(c.find("h2").html()),s.elBtnYes.text("Upgrade"),s.elBtnYes.show(),s.elBtnNo.text("close"),s.callBackYes=function(){if(a()){e=1,s.elBtnYes.hide(),s.elBtnNo.hide();var t=s.elLPOverlay.find(".lp-group-step"),n=c.find(".lp-item-step"),l=[];i.each(n,(function(e,t){var n=i(t);if(!n.hasClass("completed")){var r=n.find("input").val();l.push(r)}}));var u={steps:l,step:l[0]},d=null,p=function(e,n){(d=t.find("input[value="+e+"]").closest(".lp-item-step")).addClass("running"),100===n&&d.removeClass("running").addClass("completed"),d.find(".progress-bar").css("width",n+"%"),d.find(".percent").text(n+"%")};p(l[0],.1);var f={success:function(n){var a,l;p(u.step,n.percent),u.step!==n.name&&p(n.name,.1),a=u.step,l=(d=t.find("input[value="+a+"]").closest(".lp-item-step")).offset().top-s.elMainContent.offset().top+s.elMainContent.scrollTop(),s.elMainContent.stop().animate({scrollTop:l},600),"success"===n.status?(u.step=n.name,u.data=n.data,setTimeout((function(){o("/lp/v1/database/upgrade",u,f)}),800)):"finished"===n.status?(e=0,d.removeClass("running").addClass("completed"),setTimeout((function(){s.setContentModal(r.html())}),1e3),s.elFooter.find(".learn-press-notice").remove(),s.elBtnNo.show(),s.elBtnNo.on("click",(function(){window.location.reload()}))):(e=0,s.elFooter.find(".learn-press-notice").remove(),d.removeClass("running").addClass("error"),s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.href="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),n.message||(n.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(n.message)})))},error:function(t){e=0,s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.location="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),t.message||(t.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(t.message)}))},completed:function(){}};o("/lp/v1/database/upgrade",u,f)}},window.onbeforeunload=function(){if(e)return"LP is upgrading Database. Are you want to reload page?"},window.onclose=function(){if(e)return"LP is upgrading Database. Are you want to close page?"}},d=function(){if(c.length&&s.init()){var e=i(".wrapper-lp-status-upgrade"),t=window.location.search,n=new URLSearchParams(t).get("action");"upgrade-db"===n&&(s.elLPOverlay.show(),s.setTitleModal(c.find("h2").html()),s.setContentModal(i(".wrapper-lp-loading").html())),o("/lp/v1/database/get_steps",{},{success:function(t){var r=t.steps_completed,a=t.steps_default;if(void 0===r||void 0===a)return console.log("invalid steps_completed and steps_default"),!1;var l="";for(var o in a){var c=a[o],d=c.steps;for(var p in l='<div class="lp-group-step">',l+="<h3>"+c.label+"</h3>",d){var f=d[p],m="";void 0!==r[p]&&(m="completed"),l+='<div class="lp-item-step '+m+'">',l+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+f.name+'" /></div>',l+='<div class="lp-item-step-right">',l+='<label for=""><strong></strong>'+f.label+"</label>",l+='<div class="description">'+f.description+"</div>",l+='<div class="percent"></div>',l+='<span class="progress-bar"></span>',l+="</div>",l+="</div>"}l+="</div>",e.append(l);var v=i(".lp-btn-upgrade-db");"upgrade-db"===n&&u(),v.on("click",(function(){s.elLPOverlay.show(),u()}))}},error:function(e){},completed:function(){}})}},p=function(){var e=document.querySelector("#lp-tool-create-indexes-tables");e&&e.querySelector(".lp-btn-create-indexes").addEventListener("click",(function(t){t.preventDefault();var n=e.querySelector(".wrapper-lp-loading");if(s.init()){s.elLPOverlay.show(),s.setContentModal(n.innerHTML),s.setTitleModal(e.querySelector("h2").textContent),s.elBtnYes[0].style.display="inline-block",s.elBtnYes[0].textContent="Run",s.elBtnNo[0].textContent="Close";var r={success:function(e){e.status,e.message;var t=e.data,n=t.tables,r=t.table,a=document.querySelector(".example-lp-group-step");s.setContentModal(a.innerHTML);var l=s.elLPOverlay[0].querySelector(".lp-group-step "),i=function(e,t){var n=l.querySelector("input[value="+e+"]").closest(".lp-item-step");n.classList.add("running"),100===t&&(n.classList.remove("running"),n.classList.add("completed")),n.querySelector(".progress-bar").style.width=t};for(var c in n){var u=s.elLPOverlay[0].querySelector(".lp-item-step").cloneNode(!0),d=u.querySelector("input");u.querySelector("label").textContent="Table: ".concat(c),d.value=c,l.append(u)}s.callBackYes=function(){var e="/lp/v1/tools/admin/create-indexs",t={tables:n,table:r};s.elBtnNo[0].style.display="none",s.elBtnYes[0].style.display="none",i(r,.1);var a={success:function(n){var r=n.status,c=n.message,u=n.data,d=u.table,p=u.percent;i(t.table,p),void 0!==d&&(t.table!==d&&(i(d,.1),function(e){var t=l.querySelector("input[value="+e+"]").closest(".lp-item-step");console.log(t.offsetTop,s.elMainContent[0].offsetTop);var n=t.offsetTop-s.elMainContent[0].offsetTop+s.elMainContent[0].scrollTop;s.elMainContent.stop().animate({scrollTop:n},600)}(d)),t.table=d),"success"===r?o(e,t,a):"finished"===r?(console.log("finished"),s.elBtnNo[0].style.display="inline-block",s.elBtnNo[0].textContent="Finish"):console.log(c)},error:function(e){console.log(e)},completed:function(){}};o(e,t,a)}},error:function(e){},completed:function(){}};o("/lp/v1/admin/tools/list-tables-indexs",{},r)}}))},f=function(){var e=document.querySelector("#lp-tool-re-upgrade-db");if(e){var t="lp/v1/database/check-db-valid-re-upgrade";o(t,{},{success:function(n){if(n.data.can_re_upgrade){e.style.display="block";var r=e.querySelector(".lp-btn-re-upgrade-db"),a=e.querySelector(".learn-press-message");r.addEventListener("click",(function(){confirm("Are want Re Upgrade!")&&o(t="lp/v1/database/del-tb-lp-upgrade-db",{},{success:function(e){var t=e.status,n=(e.message,e.data.url);"success"===t&&void 0!==n&&(window.location.href=n)},error:function(e){a.classList.add("error"),a.textContent=e.message,a.style.display="block"}})}))}},error:function(e){}})}};function m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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 l,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,l=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw l}}}}function v(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 h(e,t,n,r,a,l,s){try{var o=e[l](s),i=o.value}catch(e){return void n(e)}o.done?t(i):Promise.resolve(i).then(r,a)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function s(e){h(l,r,a,s,o,"next",e)}function o(e){h(l,r,a,s,o,"throw",e)}s(void 0)}))}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,a,l=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw a}}return l}(e,t)||b(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 b(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var C=wp.i18n.__,x=wp.components,S=x.TextControl,_=x.Button,k=x.Spinner,R=x.CheckboxControl,E=x.Notice,M=wp.element,B=M.useState,T=M.useEffect,P=wp.url.addQueryArgs,L=function(){var e=y(B(!1),2),t=e[0],n=e[1],r=y(B(""),2),a=r[0],l=r[1],s=y(B([]),2),o=s[0],i=s[1],c=y(B([]),2),u=c[0],d=c[1],p=y(B([]),2),f=p[0],h=p[1],b=y(B(!1),2),w=b[0],x=b[1];T((function(){M(a)}),[a]);var M=function(){var e=g(regeneratorRuntime.mark((function e(r){var a,l,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r&&!t){e.next=5;break}return h([]),i([]),e.abrupt("return");case 5:if(!(r.length<3)){e.next=9;break}return h([{status:"error",message:"Please enter at least 3 characters to searching course."}]),i([]),e.abrupt("return");case 9:return n(!0),e.next=12,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/search-courses",{s:r}),method:"GET"});case 12:a=e.sent,l=a.status,s=a.data,n(!1),"success"===l?(i(s),h([])):(h([{status:"error",message:a.message||"LearnPress: Search Course Fail!"}]),i([])),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.log(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(t){return e.apply(this,arguments)}}();var L=function(){var e=g(regeneratorRuntime.mark((function e(){var t,n,r,a,l,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==u.length){e.next=3;break}return h([{status:"error",message:"Please chooce Course for reset data!"}]),e.abrupt("return");case 3:if(confirm("Are you sure to reset course progress of all users enrolled this course?")){e.next=5;break}return e.abrupt("return");case 5:t=[],e.prev=6,x(!0),n=m(u),e.prev=9,n.s();case 11:if((r=n.n()).done){e.next=20;break}return a=r.value,e.next=15,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/reset-courses",{courseId:a}),method:"GET"});case 15:l=e.sent,s=l.status,l.data,o=l.message,t.push({status:s,message:o||"Course #".concat(a," reset successfully!")});case 18:e.next=11;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(9),n.e(e.t0);case 25:return e.prev=25,n.f(),e.finish(25);case 28:x(!1),e.next=34;break;case 31:e.prev=31,e.t1=e.catch(6),t.push({status:"error",message:e.t1.message||"LearnPress Error: Reset Course Data."});case 34:h(t);case 35:case"end":return e.stop()}}),e,null,[[6,31],[9,22,25,28]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("h2",null,C("Reset course progress","learnpress")),React.createElement("div",{className:"description"},React.createElement("p",null,C("This action will reset progress of a course for all users have enrolled.","learnpress")),React.createElement("p",null,C("Search results only show course have user data.","learnpress")),React.createElement("div",null,React.createElement(S,{placeholder:C("Search course by name","learnpress"),value:a,onChange:function(e){return l(e)},style:{width:300}}))),t&&React.createElement(k,null),o.length>0&&React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-reset-course_progress",style:{border:"1px solid #eee"}},React.createElement("div",null,React.createElement("div",{style:{background:"#eee"}},React.createElement("div",null,React.createElement(R,{checked:u.length===o.length,onChange:function(){u.length===o.length?d([]):d(o.map((function(e){return e.id})))},style:{margin:0}})),React.createElement("div",null,C("ID","learnpress")),React.createElement("div",null,C("Name","learnpress")),React.createElement("div",null,C("Students","learnpress")))),React.createElement("div",{style:{height:"100%",maxHeight:200,overflow:"auto"}},o.map((function(e){return React.createElement("div",{style:{borderTop:"1px solid #eee"},key:e.id},React.createElement("div",null,React.createElement(R,{checked:u.includes(e.id),onChange:function(){return function(e){var t=v(u);if(t.includes(e)){var n=t.indexOf(e);n>-1&&t.splice(n,1)}else t.push(e);d(t)}(e.id)}})),React.createElement("div",null,"#",e.id),React.createElement("div",null,e.title),React.createElement("div",null,e.students))})))),w?React.createElement(k,null):React.createElement(_,{isPrimary:!0,onClick:function(){return L()},style:{marginTop:10,height:30}},C("Reset now","learnpress"))),f.length>0&&f.map((function(e,t){return React.createElement(E,{status:e.status,key:t,isDismissible:!1},e.message)})),React.createElement("style",null,"\t\t\t\t.lp-reset-course_progress .components-base-control__field {\t\t\t\t\tmargin: 0;\t\t\t\t}\t\t\t\t.components-notice{\t\t\t\t\tmargin-left: 0;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div{\t\t\t\t\tdisplay: grid;\t\t\t\t\tgrid-template-columns: 80px 50px 1fr 80px;\t\t\t\t\talign-items: center;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div > div{\t\t\t\t\tmaegin: 0;\t\t\t\t\tpadding: 8px 10px;\t\t\t\t}\t\t\t\t"))};function A(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(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 O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var j,N,q,Y,F,I,D,U,G=function(){document.querySelectorAll("#learn-press-reset-course-users").length>0&&wp.element.render(React.createElement(L,null),A(document.querySelectorAll("#learn-press-reset-course-users"))[0])};j=jQuery,N=j(document),q=!1,Y=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(t.addClass("disabled").html(t.data("installing-text")),j(".lp-install-sample__response").remove(),q=!0,j.ajax({url:t.attr("href"),data:j(".lp-install-sample__options").serializeJSON(),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},F=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(t.addClass("disabled").html(t.data("uninstalling-text")),q=!0,j.ajax({url:t.attr("href"),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},I=function(e){e.preventDefault();var t=j(this);t.hasClass("disabled")||(t.addClass("disabled").html(t.data("cleaning-text")),j.ajax({url:t.attr("href"),data:{},success:function(e){t.removeClass("disabled").html(t.data("text"))},error:function(){t.removeClass("disabled").html(t.data("text"))}}))},D=function(){j.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success:function(e){},error:function(){}})},U=function(e){e.preventDefault(),j(".lp-install-sample__options").toggleClass("hide-if-js")},j((function(){d(),p(),f(),G(),N.on("click",".lp-install-sample__install",Y).on("click",".lp-install-sample__uninstall",F).on("click","#learn-press-clear-cache",I).on("click",'input[name="enable_hard_cache"]',D).on("click",".lp-install-sample__toggle-options",U)}))}});
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}({13:function(e,t,n){"use strict";n.r(t);var r=jQuery,a=null,l={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(a=this.elLPOverlay,this.elMainContent=a.find(".main-content"),this.elTitle=a.find(".modal-title"),this.elBtnYes=a.find(".btn-yes"),this.elBtnNo=a.find(".btn-no"),this.elFooter=a.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){a.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof l.callBackYes&&l.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},s=l,o=function(e,t,n){wp.apiFetch({path:e,method:"POST",data:t}).then((function(e){"function"==typeof n.success&&n.success(e)})).catch((function(e){"function"==typeof n.error&&n.error(e)})).then((function(){"function"==typeof n.completed&&n.completed()}))},i=jQuery,c=i("#lp-tool-upgrade-db"),u=function(){var e=0,t=c.find(".wrapper-terms-upgrade"),n=c.find(".wrapper-lp-status-upgrade"),r=c.find(".wrapper-lp-upgrade-message"),a=null;if(t.length){s.setContentModal(t.html());var l=s.elLPOverlay.find(".terms-upgrade"),u=l.find("input[name=lp-agree-term]"),d=l.find(".error"),p=i("input[name=message-when-upgrading]").val();a=function(){return d.hide(),d.removeClass("learn-press-message"),u.is(":checked")?(o("/lp/v1/database/agree_terms",{agree_terms:1},{}),s.elFooter.find(".learn-press-notice").remove(),s.elFooter.prepend('<span class="learn-press-notice">'+p+"</span>"),s.setContentModal(n.html()),!0):(d.show(),d.addClass("learn-press-message"),s.elMainContent.animate({scrollTop:d.offset().top}),!1)}}else s.setContentModal(n.html()),a=function(){return!0};s.setTitleModal(c.find("h2").html()),s.elBtnYes.text("Upgrade"),s.elBtnYes.show(),s.elBtnNo.text("close"),s.callBackYes=function(){if(a()){e=1,s.elBtnYes.hide(),s.elBtnNo.hide();var t=s.elLPOverlay.find(".lp-group-step"),n=c.find(".lp-item-step"),l=[];i.each(n,(function(e,t){var n=i(t);if(!n.hasClass("completed")){var r=n.find("input").val();l.push(r)}}));var u={steps:l,step:l[0]},d=null,p=function(e,n){(d=t.find("input[value="+e+"]").closest(".lp-item-step")).addClass("running"),100===n&&d.removeClass("running").addClass("completed"),d.find(".progress-bar").css("width",n+"%"),d.find(".percent").text(n+"%")};p(l[0],.1);var f={success:function(n){var a,l;p(u.step,n.percent),u.step!==n.name&&p(n.name,.1),a=u.step,l=(d=t.find("input[value="+a+"]").closest(".lp-item-step")).offset().top-s.elMainContent.offset().top+s.elMainContent.scrollTop(),s.elMainContent.stop().animate({scrollTop:l},600),"success"===n.status?(u.step=n.name,u.data=n.data,setTimeout((function(){o("/lp/v1/database/upgrade",u,f)}),800)):"finished"===n.status?(e=0,d.removeClass("running").addClass("completed"),setTimeout((function(){s.setContentModal(r.html())}),1e3),s.elFooter.find(".learn-press-notice").remove(),s.elBtnNo.show(),s.elBtnNo.on("click",(function(){window.location.reload()}))):(e=0,s.elFooter.find(".learn-press-notice").remove(),d.removeClass("running").addClass("error"),s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.href="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),n.message||(n.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(n.message)})))},error:function(t){e=0,s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.location="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),t.message||(t.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(t.message)}))},completed:function(){}};o("/lp/v1/database/upgrade",u,f)}},window.onbeforeunload=function(){if(e)return"LP is upgrading Database. Are you want to reload page?"},window.onclose=function(){if(e)return"LP is upgrading Database. Are you want to close page?"}},d=function(){if(c.length&&s.init()){var e=i(".wrapper-lp-status-upgrade"),t=window.location.search,n=new URLSearchParams(t).get("action");"upgrade-db"===n&&(s.elLPOverlay.show(),s.setTitleModal(c.find("h2").html()),s.setContentModal(i(".wrapper-lp-loading").html())),o("/lp/v1/database/get_steps",{},{success:function(t){var r=t.steps_completed,a=t.steps_default;if(void 0===r||void 0===a)return console.log("invalid steps_completed and steps_default"),!1;var l="";for(var o in a){var c=a[o],d=c.steps;for(var p in l='<div class="lp-group-step">',l+="<h3>"+c.label+"</h3>",d){var f=d[p],m="";void 0!==r[p]&&(m="completed"),l+='<div class="lp-item-step '+m+'">',l+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+f.name+'" /></div>',l+='<div class="lp-item-step-right">',l+='<label for=""><strong></strong>'+f.label+"</label>",l+='<div class="description">'+f.description+"</div>",l+='<div class="percent"></div>',l+='<span class="progress-bar"></span>',l+="</div>",l+="</div>"}l+="</div>",e.append(l);var v=i(".lp-btn-upgrade-db");"upgrade-db"===n&&u(),v.on("click",(function(){s.elLPOverlay.show(),u()}))}},error:function(e){},completed:function(){}})}},p=function(){var e=document.querySelector("#lp-tool-create-indexes-tables");e&&e.querySelector(".lp-btn-create-indexes").addEventListener("click",(function(t){t.preventDefault();var n=e.querySelector(".wrapper-lp-loading");if(s.init()){s.elLPOverlay.show(),s.setContentModal(n.innerHTML),s.setTitleModal(e.querySelector("h2").textContent),s.elBtnYes[0].style.display="inline-block",s.elBtnYes[0].textContent="Run",s.elBtnNo[0].textContent="Close";var r={success:function(e){e.status,e.message;var t=e.data,n=t.tables,r=t.table,a=document.querySelector(".example-lp-group-step");s.setContentModal(a.innerHTML);var l=s.elLPOverlay[0].querySelector(".lp-group-step "),i=function(e,t){var n=l.querySelector("input[value="+e+"]").closest(".lp-item-step");n.classList.add("running"),100===t&&(n.classList.remove("running"),n.classList.add("completed")),n.querySelector(".progress-bar").style.width=t};for(var c in n){var u=s.elLPOverlay[0].querySelector(".lp-item-step").cloneNode(!0),d=u.querySelector("input");u.querySelector("label").textContent="Table: ".concat(c),d.value=c,l.append(u)}s.callBackYes=function(){var e="/lp/v1/admin/tools/create-indexs",t={tables:n,table:r};s.elBtnNo[0].style.display="none",s.elBtnYes[0].style.display="none",i(r,.1);var a={success:function(n){var r,c,u=n.status,d=n.message,p=n.data,f=p.table,m=p.percent;i(t.table,m),void 0!==f&&(t.table!==f&&(i(f,.1),r=f,c=l.querySelector("input[value="+r+"]").closest(".lp-item-step").offsetTop-s.elMainContent[0].offsetTop+s.elMainContent[0].scrollTop,s.elMainContent.stop().animate({scrollTop:c},600)),t.table=f),"success"===u?setTimeout((function(){o(e,t,a)}),2e3):"finished"===u?(console.log("finished"),s.elBtnNo[0].style.display="inline-block",s.elBtnNo[0].textContent="Finish"):console.log(d)},error:function(e){console.log(e)},completed:function(){}};o(e,t,a)}},error:function(e){},completed:function(){}};o("/lp/v1/admin/tools/list-tables-indexs",{},r)}}))},f=function(){var e=document.querySelector("#lp-tool-re-upgrade-db");if(e){var t="lp/v1/database/check-db-valid-re-upgrade";o(t,{},{success:function(n){if(n.data.can_re_upgrade){e.style.display="block";var r=e.querySelector(".lp-btn-re-upgrade-db"),a=e.querySelector(".learn-press-message");r.addEventListener("click",(function(){confirm("Are want Re Upgrade!")&&o(t="lp/v1/database/del-tb-lp-upgrade-db",{},{success:function(e){var t=e.status,n=(e.message,e.data.url);"success"===t&&void 0!==n&&(window.location.href=n)},error:function(e){a.classList.add("error"),a.textContent=e.message,a.style.display="block"}})}))}},error:function(e){}})}};function m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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 l,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,l=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw l}}}}function v(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 h(e,t,n,r,a,l,s){try{var o=e[l](s),i=o.value}catch(e){return void n(e)}o.done?t(i):Promise.resolve(i).then(r,a)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function s(e){h(l,r,a,s,o,"next",e)}function o(e){h(l,r,a,s,o,"throw",e)}s(void 0)}))}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,a,l=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw a}}return l}(e,t)||b(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 b(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var C=wp.i18n.__,x=wp.components,S=x.TextControl,_=x.Button,k=x.Spinner,R=x.CheckboxControl,E=x.Notice,M=wp.element,B=M.useState,T=M.useEffect,P=wp.url.addQueryArgs,L=function(){var e=y(B(!1),2),t=e[0],n=e[1],r=y(B(""),2),a=r[0],l=r[1],s=y(B([]),2),o=s[0],i=s[1],c=y(B([]),2),u=c[0],d=c[1],p=y(B([]),2),f=p[0],h=p[1],b=y(B(!1),2),w=b[0],x=b[1];T((function(){M(a)}),[a]);var M=function(){var e=g(regeneratorRuntime.mark((function e(r){var a,l,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r&&!t){e.next=5;break}return h([]),i([]),e.abrupt("return");case 5:if(!(r.length<3)){e.next=9;break}return h([{status:"error",message:"Please enter at least 3 characters to searching course."}]),i([]),e.abrupt("return");case 9:return n(!0),e.next=12,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/search-courses",{s:r}),method:"GET"});case 12:a=e.sent,l=a.status,s=a.data,n(!1),"success"===l?(i(s),h([])):(h([{status:"error",message:a.message||"LearnPress: Search Course Fail!"}]),i([])),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.log(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(t){return e.apply(this,arguments)}}();var L=function(){var e=g(regeneratorRuntime.mark((function e(){var t,n,r,a,l,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==u.length){e.next=3;break}return h([{status:"error",message:"Please chooce Course for reset data!"}]),e.abrupt("return");case 3:if(confirm("Are you sure to reset course progress of all users enrolled this course?")){e.next=5;break}return e.abrupt("return");case 5:t=[],e.prev=6,x(!0),n=m(u),e.prev=9,n.s();case 11:if((r=n.n()).done){e.next=20;break}return a=r.value,e.next=15,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/reset-courses",{courseId:a}),method:"GET"});case 15:l=e.sent,s=l.status,l.data,o=l.message,t.push({status:s,message:o||"Course #".concat(a," reset successfully!")});case 18:e.next=11;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(9),n.e(e.t0);case 25:return e.prev=25,n.f(),e.finish(25);case 28:x(!1),e.next=34;break;case 31:e.prev=31,e.t1=e.catch(6),t.push({status:"error",message:e.t1.message||"LearnPress Error: Reset Course Data."});case 34:h(t);case 35:case"end":return e.stop()}}),e,null,[[6,31],[9,22,25,28]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("h2",null,C("Reset course progress","learnpress")),React.createElement("div",{className:"description"},React.createElement("p",null,C("This action will reset progress of a course for all users have enrolled.","learnpress")),React.createElement("p",null,C("Search results only show course have user data.","learnpress")),React.createElement("div",null,React.createElement(S,{placeholder:C("Search course by name","learnpress"),value:a,onChange:function(e){return l(e)},style:{width:300}}))),t&&React.createElement(k,null),o.length>0&&React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-reset-course_progress",style:{border:"1px solid #eee"}},React.createElement("div",null,React.createElement("div",{style:{background:"#eee"}},React.createElement("div",null,React.createElement(R,{checked:u.length===o.length,onChange:function(){u.length===o.length?d([]):d(o.map((function(e){return e.id})))},style:{margin:0}})),React.createElement("div",null,C("ID","learnpress")),React.createElement("div",null,C("Name","learnpress")),React.createElement("div",null,C("Students","learnpress")))),React.createElement("div",{style:{height:"100%",maxHeight:200,overflow:"auto"}},o.map((function(e){return React.createElement("div",{style:{borderTop:"1px solid #eee"},key:e.id},React.createElement("div",null,React.createElement(R,{checked:u.includes(e.id),onChange:function(){return function(e){var t=v(u);if(t.includes(e)){var n=t.indexOf(e);n>-1&&t.splice(n,1)}else t.push(e);d(t)}(e.id)}})),React.createElement("div",null,"#",e.id),React.createElement("div",null,e.title),React.createElement("div",null,e.students))})))),w?React.createElement(k,null):React.createElement(_,{isPrimary:!0,onClick:function(){return L()},style:{marginTop:10,height:30}},C("Reset now","learnpress"))),f.length>0&&f.map((function(e,t){return React.createElement(E,{status:e.status,key:t,isDismissible:!1},e.message)})),React.createElement("style",null,"\t\t\t\t.lp-reset-course_progress .components-base-control__field {\t\t\t\t\tmargin: 0;\t\t\t\t}\t\t\t\t.components-notice{\t\t\t\t\tmargin-left: 0;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div{\t\t\t\t\tdisplay: grid;\t\t\t\t\tgrid-template-columns: 80px 50px 1fr 80px;\t\t\t\t\talign-items: center;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div > div{\t\t\t\t\tmaegin: 0;\t\t\t\t\tpadding: 8px 10px;\t\t\t\t}\t\t\t\t"))};function A(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(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 O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var j,N,q,Y,F,I,D,U,G=function(){document.querySelectorAll("#learn-press-reset-course-users").length>0&&wp.element.render(React.createElement(L,null),A(document.querySelectorAll("#learn-press-reset-course-users"))[0])};j=jQuery,N=j(document),q=!1,Y=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(t.addClass("disabled").html(t.data("installing-text")),j(".lp-install-sample__response").remove(),q=!0,j.ajax({url:t.attr("href"),data:j(".lp-install-sample__options").serializeJSON(),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},F=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(t.addClass("disabled").html(t.data("uninstalling-text")),q=!0,j.ajax({url:t.attr("href"),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},I=function(e){e.preventDefault();var t=j(this);t.hasClass("disabled")||(t.addClass("disabled").html(t.data("cleaning-text")),j.ajax({url:t.attr("href"),data:{},success:function(e){t.removeClass("disabled").html(t.data("text"))},error:function(){t.removeClass("disabled").html(t.data("text"))}}))},D=function(){j.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success:function(e){},error:function(){}})},U=function(e){e.preventDefault(),j(".lp-install-sample__options").toggleClass("hide-if-js")},j((function(){d(),p(),f(),G(),N.on("click",".lp-install-sample__install",Y).on("click",".lp-install-sample__uninstall",F).on("click","#learn-press-clear-cache",I).on("click",'input[name="enable_hard_cache"]',D).on("click",".lp-install-sample__toggle-options",U)}))}});
assets/js/dist/frontend/config.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.config=function(t){var n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(n){return t[n]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=17)}({17:function(t,n,e){"use strict";e.r(n),e.d(n,"classNames",(function(){return r})),e.d(n,"isQuestionCorrect",(function(){return i})),e.d(n,"questionBlocks",(function(){return s})),e.d(n,"questionFooterButtons",(function(){return c})),e.d(n,"questionTitleParts",(function(){return l})),e.d(n,"questionChecker",(function(){return f})),e.d(n,"quizStartBlocks",(function(){return a}));var o=LP.Hook,r={Quiz:{Result:["quiz-result"],Content:["quiz-content"],Questions:["quiz-questions"],Buttons:["quiz-buttons"],Attempts:["quiz-attempts"]}},u={single_choice:function(){},multi_choice:function(){},true_or_false:function(){}},i={fill_in_blank:function(){return!0}},s=function(){return LP.Hook.applyFilters("question-blocks",["title","content","answer-options","explanation","hint","buttons"])},c=function(){return LP.Hook.applyFilters("question-footer-buttons",["instant-check"])},l=function(){return LP.Hook.applyFilters("question-title-parts",["index","title","hint","edit-permalink"])},f=function(t){var n=LP.Hook.applyFilters("question-checkers",u);return t&&n[t]?n[t]:function(){return{}}},a=function(){o.applyFilters("quiz-start-blocks",{meta:!0,description:!0,custom:"Hello"})}}});
1
+ this.LP=this.LP||{},this.LP.config=function(t){var n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(n){return t[n]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=18)}({18:function(t,n,e){"use strict";e.r(n),e.d(n,"classNames",(function(){return r})),e.d(n,"isQuestionCorrect",(function(){return i})),e.d(n,"questionBlocks",(function(){return s})),e.d(n,"questionFooterButtons",(function(){return c})),e.d(n,"questionTitleParts",(function(){return l})),e.d(n,"questionChecker",(function(){return f})),e.d(n,"quizStartBlocks",(function(){return a}));var o=LP.Hook,r={Quiz:{Result:["quiz-result"],Content:["quiz-content"],Questions:["quiz-questions"],Buttons:["quiz-buttons"],Attempts:["quiz-attempts"]}},u={single_choice:function(){},multi_choice:function(){},true_or_false:function(){}},i={fill_in_blank:function(){return!0}},s=function(){return LP.Hook.applyFilters("question-blocks",["title","content","answer-options","explanation","hint","buttons"])},c=function(){return LP.Hook.applyFilters("question-footer-buttons",["instant-check"])},l=function(){return LP.Hook.applyFilters("question-title-parts",["index","title","hint","edit-permalink"])},f=function(t){var n=LP.Hook.applyFilters("question-checkers",u);return t&&n[t]?n[t]:function(){return{}}},a=function(){o.applyFilters("quiz-start-blocks",{meta:!0,description:!0,custom:"Hello"})}}});
assets/js/dist/frontend/custom.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.custom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}({18:function(t,e){var n=LP.Hook,r=window.jQuery||jQuery;n.addFilter("question-blocks",(function(t){return t})),n.addAction("before-start-quiz",(function(){})),n.addAction("quiz-started",(function(t,e){r(".course-item-".concat(e)).removeClass("status-completed failed passed").addClass("has-status status-started"),window.onbeforeunload=function(){return"Warning!"}})),n.addAction("quiz-submitted",(function(t,e){r(".course-item-".concat(e)).removeClass("status-started passed failed").addClass("has-status status-completed ".concat(t.results.graduation)),window.onbeforeunload=null}))}});
1
+ this.LP=this.LP||{},this.LP.custom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=19)}({19:function(t,e){var n=LP.Hook,r=window.jQuery||jQuery;n.addFilter("question-blocks",(function(t){return t})),n.addAction("before-start-quiz",(function(){})),n.addAction("quiz-started",(function(t,e){r(".course-item-".concat(e)).removeClass("status-completed failed passed").addClass("has-status status-started"),window.onbeforeunload=function(){return"Warning!"}})),n.addAction("quiz-submitted",(function(t,e){r(".course-item-".concat(e)).removeClass("status-started passed failed").addClass("has-status status-completed ".concat(t.results.graduation)),window.onbeforeunload=null}))}});
assets/js/dist/frontend/lesson.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.lesson=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=16)}({16:function(e,t){}});
1
+ this.LP=this.LP||{},this.LP.lesson=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}({17:function(e,t){}});
assets/js/dist/frontend/modal.js CHANGED
@@ -168,10 +168,10 @@ var Modal = function Modal(_ref) {
168
  }, /*#__PURE__*/React.createElement("button", {
169
  className: "lp-button modal-button-ok",
170
  onClick: dataConfirm('yes')
171
- }, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["_x"])('OK', 'button confirm ok', 'learnpress'))), /*#__PURE__*/React.createElement("button", {
172
  className: "lp-button modal-button-cancel",
173
  onClick: dataConfirm('no')
174
- }, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["_x"])('Cancel', 'button confirm cancel', 'learnpress')))))), children);
175
  };
176
 
177
  /* harmony default export */ __webpack_exports__["default"] = (Modal);
168
  }, /*#__PURE__*/React.createElement("button", {
169
  className: "lp-button modal-button-ok",
170
  onClick: dataConfirm('yes')
171
+ }, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('OK', 'learnpress'))), /*#__PURE__*/React.createElement("button", {
172
  className: "lp-button modal-button-cancel",
173
  onClick: dataConfirm('no')
174
+ }, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Cancel', 'learnpress')))))), children);
175
  };
176
 
177
  /* harmony default export */ __webpack_exports__["default"] = (Modal);
assets/js/dist/frontend/modal.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.modal=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},21:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"show",(function(){return f})),n.d(r,"hide",(function(){return p})),n.d(r,"confirm",(function(){return d}));var o={};n.r(o),n.d(o,"isOpen",(function(){return b})),n.d(o,"getMessage",(function(){return O})),n.d(o,"confirm",(function(){return m}));var c=n(1);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l={},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SHOW_MODAL":return u(u({},e),{},{isOpen:!0,message:t.message,cb:t.cb});case"HIDE_MODAL":return u(u({},e),{},{isOpen:!1,message:!1,cb:null});case"CONFIRM":return e.cb&&setTimeout((function(){e.cb()}),10),u(u({},e),{},{confirm:t.value})}return e};function f(e,t){return{type:"SHOW_MODAL",message:e,cb:t}}function p(){return{type:"HIDE_MODAL"}}function d(e){return{type:"CONFIRM",value:e}}function b(e){return e.isOpen}function O(e){return e.message}function m(e,t,n){var r=Object(c.dispatch)("learnpress/modal"),o=r.show,i=r.hide;return e.message?(i(),e.confirm):(o(t,n),"no")}var y=n(6),v=n.n(y),g={ENROLL_COURSE_X:function(e,t){}};var j=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=v()(g)(n)(e.dispatch),e.dispatch=t,e};function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=LP.dataControls.controls,E=Object(c.registerStore)("learnpress/modal",{reducer:s,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},P)});j(E);var S=n(0),_=function(e){var t=e.children,n=Object(c.dispatch)("learnpress/modal"),r=(n.show,n.hide,n.confirm),o=Object(c.useSelect)((function(e){return e("learnpress/modal").isOpen()})),i=Object(c.useSelect)((function(e){return e("learnpress/modal").getMessage()})),u=function(e){return function(t){r(e)}},a={display:o?"block":"none"};return React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement("div",{id:"lp-modal-overlay",style:a}),React.createElement("div",{id:"lp-modal-window",style:a},React.createElement("div",{id:"lp-modal-content",dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{id:"lp-modal-buttons"},React.createElement("button",{className:"lp-button modal-button-ok",onClick:u("yes")},React.createElement("span",null,Object(S._x)("OK","button confirm ok","learnpress"))),React.createElement("button",{className:"lp-button modal-button-cancel",onClick:u("no")},React.createElement("span",null,Object(S._x)("Cancel","button confirm cancel","learnpress")))))),t)};t.default=_},6:function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,c,i=n[r.type],u=t(r);if(i)for(o=0;o<i.length;o++)(c=i[o](r,e))&&e.dispatch(c);return u}}}).effects=n,t}}});
1
+ this.LP=this.LP||{},this.LP.modal=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},22:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"show",(function(){return f})),r.d(n,"hide",(function(){return p})),r.d(n,"confirm",(function(){return d}));var o={};r.r(o),r.d(o,"isOpen",(function(){return b})),r.d(o,"getMessage",(function(){return O})),r.d(o,"confirm",(function(){return m}));var c=r(1);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l={},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SHOW_MODAL":return u(u({},e),{},{isOpen:!0,message:t.message,cb:t.cb});case"HIDE_MODAL":return u(u({},e),{},{isOpen:!1,message:!1,cb:null});case"CONFIRM":return e.cb&&setTimeout((function(){e.cb()}),10),u(u({},e),{},{confirm:t.value})}return e};function f(e,t){return{type:"SHOW_MODAL",message:e,cb:t}}function p(){return{type:"HIDE_MODAL"}}function d(e){return{type:"CONFIRM",value:e}}function b(e){return e.isOpen}function O(e){return e.message}function m(e,t,r){var n=Object(c.dispatch)("learnpress/modal"),o=n.show,i=n.hide;return e.message?(i(),e.confirm):(o(t,r),"no")}var y=r(7),v=r.n(y),g={ENROLL_COURSE_X:function(e,t){}};var j=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},r={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=v()(g)(r)(e.dispatch),e.dispatch=t,e};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P=LP.dataControls.controls,E=Object(c.registerStore)("learnpress/modal",{reducer:s,selectors:o,actions:n,controls:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},P)});j(E);var S=r(0),_=function(e){var t=e.children,r=Object(c.dispatch)("learnpress/modal"),n=(r.show,r.hide,r.confirm),o=Object(c.useSelect)((function(e){return e("learnpress/modal").isOpen()})),i=Object(c.useSelect)((function(e){return e("learnpress/modal").getMessage()})),u=function(e){return function(t){n(e)}},a={display:o?"block":"none"};return React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement("div",{id:"lp-modal-overlay",style:a}),React.createElement("div",{id:"lp-modal-window",style:a},React.createElement("div",{id:"lp-modal-content",dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{id:"lp-modal-buttons"},React.createElement("button",{className:"lp-button modal-button-ok",onClick:u("yes")},React.createElement("span",null,Object(S.__)("OK","learnpress"))),React.createElement("button",{className:"lp-button modal-button-cancel",onClick:u("no")},React.createElement("span",null,Object(S.__)("Cancel","learnpress")))))),t)};t.default=_},7:function(e,t,r){"use strict";e.exports=function(e){var t,r={};return function e(t,r){var n;if(Array.isArray(r))for(n=0;n<r.length;n++)e(t,r[n]);else for(n in r)t[n]=(t[n]||[]).concat(r[n])}(r,e),(t=function(e){return function(t){return function(n){var o,c,i=r[n.type],u=t(n);if(i)for(o=0;o<i.length;o++)(c=i[o](n,e))&&e.dispatch(c);return u}}}).effects=r,t}}});
assets/js/dist/frontend/question-types.js CHANGED
@@ -256,7 +256,7 @@ var QuestionBase = /*#__PURE__*/function (_Component) {
256
  status = _this$props3.status;
257
 
258
  if (status !== 'started') {
259
- return 'LP Error: can not set answers';
260
  }
261
 
262
  var $options = _this.$wrap.find('.option-check');
256
  status = _this$props3.status;
257
 
258
  if (status !== 'started') {
259
+ return Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('LP Error: can not set answers', 'learnpress');
260
  }
261
 
262
  var $options = _this.$wrap.find('.option-check');
assets/js/dist/frontend/question-types.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},2:function(e,t){e.exports=window.wp.element},20:function(e,t,n){"use strict";n.r(t),n.d(t,"QuestionBase",(function(){return v})),n.d(t,"SingleChoice",(function(){return E})),n.d(t,"MultipleChoices",(function(){return U})),n.d(t,"TrueOrFalse",(function(){return Y})),n.d(t,"FillInBlanks",(function(){return le})),n.d(t,"SortingChoice",(function(){return je}));var r=n(2),o=n(3),i=n(1),c=n(0);function u(e){return(u="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})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){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}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=lodash,d=h.isArray,v=(h.get,h.set,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}}),t&&l(e,t)}(u,e);var t,n,r,o=f(u);function u(e){var t;a(this,u),m(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var n=e.question;return n&&n.id!==t.questionId?{options:t.self.parseOptions(n.options)}:null})),m(y(t),"setInputRef",(function(e,n){t.inputs||(t.inputs={}),t.inputs[n]=e})),m(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,n=e.status,r=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===n&&o||r&&!i})),m(y(t),"maybeDisabledOption",(function(e){var n=t.props,r=(n.answered,n.status);return n.isCheckedAnswer||"started"!==r})),m(y(t),"setAnswerChecked",(function(){return function(e){var n=t.props,r=n.updateUserQuestionAnswers,o=n.question;if("started"!==n.status)return"LP Error: can not set answers";var i=t.$wrap.find(".option-check"),c=[],u="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(c.push(t.value),u))return!1})),r(o.id,u?c[0]:c)}})),m(y(t),"maybeCheckedAnswer",(function(e){var n=t.props.answered;return d(n)?!!n.find((function(t){return t==e})):e==n})),m(y(t),"getOptionType",(function(e,t){var n="radio";switch(e){case"multi_choice":n="checkbox"}return n})),m(y(t),"isDefaultType",(function(){return t.props.supportOptions})),m(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(c.__)("Render function should be overwritten from base.","learnpress"))})),m(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),m(y(t),"parseOptions",(function(e){return e&&(e=d(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=d(e)?e:JSON.parse(e)),e||[]})),m(y(t),"getOptions",(function(){return t.state.options||[]})),m(y(t),"isCorrect",(function(){var e,n,r,o=t.props.answered;if(!o)return!1;for(e=0,r=t.getOptions();e<r.length;e++)if("yes"===(n=r[e]).isTrue&&o==n.value)return!0;return!1})),m(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),m(y(t),"getCorrectLabel",(function(){var e=t.props,n=(e.status,e.answered,e.question),r=(LP.config.isQuestionCorrect[n.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(r?" correct":" incorrect")},React.createElement("span",{className:"label"},r?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),r?n.point:0,n.point)))}));var n=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:n?t.parseOptions(n.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=u,r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(n=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(n.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(n.type,t),className:"option-check",name:"started"===r?"learn-press-question-".concat(n.id):"",id:o,ref:function(n){e.setInputRef(n,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===r?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,n),r&&s(t,r),u}(r.Component));function w(e){return(w="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})(e)}function g(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(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 O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=function(){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}}();return function(){var n,r=A(e);if(t){var o=A(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==w(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=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}}),t&&S(e,t)}(n,e);var t=_(n);function n(){var e;j(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return C(P(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=g(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(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 q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t=function(){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}}();return function(){var n,r=B(e);if(t){var o=B(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return L(this,n)}}function L(e,t){return!t||"object"!==T(t)&&"function"!=typeof t?M(e):t}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=lodash.isBoolean,U=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}}),t&&I(e,t)}(n,e);var t=N(n);function n(){var e;x(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return D(M(e=t.call.apply(t,[this].concat(o))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(F(o)||!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if("yes"===(n=r[t]).isTrue){if(-1===o.indexOf(n.value))return!1}else if(-1!==o.indexOf(n.value))return!1;return!0})),D(M(e),"getOptionClass",(function(t){var n=e.props.answered,r=k(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?-1!==n.indexOf(t.value)&&r.push("answered-correct"):-1!==n.indexOf(t.value)&&r.push("answered-wrong"))),r})),e}return n}(v);function H(e){return(H="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})(e)}function Q(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $(e,t)}(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 $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){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}}();return function(){var n,r=K(e);if(t){var o=K(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return V(this,n)}}function V(e,t){return!t||"object"!==H(t)&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Y=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}}),t&&J(e,t)}(n,e);var t=W(n);function n(){var e;z(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return X(G(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=Q(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function Z(e){return(Z="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})(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(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 te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){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}}();return function(){var n,r=ae(e);if(t){var o=ae(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ce(this,n)}}function ce(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=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}}),t&&oe(e,t)}(i,e);var t,n,r,o=ie(i);function i(){var e;ne(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return se(ue(e=o.call.apply(o,[this].concat(n))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),n={};ee(t).map((function(t){t.addEventListener("input",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)})),t.addEventListener("paste",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)}))}))})),se(ue(e),"setAnswered",(function(t,n,r){var o=e.props,i=o.updateUserQuestionAnswers,c=o.question;if("started"!==o.status)return"LP Error: can not set answers";var u=Object.assign(t,se({},n,r));i(c.id,u)})),se(ue(e),"getCorrectLabel",(function(){var t=e.props,n=t.question,r=t.mark,o=r||0;return r&&(Number.isInteger(r)||(o=r.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(c.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(n.point," ").concat(Object(c.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(c.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(c.__)("Incorrect","learnpress")))})),e}return t=i,(n=[{key:"componentDidMount",value:function(){this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(e){return React.createElement("div",{key:"blank-".concat(e.uid),dangerouslySetInnerHTML:{__html:e.title||e.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&re(t.prototype,n),r&&re(t,r),i}(v);function fe(e){return(fe="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})(e)}function pe(e){return function(e){if(Array.isArray(e))return ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(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 ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function de(e){var t=function(){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}}();return function(){var n,r=ge(e);if(t){var o=ge(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ve(this,n)}}function ve(e,t){return!t||"object"!==fe(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var je=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}}),t&&he(e,t)}(i,e);var t,n,r,o=de(i);function i(){var e;be(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Oe(we(e=o.call.apply(o,[this].concat(n))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if(o[(n=r[t]).sorting]!==n.value)return!1;return!0})),Oe(we(e),"getCorrectLabel",(function(){var t=e.props.question,n=e.isCorrect.call(we(e));return e.maybeShowCorrectAnswer()&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),n?t.point:0,t.point))))})),Oe(we(e),"getAnswerSortingChoice",(function(){var t=e.props.question.options||[],n=e.isCorrect.call(we(e)),r=[];return!n&&t.length>0&&t.map((function(e){var t=e.sorting;if(void 0!==t)return r[t]=e.title})),r})),e}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.updateUserQuestionAnswers,n=e.question,r=document.querySelector("#answer-options-".concat(n.id));return jQuery(r).sortable({items:".answer-option",cursor:"move",axis:"y",handle:".option-drag",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,update:function(e,o){var i=r.querySelectorAll(".answer-option"),c=[];pe(i).map((function(e){return c.push(e.dataset.value)})),c.length>0&&t(n.id,c)}})}},{key:"render",value:function(){var e=this,t=this.props.question,n=this.getAnswerSortingChoice();return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(t.id),className:"answer-options lp-sorting-choice-ul"},this.getOptions().map((function(t,r){return React.createElement(React.Fragment,null,React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.value),"data-value":t.value},React.createElement("span",{className:"option-drag",style:{display:"flex",alignItems:"center",position:"absolute",height:"100%",left:14}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},React.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),React.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"}))),React.createElement("label",{htmlFor:"learn-press-answer-option-".concat(t.value),className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}})),n.length>0&&void 0!==n[r]&&React.createElement("div",{className:"lp-sorting-choice__check-answer",key:"lp-checked-answer-".concat(r),style:{marginBottom:10}},n[r]))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&me(t.prototype,n),r&&me(t,r),i}(v);function Se(e){return(Se="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})(e)}function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){var t=function(){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}}();return function(){var n,r=ke(e);if(t){var o=ke(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ee(this,n)}}function Ee(e,t){return!t||"object"!==Se(t)&&"function"!=typeof t?Te(e):t}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xe=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}}),t&&Ae(e,t)}(i,e);var t,n,r,o=Ce(i);function i(){var e;Re(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return qe(Te(e=o.call.apply(o,[this].concat(n))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks,sorting_choice:LP.questionTypes.SortingChoice})[t.type]})),e}return t=i,(n=[{key:"render",value:function(){var e=this.props,t=e.question,n=e.supportOptions,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){qe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props);r.supportOptions=-1!==n.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(c.sprintf)(Object(c.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,r))}}])&&Pe(t.prototype,n),r&&Pe(t,r),i}(r.Component),Ie=Object(o.compose)(Object(i.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(n),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(xe);t.default=Ie},3:function(e,t){e.exports=window.wp.compose}});
1
+ this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=21)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},2:function(e,t){e.exports=window.wp.element},21:function(e,t,r){"use strict";r.r(t),r.d(t,"QuestionBase",(function(){return v})),r.d(t,"SingleChoice",(function(){return E})),r.d(t,"MultipleChoices",(function(){return U})),r.d(t,"TrueOrFalse",(function(){return Y})),r.d(t,"FillInBlanks",(function(){return le})),r.d(t,"SortingChoice",(function(){return je}));var n=r(2),o=r(4),i=r(1),c=r(0);function u(e){return(u="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})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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,n.key,n)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){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}}();return function(){var r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p(this,r)}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h=lodash,d=h.isArray,v=(h.get,h.set,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}}),t&&l(e,t)}(u,e);var t,r,n,o=f(u);function u(e){var t;a(this,u),m(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var r=e.question;return r&&r.id!==t.questionId?{options:t.self.parseOptions(r.options)}:null})),m(y(t),"setInputRef",(function(e,r){t.inputs||(t.inputs={}),t.inputs[r]=e})),m(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,r=e.status,n=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===r&&o||n&&!i})),m(y(t),"maybeDisabledOption",(function(e){var r=t.props,n=(r.answered,r.status);return r.isCheckedAnswer||"started"!==n})),m(y(t),"setAnswerChecked",(function(){return function(e){var r=t.props,n=r.updateUserQuestionAnswers,o=r.question;if("started"!==r.status)return Object(c.__)("LP Error: can not set answers","learnpress");var i=t.$wrap.find(".option-check"),u=[],a="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(u.push(t.value),a))return!1})),n(o.id,a?u[0]:u)}})),m(y(t),"maybeCheckedAnswer",(function(e){var r=t.props.answered;return d(r)?!!r.find((function(t){return t==e})):e==r})),m(y(t),"getOptionType",(function(e,t){var r="radio";switch(e){case"multi_choice":r="checkbox"}return r})),m(y(t),"isDefaultType",(function(){return t.props.supportOptions})),m(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(c.__)("Render function should be overwritten from base.","learnpress"))})),m(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),m(y(t),"parseOptions",(function(e){return e&&(e=d(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=d(e)?e:JSON.parse(e)),e||[]})),m(y(t),"getOptions",(function(){return t.state.options||[]})),m(y(t),"isCorrect",(function(){var e,r,n,o=t.props.answered;if(!o)return!1;for(e=0,n=t.getOptions();e<n.length;e++)if("yes"===(r=n[e]).isTrue&&o==r.value)return!0;return!1})),m(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),m(y(t),"getCorrectLabel",(function(){var e=t.props,r=(e.status,e.answered,e.question),n=(LP.config.isQuestionCorrect[r.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),n?r.point:0,r.point)))}));var r=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:r?t.parseOptions(r.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=u,n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(r=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.question,n=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(r.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(r.type,t),className:"option-check",name:"started"===n?"learn-press-question-".concat(r.id):"",id:o,ref:function(r){e.setInputRef(r,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===n?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,r),n&&s(t,n),u}(n.Component));function w(e){return(w="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})(e)}function g(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(e,t)}(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 O(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 j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){var t=function(){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}}();return function(){var r,n=A(e);if(t){var o=A(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){return!t||"object"!==w(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E=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}}),t&&_(e,t)}(r,e);var t=S(r);function r(){var e;j(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return C(P(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var r=e.props.answered,n=g(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return r}(v);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(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 q(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 x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t=function(){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}}();return function(){var r,n=B(e);if(t){var o=B(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return L(this,r)}}function L(e,t){return!t||"object"!==T(t)&&"function"!=typeof t?M(e):t}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F=lodash.isBoolean,U=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}}),t&&I(e,t)}(r,e);var t=N(r);function r(){var e;x(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return D(M(e=t.call.apply(t,[this].concat(o))),"isCorrect",(function(){var t,r,n,o=e.props.answered;if(F(o)||!o)return!1;for(t=0,n=e.getOptions();t<n.length;t++)if("yes"===(r=n[t]).isTrue){if(-1===o.indexOf(r.value))return!1}else if(-1!==o.indexOf(r.value))return!1;return!0})),D(M(e),"getOptionClass",(function(t){var r=e.props.answered,n=k(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?-1!==r.indexOf(t.value)&&n.push("answered-correct"):-1!==r.indexOf(t.value)&&n.push("answered-wrong"))),n})),e}return r}(v);function H(e){return(H="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})(e)}function Q(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(e,t)}(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 $(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 z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){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}}();return function(){var r,n=K(e);if(t){var o=K(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return V(this,r)}}function V(e,t){return!t||"object"!==H(t)&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Y=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}}),t&&J(e,t)}(r,e);var t=W(r);function r(){var e;z(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return X(G(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var r=e.props.answered,n=Q(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return r}(v);function Z(e){return(Z="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})(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return te(e,t)}(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 te(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 re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ne(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,n.key,n)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){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}}();return function(){var r,n=ae(e);if(t){var o=ae(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ce(this,r)}}function ce(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var le=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}}),t&&oe(e,t)}(i,e);var t,r,n,o=ie(i);function i(){var e;re(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return se(ue(e=o.call.apply(o,[this].concat(r))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),r={};ee(t).map((function(t){t.addEventListener("input",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)})),t.addEventListener("paste",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)}))}))})),se(ue(e),"setAnswered",(function(t,r,n){var o=e.props,i=o.updateUserQuestionAnswers,c=o.question;if("started"!==o.status)return"LP Error: can not set answers";var u=Object.assign(t,se({},r,n));i(c.id,u)})),se(ue(e),"getCorrectLabel",(function(){var t=e.props,r=t.question,n=t.mark,o=n||0;return n&&(Number.isInteger(n)||(o=n.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(c.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(r.point," ").concat(Object(c.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(c.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(c.__)("Incorrect","learnpress")))})),e}return t=i,(r=[{key:"componentDidMount",value:function(){this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(e){return React.createElement("div",{key:"blank-".concat(e.uid),dangerouslySetInnerHTML:{__html:e.title||e.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&ne(t.prototype,r),n&&ne(t,n),i}(v);function fe(e){return(fe="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})(e)}function pe(e){return function(e){if(Array.isArray(e))return ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ye(e,t)}(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 ye(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 be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(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,n.key,n)}}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function de(e){var t=function(){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}}();return function(){var r,n=ge(e);if(t){var o=ge(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ve(this,r)}}function ve(e,t){return!t||"object"!==fe(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var je=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}}),t&&he(e,t)}(i,e);var t,r,n,o=de(i);function i(){var e;be(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Oe(we(e=o.call.apply(o,[this].concat(r))),"isCorrect",(function(){var t,r,n,o=e.props.answered;if(!o)return!1;for(t=0,n=e.getOptions();t<n.length;t++)if(o[(r=n[t]).sorting]!==r.value)return!1;return!0})),Oe(we(e),"getCorrectLabel",(function(){var t=e.props.question,r=e.isCorrect.call(we(e));return e.maybeShowCorrectAnswer()&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-response"+(r?" correct":" incorrect")},React.createElement("span",{className:"label"},r?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),r?t.point:0,t.point))))})),Oe(we(e),"getAnswerSortingChoice",(function(){var t=e.props.question.options||[],r=e.isCorrect.call(we(e)),n=[];return!r&&t.length>0&&t.map((function(e){var t=e.sorting;if(void 0!==t)return n[t]=e.title})),n})),e}return t=i,(r=[{key:"componentDidMount",value:function(){var e=this.props,t=e.updateUserQuestionAnswers,r=e.question,n=document.querySelector("#answer-options-".concat(r.id));return jQuery(n).sortable({items:".answer-option",cursor:"move",axis:"y",handle:".option-drag",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,update:function(e,o){var i=n.querySelectorAll(".answer-option"),c=[];pe(i).map((function(e){return c.push(e.dataset.value)})),c.length>0&&t(r.id,c)}})}},{key:"render",value:function(){var e=this,t=this.props.question,r=this.getAnswerSortingChoice();return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(t.id),className:"answer-options lp-sorting-choice-ul"},this.getOptions().map((function(t,n){return React.createElement(React.Fragment,null,React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.value),"data-value":t.value},React.createElement("span",{className:"option-drag",style:{display:"flex",alignItems:"center",position:"absolute",height:"100%",left:14}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},React.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),React.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"}))),React.createElement("label",{htmlFor:"learn-press-answer-option-".concat(t.value),className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}})),r.length>0&&void 0!==r[n]&&React.createElement("div",{className:"lp-sorting-choice__check-answer",key:"lp-checked-answer-".concat(n),style:{marginBottom:10}},r[n]))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&me(t.prototype,r),n&&me(t,n),i}(v);function _e(e){return(_e="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})(e)}function Se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(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,n.key,n)}}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){var t=function(){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}}();return function(){var r,n=ke(e);if(t){var o=ke(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ee(this,r)}}function Ee(e,t){return!t||"object"!==_e(t)&&"function"!=typeof t?Te(e):t}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xe=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}}),t&&Ae(e,t)}(i,e);var t,r,n,o=Ce(i);function i(){var e;Re(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return qe(Te(e=o.call.apply(o,[this].concat(r))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks,sorting_choice:LP.questionTypes.SortingChoice})[t.type]})),e}return t=i,(r=[{key:"render",value:function(){var e=this.props,t=e.question,r=e.supportOptions,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(r),!0).forEach((function(t){qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},this.props);n.supportOptions=-1!==r.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(c.sprintf)(Object(c.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,n))}}])&&Pe(t.prototype,r),n&&Pe(t,n),i}(n.Component),Ie=Object(o.compose)(Object(i.withSelect)((function(e,t){var r=t.question.id,n=e("learnpress/quiz"),o=n.getData,i=n.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(r),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(xe);t.default=Ie},4:function(e,t){e.exports=window.wp.compose}});
assets/js/dist/frontend/quiz.js CHANGED
@@ -175,7 +175,7 @@ var Attempts = function Attempts() {
175
  className: "quiz-attempts__marks"
176
  }, "".concat(row.userMark, " / ").concat(row.mark)), /*#__PURE__*/React.createElement("td", {
177
  className: "quiz-attempts__grade"
178
- }, row.passingGrade || Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["_x"])('-', 'unknown passing grade value', 'learnpress')), /*#__PURE__*/React.createElement("td", {
179
  className: "quiz-attempts__result"
180
  }, "".concat(parseFloat(row.result).toFixed(2), "%"), " ", /*#__PURE__*/React.createElement("span", null, row.graduationText)));
181
  })))));
@@ -279,7 +279,7 @@ var ButtonCheck = /*#__PURE__*/function (_Component) {
279
  onClick: this.checkAnswer
280
  }, /*#__PURE__*/React.createElement("span", {
281
  className: "instant-check__icon"
282
- }), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["_x"])('Check answer', 'label of button check answer', 'learnpress'), !answered && /*#__PURE__*/React.createElement("div", {
283
  className: "instant-check__info",
284
  dangerouslySetInnerHTML: {
285
  __html: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('You need to answer the question before check answer.', 'learnpress')
@@ -508,7 +508,7 @@ var Buttons = /*#__PURE__*/function (_Component) {
508
  confirm = _select.confirm,
509
  isOpen = _select.isOpen;
510
 
511
- if ('no' === confirm('Are you sure you want to retry quiz?', _this.startQuiz)) {
512
  !isOpen() && btn && btn.removeAttribute('disabled');
513
  return;
514
  }
@@ -730,7 +730,7 @@ var Buttons = /*#__PURE__*/function (_Component) {
730
  }, (status === 'completed' && canRetry || -1 !== ['', 'viewed'].indexOf(status)) && !isReviewing && /*#__PURE__*/React.createElement("button", {
731
  className: "lp-button start",
732
  onClick: this.startQuiz
733
- }, status === 'completed' ? "".concat(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["_x"])('Retake', 'label button retry quiz', 'learnpress')).concat(retakeNumber ? " (".concat(retakeNumber, ")") : '') : Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["_x"])('Start', 'label button start quiz', 'learnpress')), ('started' === status || isReviewing) && numPages > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
734
  className: "questions-pagination"
735
  }, this.pageNumbers()))), /*#__PURE__*/React.createElement("div", {
736
  className: "button-right"
@@ -1508,7 +1508,11 @@ var Question = /*#__PURE__*/function (_Component) {
1508
  }, isShowIndex, ".") : '';
1509
  },
1510
  title: function title() {
1511
- return question.title;
 
 
 
 
1512
  },
1513
  hint: function hint() {
1514
  return /*#__PURE__*/React.createElement(_buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__["default"], {
@@ -1693,6 +1697,9 @@ var Result = function Result() {
1693
  var QuizID = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(function (select) {
1694
  return select('learnpress/quiz').getData('id');
1695
  }, []);
 
 
 
1696
  Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
1697
  animate();
1698
  var graduation = '';
@@ -1725,9 +1732,12 @@ var Result = function Result() {
1725
  itemCompleted.textContent = parseInt(allItemCompleted.length);
1726
  }
1727
  }
1728
-
1729
- updateItemsProgress();
1730
  }, [results]);
 
 
 
 
 
1731
 
1732
  var updateItemsProgress = function updateItemsProgress() {
1733
  var elements = document.querySelectorAll('.popup-header__inner');
@@ -1842,7 +1852,7 @@ var Result = function Result() {
1842
  className: "result-achieved"
1843
  }, "".concat(percentResult, "%")), /*#__PURE__*/React.createElement("span", {
1844
  className: "result-require"
1845
- }, passingGradeValue || Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["_x"])('-', 'unknown passing grade value', 'learnpress'))), done && /*#__PURE__*/React.createElement("p", {
1846
  className: "result-message"
1847
  }, message), /*#__PURE__*/React.createElement("ul", {
1848
  className: "result-statistic"
@@ -3414,6 +3424,10 @@ var itemsProgress = function itemsProgress() {
3414
  return;
3415
  }
3416
 
 
 
 
 
3417
  if ('IntersectionObserver' in window) {
3418
  var eleObserver = new IntersectionObserver(function (entries, observer) {
3419
  entries.forEach(function (entry) {
175
  className: "quiz-attempts__marks"
176
  }, "".concat(row.userMark, " / ").concat(row.mark)), /*#__PURE__*/React.createElement("td", {
177
  className: "quiz-attempts__grade"
178
+ }, row.passingGrade || _x('-', 'unknown passing grade value', 'learnpress')), /*#__PURE__*/React.createElement("td", {
179
  className: "quiz-attempts__result"
180
  }, "".concat(parseFloat(row.result).toFixed(2), "%"), " ", /*#__PURE__*/React.createElement("span", null, row.graduationText)));
181
  })))));
279
  onClick: this.checkAnswer
280
  }, /*#__PURE__*/React.createElement("span", {
281
  className: "instant-check__icon"
282
+ }), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('Check answer', 'learnpress'), !answered && /*#__PURE__*/React.createElement("div", {
283
  className: "instant-check__info",
284
  dangerouslySetInnerHTML: {
285
  __html: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('You need to answer the question before check answer.', 'learnpress')
508
  confirm = _select.confirm,
509
  isOpen = _select.isOpen;
510
 
511
+ if ('no' === confirm(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Are you sure you want to retake quiz?', 'learnpress'), _this.startQuiz)) {
512
  !isOpen() && btn && btn.removeAttribute('disabled');
513
  return;
514
  }
730
  }, (status === 'completed' && canRetry || -1 !== ['', 'viewed'].indexOf(status)) && !isReviewing && /*#__PURE__*/React.createElement("button", {
731
  className: "lp-button start",
732
  onClick: this.startQuiz
733
+ }, status === 'completed' ? "".concat(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Retake', 'learnpress')).concat(retakeNumber ? " (".concat(retakeNumber, ")") : '') : Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Start', 'learnpress')), ('started' === status || isReviewing) && numPages > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
734
  className: "questions-pagination"
735
  }, this.pageNumbers()))), /*#__PURE__*/React.createElement("div", {
736
  className: "button-right"
1508
  }, isShowIndex, ".") : '';
1509
  },
1510
  title: function title() {
1511
+ return /*#__PURE__*/React.createElement("span", {
1512
+ dangerouslySetInnerHTML: {
1513
+ __html: question.title
1514
+ }
1515
+ });
1516
  },
1517
  hint: function hint() {
1518
  return /*#__PURE__*/React.createElement(_buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__["default"], {
1697
  var QuizID = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(function (select) {
1698
  return select('learnpress/quiz').getData('id');
1699
  }, []);
1700
+ var submitting = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(function (select) {
1701
+ return select('learnpress/quiz').getData('submitting');
1702
+ }, []);
1703
  Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
1704
  animate();
1705
  var graduation = '';
1732
  itemCompleted.textContent = parseInt(allItemCompleted.length);
1733
  }
1734
  }
 
 
1735
  }, [results]);
1736
+ Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
1737
+ if (submitting !== undefined) {
1738
+ updateItemsProgress();
1739
+ }
1740
+ }, [submitting]);
1741
 
1742
  var updateItemsProgress = function updateItemsProgress() {
1743
  var elements = document.querySelectorAll('.popup-header__inner');
1852
  className: "result-achieved"
1853
  }, "".concat(percentResult, "%")), /*#__PURE__*/React.createElement("span", {
1854
  className: "result-require"
1855
+ }, passingGradeValue || _x('-', 'unknown passing grade value', 'learnpress'))), done && /*#__PURE__*/React.createElement("p", {
1856
  className: "result-message"
1857
  }, message), /*#__PURE__*/React.createElement("ul", {
1858
  className: "result-statistic"
3424
  return;
3425
  }
3426
 
3427
+ if (elements[0].querySelectorAll('form.form-button-finish-course').length !== 0) {
3428
+ return;
3429
+ }
3430
+
3431
  if ('IntersectionObserver' in window) {
3432
  var eleObserver = new IntersectionObserver(function (entries, observer) {
3433
  entries.forEach(function (entry) {
assets/js/dist/frontend/quiz.min.js CHANGED
@@ -1,6 +1,6 @@
1
- this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},a=i,u=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}}))})))}});t.a=u},function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(5),o=n(4);function i(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(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 u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;c(n),t.unobserve(n)}}))}));a(e).map((function(e){return t.observe(e)}))}},c=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}()},function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
- */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return Sn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return Ot})),n.d(r,"setCurrentQuestion",(function(){return wt})),n.d(r,"setCurrentPage",(function(){return _t})),n.d(r,"__requestBeforeStartQuiz",(function(){return jt})),n.d(r,"__requestStartQuizSuccess",(function(){return Rt})),n.d(r,"startQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuiz",(function(){return St})),n.d(r,"__requestSubmitQuizSuccess",(function(){return Pt})),n.d(r,"submitQuiz",(function(){return Et})),n.d(r,"updateUserQuestionAnswers",(function(){return kt})),n.d(r,"__requestShowHintSuccess",(function(){return zt})),n.d(r,"showHint",(function(){return Qt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return At})),n.d(r,"checkAnswer",(function(){return It})),n.d(r,"markQuestionRendered",(function(){return Ct})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Tt}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Lt})),n.d(o,"getItemStatus",(function(){return Ut})),n.d(o,"getProp",(function(){return Ft})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Bt})),n.d(o,"getQuestions",(function(){return Gt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return $t})),n.d(o,"getQuestionMark",(function(){return Jt})),n.d(o,"getCurrentQuestion",(function(){return Zt})),n.d(o,"getQuestion",(function(){return Yt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Xt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return en})),n.d(o,"getUserMark",(function(){return tn}));var i=n(2),a=n(3),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="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})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(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 b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){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}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=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}}),t&&g(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a("Are you sure you want to retry quiz?",e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c._x)("Retake","label button retry quiz","learnpress")).concat(u?" (".concat(u,")"):""):Object(c._x)("Start","label button start quiz","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&v(t.prototype,n),r&&v(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),P=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function E(e){return(E="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})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){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}}();return function(){var n,r=N(e);if(t){var o=N(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?C(e):t}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var 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}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(C(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),M=n(12),L=n.n(M);function U(e){return(U="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})(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t=function(){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}}();return function(){var n,r=$(e);if(t){var o=$(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return K(this,n)}}function K(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?W(e):t}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=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}}),t&&B(e,t)}(i,e);var t,n,r,o=G(i);function i(){var e;return F(this,i),J(W(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:L()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c._x)("Check answer","label of button check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&H(t.prototype,n),r&&H(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(Z),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="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})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){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}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,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}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return n.title},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="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})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){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}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=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}}),t&&ve(e,t)}(i,e);var t,n,r,o=ge(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||Object(c._x)("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(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 Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Pe(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))},ze=n(8);function Qe(e){return function(e){if(Array.isArray(e))return Ce(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ie(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 Ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||Ie(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 Ie(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Te=function(){var e=Ae(Object(i.useState)(0),2),t=e[0],n=e[1],r=Ae(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]);Object(i.useEffect)((function(){d();var e="";if(e=s.graduation?s.graduation:s.result>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=Qe(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}p()}),[s]);var p=function(){var e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&Object(ze.a)(e[0])},d=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},m=t;Number.isInteger(t)||(m=parseFloat(t).toFixed(2));var b=190*Math.PI,y=b-m/100*b,h={strokeDasharray:"".concat(b," ").concat(b),strokeDashoffset:y},v=s.passingGrade||l,g="";g=s.graduation?s.graduation:m>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed";var O="";O=s.graduationText?s.graduationText:"passed"===g?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var w=["quiz-result",g];return React.createElement("div",{className:w.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:h,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(m,"%")),React.createElement("span",{className:"result-require"},v||Object(c._x)("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},O),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},xe=jQuery,De=lodash.debounce,Me=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=xe("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");xe(window).on("resize.refresh-quiz-stauts-bar",De((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Le(e){return function(e){if(Array.isArray(e))return Ue(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}(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 Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ge=lodash,Ke=(Ge.omit,Ge.flow),We=Ge.isArray,$e=Ge.chunk,Je=(LP.camelCaseDashObjectKeys,LP.localStorage),Ze=Je.get,Ye=Je.set,Ve={},Xe=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Be({},t.questionId,n))})},et=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Le(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},tt=function(e,t){return t.currentPage&&Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},nt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Le(n)})},rt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Le(n),answered:He(He({},e.answered),{},Be({},t.questionId,t.result)),checkedQuestions:[].concat(Le(e.checkedQuestions),[t.questionId])})},ot=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return tt(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Le(n)}))},it=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return tt(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},at=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),ut=Object(u.combineReducers)({blocks:at,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=$e(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:Ze("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return it(e,t);case"SET_CURRENT_QUESTION":return Ye("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return ot(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Xe(e,t):e;case"MARK_QUESTION_RENDERED":return et(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?tt(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return nt(e,t);case"CHECK_ANSWER":return rt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),st=n(9);function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var lt=regeneratorRuntime.mark(Et),ft=regeneratorRuntime.mark(Qt),pt=regeneratorRuntime.mark(It);function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){return function(e){if(Array.isArray(e))return bt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(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 bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,mt(e))}var ht=LP,vt=ht.camelCaseDashObjectKeys,gt=ht.Hook;function Ot(e,t){return t="string"==typeof e?dt({},e,t):e,{type:"SET_QUIZ_DATA",data:vt(t)}}function wt(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function _t(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function jt(e,t,n){return{type:"BEFORE_START_QUIZ"}}function Rt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var qt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(st.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,yt("learnpress/quiz","__requestStartQuizSuccess",vt(o),n,r);case 10:case"end":return e.stop()}}),e)}));function St(){return{type:"SUBMIT_QUIZ"}}function Pt(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Et(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(st.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,yt("learnpress/quiz","__requestSubmitQuizSuccess",vt(s.results),o,i);case 13:case"end":return c.stop()}}),lt)}function kt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function zt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function Qt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,yt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),ft)}function At(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function It(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(st.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,yt("learnpress/quiz","__requestCheckAnswerSuccess",e,vt(s));case 7:case"end":return c.stop()}}),pt)}function Ct(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Tt(e){return setTimeout((function(){yt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var xt=lodash,Dt=xt.get,Mt=xt.isArray,Lt=function(e,t){console.time("parseOptions");var n=Yt(e,t).options;return n=Mt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Mt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Ut(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.status"):""}function Ft(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.attempts"):[]}function Bt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.answered",{}):{}}function Gt(e){var t=e.userQuiz,n=Dt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?Dt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function $t(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".answered"))||void 0}function Jt(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".mark"))||void 0}function Zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Dt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=Dt(e,"userQuiz.currentPage")||1;return Dt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Yt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(Dt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Xt(e,t){}var en=function(e,t){var n=Dt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function tn(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var nn=n(6),rn=n.n(nn),on={ENROLL_COURSE_X:function(e,t){}};var an=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=rn()(on)(n)(e.dispatch),e.dispatch=t,e};function un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=LP.dataControls.controls,ln=Object(u.registerStore)("learnpress/quiz",{reducer:ut,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?un(Object(n),!0).forEach((function(t){sn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):un(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},cn)});an(ln);function fn(e){return(fn="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})(e)}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bn(e){var t=function(){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}}();return function(){var n,r=vn(e);if(t){var o=vn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return yn(this,n)}}function yn(e,t){return!t||"object"!==fn(t)&&"function"!=typeof t?hn(e):t}function hn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vn(e){return(vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var On=lodash.chunk,wn=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}}),t&&mn(e,t)}(i,e);var t,n,r,o=bn(i);function i(e){var t;return pn(this,i),gn(hn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=On(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Te,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(Me,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(P,null),r&&!n&&React.createElement(Se,null)))}}])&&dn(t.prototype,n),r&&dn(t,r),i}(i.Component),_n=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(wn);n(10);function jn(e){return function(e){if(Array.isArray(e))return Rn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rn(e,t)}(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 Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qn=LP.modal.default,Sn=(t.default=_n,function(e,t){wp.element.render(React.createElement(qn,null,React.createElement(_n,{settings:t})),jn(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
1
+ this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}};t.a=i},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";var r=n(3),o=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){r.a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}}))})))}});t.a=o},function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(6),o=n(5);function i(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(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 u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;c(n),t.unobserve(n)}}))}));a(e).map((function(e){return t.observe(e)}))}},c=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}()},function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
+ */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return Sn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return Ot})),n.d(r,"setCurrentQuestion",(function(){return wt})),n.d(r,"setCurrentPage",(function(){return _t})),n.d(r,"__requestBeforeStartQuiz",(function(){return jt})),n.d(r,"__requestStartQuizSuccess",(function(){return Rt})),n.d(r,"startQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuiz",(function(){return St})),n.d(r,"__requestSubmitQuizSuccess",(function(){return Et})),n.d(r,"submitQuiz",(function(){return Pt})),n.d(r,"updateUserQuestionAnswers",(function(){return kt})),n.d(r,"__requestShowHintSuccess",(function(){return zt})),n.d(r,"showHint",(function(){return At})),n.d(r,"__requestCheckAnswerSuccess",(function(){return Qt})),n.d(r,"checkAnswer",(function(){return It})),n.d(r,"markQuestionRendered",(function(){return Ct})),n.d(r,"setQuizMode",(function(){return Tt})),n.d(r,"sendKey",(function(){return Nt}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Lt})),n.d(o,"getItemStatus",(function(){return Ut})),n.d(o,"getProp",(function(){return Ft})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Bt})),n.d(o,"getQuestions",(function(){return Gt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return $t})),n.d(o,"getQuestionMark",(function(){return Jt})),n.d(o,"getCurrentQuestion",(function(){return Zt})),n.d(o,"getQuestion",(function(){return Yt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Xt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return en})),n.d(o,"getUserMark",(function(){return tn}));var i=n(2),a=n(4),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="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})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(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 b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){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}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=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}}),t&&g(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a(Object(c.__)("Are you sure you want to retake quiz?","learnpress"),e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c.__)("Retake","learnpress")).concat(u?" (".concat(u,")"):""):Object(c.__)("Start","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&v(t.prototype,n),r&&v(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function P(e){return(P="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})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Q(e){var t=function(){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}}();return function(){var n,r=T(e);if(t){var o=T(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?C(e):t}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var 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}}),t&&A(e,t)}(i,e);var t,n,r,o=Q(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return N(C(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),M=n(13),L=n.n(M);function U(e){return(U="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})(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t=function(){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}}();return function(){var n,r=$(e);if(t){var o=$(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return K(this,n)}}function K(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?W(e):t}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=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}}),t&&B(e,t)}(i,e);var t,n,r,o=G(i);function i(){var e;return F(this,i),J(W(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:L()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c.__)("Check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&H(t.prototype,n),r&&H(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(Z),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="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})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){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}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,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}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return React.createElement("span",{dangerouslySetInnerHTML:{__html:n.title}})},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="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})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){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}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=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}}),t&&ve(e,t)}(i,e);var t,n,r,o=ge(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||_x("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(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 Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Ee(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))},ze=n(9);function Ae(e){return function(e){if(Array.isArray(e))return Ce(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ie(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 Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||Ie(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 Ie(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Te=lodash.debounce,Ne=function(){var e=Qe(Object(i.useState)(0),2),t=e[0],n=e[1],r=Qe(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]),p=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("submitting")}),[]);Object(i.useEffect)((function(){m();var e="";if(e=s.graduation?s.graduation:s.result>=g.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=Ae(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[s]),Object(i.useEffect)((function(){void 0!==p&&d()}),[p]);var d=function(){var e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&Object(ze.a)(e[0])},m=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Te((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Te((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},b=t;Number.isInteger(t)||(b=parseFloat(t).toFixed(2));var y=190*Math.PI,h=y-b/100*y,v={strokeDasharray:"".concat(y," ").concat(y),strokeDashoffset:h},g=s.passingGrade||l,O="";O=s.graduation?s.graduation:b>=g.replace(/[^0-9\.]+/g,"")?"passed":"failed";var w="";w=s.graduationText?s.graduationText:"passed"===O?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var _=["quiz-result",O];return React.createElement("div",{className:_.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:v,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(b,"%")),React.createElement("span",{className:"result-require"},g||_x("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},w),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},xe=jQuery,De=lodash.debounce,Me=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=xe("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");xe(window).on("resize.refresh-quiz-stauts-bar",De((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Le(e){return function(e){if(Array.isArray(e))return Ue(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}(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 Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ge=lodash,Ke=(Ge.omit,Ge.flow),We=Ge.isArray,$e=Ge.chunk,Je=(LP.camelCaseDashObjectKeys,LP.localStorage),Ze=Je.get,Ye=Je.set,Ve={},Xe=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Be({},t.questionId,n))})},et=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Le(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},tt=function(e,t){return t.currentPage&&Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},nt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Le(n)})},rt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Le(n),answered:He(He({},e.answered),{},Be({},t.questionId,t.result)),checkedQuestions:[].concat(Le(e.checkedQuestions),[t.questionId])})},ot=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return tt(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Le(n)}))},it=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return tt(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},at=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),ut=Object(u.combineReducers)({blocks:at,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=$e(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:Ze("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return it(e,t);case"SET_CURRENT_QUESTION":return Ye("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return ot(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Xe(e,t):e;case"MARK_QUESTION_RENDERED":return et(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?tt(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return nt(e,t);case"CHECK_ANSWER":return rt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),st=n(10);function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var lt=regeneratorRuntime.mark(Pt),ft=regeneratorRuntime.mark(At),pt=regeneratorRuntime.mark(It);function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){return function(e){if(Array.isArray(e))return bt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(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 bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,mt(e))}var ht=LP,vt=ht.camelCaseDashObjectKeys,gt=ht.Hook;function Ot(e,t){return t="string"==typeof e?dt({},e,t):e,{type:"SET_QUIZ_DATA",data:vt(t)}}function wt(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function _t(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function jt(e,t,n){return{type:"BEFORE_START_QUIZ"}}function Rt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var qt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(st.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,yt("learnpress/quiz","__requestStartQuizSuccess",vt(o),n,r);case 10:case"end":return e.stop()}}),e)}));function St(){return{type:"SUBMIT_QUIZ"}}function Et(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Pt(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(st.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,yt("learnpress/quiz","__requestSubmitQuizSuccess",vt(s.results),o,i);case 13:case"end":return c.stop()}}),lt)}function kt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function zt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function At(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,yt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),ft)}function Qt(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function It(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(st.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,yt("learnpress/quiz","__requestCheckAnswerSuccess",e,vt(s));case 7:case"end":return c.stop()}}),pt)}function Ct(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Tt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Nt(e){return setTimeout((function(){yt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var xt=lodash,Dt=xt.get,Mt=xt.isArray,Lt=function(e,t){console.time("parseOptions");var n=Yt(e,t).options;return n=Mt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Mt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Ut(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.status"):""}function Ft(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.attempts"):[]}function Bt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.answered",{}):{}}function Gt(e){var t=e.userQuiz,n=Dt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?Dt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function $t(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".answered"))||void 0}function Jt(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".mark"))||void 0}function Zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Dt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=Dt(e,"userQuiz.currentPage")||1;return Dt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Yt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(Dt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Xt(e,t){}var en=function(e,t){var n=Dt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function tn(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var nn=n(7),rn=n.n(nn),on={ENROLL_COURSE_X:function(e,t){}};var an=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=rn()(on)(n)(e.dispatch),e.dispatch=t,e};function un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=LP.dataControls.controls,ln=Object(u.registerStore)("learnpress/quiz",{reducer:ut,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?un(Object(n),!0).forEach((function(t){sn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):un(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},cn)});an(ln);function fn(e){return(fn="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})(e)}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bn(e){var t=function(){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}}();return function(){var n,r=vn(e);if(t){var o=vn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return yn(this,n)}}function yn(e,t){return!t||"object"!==fn(t)&&"function"!=typeof t?hn(e):t}function hn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vn(e){return(vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var On=lodash.chunk,wn=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}}),t&&mn(e,t)}(i,e);var t,n,r,o=bn(i);function i(e){var t;return pn(this,i),gn(hn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=On(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Ne,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(Me,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(E,null),r&&!n&&React.createElement(Se,null)))}}])&&dn(t.prototype,n),r&&dn(t,r),i}(i.Component),_n=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(wn);n(11);function jn(e){return function(e){if(Array.isArray(e))return Rn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rn(e,t)}(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 Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qn=LP.modal.default,Sn=(t.default=_n,function(e,t){wp.element.render(React.createElement(qn,null,React.createElement(_n,{settings:t})),jn(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
assets/js/dist/frontend/single-course.js CHANGED
@@ -680,7 +680,7 @@ function run() {
680
  Object(_single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__["Sidebar"])();
681
  }
682
 
683
- window.addEventListener('DOMContentLoaded', function () {
684
  run();
685
  });
686
 
@@ -725,13 +725,8 @@ var $ = jQuery;
725
  var _lodash = lodash,
726
  throttle = _lodash.throttle;
727
  var Sidebar = function Sidebar() {
728
- var $popup = $('#popup-course');
729
- var $curriculum = $('#learn-press-course-curriculum');
730
- var timerClearScroll;
731
- $(document).on('change', '#sidebar-toggle', function (event) {
732
- LP.Cookies.set('sidebar-toggle', event.target.checked);
733
- toggleSidebar(event.target.checked);
734
- });
735
 
736
  var toggleSidebar = function toggleSidebar(toggle) {
737
  $('body').removeClass('lp-sidebar-toggle__open');
@@ -742,9 +737,28 @@ var Sidebar = function Sidebar() {
742
  } else {
743
  $('body').addClass('lp-sidebar-toggle__open');
744
  }
745
- };
 
 
 
 
 
 
 
 
 
 
746
 
747
- toggleSidebar(LP.Cookies.get('sidebar-toggle'));
 
 
 
 
 
 
 
 
 
748
  $curriculum.find('.section-desc').each(function (i, el) {
749
  var a = $('<span class="show-desc"></span>').on('click', function () {
750
  b.toggleClass('c');
@@ -771,23 +785,7 @@ var Sidebar = function Sidebar() {
771
  LP.Cookies.remove('closed-section-(.*)');
772
  LP.Cookies.set('closed-section-' + lpGlobalSettings.post_id, _toConsumableArray(new Set(sections)));
773
  });
774
- }); // Popup only
775
-
776
- if ($popup.length) {
777
- $curriculum.on('scroll', throttle(function () {
778
- var $self = $(this);
779
- $self.addClass('scrolling');
780
- timerClearScroll && clearTimeout(timerClearScroll);
781
- timerClearScroll = setTimeout(function () {
782
- $self.removeClass('scrolling');
783
- }, 1000);
784
- }, 500));
785
- LP.toElement('.course-item.current', {
786
- container: '.curriculum-scrollable:eq(1)',
787
- offset: 100,
788
- duration: 1
789
- });
790
- }
791
  };
792
 
793
  /***/ }),
680
  Object(_single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__["Sidebar"])();
681
  }
682
 
683
+ document.addEventListener('DOMContentLoaded', function () {
684
  run();
685
  });
686
 
725
  var _lodash = lodash,
726
  throttle = _lodash.throttle;
727
  var Sidebar = function Sidebar() {
728
+ // Tungnx - Show/hide sidebar curriculumn
729
+ var elSidebarToggle = document.querySelector('#sidebar-toggle'); // For style of theme
 
 
 
 
 
730
 
731
  var toggleSidebar = function toggleSidebar(toggle) {
732
  $('body').removeClass('lp-sidebar-toggle__open');
737
  } else {
738
  $('body').addClass('lp-sidebar-toggle__open');
739
  }
740
+ }; // For lp and theme
741
+
742
+
743
+ if (elSidebarToggle) {
744
+ if ($(window).innerWidth() <= 768) {
745
+ elSidebarToggle.setAttribute('checked', 'checked');
746
+ } else if (LP.Cookies.get('sidebar-toggle')) {
747
+ elSidebarToggle.setAttribute('checked', 'checked');
748
+ } else {
749
+ elSidebarToggle.removeAttribute('checked');
750
+ }
751
 
752
+ document.querySelector('#popup-course').addEventListener('click', function (e) {
753
+ if (e.target.id === 'sidebar-toggle') {
754
+ LP.Cookies.set('sidebar-toggle', e.target.checked ? true : false);
755
+ toggleSidebar(LP.Cookies.get('sidebar-toggle'));
756
+ }
757
+ });
758
+ } // End editor by tungnx
759
+
760
+
761
+ var $curriculum = $('#learn-press-course-curriculum');
762
  $curriculum.find('.section-desc').each(function (i, el) {
763
  var a = $('<span class="show-desc"></span>').on('click', function () {
764
  b.toggleClass('c');
785
  LP.Cookies.remove('closed-section-(.*)');
786
  LP.Cookies.set('closed-section-' + lpGlobalSettings.post_id, _toConsumableArray(new Set(sections)));
787
  });
788
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
  };
790
 
791
  /***/ }),
assets/js/dist/frontend/single-course.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.singleCourse=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}({14:function(e,t){!function(){e.exports=this.LP.quiz}()},15:function(e,t){},2:function(e,t){e.exports=window.wp.element},23:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return b})),n.d(t,"initCourseTabs",(function(){return w})),n.d(t,"initCourseSidebar",(function(){return S})),n.d(t,"enrollCourse",(function(){return C}));var r=n(2),o=(n(14),n(15),n(7));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){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}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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}}),t&&l(e,t)}(i,e);var t,n,r,o=c(i);function i(){return a(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return React.createElement(React.Fragment,null)}}])&&s(t.prototype,n),r&&s(t,r),i}(r.Component);window.addEventListener("DOMContentLoaded",(function(){Object(o.a)()}));n(5);var p=n(4);function v(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)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(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 m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}t.default=f;var b=function(){wp.element.render(React.createElement(f,null))},g=jQuery,w=function(){g("#learn-press-course-tabs").on("change",'input[name="learn-press-course-tab-radio"]',(function(e){var t=g('input[name="learn-press-course-tab-radio"]:checked').val();LP.Cookies.set("course-tab",t),g('label[for="'+g(e.target).attr("id")+'"]').closest("li").addClass("active").siblings().removeClass("active")}))},S=function(){var e=g(".course-summary-sidebar");if(e.length){var t=g(window),n=e.children(),r=e.offset(),o=e.height(),i=n.height(),a=32;t.on("scroll.fixed-course-sidebar",(function(){var s=t.scrollTop()-r.top+a;if(s<0)return e.removeClass("slide-top slide-down"),void n.css("top","");s>o-i?(e.removeClass("slide-down").addClass("slide-top"),n.css("top",o-i)):(e.removeClass("slide-top").addClass("slide-down"),n.css("top",a))})).trigger("scroll.fixed-course-sidebar")}},C=function(){var e=document.querySelectorAll("form.enroll-course");e.length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/enroll-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(r.style.display="none",e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),form.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=enroll-course]").value,o=e.querySelector("button.button-enroll-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),null!==document.querySelector(".course-detail-info")&&window.addEventListener("pageshow",(function(e){(e.persisted||void 0!==window.performance&&"back_forward"==String(window.performance.getEntriesByType("navigation")[0].type))&&location.reload()}))},L=function(){var e=document.querySelectorAll(".lp-form-retake-course");e.length&&e.forEach((function(e){var t=e.querySelector(".button-retake-course"),n=e.querySelector("[name=retake-course]").value,r=e.querySelector(".lp-ajax-message");e.addEventListener("submit",(function(e){e.preventDefault()})),t.addEventListener("click",(function(e){var o;e.preventDefault(),t.classList.add("loading"),t.disabled=!0,o=t,wp.apiFetch({path:"/lp/v1/courses/retake-course",method:"POST",data:{id:n}}).then((function(e){var t=e.status,n=e.message,i=e.data;r.innerHTML=n,null!=t&&"success"===t?(o.style.display="none",setTimeout((function(){window.location.replace(i.url_redirect)}),1e3)):r.classList.add("error")})).catch((function(e){r.classList.add("error"),r.innerHTML="error: "+e.message})).then((function(){o.classList.remove("loading"),o.disabled=!1,r.style.display="block"}))}))}))};g(window).on("load",(function(){var e;g("#popup-course"),g("#learn-press-course-curriculum");v(document.querySelectorAll(".course-extra-box")).map((function(e){var t=e.querySelector(".course-extra-box__title");t.addEventListener("click",(function(){var n=t.nextElementSibling,r=document.querySelector(".course-extra-box.active");r&&!e.classList.contains("active")&&(r.classList.remove("active"),r.querySelector(".course-extra-box__content").style.display="none"),e.classList.contains("active")?(e.classList.remove("active"),n.style.display="none"):(e.classList.add("active"),n.style.display="block")}))})),w(),S(),C(),(e=document.querySelectorAll("form.purchase-course")).length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/purchase-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),"success"===i&&a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),e.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=purchase-course]").value,o=e.querySelector("button.button-purchase-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),L(),function(){var e=document.querySelectorAll(".lp-course-progress-wrapper");if(e.length){if("IntersectionObserver"in window){var t=new IntersectionObserver((function(e,r){e.forEach((function(e){if(e.isIntersecting){var r=e.target;setTimeout((function(){n(r)}),600),t.unobserve(r)}}))}));v(e).map((function(e){return t.observe(e)}))}var n=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:"lp/v1/lazy-load/course-progress",method:"POST",data:{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}});case 2:n=e.sent,r=n.data,t.innerHTML=r;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}}(),p.a.init()}))},4:function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},a=i,s=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}}))})))}});t.a=s},5:function(e,t){e.exports=window.wp.url},7:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return s}));var i=jQuery,a=lodash.throttle,s=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i(document).on("change","#sidebar-toggle",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),o(e.target.checked)}));var o=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};o(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))})),t.length&&(n.on("scroll",a((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}}});
1
+ this.LP=this.LP||{},this.LP.singleCourse=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([,,function(e,t){e.exports=window.wp.element},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}};t.a=i},,function(e,t,n){"use strict";var r=n(3),o=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){r.a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}}))})))}});t.a=o},function(e,t){e.exports=window.wp.url},,function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return a}));var i=jQuery,a=(lodash.throttle,function(){var e=document.querySelector("#sidebar-toggle");e&&(i(window).innerWidth()<=768||LP.Cookies.get("sidebar-toggle")?e.setAttribute("checked","checked"):e.removeAttribute("checked"),document.querySelector("#popup-course").addEventListener("click",(function(e){var t;"sidebar-toggle"===e.target.id&&(LP.Cookies.set("sidebar-toggle",!!e.target.checked),t=LP.Cookies.get("sidebar-toggle"),i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),t?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open"))}))),i("#learn-press-course-curriculum").find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))}))})},,,,,,,function(e,t){!function(){e.exports=this.LP.quiz}()},function(e,t){},,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return b})),n.d(t,"initCourseTabs",(function(){return w})),n.d(t,"initCourseSidebar",(function(){return S})),n.d(t,"enrollCourse",(function(){return L}));var r=n(2),o=(n(15),n(16),n(8));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){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}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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}}),t&&l(e,t)}(i,e);var t,n,r,o=c(i);function i(){return a(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return React.createElement(React.Fragment,null)}}])&&s(t.prototype,n),r&&s(t,r),i}(r.Component);document.addEventListener("DOMContentLoaded",(function(){Object(o.a)()}));n(6);var p=n(5);function v(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)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(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 m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}t.default=f;var b=function(){wp.element.render(React.createElement(f,null))},g=jQuery,w=function(){g("#learn-press-course-tabs").on("change",'input[name="learn-press-course-tab-radio"]',(function(e){var t=g('input[name="learn-press-course-tab-radio"]:checked').val();LP.Cookies.set("course-tab",t),g('label[for="'+g(e.target).attr("id")+'"]').closest("li").addClass("active").siblings().removeClass("active")}))},S=function(){var e=g(".course-summary-sidebar");if(e.length){var t=g(window),n=e.children(),r=e.offset(),o=e.height(),i=n.height(),a=32;t.on("scroll.fixed-course-sidebar",(function(){var s=t.scrollTop()-r.top+a;if(s<0)return e.removeClass("slide-top slide-down"),void n.css("top","");s>o-i?(e.removeClass("slide-down").addClass("slide-top"),n.css("top",o-i)):(e.removeClass("slide-top").addClass("slide-down"),n.css("top",a))})).trigger("scroll.fixed-course-sidebar")}},L=function(){var e=document.querySelectorAll("form.enroll-course");e.length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/enroll-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(r.style.display="none",e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),form.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=enroll-course]").value,o=e.querySelector("button.button-enroll-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),null!==document.querySelector(".course-detail-info")&&window.addEventListener("pageshow",(function(e){(e.persisted||void 0!==window.performance&&"back_forward"==String(window.performance.getEntriesByType("navigation")[0].type))&&location.reload()}))},C=function(){var e=document.querySelectorAll(".lp-form-retake-course");e.length&&e.forEach((function(e){var t=e.querySelector(".button-retake-course"),n=e.querySelector("[name=retake-course]").value,r=e.querySelector(".lp-ajax-message");e.addEventListener("submit",(function(e){e.preventDefault()})),t.addEventListener("click",(function(e){var o;e.preventDefault(),t.classList.add("loading"),t.disabled=!0,o=t,wp.apiFetch({path:"/lp/v1/courses/retake-course",method:"POST",data:{id:n}}).then((function(e){var t=e.status,n=e.message,i=e.data;r.innerHTML=n,null!=t&&"success"===t?(o.style.display="none",setTimeout((function(){window.location.replace(i.url_redirect)}),1e3)):r.classList.add("error")})).catch((function(e){r.classList.add("error"),r.innerHTML="error: "+e.message})).then((function(){o.classList.remove("loading"),o.disabled=!1,r.style.display="block"}))}))}))};g(window).on("load",(function(){var e;g("#popup-course"),g("#learn-press-course-curriculum");v(document.querySelectorAll(".course-extra-box")).map((function(e){var t=e.querySelector(".course-extra-box__title");t.addEventListener("click",(function(){var n=t.nextElementSibling,r=document.querySelector(".course-extra-box.active");r&&!e.classList.contains("active")&&(r.classList.remove("active"),r.querySelector(".course-extra-box__content").style.display="none"),e.classList.contains("active")?(e.classList.remove("active"),n.style.display="none"):(e.classList.add("active"),n.style.display="block")}))})),w(),S(),L(),(e=document.querySelectorAll("form.purchase-course")).length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/purchase-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),"success"===i&&a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),e.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=purchase-course]").value,o=e.querySelector("button.button-purchase-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),C(),function(){var e=document.querySelectorAll(".lp-course-progress-wrapper");if(e.length){if("IntersectionObserver"in window){var t=new IntersectionObserver((function(e,r){e.forEach((function(e){if(e.isIntersecting){var r=e.target;setTimeout((function(){n(r)}),600),t.unobserve(r)}}))}));v(e).map((function(e){return t.observe(e)}))}var n=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:"lp/v1/lazy-load/course-progress",method:"POST",data:{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}});case 2:n=e.sent,r=n.data,t.innerHTML=r;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}}(),p.a.init()}))}]);
assets/js/dist/frontend/single-curriculum.js CHANGED
@@ -372,6 +372,10 @@ var itemsProgress = function itemsProgress() {
372
  return;
373
  }
374
 
 
 
 
 
375
  if ('IntersectionObserver' in window) {
376
  var eleObserver = new IntersectionObserver(function (entries, observer) {
377
  entries.forEach(function (entry) {
@@ -569,13 +573,8 @@ var $ = jQuery;
569
  var _lodash = lodash,
570
  throttle = _lodash.throttle;
571
  var Sidebar = function Sidebar() {
572
- var $popup = $('#popup-course');
573
- var $curriculum = $('#learn-press-course-curriculum');
574
- var timerClearScroll;
575
- $(document).on('change', '#sidebar-toggle', function (event) {
576
- LP.Cookies.set('sidebar-toggle', event.target.checked);
577
- toggleSidebar(event.target.checked);
578
- });
579
 
580
  var toggleSidebar = function toggleSidebar(toggle) {
581
  $('body').removeClass('lp-sidebar-toggle__open');
@@ -586,9 +585,28 @@ var Sidebar = function Sidebar() {
586
  } else {
587
  $('body').addClass('lp-sidebar-toggle__open');
588
  }
589
- };
590
 
591
- toggleSidebar(LP.Cookies.get('sidebar-toggle'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  $curriculum.find('.section-desc').each(function (i, el) {
593
  var a = $('<span class="show-desc"></span>').on('click', function () {
594
  b.toggleClass('c');
@@ -615,23 +633,7 @@ var Sidebar = function Sidebar() {
615
  LP.Cookies.remove('closed-section-(.*)');
616
  LP.Cookies.set('closed-section-' + lpGlobalSettings.post_id, _toConsumableArray(new Set(sections)));
617
  });
618
- }); // Popup only
619
-
620
- if ($popup.length) {
621
- $curriculum.on('scroll', throttle(function () {
622
- var $self = $(this);
623
- $self.addClass('scrolling');
624
- timerClearScroll && clearTimeout(timerClearScroll);
625
- timerClearScroll = setTimeout(function () {
626
- $self.removeClass('scrolling');
627
- }, 1000);
628
- }, 500));
629
- LP.toElement('.course-item.current', {
630
- container: '.curriculum-scrollable:eq(1)',
631
- offset: 100,
632
- duration: 1
633
- });
634
- }
635
  };
636
 
637
  /***/ }),
@@ -724,7 +726,7 @@ var SingleCurriculums = /*#__PURE__*/function (_Component) {
724
  }(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Component"]);
725
 
726
  /* harmony default export */ __webpack_exports__["default"] = (SingleCurriculums);
727
- window.addEventListener('DOMContentLoaded', function () {
728
  LP.Hook.doAction('lp-compatible-builder');
729
  Object(_components_search__WEBPACK_IMPORTED_MODULE_1__["searchCourseContent"])();
730
  Object(_components_sidebar__WEBPACK_IMPORTED_MODULE_2__["Sidebar"])();
@@ -747,6 +749,8 @@ window.addEventListener('DOMContentLoaded', function () {
747
 
748
  "use strict";
749
  __webpack_require__.r(__webpack_exports__);
 
 
750
  var $ = jQuery;
751
  var scrollToItemCurrent = {
752
  init: function init() {
@@ -754,6 +758,7 @@ var scrollToItemCurrent = {
754
  var elItemViewing = $('.viewing-course-item');
755
 
756
  if (elItemViewing.length) {
 
757
  var heightCourseItemContentHeader = $('#popup-sidebar').outerHeight();
758
  var heightSectionTitle = $('.section-title').outerHeight();
759
  var heightSectionHeader = $('.section-header').outerHeight();
@@ -776,16 +781,9 @@ var scrollToItemCurrent = {
776
 
777
  var elItemCurrent = $('.course-item-' + idItem);
778
  var offSetTop = elItemCurrent.offset().top;
779
- var numberOffSetTop = offSetTop - heightCourseItemContentHeader;
780
-
781
- if (undefined === heightSectionTitle) {
782
- numberOffSetTop = numberOffSetTop - heightSectionHeader + 20;
783
- } else {
784
- numberOffSetTop = numberOffSetTop - heightSectionTitle;
785
- }
786
-
787
- $('#learn-press-course-curriculum').animate({
788
- scrollTop: numberOffSetTop + 300
789
  }, 800);
790
  }
791
  };
372
  return;
373
  }
374
 
375
+ if (elements[0].querySelectorAll('form.form-button-finish-course').length !== 0) {
376
+ return;
377
+ }
378
+
379
  if ('IntersectionObserver' in window) {
380
  var eleObserver = new IntersectionObserver(function (entries, observer) {
381
  entries.forEach(function (entry) {
573
  var _lodash = lodash,
574
  throttle = _lodash.throttle;
575
  var Sidebar = function Sidebar() {
576
+ // Tungnx - Show/hide sidebar curriculumn
577
+ var elSidebarToggle = document.querySelector('#sidebar-toggle'); // For style of theme
 
 
 
 
 
578
 
579
  var toggleSidebar = function toggleSidebar(toggle) {
580
  $('body').removeClass('lp-sidebar-toggle__open');
585
  } else {
586
  $('body').addClass('lp-sidebar-toggle__open');
587
  }
588
+ }; // For lp and theme
589
 
590
+
591
+ if (elSidebarToggle) {
592
+ if ($(window).innerWidth() <= 768) {
593
+ elSidebarToggle.setAttribute('checked', 'checked');
594
+ } else if (LP.Cookies.get('sidebar-toggle')) {
595
+ elSidebarToggle.setAttribute('checked', 'checked');
596
+ } else {
597
+ elSidebarToggle.removeAttribute('checked');
598
+ }
599
+
600
+ document.querySelector('#popup-course').addEventListener('click', function (e) {
601
+ if (e.target.id === 'sidebar-toggle') {
602
+ LP.Cookies.set('sidebar-toggle', e.target.checked ? true : false);
603
+ toggleSidebar(LP.Cookies.get('sidebar-toggle'));
604
+ }
605
+ });
606
+ } // End editor by tungnx
607
+
608
+
609
+ var $curriculum = $('#learn-press-course-curriculum');
610
  $curriculum.find('.section-desc').each(function (i, el) {
611
  var a = $('<span class="show-desc"></span>').on('click', function () {
612
  b.toggleClass('c');
633
  LP.Cookies.remove('closed-section-(.*)');
634
  LP.Cookies.set('closed-section-' + lpGlobalSettings.post_id, _toConsumableArray(new Set(sections)));
635
  });
636
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  };
638
 
639
  /***/ }),
726
  }(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Component"]);
727
 
728
  /* harmony default export */ __webpack_exports__["default"] = (SingleCurriculums);
729
+ document.addEventListener('DOMContentLoaded', function () {
730
  LP.Hook.doAction('lp-compatible-builder');
731
  Object(_components_search__WEBPACK_IMPORTED_MODULE_1__["searchCourseContent"])();
732
  Object(_components_sidebar__WEBPACK_IMPORTED_MODULE_2__["Sidebar"])();
749
 
750
  "use strict";
751
  __webpack_require__.r(__webpack_exports__);
752
+ /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/lp-modal-overlay */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js");
753
+
754
  var $ = jQuery;
755
  var scrollToItemCurrent = {
756
  init: function init() {
758
  var elItemViewing = $('.viewing-course-item');
759
 
760
  if (elItemViewing.length) {
761
+ var elCourseCurriculumn = $('#learn-press-course-curriculum');
762
  var heightCourseItemContentHeader = $('#popup-sidebar').outerHeight();
763
  var heightSectionTitle = $('.section-title').outerHeight();
764
  var heightSectionHeader = $('.section-header').outerHeight();
781
 
782
  var elItemCurrent = $('.course-item-' + idItem);
783
  var offSetTop = elItemCurrent.offset().top;
784
+ var offset = elItemCurrent.offset().top - elCourseCurriculumn.offset().top + elCourseCurriculumn.scrollTop();
785
+ elCourseCurriculumn.animate({
786
+ scrollTop: offset - heightSectionHeader
 
 
 
 
 
 
 
787
  }, 800);
788
  }
789
  };
assets/js/dist/frontend/single-curriculum.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}({10:function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},2:function(e,t){e.exports=window.wp.element},22:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return g}));var r=n(2),o=n(7),i=jQuery,l=n(8);n(10);function c(e){return(c="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})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){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}}();return function(){var n,r=p(e);if(t){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var m=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}}),t&&s(e,t)}(i,e);var t,n,r,o=f(i);function i(){return u(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&a(t.prototype,n),r&&a(t,r),i}(r.Component),y=m;window.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),r=e.querySelector(".search-course"),o=e.querySelector('.search-course input[type="text"]');if(!o||!n||!r)return;var i=n.querySelectorAll("li.section"),l=n.querySelectorAll("li.course-item"),c=[];l.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");c.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=o.value;r.classList.add("searching"),t||r.classList.remove("searching");var n=[];c.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),l.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),r=[];t.forEach((function(e){n.includes(e.dataset.id)&&r.push(e.dataset.id)})),0===r.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=r.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),o.value="",u(e)})),r.addEventListener("submit",u),o.addEventListener("keyup",u)}}(),Object(o.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),Object(l.b)(),(new m).checkCourseDurationExpire()}));var v=n(4),h=jQuery,b={init:function(){this.scrollToItemViewing=function(){var e=h(".viewing-course-item");if(e.length){var t=h("#popup-sidebar").outerHeight(),n=h(".section-title").outerHeight(),r=h(".section-header").outerHeight(),o=new RegExp("^viewing-course-item-([0-9].*)"),i=e.attr("class").split(/\s+/),l=0;if(h.each(i,(function(e,t){var n=o.exec(t);if(n)return l=n[1],!1})),0===l)return;var c=h(".course-item-"+l).offset().top-t;void 0===n?c=c-r+20:c-=n,h("#learn-press-course-curriculum").animate({scrollTop:c+300},800)}},this.scrollToItemViewing()}},g=(jQuery,t.default=y,function(){wp.element.render(React.createElement(y,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),v.a.init(),b.init()}))},4:function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},l=i,c=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){l.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}}))})))}});t.a=c},5:function(e,t){e.exports=window.wp.url},7:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return c}));var i=jQuery,l=lodash.throttle,c=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i(document).on("change","#sidebar-toggle",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),o(e.target.checked)}));var o=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};o(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))})),t.length&&(n.on("scroll",l((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},8:function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return a}));var r=n(5),o=n(4);function i(e,t,n,r,o,i,l){try{var c=e[i](l),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function l(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;a(n),t.unobserve(n)}}))}));l(e).map((function(e){return t.observe(e)}))}},a=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var l=e.apply(t,n);function c(e){i(l,r,o,c,u,"next",e)}function u(e){i(l,r,o,c,u,"throw",e)}c(void 0)}))});return function(e){return t.apply(this,arguments)}}()}});
1
+ this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}([,,function(e,t){e.exports=window.wp.element},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}};t.a=i},,function(e,t,n){"use strict";var r=n(3),o=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){r.a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");r.a.elLPOverlay.show(),r.a.setTitleModal(t.dataset.title),r.a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),r.a.callBackYes=function(){t.submit()}}))})))}});t.a=o},function(e,t){e.exports=window.wp.url},,function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return l}));var i=jQuery,l=(lodash.throttle,function(){var e=document.querySelector("#sidebar-toggle");e&&(i(window).innerWidth()<=768||LP.Cookies.get("sidebar-toggle")?e.setAttribute("checked","checked"):e.removeAttribute("checked"),document.querySelector("#popup-course").addEventListener("click",(function(e){var t;"sidebar-toggle"===e.target.id&&(LP.Cookies.set("sidebar-toggle",!!e.target.checked),t=LP.Cookies.get("sidebar-toggle"),i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),t?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open"))}))),i("#learn-press-course-curriculum").find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))}))})},function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return a}));var r=n(6),o=n(5);function i(e,t,n,r,o,i,l){try{var c=e[i](l),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function l(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;a(n),t.unobserve(n)}}))}));l(e).map((function(e){return t.observe(e)}))}},a=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var l=e.apply(t,n);function c(e){i(l,r,o,c,u,"next",e)}function u(e){i(l,r,o,c,u,"throw",e)}c(void 0)}))});return function(e){return t.apply(this,arguments)}}()},,function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return g}));var r=n(2),o=n(8),i=jQuery,l=n(9);n(11);function c(e){return(c="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})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){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}}();return function(){var n,r=p(e);if(t){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var m=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}}),t&&s(e,t)}(i,e);var t,n,r,o=f(i);function i(){return u(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&a(t.prototype,n),r&&a(t,r),i}(r.Component),y=m;document.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),r=e.querySelector(".search-course"),o=e.querySelector('.search-course input[type="text"]');if(!o||!n||!r)return;var i=n.querySelectorAll("li.section"),l=n.querySelectorAll("li.course-item"),c=[];l.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");c.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=o.value;r.classList.add("searching"),t||r.classList.remove("searching");var n=[];c.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),l.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),r=[];t.forEach((function(e){n.includes(e.dataset.id)&&r.push(e.dataset.id)})),0===r.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=r.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),o.value="",u(e)})),r.addEventListener("submit",u),o.addEventListener("keyup",u)}}(),Object(o.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),Object(l.b)(),(new m).checkCourseDurationExpire()}));var v=n(5),h=(n(3),jQuery),b={init:function(){this.scrollToItemViewing=function(){var e=h(".viewing-course-item");if(e.length){var t=h("#learn-press-course-curriculum"),n=(h("#popup-sidebar").outerHeight(),h(".section-title").outerHeight(),h(".section-header").outerHeight()),r=new RegExp("^viewing-course-item-([0-9].*)"),o=e.attr("class").split(/\s+/),i=0;if(h.each(o,(function(e,t){var n=r.exec(t);if(n)return i=n[1],!1})),0===i)return;var l=h(".course-item-"+i),c=(l.offset().top,l.offset().top-t.offset().top+t.scrollTop());t.animate({scrollTop:c-n},800)}},this.scrollToItemViewing()}},g=(jQuery,t.default=y,function(){wp.element.render(React.createElement(y,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),v.a.init(),b.init()}))}]);
assets/js/dist/js/data-controls.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.dataControls=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=13)}({11:function(r,t){r.exports=window.wp.apiFetch},13:function(r,t,e){"use strict";e.r(t),e.d(t,"apiFetch",(function(){return c})),e.d(t,"select",(function(){return f})),e.d(t,"dispatch",(function(){return s})),e.d(t,"controls",(function(){return l}));var n=e(11),o=e.n(n);function u(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return i(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(r,t)}(r)||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 i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var a=function(r){return r.isRegistryControl=!0,r},c=function(r){return{type:"API_FETCH",request:r}};function f(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"SELECT",storeKey:r,selectorName:t,args:n}}function s(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"DISPATCH",storeKey:r,actionName:t,args:n}}var l={API_FETCH:function(r){var t=r.request;return o()(t)},SELECT:a((function(r){return function(t){var e,n=t.storeKey,o=t.selectorName,i=t.args;return r.select(n)[o].hasResolver?function(r,t){var e=t.storeKey,n=t.selectorName,o=t.args;return new Promise((function(t){var u=function(){return r.select("").hasFinishedResolution(e,n,o)},i=function(){return r.select(e)[n].apply(null,o)},a=i();if(u())return t(a);var c=r.subscribe((function(){u()&&(c(),t(i()))}))}))}(r,{storeKey:n,selectorName:o,args:i}):(e=r.select(n))[o].apply(e,u(i))}})),DISPATCH:a((function(r){return function(t){var e,n=t.storeKey,o=t.actionName,i=t.args;return(e=r.dispatch(n))[o].apply(e,u(i))}}))}}});
1
+ this.LP=this.LP||{},this.LP.dataControls=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=14)}({12:function(r,t){r.exports=window.wp.apiFetch},14:function(r,t,e){"use strict";e.r(t),e.d(t,"apiFetch",(function(){return c})),e.d(t,"select",(function(){return f})),e.d(t,"dispatch",(function(){return s})),e.d(t,"controls",(function(){return l}));var n=e(12),o=e.n(n);function u(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return i(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(r,t)}(r)||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 i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var a=function(r){return r.isRegistryControl=!0,r},c=function(r){return{type:"API_FETCH",request:r}};function f(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"SELECT",storeKey:r,selectorName:t,args:n}}function s(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"DISPATCH",storeKey:r,actionName:t,args:n}}var l={API_FETCH:function(r){var t=r.request;return o()(t)},SELECT:a((function(r){return function(t){var e,n=t.storeKey,o=t.selectorName,i=t.args;return r.select(n)[o].hasResolver?function(r,t){var e=t.storeKey,n=t.selectorName,o=t.args;return new Promise((function(t){var u=function(){return r.select("").hasFinishedResolution(e,n,o)},i=function(){return r.select(e)[n].apply(null,o)},a=i();if(u())return t(a);var c=r.subscribe((function(){u()&&(c(),t(i()))}))}))}(r,{storeKey:n,selectorName:o,args:i}):(e=r.select(n))[o].apply(e,u(i))}})),DISPATCH:a((function(r){return function(t){var e,n=t.storeKey,o=t.actionName,i=t.args;return(e=r.dispatch(n))[o].apply(e,u(i))}}))}}});
assets/src/apps/js/admin/pages/tools/database/create_indexs.js CHANGED
@@ -55,8 +55,6 @@ const createIndexes = () => {
55
  const scrollToStepCurrent = ( stepCurrent ) => {
56
  const elItemStepCurrent = elGroupStep.querySelector( 'input[value=' + stepCurrent + ']' ).closest( '.lp-item-step' );
57
 
58
- console.log( elItemStepCurrent.offsetTop, lpModalOverlay.elMainContent[ 0 ].offsetTop );
59
-
60
  const offset = elItemStepCurrent.offsetTop - lpModalOverlay.elMainContent[ 0 ].offsetTop +
61
  lpModalOverlay.elMainContent[ 0 ].scrollTop;
62
 
@@ -77,7 +75,7 @@ const createIndexes = () => {
77
  }
78
 
79
  lpModalOverlay.callBackYes = () => {
80
- const url = '/lp/v1/tools/admin/create-indexs';
81
  const params = { tables, table };
82
 
83
  lpModalOverlay.elBtnNo[ 0 ].style.display = 'none';
@@ -101,7 +99,9 @@ const createIndexes = () => {
101
  }
102
 
103
  if ( 'success' === status ) {
104
- handleAjax( url, params, functions );
 
 
105
  } else if ( 'finished' === status ) {
106
  console.log( 'finished' );
107
  lpModalOverlay.elBtnNo[ 0 ].style.display = 'inline-block';
55
  const scrollToStepCurrent = ( stepCurrent ) => {
56
  const elItemStepCurrent = elGroupStep.querySelector( 'input[value=' + stepCurrent + ']' ).closest( '.lp-item-step' );
57
 
 
 
58
  const offset = elItemStepCurrent.offsetTop - lpModalOverlay.elMainContent[ 0 ].offsetTop +
59
  lpModalOverlay.elMainContent[ 0 ].scrollTop;
60
 
75
  }
76
 
77
  lpModalOverlay.callBackYes = () => {
78
+ const url = '/lp/v1/admin/tools/create-indexs';
79
  const params = { tables, table };
80
 
81
  lpModalOverlay.elBtnNo[ 0 ].style.display = 'none';
99
  }
100
 
101
  if ( 'success' === status ) {
102
+ setTimeout( () => {
103
+ handleAjax( url, params, functions );
104
+ }, 2000 );
105
  } else if ( 'finished' === status ) {
106
  console.log( 'finished' );
107
  lpModalOverlay.elBtnNo[ 0 ].style.display = 'inline-block';
assets/src/apps/js/frontend/modal/index.js CHANGED
@@ -6,7 +6,7 @@
6
  */
7
 
8
  import store from './store';
9
- import { _x } from '@wordpress/i18n';
10
  import { useSelect, dispatch } from '@wordpress/data';
11
 
12
  const Modal = ( { children } ) => {
@@ -38,22 +38,10 @@ const Modal = ( { children } ) => {
38
  <div id="lp-modal-content" dangerouslySetInnerHTML={ { __html: message } }></div>
39
  <div id="lp-modal-buttons">
40
  <button className="lp-button modal-button-ok" onClick={ dataConfirm( 'yes' ) }>
41
- <span>
42
- { _x(
43
- 'OK',
44
- 'button confirm ok',
45
- 'learnpress'
46
- ) }
47
- </span>
48
  </button>
49
  <button className="lp-button modal-button-cancel" onClick={ dataConfirm( 'no' ) }>
50
- <span>
51
- { _x(
52
- 'Cancel',
53
- 'button confirm cancel',
54
- 'learnpress'
55
- ) }
56
- </span>
57
  </button>
58
  </div>
59
  </div>
6
  */
7
 
8
  import store from './store';
9
+ import { __ } from '@wordpress/i18n';
10
  import { useSelect, dispatch } from '@wordpress/data';
11
 
12
  const Modal = ( { children } ) => {
38
  <div id="lp-modal-content" dangerouslySetInnerHTML={ { __html: message } }></div>
39
  <div id="lp-modal-buttons">
40
  <button className="lp-button modal-button-ok" onClick={ dataConfirm( 'yes' ) }>
41
+ <span>{ __( 'OK', 'learnpress' ) }</span>
 
 
 
 
 
 
42
  </button>
43
  <button className="lp-button modal-button-cancel" onClick={ dataConfirm( 'no' ) }>
44
+ <span>{ __( 'Cancel', 'learnpress' ) }</span>
 
 
 
 
 
 
45
  </button>
46
  </div>
47
  </div>
assets/src/apps/js/frontend/question-types/components/question-base/index.js CHANGED
@@ -95,7 +95,7 @@ class QuestionBase extends Component {
95
  } = this.props;
96
 
97
  if ( status !== 'started' ) {
98
- return 'LP Error: can not set answers';
99
  }
100
 
101
  const $options = this.$wrap.find( '.option-check' );
95
  } = this.props;
96
 
97
  if ( status !== 'started' ) {
98
+ return __( 'LP Error: can not set answers', 'learnpress' );
99
  }
100
 
101
  const $options = this.$wrap.find( '.option-check' );
assets/src/apps/js/frontend/quiz/components/attempts/index.js CHANGED
@@ -1,5 +1,5 @@
1
  import { select } from '@wordpress/data';
2
- import { __, _x } from '@wordpress/i18n';
3
 
4
  import { default as formatDuration } from '../duration';
5
 
1
  import { select } from '@wordpress/data';
2
+ import { __ } from '@wordpress/i18n';
3
 
4
  import { default as formatDuration } from '../duration';
5
 
assets/src/apps/js/frontend/quiz/components/buttons/button-check.js CHANGED
@@ -3,7 +3,7 @@ import classNames from 'classnames';
3
  import { Component } from '@wordpress/element';
4
  import { withDispatch, withSelect } from '@wordpress/data';
5
  import { compose } from '@wordpress/compose';
6
- import { __, _x } from '@wordpress/i18n';
7
 
8
  class ButtonCheck extends Component {
9
  constructor() {
@@ -37,7 +37,7 @@ class ButtonCheck extends Component {
37
  } ) } onClick={ this.checkAnswer }
38
  >
39
  <span className="instant-check__icon" />
40
- { _x( 'Check answer', 'label of button check answer', 'learnpress' ) }
41
 
42
  { ! answered && (
43
  <div className="instant-check__info" dangerouslySetInnerHTML={ { __html: __( 'You need to answer the question before check answer.', 'learnpress' ) } } />
3
  import { Component } from '@wordpress/element';
4
  import { withDispatch, withSelect } from '@wordpress/data';
5
  import { compose } from '@wordpress/compose';
6
+ import { __ } from '@wordpress/i18n';
7
 
8
  class ButtonCheck extends Component {
9
  constructor() {
37
  } ) } onClick={ this.checkAnswer }
38
  >
39
  <span className="instant-check__icon" />
40
+ { __( 'Check answer', 'learnpress' ) }
41
 
42
  { ! answered && (
43
  <div className="instant-check__info" dangerouslySetInnerHTML={ { __html: __( 'You need to answer the question before check answer.', 'learnpress' ) } } />
assets/src/apps/js/frontend/quiz/components/buttons/index.js CHANGED
@@ -1,7 +1,7 @@
1
  import { Component } from '@wordpress/element';
2
  import { withSelect, withDispatch, select } from '@wordpress/data';
3
  import { compose } from '@wordpress/compose';
4
- import { __, _x } from '@wordpress/i18n';
5
 
6
  class Buttons extends Component {
7
  startQuiz = ( event ) => {
@@ -16,7 +16,7 @@ class Buttons extends Component {
16
  if ( status === 'completed' ) {
17
  const { confirm, isOpen } = select( 'learnpress/modal' );
18
 
19
- if ( 'no' === confirm( 'Are you sure you want to retry quiz?', this.startQuiz ) ) {
20
  ! isOpen() && btn && btn.removeAttribute( 'disabled' );
21
  return;
22
  }
@@ -246,7 +246,7 @@ class Buttons extends Component {
246
 
247
  { ( ( status === 'completed' && canRetry ) || -1 !== [ '', 'viewed' ].indexOf( status ) ) && ! isReviewing && (
248
  <button className="lp-button start" onClick={ this.startQuiz }>
249
- { ( status === 'completed' ) ? `${ _x( 'Retake', 'label button retry quiz', 'learnpress' ) }${ retakeNumber ? ` (${ retakeNumber })` : '' }` : _x( 'Start', 'label button start quiz', 'learnpress' ) }
250
  </button>
251
  ) }
252
 
1
  import { Component } from '@wordpress/element';
2
  import { withSelect, withDispatch, select } from '@wordpress/data';
3
  import { compose } from '@wordpress/compose';
4
+ import { __ } from '@wordpress/i18n';
5
 
6
  class Buttons extends Component {
7
  startQuiz = ( event ) => {
16
  if ( status === 'completed' ) {
17
  const { confirm, isOpen } = select( 'learnpress/modal' );
18
 
19
+ if ( 'no' === confirm( __( 'Are you sure you want to retake quiz?', 'learnpress' ), this.startQuiz ) ) {
20
  ! isOpen() && btn && btn.removeAttribute( 'disabled' );
21
  return;
22
  }
246
 
247
  { ( ( status === 'completed' && canRetry ) || -1 !== [ '', 'viewed' ].indexOf( status ) ) && ! isReviewing && (
248
  <button className="lp-button start" onClick={ this.startQuiz }>
249
+ { ( status === 'completed' ) ? `${ __( 'Retake', 'learnpress' ) }${ retakeNumber ? ` (${ retakeNumber })` : '' }` : __( 'Start', 'learnpress' ) }
250
  </button>
251
  ) }
252
 
assets/src/apps/js/frontend/quiz/components/questions/question.js CHANGED
@@ -105,7 +105,7 @@ class Question extends Component {
105
  },
106
 
107
  title: () => {
108
- return question.title;
109
  },
110
 
111
  hint: () => {
105
  },
106
 
107
  title: () => {
108
+ return ( <span dangerouslySetInnerHTML={ { __html: question.title } } /> );
109
  },
110
 
111
  hint: () => {
assets/src/apps/js/frontend/quiz/components/result/index.js CHANGED
@@ -6,7 +6,7 @@
6
  */
7
  import { useState, useEffect } from '@wordpress/element';
8
  import { useSelect } from '@wordpress/data';
9
- import { __, _x } from '@wordpress/i18n';
10
 
11
  import { getResponse } from '../../../single-curriculum/components/items-progress';
12
 
@@ -28,6 +28,10 @@ const Result = () => {
28
  return select( 'learnpress/quiz' ).getData( 'id' );
29
  }, [] );
30
 
 
 
 
 
31
  useEffect( () => {
32
  animate();
33
 
@@ -62,10 +66,14 @@ const Result = () => {
62
  itemCompleted.textContent = parseInt( allItemCompleted.length );
63
  }
64
  }
65
-
66
- updateItemsProgress();
67
  }, [ results ] );
68
 
 
 
 
 
 
 
69
  const updateItemsProgress = () => {
70
  const elements = document.querySelectorAll( '.popup-header__inner' );
71
 
6
  */
7
  import { useState, useEffect } from '@wordpress/element';
8
  import { useSelect } from '@wordpress/data';
9
+ import { __ } from '@wordpress/i18n';
10
 
11
  import { getResponse } from '../../../single-curriculum/components/items-progress';
12
 
28
  return select( 'learnpress/quiz' ).getData( 'id' );
29
  }, [] );
30
 
31
+ const submitting = useSelect( ( select ) => {
32
+ return select( 'learnpress/quiz' ).getData( 'submitting' );
33
+ }, [] );
34
+
35
  useEffect( () => {
36
  animate();
37
 
66
  itemCompleted.textContent = parseInt( allItemCompleted.length );
67
  }
68
  }
 
 
69
  }, [ results ] );
70
 
71
+ useEffect( () => {
72
+ if ( submitting !== undefined ) {
73
+ updateItemsProgress();
74
+ }
75
+ }, [ submitting ] );
76
+
77
  const updateItemsProgress = () => {
78
  const elements = document.querySelectorAll( '.popup-header__inner' );
79
 
assets/src/apps/js/frontend/single-course/index.js CHANGED
@@ -20,7 +20,7 @@ function run() {
20
  Sidebar();
21
  }
22
 
23
- window.addEventListener( 'DOMContentLoaded', () => {
24
  run();
25
  } );
26
 
20
  Sidebar();
21
  }
22
 
23
+ document.addEventListener( 'DOMContentLoaded', () => {
24
  run();
25
  } );
26
 
assets/src/apps/js/frontend/single-curriculum/components/items-progress.js CHANGED
@@ -13,6 +13,10 @@ export const itemsProgress = () => {
13
  return;
14
  }
15
 
 
 
 
 
16
  if ( 'IntersectionObserver' in window ) {
17
  const eleObserver = new IntersectionObserver( ( entries, observer ) => {
18
  entries.forEach( ( entry ) => {
13
  return;
14
  }
15
 
16
+ if ( elements[ 0 ].querySelectorAll( 'form.form-button-finish-course' ).length !== 0 ) {
17
+ return;
18
+ }
19
+
20
  if ( 'IntersectionObserver' in window ) {
21
  const eleObserver = new IntersectionObserver( ( entries, observer ) => {
22
  entries.forEach( ( entry ) => {
assets/src/apps/js/frontend/single-curriculum/components/sidebar.js CHANGED
@@ -2,16 +2,10 @@ const $ = jQuery;
2
  const { throttle } = lodash;
3
 
4
  export const Sidebar = () => {
5
- const $popup = $( '#popup-course' );
6
- const $curriculum = $( '#learn-press-course-curriculum' );
7
- let timerClearScroll;
8
-
9
- $( document ).on( 'change', '#sidebar-toggle', ( event ) => {
10
- LP.Cookies.set( 'sidebar-toggle', event.target.checked );
11
-
12
- toggleSidebar( event.target.checked );
13
- } );
14
 
 
15
  const toggleSidebar = ( toggle ) => {
16
  $( 'body' ).removeClass( 'lp-sidebar-toggle__open' );
17
  $( 'body' ).removeClass( 'lp-sidebar-toggle__close' );
@@ -23,8 +17,26 @@ export const Sidebar = () => {
23
  }
24
  };
25
 
26
- toggleSidebar( LP.Cookies.get( 'sidebar-toggle' ) );
 
 
 
 
 
 
 
 
27
 
 
 
 
 
 
 
 
 
 
 
28
  $curriculum.find( '.section-desc' ).each( ( i, el ) => {
29
  const a = $( '<span class="show-desc"></span>' ).on( 'click', () => {
30
  b.toggleClass( 'c' );
@@ -54,22 +66,5 @@ export const Sidebar = () => {
54
  LP.Cookies.set( 'closed-section-' + lpGlobalSettings.post_id, [ ...new Set( sections ) ] );
55
  } );
56
  } );
57
-
58
- // Popup only
59
- if ( $popup.length ) {
60
- $curriculum.on( 'scroll', throttle( function() {
61
- const $self = $( this );
62
-
63
- $self.addClass( 'scrolling' );
64
-
65
- timerClearScroll && clearTimeout( timerClearScroll );
66
-
67
- timerClearScroll = setTimeout( () => {
68
- $self.removeClass( 'scrolling' );
69
- }, 1000 );
70
- }, 500 ) );
71
-
72
- LP.toElement( '.course-item.current', { container: '.curriculum-scrollable:eq(1)', offset: 100, duration: 1 } );
73
- }
74
  };
75
 
2
  const { throttle } = lodash;
3
 
4
  export const Sidebar = () => {
5
+ // Tungnx - Show/hide sidebar curriculumn
6
+ const elSidebarToggle = document.querySelector( '#sidebar-toggle' );
 
 
 
 
 
 
 
7
 
8
+ // For style of theme
9
  const toggleSidebar = ( toggle ) => {
10
  $( 'body' ).removeClass( 'lp-sidebar-toggle__open' );
11
  $( 'body' ).removeClass( 'lp-sidebar-toggle__close' );
17
  }
18
  };
19
 
20
+ // For lp and theme
21
+ if ( elSidebarToggle ) {
22
+ if ( $( window ).innerWidth() <= 768 ) {
23
+ elSidebarToggle.setAttribute( 'checked', 'checked' );
24
+ } else if ( LP.Cookies.get( 'sidebar-toggle' ) ) {
25
+ elSidebarToggle.setAttribute( 'checked', 'checked' );
26
+ } else {
27
+ elSidebarToggle.removeAttribute( 'checked' );
28
+ }
29
 
30
+ document.querySelector( '#popup-course' ).addEventListener( 'click', ( e ) => {
31
+ if ( e.target.id === 'sidebar-toggle' ) {
32
+ LP.Cookies.set( 'sidebar-toggle', e.target.checked ? true : false );
33
+ toggleSidebar( LP.Cookies.get( 'sidebar-toggle' ) );
34
+ }
35
+ } );
36
+ }
37
+ // End editor by tungnx
38
+
39
+ const $curriculum = $( '#learn-press-course-curriculum' );
40
  $curriculum.find( '.section-desc' ).each( ( i, el ) => {
41
  const a = $( '<span class="show-desc"></span>' ).on( 'click', () => {
42
  b.toggleClass( 'c' );
66
  LP.Cookies.set( 'closed-section-' + lpGlobalSettings.post_id, [ ...new Set( sections ) ] );
67
  } );
68
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  };
70
 
assets/src/apps/js/frontend/single-curriculum/index.js CHANGED
@@ -35,7 +35,7 @@ class SingleCurriculums extends Component {
35
 
36
  export default SingleCurriculums;
37
 
38
- window.addEventListener( 'DOMContentLoaded', () => {
39
  LP.Hook.doAction( 'lp-compatible-builder' );
40
 
41
  searchCourseContent();
35
 
36
  export default SingleCurriculums;
37
 
38
+ document.addEventListener( 'DOMContentLoaded', () => {
39
  LP.Hook.doAction( 'lp-compatible-builder' );
40
 
41
  searchCourseContent();
assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  const $ = jQuery;
2
 
3
  const scrollToItemCurrent = {
@@ -5,6 +7,7 @@ const scrollToItemCurrent = {
5
  this.scrollToItemViewing = function() {
6
  const elItemViewing = $( '.viewing-course-item' );
7
  if ( elItemViewing.length ) {
 
8
  const heightCourseItemContentHeader = $( '#popup-sidebar' ).outerHeight();
9
  const heightSectionTitle = $( '.section-title' ).outerHeight();
10
  const heightSectionHeader = $( '.section-header' ).outerHeight();
@@ -28,15 +31,11 @@ const scrollToItemCurrent = {
28
 
29
  const elItemCurrent = $( '.course-item-' + idItem );
30
  const offSetTop = elItemCurrent.offset().top;
31
- let numberOffSetTop = offSetTop - heightCourseItemContentHeader;
 
32
 
33
- if ( undefined === heightSectionTitle ) {
34
- numberOffSetTop = numberOffSetTop - heightSectionHeader + 20;
35
- } else {
36
- numberOffSetTop = numberOffSetTop - heightSectionTitle;
37
- }
38
- $( '#learn-press-course-curriculum' ).animate( {
39
- scrollTop: numberOffSetTop + 300,
40
  }, 800 );
41
  }
42
  };
1
+ import lpModalOverlay from '../../utils/lp-modal-overlay';
2
+
3
  const $ = jQuery;
4
 
5
  const scrollToItemCurrent = {
7
  this.scrollToItemViewing = function() {
8
  const elItemViewing = $( '.viewing-course-item' );
9
  if ( elItemViewing.length ) {
10
+ const elCourseCurriculumn = $( '#learn-press-course-curriculum' );
11
  const heightCourseItemContentHeader = $( '#popup-sidebar' ).outerHeight();
12
  const heightSectionTitle = $( '.section-title' ).outerHeight();
13
  const heightSectionHeader = $( '.section-header' ).outerHeight();
31
 
32
  const elItemCurrent = $( '.course-item-' + idItem );
33
  const offSetTop = elItemCurrent.offset().top;
34
+ const offset = elItemCurrent.offset().top - elCourseCurriculumn.offset().top +
35
+ elCourseCurriculumn.scrollTop();
36
 
37
+ elCourseCurriculumn.animate( {
38
+ scrollTop: offset - heightSectionHeader,
 
 
 
 
 
39
  }, 800 );
40
  }
41
  };
inc/abstracts/abstract-object-data.php CHANGED
@@ -213,13 +213,13 @@ if ( ! class_exists( 'LP_Abstract_Object_Data' ) ) {
213
 
214
  /**
215
  * @param string $name
216
- * @param string $default
217
  *
218
  * @return array|bool|mixed|string
219
  */
220
- public function get_extra_data( $name = '', $default = '' ) {
221
  if ( is_string( $name ) ) {
222
- return array_key_exists( $name, $this->_extra_data ) ? $this->_extra_data[ $name ] : $default;
223
  } elseif ( is_array( $name ) ) {
224
  $data = array();
225
  foreach ( $name as $key ) {
@@ -227,11 +227,9 @@ if ( ! class_exists( 'LP_Abstract_Object_Data' ) ) {
227
  }
228
 
229
  return $data;
230
- } elseif ( true === $name ) {
231
- return $this->_extra_data;
232
  }
233
 
234
- return false;
235
  }
236
 
237
  /**
213
 
214
  /**
215
  * @param string $name
216
+ * @param mixed $default
217
  *
218
  * @return array|bool|mixed|string
219
  */
220
+ public function get_extra_data( string $name = '', $default = false ) {
221
  if ( is_string( $name ) ) {
222
+ return array_key_exists( $name, $this->_extra_data ) && ! empty( $this->_extra_data[ $name ] ) ? $this->_extra_data[ $name ] : $default;
223
  } elseif ( is_array( $name ) ) {
224
  $data = array();
225
  foreach ( $name as $key ) {
227
  }
228
 
229
  return $data;
 
 
230
  }
231
 
232
+ return $default;
233
  }
234
 
235
  /**
inc/admin/settings/class-lp-settings-general.php CHANGED
@@ -71,6 +71,13 @@ class LP_Settings_General extends LP_Abstract_Settings_Page {
71
  'default' => '',
72
  'type' => 'pages-dropdown',
73
  ),
 
 
 
 
 
 
 
74
  array(
75
  'type' => 'sectionend',
76
  ),
@@ -127,11 +134,12 @@ class LP_Settings_General extends LP_Abstract_Settings_Page {
127
  'type' => 'title',
128
  ),
129
  array(
130
- 'title' => esc_html__( 'Publish profile', 'learnpress' ),
131
- 'id' => 'publish_profile',
132
- 'default' => 'no',
133
- 'type' => 'checkbox',
134
- 'desc' => esc_html__( 'User course data will be public.', 'learnpress' ),
 
135
  ),
136
  array(
137
  'title' => esc_html__( 'Instructor registration', 'learnpress' ),
71
  'default' => '',
72
  'type' => 'pages-dropdown',
73
  ),
74
+ array(
75
+ 'title' => esc_html__( 'Logout Redirect', 'learnpress' ),
76
+ 'id' => 'logout_redirect_page_id',
77
+ 'default' => '',
78
+ 'type' => 'pages-dropdown',
79
+ 'desc' => __( 'The page where user will be redirected to after logging out.', 'learnpress' ),
80
+ ),
81
  array(
82
  'type' => 'sectionend',
83
  ),
134
  'type' => 'title',
135
  ),
136
  array(
137
+ 'title' => esc_html__( 'Publish profile', 'learnpress' ),
138
+ 'id' => 'publish_profile',
139
+ 'default' => 'no',
140
+ 'type' => 'checkbox',
141
+ 'desc_tip' => esc_html__( 'This option will add a sub-item "Privacy" under Setting tab on the Profile page. If users want to publish or hide their course, quiz tab when other users visit their profile page, they need to enable/disable that option in the Privacy section.', 'learnpress' ),
142
+ 'desc' => __( 'Public all user profile page (Overview tab only).', 'learnpress' ),
143
  ),
144
  array(
145
  'title' => esc_html__( 'Instructor registration', 'learnpress' ),
inc/admin/views/meta-boxes/course/settings.php CHANGED
@@ -92,12 +92,7 @@ class LP_Meta_Box_Course extends LP_Meta_Box {
92
  esc_html__( 'Choose a difficulty level.', 'learnpress' ),
93
  '',
94
  array(
95
- 'options' => array(
96
- '' => esc_html__( 'All levels', 'learnpress' ),
97
- 'beginner' => esc_html__( 'Beginner', 'learnpress' ),
98
- 'intermediate' => esc_html__( 'Intermediate', 'learnpress' ),
99
- 'expert' => esc_html__( 'Expert', 'learnpress' ),
100
- ),
101
  )
102
  ),
103
  '_lp_students' => new LP_Meta_Box_Text_Field(
92
  esc_html__( 'Choose a difficulty level.', 'learnpress' ),
93
  '',
94
  array(
95
+ 'options' => lp_course_level(),
 
 
 
 
 
96
  )
97
  ),
98
  '_lp_students' => new LP_Meta_Box_Text_Field(
inc/admin/views/meta-boxes/order/details.php CHANGED
@@ -66,6 +66,15 @@ $user_ip = $order->get_user_ip_address();
66
  }
67
  ?>
68
  </select>
 
 
 
 
 
 
 
 
 
69
  </div>
70
 
71
  <div class="order-data-field order-data-user">
66
  }
67
  ?>
68
  </select>
69
+
70
+ <?php if ( $order->get_status() === 'completed' ) : ?>
71
+ <div>
72
+ <div style="padding: 10px 18px; margin-top: 10px; border: 2px solid #d80000; border-radius: 4px; display: inline-block;">
73
+ <span class="dashicons dashicons-warning" style="color:#d80000"></span>
74
+ <?php esc_html_e( 'When change Status to "Pending", "Cancelled" or "Failed" will delete all course, lesson, quiz... progress!', 'learnpress' ); ?>
75
+ </div>
76
+ </div>
77
+ <?php endif; ?>
78
  </div>
79
 
80
  <div class="order-data-field order-data-user">
inc/admin/views/meta-boxes/order/exports-invoice.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  /**
3
  * Admin View: Order invoice export pdf Meta box
 
4
  * @author hungkv
5
  * @since 3.2.7.8
6
  * @version 1.0.0
@@ -23,76 +24,75 @@ wp_enqueue_script( 'learnpress-jspdf' );
23
  <?php global $post; ?>
24
 
25
  <div class="submitbox" id="order-export">
26
- <div id="order-export__section">
27
- <div id="editor"></div>
28
- <button data-id="<?php echo esc_attr( $order->get_id() ); ?>" type="button"
29
- id="order-export__button"><?php echo esc_html__( 'PDF Invoice', 'learnpress' ) ?></button>
30
- </div>
31
  </div>
32
 
33
  <!-- The Modal -->
34
  <div id="myModal" class="modal export-modal" style="display:none;">
35
 
36
- <!-- Modal content -->
37
- <div class="modal-content">
38
- <span class="close">&times;</span>
39
 
40
- <!-- Tab links -->
41
- <div class="tabs" id="order-export__tabs">
42
- <div class="preview-tab tab active"
43
- data-target="pdf-preview"><?php echo esc_html__( 'PDF Preview', 'learnpress' ) ?></div>
44
- <div class="options-tab tab"
45
- data-target="export-options"><?php echo esc_html__( 'Export Options', 'learnpress' ) ?></div>
46
- </div>
47
- <div id="panels">
48
- <div class="pdf-preview panel active">
49
- <!--Start print invoice-->
50
- <div id="lp-invoice">
51
- <div id="lp-invoice__content">