LearnPress – WordPress LMS Plugin - Version 4.1.7.2

Version Description

(2022-10-03) = ~ Removed: delete file mu-plugin (Moved to the plugin Thim Optimize). ~ Fixed: CVE-2022-3360 security. ~ Fixed: error "Quiz is not auto submitted when the time is expired". ~ Fixed: error "Completed item is not redirected to the next item". ~ Modified: Shortcode button LP. ~ Removed: delete shortcode 'learn_press_button_enroll'. We recommend using the shortcode 'learn_press_button_course' instead. ~ Fixed: error "Email content on one line when you save".

Download this release

Release Info

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

Code changes from version 4.1.7.1 to 4.1.7.2

Files changed (83) hide show
  1. assets/js/admin/admin.min.js +1 -1
  2. assets/js/dist/frontend/courses.min.js +1 -1
  3. assets/js/dist/frontend/quiz.js +3 -9
  4. assets/js/dist/frontend/quiz.min.js +1 -1
  5. assets/js/vendor/plugins.all.js +1 -359
  6. assets/js/vendor/vue/vue_libs.js +1 -14524
  7. assets/src/apps/js/frontend/quiz/components/timer/index.js +1 -10
  8. assets/src/js/admin/admin.js +19 -11
  9. inc/admin/class-lp-install-sample-data.php +8 -11
  10. inc/admin/class-lp-setup-wizard.php +1 -1
  11. inc/admin/lp-admin-functions.php +1 -1
  12. inc/admin/meta-box/class-lp-meta-box-helper.php +5 -5
  13. inc/admin/meta-box/fields/email-content.php +2 -2
  14. inc/admin/views/updates/html-updated-latest-message.php +1 -1
  15. inc/cart/class-lp-cart.php +54 -38
  16. inc/cart/lp-cart-functions.php +8 -8
  17. inc/class-lp-ajax.php +32 -168
  18. inc/class-lp-assets.php +1 -1
  19. inc/class-lp-checkout.php +8 -8
  20. inc/class-lp-file-system.php +1 -21
  21. inc/class-lp-helper.php +7 -1
  22. inc/class-lp-page-controller.php +55 -38
  23. inc/class-lp-query.php +1 -1
  24. inc/class-lp-request-handler.php +25 -0
  25. inc/class-lp-shortcodes.php +1 -11
  26. inc/class-lp-thumbnail-helper.php +1 -1
  27. inc/class-lp-widget.php +1 -4
  28. inc/course/abstract-course.php +6 -67
  29. inc/course/class-lp-course-item.php +7 -176
  30. inc/course/lp-course-functions.php +2 -1
  31. inc/curds/class-lp-user-curd.php +3 -2
  32. inc/custom-post-types/abstract.php +1 -1
  33. inc/databases/class-lp-course-db.php +2 -2
  34. inc/databases/class-lp-user-items-db.php +0 -1
  35. inc/emails/class-lp-email.php +1 -30
  36. inc/external-plugin/elementor/widgets/list-courses.php +1 -1
  37. inc/external-plugin/elementor/widgets/login-form.php +1 -1
  38. inc/external-plugin/elementor/widgets/register-form.php +1 -1
  39. inc/gateways/class-lp-gateways.php +1 -1
  40. inc/gateways/offline-payment/class-lp-gateway-offline-payment.php +1 -1
  41. inc/gateways/paypal/class-lp-gateway-paypal.php +3 -3
  42. inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php +9 -9
  43. inc/jwt/rest-api/version1/class-lp-rest-lessons-v1-controller.php +1 -1
  44. inc/lp-core-functions.php +106 -595
  45. inc/lp-deprecated.php +10 -10
  46. inc/lp-template-functions.php +29 -37
  47. inc/lp-template-hooks.php +110 -113
  48. inc/order/class-lp-order.php +2 -2
  49. inc/order/lp-order-functions.php +1 -1
  50. inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php +9 -9
  51. inc/rest-api/v1/frontend/class-lp-rest-widgets-controller.php +2 -9
  52. inc/shortcodes/class-lp-shortcode-button-course.php +34 -13
  53. inc/shortcodes/class-lp-shortcode-button-purchase.php +7 -21
  54. inc/shortcodes/class-lp-shortcode-checkout.php +2 -2
  55. inc/templates/abstract-template.php +2 -2
  56. inc/templates/class-lp-template-checkout.php +3 -3
  57. inc/templates/class-lp-template-course.php +72 -175
  58. inc/user-item/class-lp-user-item-course.php +2 -0
  59. inc/user-item/class-lp-user-item-quiz.php +0 -13
  60. inc/user-item/class-lp-user-item.php +0 -83
  61. inc/user/abstract-lp-user.php +24 -701
  62. inc/user/class-lp-profile-tabs.php +6 -1
  63. inc/user/class-lp-profile.php +1 -1
  64. inc/user/lp-user-functions.php +19 -117
  65. inc/widgets/course-extra.php +3 -3
  66. languages/learnpress.pot +557 -573
  67. learnpress.php +7 -33
  68. mu-plugin/class-lp-mu-plugin.php +13 -4
  69. readme.txt +10 -1
  70. templates/archive-course.php +3 -3
  71. templates/checkout/account-login.php +1 -1
  72. templates/checkout/account-register.php +1 -1
  73. templates/checkout/empty-cart.php +1 -1
  74. templates/checkout/form.php +1 -1
  75. templates/checkout/guest-checkout-link.php +1 -1
  76. templates/checkout/guest-checkout.php +5 -5
  77. templates/checkout/payment.php +1 -1
  78. templates/shortcode/list-courses.php +2 -2
  79. templates/single-course/buttons/purchase.php +1 -1
  80. templates/single-course/content-item/popup-content.php +2 -2
  81. templates/single-course/content-item/popup-sidebar.php +1 -1
  82. templates/single-course/meta-primary.php +2 -2
  83. templates/{single-course/meta-secondary.php → single-cour} +0 -0
assets/js/admin/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){const t=function(){e.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:e(this).attr("data-nonce")},dataType:"text",success:function(e){e=LP.parseJSON(e)}})},a=function(t){const a=e(this).addClass("disabled");t.preventDefault(),e.post({url:a.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(e){const t=a.closest(".lp-notice").html("<p>"+e+"</p>");setTimeout((function(){t.fadeOut()}),2e3)}})},n=function(t){t.preventDefault();e(this).closest(".lp-upgrade-notice").fadeOut(),e.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(e){}})},o=function(t){if(e(t.target).hasClass("buy-now"))return;t.preventDefault();const a=e(this).closest(".plugin-card");e(this).hasClass("updating-message")||(e(this).addClass("updating-message button-working disabled"),e.ajax({url:e(this).attr("href"),data:{},success:function(t){e.ajax({url:window.location.href,success:function(t){const n=e(t).find("#"+a.attr("id"));n.length?a.replaceWith(n):a.find(".plugin-action-buttons a").removeClass("updating-message button-working").html(learn_press_admin_localize.plugin_installed)}})}}))},l=function(e){return e.preventDefault(),!1};e.fn._filter_post_by_author=function(){const t=e("#post-search-input");if(!t.length)return;const a=e(t[0].form),n=e('<select name="author" id="author"></select>').insertAfter(t).select2({ajax:{url:window.location.href+"&lp-ajax=search-authors",dataType:"json",s:""},placeholder:wp.i18n.__("Search by user","learnpress"),minimumInputLength:3,allowClear:!0}).on("select2:select",(function(){e('input[name="author"]').val(n.val())}));a.on("submit",(function(){window.location.href.removeQueryVar("author").addQueryVar("author",n.val())}))};const s=()=>{e(".lp-button-upgrade").each((function(){e(this).on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").removeClass("lp-update-db-modal__hidden")}))})),e(".lp-update-db-modal__button").on("click",(function(t){t.preventDefault();const a=e(this),n=a.text(),o=a.data("loading"),l=e(".lp-update-db-modal__content-text").data("text");a.addClass("loading"),a.text(o);const s=()=>{e.ajax({url:lpGlobalSettings.ajax+"?action=lp_update_database",method:"GET",success(t){if("success"===t.status)return a.text(n),e(".lp-update-db-modal__content").addClass("lp-update-db-modal__success"),e(".lp-update-db-modal__content-text > h3").text(l),a.removeClass("loading"),!1;s()}})};s()}));e(".lp-update-db-modal__cancel").on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").addClass("lp-update-db-modal__hidden")}))},i=()=>{e(".lp-meta-box__file").each((t,a)=>{let n;const o=e(a).find(".lp-meta-box__file_input"),l=e(a).find(".lp-meta-box__file_list"),s=e(a).find(".btn-upload"),i=!!e(a).data("multil");e(s).on("click",e=>{e.preventDefault(),n||(n=wp.media({states:[new wp.media.controller.Library({filterable:"all",multiple:i})]}),n.on("select",(function(){const e=n.state().get("selection");let t=o.val();e.forEach((function(e){if((e=e.toJSON()).id)if(i?t=t?t+","+e.id:e.id:(t=e.id,l.empty()),"image"===e.type){const t=e.sizes&&e.sizes.thumbnail?e.sizes.thumbnail.url:e.url;l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img src="'+t+'" /><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')}else l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img class="is_file" src="'+e.icon+'" /><span>'+e.filename+'</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')})),c(),o.val(t)}))),n.open()}),i&&l.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,placeholder:"lp-metabox-sortable-placeholder",start(e,t){t.item.css("background-color","#f6f6f6")},stop(e,t){t.item.removeAttr("style")},update(){let t="";l.find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),c(),o.val(t)}});const c=()=>{e(l).find("li.image").each((t,a)=>{e(a).find("a.delete").on("click",(function(){if(e(a).remove(),i){let t="";e(l).find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),o.val(t)}else o.val("");return!1}))})};c()})};e(document).ready((function(){if(i(),s(),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-advertisement-slider").LP("Advertisement","a","s").appendTo(e("#wpbody-content")),e(".learn-press-toggle-item-preview").on("change",t),e(".learn-press-tip").LP("QuickTip"),e(document).on("click","#learn-press-create-pages",a).on("click",".lp-upgrade-notice .close-notice",n).on("click",".plugin-action-buttons a",o).on("click","[data-remove-confirm]",l).on("mousedown",".lp-sortable-handle",(function(t){e("html, body").addClass("lp-item-moving"),e(t.target).closest(".lp-sortable-handle").css("cursor","inherit")})).on("mouseup",(function(t){e("html, body").removeClass("lp-item-moving"),e(".lp-sortable-handle").css("cursor","")})),e("#order-export__section").length){document.querySelectorAll(".tabs");const t=document.querySelectorAll(".tab"),a=document.querySelectorAll(".panel");function c(e){for(let e=0;e<t.length;e++)t[e].classList.remove("active");for(let e=0;e<a.length;e++)a[e].classList.remove("active");e.target.classList.add("active");const n=e.target.getAttribute("data-target");document.getElementById("panels").getElementsByClassName(n)[0].classList.add("active")}for(let e=0;e<t.length;e++)t[e].addEventListener("click",c,!1);const n=document.getElementById("myModal"),o=document.getElementById("order-export__button"),l=document.getElementsByClassName("close")[0];o.onclick=function(){n.style.display="block"},l.onclick=function(){n.style.display="none"},window.onclick=function(e){e.target==n&&(n.style.display="none")},e("#lp-invoice__content").length&&e("#lp-invoice__export").click((function(){const t=new jsPDF("p","pt","letter"),a={"#bypassme":(e,t)=>!0},n={top:80,bottom:60,left:40,width:522};t.fromHTML(e("#lp-invoice__content")[0],n.left,n.top,{width:n.width,elementHandlers:a},(function(e){const a=t.output("blob");window.open(URL.createObjectURL(a))}),n)})),e("#lp-invoice__update").click((function(){let t=e(this).data("id"),a=e('input[name="site_title"]'),n=e('input[name="order_date"]'),o=e('input[name="invoice_no"]'),l=e('input[name="order_customer"]'),s=e('input[name="order_email"]'),i=e('input[name="order_payment"]');a=a.is(":checked")?"check":"uncheck",n=n.is(":checked")?"check":"uncheck",o=o.is(":checked")?"check":"uncheck",l=l.is(":checked")?"check":"uncheck",s=s.is(":checked")?"check":"uncheck",i=i.is(":checked")?"check":"uncheck",e.ajax({type:"post",dataType:"html",url:"admin-ajax.php",data:{site_title:a,order_date:n,invoice_no:o,order_customer:l,order_email:s,order_id:t,order_payment:i,action:"learnpress_update_order_exports"},beforeSend(){e(".export-options__loading").addClass("active")},success(t){e("#lp-invoice__content").html(""),e("#lp-invoice__content").append(t),e(".export-options__loading").removeClass("active"),e(".options-tab").removeClass("active"),e(".preview-tab").addClass("active"),e("#panels .export-options").removeClass("active"),e("#panels .pdf-preview").addClass("active")},error(e,t,a){console.log("The following error occured: "+t,a)}})}))}if(e.fn._filter_post_by_author(),window.location.hash){const t=window.location.hash;if("#_lp_passing_grade"==t){const a=document.querySelector(t);e("html, body").animate({scrollTop:e(t).offset().top},900,"swing"),a.parentNode.style.border="2px solid orangered"}}e("input").on("click",(function(t){const a=e(t.target),n=a.attr("id").replace("learn_press_",""),o=e(".show_if_"+n);a.is(":checked")?o.show():o.hide()}))}))}(jQuery);
1
+ !function(e){const t=function(){e.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:e(this).attr("data-nonce")},dataType:"text",success:function(e){e=LP.parseJSON(e)}})},a=function(t){const a=e(this).addClass("disabled");t.preventDefault(),e.post({url:a.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(e){const t=a.closest(".lp-notice").html("<p>"+e+"</p>");setTimeout((function(){t.fadeOut()}),2e3)}})},n=function(t){t.preventDefault();e(this).closest(".lp-upgrade-notice").fadeOut(),e.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(e){}})},o=function(t){if(e(t.target).hasClass("buy-now"))return;t.preventDefault();const a=e(this).closest(".plugin-card");e(this).hasClass("updating-message")||(e(this).addClass("updating-message button-working disabled"),e.ajax({url:e(this).attr("href"),data:{},success:function(t){e.ajax({url:window.location.href,success:function(t){const n=e(t).find("#"+a.attr("id"));n.length?a.replaceWith(n):a.find(".plugin-action-buttons a").removeClass("updating-message button-working").html(learn_press_admin_localize.plugin_installed)}})}}))},l=function(e){return e.preventDefault(),!1};e.fn._filter_post_by_author=function(){const t=e("#post-search-input");if(!t.length)return;const a=e(t[0].form),n=e('<select name="author" id="author"></select>').insertAfter(t).select2({ajax:{url:window.location.href+"&lp-ajax=search-authors",dataType:"json",s:""},placeholder:wp.i18n.__("Search by user","learnpress"),minimumInputLength:3,allowClear:!0}).on("select2:select",(function(){e('input[name="author"]').val(n.val())}));a.on("submit",(function(){window.location.href.removeQueryVar("author").addQueryVar("author",n.val())}))};const s=()=>{e(".lp-button-upgrade").each((function(){e(this).on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").removeClass("lp-update-db-modal__hidden")}))})),e(".lp-update-db-modal__button").on("click",(function(t){t.preventDefault();const a=e(this),n=a.text(),o=a.data("loading"),l=e(".lp-update-db-modal__content-text").data("text");a.addClass("loading"),a.text(o);const s=()=>{e.ajax({url:lpGlobalSettings.ajax+"?action=lp_update_database",method:"GET",success(t){if("success"===t.status)return a.text(n),e(".lp-update-db-modal__content").addClass("lp-update-db-modal__success"),e(".lp-update-db-modal__content-text > h3").text(l),a.removeClass("loading"),!1;s()}})};s()}));e(".lp-update-db-modal__cancel").on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").addClass("lp-update-db-modal__hidden")}))},i=()=>{e(".lp-meta-box__file").each((t,a)=>{let n;const o=e(a).find(".lp-meta-box__file_input"),l=e(a).find(".lp-meta-box__file_list"),s=e(a).find(".btn-upload"),i=!!e(a).data("multil");e(s).on("click",e=>{e.preventDefault(),n||(n=wp.media({states:[new wp.media.controller.Library({filterable:"all",multiple:i})]}),n.on("select",(function(){const e=n.state().get("selection");let t=o.val();e.forEach((function(e){if((e=e.toJSON()).id)if(i?t=t?t+","+e.id:e.id:(t=e.id,l.empty()),"image"===e.type){const t=e.sizes&&e.sizes.thumbnail?e.sizes.thumbnail.url:e.url;l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img src="'+t+'" /><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')}else l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img class="is_file" src="'+e.icon+'" /><span>'+e.filename+'</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')})),c(),o.val(t)}))),n.open()}),i&&l.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,placeholder:"lp-metabox-sortable-placeholder",start(e,t){t.item.css("background-color","#f6f6f6")},stop(e,t){t.item.removeAttr("style")},update(){let t="";l.find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),c(),o.val(t)}});const c=()=>{e(l).find("li.image").each((t,a)=>{e(a).find("a.delete").on("click",(function(){if(e(a).remove(),i){let t="";e(l).find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),o.val(t)}else o.val("");return!1}))})};c()})};e(document).ready((function(){if(i(),s(),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-advertisement-slider").LP("Advertisement","a","s").appendTo(e("#wpbody-content")),e(".learn-press-toggle-item-preview").on("change",t),e(".learn-press-tip").LP("QuickTip"),e(document).on("click","#learn-press-create-pages",a).on("click",".lp-upgrade-notice .close-notice",n).on("click",".plugin-action-buttons a",o).on("click","[data-remove-confirm]",l).on("mousedown",".lp-sortable-handle",(function(t){e("html, body").addClass("lp-item-moving"),e(t.target).closest(".lp-sortable-handle").css("cursor","inherit")})).on("mouseup",(function(t){e("html, body").removeClass("lp-item-moving"),e(".lp-sortable-handle").css("cursor","")})),e("#order-export__section").length){document.querySelectorAll(".tabs");const t=document.querySelectorAll(".tab"),a=document.querySelectorAll(".panel");function c(e){for(let e=0;e<t.length;e++)t[e].classList.remove("active");for(let e=0;e<a.length;e++)a[e].classList.remove("active");e.target.classList.add("active");const n=e.target.getAttribute("data-target");document.getElementById("panels").getElementsByClassName(n)[0].classList.add("active")}for(let e=0;e<t.length;e++)t[e].addEventListener("click",c,!1);const n=document.getElementById("myModal"),o=document.getElementById("order-export__button"),l=document.getElementsByClassName("close")[0];o.onclick=function(){n.style.display="block"},l.onclick=function(){n.style.display="none"},window.onclick=function(e){e.target==n&&(n.style.display="none")},e("#lp-invoice__content").length&&e("#lp-invoice__export").click((function(){const t=new jsPDF("p","pt","letter"),a={"#bypassme":(e,t)=>!0},n={top:80,bottom:60,left:40,width:522};t.fromHTML(e("#lp-invoice__content")[0],n.left,n.top,{width:n.width,elementHandlers:a},(function(e){const a=t.output("blob");window.open(URL.createObjectURL(a))}),n)})),e("#lp-invoice__update").click((function(){let t=e(this).data("id"),a=e('input[name="site_title"]'),n=e('input[name="order_date"]'),o=e('input[name="invoice_no"]'),l=e('input[name="order_customer"]'),s=e('input[name="order_email"]'),i=e('input[name="order_payment"]');a=a.is(":checked")?"check":"uncheck",n=n.is(":checked")?"check":"uncheck",o=o.is(":checked")?"check":"uncheck",l=l.is(":checked")?"check":"uncheck",s=s.is(":checked")?"check":"uncheck",i=i.is(":checked")?"check":"uncheck",e.ajax({type:"post",dataType:"html",url:"admin-ajax.php",data:{site_title:a,order_date:n,invoice_no:o,order_customer:l,order_email:s,order_id:t,order_payment:i,action:"learnpress_update_order_exports"},beforeSend(){e(".export-options__loading").addClass("active")},success(t){e("#lp-invoice__content").html(""),e("#lp-invoice__content").append(t),e(".export-options__loading").removeClass("active"),e(".options-tab").removeClass("active"),e(".preview-tab").addClass("active"),e("#panels .export-options").removeClass("active"),e("#panels .pdf-preview").addClass("active")},error(e,t,a){console.log("The following error occured: "+t,a)}})}))}if(e.fn._filter_post_by_author(),window.location.hash){const t=window.location.hash;if("#_lp_passing_grade"==t){const a=document.querySelector(t);e("html, body").animate({scrollTop:e(t).offset().top},900,"swing"),a.parentNode.style.border="2px solid orangered"}}e("input").on("click",(function(t){const a=e(t.target);if(!a.length)return;const n=a.attr("id");if(!n)return;const o=n.replace("learn_press_",""),l=e(".show_if_"+o);a.is(":checked")?l.show():l.hide()}))}))}(jQuery);
assets/js/dist/frontend/courses.min.js CHANGED
@@ -1 +1 @@
1
- !function(){lpGlobalSettings.courses_url;const e=document.location.href;let t,r,o=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{},s=!1,n=1,c=null,l=null;lpGlobalSettings.is_course_archive&&(window.location.search.length||-1!==e.search("page")||(o={}));const a=(e,t)=>{const r=new URL(e);return Object.keys(t).forEach((e=>{r.searchParams.set(e,t[e])})),r};window.lpArchiveRequestCourse=(e,o)=>{const c=lpGlobalSettings.lp_rest_url;if(!c)return;if(!t)return;const u=l&&l.querySelector("div.lp-archive-courses .lp-content-area"),p=u&&u.querySelector("ul.learn-press-courses");if(!p)return;if(s)return;s=!0,r?p.append(t):r=t.outerHTML;const h=a(c+"lp/v1/courses/archive-course",{...lpGlobalSettings.lpArchiveSkeleton,...e}),d=lpGlobalSettings.lp_rest_url+"lp/v1/courses/archive-course"+h.search;fetch(d,{method:"GET"}).then((e=>e.json())).then((e=>{void 0!==e.data.content&&p&&(p.innerHTML=e.data.content||"");const t=e.data.pagination,r=document.querySelector(".learn-press-pagination");if(r&&r.remove(),void 0!==t){const e=(new DOMParser).parseFromString(t,"text/html").querySelector(".learn-press-pagination");e&&(p.after(e),i())}wp.hooks.doAction("lp-js-get-courses",e),"function"==typeof o&&o(e)})).catch((e=>{p.innerHTML+=`<div class="lp-ajax-message error" style="display:block">${e.message||"Error: Query lp/v1/courses/archive-course"}</div>`,console.log(e)})).finally((()=>{if(s=!1,jQuery("form.search-courses button").removeClass("loading"),n)n=0;else{const e={behavior:"smooth"};l.scrollIntoView(e)}window.localStorage.setItem("lp_filter_courses",JSON.stringify(e));const t=a(document.location,e);window.history.pushState("","",t)}))};const i=()=>{const e=document.querySelectorAll(".lp-archive-courses .learn-press-pagination .page-numbers");e.length>0&&e.forEach((r=>r.addEventListener("click",(o=>{if(o.preventDefault(),o.stopPropagation(),!l)return;t&&(t.style.display="block"),l.scrollIntoView({behavior:"smooth"});let s={};if(s=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{},o.currentTarget.getAttribute("href")){const t=[...e].filter((e=>e.classList.contains("current"))),n=o.currentTarget.textContent||r.classList.contains("next")&&parseInt(t[0].textContent)+1||r.classList.contains("prev")&&parseInt(t[0].textContent)-1;s.paged=n,lpArchiveRequestCourse({...s})}}))))};function u(){t=document.querySelector(".lp-archive-course-skeleton"),c=document.querySelector(".no-first-load-ajax"),t&&(c?(i(),(()=>{const e=document.querySelectorAll("form.search-courses"),r=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{};e.forEach((e=>{const o=e.querySelector('input[name="c_search"]'),s=e.querySelector('[type="submit"]');let n;o.addEventListener("keyup",(e=>{t&&(t.style.display="block"),e.preventDefault();const o=e.target.value.trim();(!o||o&&o.length>2)&&(void 0!==n&&clearTimeout(n),n=setTimeout((function(){s.classList.add("loading"),r.c_search=o,r.paged=1,lpArchiveRequestCourse({...r})}),800))})),e.addEventListener("submit",(t=>{t.preventDefault();const r=e.querySelector('input[name="c_search"]');r&&r.dispatchEvent(new Event("keyup"))}))}))})()):lpArchiveRequestCourse(o)),(()=>{const e=document.querySelectorAll('.lp-archive-courses input[name="lp-switch-layout-btn"]');e.length>0&&e.forEach((e=>e.addEventListener("change",(e=>{e.preventDefault();const t=e.target.value;if(t){const e=document.querySelector(".lp-archive-courses .learn-press-courses[data-layout]");e&&(e.dataset.layout=t),LP.Cookies.set("courses-layout",t)}}))))})(),(()=>{const e=LP.Cookies.get("courses-layout"),t=document.querySelectorAll('.lp-courses-bar .switch-layout [name="lp-switch-layout-btn"]');t.length>0&&[...t].map((t=>t.value===e&&(t.checked=!0)))})()}const p=setInterval((function(){void 0!==lpGlobalSettings.lpArchiveSkeleton&&(t=document.querySelector(".lp-archive-course-skeleton"),l=document.querySelector(".lp-archive-courses"),l&&t&&(u(),clearInterval(p)))}),1)}();
1
+ !function(){lpGlobalSettings.courses_url;const e=document.location.href;let t,r,o,s,n=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{},c=!1,l=1;lpGlobalSettings.is_course_archive&&(window.location.search.length||-1!==e.search("page")||(n={}));const a=(e,t)=>{const r=new URL(e);return Object.keys(t).forEach((e=>{r.searchParams.set(e,t[e])})),r};window.lpArchiveRequestCourse=(e,o)=>{const n=lpGlobalSettings.lp_rest_url;if(!n)return;if(!t)return;const u=s&&s.querySelector("div.lp-archive-courses .lp-content-area"),p=u&&u.querySelector("ul.learn-press-courses");if(!p)return;if(c)return;c=!0,r?p.append(t):r=t.outerHTML;const h=a(n+"lp/v1/courses/archive-course",{...lpGlobalSettings.lpArchiveSkeleton,...e}),d=lpGlobalSettings.lp_rest_url+"lp/v1/courses/archive-course"+h.search;fetch(d,{method:"GET"}).then((e=>e.json())).then((e=>{void 0!==e.data.content&&p&&(p.innerHTML=e.data.content||"");const t=e.data.pagination,r=document.querySelector(".learn-press-pagination");if(r&&r.remove(),void 0!==t){const e=(new DOMParser).parseFromString(t,"text/html").querySelector(".learn-press-pagination");e&&(p.after(e),i())}wp.hooks.doAction("lp-js-get-courses",e),"function"==typeof o&&o(e)})).catch((e=>{p.innerHTML+=`<div class="lp-ajax-message error" style="display:block">${e.message||"Error: Query lp/v1/courses/archive-course"}</div>`,console.log(e)})).finally((()=>{if(c=!1,jQuery("form.search-courses button").removeClass("loading"),l)l=0;else{const e={behavior:"smooth"};s.scrollIntoView(e)}window.localStorage.setItem("lp_filter_courses",JSON.stringify(e));const t=a(document.location,e);window.history.pushState("","",t)}))};const i=()=>{const e=document.querySelectorAll(".lp-archive-courses .learn-press-pagination .page-numbers");e.length>0&&e.forEach((r=>r.addEventListener("click",(o=>{if(o.preventDefault(),o.stopPropagation(),!s)return;t&&(t.style.display="block"),s.scrollIntoView({behavior:"smooth"});let n={};if(n=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{},o.currentTarget.getAttribute("href")){const t=[...e].filter((e=>e.classList.contains("current"))),s=o.currentTarget.textContent||r.classList.contains("next")&&parseInt(t[0].textContent)+1||r.classList.contains("prev")&&parseInt(t[0].textContent)-1;n.paged=s,lpArchiveRequestCourse({...n})}}))))};function u(){t=document.querySelector(".lp-archive-course-skeleton"),o=document.querySelector(".no-first-load-ajax"),t&&(o||lpArchiveRequestCourse(n),i(),(()=>{const e=document.querySelectorAll("form.search-courses"),r=JSON.parse(window.localStorage.getItem("lp_filter_courses"))||{};e.forEach((e=>{const o=e.querySelector('input[name="c_search"]'),s=e.querySelector('[type="submit"]');let n;o.addEventListener("keyup",(e=>{t&&(t.style.display="block"),e.preventDefault();const o=e.target.value.trim();(!o||o&&o.length>2)&&(void 0!==n&&clearTimeout(n),n=setTimeout((function(){s.classList.add("loading"),r.c_search=o,r.paged=1,lpArchiveRequestCourse({...r})}),800))})),e.addEventListener("submit",(t=>{t.preventDefault();const r=e.querySelector('input[name="c_search"]');r&&r.dispatchEvent(new Event("keyup"))}))}))})()),(()=>{const e=document.querySelectorAll('.lp-archive-courses input[name="lp-switch-layout-btn"]');e.length>0&&e.forEach((e=>e.addEventListener("change",(e=>{e.preventDefault();const t=e.target.value;if(t){const e=document.querySelector(".lp-archive-courses .learn-press-courses[data-layout]");e&&(e.dataset.layout=t),LP.Cookies.set("courses-layout",t)}}))))})(),(()=>{const e=LP.Cookies.get("courses-layout"),t=document.querySelectorAll('.lp-courses-bar .switch-layout [name="lp-switch-layout-btn"]');t.length>0&&[...t].map((t=>t.value===e&&(t.checked=!0)))})()}const p=setInterval((function(){void 0!==lpGlobalSettings.lpArchiveSkeleton&&(t=document.querySelector(".lp-archive-course-skeleton"),s=document.querySelector(".lp-archive-courses"),s&&t&&(u(),clearInterval(p)))}),1)}();
assets/js/dist/frontend/quiz.js CHANGED
@@ -1907,18 +1907,12 @@ const Timer = () => {
1907
  } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('learnpress/quiz');
1908
  const totalTime = getData('totalTime');
1909
  const durationTime = getData('duration');
1910
- /* const endTime = getData( 'endTime' );
1911
- const d1 = new Date( endTime.replace( /-/g, '/' ) );
1912
- const d2 = new Date();
1913
- const tz = new Date().getTimezoneOffset();
1914
- const t = parseInt( ( d1.getTime() / 1000 ) - ( ( d2.getTime() / 1000 ) + ( tz * 60 ) ) );*/
1915
-
1916
  const [seconds, setSeconds] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(totalTime);
1917
- let [timeSpend, setTimeSpend] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(0);
1918
- const limitTime = totalTime > 0;
1919
  (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
1920
  const myInterval = setInterval(() => {
1921
- if (limitTime) {
1922
  let remainSeconds = seconds;
1923
  remainSeconds -= 1;
1924
 
1907
  } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('learnpress/quiz');
1908
  const totalTime = getData('totalTime');
1909
  const durationTime = getData('duration');
 
 
 
 
 
 
1910
  const [seconds, setSeconds] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(totalTime);
1911
+ let [timeSpend, setTimeSpend] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(0); //const limitTime = totalTime > 0;
1912
+
1913
  (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
1914
  const myInterval = setInterval(() => {
1915
+ if (durationTime > 0) {
1916
  let remainSeconds = seconds;
1917
  remainSeconds -= 1;
1918
 
assets/js/dist/frontend/quiz.min.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={605:function(){LP.Hook.addAction("lp-compatible-builder",(()=>{LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&[...document.querySelectorAll("#popup-content")][0].addEventListener("scroll",(()=>{Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&[...document.querySelectorAll("#popup-content")][0].addEventListener("scroll",(()=>{VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-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))),LP.Hook.addAction("lp-question-compatible-builder",(()=>(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)))},184:function(e,t){var s;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var i=typeof s;if("string"===i||"number"===i)e.push(s);else if(Array.isArray(s)){if(s.length){var o=r.apply(null,s);o&&e.push(o)}}else if("object"===i)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(s=function(){return r}.apply(t,[]))||(e.exports=s)}()},965:function(e){"use strict";function t(e,s){var n;if(Array.isArray(s))for(n=0;n<s.length;n++)t(e,s[n]);else for(n in s)e[n]=(e[n]||[]).concat(s[n])}e.exports=function(e){var s,n={};return t(n,e),(s=function(e){return function(t){return function(s){var r,i,o=n[s.type],a=t(s);if(o)for(r=0;r<o.length;r++)(i=o[r](s,e))&&e.dispatch(i);return a}}}).effects=n,s}}},t={};function s(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,s),i.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){"use strict";s.r(n),s.d(n,{default:function(){return tt},init:function(){return st}});var e={};s.r(e),s.d(e,{__requestBeforeStartQuiz:function(){return ge},__requestCheckAnswerSuccess:function(){return ze},__requestShowHintSuccess:function(){return ye},__requestStartQuizSuccess:function(){return fe},__requestSubmitQuiz:function(){return qe},__requestSubmitQuizSuccess:function(){return we},checkAnswer:function(){return be},markQuestionRendered:function(){return ke},sendKey:function(){return Qe},setCurrentPage:function(){return he},setCurrentQuestion:function(){return me},setQuizData:function(){return pe},setQuizMode:function(){return Pe},showHint:function(){return Ee},startQuiz:function(){return _e},submitQuiz:function(){return ve},updateUserQuestionAnswers:function(){return Se}});var t={};s.r(t),s.d(t,{getCurrentQuestion:function(){return Fe},getData:function(){return xe},getDefaultRestArgs:function(){return De},getItemStatus:function(){return Ae},getProp:function(){return Te},getQuestion:function(){return Ue},getQuestionAnswered:function(){return Me},getQuestionMark:function(){return He},getQuestionOptions:function(){return Ce},getQuestions:function(){return Le},getQuestionsSelectedAnswers:function(){return Be},getQuizAnswered:function(){return Oe},getQuizAttempts:function(){return Re},getUserMark:function(){return Je},isCheckedAnswer:function(){return $e},isCorrect:function(){return je}});var r=window.wp.element;function i(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}var o=window.wp.compose,a=window.wp.data,u=window.wp.i18n,l=e=>{let t;const s=86400;if(e>s)t=(e-e%s)/s,e%=s;else if(e==s)return"24:00";const 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(":")};const{Hook:c}=LP;var d=()=>{const e=e=>(0,a.select)("learnpress/quiz").getData(e),t=c.applyFilters("quiz-meta-fields",{duration:{title:(0,u.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:(0,u.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:(0,u.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("ul",{className:"quiz-intro"},Object.values(t).map(((e,t)=>{const s=e.name||t;return(0,r.createElement)("li",{key:`quiz-intro-field-${t}`,className:`quiz-intro-item quiz-intro-item--${s}`},(0,r.createElement)("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),(0,r.createElement)("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};class p extends r.Component{constructor(){super(...arguments),i(this,"startQuiz",(e=>{e&&e.preventDefault();const t=document.querySelector(".lp-button.start");t&&t.setAttribute("disabled","disabled"),t.classList.add("loading");const{startQuiz:s,status:n}=this.props;if("completed"===n){const{confirm:e,isOpen:s}=(0,a.select)("learnpress/modal");if("no"===e((0,u.__)("Are you sure you want to retake quiz?","learnpress"),this.startQuiz))return void(!s()&&t&&t.removeAttribute("disabled"))}s()})),i(this,"nav",(e=>t=>{let{questionNav:s,currentPage:n,numPages:r,setCurrentPage:i}=this.props;"prev"===e?n>1?n-=1:n="infinity"===s?r:1:n<r?n+=1:n="infinity"===s?1:r,i(n)})),i(this,"moveTo",(e=>t=>{t.preventDefault();const{numPages:s,setCurrentPage:n}=this.props;e<1||e>s||n(e)})),i(this,"isLast",(()=>{const{currentPage:e,numPages:t}=this.props;return e===t})),i(this,"isFirst",(()=>{const{currentPage:e}=this.props;return 1===e})),i(this,"submit",(()=>{const{submitQuiz:e}=this.props,{confirm:t}=(0,a.select)("learnpress/modal");"no"!==t((0,u.__)("Are you sure to submit quiz?","learnpress"),this.submit)&&e()})),i(this,"setQuizMode",(e=>()=>{const{setQuizMode:t}=this.props;t(e)})),i(this,"isReviewing",(()=>{const{isReviewing:e}=this.props;return e}))}pageNumbers(e){const{numPages:t,currentPage:s}=this.props;if(t<2)return"";(e={numPages:t,currentPage:s,midSize:1,endSize:1,prevNext:!0,...e||{}}).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);const n=[...Array(t).keys()];let i=!1;return(0,r.createElement)("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&(0,r.createElement)("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},(0,u.__)("Prev","learnpress")),n.map((t=>(t+=1)===e.currentPage?(i=!0,(0,r.createElement)("span",{key:`page-number-${t}`,className:"page-numbers current"},t)):t<=e.endSize||e.currentPage&&t>=e.currentPage-e.midSize&&t<=e.currentPage+e.midSize||t>e.numPages-e.endSize?(i=!0,(0,r.createElement)("button",{key:`page-number-${t}`,className:"page-numbers",onClick:this.moveTo(t)},t)):i?(i=!1,(0,r.createElement)("span",{key:`page-number-${t}`,className:"page-numbers dots"},"…")):"")),e.prevNext&&!this.isLast()&&(0,r.createElement)("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},(0,u.__)("Next","learnpress")))}render(){const{status:e,questionNav:t,isReviewing:s,showReview:n,numPages:i,question:o,questionsPerPage:a,canRetry:l,retakeNumber:c,requiredPassword:d,allowRetake:p}=this.props,m=["quiz-buttons"];("started"===e||s)&&m.push("align-center"),"questionNav"===t&&m.push("infinity"),this.isFirst()&&m.push("is-first"),this.isLast()&&m.push("is-last");const h=document.querySelector("#popup-sidebar"),g=document.querySelector("#learn-press-quiz-app");let f="";f="started"===e||s?{marginLeft:h&&h.offsetWidth/2,width:g&&g.offsetWidth}:null;let _=" fixed";return"no"==lpQuizSettings.navigationPosition&&(_=" nav-center"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:m.join(" ")},(0,r.createElement)("div",{className:"button-left"+("started"===e||s?_:""),style:f},("completed"===e&&l||-1!==["","viewed"].indexOf(e))&&!s&&!d&&(0,r.createElement)("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===e?`${(0,u.__)("Retake","learnpress")} ${p?"":" "+(c?` (${c})`:"")} `:" "+(0,u.__)("Start","learnpress")),("started"===e||s)&&i>1&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"questions-pagination"},this.pageNumbers()))),(0,r.createElement)("div",{className:"button-right"},"started"===e&&(0,r.createElement)(r.Fragment,null,("infinity"===t||this.isLast())&&!s&&(0,r.createElement)("button",{className:"lp-button submit-quiz",onClick:this.submit},(0,u.__)("Finish Quiz","learnpress"))),s&&n&&(0,r.createElement)("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},(0,u.__)("Result","learnpress")),"completed"===e&&n&&!s&&(0,r.createElement)("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},(0,u.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&(0,r.createElement)("div",{className:"learn-press-message error"},this.props.message))}}const m=(0,o.compose)((0,a.withSelect)((e=>{const{getData:t}=e("learnpress/quiz");return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((e=>{const{showCheck:t,checkedQuestions:s,hintedQuestions:n,question:i,status:o,type:a,Button:u}=e;if("started"!==o)return!1;const l=(0,r.createElement)(u,{question:i});switch(a){case"hint":return n?!!i.hasHint&&-1===n.indexOf(i.id)&&l:l;case"check":return!!t&&(s?-1===s.indexOf(i.id)&&l:l)}}));var h=(0,o.compose)([(0,a.withSelect)((e=>{const{getData:t,getCurrentQuestion:s}=e("learnpress/quiz"),n={id:t("id"),status:t("status"),questionIds:t("questionIds"),questionNav:t("questionNav"),isReviewing:t("reviewQuestions")&&"reviewing"===t("mode"),showReview:t("reviewQuestions"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),numPages:t("numPages"),pages:t("pages"),currentPage:t("currentPage"),questionsPerPage:t("questionsPerPage"),pageNumbers:t("pageNumbers"),keyPressed:t("keyPressed"),canRetry:t("retakeCount")>0&&t("retaken")<t("retakeCount"),retakeNumber:t("retakeCount")>0&&t("retaken")<t("retakeCount")?t("retakeCount")-t("retaken"):null,message:t("messageResponse")||!1,success:void 0===t("successResponse")||t("successResponse"),requiredPassword:t("requiredPassword"),allowRetake:t("allowRetake")};if(1===n.questionsPerPage&&(n.question=s("object")),1===lpQuizSettings.checkNorequizenroll){const e=window.localStorage.getItem("quiz_off_retaken_"+lpQuizSettings.id);t("retakeCount")>e?(n.retakeNumber=t("retakeCount")-e,n.canRetry=!0):n.canRetry=!1}return n.allowRetake&&(n.canRetry=!0),n})),(0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{startQuiz:n,setCurrentQuestion:r,submitQuiz:i,setQuizMode:o,showHint:a,checkAnswer:u,setCurrentPage:l}=e("learnpress/quiz");return{startQuiz:n,setCurrentQuestion:r,setQuizMode:o,setCurrentPage:l,submitQuiz(e){i(e)},showHint(e){a(e)},checkAnswer(e){u(e)}}}))])(p);function g(){return g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},g.apply(this,arguments)}class f extends r.Component{constructor(){super(...arguments),i(this,"showHint",(()=>{const{showHint:e,question:t}=this.props;e(t.id,!t.showHint)}))}render(){const{question:e}=this.props;return e.hint?(0,r.createElement)("button",{className:"btn-show-hint",onClick:this.showHint},(0,r.createElement)("span",null,(0,u.__)("Hint","learnpress"))):""}}var _=(0,o.compose)((0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{showHint:n}=e("learnpress/quiz");return{showHint(e,t){n(e,t)}}})))(f),q=s(184),w=s.n(q);class v extends r.Component{constructor(){super(...arguments),i(this,"checkAnswer",(()=>{const{checkAnswer:e,question:t,answered:s}=this.props;s&&(e(t.id),this.setState({loading:!0}))})),this.state={loading:!1}}render(){const{answered:e}=this.props;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("button",{className:w()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},(0,r.createElement)("span",{className:"instant-check__icon"}),(0,u.__)("Check answer","learnpress"),!e&&(0,r.createElement)("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:(0,u.__)("You need to answer the question before check answer.","learnpress")}})))}}var S=(0,o.compose)((0,a.withSelect)(((e,t)=>{let{question:{id:s}}=t;const{getQuestionAnswered:n}=e("learnpress/quiz");return{answered:n(s)}})),(0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{checkAnswer:n}=e("learnpress/quiz");return{checkAnswer(e){n(e)}}})))(v),y=function(e){const{question:t}=e,s={"instant-check":()=>(0,r.createElement)(m,{type:"check",Button:S,question:t}),hint:()=>(0,r.createElement)(m,{type:"hint",Button:_,question:t})};return(0,r.createElement)(r.Fragment,null,LP.config.questionFooterButtons().map((e=>(0,r.createElement)(r.Fragment,{key:`button-${e}`},s[e]&&s[e]()))))};const E=window.jQuery,{uniqueId:z,isArray:b,isNumber:k,bind:P}=lodash;class Q extends r.Component{constructor(){super(...arguments),i(this,"setRef",(e=>{this.$wrap=E(e)})),i(this,"parseOptions",(e=>(e&&(e=b(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=b(e)?e:JSON.parse(e)),e||[]))),i(this,"getWrapperClass",(()=>{const{question:e,answered:t}=this.props,s=["question","question-"+e.type],n=this.parseOptions(e.options);return n.length&&void 0!==n[0].isTrue&&s.push("question-answered"),s})),i(this,"getEditLink",(()=>{const{question:e,editPermalink:t}=this.props;return t?t.replace(/post=(.*[0-9])/,`post=${e.id}`):""})),i(this,"editPermalink",(e=>(0,u.sprintf)('<a href="%s">%s</a>',e,(0,u.__)("Edit","learnpress")))),this.state={time:null,showHint:!1},this.$wrap=null}componentDidMount(e){const{question:t,isCurrent:s,markQuestionRendered:n}=this.props;return s&&n(t.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),"undefined"!=typeof MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub]),e}render(){const{question:e,isShow:t,isShowIndex:s,isShowHint:n,status:i}=this.props,o=LP.questionTypes.default,a=this.getEditLink();a&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",a);const l={index:()=>s?(0,r.createElement)("span",{className:"question-index"},s,"."):"",title:()=>(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:e.title}}),hint:()=>(0,r.createElement)(_,{question:e}),"edit-permalink":()=>a&&(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:this.editPermalink(a)},className:"edit-link"})},c={title:()=>(0,r.createElement)("h4",{className:"question-title"},LP.config.questionTitleParts().map((e=>(0,r.createElement)(r.Fragment,{key:`title-part-${e}`},l[e]&&l[e]())))),content:()=>(0,r.createElement)("div",{className:"question-content",dangerouslySetInnerHTML:{__html:e.content}}),"answer-options":()=>this.$wrap&&(0,r.createElement)(o,g({},this.props,{$wrap:this.$wrap})),explanation:()=>e.explanation&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"question-explanation-content"},(0,r.createElement)("strong",{className:"explanation-title"},(0,u.__)("Explanation","learnpress"),":"),(0,r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.explanation}}))),hint:()=>e.hint&&!e.explanation&&e.showHint&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"question-hint-content"},(0,r.createElement)("strong",{className:"hint-title"},(0,u.__)("Hint","learnpress"),":"),(0,r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.hint}}))),buttons:()=>"started"===i&&(0,r.createElement)(y,{question:e})},d=LP.config.questionBlocks();return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:this.getWrapperClass().join(" "),style:{display:t?"":"none"},"data-id":e.id,ref:this.setRef},d.map((e=>(0,r.createElement)(r.Fragment,{key:`block-${e}`},c[e]?c[e]():"")))))}}var N=(0,o.compose)([(0,a.withSelect)(((e,t)=>{let{question:{id:s}}=t;const{getData:n,getQuestionAnswered:r,getQuestionMark:i}=e("learnpress/quiz");return{status:n("status"),questions:n("question"),answered:r(s),questionsRendered:n("questionsRendered"),editPermalink:n("editPermalink"),numPages:n("numPages"),mark:i(s)||""}})),(0,a.withDispatch)((e=>{const{updateUserQuestionAnswers:t,markQuestionRendered:s}=e("learnpress/quiz");return{markQuestionRendered:s,updateUserQuestionAnswers:t}}))])(Q);class I extends r.Component{constructor(e){super(...arguments),i(this,"startQuiz",(e=>{e.preventDefault();const{startQuiz:t}=this.props;t()})),i(this,"isInVisibleRange",((e,t)=>{const{currentPage:s,questionsPerPage:n}=this.props;return s===Math.ceil(t/n)})),i(this,"nav",(e=>{const{sendKey:t}=this.props;switch(e.keyCode){case 37:return t("left");case 38:case 40:return;case 39:return t("right");default:e.keyCode>=49&&e.keyCode<=57&&t(e.keyCode-48)}})),this.needToTop=!1,this.state={isReviewing:null,currentPage:0,self:this}}static getDerivedStateFromProps(e,t){const s=["isReviewing","currentPage"],n={};for(let r=0;r<s.length;r++)e[s[r]]!==t[s[r]]&&(n[s[r]]=e[s[r]]);return Object.values(n).length?(t.self.needToTop=!0,n):null}componentDidUpdate(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}render(){const{status:e,currentQuestion:t,questions:s,questionsRendered:n,isReviewing:i,questionsPerPage:o}=this.props;let a=!0;return"completed"!==e||i||(a=!1),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{tabIndex:100,onKeyUp:this.nav},(0,r.createElement)("div",{className:"quiz-questions",style:{display:a?"":"none"}},s.map(((e,s)=>{const i=!o&&t===e.id,a=n&&-1!==n.indexOf(e.id),u=this.isInVisibleRange(e.id,s+1);return a||!a||u?(0,r.createElement)(N,{key:`loop-question-${e.id}`,isCurrent:i,isShow:u,isShowIndex:!!o&&s+1,questionsPerPage:o,question:e}):""})))))}}var C=(0,o.compose)((0,a.withSelect)(((e,t,s)=>{const{getData:n,getQuestions:r}=e("learnpress/quiz");return{status:n("status"),currentQuestion:n("currentQuestion"),questions:r(),questionsRendered:n("questionsRendered"),isReviewing:"reviewing"===n("mode"),numPages:n("numPages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage")||1}})),(0,a.withDispatch)((e=>{const{startQuiz:t,sendKey:s}=e("learnpress/quiz");return{startQuiz:t,sendKey:s}})))(I),A=()=>{const e=(0,a.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"quiz-attempts"},(0,r.createElement)("h4",{className:"attempts-heading"},(0,u.__)("Last Attempted","learnpress")),t&&(0,r.createElement)("table",null,(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"quiz-attempts__questions"},(0,u.__)("Questions","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__spend"},(0,u.__)("Time spent","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__marks"},(0,u.__)("Marks","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__grade"},(0,u.__)("Passing grade","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__result"},(0,u.__)("Result","learnpress")))),(0,r.createElement)("tbody",null,e.map(((e,t)=>(0,r.createElement)("tr",{key:`attempt-${t}`},(0,r.createElement)("td",{className:"quiz-attempts__questions"},`${e.questionCorrect} / ${e.questionCount}`),(0,r.createElement)("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),(0,r.createElement)("td",{className:"quiz-attempts__marks"},`${e.userMark} / ${e.mark}`),(0,r.createElement)("td",{className:"quiz-attempts__grade"},e.passingGrade||"-"),(0,r.createElement)("td",{className:"quiz-attempts__result"},`${parseFloat(e.result).toFixed(2)}%`," ",(0,r.createElement)("span",null,e.graduationText)))))))))},T=()=>{const{getData:e}=(0,a.select)("learnpress/quiz"),{submitQuiz:t}=(0,a.dispatch)("learnpress/quiz"),s=e("totalTime"),n=e("duration"),[i,o]=(0,r.useState)(s);let[u,l]=(0,r.useState)(0);const c=s>0;return(0,r.useEffect)((()=>{const e=setInterval((()=>{if(c){let s=i;s-=1,s>0?(o(s),u++,l(n-s)):(clearInterval(e),t())}else u++,l(u),o(u)}),1e3);return()=>clearInterval(e)}),[i,u]),(0,r.createElement)("div",{className:"countdown"},(0,r.createElement)("i",{className:"fas fa-stopwatch"}),(0,r.createElement)("span",null,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":";const t=[];let n;return s<3600?(t.push((i-i%60)/60),t.push(i%60)):s&&(t.push((i-i%3600)/3600),n=i%3600,t.push((n-n%60)/60),t.push(n%60)),t.map((e=>e<10?`0${e}`:e)).join(e)}()),(0,r.createElement)("input",{type:"hidden",name:"lp-quiz-time-spend",value:u}))},R=window.wp.url;const O=jQuery;let L=null;const x={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init(){return!!this.instance||(this.elLPOverlay=O(".lp-overlay"),!!this.elLPOverlay.length&&(L=this.elLPOverlay,this.elMainContent=L.find(".main-content"),this.elTitle=L.find(".modal-title"),this.elBtnYes=L.find(".btn-yes"),this.elBtnNo=L.find(".btn-no"),this.elFooter=L.find(".lp-modal-footer"),O(document).on("click",".close, .btn-no",(function(){L.hide()})),O(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof x.callBackYes&&x.callBackYes()})),this.instance=this,!0))},setElCalledModal(e){this.elCalledModal=e},setContentModal(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal(e){this.elTitle.html(e)}};var D=x,M={elBtnFinishCourse:null,elBtnCompleteItem:null,init(){D.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",(e=>{e.preventDefault();const t=e.target.closest("form");D.elLPOverlay.show(),D.setTitleModal(t.dataset.title),D.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),D.callBackYes=()=>{t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((e=>e.addEventListener("click",(e=>{e.preventDefault();const t=e.target.closest("form");D.elLPOverlay.show(),D.setTitleModal(t.dataset.title),D.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),D.callBackYes=()=>{t.submit()}})))))}};const{debounce:H}=lodash;var F=()=>{const[e,t]=(0,r.useState)(0),[s,n]=(0,r.useState)(!1),i=(0,a.useSelect)((e=>e("learnpress/quiz").getData("id")),[]),o=(0,a.useSelect)((e=>e("learnpress/quiz").getData("results")),[]),l=(0,a.useSelect)((e=>e("learnpress/quiz").getData("passingGrade")),[]),c=(0,a.useSelect)((e=>e("learnpress/quiz").getData("submitting")),[]);(0,r.useEffect)((()=>{p();let e="";if(e=o.graduation?o.graduation:o.result>=f?"passed":"failed",e){const t=document.querySelector(`.course-curriculum .course-item.course-item-${i}`);t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}const t=[...document.querySelectorAll("#popup-header .items-progress")][0],s=document.querySelector(".curriculum-sections");if(t&&s){const e=t.dataset.totalItems,s=t.querySelector(".items-completed"),n=t.querySelector(".learn-press-progress__active");if(s){const t=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");s.textContent=parseInt(t.length);const r=100-100*parseInt(t.length)/parseInt(e);n.style.left="-"+r+"%"}}}),[o]),(0,r.useEffect)((()=>{void 0!==c&&d()}),[c]);const d=()=>{const e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&(async e=>{const t=await wp.apiFetch({path:(0,R.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"}),{data:s}=t;e.innerHTML+=s,M.init()})(e[0])},p=()=>{t(0),n(!1),jQuery.easing._customEasing=function(e,t,s,n,r){return n*Math.sqrt(1-(t=t/r-1)*t)+s},H((()=>{const e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:o.result},{duration:1500,step:(e,s)=>{t(e)},done:()=>{n(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),H((()=>{jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),o.result>0?1e3:10)()};let m=e;Number.isInteger(e)||(m=parseFloat(e).toFixed(2));const h=190*Math.PI,g={strokeDasharray:`${h} ${h}`,strokeDashoffset:h-m/100*h},f=parseFloat(o.passingGrade||l);let _="";_=o.graduation?o.graduation:m>=f?"passed":"failed";let q="";q=o.graduationText?o.graduationText:"passed"===_?(0,u.__)("Passed","learnpress"):(0,u.__)("Failed","learnpress");const w=["quiz-result",_];return(0,r.createElement)("div",{className:w.join(" ")},(0,r.createElement)("h3",{className:"result-heading"},(0,u.__)("Your Result","learnpress")),(0,r.createElement)("div",{id:"quizResultGrade",className:"result-grade"},(0,r.createElement)("svg",{className:"circle-progress-bar",width:200,height:200},(0,r.createElement)("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:g,fill:"transparent",r:95,cx:100,cy:100})),(0,r.createElement)("span",{className:"result-achieved"},`${m}%`),(0,r.createElement)("span",{className:"result-require"},f+"%"||0)),s&&(0,r.createElement)("p",{className:"result-message"},q),(0,r.createElement)("ul",{className:"result-statistic"},(0,r.createElement)("li",{className:"result-statistic-field result-time-spend"},(0,r.createElement)("span",null,(0,u.__)("Time spent","learnpress")),(0,r.createElement)("p",null,o.timeSpend)),(0,r.createElement)("li",{className:"result-statistic-field result-point"},(0,r.createElement)("span",null,(0,u.__)("Points","learnpress")),(0,r.createElement)("p",null,o.userMark," / ",o.mark)),(0,r.createElement)("li",{className:"result-statistic-field result-questions"},(0,r.createElement)("span",null,(0,u.__)("Questions","learnpress")),(0,r.createElement)("p",null,o.questionCount)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-correct"},(0,r.createElement)("span",null,(0,u.__)("Correct","learnpress")),(0,r.createElement)("p",null,o.questionCorrect)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-wrong"},(0,r.createElement)("span",null,(0,u.__)("Wrong","learnpress")),(0,r.createElement)("p",null,o.questionWrong)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-skipped"},(0,r.createElement)("span",null,(0,u.__)("Skipped","learnpress")),(0,r.createElement)("p",null,o.questionEmpty))))};const U=jQuery,{debounce:$}=lodash;var j=()=>{const{submitQuiz:e}=(0,a.dispatch)("learnpress/quiz");(0,r.useEffect)((()=>{const e=U("#popup-content");if(!e.length)return;const t=e.find(".content-item-scrollable:eq(1)"),s=e.find(".content-item-wrap"),n=e.find(".quiz-status"),r=n.offset().top-92;let i=!1,o="-"+s.css("margin-left");U(window).on("resize.refresh-quiz-stauts-bar",$((function(){o="-"+s.css("margin-left"),n.css({"margin-left":o,"margin-right":o})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(()=>{if(t.scrollTop()>=r){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}),[]);const t=()=>{const{confirm:s}=(0,a.select)("learnpress/modal");"no"!==s((0,u.__)("Are you sure to submit quiz?","learnpress"),t)&&e()},{getData:s,getUserMark:n}=(0,a.select)("learnpress/quiz"),i=s("currentPage"),o=s("questionsPerPage"),l=s("questionIds").length,c=s("submitting"),d=(s("duration"),n()),p=["quiz-status"],m=(i-1)*o+1;let h=m+o-1,g="";return h=Math.min(h,l),c&&p.push("submitting"),g=h<l?o>1?(0,u.sprintf)((0,u.__)("Question <span>%d to %d of %d</span>","learnpress"),m,h,l):(0,u.sprintf)((0,u.__)("Question <span>%d of %d</span>","learnpress"),m,l):(0,u.sprintf)((0,u.__)("Question <span>%d to %d</span>","learnpress"),m,h),(0,r.createElement)("div",{className:p.join(" ")},(0,r.createElement)("div",null,(0,r.createElement)("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:g}}),(0,r.createElement)("div",{className:"current-point"},(0,u.sprintf)((0,u.__)("Earned Point: %s","learnpress"),d)),(0,r.createElement)("div",null,(0,r.createElement)("div",{className:"submit-quiz"},(0,r.createElement)("button",{className:"lp-button",id:"button-submit-quiz",onClick:t},c?(0,u.__)("Submitting...","learnpress"):(0,u.__)("Finish Quiz","learnpress"))),(0,r.createElement)(T,null))))};const{omit:B,flow:J,isArray:G,chunk:K}=lodash,{camelCaseDashObjectKeys:W}=LP,{get:Z,set:Y}=LP.localStorage,V={},X=(e,t)=>{const{answered:s,id:n}=e,r={...s[t.questionId]||{},answered:t.answers,temp:!0};return n&&localStorage.setItem(`LP_Quiz_${n}_Answered`,JSON.stringify({...e.answered,[t.questionId]:r})),{...e,answered:{...e.answered,[t.questionId]:r}}},ee=(e,t)=>{const{questionsRendered:s}=e;return G(s)?(s.push(t.questionId),{...e,questionsRendered:[...s]}):{...e,questionsRendered:[t.questionId]}},te=(e,t)=>(t.currentPage&&Y(`Q${e.id}.currentPage`,t.currentPage),{...e,...t}),se=(e,t)=>{const s=e.questions.map((e=>e.id==t.questionId?{...e,showHint:t.showHint}:e));return{...e,questions:[...s]}},ne=(e,t)=>{const s=e.questions.map((e=>{if(e.id!==t.questionId)return e;const s={explanation:t.explanation};return t.options&&(s.options=t.options),{...e,...s}})),n={...e.answered,[t.questionId]:t.result};let r=localStorage.getItem(`LP_Quiz_${e.id}_Answered`);return r&&(r={...JSON.parse(r),...n},localStorage.setItem(`LP_Quiz_${e.id}_Answered`,JSON.stringify(r))),{...e,questions:[...s],answered:n,checkedQuestions:[...e.checkedQuestions,t.questionId]}},re=(e,t)=>{localStorage.removeItem(`LP_Quiz_${e.id}_Answered`);const s=e.questions.map((s=>{const n={};return e.reviewQuestions&&(t.results.questions[s.id].explanation&&(n.explanation=t.results.questions[s.id].explanation),t.results.questions[s.id].options&&(n.options=t.results.questions[s.id].options)),{...s,...n}}));return te(e,{submitting:!1,currentPage:1,...t.results,questions:[...s]})},ie=(e,t)=>{const s=void 0!==t.results.success&&t.results.success,n=t.results.message||!1;return te(e,{checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1,...t.results.results,successResponse:s,messageResponse:n})},oe=J(a.combineReducers,(e=>(t,s)=>e(t,s)),(e=>(t,s)=>e(t,s)),(e=>(t,s)=>e(t,s)))({a(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1}},b(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2}}});var ae=(0,a.combineReducers)({blocks:oe,userQuiz:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);const s=K(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=s.length,t.data.pages=s,{...e,...t.data,currentPage:Z(`Q${t.data.id}.currentPage`)||t.data.currentPage};case"SUBMIT_QUIZ":return{...e,submitting:!0};case"START_QUIZ":case"START_QUIZ_SUCCESS":return ie(e,t);case"SET_CURRENT_QUESTION":return Y(`Q${e.id}.currentQuestion`,t.questionId),{...e,currentQuestion:t.questionId};case"SET_CURRENT_PAGE":return Y(`Q${e.id}.currentPage`,t.currentPage),{...e,currentPage:t.currentPage};case"SUBMIT_QUIZ_SUCCESS":return re(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?X(e,t):e;case"MARK_QUESTION_RENDERED":return ee(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?te(e,{mode:t.mode}):{...e,mode:t.mode};case"SET_QUESTION_HINT":return se(e,t);case"CHECK_ANSWER":return ne(e,t);case"SEND_KEY":return{...e,keyPressed:t.keyPressed}}return e}}),ue=window.LP.dataControls;function le(){const e=[].slice.call(arguments,2),t=(0,a.dispatch)(arguments[0]),s=arguments[1];t[s](...e)}const{camelCaseDashObjectKeys:ce,Hook:de}=LP;function pe(e,t){return{type:"SET_QUIZ_DATA",data:ce(t="string"==typeof e?{[e]:t}:e)}}function me(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function he(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function ge(e,t,s){return{type:"BEFORE_START_QUIZ"}}function fe(e,t,s,n){return de.doAction("quiz-started",e,t,s,n),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:s,userId:n,results:e}}const _e=function*(){const{itemId:e,courseId:t}=(0,a.select)("learnpress/quiz").getDefaultRestArgs();if(!0!==de.applyFilters("before-start-quiz",!0,e,t))return;let s=yield(0,ue.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:e,course_id:t}});const n=document.querySelector(".lp-button.start");if("error"!==s.status){if(s=de.applyFilters("request-start-quiz-response",s,e,t),1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id;window.localStorage.removeItem(e);const t={endTime:Date.now()+1e3*s.results.duration,status:s.results.status};window.localStorage.setItem(e,JSON.stringify(t));const n="quiz_off_retaken_"+lpQuizSettings.id;let r=window.localStorage.getItem(n);null===r?r=0:r++,window.localStorage.setItem(n,r)}yield le("learnpress/quiz","__requestStartQuizSuccess",ce(s),e,t)}else{const e=document.querySelector(".quiz-buttons"),t=`<div class="learn-press-message error">${s.message}</div>`;e.insertAdjacentHTML("afterend",t),n.classList.remove("loading")}};function qe(){return{type:"SUBMIT_QUIZ"}}function we(e,t,s){return de.doAction("quiz-submitted",e,t,s),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function*ve(){const{getDefaultRestArgs:e,getQuestionsSelectedAnswers:t}=(0,a.select)("learnpress/quiz"),{itemId:s,courseId:n}=e();if(!0!==de.applyFilters("before-submit-quiz",!0))return;const r=t();if(1===lpQuizSettings.checkNorequizenroll){const e=`LP_Quiz_${s}_Answered`,t=localStorage.getItem(e);if(null!==t){const e=JSON.parse(t);for(const[t,s]of Object.entries(e))r[t]=s.answered}}let i=0;const o=document.querySelector("input[name=lp-quiz-time-spend]");o&&(i=o.value);let u=yield(0,ue.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:s,course_id:n,answered:r,time_spend:i}});if(u=de.applyFilters("request-submit-quiz-response",u,s,n),"success"===u.status){if(1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id,t=window.localStorage.getItem(e);if(null!==t){const s=JSON.parse(t);s.status=u.results.status,s.results=u.results.results,window.localStorage.setItem(e,JSON.stringify(s)),window.localStorage.removeItem("LP_Quiz_"+lpQuizSettings.id+"_Answered")}}yield le("learnpress/quiz","__requestSubmitQuizSuccess",ce(u.results),s,n)}}function Se(e,t,s){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function ye(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function*Ee(e,t){yield le("learnpress/quiz","__requestShowHintSuccess",e,t)}function ze(e,t){return{type:"CHECK_ANSWER",questionId:e,...t}}function*be(e){const{getDefaultRestArgs:t,getQuestionAnswered:s}=(0,a.select)("learnpress/quiz"),{itemId:n,courseId:r}=t(),i=yield(0,ue.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:n,course_id:r,question_id:e,answered:s(e)||""}});if("success"===i.status){if(1===lpQuizSettings.checkNorequizenroll){const t="quiz_off_"+lpQuizSettings.id,s=window.localStorage.getItem(t);if(null!==s){const n=JSON.parse(s),r=i.options;void 0===n.checked_questions?(n.checked_questions=[],n.checked_questions.push(e)):-1===n.checked_questions.indexOf(e)&&n.checked_questions.push(e),void 0===n.question_options?(n.question_options={},n.question_options[e]=r):void 0===n.question_options[e]&&(n.question_options[e]=r),window.localStorage.setItem(t,JSON.stringify(n))}}yield le("learnpress/quiz","__requestCheckAnswerSuccess",e,ce(i))}}function ke(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Pe(e){return{type:"SET_QUIZ_MODE",mode:e}}function Qe(e){return setTimeout((()=>{le("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}const{get:Ne,isArray:Ie}=lodash,Ce=function(e,t){console.time("parseOptions");let s=Ue(e,t).options;return s=Ie(s)?s:JSON.parse(CryptoJS.AES.decrypt(s.data,s.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),s=Ie(s)?s:JSON.parse(s),console.timeEnd("parseOptions"),s};function Ae(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.status"):""}function Te(e,t,s){return e[t]||s}function Re(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.attempts"):[]}function Oe(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.answered",{}):{}}function Le(e){const{userQuiz:t}=e,s=Ne(t,"questions");return s?Object.values(s):[]}function xe(e,t){const{userQuiz:s}=e;return t?Ne(s,t):s}function De(e){const{userQuiz:t}=e;return{itemId:t.id,courseId:t.courseId}}function Me(e,t){const{userQuiz:s}=e;return Ne(s,`answered.${t}.answered`)||void 0}function He(e,t){const{userQuiz:s}=e;return Ne(s,`answered.${t}.mark`)||void 0}function Fe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const s=Ne(e,"userQuiz.questionsPerPage")||1;if(s>1)return!1;const n=Ne(e,"userQuiz.currentPage")||1;return Ne(e,"object"===t?`userQuiz.questions[${n-1}]`:`userQuiz.questionIds[${n-1}]`)}const Ue=function(e,t){const{userQuiz:s}=e;return(0,a.select)("learnpress/quiz").getQuestions().find((e=>e.id==t))};function $e(e,t){return-1!==(Ne(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function je(e,t){}const Be=function(e,t){const s=Ne(e,"userQuiz.answered"),n={};for(const e in s)if(s.hasOwnProperty(e)&&(s[e].temp||s[e].blanks)){if(t&&e===t)return s[e].answered;n[e]=s[e].answered}return n};function Je(e){const t=e.userQuiz||{},{answered:s,negativeMarking:n,questions:r,checkedQuestions:i}=t;let o=0;for(let e in s){if(!s.hasOwnProperty(e))continue;e=parseInt(e);const t=s[e],a=t.questionMark?t.questionMark:function(){const t=r.find((t=>t.id===e));return t?t.point:0}();i.indexOf(e),t.temp||(n?t.answered&&(o=t.correct?o+t.mark:o-a):t.answered&&t.correct&&(o+=t.mark))}return o>0?o:0}var Ge=s(965),Ke=s.n(Ge);const We={ENROLL_COURSE_X:(e,t)=>{}};const{controls:Ze}=LP.dataControls;!function(e){let t=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:e.getState,dispatch:function(){return t(...arguments)}};t=Ke()(We)(s)(e.dispatch),e.dispatch=t}((0,a.registerStore)("learnpress/quiz",{reducer:ae,selectors:t,actions:e,controls:{...Ze}}));const{chunk:Ye}=lodash;class Ve extends r.Component{constructor(e){super(...arguments),i(this,"startQuiz",(e=>{this.props.startQuiz()})),this.state={currentPage:1,numPages:0,pages:[]}}componentDidMount(){const{settings:e,setQuizData:t}=this.props,{question_ids:s,questions_per_page:n}=e,r=Ye(s,n);e.currentPage=1,e.numPages=r.length,e.pages=r;const i=!!e.id&&localStorage.getItem(`LP_Quiz_${e.id}_Answered`);i&&(e.answered=JSON.parse(i)),t(e)}componentDidUpdate(e,t,s){const{status:n}=e,r=document.querySelector(".quiz-content");void 0!==n&&r&&(r.style.display="none")}render(){const{status:e,isReviewing:t}=this.props,s=-1!==["","completed","viewed"].indexOf(e)||!e,n=-1!==["","viewed",void 0].indexOf(e)||!e;return void 0!==e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",null,!t&&"completed"===e&&(0,r.createElement)(F,null),!t&&n&&(0,r.createElement)(d,null),"started"===e&&(0,r.createElement)(j,null),(-1!==["completed","started"].indexOf(e)||t)&&(0,r.createElement)(C,null),(0,r.createElement)(h,null),s&&!t&&(0,r.createElement)(A,null)))}}var Xe=(0,o.compose)([(0,a.withSelect)((e=>{const{getQuestions:t,getData:s}=e("learnpress/quiz");return{questions:t(),status:s("status"),store:s(),answered:s("answered"),isReviewing:"reviewing"===s("mode"),questionIds:s("questionIds"),checkCount:s("instantCheck"),questionsPerPage:s("questionsPerPage")||1}})),(0,a.withDispatch)((e=>{const{setQuizData:t,startQuiz:s}=e("learnpress/quiz");return{setQuizData:t,startQuiz:s}}))])(Ve);s(605);const{modal:{default:et}}=LP;var tt=Xe;const st=(e,t)=>{if(1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id,s=window.localStorage.getItem(e);if(null!==s){const e=JSON.parse(s);if(t.status=e.status,"started"===e.status){const s=Date.now();t.total_time=Math.floor((e.endTime-s)/1e3)}else"completed"===e.status&&(t.results=e.results,t.answered=e.results.answered,t.questions=e.results.questions);if(void 0!==e.checked_questions&&(t.checked_questions=e.checked_questions),void 0!==e.question_options)for(const s in t.questions){let n=t.questions[s];void 0!==e.question_options[n.id]&&(n.options=e.question_options[n.id]),t.questions[s]=n}}}wp.element.render((0,r.createElement)(et,null,(0,r.createElement)(Xe,{settings:t})),[...document.querySelectorAll(e)][0]),LP.Hook.doAction("lp-quiz-compatible-builder")}}(),(window.LP=window.LP||{}).quiz=n}();
1
+ !function(){var e={605:function(){LP.Hook.addAction("lp-compatible-builder",(()=>{LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&[...document.querySelectorAll("#popup-content")][0].addEventListener("scroll",(()=>{Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&[...document.querySelectorAll("#popup-content")][0].addEventListener("scroll",(()=>{VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-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))),LP.Hook.addAction("lp-question-compatible-builder",(()=>(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)))},184:function(e,t){var s;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var i=typeof s;if("string"===i||"number"===i)e.push(s);else if(Array.isArray(s)){if(s.length){var o=r.apply(null,s);o&&e.push(o)}}else if("object"===i)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(s=function(){return r}.apply(t,[]))||(e.exports=s)}()},965:function(e){"use strict";function t(e,s){var n;if(Array.isArray(s))for(n=0;n<s.length;n++)t(e,s[n]);else for(n in s)e[n]=(e[n]||[]).concat(s[n])}e.exports=function(e){var s,n={};return t(n,e),(s=function(e){return function(t){return function(s){var r,i,o=n[s.type],a=t(s);if(o)for(r=0;r<o.length;r++)(i=o[r](s,e))&&e.dispatch(i);return a}}}).effects=n,s}}},t={};function s(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,s),i.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){"use strict";s.r(n),s.d(n,{default:function(){return tt},init:function(){return st}});var e={};s.r(e),s.d(e,{__requestBeforeStartQuiz:function(){return ge},__requestCheckAnswerSuccess:function(){return ze},__requestShowHintSuccess:function(){return ye},__requestStartQuizSuccess:function(){return fe},__requestSubmitQuiz:function(){return qe},__requestSubmitQuizSuccess:function(){return we},checkAnswer:function(){return be},markQuestionRendered:function(){return ke},sendKey:function(){return Qe},setCurrentPage:function(){return he},setCurrentQuestion:function(){return me},setQuizData:function(){return pe},setQuizMode:function(){return Pe},showHint:function(){return Ee},startQuiz:function(){return _e},submitQuiz:function(){return ve},updateUserQuestionAnswers:function(){return Se}});var t={};s.r(t),s.d(t,{getCurrentQuestion:function(){return Fe},getData:function(){return xe},getDefaultRestArgs:function(){return De},getItemStatus:function(){return Ae},getProp:function(){return Te},getQuestion:function(){return Ue},getQuestionAnswered:function(){return Me},getQuestionMark:function(){return He},getQuestionOptions:function(){return Ce},getQuestions:function(){return Le},getQuestionsSelectedAnswers:function(){return Be},getQuizAnswered:function(){return Oe},getQuizAttempts:function(){return Re},getUserMark:function(){return Je},isCheckedAnswer:function(){return $e},isCorrect:function(){return je}});var r=window.wp.element;function i(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}var o=window.wp.compose,a=window.wp.data,u=window.wp.i18n,l=e=>{let t;const s=86400;if(e>s)t=(e-e%s)/s,e%=s;else if(e==s)return"24:00";const 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(":")};const{Hook:c}=LP;var d=()=>{const e=e=>(0,a.select)("learnpress/quiz").getData(e),t=c.applyFilters("quiz-meta-fields",{duration:{title:(0,u.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:(0,u.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:(0,u.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("ul",{className:"quiz-intro"},Object.values(t).map(((e,t)=>{const s=e.name||t;return(0,r.createElement)("li",{key:`quiz-intro-field-${t}`,className:`quiz-intro-item quiz-intro-item--${s}`},(0,r.createElement)("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),(0,r.createElement)("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};class p extends r.Component{constructor(){super(...arguments),i(this,"startQuiz",(e=>{e&&e.preventDefault();const t=document.querySelector(".lp-button.start");t&&t.setAttribute("disabled","disabled"),t.classList.add("loading");const{startQuiz:s,status:n}=this.props;if("completed"===n){const{confirm:e,isOpen:s}=(0,a.select)("learnpress/modal");if("no"===e((0,u.__)("Are you sure you want to retake quiz?","learnpress"),this.startQuiz))return void(!s()&&t&&t.removeAttribute("disabled"))}s()})),i(this,"nav",(e=>t=>{let{questionNav:s,currentPage:n,numPages:r,setCurrentPage:i}=this.props;"prev"===e?n>1?n-=1:n="infinity"===s?r:1:n<r?n+=1:n="infinity"===s?1:r,i(n)})),i(this,"moveTo",(e=>t=>{t.preventDefault();const{numPages:s,setCurrentPage:n}=this.props;e<1||e>s||n(e)})),i(this,"isLast",(()=>{const{currentPage:e,numPages:t}=this.props;return e===t})),i(this,"isFirst",(()=>{const{currentPage:e}=this.props;return 1===e})),i(this,"submit",(()=>{const{submitQuiz:e}=this.props,{confirm:t}=(0,a.select)("learnpress/modal");"no"!==t((0,u.__)("Are you sure to submit quiz?","learnpress"),this.submit)&&e()})),i(this,"setQuizMode",(e=>()=>{const{setQuizMode:t}=this.props;t(e)})),i(this,"isReviewing",(()=>{const{isReviewing:e}=this.props;return e}))}pageNumbers(e){const{numPages:t,currentPage:s}=this.props;if(t<2)return"";(e={numPages:t,currentPage:s,midSize:1,endSize:1,prevNext:!0,...e||{}}).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);const n=[...Array(t).keys()];let i=!1;return(0,r.createElement)("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&(0,r.createElement)("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},(0,u.__)("Prev","learnpress")),n.map((t=>(t+=1)===e.currentPage?(i=!0,(0,r.createElement)("span",{key:`page-number-${t}`,className:"page-numbers current"},t)):t<=e.endSize||e.currentPage&&t>=e.currentPage-e.midSize&&t<=e.currentPage+e.midSize||t>e.numPages-e.endSize?(i=!0,(0,r.createElement)("button",{key:`page-number-${t}`,className:"page-numbers",onClick:this.moveTo(t)},t)):i?(i=!1,(0,r.createElement)("span",{key:`page-number-${t}`,className:"page-numbers dots"},"…")):"")),e.prevNext&&!this.isLast()&&(0,r.createElement)("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},(0,u.__)("Next","learnpress")))}render(){const{status:e,questionNav:t,isReviewing:s,showReview:n,numPages:i,question:o,questionsPerPage:a,canRetry:l,retakeNumber:c,requiredPassword:d,allowRetake:p}=this.props,m=["quiz-buttons"];("started"===e||s)&&m.push("align-center"),"questionNav"===t&&m.push("infinity"),this.isFirst()&&m.push("is-first"),this.isLast()&&m.push("is-last");const h=document.querySelector("#popup-sidebar"),g=document.querySelector("#learn-press-quiz-app");let f="";f="started"===e||s?{marginLeft:h&&h.offsetWidth/2,width:g&&g.offsetWidth}:null;let _=" fixed";return"no"==lpQuizSettings.navigationPosition&&(_=" nav-center"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:m.join(" ")},(0,r.createElement)("div",{className:"button-left"+("started"===e||s?_:""),style:f},("completed"===e&&l||-1!==["","viewed"].indexOf(e))&&!s&&!d&&(0,r.createElement)("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===e?`${(0,u.__)("Retake","learnpress")} ${p?"":" "+(c?` (${c})`:"")} `:" "+(0,u.__)("Start","learnpress")),("started"===e||s)&&i>1&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"questions-pagination"},this.pageNumbers()))),(0,r.createElement)("div",{className:"button-right"},"started"===e&&(0,r.createElement)(r.Fragment,null,("infinity"===t||this.isLast())&&!s&&(0,r.createElement)("button",{className:"lp-button submit-quiz",onClick:this.submit},(0,u.__)("Finish Quiz","learnpress"))),s&&n&&(0,r.createElement)("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},(0,u.__)("Result","learnpress")),"completed"===e&&n&&!s&&(0,r.createElement)("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},(0,u.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&(0,r.createElement)("div",{className:"learn-press-message error"},this.props.message))}}const m=(0,o.compose)((0,a.withSelect)((e=>{const{getData:t}=e("learnpress/quiz");return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((e=>{const{showCheck:t,checkedQuestions:s,hintedQuestions:n,question:i,status:o,type:a,Button:u}=e;if("started"!==o)return!1;const l=(0,r.createElement)(u,{question:i});switch(a){case"hint":return n?!!i.hasHint&&-1===n.indexOf(i.id)&&l:l;case"check":return!!t&&(s?-1===s.indexOf(i.id)&&l:l)}}));var h=(0,o.compose)([(0,a.withSelect)((e=>{const{getData:t,getCurrentQuestion:s}=e("learnpress/quiz"),n={id:t("id"),status:t("status"),questionIds:t("questionIds"),questionNav:t("questionNav"),isReviewing:t("reviewQuestions")&&"reviewing"===t("mode"),showReview:t("reviewQuestions"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),numPages:t("numPages"),pages:t("pages"),currentPage:t("currentPage"),questionsPerPage:t("questionsPerPage"),pageNumbers:t("pageNumbers"),keyPressed:t("keyPressed"),canRetry:t("retakeCount")>0&&t("retaken")<t("retakeCount"),retakeNumber:t("retakeCount")>0&&t("retaken")<t("retakeCount")?t("retakeCount")-t("retaken"):null,message:t("messageResponse")||!1,success:void 0===t("successResponse")||t("successResponse"),requiredPassword:t("requiredPassword"),allowRetake:t("allowRetake")};if(1===n.questionsPerPage&&(n.question=s("object")),1===lpQuizSettings.checkNorequizenroll){const e=window.localStorage.getItem("quiz_off_retaken_"+lpQuizSettings.id);t("retakeCount")>e?(n.retakeNumber=t("retakeCount")-e,n.canRetry=!0):n.canRetry=!1}return n.allowRetake&&(n.canRetry=!0),n})),(0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{startQuiz:n,setCurrentQuestion:r,submitQuiz:i,setQuizMode:o,showHint:a,checkAnswer:u,setCurrentPage:l}=e("learnpress/quiz");return{startQuiz:n,setCurrentQuestion:r,setQuizMode:o,setCurrentPage:l,submitQuiz(e){i(e)},showHint(e){a(e)},checkAnswer(e){u(e)}}}))])(p);function g(){return g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},g.apply(this,arguments)}class f extends r.Component{constructor(){super(...arguments),i(this,"showHint",(()=>{const{showHint:e,question:t}=this.props;e(t.id,!t.showHint)}))}render(){const{question:e}=this.props;return e.hint?(0,r.createElement)("button",{className:"btn-show-hint",onClick:this.showHint},(0,r.createElement)("span",null,(0,u.__)("Hint","learnpress"))):""}}var _=(0,o.compose)((0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{showHint:n}=e("learnpress/quiz");return{showHint(e,t){n(e,t)}}})))(f),q=s(184),w=s.n(q);class v extends r.Component{constructor(){super(...arguments),i(this,"checkAnswer",(()=>{const{checkAnswer:e,question:t,answered:s}=this.props;s&&(e(t.id),this.setState({loading:!0}))})),this.state={loading:!1}}render(){const{answered:e}=this.props;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("button",{className:w()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},(0,r.createElement)("span",{className:"instant-check__icon"}),(0,u.__)("Check answer","learnpress"),!e&&(0,r.createElement)("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:(0,u.__)("You need to answer the question before check answer.","learnpress")}})))}}var S=(0,o.compose)((0,a.withSelect)(((e,t)=>{let{question:{id:s}}=t;const{getQuestionAnswered:n}=e("learnpress/quiz");return{answered:n(s)}})),(0,a.withDispatch)(((e,t)=>{let{id:s}=t;const{checkAnswer:n}=e("learnpress/quiz");return{checkAnswer(e){n(e)}}})))(v),y=function(e){const{question:t}=e,s={"instant-check":()=>(0,r.createElement)(m,{type:"check",Button:S,question:t}),hint:()=>(0,r.createElement)(m,{type:"hint",Button:_,question:t})};return(0,r.createElement)(r.Fragment,null,LP.config.questionFooterButtons().map((e=>(0,r.createElement)(r.Fragment,{key:`button-${e}`},s[e]&&s[e]()))))};const E=window.jQuery,{uniqueId:z,isArray:b,isNumber:k,bind:P}=lodash;class Q extends r.Component{constructor(){super(...arguments),i(this,"setRef",(e=>{this.$wrap=E(e)})),i(this,"parseOptions",(e=>(e&&(e=b(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=b(e)?e:JSON.parse(e)),e||[]))),i(this,"getWrapperClass",(()=>{const{question:e,answered:t}=this.props,s=["question","question-"+e.type],n=this.parseOptions(e.options);return n.length&&void 0!==n[0].isTrue&&s.push("question-answered"),s})),i(this,"getEditLink",(()=>{const{question:e,editPermalink:t}=this.props;return t?t.replace(/post=(.*[0-9])/,`post=${e.id}`):""})),i(this,"editPermalink",(e=>(0,u.sprintf)('<a href="%s">%s</a>',e,(0,u.__)("Edit","learnpress")))),this.state={time:null,showHint:!1},this.$wrap=null}componentDidMount(e){const{question:t,isCurrent:s,markQuestionRendered:n}=this.props;return s&&n(t.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),"undefined"!=typeof MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub]),e}render(){const{question:e,isShow:t,isShowIndex:s,isShowHint:n,status:i}=this.props,o=LP.questionTypes.default,a=this.getEditLink();a&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",a);const l={index:()=>s?(0,r.createElement)("span",{className:"question-index"},s,"."):"",title:()=>(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:e.title}}),hint:()=>(0,r.createElement)(_,{question:e}),"edit-permalink":()=>a&&(0,r.createElement)("span",{dangerouslySetInnerHTML:{__html:this.editPermalink(a)},className:"edit-link"})},c={title:()=>(0,r.createElement)("h4",{className:"question-title"},LP.config.questionTitleParts().map((e=>(0,r.createElement)(r.Fragment,{key:`title-part-${e}`},l[e]&&l[e]())))),content:()=>(0,r.createElement)("div",{className:"question-content",dangerouslySetInnerHTML:{__html:e.content}}),"answer-options":()=>this.$wrap&&(0,r.createElement)(o,g({},this.props,{$wrap:this.$wrap})),explanation:()=>e.explanation&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"question-explanation-content"},(0,r.createElement)("strong",{className:"explanation-title"},(0,u.__)("Explanation","learnpress"),":"),(0,r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.explanation}}))),hint:()=>e.hint&&!e.explanation&&e.showHint&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"question-hint-content"},(0,r.createElement)("strong",{className:"hint-title"},(0,u.__)("Hint","learnpress"),":"),(0,r.createElement)("div",{dangerouslySetInnerHTML:{__html:e.hint}}))),buttons:()=>"started"===i&&(0,r.createElement)(y,{question:e})},d=LP.config.questionBlocks();return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:this.getWrapperClass().join(" "),style:{display:t?"":"none"},"data-id":e.id,ref:this.setRef},d.map((e=>(0,r.createElement)(r.Fragment,{key:`block-${e}`},c[e]?c[e]():"")))))}}var N=(0,o.compose)([(0,a.withSelect)(((e,t)=>{let{question:{id:s}}=t;const{getData:n,getQuestionAnswered:r,getQuestionMark:i}=e("learnpress/quiz");return{status:n("status"),questions:n("question"),answered:r(s),questionsRendered:n("questionsRendered"),editPermalink:n("editPermalink"),numPages:n("numPages"),mark:i(s)||""}})),(0,a.withDispatch)((e=>{const{updateUserQuestionAnswers:t,markQuestionRendered:s}=e("learnpress/quiz");return{markQuestionRendered:s,updateUserQuestionAnswers:t}}))])(Q);class I extends r.Component{constructor(e){super(...arguments),i(this,"startQuiz",(e=>{e.preventDefault();const{startQuiz:t}=this.props;t()})),i(this,"isInVisibleRange",((e,t)=>{const{currentPage:s,questionsPerPage:n}=this.props;return s===Math.ceil(t/n)})),i(this,"nav",(e=>{const{sendKey:t}=this.props;switch(e.keyCode){case 37:return t("left");case 38:case 40:return;case 39:return t("right");default:e.keyCode>=49&&e.keyCode<=57&&t(e.keyCode-48)}})),this.needToTop=!1,this.state={isReviewing:null,currentPage:0,self:this}}static getDerivedStateFromProps(e,t){const s=["isReviewing","currentPage"],n={};for(let r=0;r<s.length;r++)e[s[r]]!==t[s[r]]&&(n[s[r]]=e[s[r]]);return Object.values(n).length?(t.self.needToTop=!0,n):null}componentDidUpdate(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}render(){const{status:e,currentQuestion:t,questions:s,questionsRendered:n,isReviewing:i,questionsPerPage:o}=this.props;let a=!0;return"completed"!==e||i||(a=!1),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{tabIndex:100,onKeyUp:this.nav},(0,r.createElement)("div",{className:"quiz-questions",style:{display:a?"":"none"}},s.map(((e,s)=>{const i=!o&&t===e.id,a=n&&-1!==n.indexOf(e.id),u=this.isInVisibleRange(e.id,s+1);return a||!a||u?(0,r.createElement)(N,{key:`loop-question-${e.id}`,isCurrent:i,isShow:u,isShowIndex:!!o&&s+1,questionsPerPage:o,question:e}):""})))))}}var C=(0,o.compose)((0,a.withSelect)(((e,t,s)=>{const{getData:n,getQuestions:r}=e("learnpress/quiz");return{status:n("status"),currentQuestion:n("currentQuestion"),questions:r(),questionsRendered:n("questionsRendered"),isReviewing:"reviewing"===n("mode"),numPages:n("numPages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage")||1}})),(0,a.withDispatch)((e=>{const{startQuiz:t,sendKey:s}=e("learnpress/quiz");return{startQuiz:t,sendKey:s}})))(I),A=()=>{const e=(0,a.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"quiz-attempts"},(0,r.createElement)("h4",{className:"attempts-heading"},(0,u.__)("Last Attempted","learnpress")),t&&(0,r.createElement)("table",null,(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"quiz-attempts__questions"},(0,u.__)("Questions","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__spend"},(0,u.__)("Time spent","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__marks"},(0,u.__)("Marks","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__grade"},(0,u.__)("Passing grade","learnpress")),(0,r.createElement)("th",{className:"quiz-attempts__result"},(0,u.__)("Result","learnpress")))),(0,r.createElement)("tbody",null,e.map(((e,t)=>(0,r.createElement)("tr",{key:`attempt-${t}`},(0,r.createElement)("td",{className:"quiz-attempts__questions"},`${e.questionCorrect} / ${e.questionCount}`),(0,r.createElement)("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),(0,r.createElement)("td",{className:"quiz-attempts__marks"},`${e.userMark} / ${e.mark}`),(0,r.createElement)("td",{className:"quiz-attempts__grade"},e.passingGrade||"-"),(0,r.createElement)("td",{className:"quiz-attempts__result"},`${parseFloat(e.result).toFixed(2)}%`," ",(0,r.createElement)("span",null,e.graduationText)))))))))},T=()=>{const{getData:e}=(0,a.select)("learnpress/quiz"),{submitQuiz:t}=(0,a.dispatch)("learnpress/quiz"),s=e("totalTime"),n=e("duration"),[i,o]=(0,r.useState)(s);let[u,l]=(0,r.useState)(0);return(0,r.useEffect)((()=>{const e=setInterval((()=>{if(n>0){let s=i;s-=1,s>0?(o(s),u++,l(n-s)):(clearInterval(e),t())}else u++,l(u),o(u)}),1e3);return()=>clearInterval(e)}),[i,u]),(0,r.createElement)("div",{className:"countdown"},(0,r.createElement)("i",{className:"fas fa-stopwatch"}),(0,r.createElement)("span",null,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":";const t=[];let n;return s<3600?(t.push((i-i%60)/60),t.push(i%60)):s&&(t.push((i-i%3600)/3600),n=i%3600,t.push((n-n%60)/60),t.push(n%60)),t.map((e=>e<10?`0${e}`:e)).join(e)}()),(0,r.createElement)("input",{type:"hidden",name:"lp-quiz-time-spend",value:u}))},R=window.wp.url;const O=jQuery;let L=null;const x={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init(){return!!this.instance||(this.elLPOverlay=O(".lp-overlay"),!!this.elLPOverlay.length&&(L=this.elLPOverlay,this.elMainContent=L.find(".main-content"),this.elTitle=L.find(".modal-title"),this.elBtnYes=L.find(".btn-yes"),this.elBtnNo=L.find(".btn-no"),this.elFooter=L.find(".lp-modal-footer"),O(document).on("click",".close, .btn-no",(function(){L.hide()})),O(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof x.callBackYes&&x.callBackYes()})),this.instance=this,!0))},setElCalledModal(e){this.elCalledModal=e},setContentModal(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal(e){this.elTitle.html(e)}};var D=x,M={elBtnFinishCourse:null,elBtnCompleteItem:null,init(){D.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",(e=>{e.preventDefault();const t=e.target.closest("form");D.elLPOverlay.show(),D.setTitleModal(t.dataset.title),D.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),D.callBackYes=()=>{t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((e=>e.addEventListener("click",(e=>{e.preventDefault();const t=e.target.closest("form");D.elLPOverlay.show(),D.setTitleModal(t.dataset.title),D.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),D.callBackYes=()=>{t.submit()}})))))}};const{debounce:H}=lodash;var F=()=>{const[e,t]=(0,r.useState)(0),[s,n]=(0,r.useState)(!1),i=(0,a.useSelect)((e=>e("learnpress/quiz").getData("id")),[]),o=(0,a.useSelect)((e=>e("learnpress/quiz").getData("results")),[]),l=(0,a.useSelect)((e=>e("learnpress/quiz").getData("passingGrade")),[]),c=(0,a.useSelect)((e=>e("learnpress/quiz").getData("submitting")),[]);(0,r.useEffect)((()=>{p();let e="";if(e=o.graduation?o.graduation:o.result>=f?"passed":"failed",e){const t=document.querySelector(`.course-curriculum .course-item.course-item-${i}`);t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}const t=[...document.querySelectorAll("#popup-header .items-progress")][0],s=document.querySelector(".curriculum-sections");if(t&&s){const e=t.dataset.totalItems,s=t.querySelector(".items-completed"),n=t.querySelector(".learn-press-progress__active");if(s){const t=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");s.textContent=parseInt(t.length);const r=100-100*parseInt(t.length)/parseInt(e);n.style.left="-"+r+"%"}}}),[o]),(0,r.useEffect)((()=>{void 0!==c&&d()}),[c]);const d=()=>{const e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&(async e=>{const t=await wp.apiFetch({path:(0,R.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"}),{data:s}=t;e.innerHTML+=s,M.init()})(e[0])},p=()=>{t(0),n(!1),jQuery.easing._customEasing=function(e,t,s,n,r){return n*Math.sqrt(1-(t=t/r-1)*t)+s},H((()=>{const e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:o.result},{duration:1500,step:(e,s)=>{t(e)},done:()=>{n(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),H((()=>{jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),o.result>0?1e3:10)()};let m=e;Number.isInteger(e)||(m=parseFloat(e).toFixed(2));const h=190*Math.PI,g={strokeDasharray:`${h} ${h}`,strokeDashoffset:h-m/100*h},f=parseFloat(o.passingGrade||l);let _="";_=o.graduation?o.graduation:m>=f?"passed":"failed";let q="";q=o.graduationText?o.graduationText:"passed"===_?(0,u.__)("Passed","learnpress"):(0,u.__)("Failed","learnpress");const w=["quiz-result",_];return(0,r.createElement)("div",{className:w.join(" ")},(0,r.createElement)("h3",{className:"result-heading"},(0,u.__)("Your Result","learnpress")),(0,r.createElement)("div",{id:"quizResultGrade",className:"result-grade"},(0,r.createElement)("svg",{className:"circle-progress-bar",width:200,height:200},(0,r.createElement)("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:g,fill:"transparent",r:95,cx:100,cy:100})),(0,r.createElement)("span",{className:"result-achieved"},`${m}%`),(0,r.createElement)("span",{className:"result-require"},f+"%"||0)),s&&(0,r.createElement)("p",{className:"result-message"},q),(0,r.createElement)("ul",{className:"result-statistic"},(0,r.createElement)("li",{className:"result-statistic-field result-time-spend"},(0,r.createElement)("span",null,(0,u.__)("Time spent","learnpress")),(0,r.createElement)("p",null,o.timeSpend)),(0,r.createElement)("li",{className:"result-statistic-field result-point"},(0,r.createElement)("span",null,(0,u.__)("Points","learnpress")),(0,r.createElement)("p",null,o.userMark," / ",o.mark)),(0,r.createElement)("li",{className:"result-statistic-field result-questions"},(0,r.createElement)("span",null,(0,u.__)("Questions","learnpress")),(0,r.createElement)("p",null,o.questionCount)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-correct"},(0,r.createElement)("span",null,(0,u.__)("Correct","learnpress")),(0,r.createElement)("p",null,o.questionCorrect)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-wrong"},(0,r.createElement)("span",null,(0,u.__)("Wrong","learnpress")),(0,r.createElement)("p",null,o.questionWrong)),(0,r.createElement)("li",{className:"result-statistic-field result-questions-skipped"},(0,r.createElement)("span",null,(0,u.__)("Skipped","learnpress")),(0,r.createElement)("p",null,o.questionEmpty))))};const U=jQuery,{debounce:$}=lodash;var j=()=>{const{submitQuiz:e}=(0,a.dispatch)("learnpress/quiz");(0,r.useEffect)((()=>{const e=U("#popup-content");if(!e.length)return;const t=e.find(".content-item-scrollable:eq(1)"),s=e.find(".content-item-wrap"),n=e.find(".quiz-status"),r=n.offset().top-92;let i=!1,o="-"+s.css("margin-left");U(window).on("resize.refresh-quiz-stauts-bar",$((function(){o="-"+s.css("margin-left"),n.css({"margin-left":o,"margin-right":o})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(()=>{if(t.scrollTop()>=r){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}),[]);const t=()=>{const{confirm:s}=(0,a.select)("learnpress/modal");"no"!==s((0,u.__)("Are you sure to submit quiz?","learnpress"),t)&&e()},{getData:s,getUserMark:n}=(0,a.select)("learnpress/quiz"),i=s("currentPage"),o=s("questionsPerPage"),l=s("questionIds").length,c=s("submitting"),d=(s("duration"),n()),p=["quiz-status"],m=(i-1)*o+1;let h=m+o-1,g="";return h=Math.min(h,l),c&&p.push("submitting"),g=h<l?o>1?(0,u.sprintf)((0,u.__)("Question <span>%d to %d of %d</span>","learnpress"),m,h,l):(0,u.sprintf)((0,u.__)("Question <span>%d of %d</span>","learnpress"),m,l):(0,u.sprintf)((0,u.__)("Question <span>%d to %d</span>","learnpress"),m,h),(0,r.createElement)("div",{className:p.join(" ")},(0,r.createElement)("div",null,(0,r.createElement)("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:g}}),(0,r.createElement)("div",{className:"current-point"},(0,u.sprintf)((0,u.__)("Earned Point: %s","learnpress"),d)),(0,r.createElement)("div",null,(0,r.createElement)("div",{className:"submit-quiz"},(0,r.createElement)("button",{className:"lp-button",id:"button-submit-quiz",onClick:t},c?(0,u.__)("Submitting...","learnpress"):(0,u.__)("Finish Quiz","learnpress"))),(0,r.createElement)(T,null))))};const{omit:B,flow:J,isArray:G,chunk:K}=lodash,{camelCaseDashObjectKeys:W}=LP,{get:Z,set:Y}=LP.localStorage,V={},X=(e,t)=>{const{answered:s,id:n}=e,r={...s[t.questionId]||{},answered:t.answers,temp:!0};return n&&localStorage.setItem(`LP_Quiz_${n}_Answered`,JSON.stringify({...e.answered,[t.questionId]:r})),{...e,answered:{...e.answered,[t.questionId]:r}}},ee=(e,t)=>{const{questionsRendered:s}=e;return G(s)?(s.push(t.questionId),{...e,questionsRendered:[...s]}):{...e,questionsRendered:[t.questionId]}},te=(e,t)=>(t.currentPage&&Y(`Q${e.id}.currentPage`,t.currentPage),{...e,...t}),se=(e,t)=>{const s=e.questions.map((e=>e.id==t.questionId?{...e,showHint:t.showHint}:e));return{...e,questions:[...s]}},ne=(e,t)=>{const s=e.questions.map((e=>{if(e.id!==t.questionId)return e;const s={explanation:t.explanation};return t.options&&(s.options=t.options),{...e,...s}})),n={...e.answered,[t.questionId]:t.result};let r=localStorage.getItem(`LP_Quiz_${e.id}_Answered`);return r&&(r={...JSON.parse(r),...n},localStorage.setItem(`LP_Quiz_${e.id}_Answered`,JSON.stringify(r))),{...e,questions:[...s],answered:n,checkedQuestions:[...e.checkedQuestions,t.questionId]}},re=(e,t)=>{localStorage.removeItem(`LP_Quiz_${e.id}_Answered`);const s=e.questions.map((s=>{const n={};return e.reviewQuestions&&(t.results.questions[s.id].explanation&&(n.explanation=t.results.questions[s.id].explanation),t.results.questions[s.id].options&&(n.options=t.results.questions[s.id].options)),{...s,...n}}));return te(e,{submitting:!1,currentPage:1,...t.results,questions:[...s]})},ie=(e,t)=>{const s=void 0!==t.results.success&&t.results.success,n=t.results.message||!1;return te(e,{checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1,...t.results.results,successResponse:s,messageResponse:n})},oe=J(a.combineReducers,(e=>(t,s)=>e(t,s)),(e=>(t,s)=>e(t,s)),(e=>(t,s)=>e(t,s)))({a(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1}},b(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2}}});var ae=(0,a.combineReducers)({blocks:oe,userQuiz:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);const s=K(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=s.length,t.data.pages=s,{...e,...t.data,currentPage:Z(`Q${t.data.id}.currentPage`)||t.data.currentPage};case"SUBMIT_QUIZ":return{...e,submitting:!0};case"START_QUIZ":case"START_QUIZ_SUCCESS":return ie(e,t);case"SET_CURRENT_QUESTION":return Y(`Q${e.id}.currentQuestion`,t.questionId),{...e,currentQuestion:t.questionId};case"SET_CURRENT_PAGE":return Y(`Q${e.id}.currentPage`,t.currentPage),{...e,currentPage:t.currentPage};case"SUBMIT_QUIZ_SUCCESS":return re(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?X(e,t):e;case"MARK_QUESTION_RENDERED":return ee(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?te(e,{mode:t.mode}):{...e,mode:t.mode};case"SET_QUESTION_HINT":return se(e,t);case"CHECK_ANSWER":return ne(e,t);case"SEND_KEY":return{...e,keyPressed:t.keyPressed}}return e}}),ue=window.LP.dataControls;function le(){const e=[].slice.call(arguments,2),t=(0,a.dispatch)(arguments[0]),s=arguments[1];t[s](...e)}const{camelCaseDashObjectKeys:ce,Hook:de}=LP;function pe(e,t){return{type:"SET_QUIZ_DATA",data:ce(t="string"==typeof e?{[e]:t}:e)}}function me(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function he(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function ge(e,t,s){return{type:"BEFORE_START_QUIZ"}}function fe(e,t,s,n){return de.doAction("quiz-started",e,t,s,n),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:s,userId:n,results:e}}const _e=function*(){const{itemId:e,courseId:t}=(0,a.select)("learnpress/quiz").getDefaultRestArgs();if(!0!==de.applyFilters("before-start-quiz",!0,e,t))return;let s=yield(0,ue.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:e,course_id:t}});const n=document.querySelector(".lp-button.start");if("error"!==s.status){if(s=de.applyFilters("request-start-quiz-response",s,e,t),1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id;window.localStorage.removeItem(e);const t={endTime:Date.now()+1e3*s.results.duration,status:s.results.status};window.localStorage.setItem(e,JSON.stringify(t));const n="quiz_off_retaken_"+lpQuizSettings.id;let r=window.localStorage.getItem(n);null===r?r=0:r++,window.localStorage.setItem(n,r)}yield le("learnpress/quiz","__requestStartQuizSuccess",ce(s),e,t)}else{const e=document.querySelector(".quiz-buttons"),t=`<div class="learn-press-message error">${s.message}</div>`;e.insertAdjacentHTML("afterend",t),n.classList.remove("loading")}};function qe(){return{type:"SUBMIT_QUIZ"}}function we(e,t,s){return de.doAction("quiz-submitted",e,t,s),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function*ve(){const{getDefaultRestArgs:e,getQuestionsSelectedAnswers:t}=(0,a.select)("learnpress/quiz"),{itemId:s,courseId:n}=e();if(!0!==de.applyFilters("before-submit-quiz",!0))return;const r=t();if(1===lpQuizSettings.checkNorequizenroll){const e=`LP_Quiz_${s}_Answered`,t=localStorage.getItem(e);if(null!==t){const e=JSON.parse(t);for(const[t,s]of Object.entries(e))r[t]=s.answered}}let i=0;const o=document.querySelector("input[name=lp-quiz-time-spend]");o&&(i=o.value);let u=yield(0,ue.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:s,course_id:n,answered:r,time_spend:i}});if(u=de.applyFilters("request-submit-quiz-response",u,s,n),"success"===u.status){if(1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id,t=window.localStorage.getItem(e);if(null!==t){const s=JSON.parse(t);s.status=u.results.status,s.results=u.results.results,window.localStorage.setItem(e,JSON.stringify(s)),window.localStorage.removeItem("LP_Quiz_"+lpQuizSettings.id+"_Answered")}}yield le("learnpress/quiz","__requestSubmitQuizSuccess",ce(u.results),s,n)}}function Se(e,t,s){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function ye(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function*Ee(e,t){yield le("learnpress/quiz","__requestShowHintSuccess",e,t)}function ze(e,t){return{type:"CHECK_ANSWER",questionId:e,...t}}function*be(e){const{getDefaultRestArgs:t,getQuestionAnswered:s}=(0,a.select)("learnpress/quiz"),{itemId:n,courseId:r}=t(),i=yield(0,ue.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:n,course_id:r,question_id:e,answered:s(e)||""}});if("success"===i.status){if(1===lpQuizSettings.checkNorequizenroll){const t="quiz_off_"+lpQuizSettings.id,s=window.localStorage.getItem(t);if(null!==s){const n=JSON.parse(s),r=i.options;void 0===n.checked_questions?(n.checked_questions=[],n.checked_questions.push(e)):-1===n.checked_questions.indexOf(e)&&n.checked_questions.push(e),void 0===n.question_options?(n.question_options={},n.question_options[e]=r):void 0===n.question_options[e]&&(n.question_options[e]=r),window.localStorage.setItem(t,JSON.stringify(n))}}yield le("learnpress/quiz","__requestCheckAnswerSuccess",e,ce(i))}}function ke(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Pe(e){return{type:"SET_QUIZ_MODE",mode:e}}function Qe(e){return setTimeout((()=>{le("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}const{get:Ne,isArray:Ie}=lodash,Ce=function(e,t){console.time("parseOptions");let s=Ue(e,t).options;return s=Ie(s)?s:JSON.parse(CryptoJS.AES.decrypt(s.data,s.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),s=Ie(s)?s:JSON.parse(s),console.timeEnd("parseOptions"),s};function Ae(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.status"):""}function Te(e,t,s){return e[t]||s}function Re(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.attempts"):[]}function Oe(e,t){const s=(0,a.select)("course-learner/user").getItemById(t);return s?Ne(s,"userSettings.answered",{}):{}}function Le(e){const{userQuiz:t}=e,s=Ne(t,"questions");return s?Object.values(s):[]}function xe(e,t){const{userQuiz:s}=e;return t?Ne(s,t):s}function De(e){const{userQuiz:t}=e;return{itemId:t.id,courseId:t.courseId}}function Me(e,t){const{userQuiz:s}=e;return Ne(s,`answered.${t}.answered`)||void 0}function He(e,t){const{userQuiz:s}=e;return Ne(s,`answered.${t}.mark`)||void 0}function Fe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const s=Ne(e,"userQuiz.questionsPerPage")||1;if(s>1)return!1;const n=Ne(e,"userQuiz.currentPage")||1;return Ne(e,"object"===t?`userQuiz.questions[${n-1}]`:`userQuiz.questionIds[${n-1}]`)}const Ue=function(e,t){const{userQuiz:s}=e;return(0,a.select)("learnpress/quiz").getQuestions().find((e=>e.id==t))};function $e(e,t){return-1!==(Ne(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function je(e,t){}const Be=function(e,t){const s=Ne(e,"userQuiz.answered"),n={};for(const e in s)if(s.hasOwnProperty(e)&&(s[e].temp||s[e].blanks)){if(t&&e===t)return s[e].answered;n[e]=s[e].answered}return n};function Je(e){const t=e.userQuiz||{},{answered:s,negativeMarking:n,questions:r,checkedQuestions:i}=t;let o=0;for(let e in s){if(!s.hasOwnProperty(e))continue;e=parseInt(e);const t=s[e],a=t.questionMark?t.questionMark:function(){const t=r.find((t=>t.id===e));return t?t.point:0}();i.indexOf(e),t.temp||(n?t.answered&&(o=t.correct?o+t.mark:o-a):t.answered&&t.correct&&(o+=t.mark))}return o>0?o:0}var Ge=s(965),Ke=s.n(Ge);const We={ENROLL_COURSE_X:(e,t)=>{}};const{controls:Ze}=LP.dataControls;!function(e){let t=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:e.getState,dispatch:function(){return t(...arguments)}};t=Ke()(We)(s)(e.dispatch),e.dispatch=t}((0,a.registerStore)("learnpress/quiz",{reducer:ae,selectors:t,actions:e,controls:{...Ze}}));const{chunk:Ye}=lodash;class Ve extends r.Component{constructor(e){super(...arguments),i(this,"startQuiz",(e=>{this.props.startQuiz()})),this.state={currentPage:1,numPages:0,pages:[]}}componentDidMount(){const{settings:e,setQuizData:t}=this.props,{question_ids:s,questions_per_page:n}=e,r=Ye(s,n);e.currentPage=1,e.numPages=r.length,e.pages=r;const i=!!e.id&&localStorage.getItem(`LP_Quiz_${e.id}_Answered`);i&&(e.answered=JSON.parse(i)),t(e)}componentDidUpdate(e,t,s){const{status:n}=e,r=document.querySelector(".quiz-content");void 0!==n&&r&&(r.style.display="none")}render(){const{status:e,isReviewing:t}=this.props,s=-1!==["","completed","viewed"].indexOf(e)||!e,n=-1!==["","viewed",void 0].indexOf(e)||!e;return void 0!==e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",null,!t&&"completed"===e&&(0,r.createElement)(F,null),!t&&n&&(0,r.createElement)(d,null),"started"===e&&(0,r.createElement)(j,null),(-1!==["completed","started"].indexOf(e)||t)&&(0,r.createElement)(C,null),(0,r.createElement)(h,null),s&&!t&&(0,r.createElement)(A,null)))}}var Xe=(0,o.compose)([(0,a.withSelect)((e=>{const{getQuestions:t,getData:s}=e("learnpress/quiz");return{questions:t(),status:s("status"),store:s(),answered:s("answered"),isReviewing:"reviewing"===s("mode"),questionIds:s("questionIds"),checkCount:s("instantCheck"),questionsPerPage:s("questionsPerPage")||1}})),(0,a.withDispatch)((e=>{const{setQuizData:t,startQuiz:s}=e("learnpress/quiz");return{setQuizData:t,startQuiz:s}}))])(Ve);s(605);const{modal:{default:et}}=LP;var tt=Xe;const st=(e,t)=>{if(1===lpQuizSettings.checkNorequizenroll){const e="quiz_off_"+lpQuizSettings.id,s=window.localStorage.getItem(e);if(null!==s){const e=JSON.parse(s);if(t.status=e.status,"started"===e.status){const s=Date.now();t.total_time=Math.floor((e.endTime-s)/1e3)}else"completed"===e.status&&(t.results=e.results,t.answered=e.results.answered,t.questions=e.results.questions);if(void 0!==e.checked_questions&&(t.checked_questions=e.checked_questions),void 0!==e.question_options)for(const s in t.questions){let n=t.questions[s];void 0!==e.question_options[n.id]&&(n.options=e.question_options[n.id]),t.questions[s]=n}}}wp.element.render((0,r.createElement)(et,null,(0,r.createElement)(Xe,{settings:t})),[...document.querySelectorAll(e)][0]),LP.Hook.doAction("lp-quiz-compatible-builder")}}(),(window.LP=window.LP||{}).quiz=n}();
assets/js/vendor/plugins.all.js CHANGED
@@ -1,359 +1 @@
1
- if (!Object.prototype.watchChange) {
2
- var isFunction = function (fn) {
3
- return fn && {}.toString.call(fn) === '[object Function]';
4
- };
5
- Object.defineProperty(
6
- Object.prototype,
7
- 'watchChange',
8
- {
9
- enumerable: false,
10
- configurable: true,
11
- writable: false,
12
- value: function (prop, handler) {
13
- var obj = this;
14
-
15
- function x(prop, handler) {
16
- var oldval = obj[prop],
17
- newval = oldval,
18
- getter = function () {
19
- return newval;
20
- },
21
- setter = function (val) {
22
- return newval = handler.call(obj, prop, oldval, val);
23
- };
24
-
25
- if (delete obj[prop]) {
26
- Object.defineProperty(
27
- obj,
28
- prop,
29
- {
30
- get: getter,
31
- set: setter,
32
- enumerable: true,
33
- configurable: true
34
- }
35
- );
36
- }
37
- }
38
-
39
- if (isFunction(prop)) {
40
- for (var k in this) {
41
- new x(k, prop);
42
- }
43
- } else {
44
- new x(prop, handler)
45
- }
46
- }
47
- });
48
- }
49
-
50
- if (!Object.prototype.unwatchChange) {
51
- Object.defineProperty(
52
- Object.prototype,
53
- 'unwatchChange',
54
- {
55
- enumerable: false,
56
- configurable: true,
57
- writable: false,
58
- value: function (prop) {
59
- var val = this[prop];
60
- delete this[prop];
61
- this[prop] = val;
62
- }
63
- }
64
- );
65
- }
66
- /*!
67
- * jQuery.scrollTo
68
- * Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com
69
- * Licensed under MIT
70
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
71
- * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery
72
- * @author Ariel Flesler
73
- * @version 2.1.2
74
- */
75
- ;(function(factory) {
76
- 'use strict';
77
- if (typeof define === 'function' && define.amd) {
78
- // AMD
79
- define(['jquery'], factory);
80
- } else if (typeof module !== 'undefined' && module.exports) {
81
- // CommonJS
82
- module.exports = factory(require('jquery'));
83
- } else {
84
- // Global
85
- factory(jQuery);
86
- }
87
- })(function($) {
88
- 'use strict';
89
-
90
- var $scrollTo = $.scrollTo = function(target, duration, settings) {
91
- return $(window).scrollTo(target, duration, settings);
92
- };
93
-
94
- $scrollTo.defaults = {
95
- axis:'xy',
96
- duration: 0,
97
- limit:true
98
- };
99
-
100
- function isWin(elem) {
101
- return !elem.nodeName ||
102
- $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;
103
- }
104
-
105
- $.fn.scrollTo = function(target, duration, settings) {
106
- if (typeof duration === 'object') {
107
- settings = duration;
108
- duration = 0;
109
- }
110
- if (typeof settings === 'function') {
111
- settings = { onAfter:settings };
112
- }
113
- if (target === 'max') {
114
- target = 9e9;
115
- }
116
-
117
- settings = $.extend({}, $scrollTo.defaults, settings);
118
- // Speed is still recognized for backwards compatibility
119
- duration = duration || settings.duration;
120
- // Make sure the settings are given right
121
- var queue = settings.queue && settings.axis.length > 1;
122
- if (queue) {
123
- // Let's keep the overall duration
124
- duration /= 2;
125
- }
126
- settings.offset = both(settings.offset);
127
- settings.over = both(settings.over);
128
-
129
- return this.each(function() {
130
- // Null target yields nothing, just like jQuery does
131
- if (target === null) return;
132
-
133
- var win = isWin(this),
134
- elem = win ? this.contentWindow || window : this,
135
- $elem = $(elem),
136
- targ = target,
137
- attr = {},
138
- toff;
139
-
140
- switch (typeof targ) {
141
- // A number will pass the regex
142
- case 'number':
143
- case 'string':
144
- if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
145
- targ = both(targ);
146
- // We are done
147
- break;
148
- }
149
- // Relative/Absolute selector
150
- targ = win ? $(targ) : $(targ, elem);
151
- /* falls through */
152
- case 'object':
153
- if (targ.length === 0) return;
154
- // DOMElement / jQuery
155
- if (targ.is || targ.style) {
156
- // Get the real position of the target
157
- toff = (targ = $(targ)).offset();
158
- }
159
- }
160
-
161
- var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;
162
-
163
- $.each(settings.axis.split(''), function(i, axis) {
164
- var Pos = axis === 'x' ? 'Left' : 'Top',
165
- pos = Pos.toLowerCase(),
166
- key = 'scroll' + Pos,
167
- prev = $elem[key](),
168
- max = $scrollTo.max(elem, axis);
169
-
170
- if (toff) {// jQuery / DOMElement
171
- attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);
172
-
173
- // If it's a dom element, reduce the margin
174
- if (settings.margin) {
175
- attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;
176
- attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;
177
- }
178
-
179
- attr[key] += offset[pos] || 0;
180
-
181
- if (settings.over[pos]) {
182
- // Scroll to a fraction of its width/height
183
- attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];
184
- }
185
- } else {
186
- var val = targ[pos];
187
- // Handle percentage values
188
- attr[key] = val.slice && val.slice(-1) === '%' ?
189
- parseFloat(val) / 100 * max
190
- : val;
191
- }
192
-
193
- // Number or 'number'
194
- if (settings.limit && /^\d+$/.test(attr[key])) {
195
- // Check the limits
196
- attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
197
- }
198
-
199
- // Don't waste time animating, if there's no need.
200
- if (!i && settings.axis.length > 1) {
201
- if (prev === attr[key]) {
202
- // No animation needed
203
- attr = {};
204
- } else if (queue) {
205
- // Intermediate animation
206
- animate(settings.onAfterFirst);
207
- // Don't animate this axis again in the next iteration.
208
- attr = {};
209
- }
210
- }
211
- });
212
-
213
- animate(settings.onAfter);
214
-
215
- function animate(callback) {
216
- var opts = $.extend({}, settings, {
217
- // The queue setting conflicts with animate()
218
- // Force it to always be true
219
- queue: true,
220
- duration: duration,
221
- complete: callback && function() {
222
- callback.call(elem, targ, settings);
223
- }
224
- });
225
- $elem.animate(attr, opts);
226
- }
227
- });
228
- };
229
-
230
- // Max scrolling position, works on quirks mode
231
- // It only fails (not too badly) on IE, quirks mode.
232
- $scrollTo.max = function(elem, axis) {
233
- var Dim = axis === 'x' ? 'Width' : 'Height',
234
- scroll = 'scroll'+Dim;
235
-
236
- if (!isWin(elem))
237
- return elem[scroll] - $(elem)[Dim.toLowerCase()]();
238
-
239
- var size = 'client' + Dim,
240
- doc = elem.ownerDocument || elem.document,
241
- html = doc.documentElement,
242
- body = doc.body;
243
-
244
- return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);
245
- };
246
-
247
- function both(val) {
248
- return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
249
- }
250
-
251
- // Add special hooks so that window scroll properties can be animated
252
- $.Tween.propHooks.scrollLeft =
253
- $.Tween.propHooks.scrollTop = {
254
- get: function(t) {
255
- return $(t.elem)[t.prop]();
256
- },
257
- set: function(t) {
258
- var curr = this.get(t);
259
- // If interrupt is true and user scrolled, stop animating
260
- if (t.options.interrupt && t._last && t._last !== curr) {
261
- return $(t.elem).stop();
262
- }
263
- var next = Math.round(t.now);
264
- // Don't waste CPU
265
- // Browsers don't render floating point scroll
266
- if (curr !== next) {
267
- $(t.elem)[t.prop](next);
268
- t._last = this.get(t);
269
- }
270
- }
271
- };
272
-
273
- // AMD requirement
274
- return $scrollTo;
275
- });
276
- (function (e) {
277
- e.backward_timer = function (t) {
278
- var n = {seconds: 5, step: 1, format: "h%:m%:s%", value_setter: undefined, on_exhausted: function (e) {
279
- }, on_tick : function (e) {
280
- }}, r = this;
281
- r.seconds_left = 0;
282
- r.target = e(t);
283
- r.timeout = undefined;
284
- r.settings = {};
285
- r.methods = {init : function (t) {
286
- r.settings = e.extend({}, n, t);
287
- if (r.settings.value_setter == undefined) {
288
- if (r.target.is("input")) {
289
- r.settings.value_setter = "val"
290
- } else {
291
- r.settings.value_setter = "text"
292
- }
293
- }
294
- r.methods.reset()
295
- }, start : function () {
296
- if (r.timeout == undefined) {
297
- var e = r.seconds_left == r.settings.seconds ? 0 : r.settings.step * 1e3;
298
- setTimeout(r.methods._on_tick, e, e)
299
- }
300
- }, cancel : function () {
301
- if (r.timeout != undefined) {
302
- clearTimeout(r.timeout);
303
- r.timeout = undefined
304
- }
305
- }, reset : function () {
306
- r.seconds_left = r.settings.seconds;
307
- r.methods._render_seconds()
308
- }, _on_tick : function (e) {
309
- if (e != 0) {
310
- r.settings.on_tick(r)
311
- }
312
- r.methods._render_seconds();
313
- if (r.seconds_left > 0) {
314
- if (r.seconds_left < r.settings.step) {
315
- var t = r.seconds_left
316
- } else {
317
- var t = r.settings.step
318
- }
319
- r.seconds_left -= t;
320
- var n = t * 1e3;
321
- r.timeout = setTimeout(r.methods._on_tick, n, n)
322
- } else {
323
- r.timeout = undefined;
324
- r.settings.on_exhausted(r)
325
- }
326
- }, _render_seconds : function () {
327
- var e = r.methods._seconds_to_dhms(r.seconds_left), t = r.settings.format;
328
- if (t.indexOf("d%") !== -1) {
329
- t = t.replace("d%", e.d).replace("h%", r.methods._check_leading_zero(e.h))
330
- } else {
331
- t = t.replace("h%", e.d * 24 + e.h)
332
- }
333
- t = t.replace("m%", r.methods._check_leading_zero(e.m)).replace("s%", r.methods._check_leading_zero(e.s));
334
- r.target[r.settings.value_setter](t)
335
- }, _seconds_to_dhms : function (e) {
336
- var t = Math.floor(e / (24 * 3600)), e = e - t * 24 * 3600, n = Math.floor(e / 3600), e = e - n * 3600, r = Math.floor(e / 60), i = Math.floor(e - r * 60);
337
- return{d: t, h: n, m: r, s: i}
338
- }, _check_leading_zero: function (e) {
339
- return e < 10 ? "0" + e : "" + e
340
- }}
341
- };
342
- e.fn.backward_timer = function (t) {
343
- var n = arguments;
344
- return this.each(function () {
345
- var r = e(this).data("backward_timer");
346
- if (r == undefined) {
347
- r = new e.backward_timer(this);
348
- e(this).data("backward_timer", r)
349
- }
350
- if (r.methods[t]) {
351
- return r.methods[t].apply(this, Array.prototype.slice.call(n, 1))
352
- } else if (typeof t === "object" || !t) {
353
- return r.methods.init.apply(this, n)
354
- } else {
355
- e.error("Method " + t + " does not exist on jQuery.backward_timer")
356
- }
357
- })
358
- }
359
- })(jQuery);
1
+ if(!Object.prototype.watchChange){var isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)};Object.defineProperty(Object.prototype,"watchChange",{enumerable:!1,configurable:!0,writable:!1,value:function(e,t){var n=this;function o(e,t){var o=n[e],s=o;delete n[e]&&Object.defineProperty(n,e,{get:function(){return s},set:function(r){return s=t.call(n,e,o,r)},enumerable:!0,configurable:!0})}if(isFunction(e))for(var s in this)new o(s,e);else new o(e,t)}})}Object.prototype.unwatchChange||Object.defineProperty(Object.prototype,"unwatchChange",{enumerable:!1,configurable:!0,writable:!1,value:function(e){var t=this[e];delete this[e],this[e]=t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}((function(e){"use strict";var t=e.scrollTo=function(t,n,o){return e(window).scrollTo(t,n,o)};function n(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function o(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}return t.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(s,r,i){"object"==typeof r&&(i=r,r=0),"function"==typeof i&&(i={onAfter:i}),"max"===s&&(s=9e9),i=e.extend({},t.defaults,i),r=r||i.duration;var a=i.queue&&i.axis.length>1;return a&&(r/=2),i.offset=o(i.offset),i.over=o(i.over),this.each((function(){if(null!==s){var c,u=n(this),l=u?this.contentWindow||window:this,f=e(l),d=s,h={};switch(typeof d){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(d)){d=o(d);break}d=u?e(d):e(d,l);case"object":if(0===d.length)return;(d.is||d.style)&&(c=(d=e(d)).offset())}var m=e.isFunction(i.offset)&&i.offset(l,d)||i.offset;e.each(i.axis.split(""),(function(e,n){var o="x"===n?"Left":"Top",s=o.toLowerCase(),r="scroll"+o,p=f[r](),g=t.max(l,n);if(c)h[r]=c[s]+(u?0:p-f.offset()[s]),i.margin&&(h[r]-=parseInt(d.css("margin"+o),10)||0,h[r]-=parseInt(d.css("border"+o+"Width"),10)||0),h[r]+=m[s]||0,i.over[s]&&(h[r]+=d["x"===n?"width":"height"]()*i.over[s]);else{var v=d[s];h[r]=v.slice&&"%"===v.slice(-1)?parseFloat(v)/100*g:v}i.limit&&/^\d+$/.test(h[r])&&(h[r]=h[r]<=0?0:Math.min(h[r],g)),!e&&i.axis.length>1&&(p===h[r]?h={}:a&&(_(i.onAfterFirst),h={}))})),_(i.onAfter)}function _(t){var n=e.extend({},i,{queue:!0,duration:r,complete:t&&function(){t.call(l,d,i)}});f.animate(h,n)}}))},t.max=function(t,o){var s="x"===o?"Width":"Height",r="scroll"+s;if(!n(t))return t[r]-e(t)[s.toLowerCase()]();var i="client"+s,a=t.ownerDocument||t.document,c=a.documentElement,u=a.body;return Math.max(c[r],u[r])-Math.min(c[i],u[i])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var n=this.get(t);if(t.options.interrupt&&t._last&&t._last!==n)return e(t.elem).stop();var o=Math.round(t.now);n!==o&&(e(t.elem)[t.prop](o),t._last=this.get(t))}},t})),function(e){e.backward_timer=function(t){var n={seconds:5,step:1,format:"h%:m%:s%",value_setter:void 0,on_exhausted:function(e){},on_tick:function(e){}},o=this;o.seconds_left=0,o.target=e(t),o.timeout=void 0,o.settings={},o.methods={init:function(t){o.settings=e.extend({},n,t),null==o.settings.value_setter&&(o.target.is("input")?o.settings.value_setter="val":o.settings.value_setter="text"),o.methods.reset()},start:function(){if(null==o.timeout){var e=o.seconds_left==o.settings.seconds?0:1e3*o.settings.step;setTimeout(o.methods._on_tick,e,e)}},cancel:function(){null!=o.timeout&&(clearTimeout(o.timeout),o.timeout=void 0)},reset:function(){o.seconds_left=o.settings.seconds,o.methods._render_seconds()},_on_tick:function(e){if(0!=e&&o.settings.on_tick(o),o.methods._render_seconds(),o.seconds_left>0){if(o.seconds_left<o.settings.step)var t=o.seconds_left;else t=o.settings.step;o.seconds_left-=t;var n=1e3*t;o.timeout=setTimeout(o.methods._on_tick,n,n)}else o.timeout=void 0,o.settings.on_exhausted(o)},_render_seconds:function(){var e=o.methods._seconds_to_dhms(o.seconds_left),t=o.settings.format;t=(t=-1!==t.indexOf("d%")?t.replace("d%",e.d).replace("h%",o.methods._check_leading_zero(e.h)):t.replace("h%",24*e.d+e.h)).replace("m%",o.methods._check_leading_zero(e.m)).replace("s%",o.methods._check_leading_zero(e.s)),o.target[o.settings.value_setter](t)},_seconds_to_dhms:function(e){var t=Math.floor(e/86400),n=(e-=24*t*3600,Math.floor(e/3600)),o=(e-=3600*n,Math.floor(e/60));return{d:t,h:n,m:o,s:Math.floor(e-60*o)}},_check_leading_zero:function(e){return e<10?"0"+e:""+e}}},e.fn.backward_timer=function(t){var n=arguments;return this.each((function(){var o=e(this).data("backward_timer");return null==o&&(o=new e.backward_timer(this),e(this).data("backward_timer",o)),o.methods[t]?o.methods[t].apply(this,Array.prototype.slice.call(n,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist on jQuery.backward_timer"):o.methods.init.apply(this,n)}))}}(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/vendor/vue/vue_libs.js CHANGED
@@ -1,14524 +1 @@
1
- /*!
2
- * Vue.js v2.6.10
3
- * (c) 2014-2019 Evan You
4
- * Released under the MIT License.
5
- */
6
-
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9
- typeof define === 'function' && define.amd ? define(factory) :
10
- (global = global || self, global.Vue = factory());
11
- }(this, function () { 'use strict';
12
-
13
- /* */
14
-
15
- var emptyObject = Object.freeze({});
16
-
17
- // These helpers produce better VM code in JS engines due to their
18
- // explicitness and function inlining.
19
- function isUndef (v) {
20
- return v === undefined || v === null
21
- }
22
-
23
- function isDef (v) {
24
- return v !== undefined && v !== null
25
- }
26
-
27
- function isTrue (v) {
28
- return v === true
29
- }
30
-
31
- function isFalse (v) {
32
- return v === false
33
- }
34
-
35
- /**
36
- * Check if value is primitive.
37
- */
38
- function isPrimitive (value) {
39
- return (
40
- typeof value === 'string' ||
41
- typeof value === 'number' ||
42
- // $flow-disable-line
43
- typeof value === 'symbol' ||
44
- typeof value === 'boolean'
45
- )
46
- }
47
-
48
- /**
49
- * Quick object check - this is primarily used to tell
50
- * Objects from primitive values when we know the value
51
- * is a JSON-compliant type.
52
- */
53
- function isObject (obj) {
54
- return obj !== null && typeof obj === 'object'
55
- }
56
-
57
- /**
58
- * Get the raw type string of a value, e.g., [object Object].
59
- */
60
- var _toString = Object.prototype.toString;
61
-
62
- function toRawType (value) {
63
- return _toString.call(value).slice(8, -1)
64
- }
65
-
66
- /**
67
- * Strict object type check. Only returns true
68
- * for plain JavaScript objects.
69
- */
70
- function isPlainObject (obj) {
71
- return _toString.call(obj) === '[object Object]'
72
- }
73
-
74
- function isRegExp (v) {
75
- return _toString.call(v) === '[object RegExp]'
76
- }
77
-
78
- /**
79
- * Check if val is a valid array index.
80
- */
81
- function isValidArrayIndex (val) {
82
- var n = parseFloat(String(val));
83
- return n >= 0 && Math.floor(n) === n && isFinite(val)
84
- }
85
-
86
- function isPromise (val) {
87
- return (
88
- isDef(val) &&
89
- typeof val.then === 'function' &&
90
- typeof val.catch === 'function'
91
- )
92
- }
93
-
94
- /**
95
- * Convert a value to a string that is actually rendered.
96
- */
97
- function toString (val) {
98
- return val == null
99
- ? ''
100
- : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
101
- ? JSON.stringify(val, null, 2)
102
- : String(val)
103
- }
104
-
105
- /**
106
- * Convert an input value to a number for persistence.
107
- * If the conversion fails, return original string.
108
- */
109
- function toNumber (val) {
110
- var n = parseFloat(val);
111
- return isNaN(n) ? val : n
112
- }
113
-
114
- /**
115
- * Make a map and return a function for checking if a key
116
- * is in that map.
117
- */
118
- function makeMap (
119
- str,
120
- expectsLowerCase
121
- ) {
122
- var map = Object.create(null);
123
- var list = str.split(',');
124
- for (var i = 0; i < list.length; i++) {
125
- map[list[i]] = true;
126
- }
127
- return expectsLowerCase
128
- ? function (val) { return map[val.toLowerCase()]; }
129
- : function (val) { return map[val]; }
130
- }
131
-
132
- /**
133
- * Check if a tag is a built-in tag.
134
- */
135
- var isBuiltInTag = makeMap('slot,component', true);
136
-
137
- /**
138
- * Check if an attribute is a reserved attribute.
139
- */
140
- var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
141
-
142
- /**
143
- * Remove an item from an array.
144
- */
145
- function remove (arr, item) {
146
- if (arr.length) {
147
- var index = arr.indexOf(item);
148
- if (index > -1) {
149
- return arr.splice(index, 1)
150
- }
151
- }
152
- }
153
-
154
- /**
155
- * Check whether an object has the property.
156
- */
157
- var hasOwnProperty = Object.prototype.hasOwnProperty;
158
- function hasOwn (obj, key) {
159
- return hasOwnProperty.call(obj, key)
160
- }
161
-
162
- /**
163
- * Create a cached version of a pure function.
164
- */
165
- function cached (fn) {
166
- var cache = Object.create(null);
167
- return (function cachedFn (str) {
168
- var hit = cache[str];
169
- return hit || (cache[str] = fn(str))
170
- })
171
- }
172
-
173
- /**
174
- * Camelize a hyphen-delimited string.
175
- */
176
- var camelizeRE = /-(\w)/g;
177
- var camelize = cached(function (str) {
178
- return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
179
- });
180
-
181
- /**
182
- * Capitalize a string.
183
- */
184
- var capitalize = cached(function (str) {
185
- return str.charAt(0).toUpperCase() + str.slice(1)
186
- });
187
-
188
- /**
189
- * Hyphenate a camelCase string.
190
- */
191
- var hyphenateRE = /\B([A-Z])/g;
192
- var hyphenate = cached(function (str) {
193
- return str.replace(hyphenateRE, '-$1').toLowerCase()
194
- });
195
-
196
- /**
197
- * Simple bind polyfill for environments that do not support it,
198
- * e.g., PhantomJS 1.x. Technically, we don't need this anymore
199
- * since native bind is now performant enough in most browsers.
200
- * But removing it would mean breaking code that was able to run in
201
- * PhantomJS 1.x, so this must be kept for backward compatibility.
202
- */
203
-
204
- /* istanbul ignore next */
205
- function polyfillBind (fn, ctx) {
206
- function boundFn (a) {
207
- var l = arguments.length;
208
- return l
209
- ? l > 1
210
- ? fn.apply(ctx, arguments)
211
- : fn.call(ctx, a)
212
- : fn.call(ctx)
213
- }
214
-
215
- boundFn._length = fn.length;
216
- return boundFn
217
- }
218
-
219
- function nativeBind (fn, ctx) {
220
- return fn.bind(ctx)
221
- }
222
-
223
- var bind = Function.prototype.bind
224
- ? nativeBind
225
- : polyfillBind;
226
-
227
- /**
228
- * Convert an Array-like object to a real Array.
229
- */
230
- function toArray (list, start) {
231
- start = start || 0;
232
- var i = list.length - start;
233
- var ret = new Array(i);
234
- while (i--) {
235
- ret[i] = list[i + start];
236
- }
237
- return ret
238
- }
239
-
240
- /**
241
- * Mix properties into target object.
242
- */
243
- function extend (to, _from) {
244
- for (var key in _from) {
245
- to[key] = _from[key];
246
- }
247
- return to
248
- }
249
-
250
- /**
251
- * Merge an Array of Objects into a single Object.
252
- */
253
- function toObject (arr) {
254
- var res = {};
255
- for (var i = 0; i < arr.length; i++) {
256
- if (arr[i]) {
257
- extend(res, arr[i]);
258
- }
259
- }
260
- return res
261
- }
262
-
263
- /* eslint-disable no-unused-vars */
264
-
265
- /**
266
- * Perform no operation.
267
- * Stubbing args to make Flow happy without leaving useless transpiled code
268
- * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
269
- */
270
- function noop (a, b, c) {}
271
-
272
- /**
273
- * Always return false.
274
- */
275
- var no = function (a, b, c) { return false; };
276
-
277
- /* eslint-enable no-unused-vars */
278
-
279
- /**
280
- * Return the same value.
281
- */
282
- var identity = function (_) { return _; };
283
-
284
- /**
285
- * Generate a string containing static keys from compiler modules.
286
- */
287
- function genStaticKeys (modules) {
288
- return modules.reduce(function (keys, m) {
289
- return keys.concat(m.staticKeys || [])
290
- }, []).join(',')
291
- }
292
-
293
- /**
294
- * Check if two values are loosely equal - that is,
295
- * if they are plain objects, do they have the same shape?
296
- */
297
- function looseEqual (a, b) {
298
- if (a === b) { return true }
299
- var isObjectA = isObject(a);
300
- var isObjectB = isObject(b);
301
- if (isObjectA && isObjectB) {
302
- try {
303
- var isArrayA = Array.isArray(a);
304
- var isArrayB = Array.isArray(b);
305
- if (isArrayA && isArrayB) {
306
- return a.length === b.length && a.every(function (e, i) {
307
- return looseEqual(e, b[i])
308
- })
309
- } else if (a instanceof Date && b instanceof Date) {
310
- return a.getTime() === b.getTime()
311
- } else if (!isArrayA && !isArrayB) {
312
- var keysA = Object.keys(a);
313
- var keysB = Object.keys(b);
314
- return keysA.length === keysB.length && keysA.every(function (key) {
315
- return looseEqual(a[key], b[key])
316
- })
317
- } else {
318
- /* istanbul ignore next */
319
- return false
320
- }
321
- } catch (e) {
322
- /* istanbul ignore next */
323
- return false
324
- }
325
- } else if (!isObjectA && !isObjectB) {
326
- return String(a) === String(b)
327
- } else {
328
- return false
329
- }
330
- }
331
-
332
- /**
333
- * Return the first index at which a loosely equal value can be
334
- * found in the array (if value is a plain object, the array must
335
- * contain an object of the same shape), or -1 if it is not present.
336
- */
337
- function looseIndexOf (arr, val) {
338
- for (var i = 0; i < arr.length; i++) {
339
- if (looseEqual(arr[i], val)) { return i }
340
- }
341
- return -1
342
- }
343
-
344
- /**
345
- * Ensure a function is called only once.
346
- */
347
- function once (fn) {
348
- var called = false;
349
- return function () {
350
- if (!called) {
351
- called = true;
352
- fn.apply(this, arguments);
353
- }
354
- }
355
- }
356
-
357
- var SSR_ATTR = 'data-server-rendered';
358
-
359
- var ASSET_TYPES = [
360
- 'component',
361
- 'directive',
362
- 'filter'
363
- ];
364
-
365
- var LIFECYCLE_HOOKS = [
366
- 'beforeCreate',
367
- 'created',
368
- 'beforeMount',
369
- 'mounted',
370
- 'beforeUpdate',
371
- 'updated',
372
- 'beforeDestroy',
373
- 'destroyed',
374
- 'activated',
375
- 'deactivated',
376
- 'errorCaptured',
377
- 'serverPrefetch'
378
- ];
379
-
380
- /* */
381
-
382
-
383
-
384
- var config = ({
385
- /**
386
- * Option merge strategies (used in core/util/options)
387
- */
388
- // $flow-disable-line
389
- optionMergeStrategies: Object.create(null),
390
-
391
- /**
392
- * Whether to suppress warnings.
393
- */
394
- silent: false,
395
-
396
- /**
397
- * Show production mode tip message on boot?
398
- */
399
- productionTip: "development" !== 'production',
400
-
401
- /**
402
- * Whether to enable devtools
403
- */
404
- devtools: "development" !== 'production',
405
-
406
- /**
407
- * Whether to record perf
408
- */
409
- performance: false,
410
-
411
- /**
412
- * Error handler for watcher errors
413
- */
414
- errorHandler: null,
415
-
416
- /**
417
- * Warn handler for watcher warns
418
- */
419
- warnHandler: null,
420
-
421
- /**
422
- * Ignore certain custom elements
423
- */
424
- ignoredElements: [],
425
-
426
- /**
427
- * Custom user key aliases for v-on
428
- */
429
- // $flow-disable-line
430
- keyCodes: Object.create(null),
431
-
432
- /**
433
- * Check if a tag is reserved so that it cannot be registered as a
434
- * component. This is platform-dependent and may be overwritten.
435
- */
436
- isReservedTag: no,
437
-
438
- /**
439
- * Check if an attribute is reserved so that it cannot be used as a component
440
- * prop. This is platform-dependent and may be overwritten.
441
- */
442
- isReservedAttr: no,
443
-
444
- /**
445
- * Check if a tag is an unknown element.
446
- * Platform-dependent.
447
- */
448
- isUnknownElement: no,
449
-
450
- /**
451
- * Get the namespace of an element
452
- */
453
- getTagNamespace: noop,
454
-
455
- /**
456
- * Parse the real tag name for the specific platform.
457
- */
458
- parsePlatformTagName: identity,
459
-
460
- /**
461
- * Check if an attribute must be bound using property, e.g. value
462
- * Platform-dependent.
463
- */
464
- mustUseProp: no,
465
-
466
- /**
467
- * Perform updates asynchronously. Intended to be used by Vue Test Utils
468
- * This will significantly reduce performance if set to false.
469
- */
470
- async: true,
471
-
472
- /**
473
- * Exposed for legacy reasons
474
- */
475
- _lifecycleHooks: LIFECYCLE_HOOKS
476
- });
477
-
478
- /* */
479
-
480
- /**
481
- * unicode letters used for parsing html tags, component names and property paths.
482
- * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
483
- * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
484
- */
485
- var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
486
-
487
- /**
488
- * Check if a string starts with $ or _
489
- */
490
- function isReserved (str) {
491
- var c = (str + '').charCodeAt(0);
492
- return c === 0x24 || c === 0x5F
493
- }
494
-
495
- /**
496
- * Define a property.
497
- */
498
- function def (obj, key, val, enumerable) {
499
- Object.defineProperty(obj, key, {
500
- value: val,
501
- enumerable: !!enumerable,
502
- writable: true,
503
- configurable: true
504
- });
505
- }
506
-
507
- /**
508
- * Parse simple path.
509
- */
510
- var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
511
- function parsePath (path) {
512
- if (bailRE.test(path)) {
513
- return
514
- }
515
- var segments = path.split('.');
516
- return function (obj) {
517
- for (var i = 0; i < segments.length; i++) {
518
- if (!obj) { return }
519
- obj = obj[segments[i]];
520
- }
521
- return obj
522
- }
523
- }
524
-
525
- /* */
526
-
527
- // can we use __proto__?
528
- var hasProto = '__proto__' in {};
529
-
530
- // Browser environment sniffing
531
- var inBrowser = typeof window !== 'undefined';
532
- var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
533
- var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
534
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
535
- var isIE = UA && /msie|trident/.test(UA);
536
- var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
537
- var isEdge = UA && UA.indexOf('edge/') > 0;
538
- var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
539
- var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
540
- var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
541
- var isPhantomJS = UA && /phantomjs/.test(UA);
542
- var isFF = UA && UA.match(/firefox\/(\d+)/);
543
-
544
- // Firefox has a "watch" function on Object.prototype...
545
- var nativeWatch = ({}).watch;
546
-
547
- var supportsPassive = false;
548
- if (inBrowser) {
549
- try {
550
- var opts = {};
551
- Object.defineProperty(opts, 'passive', ({
552
- get: function get () {
553
- /* istanbul ignore next */
554
- supportsPassive = true;
555
- }
556
- })); // https://github.com/facebook/flow/issues/285
557
- window.addEventListener('test-passive', null, opts);
558
- } catch (e) {}
559
- }
560
-
561
- // this needs to be lazy-evaled because vue may be required before
562
- // vue-server-renderer can set VUE_ENV
563
- var _isServer;
564
- var isServerRendering = function () {
565
- if (_isServer === undefined) {
566
- /* istanbul ignore if */
567
- if (!inBrowser && !inWeex && typeof global !== 'undefined') {
568
- // detect presence of vue-server-renderer and avoid
569
- // Webpack shimming the process
570
- _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
571
- } else {
572
- _isServer = false;
573
- }
574
- }
575
- return _isServer
576
- };
577
-
578
- // detect devtools
579
- var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
580
-
581
- /* istanbul ignore next */
582
- function isNative (Ctor) {
583
- return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
584
- }
585
-
586
- var hasSymbol =
587
- typeof Symbol !== 'undefined' && isNative(Symbol) &&
588
- typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
589
-
590
- var _Set;
591
- /* istanbul ignore if */ // $flow-disable-line
592
- if (typeof Set !== 'undefined' && isNative(Set)) {
593
- // use native Set when available.
594
- _Set = Set;
595
- } else {
596
- // a non-standard Set polyfill that only works with primitive keys.
597
- _Set = /*@__PURE__*/(function () {
598
- function Set () {
599
- this.set = Object.create(null);
600
- }
601
- Set.prototype.has = function has (key) {
602
- return this.set[key] === true
603
- };
604
- Set.prototype.add = function add (key) {
605
- this.set[key] = true;
606
- };
607
- Set.prototype.clear = function clear () {
608
- this.set = Object.create(null);
609
- };
610
-
611
- return Set;
612
- }());
613
- }
614
-
615
- /* */
616
-
617
- var warn = noop;
618
- var tip = noop;
619
- var generateComponentTrace = (noop); // work around flow check
620
- var formatComponentName = (noop);
621
-
622
- {
623
- var hasConsole = typeof console !== 'undefined';
624
- var classifyRE = /(?:^|[-_])(\w)/g;
625
- var classify = function (str) { return str
626
- .replace(classifyRE, function (c) { return c.toUpperCase(); })
627
- .replace(/[-_]/g, ''); };
628
-
629
- warn = function (msg, vm) {
630
- var trace = vm ? generateComponentTrace(vm) : '';
631
-
632
- if (config.warnHandler) {
633
- config.warnHandler.call(null, msg, vm, trace);
634
- } else if (hasConsole && (!config.silent)) {
635
- console.error(("[Vue warn]: " + msg + trace));
636
- }
637
- };
638
-
639
- tip = function (msg, vm) {
640
- if (hasConsole && (!config.silent)) {
641
- console.warn("[Vue tip]: " + msg + (
642
- vm ? generateComponentTrace(vm) : ''
643
- ));
644
- }
645
- };
646
-
647
- formatComponentName = function (vm, includeFile) {
648
- if (vm.$root === vm) {
649
- return '<Root>'
650
- }
651
- var options = typeof vm === 'function' && vm.cid != null
652
- ? vm.options
653
- : vm._isVue
654
- ? vm.$options || vm.constructor.options
655
- : vm;
656
- var name = options.name || options._componentTag;
657
- var file = options.__file;
658
- if (!name && file) {
659
- var match = file.match(/([^/\\]+)\.vue$/);
660
- name = match && match[1];
661
- }
662
-
663
- return (
664
- (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
665
- (file && includeFile !== false ? (" at " + file) : '')
666
- )
667
- };
668
-
669
- var repeat = function (str, n) {
670
- var res = '';
671
- while (n) {
672
- if (n % 2 === 1) { res += str; }
673
- if (n > 1) { str += str; }
674
- n >>= 1;
675
- }
676
- return res
677
- };
678
-
679
- generateComponentTrace = function (vm) {
680
- if (vm._isVue && vm.$parent) {
681
- var tree = [];
682
- var currentRecursiveSequence = 0;
683
- while (vm) {
684
- if (tree.length > 0) {
685
- var last = tree[tree.length - 1];
686
- if (last.constructor === vm.constructor) {
687
- currentRecursiveSequence++;
688
- vm = vm.$parent;
689
- continue
690
- } else if (currentRecursiveSequence > 0) {
691
- tree[tree.length - 1] = [last, currentRecursiveSequence];
692
- currentRecursiveSequence = 0;
693
- }
694
- }
695
- tree.push(vm);
696
- vm = vm.$parent;
697
- }
698
- return '\n\nfound in\n\n' + tree
699
- .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
700
- ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
701
- : formatComponentName(vm))); })
702
- .join('\n')
703
- } else {
704
- return ("\n\n(found in " + (formatComponentName(vm)) + ")")
705
- }
706
- };
707
- }
708
-
709
- /* */
710
-
711
- var uid = 0;
712
-
713
- /**
714
- * A dep is an observable that can have multiple
715
- * directives subscribing to it.
716
- */
717
- var Dep = function Dep () {
718
- this.id = uid++;
719
- this.subs = [];
720
- };
721
-
722
- Dep.prototype.addSub = function addSub (sub) {
723
- this.subs.push(sub);
724
- };
725
-
726
- Dep.prototype.removeSub = function removeSub (sub) {
727
- remove(this.subs, sub);
728
- };
729
-
730
- Dep.prototype.depend = function depend () {
731
- if (Dep.target) {
732
- Dep.target.addDep(this);
733
- }
734
- };
735
-
736
- Dep.prototype.notify = function notify () {
737
- // stabilize the subscriber list first
738
- var subs = this.subs.slice();
739
- if (!config.async) {
740
- // subs aren't sorted in scheduler if not running async
741
- // we need to sort them now to make sure they fire in correct
742
- // order
743
- subs.sort(function (a, b) { return a.id - b.id; });
744
- }
745
- for (var i = 0, l = subs.length; i < l; i++) {
746
- subs[i].update();
747
- }
748
- };
749
-
750
- // The current target watcher being evaluated.
751
- // This is globally unique because only one watcher
752
- // can be evaluated at a time.
753
- Dep.target = null;
754
- var targetStack = [];
755
-
756
- function pushTarget (target) {
757
- targetStack.push(target);
758
- Dep.target = target;
759
- }
760
-
761
- function popTarget () {
762
- targetStack.pop();
763
- Dep.target = targetStack[targetStack.length - 1];
764
- }
765
-
766
- /* */
767
-
768
- var VNode = function VNode (
769
- tag,
770
- data,
771
- children,
772
- text,
773
- elm,
774
- context,
775
- componentOptions,
776
- asyncFactory
777
- ) {
778
- this.tag = tag;
779
- this.data = data;
780
- this.children = children;
781
- this.text = text;
782
- this.elm = elm;
783
- this.ns = undefined;
784
- this.context = context;
785
- this.fnContext = undefined;
786
- this.fnOptions = undefined;
787
- this.fnScopeId = undefined;
788
- this.key = data && data.key;
789
- this.componentOptions = componentOptions;
790
- this.componentInstance = undefined;
791
- this.parent = undefined;
792
- this.raw = false;
793
- this.isStatic = false;
794
- this.isRootInsert = true;
795
- this.isComment = false;
796
- this.isCloned = false;
797
- this.isOnce = false;
798
- this.asyncFactory = asyncFactory;
799
- this.asyncMeta = undefined;
800
- this.isAsyncPlaceholder = false;
801
- };
802
-
803
- var prototypeAccessors = { child: { configurable: true } };
804
-
805
- // DEPRECATED: alias for componentInstance for backwards compat.
806
- /* istanbul ignore next */
807
- prototypeAccessors.child.get = function () {
808
- return this.componentInstance
809
- };
810
-
811
- Object.defineProperties( VNode.prototype, prototypeAccessors );
812
-
813
- var createEmptyVNode = function (text) {
814
- if ( text === void 0 ) text = '';
815
-
816
- var node = new VNode();
817
- node.text = text;
818
- node.isComment = true;
819
- return node
820
- };
821
-
822
- function createTextVNode (val) {
823
- return new VNode(undefined, undefined, undefined, String(val))
824
- }
825
-
826
- // optimized shallow clone
827
- // used for static nodes and slot nodes because they may be reused across
828
- // multiple renders, cloning them avoids errors when DOM manipulations rely
829
- // on their elm reference.
830
- function cloneVNode (vnode) {
831
- var cloned = new VNode(
832
- vnode.tag,
833
- vnode.data,
834
- // #7975
835
- // clone children array to avoid mutating original in case of cloning
836
- // a child.
837
- vnode.children && vnode.children.slice(),
838
- vnode.text,
839
- vnode.elm,
840
- vnode.context,
841
- vnode.componentOptions,
842
- vnode.asyncFactory
843
- );
844
- cloned.ns = vnode.ns;
845
- cloned.isStatic = vnode.isStatic;
846
- cloned.key = vnode.key;
847
- cloned.isComment = vnode.isComment;
848
- cloned.fnContext = vnode.fnContext;
849
- cloned.fnOptions = vnode.fnOptions;
850
- cloned.fnScopeId = vnode.fnScopeId;
851
- cloned.asyncMeta = vnode.asyncMeta;
852
- cloned.isCloned = true;
853
- return cloned
854
- }
855
-
856
- /*
857
- * not type checking this file because flow doesn't play well with
858
- * dynamically accessing methods on Array prototype
859
- */
860
-
861
- var arrayProto = Array.prototype;
862
- var arrayMethods = Object.create(arrayProto);
863
-
864
- var methodsToPatch = [
865
- 'push',
866
- 'pop',
867
- 'shift',
868
- 'unshift',
869
- 'splice',
870
- 'sort',
871
- 'reverse'
872
- ];
873
-
874
- /**
875
- * Intercept mutating methods and emit events
876
- */
877
- methodsToPatch.forEach(function (method) {
878
- // cache original method
879
- var original = arrayProto[method];
880
- def(arrayMethods, method, function mutator () {
881
- var args = [], len = arguments.length;
882
- while ( len-- ) args[ len ] = arguments[ len ];
883
-
884
- var result = original.apply(this, args);
885
- var ob = this.__ob__;
886
- var inserted;
887
- switch (method) {
888
- case 'push':
889
- case 'unshift':
890
- inserted = args;
891
- break
892
- case 'splice':
893
- inserted = args.slice(2);
894
- break
895
- }
896
- if (inserted) { ob.observeArray(inserted); }
897
- // notify change
898
- ob.dep.notify();
899
- return result
900
- });
901
- });
902
-
903
- /* */
904
-
905
- var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
906
-
907
- /**
908
- * In some cases we may want to disable observation inside a component's
909
- * update computation.
910
- */
911
- var shouldObserve = true;
912
-
913
- function toggleObserving (value) {
914
- shouldObserve = value;
915
- }
916
-
917
- /**
918
- * Observer class that is attached to each observed
919
- * object. Once attached, the observer converts the target
920
- * object's property keys into getter/setters that
921
- * collect dependencies and dispatch updates.
922
- */
923
- var Observer = function Observer (value) {
924
- this.value = value;
925
- this.dep = new Dep();
926
- this.vmCount = 0;
927
- def(value, '__ob__', this);
928
- if (Array.isArray(value)) {
929
- if (hasProto) {
930
- protoAugment(value, arrayMethods);
931
- } else {
932
- copyAugment(value, arrayMethods, arrayKeys);
933
- }
934
- this.observeArray(value);
935
- } else {
936
- this.walk(value);
937
- }
938
- };
939
-
940
- /**
941
- * Walk through all properties and convert them into
942
- * getter/setters. This method should only be called when
943
- * value type is Object.
944
- */
945
- Observer.prototype.walk = function walk (obj) {
946
- var keys = Object.keys(obj);
947
- for (var i = 0; i < keys.length; i++) {
948
- defineReactive$$1(obj, keys[i]);
949
- }
950
- };
951
-
952
- /**
953
- * Observe a list of Array items.
954
- */
955
- Observer.prototype.observeArray = function observeArray (items) {
956
- for (var i = 0, l = items.length; i < l; i++) {
957
- observe(items[i]);
958
- }
959
- };
960
-
961
- // helpers
962
-
963
- /**
964
- * Augment a target Object or Array by intercepting
965
- * the prototype chain using __proto__
966
- */
967
- function protoAugment (target, src) {
968
- /* eslint-disable no-proto */
969
- target.__proto__ = src;
970
- /* eslint-enable no-proto */
971
- }
972
-
973
- /**
974
- * Augment a target Object or Array by defining
975
- * hidden properties.
976
- */
977
- /* istanbul ignore next */
978
- function copyAugment (target, src, keys) {
979
- for (var i = 0, l = keys.length; i < l; i++) {
980
- var key = keys[i];
981
- def(target, key, src[key]);
982
- }
983
- }
984
-
985
- /**
986
- * Attempt to create an observer instance for a value,
987
- * returns the new observer if successfully observed,
988
- * or the existing observer if the value already has one.
989
- */
990
- function observe (value, asRootData) {
991
- if (!isObject(value) || value instanceof VNode) {
992
- return
993
- }
994
- var ob;
995
- if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
996
- ob = value.__ob__;
997
- } else if (
998
- shouldObserve &&
999
- !isServerRendering() &&
1000
- (Array.isArray(value) || isPlainObject(value)) &&
1001
- Object.isExtensible(value) &&
1002
- !value._isVue
1003
- ) {
1004
- ob = new Observer(value);
1005
- }
1006
- if (asRootData && ob) {
1007
- ob.vmCount++;
1008
- }
1009
- return ob
1010
- }
1011
-
1012
- /**
1013
- * Define a reactive property on an Object.
1014
- */
1015
- function defineReactive$$1 (
1016
- obj,
1017
- key,
1018
- val,
1019
- customSetter,
1020
- shallow
1021
- ) {
1022
- var dep = new Dep();
1023
-
1024
- var property = Object.getOwnPropertyDescriptor(obj, key);
1025
- if (property && property.configurable === false) {
1026
- return
1027
- }
1028
-
1029
- // cater for pre-defined getter/setters
1030
- var getter = property && property.get;
1031
- var setter = property && property.set;
1032
- if ((!getter || setter) && arguments.length === 2) {
1033
- val = obj[key];
1034
- }
1035
-
1036
- var childOb = !shallow && observe(val);
1037
- Object.defineProperty(obj, key, {
1038
- enumerable: true,
1039
- configurable: true,
1040
- get: function reactiveGetter () {
1041
- var value = getter ? getter.call(obj) : val;
1042
- if (Dep.target) {
1043
- dep.depend();
1044
- if (childOb) {
1045
- childOb.dep.depend();
1046
- if (Array.isArray(value)) {
1047
- dependArray(value);
1048
- }
1049
- }
1050
- }
1051
- return value
1052
- },
1053
- set: function reactiveSetter (newVal) {
1054
- var value = getter ? getter.call(obj) : val;
1055
- /* eslint-disable no-self-compare */
1056
- if (newVal === value || (newVal !== newVal && value !== value)) {
1057
- return
1058
- }
1059
- /* eslint-enable no-self-compare */
1060
- if (customSetter) {
1061
- customSetter();
1062
- }
1063
- // #7981: for accessor properties without setter
1064
- if (getter && !setter) { return }
1065
- if (setter) {
1066
- setter.call(obj, newVal);
1067
- } else {
1068
- val = newVal;
1069
- }
1070
- childOb = !shallow && observe(newVal);
1071
- dep.notify();
1072
- }
1073
- });
1074
- }
1075
-
1076
- /**
1077
- * Set a property on an object. Adds the new property and
1078
- * triggers change notification if the property doesn't
1079
- * already exist.
1080
- */
1081
- function set (target, key, val) {
1082
- if (isUndef(target) || isPrimitive(target)
1083
- ) {
1084
- warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
1085
- }
1086
- if (Array.isArray(target) && isValidArrayIndex(key)) {
1087
- target.length = Math.max(target.length, key);
1088
- target.splice(key, 1, val);
1089
- return val
1090
- }
1091
- if (key in target && !(key in Object.prototype)) {
1092
- target[key] = val;
1093
- return val
1094
- }
1095
- var ob = (target).__ob__;
1096
- if (target._isVue || (ob && ob.vmCount)) {
1097
- warn(
1098
- 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1099
- 'at runtime - declare it upfront in the data option.'
1100
- );
1101
- return val
1102
- }
1103
- if (!ob) {
1104
- target[key] = val;
1105
- return val
1106
- }
1107
- defineReactive$$1(ob.value, key, val);
1108
- ob.dep.notify();
1109
- return val
1110
- }
1111
-
1112
- /**
1113
- * Delete a property and trigger change if necessary.
1114
- */
1115
- function del (target, key) {
1116
- if (isUndef(target) || isPrimitive(target)
1117
- ) {
1118
- warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
1119
- }
1120
- if (Array.isArray(target) && isValidArrayIndex(key)) {
1121
- target.splice(key, 1);
1122
- return
1123
- }
1124
- var ob = (target).__ob__;
1125
- if (target._isVue || (ob && ob.vmCount)) {
1126
- warn(
1127
- 'Avoid deleting properties on a Vue instance or its root $data ' +
1128
- '- just set it to null.'
1129
- );
1130
- return
1131
- }
1132
- if (!hasOwn(target, key)) {
1133
- return
1134
- }
1135
- delete target[key];
1136
- if (!ob) {
1137
- return
1138
- }
1139
- ob.dep.notify();
1140
- }
1141
-
1142
- /**
1143
- * Collect dependencies on array elements when the array is touched, since
1144
- * we cannot intercept array element access like property getters.
1145
- */
1146
- function dependArray (value) {
1147
- for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1148
- e = value[i];
1149
- e && e.__ob__ && e.__ob__.dep.depend();
1150
- if (Array.isArray(e)) {
1151
- dependArray(e);
1152
- }
1153
- }
1154
- }
1155
-
1156
- /* */
1157
-
1158
- /**
1159
- * Option overwriting strategies are functions that handle
1160
- * how to merge a parent option value and a child option
1161
- * value into the final value.
1162
- */
1163
- var strats = config.optionMergeStrategies;
1164
-
1165
- /**
1166
- * Options with restrictions
1167
- */
1168
- {
1169
- strats.el = strats.propsData = function (parent, child, vm, key) {
1170
- if (!vm) {
1171
- warn(
1172
- "option \"" + key + "\" can only be used during instance " +
1173
- 'creation with the `new` keyword.'
1174
- );
1175
- }
1176
- return defaultStrat(parent, child)
1177
- };
1178
- }
1179
-
1180
- /**
1181
- * Helper that recursively merges two data objects together.
1182
- */
1183
- function mergeData (to, from) {
1184
- if (!from) { return to }
1185
- var key, toVal, fromVal;
1186
-
1187
- var keys = hasSymbol
1188
- ? Reflect.ownKeys(from)
1189
- : Object.keys(from);
1190
-
1191
- for (var i = 0; i < keys.length; i++) {
1192
- key = keys[i];
1193
- // in case the object is already observed...
1194
- if (key === '__ob__') { continue }
1195
- toVal = to[key];
1196
- fromVal = from[key];
1197
- if (!hasOwn(to, key)) {
1198
- set(to, key, fromVal);
1199
- } else if (
1200
- toVal !== fromVal &&
1201
- isPlainObject(toVal) &&
1202
- isPlainObject(fromVal)
1203
- ) {
1204
- mergeData(toVal, fromVal);
1205
- }
1206
- }
1207
- return to
1208
- }
1209
-
1210
- /**
1211
- * Data
1212
- */
1213
- function mergeDataOrFn (
1214
- parentVal,
1215
- childVal,
1216
- vm
1217
- ) {
1218
- if (!vm) {
1219
- // in a Vue.extend merge, both should be functions
1220
- if (!childVal) {
1221
- return parentVal
1222
- }
1223
- if (!parentVal) {
1224
- return childVal
1225
- }
1226
- // when parentVal & childVal are both present,
1227
- // we need to return a function that returns the
1228
- // merged result of both functions... no need to
1229
- // check if parentVal is a function here because
1230
- // it has to be a function to pass previous merges.
1231
- return function mergedDataFn () {
1232
- return mergeData(
1233
- typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1234
- typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1235
- )
1236
- }
1237
- } else {
1238
- return function mergedInstanceDataFn () {
1239
- // instance merge
1240
- var instanceData = typeof childVal === 'function'
1241
- ? childVal.call(vm, vm)
1242
- : childVal;
1243
- var defaultData = typeof parentVal === 'function'
1244
- ? parentVal.call(vm, vm)
1245
- : parentVal;
1246
- if (instanceData) {
1247
- return mergeData(instanceData, defaultData)
1248
- } else {
1249
- return defaultData
1250
- }
1251
- }
1252
- }
1253
- }
1254
-
1255
- strats.data = function (
1256
- parentVal,
1257
- childVal,
1258
- vm
1259
- ) {
1260
- if (!vm) {
1261
- if (childVal && typeof childVal !== 'function') {
1262
- warn(
1263
- 'The "data" option should be a function ' +
1264
- 'that returns a per-instance value in component ' +
1265
- 'definitions.',
1266
- vm
1267
- );
1268
-
1269
- return parentVal
1270
- }
1271
- return mergeDataOrFn(parentVal, childVal)
1272
- }
1273
-
1274
- return mergeDataOrFn(parentVal, childVal, vm)
1275
- };
1276
-
1277
- /**
1278
- * Hooks and props are merged as arrays.
1279
- */
1280
- function mergeHook (
1281
- parentVal,
1282
- childVal
1283
- ) {
1284
- var res = childVal
1285
- ? parentVal
1286
- ? parentVal.concat(childVal)
1287
- : Array.isArray(childVal)
1288
- ? childVal
1289
- : [childVal]
1290
- : parentVal;
1291
- return res
1292
- ? dedupeHooks(res)
1293
- : res
1294
- }
1295
-
1296
- function dedupeHooks (hooks) {
1297
- var res = [];
1298
- for (var i = 0; i < hooks.length; i++) {
1299
- if (res.indexOf(hooks[i]) === -1) {
1300
- res.push(hooks[i]);
1301
- }
1302
- }
1303
- return res
1304
- }
1305
-
1306
- LIFECYCLE_HOOKS.forEach(function (hook) {
1307
- strats[hook] = mergeHook;
1308
- });
1309
-
1310
- /**
1311
- * Assets
1312
- *
1313
- * When a vm is present (instance creation), we need to do
1314
- * a three-way merge between constructor options, instance
1315
- * options and parent options.
1316
- */
1317
- function mergeAssets (
1318
- parentVal,
1319
- childVal,
1320
- vm,
1321
- key
1322
- ) {
1323
- var res = Object.create(parentVal || null);
1324
- if (childVal) {
1325
- assertObjectType(key, childVal, vm);
1326
- return extend(res, childVal)
1327
- } else {
1328
- return res
1329
- }
1330
- }
1331
-
1332
- ASSET_TYPES.forEach(function (type) {
1333
- strats[type + 's'] = mergeAssets;
1334
- });
1335
-
1336
- /**
1337
- * Watchers.
1338
- *
1339
- * Watchers hashes should not overwrite one
1340
- * another, so we merge them as arrays.
1341
- */
1342
- strats.watch = function (
1343
- parentVal,
1344
- childVal,
1345
- vm,
1346
- key
1347
- ) {
1348
- // work around Firefox's Object.prototype.watch...
1349
- if (parentVal === nativeWatch) { parentVal = undefined; }
1350
- if (childVal === nativeWatch) { childVal = undefined; }
1351
- /* istanbul ignore if */
1352
- if (!childVal) { return Object.create(parentVal || null) }
1353
- {
1354
- assertObjectType(key, childVal, vm);
1355
- }
1356
- if (!parentVal) { return childVal }
1357
- var ret = {};
1358
- extend(ret, parentVal);
1359
- for (var key$1 in childVal) {
1360
- var parent = ret[key$1];
1361
- var child = childVal[key$1];
1362
- if (parent && !Array.isArray(parent)) {
1363
- parent = [parent];
1364
- }
1365
- ret[key$1] = parent
1366
- ? parent.concat(child)
1367
- : Array.isArray(child) ? child : [child];
1368
- }
1369
- return ret
1370
- };
1371
-
1372
- /**
1373
- * Other object hashes.
1374
- */
1375
- strats.props =
1376
- strats.methods =
1377
- strats.inject =
1378
- strats.computed = function (
1379
- parentVal,
1380
- childVal,
1381
- vm,
1382
- key
1383
- ) {
1384
- if (childVal && "development" !== 'production') {
1385
- assertObjectType(key, childVal, vm);
1386
- }
1387
- if (!parentVal) { return childVal }
1388
- var ret = Object.create(null);
1389
- extend(ret, parentVal);
1390
- if (childVal) { extend(ret, childVal); }
1391
- return ret
1392
- };
1393
- strats.provide = mergeDataOrFn;
1394
-
1395
- /**
1396
- * Default strategy.
1397
- */
1398
- var defaultStrat = function (parentVal, childVal) {
1399
- return childVal === undefined
1400
- ? parentVal
1401
- : childVal
1402
- };
1403
-
1404
- /**
1405
- * Validate component names
1406
- */
1407
- function checkComponents (options) {
1408
- for (var key in options.components) {
1409
- validateComponentName(key);
1410
- }
1411
- }
1412
-
1413
- function validateComponentName (name) {
1414
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1415
- warn(
1416
- 'Invalid component name: "' + name + '". Component names ' +
1417
- 'should conform to valid custom element name in html5 specification.'
1418
- );
1419
- }
1420
- if (isBuiltInTag(name) || config.isReservedTag(name)) {
1421
- warn(
1422
- 'Do not use built-in or reserved HTML elements as component ' +
1423
- 'id: ' + name
1424
- );
1425
- }
1426
- }
1427
-
1428
- /**
1429
- * Ensure all props option syntax are normalized into the
1430
- * Object-based format.
1431
- */
1432
- function normalizeProps (options, vm) {
1433
- var props = options.props;
1434
- if (!props) { return }
1435
- var res = {};
1436
- var i, val, name;
1437
- if (Array.isArray(props)) {
1438
- i = props.length;
1439
- while (i--) {
1440
- val = props[i];
1441
- if (typeof val === 'string') {
1442
- name = camelize(val);
1443
- res[name] = { type: null };
1444
- } else {
1445
- warn('props must be strings when using array syntax.');
1446
- }
1447
- }
1448
- } else if (isPlainObject(props)) {
1449
- for (var key in props) {
1450
- val = props[key];
1451
- name = camelize(key);
1452
- res[name] = isPlainObject(val)
1453
- ? val
1454
- : { type: val };
1455
- }
1456
- } else {
1457
- warn(
1458
- "Invalid value for option \"props\": expected an Array or an Object, " +
1459
- "but got " + (toRawType(props)) + ".",
1460
- vm
1461
- );
1462
- }
1463
- options.props = res;
1464
- }
1465
-
1466
- /**
1467
- * Normalize all injections into Object-based format
1468
- */
1469
- function normalizeInject (options, vm) {
1470
- var inject = options.inject;
1471
- if (!inject) { return }
1472
- var normalized = options.inject = {};
1473
- if (Array.isArray(inject)) {
1474
- for (var i = 0; i < inject.length; i++) {
1475
- normalized[inject[i]] = { from: inject[i] };
1476
- }
1477
- } else if (isPlainObject(inject)) {
1478
- for (var key in inject) {
1479
- var val = inject[key];
1480
- normalized[key] = isPlainObject(val)
1481
- ? extend({ from: key }, val)
1482
- : { from: val };
1483
- }
1484
- } else {
1485
- warn(
1486
- "Invalid value for option \"inject\": expected an Array or an Object, " +
1487
- "but got " + (toRawType(inject)) + ".",
1488
- vm
1489
- );
1490
- }
1491
- }
1492
-
1493
- /**
1494
- * Normalize raw function directives into object format.
1495
- */
1496
- function normalizeDirectives (options) {
1497
- var dirs = options.directives;
1498
- if (dirs) {
1499
- for (var key in dirs) {
1500
- var def$$1 = dirs[key];
1501
- if (typeof def$$1 === 'function') {
1502
- dirs[key] = { bind: def$$1, update: def$$1 };
1503
- }
1504
- }
1505
- }
1506
- }
1507
-
1508
- function assertObjectType (name, value, vm) {
1509
- if (!isPlainObject(value)) {
1510
- warn(
1511
- "Invalid value for option \"" + name + "\": expected an Object, " +
1512
- "but got " + (toRawType(value)) + ".",
1513
- vm
1514
- );
1515
- }
1516
- }
1517
-
1518
- /**
1519
- * Merge two option objects into a new one.
1520
- * Core utility used in both instantiation and inheritance.
1521
- */
1522
- function mergeOptions (
1523
- parent,
1524
- child,
1525
- vm
1526
- ) {
1527
- {
1528
- checkComponents(child);
1529
- }
1530
-
1531
- if (typeof child === 'function') {
1532
- child = child.options;
1533
- }
1534
-
1535
- normalizeProps(child, vm);
1536
- normalizeInject(child, vm);
1537
- normalizeDirectives(child);
1538
-
1539
- // Apply extends and mixins on the child options,
1540
- // but only if it is a raw options object that isn't
1541
- // the result of another mergeOptions call.
1542
- // Only merged options has the _base property.
1543
- if (!child._base) {
1544
- if (child.extends) {
1545
- parent = mergeOptions(parent, child.extends, vm);
1546
- }
1547
- if (child.mixins) {
1548
- for (var i = 0, l = child.mixins.length; i < l; i++) {
1549
- parent = mergeOptions(parent, child.mixins[i], vm);
1550
- }
1551
- }
1552
- }
1553
-
1554
- var options = {};
1555
- var key;
1556
- for (key in parent) {
1557
- mergeField(key);
1558
- }
1559
- for (key in child) {
1560
- if (!hasOwn(parent, key)) {
1561
- mergeField(key);
1562
- }
1563
- }
1564
- function mergeField (key) {
1565
- var strat = strats[key] || defaultStrat;
1566
- options[key] = strat(parent[key], child[key], vm, key);
1567
- }
1568
- return options
1569
- }
1570
-
1571
- /**
1572
- * Resolve an asset.
1573
- * This function is used because child instances need access
1574
- * to assets defined in its ancestor chain.
1575
- */
1576
- function resolveAsset (
1577
- options,
1578
- type,
1579
- id,
1580
- warnMissing
1581
- ) {
1582
- /* istanbul ignore if */
1583
- if (typeof id !== 'string') {
1584
- return
1585
- }
1586
- var assets = options[type];
1587
- // check local registration variations first
1588
- if (hasOwn(assets, id)) { return assets[id] }
1589
- var camelizedId = camelize(id);
1590
- if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1591
- var PascalCaseId = capitalize(camelizedId);
1592
- if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1593
- // fallback to prototype chain
1594
- var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1595
- if (warnMissing && !res) {
1596
- warn(
1597
- 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1598
- options
1599
- );
1600
- }
1601
- return res
1602
- }
1603
-
1604
- /* */
1605
-
1606
-
1607
-
1608
- function validateProp (
1609
- key,
1610
- propOptions,
1611
- propsData,
1612
- vm
1613
- ) {
1614
- var prop = propOptions[key];
1615
- var absent = !hasOwn(propsData, key);
1616
- var value = propsData[key];
1617
- // boolean casting
1618
- var booleanIndex = getTypeIndex(Boolean, prop.type);
1619
- if (booleanIndex > -1) {
1620
- if (absent && !hasOwn(prop, 'default')) {
1621
- value = false;
1622
- } else if (value === '' || value === hyphenate(key)) {
1623
- // only cast empty string / same name to boolean if
1624
- // boolean has higher priority
1625
- var stringIndex = getTypeIndex(String, prop.type);
1626
- if (stringIndex < 0 || booleanIndex < stringIndex) {
1627
- value = true;
1628
- }
1629
- }
1630
- }
1631
- // check default value
1632
- if (value === undefined) {
1633
- value = getPropDefaultValue(vm, prop, key);
1634
- // since the default value is a fresh copy,
1635
- // make sure to observe it.
1636
- var prevShouldObserve = shouldObserve;
1637
- toggleObserving(true);
1638
- observe(value);
1639
- toggleObserving(prevShouldObserve);
1640
- }
1641
- {
1642
- assertProp(prop, key, value, vm, absent);
1643
- }
1644
- return value
1645
- }
1646
-
1647
- /**
1648
- * Get the default value of a prop.
1649
- */
1650
- function getPropDefaultValue (vm, prop, key) {
1651
- // no default, return undefined
1652
- if (!hasOwn(prop, 'default')) {
1653
- return undefined
1654
- }
1655
- var def = prop.default;
1656
- // warn against non-factory defaults for Object & Array
1657
- if (isObject(def)) {
1658
- warn(
1659
- 'Invalid default value for prop "' + key + '": ' +
1660
- 'Props with type Object/Array must use a factory function ' +
1661
- 'to return the default value.',
1662
- vm
1663
- );
1664
- }
1665
- // the raw prop value was also undefined from previous render,
1666
- // return previous default value to avoid unnecessary watcher trigger
1667
- if (vm && vm.$options.propsData &&
1668
- vm.$options.propsData[key] === undefined &&
1669
- vm._props[key] !== undefined
1670
- ) {
1671
- return vm._props[key]
1672
- }
1673
- // call factory function for non-Function types
1674
- // a value is Function if its prototype is function even across different execution context
1675
- return typeof def === 'function' && getType(prop.type) !== 'Function'
1676
- ? def.call(vm)
1677
- : def
1678
- }
1679
-
1680
- /**
1681
- * Assert whether a prop is valid.
1682
- */
1683
- function assertProp (
1684
- prop,
1685
- name,
1686
- value,
1687
- vm,
1688
- absent
1689
- ) {
1690
- if (prop.required && absent) {
1691
- warn(
1692
- 'Missing required prop: "' + name + '"',
1693
- vm
1694
- );
1695
- return
1696
- }
1697
- if (value == null && !prop.required) {
1698
- return
1699
- }
1700
- var type = prop.type;
1701
- var valid = !type || type === true;
1702
- var expectedTypes = [];
1703
- if (type) {
1704
- if (!Array.isArray(type)) {
1705
- type = [type];
1706
- }
1707
- for (var i = 0; i < type.length && !valid; i++) {
1708
- var assertedType = assertType(value, type[i]);
1709
- expectedTypes.push(assertedType.expectedType || '');
1710
- valid = assertedType.valid;
1711
- }
1712
- }
1713
-
1714
- if (!valid) {
1715
- warn(
1716
- getInvalidTypeMessage(name, value, expectedTypes),
1717
- vm
1718
- );
1719
- return
1720
- }
1721
- var validator = prop.validator;
1722
- if (validator) {
1723
- if (!validator(value)) {
1724
- warn(
1725
- 'Invalid prop: custom validator check failed for prop "' + name + '".',
1726
- vm
1727
- );
1728
- }
1729
- }
1730
- }
1731
-
1732
- var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1733
-
1734
- function assertType (value, type) {
1735
- var valid;
1736
- var expectedType = getType(type);
1737
- if (simpleCheckRE.test(expectedType)) {
1738
- var t = typeof value;
1739
- valid = t === expectedType.toLowerCase();
1740
- // for primitive wrapper objects
1741
- if (!valid && t === 'object') {
1742
- valid = value instanceof type;
1743
- }
1744
- } else if (expectedType === 'Object') {
1745
- valid = isPlainObject(value);
1746
- } else if (expectedType === 'Array') {
1747
- valid = Array.isArray(value);
1748
- } else {
1749
- valid = value instanceof type;
1750
- }
1751
- return {
1752
- valid: valid,
1753
- expectedType: expectedType
1754
- }
1755
- }
1756
-
1757
- /**
1758
- * Use function string name to check built-in types,
1759
- * because a simple equality check will fail when running
1760
- * across different vms / iframes.
1761
- */
1762
- function getType (fn) {
1763
- var match = fn && fn.toString().match(/^\s*function (\w+)/);
1764
- return match ? match[1] : ''
1765
- }
1766
-
1767
- function isSameType (a, b) {
1768
- return getType(a) === getType(b)
1769
- }
1770
-
1771
- function getTypeIndex (type, expectedTypes) {
1772
- if (!Array.isArray(expectedTypes)) {
1773
- return isSameType(expectedTypes, type) ? 0 : -1
1774
- }
1775
- for (var i = 0, len = expectedTypes.length; i < len; i++) {
1776
- if (isSameType(expectedTypes[i], type)) {
1777
- return i
1778
- }
1779
- }
1780
- return -1
1781
- }
1782
-
1783
- function getInvalidTypeMessage (name, value, expectedTypes) {
1784
- var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
1785
- " Expected " + (expectedTypes.map(capitalize).join(', '));
1786
- var expectedType = expectedTypes[0];
1787
- var receivedType = toRawType(value);
1788
- var expectedValue = styleValue(value, expectedType);
1789
- var receivedValue = styleValue(value, receivedType);
1790
- // check if we need to specify expected value
1791
- if (expectedTypes.length === 1 &&
1792
- isExplicable(expectedType) &&
1793
- !isBoolean(expectedType, receivedType)) {
1794
- message += " with value " + expectedValue;
1795
- }
1796
- message += ", got " + receivedType + " ";
1797
- // check if we need to specify received value
1798
- if (isExplicable(receivedType)) {
1799
- message += "with value " + receivedValue + ".";
1800
- }
1801
- return message
1802
- }
1803
-
1804
- function styleValue (value, type) {
1805
- if (type === 'String') {
1806
- return ("\"" + value + "\"")
1807
- } else if (type === 'Number') {
1808
- return ("" + (Number(value)))
1809
- } else {
1810
- return ("" + value)
1811
- }
1812
- }
1813
-
1814
- function isExplicable (value) {
1815
- var explicitTypes = ['string', 'number', 'boolean'];
1816
- return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
1817
- }
1818
-
1819
- function isBoolean () {
1820
- var args = [], len = arguments.length;
1821
- while ( len-- ) args[ len ] = arguments[ len ];
1822
-
1823
- return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
1824
- }
1825
-
1826
- /* */
1827
-
1828
- function handleError (err, vm, info) {
1829
- // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1830
- // See: https://github.com/vuejs/vuex/issues/1505
1831
- pushTarget();
1832
- try {
1833
- if (vm) {
1834
- var cur = vm;
1835
- while ((cur = cur.$parent)) {
1836
- var hooks = cur.$options.errorCaptured;
1837
- if (hooks) {
1838
- for (var i = 0; i < hooks.length; i++) {
1839
- try {
1840
- var capture = hooks[i].call(cur, err, vm, info) === false;
1841
- if (capture) { return }
1842
- } catch (e) {
1843
- globalHandleError(e, cur, 'errorCaptured hook');
1844
- }
1845
- }
1846
- }
1847
- }
1848
- }
1849
- globalHandleError(err, vm, info);
1850
- } finally {
1851
- popTarget();
1852
- }
1853
- }
1854
-
1855
- function invokeWithErrorHandling (
1856
- handler,
1857
- context,
1858
- args,
1859
- vm,
1860
- info
1861
- ) {
1862
- var res;
1863
- try {
1864
- res = args ? handler.apply(context, args) : handler.call(context);
1865
- if (res && !res._isVue && isPromise(res) && !res._handled) {
1866
- res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1867
- // issue #9511
1868
- // avoid catch triggering multiple times when nested calls
1869
- res._handled = true;
1870
- }
1871
- } catch (e) {
1872
- handleError(e, vm, info);
1873
- }
1874
- return res
1875
- }
1876
-
1877
- function globalHandleError (err, vm, info) {
1878
- if (config.errorHandler) {
1879
- try {
1880
- return config.errorHandler.call(null, err, vm, info)
1881
- } catch (e) {
1882
- // if the user intentionally throws the original error in the handler,
1883
- // do not log it twice
1884
- if (e !== err) {
1885
- logError(e, null, 'config.errorHandler');
1886
- }
1887
- }
1888
- }
1889
- logError(err, vm, info);
1890
- }
1891
-
1892
- function logError (err, vm, info) {
1893
- {
1894
- warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
1895
- }
1896
- /* istanbul ignore else */
1897
- if ((inBrowser || inWeex) && typeof console !== 'undefined') {
1898
- console.error(err);
1899
- } else {
1900
- throw err
1901
- }
1902
- }
1903
-
1904
- /* */
1905
-
1906
- var isUsingMicroTask = false;
1907
-
1908
- var callbacks = [];
1909
- var pending = false;
1910
-
1911
- function flushCallbacks () {
1912
- pending = false;
1913
- var copies = callbacks.slice(0);
1914
- callbacks.length = 0;
1915
- for (var i = 0; i < copies.length; i++) {
1916
- copies[i]();
1917
- }
1918
- }
1919
-
1920
- // Here we have async deferring wrappers using microtasks.
1921
- // In 2.5 we used (macro) tasks (in combination with microtasks).
1922
- // However, it has subtle problems when state is changed right before repaint
1923
- // (e.g. #6813, out-in transitions).
1924
- // Also, using (macro) tasks in event handler would cause some weird behaviors
1925
- // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
1926
- // So we now use microtasks everywhere, again.
1927
- // A major drawback of this tradeoff is that there are some scenarios
1928
- // where microtasks have too high a priority and fire in between supposedly
1929
- // sequential events (e.g. #4521, #6690, which have workarounds)
1930
- // or even between bubbling of the same event (#6566).
1931
- var timerFunc;
1932
-
1933
- // The nextTick behavior leverages the microtask queue, which can be accessed
1934
- // via either native Promise.then or MutationObserver.
1935
- // MutationObserver has wider support, however it is seriously bugged in
1936
- // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
1937
- // completely stops working after triggering a few times... so, if native
1938
- // Promise is available, we will use it:
1939
- /* istanbul ignore next, $flow-disable-line */
1940
- if (typeof Promise !== 'undefined' && isNative(Promise)) {
1941
- var p = Promise.resolve();
1942
- timerFunc = function () {
1943
- p.then(flushCallbacks);
1944
- // In problematic UIWebViews, Promise.then doesn't completely break, but
1945
- // it can get stuck in a weird state where callbacks are pushed into the
1946
- // microtask queue but the queue isn't being flushed, until the browser
1947
- // needs to do some other work, e.g. handle a timer. Therefore we can
1948
- // "force" the microtask queue to be flushed by adding an empty timer.
1949
- if (isIOS) { setTimeout(noop); }
1950
- };
1951
- isUsingMicroTask = true;
1952
- } else if (!isIE && typeof MutationObserver !== 'undefined' && (
1953
- isNative(MutationObserver) ||
1954
- // PhantomJS and iOS 7.x
1955
- MutationObserver.toString() === '[object MutationObserverConstructor]'
1956
- )) {
1957
- // Use MutationObserver where native Promise is not available,
1958
- // e.g. PhantomJS, iOS7, Android 4.4
1959
- // (#6466 MutationObserver is unreliable in IE11)
1960
- var counter = 1;
1961
- var observer = new MutationObserver(flushCallbacks);
1962
- var textNode = document.createTextNode(String(counter));
1963
- observer.observe(textNode, {
1964
- characterData: true
1965
- });
1966
- timerFunc = function () {
1967
- counter = (counter + 1) % 2;
1968
- textNode.data = String(counter);
1969
- };
1970
- isUsingMicroTask = true;
1971
- } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1972
- // Fallback to setImmediate.
1973
- // Techinically it leverages the (macro) task queue,
1974
- // but it is still a better choice than setTimeout.
1975
- timerFunc = function () {
1976
- setImmediate(flushCallbacks);
1977
- };
1978
- } else {
1979
- // Fallback to setTimeout.
1980
- timerFunc = function () {
1981
- setTimeout(flushCallbacks, 0);
1982
- };
1983
- }
1984
-
1985
- function nextTick (cb, ctx) {
1986
- var _resolve;
1987
- callbacks.push(function () {
1988
- if (cb) {
1989
- try {
1990
- cb.call(ctx);
1991
- } catch (e) {
1992
- handleError(e, ctx, 'nextTick');
1993
- }
1994
- } else if (_resolve) {
1995
- _resolve(ctx);
1996
- }
1997
- });
1998
- if (!pending) {
1999
- pending = true;
2000
- timerFunc();
2001
- }
2002
- // $flow-disable-line
2003
- if (!cb && typeof Promise !== 'undefined') {
2004
- return new Promise(function (resolve) {
2005
- _resolve = resolve;
2006
- })
2007
- }
2008
- }
2009
-
2010
- /* */
2011
-
2012
- var mark;
2013
- var measure;
2014
-
2015
- {
2016
- var perf = inBrowser && window.performance;
2017
- /* istanbul ignore if */
2018
- if (
2019
- perf &&
2020
- perf.mark &&
2021
- perf.measure &&
2022
- perf.clearMarks &&
2023
- perf.clearMeasures
2024
- ) {
2025
- mark = function (tag) { return perf.mark(tag); };
2026
- measure = function (name, startTag, endTag) {
2027
- perf.measure(name, startTag, endTag);
2028
- perf.clearMarks(startTag);
2029
- perf.clearMarks(endTag);
2030
- // perf.clearMeasures(name)
2031
- };
2032
- }
2033
- }
2034
-
2035
- /* not type checking this file because flow doesn't play well with Proxy */
2036
-
2037
- var initProxy;
2038
-
2039
- {
2040
- var allowedGlobals = makeMap(
2041
- 'Infinity,undefined,NaN,isFinite,isNaN,' +
2042
- 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2043
- 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2044
- 'require' // for Webpack/Browserify
2045
- );
2046
-
2047
- var warnNonPresent = function (target, key) {
2048
- warn(
2049
- "Property or method \"" + key + "\" is not defined on the instance but " +
2050
- 'referenced during render. Make sure that this property is reactive, ' +
2051
- 'either in the data option, or for class-based components, by ' +
2052
- 'initializing the property. ' +
2053
- 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2054
- target
2055
- );
2056
- };
2057
-
2058
- var warnReservedPrefix = function (target, key) {
2059
- warn(
2060
- "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2061
- 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2062
- 'prevent conflicts with Vue internals' +
2063
- 'See: https://vuejs.org/v2/api/#data',
2064
- target
2065
- );
2066
- };
2067
-
2068
- var hasProxy =
2069
- typeof Proxy !== 'undefined' && isNative(Proxy);
2070
-
2071
- if (hasProxy) {
2072
- var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2073
- config.keyCodes = new Proxy(config.keyCodes, {
2074
- set: function set (target, key, value) {
2075
- if (isBuiltInModifier(key)) {
2076
- warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2077
- return false
2078
- } else {
2079
- target[key] = value;
2080
- return true
2081
- }
2082
- }
2083
- });
2084
- }
2085
-
2086
- var hasHandler = {
2087
- has: function has (target, key) {
2088
- var has = key in target;
2089
- var isAllowed = allowedGlobals(key) ||
2090
- (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2091
- if (!has && !isAllowed) {
2092
- if (key in target.$data) { warnReservedPrefix(target, key); }
2093
- else { warnNonPresent(target, key); }
2094
- }
2095
- return has || !isAllowed
2096
- }
2097
- };
2098
-
2099
- var getHandler = {
2100
- get: function get (target, key) {
2101
- if (typeof key === 'string' && !(key in target)) {
2102
- if (key in target.$data) { warnReservedPrefix(target, key); }
2103
- else { warnNonPresent(target, key); }
2104
- }
2105
- return target[key]
2106
- }
2107
- };
2108
-
2109
- initProxy = function initProxy (vm) {
2110
- if (hasProxy) {
2111
- // determine which proxy handler to use
2112
- var options = vm.$options;
2113
- var handlers = options.render && options.render._withStripped
2114
- ? getHandler
2115
- : hasHandler;
2116
- vm._renderProxy = new Proxy(vm, handlers);
2117
- } else {
2118
- vm._renderProxy = vm;
2119
- }
2120
- };
2121
- }
2122
-
2123
- /* */
2124
-
2125
- var seenObjects = new _Set();
2126
-
2127
- /**
2128
- * Recursively traverse an object to evoke all converted
2129
- * getters, so that every nested property inside the object
2130
- * is collected as a "deep" dependency.
2131
- */
2132
- function traverse (val) {
2133
- _traverse(val, seenObjects);
2134
- seenObjects.clear();
2135
- }
2136
-
2137
- function _traverse (val, seen) {
2138
- var i, keys;
2139
- var isA = Array.isArray(val);
2140
- if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2141
- return
2142
- }
2143
- if (val.__ob__) {
2144
- var depId = val.__ob__.dep.id;
2145
- if (seen.has(depId)) {
2146
- return
2147
- }
2148
- seen.add(depId);
2149
- }
2150
- if (isA) {
2151
- i = val.length;
2152
- while (i--) { _traverse(val[i], seen); }
2153
- } else {
2154
- keys = Object.keys(val);
2155
- i = keys.length;
2156
- while (i--) { _traverse(val[keys[i]], seen); }
2157
- }
2158
- }
2159
-
2160
- /* */
2161
-
2162
- var normalizeEvent = cached(function (name) {
2163
- var passive = name.charAt(0) === '&';
2164
- name = passive ? name.slice(1) : name;
2165
- var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2166
- name = once$$1 ? name.slice(1) : name;
2167
- var capture = name.charAt(0) === '!';
2168
- name = capture ? name.slice(1) : name;
2169
- return {
2170
- name: name,
2171
- once: once$$1,
2172
- capture: capture,
2173
- passive: passive
2174
- }
2175
- });
2176
-
2177
- function createFnInvoker (fns, vm) {
2178
- function invoker () {
2179
- var arguments$1 = arguments;
2180
-
2181
- var fns = invoker.fns;
2182
- if (Array.isArray(fns)) {
2183
- var cloned = fns.slice();
2184
- for (var i = 0; i < cloned.length; i++) {
2185
- invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2186
- }
2187
- } else {
2188
- // return handler return value for single handlers
2189
- return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2190
- }
2191
- }
2192
- invoker.fns = fns;
2193
- return invoker
2194
- }
2195
-
2196
- function updateListeners (
2197
- on,
2198
- oldOn,
2199
- add,
2200
- remove$$1,
2201
- createOnceHandler,
2202
- vm
2203
- ) {
2204
- var name, def$$1, cur, old, event;
2205
- for (name in on) {
2206
- def$$1 = cur = on[name];
2207
- old = oldOn[name];
2208
- event = normalizeEvent(name);
2209
- if (isUndef(cur)) {
2210
- warn(
2211
- "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2212
- vm
2213
- );
2214
- } else if (isUndef(old)) {
2215
- if (isUndef(cur.fns)) {
2216
- cur = on[name] = createFnInvoker(cur, vm);
2217
- }
2218
- if (isTrue(event.once)) {
2219
- cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2220
- }
2221
- add(event.name, cur, event.capture, event.passive, event.params);
2222
- } else if (cur !== old) {
2223
- old.fns = cur;
2224
- on[name] = old;
2225
- }
2226
- }
2227
- for (name in oldOn) {
2228
- if (isUndef(on[name])) {
2229
- event = normalizeEvent(name);
2230
- remove$$1(event.name, oldOn[name], event.capture);
2231
- }
2232
- }
2233
- }
2234
-
2235
- /* */
2236
-
2237
- function mergeVNodeHook (def, hookKey, hook) {
2238
- if (def instanceof VNode) {
2239
- def = def.data.hook || (def.data.hook = {});
2240
- }
2241
- var invoker;
2242
- var oldHook = def[hookKey];
2243
-
2244
- function wrappedHook () {
2245
- hook.apply(this, arguments);
2246
- // important: remove merged hook to ensure it's called only once
2247
- // and prevent memory leak
2248
- remove(invoker.fns, wrappedHook);
2249
- }
2250
-
2251
- if (isUndef(oldHook)) {
2252
- // no existing hook
2253
- invoker = createFnInvoker([wrappedHook]);
2254
- } else {
2255
- /* istanbul ignore if */
2256
- if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2257
- // already a merged invoker
2258
- invoker = oldHook;
2259
- invoker.fns.push(wrappedHook);
2260
- } else {
2261
- // existing plain hook
2262
- invoker = createFnInvoker([oldHook, wrappedHook]);
2263
- }
2264
- }
2265
-
2266
- invoker.merged = true;
2267
- def[hookKey] = invoker;
2268
- }
2269
-
2270
- /* */
2271
-
2272
- function extractPropsFromVNodeData (
2273
- data,
2274
- Ctor,
2275
- tag
2276
- ) {
2277
- // we are only extracting raw values here.
2278
- // validation and default values are handled in the child
2279
- // component itself.
2280
- var propOptions = Ctor.options.props;
2281
- if (isUndef(propOptions)) {
2282
- return
2283
- }
2284
- var res = {};
2285
- var attrs = data.attrs;
2286
- var props = data.props;
2287
- if (isDef(attrs) || isDef(props)) {
2288
- for (var key in propOptions) {
2289
- var altKey = hyphenate(key);
2290
- {
2291
- var keyInLowerCase = key.toLowerCase();
2292
- if (
2293
- key !== keyInLowerCase &&
2294
- attrs && hasOwn(attrs, keyInLowerCase)
2295
- ) {
2296
- tip(
2297
- "Prop \"" + keyInLowerCase + "\" is passed to component " +
2298
- (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2299
- " \"" + key + "\". " +
2300
- "Note that HTML attributes are case-insensitive and camelCased " +
2301
- "props need to use their kebab-case equivalents when using in-DOM " +
2302
- "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2303
- );
2304
- }
2305
- }
2306
- checkProp(res, props, key, altKey, true) ||
2307
- checkProp(res, attrs, key, altKey, false);
2308
- }
2309
- }
2310
- return res
2311
- }
2312
-
2313
- function checkProp (
2314
- res,
2315
- hash,
2316
- key,
2317
- altKey,
2318
- preserve
2319
- ) {
2320
- if (isDef(hash)) {
2321
- if (hasOwn(hash, key)) {
2322
- res[key] = hash[key];
2323
- if (!preserve) {
2324
- delete hash[key];
2325
- }
2326
- return true
2327
- } else if (hasOwn(hash, altKey)) {
2328
- res[key] = hash[altKey];
2329
- if (!preserve) {
2330
- delete hash[altKey];
2331
- }
2332
- return true
2333
- }
2334
- }
2335
- return false
2336
- }
2337
-
2338
- /* */
2339
-
2340
- // The template compiler attempts to minimize the need for normalization by
2341
- // statically analyzing the template at compile time.
2342
- //
2343
- // For plain HTML markup, normalization can be completely skipped because the
2344
- // generated render function is guaranteed to return Array<VNode>. There are
2345
- // two cases where extra normalization is needed:
2346
-
2347
- // 1. When the children contains components - because a functional component
2348
- // may return an Array instead of a single root. In this case, just a simple
2349
- // normalization is needed - if any child is an Array, we flatten the whole
2350
- // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2351
- // because functional components already normalize their own children.
2352
- function simpleNormalizeChildren (children) {
2353
- for (var i = 0; i < children.length; i++) {
2354
- if (Array.isArray(children[i])) {
2355
- return Array.prototype.concat.apply([], children)
2356
- }
2357
- }
2358
- return children
2359
- }
2360
-
2361
- // 2. When the children contains constructs that always generated nested Arrays,
2362
- // e.g. <template>, <slot>, v-for, or when the children is provided by user
2363
- // with hand-written render functions / JSX. In such cases a full normalization
2364
- // is needed to cater to all possible types of children values.
2365
- function normalizeChildren (children) {
2366
- return isPrimitive(children)
2367
- ? [createTextVNode(children)]
2368
- : Array.isArray(children)
2369
- ? normalizeArrayChildren(children)
2370
- : undefined
2371
- }
2372
-
2373
- function isTextNode (node) {
2374
- return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2375
- }
2376
-
2377
- function normalizeArrayChildren (children, nestedIndex) {
2378
- var res = [];
2379
- var i, c, lastIndex, last;
2380
- for (i = 0; i < children.length; i++) {
2381
- c = children[i];
2382
- if (isUndef(c) || typeof c === 'boolean') { continue }
2383
- lastIndex = res.length - 1;
2384
- last = res[lastIndex];
2385
- // nested
2386
- if (Array.isArray(c)) {
2387
- if (c.length > 0) {
2388
- c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2389
- // merge adjacent text nodes
2390
- if (isTextNode(c[0]) && isTextNode(last)) {
2391
- res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2392
- c.shift();
2393
- }
2394
- res.push.apply(res, c);
2395
- }
2396
- } else if (isPrimitive(c)) {
2397
- if (isTextNode(last)) {
2398
- // merge adjacent text nodes
2399
- // this is necessary for SSR hydration because text nodes are
2400
- // essentially merged when rendered to HTML strings
2401
- res[lastIndex] = createTextVNode(last.text + c);
2402
- } else if (c !== '') {
2403
- // convert primitive to vnode
2404
- res.push(createTextVNode(c));
2405
- }
2406
- } else {
2407
- if (isTextNode(c) && isTextNode(last)) {
2408
- // merge adjacent text nodes
2409
- res[lastIndex] = createTextVNode(last.text + c.text);
2410
- } else {
2411
- // default key for nested array children (likely generated by v-for)
2412
- if (isTrue(children._isVList) &&
2413
- isDef(c.tag) &&
2414
- isUndef(c.key) &&
2415
- isDef(nestedIndex)) {
2416
- c.key = "__vlist" + nestedIndex + "_" + i + "__";
2417
- }
2418
- res.push(c);
2419
- }
2420
- }
2421
- }
2422
- return res
2423
- }
2424
-
2425
- /* */
2426
-
2427
- function initProvide (vm) {
2428
- var provide = vm.$options.provide;
2429
- if (provide) {
2430
- vm._provided = typeof provide === 'function'
2431
- ? provide.call(vm)
2432
- : provide;
2433
- }
2434
- }
2435
-
2436
- function initInjections (vm) {
2437
- var result = resolveInject(vm.$options.inject, vm);
2438
- if (result) {
2439
- toggleObserving(false);
2440
- Object.keys(result).forEach(function (key) {
2441
- /* istanbul ignore else */
2442
- {
2443
- defineReactive$$1(vm, key, result[key], function () {
2444
- warn(
2445
- "Avoid mutating an injected value directly since the changes will be " +
2446
- "overwritten whenever the provided component re-renders. " +
2447
- "injection being mutated: \"" + key + "\"",
2448
- vm
2449
- );
2450
- });
2451
- }
2452
- });
2453
- toggleObserving(true);
2454
- }
2455
- }
2456
-
2457
- function resolveInject (inject, vm) {
2458
- if (inject) {
2459
- // inject is :any because flow is not smart enough to figure out cached
2460
- var result = Object.create(null);
2461
- var keys = hasSymbol
2462
- ? Reflect.ownKeys(inject)
2463
- : Object.keys(inject);
2464
-
2465
- for (var i = 0; i < keys.length; i++) {
2466
- var key = keys[i];
2467
- // #6574 in case the inject object is observed...
2468
- if (key === '__ob__') { continue }
2469
- var provideKey = inject[key].from;
2470
- var source = vm;
2471
- while (source) {
2472
- if (source._provided && hasOwn(source._provided, provideKey)) {
2473
- result[key] = source._provided[provideKey];
2474
- break
2475
- }
2476
- source = source.$parent;
2477
- }
2478
- if (!source) {
2479
- if ('default' in inject[key]) {
2480
- var provideDefault = inject[key].default;
2481
- result[key] = typeof provideDefault === 'function'
2482
- ? provideDefault.call(vm)
2483
- : provideDefault;
2484
- } else {
2485
- warn(("Injection \"" + key + "\" not found"), vm);
2486
- }
2487
- }
2488
- }
2489
- return result
2490
- }
2491
- }
2492
-
2493
- /* */
2494
-
2495
-
2496
-
2497
- /**
2498
- * Runtime helper for resolving raw children VNodes into a slot object.
2499
- */
2500
- function resolveSlots (
2501
- children,
2502
- context
2503
- ) {
2504
- if (!children || !children.length) {
2505
- return {}
2506
- }
2507
- var slots = {};
2508
- for (var i = 0, l = children.length; i < l; i++) {
2509
- var child = children[i];
2510
- var data = child.data;
2511
- // remove slot attribute if the node is resolved as a Vue slot node
2512
- if (data && data.attrs && data.attrs.slot) {
2513
- delete data.attrs.slot;
2514
- }
2515
- // named slots should only be respected if the vnode was rendered in the
2516
- // same context.
2517
- if ((child.context === context || child.fnContext === context) &&
2518
- data && data.slot != null
2519
- ) {
2520
- var name = data.slot;
2521
- var slot = (slots[name] || (slots[name] = []));
2522
- if (child.tag === 'template') {
2523
- slot.push.apply(slot, child.children || []);
2524
- } else {
2525
- slot.push(child);
2526
- }
2527
- } else {
2528
- (slots.default || (slots.default = [])).push(child);
2529
- }
2530
- }
2531
- // ignore slots that contains only whitespace
2532
- for (var name$1 in slots) {
2533
- if (slots[name$1].every(isWhitespace)) {
2534
- delete slots[name$1];
2535
- }
2536
- }
2537
- return slots
2538
- }
2539
-
2540
- function isWhitespace (node) {
2541
- return (node.isComment && !node.asyncFactory) || node.text === ' '
2542
- }
2543
-
2544
- /* */
2545
-
2546
- function normalizeScopedSlots (
2547
- slots,
2548
- normalSlots,
2549
- prevSlots
2550
- ) {
2551
- var res;
2552
- var hasNormalSlots = Object.keys(normalSlots).length > 0;
2553
- var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2554
- var key = slots && slots.$key;
2555
- if (!slots) {
2556
- res = {};
2557
- } else if (slots._normalized) {
2558
- // fast path 1: child component re-render only, parent did not change
2559
- return slots._normalized
2560
- } else if (
2561
- isStable &&
2562
- prevSlots &&
2563
- prevSlots !== emptyObject &&
2564
- key === prevSlots.$key &&
2565
- !hasNormalSlots &&
2566
- !prevSlots.$hasNormal
2567
- ) {
2568
- // fast path 2: stable scoped slots w/ no normal slots to proxy,
2569
- // only need to normalize once
2570
- return prevSlots
2571
- } else {
2572
- res = {};
2573
- for (var key$1 in slots) {
2574
- if (slots[key$1] && key$1[0] !== '$') {
2575
- res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2576
- }
2577
- }
2578
- }
2579
- // expose normal slots on scopedSlots
2580
- for (var key$2 in normalSlots) {
2581
- if (!(key$2 in res)) {
2582
- res[key$2] = proxyNormalSlot(normalSlots, key$2);
2583
- }
2584
- }
2585
- // avoriaz seems to mock a non-extensible $scopedSlots object
2586
- // and when that is passed down this would cause an error
2587
- if (slots && Object.isExtensible(slots)) {
2588
- (slots)._normalized = res;
2589
- }
2590
- def(res, '$stable', isStable);
2591
- def(res, '$key', key);
2592
- def(res, '$hasNormal', hasNormalSlots);
2593
- return res
2594
- }
2595
-
2596
- function normalizeScopedSlot(normalSlots, key, fn) {
2597
- var normalized = function () {
2598
- var res = arguments.length ? fn.apply(null, arguments) : fn({});
2599
- res = res && typeof res === 'object' && !Array.isArray(res)
2600
- ? [res] // single vnode
2601
- : normalizeChildren(res);
2602
- return res && (
2603
- res.length === 0 ||
2604
- (res.length === 1 && res[0].isComment) // #9658
2605
- ) ? undefined
2606
- : res
2607
- };
2608
- // this is a slot using the new v-slot syntax without scope. although it is
2609
- // compiled as a scoped slot, render fn users would expect it to be present
2610
- // on this.$slots because the usage is semantically a normal slot.
2611
- if (fn.proxy) {
2612
- Object.defineProperty(normalSlots, key, {
2613
- get: normalized,
2614
- enumerable: true,
2615
- configurable: true
2616
- });
2617
- }
2618
- return normalized
2619
- }
2620
-
2621
- function proxyNormalSlot(slots, key) {
2622
- return function () { return slots[key]; }
2623
- }
2624
-
2625
- /* */
2626
-
2627
- /**
2628
- * Runtime helper for rendering v-for lists.
2629
- */
2630
- function renderList (
2631
- val,
2632
- render
2633
- ) {
2634
- var ret, i, l, keys, key;
2635
- if (Array.isArray(val) || typeof val === 'string') {
2636
- ret = new Array(val.length);
2637
- for (i = 0, l = val.length; i < l; i++) {
2638
- ret[i] = render(val[i], i);
2639
- }
2640
- } else if (typeof val === 'number') {
2641
- ret = new Array(val);
2642
- for (i = 0; i < val; i++) {
2643
- ret[i] = render(i + 1, i);
2644
- }
2645
- } else if (isObject(val)) {
2646
- if (hasSymbol && val[Symbol.iterator]) {
2647
- ret = [];
2648
- var iterator = val[Symbol.iterator]();
2649
- var result = iterator.next();
2650
- while (!result.done) {
2651
- ret.push(render(result.value, ret.length));
2652
- result = iterator.next();
2653
- }
2654
- } else {
2655
- keys = Object.keys(val);
2656
- ret = new Array(keys.length);
2657
- for (i = 0, l = keys.length; i < l; i++) {
2658
- key = keys[i];
2659
- ret[i] = render(val[key], key, i);
2660
- }
2661
- }
2662
- }
2663
- if (!isDef(ret)) {
2664
- ret = [];
2665
- }
2666
- (ret)._isVList = true;
2667
- return ret
2668
- }
2669
-
2670
- /* */
2671
-
2672
- /**
2673
- * Runtime helper for rendering <slot>
2674
- */
2675
- function renderSlot (
2676
- name,
2677
- fallback,
2678
- props,
2679
- bindObject
2680
- ) {
2681
- var scopedSlotFn = this.$scopedSlots[name];
2682
- var nodes;
2683
- if (scopedSlotFn) { // scoped slot
2684
- props = props || {};
2685
- if (bindObject) {
2686
- if (!isObject(bindObject)) {
2687
- warn(
2688
- 'slot v-bind without argument expects an Object',
2689
- this
2690
- );
2691
- }
2692
- props = extend(extend({}, bindObject), props);
2693
- }
2694
- nodes = scopedSlotFn(props) || fallback;
2695
- } else {
2696
- nodes = this.$slots[name] || fallback;
2697
- }
2698
-
2699
- var target = props && props.slot;
2700
- if (target) {
2701
- return this.$createElement('template', { slot: target }, nodes)
2702
- } else {
2703
- return nodes
2704
- }
2705
- }
2706
-
2707
- /* */
2708
-
2709
- /**
2710
- * Runtime helper for resolving filters
2711
- */
2712
- function resolveFilter (id) {
2713
- return resolveAsset(this.$options, 'filters', id, true) || identity
2714
- }
2715
-
2716
- /* */
2717
-
2718
- function isKeyNotMatch (expect, actual) {
2719
- if (Array.isArray(expect)) {
2720
- return expect.indexOf(actual) === -1
2721
- } else {
2722
- return expect !== actual
2723
- }
2724
- }
2725
-
2726
- /**
2727
- * Runtime helper for checking keyCodes from config.
2728
- * exposed as Vue.prototype._k
2729
- * passing in eventKeyName as last argument separately for backwards compat
2730
- */
2731
- function checkKeyCodes (
2732
- eventKeyCode,
2733
- key,
2734
- builtInKeyCode,
2735
- eventKeyName,
2736
- builtInKeyName
2737
- ) {
2738
- var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2739
- if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2740
- return isKeyNotMatch(builtInKeyName, eventKeyName)
2741
- } else if (mappedKeyCode) {
2742
- return isKeyNotMatch(mappedKeyCode, eventKeyCode)
2743
- } else if (eventKeyName) {
2744
- return hyphenate(eventKeyName) !== key
2745
- }
2746
- }
2747
-
2748
- /* */
2749
-
2750
- /**
2751
- * Runtime helper for merging v-bind="object" into a VNode's data.
2752
- */
2753
- function bindObjectProps (
2754
- data,
2755
- tag,
2756
- value,
2757
- asProp,
2758
- isSync
2759
- ) {
2760
- if (value) {
2761
- if (!isObject(value)) {
2762
- warn(
2763
- 'v-bind without argument expects an Object or Array value',
2764
- this
2765
- );
2766
- } else {
2767
- if (Array.isArray(value)) {
2768
- value = toObject(value);
2769
- }
2770
- var hash;
2771
- var loop = function ( key ) {
2772
- if (
2773
- key === 'class' ||
2774
- key === 'style' ||
2775
- isReservedAttribute(key)
2776
- ) {
2777
- hash = data;
2778
- } else {
2779
- var type = data.attrs && data.attrs.type;
2780
- hash = asProp || config.mustUseProp(tag, type, key)
2781
- ? data.domProps || (data.domProps = {})
2782
- : data.attrs || (data.attrs = {});
2783
- }
2784
- var camelizedKey = camelize(key);
2785
- var hyphenatedKey = hyphenate(key);
2786
- if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2787
- hash[key] = value[key];
2788
-
2789
- if (isSync) {
2790
- var on = data.on || (data.on = {});
2791
- on[("update:" + key)] = function ($event) {
2792
- value[key] = $event;
2793
- };
2794
- }
2795
- }
2796
- };
2797
-
2798
- for (var key in value) loop( key );
2799
- }
2800
- }
2801
- return data
2802
- }
2803
-
2804
- /* */
2805
-
2806
- /**
2807
- * Runtime helper for rendering static trees.
2808
- */
2809
- function renderStatic (
2810
- index,
2811
- isInFor
2812
- ) {
2813
- var cached = this._staticTrees || (this._staticTrees = []);
2814
- var tree = cached[index];
2815
- // if has already-rendered static tree and not inside v-for,
2816
- // we can reuse the same tree.
2817
- if (tree && !isInFor) {
2818
- return tree
2819
- }
2820
- // otherwise, render a fresh tree.
2821
- tree = cached[index] = this.$options.staticRenderFns[index].call(
2822
- this._renderProxy,
2823
- null,
2824
- this // for render fns generated for functional component templates
2825
- );
2826
- markStatic(tree, ("__static__" + index), false);
2827
- return tree
2828
- }
2829
-
2830
- /**
2831
- * Runtime helper for v-once.
2832
- * Effectively it means marking the node as static with a unique key.
2833
- */
2834
- function markOnce (
2835
- tree,
2836
- index,
2837
- key
2838
- ) {
2839
- markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
2840
- return tree
2841
- }
2842
-
2843
- function markStatic (
2844
- tree,
2845
- key,
2846
- isOnce
2847
- ) {
2848
- if (Array.isArray(tree)) {
2849
- for (var i = 0; i < tree.length; i++) {
2850
- if (tree[i] && typeof tree[i] !== 'string') {
2851
- markStaticNode(tree[i], (key + "_" + i), isOnce);
2852
- }
2853
- }
2854
- } else {
2855
- markStaticNode(tree, key, isOnce);
2856
- }
2857
- }
2858
-
2859
- function markStaticNode (node, key, isOnce) {
2860
- node.isStatic = true;
2861
- node.key = key;
2862
- node.isOnce = isOnce;
2863
- }
2864
-
2865
- /* */
2866
-
2867
- function bindObjectListeners (data, value) {
2868
- if (value) {
2869
- if (!isPlainObject(value)) {
2870
- warn(
2871
- 'v-on without argument expects an Object value',
2872
- this
2873
- );
2874
- } else {
2875
- var on = data.on = data.on ? extend({}, data.on) : {};
2876
- for (var key in value) {
2877
- var existing = on[key];
2878
- var ours = value[key];
2879
- on[key] = existing ? [].concat(existing, ours) : ours;
2880
- }
2881
- }
2882
- }
2883
- return data
2884
- }
2885
-
2886
- /* */
2887
-
2888
- function resolveScopedSlots (
2889
- fns, // see flow/vnode
2890
- res,
2891
- // the following are added in 2.6
2892
- hasDynamicKeys,
2893
- contentHashKey
2894
- ) {
2895
- res = res || { $stable: !hasDynamicKeys };
2896
- for (var i = 0; i < fns.length; i++) {
2897
- var slot = fns[i];
2898
- if (Array.isArray(slot)) {
2899
- resolveScopedSlots(slot, res, hasDynamicKeys);
2900
- } else if (slot) {
2901
- // marker for reverse proxying v-slot without scope on this.$slots
2902
- if (slot.proxy) {
2903
- slot.fn.proxy = true;
2904
- }
2905
- res[slot.key] = slot.fn;
2906
- }
2907
- }
2908
- if (contentHashKey) {
2909
- (res).$key = contentHashKey;
2910
- }
2911
- return res
2912
- }
2913
-
2914
- /* */
2915
-
2916
- function bindDynamicKeys (baseObj, values) {
2917
- for (var i = 0; i < values.length; i += 2) {
2918
- var key = values[i];
2919
- if (typeof key === 'string' && key) {
2920
- baseObj[values[i]] = values[i + 1];
2921
- } else if (key !== '' && key !== null) {
2922
- // null is a speical value for explicitly removing a binding
2923
- warn(
2924
- ("Invalid value for dynamic directive argument (expected string or null): " + key),
2925
- this
2926
- );
2927
- }
2928
- }
2929
- return baseObj
2930
- }
2931
-
2932
- // helper to dynamically append modifier runtime markers to event names.
2933
- // ensure only append when value is already string, otherwise it will be cast
2934
- // to string and cause the type check to miss.
2935
- function prependModifier (value, symbol) {
2936
- return typeof value === 'string' ? symbol + value : value
2937
- }
2938
-
2939
- /* */
2940
-
2941
- function installRenderHelpers (target) {
2942
- target._o = markOnce;
2943
- target._n = toNumber;
2944
- target._s = toString;
2945
- target._l = renderList;
2946
- target._t = renderSlot;
2947
- target._q = looseEqual;
2948
- target._i = looseIndexOf;
2949
- target._m = renderStatic;
2950
- target._f = resolveFilter;
2951
- target._k = checkKeyCodes;
2952
- target._b = bindObjectProps;
2953
- target._v = createTextVNode;
2954
- target._e = createEmptyVNode;
2955
- target._u = resolveScopedSlots;
2956
- target._g = bindObjectListeners;
2957
- target._d = bindDynamicKeys;
2958
- target._p = prependModifier;
2959
- }
2960
-
2961
- /* */
2962
-
2963
- function FunctionalRenderContext (
2964
- data,
2965
- props,
2966
- children,
2967
- parent,
2968
- Ctor
2969
- ) {
2970
- var this$1 = this;
2971
-
2972
- var options = Ctor.options;
2973
- // ensure the createElement function in functional components
2974
- // gets a unique context - this is necessary for correct named slot check
2975
- var contextVm;
2976
- if (hasOwn(parent, '_uid')) {
2977
- contextVm = Object.create(parent);
2978
- // $flow-disable-line
2979
- contextVm._original = parent;
2980
- } else {
2981
- // the context vm passed in is a functional context as well.
2982
- // in this case we want to make sure we are able to get a hold to the
2983
- // real context instance.
2984
- contextVm = parent;
2985
- // $flow-disable-line
2986
- parent = parent._original;
2987
- }
2988
- var isCompiled = isTrue(options._compiled);
2989
- var needNormalization = !isCompiled;
2990
-
2991
- this.data = data;
2992
- this.props = props;
2993
- this.children = children;
2994
- this.parent = parent;
2995
- this.listeners = data.on || emptyObject;
2996
- this.injections = resolveInject(options.inject, parent);
2997
- this.slots = function () {
2998
- if (!this$1.$slots) {
2999
- normalizeScopedSlots(
3000
- data.scopedSlots,
3001
- this$1.$slots = resolveSlots(children, parent)
3002
- );
3003
- }
3004
- return this$1.$slots
3005
- };
3006
-
3007
- Object.defineProperty(this, 'scopedSlots', ({
3008
- enumerable: true,
3009
- get: function get () {
3010
- return normalizeScopedSlots(data.scopedSlots, this.slots())
3011
- }
3012
- }));
3013
-
3014
- // support for compiled functional template
3015
- if (isCompiled) {
3016
- // exposing $options for renderStatic()
3017
- this.$options = options;
3018
- // pre-resolve slots for renderSlot()
3019
- this.$slots = this.slots();
3020
- this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
3021
- }
3022
-
3023
- if (options._scopeId) {
3024
- this._c = function (a, b, c, d) {
3025
- var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3026
- if (vnode && !Array.isArray(vnode)) {
3027
- vnode.fnScopeId = options._scopeId;
3028
- vnode.fnContext = parent;
3029
- }
3030
- return vnode
3031
- };
3032
- } else {
3033
- this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
3034
- }
3035
- }
3036
-
3037
- installRenderHelpers(FunctionalRenderContext.prototype);
3038
-
3039
- function createFunctionalComponent (
3040
- Ctor,
3041
- propsData,
3042
- data,
3043
- contextVm,
3044
- children
3045
- ) {
3046
- var options = Ctor.options;
3047
- var props = {};
3048
- var propOptions = options.props;
3049
- if (isDef(propOptions)) {
3050
- for (var key in propOptions) {
3051
- props[key] = validateProp(key, propOptions, propsData || emptyObject);
3052
- }
3053
- } else {
3054
- if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
3055
- if (isDef(data.props)) { mergeProps(props, data.props); }
3056
- }
3057
-
3058
- var renderContext = new FunctionalRenderContext(
3059
- data,
3060
- props,
3061
- children,
3062
- contextVm,
3063
- Ctor
3064
- );
3065
-
3066
- var vnode = options.render.call(null, renderContext._c, renderContext);
3067
-
3068
- if (vnode instanceof VNode) {
3069
- return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
3070
- } else if (Array.isArray(vnode)) {
3071
- var vnodes = normalizeChildren(vnode) || [];
3072
- var res = new Array(vnodes.length);
3073
- for (var i = 0; i < vnodes.length; i++) {
3074
- res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3075
- }
3076
- return res
3077
- }
3078
- }
3079
-
3080
- function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
3081
- // #7817 clone node before setting fnContext, otherwise if the node is reused
3082
- // (e.g. it was from a cached normal slot) the fnContext causes named slots
3083
- // that should not be matched to match.
3084
- var clone = cloneVNode(vnode);
3085
- clone.fnContext = contextVm;
3086
- clone.fnOptions = options;
3087
- {
3088
- (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
3089
- }
3090
- if (data.slot) {
3091
- (clone.data || (clone.data = {})).slot = data.slot;
3092
- }
3093
- return clone
3094
- }
3095
-
3096
- function mergeProps (to, from) {
3097
- for (var key in from) {
3098
- to[camelize(key)] = from[key];
3099
- }
3100
- }
3101
-
3102
- /* */
3103
-
3104
- /* */
3105
-
3106
- /* */
3107
-
3108
- /* */
3109
-
3110
- // inline hooks to be invoked on component VNodes during patch
3111
- var componentVNodeHooks = {
3112
- init: function init (vnode, hydrating) {
3113
- if (
3114
- vnode.componentInstance &&
3115
- !vnode.componentInstance._isDestroyed &&
3116
- vnode.data.keepAlive
3117
- ) {
3118
- // kept-alive components, treat as a patch
3119
- var mountedNode = vnode; // work around flow
3120
- componentVNodeHooks.prepatch(mountedNode, mountedNode);
3121
- } else {
3122
- var child = vnode.componentInstance = createComponentInstanceForVnode(
3123
- vnode,
3124
- activeInstance
3125
- );
3126
- child.$mount(hydrating ? vnode.elm : undefined, hydrating);
3127
- }
3128
- },
3129
-
3130
- prepatch: function prepatch (oldVnode, vnode) {
3131
- var options = vnode.componentOptions;
3132
- var child = vnode.componentInstance = oldVnode.componentInstance;
3133
- updateChildComponent(
3134
- child,
3135
- options.propsData, // updated props
3136
- options.listeners, // updated listeners
3137
- vnode, // new parent vnode
3138
- options.children // new children
3139
- );
3140
- },
3141
-
3142
- insert: function insert (vnode) {
3143
- var context = vnode.context;
3144
- var componentInstance = vnode.componentInstance;
3145
- if (!componentInstance._isMounted) {
3146
- componentInstance._isMounted = true;
3147
- callHook(componentInstance, 'mounted');
3148
- }
3149
- if (vnode.data.keepAlive) {
3150
- if (context._isMounted) {
3151
- // vue-router#1212
3152
- // During updates, a kept-alive component's child components may
3153
- // change, so directly walking the tree here may call activated hooks
3154
- // on incorrect children. Instead we push them into a queue which will
3155
- // be processed after the whole patch process ended.
3156
- queueActivatedComponent(componentInstance);
3157
- } else {
3158
- activateChildComponent(componentInstance, true /* direct */);
3159
- }
3160
- }
3161
- },
3162
-
3163
- destroy: function destroy (vnode) {
3164
- var componentInstance = vnode.componentInstance;
3165
- if (!componentInstance._isDestroyed) {
3166
- if (!vnode.data.keepAlive) {
3167
- componentInstance.$destroy();
3168
- } else {
3169
- deactivateChildComponent(componentInstance, true /* direct */);
3170
- }
3171
- }
3172
- }
3173
- };
3174
-
3175
- var hooksToMerge = Object.keys(componentVNodeHooks);
3176
-
3177
- function createComponent (
3178
- Ctor,
3179
- data,
3180
- context,
3181
- children,
3182
- tag
3183
- ) {
3184
- if (isUndef(Ctor)) {
3185
- return
3186
- }
3187
-
3188
- var baseCtor = context.$options._base;
3189
-
3190
- // plain options object: turn it into a constructor
3191
- if (isObject(Ctor)) {
3192
- Ctor = baseCtor.extend(Ctor);
3193
- }
3194
-
3195
- // if at this stage it's not a constructor or an async component factory,
3196
- // reject.
3197
- if (typeof Ctor !== 'function') {
3198
- {
3199
- warn(("Invalid Component definition: " + (String(Ctor))), context);
3200
- }
3201
- return
3202
- }
3203
-
3204
- // async component
3205
- var asyncFactory;
3206
- if (isUndef(Ctor.cid)) {
3207
- asyncFactory = Ctor;
3208
- Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3209
- if (Ctor === undefined) {
3210
- // return a placeholder node for async component, which is rendered
3211
- // as a comment node but preserves all the raw information for the node.
3212
- // the information will be used for async server-rendering and hydration.
3213
- return createAsyncPlaceholder(
3214
- asyncFactory,
3215
- data,
3216
- context,
3217
- children,
3218
- tag
3219
- )
3220
- }
3221
- }
3222
-
3223
- data = data || {};
3224
-
3225
- // resolve constructor options in case global mixins are applied after
3226
- // component constructor creation
3227
- resolveConstructorOptions(Ctor);
3228
-
3229
- // transform component v-model data into props & events
3230
- if (isDef(data.model)) {
3231
- transformModel(Ctor.options, data);
3232
- }
3233
-
3234
- // extract props
3235
- var propsData = extractPropsFromVNodeData(data, Ctor, tag);
3236
-
3237
- // functional component
3238
- if (isTrue(Ctor.options.functional)) {
3239
- return createFunctionalComponent(Ctor, propsData, data, context, children)
3240
- }
3241
-
3242
- // extract listeners, since these needs to be treated as
3243
- // child component listeners instead of DOM listeners
3244
- var listeners = data.on;
3245
- // replace with listeners with .native modifier
3246
- // so it gets processed during parent component patch.
3247
- data.on = data.nativeOn;
3248
-
3249
- if (isTrue(Ctor.options.abstract)) {
3250
- // abstract components do not keep anything
3251
- // other than props & listeners & slot
3252
-
3253
- // work around flow
3254
- var slot = data.slot;
3255
- data = {};
3256
- if (slot) {
3257
- data.slot = slot;
3258
- }
3259
- }
3260
-
3261
- // install component management hooks onto the placeholder node
3262
- installComponentHooks(data);
3263
-
3264
- // return a placeholder vnode
3265
- var name = Ctor.options.name || tag;
3266
- var vnode = new VNode(
3267
- ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
3268
- data, undefined, undefined, undefined, context,
3269
- { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
3270
- asyncFactory
3271
- );
3272
-
3273
- return vnode
3274
- }
3275
-
3276
- function createComponentInstanceForVnode (
3277
- vnode, // we know it's MountedComponentVNode but flow doesn't
3278
- parent // activeInstance in lifecycle state
3279
- ) {
3280
- var options = {
3281
- _isComponent: true,
3282
- _parentVnode: vnode,
3283
- parent: parent
3284
- };
3285
- // check inline-template render functions
3286
- var inlineTemplate = vnode.data.inlineTemplate;
3287
- if (isDef(inlineTemplate)) {
3288
- options.render = inlineTemplate.render;
3289
- options.staticRenderFns = inlineTemplate.staticRenderFns;
3290
- }
3291
- return new vnode.componentOptions.Ctor(options)
3292
- }
3293
-
3294
- function installComponentHooks (data) {
3295
- var hooks = data.hook || (data.hook = {});
3296
- for (var i = 0; i < hooksToMerge.length; i++) {
3297
- var key = hooksToMerge[i];
3298
- var existing = hooks[key];
3299
- var toMerge = componentVNodeHooks[key];
3300
- if (existing !== toMerge && !(existing && existing._merged)) {
3301
- hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
3302
- }
3303
- }
3304
- }
3305
-
3306
- function mergeHook$1 (f1, f2) {
3307
- var merged = function (a, b) {
3308
- // flow complains about extra args which is why we use any
3309
- f1(a, b);
3310
- f2(a, b);
3311
- };
3312
- merged._merged = true;
3313
- return merged
3314
- }
3315
-
3316
- // transform component v-model info (value and callback) into
3317
- // prop and event handler respectively.
3318
- function transformModel (options, data) {
3319
- var prop = (options.model && options.model.prop) || 'value';
3320
- var event = (options.model && options.model.event) || 'input'
3321
- ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
3322
- var on = data.on || (data.on = {});
3323
- var existing = on[event];
3324
- var callback = data.model.callback;
3325
- if (isDef(existing)) {
3326
- if (
3327
- Array.isArray(existing)
3328
- ? existing.indexOf(callback) === -1
3329
- : existing !== callback
3330
- ) {
3331
- on[event] = [callback].concat(existing);
3332
- }
3333
- } else {
3334
- on[event] = callback;
3335
- }
3336
- }
3337
-
3338
- /* */
3339
-
3340
- var SIMPLE_NORMALIZE = 1;
3341
- var ALWAYS_NORMALIZE = 2;
3342
-
3343
- // wrapper function for providing a more flexible interface
3344
- // without getting yelled at by flow
3345
- function createElement (
3346
- context,
3347
- tag,
3348
- data,
3349
- children,
3350
- normalizationType,
3351
- alwaysNormalize
3352
- ) {
3353
- if (Array.isArray(data) || isPrimitive(data)) {
3354
- normalizationType = children;
3355
- children = data;
3356
- data = undefined;
3357
- }
3358
- if (isTrue(alwaysNormalize)) {
3359
- normalizationType = ALWAYS_NORMALIZE;
3360
- }
3361
- return _createElement(context, tag, data, children, normalizationType)
3362
- }
3363
-
3364
- function _createElement (
3365
- context,
3366
- tag,
3367
- data,
3368
- children,
3369
- normalizationType
3370
- ) {
3371
- if (isDef(data) && isDef((data).__ob__)) {
3372
- warn(
3373
- "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
3374
- 'Always create fresh vnode data objects in each render!',
3375
- context
3376
- );
3377
- return createEmptyVNode()
3378
- }
3379
- // object syntax in v-bind
3380
- if (isDef(data) && isDef(data.is)) {
3381
- tag = data.is;
3382
- }
3383
- if (!tag) {
3384
- // in case of component :is set to falsy value
3385
- return createEmptyVNode()
3386
- }
3387
- // warn against non-primitive key
3388
- if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
3389
- ) {
3390
- {
3391
- warn(
3392
- 'Avoid using non-primitive value as key, ' +
3393
- 'use string/number value instead.',
3394
- context
3395
- );
3396
- }
3397
- }
3398
- // support single function children as default scoped slot
3399
- if (Array.isArray(children) &&
3400
- typeof children[0] === 'function'
3401
- ) {
3402
- data = data || {};
3403
- data.scopedSlots = { default: children[0] };
3404
- children.length = 0;
3405
- }
3406
- if (normalizationType === ALWAYS_NORMALIZE) {
3407
- children = normalizeChildren(children);
3408
- } else if (normalizationType === SIMPLE_NORMALIZE) {
3409
- children = simpleNormalizeChildren(children);
3410
- }
3411
- var vnode, ns;
3412
- if (typeof tag === 'string') {
3413
- var Ctor;
3414
- ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3415
- if (config.isReservedTag(tag)) {
3416
- // platform built-in elements
3417
- vnode = new VNode(
3418
- config.parsePlatformTagName(tag), data, children,
3419
- undefined, undefined, context
3420
- );
3421
- } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3422
- // component
3423
- vnode = createComponent(Ctor, data, context, children, tag);
3424
- } else {
3425
- // unknown or unlisted namespaced elements
3426
- // check at runtime because it may get assigned a namespace when its
3427
- // parent normalizes children
3428
- vnode = new VNode(
3429
- tag, data, children,
3430
- undefined, undefined, context
3431
- );
3432
- }
3433
- } else {
3434
- // direct component options / constructor
3435
- vnode = createComponent(tag, data, context, children);
3436
- }
3437
- if (Array.isArray(vnode)) {
3438
- return vnode
3439
- } else if (isDef(vnode)) {
3440
- if (isDef(ns)) { applyNS(vnode, ns); }
3441
- if (isDef(data)) { registerDeepBindings(data); }
3442
- return vnode
3443
- } else {
3444
- return createEmptyVNode()
3445
- }
3446
- }
3447
-
3448
- function applyNS (vnode, ns, force) {
3449
- vnode.ns = ns;
3450
- if (vnode.tag === 'foreignObject') {
3451
- // use default namespace inside foreignObject
3452
- ns = undefined;
3453
- force = true;
3454
- }
3455
- if (isDef(vnode.children)) {
3456
- for (var i = 0, l = vnode.children.length; i < l; i++) {
3457
- var child = vnode.children[i];
3458
- if (isDef(child.tag) && (
3459
- isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
3460
- applyNS(child, ns, force);
3461
- }
3462
- }
3463
- }
3464
- }
3465
-
3466
- // ref #5318
3467
- // necessary to ensure parent re-render when deep bindings like :style and
3468
- // :class are used on slot nodes
3469
- function registerDeepBindings (data) {
3470
- if (isObject(data.style)) {
3471
- traverse(data.style);
3472
- }
3473
- if (isObject(data.class)) {
3474
- traverse(data.class);
3475
- }
3476
- }
3477
-
3478
- /* */
3479
-
3480
- function initRender (vm) {
3481
- vm._vnode = null; // the root of the child tree
3482
- vm._staticTrees = null; // v-once cached trees
3483
- var options = vm.$options;
3484
- var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3485
- var renderContext = parentVnode && parentVnode.context;
3486
- vm.$slots = resolveSlots(options._renderChildren, renderContext);
3487
- vm.$scopedSlots = emptyObject;
3488
- // bind the createElement fn to this instance
3489
- // so that we get proper render context inside it.
3490
- // args order: tag, data, children, normalizationType, alwaysNormalize
3491
- // internal version is used by render functions compiled from templates
3492
- vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
3493
- // normalization is always applied for the public version, used in
3494
- // user-written render functions.
3495
- vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
3496
-
3497
- // $attrs & $listeners are exposed for easier HOC creation.
3498
- // they need to be reactive so that HOCs using them are always updated
3499
- var parentData = parentVnode && parentVnode.data;
3500
-
3501
- /* istanbul ignore else */
3502
- {
3503
- defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3504
- !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3505
- }, true);
3506
- defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3507
- !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3508
- }, true);
3509
- }
3510
- }
3511
-
3512
- var currentRenderingInstance = null;
3513
-
3514
- function renderMixin (Vue) {
3515
- // install runtime convenience helpers
3516
- installRenderHelpers(Vue.prototype);
3517
-
3518
- Vue.prototype.$nextTick = function (fn) {
3519
- return nextTick(fn, this)
3520
- };
3521
-
3522
- Vue.prototype._render = function () {
3523
- var vm = this;
3524
- var ref = vm.$options;
3525
- var render = ref.render;
3526
- var _parentVnode = ref._parentVnode;
3527
-
3528
- if (_parentVnode) {
3529
- vm.$scopedSlots = normalizeScopedSlots(
3530
- _parentVnode.data.scopedSlots,
3531
- vm.$slots,
3532
- vm.$scopedSlots
3533
- );
3534
- }
3535
-
3536
- // set parent vnode. this allows render functions to have access
3537
- // to the data on the placeholder node.
3538
- vm.$vnode = _parentVnode;
3539
- // render self
3540
- var vnode;
3541
- try {
3542
- // There's no need to maintain a stack becaues all render fns are called
3543
- // separately from one another. Nested component's render fns are called
3544
- // when parent component is patched.
3545
- currentRenderingInstance = vm;
3546
- vnode = render.call(vm._renderProxy, vm.$createElement);
3547
- } catch (e) {
3548
- handleError(e, vm, "render");
3549
- // return error render result,
3550
- // or previous vnode to prevent render error causing blank component
3551
- /* istanbul ignore else */
3552
- if (vm.$options.renderError) {
3553
- try {
3554
- vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3555
- } catch (e) {
3556
- handleError(e, vm, "renderError");
3557
- vnode = vm._vnode;
3558
- }
3559
- } else {
3560
- vnode = vm._vnode;
3561
- }
3562
- } finally {
3563
- currentRenderingInstance = null;
3564
- }
3565
- // if the returned array contains only a single node, allow it
3566
- if (Array.isArray(vnode) && vnode.length === 1) {
3567
- vnode = vnode[0];
3568
- }
3569
- // return empty vnode in case the render function errored out
3570
- if (!(vnode instanceof VNode)) {
3571
- if (Array.isArray(vnode)) {
3572
- warn(
3573
- 'Multiple root nodes returned from render function. Render function ' +
3574
- 'should return a single root node.',
3575
- vm
3576
- );
3577
- }
3578
- vnode = createEmptyVNode();
3579
- }
3580
- // set parent
3581
- vnode.parent = _parentVnode;
3582
- return vnode
3583
- };
3584
- }
3585
-
3586
- /* */
3587
-
3588
- function ensureCtor (comp, base) {
3589
- if (
3590
- comp.__esModule ||
3591
- (hasSymbol && comp[Symbol.toStringTag] === 'Module')
3592
- ) {
3593
- comp = comp.default;
3594
- }
3595
- return isObject(comp)
3596
- ? base.extend(comp)
3597
- : comp
3598
- }
3599
-
3600
- function createAsyncPlaceholder (
3601
- factory,
3602
- data,
3603
- context,
3604
- children,
3605
- tag
3606
- ) {
3607
- var node = createEmptyVNode();
3608
- node.asyncFactory = factory;
3609
- node.asyncMeta = { data: data, context: context, children: children, tag: tag };
3610
- return node
3611
- }
3612
-
3613
- function resolveAsyncComponent (
3614
- factory,
3615
- baseCtor
3616
- ) {
3617
- if (isTrue(factory.error) && isDef(factory.errorComp)) {
3618
- return factory.errorComp
3619
- }
3620
-
3621
- if (isDef(factory.resolved)) {
3622
- return factory.resolved
3623
- }
3624
-
3625
- var owner = currentRenderingInstance;
3626
- if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3627
- // already pending
3628
- factory.owners.push(owner);
3629
- }
3630
-
3631
- if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3632
- return factory.loadingComp
3633
- }
3634
-
3635
- if (owner && !isDef(factory.owners)) {
3636
- var owners = factory.owners = [owner];
3637
- var sync = true;
3638
- var timerLoading = null;
3639
- var timerTimeout = null
3640
-
3641
- ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3642
-
3643
- var forceRender = function (renderCompleted) {
3644
- for (var i = 0, l = owners.length; i < l; i++) {
3645
- (owners[i]).$forceUpdate();
3646
- }
3647
-
3648
- if (renderCompleted) {
3649
- owners.length = 0;
3650
- if (timerLoading !== null) {
3651
- clearTimeout(timerLoading);
3652
- timerLoading = null;
3653
- }
3654
- if (timerTimeout !== null) {
3655
- clearTimeout(timerTimeout);
3656
- timerTimeout = null;
3657
- }
3658
- }
3659
- };
3660
-
3661
- var resolve = once(function (res) {
3662
- // cache resolved
3663
- factory.resolved = ensureCtor(res, baseCtor);
3664
- // invoke callbacks only if this is not a synchronous resolve
3665
- // (async resolves are shimmed as synchronous during SSR)
3666
- if (!sync) {
3667
- forceRender(true);
3668
- } else {
3669
- owners.length = 0;
3670
- }
3671
- });
3672
-
3673
- var reject = once(function (reason) {
3674
- warn(
3675
- "Failed to resolve async component: " + (String(factory)) +
3676
- (reason ? ("\nReason: " + reason) : '')
3677
- );
3678
- if (isDef(factory.errorComp)) {
3679
- factory.error = true;
3680
- forceRender(true);
3681
- }
3682
- });
3683
-
3684
- var res = factory(resolve, reject);
3685
-
3686
- if (isObject(res)) {
3687
- if (isPromise(res)) {
3688
- // () => Promise
3689
- if (isUndef(factory.resolved)) {
3690
- res.then(resolve, reject);
3691
- }
3692
- } else if (isPromise(res.component)) {
3693
- res.component.then(resolve, reject);
3694
-
3695
- if (isDef(res.error)) {
3696
- factory.errorComp = ensureCtor(res.error, baseCtor);
3697
- }
3698
-
3699
- if (isDef(res.loading)) {
3700
- factory.loadingComp = ensureCtor(res.loading, baseCtor);
3701
- if (res.delay === 0) {
3702
- factory.loading = true;
3703
- } else {
3704
- timerLoading = setTimeout(function () {
3705
- timerLoading = null;
3706
- if (isUndef(factory.resolved) && isUndef(factory.error)) {
3707
- factory.loading = true;
3708
- forceRender(false);
3709
- }
3710
- }, res.delay || 200);
3711
- }
3712
- }
3713
-
3714
- if (isDef(res.timeout)) {
3715
- timerTimeout = setTimeout(function () {
3716
- timerTimeout = null;
3717
- if (isUndef(factory.resolved)) {
3718
- reject(
3719
- "timeout (" + (res.timeout) + "ms)"
3720
- );
3721
- }
3722
- }, res.timeout);
3723
- }
3724
- }
3725
- }
3726
-
3727
- sync = false;
3728
- // return in case resolved synchronously
3729
- return factory.loading
3730
- ? factory.loadingComp
3731
- : factory.resolved
3732
- }
3733
- }
3734
-
3735
- /* */
3736
-
3737
- function isAsyncPlaceholder (node) {
3738
- return node.isComment && node.asyncFactory
3739
- }
3740
-
3741
- /* */
3742
-
3743
- function getFirstComponentChild (children) {
3744
- if (Array.isArray(children)) {
3745
- for (var i = 0; i < children.length; i++) {
3746
- var c = children[i];
3747
- if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3748
- return c
3749
- }
3750
- }
3751
- }
3752
- }
3753
-
3754
- /* */
3755
-
3756
- /* */
3757
-
3758
- function initEvents (vm) {
3759
- vm._events = Object.create(null);
3760
- vm._hasHookEvent = false;
3761
- // init parent attached events
3762
- var listeners = vm.$options._parentListeners;
3763
- if (listeners) {
3764
- updateComponentListeners(vm, listeners);
3765
- }
3766
- }
3767
-
3768
- var target;
3769
-
3770
- function add (event, fn) {
3771
- target.$on(event, fn);
3772
- }
3773
-
3774
- function remove$1 (event, fn) {
3775
- target.$off(event, fn);
3776
- }
3777
-
3778
- function createOnceHandler (event, fn) {
3779
- var _target = target;
3780
- return function onceHandler () {
3781
- var res = fn.apply(null, arguments);
3782
- if (res !== null) {
3783
- _target.$off(event, onceHandler);
3784
- }
3785
- }
3786
- }
3787
-
3788
- function updateComponentListeners (
3789
- vm,
3790
- listeners,
3791
- oldListeners
3792
- ) {
3793
- target = vm;
3794
- updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3795
- target = undefined;
3796
- }
3797
-
3798
- function eventsMixin (Vue) {
3799
- var hookRE = /^hook:/;
3800
- Vue.prototype.$on = function (event, fn) {
3801
- var vm = this;
3802
- if (Array.isArray(event)) {
3803
- for (var i = 0, l = event.length; i < l; i++) {
3804
- vm.$on(event[i], fn);
3805
- }
3806
- } else {
3807
- (vm._events[event] || (vm._events[event] = [])).push(fn);
3808
- // optimize hook:event cost by using a boolean flag marked at registration
3809
- // instead of a hash lookup
3810
- if (hookRE.test(event)) {
3811
- vm._hasHookEvent = true;
3812
- }
3813
- }
3814
- return vm
3815
- };
3816
-
3817
- Vue.prototype.$once = function (event, fn) {
3818
- var vm = this;
3819
- function on () {
3820
- vm.$off(event, on);
3821
- fn.apply(vm, arguments);
3822
- }
3823
- on.fn = fn;
3824
- vm.$on(event, on);
3825
- return vm
3826
- };
3827
-
3828
- Vue.prototype.$off = function (event, fn) {
3829
- var vm = this;
3830
- // all
3831
- if (!arguments.length) {
3832
- vm._events = Object.create(null);
3833
- return vm
3834
- }
3835
- // array of events
3836
- if (Array.isArray(event)) {
3837
- for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3838
- vm.$off(event[i$1], fn);
3839
- }
3840
- return vm
3841
- }
3842
- // specific event
3843
- var cbs = vm._events[event];
3844
- if (!cbs) {
3845
- return vm
3846
- }
3847
- if (!fn) {
3848
- vm._events[event] = null;
3849
- return vm
3850
- }
3851
- // specific handler
3852
- var cb;
3853
- var i = cbs.length;
3854
- while (i--) {
3855
- cb = cbs[i];
3856
- if (cb === fn || cb.fn === fn) {
3857
- cbs.splice(i, 1);
3858
- break
3859
- }
3860
- }
3861
- return vm
3862
- };
3863
-
3864
- Vue.prototype.$emit = function (event) {
3865
- var vm = this;
3866
- {
3867
- var lowerCaseEvent = event.toLowerCase();
3868
- if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3869
- tip(
3870
- "Event \"" + lowerCaseEvent + "\" is emitted in component " +
3871
- (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
3872
- "Note that HTML attributes are case-insensitive and you cannot use " +
3873
- "v-on to listen to camelCase events when using in-DOM templates. " +
3874
- "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
3875
- );
3876
- }
3877
- }
3878
- var cbs = vm._events[event];
3879
- if (cbs) {
3880
- cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3881
- var args = toArray(arguments, 1);
3882
- var info = "event handler for \"" + event + "\"";
3883
- for (var i = 0, l = cbs.length; i < l; i++) {
3884
- invokeWithErrorHandling(cbs[i], vm, args, vm, info);
3885
- }
3886
- }
3887
- return vm
3888
- };
3889
- }
3890
-
3891
- /* */
3892
-
3893
- var activeInstance = null;
3894
- var isUpdatingChildComponent = false;
3895
-
3896
- function setActiveInstance(vm) {
3897
- var prevActiveInstance = activeInstance;
3898
- activeInstance = vm;
3899
- return function () {
3900
- activeInstance = prevActiveInstance;
3901
- }
3902
- }
3903
-
3904
- function initLifecycle (vm) {
3905
- var options = vm.$options;
3906
-
3907
- // locate first non-abstract parent
3908
- var parent = options.parent;
3909
- if (parent && !options.abstract) {
3910
- while (parent.$options.abstract && parent.$parent) {
3911
- parent = parent.$parent;
3912
- }
3913
- parent.$children.push(vm);
3914
- }
3915
-
3916
- vm.$parent = parent;
3917
- vm.$root = parent ? parent.$root : vm;
3918
-
3919
- vm.$children = [];
3920
- vm.$refs = {};
3921
-
3922
- vm._watcher = null;
3923
- vm._inactive = null;
3924
- vm._directInactive = false;
3925
- vm._isMounted = false;
3926
- vm._isDestroyed = false;
3927
- vm._isBeingDestroyed = false;
3928
- }
3929
-
3930
- function lifecycleMixin (Vue) {
3931
- Vue.prototype._update = function (vnode, hydrating) {
3932
- var vm = this;
3933
- var prevEl = vm.$el;
3934
- var prevVnode = vm._vnode;
3935
- var restoreActiveInstance = setActiveInstance(vm);
3936
- vm._vnode = vnode;
3937
- // Vue.prototype.__patch__ is injected in entry points
3938
- // based on the rendering backend used.
3939
- if (!prevVnode) {
3940
- // initial render
3941
- vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
3942
- } else {
3943
- // updates
3944
- vm.$el = vm.__patch__(prevVnode, vnode);
3945
- }
3946
- restoreActiveInstance();
3947
- // update __vue__ reference
3948
- if (prevEl) {
3949
- prevEl.__vue__ = null;
3950
- }
3951
- if (vm.$el) {
3952
- vm.$el.__vue__ = vm;
3953
- }
3954
- // if parent is an HOC, update its $el as well
3955
- if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
3956
- vm.$parent.$el = vm.$el;
3957
- }
3958
- // updated hook is called by the scheduler to ensure that children are
3959
- // updated in a parent's updated hook.
3960
- };
3961
-
3962
- Vue.prototype.$forceUpdate = function () {
3963
- var vm = this;
3964
- if (vm._watcher) {
3965
- vm._watcher.update();
3966
- }
3967
- };
3968
-
3969
- Vue.prototype.$destroy = function () {
3970
- var vm = this;
3971
- if (vm._isBeingDestroyed) {
3972
- return
3973
- }
3974
- callHook(vm, 'beforeDestroy');
3975
- vm._isBeingDestroyed = true;
3976
- // remove self from parent
3977
- var parent = vm.$parent;
3978
- if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
3979
- remove(parent.$children, vm);
3980
- }
3981
- // teardown watchers
3982
- if (vm._watcher) {
3983
- vm._watcher.teardown();
3984
- }
3985
- var i = vm._watchers.length;
3986
- while (i--) {
3987
- vm._watchers[i].teardown();
3988
- }
3989
- // remove reference from data ob
3990
- // frozen object may not have observer.
3991
- if (vm._data.__ob__) {
3992
- vm._data.__ob__.vmCount--;
3993
- }
3994
- // call the last hook...
3995
- vm._isDestroyed = true;
3996
- // invoke destroy hooks on current rendered tree
3997
- vm.__patch__(vm._vnode, null);
3998
- // fire destroyed hook
3999
- callHook(vm, 'destroyed');
4000
- // turn off all instance listeners.
4001
- vm.$off();
4002
- // remove __vue__ reference
4003
- if (vm.$el) {
4004
- vm.$el.__vue__ = null;
4005
- }
4006
- // release circular reference (#6759)
4007
- if (vm.$vnode) {
4008
- vm.$vnode.parent = null;
4009
- }
4010
- };
4011
- }
4012
-
4013
- function mountComponent (
4014
- vm,
4015
- el,
4016
- hydrating
4017
- ) {
4018
- vm.$el = el;
4019
- if (!vm.$options.render) {
4020
- vm.$options.render = createEmptyVNode;
4021
- {
4022
- /* istanbul ignore if */
4023
- if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
4024
- vm.$options.el || el) {
4025
- warn(
4026
- 'You are using the runtime-only build of Vue where the template ' +
4027
- 'compiler is not available. Either pre-compile the templates into ' +
4028
- 'render functions, or use the compiler-included build.',
4029
- vm
4030
- );
4031
- } else {
4032
- warn(
4033
- 'Failed to mount component: template or render function not defined.',
4034
- vm
4035
- );
4036
- }
4037
- }
4038
- }
4039
- callHook(vm, 'beforeMount');
4040
-
4041
- var updateComponent;
4042
- /* istanbul ignore if */
4043
- if (config.performance && mark) {
4044
- updateComponent = function () {
4045
- var name = vm._name;
4046
- var id = vm._uid;
4047
- var startTag = "vue-perf-start:" + id;
4048
- var endTag = "vue-perf-end:" + id;
4049
-
4050
- mark(startTag);
4051
- var vnode = vm._render();
4052
- mark(endTag);
4053
- measure(("vue " + name + " render"), startTag, endTag);
4054
-
4055
- mark(startTag);
4056
- vm._update(vnode, hydrating);
4057
- mark(endTag);
4058
- measure(("vue " + name + " patch"), startTag, endTag);
4059
- };
4060
- } else {
4061
- updateComponent = function () {
4062
- vm._update(vm._render(), hydrating);
4063
- };
4064
- }
4065
-
4066
- // we set this to vm._watcher inside the watcher's constructor
4067
- // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4068
- // component's mounted hook), which relies on vm._watcher being already defined
4069
- new Watcher(vm, updateComponent, noop, {
4070
- before: function before () {
4071
- if (vm._isMounted && !vm._isDestroyed) {
4072
- callHook(vm, 'beforeUpdate');
4073
- }
4074
- }
4075
- }, true /* isRenderWatcher */);
4076
- hydrating = false;
4077
-
4078
- // manually mounted instance, call mounted on self
4079
- // mounted is called for render-created child components in its inserted hook
4080
- if (vm.$vnode == null) {
4081
- vm._isMounted = true;
4082
- callHook(vm, 'mounted');
4083
- }
4084
- return vm
4085
- }
4086
-
4087
- function updateChildComponent (
4088
- vm,
4089
- propsData,
4090
- listeners,
4091
- parentVnode,
4092
- renderChildren
4093
- ) {
4094
- {
4095
- isUpdatingChildComponent = true;
4096
- }
4097
-
4098
- // determine whether component has slot children
4099
- // we need to do this before overwriting $options._renderChildren.
4100
-
4101
- // check if there are dynamic scopedSlots (hand-written or compiled but with
4102
- // dynamic slot names). Static scoped slots compiled from template has the
4103
- // "$stable" marker.
4104
- var newScopedSlots = parentVnode.data.scopedSlots;
4105
- var oldScopedSlots = vm.$scopedSlots;
4106
- var hasDynamicScopedSlot = !!(
4107
- (newScopedSlots && !newScopedSlots.$stable) ||
4108
- (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4109
- (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4110
- );
4111
-
4112
- // Any static slot children from the parent may have changed during parent's
4113
- // update. Dynamic scoped slots may also have changed. In such cases, a forced
4114
- // update is necessary to ensure correctness.
4115
- var needsForceUpdate = !!(
4116
- renderChildren || // has new static slots
4117
- vm.$options._renderChildren || // has old static slots
4118
- hasDynamicScopedSlot
4119
- );
4120
-
4121
- vm.$options._parentVnode = parentVnode;
4122
- vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4123
-
4124
- if (vm._vnode) { // update child tree's parent
4125
- vm._vnode.parent = parentVnode;
4126
- }
4127
- vm.$options._renderChildren = renderChildren;
4128
-
4129
- // update $attrs and $listeners hash
4130
- // these are also reactive so they may trigger child update if the child
4131
- // used them during render
4132
- vm.$attrs = parentVnode.data.attrs || emptyObject;
4133
- vm.$listeners = listeners || emptyObject;
4134
-
4135
- // update props
4136
- if (propsData && vm.$options.props) {
4137
- toggleObserving(false);
4138
- var props = vm._props;
4139
- var propKeys = vm.$options._propKeys || [];
4140
- for (var i = 0; i < propKeys.length; i++) {
4141
- var key = propKeys[i];
4142
- var propOptions = vm.$options.props; // wtf flow?
4143
- props[key] = validateProp(key, propOptions, propsData, vm);
4144
- }
4145
- toggleObserving(true);
4146
- // keep a copy of raw propsData
4147
- vm.$options.propsData = propsData;
4148
- }
4149
-
4150
- // update listeners
4151
- listeners = listeners || emptyObject;
4152
- var oldListeners = vm.$options._parentListeners;
4153
- vm.$options._parentListeners = listeners;
4154
- updateComponentListeners(vm, listeners, oldListeners);
4155
-
4156
- // resolve slots + force update if has children
4157
- if (needsForceUpdate) {
4158
- vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4159
- vm.$forceUpdate();
4160
- }
4161
-
4162
- {
4163
- isUpdatingChildComponent = false;
4164
- }
4165
- }
4166
-
4167
- function isInInactiveTree (vm) {
4168
- while (vm && (vm = vm.$parent)) {
4169
- if (vm._inactive) { return true }
4170
- }
4171
- return false
4172
- }
4173
-
4174
- function activateChildComponent (vm, direct) {
4175
- if (direct) {
4176
- vm._directInactive = false;
4177
- if (isInInactiveTree(vm)) {
4178
- return
4179
- }
4180
- } else if (vm._directInactive) {
4181
- return
4182
- }
4183
- if (vm._inactive || vm._inactive === null) {
4184
- vm._inactive = false;
4185
- for (var i = 0; i < vm.$children.length; i++) {
4186
- activateChildComponent(vm.$children[i]);
4187
- }
4188
- callHook(vm, 'activated');
4189
- }
4190
- }
4191
-
4192
- function deactivateChildComponent (vm, direct) {
4193
- if (direct) {
4194
- vm._directInactive = true;
4195
- if (isInInactiveTree(vm)) {
4196
- return
4197
- }
4198
- }
4199
- if (!vm._inactive) {
4200
- vm._inactive = true;
4201
- for (var i = 0; i < vm.$children.length; i++) {
4202
- deactivateChildComponent(vm.$children[i]);
4203
- }
4204
- callHook(vm, 'deactivated');
4205
- }
4206
- }
4207
-
4208
- function callHook (vm, hook) {
4209
- // #7573 disable dep collection when invoking lifecycle hooks
4210
- pushTarget();
4211
- var handlers = vm.$options[hook];
4212
- var info = hook + " hook";
4213
- if (handlers) {
4214
- for (var i = 0, j = handlers.length; i < j; i++) {
4215
- invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4216
- }
4217
- }
4218
- if (vm._hasHookEvent) {
4219
- vm.$emit('hook:' + hook);
4220
- }
4221
- popTarget();
4222
- }
4223
-
4224
- /* */
4225
-
4226
- var MAX_UPDATE_COUNT = 100;
4227
-
4228
- var queue = [];
4229
- var activatedChildren = [];
4230
- var has = {};
4231
- var circular = {};
4232
- var waiting = false;
4233
- var flushing = false;
4234
- var index = 0;
4235
-
4236
- /**
4237
- * Reset the scheduler's state.
4238
- */
4239
- function resetSchedulerState () {
4240
- index = queue.length = activatedChildren.length = 0;
4241
- has = {};
4242
- {
4243
- circular = {};
4244
- }
4245
- waiting = flushing = false;
4246
- }
4247
-
4248
- // Async edge case #6566 requires saving the timestamp when event listeners are
4249
- // attached. However, calling performance.now() has a perf overhead especially
4250
- // if the page has thousands of event listeners. Instead, we take a timestamp
4251
- // every time the scheduler flushes and use that for all event listeners
4252
- // attached during that flush.
4253
- var currentFlushTimestamp = 0;
4254
-
4255
- // Async edge case fix requires storing an event listener's attach timestamp.
4256
- var getNow = Date.now;
4257
-
4258
- // Determine what event timestamp the browser is using. Annoyingly, the
4259
- // timestamp can either be hi-res (relative to page load) or low-res
4260
- // (relative to UNIX epoch), so in order to compare time we have to use the
4261
- // same timestamp type when saving the flush timestamp.
4262
- // All IE versions use low-res event timestamps, and have problematic clock
4263
- // implementations (#9632)
4264
- if (inBrowser && !isIE) {
4265
- var performance = window.performance;
4266
- if (
4267
- performance &&
4268
- typeof performance.now === 'function' &&
4269
- getNow() > document.createEvent('Event').timeStamp
4270
- ) {
4271
- // if the event timestamp, although evaluated AFTER the Date.now(), is
4272
- // smaller than it, it means the event is using a hi-res timestamp,
4273
- // and we need to use the hi-res version for event listener timestamps as
4274
- // well.
4275
- getNow = function () { return performance.now(); };
4276
- }
4277
- }
4278
-
4279
- /**
4280
- * Flush both queues and run the watchers.
4281
- */
4282
- function flushSchedulerQueue () {
4283
- currentFlushTimestamp = getNow();
4284
- flushing = true;
4285
- var watcher, id;
4286
-
4287
- // Sort queue before flush.
4288
- // This ensures that:
4289
- // 1. Components are updated from parent to child. (because parent is always
4290
- // created before the child)
4291
- // 2. A component's user watchers are run before its render watcher (because
4292
- // user watchers are created before the render watcher)
4293
- // 3. If a component is destroyed during a parent component's watcher run,
4294
- // its watchers can be skipped.
4295
- queue.sort(function (a, b) { return a.id - b.id; });
4296
-
4297
- // do not cache length because more watchers might be pushed
4298
- // as we run existing watchers
4299
- for (index = 0; index < queue.length; index++) {
4300
- watcher = queue[index];
4301
- if (watcher.before) {
4302
- watcher.before();
4303
- }
4304
- id = watcher.id;
4305
- has[id] = null;
4306
- watcher.run();
4307
- // in dev build, check and stop circular updates.
4308
- if (has[id] != null) {
4309
- circular[id] = (circular[id] || 0) + 1;
4310
- if (circular[id] > MAX_UPDATE_COUNT) {
4311
- warn(
4312
- 'You may have an infinite update loop ' + (
4313
- watcher.user
4314
- ? ("in watcher with expression \"" + (watcher.expression) + "\"")
4315
- : "in a component render function."
4316
- ),
4317
- watcher.vm
4318
- );
4319
- break
4320
- }
4321
- }
4322
- }
4323
-
4324
- // keep copies of post queues before resetting state
4325
- var activatedQueue = activatedChildren.slice();
4326
- var updatedQueue = queue.slice();
4327
-
4328
- resetSchedulerState();
4329
-
4330
- // call component updated and activated hooks
4331
- callActivatedHooks(activatedQueue);
4332
- callUpdatedHooks(updatedQueue);
4333
-
4334
- // devtool hook
4335
- /* istanbul ignore if */
4336
- if (devtools && config.devtools) {
4337
- devtools.emit('flush');
4338
- }
4339
- }
4340
-
4341
- function callUpdatedHooks (queue) {
4342
- var i = queue.length;
4343
- while (i--) {
4344
- var watcher = queue[i];
4345
- var vm = watcher.vm;
4346
- if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4347
- callHook(vm, 'updated');
4348
- }
4349
- }
4350
- }
4351
-
4352
- /**
4353
- * Queue a kept-alive component that was activated during patch.
4354
- * The queue will be processed after the entire tree has been patched.
4355
- */
4356
- function queueActivatedComponent (vm) {
4357
- // setting _inactive to false here so that a render function can
4358
- // rely on checking whether it's in an inactive tree (e.g. router-view)
4359
- vm._inactive = false;
4360
- activatedChildren.push(vm);
4361
- }
4362
-
4363
- function callActivatedHooks (queue) {
4364
- for (var i = 0; i < queue.length; i++) {
4365
- queue[i]._inactive = true;
4366
- activateChildComponent(queue[i], true /* true */);
4367
- }
4368
- }
4369
-
4370
- /**
4371
- * Push a watcher into the watcher queue.
4372
- * Jobs with duplicate IDs will be skipped unless it's
4373
- * pushed when the queue is being flushed.
4374
- */
4375
- function queueWatcher (watcher) {
4376
- var id = watcher.id;
4377
- if (has[id] == null) {
4378
- has[id] = true;
4379
- if (!flushing) {
4380
- queue.push(watcher);
4381
- } else {
4382
- // if already flushing, splice the watcher based on its id
4383
- // if already past its id, it will be run next immediately.
4384
- var i = queue.length - 1;
4385
- while (i > index && queue[i].id > watcher.id) {
4386
- i--;
4387
- }
4388
- queue.splice(i + 1, 0, watcher);
4389
- }
4390
- // queue the flush
4391
- if (!waiting) {
4392
- waiting = true;
4393
-
4394
- if (!config.async) {
4395
- flushSchedulerQueue();
4396
- return
4397
- }
4398
- nextTick(flushSchedulerQueue);
4399
- }
4400
- }
4401
- }
4402
-
4403
- /* */
4404
-
4405
-
4406
-
4407
- var uid$2 = 0;
4408
-
4409
- /**
4410
- * A watcher parses an expression, collects dependencies,
4411
- * and fires callback when the expression value changes.
4412
- * This is used for both the $watch() api and directives.
4413
- */
4414
- var Watcher = function Watcher (
4415
- vm,
4416
- expOrFn,
4417
- cb,
4418
- options,
4419
- isRenderWatcher
4420
- ) {
4421
- this.vm = vm;
4422
- if (isRenderWatcher) {
4423
- vm._watcher = this;
4424
- }
4425
- vm._watchers.push(this);
4426
- // options
4427
- if (options) {
4428
- this.deep = !!options.deep;
4429
- this.user = !!options.user;
4430
- this.lazy = !!options.lazy;
4431
- this.sync = !!options.sync;
4432
- this.before = options.before;
4433
- } else {
4434
- this.deep = this.user = this.lazy = this.sync = false;
4435
- }
4436
- this.cb = cb;
4437
- this.id = ++uid$2; // uid for batching
4438
- this.active = true;
4439
- this.dirty = this.lazy; // for lazy watchers
4440
- this.deps = [];
4441
- this.newDeps = [];
4442
- this.depIds = new _Set();
4443
- this.newDepIds = new _Set();
4444
- this.expression = expOrFn.toString();
4445
- // parse expression for getter
4446
- if (typeof expOrFn === 'function') {
4447
- this.getter = expOrFn;
4448
- } else {
4449
- this.getter = parsePath(expOrFn);
4450
- if (!this.getter) {
4451
- this.getter = noop;
4452
- warn(
4453
- "Failed watching path: \"" + expOrFn + "\" " +
4454
- 'Watcher only accepts simple dot-delimited paths. ' +
4455
- 'For full control, use a function instead.',
4456
- vm
4457
- );
4458
- }
4459
- }
4460
- this.value = this.lazy
4461
- ? undefined
4462
- : this.get();
4463
- };
4464
-
4465
- /**
4466
- * Evaluate the getter, and re-collect dependencies.
4467
- */
4468
- Watcher.prototype.get = function get () {
4469
- pushTarget(this);
4470
- var value;
4471
- var vm = this.vm;
4472
- try {
4473
- value = this.getter.call(vm, vm);
4474
- } catch (e) {
4475
- if (this.user) {
4476
- handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
4477
- } else {
4478
- throw e
4479
- }
4480
- } finally {
4481
- // "touch" every property so they are all tracked as
4482
- // dependencies for deep watching
4483
- if (this.deep) {
4484
- traverse(value);
4485
- }
4486
- popTarget();
4487
- this.cleanupDeps();
4488
- }
4489
- return value
4490
- };
4491
-
4492
- /**
4493
- * Add a dependency to this directive.
4494
- */
4495
- Watcher.prototype.addDep = function addDep (dep) {
4496
- var id = dep.id;
4497
- if (!this.newDepIds.has(id)) {
4498
- this.newDepIds.add(id);
4499
- this.newDeps.push(dep);
4500
- if (!this.depIds.has(id)) {
4501
- dep.addSub(this);
4502
- }
4503
- }
4504
- };
4505
-
4506
- /**
4507
- * Clean up for dependency collection.
4508
- */
4509
- Watcher.prototype.cleanupDeps = function cleanupDeps () {
4510
- var i = this.deps.length;
4511
- while (i--) {
4512
- var dep = this.deps[i];
4513
- if (!this.newDepIds.has(dep.id)) {
4514
- dep.removeSub(this);
4515
- }
4516
- }
4517
- var tmp = this.depIds;
4518
- this.depIds = this.newDepIds;
4519
- this.newDepIds = tmp;
4520
- this.newDepIds.clear();
4521
- tmp = this.deps;
4522
- this.deps = this.newDeps;
4523
- this.newDeps = tmp;
4524
- this.newDeps.length = 0;
4525
- };
4526
-
4527
- /**
4528
- * Subscriber interface.
4529
- * Will be called when a dependency changes.
4530
- */
4531
- Watcher.prototype.update = function update () {
4532
- /* istanbul ignore else */
4533
- if (this.lazy) {
4534
- this.dirty = true;
4535
- } else if (this.sync) {
4536
- this.run();
4537
- } else {
4538
- queueWatcher(this);
4539
- }
4540
- };
4541
-
4542
- /**
4543
- * Scheduler job interface.
4544
- * Will be called by the scheduler.
4545
- */
4546
- Watcher.prototype.run = function run () {
4547
- if (this.active) {
4548
- var value = this.get();
4549
- if (
4550
- value !== this.value ||
4551
- // Deep watchers and watchers on Object/Arrays should fire even
4552
- // when the value is the same, because the value may
4553
- // have mutated.
4554
- isObject(value) ||
4555
- this.deep
4556
- ) {
4557
- // set new value
4558
- var oldValue = this.value;
4559
- this.value = value;
4560
- if (this.user) {
4561
- try {
4562
- this.cb.call(this.vm, value, oldValue);
4563
- } catch (e) {
4564
- handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4565
- }
4566
- } else {
4567
- this.cb.call(this.vm, value, oldValue);
4568
- }
4569
- }
4570
- }
4571
- };
4572
-
4573
- /**
4574
- * Evaluate the value of the watcher.
4575
- * This only gets called for lazy watchers.
4576
- */
4577
- Watcher.prototype.evaluate = function evaluate () {
4578
- this.value = this.get();
4579
- this.dirty = false;
4580
- };
4581
-
4582
- /**
4583
- * Depend on all deps collected by this watcher.
4584
- */
4585
- Watcher.prototype.depend = function depend () {
4586
- var i = this.deps.length;
4587
- while (i--) {
4588
- this.deps[i].depend();
4589
- }
4590
- };
4591
-
4592
- /**
4593
- * Remove self from all dependencies' subscriber list.
4594
- */
4595
- Watcher.prototype.teardown = function teardown () {
4596
- if (this.active) {
4597
- // remove self from vm's watcher list
4598
- // this is a somewhat expensive operation so we skip it
4599
- // if the vm is being destroyed.
4600
- if (!this.vm._isBeingDestroyed) {
4601
- remove(this.vm._watchers, this);
4602
- }
4603
- var i = this.deps.length;
4604
- while (i--) {
4605
- this.deps[i].removeSub(this);
4606
- }
4607
- this.active = false;
4608
- }
4609
- };
4610
-
4611
- /* */
4612
-
4613
- var sharedPropertyDefinition = {
4614
- enumerable: true,
4615
- configurable: true,
4616
- get: noop,
4617
- set: noop
4618
- };
4619
-
4620
- function proxy (target, sourceKey, key) {
4621
- sharedPropertyDefinition.get = function proxyGetter () {
4622
- return this[sourceKey][key]
4623
- };
4624
- sharedPropertyDefinition.set = function proxySetter (val) {
4625
- this[sourceKey][key] = val;
4626
- };
4627
- Object.defineProperty(target, key, sharedPropertyDefinition);
4628
- }
4629
-
4630
- function initState (vm) {
4631
- vm._watchers = [];
4632
- var opts = vm.$options;
4633
- if (opts.props) { initProps(vm, opts.props); }
4634
- if (opts.methods) { initMethods(vm, opts.methods); }
4635
- if (opts.data) {
4636
- initData(vm);
4637
- } else {
4638
- observe(vm._data = {}, true /* asRootData */);
4639
- }
4640
- if (opts.computed) { initComputed(vm, opts.computed); }
4641
- if (opts.watch && opts.watch !== nativeWatch) {
4642
- initWatch(vm, opts.watch);
4643
- }
4644
- }
4645
-
4646
- function initProps (vm, propsOptions) {
4647
- var propsData = vm.$options.propsData || {};
4648
- var props = vm._props = {};
4649
- // cache prop keys so that future props updates can iterate using Array
4650
- // instead of dynamic object key enumeration.
4651
- var keys = vm.$options._propKeys = [];
4652
- var isRoot = !vm.$parent;
4653
- // root instance props should be converted
4654
- if (!isRoot) {
4655
- toggleObserving(false);
4656
- }
4657
- var loop = function ( key ) {
4658
- keys.push(key);
4659
- var value = validateProp(key, propsOptions, propsData, vm);
4660
- /* istanbul ignore else */
4661
- {
4662
- var hyphenatedKey = hyphenate(key);
4663
- if (isReservedAttribute(hyphenatedKey) ||
4664
- config.isReservedAttr(hyphenatedKey)) {
4665
- warn(
4666
- ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
4667
- vm
4668
- );
4669
- }
4670
- defineReactive$$1(props, key, value, function () {
4671
- if (!isRoot && !isUpdatingChildComponent) {
4672
- warn(
4673
- "Avoid mutating a prop directly since the value will be " +
4674
- "overwritten whenever the parent component re-renders. " +
4675
- "Instead, use a data or computed property based on the prop's " +
4676
- "value. Prop being mutated: \"" + key + "\"",
4677
- vm
4678
- );
4679
- }
4680
- });
4681
- }
4682
- // static props are already proxied on the component's prototype
4683
- // during Vue.extend(). We only need to proxy props defined at
4684
- // instantiation here.
4685
- if (!(key in vm)) {
4686
- proxy(vm, "_props", key);
4687
- }
4688
- };
4689
-
4690
- for (var key in propsOptions) loop( key );
4691
- toggleObserving(true);
4692
- }
4693
-
4694
- function initData (vm) {
4695
- var data = vm.$options.data;
4696
- data = vm._data = typeof data === 'function'
4697
- ? getData(data, vm)
4698
- : data || {};
4699
- if (!isPlainObject(data)) {
4700
- data = {};
4701
- warn(
4702
- 'data functions should return an object:\n' +
4703
- 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
4704
- vm
4705
- );
4706
- }
4707
- // proxy data on instance
4708
- var keys = Object.keys(data);
4709
- var props = vm.$options.props;
4710
- var methods = vm.$options.methods;
4711
- var i = keys.length;
4712
- while (i--) {
4713
- var key = keys[i];
4714
- {
4715
- if (methods && hasOwn(methods, key)) {
4716
- warn(
4717
- ("Method \"" + key + "\" has already been defined as a data property."),
4718
- vm
4719
- );
4720
- }
4721
- }
4722
- if (props && hasOwn(props, key)) {
4723
- warn(
4724
- "The data property \"" + key + "\" is already declared as a prop. " +
4725
- "Use prop default value instead.",
4726
- vm
4727
- );
4728
- } else if (!isReserved(key)) {
4729
- proxy(vm, "_data", key);
4730
- }
4731
- }
4732
- // observe data
4733
- observe(data, true /* asRootData */);
4734
- }
4735
-
4736
- function getData (data, vm) {
4737
- // #7573 disable dep collection when invoking data getters
4738
- pushTarget();
4739
- try {
4740
- return data.call(vm, vm)
4741
- } catch (e) {
4742
- handleError(e, vm, "data()");
4743
- return {}
4744
- } finally {
4745
- popTarget();
4746
- }
4747
- }
4748
-
4749
- var computedWatcherOptions = { lazy: true };
4750
-
4751
- function initComputed (vm, computed) {
4752
- // $flow-disable-line
4753
- var watchers = vm._computedWatchers = Object.create(null);
4754
- // computed properties are just getters during SSR
4755
- var isSSR = isServerRendering();
4756
-
4757
- for (var key in computed) {
4758
- var userDef = computed[key];
4759
- var getter = typeof userDef === 'function' ? userDef : userDef.get;
4760
- if (getter == null) {
4761
- warn(
4762
- ("Getter is missing for computed property \"" + key + "\"."),
4763
- vm
4764
- );
4765
- }
4766
-
4767
- if (!isSSR) {
4768
- // create internal watcher for the computed property.
4769
- watchers[key] = new Watcher(
4770
- vm,
4771
- getter || noop,
4772
- noop,
4773
- computedWatcherOptions
4774
- );
4775
- }
4776
-
4777
- // component-defined computed properties are already defined on the
4778
- // component prototype. We only need to define computed properties defined
4779
- // at instantiation here.
4780
- if (!(key in vm)) {
4781
- defineComputed(vm, key, userDef);
4782
- } else {
4783
- if (key in vm.$data) {
4784
- warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4785
- } else if (vm.$options.props && key in vm.$options.props) {
4786
- warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4787
- }
4788
- }
4789
- }
4790
- }
4791
-
4792
- function defineComputed (
4793
- target,
4794
- key,
4795
- userDef
4796
- ) {
4797
- var shouldCache = !isServerRendering();
4798
- if (typeof userDef === 'function') {
4799
- sharedPropertyDefinition.get = shouldCache
4800
- ? createComputedGetter(key)
4801
- : createGetterInvoker(userDef);
4802
- sharedPropertyDefinition.set = noop;
4803
- } else {
4804
- sharedPropertyDefinition.get = userDef.get
4805
- ? shouldCache && userDef.cache !== false
4806
- ? createComputedGetter(key)
4807
- : createGetterInvoker(userDef.get)
4808
- : noop;
4809
- sharedPropertyDefinition.set = userDef.set || noop;
4810
- }
4811
- if (sharedPropertyDefinition.set === noop) {
4812
- sharedPropertyDefinition.set = function () {
4813
- warn(
4814
- ("Computed property \"" + key + "\" was assigned to but it has no setter."),
4815
- this
4816
- );
4817
- };
4818
- }
4819
- Object.defineProperty(target, key, sharedPropertyDefinition);
4820
- }
4821
-
4822
- function createComputedGetter (key) {
4823
- return function computedGetter () {
4824
- var watcher = this._computedWatchers && this._computedWatchers[key];
4825
- if (watcher) {
4826
- if (watcher.dirty) {
4827
- watcher.evaluate();
4828
- }
4829
- if (Dep.target) {
4830
- watcher.depend();
4831
- }
4832
- return watcher.value
4833
- }
4834
- }
4835
- }
4836
-
4837
- function createGetterInvoker(fn) {
4838
- return function computedGetter () {
4839
- return fn.call(this, this)
4840
- }
4841
- }
4842
-
4843
- function initMethods (vm, methods) {
4844
- var props = vm.$options.props;
4845
- for (var key in methods) {
4846
- {
4847
- if (typeof methods[key] !== 'function') {
4848
- warn(
4849
- "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
4850
- "Did you reference the function correctly?",
4851
- vm
4852
- );
4853
- }
4854
- if (props && hasOwn(props, key)) {
4855
- warn(
4856
- ("Method \"" + key + "\" has already been defined as a prop."),
4857
- vm
4858
- );
4859
- }
4860
- if ((key in vm) && isReserved(key)) {
4861
- warn(
4862
- "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
4863
- "Avoid defining component methods that start with _ or $."
4864
- );
4865
- }
4866
- }
4867
- vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
4868
- }
4869
- }
4870
-
4871
- function initWatch (vm, watch) {
4872
- for (var key in watch) {
4873
- var handler = watch[key];
4874
- if (Array.isArray(handler)) {
4875
- for (var i = 0; i < handler.length; i++) {
4876
- createWatcher(vm, key, handler[i]);
4877
- }
4878
- } else {
4879
- createWatcher(vm, key, handler);
4880
- }
4881
- }
4882
- }
4883
-
4884
- function createWatcher (
4885
- vm,
4886
- expOrFn,
4887
- handler,
4888
- options
4889
- ) {
4890
- if (isPlainObject(handler)) {
4891
- options = handler;
4892
- handler = handler.handler;
4893
- }
4894
- if (typeof handler === 'string') {
4895
- handler = vm[handler];
4896
- }
4897
- return vm.$watch(expOrFn, handler, options)
4898
- }
4899
-
4900
- function stateMixin (Vue) {
4901
- // flow somehow has problems with directly declared definition object
4902
- // when using Object.defineProperty, so we have to procedurally build up
4903
- // the object here.
4904
- var dataDef = {};
4905
- dataDef.get = function () { return this._data };
4906
- var propsDef = {};
4907
- propsDef.get = function () { return this._props };
4908
- {
4909
- dataDef.set = function () {
4910
- warn(
4911
- 'Avoid replacing instance root $data. ' +
4912
- 'Use nested data properties instead.',
4913
- this
4914
- );
4915
- };
4916
- propsDef.set = function () {
4917
- warn("$props is readonly.", this);
4918
- };
4919
- }
4920
- Object.defineProperty(Vue.prototype, '$data', dataDef);
4921
- Object.defineProperty(Vue.prototype, '$props', propsDef);
4922
-
4923
- Vue.prototype.$set = set;
4924
- Vue.prototype.$delete = del;
4925
-
4926
- Vue.prototype.$watch = function (
4927
- expOrFn,
4928
- cb,
4929
- options
4930
- ) {
4931
- var vm = this;
4932
- if (isPlainObject(cb)) {
4933
- return createWatcher(vm, expOrFn, cb, options)
4934
- }
4935
- options = options || {};
4936
- options.user = true;
4937
- var watcher = new Watcher(vm, expOrFn, cb, options);
4938
- if (options.immediate) {
4939
- try {
4940
- cb.call(vm, watcher.value);
4941
- } catch (error) {
4942
- handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4943
- }
4944
- }
4945
- return function unwatchFn () {
4946
- watcher.teardown();
4947
- }
4948
- };
4949
- }
4950
-
4951
- /* */
4952
-
4953
- var uid$3 = 0;
4954
-
4955
- function initMixin (Vue) {
4956
- Vue.prototype._init = function (options) {
4957
- var vm = this;
4958
- // a uid
4959
- vm._uid = uid$3++;
4960
-
4961
- var startTag, endTag;
4962
- /* istanbul ignore if */
4963
- if (config.performance && mark) {
4964
- startTag = "vue-perf-start:" + (vm._uid);
4965
- endTag = "vue-perf-end:" + (vm._uid);
4966
- mark(startTag);
4967
- }
4968
-
4969
- // a flag to avoid this being observed
4970
- vm._isVue = true;
4971
- // merge options
4972
- if (options && options._isComponent) {
4973
- // optimize internal component instantiation
4974
- // since dynamic options merging is pretty slow, and none of the
4975
- // internal component options needs special treatment.
4976
- initInternalComponent(vm, options);
4977
- } else {
4978
- vm.$options = mergeOptions(
4979
- resolveConstructorOptions(vm.constructor),
4980
- options || {},
4981
- vm
4982
- );
4983
- }
4984
- /* istanbul ignore else */
4985
- {
4986
- initProxy(vm);
4987
- }
4988
- // expose real self
4989
- vm._self = vm;
4990
- initLifecycle(vm);
4991
- initEvents(vm);
4992
- initRender(vm);
4993
- callHook(vm, 'beforeCreate');
4994
- initInjections(vm); // resolve injections before data/props
4995
- initState(vm);
4996
- initProvide(vm); // resolve provide after data/props
4997
- callHook(vm, 'created');
4998
-
4999
- /* istanbul ignore if */
5000
- if (config.performance && mark) {
5001
- vm._name = formatComponentName(vm, false);
5002
- mark(endTag);
5003
- measure(("vue " + (vm._name) + " init"), startTag, endTag);
5004
- }
5005
-
5006
- if (vm.$options.el) {
5007
- vm.$mount(vm.$options.el);
5008
- }
5009
- };
5010
- }
5011
-
5012
- function initInternalComponent (vm, options) {
5013
- var opts = vm.$options = Object.create(vm.constructor.options);
5014
- // doing this because it's faster than dynamic enumeration.
5015
- var parentVnode = options._parentVnode;
5016
- opts.parent = options.parent;
5017
- opts._parentVnode = parentVnode;
5018
-
5019
- var vnodeComponentOptions = parentVnode.componentOptions;
5020
- opts.propsData = vnodeComponentOptions.propsData;
5021
- opts._parentListeners = vnodeComponentOptions.listeners;
5022
- opts._renderChildren = vnodeComponentOptions.children;
5023
- opts._componentTag = vnodeComponentOptions.tag;
5024
-
5025
- if (options.render) {
5026
- opts.render = options.render;
5027
- opts.staticRenderFns = options.staticRenderFns;
5028
- }
5029
- }
5030
-
5031
- function resolveConstructorOptions (Ctor) {
5032
- var options = Ctor.options;
5033
- if (Ctor.super) {
5034
- var superOptions = resolveConstructorOptions(Ctor.super);
5035
- var cachedSuperOptions = Ctor.superOptions;
5036
- if (superOptions !== cachedSuperOptions) {
5037
- // super option changed,
5038
- // need to resolve new options.
5039
- Ctor.superOptions = superOptions;
5040
- // check if there are any late-modified/attached options (#4976)
5041
- var modifiedOptions = resolveModifiedOptions(Ctor);
5042
- // update base extend options
5043
- if (modifiedOptions) {
5044
- extend(Ctor.extendOptions, modifiedOptions);
5045
- }
5046
- options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5047
- if (options.name) {
5048
- options.components[options.name] = Ctor;
5049
- }
5050
- }
5051
- }
5052
- return options
5053
- }
5054
-
5055
- function resolveModifiedOptions (Ctor) {
5056
- var modified;
5057
- var latest = Ctor.options;
5058
- var sealed = Ctor.sealedOptions;
5059
- for (var key in latest) {
5060
- if (latest[key] !== sealed[key]) {
5061
- if (!modified) { modified = {}; }
5062
- modified[key] = latest[key];
5063
- }
5064
- }
5065
- return modified
5066
- }
5067
-
5068
- function Vue (options) {
5069
- if (!(this instanceof Vue)
5070
- ) {
5071
- warn('Vue is a constructor and should be called with the `new` keyword');
5072
- }
5073
- this._init(options);
5074
- }
5075
-
5076
- initMixin(Vue);
5077
- stateMixin(Vue);
5078
- eventsMixin(Vue);
5079
- lifecycleMixin(Vue);
5080
- renderMixin(Vue);
5081
-
5082
- /* */
5083
-
5084
- function initUse (Vue) {
5085
- Vue.use = function (plugin) {
5086
- var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
5087
- if (installedPlugins.indexOf(plugin) > -1) {
5088
- return this
5089
- }
5090
-
5091
- // additional parameters
5092
- var args = toArray(arguments, 1);
5093
- args.unshift(this);
5094
- if (typeof plugin.install === 'function') {
5095
- plugin.install.apply(plugin, args);
5096
- } else if (typeof plugin === 'function') {
5097
- plugin.apply(null, args);
5098
- }
5099
- installedPlugins.push(plugin);
5100
- return this
5101
- };
5102
- }
5103
-
5104
- /* */
5105
-
5106
- function initMixin$1 (Vue) {
5107
- Vue.mixin = function (mixin) {
5108
- this.options = mergeOptions(this.options, mixin);
5109
- return this
5110
- };
5111
- }
5112
-
5113
- /* */
5114
-
5115
- function initExtend (Vue) {
5116
- /**
5117
- * Each instance constructor, including Vue, has a unique
5118
- * cid. This enables us to create wrapped "child
5119
- * constructors" for prototypal inheritance and cache them.
5120
- */
5121
- Vue.cid = 0;
5122
- var cid = 1;
5123
-
5124
- /**
5125
- * Class inheritance
5126
- */
5127
- Vue.extend = function (extendOptions) {
5128
- extendOptions = extendOptions || {};
5129
- var Super = this;
5130
- var SuperId = Super.cid;
5131
- var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5132
- if (cachedCtors[SuperId]) {
5133
- return cachedCtors[SuperId]
5134
- }
5135
-
5136
- var name = extendOptions.name || Super.options.name;
5137
- if (name) {
5138
- validateComponentName(name);
5139
- }
5140
-
5141
- var Sub = function VueComponent (options) {
5142
- this._init(options);
5143
- };
5144
- Sub.prototype = Object.create(Super.prototype);
5145
- Sub.prototype.constructor = Sub;
5146
- Sub.cid = cid++;
5147
- Sub.options = mergeOptions(
5148
- Super.options,
5149
- extendOptions
5150
- );
5151
- Sub['super'] = Super;
5152
-
5153
- // For props and computed properties, we define the proxy getters on
5154
- // the Vue instances at extension time, on the extended prototype. This
5155
- // avoids Object.defineProperty calls for each instance created.
5156
- if (Sub.options.props) {
5157
- initProps$1(Sub);
5158
- }
5159
- if (Sub.options.computed) {
5160
- initComputed$1(Sub);
5161
- }
5162
-
5163
- // allow further extension/mixin/plugin usage
5164
- Sub.extend = Super.extend;
5165
- Sub.mixin = Super.mixin;
5166
- Sub.use = Super.use;
5167
-
5168
- // create asset registers, so extended classes
5169
- // can have their private assets too.
5170
- ASSET_TYPES.forEach(function (type) {
5171
- Sub[type] = Super[type];
5172
- });
5173
- // enable recursive self-lookup
5174
- if (name) {
5175
- Sub.options.components[name] = Sub;
5176
- }
5177
-
5178
- // keep a reference to the super options at extension time.
5179
- // later at instantiation we can check if Super's options have
5180
- // been updated.
5181
- Sub.superOptions = Super.options;
5182
- Sub.extendOptions = extendOptions;
5183
- Sub.sealedOptions = extend({}, Sub.options);
5184
-
5185
- // cache constructor
5186
- cachedCtors[SuperId] = Sub;
5187
- return Sub
5188
- };
5189
- }
5190
-
5191
- function initProps$1 (Comp) {
5192
- var props = Comp.options.props;
5193
- for (var key in props) {
5194
- proxy(Comp.prototype, "_props", key);
5195
- }
5196
- }
5197
-
5198
- function initComputed$1 (Comp) {
5199
- var computed = Comp.options.computed;
5200
- for (var key in computed) {
5201
- defineComputed(Comp.prototype, key, computed[key]);
5202
- }
5203
- }
5204
-
5205
- /* */
5206
-
5207
- function initAssetRegisters (Vue) {
5208
- /**
5209
- * Create asset registration methods.
5210
- */
5211
- ASSET_TYPES.forEach(function (type) {
5212
- Vue[type] = function (
5213
- id,
5214
- definition
5215
- ) {
5216
- if (!definition) {
5217
- return this.options[type + 's'][id]
5218
- } else {
5219
- /* istanbul ignore if */
5220
- if (type === 'component') {
5221
- validateComponentName(id);
5222
- }
5223
- if (type === 'component' && isPlainObject(definition)) {
5224
- definition.name = definition.name || id;
5225
- definition = this.options._base.extend(definition);
5226
- }
5227
- if (type === 'directive' && typeof definition === 'function') {
5228
- definition = { bind: definition, update: definition };
5229
- }
5230
- this.options[type + 's'][id] = definition;
5231
- return definition
5232
- }
5233
- };
5234
- });
5235
- }
5236
-
5237
- /* */
5238
-
5239
-
5240
-
5241
- function getComponentName (opts) {
5242
- return opts && (opts.Ctor.options.name || opts.tag)
5243
- }
5244
-
5245
- function matches (pattern, name) {
5246
- if (Array.isArray(pattern)) {
5247
- return pattern.indexOf(name) > -1
5248
- } else if (typeof pattern === 'string') {
5249
- return pattern.split(',').indexOf(name) > -1
5250
- } else if (isRegExp(pattern)) {
5251
- return pattern.test(name)
5252
- }
5253
- /* istanbul ignore next */
5254
- return false
5255
- }
5256
-
5257
- function pruneCache (keepAliveInstance, filter) {
5258
- var cache = keepAliveInstance.cache;
5259
- var keys = keepAliveInstance.keys;
5260
- var _vnode = keepAliveInstance._vnode;
5261
- for (var key in cache) {
5262
- var cachedNode = cache[key];
5263
- if (cachedNode) {
5264
- var name = getComponentName(cachedNode.componentOptions);
5265
- if (name && !filter(name)) {
5266
- pruneCacheEntry(cache, key, keys, _vnode);
5267
- }
5268
- }
5269
- }
5270
- }
5271
-
5272
- function pruneCacheEntry (
5273
- cache,
5274
- key,
5275
- keys,
5276
- current
5277
- ) {
5278
- var cached$$1 = cache[key];
5279
- if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5280
- cached$$1.componentInstance.$destroy();
5281
- }
5282
- cache[key] = null;
5283
- remove(keys, key);
5284
- }
5285
-
5286
- var patternTypes = [String, RegExp, Array];
5287
-
5288
- var KeepAlive = {
5289
- name: 'keep-alive',
5290
- abstract: true,
5291
-
5292
- props: {
5293
- include: patternTypes,
5294
- exclude: patternTypes,
5295
- max: [String, Number]
5296
- },
5297
-
5298
- created: function created () {
5299
- this.cache = Object.create(null);
5300
- this.keys = [];
5301
- },
5302
-
5303
- destroyed: function destroyed () {
5304
- for (var key in this.cache) {
5305
- pruneCacheEntry(this.cache, key, this.keys);
5306
- }
5307
- },
5308
-
5309
- mounted: function mounted () {
5310
- var this$1 = this;
5311
-
5312
- this.$watch('include', function (val) {
5313
- pruneCache(this$1, function (name) { return matches(val, name); });
5314
- });
5315
- this.$watch('exclude', function (val) {
5316
- pruneCache(this$1, function (name) { return !matches(val, name); });
5317
- });
5318
- },
5319
-
5320
- render: function render () {
5321
- var slot = this.$slots.default;
5322
- var vnode = getFirstComponentChild(slot);
5323
- var componentOptions = vnode && vnode.componentOptions;
5324
- if (componentOptions) {
5325
- // check pattern
5326
- var name = getComponentName(componentOptions);
5327
- var ref = this;
5328
- var include = ref.include;
5329
- var exclude = ref.exclude;
5330
- if (
5331
- // not included
5332
- (include && (!name || !matches(include, name))) ||
5333
- // excluded
5334
- (exclude && name && matches(exclude, name))
5335
- ) {
5336
- return vnode
5337
- }
5338
-
5339
- var ref$1 = this;
5340
- var cache = ref$1.cache;
5341
- var keys = ref$1.keys;
5342
- var key = vnode.key == null
5343
- // same constructor may get registered as different local components
5344
- // so cid alone is not enough (#3269)
5345
- ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
5346
- : vnode.key;
5347
- if (cache[key]) {
5348
- vnode.componentInstance = cache[key].componentInstance;
5349
- // make current key freshest
5350
- remove(keys, key);
5351
- keys.push(key);
5352
- } else {
5353
- cache[key] = vnode;
5354
- keys.push(key);
5355
- // prune oldest entry
5356
- if (this.max && keys.length > parseInt(this.max)) {
5357
- pruneCacheEntry(cache, keys[0], keys, this._vnode);
5358
- }
5359
- }
5360
-
5361
- vnode.data.keepAlive = true;
5362
- }
5363
- return vnode || (slot && slot[0])
5364
- }
5365
- };
5366
-
5367
- var builtInComponents = {
5368
- KeepAlive: KeepAlive
5369
- };
5370
-
5371
- /* */
5372
-
5373
- function initGlobalAPI (Vue) {
5374
- // config
5375
- var configDef = {};
5376
- configDef.get = function () { return config; };
5377
- {
5378
- configDef.set = function () {
5379
- warn(
5380
- 'Do not replace the Vue.config object, set individual fields instead.'
5381
- );
5382
- };
5383
- }
5384
- Object.defineProperty(Vue, 'config', configDef);
5385
-
5386
- // exposed util methods.
5387
- // NOTE: these are not considered part of the public API - avoid relying on
5388
- // them unless you are aware of the risk.
5389
- Vue.util = {
5390
- warn: warn,
5391
- extend: extend,
5392
- mergeOptions: mergeOptions,
5393
- defineReactive: defineReactive$$1
5394
- };
5395
-
5396
- Vue.set = set;
5397
- Vue.delete = del;
5398
- Vue.nextTick = nextTick;
5399
-
5400
- // 2.6 explicit observable API
5401
- Vue.observable = function (obj) {
5402
- observe(obj);
5403
- return obj
5404
- };
5405
-
5406
- Vue.options = Object.create(null);
5407
- ASSET_TYPES.forEach(function (type) {
5408
- Vue.options[type + 's'] = Object.create(null);
5409
- });
5410
-
5411
- // this is used to identify the "base" constructor to extend all plain-object
5412
- // components with in Weex's multi-instance scenarios.
5413
- Vue.options._base = Vue;
5414
-
5415
- extend(Vue.options.components, builtInComponents);
5416
-
5417
- initUse(Vue);
5418
- initMixin$1(Vue);
5419
- initExtend(Vue);
5420
- initAssetRegisters(Vue);
5421
- }
5422
-
5423
- initGlobalAPI(Vue);
5424
-
5425
- Object.defineProperty(Vue.prototype, '$isServer', {
5426
- get: isServerRendering
5427
- });
5428
-
5429
- Object.defineProperty(Vue.prototype, '$ssrContext', {
5430
- get: function get () {
5431
- /* istanbul ignore next */
5432
- return this.$vnode && this.$vnode.ssrContext
5433
- }
5434
- });
5435
-
5436
- // expose FunctionalRenderContext for ssr runtime helper installation
5437
- Object.defineProperty(Vue, 'FunctionalRenderContext', {
5438
- value: FunctionalRenderContext
5439
- });
5440
-
5441
- Vue.version = '2.6.10';
5442
-
5443
- /* */
5444
-
5445
- // these are reserved for web because they are directly compiled away
5446
- // during template compilation
5447
- var isReservedAttr = makeMap('style,class');
5448
-
5449
- // attributes that should be using props for binding
5450
- var acceptValue = makeMap('input,textarea,option,select,progress');
5451
- var mustUseProp = function (tag, type, attr) {
5452
- return (
5453
- (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
5454
- (attr === 'selected' && tag === 'option') ||
5455
- (attr === 'checked' && tag === 'input') ||
5456
- (attr === 'muted' && tag === 'video')
5457
- )
5458
- };
5459
-
5460
- var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5461
-
5462
- var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5463
-
5464
- var convertEnumeratedValue = function (key, value) {
5465
- return isFalsyAttrValue(value) || value === 'false'
5466
- ? 'false'
5467
- // allow arbitrary string value for contenteditable
5468
- : key === 'contenteditable' && isValidContentEditableValue(value)
5469
- ? value
5470
- : 'true'
5471
- };
5472
-
5473
- var isBooleanAttr = makeMap(
5474
- 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
5475
- 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5476
- 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5477
- 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5478
- 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5479
- 'truespeed,typemustmatch,visible'
5480
- );
5481
-
5482
- var xlinkNS = 'http://www.w3.org/1999/xlink';
5483
-
5484
- var isXlink = function (name) {
5485
- return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
5486
- };
5487
-
5488
- var getXlinkProp = function (name) {
5489
- return isXlink(name) ? name.slice(6, name.length) : ''
5490
- };
5491
-
5492
- var isFalsyAttrValue = function (val) {
5493
- return val == null || val === false
5494
- };
5495
-
5496
- /* */
5497
-
5498
- function genClassForVnode (vnode) {
5499
- var data = vnode.data;
5500
- var parentNode = vnode;
5501
- var childNode = vnode;
5502
- while (isDef(childNode.componentInstance)) {
5503
- childNode = childNode.componentInstance._vnode;
5504
- if (childNode && childNode.data) {
5505
- data = mergeClassData(childNode.data, data);
5506
- }
5507
- }
5508
- while (isDef(parentNode = parentNode.parent)) {
5509
- if (parentNode && parentNode.data) {
5510
- data = mergeClassData(data, parentNode.data);
5511
- }
5512
- }
5513
- return renderClass(data.staticClass, data.class)
5514
- }
5515
-
5516
- function mergeClassData (child, parent) {
5517
- return {
5518
- staticClass: concat(child.staticClass, parent.staticClass),
5519
- class: isDef(child.class)
5520
- ? [child.class, parent.class]
5521
- : parent.class
5522
- }
5523
- }
5524
-
5525
- function renderClass (
5526
- staticClass,
5527
- dynamicClass
5528
- ) {
5529
- if (isDef(staticClass) || isDef(dynamicClass)) {
5530
- return concat(staticClass, stringifyClass(dynamicClass))
5531
- }
5532
- /* istanbul ignore next */
5533
- return ''
5534
- }
5535
-
5536
- function concat (a, b) {
5537
- return a ? b ? (a + ' ' + b) : a : (b || '')
5538
- }
5539
-
5540
- function stringifyClass (value) {
5541
- if (Array.isArray(value)) {
5542
- return stringifyArray(value)
5543
- }
5544
- if (isObject(value)) {
5545
- return stringifyObject(value)
5546
- }
5547
- if (typeof value === 'string') {
5548
- return value
5549
- }
5550
- /* istanbul ignore next */
5551
- return ''
5552
- }
5553
-
5554
- function stringifyArray (value) {
5555
- var res = '';
5556
- var stringified;
5557
- for (var i = 0, l = value.length; i < l; i++) {
5558
- if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5559
- if (res) { res += ' '; }
5560
- res += stringified;
5561
- }
5562
- }
5563
- return res
5564
- }
5565
-
5566
- function stringifyObject (value) {
5567
- var res = '';
5568
- for (var key in value) {
5569
- if (value[key]) {
5570
- if (res) { res += ' '; }
5571
- res += key;
5572
- }
5573
- }
5574
- return res
5575
- }
5576
-
5577
- /* */
5578
-
5579
- var namespaceMap = {
5580
- svg: 'http://www.w3.org/2000/svg',
5581
- math: 'http://www.w3.org/1998/Math/MathML'
5582
- };
5583
-
5584
- var isHTMLTag = makeMap(
5585
- 'html,body,base,head,link,meta,style,title,' +
5586
- 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
5587
- 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
5588
- 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
5589
- 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
5590
- 'embed,object,param,source,canvas,script,noscript,del,ins,' +
5591
- 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
5592
- 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
5593
- 'output,progress,select,textarea,' +
5594
- 'details,dialog,menu,menuitem,summary,' +
5595
- 'content,element,shadow,template,blockquote,iframe,tfoot'
5596
- );
5597
-
5598
- // this map is intentionally selective, only covering SVG elements that may
5599
- // contain child elements.
5600
- var isSVG = makeMap(
5601
- 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5602
- 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5603
- 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5604
- true
5605
- );
5606
-
5607
- var isPreTag = function (tag) { return tag === 'pre'; };
5608
-
5609
- var isReservedTag = function (tag) {
5610
- return isHTMLTag(tag) || isSVG(tag)
5611
- };
5612
-
5613
- function getTagNamespace (tag) {
5614
- if (isSVG(tag)) {
5615
- return 'svg'
5616
- }
5617
- // basic support for MathML
5618
- // note it doesn't support other MathML elements being component roots
5619
- if (tag === 'math') {
5620
- return 'math'
5621
- }
5622
- }
5623
-
5624
- var unknownElementCache = Object.create(null);
5625
- function isUnknownElement (tag) {
5626
- /* istanbul ignore if */
5627
- if (!inBrowser) {
5628
- return true
5629
- }
5630
- if (isReservedTag(tag)) {
5631
- return false
5632
- }
5633
- tag = tag.toLowerCase();
5634
- /* istanbul ignore if */
5635
- if (unknownElementCache[tag] != null) {
5636
- return unknownElementCache[tag]
5637
- }
5638
- var el = document.createElement(tag);
5639
- if (tag.indexOf('-') > -1) {
5640
- // http://stackoverflow.com/a/28210364/1070244
5641
- return (unknownElementCache[tag] = (
5642
- el.constructor === window.HTMLUnknownElement ||
5643
- el.constructor === window.HTMLElement
5644
- ))
5645
- } else {
5646
- return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
5647
- }
5648
- }
5649
-
5650
- var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5651
-
5652
- /* */
5653
-
5654
- /**
5655
- * Query an element selector if it's not an element already.
5656
- */
5657
- function query (el) {
5658
- if (typeof el === 'string') {
5659
- var selected = document.querySelector(el);
5660
- if (!selected) {
5661
- warn(
5662
- 'Cannot find element: ' + el
5663
- );
5664
- return document.createElement('div')
5665
- }
5666
- return selected
5667
- } else {
5668
- return el
5669
- }
5670
- }
5671
-
5672
- /* */
5673
-
5674
- function createElement$1 (tagName, vnode) {
5675
- var elm = document.createElement(tagName);
5676
- if (tagName !== 'select') {
5677
- return elm
5678
- }
5679
- // false or null will remove the attribute but undefined will not
5680
- if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5681
- elm.setAttribute('multiple', 'multiple');
5682
- }
5683
- return elm
5684
- }
5685
-
5686
- function createElementNS (namespace, tagName) {
5687
- return document.createElementNS(namespaceMap[namespace], tagName)
5688
- }
5689
-
5690
- function createTextNode (text) {
5691
- return document.createTextNode(text)
5692
- }
5693
-
5694
- function createComment (text) {
5695
- return document.createComment(text)
5696
- }
5697
-
5698
- function insertBefore (parentNode, newNode, referenceNode) {
5699
- parentNode.insertBefore(newNode, referenceNode);
5700
- }
5701
-
5702
- function removeChild (node, child) {
5703
- node.removeChild(child);
5704
- }
5705
-
5706
- function appendChild (node, child) {
5707
- node.appendChild(child);
5708
- }
5709
-
5710
- function parentNode (node) {
5711
- return node.parentNode
5712
- }
5713
-
5714
- function nextSibling (node) {
5715
- return node.nextSibling
5716
- }
5717
-
5718
- function tagName (node) {
5719
- return node.tagName
5720
- }
5721
-
5722
- function setTextContent (node, text) {
5723
- node.textContent = text;
5724
- }
5725
-
5726
- function setStyleScope (node, scopeId) {
5727
- node.setAttribute(scopeId, '');
5728
- }
5729
-
5730
- var nodeOps = /*#__PURE__*/Object.freeze({
5731
- createElement: createElement$1,
5732
- createElementNS: createElementNS,
5733
- createTextNode: createTextNode,
5734
- createComment: createComment,
5735
- insertBefore: insertBefore,
5736
- removeChild: removeChild,
5737
- appendChild: appendChild,
5738
- parentNode: parentNode,
5739
- nextSibling: nextSibling,
5740
- tagName: tagName,
5741
- setTextContent: setTextContent,
5742
- setStyleScope: setStyleScope
5743
- });
5744
-
5745
- /* */
5746
-
5747
- var ref = {
5748
- create: function create (_, vnode) {
5749
- registerRef(vnode);
5750
- },
5751
- update: function update (oldVnode, vnode) {
5752
- if (oldVnode.data.ref !== vnode.data.ref) {
5753
- registerRef(oldVnode, true);
5754
- registerRef(vnode);
5755
- }
5756
- },
5757
- destroy: function destroy (vnode) {
5758
- registerRef(vnode, true);
5759
- }
5760
- };
5761
-
5762
- function registerRef (vnode, isRemoval) {
5763
- var key = vnode.data.ref;
5764
- if (!isDef(key)) { return }
5765
-
5766
- var vm = vnode.context;
5767
- var ref = vnode.componentInstance || vnode.elm;
5768
- var refs = vm.$refs;
5769
- if (isRemoval) {
5770
- if (Array.isArray(refs[key])) {
5771
- remove(refs[key], ref);
5772
- } else if (refs[key] === ref) {
5773
- refs[key] = undefined;
5774
- }
5775
- } else {
5776
- if (vnode.data.refInFor) {
5777
- if (!Array.isArray(refs[key])) {
5778
- refs[key] = [ref];
5779
- } else if (refs[key].indexOf(ref) < 0) {
5780
- // $flow-disable-line
5781
- refs[key].push(ref);
5782
- }
5783
- } else {
5784
- refs[key] = ref;
5785
- }
5786
- }
5787
- }
5788
-
5789
- /**
5790
- * Virtual DOM patching algorithm based on Snabbdom by
5791
- * Simon Friis Vindum (@paldepind)
5792
- * Licensed under the MIT License
5793
- * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5794
- *
5795
- * modified by Evan You (@yyx990803)
5796
- *
5797
- * Not type-checking this because this file is perf-critical and the cost
5798
- * of making flow understand it is not worth it.
5799
- */
5800
-
5801
- var emptyNode = new VNode('', {}, []);
5802
-
5803
- var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5804
-
5805
- function sameVnode (a, b) {
5806
- return (
5807
- a.key === b.key && (
5808
- (
5809
- a.tag === b.tag &&
5810
- a.isComment === b.isComment &&
5811
- isDef(a.data) === isDef(b.data) &&
5812
- sameInputType(a, b)
5813
- ) || (
5814
- isTrue(a.isAsyncPlaceholder) &&
5815
- a.asyncFactory === b.asyncFactory &&
5816
- isUndef(b.asyncFactory.error)
5817
- )
5818
- )
5819
- )
5820
- }
5821
-
5822
- function sameInputType (a, b) {
5823
- if (a.tag !== 'input') { return true }
5824
- var i;
5825
- var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5826
- var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5827
- return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
5828
- }
5829
-
5830
- function createKeyToOldIdx (children, beginIdx, endIdx) {
5831
- var i, key;
5832
- var map = {};
5833
- for (i = beginIdx; i <= endIdx; ++i) {
5834
- key = children[i].key;
5835
- if (isDef(key)) { map[key] = i; }
5836
- }
5837
- return map
5838
- }
5839
-
5840
- function createPatchFunction (backend) {
5841
- var i, j;
5842
- var cbs = {};
5843
-
5844
- var modules = backend.modules;
5845
- var nodeOps = backend.nodeOps;
5846
-
5847
- for (i = 0; i < hooks.length; ++i) {
5848
- cbs[hooks[i]] = [];
5849
- for (j = 0; j < modules.length; ++j) {
5850
- if (isDef(modules[j][hooks[i]])) {
5851
- cbs[hooks[i]].push(modules[j][hooks[i]]);
5852
- }
5853
- }
5854
- }
5855
-
5856
- function emptyNodeAt (elm) {
5857
- return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
5858
- }
5859
-
5860
- function createRmCb (childElm, listeners) {
5861
- function remove$$1 () {
5862
- if (--remove$$1.listeners === 0) {
5863
- removeNode(childElm);
5864
- }
5865
- }
5866
- remove$$1.listeners = listeners;
5867
- return remove$$1
5868
- }
5869
-
5870
- function removeNode (el) {
5871
- var parent = nodeOps.parentNode(el);
5872
- // element may have already been removed due to v-html / v-text
5873
- if (isDef(parent)) {
5874
- nodeOps.removeChild(parent, el);
5875
- }
5876
- }
5877
-
5878
- function isUnknownElement$$1 (vnode, inVPre) {
5879
- return (
5880
- !inVPre &&
5881
- !vnode.ns &&
5882
- !(
5883
- config.ignoredElements.length &&
5884
- config.ignoredElements.some(function (ignore) {
5885
- return isRegExp(ignore)
5886
- ? ignore.test(vnode.tag)
5887
- : ignore === vnode.tag
5888
- })
5889
- ) &&
5890
- config.isUnknownElement(vnode.tag)
5891
- )
5892
- }
5893
-
5894
- var creatingElmInVPre = 0;
5895
-
5896
- function createElm (
5897
- vnode,
5898
- insertedVnodeQueue,
5899
- parentElm,
5900
- refElm,
5901
- nested,
5902
- ownerArray,
5903
- index
5904
- ) {
5905
- if (isDef(vnode.elm) && isDef(ownerArray)) {
5906
- // This vnode was used in a previous render!
5907
- // now it's used as a new node, overwriting its elm would cause
5908
- // potential patch errors down the road when it's used as an insertion
5909
- // reference node. Instead, we clone the node on-demand before creating
5910
- // associated DOM element for it.
5911
- vnode = ownerArray[index] = cloneVNode(vnode);
5912
- }
5913
-
5914
- vnode.isRootInsert = !nested; // for transition enter check
5915
- if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
5916
- return
5917
- }
5918
-
5919
- var data = vnode.data;
5920
- var children = vnode.children;
5921
- var tag = vnode.tag;
5922
- if (isDef(tag)) {
5923
- {
5924
- if (data && data.pre) {
5925
- creatingElmInVPre++;
5926
- }
5927
- if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
5928
- warn(
5929
- 'Unknown custom element: <' + tag + '> - did you ' +
5930
- 'register the component correctly? For recursive components, ' +
5931
- 'make sure to provide the "name" option.',
5932
- vnode.context
5933
- );
5934
- }
5935
- }
5936
-
5937
- vnode.elm = vnode.ns
5938
- ? nodeOps.createElementNS(vnode.ns, tag)
5939
- : nodeOps.createElement(tag, vnode);
5940
- setScope(vnode);
5941
-
5942
- /* istanbul ignore if */
5943
- {
5944
- createChildren(vnode, children, insertedVnodeQueue);
5945
- if (isDef(data)) {
5946
- invokeCreateHooks(vnode, insertedVnodeQueue);
5947
- }
5948
- insert(parentElm, vnode.elm, refElm);
5949
- }
5950
-
5951
- if (data && data.pre) {
5952
- creatingElmInVPre--;
5953
- }
5954
- } else if (isTrue(vnode.isComment)) {
5955
- vnode.elm = nodeOps.createComment(vnode.text);
5956
- insert(parentElm, vnode.elm, refElm);
5957
- } else {
5958
- vnode.elm = nodeOps.createTextNode(vnode.text);
5959
- insert(parentElm, vnode.elm, refElm);
5960
- }
5961
- }
5962
-
5963
- function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
5964
- var i = vnode.data;
5965
- if (isDef(i)) {
5966
- var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
5967
- if (isDef(i = i.hook) && isDef(i = i.init)) {
5968
- i(vnode, false /* hydrating */);
5969
- }
5970
- // after calling the init hook, if the vnode is a child component
5971
- // it should've created a child instance and mounted it. the child
5972
- // component also has set the placeholder vnode's elm.
5973
- // in that case we can just return the element and be done.
5974
- if (isDef(vnode.componentInstance)) {
5975
- initComponent(vnode, insertedVnodeQueue);
5976
- insert(parentElm, vnode.elm, refElm);
5977
- if (isTrue(isReactivated)) {
5978
- reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
5979
- }
5980
- return true
5981
- }
5982
- }
5983
- }
5984
-
5985
- function initComponent (vnode, insertedVnodeQueue) {
5986
- if (isDef(vnode.data.pendingInsert)) {
5987
- insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5988
- vnode.data.pendingInsert = null;
5989
- }
5990
- vnode.elm = vnode.componentInstance.$el;
5991
- if (isPatchable(vnode)) {
5992
- invokeCreateHooks(vnode, insertedVnodeQueue);
5993
- setScope(vnode);
5994
- } else {
5995
- // empty component root.
5996
- // skip all element-related modules except for ref (#3455)
5997
- registerRef(vnode);
5998
- // make sure to invoke the insert hook
5999
- insertedVnodeQueue.push(vnode);
6000
- }
6001
- }
6002
-
6003
- function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
6004
- var i;
6005
- // hack for #4339: a reactivated component with inner transition
6006
- // does not trigger because the inner node's created hooks are not called
6007
- // again. It's not ideal to involve module-specific logic in here but
6008
- // there doesn't seem to be a better way to do it.
6009
- var innerNode = vnode;
6010
- while (innerNode.componentInstance) {
6011
- innerNode = innerNode.componentInstance._vnode;
6012
- if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6013
- for (i = 0; i < cbs.activate.length; ++i) {
6014
- cbs.activate[i](emptyNode, innerNode);
6015
- }
6016
- insertedVnodeQueue.push(innerNode);
6017
- break
6018
- }
6019
- }
6020
- // unlike a newly created component,
6021
- // a reactivated keep-alive component doesn't insert itself
6022
- insert(parentElm, vnode.elm, refElm);
6023
- }
6024
-
6025
- function insert (parent, elm, ref$$1) {
6026
- if (isDef(parent)) {
6027
- if (isDef(ref$$1)) {
6028
- if (nodeOps.parentNode(ref$$1) === parent) {
6029
- nodeOps.insertBefore(parent, elm, ref$$1);
6030
- }
6031
- } else {
6032
- nodeOps.appendChild(parent, elm);
6033
- }
6034
- }
6035
- }
6036
-
6037
- function createChildren (vnode, children, insertedVnodeQueue) {
6038
- if (Array.isArray(children)) {
6039
- {
6040
- checkDuplicateKeys(children);
6041
- }
6042
- for (var i = 0; i < children.length; ++i) {
6043
- createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6044
- }
6045
- } else if (isPrimitive(vnode.text)) {
6046
- nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6047
- }
6048
- }
6049
-
6050
- function isPatchable (vnode) {
6051
- while (vnode.componentInstance) {
6052
- vnode = vnode.componentInstance._vnode;
6053
- }
6054
- return isDef(vnode.tag)
6055
- }
6056
-
6057
- function invokeCreateHooks (vnode, insertedVnodeQueue) {
6058
- for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6059
- cbs.create[i$1](emptyNode, vnode);
6060
- }
6061
- i = vnode.data.hook; // Reuse variable
6062
- if (isDef(i)) {
6063
- if (isDef(i.create)) { i.create(emptyNode, vnode); }
6064
- if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
6065
- }
6066
- }
6067
-
6068
- // set scope id attribute for scoped CSS.
6069
- // this is implemented as a special case to avoid the overhead
6070
- // of going through the normal attribute patching process.
6071
- function setScope (vnode) {
6072
- var i;
6073
- if (isDef(i = vnode.fnScopeId)) {
6074
- nodeOps.setStyleScope(vnode.elm, i);
6075
- } else {
6076
- var ancestor = vnode;
6077
- while (ancestor) {
6078
- if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6079
- nodeOps.setStyleScope(vnode.elm, i);
6080
- }
6081
- ancestor = ancestor.parent;
6082
- }
6083
- }
6084
- // for slot content they should also get the scopeId from the host instance.
6085
- if (isDef(i = activeInstance) &&
6086
- i !== vnode.context &&
6087
- i !== vnode.fnContext &&
6088
- isDef(i = i.$options._scopeId)
6089
- ) {
6090
- nodeOps.setStyleScope(vnode.elm, i);
6091
- }
6092
- }
6093
-
6094
- function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6095
- for (; startIdx <= endIdx; ++startIdx) {
6096
- createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6097
- }
6098
- }
6099
-
6100
- function invokeDestroyHook (vnode) {
6101
- var i, j;
6102
- var data = vnode.data;
6103
- if (isDef(data)) {
6104
- if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
6105
- for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
6106
- }
6107
- if (isDef(i = vnode.children)) {
6108
- for (j = 0; j < vnode.children.length; ++j) {
6109
- invokeDestroyHook(vnode.children[j]);
6110
- }
6111
- }
6112
- }
6113
-
6114
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6115
- for (; startIdx <= endIdx; ++startIdx) {
6116
- var ch = vnodes[startIdx];
6117
- if (isDef(ch)) {
6118
- if (isDef(ch.tag)) {
6119
- removeAndInvokeRemoveHook(ch);
6120
- invokeDestroyHook(ch);
6121
- } else { // Text node
6122
- removeNode(ch.elm);
6123
- }
6124
- }
6125
- }
6126
- }
6127
-
6128
- function removeAndInvokeRemoveHook (vnode, rm) {
6129
- if (isDef(rm) || isDef(vnode.data)) {
6130
- var i;
6131
- var listeners = cbs.remove.length + 1;
6132
- if (isDef(rm)) {
6133
- // we have a recursively passed down rm callback
6134
- // increase the listeners count
6135
- rm.listeners += listeners;
6136
- } else {
6137
- // directly removing
6138
- rm = createRmCb(vnode.elm, listeners);
6139
- }
6140
- // recursively invoke hooks on child component root node
6141
- if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6142
- removeAndInvokeRemoveHook(i, rm);
6143
- }
6144
- for (i = 0; i < cbs.remove.length; ++i) {
6145
- cbs.remove[i](vnode, rm);
6146
- }
6147
- if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6148
- i(vnode, rm);
6149
- } else {
6150
- rm();
6151
- }
6152
- } else {
6153
- removeNode(vnode.elm);
6154
- }
6155
- }
6156
-
6157
- function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6158
- var oldStartIdx = 0;
6159
- var newStartIdx = 0;
6160
- var oldEndIdx = oldCh.length - 1;
6161
- var oldStartVnode = oldCh[0];
6162
- var oldEndVnode = oldCh[oldEndIdx];
6163
- var newEndIdx = newCh.length - 1;
6164
- var newStartVnode = newCh[0];
6165
- var newEndVnode = newCh[newEndIdx];
6166
- var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
6167
-
6168
- // removeOnly is a special flag used only by <transition-group>
6169
- // to ensure removed elements stay in correct relative positions
6170
- // during leaving transitions
6171
- var canMove = !removeOnly;
6172
-
6173
- {
6174
- checkDuplicateKeys(newCh);
6175
- }
6176
-
6177
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6178
- if (isUndef(oldStartVnode)) {
6179
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6180
- } else if (isUndef(oldEndVnode)) {
6181
- oldEndVnode = oldCh[--oldEndIdx];
6182
- } else if (sameVnode(oldStartVnode, newStartVnode)) {
6183
- patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6184
- oldStartVnode = oldCh[++oldStartIdx];
6185
- newStartVnode = newCh[++newStartIdx];
6186
- } else if (sameVnode(oldEndVnode, newEndVnode)) {
6187
- patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6188
- oldEndVnode = oldCh[--oldEndIdx];
6189
- newEndVnode = newCh[--newEndIdx];
6190
- } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
6191
- patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6192
- canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6193
- oldStartVnode = oldCh[++oldStartIdx];
6194
- newEndVnode = newCh[--newEndIdx];
6195
- } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
6196
- patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6197
- canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6198
- oldEndVnode = oldCh[--oldEndIdx];
6199
- newStartVnode = newCh[++newStartIdx];
6200
- } else {
6201
- if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
6202
- idxInOld = isDef(newStartVnode.key)
6203
- ? oldKeyToIdx[newStartVnode.key]
6204
- : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6205
- if (isUndef(idxInOld)) { // New element
6206
- createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6207
- } else {
6208
- vnodeToMove = oldCh[idxInOld];
6209
- if (sameVnode(vnodeToMove, newStartVnode)) {
6210
- patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6211
- oldCh[idxInOld] = undefined;
6212
- canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6213
- } else {
6214
- // same key but different element. treat as new element
6215
- createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6216
- }
6217
- }
6218
- newStartVnode = newCh[++newStartIdx];
6219
- }
6220
- }
6221
- if (oldStartIdx > oldEndIdx) {
6222
- refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6223
- addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6224
- } else if (newStartIdx > newEndIdx) {
6225
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6226
- }
6227
- }
6228
-
6229
- function checkDuplicateKeys (children) {
6230
- var seenKeys = {};
6231
- for (var i = 0; i < children.length; i++) {
6232
- var vnode = children[i];
6233
- var key = vnode.key;
6234
- if (isDef(key)) {
6235
- if (seenKeys[key]) {
6236
- warn(
6237
- ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
6238
- vnode.context
6239
- );
6240
- } else {
6241
- seenKeys[key] = true;
6242
- }
6243
- }
6244
- }
6245
- }
6246
-
6247
- function findIdxInOld (node, oldCh, start, end) {
6248
- for (var i = start; i < end; i++) {
6249
- var c = oldCh[i];
6250
- if (isDef(c) && sameVnode(node, c)) { return i }
6251
- }
6252
- }
6253
-
6254
- function patchVnode (
6255
- oldVnode,
6256
- vnode,
6257
- insertedVnodeQueue,
6258
- ownerArray,
6259
- index,
6260
- removeOnly
6261
- ) {
6262
- if (oldVnode === vnode) {
6263
- return
6264
- }
6265
-
6266
- if (isDef(vnode.elm) && isDef(ownerArray)) {
6267
- // clone reused vnode
6268
- vnode = ownerArray[index] = cloneVNode(vnode);
6269
- }
6270
-
6271
- var elm = vnode.elm = oldVnode.elm;
6272
-
6273
- if (isTrue(oldVnode.isAsyncPlaceholder)) {
6274
- if (isDef(vnode.asyncFactory.resolved)) {
6275
- hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6276
- } else {
6277
- vnode.isAsyncPlaceholder = true;
6278
- }
6279
- return
6280
- }
6281
-
6282
- // reuse element for static trees.
6283
- // note we only do this if the vnode is cloned -
6284
- // if the new node is not cloned it means the render functions have been
6285
- // reset by the hot-reload-api and we need to do a proper re-render.
6286
- if (isTrue(vnode.isStatic) &&
6287
- isTrue(oldVnode.isStatic) &&
6288
- vnode.key === oldVnode.key &&
6289
- (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6290
- ) {
6291
- vnode.componentInstance = oldVnode.componentInstance;
6292
- return
6293
- }
6294
-
6295
- var i;
6296
- var data = vnode.data;
6297
- if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6298
- i(oldVnode, vnode);
6299
- }
6300
-
6301
- var oldCh = oldVnode.children;
6302
- var ch = vnode.children;
6303
- if (isDef(data) && isPatchable(vnode)) {
6304
- for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6305
- if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6306
- }
6307
- if (isUndef(vnode.text)) {
6308
- if (isDef(oldCh) && isDef(ch)) {
6309
- if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6310
- } else if (isDef(ch)) {
6311
- {
6312
- checkDuplicateKeys(ch);
6313
- }
6314
- if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6315
- addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6316
- } else if (isDef(oldCh)) {
6317
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6318
- } else if (isDef(oldVnode.text)) {
6319
- nodeOps.setTextContent(elm, '');
6320
- }
6321
- } else if (oldVnode.text !== vnode.text) {
6322
- nodeOps.setTextContent(elm, vnode.text);
6323
- }
6324
- if (isDef(data)) {
6325
- if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
6326
- }
6327
- }
6328
-
6329
- function invokeInsertHook (vnode, queue, initial) {
6330
- // delay insert hooks for component root nodes, invoke them after the
6331
- // element is really inserted
6332
- if (isTrue(initial) && isDef(vnode.parent)) {
6333
- vnode.parent.data.pendingInsert = queue;
6334
- } else {
6335
- for (var i = 0; i < queue.length; ++i) {
6336
- queue[i].data.hook.insert(queue[i]);
6337
- }
6338
- }
6339
- }
6340
-
6341
- var hydrationBailed = false;
6342
- // list of modules that can skip create hook during hydration because they
6343
- // are already rendered on the client or has no need for initialization
6344
- // Note: style is excluded because it relies on initial clone for future
6345
- // deep updates (#7063).
6346
- var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
6347
-
6348
- // Note: this is a browser-only function so we can assume elms are DOM nodes.
6349
- function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
6350
- var i;
6351
- var tag = vnode.tag;
6352
- var data = vnode.data;
6353
- var children = vnode.children;
6354
- inVPre = inVPre || (data && data.pre);
6355
- vnode.elm = elm;
6356
-
6357
- if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6358
- vnode.isAsyncPlaceholder = true;
6359
- return true
6360
- }
6361
- // assert node match
6362
- {
6363
- if (!assertNodeMatch(elm, vnode, inVPre)) {
6364
- return false
6365
- }
6366
- }
6367
- if (isDef(data)) {
6368
- if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
6369
- if (isDef(i = vnode.componentInstance)) {
6370
- // child component. it should have hydrated its own tree.
6371
- initComponent(vnode, insertedVnodeQueue);
6372
- return true
6373
- }
6374
- }
6375
- if (isDef(tag)) {
6376
- if (isDef(children)) {
6377
- // empty element, allow client to pick up and populate children
6378
- if (!elm.hasChildNodes()) {
6379
- createChildren(vnode, children, insertedVnodeQueue);
6380
- } else {
6381
- // v-html and domProps: innerHTML
6382
- if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6383
- if (i !== elm.innerHTML) {
6384
- /* istanbul ignore if */
6385
- if (typeof console !== 'undefined' &&
6386
- !hydrationBailed
6387
- ) {
6388
- hydrationBailed = true;
6389
- console.warn('Parent: ', elm);
6390
- console.warn('server innerHTML: ', i);
6391
- console.warn('client innerHTML: ', elm.innerHTML);
6392
- }
6393
- return false
6394
- }
6395
- } else {
6396
- // iterate and compare children lists
6397
- var childrenMatch = true;
6398
- var childNode = elm.firstChild;
6399
- for (var i$1 = 0; i$1 < children.length; i$1++) {
6400
- if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6401
- childrenMatch = false;
6402
- break
6403
- }
6404
- childNode = childNode.nextSibling;
6405
- }
6406
- // if childNode is not null, it means the actual childNodes list is
6407
- // longer than the virtual children list.
6408
- if (!childrenMatch || childNode) {
6409
- /* istanbul ignore if */
6410
- if (typeof console !== 'undefined' &&
6411
- !hydrationBailed
6412
- ) {
6413
- hydrationBailed = true;
6414
- console.warn('Parent: ', elm);
6415
- console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6416
- }
6417
- return false
6418
- }
6419
- }
6420
- }
6421
- }
6422
- if (isDef(data)) {
6423
- var fullInvoke = false;
6424
- for (var key in data) {
6425
- if (!isRenderedModule(key)) {
6426
- fullInvoke = true;
6427
- invokeCreateHooks(vnode, insertedVnodeQueue);
6428
- break
6429
- }
6430
- }
6431
- if (!fullInvoke && data['class']) {
6432
- // ensure collecting deps for deep class bindings for future updates
6433
- traverse(data['class']);
6434
- }
6435
- }
6436
- } else if (elm.data !== vnode.text) {
6437
- elm.data = vnode.text;
6438
- }
6439
- return true
6440
- }
6441
-
6442
- function assertNodeMatch (node, vnode, inVPre) {
6443
- if (isDef(vnode.tag)) {
6444
- return vnode.tag.indexOf('vue-component') === 0 || (
6445
- !isUnknownElement$$1(vnode, inVPre) &&
6446
- vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
6447
- )
6448
- } else {
6449
- return node.nodeType === (vnode.isComment ? 8 : 3)
6450
- }
6451
- }
6452
-
6453
- return function patch (oldVnode, vnode, hydrating, removeOnly) {
6454
- if (isUndef(vnode)) {
6455
- if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
6456
- return
6457
- }
6458
-
6459
- var isInitialPatch = false;
6460
- var insertedVnodeQueue = [];
6461
-
6462
- if (isUndef(oldVnode)) {
6463
- // empty mount (likely as component), create new root element
6464
- isInitialPatch = true;
6465
- createElm(vnode, insertedVnodeQueue);
6466
- } else {
6467
- var isRealElement = isDef(oldVnode.nodeType);
6468
- if (!isRealElement && sameVnode(oldVnode, vnode)) {
6469
- // patch existing root node
6470
- patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6471
- } else {
6472
- if (isRealElement) {
6473
- // mounting to a real element
6474
- // check if this is server-rendered content and if we can perform
6475
- // a successful hydration.
6476
- if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6477
- oldVnode.removeAttribute(SSR_ATTR);
6478
- hydrating = true;
6479
- }
6480
- if (isTrue(hydrating)) {
6481
- if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6482
- invokeInsertHook(vnode, insertedVnodeQueue, true);
6483
- return oldVnode
6484
- } else {
6485
- warn(
6486
- 'The client-side rendered virtual DOM tree is not matching ' +
6487
- 'server-rendered content. This is likely caused by incorrect ' +
6488
- 'HTML markup, for example nesting block-level elements inside ' +
6489
- '<p>, or missing <tbody>. Bailing hydration and performing ' +
6490
- 'full client-side render.'
6491
- );
6492
- }
6493
- }
6494
- // either not server-rendered, or hydration failed.
6495
- // create an empty node and replace it
6496
- oldVnode = emptyNodeAt(oldVnode);
6497
- }
6498
-
6499
- // replacing existing element
6500
- var oldElm = oldVnode.elm;
6501
- var parentElm = nodeOps.parentNode(oldElm);
6502
-
6503
- // create new node
6504
- createElm(
6505
- vnode,
6506
- insertedVnodeQueue,
6507
- // extremely rare edge case: do not insert if old element is in a
6508
- // leaving transition. Only happens when combining transition +
6509
- // keep-alive + HOCs. (#4590)
6510
- oldElm._leaveCb ? null : parentElm,
6511
- nodeOps.nextSibling(oldElm)
6512
- );
6513
-
6514
- // update parent placeholder node element, recursively
6515
- if (isDef(vnode.parent)) {
6516
- var ancestor = vnode.parent;
6517
- var patchable = isPatchable(vnode);
6518
- while (ancestor) {
6519
- for (var i = 0; i < cbs.destroy.length; ++i) {
6520
- cbs.destroy[i](ancestor);
6521
- }
6522
- ancestor.elm = vnode.elm;
6523
- if (patchable) {
6524
- for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6525
- cbs.create[i$1](emptyNode, ancestor);
6526
- }
6527
- // #6513
6528
- // invoke insert hooks that may have been merged by create hooks.
6529
- // e.g. for directives that uses the "inserted" hook.
6530
- var insert = ancestor.data.hook.insert;
6531
- if (insert.merged) {
6532
- // start at index 1 to avoid re-invoking component mounted hook
6533
- for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6534
- insert.fns[i$2]();
6535
- }
6536
- }
6537
- } else {
6538
- registerRef(ancestor);
6539
- }
6540
- ancestor = ancestor.parent;
6541
- }
6542
- }
6543
-
6544
- // destroy old node
6545
- if (isDef(parentElm)) {
6546
- removeVnodes(parentElm, [oldVnode], 0, 0);
6547
- } else if (isDef(oldVnode.tag)) {
6548
- invokeDestroyHook(oldVnode);
6549
- }
6550
- }
6551
- }
6552
-
6553
- invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6554
- return vnode.elm
6555
- }
6556
- }
6557
-
6558
- /* */
6559
-
6560
- var directives = {
6561
- create: updateDirectives,
6562
- update: updateDirectives,
6563
- destroy: function unbindDirectives (vnode) {
6564
- updateDirectives(vnode, emptyNode);
6565
- }
6566
- };
6567
-
6568
- function updateDirectives (oldVnode, vnode) {
6569
- if (oldVnode.data.directives || vnode.data.directives) {
6570
- _update(oldVnode, vnode);
6571
- }
6572
- }
6573
-
6574
- function _update (oldVnode, vnode) {
6575
- var isCreate = oldVnode === emptyNode;
6576
- var isDestroy = vnode === emptyNode;
6577
- var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6578
- var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6579
-
6580
- var dirsWithInsert = [];
6581
- var dirsWithPostpatch = [];
6582
-
6583
- var key, oldDir, dir;
6584
- for (key in newDirs) {
6585
- oldDir = oldDirs[key];
6586
- dir = newDirs[key];
6587
- if (!oldDir) {
6588
- // new directive, bind
6589
- callHook$1(dir, 'bind', vnode, oldVnode);
6590
- if (dir.def && dir.def.inserted) {
6591
- dirsWithInsert.push(dir);
6592
- }
6593
- } else {
6594
- // existing directive, update
6595
- dir.oldValue = oldDir.value;
6596
- dir.oldArg = oldDir.arg;
6597
- callHook$1(dir, 'update', vnode, oldVnode);
6598
- if (dir.def && dir.def.componentUpdated) {
6599
- dirsWithPostpatch.push(dir);
6600
- }
6601
- }
6602
- }
6603
-
6604
- if (dirsWithInsert.length) {
6605
- var callInsert = function () {
6606
- for (var i = 0; i < dirsWithInsert.length; i++) {
6607
- callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6608
- }
6609
- };
6610
- if (isCreate) {
6611
- mergeVNodeHook(vnode, 'insert', callInsert);
6612
- } else {
6613
- callInsert();
6614
- }
6615
- }
6616
-
6617
- if (dirsWithPostpatch.length) {
6618
- mergeVNodeHook(vnode, 'postpatch', function () {
6619
- for (var i = 0; i < dirsWithPostpatch.length; i++) {
6620
- callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6621
- }
6622
- });
6623
- }
6624
-
6625
- if (!isCreate) {
6626
- for (key in oldDirs) {
6627
- if (!newDirs[key]) {
6628
- // no longer present, unbind
6629
- callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6630
- }
6631
- }
6632
- }
6633
- }
6634
-
6635
- var emptyModifiers = Object.create(null);
6636
-
6637
- function normalizeDirectives$1 (
6638
- dirs,
6639
- vm
6640
- ) {
6641
- var res = Object.create(null);
6642
- if (!dirs) {
6643
- // $flow-disable-line
6644
- return res
6645
- }
6646
- var i, dir;
6647
- for (i = 0; i < dirs.length; i++) {
6648
- dir = dirs[i];
6649
- if (!dir.modifiers) {
6650
- // $flow-disable-line
6651
- dir.modifiers = emptyModifiers;
6652
- }
6653
- res[getRawDirName(dir)] = dir;
6654
- dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6655
- }
6656
- // $flow-disable-line
6657
- return res
6658
- }
6659
-
6660
- function getRawDirName (dir) {
6661
- return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
6662
- }
6663
-
6664
- function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
6665
- var fn = dir.def && dir.def[hook];
6666
- if (fn) {
6667
- try {
6668
- fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6669
- } catch (e) {
6670
- handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
6671
- }
6672
- }
6673
- }
6674
-
6675
- var baseModules = [
6676
- ref,
6677
- directives
6678
- ];
6679
-
6680
- /* */
6681
-
6682
- function updateAttrs (oldVnode, vnode) {
6683
- var opts = vnode.componentOptions;
6684
- if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6685
- return
6686
- }
6687
- if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6688
- return
6689
- }
6690
- var key, cur, old;
6691
- var elm = vnode.elm;
6692
- var oldAttrs = oldVnode.data.attrs || {};
6693
- var attrs = vnode.data.attrs || {};
6694
- // clone observed objects, as the user probably wants to mutate it
6695
- if (isDef(attrs.__ob__)) {
6696
- attrs = vnode.data.attrs = extend({}, attrs);
6697
- }
6698
-
6699
- for (key in attrs) {
6700
- cur = attrs[key];
6701
- old = oldAttrs[key];
6702
- if (old !== cur) {
6703
- setAttr(elm, key, cur);
6704
- }
6705
- }
6706
- // #4391: in IE9, setting type can reset value for input[type=radio]
6707
- // #6666: IE/Edge forces progress value down to 1 before setting a max
6708
- /* istanbul ignore if */
6709
- if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6710
- setAttr(elm, 'value', attrs.value);
6711
- }
6712
- for (key in oldAttrs) {
6713
- if (isUndef(attrs[key])) {
6714
- if (isXlink(key)) {
6715
- elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6716
- } else if (!isEnumeratedAttr(key)) {
6717
- elm.removeAttribute(key);
6718
- }
6719
- }
6720
- }
6721
- }
6722
-
6723
- function setAttr (el, key, value) {
6724
- if (el.tagName.indexOf('-') > -1) {
6725
- baseSetAttr(el, key, value);
6726
- } else if (isBooleanAttr(key)) {
6727
- // set attribute for blank value
6728
- // e.g. <option disabled>Select one</option>
6729
- if (isFalsyAttrValue(value)) {
6730
- el.removeAttribute(key);
6731
- } else {
6732
- // technically allowfullscreen is a boolean attribute for <iframe>,
6733
- // but Flash expects a value of "true" when used on <embed> tag
6734
- value = key === 'allowfullscreen' && el.tagName === 'EMBED'
6735
- ? 'true'
6736
- : key;
6737
- el.setAttribute(key, value);
6738
- }
6739
- } else if (isEnumeratedAttr(key)) {
6740
- el.setAttribute(key, convertEnumeratedValue(key, value));
6741
- } else if (isXlink(key)) {
6742
- if (isFalsyAttrValue(value)) {
6743
- el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6744
- } else {
6745
- el.setAttributeNS(xlinkNS, key, value);
6746
- }
6747
- } else {
6748
- baseSetAttr(el, key, value);
6749
- }
6750
- }
6751
-
6752
- function baseSetAttr (el, key, value) {
6753
- if (isFalsyAttrValue(value)) {
6754
- el.removeAttribute(key);
6755
- } else {
6756
- // #7138: IE10 & 11 fires input event when setting placeholder on
6757
- // <textarea>... block the first input event and remove the blocker
6758
- // immediately.
6759
- /* istanbul ignore if */
6760
- if (
6761
- isIE && !isIE9 &&
6762
- el.tagName === 'TEXTAREA' &&
6763
- key === 'placeholder' && value !== '' && !el.__ieph
6764
- ) {
6765
- var blocker = function (e) {
6766
- e.stopImmediatePropagation();
6767
- el.removeEventListener('input', blocker);
6768
- };
6769
- el.addEventListener('input', blocker);
6770
- // $flow-disable-line
6771
- el.__ieph = true; /* IE placeholder patched */
6772
- }
6773
- el.setAttribute(key, value);
6774
- }
6775
- }
6776
-
6777
- var attrs = {
6778
- create: updateAttrs,
6779
- update: updateAttrs
6780
- };
6781
-
6782
- /* */
6783
-
6784
- function updateClass (oldVnode, vnode) {
6785
- var el = vnode.elm;
6786
- var data = vnode.data;
6787
- var oldData = oldVnode.data;
6788
- if (
6789
- isUndef(data.staticClass) &&
6790
- isUndef(data.class) && (
6791
- isUndef(oldData) || (
6792
- isUndef(oldData.staticClass) &&
6793
- isUndef(oldData.class)
6794
- )
6795
- )
6796
- ) {
6797
- return
6798
- }
6799
-
6800
- var cls = genClassForVnode(vnode);
6801
-
6802
- // handle transition classes
6803
- var transitionClass = el._transitionClasses;
6804
- if (isDef(transitionClass)) {
6805
- cls = concat(cls, stringifyClass(transitionClass));
6806
- }
6807
-
6808
- // set the class
6809
- if (cls !== el._prevClass) {
6810
- el.setAttribute('class', cls);
6811
- el._prevClass = cls;
6812
- }
6813
- }
6814
-
6815
- var klass = {
6816
- create: updateClass,
6817
- update: updateClass
6818
- };
6819
-
6820
- /* */
6821
-
6822
- var validDivisionCharRE = /[\w).+\-_$\]]/;
6823
-
6824
- function parseFilters (exp) {
6825
- var inSingle = false;
6826
- var inDouble = false;
6827
- var inTemplateString = false;
6828
- var inRegex = false;
6829
- var curly = 0;
6830
- var square = 0;
6831
- var paren = 0;
6832
- var lastFilterIndex = 0;
6833
- var c, prev, i, expression, filters;
6834
-
6835
- for (i = 0; i < exp.length; i++) {
6836
- prev = c;
6837
- c = exp.charCodeAt(i);
6838
- if (inSingle) {
6839
- if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
6840
- } else if (inDouble) {
6841
- if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
6842
- } else if (inTemplateString) {
6843
- if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
6844
- } else if (inRegex) {
6845
- if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
6846
- } else if (
6847
- c === 0x7C && // pipe
6848
- exp.charCodeAt(i + 1) !== 0x7C &&
6849
- exp.charCodeAt(i - 1) !== 0x7C &&
6850
- !curly && !square && !paren
6851
- ) {
6852
- if (expression === undefined) {
6853
- // first filter, end of expression
6854
- lastFilterIndex = i + 1;
6855
- expression = exp.slice(0, i).trim();
6856
- } else {
6857
- pushFilter();
6858
- }
6859
- } else {
6860
- switch (c) {
6861
- case 0x22: inDouble = true; break // "
6862
- case 0x27: inSingle = true; break // '
6863
- case 0x60: inTemplateString = true; break // `
6864
- case 0x28: paren++; break // (
6865
- case 0x29: paren--; break // )
6866
- case 0x5B: square++; break // [
6867
- case 0x5D: square--; break // ]
6868
- case 0x7B: curly++; break // {
6869
- case 0x7D: curly--; break // }
6870
- }
6871
- if (c === 0x2f) { // /
6872
- var j = i - 1;
6873
- var p = (void 0);
6874
- // find first non-whitespace prev char
6875
- for (; j >= 0; j--) {
6876
- p = exp.charAt(j);
6877
- if (p !== ' ') { break }
6878
- }
6879
- if (!p || !validDivisionCharRE.test(p)) {
6880
- inRegex = true;
6881
- }
6882
- }
6883
- }
6884
- }
6885
-
6886
- if (expression === undefined) {
6887
- expression = exp.slice(0, i).trim();
6888
- } else if (lastFilterIndex !== 0) {
6889
- pushFilter();
6890
- }
6891
-
6892
- function pushFilter () {
6893
- (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
6894
- lastFilterIndex = i + 1;
6895
- }
6896
-
6897
- if (filters) {
6898
- for (i = 0; i < filters.length; i++) {
6899
- expression = wrapFilter(expression, filters[i]);
6900
- }
6901
- }
6902
-
6903
- return expression
6904
- }
6905
-
6906
- function wrapFilter (exp, filter) {
6907
- var i = filter.indexOf('(');
6908
- if (i < 0) {
6909
- // _f: resolveFilter
6910
- return ("_f(\"" + filter + "\")(" + exp + ")")
6911
- } else {
6912
- var name = filter.slice(0, i);
6913
- var args = filter.slice(i + 1);
6914
- return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
6915
- }
6916
- }
6917
-
6918
- /* */
6919
-
6920
-
6921
-
6922
- /* eslint-disable no-unused-vars */
6923
- function baseWarn (msg, range) {
6924
- console.error(("[Vue compiler]: " + msg));
6925
- }
6926
- /* eslint-enable no-unused-vars */
6927
-
6928
- function pluckModuleFunction (
6929
- modules,
6930
- key
6931
- ) {
6932
- return modules
6933
- ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
6934
- : []
6935
- }
6936
-
6937
- function addProp (el, name, value, range, dynamic) {
6938
- (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6939
- el.plain = false;
6940
- }
6941
-
6942
- function addAttr (el, name, value, range, dynamic) {
6943
- var attrs = dynamic
6944
- ? (el.dynamicAttrs || (el.dynamicAttrs = []))
6945
- : (el.attrs || (el.attrs = []));
6946
- attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
6947
- el.plain = false;
6948
- }
6949
-
6950
- // add a raw attr (use this in preTransforms)
6951
- function addRawAttr (el, name, value, range) {
6952
- el.attrsMap[name] = value;
6953
- el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
6954
- }
6955
-
6956
- function addDirective (
6957
- el,
6958
- name,
6959
- rawName,
6960
- value,
6961
- arg,
6962
- isDynamicArg,
6963
- modifiers,
6964
- range
6965
- ) {
6966
- (el.directives || (el.directives = [])).push(rangeSetItem({
6967
- name: name,
6968
- rawName: rawName,
6969
- value: value,
6970
- arg: arg,
6971
- isDynamicArg: isDynamicArg,
6972
- modifiers: modifiers
6973
- }, range));
6974
- el.plain = false;
6975
- }
6976
-
6977
- function prependModifierMarker (symbol, name, dynamic) {
6978
- return dynamic
6979
- ? ("_p(" + name + ",\"" + symbol + "\")")
6980
- : symbol + name // mark the event as captured
6981
- }
6982
-
6983
- function addHandler (
6984
- el,
6985
- name,
6986
- value,
6987
- modifiers,
6988
- important,
6989
- warn,
6990
- range,
6991
- dynamic
6992
- ) {
6993
- modifiers = modifiers || emptyObject;
6994
- // warn prevent and passive modifier
6995
- /* istanbul ignore if */
6996
- if (
6997
- warn &&
6998
- modifiers.prevent && modifiers.passive
6999
- ) {
7000
- warn(
7001
- 'passive and prevent can\'t be used together. ' +
7002
- 'Passive handler can\'t prevent default event.',
7003
- range
7004
- );
7005
- }
7006
-
7007
- // normalize click.right and click.middle since they don't actually fire
7008
- // this is technically browser-specific, but at least for now browsers are
7009
- // the only target envs that have right/middle clicks.
7010
- if (modifiers.right) {
7011
- if (dynamic) {
7012
- name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
7013
- } else if (name === 'click') {
7014
- name = 'contextmenu';
7015
- delete modifiers.right;
7016
- }
7017
- } else if (modifiers.middle) {
7018
- if (dynamic) {
7019
- name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
7020
- } else if (name === 'click') {
7021
- name = 'mouseup';
7022
- }
7023
- }
7024
-
7025
- // check capture modifier
7026
- if (modifiers.capture) {
7027
- delete modifiers.capture;
7028
- name = prependModifierMarker('!', name, dynamic);
7029
- }
7030
- if (modifiers.once) {
7031
- delete modifiers.once;
7032
- name = prependModifierMarker('~', name, dynamic);
7033
- }
7034
- /* istanbul ignore if */
7035
- if (modifiers.passive) {
7036
- delete modifiers.passive;
7037
- name = prependModifierMarker('&', name, dynamic);
7038
- }
7039
-
7040
- var events;
7041
- if (modifiers.native) {
7042
- delete modifiers.native;
7043
- events = el.nativeEvents || (el.nativeEvents = {});
7044
- } else {
7045
- events = el.events || (el.events = {});
7046
- }
7047
-
7048
- var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
7049
- if (modifiers !== emptyObject) {
7050
- newHandler.modifiers = modifiers;
7051
- }
7052
-
7053
- var handlers = events[name];
7054
- /* istanbul ignore if */
7055
- if (Array.isArray(handlers)) {
7056
- important ? handlers.unshift(newHandler) : handlers.push(newHandler);
7057
- } else if (handlers) {
7058
- events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
7059
- } else {
7060
- events[name] = newHandler;
7061
- }
7062
-
7063
- el.plain = false;
7064
- }
7065
-
7066
- function getRawBindingAttr (
7067
- el,
7068
- name
7069
- ) {
7070
- return el.rawAttrsMap[':' + name] ||
7071
- el.rawAttrsMap['v-bind:' + name] ||
7072
- el.rawAttrsMap[name]
7073
- }
7074
-
7075
- function getBindingAttr (
7076
- el,
7077
- name,
7078
- getStatic
7079
- ) {
7080
- var dynamicValue =
7081
- getAndRemoveAttr(el, ':' + name) ||
7082
- getAndRemoveAttr(el, 'v-bind:' + name);
7083
- if (dynamicValue != null) {
7084
- return parseFilters(dynamicValue)
7085
- } else if (getStatic !== false) {
7086
- var staticValue = getAndRemoveAttr(el, name);
7087
- if (staticValue != null) {
7088
- return JSON.stringify(staticValue)
7089
- }
7090
- }
7091
- }
7092
-
7093
- // note: this only removes the attr from the Array (attrsList) so that it
7094
- // doesn't get processed by processAttrs.
7095
- // By default it does NOT remove it from the map (attrsMap) because the map is
7096
- // needed during codegen.
7097
- function getAndRemoveAttr (
7098
- el,
7099
- name,
7100
- removeFromMap
7101
- ) {
7102
- var val;
7103
- if ((val = el.attrsMap[name]) != null) {
7104
- var list = el.attrsList;
7105
- for (var i = 0, l = list.length; i < l; i++) {
7106
- if (list[i].name === name) {
7107
- list.splice(i, 1);
7108
- break
7109
- }
7110
- }
7111
- }
7112
- if (removeFromMap) {
7113
- delete el.attrsMap[name];
7114
- }
7115
- return val
7116
- }
7117
-
7118
- function getAndRemoveAttrByRegex (
7119
- el,
7120
- name
7121
- ) {
7122
- var list = el.attrsList;
7123
- for (var i = 0, l = list.length; i < l; i++) {
7124
- var attr = list[i];
7125
- if (name.test(attr.name)) {
7126
- list.splice(i, 1);
7127
- return attr
7128
- }
7129
- }
7130
- }
7131
-
7132
- function rangeSetItem (
7133
- item,
7134
- range
7135
- ) {
7136
- if (range) {
7137
- if (range.start != null) {
7138
- item.start = range.start;
7139
- }
7140
- if (range.end != null) {
7141
- item.end = range.end;
7142
- }
7143
- }
7144
- return item
7145
- }
7146
-
7147
- /* */
7148
-
7149
- /**
7150
- * Cross-platform code generation for component v-model
7151
- */
7152
- function genComponentModel (
7153
- el,
7154
- value,
7155
- modifiers
7156
- ) {
7157
- var ref = modifiers || {};
7158
- var number = ref.number;
7159
- var trim = ref.trim;
7160
-
7161
- var baseValueExpression = '$$v';
7162
- var valueExpression = baseValueExpression;
7163
- if (trim) {
7164
- valueExpression =
7165
- "(typeof " + baseValueExpression + " === 'string'" +
7166
- "? " + baseValueExpression + ".trim()" +
7167
- ": " + baseValueExpression + ")";
7168
- }
7169
- if (number) {
7170
- valueExpression = "_n(" + valueExpression + ")";
7171
- }
7172
- var assignment = genAssignmentCode(value, valueExpression);
7173
-
7174
- el.model = {
7175
- value: ("(" + value + ")"),
7176
- expression: JSON.stringify(value),
7177
- callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
7178
- };
7179
- }
7180
-
7181
- /**
7182
- * Cross-platform codegen helper for generating v-model value assignment code.
7183
- */
7184
- function genAssignmentCode (
7185
- value,
7186
- assignment
7187
- ) {
7188
- var res = parseModel(value);
7189
- if (res.key === null) {
7190
- return (value + "=" + assignment)
7191
- } else {
7192
- return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
7193
- }
7194
- }
7195
-
7196
- /**
7197
- * Parse a v-model expression into a base path and a final key segment.
7198
- * Handles both dot-path and possible square brackets.
7199
- *
7200
- * Possible cases:
7201
- *
7202
- * - test
7203
- * - test[key]
7204
- * - test[test1[key]]
7205
- * - test["a"][key]
7206
- * - xxx.test[a[a].test1[key]]
7207
- * - test.xxx.a["asa"][test1[key]]
7208
- *
7209
- */
7210
-
7211
- var len, str, chr, index$1, expressionPos, expressionEndPos;
7212
-
7213
-
7214
-
7215
- function parseModel (val) {
7216
- // Fix https://github.com/vuejs/vue/pull/7730
7217
- // allow v-model="obj.val " (trailing whitespace)
7218
- val = val.trim();
7219
- len = val.length;
7220
-
7221
- if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
7222
- index$1 = val.lastIndexOf('.');
7223
- if (index$1 > -1) {
7224
- return {
7225
- exp: val.slice(0, index$1),
7226
- key: '"' + val.slice(index$1 + 1) + '"'
7227
- }
7228
- } else {
7229
- return {
7230
- exp: val,
7231
- key: null
7232
- }
7233
- }
7234
- }
7235
-
7236
- str = val;
7237
- index$1 = expressionPos = expressionEndPos = 0;
7238
-
7239
- while (!eof()) {
7240
- chr = next();
7241
- /* istanbul ignore if */
7242
- if (isStringStart(chr)) {
7243
- parseString(chr);
7244
- } else if (chr === 0x5B) {
7245
- parseBracket(chr);
7246
- }
7247
- }
7248
-
7249
- return {
7250
- exp: val.slice(0, expressionPos),
7251
- key: val.slice(expressionPos + 1, expressionEndPos)
7252
- }
7253
- }
7254
-
7255
- function next () {
7256
- return str.charCodeAt(++index$1)
7257
- }
7258
-
7259
- function eof () {
7260
- return index$1 >= len
7261
- }
7262
-
7263
- function isStringStart (chr) {
7264
- return chr === 0x22 || chr === 0x27
7265
- }
7266
-
7267
- function parseBracket (chr) {
7268
- var inBracket = 1;
7269
- expressionPos = index$1;
7270
- while (!eof()) {
7271
- chr = next();
7272
- if (isStringStart(chr)) {
7273
- parseString(chr);
7274
- continue
7275
- }
7276
- if (chr === 0x5B) { inBracket++; }
7277
- if (chr === 0x5D) { inBracket--; }
7278
- if (inBracket === 0) {
7279
- expressionEndPos = index$1;
7280
- break
7281
- }
7282
- }
7283
- }
7284
-
7285
- function parseString (chr) {
7286
- var stringQuote = chr;
7287
- while (!eof()) {
7288
- chr = next();
7289
- if (chr === stringQuote) {
7290
- break
7291
- }
7292
- }
7293
- }
7294
-
7295
- /* */
7296
-
7297
- var warn$1;
7298
-
7299
- // in some cases, the event used has to be determined at runtime
7300
- // so we used some reserved tokens during compile.
7301
- var RANGE_TOKEN = '__r';
7302
- var CHECKBOX_RADIO_TOKEN = '__c';
7303
-
7304
- function model (
7305
- el,
7306
- dir,
7307
- _warn
7308
- ) {
7309
- warn$1 = _warn;
7310
- var value = dir.value;
7311
- var modifiers = dir.modifiers;
7312
- var tag = el.tag;
7313
- var type = el.attrsMap.type;
7314
-
7315
- {
7316
- // inputs with type="file" are read only and setting the input's
7317
- // value will throw an error.
7318
- if (tag === 'input' && type === 'file') {
7319
- warn$1(
7320
- "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
7321
- "File inputs are read only. Use a v-on:change listener instead.",
7322
- el.rawAttrsMap['v-model']
7323
- );
7324
- }
7325
- }
7326
-
7327
- if (el.component) {
7328
- genComponentModel(el, value, modifiers);
7329
- // component v-model doesn't need extra runtime
7330
- return false
7331
- } else if (tag === 'select') {
7332
- genSelect(el, value, modifiers);
7333
- } else if (tag === 'input' && type === 'checkbox') {
7334
- genCheckboxModel(el, value, modifiers);
7335
- } else if (tag === 'input' && type === 'radio') {
7336
- genRadioModel(el, value, modifiers);
7337
- } else if (tag === 'input' || tag === 'textarea') {
7338
- genDefaultModel(el, value, modifiers);
7339
- } else if (!config.isReservedTag(tag)) {
7340
- genComponentModel(el, value, modifiers);
7341
- // component v-model doesn't need extra runtime
7342
- return false
7343
- } else {
7344
- warn$1(
7345
- "<" + (el.tag) + " v-model=\"" + value + "\">: " +
7346
- "v-model is not supported on this element type. " +
7347
- 'If you are working with contenteditable, it\'s recommended to ' +
7348
- 'wrap a library dedicated for that purpose inside a custom component.',
7349
- el.rawAttrsMap['v-model']
7350
- );
7351
- }
7352
-
7353
- // ensure runtime directive metadata
7354
- return true
7355
- }
7356
-
7357
- function genCheckboxModel (
7358
- el,
7359
- value,
7360
- modifiers
7361
- ) {
7362
- var number = modifiers && modifiers.number;
7363
- var valueBinding = getBindingAttr(el, 'value') || 'null';
7364
- var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
7365
- var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
7366
- addProp(el, 'checked',
7367
- "Array.isArray(" + value + ")" +
7368
- "?_i(" + value + "," + valueBinding + ")>-1" + (
7369
- trueValueBinding === 'true'
7370
- ? (":(" + value + ")")
7371
- : (":_q(" + value + "," + trueValueBinding + ")")
7372
- )
7373
- );
7374
- addHandler(el, 'change',
7375
- "var $$a=" + value + "," +
7376
- '$$el=$event.target,' +
7377
- "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
7378
- 'if(Array.isArray($$a)){' +
7379
- "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
7380
- '$$i=_i($$a,$$v);' +
7381
- "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
7382
- "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
7383
- "}else{" + (genAssignmentCode(value, '$$c')) + "}",
7384
- null, true
7385
- );
7386
- }
7387
-
7388
- function genRadioModel (
7389
- el,
7390
- value,
7391
- modifiers
7392
- ) {
7393
- var number = modifiers && modifiers.number;
7394
- var valueBinding = getBindingAttr(el, 'value') || 'null';
7395
- valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
7396
- addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
7397
- addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
7398
- }
7399
-
7400
- function genSelect (
7401
- el,
7402
- value,
7403
- modifiers
7404
- ) {
7405
- var number = modifiers && modifiers.number;
7406
- var selectedVal = "Array.prototype.filter" +
7407
- ".call($event.target.options,function(o){return o.selected})" +
7408
- ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
7409
- "return " + (number ? '_n(val)' : 'val') + "})";
7410
-
7411
- var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
7412
- var code = "var $$selectedVal = " + selectedVal + ";";
7413
- code = code + " " + (genAssignmentCode(value, assignment));
7414
- addHandler(el, 'change', code, null, true);
7415
- }
7416
-
7417
- function genDefaultModel (
7418
- el,
7419
- value,
7420
- modifiers
7421
- ) {
7422
- var type = el.attrsMap.type;
7423
-
7424
- // warn if v-bind:value conflicts with v-model
7425
- // except for inputs with v-bind:type
7426
- {
7427
- var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
7428
- var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
7429
- if (value$1 && !typeBinding) {
7430
- var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
7431
- warn$1(
7432
- binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
7433
- 'because the latter already expands to a value binding internally',
7434
- el.rawAttrsMap[binding]
7435
- );
7436
- }
7437
- }
7438
-
7439
- var ref = modifiers || {};
7440
- var lazy = ref.lazy;
7441
- var number = ref.number;
7442
- var trim = ref.trim;
7443
- var needCompositionGuard = !lazy && type !== 'range';
7444
- var event = lazy
7445
- ? 'change'
7446
- : type === 'range'
7447
- ? RANGE_TOKEN
7448
- : 'input';
7449
-
7450
- var valueExpression = '$event.target.value';
7451
- if (trim) {
7452
- valueExpression = "$event.target.value.trim()";
7453
- }
7454
- if (number) {
7455
- valueExpression = "_n(" + valueExpression + ")";
7456
- }
7457
-
7458
- var code = genAssignmentCode(value, valueExpression);
7459
- if (needCompositionGuard) {
7460
- code = "if($event.target.composing)return;" + code;
7461
- }
7462
-
7463
- addProp(el, 'value', ("(" + value + ")"));
7464
- addHandler(el, event, code, null, true);
7465
- if (trim || number) {
7466
- addHandler(el, 'blur', '$forceUpdate()');
7467
- }
7468
- }
7469
-
7470
- /* */
7471
-
7472
- // normalize v-model event tokens that can only be determined at runtime.
7473
- // it's important to place the event as the first in the array because
7474
- // the whole point is ensuring the v-model callback gets called before
7475
- // user-attached handlers.
7476
- function normalizeEvents (on) {
7477
- /* istanbul ignore if */
7478
- if (isDef(on[RANGE_TOKEN])) {
7479
- // IE input[type=range] only supports `change` event
7480
- var event = isIE ? 'change' : 'input';
7481
- on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
7482
- delete on[RANGE_TOKEN];
7483
- }
7484
- // This was originally intended to fix #4521 but no longer necessary
7485
- // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7486
- /* istanbul ignore if */
7487
- if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7488
- on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7489
- delete on[CHECKBOX_RADIO_TOKEN];
7490
- }
7491
- }
7492
-
7493
- var target$1;
7494
-
7495
- function createOnceHandler$1 (event, handler, capture) {
7496
- var _target = target$1; // save current target element in closure
7497
- return function onceHandler () {
7498
- var res = handler.apply(null, arguments);
7499
- if (res !== null) {
7500
- remove$2(event, onceHandler, capture, _target);
7501
- }
7502
- }
7503
- }
7504
-
7505
- // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
7506
- // implementation and does not fire microtasks in between event propagation, so
7507
- // safe to exclude.
7508
- var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
7509
-
7510
- function add$1 (
7511
- name,
7512
- handler,
7513
- capture,
7514
- passive
7515
- ) {
7516
- // async edge case #6566: inner click event triggers patch, event handler
7517
- // attached to outer element during patch, and triggered again. This
7518
- // happens because browsers fire microtask ticks between event propagation.
7519
- // the solution is simple: we save the timestamp when a handler is attached,
7520
- // and the handler would only fire if the event passed to it was fired
7521
- // AFTER it was attached.
7522
- if (useMicrotaskFix) {
7523
- var attachedTimestamp = currentFlushTimestamp;
7524
- var original = handler;
7525
- handler = original._wrapper = function (e) {
7526
- if (
7527
- // no bubbling, should always fire.
7528
- // this is just a safety net in case event.timeStamp is unreliable in
7529
- // certain weird environments...
7530
- e.target === e.currentTarget ||
7531
- // event is fired after handler attachment
7532
- e.timeStamp >= attachedTimestamp ||
7533
- // bail for environments that have buggy event.timeStamp implementations
7534
- // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7535
- // #9681 QtWebEngine event.timeStamp is negative value
7536
- e.timeStamp <= 0 ||
7537
- // #9448 bail if event is fired in another document in a multi-page
7538
- // electron/nw.js app, since event.timeStamp will be using a different
7539
- // starting reference
7540
- e.target.ownerDocument !== document
7541
- ) {
7542
- return original.apply(this, arguments)
7543
- }
7544
- };
7545
- }
7546
- target$1.addEventListener(
7547
- name,
7548
- handler,
7549
- supportsPassive
7550
- ? { capture: capture, passive: passive }
7551
- : capture
7552
- );
7553
- }
7554
-
7555
- function remove$2 (
7556
- name,
7557
- handler,
7558
- capture,
7559
- _target
7560
- ) {
7561
- (_target || target$1).removeEventListener(
7562
- name,
7563
- handler._wrapper || handler,
7564
- capture
7565
- );
7566
- }
7567
-
7568
- function updateDOMListeners (oldVnode, vnode) {
7569
- if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
7570
- return
7571
- }
7572
- var on = vnode.data.on || {};
7573
- var oldOn = oldVnode.data.on || {};
7574
- target$1 = vnode.elm;
7575
- normalizeEvents(on);
7576
- updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
7577
- target$1 = undefined;
7578
- }
7579
-
7580
- var events = {
7581
- create: updateDOMListeners,
7582
- update: updateDOMListeners
7583
- };
7584
-
7585
- /* */
7586
-
7587
- var svgContainer;
7588
-
7589
- function updateDOMProps (oldVnode, vnode) {
7590
- if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
7591
- return
7592
- }
7593
- var key, cur;
7594
- var elm = vnode.elm;
7595
- var oldProps = oldVnode.data.domProps || {};
7596
- var props = vnode.data.domProps || {};
7597
- // clone observed objects, as the user probably wants to mutate it
7598
- if (isDef(props.__ob__)) {
7599
- props = vnode.data.domProps = extend({}, props);
7600
- }
7601
-
7602
- for (key in oldProps) {
7603
- if (!(key in props)) {
7604
- elm[key] = '';
7605
- }
7606
- }
7607
-
7608
- for (key in props) {
7609
- cur = props[key];
7610
- // ignore children if the node has textContent or innerHTML,
7611
- // as these will throw away existing DOM nodes and cause removal errors
7612
- // on subsequent patches (#3360)
7613
- if (key === 'textContent' || key === 'innerHTML') {
7614
- if (vnode.children) { vnode.children.length = 0; }
7615
- if (cur === oldProps[key]) { continue }
7616
- // #6601 work around Chrome version <= 55 bug where single textNode
7617
- // replaced by innerHTML/textContent retains its parentNode property
7618
- if (elm.childNodes.length === 1) {
7619
- elm.removeChild(elm.childNodes[0]);
7620
- }
7621
- }
7622
-
7623
- if (key === 'value' && elm.tagName !== 'PROGRESS') {
7624
- // store value as _value as well since
7625
- // non-string values will be stringified
7626
- elm._value = cur;
7627
- // avoid resetting cursor position when value is the same
7628
- var strCur = isUndef(cur) ? '' : String(cur);
7629
- if (shouldUpdateValue(elm, strCur)) {
7630
- elm.value = strCur;
7631
- }
7632
- } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7633
- // IE doesn't support innerHTML for SVG elements
7634
- svgContainer = svgContainer || document.createElement('div');
7635
- svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7636
- var svg = svgContainer.firstChild;
7637
- while (elm.firstChild) {
7638
- elm.removeChild(elm.firstChild);
7639
- }
7640
- while (svg.firstChild) {
7641
- elm.appendChild(svg.firstChild);
7642
- }
7643
- } else if (
7644
- // skip the update if old and new VDOM state is the same.
7645
- // `value` is handled separately because the DOM value may be temporarily
7646
- // out of sync with VDOM state due to focus, composition and modifiers.
7647
- // This #4521 by skipping the unnecesarry `checked` update.
7648
- cur !== oldProps[key]
7649
- ) {
7650
- // some property updates can throw
7651
- // e.g. `value` on <progress> w/ non-finite value
7652
- try {
7653
- elm[key] = cur;
7654
- } catch (e) {}
7655
- }
7656
- }
7657
- }
7658
-
7659
- // check platforms/web/util/attrs.js acceptValue
7660
-
7661
-
7662
- function shouldUpdateValue (elm, checkVal) {
7663
- return (!elm.composing && (
7664
- elm.tagName === 'OPTION' ||
7665
- isNotInFocusAndDirty(elm, checkVal) ||
7666
- isDirtyWithModifiers(elm, checkVal)
7667
- ))
7668
- }
7669
-
7670
- function isNotInFocusAndDirty (elm, checkVal) {
7671
- // return true when textbox (.number and .trim) loses focus and its value is
7672
- // not equal to the updated value
7673
- var notInFocus = true;
7674
- // #6157
7675
- // work around IE bug when accessing document.activeElement in an iframe
7676
- try { notInFocus = document.activeElement !== elm; } catch (e) {}
7677
- return notInFocus && elm.value !== checkVal
7678
- }
7679
-
7680
- function isDirtyWithModifiers (elm, newVal) {
7681
- var value = elm.value;
7682
- var modifiers = elm._vModifiers; // injected by v-model runtime
7683
- if (isDef(modifiers)) {
7684
- if (modifiers.number) {
7685
- return toNumber(value) !== toNumber(newVal)
7686
- }
7687
- if (modifiers.trim) {
7688
- return value.trim() !== newVal.trim()
7689
- }
7690
- }
7691
- return value !== newVal
7692
- }
7693
-
7694
- var domProps = {
7695
- create: updateDOMProps,
7696
- update: updateDOMProps
7697
- };
7698
-
7699
- /* */
7700
-
7701
- var parseStyleText = cached(function (cssText) {
7702
- var res = {};
7703
- var listDelimiter = /;(?![^(]*\))/g;
7704
- var propertyDelimiter = /:(.+)/;
7705
- cssText.split(listDelimiter).forEach(function (item) {
7706
- if (item) {
7707
- var tmp = item.split(propertyDelimiter);
7708
- tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7709
- }
7710
- });
7711
- return res
7712
- });
7713
-
7714
- // merge static and dynamic style data on the same vnode
7715
- function normalizeStyleData (data) {
7716
- var style = normalizeStyleBinding(data.style);
7717
- // static style is pre-processed into an object during compilation
7718
- // and is always a fresh object, so it's safe to merge into it
7719
- return data.staticStyle
7720
- ? extend(data.staticStyle, style)
7721
- : style
7722
- }
7723
-
7724
- // normalize possible array / string values into Object
7725
- function normalizeStyleBinding (bindingStyle) {
7726
- if (Array.isArray(bindingStyle)) {
7727
- return toObject(bindingStyle)
7728
- }
7729
- if (typeof bindingStyle === 'string') {
7730
- return parseStyleText(bindingStyle)
7731
- }
7732
- return bindingStyle
7733
- }
7734
-
7735
- /**
7736
- * parent component style should be after child's
7737
- * so that parent component's style could override it
7738
- */
7739
- function getStyle (vnode, checkChild) {
7740
- var res = {};
7741
- var styleData;
7742
-
7743
- if (checkChild) {
7744
- var childNode = vnode;
7745
- while (childNode.componentInstance) {
7746
- childNode = childNode.componentInstance._vnode;
7747
- if (
7748
- childNode && childNode.data &&
7749
- (styleData = normalizeStyleData(childNode.data))
7750
- ) {
7751
- extend(res, styleData);
7752
- }
7753
- }
7754
- }
7755
-
7756
- if ((styleData = normalizeStyleData(vnode.data))) {
7757
- extend(res, styleData);
7758
- }
7759
-
7760
- var parentNode = vnode;
7761
- while ((parentNode = parentNode.parent)) {
7762
- if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7763
- extend(res, styleData);
7764
- }
7765
- }
7766
- return res
7767
- }
7768
-
7769
- /* */
7770
-
7771
- var cssVarRE = /^--/;
7772
- var importantRE = /\s*!important$/;
7773
- var setProp = function (el, name, val) {
7774
- /* istanbul ignore if */
7775
- if (cssVarRE.test(name)) {
7776
- el.style.setProperty(name, val);
7777
- } else if (importantRE.test(val)) {
7778
- el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7779
- } else {
7780
- var normalizedName = normalize(name);
7781
- if (Array.isArray(val)) {
7782
- // Support values array created by autoprefixer, e.g.
7783
- // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7784
- // Set them one by one, and the browser will only set those it can recognize
7785
- for (var i = 0, len = val.length; i < len; i++) {
7786
- el.style[normalizedName] = val[i];
7787
- }
7788
- } else {
7789
- el.style[normalizedName] = val;
7790
- }
7791
- }
7792
- };
7793
-
7794
- var vendorNames = ['Webkit', 'Moz', 'ms'];
7795
-
7796
- var emptyStyle;
7797
- var normalize = cached(function (prop) {
7798
- emptyStyle = emptyStyle || document.createElement('div').style;
7799
- prop = camelize(prop);
7800
- if (prop !== 'filter' && (prop in emptyStyle)) {
7801
- return prop
7802
- }
7803
- var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7804
- for (var i = 0; i < vendorNames.length; i++) {
7805
- var name = vendorNames[i] + capName;
7806
- if (name in emptyStyle) {
7807
- return name
7808
- }
7809
- }
7810
- });
7811
-
7812
- function updateStyle (oldVnode, vnode) {
7813
- var data = vnode.data;
7814
- var oldData = oldVnode.data;
7815
-
7816
- if (isUndef(data.staticStyle) && isUndef(data.style) &&
7817
- isUndef(oldData.staticStyle) && isUndef(oldData.style)
7818
- ) {
7819
- return
7820
- }
7821
-
7822
- var cur, name;
7823
- var el = vnode.elm;
7824
- var oldStaticStyle = oldData.staticStyle;
7825
- var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
7826
-
7827
- // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7828
- var oldStyle = oldStaticStyle || oldStyleBinding;
7829
-
7830
- var style = normalizeStyleBinding(vnode.data.style) || {};
7831
-
7832
- // store normalized style under a different key for next diff
7833
- // make sure to clone it if it's reactive, since the user likely wants
7834
- // to mutate it.
7835
- vnode.data.normalizedStyle = isDef(style.__ob__)
7836
- ? extend({}, style)
7837
- : style;
7838
-
7839
- var newStyle = getStyle(vnode, true);
7840
-
7841
- for (name in oldStyle) {
7842
- if (isUndef(newStyle[name])) {
7843
- setProp(el, name, '');
7844
- }
7845
- }
7846
- for (name in newStyle) {
7847
- cur = newStyle[name];
7848
- if (cur !== oldStyle[name]) {
7849
- // ie9 setting to null has no effect, must use empty string
7850
- setProp(el, name, cur == null ? '' : cur);
7851
- }
7852
- }
7853
- }
7854
-
7855
- var style = {
7856
- create: updateStyle,
7857
- update: updateStyle
7858
- };
7859
-
7860
- /* */
7861
-
7862
- var whitespaceRE = /\s+/;
7863
-
7864
- /**
7865
- * Add class with compatibility for SVG since classList is not supported on
7866
- * SVG elements in IE
7867
- */
7868
- function addClass (el, cls) {
7869
- /* istanbul ignore if */
7870
- if (!cls || !(cls = cls.trim())) {
7871
- return
7872
- }
7873
-
7874
- /* istanbul ignore else */
7875
- if (el.classList) {
7876
- if (cls.indexOf(' ') > -1) {
7877
- cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
7878
- } else {
7879
- el.classList.add(cls);
7880
- }
7881
- } else {
7882
- var cur = " " + (el.getAttribute('class') || '') + " ";
7883
- if (cur.indexOf(' ' + cls + ' ') < 0) {
7884
- el.setAttribute('class', (cur + cls).trim());
7885
- }
7886
- }
7887
- }
7888
-
7889
- /**
7890
- * Remove class with compatibility for SVG since classList is not supported on
7891
- * SVG elements in IE
7892
- */
7893
- function removeClass (el, cls) {
7894
- /* istanbul ignore if */
7895
- if (!cls || !(cls = cls.trim())) {
7896
- return
7897
- }
7898
-
7899
- /* istanbul ignore else */
7900
- if (el.classList) {
7901
- if (cls.indexOf(' ') > -1) {
7902
- cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
7903
- } else {
7904
- el.classList.remove(cls);
7905
- }
7906
- if (!el.classList.length) {
7907
- el.removeAttribute('class');
7908
- }
7909
- } else {
7910
- var cur = " " + (el.getAttribute('class') || '') + " ";
7911
- var tar = ' ' + cls + ' ';
7912
- while (cur.indexOf(tar) >= 0) {
7913
- cur = cur.replace(tar, ' ');
7914
- }
7915
- cur = cur.trim();
7916
- if (cur) {
7917
- el.setAttribute('class', cur);
7918
- } else {
7919
- el.removeAttribute('class');
7920
- }
7921
- }
7922
- }
7923
-
7924
- /* */
7925
-
7926
- function resolveTransition (def$$1) {
7927
- if (!def$$1) {
7928
- return
7929
- }
7930
- /* istanbul ignore else */
7931
- if (typeof def$$1 === 'object') {
7932
- var res = {};
7933
- if (def$$1.css !== false) {
7934
- extend(res, autoCssTransition(def$$1.name || 'v'));
7935
- }
7936
- extend(res, def$$1);
7937
- return res
7938
- } else if (typeof def$$1 === 'string') {
7939
- return autoCssTransition(def$$1)
7940
- }
7941
- }
7942
-
7943
- var autoCssTransition = cached(function (name) {
7944
- return {
7945
- enterClass: (name + "-enter"),
7946
- enterToClass: (name + "-enter-to"),
7947
- enterActiveClass: (name + "-enter-active"),
7948
- leaveClass: (name + "-leave"),
7949
- leaveToClass: (name + "-leave-to"),
7950
- leaveActiveClass: (name + "-leave-active")
7951
- }
7952
- });
7953
-
7954
- var hasTransition = inBrowser && !isIE9;
7955
- var TRANSITION = 'transition';
7956
- var ANIMATION = 'animation';
7957
-
7958
- // Transition property/event sniffing
7959
- var transitionProp = 'transition';
7960
- var transitionEndEvent = 'transitionend';
7961
- var animationProp = 'animation';
7962
- var animationEndEvent = 'animationend';
7963
- if (hasTransition) {
7964
- /* istanbul ignore if */
7965
- if (window.ontransitionend === undefined &&
7966
- window.onwebkittransitionend !== undefined
7967
- ) {
7968
- transitionProp = 'WebkitTransition';
7969
- transitionEndEvent = 'webkitTransitionEnd';
7970
- }
7971
- if (window.onanimationend === undefined &&
7972
- window.onwebkitanimationend !== undefined
7973
- ) {
7974
- animationProp = 'WebkitAnimation';
7975
- animationEndEvent = 'webkitAnimationEnd';
7976
- }
7977
- }
7978
-
7979
- // binding to window is necessary to make hot reload work in IE in strict mode
7980
- var raf = inBrowser
7981
- ? window.requestAnimationFrame
7982
- ? window.requestAnimationFrame.bind(window)
7983
- : setTimeout
7984
- : /* istanbul ignore next */ function (fn) { return fn(); };
7985
-
7986
- function nextFrame (fn) {
7987
- raf(function () {
7988
- raf(fn);
7989
- });
7990
- }
7991
-
7992
- function addTransitionClass (el, cls) {
7993
- var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
7994
- if (transitionClasses.indexOf(cls) < 0) {
7995
- transitionClasses.push(cls);
7996
- addClass(el, cls);
7997
- }
7998
- }
7999
-
8000
- function removeTransitionClass (el, cls) {
8001
- if (el._transitionClasses) {
8002
- remove(el._transitionClasses, cls);
8003
- }
8004
- removeClass(el, cls);
8005
- }
8006
-
8007
- function whenTransitionEnds (
8008
- el,
8009
- expectedType,
8010
- cb
8011
- ) {
8012
- var ref = getTransitionInfo(el, expectedType);
8013
- var type = ref.type;
8014
- var timeout = ref.timeout;
8015
- var propCount = ref.propCount;
8016
- if (!type) { return cb() }
8017
- var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
8018
- var ended = 0;
8019
- var end = function () {
8020
- el.removeEventListener(event, onEnd);
8021
- cb();
8022
- };
8023
- var onEnd = function (e) {
8024
- if (e.target === el) {
8025
- if (++ended >= propCount) {
8026
- end();
8027
- }
8028
- }
8029
- };
8030
- setTimeout(function () {
8031
- if (ended < propCount) {
8032
- end();
8033
- }
8034
- }, timeout + 1);
8035
- el.addEventListener(event, onEnd);
8036
- }
8037
-
8038
- var transformRE = /\b(transform|all)(,|$)/;
8039
-
8040
- function getTransitionInfo (el, expectedType) {
8041
- var styles = window.getComputedStyle(el);
8042
- // JSDOM may return undefined for transition properties
8043
- var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
8044
- var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
8045
- var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
8046
- var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
8047
- var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
8048
- var animationTimeout = getTimeout(animationDelays, animationDurations);
8049
-
8050
- var type;
8051
- var timeout = 0;
8052
- var propCount = 0;
8053
- /* istanbul ignore if */
8054
- if (expectedType === TRANSITION) {
8055
- if (transitionTimeout > 0) {
8056
- type = TRANSITION;
8057
- timeout = transitionTimeout;
8058
- propCount = transitionDurations.length;
8059
- }
8060
- } else if (expectedType === ANIMATION) {
8061
- if (animationTimeout > 0) {
8062
- type = ANIMATION;
8063
- timeout = animationTimeout;
8064
- propCount = animationDurations.length;
8065
- }
8066
- } else {
8067
- timeout = Math.max(transitionTimeout, animationTimeout);
8068
- type = timeout > 0
8069
- ? transitionTimeout > animationTimeout
8070
- ? TRANSITION
8071
- : ANIMATION
8072
- : null;
8073
- propCount = type
8074
- ? type === TRANSITION
8075
- ? transitionDurations.length
8076
- : animationDurations.length
8077
- : 0;
8078
- }
8079
- var hasTransform =
8080
- type === TRANSITION &&
8081
- transformRE.test(styles[transitionProp + 'Property']);
8082
- return {
8083
- type: type,
8084
- timeout: timeout,
8085
- propCount: propCount,
8086
- hasTransform: hasTransform
8087
- }
8088
- }
8089
-
8090
- function getTimeout (delays, durations) {
8091
- /* istanbul ignore next */
8092
- while (delays.length < durations.length) {
8093
- delays = delays.concat(delays);
8094
- }
8095
-
8096
- return Math.max.apply(null, durations.map(function (d, i) {
8097
- return toMs(d) + toMs(delays[i])
8098
- }))
8099
- }
8100
-
8101
- // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
8102
- // in a locale-dependent way, using a comma instead of a dot.
8103
- // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
8104
- // as a floor function) causing unexpected behaviors
8105
- function toMs (s) {
8106
- return Number(s.slice(0, -1).replace(',', '.')) * 1000
8107
- }
8108
-
8109
- /* */
8110
-
8111
- function enter (vnode, toggleDisplay) {
8112
- var el = vnode.elm;
8113
-
8114
- // call leave callback now
8115
- if (isDef(el._leaveCb)) {
8116
- el._leaveCb.cancelled = true;
8117
- el._leaveCb();
8118
- }
8119
-
8120
- var data = resolveTransition(vnode.data.transition);
8121
- if (isUndef(data)) {
8122
- return
8123
- }
8124
-
8125
- /* istanbul ignore if */
8126
- if (isDef(el._enterCb) || el.nodeType !== 1) {
8127
- return
8128
- }
8129
-
8130
- var css = data.css;
8131
- var type = data.type;
8132
- var enterClass = data.enterClass;
8133
- var enterToClass = data.enterToClass;
8134
- var enterActiveClass = data.enterActiveClass;
8135
- var appearClass = data.appearClass;
8136
- var appearToClass = data.appearToClass;
8137
- var appearActiveClass = data.appearActiveClass;
8138
- var beforeEnter = data.beforeEnter;
8139
- var enter = data.enter;
8140
- var afterEnter = data.afterEnter;
8141
- var enterCancelled = data.enterCancelled;
8142
- var beforeAppear = data.beforeAppear;
8143
- var appear = data.appear;
8144
- var afterAppear = data.afterAppear;
8145
- var appearCancelled = data.appearCancelled;
8146
- var duration = data.duration;
8147
-
8148
- // activeInstance will always be the <transition> component managing this
8149
- // transition. One edge case to check is when the <transition> is placed
8150
- // as the root node of a child component. In that case we need to check
8151
- // <transition>'s parent for appear check.
8152
- var context = activeInstance;
8153
- var transitionNode = activeInstance.$vnode;
8154
- while (transitionNode && transitionNode.parent) {
8155
- context = transitionNode.context;
8156
- transitionNode = transitionNode.parent;
8157
- }
8158
-
8159
- var isAppear = !context._isMounted || !vnode.isRootInsert;
8160
-
8161
- if (isAppear && !appear && appear !== '') {
8162
- return
8163
- }
8164
-
8165
- var startClass = isAppear && appearClass
8166
- ? appearClass
8167
- : enterClass;
8168
- var activeClass = isAppear && appearActiveClass
8169
- ? appearActiveClass
8170
- : enterActiveClass;
8171
- var toClass = isAppear && appearToClass
8172
- ? appearToClass
8173
- : enterToClass;
8174
-
8175
- var beforeEnterHook = isAppear
8176
- ? (beforeAppear || beforeEnter)
8177
- : beforeEnter;
8178
- var enterHook = isAppear
8179
- ? (typeof appear === 'function' ? appear : enter)
8180
- : enter;
8181
- var afterEnterHook = isAppear
8182
- ? (afterAppear || afterEnter)
8183
- : afterEnter;
8184
- var enterCancelledHook = isAppear
8185
- ? (appearCancelled || enterCancelled)
8186
- : enterCancelled;
8187
-
8188
- var explicitEnterDuration = toNumber(
8189
- isObject(duration)
8190
- ? duration.enter
8191
- : duration
8192
- );
8193
-
8194
- if (explicitEnterDuration != null) {
8195
- checkDuration(explicitEnterDuration, 'enter', vnode);
8196
- }
8197
-
8198
- var expectsCSS = css !== false && !isIE9;
8199
- var userWantsControl = getHookArgumentsLength(enterHook);
8200
-
8201
- var cb = el._enterCb = once(function () {
8202
- if (expectsCSS) {
8203
- removeTransitionClass(el, toClass);
8204
- removeTransitionClass(el, activeClass);
8205
- }
8206
- if (cb.cancelled) {
8207
- if (expectsCSS) {
8208
- removeTransitionClass(el, startClass);
8209
- }
8210
- enterCancelledHook && enterCancelledHook(el);
8211
- } else {
8212
- afterEnterHook && afterEnterHook(el);
8213
- }
8214
- el._enterCb = null;
8215
- });
8216
-
8217
- if (!vnode.data.show) {
8218
- // remove pending leave element on enter by injecting an insert hook
8219
- mergeVNodeHook(vnode, 'insert', function () {
8220
- var parent = el.parentNode;
8221
- var pendingNode = parent && parent._pending && parent._pending[vnode.key];
8222
- if (pendingNode &&
8223
- pendingNode.tag === vnode.tag &&
8224
- pendingNode.elm._leaveCb
8225
- ) {
8226
- pendingNode.elm._leaveCb();
8227
- }
8228
- enterHook && enterHook(el, cb);
8229
- });
8230
- }
8231
-
8232
- // start enter transition
8233
- beforeEnterHook && beforeEnterHook(el);
8234
- if (expectsCSS) {
8235
- addTransitionClass(el, startClass);
8236
- addTransitionClass(el, activeClass);
8237
- nextFrame(function () {
8238
- removeTransitionClass(el, startClass);
8239
- if (!cb.cancelled) {
8240
- addTransitionClass(el, toClass);
8241
- if (!userWantsControl) {
8242
- if (isValidDuration(explicitEnterDuration)) {
8243
- setTimeout(cb, explicitEnterDuration);
8244
- } else {
8245
- whenTransitionEnds(el, type, cb);
8246
- }
8247
- }
8248
- }
8249
- });
8250
- }
8251
-
8252
- if (vnode.data.show) {
8253
- toggleDisplay && toggleDisplay();
8254
- enterHook && enterHook(el, cb);
8255
- }
8256
-
8257
- if (!expectsCSS && !userWantsControl) {
8258
- cb();
8259
- }
8260
- }
8261
-
8262
- function leave (vnode, rm) {
8263
- var el = vnode.elm;
8264
-
8265
- // call enter callback now
8266
- if (isDef(el._enterCb)) {
8267
- el._enterCb.cancelled = true;
8268
- el._enterCb();
8269
- }
8270
-
8271
- var data = resolveTransition(vnode.data.transition);
8272
- if (isUndef(data) || el.nodeType !== 1) {
8273
- return rm()
8274
- }
8275
-
8276
- /* istanbul ignore if */
8277
- if (isDef(el._leaveCb)) {
8278
- return
8279
- }
8280
-
8281
- var css = data.css;
8282
- var type = data.type;
8283
- var leaveClass = data.leaveClass;
8284
- var leaveToClass = data.leaveToClass;
8285
- var leaveActiveClass = data.leaveActiveClass;
8286
- var beforeLeave = data.beforeLeave;
8287
- var leave = data.leave;
8288
- var afterLeave = data.afterLeave;
8289
- var leaveCancelled = data.leaveCancelled;
8290
- var delayLeave = data.delayLeave;
8291
- var duration = data.duration;
8292
-
8293
- var expectsCSS = css !== false && !isIE9;
8294
- var userWantsControl = getHookArgumentsLength(leave);
8295
-
8296
- var explicitLeaveDuration = toNumber(
8297
- isObject(duration)
8298
- ? duration.leave
8299
- : duration
8300
- );
8301
-
8302
- if (isDef(explicitLeaveDuration)) {
8303
- checkDuration(explicitLeaveDuration, 'leave', vnode);
8304
- }
8305
-
8306
- var cb = el._leaveCb = once(function () {
8307
- if (el.parentNode && el.parentNode._pending) {
8308
- el.parentNode._pending[vnode.key] = null;
8309
- }
8310
- if (expectsCSS) {
8311
- removeTransitionClass(el, leaveToClass);
8312
- removeTransitionClass(el, leaveActiveClass);
8313
- }
8314
- if (cb.cancelled) {
8315
- if (expectsCSS) {
8316
- removeTransitionClass(el, leaveClass);
8317
- }
8318
- leaveCancelled && leaveCancelled(el);
8319
- } else {
8320
- rm();
8321
- afterLeave && afterLeave(el);
8322
- }
8323
- el._leaveCb = null;
8324
- });
8325
-
8326
- if (delayLeave) {
8327
- delayLeave(performLeave);
8328
- } else {
8329
- performLeave();
8330
- }
8331
-
8332
- function performLeave () {
8333
- // the delayed leave may have already been cancelled
8334
- if (cb.cancelled) {
8335
- return
8336
- }
8337
- // record leaving element
8338
- if (!vnode.data.show && el.parentNode) {
8339
- (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
8340
- }
8341
- beforeLeave && beforeLeave(el);
8342
- if (expectsCSS) {
8343
- addTransitionClass(el, leaveClass);
8344
- addTransitionClass(el, leaveActiveClass);
8345
- nextFrame(function () {
8346
- removeTransitionClass(el, leaveClass);
8347
- if (!cb.cancelled) {
8348
- addTransitionClass(el, leaveToClass);
8349
- if (!userWantsControl) {
8350
- if (isValidDuration(explicitLeaveDuration)) {
8351
- setTimeout(cb, explicitLeaveDuration);
8352
- } else {
8353
- whenTransitionEnds(el, type, cb);
8354
- }
8355
- }
8356
- }
8357
- });
8358
- }
8359
- leave && leave(el, cb);
8360
- if (!expectsCSS && !userWantsControl) {
8361
- cb();
8362
- }
8363
- }
8364
- }
8365
-
8366
- // only used in dev mode
8367
- function checkDuration (val, name, vnode) {
8368
- if (typeof val !== 'number') {
8369
- warn(
8370
- "<transition> explicit " + name + " duration is not a valid number - " +
8371
- "got " + (JSON.stringify(val)) + ".",
8372
- vnode.context
8373
- );
8374
- } else if (isNaN(val)) {
8375
- warn(
8376
- "<transition> explicit " + name + " duration is NaN - " +
8377
- 'the duration expression might be incorrect.',
8378
- vnode.context
8379
- );
8380
- }
8381
- }
8382
-
8383
- function isValidDuration (val) {
8384
- return typeof val === 'number' && !isNaN(val)
8385
- }
8386
-
8387
- /**
8388
- * Normalize a transition hook's argument length. The hook may be:
8389
- * - a merged hook (invoker) with the original in .fns
8390
- * - a wrapped component method (check ._length)
8391
- * - a plain function (.length)
8392
- */
8393
- function getHookArgumentsLength (fn) {
8394
- if (isUndef(fn)) {
8395
- return false
8396
- }
8397
- var invokerFns = fn.fns;
8398
- if (isDef(invokerFns)) {
8399
- // invoker
8400
- return getHookArgumentsLength(
8401
- Array.isArray(invokerFns)
8402
- ? invokerFns[0]
8403
- : invokerFns
8404
- )
8405
- } else {
8406
- return (fn._length || fn.length) > 1
8407
- }
8408
- }
8409
-
8410
- function _enter (_, vnode) {
8411
- if (vnode.data.show !== true) {
8412
- enter(vnode);
8413
- }
8414
- }
8415
-
8416
- var transition = inBrowser ? {
8417
- create: _enter,
8418
- activate: _enter,
8419
- remove: function remove$$1 (vnode, rm) {
8420
- /* istanbul ignore else */
8421
- if (vnode.data.show !== true) {
8422
- leave(vnode, rm);
8423
- } else {
8424
- rm();
8425
- }
8426
- }
8427
- } : {};
8428
-
8429
- var platformModules = [
8430
- attrs,
8431
- klass,
8432
- events,
8433
- domProps,
8434
- style,
8435
- transition
8436
- ];
8437
-
8438
- /* */
8439
-
8440
- // the directive module should be applied last, after all
8441
- // built-in modules have been applied.
8442
- var modules = platformModules.concat(baseModules);
8443
-
8444
- var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
8445
-
8446
- /**
8447
- * Not type checking this file because flow doesn't like attaching
8448
- * properties to Elements.
8449
- */
8450
-
8451
- /* istanbul ignore if */
8452
- if (isIE9) {
8453
- // http://www.matts411.com/post/internet-explorer-9-oninput/
8454
- document.addEventListener('selectionchange', function () {
8455
- var el = document.activeElement;
8456
- if (el && el.vmodel) {
8457
- trigger(el, 'input');
8458
- }
8459
- });
8460
- }
8461
-
8462
- var directive = {
8463
- inserted: function inserted (el, binding, vnode, oldVnode) {
8464
- if (vnode.tag === 'select') {
8465
- // #6903
8466
- if (oldVnode.elm && !oldVnode.elm._vOptions) {
8467
- mergeVNodeHook(vnode, 'postpatch', function () {
8468
- directive.componentUpdated(el, binding, vnode);
8469
- });
8470
- } else {
8471
- setSelected(el, binding, vnode.context);
8472
- }
8473
- el._vOptions = [].map.call(el.options, getValue);
8474
- } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8475
- el._vModifiers = binding.modifiers;
8476
- if (!binding.modifiers.lazy) {
8477
- el.addEventListener('compositionstart', onCompositionStart);
8478
- el.addEventListener('compositionend', onCompositionEnd);
8479
- // Safari < 10.2 & UIWebView doesn't fire compositionend when
8480
- // switching focus before confirming composition choice
8481
- // this also fixes the issue where some browsers e.g. iOS Chrome
8482
- // fires "change" instead of "input" on autocomplete.
8483
- el.addEventListener('change', onCompositionEnd);
8484
- /* istanbul ignore if */
8485
- if (isIE9) {
8486
- el.vmodel = true;
8487
- }
8488
- }
8489
- }
8490
- },
8491
-
8492
- componentUpdated: function componentUpdated (el, binding, vnode) {
8493
- if (vnode.tag === 'select') {
8494
- setSelected(el, binding, vnode.context);
8495
- // in case the options rendered by v-for have changed,
8496
- // it's possible that the value is out-of-sync with the rendered options.
8497
- // detect such cases and filter out values that no longer has a matching
8498
- // option in the DOM.
8499
- var prevOptions = el._vOptions;
8500
- var curOptions = el._vOptions = [].map.call(el.options, getValue);
8501
- if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
8502
- // trigger change event if
8503
- // no matching option found for at least one value
8504
- var needReset = el.multiple
8505
- ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
8506
- : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
8507
- if (needReset) {
8508
- trigger(el, 'change');
8509
- }
8510
- }
8511
- }
8512
- }
8513
- };
8514
-
8515
- function setSelected (el, binding, vm) {
8516
- actuallySetSelected(el, binding, vm);
8517
- /* istanbul ignore if */
8518
- if (isIE || isEdge) {
8519
- setTimeout(function () {
8520
- actuallySetSelected(el, binding, vm);
8521
- }, 0);
8522
- }
8523
- }
8524
-
8525
- function actuallySetSelected (el, binding, vm) {
8526
- var value = binding.value;
8527
- var isMultiple = el.multiple;
8528
- if (isMultiple && !Array.isArray(value)) {
8529
- warn(
8530
- "<select multiple v-model=\"" + (binding.expression) + "\"> " +
8531
- "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
8532
- vm
8533
- );
8534
- return
8535
- }
8536
- var selected, option;
8537
- for (var i = 0, l = el.options.length; i < l; i++) {
8538
- option = el.options[i];
8539
- if (isMultiple) {
8540
- selected = looseIndexOf(value, getValue(option)) > -1;
8541
- if (option.selected !== selected) {
8542
- option.selected = selected;
8543
- }
8544
- } else {
8545
- if (looseEqual(getValue(option), value)) {
8546
- if (el.selectedIndex !== i) {
8547
- el.selectedIndex = i;
8548
- }
8549
- return
8550
- }
8551
- }
8552
- }
8553
- if (!isMultiple) {
8554
- el.selectedIndex = -1;
8555
- }
8556
- }
8557
-
8558
- function hasNoMatchingOption (value, options) {
8559
- return options.every(function (o) { return !looseEqual(o, value); })
8560
- }
8561
-
8562
- function getValue (option) {
8563
- return '_value' in option
8564
- ? option._value
8565
- : option.value
8566
- }
8567
-
8568
- function onCompositionStart (e) {
8569
- e.target.composing = true;
8570
- }
8571
-
8572
- function onCompositionEnd (e) {
8573
- // prevent triggering an input event for no reason
8574
- if (!e.target.composing) { return }
8575
- e.target.composing = false;
8576
- trigger(e.target, 'input');
8577
- }
8578
-
8579
- function trigger (el, type) {
8580
- var e = document.createEvent('HTMLEvents');
8581
- e.initEvent(type, true, true);
8582
- el.dispatchEvent(e);
8583
- }
8584
-
8585
- /* */
8586
-
8587
- // recursively search for possible transition defined inside the component root
8588
- function locateNode (vnode) {
8589
- return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
8590
- ? locateNode(vnode.componentInstance._vnode)
8591
- : vnode
8592
- }
8593
-
8594
- var show = {
8595
- bind: function bind (el, ref, vnode) {
8596
- var value = ref.value;
8597
-
8598
- vnode = locateNode(vnode);
8599
- var transition$$1 = vnode.data && vnode.data.transition;
8600
- var originalDisplay = el.__vOriginalDisplay =
8601
- el.style.display === 'none' ? '' : el.style.display;
8602
- if (value && transition$$1) {
8603
- vnode.data.show = true;
8604
- enter(vnode, function () {
8605
- el.style.display = originalDisplay;
8606
- });
8607
- } else {
8608
- el.style.display = value ? originalDisplay : 'none';
8609
- }
8610
- },
8611
-
8612
- update: function update (el, ref, vnode) {
8613
- var value = ref.value;
8614
- var oldValue = ref.oldValue;
8615
-
8616
- /* istanbul ignore if */
8617
- if (!value === !oldValue) { return }
8618
- vnode = locateNode(vnode);
8619
- var transition$$1 = vnode.data && vnode.data.transition;
8620
- if (transition$$1) {
8621
- vnode.data.show = true;
8622
- if (value) {
8623
- enter(vnode, function () {
8624
- el.style.display = el.__vOriginalDisplay;
8625
- });
8626
- } else {
8627
- leave(vnode, function () {
8628
- el.style.display = 'none';
8629
- });
8630
- }
8631
- } else {
8632
- el.style.display = value ? el.__vOriginalDisplay : 'none';
8633
- }
8634
- },
8635
-
8636
- unbind: function unbind (
8637
- el,
8638
- binding,
8639
- vnode,
8640
- oldVnode,
8641
- isDestroy
8642
- ) {
8643
- if (!isDestroy) {
8644
- el.style.display = el.__vOriginalDisplay;
8645
- }
8646
- }
8647
- };
8648
-
8649
- var platformDirectives = {
8650
- model: directive,
8651
- show: show
8652
- };
8653
-
8654
- /* */
8655
-
8656
- var transitionProps = {
8657
- name: String,
8658
- appear: Boolean,
8659
- css: Boolean,
8660
- mode: String,
8661
- type: String,
8662
- enterClass: String,
8663
- leaveClass: String,
8664
- enterToClass: String,
8665
- leaveToClass: String,
8666
- enterActiveClass: String,
8667
- leaveActiveClass: String,
8668
- appearClass: String,
8669
- appearActiveClass: String,
8670
- appearToClass: String,
8671
- duration: [Number, String, Object]
8672
- };
8673
-
8674
- // in case the child is also an abstract component, e.g. <keep-alive>
8675
- // we want to recursively retrieve the real component to be rendered
8676
- function getRealChild (vnode) {
8677
- var compOptions = vnode && vnode.componentOptions;
8678
- if (compOptions && compOptions.Ctor.options.abstract) {
8679
- return getRealChild(getFirstComponentChild(compOptions.children))
8680
- } else {
8681
- return vnode
8682
- }
8683
- }
8684
-
8685
- function extractTransitionData (comp) {
8686
- var data = {};
8687
- var options = comp.$options;
8688
- // props
8689
- for (var key in options.propsData) {
8690
- data[key] = comp[key];
8691
- }
8692
- // events.
8693
- // extract listeners and pass them directly to the transition methods
8694
- var listeners = options._parentListeners;
8695
- for (var key$1 in listeners) {
8696
- data[camelize(key$1)] = listeners[key$1];
8697
- }
8698
- return data
8699
- }
8700
-
8701
- function placeholder (h, rawChild) {
8702
- if (/\d-keep-alive$/.test(rawChild.tag)) {
8703
- return h('keep-alive', {
8704
- props: rawChild.componentOptions.propsData
8705
- })
8706
- }
8707
- }
8708
-
8709
- function hasParentTransition (vnode) {
8710
- while ((vnode = vnode.parent)) {
8711
- if (vnode.data.transition) {
8712
- return true
8713
- }
8714
- }
8715
- }
8716
-
8717
- function isSameChild (child, oldChild) {
8718
- return oldChild.key === child.key && oldChild.tag === child.tag
8719
- }
8720
-
8721
- var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
8722
-
8723
- var isVShowDirective = function (d) { return d.name === 'show'; };
8724
-
8725
- var Transition = {
8726
- name: 'transition',
8727
- props: transitionProps,
8728
- abstract: true,
8729
-
8730
- render: function render (h) {
8731
- var this$1 = this;
8732
-
8733
- var children = this.$slots.default;
8734
- if (!children) {
8735
- return
8736
- }
8737
-
8738
- // filter out text nodes (possible whitespaces)
8739
- children = children.filter(isNotTextNode);
8740
- /* istanbul ignore if */
8741
- if (!children.length) {
8742
- return
8743
- }
8744
-
8745
- // warn multiple elements
8746
- if (children.length > 1) {
8747
- warn(
8748
- '<transition> can only be used on a single element. Use ' +
8749
- '<transition-group> for lists.',
8750
- this.$parent
8751
- );
8752
- }
8753
-
8754
- var mode = this.mode;
8755
-
8756
- // warn invalid mode
8757
- if (mode && mode !== 'in-out' && mode !== 'out-in'
8758
- ) {
8759
- warn(
8760
- 'invalid <transition> mode: ' + mode,
8761
- this.$parent
8762
- );
8763
- }
8764
-
8765
- var rawChild = children[0];
8766
-
8767
- // if this is a component root node and the component's
8768
- // parent container node also has transition, skip.
8769
- if (hasParentTransition(this.$vnode)) {
8770
- return rawChild
8771
- }
8772
-
8773
- // apply transition data to child
8774
- // use getRealChild() to ignore abstract components e.g. keep-alive
8775
- var child = getRealChild(rawChild);
8776
- /* istanbul ignore if */
8777
- if (!child) {
8778
- return rawChild
8779
- }
8780
-
8781
- if (this._leaving) {
8782
- return placeholder(h, rawChild)
8783
- }
8784
-
8785
- // ensure a key that is unique to the vnode type and to this transition
8786
- // component instance. This key will be used to remove pending leaving nodes
8787
- // during entering.
8788
- var id = "__transition-" + (this._uid) + "-";
8789
- child.key = child.key == null
8790
- ? child.isComment
8791
- ? id + 'comment'
8792
- : id + child.tag
8793
- : isPrimitive(child.key)
8794
- ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
8795
- : child.key;
8796
-
8797
- var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8798
- var oldRawChild = this._vnode;
8799
- var oldChild = getRealChild(oldRawChild);
8800
-
8801
- // mark v-show
8802
- // so that the transition module can hand over the control to the directive
8803
- if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8804
- child.data.show = true;
8805
- }
8806
-
8807
- if (
8808
- oldChild &&
8809
- oldChild.data &&
8810
- !isSameChild(child, oldChild) &&
8811
- !isAsyncPlaceholder(oldChild) &&
8812
- // #6687 component root is a comment node
8813
- !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
8814
- ) {
8815
- // replace old child transition data with fresh one
8816
- // important for dynamic transitions!
8817
- var oldData = oldChild.data.transition = extend({}, data);
8818
- // handle transition mode
8819
- if (mode === 'out-in') {
8820
- // return placeholder node and queue update when leave finishes
8821
- this._leaving = true;
8822
- mergeVNodeHook(oldData, 'afterLeave', function () {
8823
- this$1._leaving = false;
8824
- this$1.$forceUpdate();
8825
- });
8826
- return placeholder(h, rawChild)
8827
- } else if (mode === 'in-out') {
8828
- if (isAsyncPlaceholder(child)) {
8829
- return oldRawChild
8830
- }
8831
- var delayedLeave;
8832
- var performLeave = function () { delayedLeave(); };
8833
- mergeVNodeHook(data, 'afterEnter', performLeave);
8834
- mergeVNodeHook(data, 'enterCancelled', performLeave);
8835
- mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
8836
- }
8837
- }
8838
-
8839
- return rawChild
8840
- }
8841
- };
8842
-
8843
- /* */
8844
-
8845
- var props = extend({
8846
- tag: String,
8847
- moveClass: String
8848
- }, transitionProps);
8849
-
8850
- delete props.mode;
8851
-
8852
- var TransitionGroup = {
8853
- props: props,
8854
-
8855
- beforeMount: function beforeMount () {
8856
- var this$1 = this;
8857
-
8858
- var update = this._update;
8859
- this._update = function (vnode, hydrating) {
8860
- var restoreActiveInstance = setActiveInstance(this$1);
8861
- // force removing pass
8862
- this$1.__patch__(
8863
- this$1._vnode,
8864
- this$1.kept,
8865
- false, // hydrating
8866
- true // removeOnly (!important, avoids unnecessary moves)
8867
- );
8868
- this$1._vnode = this$1.kept;
8869
- restoreActiveInstance();
8870
- update.call(this$1, vnode, hydrating);
8871
- };
8872
- },
8873
-
8874
- render: function render (h) {
8875
- var tag = this.tag || this.$vnode.data.tag || 'span';
8876
- var map = Object.create(null);
8877
- var prevChildren = this.prevChildren = this.children;
8878
- var rawChildren = this.$slots.default || [];
8879
- var children = this.children = [];
8880
- var transitionData = extractTransitionData(this);
8881
-
8882
- for (var i = 0; i < rawChildren.length; i++) {
8883
- var c = rawChildren[i];
8884
- if (c.tag) {
8885
- if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8886
- children.push(c);
8887
- map[c.key] = c
8888
- ;(c.data || (c.data = {})).transition = transitionData;
8889
- } else {
8890
- var opts = c.componentOptions;
8891
- var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
8892
- warn(("<transition-group> children must be keyed: <" + name + ">"));
8893
- }
8894
- }
8895
- }
8896
-
8897
- if (prevChildren) {
8898
- var kept = [];
8899
- var removed = [];
8900
- for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
8901
- var c$1 = prevChildren[i$1];
8902
- c$1.data.transition = transitionData;
8903
- c$1.data.pos = c$1.elm.getBoundingClientRect();
8904
- if (map[c$1.key]) {
8905
- kept.push(c$1);
8906
- } else {
8907
- removed.push(c$1);
8908
- }
8909
- }
8910
- this.kept = h(tag, null, kept);
8911
- this.removed = removed;
8912
- }
8913
-
8914
- return h(tag, null, children)
8915
- },
8916
-
8917
- updated: function updated () {
8918
- var children = this.prevChildren;
8919
- var moveClass = this.moveClass || ((this.name || 'v') + '-move');
8920
- if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
8921
- return
8922
- }
8923
-
8924
- // we divide the work into three loops to avoid mixing DOM reads and writes
8925
- // in each iteration - which helps prevent layout thrashing.
8926
- children.forEach(callPendingCbs);
8927
- children.forEach(recordPosition);
8928
- children.forEach(applyTranslation);
8929
-
8930
- // force reflow to put everything in position
8931
- // assign to this to avoid being removed in tree-shaking
8932
- // $flow-disable-line
8933
- this._reflow = document.body.offsetHeight;
8934
-
8935
- children.forEach(function (c) {
8936
- if (c.data.moved) {
8937
- var el = c.elm;
8938
- var s = el.style;
8939
- addTransitionClass(el, moveClass);
8940
- s.transform = s.WebkitTransform = s.transitionDuration = '';
8941
- el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
8942
- if (e && e.target !== el) {
8943
- return
8944
- }
8945
- if (!e || /transform$/.test(e.propertyName)) {
8946
- el.removeEventListener(transitionEndEvent, cb);
8947
- el._moveCb = null;
8948
- removeTransitionClass(el, moveClass);
8949
- }
8950
- });
8951
- }
8952
- });
8953
- },
8954
-
8955
- methods: {
8956
- hasMove: function hasMove (el, moveClass) {
8957
- /* istanbul ignore if */
8958
- if (!hasTransition) {
8959
- return false
8960
- }
8961
- /* istanbul ignore if */
8962
- if (this._hasMove) {
8963
- return this._hasMove
8964
- }
8965
- // Detect whether an element with the move class applied has
8966
- // CSS transitions. Since the element may be inside an entering
8967
- // transition at this very moment, we make a clone of it and remove
8968
- // all other transition classes applied to ensure only the move class
8969
- // is applied.
8970
- var clone = el.cloneNode();
8971
- if (el._transitionClasses) {
8972
- el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
8973
- }
8974
- addClass(clone, moveClass);
8975
- clone.style.display = 'none';
8976
- this.$el.appendChild(clone);
8977
- var info = getTransitionInfo(clone);
8978
- this.$el.removeChild(clone);
8979
- return (this._hasMove = info.hasTransform)
8980
- }
8981
- }
8982
- };
8983
-
8984
- function callPendingCbs (c) {
8985
- /* istanbul ignore if */
8986
- if (c.elm._moveCb) {
8987
- c.elm._moveCb();
8988
- }
8989
- /* istanbul ignore if */
8990
- if (c.elm._enterCb) {
8991
- c.elm._enterCb();
8992
- }
8993
- }
8994
-
8995
- function recordPosition (c) {
8996
- c.data.newPos = c.elm.getBoundingClientRect();
8997
- }
8998
-
8999
- function applyTranslation (c) {
9000
- var oldPos = c.data.pos;
9001
- var newPos = c.data.newPos;
9002
- var dx = oldPos.left - newPos.left;
9003
- var dy = oldPos.top - newPos.top;
9004
- if (dx || dy) {
9005
- c.data.moved = true;
9006
- var s = c.elm.style;
9007
- s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
9008
- s.transitionDuration = '0s';
9009
- }
9010
- }
9011
-
9012
- var platformComponents = {
9013
- Transition: Transition,
9014
- TransitionGroup: TransitionGroup
9015
- };
9016
-
9017
- /* */
9018
-
9019
- // install platform specific utils
9020
- Vue.config.mustUseProp = mustUseProp;
9021
- Vue.config.isReservedTag = isReservedTag;
9022
- Vue.config.isReservedAttr = isReservedAttr;
9023
- Vue.config.getTagNamespace = getTagNamespace;
9024
- Vue.config.isUnknownElement = isUnknownElement;
9025
-
9026
- // install platform runtime directives & components
9027
- extend(Vue.options.directives, platformDirectives);
9028
- extend(Vue.options.components, platformComponents);
9029
-
9030
- // install platform patch function
9031
- Vue.prototype.__patch__ = inBrowser ? patch : noop;
9032
-
9033
- // public mount method
9034
- Vue.prototype.$mount = function (
9035
- el,
9036
- hydrating
9037
- ) {
9038
- el = el && inBrowser ? query(el) : undefined;
9039
- return mountComponent(this, el, hydrating)
9040
- };
9041
-
9042
- // devtools global hook
9043
- /* istanbul ignore next */
9044
- if (inBrowser) {
9045
- setTimeout(function () {
9046
- if (config.devtools) {
9047
- if (devtools) {
9048
- devtools.emit('init', Vue);
9049
- } else {
9050
- console[console.info ? 'info' : 'log'](
9051
- 'Download the Vue Devtools extension for a better development experience:\n' +
9052
- 'https://github.com/vuejs/vue-devtools'
9053
- );
9054
- }
9055
- }
9056
- if (config.productionTip !== false &&
9057
- typeof console !== 'undefined'
9058
- ) {
9059
- console[console.info ? 'info' : 'log'](
9060
- "You are running Vue in development mode.\n" +
9061
- "Make sure to turn on production mode when deploying for production.\n" +
9062
- "See more tips at https://vuejs.org/guide/deployment.html"
9063
- );
9064
- }
9065
- }, 0);
9066
- }
9067
-
9068
- /* */
9069
-
9070
- var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
9071
- var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
9072
-
9073
- var buildRegex = cached(function (delimiters) {
9074
- var open = delimiters[0].replace(regexEscapeRE, '\\$&');
9075
- var close = delimiters[1].replace(regexEscapeRE, '\\$&');
9076
- return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
9077
- });
9078
-
9079
-
9080
-
9081
- function parseText (
9082
- text,
9083
- delimiters
9084
- ) {
9085
- var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
9086
- if (!tagRE.test(text)) {
9087
- return
9088
- }
9089
- var tokens = [];
9090
- var rawTokens = [];
9091
- var lastIndex = tagRE.lastIndex = 0;
9092
- var match, index, tokenValue;
9093
- while ((match = tagRE.exec(text))) {
9094
- index = match.index;
9095
- // push text token
9096
- if (index > lastIndex) {
9097
- rawTokens.push(tokenValue = text.slice(lastIndex, index));
9098
- tokens.push(JSON.stringify(tokenValue));
9099
- }
9100
- // tag token
9101
- var exp = parseFilters(match[1].trim());
9102
- tokens.push(("_s(" + exp + ")"));
9103
- rawTokens.push({ '@binding': exp });
9104
- lastIndex = index + match[0].length;
9105
- }
9106
- if (lastIndex < text.length) {
9107
- rawTokens.push(tokenValue = text.slice(lastIndex));
9108
- tokens.push(JSON.stringify(tokenValue));
9109
- }
9110
- return {
9111
- expression: tokens.join('+'),
9112
- tokens: rawTokens
9113
- }
9114
- }
9115
-
9116
- /* */
9117
-
9118
- function transformNode (el, options) {
9119
- var warn = options.warn || baseWarn;
9120
- var staticClass = getAndRemoveAttr(el, 'class');
9121
- if (staticClass) {
9122
- var res = parseText(staticClass, options.delimiters);
9123
- if (res) {
9124
- warn(
9125
- "class=\"" + staticClass + "\": " +
9126
- 'Interpolation inside attributes has been removed. ' +
9127
- 'Use v-bind or the colon shorthand instead. For example, ' +
9128
- 'instead of <div class="{{ val }}">, use <div :class="val">.',
9129
- el.rawAttrsMap['class']
9130
- );
9131
- }
9132
- }
9133
- if (staticClass) {
9134
- el.staticClass = JSON.stringify(staticClass);
9135
- }
9136
- var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
9137
- if (classBinding) {
9138
- el.classBinding = classBinding;
9139
- }
9140
- }
9141
-
9142
- function genData (el) {
9143
- var data = '';
9144
- if (el.staticClass) {
9145
- data += "staticClass:" + (el.staticClass) + ",";
9146
- }
9147
- if (el.classBinding) {
9148
- data += "class:" + (el.classBinding) + ",";
9149
- }
9150
- return data
9151
- }
9152
-
9153
- var klass$1 = {
9154
- staticKeys: ['staticClass'],
9155
- transformNode: transformNode,
9156
- genData: genData
9157
- };
9158
-
9159
- /* */
9160
-
9161
- function transformNode$1 (el, options) {
9162
- var warn = options.warn || baseWarn;
9163
- var staticStyle = getAndRemoveAttr(el, 'style');
9164
- if (staticStyle) {
9165
- /* istanbul ignore if */
9166
- {
9167
- var res = parseText(staticStyle, options.delimiters);
9168
- if (res) {
9169
- warn(
9170
- "style=\"" + staticStyle + "\": " +
9171
- 'Interpolation inside attributes has been removed. ' +
9172
- 'Use v-bind or the colon shorthand instead. For example, ' +
9173
- 'instead of <div style="{{ val }}">, use <div :style="val">.',
9174
- el.rawAttrsMap['style']
9175
- );
9176
- }
9177
- }
9178
- el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9179
- }
9180
-
9181
- var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
9182
- if (styleBinding) {
9183
- el.styleBinding = styleBinding;
9184
- }
9185
- }
9186
-
9187
- function genData$1 (el) {
9188
- var data = '';
9189
- if (el.staticStyle) {
9190
- data += "staticStyle:" + (el.staticStyle) + ",";
9191
- }
9192
- if (el.styleBinding) {
9193
- data += "style:(" + (el.styleBinding) + "),";
9194
- }
9195
- return data
9196
- }
9197
-
9198
- var style$1 = {
9199
- staticKeys: ['staticStyle'],
9200
- transformNode: transformNode$1,
9201
- genData: genData$1
9202
- };
9203
-
9204
- /* */
9205
-
9206
- var decoder;
9207
-
9208
- var he = {
9209
- decode: function decode (html) {
9210
- decoder = decoder || document.createElement('div');
9211
- decoder.innerHTML = html;
9212
- return decoder.textContent
9213
- }
9214
- };
9215
-
9216
- /* */
9217
-
9218
- var isUnaryTag = makeMap(
9219
- 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
9220
- 'link,meta,param,source,track,wbr'
9221
- );
9222
-
9223
- // Elements that you can, intentionally, leave open
9224
- // (and which close themselves)
9225
- var canBeLeftOpenTag = makeMap(
9226
- 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
9227
- );
9228
-
9229
- // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
9230
- // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
9231
- var isNonPhrasingTag = makeMap(
9232
- 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
9233
- 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
9234
- 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
9235
- 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
9236
- 'title,tr,track'
9237
- );
9238
-
9239
- /**
9240
- * Not type-checking this file because it's mostly vendor code.
9241
- */
9242
-
9243
- // Regular Expressions for parsing tags and attributes
9244
- var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9245
- var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9246
- var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
9247
- var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9248
- var startTagOpen = new RegExp(("^<" + qnameCapture));
9249
- var startTagClose = /^\s*(\/?)>/;
9250
- var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9251
- var doctype = /^<!DOCTYPE [^>]+>/i;
9252
- // #7298: escape - to avoid being pased as HTML comment when inlined in page
9253
- var comment = /^<!\--/;
9254
- var conditionalComment = /^<!\[/;
9255
-
9256
- // Special Elements (can contain anything)
9257
- var isPlainTextElement = makeMap('script,style,textarea', true);
9258
- var reCache = {};
9259
-
9260
- var decodingMap = {
9261
- '&lt;': '<',
9262
- '&gt;': '>',
9263
- '&quot;': '"',
9264
- '&amp;': '&',
9265
- '&#10;': '\n',
9266
- '&#9;': '\t',
9267
- '&#39;': "'"
9268
- };
9269
- var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
9270
- var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
9271
-
9272
- // #5992
9273
- var isIgnoreNewlineTag = makeMap('pre,textarea', true);
9274
- var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
9275
-
9276
- function decodeAttr (value, shouldDecodeNewlines) {
9277
- var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
9278
- return value.replace(re, function (match) { return decodingMap[match]; })
9279
- }
9280
-
9281
- function parseHTML (html, options) {
9282
- var stack = [];
9283
- var expectHTML = options.expectHTML;
9284
- var isUnaryTag$$1 = options.isUnaryTag || no;
9285
- var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
9286
- var index = 0;
9287
- var last, lastTag;
9288
- while (html) {
9289
- last = html;
9290
- // Make sure we're not in a plaintext content element like script/style
9291
- if (!lastTag || !isPlainTextElement(lastTag)) {
9292
- var textEnd = html.indexOf('<');
9293
- if (textEnd === 0) {
9294
- // Comment:
9295
- if (comment.test(html)) {
9296
- var commentEnd = html.indexOf('-->');
9297
-
9298
- if (commentEnd >= 0) {
9299
- if (options.shouldKeepComment) {
9300
- options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9301
- }
9302
- advance(commentEnd + 3);
9303
- continue
9304
- }
9305
- }
9306
-
9307
- // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9308
- if (conditionalComment.test(html)) {
9309
- var conditionalEnd = html.indexOf(']>');
9310
-
9311
- if (conditionalEnd >= 0) {
9312
- advance(conditionalEnd + 2);
9313
- continue
9314
- }
9315
- }
9316
-
9317
- // Doctype:
9318
- var doctypeMatch = html.match(doctype);
9319
- if (doctypeMatch) {
9320
- advance(doctypeMatch[0].length);
9321
- continue
9322
- }
9323
-
9324
- // End tag:
9325
- var endTagMatch = html.match(endTag);
9326
- if (endTagMatch) {
9327
- var curIndex = index;
9328
- advance(endTagMatch[0].length);
9329
- parseEndTag(endTagMatch[1], curIndex, index);
9330
- continue
9331
- }
9332
-
9333
- // Start tag:
9334
- var startTagMatch = parseStartTag();
9335
- if (startTagMatch) {
9336
- handleStartTag(startTagMatch);
9337
- if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9338
- advance(1);
9339
- }
9340
- continue
9341
- }
9342
- }
9343
-
9344
- var text = (void 0), rest = (void 0), next = (void 0);
9345
- if (textEnd >= 0) {
9346
- rest = html.slice(textEnd);
9347
- while (
9348
- !endTag.test(rest) &&
9349
- !startTagOpen.test(rest) &&
9350
- !comment.test(rest) &&
9351
- !conditionalComment.test(rest)
9352
- ) {
9353
- // < in plain text, be forgiving and treat it as text
9354
- next = rest.indexOf('<', 1);
9355
- if (next < 0) { break }
9356
- textEnd += next;
9357
- rest = html.slice(textEnd);
9358
- }
9359
- text = html.substring(0, textEnd);
9360
- }
9361
-
9362
- if (textEnd < 0) {
9363
- text = html;
9364
- }
9365
-
9366
- if (text) {
9367
- advance(text.length);
9368
- }
9369
-
9370
- if (options.chars && text) {
9371
- options.chars(text, index - text.length, index);
9372
- }
9373
- } else {
9374
- var endTagLength = 0;
9375
- var stackedTag = lastTag.toLowerCase();
9376
- var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
9377
- var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
9378
- endTagLength = endTag.length;
9379
- if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
9380
- text = text
9381
- .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
9382
- .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
9383
- }
9384
- if (shouldIgnoreFirstNewline(stackedTag, text)) {
9385
- text = text.slice(1);
9386
- }
9387
- if (options.chars) {
9388
- options.chars(text);
9389
- }
9390
- return ''
9391
- });
9392
- index += html.length - rest$1.length;
9393
- html = rest$1;
9394
- parseEndTag(stackedTag, index - endTagLength, index);
9395
- }
9396
-
9397
- if (html === last) {
9398
- options.chars && options.chars(html);
9399
- if (!stack.length && options.warn) {
9400
- options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
9401
- }
9402
- break
9403
- }
9404
- }
9405
-
9406
- // Clean up any remaining tags
9407
- parseEndTag();
9408
-
9409
- function advance (n) {
9410
- index += n;
9411
- html = html.substring(n);
9412
- }
9413
-
9414
- function parseStartTag () {
9415
- var start = html.match(startTagOpen);
9416
- if (start) {
9417
- var match = {
9418
- tagName: start[1],
9419
- attrs: [],
9420
- start: index
9421
- };
9422
- advance(start[0].length);
9423
- var end, attr;
9424
- while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
9425
- attr.start = index;
9426
- advance(attr[0].length);
9427
- attr.end = index;
9428
- match.attrs.push(attr);
9429
- }
9430
- if (end) {
9431
- match.unarySlash = end[1];
9432
- advance(end[0].length);
9433
- match.end = index;
9434
- return match
9435
- }
9436
- }
9437
- }
9438
-
9439
- function handleStartTag (match) {
9440
- var tagName = match.tagName;
9441
- var unarySlash = match.unarySlash;
9442
-
9443
- if (expectHTML) {
9444
- if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
9445
- parseEndTag(lastTag);
9446
- }
9447
- if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
9448
- parseEndTag(tagName);
9449
- }
9450
- }
9451
-
9452
- var unary = isUnaryTag$$1(tagName) || !!unarySlash;
9453
-
9454
- var l = match.attrs.length;
9455
- var attrs = new Array(l);
9456
- for (var i = 0; i < l; i++) {
9457
- var args = match.attrs[i];
9458
- var value = args[3] || args[4] || args[5] || '';
9459
- var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
9460
- ? options.shouldDecodeNewlinesForHref
9461
- : options.shouldDecodeNewlines;
9462
- attrs[i] = {
9463
- name: args[1],
9464
- value: decodeAttr(value, shouldDecodeNewlines)
9465
- };
9466
- if (options.outputSourceRange) {
9467
- attrs[i].start = args.start + args[0].match(/^\s*/).length;
9468
- attrs[i].end = args.end;
9469
- }
9470
- }
9471
-
9472
- if (!unary) {
9473
- stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
9474
- lastTag = tagName;
9475
- }
9476
-
9477
- if (options.start) {
9478
- options.start(tagName, attrs, unary, match.start, match.end);
9479
- }
9480
- }
9481
-
9482
- function parseEndTag (tagName, start, end) {
9483
- var pos, lowerCasedTagName;
9484
- if (start == null) { start = index; }
9485
- if (end == null) { end = index; }
9486
-
9487
- // Find the closest opened tag of the same type
9488
- if (tagName) {
9489
- lowerCasedTagName = tagName.toLowerCase();
9490
- for (pos = stack.length - 1; pos >= 0; pos--) {
9491
- if (stack[pos].lowerCasedTag === lowerCasedTagName) {
9492
- break
9493
- }
9494
- }
9495
- } else {
9496
- // If no tag name is provided, clean shop
9497
- pos = 0;
9498
- }
9499
-
9500
- if (pos >= 0) {
9501
- // Close all the open elements, up the stack
9502
- for (var i = stack.length - 1; i >= pos; i--) {
9503
- if (i > pos || !tagName &&
9504
- options.warn
9505
- ) {
9506
- options.warn(
9507
- ("tag <" + (stack[i].tag) + "> has no matching end tag."),
9508
- { start: stack[i].start, end: stack[i].end }
9509
- );
9510
- }
9511
- if (options.end) {
9512
- options.end(stack[i].tag, start, end);
9513
- }
9514
- }
9515
-
9516
- // Remove the open elements from the stack
9517
- stack.length = pos;
9518
- lastTag = pos && stack[pos - 1].tag;
9519
- } else if (lowerCasedTagName === 'br') {
9520
- if (options.start) {
9521
- options.start(tagName, [], true, start, end);
9522
- }
9523
- } else if (lowerCasedTagName === 'p') {
9524
- if (options.start) {
9525
- options.start(tagName, [], false, start, end);
9526
- }
9527
- if (options.end) {
9528
- options.end(tagName, start, end);
9529
- }
9530
- }
9531
- }
9532
- }
9533
-
9534
- /* */
9535
-
9536
- var onRE = /^@|^v-on:/;
9537
- var dirRE = /^v-|^@|^:/;
9538
- var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9539
- var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9540
- var stripParensRE = /^\(|\)$/g;
9541
- var dynamicArgRE = /^\[.*\]$/;
9542
-
9543
- var argRE = /:(.*)$/;
9544
- var bindRE = /^:|^\.|^v-bind:/;
9545
- var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9546
-
9547
- var slotRE = /^v-slot(:|$)|^#/;
9548
-
9549
- var lineBreakRE = /[\r\n]/;
9550
- var whitespaceRE$1 = /\s+/g;
9551
-
9552
- var invalidAttributeRE = /[\s"'<>\/=]/;
9553
-
9554
- var decodeHTMLCached = cached(he.decode);
9555
-
9556
- var emptySlotScopeToken = "_empty_";
9557
-
9558
- // configurable state
9559
- var warn$2;
9560
- var delimiters;
9561
- var transforms;
9562
- var preTransforms;
9563
- var postTransforms;
9564
- var platformIsPreTag;
9565
- var platformMustUseProp;
9566
- var platformGetTagNamespace;
9567
- var maybeComponent;
9568
-
9569
- function createASTElement (
9570
- tag,
9571
- attrs,
9572
- parent
9573
- ) {
9574
- return {
9575
- type: 1,
9576
- tag: tag,
9577
- attrsList: attrs,
9578
- attrsMap: makeAttrsMap(attrs),
9579
- rawAttrsMap: {},
9580
- parent: parent,
9581
- children: []
9582
- }
9583
- }
9584
-
9585
- /**
9586
- * Convert HTML string to AST.
9587
- */
9588
- function parse (
9589
- template,
9590
- options
9591
- ) {
9592
- warn$2 = options.warn || baseWarn;
9593
-
9594
- platformIsPreTag = options.isPreTag || no;
9595
- platformMustUseProp = options.mustUseProp || no;
9596
- platformGetTagNamespace = options.getTagNamespace || no;
9597
- var isReservedTag = options.isReservedTag || no;
9598
- maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
9599
-
9600
- transforms = pluckModuleFunction(options.modules, 'transformNode');
9601
- preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9602
- postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
9603
-
9604
- delimiters = options.delimiters;
9605
-
9606
- var stack = [];
9607
- var preserveWhitespace = options.preserveWhitespace !== false;
9608
- var whitespaceOption = options.whitespace;
9609
- var root;
9610
- var currentParent;
9611
- var inVPre = false;
9612
- var inPre = false;
9613
- var warned = false;
9614
-
9615
- function warnOnce (msg, range) {
9616
- if (!warned) {
9617
- warned = true;
9618
- warn$2(msg, range);
9619
- }
9620
- }
9621
-
9622
- function closeElement (element) {
9623
- trimEndingWhitespace(element);
9624
- if (!inVPre && !element.processed) {
9625
- element = processElement(element, options);
9626
- }
9627
- // tree management
9628
- if (!stack.length && element !== root) {
9629
- // allow root elements with v-if, v-else-if and v-else
9630
- if (root.if && (element.elseif || element.else)) {
9631
- {
9632
- checkRootConstraints(element);
9633
- }
9634
- addIfCondition(root, {
9635
- exp: element.elseif,
9636
- block: element
9637
- });
9638
- } else {
9639
- warnOnce(
9640
- "Component template should contain exactly one root element. " +
9641
- "If you are using v-if on multiple elements, " +
9642
- "use v-else-if to chain them instead.",
9643
- { start: element.start }
9644
- );
9645
- }
9646
- }
9647
- if (currentParent && !element.forbidden) {
9648
- if (element.elseif || element.else) {
9649
- processIfConditions(element, currentParent);
9650
- } else {
9651
- if (element.slotScope) {
9652
- // scoped slot
9653
- // keep it in the children list so that v-else(-if) conditions can
9654
- // find it as the prev node.
9655
- var name = element.slotTarget || '"default"'
9656
- ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
9657
- }
9658
- currentParent.children.push(element);
9659
- element.parent = currentParent;
9660
- }
9661
- }
9662
-
9663
- // final children cleanup
9664
- // filter out scoped slots
9665
- element.children = element.children.filter(function (c) { return !(c).slotScope; });
9666
- // remove trailing whitespace node again
9667
- trimEndingWhitespace(element);
9668
-
9669
- // check pre state
9670
- if (element.pre) {
9671
- inVPre = false;
9672
- }
9673
- if (platformIsPreTag(element.tag)) {
9674
- inPre = false;
9675
- }
9676
- // apply post-transforms
9677
- for (var i = 0; i < postTransforms.length; i++) {
9678
- postTransforms[i](element, options);
9679
- }
9680
- }
9681
-
9682
- function trimEndingWhitespace (el) {
9683
- // remove trailing whitespace node
9684
- if (!inPre) {
9685
- var lastNode;
9686
- while (
9687
- (lastNode = el.children[el.children.length - 1]) &&
9688
- lastNode.type === 3 &&
9689
- lastNode.text === ' '
9690
- ) {
9691
- el.children.pop();
9692
- }
9693
- }
9694
- }
9695
-
9696
- function checkRootConstraints (el) {
9697
- if (el.tag === 'slot' || el.tag === 'template') {
9698
- warnOnce(
9699
- "Cannot use <" + (el.tag) + "> as component root element because it may " +
9700
- 'contain multiple nodes.',
9701
- { start: el.start }
9702
- );
9703
- }
9704
- if (el.attrsMap.hasOwnProperty('v-for')) {
9705
- warnOnce(
9706
- 'Cannot use v-for on stateful component root element because ' +
9707
- 'it renders multiple elements.',
9708
- el.rawAttrsMap['v-for']
9709
- );
9710
- }
9711
- }
9712
-
9713
- parseHTML(template, {
9714
- warn: warn$2,
9715
- expectHTML: options.expectHTML,
9716
- isUnaryTag: options.isUnaryTag,
9717
- canBeLeftOpenTag: options.canBeLeftOpenTag,
9718
- shouldDecodeNewlines: options.shouldDecodeNewlines,
9719
- shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9720
- shouldKeepComment: options.comments,
9721
- outputSourceRange: options.outputSourceRange,
9722
- start: function start (tag, attrs, unary, start$1, end) {
9723
- // check namespace.
9724
- // inherit parent ns if there is one
9725
- var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
9726
-
9727
- // handle IE svg bug
9728
- /* istanbul ignore if */
9729
- if (isIE && ns === 'svg') {
9730
- attrs = guardIESVGBug(attrs);
9731
- }
9732
-
9733
- var element = createASTElement(tag, attrs, currentParent);
9734
- if (ns) {
9735
- element.ns = ns;
9736
- }
9737
-
9738
- {
9739
- if (options.outputSourceRange) {
9740
- element.start = start$1;
9741
- element.end = end;
9742
- element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9743
- cumulated[attr.name] = attr;
9744
- return cumulated
9745
- }, {});
9746
- }
9747
- attrs.forEach(function (attr) {
9748
- if (invalidAttributeRE.test(attr.name)) {
9749
- warn$2(
9750
- "Invalid dynamic argument expression: attribute names cannot contain " +
9751
- "spaces, quotes, <, >, / or =.",
9752
- {
9753
- start: attr.start + attr.name.indexOf("["),
9754
- end: attr.start + attr.name.length
9755
- }
9756
- );
9757
- }
9758
- });
9759
- }
9760
-
9761
- if (isForbiddenTag(element) && !isServerRendering()) {
9762
- element.forbidden = true;
9763
- warn$2(
9764
- 'Templates should only be responsible for mapping the state to the ' +
9765
- 'UI. Avoid placing tags with side-effects in your templates, such as ' +
9766
- "<" + tag + ">" + ', as they will not be parsed.',
9767
- { start: element.start }
9768
- );
9769
- }
9770
-
9771
- // apply pre-transforms
9772
- for (var i = 0; i < preTransforms.length; i++) {
9773
- element = preTransforms[i](element, options) || element;
9774
- }
9775
-
9776
- if (!inVPre) {
9777
- processPre(element);
9778
- if (element.pre) {
9779
- inVPre = true;
9780
- }
9781
- }
9782
- if (platformIsPreTag(element.tag)) {
9783
- inPre = true;
9784
- }
9785
- if (inVPre) {
9786
- processRawAttrs(element);
9787
- } else if (!element.processed) {
9788
- // structural directives
9789
- processFor(element);
9790
- processIf(element);
9791
- processOnce(element);
9792
- }
9793
-
9794
- if (!root) {
9795
- root = element;
9796
- {
9797
- checkRootConstraints(root);
9798
- }
9799
- }
9800
-
9801
- if (!unary) {
9802
- currentParent = element;
9803
- stack.push(element);
9804
- } else {
9805
- closeElement(element);
9806
- }
9807
- },
9808
-
9809
- end: function end (tag, start, end$1) {
9810
- var element = stack[stack.length - 1];
9811
- // pop stack
9812
- stack.length -= 1;
9813
- currentParent = stack[stack.length - 1];
9814
- if (options.outputSourceRange) {
9815
- element.end = end$1;
9816
- }
9817
- closeElement(element);
9818
- },
9819
-
9820
- chars: function chars (text, start, end) {
9821
- if (!currentParent) {
9822
- {
9823
- if (text === template) {
9824
- warnOnce(
9825
- 'Component template requires a root element, rather than just text.',
9826
- { start: start }
9827
- );
9828
- } else if ((text = text.trim())) {
9829
- warnOnce(
9830
- ("text \"" + text + "\" outside root element will be ignored."),
9831
- { start: start }
9832
- );
9833
- }
9834
- }
9835
- return
9836
- }
9837
- // IE textarea placeholder bug
9838
- /* istanbul ignore if */
9839
- if (isIE &&
9840
- currentParent.tag === 'textarea' &&
9841
- currentParent.attrsMap.placeholder === text
9842
- ) {
9843
- return
9844
- }
9845
- var children = currentParent.children;
9846
- if (inPre || text.trim()) {
9847
- text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
9848
- } else if (!children.length) {
9849
- // remove the whitespace-only node right after an opening tag
9850
- text = '';
9851
- } else if (whitespaceOption) {
9852
- if (whitespaceOption === 'condense') {
9853
- // in condense mode, remove the whitespace node if it contains
9854
- // line break, otherwise condense to a single space
9855
- text = lineBreakRE.test(text) ? '' : ' ';
9856
- } else {
9857
- text = ' ';
9858
- }
9859
- } else {
9860
- text = preserveWhitespace ? ' ' : '';
9861
- }
9862
- if (text) {
9863
- if (!inPre && whitespaceOption === 'condense') {
9864
- // condense consecutive whitespaces into single space
9865
- text = text.replace(whitespaceRE$1, ' ');
9866
- }
9867
- var res;
9868
- var child;
9869
- if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
9870
- child = {
9871
- type: 2,
9872
- expression: res.expression,
9873
- tokens: res.tokens,
9874
- text: text
9875
- };
9876
- } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
9877
- child = {
9878
- type: 3,
9879
- text: text
9880
- };
9881
- }
9882
- if (child) {
9883
- if (options.outputSourceRange) {
9884
- child.start = start;
9885
- child.end = end;
9886
- }
9887
- children.push(child);
9888
- }
9889
- }
9890
- },
9891
- comment: function comment (text, start, end) {
9892
- // adding anyting as a sibling to the root node is forbidden
9893
- // comments should still be allowed, but ignored
9894
- if (currentParent) {
9895
- var child = {
9896
- type: 3,
9897
- text: text,
9898
- isComment: true
9899
- };
9900
- if (options.outputSourceRange) {
9901
- child.start = start;
9902
- child.end = end;
9903
- }
9904
- currentParent.children.push(child);
9905
- }
9906
- }
9907
- });
9908
- return root
9909
- }
9910
-
9911
- function processPre (el) {
9912
- if (getAndRemoveAttr(el, 'v-pre') != null) {
9913
- el.pre = true;
9914
- }
9915
- }
9916
-
9917
- function processRawAttrs (el) {
9918
- var list = el.attrsList;
9919
- var len = list.length;
9920
- if (len) {
9921
- var attrs = el.attrs = new Array(len);
9922
- for (var i = 0; i < len; i++) {
9923
- attrs[i] = {
9924
- name: list[i].name,
9925
- value: JSON.stringify(list[i].value)
9926
- };
9927
- if (list[i].start != null) {
9928
- attrs[i].start = list[i].start;
9929
- attrs[i].end = list[i].end;
9930
- }
9931
- }
9932
- } else if (!el.pre) {
9933
- // non root node in pre blocks with no attributes
9934
- el.plain = true;
9935
- }
9936
- }
9937
-
9938
- function processElement (
9939
- element,
9940
- options
9941
- ) {
9942
- processKey(element);
9943
-
9944
- // determine whether this is a plain element after
9945
- // removing structural attributes
9946
- element.plain = (
9947
- !element.key &&
9948
- !element.scopedSlots &&
9949
- !element.attrsList.length
9950
- );
9951
-
9952
- processRef(element);
9953
- processSlotContent(element);
9954
- processSlotOutlet(element);
9955
- processComponent(element);
9956
- for (var i = 0; i < transforms.length; i++) {
9957
- element = transforms[i](element, options) || element;
9958
- }
9959
- processAttrs(element);
9960
- return element
9961
- }
9962
-
9963
- function processKey (el) {
9964
- var exp = getBindingAttr(el, 'key');
9965
- if (exp) {
9966
- {
9967
- if (el.tag === 'template') {
9968
- warn$2(
9969
- "<template> cannot be keyed. Place the key on real elements instead.",
9970
- getRawBindingAttr(el, 'key')
9971
- );
9972
- }
9973
- if (el.for) {
9974
- var iterator = el.iterator2 || el.iterator1;
9975
- var parent = el.parent;
9976
- if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
9977
- warn$2(
9978
- "Do not use v-for index as key on <transition-group> children, " +
9979
- "this is the same as not using keys.",
9980
- getRawBindingAttr(el, 'key'),
9981
- true /* tip */
9982
- );
9983
- }
9984
- }
9985
- }
9986
- el.key = exp;
9987
- }
9988
- }
9989
-
9990
- function processRef (el) {
9991
- var ref = getBindingAttr(el, 'ref');
9992
- if (ref) {
9993
- el.ref = ref;
9994
- el.refInFor = checkInFor(el);
9995
- }
9996
- }
9997
-
9998
- function processFor (el) {
9999
- var exp;
10000
- if ((exp = getAndRemoveAttr(el, 'v-for'))) {
10001
- var res = parseFor(exp);
10002
- if (res) {
10003
- extend(el, res);
10004
- } else {
10005
- warn$2(
10006
- ("Invalid v-for expression: " + exp),
10007
- el.rawAttrsMap['v-for']
10008
- );
10009
- }
10010
- }
10011
- }
10012
-
10013
-
10014
-
10015
- function parseFor (exp) {
10016
- var inMatch = exp.match(forAliasRE);
10017
- if (!inMatch) { return }
10018
- var res = {};
10019
- res.for = inMatch[2].trim();
10020
- var alias = inMatch[1].trim().replace(stripParensRE, '');
10021
- var iteratorMatch = alias.match(forIteratorRE);
10022
- if (iteratorMatch) {
10023
- res.alias = alias.replace(forIteratorRE, '').trim();
10024
- res.iterator1 = iteratorMatch[1].trim();
10025
- if (iteratorMatch[2]) {
10026
- res.iterator2 = iteratorMatch[2].trim();
10027
- }
10028
- } else {
10029
- res.alias = alias;
10030
- }
10031
- return res
10032
- }
10033
-
10034
- function processIf (el) {
10035
- var exp = getAndRemoveAttr(el, 'v-if');
10036
- if (exp) {
10037
- el.if = exp;
10038
- addIfCondition(el, {
10039
- exp: exp,
10040
- block: el
10041
- });
10042
- } else {
10043
- if (getAndRemoveAttr(el, 'v-else') != null) {
10044
- el.else = true;
10045
- }
10046
- var elseif = getAndRemoveAttr(el, 'v-else-if');
10047
- if (elseif) {
10048
- el.elseif = elseif;
10049
- }
10050
- }
10051
- }
10052
-
10053
- function processIfConditions (el, parent) {
10054
- var prev = findPrevElement(parent.children);
10055
- if (prev && prev.if) {
10056
- addIfCondition(prev, {
10057
- exp: el.elseif,
10058
- block: el
10059
- });
10060
- } else {
10061
- warn$2(
10062
- "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
10063
- "used on element <" + (el.tag) + "> without corresponding v-if.",
10064
- el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
10065
- );
10066
- }
10067
- }
10068
-
10069
- function findPrevElement (children) {
10070
- var i = children.length;
10071
- while (i--) {
10072
- if (children[i].type === 1) {
10073
- return children[i]
10074
- } else {
10075
- if (children[i].text !== ' ') {
10076
- warn$2(
10077
- "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
10078
- "will be ignored.",
10079
- children[i]
10080
- );
10081
- }
10082
- children.pop();
10083
- }
10084
- }
10085
- }
10086
-
10087
- function addIfCondition (el, condition) {
10088
- if (!el.ifConditions) {
10089
- el.ifConditions = [];
10090
- }
10091
- el.ifConditions.push(condition);
10092
- }
10093
-
10094
- function processOnce (el) {
10095
- var once$$1 = getAndRemoveAttr(el, 'v-once');
10096
- if (once$$1 != null) {
10097
- el.once = true;
10098
- }
10099
- }
10100
-
10101
- // handle content being passed to a component as slot,
10102
- // e.g. <template slot="xxx">, <div slot-scope="xxx">
10103
- function processSlotContent (el) {
10104
- var slotScope;
10105
- if (el.tag === 'template') {
10106
- slotScope = getAndRemoveAttr(el, 'scope');
10107
- /* istanbul ignore if */
10108
- if (slotScope) {
10109
- warn$2(
10110
- "the \"scope\" attribute for scoped slots have been deprecated and " +
10111
- "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
10112
- "can also be used on plain elements in addition to <template> to " +
10113
- "denote scoped slots.",
10114
- el.rawAttrsMap['scope'],
10115
- true
10116
- );
10117
- }
10118
- el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
10119
- } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
10120
- /* istanbul ignore if */
10121
- if (el.attrsMap['v-for']) {
10122
- warn$2(
10123
- "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
10124
- "(v-for takes higher priority). Use a wrapper <template> for the " +
10125
- "scoped slot to make it clearer.",
10126
- el.rawAttrsMap['slot-scope'],
10127
- true
10128
- );
10129
- }
10130
- el.slotScope = slotScope;
10131
- }
10132
-
10133
- // slot="xxx"
10134
- var slotTarget = getBindingAttr(el, 'slot');
10135
- if (slotTarget) {
10136
- el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
10137
- el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
10138
- // preserve slot as an attribute for native shadow DOM compat
10139
- // only for non-scoped slots.
10140
- if (el.tag !== 'template' && !el.slotScope) {
10141
- addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
10142
- }
10143
- }
10144
-
10145
- // 2.6 v-slot syntax
10146
- {
10147
- if (el.tag === 'template') {
10148
- // v-slot on <template>
10149
- var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10150
- if (slotBinding) {
10151
- {
10152
- if (el.slotTarget || el.slotScope) {
10153
- warn$2(
10154
- "Unexpected mixed usage of different slot syntaxes.",
10155
- el
10156
- );
10157
- }
10158
- if (el.parent && !maybeComponent(el.parent)) {
10159
- warn$2(
10160
- "<template v-slot> can only appear at the root level inside " +
10161
- "the receiving the component",
10162
- el
10163
- );
10164
- }
10165
- }
10166
- var ref = getSlotName(slotBinding);
10167
- var name = ref.name;
10168
- var dynamic = ref.dynamic;
10169
- el.slotTarget = name;
10170
- el.slotTargetDynamic = dynamic;
10171
- el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
10172
- }
10173
- } else {
10174
- // v-slot on component, denotes default slot
10175
- var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
10176
- if (slotBinding$1) {
10177
- {
10178
- if (!maybeComponent(el)) {
10179
- warn$2(
10180
- "v-slot can only be used on components or <template>.",
10181
- slotBinding$1
10182
- );
10183
- }
10184
- if (el.slotScope || el.slotTarget) {
10185
- warn$2(
10186
- "Unexpected mixed usage of different slot syntaxes.",
10187
- el
10188
- );
10189
- }
10190
- if (el.scopedSlots) {
10191
- warn$2(
10192
- "To avoid scope ambiguity, the default slot should also use " +
10193
- "<template> syntax when there are other named slots.",
10194
- slotBinding$1
10195
- );
10196
- }
10197
- }
10198
- // add the component's children to its default slot
10199
- var slots = el.scopedSlots || (el.scopedSlots = {});
10200
- var ref$1 = getSlotName(slotBinding$1);
10201
- var name$1 = ref$1.name;
10202
- var dynamic$1 = ref$1.dynamic;
10203
- var slotContainer = slots[name$1] = createASTElement('template', [], el);
10204
- slotContainer.slotTarget = name$1;
10205
- slotContainer.slotTargetDynamic = dynamic$1;
10206
- slotContainer.children = el.children.filter(function (c) {
10207
- if (!c.slotScope) {
10208
- c.parent = slotContainer;
10209
- return true
10210
- }
10211
- });
10212
- slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
10213
- // remove children as they are returned from scopedSlots now
10214
- el.children = [];
10215
- // mark el non-plain so data gets generated
10216
- el.plain = false;
10217
- }
10218
- }
10219
- }
10220
- }
10221
-
10222
- function getSlotName (binding) {
10223
- var name = binding.name.replace(slotRE, '');
10224
- if (!name) {
10225
- if (binding.name[0] !== '#') {
10226
- name = 'default';
10227
- } else {
10228
- warn$2(
10229
- "v-slot shorthand syntax requires a slot name.",
10230
- binding
10231
- );
10232
- }
10233
- }
10234
- return dynamicArgRE.test(name)
10235
- // dynamic [name]
10236
- ? { name: name.slice(1, -1), dynamic: true }
10237
- // static name
10238
- : { name: ("\"" + name + "\""), dynamic: false }
10239
- }
10240
-
10241
- // handle <slot/> outlets
10242
- function processSlotOutlet (el) {
10243
- if (el.tag === 'slot') {
10244
- el.slotName = getBindingAttr(el, 'name');
10245
- if (el.key) {
10246
- warn$2(
10247
- "`key` does not work on <slot> because slots are abstract outlets " +
10248
- "and can possibly expand into multiple elements. " +
10249
- "Use the key on a wrapping element instead.",
10250
- getRawBindingAttr(el, 'key')
10251
- );
10252
- }
10253
- }
10254
- }
10255
-
10256
- function processComponent (el) {
10257
- var binding;
10258
- if ((binding = getBindingAttr(el, 'is'))) {
10259
- el.component = binding;
10260
- }
10261
- if (getAndRemoveAttr(el, 'inline-template') != null) {
10262
- el.inlineTemplate = true;
10263
- }
10264
- }
10265
-
10266
- function processAttrs (el) {
10267
- var list = el.attrsList;
10268
- var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
10269
- for (i = 0, l = list.length; i < l; i++) {
10270
- name = rawName = list[i].name;
10271
- value = list[i].value;
10272
- if (dirRE.test(name)) {
10273
- // mark element as dynamic
10274
- el.hasBindings = true;
10275
- // modifiers
10276
- modifiers = parseModifiers(name.replace(dirRE, ''));
10277
- // support .foo shorthand syntax for the .prop modifier
10278
- if (modifiers) {
10279
- name = name.replace(modifierRE, '');
10280
- }
10281
- if (bindRE.test(name)) { // v-bind
10282
- name = name.replace(bindRE, '');
10283
- value = parseFilters(value);
10284
- isDynamic = dynamicArgRE.test(name);
10285
- if (isDynamic) {
10286
- name = name.slice(1, -1);
10287
- }
10288
- if (
10289
- value.trim().length === 0
10290
- ) {
10291
- warn$2(
10292
- ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
10293
- );
10294
- }
10295
- if (modifiers) {
10296
- if (modifiers.prop && !isDynamic) {
10297
- name = camelize(name);
10298
- if (name === 'innerHtml') { name = 'innerHTML'; }
10299
- }
10300
- if (modifiers.camel && !isDynamic) {
10301
- name = camelize(name);
10302
- }
10303
- if (modifiers.sync) {
10304
- syncGen = genAssignmentCode(value, "$event");
10305
- if (!isDynamic) {
10306
- addHandler(
10307
- el,
10308
- ("update:" + (camelize(name))),
10309
- syncGen,
10310
- null,
10311
- false,
10312
- warn$2,
10313
- list[i]
10314
- );
10315
- if (hyphenate(name) !== camelize(name)) {
10316
- addHandler(
10317
- el,
10318
- ("update:" + (hyphenate(name))),
10319
- syncGen,
10320
- null,
10321
- false,
10322
- warn$2,
10323
- list[i]
10324
- );
10325
- }
10326
- } else {
10327
- // handler w/ dynamic event name
10328
- addHandler(
10329
- el,
10330
- ("\"update:\"+(" + name + ")"),
10331
- syncGen,
10332
- null,
10333
- false,
10334
- warn$2,
10335
- list[i],
10336
- true // dynamic
10337
- );
10338
- }
10339
- }
10340
- }
10341
- if ((modifiers && modifiers.prop) || (
10342
- !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
10343
- )) {
10344
- addProp(el, name, value, list[i], isDynamic);
10345
- } else {
10346
- addAttr(el, name, value, list[i], isDynamic);
10347
- }
10348
- } else if (onRE.test(name)) { // v-on
10349
- name = name.replace(onRE, '');
10350
- isDynamic = dynamicArgRE.test(name);
10351
- if (isDynamic) {
10352
- name = name.slice(1, -1);
10353
- }
10354
- addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
10355
- } else { // normal directives
10356
- name = name.replace(dirRE, '');
10357
- // parse arg
10358
- var argMatch = name.match(argRE);
10359
- var arg = argMatch && argMatch[1];
10360
- isDynamic = false;
10361
- if (arg) {
10362
- name = name.slice(0, -(arg.length + 1));
10363
- if (dynamicArgRE.test(arg)) {
10364
- arg = arg.slice(1, -1);
10365
- isDynamic = true;
10366
- }
10367
- }
10368
- addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
10369
- if (name === 'model') {
10370
- checkForAliasModel(el, value);
10371
- }
10372
- }
10373
- } else {
10374
- // literal attribute
10375
- {
10376
- var res = parseText(value, delimiters);
10377
- if (res) {
10378
- warn$2(
10379
- name + "=\"" + value + "\": " +
10380
- 'Interpolation inside attributes has been removed. ' +
10381
- 'Use v-bind or the colon shorthand instead. For example, ' +
10382
- 'instead of <div id="{{ val }}">, use <div :id="val">.',
10383
- list[i]
10384
- );
10385
- }
10386
- }
10387
- addAttr(el, name, JSON.stringify(value), list[i]);
10388
- // #6887 firefox doesn't update muted state if set via attribute
10389
- // even immediately after element creation
10390
- if (!el.component &&
10391
- name === 'muted' &&
10392
- platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10393
- addProp(el, name, 'true', list[i]);
10394
- }
10395
- }
10396
- }
10397
- }
10398
-
10399
- function checkInFor (el) {
10400
- var parent = el;
10401
- while (parent) {
10402
- if (parent.for !== undefined) {
10403
- return true
10404
- }
10405
- parent = parent.parent;
10406
- }
10407
- return false
10408
- }
10409
-
10410
- function parseModifiers (name) {
10411
- var match = name.match(modifierRE);
10412
- if (match) {
10413
- var ret = {};
10414
- match.forEach(function (m) { ret[m.slice(1)] = true; });
10415
- return ret
10416
- }
10417
- }
10418
-
10419
- function makeAttrsMap (attrs) {
10420
- var map = {};
10421
- for (var i = 0, l = attrs.length; i < l; i++) {
10422
- if (
10423
- map[attrs[i].name] && !isIE && !isEdge
10424
- ) {
10425
- warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
10426
- }
10427
- map[attrs[i].name] = attrs[i].value;
10428
- }
10429
- return map
10430
- }
10431
-
10432
- // for script (e.g. type="x/template") or style, do not decode content
10433
- function isTextTag (el) {
10434
- return el.tag === 'script' || el.tag === 'style'
10435
- }
10436
-
10437
- function isForbiddenTag (el) {
10438
- return (
10439
- el.tag === 'style' ||
10440
- (el.tag === 'script' && (
10441
- !el.attrsMap.type ||
10442
- el.attrsMap.type === 'text/javascript'
10443
- ))
10444
- )
10445
- }
10446
-
10447
- var ieNSBug = /^xmlns:NS\d+/;
10448
- var ieNSPrefix = /^NS\d+:/;
10449
-
10450
- /* istanbul ignore next */
10451
- function guardIESVGBug (attrs) {
10452
- var res = [];
10453
- for (var i = 0; i < attrs.length; i++) {
10454
- var attr = attrs[i];
10455
- if (!ieNSBug.test(attr.name)) {
10456
- attr.name = attr.name.replace(ieNSPrefix, '');
10457
- res.push(attr);
10458
- }
10459
- }
10460
- return res
10461
- }
10462
-
10463
- function checkForAliasModel (el, value) {
10464
- var _el = el;
10465
- while (_el) {
10466
- if (_el.for && _el.alias === value) {
10467
- warn$2(
10468
- "<" + (el.tag) + " v-model=\"" + value + "\">: " +
10469
- "You are binding v-model directly to a v-for iteration alias. " +
10470
- "This will not be able to modify the v-for source array because " +
10471
- "writing to the alias is like modifying a function local variable. " +
10472
- "Consider using an array of objects and use v-model on an object property instead.",
10473
- el.rawAttrsMap['v-model']
10474
- );
10475
- }
10476
- _el = _el.parent;
10477
- }
10478
- }
10479
-
10480
- /* */
10481
-
10482
- function preTransformNode (el, options) {
10483
- if (el.tag === 'input') {
10484
- var map = el.attrsMap;
10485
- if (!map['v-model']) {
10486
- return
10487
- }
10488
-
10489
- var typeBinding;
10490
- if (map[':type'] || map['v-bind:type']) {
10491
- typeBinding = getBindingAttr(el, 'type');
10492
- }
10493
- if (!map.type && !typeBinding && map['v-bind']) {
10494
- typeBinding = "(" + (map['v-bind']) + ").type";
10495
- }
10496
-
10497
- if (typeBinding) {
10498
- var ifCondition = getAndRemoveAttr(el, 'v-if', true);
10499
- var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
10500
- var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
10501
- var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
10502
- // 1. checkbox
10503
- var branch0 = cloneASTElement(el);
10504
- // process for on the main node
10505
- processFor(branch0);
10506
- addRawAttr(branch0, 'type', 'checkbox');
10507
- processElement(branch0, options);
10508
- branch0.processed = true; // prevent it from double-processed
10509
- branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
10510
- addIfCondition(branch0, {
10511
- exp: branch0.if,
10512
- block: branch0
10513
- });
10514
- // 2. add radio else-if condition
10515
- var branch1 = cloneASTElement(el);
10516
- getAndRemoveAttr(branch1, 'v-for', true);
10517
- addRawAttr(branch1, 'type', 'radio');
10518
- processElement(branch1, options);
10519
- addIfCondition(branch0, {
10520
- exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
10521
- block: branch1
10522
- });
10523
- // 3. other
10524
- var branch2 = cloneASTElement(el);
10525
- getAndRemoveAttr(branch2, 'v-for', true);
10526
- addRawAttr(branch2, ':type', typeBinding);
10527
- processElement(branch2, options);
10528
- addIfCondition(branch0, {
10529
- exp: ifCondition,
10530
- block: branch2
10531
- });
10532
-
10533
- if (hasElse) {
10534
- branch0.else = true;
10535
- } else if (elseIfCondition) {
10536
- branch0.elseif = elseIfCondition;
10537
- }
10538
-
10539
- return branch0
10540
- }
10541
- }
10542
- }
10543
-
10544
- function cloneASTElement (el) {
10545
- return createASTElement(el.tag, el.attrsList.slice(), el.parent)
10546
- }
10547
-
10548
- var model$1 = {
10549
- preTransformNode: preTransformNode
10550
- };
10551
-
10552
- var modules$1 = [
10553
- klass$1,
10554
- style$1,
10555
- model$1
10556
- ];
10557
-
10558
- /* */
10559
-
10560
- function text (el, dir) {
10561
- if (dir.value) {
10562
- addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
10563
- }
10564
- }
10565
-
10566
- /* */
10567
-
10568
- function html (el, dir) {
10569
- if (dir.value) {
10570
- addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
10571
- }
10572
- }
10573
-
10574
- var directives$1 = {
10575
- model: model,
10576
- text: text,
10577
- html: html
10578
- };
10579
-
10580
- /* */
10581
-
10582
- var baseOptions = {
10583
- expectHTML: true,
10584
- modules: modules$1,
10585
- directives: directives$1,
10586
- isPreTag: isPreTag,
10587
- isUnaryTag: isUnaryTag,
10588
- mustUseProp: mustUseProp,
10589
- canBeLeftOpenTag: canBeLeftOpenTag,
10590
- isReservedTag: isReservedTag,
10591
- getTagNamespace: getTagNamespace,
10592
- staticKeys: genStaticKeys(modules$1)
10593
- };
10594
-
10595
- /* */
10596
-
10597
- var isStaticKey;
10598
- var isPlatformReservedTag;
10599
-
10600
- var genStaticKeysCached = cached(genStaticKeys$1);
10601
-
10602
- /**
10603
- * Goal of the optimizer: walk the generated template AST tree
10604
- * and detect sub-trees that are purely static, i.e. parts of
10605
- * the DOM that never needs to change.
10606
- *
10607
- * Once we detect these sub-trees, we can:
10608
- *
10609
- * 1. Hoist them into constants, so that we no longer need to
10610
- * create fresh nodes for them on each re-render;
10611
- * 2. Completely skip them in the patching process.
10612
- */
10613
- function optimize (root, options) {
10614
- if (!root) { return }
10615
- isStaticKey = genStaticKeysCached(options.staticKeys || '');
10616
- isPlatformReservedTag = options.isReservedTag || no;
10617
- // first pass: mark all non-static nodes.
10618
- markStatic$1(root);
10619
- // second pass: mark static roots.
10620
- markStaticRoots(root, false);
10621
- }
10622
-
10623
- function genStaticKeys$1 (keys) {
10624
- return makeMap(
10625
- 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
10626
- (keys ? ',' + keys : '')
10627
- )
10628
- }
10629
-
10630
- function markStatic$1 (node) {
10631
- node.static = isStatic(node);
10632
- if (node.type === 1) {
10633
- // do not make component slot content static. this avoids
10634
- // 1. components not able to mutate slot nodes
10635
- // 2. static slot content fails for hot-reloading
10636
- if (
10637
- !isPlatformReservedTag(node.tag) &&
10638
- node.tag !== 'slot' &&
10639
- node.attrsMap['inline-template'] == null
10640
- ) {
10641
- return
10642
- }
10643
- for (var i = 0, l = node.children.length; i < l; i++) {
10644
- var child = node.children[i];
10645
- markStatic$1(child);
10646
- if (!child.static) {
10647
- node.static = false;
10648
- }
10649
- }
10650
- if (node.ifConditions) {
10651
- for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10652
- var block = node.ifConditions[i$1].block;
10653
- markStatic$1(block);
10654
- if (!block.static) {
10655
- node.static = false;
10656
- }
10657
- }
10658
- }
10659
- }
10660
- }
10661
-
10662
- function markStaticRoots (node, isInFor) {
10663
- if (node.type === 1) {
10664
- if (node.static || node.once) {
10665
- node.staticInFor = isInFor;
10666
- }
10667
- // For a node to qualify as a static root, it should have children that
10668
- // are not just static text. Otherwise the cost of hoisting out will
10669
- // outweigh the benefits and it's better off to just always render it fresh.
10670
- if (node.static && node.children.length && !(
10671
- node.children.length === 1 &&
10672
- node.children[0].type === 3
10673
- )) {
10674
- node.staticRoot = true;
10675
- return
10676
- } else {
10677
- node.staticRoot = false;
10678
- }
10679
- if (node.children) {
10680
- for (var i = 0, l = node.children.length; i < l; i++) {
10681
- markStaticRoots(node.children[i], isInFor || !!node.for);
10682
- }
10683
- }
10684
- if (node.ifConditions) {
10685
- for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10686
- markStaticRoots(node.ifConditions[i$1].block, isInFor);
10687
- }
10688
- }
10689
- }
10690
- }
10691
-
10692
- function isStatic (node) {
10693
- if (node.type === 2) { // expression
10694
- return false
10695
- }
10696
- if (node.type === 3) { // text
10697
- return true
10698
- }
10699
- return !!(node.pre || (
10700
- !node.hasBindings && // no dynamic bindings
10701
- !node.if && !node.for && // not v-if or v-for or v-else
10702
- !isBuiltInTag(node.tag) && // not a built-in
10703
- isPlatformReservedTag(node.tag) && // not a component
10704
- !isDirectChildOfTemplateFor(node) &&
10705
- Object.keys(node).every(isStaticKey)
10706
- ))
10707
- }
10708
-
10709
- function isDirectChildOfTemplateFor (node) {
10710
- while (node.parent) {
10711
- node = node.parent;
10712
- if (node.tag !== 'template') {
10713
- return false
10714
- }
10715
- if (node.for) {
10716
- return true
10717
- }
10718
- }
10719
- return false
10720
- }
10721
-
10722
- /* */
10723
-
10724
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
10725
- var fnInvokeRE = /\([^)]*?\);*$/;
10726
- var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10727
-
10728
- // KeyboardEvent.keyCode aliases
10729
- var keyCodes = {
10730
- esc: 27,
10731
- tab: 9,
10732
- enter: 13,
10733
- space: 32,
10734
- up: 38,
10735
- left: 37,
10736
- right: 39,
10737
- down: 40,
10738
- 'delete': [8, 46]
10739
- };
10740
-
10741
- // KeyboardEvent.key aliases
10742
- var keyNames = {
10743
- // #7880: IE11 and Edge use `Esc` for Escape key name.
10744
- esc: ['Esc', 'Escape'],
10745
- tab: 'Tab',
10746
- enter: 'Enter',
10747
- // #9112: IE11 uses `Spacebar` for Space key name.
10748
- space: [' ', 'Spacebar'],
10749
- // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
10750
- up: ['Up', 'ArrowUp'],
10751
- left: ['Left', 'ArrowLeft'],
10752
- right: ['Right', 'ArrowRight'],
10753
- down: ['Down', 'ArrowDown'],
10754
- // #9112: IE11 uses `Del` for Delete key name.
10755
- 'delete': ['Backspace', 'Delete', 'Del']
10756
- };
10757
-
10758
- // #4868: modifiers that prevent the execution of the listener
10759
- // need to explicitly return null so that we can determine whether to remove
10760
- // the listener for .once
10761
- var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
10762
-
10763
- var modifierCode = {
10764
- stop: '$event.stopPropagation();',
10765
- prevent: '$event.preventDefault();',
10766
- self: genGuard("$event.target !== $event.currentTarget"),
10767
- ctrl: genGuard("!$event.ctrlKey"),
10768
- shift: genGuard("!$event.shiftKey"),
10769
- alt: genGuard("!$event.altKey"),
10770
- meta: genGuard("!$event.metaKey"),
10771
- left: genGuard("'button' in $event && $event.button !== 0"),
10772
- middle: genGuard("'button' in $event && $event.button !== 1"),
10773
- right: genGuard("'button' in $event && $event.button !== 2")
10774
- };
10775
-
10776
- function genHandlers (
10777
- events,
10778
- isNative
10779
- ) {
10780
- var prefix = isNative ? 'nativeOn:' : 'on:';
10781
- var staticHandlers = "";
10782
- var dynamicHandlers = "";
10783
- for (var name in events) {
10784
- var handlerCode = genHandler(events[name]);
10785
- if (events[name] && events[name].dynamic) {
10786
- dynamicHandlers += name + "," + handlerCode + ",";
10787
- } else {
10788
- staticHandlers += "\"" + name + "\":" + handlerCode + ",";
10789
- }
10790
- }
10791
- staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
10792
- if (dynamicHandlers) {
10793
- return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
10794
- } else {
10795
- return prefix + staticHandlers
10796
- }
10797
- }
10798
-
10799
- function genHandler (handler) {
10800
- if (!handler) {
10801
- return 'function(){}'
10802
- }
10803
-
10804
- if (Array.isArray(handler)) {
10805
- return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
10806
- }
10807
-
10808
- var isMethodPath = simplePathRE.test(handler.value);
10809
- var isFunctionExpression = fnExpRE.test(handler.value);
10810
- var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
10811
-
10812
- if (!handler.modifiers) {
10813
- if (isMethodPath || isFunctionExpression) {
10814
- return handler.value
10815
- }
10816
- return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
10817
- } else {
10818
- var code = '';
10819
- var genModifierCode = '';
10820
- var keys = [];
10821
- for (var key in handler.modifiers) {
10822
- if (modifierCode[key]) {
10823
- genModifierCode += modifierCode[key];
10824
- // left/right
10825
- if (keyCodes[key]) {
10826
- keys.push(key);
10827
- }
10828
- } else if (key === 'exact') {
10829
- var modifiers = (handler.modifiers);
10830
- genModifierCode += genGuard(
10831
- ['ctrl', 'shift', 'alt', 'meta']
10832
- .filter(function (keyModifier) { return !modifiers[keyModifier]; })
10833
- .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
10834
- .join('||')
10835
- );
10836
- } else {
10837
- keys.push(key);
10838
- }
10839
- }
10840
- if (keys.length) {
10841
- code += genKeyFilter(keys);
10842
- }
10843
- // Make sure modifiers like prevent and stop get executed after key filtering
10844
- if (genModifierCode) {
10845
- code += genModifierCode;
10846
- }
10847
- var handlerCode = isMethodPath
10848
- ? ("return " + (handler.value) + "($event)")
10849
- : isFunctionExpression
10850
- ? ("return (" + (handler.value) + ")($event)")
10851
- : isFunctionInvocation
10852
- ? ("return " + (handler.value))
10853
- : handler.value;
10854
- return ("function($event){" + code + handlerCode + "}")
10855
- }
10856
- }
10857
-
10858
- function genKeyFilter (keys) {
10859
- return (
10860
- // make sure the key filters only apply to KeyboardEvents
10861
- // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
10862
- // key events that do not have keyCode property...
10863
- "if(!$event.type.indexOf('key')&&" +
10864
- (keys.map(genFilterCode).join('&&')) + ")return null;"
10865
- )
10866
- }
10867
-
10868
- function genFilterCode (key) {
10869
- var keyVal = parseInt(key, 10);
10870
- if (keyVal) {
10871
- return ("$event.keyCode!==" + keyVal)
10872
- }
10873
- var keyCode = keyCodes[key];
10874
- var keyName = keyNames[key];
10875
- return (
10876
- "_k($event.keyCode," +
10877
- (JSON.stringify(key)) + "," +
10878
- (JSON.stringify(keyCode)) + "," +
10879
- "$event.key," +
10880
- "" + (JSON.stringify(keyName)) +
10881
- ")"
10882
- )
10883
- }
10884
-
10885
- /* */
10886
-
10887
- function on (el, dir) {
10888
- if (dir.modifiers) {
10889
- warn("v-on without argument does not support modifiers.");
10890
- }
10891
- el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
10892
- }
10893
-
10894
- /* */
10895
-
10896
- function bind$1 (el, dir) {
10897
- el.wrapData = function (code) {
10898
- return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
10899
- };
10900
- }
10901
-
10902
- /* */
10903
-
10904
- var baseDirectives = {
10905
- on: on,
10906
- bind: bind$1,
10907
- cloak: noop
10908
- };
10909
-
10910
- /* */
10911
-
10912
-
10913
-
10914
-
10915
-
10916
- var CodegenState = function CodegenState (options) {
10917
- this.options = options;
10918
- this.warn = options.warn || baseWarn;
10919
- this.transforms = pluckModuleFunction(options.modules, 'transformCode');
10920
- this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
10921
- this.directives = extend(extend({}, baseDirectives), options.directives);
10922
- var isReservedTag = options.isReservedTag || no;
10923
- this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
10924
- this.onceId = 0;
10925
- this.staticRenderFns = [];
10926
- this.pre = false;
10927
- };
10928
-
10929
-
10930
-
10931
- function generate (
10932
- ast,
10933
- options
10934
- ) {
10935
- var state = new CodegenState(options);
10936
- var code = ast ? genElement(ast, state) : '_c("div")';
10937
- return {
10938
- render: ("with(this){return " + code + "}"),
10939
- staticRenderFns: state.staticRenderFns
10940
- }
10941
- }
10942
-
10943
- function genElement (el, state) {
10944
- if (el.parent) {
10945
- el.pre = el.pre || el.parent.pre;
10946
- }
10947
-
10948
- if (el.staticRoot && !el.staticProcessed) {
10949
- return genStatic(el, state)
10950
- } else if (el.once && !el.onceProcessed) {
10951
- return genOnce(el, state)
10952
- } else if (el.for && !el.forProcessed) {
10953
- return genFor(el, state)
10954
- } else if (el.if && !el.ifProcessed) {
10955
- return genIf(el, state)
10956
- } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
10957
- return genChildren(el, state) || 'void 0'
10958
- } else if (el.tag === 'slot') {
10959
- return genSlot(el, state)
10960
- } else {
10961
- // component or element
10962
- var code;
10963
- if (el.component) {
10964
- code = genComponent(el.component, el, state);
10965
- } else {
10966
- var data;
10967
- if (!el.plain || (el.pre && state.maybeComponent(el))) {
10968
- data = genData$2(el, state);
10969
- }
10970
-
10971
- var children = el.inlineTemplate ? null : genChildren(el, state, true);
10972
- code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
10973
- }
10974
- // module transforms
10975
- for (var i = 0; i < state.transforms.length; i++) {
10976
- code = state.transforms[i](el, code);
10977
- }
10978
- return code
10979
- }
10980
- }
10981
-
10982
- // hoist static sub-trees out
10983
- function genStatic (el, state) {
10984
- el.staticProcessed = true;
10985
- // Some elements (templates) need to behave differently inside of a v-pre
10986
- // node. All pre nodes are static roots, so we can use this as a location to
10987
- // wrap a state change and reset it upon exiting the pre node.
10988
- var originalPreState = state.pre;
10989
- if (el.pre) {
10990
- state.pre = el.pre;
10991
- }
10992
- state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
10993
- state.pre = originalPreState;
10994
- return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
10995
- }
10996
-
10997
- // v-once
10998
- function genOnce (el, state) {
10999
- el.onceProcessed = true;
11000
- if (el.if && !el.ifProcessed) {
11001
- return genIf(el, state)
11002
- } else if (el.staticInFor) {
11003
- var key = '';
11004
- var parent = el.parent;
11005
- while (parent) {
11006
- if (parent.for) {
11007
- key = parent.key;
11008
- break
11009
- }
11010
- parent = parent.parent;
11011
- }
11012
- if (!key) {
11013
- state.warn(
11014
- "v-once can only be used inside v-for that is keyed. ",
11015
- el.rawAttrsMap['v-once']
11016
- );
11017
- return genElement(el, state)
11018
- }
11019
- return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
11020
- } else {
11021
- return genStatic(el, state)
11022
- }
11023
- }
11024
-
11025
- function genIf (
11026
- el,
11027
- state,
11028
- altGen,
11029
- altEmpty
11030
- ) {
11031
- el.ifProcessed = true; // avoid recursion
11032
- return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
11033
- }
11034
-
11035
- function genIfConditions (
11036
- conditions,
11037
- state,
11038
- altGen,
11039
- altEmpty
11040
- ) {
11041
- if (!conditions.length) {
11042
- return altEmpty || '_e()'
11043
- }
11044
-
11045
- var condition = conditions.shift();
11046
- if (condition.exp) {
11047
- return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
11048
- } else {
11049
- return ("" + (genTernaryExp(condition.block)))
11050
- }
11051
-
11052
- // v-if with v-once should generate code like (a)?_m(0):_m(1)
11053
- function genTernaryExp (el) {
11054
- return altGen
11055
- ? altGen(el, state)
11056
- : el.once
11057
- ? genOnce(el, state)
11058
- : genElement(el, state)
11059
- }
11060
- }
11061
-
11062
- function genFor (
11063
- el,
11064
- state,
11065
- altGen,
11066
- altHelper
11067
- ) {
11068
- var exp = el.for;
11069
- var alias = el.alias;
11070
- var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
11071
- var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
11072
-
11073
- if (state.maybeComponent(el) &&
11074
- el.tag !== 'slot' &&
11075
- el.tag !== 'template' &&
11076
- !el.key
11077
- ) {
11078
- state.warn(
11079
- "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
11080
- "v-for should have explicit keys. " +
11081
- "See https://vuejs.org/guide/list.html#key for more info.",
11082
- el.rawAttrsMap['v-for'],
11083
- true /* tip */
11084
- );
11085
- }
11086
-
11087
- el.forProcessed = true; // avoid recursion
11088
- return (altHelper || '_l') + "((" + exp + ")," +
11089
- "function(" + alias + iterator1 + iterator2 + "){" +
11090
- "return " + ((altGen || genElement)(el, state)) +
11091
- '})'
11092
- }
11093
-
11094
- function genData$2 (el, state) {
11095
- var data = '{';
11096
-
11097
- // directives first.
11098
- // directives may mutate the el's other properties before they are generated.
11099
- var dirs = genDirectives(el, state);
11100
- if (dirs) { data += dirs + ','; }
11101
-
11102
- // key
11103
- if (el.key) {
11104
- data += "key:" + (el.key) + ",";
11105
- }
11106
- // ref
11107
- if (el.ref) {
11108
- data += "ref:" + (el.ref) + ",";
11109
- }
11110
- if (el.refInFor) {
11111
- data += "refInFor:true,";
11112
- }
11113
- // pre
11114
- if (el.pre) {
11115
- data += "pre:true,";
11116
- }
11117
- // record original tag name for components using "is" attribute
11118
- if (el.component) {
11119
- data += "tag:\"" + (el.tag) + "\",";
11120
- }
11121
- // module data generation functions
11122
- for (var i = 0; i < state.dataGenFns.length; i++) {
11123
- data += state.dataGenFns[i](el);
11124
- }
11125
- // attributes
11126
- if (el.attrs) {
11127
- data += "attrs:" + (genProps(el.attrs)) + ",";
11128
- }
11129
- // DOM props
11130
- if (el.props) {
11131
- data += "domProps:" + (genProps(el.props)) + ",";
11132
- }
11133
- // event handlers
11134
- if (el.events) {
11135
- data += (genHandlers(el.events, false)) + ",";
11136
- }
11137
- if (el.nativeEvents) {
11138
- data += (genHandlers(el.nativeEvents, true)) + ",";
11139
- }
11140
- // slot target
11141
- // only for non-scoped slots
11142
- if (el.slotTarget && !el.slotScope) {
11143
- data += "slot:" + (el.slotTarget) + ",";
11144
- }
11145
- // scoped slots
11146
- if (el.scopedSlots) {
11147
- data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
11148
- }
11149
- // component v-model
11150
- if (el.model) {
11151
- data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
11152
- }
11153
- // inline-template
11154
- if (el.inlineTemplate) {
11155
- var inlineTemplate = genInlineTemplate(el, state);
11156
- if (inlineTemplate) {
11157
- data += inlineTemplate + ",";
11158
- }
11159
- }
11160
- data = data.replace(/,$/, '') + '}';
11161
- // v-bind dynamic argument wrap
11162
- // v-bind with dynamic arguments must be applied using the same v-bind object
11163
- // merge helper so that class/style/mustUseProp attrs are handled correctly.
11164
- if (el.dynamicAttrs) {
11165
- data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
11166
- }
11167
- // v-bind data wrap
11168
- if (el.wrapData) {
11169
- data = el.wrapData(data);
11170
- }
11171
- // v-on data wrap
11172
- if (el.wrapListeners) {
11173
- data = el.wrapListeners(data);
11174
- }
11175
- return data
11176
- }
11177
-
11178
- function genDirectives (el, state) {
11179
- var dirs = el.directives;
11180
- if (!dirs) { return }
11181
- var res = 'directives:[';
11182
- var hasRuntime = false;
11183
- var i, l, dir, needRuntime;
11184
- for (i = 0, l = dirs.length; i < l; i++) {
11185
- dir = dirs[i];
11186
- needRuntime = true;
11187
- var gen = state.directives[dir.name];
11188
- if (gen) {
11189
- // compile-time directive that manipulates AST.
11190
- // returns true if it also needs a runtime counterpart.
11191
- needRuntime = !!gen(el, dir, state.warn);
11192
- }
11193
- if (needRuntime) {
11194
- hasRuntime = true;
11195
- res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
11196
- }
11197
- }
11198
- if (hasRuntime) {
11199
- return res.slice(0, -1) + ']'
11200
- }
11201
- }
11202
-
11203
- function genInlineTemplate (el, state) {
11204
- var ast = el.children[0];
11205
- if (el.children.length !== 1 || ast.type !== 1) {
11206
- state.warn(
11207
- 'Inline-template components must have exactly one child element.',
11208
- { start: el.start }
11209
- );
11210
- }
11211
- if (ast && ast.type === 1) {
11212
- var inlineRenderFns = generate(ast, state.options);
11213
- return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
11214
- }
11215
- }
11216
-
11217
- function genScopedSlots (
11218
- el,
11219
- slots,
11220
- state
11221
- ) {
11222
- // by default scoped slots are considered "stable", this allows child
11223
- // components with only scoped slots to skip forced updates from parent.
11224
- // but in some cases we have to bail-out of this optimization
11225
- // for example if the slot contains dynamic names, has v-if or v-for on them...
11226
- var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
11227
- var slot = slots[key];
11228
- return (
11229
- slot.slotTargetDynamic ||
11230
- slot.if ||
11231
- slot.for ||
11232
- containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11233
- )
11234
- });
11235
-
11236
- // #9534: if a component with scoped slots is inside a conditional branch,
11237
- // it's possible for the same component to be reused but with different
11238
- // compiled slot content. To avoid that, we generate a unique key based on
11239
- // the generated code of all the slot contents.
11240
- var needsKey = !!el.if;
11241
-
11242
- // OR when it is inside another scoped slot or v-for (the reactivity may be
11243
- // disconnected due to the intermediate scope variable)
11244
- // #9438, #9506
11245
- // TODO: this can be further optimized by properly analyzing in-scope bindings
11246
- // and skip force updating ones that do not actually use scope variables.
11247
- if (!needsForceUpdate) {
11248
- var parent = el.parent;
11249
- while (parent) {
11250
- if (
11251
- (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
11252
- parent.for
11253
- ) {
11254
- needsForceUpdate = true;
11255
- break
11256
- }
11257
- if (parent.if) {
11258
- needsKey = true;
11259
- }
11260
- parent = parent.parent;
11261
- }
11262
- }
11263
-
11264
- var generatedSlots = Object.keys(slots)
11265
- .map(function (key) { return genScopedSlot(slots[key], state); })
11266
- .join(',');
11267
-
11268
- return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
11269
- }
11270
-
11271
- function hash(str) {
11272
- var hash = 5381;
11273
- var i = str.length;
11274
- while(i) {
11275
- hash = (hash * 33) ^ str.charCodeAt(--i);
11276
- }
11277
- return hash >>> 0
11278
- }
11279
-
11280
- function containsSlotChild (el) {
11281
- if (el.type === 1) {
11282
- if (el.tag === 'slot') {
11283
- return true
11284
- }
11285
- return el.children.some(containsSlotChild)
11286
- }
11287
- return false
11288
- }
11289
-
11290
- function genScopedSlot (
11291
- el,
11292
- state
11293
- ) {
11294
- var isLegacySyntax = el.attrsMap['slot-scope'];
11295
- if (el.if && !el.ifProcessed && !isLegacySyntax) {
11296
- return genIf(el, state, genScopedSlot, "null")
11297
- }
11298
- if (el.for && !el.forProcessed) {
11299
- return genFor(el, state, genScopedSlot)
11300
- }
11301
- var slotScope = el.slotScope === emptySlotScopeToken
11302
- ? ""
11303
- : String(el.slotScope);
11304
- var fn = "function(" + slotScope + "){" +
11305
- "return " + (el.tag === 'template'
11306
- ? el.if && isLegacySyntax
11307
- ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
11308
- : genChildren(el, state) || 'undefined'
11309
- : genElement(el, state)) + "}";
11310
- // reverse proxy v-slot without scope on this.$slots
11311
- var reverseProxy = slotScope ? "" : ",proxy:true";
11312
- return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
11313
- }
11314
-
11315
- function genChildren (
11316
- el,
11317
- state,
11318
- checkSkip,
11319
- altGenElement,
11320
- altGenNode
11321
- ) {
11322
- var children = el.children;
11323
- if (children.length) {
11324
- var el$1 = children[0];
11325
- // optimize single v-for
11326
- if (children.length === 1 &&
11327
- el$1.for &&
11328
- el$1.tag !== 'template' &&
11329
- el$1.tag !== 'slot'
11330
- ) {
11331
- var normalizationType = checkSkip
11332
- ? state.maybeComponent(el$1) ? ",1" : ",0"
11333
- : "";
11334
- return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
11335
- }
11336
- var normalizationType$1 = checkSkip
11337
- ? getNormalizationType(children, state.maybeComponent)
11338
- : 0;
11339
- var gen = altGenNode || genNode;
11340
- return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
11341
- }
11342
- }
11343
-
11344
- // determine the normalization needed for the children array.
11345
- // 0: no normalization needed
11346
- // 1: simple normalization needed (possible 1-level deep nested array)
11347
- // 2: full normalization needed
11348
- function getNormalizationType (
11349
- children,
11350
- maybeComponent
11351
- ) {
11352
- var res = 0;
11353
- for (var i = 0; i < children.length; i++) {
11354
- var el = children[i];
11355
- if (el.type !== 1) {
11356
- continue
11357
- }
11358
- if (needsNormalization(el) ||
11359
- (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
11360
- res = 2;
11361
- break
11362
- }
11363
- if (maybeComponent(el) ||
11364
- (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
11365
- res = 1;
11366
- }
11367
- }
11368
- return res
11369
- }
11370
-
11371
- function needsNormalization (el) {
11372
- return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
11373
- }
11374
-
11375
- function genNode (node, state) {
11376
- if (node.type === 1) {
11377
- return genElement(node, state)
11378
- } else if (node.type === 3 && node.isComment) {
11379
- return genComment(node)
11380
- } else {
11381
- return genText(node)
11382
- }
11383
- }
11384
-
11385
- function genText (text) {
11386
- return ("_v(" + (text.type === 2
11387
- ? text.expression // no need for () because already wrapped in _s()
11388
- : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
11389
- }
11390
-
11391
- function genComment (comment) {
11392
- return ("_e(" + (JSON.stringify(comment.text)) + ")")
11393
- }
11394
-
11395
- function genSlot (el, state) {
11396
- var slotName = el.slotName || '"default"';
11397
- var children = genChildren(el, state);
11398
- var res = "_t(" + slotName + (children ? ("," + children) : '');
11399
- var attrs = el.attrs || el.dynamicAttrs
11400
- ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11401
- // slot props are camelized
11402
- name: camelize(attr.name),
11403
- value: attr.value,
11404
- dynamic: attr.dynamic
11405
- }); }))
11406
- : null;
11407
- var bind$$1 = el.attrsMap['v-bind'];
11408
- if ((attrs || bind$$1) && !children) {
11409
- res += ",null";
11410
- }
11411
- if (attrs) {
11412
- res += "," + attrs;
11413
- }
11414
- if (bind$$1) {
11415
- res += (attrs ? '' : ',null') + "," + bind$$1;
11416
- }
11417
- return res + ')'
11418
- }
11419
-
11420
- // componentName is el.component, take it as argument to shun flow's pessimistic refinement
11421
- function genComponent (
11422
- componentName,
11423
- el,
11424
- state
11425
- ) {
11426
- var children = el.inlineTemplate ? null : genChildren(el, state, true);
11427
- return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
11428
- }
11429
-
11430
- function genProps (props) {
11431
- var staticProps = "";
11432
- var dynamicProps = "";
11433
- for (var i = 0; i < props.length; i++) {
11434
- var prop = props[i];
11435
- var value = transformSpecialNewlines(prop.value);
11436
- if (prop.dynamic) {
11437
- dynamicProps += (prop.name) + "," + value + ",";
11438
- } else {
11439
- staticProps += "\"" + (prop.name) + "\":" + value + ",";
11440
- }
11441
- }
11442
- staticProps = "{" + (staticProps.slice(0, -1)) + "}";
11443
- if (dynamicProps) {
11444
- return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
11445
- } else {
11446
- return staticProps
11447
- }
11448
- }
11449
-
11450
- // #3895, #4268
11451
- function transformSpecialNewlines (text) {
11452
- return text
11453
- .replace(/\u2028/g, '\\u2028')
11454
- .replace(/\u2029/g, '\\u2029')
11455
- }
11456
-
11457
- /* */
11458
-
11459
-
11460
-
11461
- // these keywords should not appear inside expressions, but operators like
11462
- // typeof, instanceof and in are allowed
11463
- var prohibitedKeywordRE = new RegExp('\\b' + (
11464
- 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
11465
- 'super,throw,while,yield,delete,export,import,return,switch,default,' +
11466
- 'extends,finally,continue,debugger,function,arguments'
11467
- ).split(',').join('\\b|\\b') + '\\b');
11468
-
11469
- // these unary operators should not be used as property/method names
11470
- var unaryOperatorsRE = new RegExp('\\b' + (
11471
- 'delete,typeof,void'
11472
- ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
11473
-
11474
- // strip strings in expressions
11475
- var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
11476
-
11477
- // detect problematic expressions in a template
11478
- function detectErrors (ast, warn) {
11479
- if (ast) {
11480
- checkNode(ast, warn);
11481
- }
11482
- }
11483
-
11484
- function checkNode (node, warn) {
11485
- if (node.type === 1) {
11486
- for (var name in node.attrsMap) {
11487
- if (dirRE.test(name)) {
11488
- var value = node.attrsMap[name];
11489
- if (value) {
11490
- var range = node.rawAttrsMap[name];
11491
- if (name === 'v-for') {
11492
- checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11493
- } else if (onRE.test(name)) {
11494
- checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11495
- } else {
11496
- checkExpression(value, (name + "=\"" + value + "\""), warn, range);
11497
- }
11498
- }
11499
- }
11500
- }
11501
- if (node.children) {
11502
- for (var i = 0; i < node.children.length; i++) {
11503
- checkNode(node.children[i], warn);
11504
- }
11505
- }
11506
- } else if (node.type === 2) {
11507
- checkExpression(node.expression, node.text, warn, node);
11508
- }
11509
- }
11510
-
11511
- function checkEvent (exp, text, warn, range) {
11512
- var stipped = exp.replace(stripStringRE, '');
11513
- var keywordMatch = stipped.match(unaryOperatorsRE);
11514
- if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11515
- warn(
11516
- "avoid using JavaScript unary operator as property name: " +
11517
- "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
11518
- range
11519
- );
11520
- }
11521
- checkExpression(exp, text, warn, range);
11522
- }
11523
-
11524
- function checkFor (node, text, warn, range) {
11525
- checkExpression(node.for || '', text, warn, range);
11526
- checkIdentifier(node.alias, 'v-for alias', text, warn, range);
11527
- checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
11528
- checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
11529
- }
11530
-
11531
- function checkIdentifier (
11532
- ident,
11533
- type,
11534
- text,
11535
- warn,
11536
- range
11537
- ) {
11538
- if (typeof ident === 'string') {
11539
- try {
11540
- new Function(("var " + ident + "=_"));
11541
- } catch (e) {
11542
- warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
11543
- }
11544
- }
11545
- }
11546
-
11547
- function checkExpression (exp, text, warn, range) {
11548
- try {
11549
- new Function(("return " + exp));
11550
- } catch (e) {
11551
- var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
11552
- if (keywordMatch) {
11553
- warn(
11554
- "avoid using JavaScript keyword as property name: " +
11555
- "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
11556
- range
11557
- );
11558
- } else {
11559
- warn(
11560
- "invalid expression: " + (e.message) + " in\n\n" +
11561
- " " + exp + "\n\n" +
11562
- " Raw expression: " + (text.trim()) + "\n",
11563
- range
11564
- );
11565
- }
11566
- }
11567
- }
11568
-
11569
- /* */
11570
-
11571
- var range = 2;
11572
-
11573
- function generateCodeFrame (
11574
- source,
11575
- start,
11576
- end
11577
- ) {
11578
- if ( start === void 0 ) start = 0;
11579
- if ( end === void 0 ) end = source.length;
11580
-
11581
- var lines = source.split(/\r?\n/);
11582
- var count = 0;
11583
- var res = [];
11584
- for (var i = 0; i < lines.length; i++) {
11585
- count += lines[i].length + 1;
11586
- if (count >= start) {
11587
- for (var j = i - range; j <= i + range || end > count; j++) {
11588
- if (j < 0 || j >= lines.length) { continue }
11589
- res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
11590
- var lineLength = lines[j].length;
11591
- if (j === i) {
11592
- // push underline
11593
- var pad = start - (count - lineLength) + 1;
11594
- var length = end > count ? lineLength - pad : end - start;
11595
- res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
11596
- } else if (j > i) {
11597
- if (end > count) {
11598
- var length$1 = Math.min(end - count, lineLength);
11599
- res.push(" | " + repeat$1("^", length$1));
11600
- }
11601
- count += lineLength + 1;
11602
- }
11603
- }
11604
- break
11605
- }
11606
- }
11607
- return res.join('\n')
11608
- }
11609
-
11610
- function repeat$1 (str, n) {
11611
- var result = '';
11612
- if (n > 0) {
11613
- while (true) { // eslint-disable-line
11614
- if (n & 1) { result += str; }
11615
- n >>>= 1;
11616
- if (n <= 0) { break }
11617
- str += str;
11618
- }
11619
- }
11620
- return result
11621
- }
11622
-
11623
- /* */
11624
-
11625
-
11626
-
11627
- function createFunction (code, errors) {
11628
- try {
11629
- return new Function(code)
11630
- } catch (err) {
11631
- errors.push({ err: err, code: code });
11632
- return noop
11633
- }
11634
- }
11635
-
11636
- function createCompileToFunctionFn (compile) {
11637
- var cache = Object.create(null);
11638
-
11639
- return function compileToFunctions (
11640
- template,
11641
- options,
11642
- vm
11643
- ) {
11644
- options = extend({}, options);
11645
- var warn$$1 = options.warn || warn;
11646
- delete options.warn;
11647
-
11648
- /* istanbul ignore if */
11649
- {
11650
- // detect possible CSP restriction
11651
- try {
11652
- new Function('return 1');
11653
- } catch (e) {
11654
- if (e.toString().match(/unsafe-eval|CSP/)) {
11655
- warn$$1(
11656
- 'It seems you are using the standalone build of Vue.js in an ' +
11657
- 'environment with Content Security Policy that prohibits unsafe-eval. ' +
11658
- 'The template compiler cannot work in this environment. Consider ' +
11659
- 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
11660
- 'templates into render functions.'
11661
- );
11662
- }
11663
- }
11664
- }
11665
-
11666
- // check cache
11667
- var key = options.delimiters
11668
- ? String(options.delimiters) + template
11669
- : template;
11670
- if (cache[key]) {
11671
- return cache[key]
11672
- }
11673
-
11674
- // compile
11675
- var compiled = compile(template, options);
11676
-
11677
- // check compilation errors/tips
11678
- {
11679
- if (compiled.errors && compiled.errors.length) {
11680
- if (options.outputSourceRange) {
11681
- compiled.errors.forEach(function (e) {
11682
- warn$$1(
11683
- "Error compiling template:\n\n" + (e.msg) + "\n\n" +
11684
- generateCodeFrame(template, e.start, e.end),
11685
- vm
11686
- );
11687
- });
11688
- } else {
11689
- warn$$1(
11690
- "Error compiling template:\n\n" + template + "\n\n" +
11691
- compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
11692
- vm
11693
- );
11694
- }
11695
- }
11696
- if (compiled.tips && compiled.tips.length) {
11697
- if (options.outputSourceRange) {
11698
- compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
11699
- } else {
11700
- compiled.tips.forEach(function (msg) { return tip(msg, vm); });
11701
- }
11702
- }
11703
- }
11704
-
11705
- // turn code into functions
11706
- var res = {};
11707
- var fnGenErrors = [];
11708
- res.render = createFunction(compiled.render, fnGenErrors);
11709
- res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
11710
- return createFunction(code, fnGenErrors)
11711
- });
11712
-
11713
- // check function generation errors.
11714
- // this should only happen if there is a bug in the compiler itself.
11715
- // mostly for codegen development use
11716
- /* istanbul ignore if */
11717
- {
11718
- if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
11719
- warn$$1(
11720
- "Failed to generate render function:\n\n" +
11721
- fnGenErrors.map(function (ref) {
11722
- var err = ref.err;
11723
- var code = ref.code;
11724
-
11725
- return ((err.toString()) + " in\n\n" + code + "\n");
11726
- }).join('\n'),
11727
- vm
11728
- );
11729
- }
11730
- }
11731
-
11732
- return (cache[key] = res)
11733
- }
11734
- }
11735
-
11736
- /* */
11737
-
11738
- function createCompilerCreator (baseCompile) {
11739
- return function createCompiler (baseOptions) {
11740
- function compile (
11741
- template,
11742
- options
11743
- ) {
11744
- var finalOptions = Object.create(baseOptions);
11745
- var errors = [];
11746
- var tips = [];
11747
-
11748
- var warn = function (msg, range, tip) {
11749
- (tip ? tips : errors).push(msg);
11750
- };
11751
-
11752
- if (options) {
11753
- if (options.outputSourceRange) {
11754
- // $flow-disable-line
11755
- var leadingSpaceLength = template.match(/^\s*/)[0].length;
11756
-
11757
- warn = function (msg, range, tip) {
11758
- var data = { msg: msg };
11759
- if (range) {
11760
- if (range.start != null) {
11761
- data.start = range.start + leadingSpaceLength;
11762
- }
11763
- if (range.end != null) {
11764
- data.end = range.end + leadingSpaceLength;
11765
- }
11766
- }
11767
- (tip ? tips : errors).push(data);
11768
- };
11769
- }
11770
- // merge custom modules
11771
- if (options.modules) {
11772
- finalOptions.modules =
11773
- (baseOptions.modules || []).concat(options.modules);
11774
- }
11775
- // merge custom directives
11776
- if (options.directives) {
11777
- finalOptions.directives = extend(
11778
- Object.create(baseOptions.directives || null),
11779
- options.directives
11780
- );
11781
- }
11782
- // copy other options
11783
- for (var key in options) {
11784
- if (key !== 'modules' && key !== 'directives') {
11785
- finalOptions[key] = options[key];
11786
- }
11787
- }
11788
- }
11789
-
11790
- finalOptions.warn = warn;
11791
-
11792
- var compiled = baseCompile(template.trim(), finalOptions);
11793
- {
11794
- detectErrors(compiled.ast, warn);
11795
- }
11796
- compiled.errors = errors;
11797
- compiled.tips = tips;
11798
- return compiled
11799
- }
11800
-
11801
- return {
11802
- compile: compile,
11803
- compileToFunctions: createCompileToFunctionFn(compile)
11804
- }
11805
- }
11806
- }
11807
-
11808
- /* */
11809
-
11810
- // `createCompilerCreator` allows creating compilers that use alternative
11811
- // parser/optimizer/codegen, e.g the SSR optimizing compiler.
11812
- // Here we just export a default compiler using the default parts.
11813
- var createCompiler = createCompilerCreator(function baseCompile (
11814
- template,
11815
- options
11816
- ) {
11817
- var ast = parse(template.trim(), options);
11818
- if (options.optimize !== false) {
11819
- optimize(ast, options);
11820
- }
11821
- var code = generate(ast, options);
11822
- return {
11823
- ast: ast,
11824
- render: code.render,
11825
- staticRenderFns: code.staticRenderFns
11826
- }
11827
- });
11828
-
11829
- /* */
11830
-
11831
- var ref$1 = createCompiler(baseOptions);
11832
- var compile = ref$1.compile;
11833
- var compileToFunctions = ref$1.compileToFunctions;
11834
-
11835
- /* */
11836
-
11837
- // check whether current browser encodes a char inside attribute values
11838
- var div;
11839
- function getShouldDecode (href) {
11840
- div = div || document.createElement('div');
11841
- div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
11842
- return div.innerHTML.indexOf('&#10;') > 0
11843
- }
11844
-
11845
- // #3663: IE encodes newlines inside attribute values while other browsers don't
11846
- var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
11847
- // #6828: chrome encodes content in a[href]
11848
- var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
11849
-
11850
- /* */
11851
-
11852
- var idToTemplate = cached(function (id) {
11853
- var el = query(id);
11854
- return el && el.innerHTML
11855
- });
11856
-
11857
- var mount = Vue.prototype.$mount;
11858
- Vue.prototype.$mount = function (
11859
- el,
11860
- hydrating
11861
- ) {
11862
- el = el && query(el);
11863
-
11864
- /* istanbul ignore if */
11865
- if (el === document.body || el === document.documentElement) {
11866
- warn(
11867
- "Do not mount Vue to <html> or <body> - mount to normal elements instead."
11868
- );
11869
- return this
11870
- }
11871
-
11872
- var options = this.$options;
11873
- // resolve template/el and convert to render function
11874
- if (!options.render) {
11875
- var template = options.template;
11876
- if (template) {
11877
- if (typeof template === 'string') {
11878
- if (template.charAt(0) === '#') {
11879
- template = idToTemplate(template);
11880
- /* istanbul ignore if */
11881
- if (!template) {
11882
- warn(
11883
- ("Template element not found or is empty: " + (options.template)),
11884
- this
11885
- );
11886
- }
11887
- }
11888
- } else if (template.nodeType) {
11889
- template = template.innerHTML;
11890
- } else {
11891
- {
11892
- warn('invalid template option:' + template, this);
11893
- }
11894
- return this
11895
- }
11896
- } else if (el) {
11897
- template = getOuterHTML(el);
11898
- }
11899
- if (template) {
11900
- /* istanbul ignore if */
11901
- if (config.performance && mark) {
11902
- mark('compile');
11903
- }
11904
-
11905
- var ref = compileToFunctions(template, {
11906
- outputSourceRange: "development" !== 'production',
11907
- shouldDecodeNewlines: shouldDecodeNewlines,
11908
- shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
11909
- delimiters: options.delimiters,
11910
- comments: options.comments
11911
- }, this);
11912
- var render = ref.render;
11913
- var staticRenderFns = ref.staticRenderFns;
11914
- options.render = render;
11915
- options.staticRenderFns = staticRenderFns;
11916
-
11917
- /* istanbul ignore if */
11918
- if (config.performance && mark) {
11919
- mark('compile end');
11920
- measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
11921
- }
11922
- }
11923
- }
11924
- return mount.call(this, el, hydrating)
11925
- };
11926
-
11927
- /**
11928
- * Get outerHTML of elements, taking care
11929
- * of SVG elements in IE as well.
11930
- */
11931
- function getOuterHTML (el) {
11932
- if (el.outerHTML) {
11933
- return el.outerHTML
11934
- } else {
11935
- var container = document.createElement('div');
11936
- container.appendChild(el.cloneNode(true));
11937
- return container.innerHTML
11938
- }
11939
- }
11940
-
11941
- Vue.compile = compileToFunctions;
11942
-
11943
- return Vue;
11944
-
11945
- }));
11946
- /**
11947
- * vuex v3.1.0
11948
- * (c) 2019 Evan You
11949
- * @license MIT
11950
- */
11951
- (function (global, factory) {
11952
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
11953
- typeof define === 'function' && define.amd ? define(factory) :
11954
- (global = global || self, global.Vuex = factory());
11955
- }(this, function () { 'use strict';
11956
-
11957
- function applyMixin (Vue) {
11958
- var version = Number(Vue.version.split('.')[0]);
11959
-
11960
- if (version >= 2) {
11961
- Vue.mixin({ beforeCreate: vuexInit });
11962
- } else {
11963
- // override init and inject vuex init procedure
11964
- // for 1.x backwards compatibility.
11965
- var _init = Vue.prototype._init;
11966
- Vue.prototype._init = function (options) {
11967
- if ( options === void 0 ) options = {};
11968
-
11969
- options.init = options.init
11970
- ? [vuexInit].concat(options.init)
11971
- : vuexInit;
11972
- _init.call(this, options);
11973
- };
11974
- }
11975
-
11976
- /**
11977
- * Vuex init hook, injected into each instances init hooks list.
11978
- */
11979
-
11980
- function vuexInit () {
11981
- var options = this.$options;
11982
- // store injection
11983
- if (options.store) {
11984
- this.$store = typeof options.store === 'function'
11985
- ? options.store()
11986
- : options.store;
11987
- } else if (options.parent && options.parent.$store) {
11988
- this.$store = options.parent.$store;
11989
- }
11990
- }
11991
- }
11992
-
11993
- var devtoolHook =
11994
- typeof window !== 'undefined' &&
11995
- window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
11996
-
11997
- function devtoolPlugin (store) {
11998
- if (!devtoolHook) { return }
11999
-
12000
- store._devtoolHook = devtoolHook;
12001
-
12002
- devtoolHook.emit('vuex:init', store);
12003
-
12004
- devtoolHook.on('vuex:travel-to-state', function (targetState) {
12005
- store.replaceState(targetState);
12006
- });
12007
-
12008
- store.subscribe(function (mutation, state) {
12009
- devtoolHook.emit('vuex:mutation', mutation, state);
12010
- });
12011
- }
12012
-
12013
- /**
12014
- * Get the first item that pass the test
12015
- * by second argument function
12016
- *
12017
- * @param {Array} list
12018
- * @param {Function} f
12019
- * @return {*}
12020
- */
12021
-
12022
- /**
12023
- * forEach for object
12024
- */
12025
- function forEachValue (obj, fn) {
12026
- Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
12027
- }
12028
-
12029
- function isObject (obj) {
12030
- return obj !== null && typeof obj === 'object'
12031
- }
12032
-
12033
- function isPromise (val) {
12034
- return val && typeof val.then === 'function'
12035
- }
12036
-
12037
- function assert (condition, msg) {
12038
- if (!condition) { throw new Error(("[vuex] " + msg)) }
12039
- }
12040
-
12041
- // Base data struct for store's module, package with some attribute and method
12042
- var Module = function Module (rawModule, runtime) {
12043
- this.runtime = runtime;
12044
- // Store some children item
12045
- this._children = Object.create(null);
12046
- // Store the origin module object which passed by programmer
12047
- this._rawModule = rawModule;
12048
- var rawState = rawModule.state;
12049
-
12050
- // Store the origin module's state
12051
- this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
12052
- };
12053
-
12054
- var prototypeAccessors = { namespaced: { configurable: true } };
12055
-
12056
- prototypeAccessors.namespaced.get = function () {
12057
- return !!this._rawModule.namespaced
12058
- };
12059
-
12060
- Module.prototype.addChild = function addChild (key, module) {
12061
- this._children[key] = module;
12062
- };
12063
-
12064
- Module.prototype.removeChild = function removeChild (key) {
12065
- delete this._children[key];
12066
- };
12067
-
12068
- Module.prototype.getChild = function getChild (key) {
12069
- return this._children[key]
12070
- };
12071
-
12072
- Module.prototype.update = function update (rawModule) {
12073
- this._rawModule.namespaced = rawModule.namespaced;
12074
- if (rawModule.actions) {
12075
- this._rawModule.actions = rawModule.actions;
12076
- }
12077
- if (rawModule.mutations) {
12078
- this._rawModule.mutations = rawModule.mutations;
12079
- }
12080
- if (rawModule.getters) {
12081
- this._rawModule.getters = rawModule.getters;
12082
- }
12083
- };
12084
-
12085
- Module.prototype.forEachChild = function forEachChild (fn) {
12086
- forEachValue(this._children, fn);
12087
- };
12088
-
12089
- Module.prototype.forEachGetter = function forEachGetter (fn) {
12090
- if (this._rawModule.getters) {
12091
- forEachValue(this._rawModule.getters, fn);
12092
- }
12093
- };
12094
-
12095
- Module.prototype.forEachAction = function forEachAction (fn) {
12096
- if (this._rawModule.actions) {
12097
- forEachValue(this._rawModule.actions, fn);
12098
- }
12099
- };
12100
-
12101
- Module.prototype.forEachMutation = function forEachMutation (fn) {
12102
- if (this._rawModule.mutations) {
12103
- forEachValue(this._rawModule.mutations, fn);
12104
- }
12105
- };
12106
-
12107
- Object.defineProperties( Module.prototype, prototypeAccessors );
12108
-
12109
- var ModuleCollection = function ModuleCollection (rawRootModule) {
12110
- // register root module (Vuex.Store options)
12111
- this.register([], rawRootModule, false);
12112
- };
12113
-
12114
- ModuleCollection.prototype.get = function get (path) {
12115
- return path.reduce(function (module, key) {
12116
- return module.getChild(key)
12117
- }, this.root)
12118
- };
12119
-
12120
- ModuleCollection.prototype.getNamespace = function getNamespace (path) {
12121
- var module = this.root;
12122
- return path.reduce(function (namespace, key) {
12123
- module = module.getChild(key);
12124
- return namespace + (module.namespaced ? key + '/' : '')
12125
- }, '')
12126
- };
12127
-
12128
- ModuleCollection.prototype.update = function update$1 (rawRootModule) {
12129
- update([], this.root, rawRootModule);
12130
- };
12131
-
12132
- ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
12133
- var this$1 = this;
12134
- if ( runtime === void 0 ) runtime = true;
12135
-
12136
- {
12137
- assertRawModule(path, rawModule);
12138
- }
12139
-
12140
- var newModule = new Module(rawModule, runtime);
12141
- if (path.length === 0) {
12142
- this.root = newModule;
12143
- } else {
12144
- var parent = this.get(path.slice(0, -1));
12145
- parent.addChild(path[path.length - 1], newModule);
12146
- }
12147
-
12148
- // register nested modules
12149
- if (rawModule.modules) {
12150
- forEachValue(rawModule.modules, function (rawChildModule, key) {
12151
- this$1.register(path.concat(key), rawChildModule, runtime);
12152
- });
12153
- }
12154
- };
12155
-
12156
- ModuleCollection.prototype.unregister = function unregister (path) {
12157
- var parent = this.get(path.slice(0, -1));
12158
- var key = path[path.length - 1];
12159
- if (!parent.getChild(key).runtime) { return }
12160
-
12161
- parent.removeChild(key);
12162
- };
12163
-
12164
- function update (path, targetModule, newModule) {
12165
- {
12166
- assertRawModule(path, newModule);
12167
- }
12168
-
12169
- // update target module
12170
- targetModule.update(newModule);
12171
-
12172
- // update nested modules
12173
- if (newModule.modules) {
12174
- for (var key in newModule.modules) {
12175
- if (!targetModule.getChild(key)) {
12176
- {
12177
- console.warn(
12178
- "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
12179
- 'manual reload is needed'
12180
- );
12181
- }
12182
- return
12183
- }
12184
- update(
12185
- path.concat(key),
12186
- targetModule.getChild(key),
12187
- newModule.modules[key]
12188
- );
12189
- }
12190
- }
12191
- }
12192
-
12193
- var functionAssert = {
12194
- assert: function (value) { return typeof value === 'function'; },
12195
- expected: 'function'
12196
- };
12197
-
12198
- var objectAssert = {
12199
- assert: function (value) { return typeof value === 'function' ||
12200
- (typeof value === 'object' && typeof value.handler === 'function'); },
12201
- expected: 'function or object with "handler" function'
12202
- };
12203
-
12204
- var assertTypes = {
12205
- getters: functionAssert,
12206
- mutations: functionAssert,
12207
- actions: objectAssert
12208
- };
12209
-
12210
- function assertRawModule (path, rawModule) {
12211
- Object.keys(assertTypes).forEach(function (key) {
12212
- if (!rawModule[key]) { return }
12213
-
12214
- var assertOptions = assertTypes[key];
12215
-
12216
- forEachValue(rawModule[key], function (value, type) {
12217
- assert(
12218
- assertOptions.assert(value),
12219
- makeAssertionMessage(path, key, type, value, assertOptions.expected)
12220
- );
12221
- });
12222
- });
12223
- }
12224
-
12225
- function makeAssertionMessage (path, key, type, value, expected) {
12226
- var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
12227
- if (path.length > 0) {
12228
- buf += " in module \"" + (path.join('.')) + "\"";
12229
- }
12230
- buf += " is " + (JSON.stringify(value)) + ".";
12231
- return buf
12232
- }
12233
-
12234
- var Vue; // bind on install
12235
-
12236
- var Store = function Store (options) {
12237
- var this$1 = this;
12238
- if ( options === void 0 ) options = {};
12239
-
12240
- // Auto install if it is not done yet and `window` has `Vue`.
12241
- // To allow users to avoid auto-installation in some cases,
12242
- // this code should be placed here. See #731
12243
- if (!Vue && typeof window !== 'undefined' && window.Vue) {
12244
- install(window.Vue);
12245
- }
12246
-
12247
- {
12248
- assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
12249
- assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
12250
- assert(this instanceof Store, "store must be called with the new operator.");
12251
- }
12252
-
12253
- var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
12254
- var strict = options.strict; if ( strict === void 0 ) strict = false;
12255
-
12256
- // store internal state
12257
- this._committing = false;
12258
- this._actions = Object.create(null);
12259
- this._actionSubscribers = [];
12260
- this._mutations = Object.create(null);
12261
- this._wrappedGetters = Object.create(null);
12262
- this._modules = new ModuleCollection(options);
12263
- this._modulesNamespaceMap = Object.create(null);
12264
- this._subscribers = [];
12265
- this._watcherVM = new Vue();
12266
-
12267
- // bind commit and dispatch to self
12268
- var store = this;
12269
- var ref = this;
12270
- var dispatch = ref.dispatch;
12271
- var commit = ref.commit;
12272
- this.dispatch = function boundDispatch (type, payload) {
12273
- return dispatch.call(store, type, payload)
12274
- };
12275
- this.commit = function boundCommit (type, payload, options) {
12276
- return commit.call(store, type, payload, options)
12277
- };
12278
-
12279
- // strict mode
12280
- this.strict = strict;
12281
-
12282
- var state = this._modules.root.state;
12283
-
12284
- // init root module.
12285
- // this also recursively registers all sub-modules
12286
- // and collects all module getters inside this._wrappedGetters
12287
- installModule(this, state, [], this._modules.root);
12288
-
12289
- // initialize the store vm, which is responsible for the reactivity
12290
- // (also registers _wrappedGetters as computed properties)
12291
- resetStoreVM(this, state);
12292
-
12293
- // apply plugins
12294
- plugins.forEach(function (plugin) { return plugin(this$1); });
12295
-
12296
- var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
12297
- if (useDevtools) {
12298
- devtoolPlugin(this);
12299
- }
12300
- };
12301
-
12302
- var prototypeAccessors$1 = { state: { configurable: true } };
12303
-
12304
- prototypeAccessors$1.state.get = function () {
12305
- return this._vm._data.$$state
12306
- };
12307
-
12308
- prototypeAccessors$1.state.set = function (v) {
12309
- {
12310
- assert(false, "use store.replaceState() to explicit replace store state.");
12311
- }
12312
- };
12313
-
12314
- Store.prototype.commit = function commit (_type, _payload, _options) {
12315
- var this$1 = this;
12316
-
12317
- // check object-style commit
12318
- var ref = unifyObjectStyle(_type, _payload, _options);
12319
- var type = ref.type;
12320
- var payload = ref.payload;
12321
- var options = ref.options;
12322
-
12323
- var mutation = { type: type, payload: payload };
12324
- var entry = this._mutations[type];
12325
- if (!entry) {
12326
- {
12327
- console.error(("[vuex] unknown mutation type: " + type));
12328
- }
12329
- return
12330
- }
12331
- this._withCommit(function () {
12332
- entry.forEach(function commitIterator (handler) {
12333
- handler(payload);
12334
- });
12335
- });
12336
- this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
12337
-
12338
- if (
12339
- options && options.silent
12340
- ) {
12341
- console.warn(
12342
- "[vuex] mutation type: " + type + ". Silent option has been removed. " +
12343
- 'Use the filter functionality in the vue-devtools'
12344
- );
12345
- }
12346
- };
12347
-
12348
- Store.prototype.dispatch = function dispatch (_type, _payload) {
12349
- var this$1 = this;
12350
-
12351
- // check object-style dispatch
12352
- var ref = unifyObjectStyle(_type, _payload);
12353
- var type = ref.type;
12354
- var payload = ref.payload;
12355
-
12356
- var action = { type: type, payload: payload };
12357
- var entry = this._actions[type];
12358
- if (!entry) {
12359
- {
12360
- console.error(("[vuex] unknown action type: " + type));
12361
- }
12362
- return
12363
- }
12364
-
12365
- try {
12366
- this._actionSubscribers
12367
- .filter(function (sub) { return sub.before; })
12368
- .forEach(function (sub) { return sub.before(action, this$1.state); });
12369
- } catch (e) {
12370
- {
12371
- console.warn("[vuex] error in before action subscribers: ");
12372
- console.error(e);
12373
- }
12374
- }
12375
-
12376
- var result = entry.length > 1
12377
- ? Promise.all(entry.map(function (handler) { return handler(payload); }))
12378
- : entry[0](payload);
12379
-
12380
- return result.then(function (res) {
12381
- try {
12382
- this$1._actionSubscribers
12383
- .filter(function (sub) { return sub.after; })
12384
- .forEach(function (sub) { return sub.after(action, this$1.state); });
12385
- } catch (e) {
12386
- {
12387
- console.warn("[vuex] error in after action subscribers: ");
12388
- console.error(e);
12389
- }
12390
- }
12391
- return res
12392
- })
12393
- };
12394
-
12395
- Store.prototype.subscribe = function subscribe (fn) {
12396
- return genericSubscribe(fn, this._subscribers)
12397
- };
12398
-
12399
- Store.prototype.subscribeAction = function subscribeAction (fn) {
12400
- var subs = typeof fn === 'function' ? { before: fn } : fn;
12401
- return genericSubscribe(subs, this._actionSubscribers)
12402
- };
12403
-
12404
- Store.prototype.watch = function watch (getter, cb, options) {
12405
- var this$1 = this;
12406
-
12407
- {
12408
- assert(typeof getter === 'function', "store.watch only accepts a function.");
12409
- }
12410
- return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
12411
- };
12412
-
12413
- Store.prototype.replaceState = function replaceState (state) {
12414
- var this$1 = this;
12415
-
12416
- this._withCommit(function () {
12417
- this$1._vm._data.$$state = state;
12418
- });
12419
- };
12420
-
12421
- Store.prototype.registerModule = function registerModule (path, rawModule, options) {
12422
- if ( options === void 0 ) options = {};
12423
-
12424
- if (typeof path === 'string') { path = [path]; }
12425
-
12426
- {
12427
- assert(Array.isArray(path), "module path must be a string or an Array.");
12428
- assert(path.length > 0, 'cannot register the root module by using registerModule.');
12429
- }
12430
-
12431
- this._modules.register(path, rawModule);
12432
- installModule(this, this.state, path, this._modules.get(path), options.preserveState);
12433
- // reset store to update getters...
12434
- resetStoreVM(this, this.state);
12435
- };
12436
-
12437
- Store.prototype.unregisterModule = function unregisterModule (path) {
12438
- var this$1 = this;
12439
-
12440
- if (typeof path === 'string') { path = [path]; }
12441
-
12442
- {
12443
- assert(Array.isArray(path), "module path must be a string or an Array.");
12444
- }
12445
-
12446
- this._modules.unregister(path);
12447
- this._withCommit(function () {
12448
- var parentState = getNestedState(this$1.state, path.slice(0, -1));
12449
- Vue.delete(parentState, path[path.length - 1]);
12450
- });
12451
- resetStore(this);
12452
- };
12453
-
12454
- Store.prototype.hotUpdate = function hotUpdate (newOptions) {
12455
- this._modules.update(newOptions);
12456
- resetStore(this, true);
12457
- };
12458
-
12459
- Store.prototype._withCommit = function _withCommit (fn) {
12460
- var committing = this._committing;
12461
- this._committing = true;
12462
- fn();
12463
- this._committing = committing;
12464
- };
12465
-
12466
- Object.defineProperties( Store.prototype, prototypeAccessors$1 );
12467
-
12468
- function genericSubscribe (fn, subs) {
12469
- if (subs.indexOf(fn) < 0) {
12470
- subs.push(fn);
12471
- }
12472
- return function () {
12473
- var i = subs.indexOf(fn);
12474
- if (i > -1) {
12475
- subs.splice(i, 1);
12476
- }
12477
- }
12478
- }
12479
-
12480
- function resetStore (store, hot) {
12481
- store._actions = Object.create(null);
12482
- store._mutations = Object.create(null);
12483
- store._wrappedGetters = Object.create(null);
12484
- store._modulesNamespaceMap = Object.create(null);
12485
- var state = store.state;
12486
- // init all modules
12487
- installModule(store, state, [], store._modules.root, true);
12488
- // reset vm
12489
- resetStoreVM(store, state, hot);
12490
- }
12491
-
12492
- function resetStoreVM (store, state, hot) {
12493
- var oldVm = store._vm;
12494
-
12495
- // bind store public getters
12496
- store.getters = {};
12497
- var wrappedGetters = store._wrappedGetters;
12498
- var computed = {};
12499
- forEachValue(wrappedGetters, function (fn, key) {
12500
- // use computed to leverage its lazy-caching mechanism
12501
- computed[key] = function () { return fn(store); };
12502
- Object.defineProperty(store.getters, key, {
12503
- get: function () { return store._vm[key]; },
12504
- enumerable: true // for local getters
12505
- });
12506
- });
12507
-
12508
- // use a Vue instance to store the state tree
12509
- // suppress warnings just in case the user has added
12510
- // some funky global mixins
12511
- var silent = Vue.config.silent;
12512
- Vue.config.silent = true;
12513
- store._vm = new Vue({
12514
- data: {
12515
- $$state: state
12516
- },
12517
- computed: computed
12518
- });
12519
- Vue.config.silent = silent;
12520
-
12521
- // enable strict mode for new vm
12522
- if (store.strict) {
12523
- enableStrictMode(store);
12524
- }
12525
-
12526
- if (oldVm) {
12527
- if (hot) {
12528
- // dispatch changes in all subscribed watchers
12529
- // to force getter re-evaluation for hot reloading.
12530
- store._withCommit(function () {
12531
- oldVm._data.$$state = null;
12532
- });
12533
- }
12534
- Vue.nextTick(function () { return oldVm.$destroy(); });
12535
- }
12536
- }
12537
-
12538
- function installModule (store, rootState, path, module, hot) {
12539
- var isRoot = !path.length;
12540
- var namespace = store._modules.getNamespace(path);
12541
-
12542
- // register in namespace map
12543
- if (module.namespaced) {
12544
- store._modulesNamespaceMap[namespace] = module;
12545
- }
12546
-
12547
- // set state
12548
- if (!isRoot && !hot) {
12549
- var parentState = getNestedState(rootState, path.slice(0, -1));
12550
- var moduleName = path[path.length - 1];
12551
- store._withCommit(function () {
12552
- Vue.set(parentState, moduleName, module.state);
12553
- });
12554
- }
12555
-
12556
- var local = module.context = makeLocalContext(store, namespace, path);
12557
-
12558
- module.forEachMutation(function (mutation, key) {
12559
- var namespacedType = namespace + key;
12560
- registerMutation(store, namespacedType, mutation, local);
12561
- });
12562
-
12563
- module.forEachAction(function (action, key) {
12564
- var type = action.root ? key : namespace + key;
12565
- var handler = action.handler || action;
12566
- registerAction(store, type, handler, local);
12567
- });
12568
-
12569
- module.forEachGetter(function (getter, key) {
12570
- var namespacedType = namespace + key;
12571
- registerGetter(store, namespacedType, getter, local);
12572
- });
12573
-
12574
- module.forEachChild(function (child, key) {
12575
- installModule(store, rootState, path.concat(key), child, hot);
12576
- });
12577
- }
12578
-
12579
- /**
12580
- * make localized dispatch, commit, getters and state
12581
- * if there is no namespace, just use root ones
12582
- */
12583
- function makeLocalContext (store, namespace, path) {
12584
- var noNamespace = namespace === '';
12585
-
12586
- var local = {
12587
- dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
12588
- var args = unifyObjectStyle(_type, _payload, _options);
12589
- var payload = args.payload;
12590
- var options = args.options;
12591
- var type = args.type;
12592
-
12593
- if (!options || !options.root) {
12594
- type = namespace + type;
12595
- if (!store._actions[type]) {
12596
- console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
12597
- return
12598
- }
12599
- }
12600
-
12601
- return store.dispatch(type, payload)
12602
- },
12603
-
12604
- commit: noNamespace ? store.commit : function (_type, _payload, _options) {
12605
- var args = unifyObjectStyle(_type, _payload, _options);
12606
- var payload = args.payload;
12607
- var options = args.options;
12608
- var type = args.type;
12609
-
12610
- if (!options || !options.root) {
12611
- type = namespace + type;
12612
- if (!store._mutations[type]) {
12613
- console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
12614
- return
12615
- }
12616
- }
12617
-
12618
- store.commit(type, payload, options);
12619
- }
12620
- };
12621
-
12622
- // getters and state object must be gotten lazily
12623
- // because they will be changed by vm update
12624
- Object.defineProperties(local, {
12625
- getters: {
12626
- get: noNamespace
12627
- ? function () { return store.getters; }
12628
- : function () { return makeLocalGetters(store, namespace); }
12629
- },
12630
- state: {
12631
- get: function () { return getNestedState(store.state, path); }
12632
- }
12633
- });
12634
-
12635
- return local
12636
- }
12637
-
12638
- function makeLocalGetters (store, namespace) {
12639
- var gettersProxy = {};
12640
-
12641
- var splitPos = namespace.length;
12642
- Object.keys(store.getters).forEach(function (type) {
12643
- // skip if the target getter is not match this namespace
12644
- if (type.slice(0, splitPos) !== namespace) { return }
12645
-
12646
- // extract local getter type
12647
- var localType = type.slice(splitPos);
12648
-
12649
- // Add a port to the getters proxy.
12650
- // Define as getter property because
12651
- // we do not want to evaluate the getters in this time.
12652
- Object.defineProperty(gettersProxy, localType, {
12653
- get: function () { return store.getters[type]; },
12654
- enumerable: true
12655
- });
12656
- });
12657
-
12658
- return gettersProxy
12659
- }
12660
-
12661
- function registerMutation (store, type, handler, local) {
12662
- var entry = store._mutations[type] || (store._mutations[type] = []);
12663
- entry.push(function wrappedMutationHandler (payload) {
12664
- handler.call(store, local.state, payload);
12665
- });
12666
- }
12667
-
12668
- function registerAction (store, type, handler, local) {
12669
- var entry = store._actions[type] || (store._actions[type] = []);
12670
- entry.push(function wrappedActionHandler (payload, cb) {
12671
- var res = handler.call(store, {
12672
- dispatch: local.dispatch,
12673
- commit: local.commit,
12674
- getters: local.getters,
12675
- state: local.state,
12676
- rootGetters: store.getters,
12677
- rootState: store.state
12678
- }, payload, cb);
12679
- if (!isPromise(res)) {
12680
- res = Promise.resolve(res);
12681
- }
12682
- if (store._devtoolHook) {
12683
- return res.catch(function (err) {
12684
- store._devtoolHook.emit('vuex:error', err);
12685
- throw err
12686
- })
12687
- } else {
12688
- return res
12689
- }
12690
- });
12691
- }
12692
-
12693
- function registerGetter (store, type, rawGetter, local) {
12694
- if (store._wrappedGetters[type]) {
12695
- {
12696
- console.error(("[vuex] duplicate getter key: " + type));
12697
- }
12698
- return
12699
- }
12700
- store._wrappedGetters[type] = function wrappedGetter (store) {
12701
- return rawGetter(
12702
- local.state, // local state
12703
- local.getters, // local getters
12704
- store.state, // root state
12705
- store.getters // root getters
12706
- )
12707
- };
12708
- }
12709
-
12710
- function enableStrictMode (store) {
12711
- store._vm.$watch(function () { return this._data.$$state }, function () {
12712
- {
12713
- assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
12714
- }
12715
- }, { deep: true, sync: true });
12716
- }
12717
-
12718
- function getNestedState (state, path) {
12719
- return path.length
12720
- ? path.reduce(function (state, key) { return state[key]; }, state)
12721
- : state
12722
- }
12723
-
12724
- function unifyObjectStyle (type, payload, options) {
12725
- if (isObject(type) && type.type) {
12726
- options = payload;
12727
- payload = type;
12728
- type = type.type;
12729
- }
12730
-
12731
- {
12732
- assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
12733
- }
12734
-
12735
- return { type: type, payload: payload, options: options }
12736
- }
12737
-
12738
- function install (_Vue) {
12739
- if (Vue && _Vue === Vue) {
12740
- {
12741
- console.error(
12742
- '[vuex] already installed. Vue.use(Vuex) should be called only once.'
12743
- );
12744
- }
12745
- return
12746
- }
12747
- Vue = _Vue;
12748
- applyMixin(Vue);
12749
- }
12750
-
12751
- /**
12752
- * Reduce the code which written in Vue.js for getting the state.
12753
- * @param {String} [namespace] - Module's namespace
12754
- * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
12755
- * @param {Object}
12756
- */
12757
- var mapState = normalizeNamespace(function (namespace, states) {
12758
- var res = {};
12759
- normalizeMap(states).forEach(function (ref) {
12760
- var key = ref.key;
12761
- var val = ref.val;
12762
-
12763
- res[key] = function mappedState () {
12764
- var state = this.$store.state;
12765
- var getters = this.$store.getters;
12766
- if (namespace) {
12767
- var module = getModuleByNamespace(this.$store, 'mapState', namespace);
12768
- if (!module) {
12769
- return
12770
- }
12771
- state = module.context.state;
12772
- getters = module.context.getters;
12773
- }
12774
- return typeof val === 'function'
12775
- ? val.call(this, state, getters)
12776
- : state[val]
12777
- };
12778
- // mark vuex getter for devtools
12779
- res[key].vuex = true;
12780
- });
12781
- return res
12782
- });
12783
-
12784
- /**
12785
- * Reduce the code which written in Vue.js for committing the mutation
12786
- * @param {String} [namespace] - Module's namespace
12787
- * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept anthor params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
12788
- * @return {Object}
12789
- */
12790
- var mapMutations = normalizeNamespace(function (namespace, mutations) {
12791
- var res = {};
12792
- normalizeMap(mutations).forEach(function (ref) {
12793
- var key = ref.key;
12794
- var val = ref.val;
12795
-
12796
- res[key] = function mappedMutation () {
12797
- var args = [], len = arguments.length;
12798
- while ( len-- ) args[ len ] = arguments[ len ];
12799
-
12800
- // Get the commit method from store
12801
- var commit = this.$store.commit;
12802
- if (namespace) {
12803
- var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
12804
- if (!module) {
12805
- return
12806
- }
12807
- commit = module.context.commit;
12808
- }
12809
- return typeof val === 'function'
12810
- ? val.apply(this, [commit].concat(args))
12811
- : commit.apply(this.$store, [val].concat(args))
12812
- };
12813
- });
12814
- return res
12815
- });
12816
-
12817
- /**
12818
- * Reduce the code which written in Vue.js for getting the getters
12819
- * @param {String} [namespace] - Module's namespace
12820
- * @param {Object|Array} getters
12821
- * @return {Object}
12822
- */
12823
- var mapGetters = normalizeNamespace(function (namespace, getters) {
12824
- var res = {};
12825
- normalizeMap(getters).forEach(function (ref) {
12826
- var key = ref.key;
12827
- var val = ref.val;
12828
-
12829
- // The namespace has been mutated by normalizeNamespace
12830
- val = namespace + val;
12831
- res[key] = function mappedGetter () {
12832
- if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
12833
- return
12834
- }
12835
- if (!(val in this.$store.getters)) {
12836
- console.error(("[vuex] unknown getter: " + val));
12837
- return
12838
- }
12839
- return this.$store.getters[val]
12840
- };
12841
- // mark vuex getter for devtools
12842
- res[key].vuex = true;
12843
- });
12844
- return res
12845
- });
12846
-
12847
- /**
12848
- * Reduce the code which written in Vue.js for dispatch the action
12849
- * @param {String} [namespace] - Module's namespace
12850
- * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
12851
- * @return {Object}
12852
- */
12853
- var mapActions = normalizeNamespace(function (namespace, actions) {
12854
- var res = {};
12855
- normalizeMap(actions).forEach(function (ref) {
12856
- var key = ref.key;
12857
- var val = ref.val;
12858
-
12859
- res[key] = function mappedAction () {
12860
- var args = [], len = arguments.length;
12861
- while ( len-- ) args[ len ] = arguments[ len ];
12862
-
12863
- // get dispatch function from store
12864
- var dispatch = this.$store.dispatch;
12865
- if (namespace) {
12866
- var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
12867
- if (!module) {
12868
- return
12869
- }
12870
- dispatch = module.context.dispatch;
12871
- }
12872
- return typeof val === 'function'
12873
- ? val.apply(this, [dispatch].concat(args))
12874
- : dispatch.apply(this.$store, [val].concat(args))
12875
- };
12876
- });
12877
- return res
12878
- });
12879
-
12880
- /**
12881
- * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
12882
- * @param {String} namespace
12883
- * @return {Object}
12884
- */
12885
- var createNamespacedHelpers = function (namespace) { return ({
12886
- mapState: mapState.bind(null, namespace),
12887
- mapGetters: mapGetters.bind(null, namespace),
12888
- mapMutations: mapMutations.bind(null, namespace),
12889
- mapActions: mapActions.bind(null, namespace)
12890
- }); };
12891
-
12892
- /**
12893
- * Normalize the map
12894
- * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
12895
- * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
12896
- * @param {Array|Object} map
12897
- * @return {Object}
12898
- */
12899
- function normalizeMap (map) {
12900
- return Array.isArray(map)
12901
- ? map.map(function (key) { return ({ key: key, val: key }); })
12902
- : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
12903
- }
12904
-
12905
- /**
12906
- * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
12907
- * @param {Function} fn
12908
- * @return {Function}
12909
- */
12910
- function normalizeNamespace (fn) {
12911
- return function (namespace, map) {
12912
- if (typeof namespace !== 'string') {
12913
- map = namespace;
12914
- namespace = '';
12915
- } else if (namespace.charAt(namespace.length - 1) !== '/') {
12916
- namespace += '/';
12917
- }
12918
- return fn(namespace, map)
12919
- }
12920
- }
12921
-
12922
- /**
12923
- * Search a special module from store by namespace. if module not exist, print error message.
12924
- * @param {Object} store
12925
- * @param {String} helper
12926
- * @param {String} namespace
12927
- * @return {Object}
12928
- */
12929
- function getModuleByNamespace (store, helper, namespace) {
12930
- var module = store._modulesNamespaceMap[namespace];
12931
- if (!module) {
12932
- console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
12933
- }
12934
- return module
12935
- }
12936
-
12937
- var index = {
12938
- Store: Store,
12939
- install: install,
12940
- version: '3.1.0',
12941
- mapState: mapState,
12942
- mapMutations: mapMutations,
12943
- mapGetters: mapGetters,
12944
- mapActions: mapActions,
12945
- createNamespacedHelpers: createNamespacedHelpers
12946
- };
12947
-
12948
- return index;
12949
-
12950
- }));
12951
- /*!
12952
- * vue-resource v1.3.4
12953
- * https://github.com/pagekit/vue-resource
12954
- * Released under the MIT License.
12955
- */
12956
-
12957
- (function (global, factory) {
12958
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
12959
- typeof define === 'function' && define.amd ? define(factory) :
12960
- (global.VueResource = factory());
12961
- }(this, (function () { 'use strict';
12962
-
12963
- /**
12964
- * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
12965
- */
12966
-
12967
- var RESOLVED = 0;
12968
- var REJECTED = 1;
12969
- var PENDING = 2;
12970
-
12971
- function Promise$1(executor) {
12972
-
12973
- this.state = PENDING;
12974
- this.value = undefined;
12975
- this.deferred = [];
12976
-
12977
- var promise = this;
12978
-
12979
- try {
12980
- executor(function (x) {
12981
- promise.resolve(x);
12982
- }, function (r) {
12983
- promise.reject(r);
12984
- });
12985
- } catch (e) {
12986
- promise.reject(e);
12987
- }
12988
- }
12989
-
12990
- Promise$1.reject = function (r) {
12991
- return new Promise$1(function (resolve, reject) {
12992
- reject(r);
12993
- });
12994
- };
12995
-
12996
- Promise$1.resolve = function (x) {
12997
- return new Promise$1(function (resolve, reject) {
12998
- resolve(x);
12999
- });
13000
- };
13001
-
13002
- Promise$1.all = function all(iterable) {
13003
- return new Promise$1(function (resolve, reject) {
13004
- var count = 0, result = [];
13005
-
13006
- if (iterable.length === 0) {
13007
- resolve(result);
13008
- }
13009
-
13010
- function resolver(i) {
13011
- return function (x) {
13012
- result[i] = x;
13013
- count += 1;
13014
-
13015
- if (count === iterable.length) {
13016
- resolve(result);
13017
- }
13018
- };
13019
- }
13020
-
13021
- for (var i = 0; i < iterable.length; i += 1) {
13022
- Promise$1.resolve(iterable[i]).then(resolver(i), reject);
13023
- }
13024
- });
13025
- };
13026
-
13027
- Promise$1.race = function race(iterable) {
13028
- return new Promise$1(function (resolve, reject) {
13029
- for (var i = 0; i < iterable.length; i += 1) {
13030
- Promise$1.resolve(iterable[i]).then(resolve, reject);
13031
- }
13032
- });
13033
- };
13034
-
13035
- var p$1 = Promise$1.prototype;
13036
-
13037
- p$1.resolve = function resolve(x) {
13038
- var promise = this;
13039
-
13040
- if (promise.state === PENDING) {
13041
- if (x === promise) {
13042
- throw new TypeError('Promise settled with itself.');
13043
- }
13044
-
13045
- var called = false;
13046
-
13047
- try {
13048
- var then = x && x['then'];
13049
-
13050
- if (x !== null && typeof x === 'object' && typeof then === 'function') {
13051
- then.call(x, function (x) {
13052
- if (!called) {
13053
- promise.resolve(x);
13054
- }
13055
- called = true;
13056
-
13057
- }, function (r) {
13058
- if (!called) {
13059
- promise.reject(r);
13060
- }
13061
- called = true;
13062
- });
13063
- return;
13064
- }
13065
- } catch (e) {
13066
- if (!called) {
13067
- promise.reject(e);
13068
- }
13069
- return;
13070
- }
13071
-
13072
- promise.state = RESOLVED;
13073
- promise.value = x;
13074
- promise.notify();
13075
- }
13076
- };
13077
-
13078
- p$1.reject = function reject(reason) {
13079
- var promise = this;
13080
-
13081
- if (promise.state === PENDING) {
13082
- if (reason === promise) {
13083
- throw new TypeError('Promise settled with itself.');
13084
- }
13085
-
13086
- promise.state = REJECTED;
13087
- promise.value = reason;
13088
- promise.notify();
13089
- }
13090
- };
13091
-
13092
- p$1.notify = function notify() {
13093
- var promise = this;
13094
-
13095
- nextTick(function () {
13096
- if (promise.state !== PENDING) {
13097
- while (promise.deferred.length) {
13098
- var deferred = promise.deferred.shift(),
13099
- onResolved = deferred[0],
13100
- onRejected = deferred[1],
13101
- resolve = deferred[2],
13102
- reject = deferred[3];
13103
-
13104
- try {
13105
- if (promise.state === RESOLVED) {
13106
- if (typeof onResolved === 'function') {
13107
- resolve(onResolved.call(undefined, promise.value));
13108
- } else {
13109
- resolve(promise.value);
13110
- }
13111
- } else if (promise.state === REJECTED) {
13112
- if (typeof onRejected === 'function') {
13113
- resolve(onRejected.call(undefined, promise.value));
13114
- } else {
13115
- reject(promise.value);
13116
- }
13117
- }
13118
- } catch (e) {
13119
- reject(e);
13120
- }
13121
- }
13122
- }
13123
- });
13124
- };
13125
-
13126
- p$1.then = function then(onResolved, onRejected) {
13127
- var promise = this;
13128
-
13129
- return new Promise$1(function (resolve, reject) {
13130
- promise.deferred.push([onResolved, onRejected, resolve, reject]);
13131
- promise.notify();
13132
- });
13133
- };
13134
-
13135
- p$1.catch = function (onRejected) {
13136
- return this.then(undefined, onRejected);
13137
- };
13138
-
13139
- /**
13140
- * Promise adapter.
13141
- */
13142
-
13143
- if (typeof Promise === 'undefined') {
13144
- window.Promise = Promise$1;
13145
- }
13146
-
13147
- function PromiseObj(executor, context) {
13148
-
13149
- if (executor instanceof Promise) {
13150
- this.promise = executor;
13151
- } else {
13152
- this.promise = new Promise(executor.bind(context));
13153
- }
13154
-
13155
- this.context = context;
13156
- }
13157
-
13158
- PromiseObj.all = function (iterable, context) {
13159
- return new PromiseObj(Promise.all(iterable), context);
13160
- };
13161
-
13162
- PromiseObj.resolve = function (value, context) {
13163
- return new PromiseObj(Promise.resolve(value), context);
13164
- };
13165
-
13166
- PromiseObj.reject = function (reason, context) {
13167
- return new PromiseObj(Promise.reject(reason), context);
13168
- };
13169
-
13170
- PromiseObj.race = function (iterable, context) {
13171
- return new PromiseObj(Promise.race(iterable), context);
13172
- };
13173
-
13174
- var p = PromiseObj.prototype;
13175
-
13176
- p.bind = function (context) {
13177
- this.context = context;
13178
- return this;
13179
- };
13180
-
13181
- p.then = function (fulfilled, rejected) {
13182
-
13183
- if (fulfilled && fulfilled.bind && this.context) {
13184
- fulfilled = fulfilled.bind(this.context);
13185
- }
13186
-
13187
- if (rejected && rejected.bind && this.context) {
13188
- rejected = rejected.bind(this.context);
13189
- }
13190
-
13191
- return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
13192
- };
13193
-
13194
- p.catch = function (rejected) {
13195
-
13196
- if (rejected && rejected.bind && this.context) {
13197
- rejected = rejected.bind(this.context);
13198
- }
13199
-
13200
- return new PromiseObj(this.promise.catch(rejected), this.context);
13201
- };
13202
-
13203
- p.finally = function (callback) {
13204
-
13205
- return this.then(function (value) {
13206
- callback.call(this);
13207
- return value;
13208
- }, function (reason) {
13209
- callback.call(this);
13210
- return Promise.reject(reason);
13211
- }
13212
- );
13213
- };
13214
-
13215
- /**
13216
- * Utility functions.
13217
- */
13218
-
13219
- var ref = {};
13220
- var hasOwnProperty = ref.hasOwnProperty;
13221
-
13222
- var ref$1 = [];
13223
- var slice = ref$1.slice;
13224
- var debug = false;
13225
- var ntick;
13226
-
13227
- var inBrowser = typeof window !== 'undefined';
13228
-
13229
- var Util = function (ref) {
13230
- var config = ref.config;
13231
- var nextTick = ref.nextTick;
13232
-
13233
- ntick = nextTick;
13234
- debug = config.debug || !config.silent;
13235
- };
13236
-
13237
- function warn(msg) {
13238
- if (typeof console !== 'undefined' && debug) {
13239
- console.warn('[VueResource warn]: ' + msg);
13240
- }
13241
- }
13242
-
13243
- function error(msg) {
13244
- if (typeof console !== 'undefined') {
13245
- console.error(msg);
13246
- }
13247
- }
13248
-
13249
- function nextTick(cb, ctx) {
13250
- return ntick(cb, ctx);
13251
- }
13252
-
13253
- function trim(str) {
13254
- return str ? str.replace(/^\s*|\s*$/g, '') : '';
13255
- }
13256
-
13257
- function trimEnd(str, chars) {
13258
-
13259
- if (str && chars === undefined) {
13260
- return str.replace(/\s+$/, '');
13261
- }
13262
-
13263
- if (!str || !chars) {
13264
- return str;
13265
- }
13266
-
13267
- return str.replace(new RegExp(("[" + chars + "]+$")), '');
13268
- }
13269
-
13270
- function toLower(str) {
13271
- return str ? str.toLowerCase() : '';
13272
- }
13273
-
13274
- function toUpper(str) {
13275
- return str ? str.toUpperCase() : '';
13276
- }
13277
-
13278
- var isArray = Array.isArray;
13279
-
13280
- function isString(val) {
13281
- return typeof val === 'string';
13282
- }
13283
-
13284
-
13285
-
13286
- function isFunction(val) {
13287
- return typeof val === 'function';
13288
- }
13289
-
13290
- function isObject(obj) {
13291
- return obj !== null && typeof obj === 'object';
13292
- }
13293
-
13294
- function isPlainObject(obj) {
13295
- return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
13296
- }
13297
-
13298
- function isBlob(obj) {
13299
- return typeof Blob !== 'undefined' && obj instanceof Blob;
13300
- }
13301
-
13302
- function isFormData(obj) {
13303
- return typeof FormData !== 'undefined' && obj instanceof FormData;
13304
- }
13305
-
13306
- function when(value, fulfilled, rejected) {
13307
-
13308
- var promise = PromiseObj.resolve(value);
13309
-
13310
- if (arguments.length < 2) {
13311
- return promise;
13312
- }
13313
-
13314
- return promise.then(fulfilled, rejected);
13315
- }
13316
-
13317
- function options(fn, obj, opts) {
13318
-
13319
- opts = opts || {};
13320
-
13321
- if (isFunction(opts)) {
13322
- opts = opts.call(obj);
13323
- }
13324
-
13325
- return merge(fn.bind({$vm: obj, $options: opts}), fn, {$options: opts});
13326
- }
13327
-
13328
- function each(obj, iterator) {
13329
-
13330
- var i, key;
13331
-
13332
- if (isArray(obj)) {
13333
- for (i = 0; i < obj.length; i++) {
13334
- iterator.call(obj[i], obj[i], i);
13335
- }
13336
- } else if (isObject(obj)) {
13337
- for (key in obj) {
13338
- if (hasOwnProperty.call(obj, key)) {
13339
- iterator.call(obj[key], obj[key], key);
13340
- }
13341
- }
13342
- }
13343
-
13344
- return obj;
13345
- }
13346
-
13347
- var assign = Object.assign || _assign;
13348
-
13349
- function merge(target) {
13350
-
13351
- var args = slice.call(arguments, 1);
13352
-
13353
- args.forEach(function (source) {
13354
- _merge(target, source, true);
13355
- });
13356
-
13357
- return target;
13358
- }
13359
-
13360
- function defaults(target) {
13361
-
13362
- var args = slice.call(arguments, 1);
13363
-
13364
- args.forEach(function (source) {
13365
-
13366
- for (var key in source) {
13367
- if (target[key] === undefined) {
13368
- target[key] = source[key];
13369
- }
13370
- }
13371
-
13372
- });
13373
-
13374
- return target;
13375
- }
13376
-
13377
- function _assign(target) {
13378
-
13379
- var args = slice.call(arguments, 1);
13380
-
13381
- args.forEach(function (source) {
13382
- _merge(target, source);
13383
- });
13384
-
13385
- return target;
13386
- }
13387
-
13388
- function _merge(target, source, deep) {
13389
- for (var key in source) {
13390
- if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
13391
- if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
13392
- target[key] = {};
13393
- }
13394
- if (isArray(source[key]) && !isArray(target[key])) {
13395
- target[key] = [];
13396
- }
13397
- _merge(target[key], source[key], deep);
13398
- } else if (source[key] !== undefined) {
13399
- target[key] = source[key];
13400
- }
13401
- }
13402
- }
13403
-
13404
- /**
13405
- * Root Prefix Transform.
13406
- */
13407
-
13408
- var root = function (options$$1, next) {
13409
-
13410
- var url = next(options$$1);
13411
-
13412
- if (isString(options$$1.root) && !/^(https?:)?\//.test(url)) {
13413
- url = trimEnd(options$$1.root, '/') + '/' + url;
13414
- }
13415
-
13416
- return url;
13417
- };
13418
-
13419
- /**
13420
- * Query Parameter Transform.
13421
- */
13422
-
13423
- var query = function (options$$1, next) {
13424
-
13425
- var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
13426
-
13427
- each(options$$1.params, function (value, key) {
13428
- if (urlParams.indexOf(key) === -1) {
13429
- query[key] = value;
13430
- }
13431
- });
13432
-
13433
- query = Url.params(query);
13434
-
13435
- if (query) {
13436
- url += (url.indexOf('?') == -1 ? '?' : '&') + query;
13437
- }
13438
-
13439
- return url;
13440
- };
13441
-
13442
- /**
13443
- * URL Template v2.0.6 (https://github.com/bramstein/url-template)
13444
- */
13445
-
13446
- function expand(url, params, variables) {
13447
-
13448
- var tmpl = parse(url), expanded = tmpl.expand(params);
13449
-
13450
- if (variables) {
13451
- variables.push.apply(variables, tmpl.vars);
13452
- }
13453
-
13454
- return expanded;
13455
- }
13456
-
13457
- function parse(template) {
13458
-
13459
- var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
13460
-
13461
- return {
13462
- vars: variables,
13463
- expand: function expand(context) {
13464
- return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
13465
- if (expression) {
13466
-
13467
- var operator = null, values = [];
13468
-
13469
- if (operators.indexOf(expression.charAt(0)) !== -1) {
13470
- operator = expression.charAt(0);
13471
- expression = expression.substr(1);
13472
- }
13473
-
13474
- expression.split(/,/g).forEach(function (variable) {
13475
- var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
13476
- values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
13477
- variables.push(tmp[1]);
13478
- });
13479
-
13480
- if (operator && operator !== '+') {
13481
-
13482
- var separator = ',';
13483
-
13484
- if (operator === '?') {
13485
- separator = '&';
13486
- } else if (operator !== '#') {
13487
- separator = operator;
13488
- }
13489
-
13490
- return (values.length !== 0 ? operator : '') + values.join(separator);
13491
- } else {
13492
- return values.join(',');
13493
- }
13494
-
13495
- } else {
13496
- return encodeReserved(literal);
13497
- }
13498
- });
13499
- }
13500
- };
13501
- }
13502
-
13503
- function getValues(context, operator, key, modifier) {
13504
-
13505
- var value = context[key], result = [];
13506
-
13507
- if (isDefined(value) && value !== '') {
13508
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13509
- value = value.toString();
13510
-
13511
- if (modifier && modifier !== '*') {
13512
- value = value.substring(0, parseInt(modifier, 10));
13513
- }
13514
-
13515
- result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
13516
- } else {
13517
- if (modifier === '*') {
13518
- if (Array.isArray(value)) {
13519
- value.filter(isDefined).forEach(function (value) {
13520
- result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
13521
- });
13522
- } else {
13523
- Object.keys(value).forEach(function (k) {
13524
- if (isDefined(value[k])) {
13525
- result.push(encodeValue(operator, value[k], k));
13526
- }
13527
- });
13528
- }
13529
- } else {
13530
- var tmp = [];
13531
-
13532
- if (Array.isArray(value)) {
13533
- value.filter(isDefined).forEach(function (value) {
13534
- tmp.push(encodeValue(operator, value));
13535
- });
13536
- } else {
13537
- Object.keys(value).forEach(function (k) {
13538
- if (isDefined(value[k])) {
13539
- tmp.push(encodeURIComponent(k));
13540
- tmp.push(encodeValue(operator, value[k].toString()));
13541
- }
13542
- });
13543
- }
13544
-
13545
- if (isKeyOperator(operator)) {
13546
- result.push(encodeURIComponent(key) + '=' + tmp.join(','));
13547
- } else if (tmp.length !== 0) {
13548
- result.push(tmp.join(','));
13549
- }
13550
- }
13551
- }
13552
- } else {
13553
- if (operator === ';') {
13554
- result.push(encodeURIComponent(key));
13555
- } else if (value === '' && (operator === '&' || operator === '?')) {
13556
- result.push(encodeURIComponent(key) + '=');
13557
- } else if (value === '') {
13558
- result.push('');
13559
- }
13560
- }
13561
-
13562
- return result;
13563
- }
13564
-
13565
- function isDefined(value) {
13566
- return value !== undefined && value !== null;
13567
- }
13568
-
13569
- function isKeyOperator(operator) {
13570
- return operator === ';' || operator === '&' || operator === '?';
13571
- }
13572
-
13573
- function encodeValue(operator, value, key) {
13574
-
13575
- value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeURIComponent(value);
13576
-
13577
- if (key) {
13578
- return encodeURIComponent(key) + '=' + value;
13579
- } else {
13580
- return value;
13581
- }
13582
- }
13583
-
13584
- function encodeReserved(str) {
13585
- return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
13586
- if (!/%[0-9A-Fa-f]/.test(part)) {
13587
- part = encodeURI(part);
13588
- }
13589
- return part;
13590
- }).join('');
13591
- }
13592
-
13593
- /**
13594
- * URL Template (RFC 6570) Transform.
13595
- */
13596
-
13597
- var template = function (options) {
13598
-
13599
- var variables = [], url = expand(options.url, options.params, variables);
13600
-
13601
- variables.forEach(function (key) {
13602
- delete options.params[key];
13603
- });
13604
-
13605
- return url;
13606
- };
13607
-
13608
- /**
13609
- * Service for URL templating.
13610
- */
13611
-
13612
- function Url(url, params) {
13613
-
13614
- var self = this || {}, options$$1 = url, transform;
13615
-
13616
- if (isString(url)) {
13617
- options$$1 = {url: url, params: params};
13618
- }
13619
-
13620
- options$$1 = merge({}, Url.options, self.$options, options$$1);
13621
-
13622
- Url.transforms.forEach(function (handler) {
13623
-
13624
- if (isString(handler)) {
13625
- handler = Url.transform[handler];
13626
- }
13627
-
13628
- if (isFunction(handler)) {
13629
- transform = factory(handler, transform, self.$vm);
13630
- }
13631
-
13632
- });
13633
-
13634
- return transform(options$$1);
13635
- }
13636
-
13637
- /**
13638
- * Url options.
13639
- */
13640
-
13641
- Url.options = {
13642
- url: '',
13643
- root: null,
13644
- params: {}
13645
- };
13646
-
13647
- /**
13648
- * Url transforms.
13649
- */
13650
-
13651
- Url.transform = {template: template, query: query, root: root};
13652
- Url.transforms = ['template', 'query', 'root'];
13653
-
13654
- /**
13655
- * Encodes a Url parameter string.
13656
- *
13657
- * @param {Object} obj
13658
- */
13659
-
13660
- Url.params = function (obj) {
13661
-
13662
- var params = [], escape = encodeURIComponent;
13663
-
13664
- params.add = function (key, value) {
13665
-
13666
- if (isFunction(value)) {
13667
- value = value();
13668
- }
13669
-
13670
- if (value === null) {
13671
- value = '';
13672
- }
13673
-
13674
- this.push(escape(key) + '=' + escape(value));
13675
- };
13676
-
13677
- serialize(params, obj);
13678
-
13679
- return params.join('&').replace(/%20/g, '+');
13680
- };
13681
-
13682
- /**
13683
- * Parse a URL and return its components.
13684
- *
13685
- * @param {String} url
13686
- */
13687
-
13688
- Url.parse = function (url) {
13689
-
13690
- var el = document.createElement('a');
13691
-
13692
- if (document.documentMode) {
13693
- el.href = url;
13694
- url = el.href;
13695
- }
13696
-
13697
- el.href = url;
13698
-
13699
- return {
13700
- href: el.href,
13701
- protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
13702
- port: el.port,
13703
- host: el.host,
13704
- hostname: el.hostname,
13705
- pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
13706
- search: el.search ? el.search.replace(/^\?/, '') : '',
13707
- hash: el.hash ? el.hash.replace(/^#/, '') : ''
13708
- };
13709
- };
13710
-
13711
- function factory(handler, next, vm) {
13712
- return function (options$$1) {
13713
- return handler.call(vm, options$$1, next);
13714
- };
13715
- }
13716
-
13717
- function serialize(params, obj, scope) {
13718
-
13719
- var array = isArray(obj), plain = isPlainObject(obj), hash;
13720
-
13721
- each(obj, function (value, key) {
13722
-
13723
- hash = isObject(value) || isArray(value);
13724
-
13725
- if (scope) {
13726
- key = scope + '[' + (plain || hash ? key : '') + ']';
13727
- }
13728
-
13729
- if (!scope && array) {
13730
- params.add(value.name, value.value);
13731
- } else if (hash) {
13732
- serialize(params, value, key);
13733
- } else {
13734
- params.add(key, value);
13735
- }
13736
- });
13737
- }
13738
-
13739
- /**
13740
- * XDomain client (Internet Explorer).
13741
- */
13742
-
13743
- var xdrClient = function (request) {
13744
- return new PromiseObj(function (resolve) {
13745
-
13746
- var xdr = new XDomainRequest(), handler = function (ref) {
13747
- var type = ref.type;
13748
-
13749
-
13750
- var status = 0;
13751
-
13752
- if (type === 'load') {
13753
- status = 200;
13754
- } else if (type === 'error') {
13755
- status = 500;
13756
- }
13757
-
13758
- resolve(request.respondWith(xdr.responseText, {status: status}));
13759
- };
13760
-
13761
- request.abort = function () { return xdr.abort(); };
13762
-
13763
- xdr.open(request.method, request.getUrl());
13764
-
13765
- if (request.timeout) {
13766
- xdr.timeout = request.timeout;
13767
- }
13768
-
13769
- xdr.onload = handler;
13770
- xdr.onabort = handler;
13771
- xdr.onerror = handler;
13772
- xdr.ontimeout = handler;
13773
- xdr.onprogress = function () {};
13774
- xdr.send(request.getBody());
13775
- });
13776
- };
13777
-
13778
- /**
13779
- * CORS Interceptor.
13780
- */
13781
-
13782
- var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
13783
-
13784
- var cors = function (request, next) {
13785
-
13786
- if (inBrowser) {
13787
-
13788
- var orgUrl = Url.parse(location.href);
13789
- var reqUrl = Url.parse(request.getUrl());
13790
-
13791
- if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
13792
-
13793
- request.crossOrigin = true;
13794
- request.emulateHTTP = false;
13795
-
13796
- if (!SUPPORTS_CORS) {
13797
- request.client = xdrClient;
13798
- }
13799
- }
13800
- }
13801
-
13802
- next();
13803
- };
13804
-
13805
- /**
13806
- * Form data Interceptor.
13807
- */
13808
-
13809
- var form = function (request, next) {
13810
-
13811
- if (isFormData(request.body)) {
13812
-
13813
- request.headers.delete('Content-Type');
13814
-
13815
- } else if (isObject(request.body) && request.emulateJSON) {
13816
-
13817
- request.body = Url.params(request.body);
13818
- request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
13819
- }
13820
-
13821
- next();
13822
- };
13823
-
13824
- /**
13825
- * JSON Interceptor.
13826
- */
13827
-
13828
- var json = function (request, next) {
13829
-
13830
- var type = request.headers.get('Content-Type') || '';
13831
-
13832
- if (isObject(request.body) && type.indexOf('application/json') === 0) {
13833
- request.body = JSON.stringify(request.body);
13834
- }
13835
-
13836
- next(function (response) {
13837
-
13838
- return response.bodyText ? when(response.text(), function (text) {
13839
-
13840
- type = response.headers.get('Content-Type') || '';
13841
-
13842
- if (type.indexOf('application/json') === 0 || isJson(text)) {
13843
-
13844
- try {
13845
- response.body = JSON.parse(text);
13846
- } catch (e) {
13847
- response.body = null;
13848
- }
13849
-
13850
- } else {
13851
- response.body = text;
13852
- }
13853
-
13854
- return response;
13855
-
13856
- }) : response;
13857
-
13858
- });
13859
- };
13860
-
13861
- function isJson(str) {
13862
-
13863
- var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/};
13864
-
13865
- return start && end[start[0]].test(str);
13866
- }
13867
-
13868
- /**
13869
- * JSONP client (Browser).
13870
- */
13871
-
13872
- var jsonpClient = function (request) {
13873
- return new PromiseObj(function (resolve) {
13874
-
13875
- var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
13876
-
13877
- handler = function (ref) {
13878
- var type = ref.type;
13879
-
13880
-
13881
- var status = 0;
13882
-
13883
- if (type === 'load' && body !== null) {
13884
- status = 200;
13885
- } else if (type === 'error') {
13886
- status = 500;
13887
- }
13888
-
13889
- if (status && window[callback]) {
13890
- delete window[callback];
13891
- document.body.removeChild(script);
13892
- }
13893
-
13894
- resolve(request.respondWith(body, {status: status}));
13895
- };
13896
-
13897
- window[callback] = function (result) {
13898
- body = JSON.stringify(result);
13899
- };
13900
-
13901
- request.abort = function () {
13902
- handler({type: 'abort'});
13903
- };
13904
-
13905
- request.params[name] = callback;
13906
-
13907
- if (request.timeout) {
13908
- setTimeout(request.abort, request.timeout);
13909
- }
13910
-
13911
- script = document.createElement('script');
13912
- script.src = request.getUrl();
13913
- script.type = 'text/javascript';
13914
- script.async = true;
13915
- script.onload = handler;
13916
- script.onerror = handler;
13917
-
13918
- document.body.appendChild(script);
13919
- });
13920
- };
13921
-
13922
- /**
13923
- * JSONP Interceptor.
13924
- */
13925
-
13926
- var jsonp = function (request, next) {
13927
-
13928
- if (request.method == 'JSONP') {
13929
- request.client = jsonpClient;
13930
- }
13931
-
13932
- next();
13933
- };
13934
-
13935
- /**
13936
- * Before Interceptor.
13937
- */
13938
-
13939
- var before = function (request, next) {
13940
-
13941
- if (isFunction(request.before)) {
13942
- request.before.call(this, request);
13943
- }
13944
-
13945
- next();
13946
- };
13947
-
13948
- /**
13949
- * HTTP method override Interceptor.
13950
- */
13951
-
13952
- var method = function (request, next) {
13953
-
13954
- if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
13955
- request.headers.set('X-HTTP-Method-Override', request.method);
13956
- request.method = 'POST';
13957
- }
13958
-
13959
- next();
13960
- };
13961
-
13962
- /**
13963
- * Header Interceptor.
13964
- */
13965
-
13966
- var header = function (request, next) {
13967
-
13968
- var headers = assign({}, Http.headers.common,
13969
- !request.crossOrigin ? Http.headers.custom : {},
13970
- Http.headers[toLower(request.method)]
13971
- );
13972
-
13973
- each(headers, function (value, name) {
13974
- if (!request.headers.has(name)) {
13975
- request.headers.set(name, value);
13976
- }
13977
- });
13978
-
13979
- next();
13980
- };
13981
-
13982
- /**
13983
- * XMLHttp client (Browser).
13984
- */
13985
-
13986
- var xhrClient = function (request) {
13987
- return new PromiseObj(function (resolve) {
13988
-
13989
- var xhr = new XMLHttpRequest(), handler = function (event) {
13990
-
13991
- var response = request.respondWith(
13992
- 'response' in xhr ? xhr.response : xhr.responseText, {
13993
- status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
13994
- statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)
13995
- }
13996
- );
13997
-
13998
- each(trim(xhr.getAllResponseHeaders()).split('\n'), function (row) {
13999
- response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
14000
- });
14001
-
14002
- resolve(response);
14003
- };
14004
-
14005
- request.abort = function () { return xhr.abort(); };
14006
-
14007
- if (request.progress) {
14008
- if (request.method === 'GET') {
14009
- xhr.addEventListener('progress', request.progress);
14010
- } else if (/^(POST|PUT)$/i.test(request.method)) {
14011
- xhr.upload.addEventListener('progress', request.progress);
14012
- }
14013
- }
14014
-
14015
- xhr.open(request.method, request.getUrl(), true);
14016
-
14017
- if (request.timeout) {
14018
- xhr.timeout = request.timeout;
14019
- }
14020
-
14021
- if (request.responseType && 'responseType' in xhr) {
14022
- xhr.responseType = request.responseType;
14023
- }
14024
-
14025
- if (request.withCredentials || request.credentials) {
14026
- xhr.withCredentials = true;
14027
- }
14028
-
14029
- if (!request.crossOrigin) {
14030
- request.headers.set('X-Requested-With', 'XMLHttpRequest');
14031
- }
14032
-
14033
- request.headers.forEach(function (value, name) {
14034
- xhr.setRequestHeader(name, value);
14035
- });
14036
-
14037
- xhr.onload = handler;
14038
- xhr.onabort = handler;
14039
- xhr.onerror = handler;
14040
- xhr.ontimeout = handler;
14041
- xhr.send(request.getBody());
14042
- });
14043
- };
14044
-
14045
- /**
14046
- * Http client (Node).
14047
- */
14048
-
14049
- var nodeClient = function (request) {
14050
-
14051
- var client = require('got');
14052
-
14053
- return new PromiseObj(function (resolve) {
14054
-
14055
- var url = request.getUrl();
14056
- var body = request.getBody();
14057
- var method = request.method;
14058
- var headers = {}, handler;
14059
-
14060
- request.headers.forEach(function (value, name) {
14061
- headers[name] = value;
14062
- });
14063
-
14064
- client(url, {body: body, method: method, headers: headers}).then(handler = function (resp) {
14065
-
14066
- var response = request.respondWith(resp.body, {
14067
- status: resp.statusCode,
14068
- statusText: trim(resp.statusMessage)
14069
- }
14070
- );
14071
-
14072
- each(resp.headers, function (value, name) {
14073
- response.headers.set(name, value);
14074
- });
14075
-
14076
- resolve(response);
14077
-
14078
- }, function (error$$1) { return handler(error$$1.response); });
14079
- });
14080
- };
14081
-
14082
- /**
14083
- * Base client.
14084
- */
14085
-
14086
- var Client = function (context) {
14087
-
14088
- var reqHandlers = [sendRequest], resHandlers = [], handler;
14089
-
14090
- if (!isObject(context)) {
14091
- context = null;
14092
- }
14093
-
14094
- function Client(request) {
14095
- return new PromiseObj(function (resolve, reject) {
14096
-
14097
- function exec() {
14098
-
14099
- handler = reqHandlers.pop();
14100
-
14101
- if (isFunction(handler)) {
14102
- handler.call(context, request, next);
14103
- } else {
14104
- warn(("Invalid interceptor of type " + (typeof handler) + ", must be a function"));
14105
- next();
14106
- }
14107
- }
14108
-
14109
- function next(response) {
14110
-
14111
- if (isFunction(response)) {
14112
-
14113
- resHandlers.unshift(response);
14114
-
14115
- } else if (isObject(response)) {
14116
-
14117
- resHandlers.forEach(function (handler) {
14118
- response = when(response, function (response) {
14119
- return handler.call(context, response) || response;
14120
- }, reject);
14121
- });
14122
-
14123
- when(response, resolve, reject);
14124
-
14125
- return;
14126
- }
14127
-
14128
- exec();
14129
- }
14130
-
14131
- exec();
14132
-
14133
- }, context);
14134
- }
14135
-
14136
- Client.use = function (handler) {
14137
- reqHandlers.push(handler);
14138
- };
14139
-
14140
- return Client;
14141
- };
14142
-
14143
- function sendRequest(request, resolve) {
14144
-
14145
- var client = request.client || (inBrowser ? xhrClient : nodeClient);
14146
-
14147
- resolve(client(request));
14148
- }
14149
-
14150
- /**
14151
- * HTTP Headers.
14152
- */
14153
-
14154
- var Headers = function Headers(headers) {
14155
- var this$1 = this;
14156
-
14157
-
14158
- this.map = {};
14159
-
14160
- each(headers, function (value, name) { return this$1.append(name, value); });
14161
- };
14162
-
14163
- Headers.prototype.has = function has (name) {
14164
- return getName(this.map, name) !== null;
14165
- };
14166
-
14167
- Headers.prototype.get = function get (name) {
14168
-
14169
- var list = this.map[getName(this.map, name)];
14170
-
14171
- return list ? list.join() : null;
14172
- };
14173
-
14174
- Headers.prototype.getAll = function getAll (name) {
14175
- return this.map[getName(this.map, name)] || [];
14176
- };
14177
-
14178
- Headers.prototype.set = function set (name, value) {
14179
- this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];
14180
- };
14181
-
14182
- Headers.prototype.append = function append (name, value){
14183
-
14184
- var list = this.map[getName(this.map, name)];
14185
-
14186
- if (list) {
14187
- list.push(trim(value));
14188
- } else {
14189
- this.set(name, value);
14190
- }
14191
- };
14192
-
14193
- Headers.prototype.delete = function delete$1 (name){
14194
- delete this.map[getName(this.map, name)];
14195
- };
14196
-
14197
- Headers.prototype.deleteAll = function deleteAll (){
14198
- this.map = {};
14199
- };
14200
-
14201
- Headers.prototype.forEach = function forEach (callback, thisArg) {
14202
- var this$1 = this;
14203
-
14204
- each(this.map, function (list, name) {
14205
- each(list, function (value) { return callback.call(thisArg, value, name, this$1); });
14206
- });
14207
- };
14208
-
14209
- function getName(map, name) {
14210
- return Object.keys(map).reduce(function (prev, curr) {
14211
- return toLower(name) === toLower(curr) ? curr : prev;
14212
- }, null);
14213
- }
14214
-
14215
- function normalizeName(name) {
14216
-
14217
- if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
14218
- throw new TypeError('Invalid character in header field name');
14219
- }
14220
-
14221
- return trim(name);
14222
- }
14223
-
14224
- /**
14225
- * HTTP Response.
14226
- */
14227
-
14228
- var Response = function Response(body, ref) {
14229
- var url = ref.url;
14230
- var headers = ref.headers;
14231
- var status = ref.status;
14232
- var statusText = ref.statusText;
14233
-
14234
-
14235
- this.url = url;
14236
- this.ok = status >= 200 && status < 300;
14237
- this.status = status || 0;
14238
- this.statusText = statusText || '';
14239
- this.headers = new Headers(headers);
14240
- this.body = body;
14241
-
14242
- if (isString(body)) {
14243
-
14244
- this.bodyText = body;
14245
-
14246
- } else if (isBlob(body)) {
14247
-
14248
- this.bodyBlob = body;
14249
-
14250
- if (isBlobText(body)) {
14251
- this.bodyText = blobText(body);
14252
- }
14253
- }
14254
- };
14255
-
14256
- Response.prototype.blob = function blob () {
14257
- return when(this.bodyBlob);
14258
- };
14259
-
14260
- Response.prototype.text = function text () {
14261
- return when(this.bodyText);
14262
- };
14263
-
14264
- Response.prototype.json = function json () {
14265
- return when(this.text(), function (text) { return JSON.parse(text); });
14266
- };
14267
-
14268
- Object.defineProperty(Response.prototype, 'data', {
14269
-
14270
- get: function get() {
14271
- return this.body;
14272
- },
14273
-
14274
- set: function set(body) {
14275
- this.body = body;
14276
- }
14277
-
14278
- });
14279
-
14280
- function blobText(body) {
14281
- return new PromiseObj(function (resolve) {
14282
-
14283
- var reader = new FileReader();
14284
-
14285
- reader.readAsText(body);
14286
- reader.onload = function () {
14287
- resolve(reader.result);
14288
- };
14289
-
14290
- });
14291
- }
14292
-
14293
- function isBlobText(body) {
14294
- return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
14295
- }
14296
-
14297
- /**
14298
- * HTTP Request.
14299
- */
14300
-
14301
- var Request = function Request(options$$1) {
14302
-
14303
- this.body = null;
14304
- this.params = {};
14305
-
14306
- assign(this, options$$1, {
14307
- method: toUpper(options$$1.method || 'GET')
14308
- });
14309
-
14310
- if (!(this.headers instanceof Headers)) {
14311
- this.headers = new Headers(this.headers);
14312
- }
14313
- };
14314
-
14315
- Request.prototype.getUrl = function getUrl (){
14316
- return Url(this);
14317
- };
14318
-
14319
- Request.prototype.getBody = function getBody (){
14320
- return this.body;
14321
- };
14322
-
14323
- Request.prototype.respondWith = function respondWith (body, options$$1) {
14324
- return new Response(body, assign(options$$1 || {}, {url: this.getUrl()}));
14325
- };
14326
-
14327
- /**
14328
- * Service for sending network requests.
14329
- */
14330
-
14331
- var COMMON_HEADERS = {'Accept': 'application/json, text/plain, */*'};
14332
- var JSON_CONTENT_TYPE = {'Content-Type': 'application/json;charset=utf-8'};
14333
-
14334
- function Http(options$$1) {
14335
-
14336
- var self = this || {}, client = Client(self.$vm);
14337
-
14338
- defaults(options$$1 || {}, self.$options, Http.options);
14339
-
14340
- Http.interceptors.forEach(function (handler) {
14341
-
14342
- if (isString(handler)) {
14343
- handler = Http.interceptor[handler];
14344
- }
14345
-
14346
- if (isFunction(handler)) {
14347
- client.use(handler);
14348
- }
14349
-
14350
- });
14351
-
14352
- return client(new Request(options$$1)).then(function (response) {
14353
-
14354
- return response.ok ? response : PromiseObj.reject(response);
14355
-
14356
- }, function (response) {
14357
-
14358
- if (response instanceof Error) {
14359
- error(response);
14360
- }
14361
-
14362
- return PromiseObj.reject(response);
14363
- });
14364
- }
14365
-
14366
- Http.options = {};
14367
-
14368
- Http.headers = {
14369
- put: JSON_CONTENT_TYPE,
14370
- post: JSON_CONTENT_TYPE,
14371
- patch: JSON_CONTENT_TYPE,
14372
- delete: JSON_CONTENT_TYPE,
14373
- common: COMMON_HEADERS,
14374
- custom: {}
14375
- };
14376
-
14377
- Http.interceptor = {before: before, method: method, jsonp: jsonp, json: json, form: form, header: header, cors: cors};
14378
- Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
14379
-
14380
- ['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
14381
-
14382
- Http[method$$1] = function (url, options$$1) {
14383
- return this(assign(options$$1 || {}, {url: url, method: method$$1}));
14384
- };
14385
-
14386
- });
14387
-
14388
- ['post', 'put', 'patch'].forEach(function (method$$1) {
14389
-
14390
- Http[method$$1] = function (url, body, options$$1) {
14391
- return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body}));
14392
- };
14393
-
14394
- });
14395
-
14396
- /**
14397
- * Service for interacting with RESTful services.
14398
- */
14399
-
14400
- function Resource(url, params, actions, options$$1) {
14401
-
14402
- var self = this || {}, resource = {};
14403
-
14404
- actions = assign({},
14405
- Resource.actions,
14406
- actions
14407
- );
14408
-
14409
- each(actions, function (action, name) {
14410
-
14411
- action = merge({url: url, params: assign({}, params)}, options$$1, action);
14412
-
14413
- resource[name] = function () {
14414
- return (self.$http || Http)(opts(action, arguments));
14415
- };
14416
- });
14417
-
14418
- return resource;
14419
- }
14420
-
14421
- function opts(action, args) {
14422
-
14423
- var options$$1 = assign({}, action), params = {}, body;
14424
-
14425
- switch (args.length) {
14426
-
14427
- case 2:
14428
-
14429
- params = args[0];
14430
- body = args[1];
14431
-
14432
- break;
14433
-
14434
- case 1:
14435
-
14436
- if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {
14437
- body = args[0];
14438
- } else {
14439
- params = args[0];
14440
- }
14441
-
14442
- break;
14443
-
14444
- case 0:
14445
-
14446
- break;
14447
-
14448
- default:
14449
-
14450
- throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
14451
- }
14452
-
14453
- options$$1.body = body;
14454
- options$$1.params = assign({}, options$$1.params, params);
14455
-
14456
- return options$$1;
14457
- }
14458
-
14459
- Resource.actions = {
14460
-
14461
- get: {method: 'GET'},
14462
- save: {method: 'POST'},
14463
- query: {method: 'GET'},
14464
- update: {method: 'PUT'},
14465
- remove: {method: 'DELETE'},
14466
- delete: {method: 'DELETE'}
14467
-
14468
- };
14469
-
14470
- /**
14471
- * Install plugin.
14472
- */
14473
-
14474
- function plugin(Vue) {
14475
-
14476
- if (plugin.installed) {
14477
- return;
14478
- }
14479
-
14480
- Util(Vue);
14481
-
14482
- Vue.url = Url;
14483
- Vue.http = Http;
14484
- Vue.resource = Resource;
14485
- Vue.Promise = PromiseObj;
14486
-
14487
- Object.defineProperties(Vue.prototype, {
14488
-
14489
- $url: {
14490
- get: function get() {
14491
- return options(Vue.url, this, this.$options.url);
14492
- }
14493
- },
14494
-
14495
- $http: {
14496
- get: function get() {
14497
- return options(Vue.http, this, this.$options.http);
14498
- }
14499
- },
14500
-
14501
- $resource: {
14502
- get: function get() {
14503
- return Vue.resource.bind(this);
14504
- }
14505
- },
14506
-
14507
- $promise: {
14508
- get: function get() {
14509
- var this$1 = this;
14510
-
14511
- return function (executor) { return new Vue.Promise(executor, this$1); };
14512
- }
14513
- }
14514
-
14515
- });
14516
- }
14517
-
14518
- if (typeof window !== 'undefined' && window.Vue) {
14519
- window.Vue.use(plugin);
14520
- }
14521
-
14522
- return plugin;
14523
-
14524
- })));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,(function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function o(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function i(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return a.call(e).slice(8,-1)}function c(e){return"[object Object]"===a.call(e)}function u(e){return"[object RegExp]"===a.call(e)}function l(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function f(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function p(e){return null==e?"":Array.isArray(e)||c(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function d(e){var t=parseFloat(e);return isNaN(t)?e:t}function v(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var h=v("slot,component",!0),m=v("key,ref,slot,slot-scope,is");function y(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var g=Object.prototype.hasOwnProperty;function b(e,t){return g.call(e,t)}function _(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var w=/-(\w)/g,x=_((function(e){return e.replace(w,(function(e,t){return t?t.toUpperCase():""}))})),$=_((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),C=/\B([A-Z])/g,k=_((function(e){return e.replace(C,"-$1").toLowerCase()})),A=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function O(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function S(e,t){for(var n in t)e[n]=t[n];return e}function T(e){for(var t={},n=0;n<e.length;n++)e[n]&&S(t,e[n]);return t}function j(e,t,n){}var E=function(e,t,n){return!1},M=function(e){return e};function N(e,t){if(e===t)return!0;var n=i(e),r=i(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),a=Array.isArray(t);if(o&&a)return e.length===t.length&&e.every((function(e,n){return N(e,t[n])}));if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every((function(n){return N(e[n],t[n])}))}catch(e){return!1}}function P(e,t){for(var n=0;n<e.length;n++)if(N(e[n],t))return n;return-1}function I(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",D=["component","directive","filter"],R=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!0,devtools:!0,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:E,isReservedAttr:E,isUnknownElement:E,getTagNamespace:j,parsePlatformTagName:M,mustUseProp:E,async:!0,_lifecycleHooks:R},U=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function H(e){var t=(e+"").charCodeAt(0);return 36===t||95===t}function V(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var B,q=new RegExp("[^"+U.source+".$_\\d]"),z="__proto__"in{},J="undefined"!=typeof window,G="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=G&&WXEnvironment.platform.toLowerCase(),W=J&&window.navigator.userAgent.toLowerCase(),X=W&&/msie|trident/.test(W),Z=W&&W.indexOf("msie 9.0")>0,Y=W&&W.indexOf("edge/")>0,Q=(W&&W.indexOf("android"),W&&/iphone|ipad|ipod|ios/.test(W)||"ios"===K),ee=(W&&/chrome\/\d+/.test(W),W&&/phantomjs/.test(W),W&&W.match(/firefox\/(\d+)/)),te={}.watch,ne=!1;if(J)try{var re={};Object.defineProperty(re,"passive",{get:function(){ne=!0}}),window.addEventListener("test-passive",null,re)}catch(e){}var oe=function(){return void 0===B&&(B=!J&&!G&&"undefined"!=typeof global&&global.process&&"server"===global.process.env.VUE_ENV),B},ie=J&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ae(e){return"function"==typeof e&&/native code/.test(e.toString())}var se,ce="undefined"!=typeof Symbol&&ae(Symbol)&&"undefined"!=typeof Reflect&&ae(Reflect.ownKeys);se="undefined"!=typeof Set&&ae(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ue,le,fe,pe=j,de="undefined"!=typeof console,ve=/(?:^|[-_])(\w)/g;ue=function(e,t){var n=t?pe(t):"";F.warnHandler?F.warnHandler.call(null,e,t,n):de&&!F.silent&&console.error("[Vue warn]: "+e+n)},le=function(e,t){de&&!F.silent&&console.warn("[Vue tip]: "+e+(t?pe(t):""))},fe=function(e,t){if(e.$root===e)return"<Root>";var n="function"==typeof e&&null!=e.cid?e.options:e._isVue?e.$options||e.constructor.options:e,r=n.name||n._componentTag,o=n.__file;if(!r&&o){var i=o.match(/([^/\\]+)\.vue$/);r=i&&i[1]}return(r?"<"+function(e){return e.replace(ve,(function(e){return e.toUpperCase()})).replace(/[-_]/g,"")}(r)+">":"<Anonymous>")+(o&&!1!==t?" at "+o:"")},pe=function(e){if(e._isVue&&e.$parent){for(var t=[],n=0;e;){if(t.length>0){var r=t[t.length-1];if(r.constructor===e.constructor){n++,e=e.$parent;continue}n>0&&(t[t.length-1]=[r,n],n=0)}t.push(e),e=e.$parent}return"\n\nfound in\n\n"+t.map((function(e,t){return""+(0===t?"---\x3e ":function(e,t){for(var n="";t;)t%2==1&&(n+=e),t>1&&(e+=e),t>>=1;return n}(" ",5+2*t))+(Array.isArray(e)?fe(e[0])+"... ("+e[1]+" recursive calls)":fe(e))})).join("\n")}return"\n\n(found in "+fe(e)+")"};var he=0,me=function(){this.id=he++,this.subs=[]};me.prototype.addSub=function(e){this.subs.push(e)},me.prototype.removeSub=function(e){y(this.subs,e)},me.prototype.depend=function(){me.target&&me.target.addDep(this)},me.prototype.notify=function(){var e=this.subs.slice();F.async||e.sort((function(e,t){return e.id-t.id}));for(var t=0,n=e.length;t<n;t++)e[t].update()},me.target=null;var ye=[];function ge(e){ye.push(e),me.target=e}function be(){ye.pop(),me.target=ye[ye.length-1]}var _e=function(e,t,n,r,o,i,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},we={child:{configurable:!0}};we.child.get=function(){return this.componentInstance},Object.defineProperties(_e.prototype,we);var xe=function(e){void 0===e&&(e="");var t=new _e;return t.text=e,t.isComment=!0,t};function $e(e){return new _e(void 0,void 0,void 0,String(e))}function Ce(e){var t=new _e(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}var ke=Array.prototype,Ae=Object.create(ke);["push","pop","shift","unshift","splice","sort","reverse"].forEach((function(e){var t=ke[e];V(Ae,e,(function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var o,i=t.apply(this,n),a=this.__ob__;switch(e){case"push":case"unshift":o=n;break;case"splice":o=n.slice(2)}return o&&a.observeArray(o),a.dep.notify(),i}))}));var Oe=Object.getOwnPropertyNames(Ae),Se=!0;function Te(e){Se=e}var je=function(e){this.value=e,this.dep=new me,this.vmCount=0,V(e,"__ob__",this),Array.isArray(e)?(z?function(e,t){e.__proto__=t}(e,Ae):function(e,t,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];V(e,i,t[i])}}(e,Ae,Oe),this.observeArray(e)):this.walk(e)};function Ee(e,t){var n;if(i(e)&&!(e instanceof _e))return b(e,"__ob__")&&e.__ob__ instanceof je?n=e.__ob__:Se&&!oe()&&(Array.isArray(e)||c(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new je(e)),t&&n&&n.vmCount++,n}function Me(e,t,n,r,o){var i=new me,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=e[t]);var u=!o&&Ee(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return me.target&&(i.depend(),u&&(u.dep.depend(),Array.isArray(t)&&Ie(t))),t},set:function(t){var a=s?s.call(e):n;t===a||t!=t&&a!=a||(r&&r(),s&&!c||(c?c.call(e,t):n=t,u=!o&&Ee(t),i.notify()))}})}}function Ne(e,n,r){if((t(e)||o(e))&&ue("Cannot set reactive property on undefined, null, or primitive value: "+e),Array.isArray(e)&&l(n))return e.length=Math.max(e.length,n),e.splice(n,1,r),r;if(n in e&&!(n in Object.prototype))return e[n]=r,r;var i=e.__ob__;return e._isVue||i&&i.vmCount?(ue("Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option."),r):i?(Me(i.value,n,r),i.dep.notify(),r):(e[n]=r,r)}function Pe(e,n){if((t(e)||o(e))&&ue("Cannot delete reactive property on undefined, null, or primitive value: "+e),Array.isArray(e)&&l(n))e.splice(n,1);else{var r=e.__ob__;e._isVue||r&&r.vmCount?ue("Avoid deleting properties on a Vue instance or its root $data - just set it to null."):b(e,n)&&(delete e[n],r&&r.dep.notify())}}function Ie(e){for(var t=void 0,n=0,r=e.length;n<r;n++)(t=e[n])&&t.__ob__&&t.__ob__.dep.depend(),Array.isArray(t)&&Ie(t)}je.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)Me(e,t[n])},je.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)Ee(e[t])};var Le=F.optionMergeStrategies;function De(e,t){if(!t)return e;for(var n,r,o,i=ce?Reflect.ownKeys(t):Object.keys(t),a=0;a<i.length;a++)"__ob__"!==(n=i[a])&&(r=e[n],o=t[n],b(e,n)?r!==o&&c(r)&&c(o)&&De(r,o):Ne(e,n,o));return e}function Re(e,t,n){return n?function(){var r="function"==typeof t?t.call(n,n):t,o="function"==typeof e?e.call(n,n):e;return r?De(r,o):o}:t?e?function(){return De("function"==typeof t?t.call(this,this):t,"function"==typeof e?e.call(this,this):e)}:t:e}function Fe(e,t){var n=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return n?function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}function Ue(e,t,n,r){var o=Object.create(e||null);return t?(Be(r,t,n),S(o,t)):o}Le.el=Le.propsData=function(e,t,n,r){return n||ue('option "'+r+'" can only be used during instance creation with the `new` keyword.'),He(e,t)},Le.data=function(e,t,n){return n?Re(e,t,n):t&&"function"!=typeof t?(ue('The "data" option should be a function that returns a per-instance value in component definitions.',n),e):Re(e,t)},R.forEach((function(e){Le[e]=Fe})),D.forEach((function(e){Le[e+"s"]=Ue})),Le.watch=function(e,t,n,r){if(e===te&&(e=void 0),t===te&&(t=void 0),!t)return Object.create(e||null);if(Be(r,t,n),!e)return t;var o={};for(var i in S(o,e),t){var a=o[i],s=t[i];a&&!Array.isArray(a)&&(a=[a]),o[i]=a?a.concat(s):Array.isArray(s)?s:[s]}return o},Le.props=Le.methods=Le.inject=Le.computed=function(e,t,n,r){if(t&&Be(r,t,n),!e)return t;var o=Object.create(null);return S(o,e),t&&S(o,t),o},Le.provide=Re;var He=function(e,t){return void 0===t?e:t};function Ve(e){new RegExp("^[a-zA-Z][\\-\\.0-9_"+U.source+"]*$").test(e)||ue('Invalid component name: "'+e+'". Component names should conform to valid custom element name in html5 specification.'),(h(e)||F.isReservedTag(e))&&ue("Do not use built-in or reserved HTML elements as component id: "+e)}function Be(e,t,n){c(t)||ue('Invalid value for option "'+e+'": expected an Object, but got '+s(t)+".",n)}function qe(e,t,n){if(function(e){for(var t in e.components)Ve(t)}(t),"function"==typeof t&&(t=t.options),function(e,t){var n=e.props;if(n){var r,o,i={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(o=n[r])?i[x(o)]={type:null}:ue("props must be strings when using array syntax.");else if(c(n))for(var a in n)o=n[a],i[x(a)]=c(o)?o:{type:o};else ue('Invalid value for option "props": expected an Array or an Object, but got '+s(n)+".",t);e.props=i}}(t,n),function(e,t){var n=e.inject;if(n){var r=e.inject={};if(Array.isArray(n))for(var o=0;o<n.length;o++)r[n[o]]={from:n[o]};else if(c(n))for(var i in n){var a=n[i];r[i]=c(a)?S({from:i},a):{from:a}}else ue('Invalid value for option "inject": expected an Array or an Object, but got '+s(n)+".",t)}}(t,n),function(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}(t),!t._base&&(t.extends&&(e=qe(e,t.extends,n)),t.mixins))for(var r=0,o=t.mixins.length;r<o;r++)e=qe(e,t.mixins[r],n);var i,a={};for(i in e)u(i);for(i in t)b(e,i)||u(i);function u(r){var o=Le[r]||He;a[r]=o(e[r],t[r],n,r)}return a}function ze(e,t,n,r){if("string"==typeof n){var o=e[t];if(b(o,n))return o[n];var i=x(n);if(b(o,i))return o[i];var a=$(i);if(b(o,a))return o[a];var s=o[n]||o[i]||o[a];return r&&!s&&ue("Failed to resolve "+t.slice(0,-1)+": "+n,e),s}}function Je(e,t,n,r){var o=t[e],a=!b(n,e),c=n[e],u=Ze(Boolean,o.type);if(u>-1)if(a&&!b(o,"default"))c=!1;else if(""===c||c===k(e)){var l=Ze(String,o.type);(l<0||u<l)&&(c=!0)}if(void 0===c){c=function(e,t,n){if(b(t,"default")){var r=t.default;return i(r)&&ue('Invalid default value for prop "'+n+'": Props with type Object/Array must use a factory function to return the default value.',e),e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n]?e._props[n]:"function"==typeof r&&"Function"!==We(t.type)?r.call(e):r}}(r,o,e);var f=Se;Te(!0),Ee(c),Te(f)}return function(e,t,n,r,o){if(e.required&&o)ue('Missing required prop: "'+t+'"',r);else if(null!=n||e.required){var i=e.type,a=!i||!0===i,c=[];if(i){Array.isArray(i)||(i=[i]);for(var u=0;u<i.length&&!a;u++){var l=Ke(n,i[u]);c.push(l.expectedType||""),a=l.valid}}if(a){var f=e.validator;f&&(f(n)||ue('Invalid prop: custom validator check failed for prop "'+t+'".',r))}else ue(function(e,t,n){var r='Invalid prop: type check failed for prop "'+e+'". Expected '+n.map($).join(", "),o=n[0],i=s(t),a=Ye(t,o),c=Ye(t,i);return 1===n.length&&Qe(o)&&!function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return e.some((function(e){return"boolean"===e.toLowerCase()}))}(o,i)&&(r+=" with value "+a),r+=", got "+i+" ",Qe(i)&&(r+="with value "+c+"."),r}(t,n,c),r)}}(o,e,c,r,a),c}var Ge=/^(String|Number|Boolean|Function|Symbol)$/;function Ke(e,t){var n,r=We(t);if(Ge.test(r)){var o=typeof e;(n=o===r.toLowerCase())||"object"!==o||(n=e instanceof t)}else n="Object"===r?c(e):"Array"===r?Array.isArray(e):e instanceof t;return{valid:n,expectedType:r}}function We(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Xe(e,t){return We(e)===We(t)}function Ze(e,t){if(!Array.isArray(t))return Xe(t,e)?0:-1;for(var n=0,r=t.length;n<r;n++)if(Xe(t[n],e))return n;return-1}function Ye(e,t){return"String"===t?'"'+e+'"':"Number"===t?""+Number(e):""+e}function Qe(e){return["string","number","boolean"].some((function(t){return e.toLowerCase()===t}))}function et(e,t,n){ge();try{if(t)for(var r=t;r=r.$parent;){var o=r.$options.errorCaptured;if(o)for(var i=0;i<o.length;i++)try{if(!1===o[i].call(r,e,t,n))return}catch(e){nt(e,r,"errorCaptured hook")}}nt(e,t,n)}finally{be()}}function tt(e,t,n,r,o){var i;try{(i=n?e.apply(t,n):e.call(t))&&!i._isVue&&f(i)&&!i._handled&&(i.catch((function(e){return et(e,r,o+" (Promise/async)")})),i._handled=!0)}catch(e){et(e,r,o)}return i}function nt(e,t,n){if(F.errorHandler)try{return F.errorHandler.call(null,e,t,n)}catch(t){t!==e&&rt(t,null,"config.errorHandler")}rt(e,t,n)}function rt(e,t,n){if(ue("Error in "+n+': "'+e.toString()+'"',t),!J&&!G||"undefined"==typeof console)throw e;console.error(e)}var ot,it,at,st=!1,ct=[],ut=!1;function lt(){ut=!1;var e=ct.slice(0);ct.length=0;for(var t=0;t<e.length;t++)e[t]()}if("undefined"!=typeof Promise&&ae(Promise)){var ft=Promise.resolve();ot=function(){ft.then(lt),Q&&setTimeout(j)},st=!0}else if(X||"undefined"==typeof MutationObserver||!ae(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())ot="undefined"!=typeof setImmediate&&ae(setImmediate)?function(){setImmediate(lt)}:function(){setTimeout(lt,0)};else{var pt=1,dt=new MutationObserver(lt),vt=document.createTextNode(String(pt));dt.observe(vt,{characterData:!0}),ot=function(){pt=(pt+1)%2,vt.data=String(pt)},st=!0}function ht(e,t){var n;if(ct.push((function(){if(e)try{e.call(t)}catch(e){et(e,t,"nextTick")}else n&&n(t)})),ut||(ut=!0,ot()),!e&&"undefined"!=typeof Promise)return new Promise((function(e){n=e}))}var mt,yt=J&&window.performance;yt&&yt.mark&&yt.measure&&yt.clearMarks&&yt.clearMeasures&&(it=function(e){return yt.mark(e)},at=function(e,t,n){yt.measure(e,t,n),yt.clearMarks(t),yt.clearMarks(n)});var gt=v("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,require"),bt=function(e,t){ue('Property or method "'+t+'" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',e)},_t=function(e,t){ue('Property "'+t+'" must be accessed with "$data.'+t+'" because properties starting with "$" or "_" are not proxied in the Vue instance to prevent conflicts with Vue internalsSee: https://vuejs.org/v2/api/#data',e)},wt="undefined"!=typeof Proxy&&ae(Proxy);if(wt){var xt=v("stop,prevent,self,ctrl,shift,alt,meta,exact");F.keyCodes=new Proxy(F.keyCodes,{set:function(e,t,n){return xt(t)?(ue("Avoid overwriting built-in modifier in config.keyCodes: ."+t),!1):(e[t]=n,!0)}})}var $t={has:function(e,t){var n=t in e,r=gt(t)||"string"==typeof t&&"_"===t.charAt(0)&&!(t in e.$data);return n||r||(t in e.$data?_t(e,t):bt(e,t)),n||!r}},Ct={get:function(e,t){return"string"!=typeof t||t in e||(t in e.$data?_t(e,t):bt(e,t)),e[t]}};mt=function(e){if(wt){var t=e.$options,n=t.render&&t.render._withStripped?Ct:$t;e._renderProxy=new Proxy(e,n)}else e._renderProxy=e};var kt=new se;function At(e){Ot(e,kt),kt.clear()}function Ot(e,t){var n,r,o=Array.isArray(e);if(!(!o&&!i(e)||Object.isFrozen(e)||e instanceof _e)){if(e.__ob__){var a=e.__ob__.dep.id;if(t.has(a))return;t.add(a)}if(o)for(n=e.length;n--;)Ot(e[n],t);else for(n=(r=Object.keys(e)).length;n--;)Ot(e[r[n]],t)}}var St=_((function(e){var t="&"===e.charAt(0),n="~"===(e=t?e.slice(1):e).charAt(0),r="!"===(e=n?e.slice(1):e).charAt(0);return{name:e=r?e.slice(1):e,once:n,capture:r,passive:t}}));function Tt(e,t){function n(){var e=arguments,r=n.fns;if(!Array.isArray(r))return tt(r,null,arguments,t,"v-on handler");for(var o=r.slice(),i=0;i<o.length;i++)tt(o[i],null,e,t,"v-on handler")}return n.fns=e,n}function jt(e,n,o,i,a,s){var c,u,l,f;for(c in e)u=e[c],l=n[c],f=St(c),t(u)?ue('Invalid handler for event "'+f.name+'": got '+String(u),s):t(l)?(t(u.fns)&&(u=e[c]=Tt(u,s)),r(f.once)&&(u=e[c]=a(f.name,u,f.capture)),o(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,e[c]=l);for(c in n)t(e[c])&&i((f=St(c)).name,n[c],f.capture)}function Et(e,o,i){var a;e instanceof _e&&(e=e.data.hook||(e.data.hook={}));var s=e[o];function c(){i.apply(this,arguments),y(a.fns,c)}t(s)?a=Tt([c]):n(s.fns)&&r(s.merged)?(a=s).fns.push(c):a=Tt([s,c]),a.merged=!0,e[o]=a}function Mt(e,t,r,o,i){if(n(t)){if(b(t,r))return e[r]=t[r],i||delete t[r],!0;if(b(t,o))return e[r]=t[o],i||delete t[o],!0}return!1}function Nt(e){return o(e)?[$e(e)]:Array.isArray(e)?It(e):void 0}function Pt(e){return n(e)&&n(e.text)&&!1===e.isComment}function It(e,i){var a,s,c,u,l=[];for(a=0;a<e.length;a++)t(s=e[a])||"boolean"==typeof s||(u=l[c=l.length-1],Array.isArray(s)?s.length>0&&(Pt((s=It(s,(i||"")+"_"+a))[0])&&Pt(u)&&(l[c]=$e(u.text+s[0].text),s.shift()),l.push.apply(l,s)):o(s)?Pt(u)?l[c]=$e(u.text+s):""!==s&&l.push($e(s)):Pt(s)&&Pt(u)?l[c]=$e(u.text+s.text):(r(e._isVList)&&n(s.tag)&&t(s.key)&&n(i)&&(s.key="__vlist"+i+"_"+a+"__"),l.push(s)));return l}function Lt(e,t){if(e){for(var n=Object.create(null),r=ce?Reflect.ownKeys(e):Object.keys(e),o=0;o<r.length;o++){var i=r[o];if("__ob__"!==i){for(var a=e[i].from,s=t;s;){if(s._provided&&b(s._provided,a)){n[i]=s._provided[a];break}s=s.$parent}if(!s)if("default"in e[i]){var c=e[i].default;n[i]="function"==typeof c?c.call(t):c}else ue('Injection "'+i+'" not found',t)}}return n}}function Dt(e,t){if(!e||!e.length)return{};for(var n={},r=0,o=e.length;r<o;r++){var i=e[r],a=i.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,i.context!==t&&i.fnContext!==t||!a||null==a.slot)(n.default||(n.default=[])).push(i);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===i.tag?c.push.apply(c,i.children||[]):c.push(i)}}for(var u in n)n[u].every(Rt)&&delete n[u];return n}function Rt(e){return e.isComment&&!e.asyncFactory||" "===e.text}function Ft(t,n,r){var o,i=Object.keys(n).length>0,a=t?!!t.$stable:!i,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!i&&!r.$hasNormal)return r;for(var c in o={},t)t[c]&&"$"!==c[0]&&(o[c]=Ut(n,c,t[c]))}else o={};for(var u in n)u in o||(o[u]=Ht(n,u));return t&&Object.isExtensible(t)&&(t._normalized=o),V(o,"$stable",a),V(o,"$key",s),V(o,"$hasNormal",i),o}function Ut(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:Nt(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function Ht(e,t){return function(){return e[t]}}function Vt(e,t){var r,o,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),o=0,a=e.length;o<a;o++)r[o]=t(e[o],o);else if("number"==typeof e)for(r=new Array(e),o=0;o<e;o++)r[o]=t(o+1,o);else if(i(e))if(ce&&e[Symbol.iterator]){r=[];for(var u=e[Symbol.iterator](),l=u.next();!l.done;)r.push(t(l.value,r.length)),l=u.next()}else for(s=Object.keys(e),r=new Array(s.length),o=0,a=s.length;o<a;o++)c=s[o],r[o]=t(e[c],c,o);return n(r)||(r=[]),r._isVList=!0,r}function Bt(e,t,n,r){var o,a=this.$scopedSlots[e];a?(n=n||{},r&&(i(r)||ue("slot v-bind without argument expects an Object",this),n=S(S({},r),n)),o=a(n)||t):o=this.$slots[e]||t;var s=n&&n.slot;return s?this.$createElement("template",{slot:s},o):o}function qt(e){return ze(this.$options,"filters",e,!0)||M}function zt(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t}function Jt(e,t,n,r,o){var i=F.keyCodes[t]||n;return o&&r&&!F.keyCodes[t]?zt(o,r):i?zt(i,e):r?k(r)!==t:void 0}function Gt(e,t,n,r,o){if(n)if(i(n)){var a;Array.isArray(n)&&(n=T(n));var s=function(i){if("class"===i||"style"===i||m(i))a=e;else{var s=e.attrs&&e.attrs.type;a=r||F.mustUseProp(t,s,i)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}var c=x(i),u=k(i);c in a||u in a||(a[i]=n[i],o&&((e.on||(e.on={}))["update:"+i]=function(e){n[i]=e}))};for(var c in n)s(c)}else ue("v-bind without argument expects an Object or Array value",this);return e}function Kt(e,t){var n=this._staticTrees||(this._staticTrees=[]),r=n[e];return r&&!t||Xt(r=n[e]=this.$options.staticRenderFns[e].call(this._renderProxy,null,this),"__static__"+e,!1),r}function Wt(e,t,n){return Xt(e,"__once__"+t+(n?"_"+n:""),!0),e}function Xt(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&Zt(e[r],t+"_"+r,n);else Zt(e,t,n)}function Zt(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function Yt(e,t){if(t)if(c(t)){var n=e.on=e.on?S({},e.on):{};for(var r in t){var o=n[r],i=t[r];n[r]=o?[].concat(o,i):i}}else ue("v-on without argument expects an Object value",this);return e}function Qt(e,t,n,r){t=t||{$stable:!n};for(var o=0;o<e.length;o++){var i=e[o];Array.isArray(i)?Qt(i,t,n):i&&(i.proxy&&(i.fn.proxy=!0),t[i.key]=i.fn)}return r&&(t.$key=r),t}function en(e,t){for(var n=0;n<t.length;n+=2){var r=t[n];"string"==typeof r&&r?e[t[n]]=t[n+1]:""!==r&&null!==r&&ue("Invalid value for dynamic directive argument (expected string or null): "+r,this)}return e}function tn(e,t){return"string"==typeof e?t+e:e}function nn(e){e._o=Wt,e._n=d,e._s=p,e._l=Vt,e._t=Bt,e._q=N,e._i=P,e._m=Kt,e._f=qt,e._k=Jt,e._b=Gt,e._v=$e,e._e=xe,e._u=Qt,e._g=Yt,e._d=en,e._p=tn}function rn(t,n,o,i,a){var s,c=this,u=a.options;b(i,"_uid")?(s=Object.create(i))._original=i:(s=i,i=i._original);var l=r(u._compiled),f=!l;this.data=t,this.props=n,this.children=o,this.parent=i,this.listeners=t.on||e,this.injections=Lt(u.inject,i),this.slots=function(){return c.$slots||Ft(t.scopedSlots,c.$slots=Dt(o,i)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return Ft(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=Ft(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(e,t,n,r){var o=fn(s,e,t,n,r,f);return o&&!Array.isArray(o)&&(o.fnScopeId=u._scopeId,o.fnContext=i),o}:this._c=function(e,t,n,r){return fn(s,e,t,n,r,f)}}function on(e,t,n,r,o){var i=Ce(e);return i.fnContext=n,i.fnOptions=r,(i.devtoolsMeta=i.devtoolsMeta||{}).renderContext=o,t.slot&&((i.data||(i.data={})).slot=t.slot),i}function an(e,t){for(var n in t)e[x(n)]=t[n]}nn(rn.prototype);var sn={init:function(e,t){if(e.componentInstance&&!e.componentInstance._isDestroyed&&e.data.keepAlive){var r=e;sn.prepatch(r,r)}else(e.componentInstance=function(e,t){var r={_isComponent:!0,_parentVnode:e,parent:t},o=e.data.inlineTemplate;return n(o)&&(r.render=o.render,r.staticRenderFns=o.staticRenderFns),new e.componentOptions.Ctor(r)}(e,$n)).$mount(t?e.elm:void 0,t)},prepatch:function(t,n){var r=n.componentOptions;!function(t,n,r,o,i){Cn=!0;var a=o.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==e&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(i||t.$options._renderChildren||c);if(t.$options._parentVnode=o,t.$vnode=o,t._vnode&&(t._vnode.parent=o),t.$options._renderChildren=i,t.$attrs=o.data.attrs||e,t.$listeners=r||e,n&&t.$options.props){Te(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],v=t.$options.props;l[d]=Je(d,v,n,t)}Te(!0),t.$options.propsData=n}r=r||e;var h=t.$options._parentListeners;t.$options._parentListeners=r,xn(t,r,h),u&&(t.$slots=Dt(i,o.context),t.$forceUpdate()),Cn=!1}(n.componentInstance=t.componentInstance,r.propsData,r.listeners,n,r.children)},insert:function(e){var t,n=e.context,r=e.componentInstance;r._isMounted||(r._isMounted=!0,Tn(r,"mounted")),e.data.keepAlive&&(n._isMounted?((t=r)._inactive=!1,En.push(t)):On(r,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?Sn(t,!0):t.$destroy())}},cn=Object.keys(sn);function un(o,a,s,c,u){if(!t(o)){var l=s.$options._base;if(i(o)&&(o=l.extend(o)),"function"==typeof o){var p;if(t(o.cid)&&(o=function(e,o){if(r(e.error)&&n(e.errorComp))return e.errorComp;if(n(e.resolved))return e.resolved;var a=vn;if(a&&n(e.owners)&&-1===e.owners.indexOf(a)&&e.owners.push(a),r(e.loading)&&n(e.loadingComp))return e.loadingComp;if(a&&!n(e.owners)){var s=e.owners=[a],c=!0,u=null,l=null;a.$on("hook:destroyed",(function(){return y(s,a)}));var p=function(e){for(var t=0,n=s.length;t<n;t++)s[t].$forceUpdate();e&&(s.length=0,null!==u&&(clearTimeout(u),u=null),null!==l&&(clearTimeout(l),l=null))},d=I((function(t){e.resolved=hn(t,o),c?s.length=0:p(!0)})),v=I((function(t){ue("Failed to resolve async component: "+String(e)+(t?"\nReason: "+t:"")),n(e.errorComp)&&(e.error=!0,p(!0))})),h=e(d,v);return i(h)&&(f(h)?t(e.resolved)&&h.then(d,v):f(h.component)&&(h.component.then(d,v),n(h.error)&&(e.errorComp=hn(h.error,o)),n(h.loading)&&(e.loadingComp=hn(h.loading,o),0===h.delay?e.loading=!0:u=setTimeout((function(){u=null,t(e.resolved)&&t(e.error)&&(e.loading=!0,p(!1))}),h.delay||200)),n(h.timeout)&&(l=setTimeout((function(){l=null,t(e.resolved)&&v("timeout ("+h.timeout+"ms)")}),h.timeout)))),c=!1,e.loading?e.loadingComp:e.resolved}}(p=o,l),void 0===o))return function(e,t,n,r,o){var i=xe();return i.asyncFactory=e,i.asyncMeta={data:t,context:n,children:r,tag:o},i}(p,a,s,c,u);a=a||{},Zn(o),n(a.model)&&function(e,t){var r=e.model&&e.model.prop||"value",o=e.model&&e.model.event||"input";(t.attrs||(t.attrs={}))[r]=t.model.value;var i=t.on||(t.on={}),a=i[o],s=t.model.callback;n(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(i[o]=[s].concat(a)):i[o]=s}(o.options,a);var d=function(e,r,o){var i=r.options.props;if(!t(i)){var a={},s=e.attrs,c=e.props;if(n(s)||n(c))for(var u in i){var l=k(u),f=u.toLowerCase();u!==f&&s&&b(s,f)&&le('Prop "'+f+'" is passed to component '+fe(o||r)+', but the declared prop name is "'+u+'". Note that HTML attributes are case-insensitive and camelCased props need to use their kebab-case equivalents when using in-DOM templates. You should probably use "'+l+'" instead of "'+u+'".'),Mt(a,c,u,l,!0)||Mt(a,s,u,l,!1)}return a}}(a,o,u);if(r(o.options.functional))return function(t,r,o,i,a){var s=t.options,c={},u=s.props;if(n(u))for(var l in u)c[l]=Je(l,u,r||e);else n(o.attrs)&&an(c,o.attrs),n(o.props)&&an(c,o.props);var f=new rn(o,c,a,i,t),p=s.render.call(null,f._c,f);if(p instanceof _e)return on(p,o,f.parent,s,f);if(Array.isArray(p)){for(var d=Nt(p)||[],v=new Array(d.length),h=0;h<d.length;h++)v[h]=on(d[h],o,f.parent,s,f);return v}}(o,d,a,s,c);var v=a.on;if(a.on=a.nativeOn,r(o.options.abstract)){var h=a.slot;a={},h&&(a.slot=h)}!function(e){for(var t=e.hook||(e.hook={}),n=0;n<cn.length;n++){var r=cn[n],o=t[r],i=sn[r];o===i||o&&o._merged||(t[r]=o?ln(i,o):i)}}(a);var m=o.options.name||u;return new _e("vue-component-"+o.cid+(m?"-"+m:""),a,void 0,void 0,void 0,s,{Ctor:o,propsData:d,listeners:v,tag:u,children:c},p)}ue("Invalid Component definition: "+String(o),s)}}function ln(e,t){var n=function(n,r){e(n,r),t(n,r)};return n._merged=!0,n}function fn(e,t,a,s,c,u){return(Array.isArray(a)||o(a))&&(c=s,s=a,a=void 0),r(u)&&(c=2),function(e,t,r,a,s){if(n(r)&&n(r.__ob__))return ue("Avoid using observed data object as vnode data: "+JSON.stringify(r)+"\nAlways create fresh vnode data objects in each render!",e),xe();if(n(r)&&n(r.is)&&(t=r.is),!t)return xe();var c,u,l;(n(r)&&n(r.key)&&!o(r.key)&&ue("Avoid using non-primitive value as key, use string/number value instead.",e),Array.isArray(a)&&"function"==typeof a[0]&&((r=r||{}).scopedSlots={default:a[0]},a.length=0),2===s?a=Nt(a):1===s&&(a=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}(a)),"string"==typeof t)?(u=e.$vnode&&e.$vnode.ns||F.getTagNamespace(t),c=F.isReservedTag(t)?new _e(F.parsePlatformTagName(t),r,a,void 0,void 0,e):r&&r.pre||!n(l=ze(e.$options,"components",t))?new _e(t,r,a,void 0,void 0,e):un(l,r,e,a,t)):c=un(t,r,e,a);return Array.isArray(c)?c:n(c)?(n(u)&&pn(c,u),n(r)&&function(e){i(e.style)&&At(e.style),i(e.class)&&At(e.class)}(r),c):xe()}(e,t,a,s,c)}function pn(e,o,i){if(e.ns=o,"foreignObject"===e.tag&&(o=void 0,i=!0),n(e.children))for(var a=0,s=e.children.length;a<s;a++){var c=e.children[a];n(c.tag)&&(t(c.ns)||r(i)&&"svg"!==c.tag)&&pn(c,o,i)}}var dn,vn=null;function hn(e,t){return(e.__esModule||ce&&"Module"===e[Symbol.toStringTag])&&(e=e.default),i(e)?t.extend(e):e}function mn(e){return e.isComment&&e.asyncFactory}function yn(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var r=e[t];if(n(r)&&(n(r.componentOptions)||mn(r)))return r}}function gn(e,t){dn.$on(e,t)}function bn(e,t){dn.$off(e,t)}function wn(e,t){var n=dn;return function r(){var o=t.apply(null,arguments);null!==o&&n.$off(e,r)}}function xn(e,t,n){dn=e,jt(t,n||{},gn,bn,wn,e),dn=void 0}var $n=null,Cn=!1;function kn(e){var t=$n;return $n=e,function(){$n=t}}function An(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function On(e,t){if(t){if(e._directInactive=!1,An(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)On(e.$children[n]);Tn(e,"activated")}}function Sn(e,t){if(!(t&&(e._directInactive=!0,An(e))||e._inactive)){e._inactive=!0;for(var n=0;n<e.$children.length;n++)Sn(e.$children[n]);Tn(e,"deactivated")}}function Tn(e,t){ge();var n=e.$options[t],r=t+" hook";if(n)for(var o=0,i=n.length;o<i;o++)tt(n[o],e,null,e,r);e._hasHookEvent&&e.$emit("hook:"+t),be()}var jn=[],En=[],Mn={},Nn={},Pn=!1,In=!1,Ln=0,Dn=0,Rn=Date.now;if(J&&!X){var Fn=window.performance;Fn&&"function"==typeof Fn.now&&Rn()>document.createEvent("Event").timeStamp&&(Rn=function(){return Fn.now()})}function Un(){var e,t;for(Dn=Rn(),In=!0,jn.sort((function(e,t){return e.id-t.id})),Ln=0;Ln<jn.length;Ln++)if((e=jn[Ln]).before&&e.before(),t=e.id,Mn[t]=null,e.run(),null!=Mn[t]&&(Nn[t]=(Nn[t]||0)+1,Nn[t]>100)){ue("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var n=En.slice(),r=jn.slice();Ln=jn.length=En.length=0,Mn={},Nn={},Pn=In=!1,function(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,On(e[t],!0)}(n),function(e){for(var t=e.length;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Tn(r,"updated")}}(r),ie&&F.devtools&&ie.emit("flush")}var Hn=0,Vn=function(e,t,n,r,o){this.vm=e,o&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++Hn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new se,this.newDepIds=new se,this.expression=t.toString(),"function"==typeof t?this.getter=t:(this.getter=function(e){if(!q.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}(t),this.getter||(this.getter=j,ue('Failed watching path: "'+t+'" Watcher only accepts simple dot-delimited paths. For full control, use a function instead.',e))),this.value=this.lazy?void 0:this.get()};Vn.prototype.get=function(){var e;ge(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;et(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&At(e),be(),this.cleanupDeps()}return e},Vn.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},Vn.prototype.cleanupDeps=function(){for(var e=this.deps.length;e--;){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},Vn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(e){var t=e.id;if(null==Mn[t]){if(Mn[t]=!0,In){for(var n=jn.length-1;n>Ln&&jn[n].id>e.id;)n--;jn.splice(n+1,0,e)}else jn.push(e);if(!Pn){if(Pn=!0,!F.async)return void Un();ht(Un)}}}(this)},Vn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||i(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){et(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Vn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Vn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Vn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||y(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Bn={enumerable:!0,configurable:!0,get:j,set:j};function qn(e,t,n){Bn.get=function(){return this[t][n]},Bn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Bn)}var zn={lazy:!0};function Jn(e,t,n){var r=!oe();"function"==typeof n?(Bn.get=r?Gn(t):Kn(n),Bn.set=j):(Bn.get=n.get?r&&!1!==n.cache?Gn(t):Kn(n.get):j,Bn.set=n.set||j),Bn.set===j&&(Bn.set=function(){ue('Computed property "'+t+'" was assigned to but it has no setter.',this)}),Object.defineProperty(e,t,Bn)}function Gn(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),me.target&&t.depend(),t.value}}function Kn(e){return function(){return e.call(this,this)}}function Wn(e,t,n,r){return c(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}var Xn=0;function Zn(e){var t=e.options;if(e.super){var n=Zn(e.super);if(n!==e.superOptions){e.superOptions=n;var r=function(e){var t,n=e.options,r=e.sealedOptions;for(var o in n)n[o]!==r[o]&&(t||(t={}),t[o]=n[o]);return t}(e);r&&S(e.extendOptions,r),(t=e.options=qe(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function Yn(e){this instanceof Yn||ue("Vue is a constructor and should be called with the `new` keyword"),this._init(e)}function Qn(e){return e&&(e.Ctor.options.name||e.tag)}function er(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!u(e)&&e.test(t)}function tr(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=Qn(a.componentOptions);s&&!t(s)&&nr(n,i,r,o)}}}function nr(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,y(n,t)}!function(t){t.prototype._init=function(t){var n,r,o=this;o._uid=Xn++,F.performance&&it&&(n="vue-perf-start:"+o._uid,r="vue-perf-end:"+o._uid,it(n)),o._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(o,t):o.$options=qe(Zn(o.constructor),t||{},o),mt(o),o._self=o,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(o),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&xn(e,t)}(o),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,o=r&&r.context;t.$slots=Dt(n._renderChildren,o),t.$scopedSlots=e,t._c=function(e,n,r,o){return fn(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return fn(t,e,n,r,o,!0)};var i=r&&r.data;Me(t,"$attrs",i&&i.attrs||e,(function(){!Cn&&ue("$attrs is readonly.",t)}),!0),Me(t,"$listeners",n._parentListeners||e,(function(){!Cn&&ue("$listeners is readonly.",t)}),!0)}(o),Tn(o,"beforeCreate"),function(e){var t=Lt(e.$options.inject,e);t&&(Te(!1),Object.keys(t).forEach((function(n){Me(e,n,t[n],(function(){ue('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',e)}))})),Te(!0))}(o),function(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;i||Te(!1);var a=function(a){o.push(a);var s=Je(a,t,n,e),c=k(a);(m(c)||F.isReservedAttr(c))&&ue('"'+c+'" is a reserved attribute and cannot be used as component prop.',e),Me(r,a,s,(function(){i||Cn||ue("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',e)})),a in e||qn(e,"_props",a)};for(var s in t)a(s);Te(!0)}(e,t.props),t.methods&&function(e,t){var n=e.$options.props;for(var r in t)"function"!=typeof t[r]&&ue('Method "'+r+'" has type "'+typeof t[r]+'" in the component definition. Did you reference the function correctly?',e),n&&b(n,r)&&ue('Method "'+r+'" has already been defined as a prop.',e),r in e&&H(r)&&ue('Method "'+r+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),e[r]="function"!=typeof t[r]?j:A(t[r],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;c(t=e._data="function"==typeof t?function(e,t){ge();try{return e.call(t,t)}catch(e){return et(e,t,"data()"),{}}finally{be()}}(t,e):t||{})||(t={},ue("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));for(var n=Object.keys(t),r=e.$options.props,o=e.$options.methods,i=n.length;i--;){var a=n[i];o&&b(o,a)&&ue('Method "'+a+'" has already been defined as a data property.',e),r&&b(r,a)?ue('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',e):H(a)||qn(e,"_data",a)}Ee(t,!0)}(e):Ee(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=oe();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;null==a&&ue('Getter is missing for computed property "'+o+'".',e),r||(n[o]=new Vn(e,a||j,j,zn)),o in e?o in e.$data?ue('The computed property "'+o+'" is already defined in data.',e):e.$options.props&&o in e.$options.props&&ue('The computed property "'+o+'" is already defined as a prop.',e):Jn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==te&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o<r.length;o++)Wn(e,n,r[o]);else Wn(e,n,r)}}(e,t.watch)}(o),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(o),Tn(o,"created"),F.performance&&it&&(o._name=fe(o,!1),it(r),at("vue "+o._name+" init",n,r)),o.$options.el&&o.$mount(o.$options.el)}}(Yn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};t.set=function(){ue("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){ue("$props is readonly.",this)},Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Ne,e.prototype.$delete=Pe,e.prototype.$watch=function(e,t,n){var r=this;if(c(t))return Wn(r,e,t,n);(n=n||{}).user=!0;var o=new Vn(r,e,t,n);if(n.immediate)try{t.call(r,o.value)}catch(e){et(e,r,'callback for immediate watcher "'+o.expression+'"')}return function(){o.teardown()}}}(Yn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o<i;o++)r.$on(e[o],n);else(r._events[e]||(r._events[e]=[])).push(n),t.test(e)&&(r._hasHookEvent=!0);return r},e.prototype.$once=function(e,t){var n=this;function r(){n.$off(e,r),t.apply(n,arguments)}return r.fn=t,n.$on(e,r),n},e.prototype.$off=function(e,t){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(e)){for(var r=0,o=e.length;r<o;r++)n.$off(e[r],t);return n}var i,a=n._events[e];if(!a)return n;if(!t)return n._events[e]=null,n;for(var s=a.length;s--;)if((i=a[s])===t||i.fn===t){a.splice(s,1);break}return n},e.prototype.$emit=function(e){var t=this,n=e.toLowerCase();n!==e&&t._events[n]&&le('Event "'+n+'" is emitted in component '+fe(t)+' but the handler is registered for "'+e+'". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "'+k(e)+'" instead of "'+e+'".');var r=t._events[e];if(r){r=r.length>1?O(r):r;for(var o=O(arguments,1),i='event handler for "'+e+'"',a=0,s=r.length;a<s;a++)tt(r[a],t,o,t,i)}return t}}(Yn),function(e){e.prototype._update=function(e,t){var n=this,r=n.$el,o=n._vnode,i=kn(n);n._vnode=e,n.$el=o?n.__patch__(o,e):n.__patch__(n.$el,e,t,!1),i(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){Tn(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||y(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),Tn(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$vnode&&(e.$vnode.parent=null)}}}(Yn),function(e){nn(e.prototype),e.prototype.$nextTick=function(e){return ht(e,this)},e.prototype._render=function(){var e,t=this,n=t.$options,r=n.render,o=n._parentVnode;o&&(t.$scopedSlots=Ft(o.data.scopedSlots,t.$slots,t.$scopedSlots)),t.$vnode=o;try{vn=t,e=r.call(t._renderProxy,t.$createElement)}catch(n){if(et(n,t,"render"),t.$options.renderError)try{e=t.$options.renderError.call(t._renderProxy,t.$createElement,n)}catch(n){et(n,t,"renderError"),e=t._vnode}else e=t._vnode}finally{vn=null}return Array.isArray(e)&&1===e.length&&(e=e[0]),e instanceof _e||(Array.isArray(e)&&ue("Multiple root nodes returned from render function. Render function should return a single root node.",t),e=xe()),e.parent=o,e}}(Yn);var rr=[String,RegExp,Array],or={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:rr,exclude:rr,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)nr(this.cache,e,this.keys)},mounted:function(){var e=this;this.$watch("include",(function(t){tr(e,(function(e){return er(t,e)}))})),this.$watch("exclude",(function(t){tr(e,(function(e){return!er(t,e)}))}))},render:function(){var e=this.$slots.default,t=yn(e),n=t&&t.componentOptions;if(n){var r=Qn(n),o=this.include,i=this.exclude;if(o&&(!r||!er(o,r))||i&&r&&er(i,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,y(s,c),s.push(c)):(a[c]=t,s.push(c),this.max&&s.length>parseInt(this.max)&&nr(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F},set:function(){ue("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(e,"config",t),e.util={warn:ue,extend:S,mergeOptions:qe,defineReactive:Me},e.set=Ne,e.delete=Pe,e.nextTick=ht,e.observable=function(e){return Ee(e),e},e.options=Object.create(null),D.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,S(e.options.components,or),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=O(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=qe(this.options,e),this}}(e),function(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,o=e._Ctor||(e._Ctor={});if(o[r])return o[r];var i=e.name||n.options.name;i&&Ve(i);var a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=qe(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)qn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)Jn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,D.forEach((function(e){a[e]=n[e]})),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=S({},a.options),o[r]=a,a}}(e),function(e){D.forEach((function(t){e[t]=function(e,n){return n?("component"===t&&Ve(e),"component"===t&&c(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}}))}(e)}(Yn),Object.defineProperty(Yn.prototype,"$isServer",{get:oe}),Object.defineProperty(Yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Yn,"FunctionalRenderContext",{value:rn}),Yn.version="2.6.10";var ir=v("style,class"),ar=v("input,textarea,option,select,progress"),sr=function(e,t,n){return"value"===n&&ar(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},cr=v("contenteditable,draggable,spellcheck"),ur=v("events,caret,typing,plaintext-only"),lr=v("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),fr="http://www.w3.org/1999/xlink",pr=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},dr=function(e){return pr(e)?e.slice(6,e.length):""},vr=function(e){return null==e||!1===e};function hr(e,t){return{staticClass:mr(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function mr(e,t){return e?t?e+" "+t:e:t||""}function yr(e){return Array.isArray(e)?function(e){for(var t,r="",o=0,i=e.length;o<i;o++)n(t=yr(e[o]))&&""!==t&&(r&&(r+=" "),r+=t);return r}(e):i(e)?function(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}(e):"string"==typeof e?e:""}var gr={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},br=v("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),_r=v("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),wr=function(e){return br(e)||_r(e)};function xr(e){return _r(e)?"svg":"math"===e?"math":void 0}var $r=Object.create(null),Cr=v("text,number,password,search,email,tel,url");function kr(e){return"string"==typeof e?document.querySelector(e)||(ue("Cannot find element: "+e),document.createElement("div")):e}var Ar=Object.freeze({createElement:function(e,t){var n=document.createElement(e);return"select"!==e||t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n},createElementNS:function(e,t){return document.createElementNS(gr[e],t)},createTextNode:function(e){return document.createTextNode(e)},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t},setStyleScope:function(e,t){e.setAttribute(t,"")}}),Or={create:function(e,t){Sr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(Sr(e,!0),Sr(t))},destroy:function(e){Sr(e,!0)}};function Sr(e,t){var r=e.data.ref;if(n(r)){var o=e.context,i=e.componentInstance||e.elm,a=o.$refs;t?Array.isArray(a[r])?y(a[r],i):a[r]===i&&(a[r]=void 0):e.data.refInFor?Array.isArray(a[r])?a[r].indexOf(i)<0&&a[r].push(i):a[r]=[i]:a[r]=i}}var Tr=new _e("",{},[]),jr=["create","activate","update","remove","destroy"];function Er(e,o){return e.key===o.key&&(e.tag===o.tag&&e.isComment===o.isComment&&n(e.data)===n(o.data)&&function(e,t){if("input"!==e.tag)return!0;var r,o=n(r=e.data)&&n(r=r.attrs)&&r.type,i=n(r=t.data)&&n(r=r.attrs)&&r.type;return o===i||Cr(o)&&Cr(i)}(e,o)||r(e.isAsyncPlaceholder)&&e.asyncFactory===o.asyncFactory&&t(o.asyncFactory.error))}function Mr(e,t,r){var o,i,a={};for(o=t;o<=r;++o)n(i=e[o].key)&&(a[i]=o);return a}var Nr={create:Pr,update:Pr,destroy:function(e){Pr(e,Tr)}};function Pr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===Tr,a=t===Tr,s=Lr(e.data.directives,e.context),c=Lr(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,Rr(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(Rr(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var f=function(){for(var n=0;n<u.length;n++)Rr(u[n],"inserted",t,e)};i?Et(t,"insert",f):f()}if(l.length&&Et(t,"postpatch",(function(){for(var n=0;n<l.length;n++)Rr(l[n],"componentUpdated",t,e)})),!i)for(n in s)c[n]||Rr(s[n],"unbind",e,e,a)}(e,t)}var Ir=Object.create(null);function Lr(e,t){var n,r,o=Object.create(null);if(!e)return o;for(n=0;n<e.length;n++)(r=e[n]).modifiers||(r.modifiers=Ir),o[Dr(r)]=r,r.def=ze(t.$options,"directives",r.name,!0);return o}function Dr(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function Rr(e,t,n,r,o){var i=e.def&&e.def[t];if(i)try{i(n.elm,e,n,r,o)}catch(r){et(r,n.context,"directive "+e.name+" "+t+" hook")}}var Fr=[Or,Nr];function Ur(e,r){var o=r.componentOptions;if(!(n(o)&&!1===o.Ctor.options.inheritAttrs||t(e.data.attrs)&&t(r.data.attrs))){var i,a,s=r.elm,c=e.data.attrs||{},u=r.data.attrs||{};for(i in n(u.__ob__)&&(u=r.data.attrs=S({},u)),u)a=u[i],c[i]!==a&&Hr(s,i,a);for(i in(X||Y)&&u.value!==c.value&&Hr(s,"value",u.value),c)t(u[i])&&(pr(i)?s.removeAttributeNS(fr,dr(i)):cr(i)||s.removeAttribute(i))}}function Hr(e,t,n){e.tagName.indexOf("-")>-1?Vr(e,t,n):lr(t)?vr(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):cr(t)?e.setAttribute(t,function(e,t){return vr(t)||"false"===t?"false":"contenteditable"===e&&ur(t)?t:"true"}(t,n)):pr(t)?vr(n)?e.removeAttributeNS(fr,dr(t)):e.setAttributeNS(fr,t,n):Vr(e,t,n)}function Vr(e,t,n){if(vr(n))e.removeAttribute(t);else{if(X&&!Z&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var Br={create:Ur,update:Ur};function qr(e,r){var o=r.elm,i=r.data,a=e.data;if(!(t(i.staticClass)&&t(i.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=function(e){for(var t=e.data,r=e,o=e;n(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(t=hr(o.data,t));for(;n(r=r.parent);)r&&r.data&&(t=hr(t,r.data));return i=t.staticClass,a=t.class,n(i)||n(a)?mr(i,yr(a)):"";var i,a}(r),c=o._transitionClasses;n(c)&&(s=mr(s,yr(c))),s!==o._prevClass&&(o.setAttribute("class",s),o._prevClass=s)}}var zr,Jr,Gr,Kr,Wr,Xr,Zr,Yr={create:qr,update:qr},Qr=/[\w).+\-_$\]]/;function eo(e){var t,n,r,o,i,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r<e.length;r++)if(n=t,t=e.charCodeAt(r),a)39===t&&92!==n&&(a=!1);else if(s)34===t&&92!==n&&(s=!1);else if(c)96===t&&92!==n&&(c=!1);else if(u)47===t&&92!==n&&(u=!1);else if(124!==t||124===e.charCodeAt(r+1)||124===e.charCodeAt(r-1)||l||f||p){switch(t){case 34:s=!0;break;case 39:a=!0;break;case 96:c=!0;break;case 40:p++;break;case 41:p--;break;case 91:f++;break;case 93:f--;break;case 123:l++;break;case 125:l--}if(47===t){for(var v=r-1,h=void 0;v>=0&&" "===(h=e.charAt(v));v--);h&&Qr.test(h)||(u=!0)}}else void 0===o?(d=r+1,o=e.slice(0,r).trim()):m();function m(){(i||(i=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===o?o=e.slice(0,r).trim():0!==d&&m(),i)for(r=0;r<i.length;r++)o=to(o,i[r]);return o}function to(e,t){var n=t.indexOf("(");if(n<0)return'_f("'+t+'")('+e+")";var r=t.slice(0,n),o=t.slice(n+1);return'_f("'+r+'")('+e+(")"!==o?","+o:o)}function no(e,t){console.error("[Vue compiler]: "+e)}function ro(e,t){return e?e.map((function(e){return e[t]})).filter((function(e){return e})):[]}function oo(e,t,n,r,o){(e.props||(e.props=[])).push(ho({name:t,value:n,dynamic:o},r)),e.plain=!1}function io(e,t,n,r,o){(o?e.dynamicAttrs||(e.dynamicAttrs=[]):e.attrs||(e.attrs=[])).push(ho({name:t,value:n,dynamic:o},r)),e.plain=!1}function ao(e,t,n,r){e.attrsMap[t]=n,e.attrsList.push(ho({name:t,value:n},r))}function so(e,t,n,r,o,i,a,s){(e.directives||(e.directives=[])).push(ho({name:t,rawName:n,value:r,arg:o,isDynamicArg:i,modifiers:a},s)),e.plain=!1}function co(e,t,n){return n?"_p("+t+',"'+e+'")':e+t}function uo(t,n,r,o,i,a,s,c){var u;o=o||e,a&&o.prevent&&o.passive&&a("passive and prevent can't be used together. Passive handler can't prevent default event.",s),o.right?c?n="("+n+")==='click'?'contextmenu':("+n+")":"click"===n&&(n="contextmenu",delete o.right):o.middle&&(c?n="("+n+")==='click'?'mouseup':("+n+")":"click"===n&&(n="mouseup")),o.capture&&(delete o.capture,n=co("!",n,c)),o.once&&(delete o.once,n=co("~",n,c)),o.passive&&(delete o.passive,n=co("&",n,c)),o.native?(delete o.native,u=t.nativeEvents||(t.nativeEvents={})):u=t.events||(t.events={});var l=ho({value:r.trim(),dynamic:c},s);o!==e&&(l.modifiers=o);var f=u[n];Array.isArray(f)?i?f.unshift(l):f.push(l):u[n]=f?i?[l,f]:[f,l]:l,t.plain=!1}function lo(e,t){return e.rawAttrsMap[":"+t]||e.rawAttrsMap["v-bind:"+t]||e.rawAttrsMap[t]}function fo(e,t,n){var r=po(e,":"+t)||po(e,"v-bind:"+t);if(null!=r)return eo(r);if(!1!==n){var o=po(e,t);if(null!=o)return JSON.stringify(o)}}function po(e,t,n){var r;if(null!=(r=e.attrsMap[t]))for(var o=e.attrsList,i=0,a=o.length;i<a;i++)if(o[i].name===t){o.splice(i,1);break}return n&&delete e.attrsMap[t],r}function vo(e,t){for(var n=e.attrsList,r=0,o=n.length;r<o;r++){var i=n[r];if(t.test(i.name))return n.splice(r,1),i}}function ho(e,t){return t&&(null!=t.start&&(e.start=t.start),null!=t.end&&(e.end=t.end)),e}function mo(e,t,n){var r=n||{},o=r.number,i="$$v";r.trim&&(i="(typeof $$v === 'string'? $$v.trim(): $$v)"),o&&(i="_n("+i+")");var a=yo(t,i);e.model={value:"("+t+")",expression:JSON.stringify(t),callback:"function ($$v) {"+a+"}"}}function yo(e,t){var n=function(e){if(e=e.trim(),zr=e.length,e.indexOf("[")<0||e.lastIndexOf("]")<zr-1)return(Kr=e.lastIndexOf("."))>-1?{exp:e.slice(0,Kr),key:'"'+e.slice(Kr+1)+'"'}:{exp:e,key:null};for(Jr=e,Kr=Wr=Xr=0;!bo();)_o(Gr=go())?xo(Gr):91===Gr&&wo(Gr);return{exp:e.slice(0,Wr),key:e.slice(Wr+1,Xr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function go(){return Jr.charCodeAt(++Kr)}function bo(){return Kr>=zr}function _o(e){return 34===e||39===e}function wo(e){var t=1;for(Wr=Kr;!bo();)if(_o(e=go()))xo(e);else if(91===e&&t++,93===e&&t--,0===t){Xr=Kr;break}}function xo(e){for(var t=e;!bo()&&(e=go())!==t;);}var $o;function Co(e,t,n){var r=$o;return function o(){var i=t.apply(null,arguments);null!==i&&Oo(e,o,n,r)}}var ko=st&&!(ee&&Number(ee[1])<=53);function Ao(e,t,n,r){if(ko){var o=Dn,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=o||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}$o.addEventListener(e,t,ne?{capture:n,passive:r}:n)}function Oo(e,t,n,r){(r||$o).removeEventListener(e,t._wrapper||t,n)}function So(e,r){if(!t(e.data.on)||!t(r.data.on)){var o=r.data.on||{},i=e.data.on||{};$o=r.elm,function(e){if(n(e.__r)){var t=X?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}n(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(o),jt(o,i,Ao,Oo,Co,r.context),$o=void 0}}var To,jo={create:So,update:So};function Eo(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var o,i,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(o in n(c.__ob__)&&(c=r.data.domProps=S({},c)),s)o in c||(a[o]="");for(o in c){if(i=c[o],"textContent"===o||"innerHTML"===o){if(r.children&&(r.children.length=0),i===s[o])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===o&&"PROGRESS"!==a.tagName){a._value=i;var u=t(i)?"":String(i);Mo(a,u)&&(a.value=u)}else if("innerHTML"===o&&_r(a.tagName)&&t(a.innerHTML)){(To=To||document.createElement("div")).innerHTML="<svg>"+i+"</svg>";for(var l=To.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(i!==s[o])try{a[o]=i}catch(e){}}}}function Mo(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,o=e._vModifiers;if(n(o)){if(o.number)return d(r)!==d(t);if(o.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var No={create:Eo,update:Eo},Po=_((function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}})),t}));function Io(e){var t=Lo(e.style);return e.staticStyle?S(e.staticStyle,t):t}function Lo(e){return Array.isArray(e)?T(e):"string"==typeof e?Po(e):e}var Do,Ro=/^--/,Fo=/\s*!important$/,Uo=function(e,t,n){if(Ro.test(t))e.style.setProperty(t,n);else if(Fo.test(n))e.style.setProperty(k(t),n.replace(Fo,""),"important");else{var r=Vo(t);if(Array.isArray(n))for(var o=0,i=n.length;o<i;o++)e.style[r]=n[o];else e.style[r]=n}},Ho=["Webkit","Moz","ms"],Vo=_((function(e){if(Do=Do||document.createElement("div").style,"filter"!==(e=x(e))&&e in Do)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<Ho.length;n++){var r=Ho[n]+t;if(r in Do)return r}}));function Bo(e,r){var o=r.data,i=e.data;if(!(t(o.staticStyle)&&t(o.style)&&t(i.staticStyle)&&t(i.style))){var a,s,c=r.elm,u=i.staticStyle,l=i.normalizedStyle||i.style||{},f=u||l,p=Lo(r.data.style)||{};r.data.normalizedStyle=n(p.__ob__)?S({},p):p;var d=function(e,t){for(var n,r={},o=e;o.componentInstance;)(o=o.componentInstance._vnode)&&o.data&&(n=Io(o.data))&&S(r,n);(n=Io(e.data))&&S(r,n);for(var i=e;i=i.parent;)i.data&&(n=Io(i.data))&&S(r,n);return r}(r);for(s in f)t(d[s])&&Uo(c,s,"");for(s in d)(a=d[s])!==f[s]&&Uo(c,s,null==a?"":a)}}var qo={create:Bo,update:Bo},zo=/\s+/;function Jo(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(zo).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Go(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(zo).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function Ko(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&S(t,Wo(e.name||"v")),S(t,e),t}return"string"==typeof e?Wo(e):void 0}}var Wo=_((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),Xo=J&&!Z,Zo="transition",Yo="animation",Qo="transition",ei="transitionend",ti="animation",ni="animationend";Xo&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Qo="WebkitTransition",ei="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(ti="WebkitAnimation",ni="webkitAnimationEnd"));var ri=J?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function oi(e){ri((function(){ri(e)}))}function ii(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),Jo(e,t))}function ai(e,t){e._transitionClasses&&y(e._transitionClasses,t),Go(e,t)}function si(e,t,n){var r=ui(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Zo?ei:ni,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout((function(){c<a&&u()}),i+1),e.addEventListener(s,l)}var ci=/\b(transform|all)(,|$)/;function ui(e,t){var n,r=window.getComputedStyle(e),o=(r[Qo+"Delay"]||"").split(", "),i=(r[Qo+"Duration"]||"").split(", "),a=li(o,i),s=(r[ti+"Delay"]||"").split(", "),c=(r[ti+"Duration"]||"").split(", "),u=li(s,c),l=0,f=0;return t===Zo?a>0&&(n=Zo,l=a,f=i.length):t===Yo?u>0&&(n=Yo,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Zo:Yo:null)?n===Zo?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Zo&&ci.test(r[Qo+"Property"])}}function li(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map((function(t,n){return fi(t)+fi(e[n])})))}function fi(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}function pi(e,r){var o=e.elm;n(o._leaveCb)&&(o._leaveCb.cancelled=!0,o._leaveCb());var a=Ko(e.data.transition);if(!t(a)&&!n(o._enterCb)&&1===o.nodeType){for(var s=a.css,c=a.type,u=a.enterClass,l=a.enterToClass,f=a.enterActiveClass,p=a.appearClass,v=a.appearToClass,h=a.appearActiveClass,m=a.beforeEnter,y=a.enter,g=a.afterEnter,b=a.enterCancelled,_=a.beforeAppear,w=a.appear,x=a.afterAppear,$=a.appearCancelled,C=a.duration,k=$n,A=$n.$vnode;A&&A.parent;)k=A.context,A=A.parent;var O=!k._isMounted||!e.isRootInsert;if(!O||w||""===w){var S=O&&p?p:u,T=O&&h?h:f,j=O&&v?v:l,E=O&&_||m,M=O&&"function"==typeof w?w:y,N=O&&x||g,P=O&&$||b,L=d(i(C)?C.enter:C);null!=L&&vi(L,"enter",e);var D=!1!==s&&!Z,R=mi(M),F=o._enterCb=I((function(){D&&(ai(o,j),ai(o,T)),F.cancelled?(D&&ai(o,S),P&&P(o)):N&&N(o),o._enterCb=null}));e.data.show||Et(e,"insert",(function(){var t=o.parentNode,n=t&&t._pending&&t._pending[e.key];n&&n.tag===e.tag&&n.elm._leaveCb&&n.elm._leaveCb(),M&&M(o,F)})),E&&E(o),D&&(ii(o,S),ii(o,T),oi((function(){ai(o,S),F.cancelled||(ii(o,j),R||(hi(L)?setTimeout(F,L):si(o,c,F)))}))),e.data.show&&(r&&r(),M&&M(o,F)),D||R||F()}}}function di(e,r){var o=e.elm;n(o._enterCb)&&(o._enterCb.cancelled=!0,o._enterCb());var a=Ko(e.data.transition);if(t(a)||1!==o.nodeType)return r();if(!n(o._leaveCb)){var s=a.css,c=a.type,u=a.leaveClass,l=a.leaveToClass,f=a.leaveActiveClass,p=a.beforeLeave,v=a.leave,h=a.afterLeave,m=a.leaveCancelled,y=a.delayLeave,g=a.duration,b=!1!==s&&!Z,_=mi(v),w=d(i(g)?g.leave:g);n(w)&&vi(w,"leave",e);var x=o._leaveCb=I((function(){o.parentNode&&o.parentNode._pending&&(o.parentNode._pending[e.key]=null),b&&(ai(o,l),ai(o,f)),x.cancelled?(b&&ai(o,u),m&&m(o)):(r(),h&&h(o)),o._leaveCb=null}));y?y($):$()}function $(){x.cancelled||(!e.data.show&&o.parentNode&&((o.parentNode._pending||(o.parentNode._pending={}))[e.key]=e),p&&p(o),b&&(ii(o,u),ii(o,f),oi((function(){ai(o,u),x.cancelled||(ii(o,l),_||(hi(w)?setTimeout(x,w):si(o,c,x)))}))),v&&v(o,x),b||_||x())}}function vi(e,t,n){"number"!=typeof e?ue("<transition> explicit "+t+" duration is not a valid number - got "+JSON.stringify(e)+".",n.context):isNaN(e)&&ue("<transition> explicit "+t+" duration is NaN - the duration expression might be incorrect.",n.context)}function hi(e){return"number"==typeof e&&!isNaN(e)}function mi(e){if(t(e))return!1;var r=e.fns;return n(r)?mi(Array.isArray(r)?r[0]:r):(e._length||e.length)>1}function yi(e,t){!0!==t.data.show&&pi(t)}var gi=function(e){var i,a,s={},c=e.modules,l=e.nodeOps;for(i=0;i<jr.length;++i)for(s[jr[i]]=[],a=0;a<c.length;++a)n(c[a][jr[i]])&&s[jr[i]].push(c[a][jr[i]]);function f(e){var t=l.parentNode(e);n(t)&&l.removeChild(t,e)}function p(e,t){return!t&&!e.ns&&!(F.ignoredElements.length&&F.ignoredElements.some((function(t){return u(t)?t.test(e.tag):t===e.tag})))&&F.isUnknownElement(e.tag)}var d=0;function h(e,t,o,i,a,c,u){if(n(e.elm)&&n(c)&&(e=c[u]=Ce(e)),e.isRootInsert=!a,!function(e,t,o,i){var a=e.data;if(n(a)){var c=n(e.componentInstance)&&a.keepAlive;if(n(a=a.hook)&&n(a=a.init)&&a(e,!1),n(e.componentInstance))return m(e,t),y(o,e.elm,i),r(c)&&function(e,t,r,o){for(var i,a=e;a.componentInstance;)if(n(i=(a=a.componentInstance._vnode).data)&&n(i=i.transition)){for(i=0;i<s.activate.length;++i)s.activate[i](Tr,a);t.push(a);break}y(r,e.elm,o)}(e,t,o,i),!0}}(e,t,o,i)){var f=e.data,v=e.children,h=e.tag;n(h)?(f&&f.pre&&d++,p(e,d)&&ue("Unknown custom element: <"+h+'> - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context),e.elm=e.ns?l.createElementNS(e.ns,h):l.createElement(h,e),w(e),g(e,v,t),n(f)&&_(e,t),y(o,e.elm,i),f&&f.pre&&d--):r(e.isComment)?(e.elm=l.createComment(e.text),y(o,e.elm,i)):(e.elm=l.createTextNode(e.text),y(o,e.elm,i))}}function m(e,t){n(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,b(e)?(_(e,t),w(e)):(Sr(e),t.push(e))}function y(e,t,r){n(e)&&(n(r)?l.parentNode(r)===e&&l.insertBefore(e,t,r):l.appendChild(e,t))}function g(e,t,n){if(Array.isArray(t)){A(t);for(var r=0;r<t.length;++r)h(t[r],n,e.elm,null,!0,t,r)}else o(e.text)&&l.appendChild(e.elm,l.createTextNode(String(e.text)))}function b(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return n(e.tag)}function _(e,t){for(var r=0;r<s.create.length;++r)s.create[r](Tr,e);n(i=e.data.hook)&&(n(i.create)&&i.create(Tr,e),n(i.insert)&&t.push(e))}function w(e){var t;if(n(t=e.fnScopeId))l.setStyleScope(e.elm,t);else for(var r=e;r;)n(t=r.context)&&n(t=t.$options._scopeId)&&l.setStyleScope(e.elm,t),r=r.parent;n(t=$n)&&t!==e.context&&t!==e.fnContext&&n(t=t.$options._scopeId)&&l.setStyleScope(e.elm,t)}function x(e,t,n,r,o,i){for(;r<=o;++r)h(n[r],i,e,t,!1,n,r)}function $(e){var t,r,o=e.data;if(n(o))for(n(t=o.hook)&&n(t=t.destroy)&&t(e),t=0;t<s.destroy.length;++t)s.destroy[t](e);if(n(t=e.children))for(r=0;r<e.children.length;++r)$(e.children[r])}function C(e,t,r,o){for(;r<=o;++r){var i=t[r];n(i)&&(n(i.tag)?(k(i),$(i)):f(i.elm))}}function k(e,t){if(n(t)||n(e.data)){var r,o=s.remove.length+1;for(n(t)?t.listeners+=o:t=function(e,t){function n(){0==--n.listeners&&f(e)}return n.listeners=t,n}(e.elm,o),n(r=e.componentInstance)&&n(r=r._vnode)&&n(r.data)&&k(r,t),r=0;r<s.remove.length;++r)s.remove[r](e,t);n(r=e.data.hook)&&n(r=r.remove)?r(e,t):t()}else f(e.elm)}function A(e){for(var t={},r=0;r<e.length;r++){var o=e[r],i=o.key;n(i)&&(t[i]?ue("Duplicate keys detected: '"+i+"'. This may cause an update error.",o.context):t[i]=!0)}}function O(e,t,r,o){for(var i=r;i<o;i++){var a=t[i];if(n(a)&&Er(e,a))return i}}function S(e,o,i,a,c,u){if(e!==o){n(o.elm)&&n(a)&&(o=a[c]=Ce(o));var f=o.elm=e.elm;if(r(e.isAsyncPlaceholder))n(o.asyncFactory.resolved)?M(e.elm,o,i):o.isAsyncPlaceholder=!0;else if(r(o.isStatic)&&r(e.isStatic)&&o.key===e.key&&(r(o.isCloned)||r(o.isOnce)))o.componentInstance=e.componentInstance;else{var p,d=o.data;n(d)&&n(p=d.hook)&&n(p=p.prepatch)&&p(e,o);var v=e.children,m=o.children;if(n(d)&&b(o)){for(p=0;p<s.update.length;++p)s.update[p](e,o);n(p=d.hook)&&n(p=p.update)&&p(e,o)}t(o.text)?n(v)&&n(m)?v!==m&&function(e,r,o,i,a){var s,c,u,f=0,p=0,d=r.length-1,v=r[0],m=r[d],y=o.length-1,g=o[0],b=o[y],_=!a;for(A(o);f<=d&&p<=y;)t(v)?v=r[++f]:t(m)?m=r[--d]:Er(v,g)?(S(v,g,i,o,p),v=r[++f],g=o[++p]):Er(m,b)?(S(m,b,i,o,y),m=r[--d],b=o[--y]):Er(v,b)?(S(v,b,i,o,y),_&&l.insertBefore(e,v.elm,l.nextSibling(m.elm)),v=r[++f],b=o[--y]):Er(m,g)?(S(m,g,i,o,p),_&&l.insertBefore(e,m.elm,v.elm),m=r[--d],g=o[++p]):(t(s)&&(s=Mr(r,f,d)),t(c=n(g.key)?s[g.key]:O(g,r,f,d))?h(g,i,e,v.elm,!1,o,p):Er(u=r[c],g)?(S(u,g,i,o,p),r[c]=void 0,_&&l.insertBefore(e,u.elm,v.elm)):h(g,i,e,v.elm,!1,o,p),g=o[++p]);f>d?x(e,t(o[y+1])?null:o[y+1].elm,o,p,y,i):p>y&&C(0,r,f,d)}(f,v,m,i,u):n(m)?(A(m),n(e.text)&&l.setTextContent(f,""),x(f,null,m,0,m.length-1,i)):n(v)?C(0,v,0,v.length-1):n(e.text)&&l.setTextContent(f,""):e.text!==o.text&&l.setTextContent(f,o.text),n(d)&&n(p=d.hook)&&n(p=p.postpatch)&&p(e,o)}}}function T(e,t,o){if(r(o)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var i=0;i<t.length;++i)t[i].data.hook.insert(t[i])}var j=!1,E=v("attrs,class,staticClass,staticStyle,key");function M(e,t,o,i){var a,s=t.tag,c=t.data,u=t.children;if(i=i||c&&c.pre,t.elm=e,r(t.isComment)&&n(t.asyncFactory))return t.isAsyncPlaceholder=!0,!0;if(!function(e,t,r){return n(t.tag)?0===t.tag.indexOf("vue-component")||!p(t,r)&&t.tag.toLowerCase()===(e.tagName&&e.tagName.toLowerCase()):e.nodeType===(t.isComment?8:3)}(e,t,i))return!1;if(n(c)&&(n(a=c.hook)&&n(a=a.init)&&a(t,!0),n(a=t.componentInstance)))return m(t,o),!0;if(n(s)){if(n(u))if(e.hasChildNodes())if(n(a=c)&&n(a=a.domProps)&&n(a=a.innerHTML)){if(a!==e.innerHTML)return"undefined"==typeof console||j||(j=!0,console.warn("Parent: ",e),console.warn("server innerHTML: ",a),console.warn("client innerHTML: ",e.innerHTML)),!1}else{for(var l=!0,f=e.firstChild,d=0;d<u.length;d++){if(!f||!M(f,u[d],o,i)){l=!1;break}f=f.nextSibling}if(!l||f)return"undefined"==typeof console||j||(j=!0,console.warn("Parent: ",e),console.warn("Mismatching childNodes vs. VNodes: ",e.childNodes,u)),!1}else g(t,u,o);if(n(c)){var v=!1;for(var h in c)if(!E(h)){v=!0,_(t,o);break}!v&&c.class&&At(c.class)}}else e.data!==t.text&&(e.data=t.text);return!0}return function(e,o,i,a){if(!t(o)){var c,u=!1,f=[];if(t(e))u=!0,h(o,f);else{var p=n(e.nodeType);if(!p&&Er(e,o))S(e,o,f,null,null,a);else{if(p){if(1===e.nodeType&&e.hasAttribute(L)&&(e.removeAttribute(L),i=!0),r(i)){if(M(e,o,f))return T(o,f,!0),e;ue("The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.")}c=e,e=new _e(l.tagName(c).toLowerCase(),{},[],void 0,c)}var d=e.elm,v=l.parentNode(d);if(h(o,f,d._leaveCb?null:v,l.nextSibling(d)),n(o.parent))for(var m=o.parent,y=b(o);m;){for(var g=0;g<s.destroy.length;++g)s.destroy[g](m);if(m.elm=o.elm,y){for(var _=0;_<s.create.length;++_)s.create[_](Tr,m);var w=m.data.hook.insert;if(w.merged)for(var x=1;x<w.fns.length;x++)w.fns[x]()}else Sr(m);m=m.parent}n(v)?C(0,[e],0,0):n(e.tag)&&$(e)}}return T(o,f,u),o.elm}n(e)&&$(e)}}({nodeOps:Ar,modules:[Br,Yr,jo,No,qo,J?{create:yi,activate:yi,remove:function(e,t){!0!==e.data.show?di(e,t):t()}}:{}].concat(Fr)});Z&&document.addEventListener("selectionchange",(function(){var e=document.activeElement;e&&e.vmodel&&Ai(e,"input")}));var bi={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?Et(n,"postpatch",(function(){bi.componentUpdated(e,t,n)})):_i(e,t,n.context),e._vOptions=[].map.call(e.options,$i)):("textarea"===n.tag||Cr(e.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||(e.addEventListener("compositionstart",Ci),e.addEventListener("compositionend",ki),e.addEventListener("change",ki),Z&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){_i(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,$i);o.some((function(e,t){return!N(e,r[t])}))&&(e.multiple?t.value.some((function(e){return xi(e,o)})):t.value!==t.oldValue&&xi(t.value,o))&&Ai(e,"change")}}};function _i(e,t,n){wi(e,t,n),(X||Y)&&setTimeout((function(){wi(e,t,n)}),0)}function wi(e,t,n){var r=t.value,o=e.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,c=e.options.length;s<c;s++)if(a=e.options[s],o)i=P(r,$i(a))>-1,a.selected!==i&&(a.selected=i);else if(N($i(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}else ue('<select multiple v-model="'+t.expression+'"> expects an Array value for its binding, but got '+Object.prototype.toString.call(r).slice(8,-1),n)}function xi(e,t){return t.every((function(t){return!N(t,e)}))}function $i(e){return"_value"in e?e._value:e.value}function Ci(e){e.target.composing=!0}function ki(e){e.target.composing&&(e.target.composing=!1,Ai(e.target,"input"))}function Ai(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Oi(e){return!e.componentInstance||e.data&&e.data.transition?e:Oi(e.componentInstance._vnode)}var Si={bind:function(e,t,n){var r=t.value,o=(n=Oi(n)).data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o?(n.data.show=!0,pi(n,(function(){e.style.display=i}))):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Oi(n)).data&&n.data.transition?(n.data.show=!0,r?pi(n,(function(){e.style.display=e.__vOriginalDisplay})):di(n,(function(){e.style.display="none"}))):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}},Ti={model:bi,show:Si},ji={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Ei(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Ei(yn(t.children)):e}function Mi(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[x(i)]=o[i];return t}function Ni(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var Pi=function(e){return e.tag||mn(e)},Ii=function(e){return"show"===e.name},Li={name:"transition",props:ji,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(Pi)).length){n.length>1&&ue("<transition> can only be used on a single element. Use <transition-group> for lists.",this.$parent);var r=this.mode;r&&"in-out"!==r&&"out-in"!==r&&ue("invalid <transition> mode: "+r,this.$parent);var i=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return i;var a=Ei(i);if(!a)return i;if(this._leaving)return Ni(e,i);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:o(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=Mi(this),u=this._vnode,l=Ei(u);if(a.data.directives&&a.data.directives.some(Ii)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!mn(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=S({},c);if("out-in"===r)return this._leaving=!0,Et(f,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),Ni(e,i);if("in-out"===r){if(mn(a))return u;var p,d=function(){p()};Et(c,"afterEnter",d),Et(c,"enterCancelled",d),Et(f,"delayLeave",(function(e){p=e}))}}return i}}},Di=S({tag:String,moveClass:String},ji);delete Di.mode;var Ri={props:Di,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var o=kn(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,o(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=Mi(this),s=0;s<o.length;s++){var c=o[s];if(c.tag)if(null!=c.key&&0!==String(c.key).indexOf("__vlist"))i.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a;else{var u=c.componentOptions,l=u?u.Ctor.options.name||u.tag||"":c.tag;ue("<transition-group> children must be keyed: <"+l+">")}}if(r){for(var f=[],p=[],d=0;d<r.length;d++){var v=r[d];v.data.transition=a,v.data.pos=v.elm.getBoundingClientRect(),n[v.key]?f.push(v):p.push(v)}this.kept=e(t,null,f),this.removed=p}return e(t,null,i)},updated:function(){var e=this.prevChildren,t=this.moveClass||(this.name||"v")+"-move";e.length&&this.hasMove(e[0].elm,t)&&(e.forEach(Fi),e.forEach(Ui),e.forEach(Hi),this._reflow=document.body.offsetHeight,e.forEach((function(e){if(e.data.moved){var n=e.elm,r=n.style;ii(n,t),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(ei,n._moveCb=function e(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(ei,e),n._moveCb=null,ai(n,t))})}})))},methods:{hasMove:function(e,t){if(!Xo)return!1;if(this._hasMove)return this._hasMove;var n=e.cloneNode();e._transitionClasses&&e._transitionClasses.forEach((function(e){Go(n,e)})),Jo(n,t),n.style.display="none",this.$el.appendChild(n);var r=ui(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}};function Fi(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function Ui(e){e.data.newPos=e.elm.getBoundingClientRect()}function Hi(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,o=t.top-n.top;if(r||o){e.data.moved=!0;var i=e.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}var Vi={Transition:Li,TransitionGroup:Ri};Yn.config.mustUseProp=sr,Yn.config.isReservedTag=wr,Yn.config.isReservedAttr=ir,Yn.config.getTagNamespace=xr,Yn.config.isUnknownElement=function(e){if(!J)return!0;if(wr(e))return!1;if(e=e.toLowerCase(),null!=$r[e])return $r[e];var t=document.createElement(e);return e.indexOf("-")>-1?$r[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:$r[e]=/HTMLUnknownElement/.test(t.toString())},S(Yn.options.directives,Ti),S(Yn.options.components,Vi),Yn.prototype.__patch__=J?gi:j,Yn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=xe,e.$options.template&&"#"!==e.$options.template.charAt(0)||e.$options.el||t?ue("You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.",e):ue("Failed to mount component: template or render function not defined.",e)),Tn(e,"beforeMount"),r=F.performance&&it?function(){var t=e._name,r=e._uid,o="vue-perf-start:"+r,i="vue-perf-end:"+r;it(o);var a=e._render();it(i),at("vue "+t+" render",o,i),it(o),e._update(a,n),it(i),at("vue "+t+" patch",o,i)}:function(){e._update(e._render(),n)},new Vn(e,r,j,{before:function(){e._isMounted&&!e._isDestroyed&&Tn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Tn(e,"mounted")),e}(this,e=e&&J?kr(e):void 0,t)},J&&setTimeout((function(){F.devtools&&(ie?ie.emit("init",Yn):console[console.info?"info":"log"]("Download the Vue Devtools extension for a better development experience:\nhttps://github.com/vuejs/vue-devtools")),!1!==F.productionTip&&"undefined"!=typeof console&&console[console.info?"info":"log"]("You are running Vue in development mode.\nMake sure to turn on production mode when deploying for production.\nSee more tips at https://vuejs.org/guide/deployment.html")}),0);var Bi=/\{\{((?:.|\r?\n)+?)\}\}/g,qi=/[-.*+?^${}()|[\]\/\\]/g,zi=_((function(e){var t=e[0].replace(qi,"\\$&"),n=e[1].replace(qi,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")}));function Ji(e,t){var n=t?zi(t):Bi;if(n.test(e)){for(var r,o,i,a=[],s=[],c=n.lastIndex=0;r=n.exec(e);){(o=r.index)>c&&(s.push(i=e.slice(c,o)),a.push(JSON.stringify(i)));var u=eo(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=o+r[0].length}return c<e.length&&(s.push(i=e.slice(c)),a.push(JSON.stringify(i))),{expression:a.join("+"),tokens:s}}}var Gi,Ki={staticKeys:["staticClass"],transformNode:function(e,t){var n=t.warn||no,r=po(e,"class");r&&Ji(r,t.delimiters)&&n('class="'+r+'": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div class="{{ val }}">, use <div :class="val">.',e.rawAttrsMap.class),r&&(e.staticClass=JSON.stringify(r));var o=fo(e,"class",!1);o&&(e.classBinding=o)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}},Wi={staticKeys:["staticStyle"],transformNode:function(e,t){var n=t.warn||no,r=po(e,"style");r&&(Ji(r,t.delimiters)&&n('style="'+r+'": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div style="{{ val }}">, use <div :style="val">.',e.rawAttrsMap.style),e.staticStyle=JSON.stringify(Po(r)));var o=fo(e,"style",!1);o&&(e.styleBinding=o)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},Xi=v("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),Zi=v("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),Yi=v("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),Qi=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ea=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ta="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+U.source+"]*",na="((?:"+ta+"\\:)?"+ta+")",ra=new RegExp("^<"+na),oa=/^\s*(\/?)>/,ia=new RegExp("^<\\/"+na+"[^>]*>"),aa=/^<!DOCTYPE [^>]+>/i,sa=/^<!\--/,ca=/^<!\[/,ua=v("script,style,textarea",!0),la={},fa={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t","&#39;":"'"},pa=/&(?:lt|gt|quot|amp|#39);/g,da=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,va=v("pre,textarea",!0),ha=function(e,t){return e&&va(e)&&"\n"===t[0]};function ma(e,t){var n=t?da:pa;return e.replace(n,(function(e){return fa[e]}))}var ya,ga,ba,_a,wa,xa,$a,Ca,ka,Aa=/^@|^v-on:/,Oa=/^v-|^@|^:/,Sa=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ta=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ja=/^\(|\)$/g,Ea=/^\[.*\]$/,Ma=/:(.*)$/,Na=/^:|^\.|^v-bind:/,Pa=/\.[^.\]]+(?=[^\]]*$)/g,Ia=/^v-slot(:|$)|^#/,La=/[\r\n]/,Da=/\s+/g,Ra=/[\s"'<>\/=]/,Fa=_((function(e){return(Gi=Gi||document.createElement("div")).innerHTML=e,Gi.textContent})),Ua="_empty_";function Ha(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:Ga(t),rawAttrsMap:{},parent:n,children:[]}}function Va(e,t){var n;!function(e){var t=fo(e,"key");if(t){if("template"===e.tag&&ya("<template> cannot be keyed. Place the key on real elements instead.",lo(e,"key")),e.for){var n=e.iterator2||e.iterator1,r=e.parent;n&&n===t&&r&&"transition-group"===r.tag&&ya("Do not use v-for index as key on <transition-group> children, this is the same as not using keys.",lo(e,"key"),!0)}e.key=t}}(e),e.plain=!e.key&&!e.scopedSlots&&!e.attrsList.length,function(e){var t=fo(e,"ref");t&&(e.ref=t,e.refInFor=function(e){for(var t=e;t;){if(void 0!==t.for)return!0;t=t.parent}return!1}(e))}(e),function(e){var t;"template"===e.tag?((t=po(e,"scope"))&&ya('the "scope" attribute for scoped slots have been deprecated and replaced by "slot-scope" since 2.5. The new "slot-scope" attribute can also be used on plain elements in addition to <template> to denote scoped slots.',e.rawAttrsMap.scope,!0),e.slotScope=t||po(e,"slot-scope")):(t=po(e,"slot-scope"))&&(e.attrsMap["v-for"]&&ya("Ambiguous combined usage of slot-scope and v-for on <"+e.tag+"> (v-for takes higher priority). Use a wrapper <template> for the scoped slot to make it clearer.",e.rawAttrsMap["slot-scope"],!0),e.slotScope=t);var n=fo(e,"slot");if(n&&(e.slotTarget='""'===n?'"default"':n,e.slotTargetDynamic=!(!e.attrsMap[":slot"]&&!e.attrsMap["v-bind:slot"]),"template"===e.tag||e.slotScope||io(e,"slot",n,lo(e,"slot"))),"template"===e.tag){var r=vo(e,Ia);if(r){(e.slotTarget||e.slotScope)&&ya("Unexpected mixed usage of different slot syntaxes.",e),e.parent&&!ka(e.parent)&&ya("<template v-slot> can only appear at the root level inside the receiving the component",e);var o=za(r),i=o.name,a=o.dynamic;e.slotTarget=i,e.slotTargetDynamic=a,e.slotScope=r.value||Ua}}else{var s=vo(e,Ia);if(s){ka(e)||ya("v-slot can only be used on components or <template>.",s),(e.slotScope||e.slotTarget)&&ya("Unexpected mixed usage of different slot syntaxes.",e),e.scopedSlots&&ya("To avoid scope ambiguity, the default slot should also use <template> syntax when there are other named slots.",s);var c=e.scopedSlots||(e.scopedSlots={}),u=za(s),l=u.name,f=u.dynamic,p=c[l]=Ha("template",[],e);p.slotTarget=l,p.slotTargetDynamic=f,p.children=e.children.filter((function(e){if(!e.slotScope)return e.parent=p,!0})),p.slotScope=s.value||Ua,e.children=[],e.plain=!1}}}(e),"slot"===(n=e).tag&&(n.slotName=fo(n,"name"),n.key&&ya("`key` does not work on <slot> because slots are abstract outlets and can possibly expand into multiple elements. Use the key on a wrapping element instead.",lo(n,"key"))),function(e){var t;(t=fo(e,"is"))&&(e.component=t),null!=po(e,"inline-template")&&(e.inlineTemplate=!0)}(e);for(var r=0;r<ba.length;r++)e=ba[r](e,t)||e;return function(e){var t,n,r,o,i,a,s,c,u=e.attrsList;for(t=0,n=u.length;t<n;t++)if(r=o=u[t].name,i=u[t].value,Oa.test(r))if(e.hasBindings=!0,(a=Ja(r.replace(Oa,"")))&&(r=r.replace(Pa,"")),Na.test(r))r=r.replace(Na,""),i=eo(i),(c=Ea.test(r))&&(r=r.slice(1,-1)),0===i.trim().length&&ya('The value for a v-bind expression cannot be empty. Found in "v-bind:'+r+'"'),a&&(a.prop&&!c&&"innerHtml"===(r=x(r))&&(r="innerHTML"),a.camel&&!c&&(r=x(r)),a.sync&&(s=yo(i,"$event"),c?uo(e,'"update:"+('+r+")",s,null,!1,ya,u[t],!0):(uo(e,"update:"+x(r),s,null,!1,ya,u[t]),k(r)!==x(r)&&uo(e,"update:"+k(r),s,null,!1,ya,u[t])))),a&&a.prop||!e.component&&$a(e.tag,e.attrsMap.type,r)?oo(e,r,i,u[t],c):io(e,r,i,u[t],c);else if(Aa.test(r))r=r.replace(Aa,""),(c=Ea.test(r))&&(r=r.slice(1,-1)),uo(e,r,i,a,!1,ya,u[t],c);else{var l=(r=r.replace(Oa,"")).match(Ma),f=l&&l[1];c=!1,f&&(r=r.slice(0,-(f.length+1)),Ea.test(f)&&(f=f.slice(1,-1),c=!0)),so(e,r,o,i,f,c,a,u[t]),"model"===r&&Xa(e,i)}else Ji(i,ga)&&ya(r+'="'+i+'": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div id="{{ val }}">, use <div :id="val">.',u[t]),io(e,r,JSON.stringify(i),u[t]),!e.component&&"muted"===r&&$a(e.tag,e.attrsMap.type,r)&&oo(e,r,"true",u[t])}(e),e}function Ba(e){var t;if(t=po(e,"v-for")){var n=function(e){var t=e.match(Sa);if(t){var n={};n.for=t[2].trim();var r=t[1].trim().replace(ja,""),o=r.match(Ta);return o?(n.alias=r.replace(Ta,"").trim(),n.iterator1=o[1].trim(),o[2]&&(n.iterator2=o[2].trim())):n.alias=r,n}}(t);n?S(e,n):ya("Invalid v-for expression: "+t,e.rawAttrsMap["v-for"])}}function qa(e,t){e.ifConditions||(e.ifConditions=[]),e.ifConditions.push(t)}function za(e){var t=e.name.replace(Ia,"");return t||("#"!==e.name[0]?t="default":ya("v-slot shorthand syntax requires a slot name.",e)),Ea.test(t)?{name:t.slice(1,-1),dynamic:!0}:{name:'"'+t+'"',dynamic:!1}}function Ja(e){var t=e.match(Pa);if(t){var n={};return t.forEach((function(e){n[e.slice(1)]=!0})),n}}function Ga(e){for(var t={},n=0,r=e.length;n<r;n++)!t[e[n].name]||X||Y||ya("duplicate attribute: "+e[n].name,e[n]),t[e[n].name]=e[n].value;return t}var Ka=/^xmlns:NS\d+/,Wa=/^NS\d+:/;function Xa(e,t){for(var n=e;n;)n.for&&n.alias===t&&ya("<"+e.tag+' v-model="'+t+'">: You are binding v-model directly to a v-for iteration alias. This will not be able to modify the v-for source array because writing to the alias is like modifying a function local variable. Consider using an array of objects and use v-model on an object property instead.',e.rawAttrsMap["v-model"]),n=n.parent}function Za(e){return Ha(e.tag,e.attrsList.slice(),e.parent)}var Ya,Qa,es,ts=[Ki,Wi,{preTransformNode:function(e,t){if("input"===e.tag){var n,r=e.attrsMap;if(!r["v-model"])return;if((r[":type"]||r["v-bind:type"])&&(n=fo(e,"type")),r.type||n||!r["v-bind"]||(n="("+r["v-bind"]+").type"),n){var o=po(e,"v-if",!0),i=o?"&&("+o+")":"",a=null!=po(e,"v-else",!0),s=po(e,"v-else-if",!0),c=Za(e);Ba(c),ao(c,"type","checkbox"),Va(c,t),c.processed=!0,c.if="("+n+")==='checkbox'"+i,qa(c,{exp:c.if,block:c});var u=Za(e);po(u,"v-for",!0),ao(u,"type","radio"),Va(u,t),qa(c,{exp:"("+n+")==='radio'"+i,block:u});var l=Za(e);return po(l,"v-for",!0),ao(l,":type",n),Va(l,t),qa(c,{exp:o,block:l}),a?c.else=!0:s&&(c.elseif=s),c}}}}],ns={model:function(e,t,n){Zr=n;var r=t.value,o=t.modifiers,i=e.tag,a=e.attrsMap.type;if("input"===i&&"file"===a&&Zr("<"+e.tag+' v-model="'+r+'" type="file">:\nFile inputs are read only. Use a v-on:change listener instead.',e.rawAttrsMap["v-model"]),e.component)return mo(e,r,o),!1;if("select"===i)!function(e,t,n){var r='var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(n&&n.number?"_n(val)":"val")+"});";uo(e,"change",r=r+" "+yo(t,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),null,!0)}(e,r,o);else if("input"===i&&"checkbox"===a)!function(e,t,n){var r=n&&n.number,o=fo(e,"value")||"null",i=fo(e,"true-value")||"true",a=fo(e,"false-value")||"false";oo(e,"checked","Array.isArray("+t+")?_i("+t+","+o+")>-1"+("true"===i?":("+t+")":":_q("+t+","+i+")")),uo(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+i+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+o+")":o)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+yo(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+yo(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+yo(t,"$$c")+"}",null,!0)}(e,r,o);else if("input"===i&&"radio"===a)!function(e,t,n){var r=n&&n.number,o=fo(e,"value")||"null";oo(e,"checked","_q("+t+","+(o=r?"_n("+o+")":o)+")"),uo(e,"change",yo(t,o),null,!0)}(e,r,o);else if("input"===i||"textarea"===i)!function(e,t,n){var r=e.attrsMap.type,o=e.attrsMap["v-bind:value"]||e.attrsMap[":value"],i=e.attrsMap["v-bind:type"]||e.attrsMap[":type"];if(o&&!i){var a=e.attrsMap["v-bind:value"]?"v-bind:value":":value";Zr(a+'="'+o+'" conflicts with v-model on the same element because the latter already expands to a value binding internally',e.rawAttrsMap[a])}var s=n||{},c=s.lazy,u=s.number,l=s.trim,f=!c&&"range"!==r,p=c?"change":"range"===r?"__r":"input",d="$event.target.value";l&&(d="$event.target.value.trim()"),u&&(d="_n("+d+")");var v=yo(t,d);f&&(v="if($event.target.composing)return;"+v),oo(e,"value","("+t+")"),uo(e,p,v,null,!0),(l||u)&&uo(e,"blur","$forceUpdate()")}(e,r,o);else{if(!F.isReservedTag(i))return mo(e,r,o),!1;Zr("<"+e.tag+' v-model="'+r+"\">: v-model is not supported on this element type. If you are working with contenteditable, it's recommended to wrap a library dedicated for that purpose inside a custom component.",e.rawAttrsMap["v-model"])}return!0},text:function(e,t){t.value&&oo(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&oo(e,"innerHTML","_s("+t.value+")",t)}},rs={expectHTML:!0,modules:ts,directives:ns,isPreTag:function(e){return"pre"===e},isUnaryTag:Xi,mustUseProp:sr,canBeLeftOpenTag:Zi,isReservedTag:wr,getTagNamespace:xr,staticKeys:(es=ts,es.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(","))},os=_((function(e){return v("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))}));function is(e,t){e&&(Ya=os(t.staticKeys||""),Qa=t.isReservedTag||E,as(e),ss(e,!1))}function as(e){if(e.static=function(e){return 2!==e.type&&(3===e.type||!(!e.pre&&(e.hasBindings||e.if||e.for||h(e.tag)||!Qa(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(Ya))))}(e),1===e.type){if(!Qa(e.tag)&&"slot"!==e.tag&&null==e.attrsMap["inline-template"])return;for(var t=0,n=e.children.length;t<n;t++){var r=e.children[t];as(r),r.static||(e.static=!1)}if(e.ifConditions)for(var o=1,i=e.ifConditions.length;o<i;o++){var a=e.ifConditions[o].block;as(a),a.static||(e.static=!1)}}}function ss(e,t){if(1===e.type){if((e.static||e.once)&&(e.staticInFor=t),e.static&&e.children.length&&(1!==e.children.length||3!==e.children[0].type))return void(e.staticRoot=!0);if(e.staticRoot=!1,e.children)for(var n=0,r=e.children.length;n<r;n++)ss(e.children[n],t||!!e.for);if(e.ifConditions)for(var o=1,i=e.ifConditions.length;o<i;o++)ss(e.ifConditions[o].block,t)}}var cs=/^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/,us=/\([^)]*?\);*$/,ls=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,fs={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},ps={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},ds=function(e){return"if("+e+")return null;"},vs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:ds("$event.target !== $event.currentTarget"),ctrl:ds("!$event.ctrlKey"),shift:ds("!$event.shiftKey"),alt:ds("!$event.altKey"),meta:ds("!$event.metaKey"),left:ds("'button' in $event && $event.button !== 0"),middle:ds("'button' in $event && $event.button !== 1"),right:ds("'button' in $event && $event.button !== 2")};function hs(e,t){var n=t?"nativeOn:":"on:",r="",o="";for(var i in e){var a=ms(e[i]);e[i]&&e[i].dynamic?o+=i+","+a+",":r+='"'+i+'":'+a+","}return r="{"+r.slice(0,-1)+"}",o?n+"_d("+r+",["+o.slice(0,-1)+"])":n+r}function ms(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return ms(e)})).join(",")+"]";var t=ls.test(e.value),n=cs.test(e.value),r=ls.test(e.value.replace(us,""));if(e.modifiers){var o="",i="",a=[];for(var s in e.modifiers)if(vs[s])i+=vs[s],fs[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;i+=ds(["ctrl","shift","alt","meta"].filter((function(e){return!c[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else a.push(s);return a.length&&(o+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(ys).join("&&")+")return null;"}(a)),i&&(o+=i),"function($event){"+o+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function ys(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=fs[e],r=ps[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var gs={on:function(e,t){t.modifiers&&ue("v-on without argument does not support modifiers."),e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:j},bs=function(e){this.options=e,this.warn=e.warn||no,this.transforms=ro(e.modules,"transformCode"),this.dataGenFns=ro(e.modules,"genData"),this.directives=S(S({},gs),e.directives);var t=e.isReservedTag||E;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function _s(e,t){var n=new bs(t);return{render:"with(this){return "+(e?ws(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function ws(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return xs(e,t);if(e.once&&!e.onceProcessed)return $s(e,t);if(e.for&&!e.forProcessed)return As(e,t);if(e.if&&!e.ifProcessed)return Cs(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=js(e,t),o="_t("+n+(r?","+r:""),i=e.attrs||e.dynamicAttrs?Ns((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:x(e.name),value:e.value,dynamic:e.dynamic}}))):null,a=e.attrsMap["v-bind"];return!i&&!a||r||(o+=",null"),i&&(o+=","+i),a&&(o+=(i?"":",null")+","+a),o+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:js(t,n,!0);return"_c("+e+","+Os(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Os(e,t));var o=e.inlineTemplate?null:js(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(o?","+o:"")+")"}for(var i=0;i<t.transforms.length;i++)n=t.transforms[i](e,n);return n}return js(e,t)||"void 0"}function xs(e,t){e.staticProcessed=!0;var n=t.pre;return e.pre&&(t.pre=e.pre),t.staticRenderFns.push("with(this){return "+ws(e,t)+"}"),t.pre=n,"_m("+(t.staticRenderFns.length-1)+(e.staticInFor?",true":"")+")"}function $s(e,t){if(e.onceProcessed=!0,e.if&&!e.ifProcessed)return Cs(e,t);if(e.staticInFor){for(var n="",r=e.parent;r;){if(r.for){n=r.key;break}r=r.parent}return n?"_o("+ws(e,t)+","+t.onceId+++","+n+")":(t.warn("v-once can only be used inside v-for that is keyed. ",e.rawAttrsMap["v-once"]),ws(e,t))}return xs(e,t)}function Cs(e,t,n,r){return e.ifProcessed=!0,ks(e.ifConditions.slice(),t,n,r)}function ks(e,t,n,r){if(!e.length)return r||"_e()";var o=e.shift();return o.exp?"("+o.exp+")?"+i(o.block)+":"+ks(e,t,n,r):""+i(o.block);function i(e){return n?n(e,t):e.once?$s(e,t):ws(e,t)}}function As(e,t,n,r){var o=e.for,i=e.alias,a=e.iterator1?","+e.iterator1:"",s=e.iterator2?","+e.iterator2:"";return t.maybeComponent(e)&&"slot"!==e.tag&&"template"!==e.tag&&!e.key&&t.warn("<"+e.tag+' v-for="'+i+" in "+o+'">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.',e.rawAttrsMap["v-for"],!0),e.forProcessed=!0,(r||"_l")+"(("+o+"),function("+i+a+s+"){return "+(n||ws)(e,t)+"})"}function Os(e,t){var n="{",r=function(e,t){var n=e.directives;if(n){var r,o,i,a,s="directives:[",c=!1;for(r=0,o=n.length;r<o;r++){i=n[r],a=!0;var u=t.directives[i.name];u&&(a=!!u(e,i,t.warn)),a&&(c=!0,s+='{name:"'+i.name+'",rawName:"'+i.rawName+'"'+(i.value?",value:("+i.value+"),expression:"+JSON.stringify(i.value):"")+(i.arg?",arg:"+(i.isDynamicArg?i.arg:'"'+i.arg+'"'):"")+(i.modifiers?",modifiers:"+JSON.stringify(i.modifiers):"")+"},")}return c?s.slice(0,-1)+"]":void 0}}(e,t);r&&(n+=r+","),e.key&&(n+="key:"+e.key+","),e.ref&&(n+="ref:"+e.ref+","),e.refInFor&&(n+="refInFor:true,"),e.pre&&(n+="pre:true,"),e.component&&(n+='tag:"'+e.tag+'",');for(var o=0;o<t.dataGenFns.length;o++)n+=t.dataGenFns[o](e);if(e.attrs&&(n+="attrs:"+Ns(e.attrs)+","),e.props&&(n+="domProps:"+Ns(e.props)+","),e.events&&(n+=hs(e.events,!1)+","),e.nativeEvents&&(n+=hs(e.nativeEvents,!0)+","),e.slotTarget&&!e.slotScope&&(n+="slot:"+e.slotTarget+","),e.scopedSlots&&(n+=function(e,t,n){var r=e.for||Object.keys(t).some((function(e){var n=t[e];return n.slotTargetDynamic||n.if||n.for||Ss(n)})),o=!!e.if;if(!r)for(var i=e.parent;i;){if(i.slotScope&&i.slotScope!==Ua||i.for){r=!0;break}i.if&&(o=!0),i=i.parent}var a=Object.keys(t).map((function(e){return Ts(t[e],n)})).join(",");return"scopedSlots:_u(["+a+"]"+(r?",null,true":"")+(!r&&o?",null,false,"+function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var i=function(e,t){var n=e.children[0];if(1===e.children.length&&1===n.type||t.warn("Inline-template components must have exactly one child element.",{start:e.start}),n&&1===n.type){var r=_s(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);i&&(n+=i+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ns(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ss(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ss))}function Ts(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Cs(e,t,Ts,"null");if(e.for&&!e.forProcessed)return As(e,t,Ts);var r=e.slotScope===Ua?"":String(e.slotScope),o="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(js(e,t)||"undefined")+":undefined":js(e,t)||"undefined":ws(e,t))+"}",i=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+o+i+"}"}function js(e,t,n,r,o){var i=e.children;if(i.length){var a=i[0];if(1===i.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||ws)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r<e.length;r++){var o=e[r];if(1===o.type){if(Es(o)||o.ifConditions&&o.ifConditions.some((function(e){return Es(e.block)}))){n=2;break}(t(o)||o.ifConditions&&o.ifConditions.some((function(e){return t(e.block)})))&&(n=1)}}return n}(i,t.maybeComponent):0,u=o||Ms;return"["+i.map((function(e){return u(e,t)})).join(",")+"]"+(c?","+c:"")}}function Es(e){return void 0!==e.for||"template"===e.tag||"slot"===e.tag}function Ms(e,t){return 1===e.type?ws(e,t):3===e.type&&e.isComment?function(e){return"_e("+JSON.stringify(e.text)+")"}(e):"_v("+(2===(n=e).type?n.expression:Ps(JSON.stringify(n.text)))+")";var n}function Ns(e){for(var t="",n="",r=0;r<e.length;r++){var o=e[r],i=Ps(o.value);o.dynamic?n+=o.name+","+i+",":t+='"'+o.name+'":'+i+","}return t="{"+t.slice(0,-1)+"}",n?"_d("+t+",["+n.slice(0,-1)+"])":t}function Ps(e){return e.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var Is=new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b"),Ls=new RegExp("\\b"+"delete,typeof,void".split(",").join("\\s*\\([^\\)]*\\)|\\b")+"\\s*\\([^\\)]*\\)"),Ds=/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;function Rs(e,t){e&&Fs(e,t)}function Fs(e,t){if(1===e.type){for(var n in e.attrsMap)if(Oa.test(n)){var r=e.attrsMap[n];if(r){var o=e.rawAttrsMap[n];"v-for"===n?Hs(e,'v-for="'+r+'"',t,o):Aa.test(n)?Us(r,n+'="'+r+'"',t,o):Bs(r,n+'="'+r+'"',t,o)}}if(e.children)for(var i=0;i<e.children.length;i++)Fs(e.children[i],t)}else 2===e.type&&Bs(e.expression,e.text,t,e)}function Us(e,t,n,r){var o=e.replace(Ds,""),i=o.match(Ls);i&&"$"!==o.charAt(i.index-1)&&n('avoid using JavaScript unary operator as property name: "'+i[0]+'" in expression '+t.trim(),r),Bs(e,t,n,r)}function Hs(e,t,n,r){Bs(e.for||"",t,n,r),Vs(e.alias,"v-for alias",t,n,r),Vs(e.iterator1,"v-for iterator",t,n,r),Vs(e.iterator2,"v-for iterator",t,n,r)}function Vs(e,t,n,r,o){if("string"==typeof e)try{new Function("var "+e+"=_")}catch(i){r("invalid "+t+' "'+e+'" in expression: '+n.trim(),o)}}function Bs(e,t,n,r){try{new Function("return "+e)}catch(i){var o=e.replace(Ds,"").match(Is);n(o?'avoid using JavaScript keyword as property name: "'+o[0]+'"\n Raw expression: '+t.trim():"invalid expression: "+i.message+" in\n\n "+e+"\n\n Raw expression: "+t.trim()+"\n",r)}}function qs(e,t){var n="";if(t>0)for(;1&t&&(n+=e),!((t>>>=1)<=0);)e+=e;return n}function zs(e,t){try{return new Function(e)}catch(n){return t.push({err:n,code:e}),j}}function Js(e){var t=Object.create(null);return function(n,r,o){var i=(r=S({},r)).warn||ue;delete r.warn;try{new Function("return 1")}catch(e){e.toString().match(/unsafe-eval|CSP/)&&i("It seems you are using the standalone build of Vue.js in an environment with Content Security Policy that prohibits unsafe-eval. The template compiler cannot work in this environment. Consider relaxing the policy to allow unsafe-eval or pre-compiling your templates into render functions.")}var a=r.delimiters?String(r.delimiters)+n:n;if(t[a])return t[a];var s=e(n,r);s.errors&&s.errors.length&&(r.outputSourceRange?s.errors.forEach((function(e){i("Error compiling template:\n\n"+e.msg+"\n\n"+function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.length);for(var r=e.split(/\r?\n/),o=0,i=[],a=0;a<r.length;a++)if((o+=r[a].length+1)>=t){for(var s=a-2;s<=a+2||n>o;s++)if(!(s<0||s>=r.length)){i.push(""+(s+1)+qs(" ",3-String(s+1).length)+"| "+r[s]);var c=r[s].length;if(s===a){var u=t-(o-c)+1,l=n>o?c-u:n-t;i.push(" | "+qs(" ",u)+qs("^",l))}else if(s>a){if(n>o){var f=Math.min(n-o,c);i.push(" | "+qs("^",f))}o+=c+1}}break}return i.join("\n")}(n,e.start,e.end),o)})):i("Error compiling template:\n\n"+n+"\n\n"+s.errors.map((function(e){return"- "+e})).join("\n")+"\n",o)),s.tips&&s.tips.length&&(r.outputSourceRange?s.tips.forEach((function(e){return le(e.msg,o)})):s.tips.forEach((function(e){return le(e,o)})));var c={},u=[];return c.render=zs(s.render,u),c.staticRenderFns=s.staticRenderFns.map((function(e){return zs(e,u)})),s.errors&&s.errors.length||!u.length||i("Failed to generate render function:\n\n"+u.map((function(e){var t=e.err,n=e.code;return t.toString()+" in\n\n"+n+"\n"})).join("\n"),o),t[a]=c}}var Gs,Ks,Ws=(Gs=function(e,t){var n=function(e,t){ya=t.warn||no,xa=t.isPreTag||E,$a=t.mustUseProp||E,Ca=t.getTagNamespace||E;var n=t.isReservedTag||E;ka=function(e){return!!e.component||!n(e.tag)},ba=ro(t.modules,"transformNode"),_a=ro(t.modules,"preTransformNode"),wa=ro(t.modules,"postTransformNode"),ga=t.delimiters;var r,o,i=[],a=!1!==t.preserveWhitespace,s=t.whitespace,c=!1,u=!1,l=!1;function f(e,t){l||(l=!0,ya(e,t))}function p(e){if(d(e),c||e.processed||(e=Va(e,t)),i.length||e===r||(r.if&&(e.elseif||e.else)?(v(e),qa(r,{exp:e.elseif,block:e})):f("Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.",{start:e.start})),o&&!e.forbidden)if(e.elseif||e.else)a=e,s=function(e){for(var t=e.length;t--;){if(1===e[t].type)return e[t];" "!==e[t].text&&ya('text "'+e[t].text.trim()+'" between v-if and v-else(-if) will be ignored.',e[t]),e.pop()}}(o.children),s&&s.if?qa(s,{exp:a.elseif,block:a}):ya("v-"+(a.elseif?'else-if="'+a.elseif+'"':"else")+" used on element <"+a.tag+"> without corresponding v-if.",a.rawAttrsMap[a.elseif?"v-else-if":"v-else"]);else{if(e.slotScope){var n=e.slotTarget||'"default"';(o.scopedSlots||(o.scopedSlots={}))[n]=e}o.children.push(e),e.parent=o}var a,s;e.children=e.children.filter((function(e){return!e.slotScope})),d(e),e.pre&&(c=!1),xa(e.tag)&&(u=!1);for(var l=0;l<wa.length;l++)wa[l](e,t)}function d(e){if(!u)for(var t;(t=e.children[e.children.length-1])&&3===t.type&&" "===t.text;)e.children.pop()}function v(e){"slot"!==e.tag&&"template"!==e.tag||f("Cannot use <"+e.tag+"> as component root element because it may contain multiple nodes.",{start:e.start}),e.attrsMap.hasOwnProperty("v-for")&&f("Cannot use v-for on stateful component root element because it renders multiple elements.",e.rawAttrsMap["v-for"])}return function(e,t){for(var n,r,o=[],i=t.expectHTML,a=t.isUnaryTag||E,s=t.canBeLeftOpenTag||E,c=0;e;){if(n=e,r&&ua(r)){var u=0,l=r.toLowerCase(),f=la[l]||(la[l]=new RegExp("([\\s\\S]*?)(</"+l+"[^>]*>)","i")),p=e.replace(f,(function(e,n,r){return u=r.length,ua(l)||"noscript"===l||(n=n.replace(/<!\--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),ha(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""}));c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(sa.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),$(v+3);continue}}if(ca.test(e)){var h=e.indexOf("]>");if(h>=0){$(h+2);continue}}var m=e.match(aa);if(m){$(m[0].length);continue}var y=e.match(ia);if(y){var g=c;$(y[0].length),A(y[1],g,c);continue}var b=C();if(b){k(b),ha(b.tagName,e)&&$(1);continue}}var _=void 0,w=void 0,x=void 0;if(d>=0){for(w=e.slice(d);!(ia.test(w)||ra.test(w)||sa.test(w)||ca.test(w)||(x=w.indexOf("<",1))<0);)d+=x,w=e.slice(d);_=e.substring(0,d)}d<0&&(_=e),_&&$(_.length),t.chars&&_&&t.chars(_,c-_.length,c)}if(e===n){t.chars&&t.chars(e),!o.length&&t.warn&&t.warn('Mal-formatted tag at end of template: "'+e+'"',{start:c+e.length});break}}function $(t){c+=t,e=e.substring(t)}function C(){var t=e.match(ra);if(t){var n,r,o={tagName:t[1],attrs:[],start:c};for($(t[0].length);!(n=e.match(oa))&&(r=e.match(ea)||e.match(Qi));)r.start=c,$(r[0].length),r.end=c,o.attrs.push(r);if(n)return o.unarySlash=n[1],$(n[0].length),o.end=c,o}}function k(e){var n=e.tagName,c=e.unarySlash;i&&("p"===r&&Yi(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p<l;p++){var d=e.attrs[p],v=d[3]||d[4]||d[5]||"",h="a"===n&&"href"===d[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;f[p]={name:d[1],value:ma(v,h)},t.outputSourceRange&&(f[p].start=d.start+d[0].match(/^\s*/).length,f[p].end=d.end)}u||(o.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:f,start:e.start,end:e.end}),r=n),t.start&&t.start(n,f,u,e.start,e.end)}function A(e,n,i){var a,s;if(null==n&&(n=c),null==i&&(i=c),e)for(s=e.toLowerCase(),a=o.length-1;a>=0&&o[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=o.length-1;u>=a;u--)(u>a||!e&&t.warn)&&t.warn("tag <"+o[u].tag+"> has no matching end tag.",{start:o[u].start,end:o[u].end}),t.end&&t.end(o[u].tag,n,i);o.length=a,r=a&&o[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,i):"p"===s&&(t.start&&t.start(e,[],!1,n,i),t.end&&t.end(e,n,i))}A()}(e,{warn:ya,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,n,a,s,l){var f=o&&o.ns||Ca(e);X&&"svg"===f&&(n=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];Ka.test(r.name)||(r.name=r.name.replace(Wa,""),t.push(r))}return t}(n));var d,h=Ha(e,n,o);f&&(h.ns=f),t.outputSourceRange&&(h.start=s,h.end=l,h.rawAttrsMap=h.attrsList.reduce((function(e,t){return e[t.name]=t,e}),{})),n.forEach((function(e){Ra.test(e.name)&&ya("Invalid dynamic argument expression: attribute names cannot contain spaces, quotes, <, >, / or =.",{start:e.start+e.name.indexOf("["),end:e.start+e.name.length})})),"style"!==(d=h).tag&&("script"!==d.tag||d.attrsMap.type&&"text/javascript"!==d.attrsMap.type)||oe()||(h.forbidden=!0,ya("Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <"+e+">, as they will not be parsed.",{start:h.start}));for(var m=0;m<_a.length;m++)h=_a[m](h,t)||h;c||(function(e){null!=po(e,"v-pre")&&(e.pre=!0)}(h),h.pre&&(c=!0)),xa(h.tag)&&(u=!0),c?function(e){var t=e.attrsList,n=t.length;if(n)for(var r=e.attrs=new Array(n),o=0;o<n;o++)r[o]={name:t[o].name,value:JSON.stringify(t[o].value)},null!=t[o].start&&(r[o].start=t[o].start,r[o].end=t[o].end);else e.pre||(e.plain=!0)}(h):h.processed||(Ba(h),function(e){var t=po(e,"v-if");if(t)e.if=t,qa(e,{exp:t,block:e});else{null!=po(e,"v-else")&&(e.else=!0);var n=po(e,"v-else-if");n&&(e.elseif=n)}}(h),function(e){null!=po(e,"v-once")&&(e.once=!0)}(h)),r||v(r=h),a?p(h):(o=h,i.push(h))},end:function(e,n,r){var a=i[i.length-1];i.length-=1,o=i[i.length-1],t.outputSourceRange&&(a.end=r),p(a)},chars:function(n,r,i){if(o){if(!X||"textarea"!==o.tag||o.attrsMap.placeholder!==n){var l,p,d,v=o.children;(n=u||n.trim()?"script"===(l=o).tag||"style"===l.tag?n:Fa(n):v.length?s?"condense"===s&&La.test(n)?"":" ":a?" ":"":"")&&(u||"condense"!==s||(n=n.replace(Da," ")),!c&&" "!==n&&(p=Ji(n,ga))?d={type:2,expression:p.expression,tokens:p.tokens,text:n}:" "===n&&v.length&&" "===v[v.length-1].text||(d={type:3,text:n}),d&&(t.outputSourceRange&&(d.start=r,d.end=i),v.push(d)))}}else n===e?f("Component template requires a root element, rather than just text.",{start:r}):(n=n.trim())&&f('text "'+n+'" outside root element will be ignored.',{start:r})},comment:function(e,n,r){if(o){var i={type:3,text:e,isComment:!0};t.outputSourceRange&&(i.start=n,i.end=r),o.children.push(i)}}}),r}(e.trim(),t);!1!==t.optimize&&is(n,t);var r=_s(n,t);return{ast:n,render:r.render,staticRenderFns:r.staticRenderFns}},function(e){function t(t,n){var r=Object.create(e),o=[],i=[],a=function(e,t,n){(n?i:o).push(e)};if(n){if(n.outputSourceRange){var s=t.match(/^\s*/)[0].length;a=function(e,t,n){var r={msg:e};t&&(null!=t.start&&(r.start=t.start+s),null!=t.end&&(r.end=t.end+s)),(n?i:o).push(r)}}for(var c in n.modules&&(r.modules=(e.modules||[]).concat(n.modules)),n.directives&&(r.directives=S(Object.create(e.directives||null),n.directives)),n)"modules"!==c&&"directives"!==c&&(r[c]=n[c])}r.warn=a;var u=Gs(t.trim(),r);return Rs(u.ast,a),u.errors=o,u.tips=i,u}return{compile:t,compileToFunctions:Js(t)}}),Xs=Ws(rs),Zs=(Xs.compile,Xs.compileToFunctions);function Ys(e){return(Ks=Ks||document.createElement("div")).innerHTML=e?'<a href="\n"/>':'<div a="\n"/>',Ks.innerHTML.indexOf("&#10;")>0}var Qs=!!J&&Ys(!1),ec=!!J&&Ys(!0),tc=_((function(e){var t=kr(e);return t&&t.innerHTML})),nc=Yn.prototype.$mount;return Yn.prototype.$mount=function(e,t){if((e=e&&kr(e))===document.body||e===document.documentElement)return ue("Do not mount Vue to <html> or <body> - mount to normal elements instead."),this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&((r=tc(r))||ue("Template element not found or is empty: "+n.template,this));else{if(!r.nodeType)return ue("invalid template option:"+r,this),this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){F.performance&&it&&it("compile");var o=Zs(r,{outputSourceRange:!0,shouldDecodeNewlines:Qs,shouldDecodeNewlinesForHref:ec,delimiters:n.delimiters,comments:n.comments},this),i=o.render,a=o.staticRenderFns;n.render=i,n.staticRenderFns=a,F.performance&&it&&(it("compile end"),at("vue "+this._name+" compile","compile","compile end"))}}return nc.call(this,e,t)},Yn.compile=Zs,Yn})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vuex=t()}(this,(function(){"use strict";var e="undefined"!=typeof window&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function t(e,t){Object.keys(e).forEach((function(n){return t(e[n],n)}))}function n(e,t){if(!e)throw new Error("[vuex] "+t)}var r=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var n=e.state;this.state=("function"==typeof n?n():n)||{}},o={namespaced:{configurable:!0}};o.namespaced.get=function(){return!!this._rawModule.namespaced},r.prototype.addChild=function(e,t){this._children[e]=t},r.prototype.removeChild=function(e){delete this._children[e]},r.prototype.getChild=function(e){return this._children[e]},r.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)},r.prototype.forEachChild=function(e){t(this._children,e)},r.prototype.forEachGetter=function(e){this._rawModule.getters&&t(this._rawModule.getters,e)},r.prototype.forEachAction=function(e){this._rawModule.actions&&t(this._rawModule.actions,e)},r.prototype.forEachMutation=function(e){this._rawModule.mutations&&t(this._rawModule.mutations,e)},Object.defineProperties(r.prototype,o);var i=function(e){this.register([],e,!1)};function a(e,t,n){if(l(e,n),t.update(n),n.modules)for(var r in n.modules){if(!t.getChild(r))return void console.warn("[vuex] trying to add a new module '"+r+"' on hot reloading, manual reload is needed");a(e.concat(r),t.getChild(r),n.modules[r])}}i.prototype.get=function(e){return e.reduce((function(e,t){return e.getChild(t)}),this.root)},i.prototype.getNamespace=function(e){var t=this.root;return e.reduce((function(e,n){return e+((t=t.getChild(n)).namespaced?n+"/":"")}),"")},i.prototype.update=function(e){a([],this.root,e)},i.prototype.register=function(e,n,o){var i=this;void 0===o&&(o=!0),l(e,n);var a=new r(n,o);0===e.length?this.root=a:this.get(e.slice(0,-1)).addChild(e[e.length-1],a),n.modules&&t(n.modules,(function(t,n){i.register(e.concat(n),t,o)}))},i.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),n=e[e.length-1];t.getChild(n).runtime&&t.removeChild(n)};var s,c={assert:function(e){return"function"==typeof e},expected:"function"},u={getters:c,mutations:c,actions:{assert:function(e){return"function"==typeof e||"object"==typeof e&&"function"==typeof e.handler},expected:'function or object with "handler" function'}};function l(e,r){Object.keys(u).forEach((function(o){if(r[o]){var i=u[o];t(r[o],(function(t,r){n(i.assert(t),function(e,t,n,r,o){var i=t+" should be "+o+' but "'+t+"."+n+'"';return e.length>0&&(i+=' in module "'+e.join(".")+'"'),i+" is "+JSON.stringify(r)+"."}(e,o,r,t,i.expected))}))}}))}var f=function t(r){var o=this;void 0===r&&(r={}),!s&&"undefined"!=typeof window&&window.Vue&&b(window.Vue),n(s,"must call Vue.use(Vuex) before creating a store instance."),n("undefined"!=typeof Promise,"vuex requires a Promise polyfill in this browser."),n(this instanceof t,"store must be called with the new operator.");var a=r.plugins;void 0===a&&(a=[]);var c=r.strict;void 0===c&&(c=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new i(r),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new s;var u=this,l=this.dispatch,f=this.commit;this.dispatch=function(e,t){return l.call(u,e,t)},this.commit=function(e,t,n){return f.call(u,e,t,n)},this.strict=c;var p=this._modules.root.state;m(this,p,[],this._modules.root),h(this,p),a.forEach((function(e){return e(o)})),(void 0!==r.devtools?r.devtools:s.config.devtools)&&function(t){e&&(t._devtoolHook=e,e.emit("vuex:init",t),e.on("vuex:travel-to-state",(function(e){t.replaceState(e)})),t.subscribe((function(t,n){e.emit("vuex:mutation",t,n)})))}(this)},p={state:{configurable:!0}};function d(e,t){return t.indexOf(e)<0&&t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function v(e,t){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var n=e.state;m(e,n,[],e._modules.root,!0),h(e,n,t)}function h(e,r,o){var i=e._vm;e.getters={};var a=e._wrappedGetters,c={};t(a,(function(t,n){c[n]=function(){return t(e)},Object.defineProperty(e.getters,n,{get:function(){return e._vm[n]},enumerable:!0})}));var u=s.config.silent;s.config.silent=!0,e._vm=new s({data:{$$state:r},computed:c}),s.config.silent=u,e.strict&&function(e){e._vm.$watch((function(){return this._data.$$state}),(function(){n(e._committing,"do not mutate vuex store state outside mutation handlers.")}),{deep:!0,sync:!0})}(e),i&&(o&&e._withCommit((function(){i._data.$$state=null})),s.nextTick((function(){return i.$destroy()})))}function m(e,t,n,r,o){var i=!n.length,a=e._modules.getNamespace(n);if(r.namespaced&&(e._modulesNamespaceMap[a]=r),!i&&!o){var c=y(t,n.slice(0,-1)),u=n[n.length-1];e._withCommit((function(){s.set(c,u,r.state)}))}var l=r.context=function(e,t,n){var r=""===t,o={dispatch:r?e.dispatch:function(n,r,o){var i=g(n,r,o),a=i.payload,s=i.options,c=i.type;if(s&&s.root||(c=t+c,e._actions[c]))return e.dispatch(c,a);console.error("[vuex] unknown local action type: "+i.type+", global type: "+c)},commit:r?e.commit:function(n,r,o){var i=g(n,r,o),a=i.payload,s=i.options,c=i.type;s&&s.root||(c=t+c,e._mutations[c])?e.commit(c,a,s):console.error("[vuex] unknown local mutation type: "+i.type+", global type: "+c)}};return Object.defineProperties(o,{getters:{get:r?function(){return e.getters}:function(){return function(e,t){var n={},r=t.length;return Object.keys(e.getters).forEach((function(o){if(o.slice(0,r)===t){var i=o.slice(r);Object.defineProperty(n,i,{get:function(){return e.getters[o]},enumerable:!0})}})),n}(e,t)}},state:{get:function(){return y(e.state,n)}}}),o}(e,a,n);r.forEachMutation((function(t,n){!function(e,t,n,r){(e._mutations[t]||(e._mutations[t]=[])).push((function(t){n.call(e,r.state,t)}))}(e,a+n,t,l)})),r.forEachAction((function(t,n){var r=t.root?n:a+n,o=t.handler||t;!function(e,t,n,r){(e._actions[t]||(e._actions[t]=[])).push((function(t,o){var i,a=n.call(e,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:e.getters,rootState:e.state},t,o);return(i=a)&&"function"==typeof i.then||(a=Promise.resolve(a)),e._devtoolHook?a.catch((function(t){throw e._devtoolHook.emit("vuex:error",t),t})):a}))}(e,r,o,l)})),r.forEachGetter((function(t,n){!function(e,t,n,r){e._wrappedGetters[t]?console.error("[vuex] duplicate getter key: "+t):e._wrappedGetters[t]=function(e){return n(r.state,r.getters,e.state,e.getters)}}(e,a+n,t,l)})),r.forEachChild((function(r,i){m(e,t,n.concat(i),r,o)}))}function y(e,t){return t.length?t.reduce((function(e,t){return e[t]}),e):e}function g(e,t,r){var o;return null!==(o=e)&&"object"==typeof o&&e.type&&(r=t,t=e,e=e.type),n("string"==typeof e,"expects string as the type, but found "+typeof e+"."),{type:e,payload:t,options:r}}function b(e){s&&e===s?console.error("[vuex] already installed. Vue.use(Vuex) should be called only once."):function(e){if(Number(e.version.split(".")[0])>=2)e.mixin({beforeCreate:n});else{var t=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[n].concat(e.init):n,t.call(this,e)}}function n(){var e=this.$options;e.store?this.$store="function"==typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}(s=e)}p.state.get=function(){return this._vm._data.$$state},p.state.set=function(e){n(!1,"use store.replaceState() to explicit replace store state.")},f.prototype.commit=function(e,t,n){var r=this,o=g(e,t,n),i=o.type,a=o.payload,s=o.options,c={type:i,payload:a},u=this._mutations[i];u?(this._withCommit((function(){u.forEach((function(e){e(a)}))})),this._subscribers.forEach((function(e){return e(c,r.state)})),s&&s.silent&&console.warn("[vuex] mutation type: "+i+". Silent option has been removed. Use the filter functionality in the vue-devtools")):console.error("[vuex] unknown mutation type: "+i)},f.prototype.dispatch=function(e,t){var n=this,r=g(e,t),o=r.type,i=r.payload,a={type:o,payload:i},s=this._actions[o];if(s){try{this._actionSubscribers.filter((function(e){return e.before})).forEach((function(e){return e.before(a,n.state)}))}catch(e){console.warn("[vuex] error in before action subscribers: "),console.error(e)}return(s.length>1?Promise.all(s.map((function(e){return e(i)}))):s[0](i)).then((function(e){try{n._actionSubscribers.filter((function(e){return e.after})).forEach((function(e){return e.after(a,n.state)}))}catch(e){console.warn("[vuex] error in after action subscribers: "),console.error(e)}return e}))}console.error("[vuex] unknown action type: "+o)},f.prototype.subscribe=function(e){return d(e,this._subscribers)},f.prototype.subscribeAction=function(e){return d("function"==typeof e?{before:e}:e,this._actionSubscribers)},f.prototype.watch=function(e,t,r){var o=this;return n("function"==typeof e,"store.watch only accepts a function."),this._watcherVM.$watch((function(){return e(o.state,o.getters)}),t,r)},f.prototype.replaceState=function(e){var t=this;this._withCommit((function(){t._vm._data.$$state=e}))},f.prototype.registerModule=function(e,t,r){void 0===r&&(r={}),"string"==typeof e&&(e=[e]),n(Array.isArray(e),"module path must be a string or an Array."),n(e.length>0,"cannot register the root module by using registerModule."),this._modules.register(e,t),m(this,this.state,e,this._modules.get(e),r.preserveState),h(this,this.state)},f.prototype.unregisterModule=function(e){var t=this;"string"==typeof e&&(e=[e]),n(Array.isArray(e),"module path must be a string or an Array."),this._modules.unregister(e),this._withCommit((function(){var n=y(t.state,e.slice(0,-1));s.delete(n,e[e.length-1])})),v(this)},f.prototype.hotUpdate=function(e){this._modules.update(e),v(this,!0)},f.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t},Object.defineProperties(f.prototype,p);var _=k((function(e,t){var n={};return C(t).forEach((function(t){var r=t.key,o=t.val;n[r]=function(){var t=this.$store.state,n=this.$store.getters;if(e){var r=A(this.$store,"mapState",e);if(!r)return;t=r.context.state,n=r.context.getters}return"function"==typeof o?o.call(this,t,n):t[o]},n[r].vuex=!0})),n})),w=k((function(e,t){var n={};return C(t).forEach((function(t){var r=t.key,o=t.val;n[r]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=this.$store.commit;if(e){var i=A(this.$store,"mapMutations",e);if(!i)return;r=i.context.commit}return"function"==typeof o?o.apply(this,[r].concat(t)):r.apply(this.$store,[o].concat(t))}})),n})),x=k((function(e,t){var n={};return C(t).forEach((function(t){var r=t.key,o=t.val;o=e+o,n[r]=function(){if(!e||A(this.$store,"mapGetters",e)){if(o in this.$store.getters)return this.$store.getters[o];console.error("[vuex] unknown getter: "+o)}},n[r].vuex=!0})),n})),$=k((function(e,t){var n={};return C(t).forEach((function(t){var r=t.key,o=t.val;n[r]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];var r=this.$store.dispatch;if(e){var i=A(this.$store,"mapActions",e);if(!i)return;r=i.context.dispatch}return"function"==typeof o?o.apply(this,[r].concat(t)):r.apply(this.$store,[o].concat(t))}})),n}));function C(e){return Array.isArray(e)?e.map((function(e){return{key:e,val:e}})):Object.keys(e).map((function(t){return{key:t,val:e[t]}}))}function k(e){return function(t,n){return"string"!=typeof t?(n=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),e(t,n)}}function A(e,t,n){var r=e._modulesNamespaceMap[n];return r||console.error("[vuex] module namespace not found in "+t+"(): "+n),r}return{Store:f,install:b,version:"3.1.0",mapState:_,mapMutations:w,mapGetters:x,mapActions:$,createNamespacedHelpers:function(e){return{mapState:_.bind(null,e),mapGetters:x.bind(null,e),mapMutations:w.bind(null,e),mapActions:$.bind(null,e)}}}})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueResource=t()}(this,(function(){"use strict";function e(e){this.state=2,this.value=void 0,this.deferred=[];var t=this;try{e((function(e){t.resolve(e)}),(function(e){t.reject(e)}))}catch(e){t.reject(e)}}e.reject=function(t){return new e((function(e,n){n(t)}))},e.resolve=function(t){return new e((function(e,n){e(t)}))},e.all=function(t){return new e((function(n,r){var o=0,i=[];function a(e){return function(r){i[e]=r,(o+=1)===t.length&&n(i)}}0===t.length&&n(i);for(var s=0;s<t.length;s+=1)e.resolve(t[s]).then(a(s),r)}))},e.race=function(t){return new e((function(n,r){for(var o=0;o<t.length;o+=1)e.resolve(t[o]).then(n,r)}))};var t=e.prototype;function n(e,t){this.promise=e instanceof Promise?e:new Promise(e.bind(t)),this.context=t}t.resolve=function(e){var t=this;if(2===t.state){if(e===t)throw new TypeError("Promise settled with itself.");var n=!1;try{var r=e&&e.then;if(null!==e&&"object"==typeof e&&"function"==typeof r)return void r.call(e,(function(e){n||t.resolve(e),n=!0}),(function(e){n||t.reject(e),n=!0}))}catch(e){return void(n||t.reject(e))}t.state=0,t.value=e,t.notify()}},t.reject=function(e){var t=this;if(2===t.state){if(e===t)throw new TypeError("Promise settled with itself.");t.state=1,t.value=e,t.notify()}},t.notify=function(){var e=this;o((function(){if(2!==e.state)for(;e.deferred.length;){var t=e.deferred.shift(),n=t[0],r=t[1],o=t[2],i=t[3];try{0===e.state?o("function"==typeof n?n.call(void 0,e.value):e.value):1===e.state&&("function"==typeof r?o(r.call(void 0,e.value)):i(e.value))}catch(e){i(e)}}}),undefined)},t.then=function(t,n){var r=this;return new e((function(e,o){r.deferred.push([t,n,e,o]),r.notify()}))},t.catch=function(e){return this.then(void 0,e)},"undefined"==typeof Promise&&(window.Promise=e),n.all=function(e,t){return new n(Promise.all(e),t)},n.resolve=function(e,t){return new n(Promise.resolve(e),t)},n.reject=function(e,t){return new n(Promise.reject(e),t)},n.race=function(e,t){return new n(Promise.race(e),t)};var r=n.prototype;r.bind=function(e){return this.context=e,this},r.then=function(e,t){return e&&e.bind&&this.context&&(e=e.bind(this.context)),t&&t.bind&&this.context&&(t=t.bind(this.context)),new n(this.promise.then(e,t),this.context)},r.catch=function(e){return e&&e.bind&&this.context&&(e=e.bind(this.context)),new n(this.promise.catch(e),this.context)},r.finally=function(e){return this.then((function(t){return e.call(this),t}),(function(t){return e.call(this),Promise.reject(t)}))};var o,i={}.hasOwnProperty,a=[].slice,s=!1,c="undefined"!=typeof window;function u(e){return e?e.replace(/^\s*|\s*$/g,""):""}function l(e){return e?e.toLowerCase():""}var f=Array.isArray;function p(e){return"string"==typeof e}function d(e){return"function"==typeof e}function v(e){return null!==e&&"object"==typeof e}function h(e){return v(e)&&Object.getPrototypeOf(e)==Object.prototype}function m(e,t,r){var o=n.resolve(e);return arguments.length<2?o:o.then(t,r)}function y(e,t,n){return d(n=n||{})&&(n=n.call(t)),_(e.bind({$vm:t,$options:n}),e,{$options:n})}function g(e,t){var n,r;if(f(e))for(n=0;n<e.length;n++)t.call(e[n],e[n],n);else if(v(e))for(r in e)i.call(e,r)&&t.call(e[r],e[r],r);return e}var b=Object.assign||function(e){var t=a.call(arguments,1);return t.forEach((function(t){w(e,t)})),e};function _(e){var t=a.call(arguments,1);return t.forEach((function(t){w(e,t,!0)})),e}function w(e,t,n){for(var r in t)n&&(h(t[r])||f(t[r]))?(h(t[r])&&!h(e[r])&&(e[r]={}),f(t[r])&&!f(e[r])&&(e[r]=[]),w(e[r],t[r],n)):void 0!==t[r]&&(e[r]=t[r])}function x(e){return null!=e}function $(e){return";"===e||"&"===e||"?"===e}function C(e,t,n){return t="+"===e||"#"===e?k(t):encodeURIComponent(t),n?encodeURIComponent(n)+"="+t:t}function k(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map((function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e)),e})).join("")}function A(e,t){var n,r=this||{},o=e;return p(e)&&(o={url:e,params:t}),o=_({},A.options,r.$options,o),A.transforms.forEach((function(e){p(e)&&(e=A.transform[e]),d(e)&&(n=function(e,t,n){return function(r){return e.call(n,r,t)}}(e,n,r.$vm))})),n(o)}function O(e,t,n){var r,o=f(t),i=h(t);g(t,(function(t,a){r=v(t)||f(t),n&&(a=n+"["+(i||r?a:"")+"]"),!n&&o?e.add(t.name,t.value):r?O(e,t,a):e.add(a,t)}))}A.options={url:"",root:null,params:{}},A.transform={template:function(e){var t=[],n=function(e,t,n){var r=function(e){var t=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(r){return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,(function(e,o,i){if(o){var a=null,s=[];if(-1!==t.indexOf(o.charAt(0))&&(a=o.charAt(0),o=o.substr(1)),o.split(/,/g).forEach((function(e){var t=/([^:\*]*)(?::(\d+)|(\*))?/.exec(e);s.push.apply(s,function(e,t,n,r){var o=e[n],i=[];if(x(o)&&""!==o)if("string"==typeof o||"number"==typeof o||"boolean"==typeof o)o=o.toString(),r&&"*"!==r&&(o=o.substring(0,parseInt(r,10))),i.push(C(t,o,$(t)?n:null));else if("*"===r)Array.isArray(o)?o.filter(x).forEach((function(e){i.push(C(t,e,$(t)?n:null))})):Object.keys(o).forEach((function(e){x(o[e])&&i.push(C(t,o[e],e))}));else{var a=[];Array.isArray(o)?o.filter(x).forEach((function(e){a.push(C(t,e))})):Object.keys(o).forEach((function(e){x(o[e])&&(a.push(encodeURIComponent(e)),a.push(C(t,o[e].toString())))})),$(t)?i.push(encodeURIComponent(n)+"="+a.join(",")):0!==a.length&&i.push(a.join(","))}else";"===t?i.push(encodeURIComponent(n)):""!==o||"&"!==t&&"?"!==t?""===o&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}(r,a,t[1],t[2]||t[3])),n.push(t[1])})),a&&"+"!==a){var c=",";return"?"===a?c="&":"#"!==a&&(c=a),(0!==s.length?a:"")+s.join(c)}return s.join(",")}return k(i)}))}}}(e),o=r.expand(t);return n&&n.push.apply(n,r.vars),o}(e.url,e.params,t);return t.forEach((function(t){delete e.params[t]})),n},query:function(e,t){var n=Object.keys(A.options.params),r={},o=t(e);return g(e.params,(function(e,t){-1===n.indexOf(t)&&(r[t]=e)})),(r=A.params(r))&&(o+=(-1==o.indexOf("?")?"?":"&")+r),o},root:function(e,t){var n,r=t(e);return p(e.root)&&!/^(https?:)?\//.test(r)&&("/",r=((n=e.root)?n.replace(new RegExp("[/]+$"),""):n)+"/"+r),r}},A.transforms=["template","query","root"],A.params=function(e){var t=[],n=encodeURIComponent;return t.add=function(e,t){d(t)&&(t=t()),null===t&&(t=""),this.push(n(e)+"="+n(t))},O(t,e),t.join("&").replace(/%20/g,"+")},A.parse=function(e){var t=document.createElement("a");return document.documentMode&&(t.href=e,e=t.href),t.href=e,{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",port:t.port,host:t.host,hostname:t.hostname,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):""}};var S=function(e){return new n((function(t){var n=new XDomainRequest,r=function(r){var o=r.type,i=0;"load"===o?i=200:"error"===o&&(i=500),t(e.respondWith(n.responseText,{status:i}))};e.abort=function(){return n.abort()},n.open(e.method,e.getUrl()),e.timeout&&(n.timeout=e.timeout),n.onload=r,n.onabort=r,n.onerror=r,n.ontimeout=r,n.onprogress=function(){},n.send(e.getBody())}))},T=c&&"withCredentials"in new XMLHttpRequest,j=function(e){return new n((function(t){var n,r,o=e.jsonp||"callback",i=e.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),a=null;n=function(n){var o=n.type,s=0;"load"===o&&null!==a?s=200:"error"===o&&(s=500),s&&window[i]&&(delete window[i],document.body.removeChild(r)),t(e.respondWith(a,{status:s}))},window[i]=function(e){a=JSON.stringify(e)},e.abort=function(){n({type:"abort"})},e.params[o]=i,e.timeout&&setTimeout(e.abort,e.timeout),(r=document.createElement("script")).src=e.getUrl(),r.type="text/javascript",r.async=!0,r.onload=n,r.onerror=n,document.body.appendChild(r)}))},E=function(e){return new n((function(t){var n=new XMLHttpRequest,r=function(r){var o=e.respondWith("response"in n?n.response:n.responseText,{status:1223===n.status?204:n.status,statusText:1223===n.status?"No Content":u(n.statusText)});g(u(n.getAllResponseHeaders()).split("\n"),(function(e){o.headers.append(e.slice(0,e.indexOf(":")),e.slice(e.indexOf(":")+1))})),t(o)};e.abort=function(){return n.abort()},e.progress&&("GET"===e.method?n.addEventListener("progress",e.progress):/^(POST|PUT)$/i.test(e.method)&&n.upload.addEventListener("progress",e.progress)),n.open(e.method,e.getUrl(),!0),e.timeout&&(n.timeout=e.timeout),e.responseType&&"responseType"in n&&(n.responseType=e.responseType),(e.withCredentials||e.credentials)&&(n.withCredentials=!0),e.crossOrigin||e.headers.set("X-Requested-With","XMLHttpRequest"),e.headers.forEach((function(e,t){n.setRequestHeader(t,e)})),n.onload=r,n.onabort=r,n.onerror=r,n.ontimeout=r,n.send(e.getBody())}))},M=function(e){var t=require("got");return new n((function(n){var r,o=e.getUrl(),i=e.getBody(),a=e.method,s={};e.headers.forEach((function(e,t){s[t]=e})),t(o,{body:i,method:a,headers:s}).then(r=function(t){var r=e.respondWith(t.body,{status:t.statusCode,statusText:u(t.statusMessage)});g(t.headers,(function(e,t){r.headers.set(t,e)})),n(r)},(function(e){return r(e.response)}))}))};function N(e,t){t((e.client||(c?E:M))(e))}var P=function(e){var t=this;this.map={},g(e,(function(e,n){return t.append(n,e)}))};function I(e,t){return Object.keys(e).reduce((function(e,n){return l(t)===l(n)?n:e}),null)}P.prototype.has=function(e){return null!==I(this.map,e)},P.prototype.get=function(e){var t=this.map[I(this.map,e)];return t?t.join():null},P.prototype.getAll=function(e){return this.map[I(this.map,e)]||[]},P.prototype.set=function(e,t){this.map[function(e){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return u(e)}(I(this.map,e)||e)]=[u(t)]},P.prototype.append=function(e,t){var n=this.map[I(this.map,e)];n?n.push(u(t)):this.set(e,t)},P.prototype.delete=function(e){delete this.map[I(this.map,e)]},P.prototype.deleteAll=function(){this.map={}},P.prototype.forEach=function(e,t){var n=this;g(this.map,(function(r,o){g(r,(function(r){return e.call(t,r,o,n)}))}))};var L=function(e,t){var r=t.url,o=t.headers,i=t.status,a=t.statusText;this.url=r,this.ok=i>=200&&i<300,this.status=i||0,this.statusText=a||"",this.headers=new P(o),this.body=e,p(e)?this.bodyText=e:"undefined"!=typeof Blob&&e instanceof Blob&&(this.bodyBlob=e,function(e){return 0===e.type.indexOf("text")||-1!==e.type.indexOf("json")}(e)&&(this.bodyText=function(e){return new n((function(t){var n=new FileReader;n.readAsText(e),n.onload=function(){t(n.result)}}))}(e)))};L.prototype.blob=function(){return m(this.bodyBlob)},L.prototype.text=function(){return m(this.bodyText)},L.prototype.json=function(){return m(this.text(),(function(e){return JSON.parse(e)}))},Object.defineProperty(L.prototype,"data",{get:function(){return this.body},set:function(e){this.body=e}});var D=function(e){var t;this.body=null,this.params={},b(this,e,{method:(t=e.method||"GET",t?t.toUpperCase():"")}),this.headers instanceof P||(this.headers=new P(this.headers))};D.prototype.getUrl=function(){return A(this)},D.prototype.getBody=function(){return this.body},D.prototype.respondWith=function(e,t){return new L(e,b(t||{},{url:this.getUrl()}))};var R={"Content-Type":"application/json;charset=utf-8"};function F(e){var t=this||{},r=function(e){var t,r=[N],o=[];function i(i){return new n((function(n,a){function c(){var n;d(t=r.pop())?t.call(e,i,u):(n="Invalid interceptor of type "+typeof t+", must be a function","undefined"!=typeof console&&s&&console.warn("[VueResource warn]: "+n),u())}function u(t){if(d(t))o.unshift(t);else if(v(t))return o.forEach((function(n){t=m(t,(function(t){return n.call(e,t)||t}),a)})),void m(t,n,a);c()}c()}),e)}return v(e)||(e=null),i.use=function(e){r.push(e)},i}(t.$vm);return function(e){a.call(arguments,1).forEach((function(t){for(var n in t)void 0===e[n]&&(e[n]=t[n])}))}(e||{},t.$options,F.options),F.interceptors.forEach((function(e){p(e)&&(e=F.interceptor[e]),d(e)&&r.use(e)})),r(new D(e)).then((function(e){return e.ok?e:n.reject(e)}),(function(e){var t;return e instanceof Error&&(t=e,"undefined"!=typeof console&&console.error(t)),n.reject(e)}))}function U(e,t,n,r){var o=this||{},i={};return g(n=b({},U.actions,n),(function(n,a){n=_({url:e,params:b({},t)},r,n),i[a]=function(){return(o.$http||F)(H(n,arguments))}})),i}function H(e,t){var n,r=b({},e),o={};switch(t.length){case 2:o=t[0],n=t[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(r.method)?n=t[0]:o=t[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+t.length+" arguments"}return r.body=n,r.params=b({},r.params,o),r}function V(e){var t,r,i;V.installed||(r=(t=e).config,i=t.nextTick,o=i,s=r.debug||!r.silent,e.url=A,e.http=F,e.resource=U,e.Promise=n,Object.defineProperties(e.prototype,{$url:{get:function(){return y(e.url,this,this.$options.url)}},$http:{get:function(){return y(e.http,this,this.$options.http)}},$resource:{get:function(){return e.resource.bind(this)}},$promise:{get:function(){var t=this;return function(n){return new e.Promise(n,t)}}}}))}return F.options={},F.headers={put:R,post:R,patch:R,delete:R,common:{Accept:"application/json, text/plain, */*"},custom:{}},F.interceptor={before:function(e,t){d(e.before)&&e.before.call(this,e),t()},method:function(e,t){e.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(e.method)&&(e.headers.set("X-HTTP-Method-Override",e.method),e.method="POST"),t()},jsonp:function(e,t){"JSONP"==e.method&&(e.client=j),t()},json:function(e,t){var n=e.headers.get("Content-Type")||"";v(e.body)&&0===n.indexOf("application/json")&&(e.body=JSON.stringify(e.body)),t((function(e){return e.bodyText?m(e.text(),(function(t){if(0===(n=e.headers.get("Content-Type")||"").indexOf("application/json")||(o=(r=t).match(/^\[|^\{(?!\{)/))&&{"[":/]$/,"{":/}$/}[o[0]].test(r))try{e.body=JSON.parse(t)}catch(t){e.body=null}else e.body=t;var r,o;return e})):e}))},form:function(e,t){var n;n=e.body,"undefined"!=typeof FormData&&n instanceof FormData?e.headers.delete("Content-Type"):v(e.body)&&e.emulateJSON&&(e.body=A.params(e.body),e.headers.set("Content-Type","application/x-www-form-urlencoded")),t()},header:function(e,t){g(b({},F.headers.common,e.crossOrigin?{}:F.headers.custom,F.headers[l(e.method)]),(function(t,n){e.headers.has(n)||e.headers.set(n,t)})),t()},cors:function(e,t){if(c){var n=A.parse(location.href),r=A.parse(e.getUrl());r.protocol===n.protocol&&r.host===n.host||(e.crossOrigin=!0,e.emulateHTTP=!1,T||(e.client=S))}t()}},F.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach((function(e){F[e]=function(t,n){return this(b(n||{},{url:t,method:e}))}})),["post","put","patch"].forEach((function(e){F[e]=function(t,n,r){return this(b(r||{},{url:t,method:e,body:n}))}})),U.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(V),V}));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/src/apps/js/frontend/quiz/components/timer/index.js CHANGED
@@ -9,23 +9,14 @@ import { select, dispatch } from '@wordpress/data';
9
  const Timer = () => {
10
  const { getData } = select( 'learnpress/quiz' );
11
  const { submitQuiz } = dispatch( 'learnpress/quiz' );
12
-
13
  const totalTime = getData( 'totalTime' );
14
  const durationTime = getData( 'duration' );
15
- /* const endTime = getData( 'endTime' );
16
-
17
- const d1 = new Date( endTime.replace( /-/g, '/' ) );
18
- const d2 = new Date();
19
- const tz = new Date().getTimezoneOffset();
20
- const t = parseInt( ( d1.getTime() / 1000 ) - ( ( d2.getTime() / 1000 ) + ( tz * 60 ) ) );*/
21
-
22
  const [ seconds, setSeconds ] = useState( totalTime );
23
  let [ timeSpend, setTimeSpend ] = useState( 0 );
24
- const limitTime = totalTime > 0;
25
 
26
  useEffect( () => {
27
  const myInterval = setInterval( () => {
28
- if ( limitTime ) {
29
  let remainSeconds = seconds;
30
  remainSeconds -= 1;
31
 
9
  const Timer = () => {
10
  const { getData } = select( 'learnpress/quiz' );
11
  const { submitQuiz } = dispatch( 'learnpress/quiz' );
 
12
  const totalTime = getData( 'totalTime' );
13
  const durationTime = getData( 'duration' );
 
 
 
 
 
 
 
14
  const [ seconds, setSeconds ] = useState( totalTime );
15
  let [ timeSpend, setTimeSpend ] = useState( 0 );
 
16
 
17
  useEffect( () => {
18
  const myInterval = setInterval( () => {
19
+ if ( durationTime > 0 ) {
20
  let remainSeconds = seconds;
21
  remainSeconds -= 1;
22
 
assets/src/js/admin/admin.js CHANGED
@@ -307,12 +307,12 @@
307
  .on( 'click', '.plugin-action-buttons a', pluginActions )
308
  .on( 'click', '[data-remove-confirm]', preventDefault )
309
  .on( 'mousedown', '.lp-sortable-handle', function( e ) {
310
- $( 'html, body' ).addClass( 'lp-item-moving' );
311
- $( e.target ).closest( '.lp-sortable-handle' ).css( 'cursor', 'inherit' );
312
- } ).on( 'mouseup', function( e ) {
313
- $( 'html, body' ).removeClass( 'lp-item-moving' );
314
- $( '.lp-sortable-handle' ).css( 'cursor', '' );
315
- } );
316
 
317
  /**
318
  * Function Export invoice LP Order
@@ -498,18 +498,26 @@
498
  }
499
 
500
  // Show/hide meta-box field with type checkbox
501
- $( 'input' ).on( 'click' , function ( e ) {
502
  const el = $( e.target );
 
 
 
 
503
  const id = el.attr( 'id' );
504
- const classHide = id.replace('learn_press_', '');
505
- const elHide = $(`.show_if_${classHide}`);
 
 
 
 
506
 
507
- if ( el.is(':checked') ) {
508
  elHide.show();
509
  } else {
510
  elHide.hide();
511
  }
512
- });
513
  };
514
 
515
  $( document ).ready( onReady );
307
  .on( 'click', '.plugin-action-buttons a', pluginActions )
308
  .on( 'click', '[data-remove-confirm]', preventDefault )
309
  .on( 'mousedown', '.lp-sortable-handle', function( e ) {
310
+ $( 'html, body' ).addClass( 'lp-item-moving' );
311
+ $( e.target ).closest( '.lp-sortable-handle' ).css( 'cursor', 'inherit' );
312
+ } ).on( 'mouseup', function( e ) {
313
+ $( 'html, body' ).removeClass( 'lp-item-moving' );
314
+ $( '.lp-sortable-handle' ).css( 'cursor', '' );
315
+ } );
316
 
317
  /**
318
  * Function Export invoice LP Order
498
  }
499
 
500
  // Show/hide meta-box field with type checkbox
501
+ $( 'input' ).on( 'click', function( e ) {
502
  const el = $( e.target );
503
+ if ( ! el.length ) {
504
+ return;
505
+ }
506
+
507
  const id = el.attr( 'id' );
508
+ if ( ! id ) {
509
+ return;
510
+ }
511
+
512
+ const classHide = id.replace( 'learn_press_', '' );
513
+ const elHide = $( `.show_if_${ classHide }` );
514
 
515
+ if ( el.is( ':checked' ) ) {
516
  elHide.show();
517
  } else {
518
  elHide.hide();
519
  }
520
+ } );
521
  };
522
 
523
  $( document ).ready( onReady );
inc/admin/class-lp-install-sample-data.php CHANGED
@@ -80,6 +80,8 @@ class LP_Install_Sample_Data {
80
 
81
  /**
82
  * Install
 
 
83
  */
84
  public function install() {
85
  if ( ! wp_verify_nonce( LP_Request::get_string( '_wpnonce' ), 'install-sample-course' ) ) {
@@ -89,26 +91,25 @@ class LP_Install_Sample_Data {
89
  $dummy_text = LP_WP_Filesystem::instance()->file_get_contents( LP_PLUGIN_PATH . '/dummy-data/dummy-text.txt' );
90
  $this->dummy_text = preg_split( '!\s!', $dummy_text );
91
 
92
- $section_range = LP_Request::get( 'section-range' );
93
  if ( $section_range ) {
94
  self::$section_range = $section_range;
95
  }
96
 
97
- $item_range = LP_Request::get( 'item-range' );
98
  if ( $item_range ) {
99
  self::$item_range = $item_range;
100
  }
101
 
102
- $question_range = LP_Request::get( 'question-range' );
103
  if ( $question_range ) {
104
  self::$question_range = $question_range;
105
  }
106
 
107
- $answer_range = LP_Request::get( 'answer-range' );
108
  if ( $answer_range ) {
109
  self::$answer_range = $answer_range;
110
  }
111
- //LP_Debug::startTransaction();
112
 
113
  try {
114
  @ini_set( 'memory_limit', '2G' );
@@ -126,7 +127,7 @@ class LP_Install_Sample_Data {
126
  unset( $wp_filter[ $key ] );
127
  }
128
 
129
- $name = LP_Request::get_string( 'custom-name' );
130
  $course_id = $this->create_course( $name );
131
 
132
  if ( ! $course_id ) {
@@ -135,8 +136,7 @@ class LP_Install_Sample_Data {
135
 
136
  $this->create_sections( $course_id );
137
 
138
- $price = LP_Request::get( 'course-price' );
139
-
140
  if ( $price ) {
141
  update_post_meta( $course_id, '_lp_regular_price', $price );
142
  }
@@ -162,10 +162,7 @@ class LP_Install_Sample_Data {
162
  </div>
163
 
164
  <?php
165
- //LP_Debug::commitTransaction();
166
-
167
  } catch ( Exception $ex ) {
168
- //LP_Debug::rollbackTransaction();
169
  echo '<div class="lp-install-sample__response fail">';
170
  echo wp_kses_post( $ex->getMessage() );
171
  echo '</div>';
80
 
81
  /**
82
  * Install
83
+ *
84
+ * @TODO - Need write to api, not hook init.
85
  */
86
  public function install() {
87
  if ( ! wp_verify_nonce( LP_Request::get_string( '_wpnonce' ), 'install-sample-course' ) ) {
91
  $dummy_text = LP_WP_Filesystem::instance()->file_get_contents( LP_PLUGIN_PATH . '/dummy-data/dummy-text.txt' );
92
  $this->dummy_text = preg_split( '!\s!', $dummy_text );
93
 
94
+ $section_range = LP_Request::get_param( 'section-range', 0, 'int' );
95
  if ( $section_range ) {
96
  self::$section_range = $section_range;
97
  }
98
 
99
+ $item_range = LP_Request::get_param( 'item-range', 0, 'int' );
100
  if ( $item_range ) {
101
  self::$item_range = $item_range;
102
  }
103
 
104
+ $question_range = LP_Request::get_param( 'question-range', 0, 'int' );
105
  if ( $question_range ) {
106
  self::$question_range = $question_range;
107
  }
108
 
109
+ $answer_range = LP_Request::get_param( 'answer-range', 0, 'int' );
110
  if ( $answer_range ) {
111
  self::$answer_range = $answer_range;
112
  }
 
113
 
114
  try {
115
  @ini_set( 'memory_limit', '2G' );
127
  unset( $wp_filter[ $key ] );
128
  }
129
 
130
+ $name = LP_Request::get_param( 'custom-name' );
131
  $course_id = $this->create_course( $name );
132
 
133
  if ( ! $course_id ) {
136
 
137
  $this->create_sections( $course_id );
138
 
139
+ $price = LP_Request::get_param( 'course-price', 0, 'float' );
 
140
  if ( $price ) {
141
  update_post_meta( $course_id, '_lp_regular_price', $price );
142
  }
162
  </div>
163
 
164
  <?php
 
 
165
  } catch ( Exception $ex ) {
 
166
  echo '<div class="lp-install-sample__response fail">';
167
  echo wp_kses_post( $ex->getMessage() );
168
  echo '</div>';
inc/admin/class-lp-setup-wizard.php CHANGED
@@ -352,7 +352,7 @@ class LP_Setup_Wizard {
352
  return array(
353
  'paypal' => array(
354
  'name' => __( 'PayPal', 'learnpress' ),
355
- 'icon' => LP()->plugin_url( '/assets/images/paypal-2.png' ),
356
  'callback' => array( $this, 'setup_paypal' ),
357
  ),
358
  );
352
  return array(
353
  'paypal' => array(
354
  'name' => __( 'PayPal', 'learnpress' ),
355
+ 'icon' => LearnPress::instance()->plugin_url( '/assets/images/paypal-2.png' ),
356
  'callback' => array( $this, 'setup_paypal' ),
357
  ),
358
  );
inc/admin/lp-admin-functions.php CHANGED
@@ -155,7 +155,7 @@ function learn_press_get_admin_view( $name, $plugin_file = null ) {
155
  if ( $plugin_file ) {
156
  $view = dirname( $plugin_file ) . '/inc/admin/views/' . $name;
157
  } else {
158
- $view = LP()->plugin_path( 'inc/admin/views/' . $name );
159
  }
160
 
161
  return apply_filters( 'learn_press_admin_view', $view, $name );
155
  if ( $plugin_file ) {
156
  $view = dirname( $plugin_file ) . '/inc/admin/views/' . $name;
157
  } else {
158
+ $view = LearnPress::instance()->plugin_path( 'inc/admin/views/' . $name );
159
  }
160
 
161
  return apply_filters( 'learn_press_admin_view', $view, $name );
inc/admin/meta-box/class-lp-meta-box-helper.php CHANGED
@@ -117,7 +117,7 @@ if ( ! class_exists( 'LP_Meta_Box_Helper' ) ) {
117
 
118
  public static function save_fields( $options, $data = null ) {
119
  if ( is_null( $data ) ) {
120
- $data = LP_Helper::sanitize_params_submitted( $_POST );
121
  }
122
 
123
  if ( empty( $data ) ) {
@@ -149,7 +149,7 @@ if ( ! class_exists( 'LP_Meta_Box_Helper' ) ) {
149
  $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
150
  break;
151
  case 'textarea':
152
- $value = LP_Helper::sanitize_params_submitted( trim( $raw_value ), 'html' );
153
  break;
154
  case 'multiselect':
155
  case 'multi_select_countries':
@@ -193,7 +193,7 @@ if ( ! class_exists( 'LP_Meta_Box_Helper' ) ) {
193
  }
194
  }
195
 
196
- $value = LP_Helper::sanitize_params_submitted( $value );
197
  break;
198
 
199
  case 'image_advanced':
@@ -204,13 +204,13 @@ if ( ! class_exists( 'LP_Meta_Box_Helper' ) ) {
204
  break;
205
  case 'email-content':
206
  $value = ! empty( $raw_value ) ? $raw_value : array();
207
- $value = LP_Helper::sanitize_params_submitted( $value, 'html' );
208
  break;
209
  case 'url':
210
  $value = ! empty( $raw_value ) ? esc_url_raw( $raw_value ) : '';
211
  break;
212
  default:
213
- $value = LP_Helper::sanitize_params_submitted( $raw_value );
214
  break;
215
  }
216
 
117
 
118
  public static function save_fields( $options, $data = null ) {
119
  if ( is_null( $data ) ) {
120
+ $data = LP_Helper::sanitize_params_submitted( $_POST, 'html' );
121
  }
122
 
123
  if ( empty( $data ) ) {
149
  $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
150
  break;
151
  case 'textarea':
152
+ $value = trim( $raw_value );
153
  break;
154
  case 'multiselect':
155
  case 'multi_select_countries':
193
  }
194
  }
195
 
196
+ //$value = LP_Helper::sanitize_params_submitted( $value );
197
  break;
198
 
199
  case 'image_advanced':
204
  break;
205
  case 'email-content':
206
  $value = ! empty( $raw_value ) ? $raw_value : array();
207
+ //$value = LP_Helper::sanitize_params_submitted( $value, 'html' );
208
  break;
209
  case 'url':
210
  $value = ! empty( $raw_value ) ? esc_url_raw( $raw_value ) : '';
211
  break;
212
  default:
213
+ $value = $raw_value;
214
  break;
215
  }
216
 
inc/admin/meta-box/fields/email-content.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- wp_enqueue_script( 'learn-press-email-content-field', LP()->plugin_url( 'inc/admin/meta-box/assets/email-content.js' ) );
3
- wp_enqueue_style( 'learn-press-email-content-field', LP()->plugin_url( 'inc/admin/meta-box/assets/email-content.css' ) );
4
 
5
  if ( ! isset( $value ) ) {
6
  return;
1
  <?php
2
+ wp_enqueue_script( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.js' ) );
3
+ wp_enqueue_style( 'learn-press-email-content-field', LearnPress::instance()->plugin_url( 'inc/admin/meta-box/assets/email-content.css' ) );
4
 
5
  if ( ! isset( $value ) ) {
6
  return;
inc/admin/views/updates/html-updated-latest-message.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  defined( 'ABSPATH' ) || exit;
11
 
12
- LP()->session->remove( 'do-update-learnpress', true );
13
  ?>
14
 
15
  <div class="updated notice">
9
 
10
  defined( 'ABSPATH' ) || exit;
11
 
12
+ LearnPress::instance()->session->remove( 'do-update-learnpress', true );
13
  ?>
14
 
15
  <div class="updated notice">
inc/cart/class-lp-cart.php CHANGED
@@ -58,12 +58,12 @@ class LP_Cart {
58
  $this->_cart_session_key = $key;
59
  }
60
 
61
- LP_Request_Handler::register( 'add-course-to-cart', array( $this, 'add_to_cart' ), 20 );
62
- LP_Request_Handler::register( 'remove-cart-item', array( $this, 'remove_item' ), 20 );
63
 
64
  add_action( 'learn-press/add-to-cart', array( $this, 'calculate_totals' ), 10 );
65
- add_action( 'wp', array( $this, 'maybe_set_cart_cookies' ), 99 );
66
- add_action( 'shutdown', array( $this, 'maybe_set_cart_cookies' ), 0 );
67
  add_action( 'wp_loaded', array( $this, 'init' ) );
68
  }
69
 
@@ -72,9 +72,20 @@ class LP_Cart {
72
  * Get data from session and put to cart content.
73
  */
74
  function init() {
 
 
 
 
 
 
 
 
75
  $this->get_cart_from_session();
76
  }
77
 
 
 
 
78
  public function maybe_set_cart_cookies() {
79
 
80
  if ( ! headers_sent()/* && did_action( 'wp_loaded' )*/ ) {
@@ -289,46 +300,51 @@ class LP_Cart {
289
 
290
  /**
291
  * Load cart content data from session
 
 
 
292
  */
293
  public function get_cart_from_session() {
294
- if ( ! did_action( 'learn_press_get_cart_from_session' ) ) {
295
- $cart = learn_press_session_get( $this->_cart_session_key );
296
- $data = array();
297
- if ( $cart ) {
298
- foreach ( $cart as $cart_id => $values ) {
299
- if ( ! empty( $values['item_id'] ) ) {
300
-
301
- $item_type = get_post_type( $values['item_id'] );
302
- if ( ! in_array( $item_type, learn_press_get_item_types_can_purchase() ) ) {
303
- return false;
304
- }
305
- switch ( $item_type ) {
306
- case LP_COURSE_CPT:
307
- $course = learn_press_get_course( $values['item_id'] );
308
- if ( $course && $course->exists() && $values['quantity'] > 0 ) {
309
- if ( ! $course->is_purchasable() ) {
310
- learn_press_add_message( sprintf( __( '%s has been removed from your cart because it can no longer be purchased.', 'learnpress' ), $course->get_title() ), 'error' );
311
- do_action( 'learn-press/remove-cart-item-from-session', $cart, $values );
312
- } else {
313
- $data = array_merge( $values, array( 'data' => $course ) );
314
- $this->_cart_content[ $cart_id ] = $data;
315
- }
 
 
316
  }
317
- break;
318
- default:
319
- $this->_cart_content[ $cart_id ] = apply_filters( 'learn-press/get-cart-item-from-session/item_type_' . $item_type, $data, $values, $cart_id );
320
- break;
321
- }
322
  }
323
  }
324
  }
 
325
 
326
- do_action( 'learn_press_cart_loaded_from_session' );
327
- LP()->session->set( $this->_cart_session_key, $this->get_cart_for_session() );
328
- do_action( 'learn_press_get_cart_from_session' );
329
 
330
- $this->calculate_totals();
331
- }
332
  }
333
 
334
  /**
@@ -406,8 +422,8 @@ class LP_Cart {
406
 
407
  $this->_cart_content = array();
408
 
409
- unset( LP()->session->order_awaiting_payment );
410
- unset( LP()->session->cart );
411
 
412
  do_action( 'learn-press/cart/emptied' );
413
 
58
  $this->_cart_session_key = $key;
59
  }
60
 
61
+ LP_Request::register( 'add-course-to-cart', array( $this, 'add_to_cart' ), 20 );
62
+ LP_Request::register( 'remove-cart-item', array( $this, 'remove_item' ), 20 );
63
 
64
  add_action( 'learn-press/add-to-cart', array( $this, 'calculate_totals' ), 10 );
65
+ //add_action( 'wp', array( $this, 'maybe_set_cart_cookies' ), 99 );
66
+ //add_action( 'shutdown', array( $this, 'maybe_set_cart_cookies' ), 0 );
67
  add_action( 'wp_loaded', array( $this, 'init' ) );
68
  }
69
 
72
  * Get data from session and put to cart content.
73
  */
74
  function init() {
75
+ // Only load on checkout page
76
+ $page_checkout_option = untrailingslashit( get_the_permalink( learn_press_get_page_id( 'checkout' ) ) );
77
+ $page_checkout_option = str_replace( '/', '\/', $page_checkout_option );
78
+ $pattern = '/' . $page_checkout_option . '/';
79
+ if ( ! preg_match( $pattern, LP_Helper::getUrlCurrent() ) ) {
80
+ return;
81
+ }
82
+
83
  $this->get_cart_from_session();
84
  }
85
 
86
+ /**
87
+ * @depecated 4.1.7.2
88
+ */
89
  public function maybe_set_cart_cookies() {
90
 
91
  if ( ! headers_sent()/* && did_action( 'wp_loaded' )*/ ) {
300
 
301
  /**
302
  * Load cart content data from session
303
+ *
304
+ * @since 3.0.0
305
+ * @version 3.0.1
306
  */
307
  public function get_cart_from_session() {
308
+ if ( did_action( 'learn_press_get_cart_from_session' ) ) {
309
+ return;
310
+ }
311
+
312
+ $cart = learn_press_session_get( $this->_cart_session_key );
313
+ $data = array();
314
+ if ( $cart ) {
315
+ foreach ( $cart as $cart_id => $values ) {
316
+ if ( ! empty( $values['item_id'] ) ) {
317
+ $item_type = get_post_type( $values['item_id'] );
318
+ if ( ! in_array( $item_type, learn_press_get_item_types_can_purchase() ) ) {
319
+ continue;
320
+ }
321
+
322
+ switch ( $item_type ) {
323
+ case LP_COURSE_CPT:
324
+ $course = learn_press_get_course( $values['item_id'] );
325
+ if ( $course && $course->exists() && $values['quantity'] > 0 ) {
326
+ if ( ! $course->is_purchasable() ) {
327
+ learn_press_add_message( sprintf( __( '%s has been removed from your cart because it can no longer be purchased.', 'learnpress' ), $course->get_title() ), 'error' );
328
+ do_action( 'learn-press/remove-cart-item-from-session', $cart, $values );
329
+ } else {
330
+ $data = array_merge( $values, array( 'data' => $course ) );
331
+ $this->_cart_content[ $cart_id ] = $data;
332
  }
333
+ }
334
+ break;
335
+ default:
336
+ $this->_cart_content[ $cart_id ] = apply_filters( 'learn-press/get-cart-item-from-session/item_type_' . $item_type, $data, $values, $cart_id );
337
+ break;
338
  }
339
  }
340
  }
341
+ }
342
 
343
+ do_action( 'learn_press_cart_loaded_from_session' );
344
+ LearnPress::instance()->session->set( $this->_cart_session_key, $this->get_cart_for_session() );
345
+ do_action( 'learn_press_get_cart_from_session' );
346
 
347
+ $this->calculate_totals();
 
348
  }
349
 
350
  /**
422
 
423
  $this->_cart_content = array();
424
 
425
+ unset( LearnPress::instance()->session->order_awaiting_payment );
426
+ unset( LearnPress::instance()->session->cart );
427
 
428
  do_action( 'learn-press/cart/emptied' );
429
 
inc/cart/lp-cart-functions.php CHANGED
@@ -5,7 +5,7 @@
5
  * @return mixed
6
  */
7
  function learn_press_get_cart() {
8
- return LP()->cart;
9
  }
10
 
11
  function learn_press_enable_cart() {
@@ -18,7 +18,7 @@ function learn_press_enable_cart() {
18
  * @return string
19
  */
20
  function learn_press_get_cart_description() {
21
- $items = LP()->cart->get_items();
22
  $description = array();
23
 
24
  if ( $items ) {
@@ -50,7 +50,7 @@ function learn_press_get_cart_course_url() {
50
  * @return mixed
51
  */
52
  function learn_press_get_cart_total() {
53
- return LP()->cart->total;
54
  }
55
 
56
  function learn_press_clear_cart_after_payment() {
@@ -63,18 +63,18 @@ function learn_press_clear_cart_after_payment() {
63
 
64
  if ( $order_id > 0 && $order ) {
65
  if ( $order->order_key === $order_key ) {
66
- LP()->cart->empty_cart();
67
  }
68
  }
69
  }
70
 
71
- if ( ! is_null( LP()->session ) && LP()->session->order_awaiting_payment > 0 ) {
72
- $order = learn_press_get_order( LP()->session->order_awaiting_payment );
73
 
74
  if ( $order && $order->id > 0 ) {
75
  if ( ! $order->has_status( array( 'failed', 'pending', 'cancelled' ) ) ) {
76
- LP()->cart->empty_cart();
77
- LP()->session->order_awaiting_payment = null;
78
  }
79
  }
80
  }
5
  * @return mixed
6
  */
7
  function learn_press_get_cart() {
8
+ return LearnPress::instance()->cart;
9
  }
10
 
11
  function learn_press_enable_cart() {
18
  * @return string
19
  */
20
  function learn_press_get_cart_description() {
21
+ $items = LearnPress::instance()->cart->get_items();
22
  $description = array();
23
 
24
  if ( $items ) {
50
  * @return mixed
51
  */
52
  function learn_press_get_cart_total() {
53
+ return LearnPress::instance()->cart->total;
54
  }
55
 
56
  function learn_press_clear_cart_after_payment() {
63
 
64
  if ( $order_id > 0 && $order ) {
65
  if ( $order->order_key === $order_key ) {
66
+ LearnPress::instance()->cart->empty_cart();
67
  }
68
  }
69
  }
70
 
71
+ if ( ! is_null( LearnPress::instance()->session ) && LearnPress::instance()->session->order_awaiting_payment > 0 ) {
72
+ $order = learn_press_get_order( LearnPress::instance()->session->order_awaiting_payment );
73
 
74
  if ( $order && $order->id > 0 ) {
75
  if ( ! $order->has_status( array( 'failed', 'pending', 'cancelled' ) ) ) {
76
+ LearnPress::instance()->cart->empty_cart();
77
+ LearnPress::instance()->session->order_awaiting_payment = null;
78
  }
79
  }
80
  }
inc/class-lp-ajax.php CHANGED
@@ -11,14 +11,10 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
11
  'checkout-user-email-exists:nopriv',
12
  'recover-order',
13
  'request-become-a-teacher:nonce',
14
- // 'upload-user-avatar',
15
  'checkout:nopriv',
16
  'complete-lesson',
17
  'finish-course', // finish_course.
18
- // 'retake-course', // retake_course.
19
  'external-link:nopriv',
20
- // 'save-uploaded-user-avatar',
21
- // 'load-more-courses',
22
  );
23
 
24
  $ajax_events = apply_filters( 'learn-press/ajax/events', $ajax_events );
@@ -39,50 +35,8 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
39
 
40
  LP_Request::register_ajax( $action, $callback );
41
  }
42
-
43
- //add_action( 'wp_ajax_learnpress_upload-user-avatar', array( __CLASS__, 'upload_user_avatar' ) );
44
  }
45
 
46
- /**
47
- * @depecated v4.1.6.4
48
- */
49
- /*public static function load_more_courses() {
50
- _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.1.6.4' );
51
- $type = LP_Request::get( 'type' );
52
- $user_id = LP_Request::get_int( 'user', 0 );
53
- $paged = LP_Request::get_int( 'current_page', 1 );
54
- $template = LP_Request::get( 'template' );
55
-
56
- $user = learn_press_get_user( $user_id );
57
- $template_args = array();
58
-
59
- if ( in_array( $type, array( 'featured', 'latest' ) ) ) {
60
- $query_args = array(
61
- 'paginate' => true,
62
- 'return' => 'ids',
63
- 'author' => $user->get_id(),
64
- 'paged' => $paged,
65
- );
66
-
67
- if ( 'featured' === $type ) {
68
- $query_args['featured'] = 1;
69
- }
70
-
71
- $query = new LP_Course_Query( $query_args );
72
- $template_args = (array) $query->get_courses();
73
- $template = "profile/dashboard/{$type}-courses";
74
-
75
- } else {
76
- $profile = LP_Profile::instance( $user_id );
77
- $filter_status = LP_Request::get_string( 'filter-status' );
78
- $query = $profile->query_courses( 'purchased', array( 'status' => $filter_status ) );
79
- }
80
-
81
- learn_press_get_template( $template, $template_args );
82
-
83
- wp_die();
84
- }*/
85
-
86
  public static function external_link() {
87
  $nonce = LP_Request::get( 'nonce' );
88
  $id = LP_Request::get( 'id' );
@@ -105,7 +59,7 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
105
  }
106
 
107
  public static function checkout() {
108
- LP()->checkout()->process_checkout_handler();
109
  }
110
 
111
  public static function request_become_a_teacher() {
@@ -175,39 +129,6 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
175
  learn_press_maybe_send_json( $response );
176
  }
177
 
178
- /*public static function upload_user_avatar() {
179
- $file = $_FILES['lp-upload-avatar'];
180
- $upload_dir = learn_press_user_profile_picture_upload_dir();
181
-
182
- add_filter( 'upload_dir', array( __CLASS__, '_user_avatar_upload_dir' ), 10000 );
183
-
184
- $result = wp_handle_upload(
185
- $file,
186
- array(
187
- 'test_form' => false,
188
- )
189
- );
190
-
191
- remove_filter( 'upload_dir', array( __CLASS__, '_user_avatar_upload_dir' ), 10000 );
192
-
193
- if ( is_array( $result ) ) {
194
- $result['name'] = $upload_dir['subdir'] . '/' . basename( $result['file'] );
195
- unset( $result['file'] );
196
- } else {
197
- $result = array(
198
- 'error' => __( 'Profile picture upload failed', 'learnpress' ),
199
- );
200
- }
201
-
202
- learn_press_send_json( $result );
203
- }*/
204
-
205
- public static function _user_avatar_upload_dir( $dir ) {
206
- $dir = learn_press_user_profile_picture_upload_dir();
207
-
208
- return $dir;
209
- }
210
-
211
  /**
212
  * Request finish course
213
  *
@@ -258,34 +179,42 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
258
  * Complete lesson
259
  */
260
  public static function complete_lesson() {
261
- $nonce = LP_Request::get_string( 'complete-lesson-nonce' );
262
- $item_id = LP_Request::get_int( 'id' );
263
- $course_id = LP_Request::get_int( 'course_id' );
264
-
265
- $post = get_post( $item_id );
266
- $user = learn_press_get_current_user();
267
- $course = learn_press_get_course( $course_id );
268
- if ( ! $course ) {
269
- return;
270
- }
271
-
272
  $response = array(
273
- 'result' => 'success',
274
- 'redirect' => $course->get_item_link( $item_id ),
275
  );
276
 
277
  try {
278
- // security check
279
- if ( ! $post || ( $post && ! wp_verify_nonce( $nonce, 'lesson-complete' ) ) ) {
280
- throw new Exception( __( 'Error! Invalid lesson or failed security check.', 'learnpress' ), 8000 );
 
 
 
 
 
 
 
 
281
  }
282
 
283
- $item = $course->get_item( $item_id );
 
 
 
 
 
 
 
 
 
 
284
  if ( ! $item instanceof LP_Course_Item ) {
285
- throw new Exception( 'Item is invalid!' );
286
  }
287
 
288
- $result = $user->complete_lesson( $item_id );
 
289
 
290
  if ( ! is_wp_error( $result ) ) {
291
  if ( $course->get_next_item() ) {
@@ -294,88 +223,23 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
294
  }
295
 
296
  learn_press_add_message( sprintf( __( 'Congrats! You have completed "%s".', 'learnpress' ), $item->get_title() ) );
 
297
  } else {
298
- throw new Exception( $result->get_error_message(), 'error' );
299
  }
300
 
301
- $response = apply_filters( 'learn-press/user-completed-lesson-result', $response, $item_id, $course_id, $user->get_id() );
302
  } catch ( Exception $ex ) {
303
  learn_press_add_message( $ex->getMessage(), 'error' );
304
  }
305
 
306
- if ( learn_press_message_count( 'error' ) ) {
307
- $response['result'] = 'error';
308
- }
309
-
310
- learn_press_maybe_send_json( $response );
311
 
312
  if ( ! empty( $response['redirect'] ) ) {
313
- // wp_cache_flush();
314
  wp_redirect( $response['redirect'] );
315
  exit();
316
  }
317
  }
318
-
319
- /**
320
- * Retake course action
321
- *
322
- * @TODO move this function to API
323
- */
324
- /*
325
- public static function retake_course() {
326
- $security = LP_Request::get_string( 'retake-course-nonce' );
327
- $course_id = LP_Request::get_int( 'retake-course' );
328
- $user = learn_press_get_current_user();
329
- $course = learn_press_get_course( $course_id );
330
- $response = array(
331
- 'result' => 'error',
332
- );
333
-
334
- $security_action = sprintf( 'retake-course-%d-%d', $course->get_id(), $user->get_id() );
335
- // security check
336
- if ( ! wp_verify_nonce( $security, $security_action ) ) {
337
- learn_press_add_message( __( 'Error! Invalid course or failed security check.', 'learnpress' ),
338
- 'error' );
339
- } else {
340
- if ( $user->can_retake_course( $course_id ) ) {
341
- $result = $user->retry_course( $course_id );
342
-
343
- if ( ! $result ) {
344
- learn_press_add_message( __( 'Error!', 'learnpress' ), 'error' );
345
- } else {
346
- learn_press_add_message( sprintf( __( 'You have retaken the course "%s"', 'learnpress' ),
347
- $course->get_title() ) );
348
- $response['result'] = 'success';
349
- }
350
- } else {
351
- learn_press_add_message( __( 'Error! You can not retake the course', 'learnpress' ), 'error' );
352
- }
353
- }
354
-
355
- if ( learn_press_message_count( 'error' ) == 0 ) {
356
- $item = $course->get_item_at( 0 );
357
-
358
- if ( $item ) {
359
- $redirect = $course->get_item_link( $item );
360
- } else {
361
- $redirect = $course->get_permalink();
362
- }
363
- $response['redirect'] = apply_filters( 'learn-press/user-retake-course-redirect', $redirect );
364
- $response = apply_filters( 'learn-press/user-retaken-course-result', $response, $course_id,
365
- $user->get_id() );
366
- } else {
367
- $response['redirect'] = $course->get_permalink();
368
- $response = apply_filters( 'learn-press/user-retake-course-failed-result', $response,
369
- $course_id, $user->get_id() );
370
- }
371
-
372
- learn_press_maybe_send_json( $response );
373
-
374
- if ( ! empty( $response['redirect'] ) ) {
375
- wp_redirect( $response['redirect'] );
376
- exit();
377
- }
378
- }*/
379
  }
380
  }
381
 
11
  'checkout-user-email-exists:nopriv',
12
  'recover-order',
13
  'request-become-a-teacher:nonce',
 
14
  'checkout:nopriv',
15
  'complete-lesson',
16
  'finish-course', // finish_course.
 
17
  'external-link:nopriv',
 
 
18
  );
19
 
20
  $ajax_events = apply_filters( 'learn-press/ajax/events', $ajax_events );
35
 
36
  LP_Request::register_ajax( $action, $callback );
37
  }
 
 
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  public static function external_link() {
41
  $nonce = LP_Request::get( 'nonce' );
42
  $id = LP_Request::get( 'id' );
59
  }
60
 
61
  public static function checkout() {
62
+ LearnPress::instance()->checkout()->process_checkout_handler();
63
  }
64
 
65
  public static function request_become_a_teacher() {
129
  learn_press_maybe_send_json( $response );
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  /**
133
  * Request finish course
134
  *
179
  * Complete lesson
180
  */
181
  public static function complete_lesson() {
 
 
 
 
 
 
 
 
 
 
 
182
  $response = array(
183
+ 'result' => 'error',
184
+ 'redirect' => '',
185
  );
186
 
187
  try {
188
+ $nonce = LP_Helper::sanitize_params_submitted( $_POST['complete-lesson-nonce'] ?? '' );
189
+ $lesson_id = LP_Helper::sanitize_params_submitted( $_POST['id'] ?? 0 );
190
+ $course_id = LP_Helper::sanitize_params_submitted( $_POST['course_id'] ?? 0 );
191
+
192
+ if ( ! wp_verify_nonce( $nonce, 'lesson-complete' ) ) {
193
+ throw new Exception( __( 'Error! Invalid lesson or failed security check.', 'learnpress' ) );
194
+ }
195
+
196
+ $lesson = get_post( $lesson_id );
197
+ if ( ! $lesson || $lesson->post_type !== LP_LESSON_CPT ) {
198
+ throw new Exception( __( 'Error! Invalid lesson.', 'learnpress' ) );
199
  }
200
 
201
+ $user = learn_press_get_current_user();
202
+ if ( $user instanceof LP_User_Guest ) {
203
+ throw new Exception( __( 'Please login.', 'learnpress' ) );
204
+ }
205
+
206
+ $course = learn_press_get_course( $course_id );
207
+ if ( ! $course ) {
208
+ throw new Exception( __( 'Course is invalid!.', 'learnpress' ) );
209
+ }
210
+
211
+ $item = $course->get_item( $lesson_id );
212
  if ( ! $item instanceof LP_Course_Item ) {
213
+ throw new Exception( 'Item is invalid!', 'learnpress' );
214
  }
215
 
216
+ $result = $user->complete_lesson( $lesson_id, $course_id );
217
+ $response['redirect'] = $course->get_item_link( $lesson_id );
218
 
219
  if ( ! is_wp_error( $result ) ) {
220
  if ( $course->get_next_item() ) {
223
  }
224
 
225
  learn_press_add_message( sprintf( __( 'Congrats! You have completed "%s".', 'learnpress' ), $item->get_title() ) );
226
+ $response['result'] = 'success';
227
  } else {
228
+ learn_press_add_message( $result->get_error_message(), 'error' );
229
  }
230
 
231
+ $response = apply_filters( 'learn-press/user-completed-lesson-result', $response, $lesson_id, $course_id, $user->get_id() );
232
  } catch ( Exception $ex ) {
233
  learn_press_add_message( $ex->getMessage(), 'error' );
234
  }
235
 
236
+ //learn_press_maybe_send_json( $response );
 
 
 
 
237
 
238
  if ( ! empty( $response['redirect'] ) ) {
 
239
  wp_redirect( $response['redirect'] );
240
  exit();
241
  }
242
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  }
244
  }
245
 
inc/class-lp-assets.php CHANGED
@@ -82,7 +82,7 @@ class LP_Assets extends LP_Abstract_Assets {
82
  ),
83
  'lp-checkout' => array(
84
  'ajaxurl' => home_url( '/' ),
85
- 'user_checkout' => LP()->checkout()->get_checkout_email(),
86
  'i18n_processing' => esc_html__( 'Processing', 'learnpress' ),
87
  'i18n_redirecting' => esc_html__( 'Redirecting', 'learnpress' ),
88
  'i18n_invalid_field' => esc_html__( 'Invalid field', 'learnpress' ),
82
  ),
83
  'lp-checkout' => array(
84
  'ajaxurl' => home_url( '/' ),
85
+ 'user_checkout' => LearnPress::instance()->checkout()->get_checkout_email(),
86
  'i18n_processing' => esc_html__( 'Processing', 'learnpress' ),
87
  'i18n_redirecting' => esc_html__( 'Redirecting', 'learnpress' ),
88
  'i18n_invalid_field' => esc_html__( 'Invalid field', 'learnpress' ),
inc/class-lp-checkout.php CHANGED
@@ -94,8 +94,8 @@ class LP_Checkout {
94
  add_filter( 'learn-press/validate-checkout-fields', array( $this, 'check_validate_fields' ), 10, 3 );
95
  //add_filter( 'learn-press/payment-successful-result', array( $this, 'process_customer' ), 10, 2 );
96
 
97
- if ( ! is_null( LP()->session ) ) {
98
- $this->_checkout_email = LP()->session->get( 'checkout-email' );
99
  }
100
  }
101
 
@@ -350,13 +350,13 @@ class LP_Checkout {
350
  if ( $order_id ) {
351
  return $order_id;
352
  }
353
- $cart = LP()->cart;
354
 
355
  try {
356
  $wpdb->query( 'START TRANSACTION' );
357
 
358
  // Insert or update the post data
359
- $order_id = absint( LP()->session->get( 'order_awaiting_payment' ) );
360
 
361
  // Resume the unpaid order if its pending
362
  $order = $this->_is_resume_order( $order_id );
@@ -595,7 +595,7 @@ class LP_Checkout {
595
  }
596
 
597
  if ( $this->_checkout_email ) {
598
- LP()->session->set( 'checkout-email', $this->_checkout_email );
599
  }
600
 
601
  $this->process_checkout();
@@ -640,7 +640,7 @@ class LP_Checkout {
640
  * @throws Exception
641
  */
642
  public function validate_payment() {
643
- $cart = LP()->cart;
644
  $validate = true;
645
 
646
  if ( $cart->needs_payment() ) {
@@ -679,7 +679,7 @@ class LP_Checkout {
679
 
680
  do_action( 'learn-press/before-checkout' );
681
 
682
- $cart = LP()->cart;
683
  $result = false;
684
 
685
  if ( $cart->is_empty() ) {
@@ -719,7 +719,7 @@ class LP_Checkout {
719
 
720
  if ( $this->payment_method ) {
721
  // Store the order is waiting f6or payment and each payment method should clear it
722
- LP()->session->order_awaiting_payment = $order_id;
723
  // Process Payment
724
  $result = $this->payment_method->process_payment( $order_id );
725
 
94
  add_filter( 'learn-press/validate-checkout-fields', array( $this, 'check_validate_fields' ), 10, 3 );
95
  //add_filter( 'learn-press/payment-successful-result', array( $this, 'process_customer' ), 10, 2 );
96
 
97
+ if ( ! is_null( LearnPress::instance()->session ) ) {
98
+ $this->_checkout_email = LearnPress::instance()->session->get( 'checkout-email' );
99
  }
100
  }
101
 
350
  if ( $order_id ) {
351
  return $order_id;
352
  }
353
+ $cart = LearnPress::instance()->cart;
354
 
355
  try {
356
  $wpdb->query( 'START TRANSACTION' );
357
 
358
  // Insert or update the post data
359
+ $order_id = absint( LearnPress::instance()->session->get( 'order_awaiting_payment' ) );
360
 
361
  // Resume the unpaid order if its pending
362
  $order = $this->_is_resume_order( $order_id );
595
  }
596
 
597
  if ( $this->_checkout_email ) {
598
+ LearnPress::instance()->session->set( 'checkout-email', $this->_checkout_email );
599
  }
600
 
601
  $this->process_checkout();
640
  * @throws Exception
641
  */
642
  public function validate_payment() {
643
+ $cart = LearnPress::instance()->cart;
644
  $validate = true;
645
 
646
  if ( $cart->needs_payment() ) {
679
 
680
  do_action( 'learn-press/before-checkout' );
681
 
682
+ $cart = LearnPress::instance()->cart;
683
  $result = false;
684
 
685
  if ( $cart->is_empty() ) {
719
 
720
  if ( $this->payment_method ) {
721
  // Store the order is waiting f6or payment and each payment method should clear it
722
+ LearnPress::instance()->session->order_awaiting_payment = $order_id;
723
  // Process Payment
724
  $result = $this->payment_method->process_payment( $order_id );
725
 
inc/class-lp-file-system.php CHANGED
@@ -11,7 +11,7 @@ if ( ! class_exists( 'LP_WP_Filesystem' ) ) {
11
  /**
12
  * @var WP_Filesystem_Direct
13
  */
14
- protected $lp_filesystem;
15
  /**
16
  * @var LP_WP_Filesystem
17
  */
@@ -177,26 +177,6 @@ if ( ! class_exists( 'LP_WP_Filesystem' ) ) {
177
  return $output;
178
  }
179
 
180
- /**
181
- * @editor tungnx
182
- * @modify 4.1.3.1 comment - replace file_get_contents
183
- */
184
- /*public static function get_contents( $path ) {
185
- _deprecated_function( __FUNCTION__, '4.1.3.1', 'file_get_contents' );
186
- $output = @file_get_contents( $path );
187
-
188
- if ( ! $output ) {
189
- global $wp_filesystem;
190
- self::wp_file_system();
191
-
192
- if ( self::file_exists( $path ) ) {
193
- $output = $wp_filesystem->get_contents( $path );
194
- }
195
- }
196
-
197
- return $output;
198
- }*/
199
-
200
  /**
201
  * Get content of file
202
  *
11
  /**
12
  * @var WP_Filesystem_Direct
13
  */
14
+ public $lp_filesystem;
15
  /**
16
  * @var LP_WP_Filesystem
17
  */
177
  return $output;
178
  }
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  /**
181
  * Get content of file
182
  *
inc/class-lp-helper.php CHANGED
@@ -430,7 +430,7 @@ class LP_Helper {
430
  * @since 3.2.7.1
431
  * @author tungnx
432
  */
433
- public static function sanitize_params_submitted( $value, $type_content = 'text' ) {
434
  $value = wp_unslash( $value );
435
 
436
  if ( is_string( $value ) ) {
@@ -444,6 +444,12 @@ class LP_Helper {
444
  case 'key':
445
  $value = sanitize_key( $value );
446
  break;
 
 
 
 
 
 
447
  default:
448
  $value = sanitize_text_field( $value );
449
  }
430
  * @since 3.2.7.1
431
  * @author tungnx
432
  */
433
+ public static function sanitize_params_submitted( $value, string $type_content = 'text' ) {
434
  $value = wp_unslash( $value );
435
 
436
  if ( is_string( $value ) ) {
444
  case 'key':
445
  $value = sanitize_key( $value );
446
  break;
447
+ case 'int':
448
+ $value = (int) $value;
449
+ break;
450
+ case 'float':
451
+ $value = (float) $value;
452
+ break;
453
  default:
454
  $value = sanitize_text_field( $value );
455
  }
inc/class-lp-page-controller.php CHANGED
@@ -29,6 +29,7 @@ class LP_Page_Controller {
29
  * LP_Page_Controller constructor.
30
  */
31
  protected function __construct() {
 
32
  add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), -1 );
33
  add_filter( 'template_include', array( $this, 'template_loader' ), 10 );
34
  add_filter( 'template_include', array( $this, 'check_pages' ), 30 );
@@ -57,42 +58,19 @@ class LP_Page_Controller {
57
  }
58
 
59
  /**
60
- * Check notify papal call when done.
61
  *
62
- * Set in param notify_url on @see LP_Gateway_Paypal::get_paypal_args()
 
 
 
63
  */
64
- public function check_webhook_paypal_ipn() {
65
- //error_log( 'xxx:' . json_encode( $_POST, JSON_UNESCAPED_UNICODE ) );
66
-
67
- // Paypal payment done
68
- if ( ! isset( $_GET['paypal_notify'] ) ) {
69
- return;
70
  }
71
 
72
- if ( ! isset( $_POST['ipn_track_id'] ) ) {
73
- return;
74
- }
75
-
76
- try {
77
- $paypal = new LP_Gateway_Paypal();
78
- $verify = $paypal->validate_ipn();
79
-
80
- if ( $verify ) {
81
- if ( isset( $_POST['custom'] ) ) {
82
- $data_order = json_decode( LP_Helper::sanitize_params_submitted( $_POST['custom'] ) );
83
-
84
- if ( json_last_error() === JSON_ERROR_NONE ) {
85
- $order_id = $data_order->order_id;
86
-
87
- $lp_order = learn_press_get_order( $order_id );
88
- $lp_order->set_status( 'completed' );
89
- $lp_order->save();
90
- }
91
- }
92
- }
93
- } catch ( Throwable $e ) {
94
- error_log( $e->getMessage() );
95
- }
96
  }
97
 
98
  /**
@@ -244,7 +222,7 @@ class LP_Page_Controller {
244
  * @author tungnx
245
  * @since 3.2.7.7
246
  */
247
- public function set_title_pages( string $title = '' ): string {
248
  global $wp_query;
249
  $flag_title_course = false;
250
 
@@ -410,11 +388,11 @@ class LP_Page_Controller {
410
  }
411
 
412
  /**
413
- * @deprecated v4.1.6.1 LP()->global['course'], $GLOBALS['course']
414
- * Some theme still use: global $course; LP()->global['course']
415
  */
416
- //LP()->global['course'] = $GLOBALS['course'] = $GLOBALS['lp_course'] = $course;
417
- LP()->global['course'] = $GLOBALS['course'] = $course;
418
 
419
  if ( wp_verify_nonce( LP_Request::get( 'preview' ), 'preview-' . $post->ID ) ) {
420
  $GLOBALS['preview_course'] = $post->ID;
@@ -697,7 +675,7 @@ class LP_Page_Controller {
697
  try {
698
  if ( LP_Page_Controller::page_current() === LP_PAGE_COURSES ) {
699
  if ( ( LP_Settings_Courses::is_ajax_load_courses() && ! LP_Settings_Courses::is_no_load_ajax_first_courses() ) ) {
700
- LP()->template( 'course' )->remove_callback( 'learn-press/after-courses-loop', 'loop/course/pagination.php', 10 );
701
  /**
702
  * If page is archive course - query set posts_per_page = 1
703
  * For fastest - because when page loaded - call API to load list courses
@@ -1018,6 +996,45 @@ class LP_Page_Controller {
1018
  }
1019
  }
1020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1021
  /**
1022
  * Set again HTTP_X_WP_NONCE when cache make 403 error.
1023
  *
29
  * LP_Page_Controller constructor.
30
  */
31
  protected function __construct() {
32
+ add_filter( 'post_type_archive_link', [ $this, 'link_archive_course' ], 10, 2 );
33
  add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), -1 );
34
  add_filter( 'template_include', array( $this, 'template_loader' ), 10 );
35
  add_filter( 'template_include', array( $this, 'check_pages' ), 30 );
58
  }
59
 
60
  /**
61
+ * Set link archive course.
62
  *
63
+ * @param string $link
64
+ * @param string $post_type
65
+ *
66
+ * @return string
67
  */
68
+ public function link_archive_course( string $link, string $post_type ): string {
69
+ if ( $post_type == LP_COURSE_CPT && learn_press_get_page_id( 'courses' ) ) {
70
+ $link = learn_press_get_page_link( 'courses' );
 
 
 
71
  }
72
 
73
+ return $link;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  /**
222
  * @author tungnx
223
  * @since 3.2.7.7
224
  */
225
+ public function set_title_pages( $title = '' ): string {
226
  global $wp_query;
227
  $flag_title_course = false;
228
 
388
  }
389
 
390
  /**
391
+ * @deprecated v4.1.6.1 LearnPress::instance()->global['course'], $GLOBALS['course']
392
+ * Some theme still use: global $course; LearnPress::instance()->global['course']
393
  */
394
+ //LearnPress::instance()->global['course'] = $GLOBALS['course'] = $GLOBALS['lp_course'] = $course;
395
+ LearnPress::instance()->global['course'] = $GLOBALS['course'] = $course;
396
 
397
  if ( wp_verify_nonce( LP_Request::get( 'preview' ), 'preview-' . $post->ID ) ) {
398
  $GLOBALS['preview_course'] = $post->ID;
675
  try {
676
  if ( LP_Page_Controller::page_current() === LP_PAGE_COURSES ) {
677
  if ( ( LP_Settings_Courses::is_ajax_load_courses() && ! LP_Settings_Courses::is_no_load_ajax_first_courses() ) ) {
678
+ LearnPress::instance()->template( 'course' )->remove_callback( 'learn-press/after-courses-loop', 'loop/course/pagination.php', 10 );
679
  /**
680
  * If page is archive course - query set posts_per_page = 1
681
  * For fastest - because when page loaded - call API to load list courses
996
  }
997
  }
998
 
999
+ /**
1000
+ * Check notify papal call when done.
1001
+ *
1002
+ * Set in param notify_url on @see LP_Gateway_Paypal::get_paypal_args()
1003
+ */
1004
+ public function check_webhook_paypal_ipn() {
1005
+ //error_log( 'xxx:' . json_encode( $_POST, JSON_UNESCAPED_UNICODE ) );
1006
+
1007
+ // Paypal payment done
1008
+ if ( ! isset( $_GET['paypal_notify'] ) ) {
1009
+ return;
1010
+ }
1011
+
1012
+ if ( ! isset( $_POST['ipn_track_id'] ) ) {
1013
+ return;
1014
+ }
1015
+
1016
+ try {
1017
+ $paypal = new LP_Gateway_Paypal();
1018
+ $verify = $paypal->validate_ipn();
1019
+
1020
+ if ( $verify ) {
1021
+ if ( isset( $_POST['custom'] ) ) {
1022
+ $data_order = json_decode( LP_Helper::sanitize_params_submitted( $_POST['custom'] ) );
1023
+
1024
+ if ( json_last_error() === JSON_ERROR_NONE ) {
1025
+ $order_id = $data_order->order_id;
1026
+
1027
+ $lp_order = learn_press_get_order( $order_id );
1028
+ $lp_order->set_status( 'completed' );
1029
+ $lp_order->save();
1030
+ }
1031
+ }
1032
+ }
1033
+ } catch ( Throwable $e ) {
1034
+ error_log( $e->getMessage() );
1035
+ }
1036
+ }
1037
+
1038
  /**
1039
  * Set again HTTP_X_WP_NONCE when cache make 403 error.
1040
  *
inc/class-lp-query.php CHANGED
@@ -283,7 +283,7 @@ class LP_Query {
283
  public function get_course_item( $return = 'id' ) {
284
  $course = $this->get_course( 'object' );
285
  $user = learn_press_get_current_user();
286
- $item = isset( $item ) ? $item : LP()->global['course-item'];
287
  if ( $item && $return == 'object' ) {
288
  $item = LP_Course::get_item( $item );
289
  }
283
  public function get_course_item( $return = 'id' ) {
284
  $course = $this->get_course( 'object' );
285
  $user = learn_press_get_current_user();
286
+ $item = isset( $item ) ? $item : LearnPress::instance()->global['course-item'];
287
  if ( $item && $return == 'object' ) {
288
  $item = LP_Course::get_item( $item );
289
  }
inc/class-lp-request-handler.php CHANGED
@@ -41,6 +41,31 @@ class LP_Request {
41
  add_action( 'wp_loaded', array( 'LP_Forms_Handler', 'init' ), 10 );
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  public static function get_header() {
45
  ob_start();
46
  }
41
  add_action( 'wp_loaded', array( 'LP_Forms_Handler', 'init' ), 10 );
42
  }
43
 
44
+ /**
45
+ * Get value by key from $_REQUEST
46
+ *
47
+ * @param string $key
48
+ * @param mixed $default
49
+ * @param string $sanitize_type
50
+ * @param string $method
51
+ *
52
+ * @return array|float|int|string
53
+ */
54
+ public static function get_param( string $key, $default = '', string $sanitize_type = 'text', string $method = '' ) {
55
+ switch ( $method ) {
56
+ case 'post':
57
+ $values = $_POST ?? [];
58
+ break;
59
+ case 'get':
60
+ $values = $_GET ?? [];
61
+ break;
62
+ default:
63
+ $values = $_REQUEST ?? [];
64
+ }
65
+
66
+ return LP_Helper::sanitize_params_submitted( $values[ $key ] ?? $default, $sanitize_type );
67
+ }
68
+
69
  public static function get_header() {
70
  ob_start();
71
  }
inc/class-lp-shortcodes.php CHANGED
@@ -29,7 +29,7 @@ if ( ! class_exists( 'LP_Shortcodes' ) ) {
29
  'recent_courses' => __CLASS__ . '::recent_courses',
30
  'featured_courses' => __CLASS__ . '::featured_courses',
31
  'popular_courses' => __CLASS__ . '::popular_courses',
32
- 'button_enroll' => __CLASS__ . '::button_enroll',
33
  'button_purchase' => __CLASS__ . '::button_purchase',
34
  'button_course' => __CLASS__ . '::button_course',
35
  'course_curriculum' => __CLASS__ . '::course_curriculum',
@@ -225,16 +225,6 @@ if ( ! class_exists( 'LP_Shortcodes' ) ) {
225
  return $html;
226
  }
227
 
228
- /**
229
- * @param $atts
230
- * @param string $content
231
- *
232
- * @return LP_Shortcode_Button_Enroll
233
- */
234
- public static function button_enroll( $atts, $content = '' ) {
235
- return new LP_Shortcode_Button_Enroll( $atts );
236
- }
237
-
238
  /**
239
  * @param $atts
240
  * @param string $content
29
  'recent_courses' => __CLASS__ . '::recent_courses',
30
  'featured_courses' => __CLASS__ . '::featured_courses',
31
  'popular_courses' => __CLASS__ . '::popular_courses',
32
+ //'button_enroll' => __CLASS__ . '::button_enroll',
33
  'button_purchase' => __CLASS__ . '::button_purchase',
34
  'button_course' => __CLASS__ . '::button_course',
35
  'course_curriculum' => __CLASS__ . '::course_curriculum',
225
  return $html;
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
228
  /**
229
  * @param $atts
230
  * @param string $content
inc/class-lp-thumbnail-helper.php CHANGED
@@ -53,7 +53,7 @@ class LP_Thumbnail_Helper {
53
  }
54
 
55
  if ( ! $image ) {
56
- $image = LP()->image( 'no-image.png' );
57
  $image = sprintf(
58
  '<img src="%s" alt="%s">',
59
  esc_url_raw( $image ),
53
  }
54
 
55
  if ( ! $image ) {
56
+ $image = LearnPress::instance()->image( 'no-image.png' );
57
  $image = sprintf(
58
  '<img src="%s" alt="%s">',
59
  esc_url_raw( $image ),
inc/class-lp-widget.php CHANGED
@@ -130,14 +130,11 @@ class LP_Widget extends WP_Widget {
130
 
131
  do_action( 'before_show_lp_widget_content' );
132
 
133
- $serialized_instance = serialize( $instance );
134
-
135
  $data = array_merge(
136
  $this->widget_data_attr,
137
  array(
138
  'widget' => $this->widget_id,
139
- 'instance' => base64_encode( $serialized_instance ),
140
- 'hash' => wp_hash( $serialized_instance ),
141
  )
142
  );
143
 
130
 
131
  do_action( 'before_show_lp_widget_content' );
132
 
 
 
133
  $data = array_merge(
134
  $this->widget_data_attr,
135
  array(
136
  'widget' => $this->widget_id,
137
+ 'instance' => wp_json_encode( $instance ),
 
138
  )
139
  );
140
 
inc/course/abstract-course.php CHANGED
@@ -299,9 +299,9 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
299
 
300
  if ( ! $url ) {
301
  if ( 'course_thumbnail' == $size ) {
302
- $url = LP()->image( 'no-image.png' );
303
  } else {
304
- $url = LP()->image( 'placeholder-500x300' );
305
  }
306
  }
307
 
@@ -340,22 +340,12 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
340
  * @depecated 4.0.0
341
  */
342
  public function is_required_enroll() {
343
-
344
- // $return = $this->get_data( 'required_enroll' ) == 'yes';
345
- // @deprecated
346
- // $return = apply_filters( 'learn_press_course_required_enroll', $return, $this );
347
-
348
- /**
349
- * Since version 4.0.0 feature 'no require enroll' has deprecated
350
- */
351
- $return = true;
352
-
353
- return apply_filters( 'learn-press/course-require-enrollment', $return, $this->get_id() );
354
  }
355
  /**
356
  * Check if this course is required enroll or not.
357
  *
358
- * @param mixed
359
  * @author hungkv
360
  * @since 4.0.5
361
  * @return bool
@@ -374,7 +364,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
374
  * @deprecated
375
  */
376
  public function is_require_enrollment() {
377
- return $this->is_required_enroll();
378
  }
379
 
380
  /**
@@ -488,54 +478,6 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
488
  return apply_filters( 'learn-press/course/users-enrolled', $enrolled, $this );
489
  }
490
 
491
- /**
492
- * Output html for students enrolled counter
493
- *
494
- * @return string
495
- * @editor tungnx
496
- * @modify 4.1.3
497
- */
498
- /*public function get_students_html() {
499
- $output = '';
500
- $count = $this->get_users_enrolled();
501
-
502
- if ( $count ) {
503
- $user = learn_press_get_current_user();
504
-
505
- if ( $user->has_enrolled_course( $this->get_id() ) ) {
506
- if ( $count == 1 ) {
507
- $output .= esc_html__( 'You enrolled', 'learnpress' );
508
- } else {
509
- $output .= sprintf(
510
- _nx(
511
- 'You and one student enrolled',
512
- 'You and <span class="course-students-number">%1$s</span> students enrolled',
513
- intval( $count - 1 ),
514
- 'students-html',
515
- 'learnpress'
516
- ),
517
- $count - 1
518
- );
519
- }
520
- } else {
521
- $output = sprintf(
522
- _nx(
523
- 'One student enrolled',
524
- '<span class="course-students-number">%1$s</span> students enrolled',
525
- $count,
526
- 'students-html',
527
- 'learnpress'
528
- ),
529
- $count
530
- );
531
- }
532
- } else {
533
- $output = esc_html__( 'No student enrolled', 'learnpress' );
534
- }
535
-
536
- return apply_filters( 'learn-press/students-enrolled-html', $output, $this->get_id() );
537
- }*/
538
-
539
  /**
540
  * @param string $field
541
  *
@@ -859,10 +801,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
859
  * @return mixed
860
  */
861
  public function is_purchasable() {
862
- $is_purchasable = $this->exists() && $this->is_required_enroll() && get_post_status( $this->get_id() ) == 'publish';
863
-
864
- // @deprecated
865
- $is_purchasable = apply_filters( 'learn_press_item_is_purchasable', $is_purchasable, $this->get_id() );
866
 
867
  return apply_filters( 'learn-press/is-purchasable', $is_purchasable, $this->get_id() );
868
  }
299
 
300
  if ( ! $url ) {
301
  if ( 'course_thumbnail' == $size ) {
302
+ $url = LearnPress::instance()->image( 'no-image.png' );
303
  } else {
304
+ $url = LearnPress::instance()->image( 'placeholder-500x300' );
305
  }
306
  }
307
 
340
  * @depecated 4.0.0
341
  */
342
  public function is_required_enroll() {
343
+ //_deprecated_function( __FUNCTION__, '4.1.7.2', 'is_no_required_enroll' );
344
+ return ! $this->is_no_required_enroll();
 
 
 
 
 
 
 
 
 
345
  }
346
  /**
347
  * Check if this course is required enroll or not.
348
  *
 
349
  * @author hungkv
350
  * @since 4.0.5
351
  * @return bool
364
  * @deprecated
365
  */
366
  public function is_require_enrollment() {
367
+ return ! $this->is_no_required_enroll();
368
  }
369
 
370
  /**
478
  return apply_filters( 'learn-press/course/users-enrolled', $enrolled, $this );
479
  }
480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  /**
482
  * @param string $field
483
  *
801
  * @return mixed
802
  */
803
  public function is_purchasable() {
804
+ $is_purchasable = $this->exists() && ! $this->is_no_required_enroll() && get_post_status( $this->get_id() ) == 'publish';
 
 
 
805
 
806
  return apply_filters( 'learn-press/is-purchasable', $is_purchasable, $this->get_id() );
807
  }
inc/course/class-lp-course-item.php CHANGED
@@ -542,8 +542,9 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
542
  * @param int $question_id
543
  *
544
  * @return mixed
 
545
  */
546
- public function is_viewing_question( $question_id = 0 ) {
547
  global $lp_quiz_question;
548
  if ( $question_id ) {
549
  $viewing = $lp_quiz_question && $lp_quiz_question->get_id() == $question_id;
@@ -552,15 +553,16 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
552
  }
553
 
554
  return apply_filters( 'learn-press/quiz/is-viewing-question', $viewing, $question_id, $this->get_id() );
555
- }
556
 
557
  /**
558
  * @param int $user_id
559
  * @param int $course_id
560
  *
561
  * @return mixed
 
562
  */
563
- public function get_status_classes( $user_id = 0, $course_id = 0 ) {
564
  $status_classes = array();
565
  $course = learn_press_get_course( $course_id );
566
  $user = learn_press_get_user( $user_id, ! $user_id );
@@ -568,7 +570,7 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
568
  if ( $course ) {
569
  if ( $this->is_preview() ) {
570
  $status_classes[] = 'item-preview';
571
- } elseif ( $course->is_free() && ! $course->is_required_enroll() ) {
572
  $status_classes[] = 'item-free';
573
  }
574
  }
@@ -596,7 +598,7 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
596
  $course_id,
597
  $user_id
598
  );
599
- }
600
 
601
  /**
602
  * Get duration of quiz
@@ -621,177 +623,6 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
621
  return apply_filters( 'learn-press/course-item-duration', $duration, $this->get_id() );
622
  }
623
 
624
- /**
625
- * @param int $course_id
626
- * @param int $user_id
627
- *
628
- * @return bool
629
- * @editor tungnx
630
- * @modify 4.1.3 - not use - comment
631
- * @deprecated
632
- */
633
- public function is_blocked( $course_id = 0, $user_id = 0 ) {
634
- _deprecated_function( __FUNCTION__, '4.1.3' );
635
-
636
- /*
637
- if ( ! $user_id ) {
638
- $user_id = get_current_user_id();
639
- }
640
-
641
- if ( ! $course_id ) {
642
- $course_id = get_the_ID();
643
- }
644
-
645
- $course_author = learn_press_get_course_user( $course_id );
646
-
647
- if ( $course_author ) {
648
- $author_id = $course_author->get_id();
649
-
650
- if ( $author_id == $user_id ) {
651
- // return false;
652
- }
653
- }
654
-
655
- $key = 'course-item-' . $user_id . '-' . $course_id;
656
- $blocked_items = LP_Object_Cache::get( $key, 'learn-press/blocked-items' );
657
-
658
- if ( false === $blocked_items ) {
659
- $blocked_items = $this->_parse_item_block_status( $course_id, $user_id, $key );
660
- }
661
-
662
- $is_blocked = isset( $blocked_items[ $this->get_id() ] ) ? $blocked_items[ $this->get_id() ] : false;
663
-
664
- if ( false === $is_blocked ) {
665
- if ( $course_id ) {
666
- $course = learn_press_get_course( $course_id );
667
- } else {
668
- $course = $this->get_course();
669
- $course_id = $course ? $course->get_id() : 0;
670
- }
671
-
672
- if ( ! $user_id ) {
673
- $user_id = get_current_user_id();
674
- }
675
-
676
- $user = learn_press_get_user( $user_id );
677
-
678
- if ( ! $course ) {
679
- $blocked = 'yes';
680
- } elseif ( ! $course->is_required_enroll() || $this->is_preview() ) {
681
- $blocked = 'no';
682
- } else {
683
- if ( $user ) {
684
- $blocked = $this->_item_is_blocked( $user, $course, $user->get_course_data( $course_id ) );
685
- } else {
686
- $blocked = 'yes';
687
- }
688
- }
689
-
690
- if ( ! is_array( $blocked_items ) ) {
691
- $blocked_items = array();
692
- }
693
- $blocked_items[ $this->get_id() ] = $blocked;
694
-
695
- LP_Object_Cache::set( $key, $blocked_items, 'learn-press/blocked-items' );
696
- $is_blocked = $blocked;
697
- }
698
-
699
- return apply_filters(
700
- 'learn-press/course-item/is-blocked',
701
- $is_blocked === 'yes' ? true : false,
702
- $this->get_id(),
703
- $course_id,
704
- $user_id
705
- );*/
706
- }
707
-
708
- /**
709
- * @editor tungnx
710
- * @modify 4.1.3
711
- */
712
- /*
713
- protected function _parse_item_block_status( $course_id, $user_id, $cache_key ) {
714
- $course = learn_press_get_course( $course_id );
715
-
716
- if ( ! $course ) {
717
- return false;
718
- }
719
-
720
- $user = learn_press_get_user( $user_id );
721
- $course_items = $course->get_item_ids();
722
- $course_item_data = $user->get_course_data( $course_id );
723
-
724
- if ( ! $course->is_required_enroll() ) {
725
- $blocked_items = array_fill_keys( $course_items, 'no' );
726
- } elseif ( ! $user || $user->is_guest() ) {
727
- $blocked_items = array_fill_keys( $course_items, 'yes' );
728
- } else {
729
- $blocked = $this->_item_is_blocked( $user, $course, $course_item_data );
730
- $blocked_items = array_fill_keys( $course_items, $blocked );
731
- }
732
- $block_item_types = learn_press_get_block_course_item_types();
733
-
734
- foreach ( $course_items as $course_item ) {
735
- $item = $course->get_item( $course_item );
736
-
737
- if ( $item ) {
738
- if ( $item->is_preview() ) {
739
- $blocked_items[ $course_item ] = 'no';
740
- } elseif ( ! $block_item_types || is_array( $block_item_types ) && ! in_array(
741
- $item->get_post_type(),
742
- $block_item_types
743
- ) ) {
744
- $blocked_items[ $course_item ] = 'no';
745
- }
746
- }
747
-
748
- $item_data = $course_item_data->get_item( $course_item );
749
- if ( $item_data ) {
750
- $access_level = $item_data->get_access_level();
751
- if ( $access_level > 0 && $access_level < 50 ) {
752
- $blocked_items[ $course_item ] = 'yes';
753
- }
754
- }
755
- }
756
-
757
- $blocked_items = apply_filters(
758
- 'learn-press/course-item/parse-block-statuses',
759
- $blocked_items,
760
- $course_id,
761
- $user_id
762
- );
763
-
764
- LP_Object_Cache::set( $cache_key, $blocked_items, 'learn-press/blocked-items' );
765
-
766
- return $blocked_items;
767
- }*/
768
-
769
- /**
770
- * @param LP_User $user
771
- * @param LP_Course $course
772
- * @param LP_User_Item_Course $course_item_data
773
- *
774
- * @return string
775
- * @editor tungnx
776
- * @modify 4.1.3
777
- */
778
- /*
779
- protected function _item_is_blocked( $user, $course, $course_item_data ) {
780
- if ( in_array( 'administrator', $user->get_roles() ) ) {
781
- $blocked = 'no';
782
- } elseif ( $user->has_course_status( $course->get_id(), learn_press_course_enrolled_slugs() ) ) {
783
- $blocked = 'no';
784
-
785
- if ( $course->is_block_item_content() && $course_item_data->get_finishing_type() !== 'click' ) {
786
- $blocked = 'yes';
787
- }
788
- } else {
789
- $blocked = 'yes';
790
- }
791
-
792
- return $blocked;
793
- }*/
794
-
795
  public function offsetExists( $offset ) {
796
  }
797
 
542
  * @param int $question_id
543
  *
544
  * @return mixed
545
+ * @depecated 4.1.7.2
546
  */
547
+ /*public function is_viewing_question( $question_id = 0 ) {
548
  global $lp_quiz_question;
549
  if ( $question_id ) {
550
  $viewing = $lp_quiz_question && $lp_quiz_question->get_id() == $question_id;
553
  }
554
 
555
  return apply_filters( 'learn-press/quiz/is-viewing-question', $viewing, $question_id, $this->get_id() );
556
+ }*/
557
 
558
  /**
559
  * @param int $user_id
560
  * @param int $course_id
561
  *
562
  * @return mixed
563
+ * @depecated 4.1.7.2
564
  */
565
+ /*public function get_status_classes( $user_id = 0, $course_id = 0 ) {
566
  $status_classes = array();
567
  $course = learn_press_get_course( $course_id );
568
  $user = learn_press_get_user( $user_id, ! $user_id );
570
  if ( $course ) {
571
  if ( $this->is_preview() ) {
572
  $status_classes[] = 'item-preview';
573
+ } elseif ( $course->is_free() && $course->is_no_required_enroll() ) {
574
  $status_classes[] = 'item-free';
575
  }
576
  }
598
  $course_id,
599
  $user_id
600
  );
601
+ }*/
602
 
603
  /**
604
  * Get duration of quiz
623
  return apply_filters( 'learn-press/course-item-duration', $duration, $this->get_id() );
624
  }
625
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  public function offsetExists( $offset ) {
627
  }
628
 
inc/course/lp-course-functions.php CHANGED
@@ -112,6 +112,7 @@ function learn_press_get_item_types_can_purchase() {
112
  * @param $item
113
  *
114
  * @return mixed
 
115
  */
116
  function learn_press_get_item_courses( $item ) {
117
  global $wpdb;
@@ -1036,7 +1037,7 @@ add_filter( 'learn-press/enroll-course-redirect', 'learn_press_remove_query_var_
1036
  * @since 3.0.0
1037
  */
1038
  function learn_press_mark_user_just_logged_in() {
1039
- LP()->session->set( 'user_just_logged_in', 'yes' );
1040
  }
1041
 
1042
  add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' );
112
  * @param $item
113
  *
114
  * @return mixed
115
+ * @Todo - tungnx need review code to rewrite.
116
  */
117
  function learn_press_get_item_courses( $item ) {
118
  global $wpdb;
1037
  * @since 3.0.0
1038
  */
1039
  function learn_press_mark_user_just_logged_in() {
1040
+ LearnPress::instance()->session->set( 'user_just_logged_in', 'yes' );
1041
  }
1042
 
1043
  add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' );
inc/curds/class-lp-user-curd.php CHANGED
@@ -1114,8 +1114,9 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1114
  * @param bool $last
1115
  *
1116
  * @return bool|mixed
 
1117
  */
1118
- public function get_user_item( $user_id, $item_id, $course_id = 0, $last = true ) {
1119
  $num_args = func_num_args();
1120
 
1121
  if ( $num_args == 2 ) {
@@ -1132,7 +1133,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1132
  }
1133
 
1134
  return $item;
1135
- }
1136
 
1137
  /**
1138
  * @param int $user_item_id
1114
  * @param bool $last
1115
  *
1116
  * @return bool|mixed
1117
+ * @depecated 4.1.7.2
1118
  */
1119
+ /*public function get_user_item( $user_id, $item_id, $course_id = 0, $last = true ) {
1120
  $num_args = func_num_args();
1121
 
1122
  if ( $num_args == 2 ) {
1133
  }
1134
 
1135
  return $item;
1136
+ }*/
1137
 
1138
  /**
1139
  * @param int $user_item_id
inc/custom-post-types/abstract.php CHANGED
@@ -667,7 +667,7 @@ abstract class LP_Abstract_Post_Type {
667
  }
668
  }
669
  } catch ( Throwable $e ) {
670
-
671
  }
672
 
673
  return $can_save;
667
  }
668
  }
669
  } catch ( Throwable $e ) {
670
+ $can_save = false;
671
  }
672
 
673
  return $can_save;
inc/databases/class-lp-course-db.php CHANGED
@@ -139,7 +139,7 @@ class LP_Course_DB extends LP_Database {
139
  *
140
  * @return int
141
  */
142
- public function get_user_item_id( $order_id = 0, $course_id = 0, $user_id = 0 ) {
143
  $query = $this->wpdb->prepare(
144
  "
145
  SELECT user_item_id
@@ -157,7 +157,7 @@ class LP_Course_DB extends LP_Database {
157
  $user_id
158
  );
159
 
160
- return $this->wpdb->get_var( $query );
161
  }
162
 
163
  /**
139
  *
140
  * @return int
141
  */
142
+ public function get_user_item_id( $order_id = 0, $course_id = 0, $user_id = 0 ): int {
143
  $query = $this->wpdb->prepare(
144
  "
145
  SELECT user_item_id
157
  $user_id
158
  );
159
 
160
+ return (int) $this->wpdb->get_var( $query );
161
  }
162
 
163
  /**
inc/databases/class-lp-user-items-db.php CHANGED
@@ -708,7 +708,6 @@ class LP_User_Items_DB extends LP_Database {
708
  * @throws Exception
709
  */
710
  public function get_user_quizzes( LP_User_Items_Filter $filter ) {
711
- @$this->wpdb->query( "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))" );
712
  $offset = ( absint( $filter->page ) - 1 ) * $filter->limit;
713
 
714
  $WHERE = '';
708
  * @throws Exception
709
  */
710
  public function get_user_quizzes( LP_User_Items_Filter $filter ) {
 
711
  $offset = ( absint( $filter->page ) - 1 ) * $filter->limit;
712
 
713
  $WHERE = '';
inc/emails/class-lp-email.php CHANGED
@@ -302,7 +302,7 @@ if ( ! class_exists( 'LP_Email' ) ) {
302
  public function __construct() {
303
  // Set template base path to LP templates path if it is not set.
304
  if ( empty( $this->template_base ) ) {
305
- $this->template_base = LP()->plugin_path( 'templates/' );
306
  }
307
 
308
  /**
@@ -531,22 +531,6 @@ if ( ! class_exists( 'LP_Email' ) ) {
531
  return wordwrap( $email_content, 70 );
532
  }
533
 
534
- /**
535
- * Try to get object if it is null.
536
- *
537
- * @editor tungnx
538
- * @reason comment - not use
539
- */
540
- /*protected function _maybe_get_object() {
541
- try {
542
- if ( ! $this->_object_loaded && empty( $this->object ) ) {
543
- $this->_object_loaded = true;
544
- $this->get_object();
545
- }
546
- } catch ( Exception $ex ) {
547
- }
548
- }*/
549
-
550
  /**
551
  * Get email heading.
552
  *
@@ -650,19 +634,6 @@ if ( ! class_exists( 'LP_Email' ) ) {
650
  return LP_Helper::sanitize_params_submitted( $name );
651
  }
652
 
653
- /**
654
- * Get image header in general settings.
655
- *
656
- * @return string
657
- * @editor tungnx
658
- * @reason comment - write new
659
- */
660
- /*public function get_image_header() {
661
- $image = LP_Emails::instance()->get_image_header();
662
-
663
- return apply_filters( 'learn-press/email-image-header-' . $this->id, $image );
664
- }*/
665
-
666
  /**
667
  * Get WP Blog name.
668
  *
302
  public function __construct() {
303
  // Set template base path to LP templates path if it is not set.
304
  if ( empty( $this->template_base ) ) {
305
+ $this->template_base = LearnPress::instance()->plugin_path( 'templates/' );
306
  }
307
 
308
  /**
531
  return wordwrap( $email_content, 70 );
532
  }
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  /**
535
  * Get email heading.
536
  *
634
  return LP_Helper::sanitize_params_submitted( $name );
635
  }
636
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  /**
638
  * Get WP Blog name.
639
  *
inc/external-plugin/elementor/widgets/list-courses.php CHANGED
@@ -187,7 +187,7 @@ class LP_Elementor_Widget_List_Courses extends LP_Elementor_Widget_Base {
187
  }
188
 
189
  if ( empty( $courses ) ) {
190
- LP()->template( 'course' )->no_courses_found();
191
  }
192
  ?>
193
  <div class="lp-archive-courses">
187
  }
188
 
189
  if ( empty( $courses ) ) {
190
+ LearnPress::instance()->template( 'course' )->no_courses_found();
191
  }
192
  ?>
193
  <div class="lp-archive-courses">
inc/external-plugin/elementor/widgets/login-form.php CHANGED
@@ -34,7 +34,7 @@ class LP_Elementor_Widget_Login_Form extends LP_Elementor_Widget_Base {
34
  if ( class_exists( '\Elementor\Plugin' ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
35
  learn_press_get_template( 'global/form-login.php' );
36
  } else {
37
- echo LP()->template( 'profile' )->login_form();
38
  }
39
  }
40
  }
34
  if ( class_exists( '\Elementor\Plugin' ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
35
  learn_press_get_template( 'global/form-login.php' );
36
  } else {
37
+ echo LearnPress::instance()->template( 'profile' )->login_form();
38
  }
39
  }
40
  }
inc/external-plugin/elementor/widgets/register-form.php CHANGED
@@ -36,7 +36,7 @@ class LP_Elementor_Widget_Register_Form extends LP_Elementor_Widget_Base {
36
  if ( class_exists( '\Elementor\Plugin' ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
37
  learn_press_get_template( 'global/form-register.php' );
38
  } else {
39
- echo LP()->template( 'profile' )->register_form();
40
  }
41
  }
42
  }
36
  if ( class_exists( '\Elementor\Plugin' ) && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
37
  learn_press_get_template( 'global/form-register.php' );
38
  } else {
39
+ echo LearnPress::instance()->template( 'profile' )->register_form();
40
  }
41
  }
42
  }
inc/gateways/class-lp-gateways.php CHANGED
@@ -137,7 +137,7 @@ class LP_Gateways {
137
  if ( apply_filters( 'learn-press/payment-gateway/' . $slug . '/available', true, $gateway ) ) {
138
 
139
  // If gateway has already selected before
140
- if ( LP()->session->get( 'chosen_payment_method' ) == $gateway->id ) {
141
  $gateway->is_selected = true;
142
  $is_selected = $gateway;
143
  }
137
  if ( apply_filters( 'learn-press/payment-gateway/' . $slug . '/available', true, $gateway ) ) {
138
 
139
  // If gateway has already selected before
140
+ if ( LearnPress::instance()->session->get( 'chosen_payment_method' ) == $gateway->id ) {
141
  $gateway->is_selected = true;
142
  $is_selected = $gateway;
143
  }
inc/gateways/offline-payment/class-lp-gateway-offline-payment.php CHANGED
@@ -166,7 +166,7 @@ if ( ! function_exists( 'LP_Gateway_Offline_Payment' ) ) {
166
  $order->update_status( $default_status, __( 'Payment to be made upon delivery.', 'learnpress' ) );
167
 
168
  // Remove cart
169
- LP()->cart->empty_cart();
170
 
171
  // Return thank you redirect
172
  return array(
166
  $order->update_status( $default_status, __( 'Payment to be made upon delivery.', 'learnpress' ) );
167
 
168
  // Remove cart
169
+ LearnPress::instance()->cart->empty_cart();
170
 
171
  // Return thank you redirect
172
  return array(
inc/gateways/paypal/class-lp-gateway-paypal.php CHANGED
@@ -257,7 +257,7 @@ if ( ! class_exists( 'LP_Gateway_Paypal' ) ) {
257
  * @return array
258
  */
259
  public function get_paypal_args( LP_Order $order ): array {
260
- $checkout = LP()->checkout();
261
  $custom = array(
262
  'order_id' => $order->get_id(),
263
  'order_key' => $order->get_order_key(),
@@ -265,7 +265,7 @@ if ( ! class_exists( 'LP_Gateway_Paypal' ) ) {
265
  );
266
 
267
  // Item
268
- $items = LP()->get_cart()->get_items();
269
  $item_arg = [
270
  'item_name_1' => $order->get_order_number(),
271
  'quantity_1' => 0,
@@ -349,7 +349,7 @@ if ( ! class_exists( 'LP_Gateway_Paypal' ) ) {
349
  */
350
  public function get_icon() {
351
  if ( empty( $this->icon ) ) {
352
- $this->icon = LP()->plugin_url( 'assets/images/paypal-logo-preview.png' );
353
  }
354
 
355
  return parent::get_icon();
257
  * @return array
258
  */
259
  public function get_paypal_args( LP_Order $order ): array {
260
+ $checkout = LearnPress::instance()->checkout();
261
  $custom = array(
262
  'order_id' => $order->get_id(),
263
  'order_key' => $order->get_order_key(),
265
  );
266
 
267
  // Item
268
+ $items = LearnPress::instance()->get_cart()->get_items();
269
  $item_arg = [
270
  'item_name_1' => $order->get_order_number(),
271
  'quantity_1' => 0,
349
  */
350
  public function get_icon() {
351
  if ( empty( $this->icon ) ) {
352
+ $this->icon = LearnPress::instance()->plugin_url( 'assets/images/paypal-logo-preview.png' );
353
  }
354
 
355
  return parent::get_icon();
inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php CHANGED
@@ -332,13 +332,13 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
332
  }
333
  $user = learn_press_get_current_user();
334
 
335
- $cart = LP()->cart;
336
  $checkout = LP_Checkout::instance();
337
 
338
  if ( ! learn_press_enable_cart() ) {
339
- $order_awaiting_payment = LP()->session->order_awaiting_payment;
340
  $cart->empty_cart();
341
- LP()->session->order_awaiting_payment = $order_awaiting_payment;
342
  }
343
 
344
  $cart_id = $cart->add_to_cart( $course_id, 1, array() );
@@ -1365,37 +1365,37 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
1365
  $params['orderby']['enum'] = array_merge( $params['orderby']['enum'], array( 'menu_order', 'price' ) );
1366
 
1367
  $params['category'] = array(
1368
- 'description' => __( 'Limit result set to courses assigned a specific category ID.', 'learnpress' ),
1369
  'type' => 'string',
1370
  'sanitize_callback' => 'wp_parse_id_list',
1371
  'validate_callback' => 'rest_validate_request_arg',
1372
  );
1373
  $params['tag'] = array(
1374
- 'description' => __( 'Limit result set to courses assigned a specific tag ID.', 'learnpress' ),
1375
  'type' => 'string',
1376
  'sanitize_callback' => 'wp_parse_id_list',
1377
  'validate_callback' => 'rest_validate_request_arg',
1378
  );
1379
  $params['course_filter'] = array(
1380
- 'description' => __( 'Filter by course to in-progress, passed, failed.', 'learnpress' ),
1381
  'type' => 'string',
1382
  'sanitize_callback' => 'sanitize_text_field',
1383
  'validate_callback' => 'rest_validate_request_arg',
1384
  );
1385
 
1386
  $params['on_sale'] = array(
1387
- 'description' => __( 'Get item learned by user.', 'learnpress' ),
1388
  'type' => 'boolean',
1389
  'validate_callback' => 'rest_validate_request_arg',
1390
  );
1391
 
1392
  $params['popular'] = array(
1393
- 'description' => __( 'Get item popularity.', 'learnpress' ),
1394
  'type' => 'boolean',
1395
  'validate_callback' => 'rest_validate_request_arg',
1396
  );
1397
  $params['optimize'] = array(
1398
- 'description' => __( 'Disable some fields schema.', 'learnpress' ),
1399
  'type' => array( 'boolean', 'string' ),
1400
  'validate_callback' => 'wp_parse_id_list',
1401
  );
332
  }
333
  $user = learn_press_get_current_user();
334
 
335
+ $cart = LearnPress::instance()->cart;
336
  $checkout = LP_Checkout::instance();
337
 
338
  if ( ! learn_press_enable_cart() ) {
339
+ $order_awaiting_payment = LearnPress::instance()->session->order_awaiting_payment;
340
  $cart->empty_cart();
341
+ LearnPress::instance()->session->order_awaiting_payment = $order_awaiting_payment;
342
  }
343
 
344
  $cart_id = $cart->add_to_cart( $course_id, 1, array() );
1365
  $params['orderby']['enum'] = array_merge( $params['orderby']['enum'], array( 'menu_order', 'price' ) );
1366
 
1367
  $params['category'] = array(
1368
+ 'description' => 'Limit result set to courses assigned a specific category ID.',
1369
  'type' => 'string',
1370
  'sanitize_callback' => 'wp_parse_id_list',
1371
  'validate_callback' => 'rest_validate_request_arg',
1372
  );
1373
  $params['tag'] = array(
1374
+ 'description' => 'Limit result set to courses assigned a specific tag ID.',
1375
  'type' => 'string',
1376
  'sanitize_callback' => 'wp_parse_id_list',
1377
  'validate_callback' => 'rest_validate_request_arg',
1378
  );
1379
  $params['course_filter'] = array(
1380
+ 'description' => 'Filter by course to in-progress, passed, failed.',
1381
  'type' => 'string',
1382
  'sanitize_callback' => 'sanitize_text_field',
1383
  'validate_callback' => 'rest_validate_request_arg',
1384
  );
1385
 
1386
  $params['on_sale'] = array(
1387
+ 'description' => 'Get item learned by user.',
1388
  'type' => 'boolean',
1389
  'validate_callback' => 'rest_validate_request_arg',
1390
  );
1391
 
1392
  $params['popular'] = array(
1393
+ 'description' => 'Get item popularity.',
1394
  'type' => 'boolean',
1395
  'validate_callback' => 'rest_validate_request_arg',
1396
  );
1397
  $params['optimize'] = array(
1398
+ 'description' => 'Disable some fields schema.',
1399
  'type' => array( 'boolean', 'string' ),
1400
  'validate_callback' => 'wp_parse_id_list',
1401
  );
inc/jwt/rest-api/version1/class-lp-rest-lessons-v1-controller.php CHANGED
@@ -214,7 +214,7 @@ class LP_Jwt_Lessons_V1_Controller extends LP_REST_Jwt_Posts_Controller {
214
  throw new Exception( esc_html__( 'Error: No Course or User available.', 'learnpress' ) );
215
  }
216
 
217
- $result = $user->complete_lesson( $id, $course_id, true );
218
 
219
  if ( is_wp_error( $result ) ) {
220
  throw new Exception( $result->get_error_message() ?? esc_html__( 'Error: Cannot complete Lesson', 'learnpress' ) );
214
  throw new Exception( esc_html__( 'Error: No Course or User available.', 'learnpress' ) );
215
  }
216
 
217
+ $result = $user->complete_lesson( $id, $course_id );
218
 
219
  if ( is_wp_error( $result ) ) {
220
  throw new Exception( $result->get_error_message() ?? esc_html__( 'Error: Cannot complete Lesson', 'learnpress' ) );
inc/lp-core-functions.php CHANGED
@@ -46,8 +46,9 @@ add_filter( 'use_block_editor_for_post_type', 'learnpress_gutenberg_disable_cpt'
46
  * @param string $type
47
  *
48
  * @return bool|LP_Course_CURD|LP_User_CURD|LP_Quiz_CURD|LP_Question_CURD
 
49
  */
50
- function learn_press_get_curd( $type ) {
51
  $curds = array(
52
  'user' => 'LP_User_CURD',
53
  'course' => 'LP_Course_CURD',
@@ -62,7 +63,7 @@ function learn_press_get_curd( $type ) {
62
  }
63
 
64
  return apply_filters( 'learn-press/curd', $curd, $type, $curds );
65
- }
66
 
67
  if ( ! function_exists( 'lp_add_body_class' ) ) {
68
  function lp_add_body_class( $classes ) {
@@ -136,18 +137,6 @@ function learn_press_quick_tip( $tip, $echo = true, $options = array() ) {
136
  return $tip;
137
  }
138
 
139
- /**
140
- * Return TRUE if defined WP_DEBUG and is true or 1.
141
- *
142
- * @return bool
143
- * @editor tungnx
144
- * @depecated 4.1.6.4
145
- */
146
- function learn_press_is_debug() {
147
- _deprecated_function( __FUNCTION__, '4.1.6.4' );
148
- return LP_Debug::is_debug();
149
- }
150
-
151
  /**
152
  * Get current post ID.
153
  *
@@ -176,7 +165,7 @@ function learn_press_get_post() {
176
  * @return string
177
  */
178
  function learn_press_plugin_url( $sub_dir = '' ) {
179
- return LP()->plugin_url( $sub_dir );
180
  }
181
 
182
  /**
@@ -187,7 +176,7 @@ function learn_press_plugin_url( $sub_dir = '' ) {
187
  * @return string
188
  */
189
  function learn_press_plugin_path( $sub_dir = '' ) {
190
- return LP()->plugin_path( $sub_dir );
191
  }
192
 
193
  /**
@@ -804,8 +793,9 @@ function learn_press_human_time_to_seconds( $time, $default = '' ) {
804
  * @param array $vars .
805
  *
806
  * @return bool
 
807
  */
808
- function learn_press_send_mail( $to = '', $action = '', $vars = array() ) {
809
  $email_settings = LP_Settings::instance();
810
 
811
  if ( ! $email_settings->get( $action . '.enable' ) ) {
@@ -823,12 +813,13 @@ function learn_press_send_mail( $to = '', $action = '', $vars = array() ) {
823
  $email->add_recipient( $to );
824
 
825
  return $email->send();
826
- }
827
 
828
  /*
829
  * Send email notification when a course be published
 
830
  */
831
- function learn_press_publish_course( $new_status, $old_status, $post ) {
832
  if ( $old_status == 'pending' && $new_status == 'publish' && $post->post_type == 'lp_course' ) {
833
  $instructor = get_userdata( $post->post_author );
834
  $mail_to = $instructor->user_email;
@@ -848,19 +839,9 @@ function learn_press_publish_course( $new_status, $old_status, $post ) {
848
  )
849
  );
850
  }
851
- }
852
-
853
- add_action( 'transition_post_status', 'learn_press_publish_course', 10, 3 );
854
 
855
- /**
856
- * @param $user_id
857
- *
858
- * @return WP_Query
859
- * @depecated 4.1.6.4
860
- */
861
- function learn_press_get_enrolled_courses( $user_id ) {
862
- return LP()->get_user( $user_id )->get( 'enrolled-courses' );
863
- }
864
 
865
  /**
866
  * @param $user_id
@@ -1516,51 +1497,52 @@ add_filter( 'gettext_with_context', '_learn_press_translate_user_roles', 10, 4 )
1516
  * @param string
1517
  *
1518
  * @return string
 
1519
  */
1520
- function learn_press_posts_where_statement_search( $where ) {
1521
- // gets the global query var object
1522
- global $wp_query, $wpdb;
1523
-
1524
- /**
1525
- * Need to wrap this block into () in order to make it works correctly when filter by specific post type => maybe a bug :)
1526
- * from => ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%'
1527
- * to => ( ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%' )
1528
- */
1529
- $a = preg_match( '!(' . $wpdb->posts . '.post_status)!', $where );
1530
- $b = preg_match( '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!', $where );
1531
-
1532
- if ( $a && $b ) {
1533
- // append ( to the start of the block
1534
- $where = preg_replace( '!(' . $wpdb->posts . '.post_status)!', '( $1', $where, 1 );
1535
-
1536
- // append ) to the end of the block
1537
- $where = preg_replace(
1538
- '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!',
1539
- '$1 )',
1540
- $where
1541
- );
1542
- }
1543
- remove_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1544
-
1545
- return $where;
1546
- }
1547
 
1548
  /**
1549
  * Filter post type for search function
1550
  * Only search lpr_course if see the param ref=course in request
1551
  *
1552
  * @param WP_Query $q
 
1553
  */
1554
- function learn_press_filter_search( $q ) {
1555
  if ( $q->is_main_query() && $q->is_search() && ( ! empty( $_REQUEST['ref'] ) && sanitize_text_field( $_REQUEST['ref'] ) == 'course' ) ) {
1556
  $q->set( 'post_type', 'lp_course' );
1557
 
1558
  add_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1559
  remove_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
1560
  }
1561
- }
1562
-
1563
- add_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
1564
 
1565
  if ( ! function_exists( 'learn_press_send_json' ) ) {
1566
  function learn_press_send_json( $data ) {
@@ -1630,7 +1612,8 @@ function learn_press_send_json_success( $data = '' ) {
1630
  function learn_press_maybe_send_json( $data, $callback = null ) {
1631
  if ( learn_press_is_ajax() ) {
1632
  is_callable( $callback ) && call_user_func( $callback );
1633
- if ( empty( $data['message'] ) && ( $message = learn_press_get_messages( true ) ) ) {
 
1634
  $data['message'] = $message;
1635
  }
1636
  learn_press_send_json( $data );
@@ -1879,7 +1862,7 @@ function learn_press_get_endpoint_url( $name, $value, $url ) {
1879
  }
1880
 
1881
  // Map endpoint to options
1882
- $name = isset( LP()->query_vars[ $name ] ) ? LP()->query_vars[ $name ] : $name;
1883
 
1884
  if ( get_option( 'permalink_structure' ) ) {
1885
  if ( strstr( $url, '?' ) ) {
@@ -1906,7 +1889,7 @@ function learn_press_add_endpoints() {
1906
  $endpoints = $settings->get_checkout_endpoints();
1907
  if ( $endpoints ) {
1908
  foreach ( $endpoints as $endpoint => $value ) {
1909
- LP()->query_vars[ $endpoint ] = $value;
1910
  add_rewrite_endpoint( $value, EP_PAGES );
1911
  }
1912
  }
@@ -1914,7 +1897,7 @@ function learn_press_add_endpoints() {
1914
  $endpoints = $settings->get_profile_endpoints();
1915
  if ( $endpoints ) {
1916
  foreach ( $endpoints as $endpoint => $value ) {
1917
- LP()->query_vars[ $endpoint ] = $value;
1918
  add_rewrite_endpoint( $value, EP_PAGES );
1919
  }
1920
  }
@@ -1923,7 +1906,7 @@ function learn_press_add_endpoints() {
1923
  if ( $endpoints ) {
1924
  foreach ( $endpoints as $endpoint => $value ) {
1925
  $endpoint = preg_replace( '!_!', '-', $endpoint );
1926
- LP()->query_vars[ $endpoint ] = $value;
1927
  add_rewrite_endpoint(
1928
  $value, /*EP_ROOT | */
1929
  EP_PAGES
@@ -1961,7 +1944,7 @@ function learn_press_parse_request() {
1961
  global $wp;
1962
 
1963
  // Map query vars to their keys, or get them if endpoints are not supported
1964
- foreach ( LP()->query_vars as $key => $var ) {
1965
  if ( isset( $_GET[ $var ] ) ) {
1966
  $wp->query_vars[ $key ] = LP_Helper::sanitize_params_submitted( $_GET[ $var ] ?? '' );
1967
  } elseif ( isset( $wp->query_vars[ $var ] ) ) {
@@ -1989,14 +1972,15 @@ if ( ! function_exists( 'learn_press_reset_auto_increment' ) ) {
1989
  * @param bool $hash
1990
  *
1991
  * @return string
 
1992
  */
1993
- function learn_press_get_log_file_path( $handle, $hash = false ) {
1994
  if ( $hash ) {
1995
  $hash = '-' . sanitize_file_name( wp_hash( $handle ) );
1996
  }
1997
 
1998
  return trailingslashit( LP_LOG_PATH ) . $handle . $hash . '.log';
1999
- }
2000
 
2001
  /**
2002
  * Get the cart object in checkout page
@@ -2004,7 +1988,7 @@ function learn_press_get_log_file_path( $handle, $hash = false ) {
2004
  * @return LP_Cart
2005
  */
2006
  function learn_press_get_checkout_cart() {
2007
- return apply_filters( 'learn_press_checkout_cart', LP()->cart );
2008
  }
2009
 
2010
  /*function learn_press_front_scripts() {
@@ -2013,7 +1997,7 @@ function learn_press_get_checkout_cart() {
2013
  }
2014
  $js = array(
2015
  'ajax' => admin_url( 'admin-ajax.php' ),
2016
- 'plugin_url' => LP()->plugin_url(),
2017
  'siteurl' => home_url(),
2018
  'current_url' => learn_press_get_current_url(),
2019
  'localize' => array(
@@ -2102,10 +2086,11 @@ function learn_press_profile_tab_exists( $tab ) {
2102
  * @param string $string
2103
  *
2104
  * @return string
 
2105
  */
2106
- function _learn_press_urlencode( $string ) {
2107
  return preg_replace( '/\s/', '+', $string );
2108
- }
2109
 
2110
  /**
2111
  * Point the archive post type link to course page if current
@@ -2116,16 +2101,16 @@ function _learn_press_urlencode( $string ) {
2116
  * @param string $post_type
2117
  *
2118
  * @return string
 
2119
  */
2120
- function learn_press_post_type_archive_link( $link, $post_type ) {
2121
  if ( $post_type == LP_COURSE_CPT && learn_press_get_page_id( 'courses' ) ) {
2122
  $link = learn_press_get_page_link( 'courses' );
2123
  }
2124
 
2125
  return $link;
2126
- }
2127
-
2128
- add_filter( 'post_type_archive_link', 'learn_press_post_type_archive_link', 10, 2 );
2129
 
2130
  function learn_press_single_term_title( $prefix = '', $display = true ) {
2131
  $term = get_queried_object();
@@ -2295,7 +2280,7 @@ function learn_press_get_checkout_url() {
2295
  * @return string
2296
  */
2297
  function learn_press_checkout_needs_payment() {
2298
- return LP()->cart->needs_payment();
2299
  }
2300
 
2301
  /**
@@ -2379,8 +2364,9 @@ function learn_press_debug() {
2379
  * Get current time to user for calculate remaining time of quiz.
2380
  *
2381
  * @return int
 
2382
  */
2383
- function learn_press_get_current_time() {
2384
  $current_time = apply_filters( 'learn_press_get_current_time', 0 );
2385
 
2386
  if ( $current_time > 0 ) {
@@ -2397,7 +2383,7 @@ function learn_press_get_current_time() {
2397
  } else {
2398
  return $b;
2399
  }
2400
- }
2401
 
2402
  function learn_press_get_requested_post_type() {
2403
  global $pagenow;
@@ -2436,22 +2422,6 @@ function learn_press_get_graduation_text( $slug ) {
2436
  return apply_filters( 'learn-press/get-graduation-text', $text, $slug );
2437
  }
2438
 
2439
- /*function learn_press_execute_time( $n = 1 ) {
2440
- static $time;
2441
- if ( empty( $time ) ) {
2442
- $time = microtime( true );
2443
-
2444
- return $time;
2445
- } else {
2446
- $execute_time = microtime( true ) - $time;
2447
-
2448
- echo 'Execute time ' . $n * $execute_time . "\n";
2449
- $time = 0;
2450
-
2451
- return $execute_time;
2452
- }
2453
- }*/
2454
-
2455
  if ( ! function_exists( 'learn_press_is_negative_value' ) ) {
2456
  function learn_press_is_negative_value( $value ) {
2457
  $return = in_array( $value, array( 'no', 'off', 'false', '0' ) ) || ! $value || $value == '' || $value == null;
@@ -2517,13 +2487,6 @@ function learn_press_comment_reply_link( $link, $args = array(), $comment = null
2517
 
2518
  add_filter( 'comment_reply_link', 'learn_press_comment_reply_link', 10, 4 );
2519
 
2520
- function learn_press_deprecated_function( $function, $version, $replacement = null ) {
2521
- if ( LP_Debug::is_debug() ) {
2522
- _deprecated_function( $function, $version, $replacement );
2523
- }
2524
- }
2525
-
2526
-
2527
  /**
2528
  * Sanitize content of tooltip
2529
  *
@@ -2567,8 +2530,9 @@ function learn_press_tooltip( $tooltip, $html = false ) {
2567
  *
2568
  * @return float|int
2569
  * @since 3.0.0
 
2570
  */
2571
- function learn_press_timezone_offset() {
2572
  if ( $tz = get_option( 'timezone_string' ) ) {
2573
  $timezone = new DateTimeZone( $tz );
2574
 
@@ -2576,7 +2540,7 @@ function learn_press_timezone_offset() {
2576
  } else {
2577
  return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS;
2578
  }
2579
- }
2580
 
2581
  /**
2582
  * Get default static pages of LP.
@@ -2635,208 +2599,6 @@ function learn_press_static_pages( $name = false ) {
2635
  return $pages;
2636
  }
2637
 
2638
- /*function learn_press_cache_path( $group, $key = '' ) {
2639
- $path = LP_PLUGIN_PATH . 'cache';
2640
- if ( ! file_exists( $path ) ) {
2641
- @mkdir( $path );
2642
- }
2643
- $path = $path . '/' . $group;
2644
-
2645
- if ( ! file_exists( $path ) ) {
2646
- @mkdir( $path );
2647
- }
2648
- if ( $key ) {
2649
- $path = $path . '/' . $key . '.ch';
2650
- }
2651
-
2652
- return $path;
2653
- }*/
2654
-
2655
- function learn_press_cache_get( $key, $group, $found = null ) {
2656
- //$file = learn_press_cache_path( $group, $key );
2657
- $data = wp_cache_get( $key, $group, $found );
2658
-
2659
- /*if ( ! file_exists( $file ) ) {
2660
- return false;
2661
- }*/
2662
-
2663
- /*if ( false === $data ) {
2664
- $content = file_get_contents( $file );
2665
-
2666
- if ( file_exists( $file ) && $content ) {
2667
- try {
2668
- $data = unserialize( $content );
2669
- } catch ( Exception $ex ) {
2670
- print_r( $content );
2671
- die();
2672
- }
2673
- wp_cache_set( $key, $data, $group, $found );
2674
- }
2675
- }*/
2676
-
2677
- return $data;
2678
- }
2679
-
2680
- function learn_press_cache_set( $key, $data, $group = '', $expire = 0 ) {
2681
- //$file = learn_press_cache_path( $group, $key );
2682
- wp_cache_set( $key, $data, $group, $expire );
2683
-
2684
- /*if ( ! is_string( $data ) ) {
2685
- $data = serialize( $data );
2686
- }
2687
- file_put_contents( $file, $data );*/
2688
- }
2689
-
2690
- function learn_press_cache_replace( $key, $data, $group = '', $expire = 0 ) {
2691
- wp_cache_replace( $key, $data, $group, $expire );
2692
- }
2693
-
2694
- function learn_press_cache_add( $key, $data, $group = '', $expire = 0 ) {
2695
- wp_cache_add( $key, $data, $group, $expire );
2696
- }
2697
-
2698
- if ( ! function_exists( 'learn_press_get_widget_course_object' ) ) {
2699
- /**
2700
- * Get course object for widget query.
2701
- *
2702
- * @param $query
2703
- *
2704
- * @return array
2705
- * @deprecated v4.1.6.1 - we will remove on the version 4.1.7
2706
- */
2707
- function learn_press_get_widget_course_object( $query ) {
2708
-
2709
- _deprecated_function( __FUNCTION__, '4.1.6.1' );
2710
-
2711
- global $wpdb;
2712
-
2713
- $posts = $wpdb->get_results( $query );
2714
- if ( $posts ) {
2715
- // get lp courses object from WordPress post
2716
- $courses = array_map( 'learn_press_get_lp_course', $posts );
2717
- $courses = array_filter( $courses );
2718
-
2719
- } else {
2720
- $courses = array();
2721
- }
2722
-
2723
- return $courses;
2724
- }
2725
- }
2726
-
2727
- if ( ! function_exists( 'learn_press_get_lp_course' ) ) {
2728
- /**
2729
- * Get learn press course from WordPress post object
2730
- *
2731
- * @param object - reference $post WordPress post object
2732
- *
2733
- * @return LP_Course course
2734
- * @deprecated v4.1.6.1 - we will remove on the version 4.1.7
2735
- */
2736
- function learn_press_get_lp_course( $post ) {
2737
- _deprecated_function( __FUNCTION__, '4.1.6.1' );
2738
-
2739
- $id = $post->ID;
2740
- $course = null;
2741
- if ( ! empty( $id ) ) {
2742
- // $course = new LP_Course( $id );
2743
- $course = learn_press_get_course( $id );
2744
- }
2745
-
2746
- return $course;
2747
- }
2748
- }
2749
-
2750
- /**
2751
- * Get all items are unassigned to any course.
2752
- *
2753
- * @param string|array $type - Optional. Types of items to get, default is all.
2754
- *
2755
- * @return array
2756
- * @since 3.0.0
2757
- * @deprecated 4.1.4.1 - Will remove on version 4.1.7
2758
- */
2759
- function learn_press_get_unassigned_items( $type = '' ) {
2760
- _deprecated_function( __FUNCTION__, '4.1.6.1' );
2761
-
2762
- global $wpdb;
2763
-
2764
- if ( ! $type ) {
2765
- $type = learn_press_course_get_support_item_types();
2766
- $type = array_keys( $type );
2767
- }
2768
-
2769
- settype( $type, 'array' );
2770
- $key = 'items-' . md5( serialize( $type ) );
2771
-
2772
- if ( false === ( $items = LP_Object_Cache::get( $key, 'learn-press/unassigned' ) ) ) {
2773
- $format = array_fill( 0, sizeof( $type ), '%s' );
2774
-
2775
- $query = $wpdb->prepare(
2776
- "
2777
- SELECT p.ID
2778
- FROM {$wpdb->posts} p
2779
- WHERE p.post_type IN(" . join( ',', $format ) . ")
2780
- AND p.ID NOT IN(
2781
- SELECT si.item_id
2782
- FROM {$wpdb->learnpress_section_items} si
2783
- INNER JOIN {$wpdb->posts} p ON p.ID = si.item_id
2784
- WHERE p.post_type IN(" . join( ',', $format ) . ')
2785
- )
2786
- AND p.post_status NOT IN(%s, %s)
2787
- ',
2788
- array_merge( $type, $type, array( 'auto-draft', 'trash' ) )
2789
- );
2790
-
2791
- $items = $wpdb->get_col( $query );
2792
-
2793
- //LP_Debug::var_dump($query, __FILE__, __LINE__);
2794
-
2795
- LP_Object_Cache::set( $key, $items, 'learn-press/unassigned' );
2796
- }
2797
-
2798
- return $items;
2799
- }
2800
-
2801
- /**
2802
- * Get all questions are unassigned to any quiz.
2803
- *
2804
- * @return array
2805
- * @since 3.0.0
2806
- * @deprecated 4.1.6.1 - Will remove on version 4.1.7
2807
- */
2808
- function learn_press_get_unassigned_questions() {
2809
- _deprecated_function( __FUNCTION__, '4.1.6.1' );
2810
-
2811
- global $wpdb;
2812
-
2813
- if ( false === ( $questions = LP_Object_Cache::get( 'questions', 'learn-press/unassigned' ) ) ) {
2814
- $query = $wpdb->prepare(
2815
- "
2816
- SELECT p.ID
2817
- FROM {$wpdb->posts} p
2818
- WHERE p.post_type = %s
2819
- AND p.ID NOT IN(
2820
- SELECT qq.question_id
2821
- FROM {$wpdb->learnpress_quiz_questions} qq
2822
- INNER JOIN {$wpdb->posts} p ON p.ID = qq.question_id
2823
- WHERE p.post_type = %s
2824
- )
2825
- AND p.post_status NOT IN(%s, %s)
2826
- ",
2827
- LP_QUESTION_CPT,
2828
- LP_QUESTION_CPT,
2829
- 'auto-draft',
2830
- 'trash'
2831
- );
2832
-
2833
- $questions = $wpdb->get_col( $query );
2834
- LP_Object_Cache::set( 'questions', $questions, 'learn-press/unassigned' );
2835
- }
2836
-
2837
- return $questions;
2838
- }
2839
-
2840
  /**
2841
  * Callback function for sorting to array|object by key|prop priority.
2842
  *
@@ -2895,52 +2657,6 @@ function learn_press_date_i18n( $timestamp = '', $format = '', $gmt = false ) {
2895
  return date_i18n( $format, $timestamp, $gmt );
2896
  }
2897
 
2898
- function learn_press_date() {
2899
-
2900
- }
2901
-
2902
- /**
2903
- * Remove user items.
2904
- *
2905
- * @param int $item_id
2906
- * @param int $course_id
2907
- * @param int $user_id
2908
- * @param int $keep
2909
- *
2910
- * @since 3.0.8
2911
- * @deprecated 4.1.6.1 - Will remove on version 4.1.7
2912
- */
2913
- function learn_press_remove_user_items_history( $item_id, $course_id, $user_id, $keep = 10 ) {
2914
- _deprecated_function( __FUNCTION__, '4.1.6.1' );
2915
-
2916
- $user = learn_press_get_user( $user_id );
2917
- if ( $rows = $user->get_item_archive( $item_id, $course_id ) ) {
2918
-
2919
- global $wpdb;
2920
-
2921
- $args = array( $user_id, $item_id, $course_id );
2922
- $query = $wpdb->prepare(
2923
- "
2924
- DELETE
2925
- FROM {$wpdb->learnpress_user_items}
2926
- WHERE user_id = %d AND item_id = %d
2927
- AND ref_id = %d
2928
- ",
2929
- $args
2930
- );
2931
-
2932
- if ( $keep ) {
2933
- $user_item_ids = array_keys( $rows );
2934
- $user_item_ids = array_splice( $user_item_ids, 0, $keep );
2935
- $format = array_fill( 0, sizeof( $user_item_ids ), '%d' );
2936
-
2937
- $query .= $wpdb->prepare( ' AND user_item_id NOT IN(' . join( ',', $format ) . ')', $user_item_ids );
2938
- }
2939
-
2940
- $wpdb->query( $query );
2941
- }
2942
- }
2943
-
2944
  /**
2945
  * Get item types of course support for blocking. Default is lp_lesson
2946
  *
@@ -2992,8 +2708,9 @@ function learn_press_get_post_type( $post ) {
2992
  * @param string $type
2993
  *
2994
  * @since 3.1.0
 
2995
  */
2996
- function learn_press_cache_add_post_type( $id, $type = '' ) {
2997
  if ( false === ( $post_types = LP_Object_Cache::get( 'post-types', 'learn-press' ) ) ) {
2998
  $post_types = array();
2999
  }
@@ -3005,15 +2722,18 @@ function learn_press_cache_add_post_type( $id, $type = '' ) {
3005
  }
3006
 
3007
  LP_Object_Cache::set( 'post-types', $post_types, 'learn-press' );
3008
- }
3009
 
3010
- function learn_press_has_option( $name ) {
 
 
 
3011
  global $wpdb;
3012
 
3013
  $query = $wpdb->prepare( "SELECT option_id FROM {$wpdb->options} WHERE option_name = %s", $name );
3014
 
3015
  return $wpdb->get_var( $query ) > 0;
3016
- }
3017
 
3018
  /**
3019
  * Update option to enable shuffle themes for ad.
@@ -3026,11 +2746,14 @@ function _learn_press_schedule_enable_shuffle_themes() {
3026
 
3027
  add_action( 'learn-press/schedule-enable-shuffle-themes', '_learn_press_schedule_enable_shuffle_themes' );
3028
 
3029
- function learn_press_show_log() {
 
 
 
3030
  if ( trim( LP_Request::get( 'show_log' ) ) === md5( AUTH_KEY ) ) {
3031
  call_user_func_array( 'learn_press_debug', func_get_args() );
3032
  }
3033
- }
3034
 
3035
  /**
3036
  * @return array
@@ -3039,7 +2762,7 @@ function learn_press_show_log() {
3039
  function learn_press_global_script_params() {
3040
  $js = array(
3041
  'ajax' => admin_url( 'admin-ajax.php' ),
3042
- 'plugin_url' => LP()->plugin_url(),
3043
  'siteurl' => home_url(),
3044
  'current_url' => learn_press_get_current_url(),
3045
  'theme' => get_stylesheet(),
@@ -3061,8 +2784,9 @@ function learn_press_global_script_params() {
3061
  *
3062
  * @return string
3063
  * @since 3.3.0
 
3064
  */
3065
- function learn_press_get_cron_url() {
3066
  $nonce = get_option( 'learnpress_cron_url_nonce' );
3067
 
3068
  if ( ! $nonce ) {
@@ -3078,15 +2802,16 @@ function learn_press_get_cron_url() {
3078
  );
3079
 
3080
  return $url;
3081
- }
3082
 
3083
  /**
3084
  * Get courses expired.
3085
  *
3086
  * @return array
3087
  * @since 3.3.0
 
3088
  */
3089
- function learn_press_get_expired_courses() {
3090
  global $wpdb;
3091
 
3092
  $query = $wpdb->prepare(
@@ -3113,47 +2838,6 @@ function learn_press_get_expired_courses() {
3113
  'enrolled'
3114
  );
3115
 
3116
- }
3117
-
3118
- /**
3119
- * Add new error log. Support message as an array|object.
3120
- * Convert message to string if it is not a string.
3121
- *
3122
- * @param mixed $value
3123
- *
3124
- * @since 4.0.0
3125
- */
3126
- function learn_press_error_log( $value ) {
3127
- if ( is_array( $value ) || is_object( $value ) ) {
3128
- ob_start();
3129
- print_r( $value );
3130
- $value = ob_get_clean();
3131
- }
3132
-
3133
- error_log( $value );
3134
- }
3135
-
3136
- /**
3137
- * Get status of global course for current user.
3138
- *
3139
- * @param int $user_id
3140
- * @param int $course_id
3141
- *
3142
- * @return bool|string
3143
- * @since 3.3.0
3144
- * @editor tungnx
3145
- * @modify 4.1.3 - comment - not use
3146
- */
3147
- /*function learn_press_user_course_status( $user_id = 0, $course_id = 0 ) {
3148
- if ( ! $user = learn_press_get_user( $user_id ? $user_id : get_current_user_id() ) ) {
3149
- return false;
3150
- }
3151
-
3152
- if ( ! $userCourse = $user->get_course_data( $course_id ) ) {
3153
- return false;
3154
- }
3155
-
3156
- return $userCourse->get_status();
3157
  }*/
3158
 
3159
  /**
@@ -3200,8 +2884,9 @@ function learn_press_get_question_support_feature( $feature ) {
3200
  * @param string $color
3201
  *
3202
  * @since 3.3.0
 
3203
  */
3204
- function learn_press_circle_progress_html( $percent = 0, $width = 32, $border = 4, $color = '' ) {
3205
  $radius = $width / 2;
3206
  $r = ( $width - $border ) / 2;
3207
  $circumference = $r * 2 * pi();
@@ -3227,13 +2912,16 @@ function learn_press_circle_progress_html( $percent = 0, $width = 32, $border =
3227
  $radius,
3228
  $radius
3229
  );
3230
- }
3231
 
3232
- function learn_press_is_page( $page_name ) {
 
 
 
3233
  $page_id = learn_press_get_page_id( $page_name );
3234
 
3235
  return $page_id && is_page( $page_id );
3236
- }
3237
 
3238
  /**
3239
  * Get end-date from start date with a duration.
@@ -3243,8 +2931,9 @@ function learn_press_is_page( $page_name ) {
3243
  *
3244
  * @return false|string
3245
  * @since 3.x.x
 
3246
  */
3247
- function learn_press_date_end_from( $duration, $start = '' ) {
3248
  $format = 'Y-m-d H:i:s';
3249
 
3250
  if ( ! $start ) {
@@ -3262,11 +2951,7 @@ function learn_press_date_end_from( $duration, $start = '' ) {
3262
  }
3263
 
3264
  return date( $format, $start + $duration );
3265
- }
3266
-
3267
- function learn_press_date_diff( $from, $to ) {
3268
-
3269
- }
3270
 
3271
  function learn_press_cookie_get( $name, $namespace = 'LP' ) {
3272
  if ( $namespace ) {
@@ -3278,26 +2963,6 @@ function learn_press_cookie_get( $name, $namespace = 'LP' ) {
3278
  return $cookie[ $name ] ?? null;
3279
  }
3280
 
3281
- /**
3282
- * Get list of levels support in course.
3283
- *
3284
- * @return array
3285
- * @since 3.x.x
3286
- * @editor tungnx
3287
- * @reason comment - not use
3288
- */
3289
- /*
3290
- function learn_press_default_course_levels() {
3291
- $levels = array(
3292
- 'beginner' => __( 'Beginner', 'learnpress' ),
3293
- 'intermediate' => __( 'Intermediate', 'learnpress' ),
3294
- 'expert' => __( 'Expert', 'learnpress' ),
3295
- '' => __( 'All levels', 'learnpress' ),
3296
- );
3297
-
3298
- return apply_filters( 'learn-press/default-course-levels', $levels );
3299
- }*/
3300
-
3301
  /**
3302
  * Get default methods to evaluate course results.
3303
  *
@@ -3375,32 +3040,6 @@ function learn_press_course_evaluation_methods( $postid, $return = '', $final_qu
3375
  );
3376
  }
3377
 
3378
- /**
3379
- * Wrap WP Core function current_time with mysql format.
3380
- *
3381
- * @param bool $gmt
3382
- *
3383
- * @return int|string
3384
- * @since 4.0.0
3385
- * @editor tungnx
3386
- * @modify 4.1.4.1 - comment - not use
3387
- */
3388
- /*function learn_press_mysql_time( $gmt = true ) {
3389
- return current_time( 'mysql', $gmt );
3390
- }*/
3391
-
3392
- /**
3393
- * Wrap WP Core function current_time with timestamp format.
3394
- *
3395
- * @param bool $gmt
3396
- *
3397
- * @return int|string
3398
- * @since 4.0.0
3399
- */
3400
- function learn_press_timestamp( $gmt = true ) {
3401
- return current_time( 'timestamp', $gmt );
3402
- }
3403
-
3404
  /**
3405
  * Convert time from GMT to local.
3406
  *
@@ -3409,8 +3048,9 @@ function learn_press_timestamp( $gmt = true ) {
3409
  *
3410
  * @return false|int|string
3411
  * @since 4.0.0
 
3412
  */
3413
- function learn_press_time_from_gmt( $gmt_time, $format = 'Y-m-d H:i:s' ) {
3414
  if ( is_string( $gmt_time ) ) {
3415
  $gmt_time = strtotime( $gmt_time );
3416
  } elseif ( $gmt_time instanceof LP_Datetime ) {
@@ -3424,91 +3064,7 @@ function learn_press_time_from_gmt( $gmt_time, $format = 'Y-m-d H:i:s' ) {
3424
  }
3425
 
3426
  return $current_time;
3427
- }
3428
-
3429
- /**
3430
- * Count all users has enrolled courses of an instructor.
3431
- *
3432
- * @param int $instructor_id . Author of course
3433
- *
3434
- SELECT COUNT(DISTINCT (user_id)) AS total
3435
- FROM wp_learnpress_user_items
3436
- WHERE 1 = 1
3437
- AND item_type = 'lp_course'
3438
- AND item_id IN (
3439
- SELECT ID
3440
- FROM wp_posts
3441
- WHERE post_author = 1
3442
- AND post_type = 'lp_course'
3443
- AND post_status = 'publish'
3444
- );
3445
- *
3446
- * @return int
3447
- * @since 4.0.0
3448
- * @editor tungnx
3449
- * @version 1.0.1
3450
- * @deprecated 4.1.6 replace to "get_statistic_info" function
3451
- */
3452
- //function learn_press_count_instructor_users( int $instructor_id = 0 ): int {
3453
- // try {
3454
- // $filter_course = new LP_Course_Filter();
3455
- // $filter_course->only_fields = array( 'ID' );
3456
- // $filter_course->post_author = $instructor_id;
3457
- // $filter_course->post_status = 'publish';
3458
- // $filter_course->return_string_query = true;
3459
- // $query_courses_str = LP_Course_DB::getInstance()->get_courses( $filter_course );
3460
- //
3461
- // $filter = new LP_User_Items_Filter();
3462
- // $filter->only_fields = array( 'DISTINCT (ui.user_id)' );
3463
- // $filter->field_count = 'DISTINCT (ui.user_id)';
3464
- // $filter->where[] = "AND item_id IN ({$query_courses_str})";
3465
- // $filter->query_count = true;
3466
- //
3467
- // return LP_User_Item_Course::get_user_courses( $filter );
3468
- // //return LP_User_Items_DB::getInstance()->get_user_courses( $filter );
3469
- // } catch ( Throwable $e ) {
3470
- // error_log( __FUNCTION__ . ': ' . $e->getMessage() );
3471
- //
3472
- // return 0;
3473
- // }
3474
- //
3475
- // /*$curd = new LP_User_CURD();
3476
- // $own_courses = $curd->query_own_courses( $instructor_id );
3477
- // $course_ids = $own_courses->get_items();*/
3478
- //
3479
- // /*
3480
- // global $wpdb;
3481
- // $filter = new LP_Course_Filter();
3482
- // $filter->post_author = $instructor_id;
3483
- // $filter->limit = -1;
3484
- // $courses = LP_Course::get_courses( $filter );
3485
- // $course_ids = LP_Course::get_course_ids( $courses );
3486
- //
3487
- // if ( ! empty( $course_ids ) ) {
3488
- // $query = $wpdb->prepare(
3489
- // "
3490
- // SELECT COUNT(user_id)
3491
- // FROM (
3492
- // SELECT item_id, user_id
3493
- // FROM {$wpdb->learnpress_user_items}
3494
- // WHERE item_type = %s
3495
- // GROUP BY item_id, user_id
3496
- // HAVING item_id IN(" . join( ',', $course_ids ) . ')
3497
- // ) X
3498
- // GROUP BY item_id
3499
- // ',
3500
- // LP_COURSE_CPT
3501
- // );
3502
- //
3503
- // $rows = $wpdb->get_col( $query );
3504
- //
3505
- // if ( $rows ) {
3506
- // return array_sum( $rows );
3507
- // }
3508
- // }
3509
- //
3510
- // return 0;*/
3511
- //}
3512
 
3513
  /**
3514
  * Get max retrying quiz allowed.
@@ -3530,36 +3086,11 @@ function learn_press_get_quiz_max_retrying( $quiz_id = 0, $course_id = 0 ) {
3530
  *
3531
  * @return int
3532
  * @since 4.0.0
 
3533
  */
3534
- function learn_press_get_course_max_retrying( $course_id ) {
3535
  return apply_filters( 'learn-press/max-retry-course-allowed', 1, $course_id );
3536
- }
3537
-
3538
- /**
3539
- * Get slug for status of course/lesson/quiz if user
3540
- * completed/finished and graduation is failed.
3541
- *
3542
- * @param string $type
3543
- *
3544
- * @return string
3545
- * @since 4.0.0
3546
- */
3547
- function learn_press_user_item_failed_slug( $type = '' ) {
3548
- return apply_filters( 'learn-press/user-item-failed-slug', 'failed', $type );
3549
- }
3550
-
3551
- /**
3552
- * Get slug for status of course/lesson/quiz if user
3553
- * completed/finished and graduation is passed.
3554
- *
3555
- * @param string $type
3556
- *
3557
- * @return string
3558
- * @since 4.0.0
3559
- */
3560
- function learn_press_user_item_passed_slug( $type = '' ) {
3561
- return apply_filters( 'learn-press/user-item-passed-slug', 'passed', $type );
3562
- }
3563
 
3564
  /**
3565
  * Get slug for status of course/lesson/quiz if user
@@ -3597,26 +3128,6 @@ function learn_press_is_enrolled_slug( $slug ) {
3597
  );
3598
  }
3599
 
3600
- /**
3601
- * @return array
3602
- * @since 4.0.0
3603
- * @editor tungnx
3604
- * @modify 4.1.3 - comment - not use
3605
- */
3606
- function learn_press_course_enrolled_slugs(): array {
3607
- _deprecated_function( __FUNCTION__, '4.1.3' );
3608
- return apply_filters(
3609
- 'learn-press/course-enrolled-slugs',
3610
- array(
3611
- learn_press_user_item_passed_slug(),
3612
- learn_press_user_item_failed_slug(),
3613
- 'in-progress',
3614
- 'enrolled',
3615
- 'finished', // deprecated
3616
- )
3617
- );
3618
- }
3619
-
3620
  /**
3621
  * @return array
3622
  * @since 4.0.0
46
  * @param string $type
47
  *
48
  * @return bool|LP_Course_CURD|LP_User_CURD|LP_Quiz_CURD|LP_Question_CURD
49
+ * @depecated 4.1.7.2
50
  */
51
+ /*function learn_press_get_curd( $type ) {
52
  $curds = array(
53
  'user' => 'LP_User_CURD',
54
  'course' => 'LP_Course_CURD',
63
  }
64
 
65
  return apply_filters( 'learn-press/curd', $curd, $type, $curds );
66
+ }*/
67
 
68
  if ( ! function_exists( 'lp_add_body_class' ) ) {
69
  function lp_add_body_class( $classes ) {
137
  return $tip;
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  /**
141
  * Get current post ID.
142
  *
165
  * @return string
166
  */
167
  function learn_press_plugin_url( $sub_dir = '' ) {
168
+ return LearnPress::instance()->plugin_url( $sub_dir );
169
  }
170
 
171
  /**
176
  * @return string
177
  */
178
  function learn_press_plugin_path( $sub_dir = '' ) {
179
+ return LearnPress::instance()->plugin_path( $sub_dir );
180
  }
181
 
182
  /**
793
  * @param array $vars .
794
  *
795
  * @return bool
796
+ * @depecated 4.1.7.2
797
  */
798
+ /*function learn_press_send_mail( $to = '', $action = '', $vars = array() ) {
799
  $email_settings = LP_Settings::instance();
800
 
801
  if ( ! $email_settings->get( $action . '.enable' ) ) {
813
  $email->add_recipient( $to );
814
 
815
  return $email->send();
816
+ }*/
817
 
818
  /*
819
  * Send email notification when a course be published
820
+ * @deprecated 4.1.7.2
821
  */
822
+ /*function learn_press_publish_course( $new_status, $old_status, $post ) {
823
  if ( $old_status == 'pending' && $new_status == 'publish' && $post->post_type == 'lp_course' ) {
824
  $instructor = get_userdata( $post->post_author );
825
  $mail_to = $instructor->user_email;
839
  )
840
  );
841
  }
842
+ }*/
 
 
843
 
844
+ //add_action( 'transition_post_status', 'learn_press_publish_course', 10, 3 );
 
 
 
 
 
 
 
 
845
 
846
  /**
847
  * @param $user_id
1497
  * @param string
1498
  *
1499
  * @return string
1500
+ * @deprecated 4.1.7.2
1501
  */
1502
+ //function learn_press_posts_where_statement_search( $where ) {
1503
+ // // gets the global query var object
1504
+ // global $wp_query, $wpdb;
1505
+ //
1506
+ // /**
1507
+ // * Need to wrap this block into () in order to make it works correctly when filter by specific post type => maybe a bug :)
1508
+ // * from => ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%'
1509
+ // * to => ( ( wp_2_posts.post_status = 'publish' OR wp_2_posts.post_status = 'private') OR wp_2_terms.name LIKE '%s%' )
1510
+ // */
1511
+ // $a = preg_match( '!(' . $wpdb->posts . '.post_status)!', $where );
1512
+ // $b = preg_match( '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!', $where );
1513
+ //
1514
+ // if ( $a && $b ) {
1515
+ // // append ( to the start of the block
1516
+ // $where = preg_replace( '!(' . $wpdb->posts . '.post_status)!', '( $1', $where, 1 );
1517
+ //
1518
+ // // append ) to the end of the block
1519
+ // $where = preg_replace(
1520
+ // '!(OR\s+' . $wpdb->terms . '.name LIKE \'%' . $wp_query->get( 's' ) . '%\')!',
1521
+ // '$1 )',
1522
+ // $where
1523
+ // );
1524
+ // }
1525
+ // remove_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1526
+ //
1527
+ // return $where;
1528
+ //}
1529
 
1530
  /**
1531
  * Filter post type for search function
1532
  * Only search lpr_course if see the param ref=course in request
1533
  *
1534
  * @param WP_Query $q
1535
+ * @deprecated 4.1.7.2
1536
  */
1537
+ /*function learn_press_filter_search( $q ) {
1538
  if ( $q->is_main_query() && $q->is_search() && ( ! empty( $_REQUEST['ref'] ) && sanitize_text_field( $_REQUEST['ref'] ) == 'course' ) ) {
1539
  $q->set( 'post_type', 'lp_course' );
1540
 
1541
  add_filter( 'posts_where', 'learn_press_posts_where_statement_search', 99 );
1542
  remove_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
1543
  }
1544
+ }*/
1545
+ //add_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
 
1546
 
1547
  if ( ! function_exists( 'learn_press_send_json' ) ) {
1548
  function learn_press_send_json( $data ) {
1612
  function learn_press_maybe_send_json( $data, $callback = null ) {
1613
  if ( learn_press_is_ajax() ) {
1614
  is_callable( $callback ) && call_user_func( $callback );
1615
+ $message = learn_press_get_messages( true );
1616
+ if ( empty( $data['message'] ) && $message ) {
1617
  $data['message'] = $message;
1618
  }
1619
  learn_press_send_json( $data );
1862
  }
1863
 
1864
  // Map endpoint to options
1865
+ $name = isset( LearnPress::instance()->query_vars[ $name ] ) ? LearnPress::instance()->query_vars[ $name ] : $name;
1866
 
1867
  if ( get_option( 'permalink_structure' ) ) {
1868
  if ( strstr( $url, '?' ) ) {
1889
  $endpoints = $settings->get_checkout_endpoints();
1890
  if ( $endpoints ) {
1891
  foreach ( $endpoints as $endpoint => $value ) {
1892
+ LearnPress::instance()->query_vars[ $endpoint ] = $value;
1893
  add_rewrite_endpoint( $value, EP_PAGES );
1894
  }
1895
  }
1897
  $endpoints = $settings->get_profile_endpoints();
1898
  if ( $endpoints ) {
1899
  foreach ( $endpoints as $endpoint => $value ) {
1900
+ LearnPress::instance()->query_vars[ $endpoint ] = $value;
1901
  add_rewrite_endpoint( $value, EP_PAGES );
1902
  }
1903
  }
1906
  if ( $endpoints ) {
1907
  foreach ( $endpoints as $endpoint => $value ) {
1908
  $endpoint = preg_replace( '!_!', '-', $endpoint );
1909
+ LearnPress::instance()->query_vars[ $endpoint ] = $value;
1910
  add_rewrite_endpoint(
1911
  $value, /*EP_ROOT | */
1912
  EP_PAGES
1944
  global $wp;
1945
 
1946
  // Map query vars to their keys, or get them if endpoints are not supported
1947
+ foreach ( LearnPress::instance()->query_vars as $key => $var ) {
1948
  if ( isset( $_GET[ $var ] ) ) {
1949
  $wp->query_vars[ $key ] = LP_Helper::sanitize_params_submitted( $_GET[ $var ] ?? '' );
1950
  } elseif ( isset( $wp->query_vars[ $var ] ) ) {
1972
  * @param bool $hash
1973
  *
1974
  * @return string
1975
+ * @depecated 4.1.7.2
1976
  */
1977
+ /*function learn_press_get_log_file_path( $handle, $hash = false ) {
1978
  if ( $hash ) {
1979
  $hash = '-' . sanitize_file_name( wp_hash( $handle ) );
1980
  }
1981
 
1982
  return trailingslashit( LP_LOG_PATH ) . $handle . $hash . '.log';
1983
+ }*/
1984
 
1985
  /**
1986
  * Get the cart object in checkout page
1988
  * @return LP_Cart
1989
  */
1990
  function learn_press_get_checkout_cart() {
1991
+ return apply_filters( 'learn_press_checkout_cart', LearnPress::instance()->cart );
1992
  }
1993
 
1994
  /*function learn_press_front_scripts() {
1997
  }
1998
  $js = array(
1999
  'ajax' => admin_url( 'admin-ajax.php' ),
2000
+ 'plugin_url' => LearnPress::instance()->plugin_url(),
2001
  'siteurl' => home_url(),
2002
  'current_url' => learn_press_get_current_url(),
2003
  'localize' => array(
2086
  * @param string $string
2087
  *
2088
  * @return string
2089
+ * @depecated 4.1.7.2
2090
  */
2091
+ /*function _learn_press_urlencode( $string ) {
2092
  return preg_replace( '/\s/', '+', $string );
2093
+ }*/
2094
 
2095
  /**
2096
  * Point the archive post type link to course page if current
2101
  * @param string $post_type
2102
  *
2103
  * @return string
2104
+ * @depecated 4.1.7.2
2105
  */
2106
+ /*function learn_press_post_type_archive_link( $link, $post_type ) {
2107
  if ( $post_type == LP_COURSE_CPT && learn_press_get_page_id( 'courses' ) ) {
2108
  $link = learn_press_get_page_link( 'courses' );
2109
  }
2110
 
2111
  return $link;
2112
+ }*/
2113
+ //add_filter( 'post_type_archive_link', 'learn_press_post_type_archive_link', 10, 2 );
 
2114
 
2115
  function learn_press_single_term_title( $prefix = '', $display = true ) {
2116
  $term = get_queried_object();
2280
  * @return string
2281
  */
2282
  function learn_press_checkout_needs_payment() {
2283
+ return LearnPress::instance()->cart->needs_payment();
2284
  }
2285
 
2286
  /**
2364
  * Get current time to user for calculate remaining time of quiz.
2365
  *
2366
  * @return int
2367
+ * @depecated 4.1.7.2
2368
  */
2369
+ /*function learn_press_get_current_time() {
2370
  $current_time = apply_filters( 'learn_press_get_current_time', 0 );
2371
 
2372
  if ( $current_time > 0 ) {
2383
  } else {
2384
  return $b;
2385
  }
2386
+ }*/
2387
 
2388
  function learn_press_get_requested_post_type() {
2389
  global $pagenow;
2422
  return apply_filters( 'learn-press/get-graduation-text', $text, $slug );
2423
  }
2424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2425
  if ( ! function_exists( 'learn_press_is_negative_value' ) ) {
2426
  function learn_press_is_negative_value( $value ) {
2427
  $return = in_array( $value, array( 'no', 'off', 'false', '0' ) ) || ! $value || $value == '' || $value == null;
2487
 
2488
  add_filter( 'comment_reply_link', 'learn_press_comment_reply_link', 10, 4 );
2489
 
 
 
 
 
 
 
 
2490
  /**
2491
  * Sanitize content of tooltip
2492
  *
2530
  *
2531
  * @return float|int
2532
  * @since 3.0.0
2533
+ * @depecated 4.1.7.2
2534
  */
2535
+ /*function learn_press_timezone_offset() {
2536
  if ( $tz = get_option( 'timezone_string' ) ) {
2537
  $timezone = new DateTimeZone( $tz );
2538
 
2540
  } else {
2541
  return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS;
2542
  }
2543
+ }*/
2544
 
2545
  /**
2546
  * Get default static pages of LP.
2599
  return $pages;
2600
  }
2601
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2602
  /**
2603
  * Callback function for sorting to array|object by key|prop priority.
2604
  *
2657
  return date_i18n( $format, $timestamp, $gmt );
2658
  }
2659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2660
  /**
2661
  * Get item types of course support for blocking. Default is lp_lesson
2662
  *
2708
  * @param string $type
2709
  *
2710
  * @since 3.1.0
2711
+ * @depecated 4.1.7.2
2712
  */
2713
+ /*function learn_press_cache_add_post_type( $id, $type = '' ) {
2714
  if ( false === ( $post_types = LP_Object_Cache::get( 'post-types', 'learn-press' ) ) ) {
2715
  $post_types = array();
2716
  }
2722
  }
2723
 
2724
  LP_Object_Cache::set( 'post-types', $post_types, 'learn-press' );
2725
+ }*/
2726
 
2727
+ /**
2728
+ * @depecated 4.1.7.2
2729
+ */
2730
+ /*function learn_press_has_option( $name ) {
2731
  global $wpdb;
2732
 
2733
  $query = $wpdb->prepare( "SELECT option_id FROM {$wpdb->options} WHERE option_name = %s", $name );
2734
 
2735
  return $wpdb->get_var( $query ) > 0;
2736
+ }*/
2737
 
2738
  /**
2739
  * Update option to enable shuffle themes for ad.
2746
 
2747
  add_action( 'learn-press/schedule-enable-shuffle-themes', '_learn_press_schedule_enable_shuffle_themes' );
2748
 
2749
+ /**
2750
+ * @depecated 4.1.7.2
2751
+ */
2752
+ /*function learn_press_show_log() {
2753
  if ( trim( LP_Request::get( 'show_log' ) ) === md5( AUTH_KEY ) ) {
2754
  call_user_func_array( 'learn_press_debug', func_get_args() );
2755
  }
2756
+ }*/
2757
 
2758
  /**
2759
  * @return array
2762
  function learn_press_global_script_params() {
2763
  $js = array(
2764
  'ajax' => admin_url( 'admin-ajax.php' ),
2765
+ 'plugin_url' => LearnPress::instance()->plugin_url(),
2766
  'siteurl' => home_url(),
2767
  'current_url' => learn_press_get_current_url(),
2768
  'theme' => get_stylesheet(),
2784
  *
2785
  * @return string
2786
  * @since 3.3.0
2787
+ * @depecated 4.1.7.2
2788
  */
2789
+ /*function learn_press_get_cron_url() {
2790
  $nonce = get_option( 'learnpress_cron_url_nonce' );
2791
 
2792
  if ( ! $nonce ) {
2802
  );
2803
 
2804
  return $url;
2805
+ }*/
2806
 
2807
  /**
2808
  * Get courses expired.
2809
  *
2810
  * @return array
2811
  * @since 3.3.0
2812
+ * @depecated 4.1.7.2
2813
  */
2814
+ /*function learn_press_get_expired_courses() {
2815
  global $wpdb;
2816
 
2817
  $query = $wpdb->prepare(
2838
  'enrolled'
2839
  );
2840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2841
  }*/
2842
 
2843
  /**
2884
  * @param string $color
2885
  *
2886
  * @since 3.3.0
2887
+ * @depecated 4.1.7.2
2888
  */
2889
+ /*function learn_press_circle_progress_html( $percent = 0, $width = 32, $border = 4, $color = '' ) {
2890
  $radius = $width / 2;
2891
  $r = ( $width - $border ) / 2;
2892
  $circumference = $r * 2 * pi();
2912
  $radius,
2913
  $radius
2914
  );
2915
+ }*/
2916
 
2917
+ /**
2918
+ * @depecated 4.1.7.2
2919
+ */
2920
+ /*function learn_press_is_page( $page_name ) {
2921
  $page_id = learn_press_get_page_id( $page_name );
2922
 
2923
  return $page_id && is_page( $page_id );
2924
+ }*/
2925
 
2926
  /**
2927
  * Get end-date from start date with a duration.
2931
  *
2932
  * @return false|string
2933
  * @since 3.x.x
2934
+ * @depecated 4.1.7.2
2935
  */
2936
+ /*function learn_press_date_end_from( $duration, $start = '' ) {
2937
  $format = 'Y-m-d H:i:s';
2938
 
2939
  if ( ! $start ) {
2951
  }
2952
 
2953
  return date( $format, $start + $duration );
2954
+ }*/
 
 
 
 
2955
 
2956
  function learn_press_cookie_get( $name, $namespace = 'LP' ) {
2957
  if ( $namespace ) {
2963
  return $cookie[ $name ] ?? null;
2964
  }
2965
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2966
  /**
2967
  * Get default methods to evaluate course results.
2968
  *
3040
  );
3041
  }
3042
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3043
  /**
3044
  * Convert time from GMT to local.
3045
  *
3048
  *
3049
  * @return false|int|string
3050
  * @since 4.0.0
3051
+ * @depecated 4.1.7.2
3052
  */
3053
+ /*function learn_press_time_from_gmt( $gmt_time, $format = 'Y-m-d H:i:s' ) {
3054
  if ( is_string( $gmt_time ) ) {
3055
  $gmt_time = strtotime( $gmt_time );
3056
  } elseif ( $gmt_time instanceof LP_Datetime ) {
3064
  }
3065
 
3066
  return $current_time;
3067
+ }*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3068
 
3069
  /**
3070
  * Get max retrying quiz allowed.
3086
  *
3087
  * @return int
3088
  * @since 4.0.0
3089
+ * @depecated 4.1.7.2
3090
  */
3091
+ /*function learn_press_get_course_max_retrying( $course_id ) {
3092
  return apply_filters( 'learn-press/max-retry-course-allowed', 1, $course_id );
3093
+ }*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3094
 
3095
  /**
3096
  * Get slug for status of course/lesson/quiz if user
3128
  );
3129
  }
3130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3131
  /**
3132
  * @return array
3133
  * @since 4.0.0
inc/lp-deprecated.php CHANGED
@@ -473,7 +473,7 @@ if ( ! function_exists( 'learn_press_course_nav_items' ) ) {
473
  */
474
  function learn_press_load_content_item_only( $name ) {
475
  if ( learn_press_is_content_item_only() ) {
476
- if ( LP()->global['course-item'] ) {
477
  remove_action( 'get_header', 'learn_press_load_content_item_only' );
478
  learn_press_get_template( 'single-course/content-item-only.php' );
479
  die();
@@ -494,7 +494,7 @@ if ( ! function_exists( 'learn_press_course_purchase_button' ) ) {
494
  */
495
  function learn_press_course_purchase_button() {
496
  _deprecated_function( __FUNCTION__, '3.3.0' );
497
- LP()->template( 'course' )->course_purchase_button();
498
  }
499
  }
500
 
@@ -504,7 +504,7 @@ if ( ! function_exists( 'learn_press_course_enroll_button' ) ) {
504
  */
505
  function learn_press_course_enroll_button() {
506
  _deprecated_function( __FUNCTION__, '3.3.0' );
507
- LP()->template( 'course' )->course_enroll_button();
508
  }
509
  }
510
 
@@ -518,7 +518,7 @@ if ( ! function_exists( 'learn_press_course_retake_button' ) ) {
518
  */
519
  function learn_press_course_retake_button() {
520
  _deprecated_function( __FUNCTION__, '3.3.0' );
521
- LP()->template( 'course' )->func( 'button_retry' );
522
  }
523
  }
524
 
@@ -529,7 +529,7 @@ if ( ! function_exists( 'learn_press_course_continue_button' ) ) {
529
  */
530
  function learn_press_course_continue_button() {
531
  _deprecated_function( __FUNCTION__, '4.0.0' );
532
- LP()->template( 'course' )->func( 'course_continue_button' );
533
  }
534
  }
535
 
@@ -547,7 +547,7 @@ if ( ! function_exists( 'learn_press_course_finish_button' ) ) {
547
  'warning'
548
  );
549
 
550
- LP()->template( 'course' )->func( 'course_finish_button' );
551
  }
552
  }
553
 
@@ -557,7 +557,7 @@ if ( ! function_exists( 'learn_press_course_external_button' ) ) {
557
  * Retake course button
558
  */
559
  function learn_press_course_external_button() {
560
- LP()->template( 'course' )->func( 'course_external_button' );
561
  }
562
  }
563
 
@@ -599,7 +599,7 @@ if ( ! function_exists( 'learn_press_checkout_form_login' ) ) {
599
  */
600
  function learn_press_checkout_form_login() {
601
 
602
- if ( ! LP()->checkout()->is_enable_login() ) {
603
  return;
604
  }
605
 
@@ -616,7 +616,7 @@ if ( ! function_exists( 'learn_press_checkout_form_register' ) ) {
616
  */
617
  function learn_press_checkout_form_register() {
618
 
619
- if ( ! LP()->checkout()->is_enable_register() ) {
620
  return;
621
  }
622
 
@@ -655,7 +655,7 @@ if ( ! function_exists( 'learn_press_order_guest_email' ) ) {
655
  * @hooked learn-press/checkout-order-review
656
  */
657
  function learn_press_order_guest_email() {
658
- $checkout = LP()->checkout();
659
  if ( $checkout->is_enable_guest_checkout() && ! is_user_logged_in() ) {
660
  learn_press_get_template( 'checkout/guest-email.php' );
661
  }
473
  */
474
  function learn_press_load_content_item_only( $name ) {
475
  if ( learn_press_is_content_item_only() ) {
476
+ if ( LearnPress::instance()->global['course-item'] ) {
477
  remove_action( 'get_header', 'learn_press_load_content_item_only' );
478
  learn_press_get_template( 'single-course/content-item-only.php' );
479
  die();
494
  */
495
  function learn_press_course_purchase_button() {
496
  _deprecated_function( __FUNCTION__, '3.3.0' );
497
+ LearnPress::instance()->template( 'course' )->course_purchase_button();
498
  }
499
  }
500
 
504
  */
505
  function learn_press_course_enroll_button() {
506
  _deprecated_function( __FUNCTION__, '3.3.0' );
507
+ LearnPress::instance()->template( 'course' )->course_enroll_button();
508
  }
509
  }
510
 
518
  */
519
  function learn_press_course_retake_button() {
520
  _deprecated_function( __FUNCTION__, '3.3.0' );
521
+ LearnPress::instance()->template( 'course' )->func( 'button_retry' );
522
  }
523
  }
524
 
529
  */
530
  function learn_press_course_continue_button() {
531
  _deprecated_function( __FUNCTION__, '4.0.0' );
532
+ LearnPress::instance()->template( 'course' )->func( 'course_continue_button' );
533
  }
534
  }
535
 
547
  'warning'
548
  );
549
 
550
+ LearnPress::instance()->template( 'course' )->func( 'course_finish_button' );
551
  }
552
  }
553
 
557
  * Retake course button
558
  */
559
  function learn_press_course_external_button() {
560
+ LearnPress::instance()->template( 'course' )->func( 'course_external_button' );
561
  }
562
  }
563
 
599
  */
600
  function learn_press_checkout_form_login() {
601
 
602
+ if ( ! LearnPress::instance()->checkout()->is_enable_login() ) {
603
  return;
604
  }
605
 
616
  */
617
  function learn_press_checkout_form_register() {
618
 
619
+ if ( ! LearnPress::instance()->checkout()->is_enable_register() ) {
620
  return;
621
  }
622
 
655
  * @hooked learn-press/checkout-order-review
656
  */
657
  function learn_press_order_guest_email() {
658
+ $checkout = LearnPress::instance()->checkout();
659
  if ( $checkout->is_enable_guest_checkout() && ! is_user_logged_in() ) {
660
  learn_press_get_template( 'checkout/guest-email.php' );
661
  }
inc/lp-template-functions.php CHANGED
@@ -17,23 +17,23 @@ if ( ! defined( 'ABSPATH' ) ) {
17
  */
18
  if ( ! function_exists( 'learn_press_add_course_buttons' ) ) {
19
  function learn_press_add_course_buttons() {
20
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_enroll_button' ), 5 );
21
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_purchase_button' ), 10 );
22
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_external_button' ), 15 );
23
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'button_retry' ), 20 );
24
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_continue_button' ), 25 );
25
- add_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_finish_button' ), 30 );
26
  }
27
  }
28
 
29
  if ( ! function_exists( 'learn_press_remove_course_buttons' ) ) {
30
  function learn_press_remove_course_buttons() {
31
- remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_enroll_button' ), 5 );
32
- remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_purchase_button' ), 10 );
33
- //remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_external_button' ), 15 );
34
- remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'button_retry' ), 20 );
35
- remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_continue_button' ), 25 );
36
- remove_action( 'learn-press/course-buttons', LP()->template( 'course' )->func( 'course_finish_button' ), 30 );
37
  }
38
  }
39
 
@@ -59,27 +59,27 @@ if ( ! function_exists( 'learn_press_get_course_tabs' ) ) {
59
  $defaults['overview'] = array(
60
  'title' => esc_html__( 'Overview', 'learnpress' ),
61
  'priority' => 10,
62
- 'callback' => LP()->template( 'course' )->callback( 'single-course/tabs/overview.php' ),
63
  );
64
  }
65
 
66
  $defaults['curriculum'] = array(
67
  'title' => esc_html__( 'Curriculum', 'learnpress' ),
68
  'priority' => 30,
69
- 'callback' => LP()->template( 'course' )->func( 'course_curriculum' ),
70
  );
71
 
72
  $defaults['instructor'] = array(
73
  'title' => esc_html__( 'Instructor', 'learnpress' ),
74
  'priority' => 40,
75
- 'callback' => LP()->template( 'course' )->callback( 'single-course/tabs/instructor.php' ),
76
  );
77
 
78
  if ( $course->get_faqs() ) {
79
  $defaults['faqs'] = array(
80
  'title' => esc_html__( 'FAQs', 'learnpress' ),
81
  'priority' => 50,
82
- 'callback' => LP()->template( 'course' )->func( 'faqs' ),
83
  );
84
  }
85
 
@@ -266,8 +266,8 @@ if ( ! function_exists( 'learn_press_single_quiz_args' ) ) {
266
 
267
  $args = array(
268
  'id' => $quiz->get_id(),
269
- 'totalTime' => $quiz->get_duration()->get(),
270
- 'remainingTime' => $remaining_time ? $remaining_time->get() : $quiz->get_duration()->get(),
271
  'status' => $user->get_item_status( $quiz->get_id(), $course_id ),
272
  'checkNorequizenroll' => $course->is_no_required_enroll(),
273
  'navigationPosition' => LP_Settings::get_option( 'navigation_position', 'yes' ),
@@ -411,11 +411,6 @@ if ( ! function_exists( 'learn_press_course_lesson_class' ) ) {
411
  $classes[] = 'preview-item';
412
  }
413
 
414
- /*
415
- if ( $user->can_view_item( $lesson_id, $course_id )->flag ) {
416
- $classes[] = 'viewable';
417
- }*/
418
-
419
  $classes = array_unique( array_merge( $classes, $class ) );
420
 
421
  if ( $echo ) {
@@ -1272,30 +1267,27 @@ add_filter( 'body_class', 'learn_press_body_classes', 10 );
1272
  *
1273
  * @param int $course_id
1274
  *
1275
- * @return bool|mixed
1276
  * @since 3.0
 
1277
  */
1278
- function learn_press_is_learning_course( $course_id = 0 ) {
 
1279
  $user = learn_press_get_current_user();
1280
  $course = learn_press_get_course( $course_id );
1281
- $is_learning = false;
1282
- $has_status = false;
 
1283
 
1284
- if ( $user && $course ) {
1285
- $has_status = $user->has_course_status(
1286
- $course->get_id(),
1287
- array(
1288
- 'enrolled',
1289
- 'finished',
1290
- )
1291
- );
1292
  }
1293
 
1294
- if ( $course && ( ! $course->is_required_enroll() || $has_status ) ) {
1295
  $is_learning = true;
1296
  }
1297
 
1298
- return apply_filters( 'learn-press/is-learning-course', $is_learning );
1299
  }
1300
 
1301
  /**
17
  */
18
  if ( ! function_exists( 'learn_press_add_course_buttons' ) ) {
19
  function learn_press_add_course_buttons() {
20
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_enroll_button' ), 5 );
21
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_purchase_button' ), 10 );
22
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_external_button' ), 15 );
23
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'button_retry' ), 20 );
24
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_continue_button' ), 25 );
25
+ add_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_finish_button' ), 30 );
26
  }
27
  }
28
 
29
  if ( ! function_exists( 'learn_press_remove_course_buttons' ) ) {
30
  function learn_press_remove_course_buttons() {
31
+ remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_enroll_button' ), 5 );
32
+ remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_purchase_button' ), 10 );
33
+ //remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_external_button' ), 15 );
34
+ remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'button_retry' ), 20 );
35
+ remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_continue_button' ), 25 );
36
+ remove_action( 'learn-press/course-buttons', LearnPress::instance()->template( 'course' )->func( 'course_finish_button' ), 30 );
37
  }
38
  }
39
 
59
  $defaults['overview'] = array(
60
  'title' => esc_html__( 'Overview', 'learnpress' ),
61
  'priority' => 10,
62
+ 'callback' => LearnPress::instance()->template( 'course' )->callback( 'single-course/tabs/overview.php' ),
63
  );
64
  }
65
 
66
  $defaults['curriculum'] = array(
67
  'title' => esc_html__( 'Curriculum', 'learnpress' ),
68
  'priority' => 30,
69
+ 'callback' => LearnPress::instance()->template( 'course' )->func( 'course_curriculum' ),
70
  );
71
 
72
  $defaults['instructor'] = array(
73
  'title' => esc_html__( 'Instructor', 'learnpress' ),
74
  'priority' => 40,
75
+ 'callback' => LearnPress::instance()->template( 'course' )->callback( 'single-course/tabs/instructor.php' ),
76
  );
77
 
78
  if ( $course->get_faqs() ) {
79
  $defaults['faqs'] = array(
80
  'title' => esc_html__( 'FAQs', 'learnpress' ),
81
  'priority' => 50,
82
+ 'callback' => LearnPress::instance()->template( 'course' )->func( 'faqs' ),
83
  );
84
  }
85
 
266
 
267
  $args = array(
268
  'id' => $quiz->get_id(),
269
+ //'totalTime' => -1,
270
+ //'remainingTime' => $remaining_time ? $remaining_time->get() : $quiz->get_duration()->get(),
271
  'status' => $user->get_item_status( $quiz->get_id(), $course_id ),
272
  'checkNorequizenroll' => $course->is_no_required_enroll(),
273
  'navigationPosition' => LP_Settings::get_option( 'navigation_position', 'yes' ),
411
  $classes[] = 'preview-item';
412
  }
413
 
 
 
 
 
 
414
  $classes = array_unique( array_merge( $classes, $class ) );
415
 
416
  if ( $echo ) {
1267
  *
1268
  * @param int $course_id
1269
  *
1270
+ * @return bool
1271
  * @since 3.0
1272
+ * @version 1.0.1
1273
  */
1274
+ function learn_press_is_learning_course( int $course_id = 0 ): bool {
1275
+ $is_learning = false;
1276
  $user = learn_press_get_current_user();
1277
  $course = learn_press_get_course( $course_id );
1278
+ if ( ! $course ) {
1279
+ return $is_learning;
1280
+ }
1281
 
1282
+ if ( $user ) {
1283
+ return $user->has_enrolled_or_finished( $course_id );
 
 
 
 
 
 
1284
  }
1285
 
1286
+ if ( $course->is_no_required_enroll() ) {
1287
  $is_learning = true;
1288
  }
1289
 
1290
+ return apply_filters( 'lp/is-learning-course', $is_learning, $course_id );
1291
  }
1292
 
1293
  /**
inc/lp-template-hooks.php CHANGED
@@ -12,9 +12,9 @@
12
  /**
13
  * Core template classes: LP_Template_General, LP_Template_Profile, LP_Template_Course.
14
  *
15
- * + Get instance of a template: LP()->template( TYPE ) e.g: LP()->template( 'course' )
16
- * + LP()->template( TYPE )->func(CALLBACK) => hook to an action with function CALLBACK of TYPE class
17
- * + LP()->template( TYPE )->callback( TEMPLATE ) => hook to an action to c
18
  */
19
 
20
 
@@ -30,8 +30,8 @@ defined( 'ABSPATH' ) || exit();
30
  * @see LP_Template_General::template_header()
31
  * @see LP_Template_General::template_footer()
32
  */
33
- add_action( 'learn-press/template-header', LP()->template( 'general' )->func( 'template_header' ) );
34
- add_action( 'learn-press/template-footer', LP()->template( 'general' )->func( 'template_footer' ) );
35
 
36
  /**
37
  * Course breadcrumb
@@ -40,14 +40,14 @@ add_action( 'learn-press/template-footer', LP()->template( 'general' )->func( 't
40
  */
41
  add_action(
42
  'learn-press/before-main-content',
43
- LP()->template( 'general' )->text( '<div class="lp-archive-courses">', 'lp-archive-courses-open' ),
44
  - 100
45
  );
46
- add_action( 'learn-press/before-main-content', LP()->template( 'general' )->func( 'breadcrumb' ) );
47
 
48
  add_action(
49
  'learn-press/after-main-content',
50
- LP()->template( 'general' )->text( '</div>', 'lp-archive-courses-close' ),
51
  100
52
  );
53
 
@@ -66,33 +66,33 @@ learn_press_add_course_buttons();
66
 
67
 
68
  /** BEGIN: Archive course */
69
- add_action( 'learn-press/before-courses-loop', LP()->template( 'course' )->func( 'courses_top_bar' ), 10 );
70
 
71
  /** BEGIN: Archive course loop item */
72
  add_action(
73
  'learn-press/before-courses-loop-item',
74
- LP()->template( 'course' )->text( '<div class="course-wrap-thumbnail">', 'course-wrap-thumbnail-open' ),
75
  1
76
  );
77
  add_action(
78
  'learn-press/before-courses-loop-item',
79
- LP()->template( 'course' )->callback( 'loop/course/badge-featured' ),
80
  5
81
  );
82
  add_action(
83
  'learn-press/before-courses-loop-item',
84
- LP()->template( 'course' )->callback( 'loop/course/thumbnail.php' ),
85
  10
86
  );
87
  add_action(
88
  'learn-press/before-courses-loop-item',
89
- LP()->template( 'course' )->text( '</div>', 'course-wrap-thumbnail-close' ),
90
  1000
91
  );
92
 
93
  add_action(
94
  'learn-press/before-courses-loop-item',
95
- LP()->template( 'course' )->text(
96
  '<!-- START .course-content --> <div class="course-content">',
97
  'course-content-open'
98
  ),
@@ -100,17 +100,17 @@ add_action(
100
  );
101
  add_action(
102
  'learn-press/before-courses-loop-item',
103
- LP()->template( 'course' )->callback( 'loop/course/categories' ),
104
  1010
105
  );
106
  add_action(
107
  'learn-press/before-courses-loop-item',
108
- LP()->template( 'course' )->callback( 'loop/course/instructor' ),
109
  1010
110
  );
111
  add_action(
112
  'learn-press/courses-loop-item-title',
113
- LP()->template( 'course' )->callback( 'loop/course/title.php' ),
114
  20
115
  );
116
 
@@ -124,7 +124,7 @@ add_action(
124
 
125
  add_action(
126
  'learn-press/after-courses-loop-item',
127
- LP()->template( 'course' )->text(
128
  '<!-- START .course-content-meta --> <div class="course-wrap-meta">',
129
  'course-wrap-meta-open'
130
  ),
@@ -132,57 +132,57 @@ add_action(
132
  );
133
  add_action(
134
  'learn-press/after-courses-loop-item',
135
- LP()->template( 'course' )->callback( 'single-course/meta/duration' ),
136
  20
137
  );
138
  add_action(
139
  'learn-press/after-courses-loop-item',
140
- LP()->template( 'course' )->callback( 'single-course/meta/level' ),
141
  20
142
  );
143
  /**
144
  * @see LP_Template_Course::count_object()
145
  */
146
- add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'count_object' ), 20 );
147
  add_action(
148
  'learn-press/after-courses-loop-item',
149
- LP()->template( 'course' )->text( '</div> <!-- END .course-content-meta -->', 'course-wrap-meta-close' ),
150
  20
151
  );
152
 
153
- add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'courses_loop_item_meta' ), 25 );
154
  add_action(
155
  'learn-press/after-courses-loop-item',
156
- LP()->template( 'course' )->func( 'courses_loop_item_info_begin' ),
157
  20
158
  );
159
- add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'clearfix' ), 30 );
160
 
161
  add_action(
162
  'learn-press/after-courses-loop-item',
163
- LP()->template( 'course' )->text(
164
  '<!-- START .course-content-footer --> <div class="course-footer">',
165
  'course-footer-open'
166
  ),
167
  40
168
  );
169
- add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'courses_loop_item_price' ), 50 );
170
  add_action(
171
  'learn-press/after-courses-loop-item',
172
- LP()->template( 'course' )->text( '</div> <!-- END .course-content-footer -->', 'course-footer-close' ),
173
  50
174
  );
175
- add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'course_readmore' ), 55 );
176
 
177
  add_action(
178
  'learn-press/after-courses-loop-item',
179
- LP()->template( 'course' )->func( 'courses_loop_item_info_end' ),
180
  60
181
  );
182
 
183
  add_action(
184
  'learn-press/after-courses-loop-item',
185
- LP()->template( 'course' )->text( '</div> <!-- END .course-content -->', 'course-content-close' ),
186
  1000
187
  );
188
 
@@ -191,7 +191,7 @@ add_action(
191
  /** Archive course pagination */
192
  add_action(
193
  'learn-press/after-courses-loop',
194
- LP()->template( 'course' )->callback( 'loop/course/pagination.php' ),
195
  10
196
  );
197
  /** END: Archive course */
@@ -200,12 +200,12 @@ add_action(
200
 
201
 
202
  // Sidebar and content
203
- add_action( 'learn-press/single-course-summary', LP()->template( 'course' )->callback( 'single-course/content' ), 10 );
204
 
205
  // Content
206
  add_action(
207
  'learn-press/course-content-summary',
208
- LP()->template( 'course' )->text(
209
  '<div class="course-detail-info"> <div class="lp-content-area"> <div class="course-info-left">',
210
  'course-info-left-open'
211
  ),
@@ -213,89 +213,89 @@ add_action(
213
  );
214
  add_action(
215
  'learn-press/course-content-summary',
216
- LP()->template( 'course' )->callback( 'single-course/meta-primary' ),
217
  10
218
  );
219
- add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->callback( 'single-course/title' ), 10 );
220
  add_action(
221
  'learn-press/course-content-summary',
222
- LP()->template( 'course' )->callback( 'single-course/meta-secondary' ),
223
  10
224
  );
225
  add_action(
226
  'learn-press/course-content-summary',
227
- LP()->template( 'course' )->text( ' </div> </div> </div>', 'course-info-left-close' ),
228
  15
229
  );
230
 
231
  add_action(
232
  'learn-press/course-content-summary',
233
- LP()->template( 'course' )->text( '<div class="lp-entry-content lp-content-area">', 'lp-entry-content-open' ),
234
  30
235
  );
236
  add_action(
237
  'learn-press/course-content-summary',
238
- LP()->template( 'course' )->text( '<div class="entry-content-left">', 'entry-content-left-open' ),
239
  35
240
  );
241
  add_action(
242
  'learn-press/course-content-summary',
243
- LP()->template( 'course' )->func( 'course_extra_boxes_position_control' ),
244
  39
245
  );
246
- add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->func( 'course_extra_boxes' ), 40 );
247
- // add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->callback( 'single-course/progress' ), 40 );
248
- // add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->func( 'remaining_time' ), 50 );
249
  add_action(
250
  'learn-press/course-content-summary',
251
- LP()->template( 'course' )->callback( 'single-course/tabs/tabs' ),
252
  60
253
  );
254
  // appear at bottom after enrolled
255
- add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->func( 'course_extra_boxes' ), 70 );
256
 
257
- add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->func( 'course_comment_template' ), 75 );
258
 
259
  add_action(
260
  'learn-press/course-content-summary',
261
- LP()->template( 'course' )->text( '<!-- end entry content left --> </div>', 'entry-content-left-close' ),
262
  80
263
  );
264
 
265
- add_action( 'learn-press/course-content-summary', LP()->template( 'course' )->callback( 'single-course/sidebar' ), 85 );
266
 
267
  add_action(
268
  'learn-press/course-content-summary',
269
- LP()->template( 'course' )->text( ' </div>', 'lp-entry-content-close' ),
270
  100
271
  );
272
 
273
  // Meta
274
  add_action(
275
  'learn-press/course-meta-primary-left',
276
- LP()->template( 'course' )->callback( 'single-course/meta/instructor' ),
277
  10
278
  );
279
  add_action(
280
  'learn-press/course-meta-primary-left',
281
- LP()->template( 'course' )->callback( 'single-course/meta/category' ),
282
  20
283
  );
284
 
285
  add_action(
286
  'learn-press/course-meta-secondary-left',
287
- LP()->template( 'course' )->callback( 'single-course/meta/duration' ),
288
  10
289
  );
290
  add_action(
291
  'learn-press/course-meta-secondary-left',
292
- LP()->template( 'course' )->callback( 'single-course/meta/level' ),
293
  20
294
  );
295
  /**
296
  * @see LP_Template_Course::count_object()
297
  */
298
- add_action( 'learn-press/course-meta-secondary-left', LP()->template( 'course' )->func( 'count_object' ), 20 );
299
 
300
 
301
  // Sidebar content
@@ -304,28 +304,28 @@ add_action( 'learn-press/course-meta-secondary-left', LP()->template( 'course' )
304
  * @see LP_Template_Course::course_extra_key_features()
305
  * @see LP_Template_Course::course_extra_requirements()
306
  */
307
- add_action( 'learn-press/course-summary-sidebar', LP()->template( 'course' )->func( 'course_sidebar_preview' ), 10 );
308
- add_action( 'learn-press/course-summary-sidebar', LP()->template( 'course' )->func( 'course_featured_review' ), 20 );
309
- // add_action( 'learn-press/course-summary-sidebar', LP()->template( 'course' )->func( 'course_extra_key_features' ), 20 );
310
- // add_action( 'learn-press/course-summary-sidebar', LP()->template( 'course' )->func( 'course_extra_requirements' ), 30 );
311
 
312
  /** END: Main content of single course */
313
 
314
  /** BEGIN: Course section */
315
  add_action(
316
  'learn-press/section-summary',
317
- LP()->template( 'course' )->callback( 'single-course/section/title.php', array( 'section' ) ),
318
  10
319
  );
320
  add_action(
321
  'learn-press/section-summary',
322
- LP()->template( 'course' )->callback( 'single-course/section/content.php', array( 'section' ) ),
323
  20
324
  );
325
 
326
  add_action(
327
  'learn-press/after-section-loop-item-title',
328
- LP()->template( 'course' )->callback(
329
  'single-course/section/item-meta.php',
330
  array(
331
  'item',
@@ -345,17 +345,17 @@ add_action(
345
  */
346
  add_action(
347
  'learn-press/course-section-item/before-lp_quiz-meta',
348
- LP()->template( 'course' )->func( 'quiz_meta_questions' ),
349
  10
350
  );
351
  add_action(
352
  'learn-press/course-section-item/before-lp_quiz-meta',
353
- LP()->template( 'course' )->func( 'item_meta_duration' ),
354
  20
355
  );
356
  add_action(
357
  'learn-press/course-section-item/before-lp_quiz-meta',
358
- LP()->template( 'course' )->func( 'quiz_meta_final' ),
359
  30
360
  );
361
  /** END: Quiz item */
@@ -363,7 +363,7 @@ add_action(
363
  /** BEGIN: Lesson item */
364
  add_action(
365
  'learn-press/course-section-item/before-lp_lesson-meta',
366
- LP()->template( 'course' )->func( 'item_meta_duration' ),
367
  10
368
  );
369
  /** END: Lesson item */
@@ -376,7 +376,7 @@ add_action(
376
  */
377
  add_action(
378
  'learn-press/single-button-toggle-sidebar',
379
- LP()->template( 'course' )->text( '<input type="checkbox" id="sidebar-toggle" />', 'single-button-toggle-sidebar' ),
380
  5
381
  );
382
 
@@ -386,22 +386,22 @@ add_action(
386
  * @see LP_Template_Course::popup_content()
387
  * @see LP_Template_Course::popup_footer()
388
  */
389
- add_action( 'learn-press/single-item-summary', LP()->template( 'course' )->func( 'popup_header' ), 10 );
390
- add_action( 'learn-press/single-item-summary', LP()->template( 'course' )->func( 'popup_sidebar' ), 20 );
391
- add_action( 'learn-press/single-item-summary', LP()->template( 'course' )->func( 'popup_content' ), 30 );
392
- add_action( 'learn-press/single-item-summary', LP()->template( 'course' )->func( 'popup_footer' ), 40 );
393
 
394
  /**
395
  * @see LP_Template_Course::popup_footer_nav()
396
  */
397
- add_action( 'learn-press/popup-footer', LP()->template( 'course' )->func( 'popup_footer_nav' ), 10 );
398
  /** END: Popup */
399
 
400
  /** BEGIN: Popup quiz */
401
  /**
402
  * @see LP_Template_Course::course_finish_button()
403
  */
404
- add_action( 'learn-press/quiz-buttons', LP()->template( 'course' )->func( 'course_finish_button' ), 10 );
405
  /** END: Popup quiz */
406
 
407
  /** BEGIN: Popup lesson */
@@ -409,30 +409,27 @@ add_action( 'learn-press/quiz-buttons', LP()->template( 'course' )->func( 'cours
409
  /**
410
  * @see LP_Template_Course::item_lesson_title()
411
  * @see LP_Template_Course::item_lesson_content()
412
- * @see LP_Template_Course::item_lesson_content_blocked()
413
  * @see LP_Template_Course::item_lesson_complete_button()
414
  * @see LP_Template_Course::course_finish_button()
415
  */
416
  add_action(
417
  'learn-press/before-content-item-summary/lp_lesson',
418
- LP()->template( 'course' )->func( 'item_lesson_title' ),
419
  10
420
  );
421
  add_action(
422
  'learn-press/content-item-summary/lp_lesson',
423
- LP()->template( 'course' )->func( 'item_lesson_content' ),
424
  10
425
  );
426
- // add_action( 'learn-press/content-item-summary/lp_lesson',
427
- // LP()->template( 'course' )->func( 'item_lesson_content_blocked' ), 15 );
428
  add_action(
429
  'learn-press/after-content-item-summary/lp_lesson',
430
- LP()->template( 'course' )->func( 'item_lesson_complete_button' ),
431
  10
432
  );
433
  add_action(
434
  'learn-press/after-content-item-summary/lp_lesson',
435
- LP()->template( 'course' )->func( 'course_finish_button' ),
436
  15
437
  );
438
  /** END: Popup lesson */
@@ -440,7 +437,7 @@ add_action(
440
  /**
441
  * @see LP_Template_Course::course_item_content()
442
  */
443
- add_action( 'learn-press/course-item-content', LP()->template( 'course' )->func( 'course_item_content' ), 5 );
444
 
445
  /** BEGIN: User profile */
446
 
@@ -449,24 +446,24 @@ add_action( 'learn-press/course-item-content', LP()->template( 'course' )->func(
449
  * @see LP_Template_Profile::tabs()
450
  * @see LP_Template_Profile::content()
451
  */
452
- //add_action( 'learn-press/before-user-profile', LP()->template( 'profile' )->func( 'header' ), 10 );
453
 
454
- add_action( 'learn-press/user-profile', LP()->template( 'profile' )->func( 'sidebar' ), 10 );
455
- add_action( 'learn-press/user-profile', LP()->template( 'profile' )->func( 'content' ), 20 );
456
 
457
- add_action( 'learn-press/user-profile-account', LP()->template( 'profile' )->text( ' <div class="lp-profile-left">', 'user-profile-account-left-open' ), 5 );
458
- add_action( 'learn-press/user-profile-account', LP()->template( 'profile' )->func( 'avatar' ), 10 );
459
- add_action( 'learn-press/user-profile-account', LP()->template( 'profile' )->func( 'socials' ), 10 );
460
- add_action( 'learn-press/user-profile-account', LP()->template( 'profile' )->text( ' </div>', 'user-profile-account-left-close' ), 15 );
461
- add_action( 'learn-press/user-profile-account', LP()->template( 'profile' )->func( 'header' ), 20 );
462
 
463
- add_action( 'learn-press/user-profile-tabs', LP()->template( 'profile' )->func( 'tabs' ), 10 );
464
 
465
 
466
- add_action( 'learn-press/profile/orders', LP()->template( 'profile' )->callback( 'profile/tabs/orders/list.php' ), 10 );
467
  add_action(
468
  'learn-press/profile/orders',
469
- LP()->template( 'profile' )->callback( 'profile/tabs/orders/recover-order.php' ),
470
  20
471
  );
472
 
@@ -475,23 +472,23 @@ add_action(
475
  * @see LP_Template_Profile::order_recover()
476
  * @see LP_Template_Profile::order_message()
477
  */
478
- add_action( 'learn-press/profile/order-details', LP()->template( 'profile' )->func( 'order_details' ), 5 );
479
- add_action( 'learn-press/profile/order-details', LP()->template( 'profile' )->func( 'order_recover' ), 10 );
480
- add_action( 'learn-press/profile/order-details', LP()->template( 'profile' )->func( 'order_message' ), 15 );
481
 
482
  /**
483
  * @see LP_Template_Profile::dashboard_logged_in()
484
  * @deprecated 4.1.6
485
  */
486
- // add_action( 'learn-press/profile/before-dashboard', LP()->template( 'profile' )->func( 'dashboard_statistic' ), 10 );
487
  add_action(
488
  'learn-press/profile/dashboard-summary',
489
- LP()->template( 'profile' )->func( 'dashboard_featured_courses' ),
490
  20
491
  );
492
  add_action(
493
  'learn-press/profile/dashboard-summary',
494
- LP()->template( 'profile' )->func( 'dashboard_latest_courses' ),
495
  30
496
  );
497
 
@@ -500,32 +497,32 @@ add_action(
500
  * @see LP_Template_Profile::login_form()
501
  * @see LP_Template_Profile::register_form()
502
  */
503
- add_action( 'learn-press/user-profile', LP()->template( 'profile' )->func( 'dashboard_not_logged_in' ), 5 );
504
- add_action( 'learn-press/user-profile', LP()->template( 'profile' )->func( 'login_form' ), 10 );
505
- add_action( 'learn-press/user-profile', LP()->template( 'profile' )->func( 'register_form' ), 15 );
506
 
507
  /** BEGIN: Checkout page */
508
  /**
509
  * @see LP_Template_Checkout::review_order()
510
  */
511
- add_action( 'learn-press/before-checkout-form', LP()->template( 'checkout' )->func( 'review_order' ), 10 );
512
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'account_logged_in' ), 20 );
513
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'account_register' ), 30 );
514
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'account_login' ), 40 );
515
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'guest_checkout' ), 50 );
516
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'order_comment' ), 60 );
517
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'payment' ), 70 );
518
- add_action( 'learn-press/after-checkout-form', LP()->template( 'checkout' )->func( 'terms' ), 80 );
519
 
520
  // ******************************************************************************************************************* //
521
 
522
  add_action( 'learn-press/content-item-summary-class', 'learn_press_content_item_summary_classes', 15 );
523
  add_action(
524
  'learn-press/before-content-item-summary/lp_quiz',
525
- LP()->template( 'course' )->callback( 'content-quiz/title.php' ),
526
  5
527
  );
528
- add_action( 'learn-press/content-item-summary/lp_quiz', LP()->template( 'course' )->callback( 'content-quiz/js' ), 25 );
529
  // add_action( 'learn-press/parse-course-item', 'learn_press_control_displaying_course_item', 5 ); // comment by tungnx
530
  //add_action( 'learn-press/after-single-course', 'learn_press_single_course_args', 5 );
531
  add_filter( 'document_title_parts', 'learn_press_single_document_title_parts', 5 );
@@ -535,14 +532,14 @@ add_filter( 'post_class', 'learn_press_course_class', 15, 3 );
535
  //add_action( 'wp_head', 'learn_press_single_course_args', 5 );
536
  add_action(
537
  'learn-press/before-checkout-order-review',
538
- LP()->template( 'course' )->callback( 'checkout/form-logged-in.php' ),
539
  10
540
  );
541
  add_filter( 'comments_template_query_args', 'learn_press_comments_template_query_args' );
542
  add_filter( 'get_comments_number', 'learn_press_filter_get_comments_number' );
543
 
544
  add_filter( 'excerpt_length', 'learn_press_custom_excerpt_length', 999 );
545
- // add_filter( 'learn_press_get_template', LP()->template( 'general' )->func( 'filter_block_content_template' ), 10, 5 );
546
 
547
  /**
548
  * Filter to hide the section if there is no item.
12
  /**
13
  * Core template classes: LP_Template_General, LP_Template_Profile, LP_Template_Course.
14
  *
15
+ * + Get instance of a template: LearnPress::instance()->template( TYPE ) e.g: LearnPress::instance()->template( 'course' )
16
+ * + LearnPress::instance()->template( TYPE )->func(CALLBACK) => hook to an action with function CALLBACK of TYPE class
17
+ * + LearnPress::instance()->template( TYPE )->callback( TEMPLATE ) => hook to an action to c
18
  */
19
 
20
 
30
  * @see LP_Template_General::template_header()
31
  * @see LP_Template_General::template_footer()
32
  */
33
+ add_action( 'learn-press/template-header', LearnPress::instance()->template( 'general' )->func( 'template_header' ) );
34
+ add_action( 'learn-press/template-footer', LearnPress::instance()->template( 'general' )->func( 'template_footer' ) );
35
 
36
  /**
37
  * Course breadcrumb
40
  */
41
  add_action(
42
  'learn-press/before-main-content',
43
+ LearnPress::instance()->template( 'general' )->text( '<div class="lp-archive-courses">', 'lp-archive-courses-open' ),
44
  - 100
45
  );
46
+ add_action( 'learn-press/before-main-content', LearnPress::instance()->template( 'general' )->func( 'breadcrumb' ) );
47
 
48
  add_action(
49
  'learn-press/after-main-content',
50
+ LearnPress::instance()->template( 'general' )->text( '</div>', 'lp-archive-courses-close' ),
51
  100
52
  );
53
 
66
 
67
 
68
  /** BEGIN: Archive course */
69
+ add_action( 'learn-press/before-courses-loop', LearnPress::instance()->template( 'course' )->func( 'courses_top_bar' ), 10 );
70
 
71
  /** BEGIN: Archive course loop item */
72
  add_action(
73
  'learn-press/before-courses-loop-item',
74
+ LearnPress::instance()->template( 'course' )->text( '<div class="course-wrap-thumbnail">', 'course-wrap-thumbnail-open' ),
75
  1
76
  );
77
  add_action(
78
  'learn-press/before-courses-loop-item',
79
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/badge-featured' ),
80
  5
81
  );
82
  add_action(
83
  'learn-press/before-courses-loop-item',
84
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/thumbnail.php' ),
85
  10
86
  );
87
  add_action(
88
  'learn-press/before-courses-loop-item',
89
+ LearnPress::instance()->template( 'course' )->text( '</div>', 'course-wrap-thumbnail-close' ),
90
  1000
91
  );
92
 
93
  add_action(
94
  'learn-press/before-courses-loop-item',
95
+ LearnPress::instance()->template( 'course' )->text(
96
  '<!-- START .course-content --> <div class="course-content">',
97
  'course-content-open'
98
  ),
100
  );
101
  add_action(
102
  'learn-press/before-courses-loop-item',
103
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/categories' ),
104
  1010
105
  );
106
  add_action(
107
  'learn-press/before-courses-loop-item',
108
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/instructor' ),
109
  1010
110
  );
111
  add_action(
112
  'learn-press/courses-loop-item-title',
113
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/title.php' ),
114
  20
115
  );
116
 
124
 
125
  add_action(
126
  'learn-press/after-courses-loop-item',
127
+ LearnPress::instance()->template( 'course' )->text(
128
  '<!-- START .course-content-meta --> <div class="course-wrap-meta">',
129
  'course-wrap-meta-open'
130
  ),
132
  );
133
  add_action(
134
  'learn-press/after-courses-loop-item',
135
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/duration' ),
136
  20
137
  );
138
  add_action(
139
  'learn-press/after-courses-loop-item',
140
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/level' ),
141
  20
142
  );
143
  /**
144
  * @see LP_Template_Course::count_object()
145
  */
146
+ add_action( 'learn-press/after-courses-loop-item', LearnPress::instance()->template( 'course' )->func( 'count_object' ), 20 );
147
  add_action(
148
  'learn-press/after-courses-loop-item',
149
+ LearnPress::instance()->template( 'course' )->text( '</div> <!-- END .course-content-meta -->', 'course-wrap-meta-close' ),
150
  20
151
  );
152
 
153
+ add_action( 'learn-press/after-courses-loop-item', LearnPress::instance()->template( 'course' )->func( 'courses_loop_item_meta' ), 25 );
154
  add_action(
155
  'learn-press/after-courses-loop-item',
156
+ LearnPress::instance()->template( 'course' )->func( 'courses_loop_item_info_begin' ),
157
  20
158
  );
159
+ add_action( 'learn-press/after-courses-loop-item', LearnPress::instance()->template( 'course' )->func( 'clearfix' ), 30 );
160
 
161
  add_action(
162
  'learn-press/after-courses-loop-item',
163
+ LearnPress::instance()->template( 'course' )->text(
164
  '<!-- START .course-content-footer --> <div class="course-footer">',
165
  'course-footer-open'
166
  ),
167
  40
168
  );
169
+ add_action( 'learn-press/after-courses-loop-item', LearnPress::instance()->template( 'course' )->func( 'courses_loop_item_price' ), 50 );
170
  add_action(
171
  'learn-press/after-courses-loop-item',
172
+ LearnPress::instance()->template( 'course' )->text( '</div> <!-- END .course-content-footer -->', 'course-footer-close' ),
173
  50
174
  );
175
+ add_action( 'learn-press/after-courses-loop-item', LearnPress::instance()->template( 'course' )->func( 'course_readmore' ), 55 );
176
 
177
  add_action(
178
  'learn-press/after-courses-loop-item',
179
+ LearnPress::instance()->template( 'course' )->func( 'courses_loop_item_info_end' ),
180
  60
181
  );
182
 
183
  add_action(
184
  'learn-press/after-courses-loop-item',
185
+ LearnPress::instance()->template( 'course' )->text( '</div> <!-- END .course-content -->', 'course-content-close' ),
186
  1000
187
  );
188
 
191
  /** Archive course pagination */
192
  add_action(
193
  'learn-press/after-courses-loop',
194
+ LearnPress::instance()->template( 'course' )->callback( 'loop/course/pagination.php' ),
195
  10
196
  );
197
  /** END: Archive course */
200
 
201
 
202
  // Sidebar and content
203
+ add_action( 'learn-press/single-course-summary', LearnPress::instance()->template( 'course' )->callback( 'single-course/content' ), 10 );
204
 
205
  // Content
206
  add_action(
207
  'learn-press/course-content-summary',
208
+ LearnPress::instance()->template( 'course' )->text(
209
  '<div class="course-detail-info"> <div class="lp-content-area"> <div class="course-info-left">',
210
  'course-info-left-open'
211
  ),
213
  );
214
  add_action(
215
  'learn-press/course-content-summary',
216
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta-primary' ),
217
  10
218
  );
219
+ add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->callback( 'single-course/title' ), 10 );
220
  add_action(
221
  'learn-press/course-content-summary',
222
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta-secondary' ),
223
  10
224
  );
225
  add_action(
226
  'learn-press/course-content-summary',
227
+ LearnPress::instance()->template( 'course' )->text( ' </div> </div> </div>', 'course-info-left-close' ),
228
  15
229
  );
230
 
231
  add_action(
232
  'learn-press/course-content-summary',
233
+ LearnPress::instance()->template( 'course' )->text( '<div class="lp-entry-content lp-content-area">', 'lp-entry-content-open' ),
234
  30
235
  );
236
  add_action(
237
  'learn-press/course-content-summary',
238
+ LearnPress::instance()->template( 'course' )->text( '<div class="entry-content-left">', 'entry-content-left-open' ),
239
  35
240
  );
241
  add_action(
242
  'learn-press/course-content-summary',
243
+ LearnPress::instance()->template( 'course' )->func( 'course_extra_boxes_position_control' ),
244
  39
245
  );
246
+ add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->func( 'course_extra_boxes' ), 40 );
247
+ // add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->callback( 'single-course/progress' ), 40 );
248
+ // add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->func( 'remaining_time' ), 50 );
249
  add_action(
250
  'learn-press/course-content-summary',
251
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/tabs/tabs' ),
252
  60
253
  );
254
  // appear at bottom after enrolled
255
+ add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->func( 'course_extra_boxes' ), 70 );
256
 
257
+ add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->func( 'course_comment_template' ), 75 );
258
 
259
  add_action(
260
  'learn-press/course-content-summary',
261
+ LearnPress::instance()->template( 'course' )->text( '<!-- end entry content left --> </div>', 'entry-content-left-close' ),
262
  80
263
  );
264
 
265
+ add_action( 'learn-press/course-content-summary', LearnPress::instance()->template( 'course' )->callback( 'single-course/sidebar' ), 85 );
266
 
267
  add_action(
268
  'learn-press/course-content-summary',
269
+ LearnPress::instance()->template( 'course' )->text( ' </div>', 'lp-entry-content-close' ),
270
  100
271
  );
272
 
273
  // Meta
274
  add_action(
275
  'learn-press/course-meta-primary-left',
276
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/instructor' ),
277
  10
278
  );
279
  add_action(
280
  'learn-press/course-meta-primary-left',
281
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/category' ),
282
  20
283
  );
284
 
285
  add_action(
286
  'learn-press/course-meta-secondary-left',
287
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/duration' ),
288
  10
289
  );
290
  add_action(
291
  'learn-press/course-meta-secondary-left',
292
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/meta/level' ),
293
  20
294
  );
295
  /**
296
  * @see LP_Template_Course::count_object()
297
  */
298
+ add_action( 'learn-press/course-meta-secondary-left', LearnPress::instance()->template( 'course' )->func( 'count_object' ), 20 );
299
 
300
 
301
  // Sidebar content
304
  * @see LP_Template_Course::course_extra_key_features()
305
  * @see LP_Template_Course::course_extra_requirements()
306
  */
307
+ add_action( 'learn-press/course-summary-sidebar', LearnPress::instance()->template( 'course' )->func( 'course_sidebar_preview' ), 10 );
308
+ add_action( 'learn-press/course-summary-sidebar', LearnPress::instance()->template( 'course' )->func( 'course_featured_review' ), 20 );
309
+ // add_action( 'learn-press/course-summary-sidebar', LearnPress::instance()->template( 'course' )->func( 'course_extra_key_features' ), 20 );
310
+ // add_action( 'learn-press/course-summary-sidebar', LearnPress::instance()->template( 'course' )->func( 'course_extra_requirements' ), 30 );
311
 
312
  /** END: Main content of single course */
313
 
314
  /** BEGIN: Course section */
315
  add_action(
316
  'learn-press/section-summary',
317
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/section/title.php', array( 'section' ) ),
318
  10
319
  );
320
  add_action(
321
  'learn-press/section-summary',
322
+ LearnPress::instance()->template( 'course' )->callback( 'single-course/section/content.php', array( 'section' ) ),
323
  20
324
  );
325
 
326
  add_action(
327
  'learn-press/after-section-loop-item-title',
328
+ LearnPress::instance()->template( 'course' )->callback(
329
  'single-course/section/item-meta.php',
330
  array(
331
  'item',
345
  */
346
  add_action(
347
  'learn-press/course-section-item/before-lp_quiz-meta',
348
+ LearnPress::instance()->template( 'course' )->func( 'quiz_meta_questions' ),
349
  10
350
  );
351
  add_action(
352
  'learn-press/course-section-item/before-lp_quiz-meta',
353
+ LearnPress::instance()->template( 'course' )->func( 'item_meta_duration' ),
354
  20
355
  );
356
  add_action(
357
  'learn-press/course-section-item/before-lp_quiz-meta',
358
+ LearnPress::instance()->template( 'course' )->func( 'quiz_meta_final' ),
359
  30
360
  );
361
  /** END: Quiz item */
363
  /** BEGIN: Lesson item */
364
  add_action(
365
  'learn-press/course-section-item/before-lp_lesson-meta',
366
+ LearnPress::instance()->template( 'course' )->func( 'item_meta_duration' ),
367
  10
368
  );
369
  /** END: Lesson item */
376
  */
377
  add_action(
378
  'learn-press/single-button-toggle-sidebar',
379
+ LearnPress::instance()->template( 'course' )->text( '<input type="checkbox" id="sidebar-toggle" />', 'single-button-toggle-sidebar' ),
380
  5
381
  );
382
 
386
  * @see LP_Template_Course::popup_content()
387
  * @see LP_Template_Course::popup_footer()
388
  */
389
+ add_action( 'learn-press/single-item-summary', LearnPress::instance()->template( 'course' )->func( 'popup_header' ), 10 );
390
+ add_action( 'learn-press/single-item-summary', LearnPress::instance()->template( 'course' )->func( 'popup_sidebar' ), 20 );
391
+ add_action( 'learn-press/single-item-summary', LearnPress::instance()->template( 'course' )->func( 'popup_content' ), 30 );
392
+ add_action( 'learn-press/single-item-summary', LearnPress::instance()->template( 'course' )->func( 'popup_footer' ), 40 );
393
 
394
  /**
395
  * @see LP_Template_Course::popup_footer_nav()
396
  */
397
+ add_action( 'learn-press/popup-footer', LearnPress::instance()->template( 'course' )->func( 'popup_footer_nav' ), 10 );
398
  /** END: Popup */
399
 
400
  /** BEGIN: Popup quiz */
401
  /**
402
  * @see LP_Template_Course::course_finish_button()
403
  */
404
+ add_action( 'learn-press/quiz-buttons', LearnPress::instance()->template( 'course' )->func( 'course_finish_button' ), 10 );
405
  /** END: Popup quiz */
406
 
407
  /** BEGIN: Popup lesson */
409
  /**
410
  * @see LP_Template_Course::item_lesson_title()
411
  * @see LP_Template_Course::item_lesson_content()
 
412
  * @see LP_Template_Course::item_lesson_complete_button()
413
  * @see LP_Template_Course::course_finish_button()
414
  */
415
  add_action(
416
  'learn-press/before-content-item-summary/lp_lesson',
417
+ LearnPress::instance()->template( 'course' )->func( 'item_lesson_title' ),
418
  10
419
  );
420
  add_action(
421
  'learn-press/content-item-summary/lp_lesson',
422
+ LearnPress::instance()->template( 'course' )->func( 'item_lesson_content' ),
423
  10
424
  );
 
 
425
  add_action(
426
  'learn-press/after-content-item-summary/lp_lesson',
427
+ LearnPress::instance()->template( 'course' )->func( 'item_lesson_complete_button' ),
428
  10
429
  );
430
  add_action(
431
  'learn-press/after-content-item-summary/lp_lesson',
432
+ LearnPress::instance()->template( 'course' )->func( 'course_finish_button' ),
433
  15
434
  );
435
  /** END: Popup lesson */
437
  /**
438
  * @see LP_Template_Course::course_item_content()
439
  */
440
+ add_action( 'learn-press/course-item-content', LearnPress::instance()->template( 'course' )->func( 'course_item_content' ), 5 );
441
 
442
  /** BEGIN: User profile */
443
 
446
  * @see LP_Template_Profile::tabs()
447
  * @see LP_Template_Profile::content()
448
  */
449
+ //add_action( 'learn-press/before-user-profile', LearnPress::instance()->template( 'profile' )->func( 'header' ), 10 );
450
 
451
+ add_action( 'learn-press/user-profile', LearnPress::instance()->template( 'profile' )->func( 'sidebar' ), 10 );
452
+ add_action( 'learn-press/user-profile', LearnPress::instance()->template( 'profile' )->func( 'content' ), 20 );
453
 
454
+ add_action( 'learn-press/user-profile-account', LearnPress::instance()->template( 'profile' )->text( ' <div class="lp-profile-left">', 'user-profile-account-left-open' ), 5 );
455
+ add_action( 'learn-press/user-profile-account', LearnPress::instance()->template( 'profile' )->func( 'avatar' ), 10 );
456
+ add_action( 'learn-press/user-profile-account', LearnPress::instance()->template( 'profile' )->func( 'socials' ), 10 );
457
+ add_action( 'learn-press/user-profile-account', LearnPress::instance()->template( 'profile' )->text( ' </div>', 'user-profile-account-left-close' ), 15 );
458
+ add_action( 'learn-press/user-profile-account', LearnPress::instance()->template( 'profile' )->func( 'header' ), 20 );
459
 
460
+ add_action( 'learn-press/user-profile-tabs', LearnPress::instance()->template( 'profile' )->func( 'tabs' ), 10 );
461
 
462
 
463
+ add_action( 'learn-press/profile/orders', LearnPress::instance()->template( 'profile' )->callback( 'profile/tabs/orders/list.php' ), 10 );
464
  add_action(
465
  'learn-press/profile/orders',
466
+ LearnPress::instance()->template( 'profile' )->callback( 'profile/tabs/orders/recover-order.php' ),
467
  20
468
  );
469
 
472
  * @see LP_Template_Profile::order_recover()
473
  * @see LP_Template_Profile::order_message()
474
  */
475
+ add_action( 'learn-press/profile/order-details', LearnPress::instance()->template( 'profile' )->func( 'order_details' ), 5 );
476
+ add_action( 'learn-press/profile/order-details', LearnPress::instance()->template( 'profile' )->func( 'order_recover' ), 10 );
477
+ add_action( 'learn-press/profile/order-details', LearnPress::instance()->template( 'profile' )->func( 'order_message' ), 15 );
478
 
479
  /**
480
  * @see LP_Template_Profile::dashboard_logged_in()
481
  * @deprecated 4.1.6
482
  */
483
+ // add_action( 'learn-press/profile/before-dashboard', LearnPress::instance()->template( 'profile' )->func( 'dashboard_statistic' ), 10 );
484
  add_action(
485
  'learn-press/profile/dashboard-summary',
486
+ LearnPress::instance()->template( 'profile' )->func( 'dashboard_featured_courses' ),
487
  20
488
  );
489
  add_action(
490
  'learn-press/profile/dashboard-summary',
491
+ LearnPress::instance()->template( 'profile' )->func( 'dashboard_latest_courses' ),
492
  30
493
  );
494
 
497
  * @see LP_Template_Profile::login_form()
498
  * @see LP_Template_Profile::register_form()
499
  */
500
+ add_action( 'learn-press/user-profile', LearnPress::instance()->template( 'profile' )->func( 'dashboard_not_logged_in' ), 5 );
501
+ add_action( 'learn-press/user-profile', LearnPress::instance()->template( 'profile' )->func( 'login_form' ), 10 );
502
+ add_action( 'learn-press/user-profile', LearnPress::instance()->template( 'profile' )->func( 'register_form' ), 15 );
503
 
504
  /** BEGIN: Checkout page */
505
  /**
506
  * @see LP_Template_Checkout::review_order()
507
  */
508
+ add_action( 'learn-press/before-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'review_order' ), 10 );
509
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'account_logged_in' ), 20 );
510
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'account_register' ), 30 );
511
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'account_login' ), 40 );
512
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'guest_checkout' ), 50 );
513
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'order_comment' ), 60 );
514
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'payment' ), 70 );
515
+ add_action( 'learn-press/after-checkout-form', LearnPress::instance()->template( 'checkout' )->func( 'terms' ), 80 );
516
 
517
  // ******************************************************************************************************************* //
518
 
519
  add_action( 'learn-press/content-item-summary-class', 'learn_press_content_item_summary_classes', 15 );
520
  add_action(
521
  'learn-press/before-content-item-summary/lp_quiz',
522
+ LearnPress::instance()->template( 'course' )->callback( 'content-quiz/title.php' ),
523
  5
524
  );
525
+ add_action( 'learn-press/content-item-summary/lp_quiz', LearnPress::instance()->template( 'course' )->callback( 'content-quiz/js' ), 25 );
526
  // add_action( 'learn-press/parse-course-item', 'learn_press_control_displaying_course_item', 5 ); // comment by tungnx
527
  //add_action( 'learn-press/after-single-course', 'learn_press_single_course_args', 5 );
528
  add_filter( 'document_title_parts', 'learn_press_single_document_title_parts', 5 );
532
  //add_action( 'wp_head', 'learn_press_single_course_args', 5 );
533
  add_action(
534
  'learn-press/before-checkout-order-review',
535
+ LearnPress::instance()->template( 'course' )->callback( 'checkout/form-logged-in.php' ),
536
  10
537
  );
538
  add_filter( 'comments_template_query_args', 'learn_press_comments_template_query_args' );
539
  add_filter( 'get_comments_number', 'learn_press_filter_get_comments_number' );
540
 
541
  add_filter( 'excerpt_length', 'learn_press_custom_excerpt_length', 999 );
542
+ // add_filter( 'learn_press_get_template', LearnPress::instance()->template( 'general' )->func( 'filter_block_content_template' ), 10, 5 );
543
 
544
  /**
545
  * Filter to hide the section if there is no item.
inc/order/class-lp-order.php CHANGED
@@ -366,8 +366,8 @@ if ( ! class_exists( 'LP_Order' ) ) {
366
  public function payment_complete( $transaction_id = '' ): bool {
367
  do_action( 'learn-press/payment-pre-complete', $this->get_id() );
368
 
369
- //TODO: tungnx - check to change code below - use LP()->session->set()
370
- LP()->session->order_awaiting_payment = null;
371
 
372
  $valid_order_statuses = apply_filters(
373
  'learn-press/valid-order-statuses-for-payment-complete',
366
  public function payment_complete( $transaction_id = '' ): bool {
367
  do_action( 'learn-press/payment-pre-complete', $this->get_id() );
368
 
369
+ //TODO: tungnx - check to change code below - use LearnPress::instance()->session->set()
370
+ LearnPress::instance()->session->order_awaiting_payment = null;
371
 
372
  $valid_order_statuses = apply_filters(
373
  'learn-press/valid-order-statuses-for-payment-complete',
inc/order/lp-order-functions.php CHANGED
@@ -858,7 +858,7 @@ function learn_press_get_total_price_order_complete() {
858
  if ( $enrolled ) {
859
  learn_press_add_message( sprintf( __( 'You have enrolled in this course. <a href="%s">Order details</a>', 'learnpress' ), $result['redirect'] ) );
860
  $result['redirect'] = get_the_permalink( $enrolled );
861
- LP()->cart->empty_cart();
862
  }
863
 
864
  return $result;
858
  if ( $enrolled ) {
859
  learn_press_add_message( sprintf( __( 'You have enrolled in this course. <a href="%s">Order details</a>', 'learnpress' ), $result['redirect'] ) );
860
  $result['redirect'] = get_the_permalink( $enrolled );
861
+ LearnPress::instance()->cart->empty_cart();
862
  }
863
 
864
  return $result;
inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php CHANGED
@@ -233,7 +233,7 @@ class LP_REST_Courses_Controller extends LP_Abstract_REST_Controller {
233
  }
234
  // End content items
235
  } else {
236
- LP()->template( 'course' )->no_courses_found();
237
  }
238
 
239
  $response->data->content = ob_get_clean();
@@ -323,15 +323,15 @@ class LP_REST_Courses_Controller extends LP_Abstract_REST_Controller {
323
 
324
  do_action( 'learnpress/user/course-enrolled', $course_item->ref_id, $course_id, $user->get_id() );
325
  } else { // Case enroll course free
326
- LP()->session->set( 'order_awaiting_payment', '' );
327
 
328
- $cart = LP()->cart;
329
  $checkout = LP_Checkout::instance();
330
 
331
  if ( ! learn_press_enable_cart() ) {
332
- $order_awaiting_payment = LP()->session->order_awaiting_payment;
333
  $cart->empty_cart();
334
- LP()->session->order_awaiting_payment = $order_awaiting_payment;
335
  }
336
 
337
  $cart_id = $cart->add_to_cart( $course_id, 1, array() );
@@ -469,15 +469,15 @@ class LP_REST_Courses_Controller extends LP_Abstract_REST_Controller {
469
  }
470
  }
471
 
472
- LP()->session->set( 'order_awaiting_payment', '' );
473
 
474
- $cart = LP()->cart;
475
  $checkout = LP_Checkout::instance();
476
 
477
  if ( ! learn_press_enable_cart() ) {
478
- $order_awaiting_payment = LP()->session->order_awaiting_payment;
479
  $cart->empty_cart();
480
- LP()->session->order_awaiting_payment = $order_awaiting_payment;
481
  }
482
 
483
  do_action( 'learnpress/rest-api/courses/purchase/before-add-to-cart' );
233
  }
234
  // End content items
235
  } else {
236
+ LearnPress::instance()->template( 'course' )->no_courses_found();
237
  }
238
 
239
  $response->data->content = ob_get_clean();
323
 
324
  do_action( 'learnpress/user/course-enrolled', $course_item->ref_id, $course_id, $user->get_id() );
325
  } else { // Case enroll course free
326
+ LearnPress::instance()->session->set( 'order_awaiting_payment', '' );
327
 
328
+ $cart = LearnPress::instance()->cart;
329
  $checkout = LP_Checkout::instance();
330
 
331
  if ( ! learn_press_enable_cart() ) {
332
+ $order_awaiting_payment = LearnPress::instance()->session->order_awaiting_payment;
333
  $cart->empty_cart();
334
+ LearnPress::instance()->session->order_awaiting_payment = $order_awaiting_payment;
335
  }
336
 
337
  $cart_id = $cart->add_to_cart( $course_id, 1, array() );
469
  }
470
  }
471
 
472
+ LearnPress::instance()->session->set( 'order_awaiting_payment', '' );
473
 
474
+ $cart = LearnPress::instance()->cart;
475
  $checkout = LP_Checkout::instance();
476
 
477
  if ( ! learn_press_enable_cart() ) {
478
+ $order_awaiting_payment = LearnPress::instance()->session->order_awaiting_payment;
479
  $cart->empty_cart();
480
+ LearnPress::instance()->session->order_awaiting_payment = $order_awaiting_payment;
481
  }
482
 
483
  do_action( 'learnpress/rest-api/courses/purchase/before-add-to-cart' );
inc/rest-api/v1/frontend/class-lp-rest-widgets-controller.php CHANGED
@@ -37,9 +37,8 @@ class LP_REST_Widgets_Controller extends LP_Abstract_REST_Controller {
37
  $params = $request->get_params();
38
  $widget_id = $params['widget'] ?? false; // LP_Widget.
39
  $instance = $params['instance'] ?? false;
40
- $hash = $params['hash'] ?? false;
41
 
42
- if ( empty( $widget_id ) || empty( $instance ) || empty( $hash ) ) {
43
  throw new Exception( 'Error: No params!' );
44
  }
45
 
@@ -49,13 +48,7 @@ class LP_REST_Widgets_Controller extends LP_Abstract_REST_Controller {
49
  throw new Exception( 'Error: No method lp_rest_api_content!' );
50
  }
51
 
52
- $serialized_instance = base64_decode( $instance );
53
-
54
- if ( ! hash_equals( wp_hash( $serialized_instance ), $hash ) ) {
55
- throw new Exception( 'The provided instance is malformed.' );
56
- }
57
-
58
- $instance = unserialize( $serialized_instance );
59
 
60
  unset( $params['instance'] );
61
  unset( $params['hash'] );
37
  $params = $request->get_params();
38
  $widget_id = $params['widget'] ?? false; // LP_Widget.
39
  $instance = $params['instance'] ?? false;
 
40
 
41
+ if ( empty( $widget_id ) || empty( $instance ) ) {
42
  throw new Exception( 'Error: No params!' );
43
  }
44
 
48
  throw new Exception( 'Error: No method lp_rest_api_content!' );
49
  }
50
 
51
+ $instance = json_decode( $instance, true );
 
 
 
 
 
 
52
 
53
  unset( $params['instance'] );
54
  unset( $params['hash'] );
inc/shortcodes/class-lp-shortcode-button-course.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThimPress
6
  * @category Shortcodes
7
  * @package Learnpress/Shortcodes
8
- * @version 3.0.0
9
  * @extends LP_Abstract_Shortcode
10
  */
11
 
@@ -35,13 +35,14 @@ if ( ! class_exists( 'LP_Shortcode_Button_Course' ) ) {
35
  'id' => 0,
36
  'enroll_text' => '',
37
  'purchase_text' => '',
 
38
  ),
39
  $this->_atts
40
  );
41
  }
42
 
43
  /**
44
- * Output form.
45
  *
46
  * @return string
47
  */
@@ -56,47 +57,67 @@ if ( ! class_exists( 'LP_Shortcode_Button_Course' ) ) {
56
  $course_id = $atts['id'];
57
  }
58
 
59
- $course = learn_press_get_course( $course_id );
 
 
 
 
60
 
61
- if ( $course_id && $course ) {
62
- LP_Global::set_course( $course );
63
- global $post;
64
 
65
- $post = get_post( $course_id );
 
 
 
 
66
 
67
- setup_postdata( $post );
68
- do_action( 'learn-press/course-buttons' );
69
- wp_reset_postdata();
70
- LP_Global::reset();
 
 
 
71
  }
72
 
73
  return ob_get_clean();
74
  }
75
 
76
  /**
 
 
77
  * @param string $text
78
  *
79
  * @return string
80
  */
81
- public function purchase_button_text( $text ) {
82
  if ( $this->_atts['purchase_text'] ) {
83
  $text = $this->_atts['purchase_text'];
 
 
84
  }
85
 
86
  return $text;
87
  }
88
 
89
  /**
 
 
90
  * @param string $text
91
  *
92
  * @return string
93
  */
94
- public function enroll_button_text( $text ) {
95
  if ( $this->_atts['enroll_text'] ) {
96
  $text = $this->_atts['enroll_text'];
 
 
97
  }
98
 
99
  return $text;
100
  }
101
  }
102
  }
 
 
5
  * @author ThimPress
6
  * @category Shortcodes
7
  * @package Learnpress/Shortcodes
8
+ * @version 3.0.1
9
  * @extends LP_Abstract_Shortcode
10
  */
11
 
35
  'id' => 0,
36
  'enroll_text' => '',
37
  'purchase_text' => '',
38
+ 'btn_label' => '',
39
  ),
40
  $this->_atts
41
  );
42
  }
43
 
44
  /**
45
+ * Output button course.
46
  *
47
  * @return string
48
  */
57
  $course_id = $atts['id'];
58
  }
59
 
60
+ try {
61
+ $course = learn_press_get_course( $course_id );
62
+ if ( ! $course ) {
63
+ return '';
64
+ }
65
 
66
+ // Load js button course.
67
+ wp_enqueue_script( 'lp-single-course' );
 
68
 
69
+ if ( $course->is_free() ) {
70
+ add_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text_enroll' ) );
71
+ } elseif ( $course->get_external_link() ) {
72
+ add_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text_external_link' ) );
73
+ } elseif ( $course->is_no_required_enroll() ) {
74
 
75
+ } else {
76
+ add_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text_purchase' ) );
77
+ }
78
+
79
+ do_action( 'learn-press/course-buttons', $course );
80
+ } catch ( Throwable $e ) {
81
+ error_log( $e->getMessage() );
82
  }
83
 
84
  return ob_get_clean();
85
  }
86
 
87
  /**
88
+ * Label button purchase.
89
+ *
90
  * @param string $text
91
  *
92
  * @return string
93
  */
94
+ public function button_text_purchase( string $text ): string {
95
  if ( $this->_atts['purchase_text'] ) {
96
  $text = $this->_atts['purchase_text'];
97
+ } elseif ( $this->_atts['btn_label'] ) {
98
+ $text = $this->_atts['btn_label'];
99
  }
100
 
101
  return $text;
102
  }
103
 
104
  /**
105
+ * Label button enroll.
106
+ *
107
  * @param string $text
108
  *
109
  * @return string
110
  */
111
+ public function button_text_enroll( string $text ): string {
112
  if ( $this->_atts['enroll_text'] ) {
113
  $text = $this->_atts['enroll_text'];
114
+ } elseif ( $this->_atts['btn_label'] ) {
115
+ $text = $this->_atts['btn_label'];
116
  }
117
 
118
  return $text;
119
  }
120
  }
121
  }
122
+
123
+ new LP_Shortcode_Button_Course();
inc/shortcodes/class-lp-shortcode-button-purchase.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThimPress
6
  * @category Shortcodes
7
  * @package Learnpress/Shortcodes
8
- * @version 3.0.0
9
  * @extends LP_Abstract_Shortcode
10
  */
11
 
@@ -22,7 +22,6 @@ if ( ! class_exists( 'LP_Shortcode_Button_Purchase' ) ) {
22
  * @since 3.0.0
23
  */
24
  class LP_Shortcode_Button_Purchase extends LP_Abstract_Shortcode {
25
-
26
  /**
27
  * LP_Shortcode_Button_Purchase constructor.
28
  *
@@ -49,7 +48,6 @@ if ( ! class_exists( 'LP_Shortcode_Button_Purchase' ) ) {
49
  ob_start();
50
 
51
  $atts = $this->_atts;
52
-
53
  if ( 'current' === $atts['id'] ) {
54
  $course_id = learn_press_is_course() ? get_the_ID() : 0;
55
  } else {
@@ -57,27 +55,15 @@ if ( ! class_exists( 'LP_Shortcode_Button_Purchase' ) ) {
57
  }
58
 
59
  $course = learn_press_get_course( $course_id );
 
 
 
60
 
61
- if ( $course_id && $course && ! $course->is_free() ) {
62
- LP_Global::set_course( $course );
63
- global $post;
64
- $enqueued = wp_script_is( 'lp-single-course', 'enqueued' );
65
-
66
- if ( ! $enqueued ) {
67
- wp_enqueue_script( 'lp-single-course' );
68
- }
69
- $post = get_post( $course_id );
70
-
71
- setup_postdata( $post );
72
  add_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text' ) );
73
-
74
- learn_press_get_template( 'single-course/buttons/purchase.php', array( 'course' => $course ) );
75
-
76
- remove_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text' ) );
77
- wp_reset_postdata();
78
  LP_Global::reset();
79
- } else {
80
-
81
  }
82
 
83
  return ob_get_clean();
5
  * @author ThimPress
6
  * @category Shortcodes
7
  * @package Learnpress/Shortcodes
8
+ * @version 3.0.1
9
  * @extends LP_Abstract_Shortcode
10
  */
11
 
22
  * @since 3.0.0
23
  */
24
  class LP_Shortcode_Button_Purchase extends LP_Abstract_Shortcode {
 
25
  /**
26
  * LP_Shortcode_Button_Purchase constructor.
27
  *
48
  ob_start();
49
 
50
  $atts = $this->_atts;
 
51
  if ( 'current' === $atts['id'] ) {
52
  $course_id = learn_press_is_course() ? get_the_ID() : 0;
53
  } else {
55
  }
56
 
57
  $course = learn_press_get_course( $course_id );
58
+ if ( ! $course ) {
59
+ return '';
60
+ }
61
 
62
+ if ( ! $course->is_free() ) {
63
+ wp_enqueue_script( 'lp-single-course' );
 
 
 
 
 
 
 
 
 
64
  add_filter( 'learn-press/purchase-course-button-text', array( $this, 'button_text' ) );
65
+ do_action( 'learn-press/course-buttons', $course );
 
 
 
 
66
  LP_Global::reset();
 
 
67
  }
68
 
69
  return ob_get_clean();
inc/shortcodes/class-lp-shortcode-checkout.php CHANGED
@@ -72,8 +72,8 @@ if ( ! class_exists( 'LP_Shortcode_Checkout' ) ) {
72
  return;
73
  }
74
 
75
- LP()->session->remove( 'order_awaiting_payment' );
76
- LP()->cart->empty_cart();
77
 
78
  learn_press_print_messages();
79
 
72
  return;
73
  }
74
 
75
+ LearnPress::instance()->session->remove( 'order_awaiting_payment' );
76
+ LearnPress::instance()->cart->empty_cart();
77
 
78
  learn_press_print_messages();
79
 
inc/templates/abstract-template.php CHANGED
@@ -71,7 +71,7 @@ class LP_Abstract_Template {
71
  * @param string $function_to_remove - '*' will remove all methods.
72
  * @param int $priority
73
  *
74
- * Ex: Remove for text: LP()->template( 'course' )->remove( 'learn-press/course-content-summary', array( '<div class="course-detail-info"> <div class="lp-content-area"> <div class="course-info-left">', 'course-info-left-open' ), 10 );
75
  */
76
  public function remove( $tag, $function_to_remove, $priority = 10 ) {
77
  global $wp_filter;
@@ -157,7 +157,7 @@ class LP_Abstract_Template {
157
  *
158
  * @author Nhamdv <email@email.com>
159
  *
160
- * Ex: LP()->template( 'course' )->remove_callback( 'learn-press/course-content-summary', 'single-course/title', 10 );
161
  *
162
  */
163
  public static function remove_callback( $tag, $function, $priority ) {
71
  * @param string $function_to_remove - '*' will remove all methods.
72
  * @param int $priority
73
  *
74
+ * Ex: Remove for text: LearnPress::instance()->template( 'course' )->remove( 'learn-press/course-content-summary', array( '<div class="course-detail-info"> <div class="lp-content-area"> <div class="course-info-left">', 'course-info-left-open' ), 10 );
75
  */
76
  public function remove( $tag, $function_to_remove, $priority = 10 ) {
77
  global $wp_filter;
157
  *
158
  * @author Nhamdv <email@email.com>
159
  *
160
+ * Ex: LearnPress::instance()->template( 'course' )->remove_callback( 'learn-press/course-content-summary', 'single-course/title', 10 );
161
  *
162
  */
163
  public static function remove_callback( $tag, $function, $priority ) {
inc/templates/class-lp-template-checkout.php CHANGED
@@ -40,7 +40,7 @@ class LP_Template_Checkout extends LP_Abstract_Template {
40
  }
41
 
42
  public function account_login() {
43
- if ( is_user_logged_in() || ! LP()->checkout()->is_enable_login() ) {
44
  return;
45
  }
46
 
@@ -48,7 +48,7 @@ class LP_Template_Checkout extends LP_Abstract_Template {
48
  }
49
 
50
  public function account_register() {
51
- if ( is_user_logged_in() || ! LP()->checkout()->is_enable_register() ) {
52
  return;
53
  }
54
 
@@ -56,7 +56,7 @@ class LP_Template_Checkout extends LP_Abstract_Template {
56
  }
57
 
58
  public function guest_checkout() {
59
- if ( is_user_logged_in() || ! LP()->checkout()->is_enable_guest_checkout() ) {
60
  return;
61
  }
62
 
40
  }
41
 
42
  public function account_login() {
43
+ if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_login() ) {
44
  return;
45
  }
46
 
48
  }
49
 
50
  public function account_register() {
51
+ if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_register() ) {
52
  return;
53
  }
54
 
56
  }
57
 
58
  public function guest_checkout() {
59
+ if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_guest_checkout() ) {
60
  return;
61
  }
62
 
inc/templates/class-lp-template-course.php CHANGED
@@ -8,7 +8,6 @@
8
  * @since 3.x.x
9
  */
10
  class LP_Template_Course extends LP_Abstract_Template {
11
-
12
  /**
13
  * @var LP_Course
14
  */
@@ -59,9 +58,11 @@ class LP_Template_Course extends LP_Abstract_Template {
59
  *
60
  * @throws Exception
61
  */
62
- public function button_retry() {
63
- $user = learn_press_get_current_user();
64
- $course = learn_press_get_course();
 
 
65
 
66
  if ( ! $user || ! $course ) {
67
  return;
@@ -173,13 +174,15 @@ class LP_Template_Course extends LP_Abstract_Template {
173
  *
174
  * @editor tungnx
175
  * @modify 4.1.3.1
176
- * @version 4.0.1
177
  * @throws Exception
 
178
  */
179
- public function course_purchase_button() {
180
  $can_show = true;
181
- $course = learn_press_get_course();
182
- $user = learn_press_get_current_user();
 
 
183
 
184
  try {
185
  if ( ! $user || ! $course ) {
@@ -226,10 +229,12 @@ class LP_Template_Course extends LP_Abstract_Template {
226
  * @throws Exception
227
  * @version 4.0.2
228
  */
229
- public function course_enroll_button() {
230
  $can_show = true;
231
  $user = learn_press_get_current_user();
232
- $course = learn_press_get_course();
 
 
233
 
234
  try {
235
  if ( ! $course || ! $user ) {
@@ -332,35 +337,6 @@ class LP_Template_Course extends LP_Abstract_Template {
332
  );
333
  }
334
 
335
- /**
336
- * Show button retake course
337
- *
338
- * @throws Exception
339
- * @deprecated 4.0.0
340
- */
341
- public function course_retake_button() {
342
- _deprecated_function( __FUNCTION__, '4.0.0', 'button_retry' );
343
- $user = learn_press_get_current_user();
344
-
345
- if ( ! $user ) {
346
- return;
347
- }
348
-
349
- if ( ! isset( $course ) ) {
350
- $course = learn_press_get_course();
351
- }
352
-
353
- if ( ! $user->has_enrolled_course( $course->get_id() ) && $course->get_external_link() ) {
354
- return;
355
- }
356
-
357
- // If user has not finished course
358
- if ( ! $user->has_finished_course( $course->get_id() ) ) {
359
- return;
360
- }
361
- learn_press_get_template( 'single-course/buttons/retake.php' );
362
- }
363
-
364
  /**
365
  * Show template "continue" button con single course
366
  *
@@ -370,10 +346,12 @@ class LP_Template_Course extends LP_Abstract_Template {
370
  * @version 4.0.2
371
  * @since 4.0.0
372
  */
373
- public function course_continue_button() {
374
  $can_show = true;
375
  $user = learn_press_get_current_user();
376
- $course = learn_press_get_course();
 
 
377
 
378
  try {
379
  if ( ! $user || ! $course ) {
@@ -415,74 +393,12 @@ class LP_Template_Course extends LP_Abstract_Template {
415
  learn_press_get_template( 'single-course/buttons/continue.php', $args );
416
  }
417
 
418
- /**
419
- * Check can show button finish course
420
- *
421
- * @param LP_Course|false $course
422
- * @param LP_User|LP_User_Guest $user
423
- *
424
- * @return array
425
- * @editor tungnx
426
- * @modify 4.1.4.1 - comment - not use - replace on function can_show_finish_course_btn on LP_User
427
- */
428
- /*
429
- public function can_show_finish_course_btn( $course, $user ): array {
430
- $return = [
431
- 'flag' => false,
432
- 'message' => '',
433
- ];
434
-
435
- try {
436
- if ( ! $course || ! $user ) {
437
- throw new Exception( esc_html__( 'Error: No Course or User available.', 'learnpress' ) );
438
- }
439
-
440
- $course_id = $course->get_id();
441
-
442
- if ( ! $user->has_enrolled_course( $course_id ) ) {
443
- throw new Exception( esc_html__( 'Course is not enroll.', 'learnpress' ) );
444
- }
445
-
446
- $course_data = $user->get_course_data( $course_id );
447
-
448
- if ( ! $user->is_course_in_progress( $course_id ) ) {
449
- throw new Exception( esc_html__( 'Error: Course is not in-progress.', 'learnpress' ) );
450
- }
451
-
452
- // Get option Allow show finish button when the student has completed all items but has not passed the course assessment.
453
- $has_finish = get_post_meta( $course_id, '_lp_has_finish', true ) ?? 'yes';
454
- $is_passed = $user->has_reached_passing_condition( $course_id );
455
-
456
- if ( ! $is_passed && $has_finish === 'no' ) {
457
- throw new Exception( esc_html__( 'Error: Course is not has finish.', 'learnpress' ) );
458
- }
459
-
460
- if ( $course_data ) {
461
- $course_result = $course_data->get_result();
462
-
463
- $is_all_completed = $user->is_completed_all_items( $course_id );
464
-
465
- if ( ! $is_all_completed && $has_finish === 'yes' && ! $course_result['pass'] ) {
466
- throw new Exception( esc_html__( 'Error: Cannot finish course.', 'learnpress' ) );
467
- }
468
- }
469
-
470
- if ( ! apply_filters( 'lp_can_finish_course', true ) ) {
471
- throw new Exception( esc_html__( 'Error: Filter disable finish course.', 'learnpress' ) );
472
- }
473
-
474
- $return['flag'] = true;
475
- } catch ( Exception $e ) {
476
- $return['message'] = $e->getMessage();
477
  }
478
 
479
- return $return;
480
- }*/
481
-
482
- public function course_finish_button() {
483
- $user = learn_press_get_current_user();
484
- $course = learn_press_get_course();
485
-
486
  if ( ! $course ) {
487
  return;
488
  }
@@ -514,9 +430,12 @@ class LP_Template_Course extends LP_Abstract_Template {
514
  * @editor tungnx
515
  * @modify 4.1.3
516
  */
517
- public function course_external_button() {
518
- $course = learn_press_get_course();
519
- $user = learn_press_get_current_user();
 
 
 
520
 
521
  if ( ! $course ) {
522
  return;
@@ -624,7 +543,8 @@ class LP_Template_Course extends LP_Abstract_Template {
624
  $section_id = LP_Section_DB::getInstance()->get_section_id_by_item_id( absint( $item_id ) );
625
  }
626
  ?>
627
- <div class="learnpress-course-curriculum" data-section="<?php echo esc_attr( $section_id ?? '' ); ?>" data-id="<?php echo esc_attr( $item_id ?? '' ); ?>">
 
628
  <ul class="lp-skeleton-animation">
629
  <li style="width: 100%; height: 50px"></li>
630
  <li style="width: 100%; height: 20px"></li>
@@ -682,13 +602,11 @@ class LP_Template_Course extends LP_Abstract_Template {
682
 
683
  public function course_item_content() {
684
  $course = learn_press_get_course();
685
- $item = LP_Global::course_item();
 
 
686
 
687
- // if ( $item->is_blocked() ) {
688
- // learn_press_get_template( 'global/block-content.php' );
689
- //
690
- // return;
691
- // }
692
 
693
  /**
694
  * Fix only for WPBakery load style inline
@@ -707,14 +625,7 @@ class LP_Template_Course extends LP_Abstract_Template {
707
  }
708
  // End
709
 
710
- // Get timestamp remaining duration of course
711
- /*$course_item = $item->get_course();
712
- if ( ! $course_item ) {
713
- return;
714
- }*/
715
-
716
  $timestamp_remaining = $course->timestamp_remaining_duration();
717
-
718
  if ( $timestamp_remaining > 0 ) {
719
  echo '<input type="hidden" name="lp-course-timestamp-remaining" value="' . esc_attr( $timestamp_remaining ) . '">';
720
  }
@@ -729,34 +640,6 @@ class LP_Template_Course extends LP_Abstract_Template {
729
  }
730
  }
731
 
732
- /**
733
- * @editor tungnx
734
- * @reason comment - not use
735
- * @since 4.1.2
736
- */
737
- /*
738
- public function remaining_time() {
739
-
740
- if ( ! $course = learn_press_get_course() ) {
741
- return;
742
- }
743
-
744
- if ( ! $user = learn_press_get_current_user() ) {
745
- return;
746
- }
747
-
748
- if ( false === ( $remain = $user->get_course_remaining_time( $course->get_id() ) ) ) {
749
-
750
- return;
751
- }
752
-
753
- if ( $user->has_finished_course( $course->get_id() ) ) {
754
- return;
755
- }
756
-
757
- learn_press_get_template( 'single-course/remaining-time.php', array( 'remaining_time' => $remain ) );
758
- }*/
759
-
760
  public function item_lesson_title() {
761
  $item = LP_Global::course_item();
762
  $format = $item->get_format();
@@ -785,12 +668,18 @@ class LP_Template_Course extends LP_Abstract_Template {
785
  learn_press_get_template( 'content-lesson/content.php', array( 'lesson' => $item ) );
786
  }
787
 
 
 
 
788
  public function item_quiz_content() {
789
  $item = LP_Global::course_item();
790
 
791
  learn_press_get_template( 'content-quiz/js.php' );
792
  }
793
 
 
 
 
794
  public function item_lesson_content_blocked() {
795
  $item = LP_Global::course_item();
796
 
@@ -803,25 +692,32 @@ class LP_Template_Course extends LP_Abstract_Template {
803
  public function item_lesson_complete_button() {
804
  $user = learn_press_get_current_user();
805
  $course = learn_press_get_course();
806
- $item = LP_Global::course_item();
807
-
808
- if ( ! $user || ! $course || ! $user->is_course_in_progress( $course->get_id() ) ) {
809
  return;
810
  }
811
 
812
- // The complete button is not displayed when the course is locked --hungkv--
813
- if ( $user->can_view_content_course( $course->get_id() )->key === LP_BLOCK_COURSE_DURATION_EXPIRE ) {
814
- return;
815
- }
 
816
 
817
- learn_press_get_template(
818
- 'content-lesson/button-complete.php',
819
- array(
820
- 'user' => $user,
821
- 'course' => $course,
822
- 'item' => $item,
823
- )
824
- );
 
 
 
 
 
 
 
 
825
  }
826
 
827
  /**
@@ -946,8 +842,7 @@ class LP_Template_Course extends LP_Abstract_Template {
946
  }
947
  }
948
 
949
- public function sidebar() {
950
- }
951
 
952
  public function course_featured_review() {
953
  $review_content = get_post_meta( $this->course->get_id(), '_lp_featured_review', true );
@@ -975,14 +870,17 @@ class LP_Template_Course extends LP_Abstract_Template {
975
  );
976
  }
977
 
978
- public function instructor_socials() {
 
 
 
979
  $instructor = $this->course->get_instructor();
980
  $socials = $instructor->get_profile_socials( $instructor->get_id() );
981
 
982
  foreach ( $socials as $social ) {
983
  echo wp_kses_post( $social );
984
  }
985
- }
986
 
987
  public function has_sidebar() {
988
  $actions = array(
@@ -1037,7 +935,7 @@ class LP_Template_Course extends LP_Abstract_Template {
1037
  }
1038
 
1039
  public function course_comment_template() {
1040
- global $post;
1041
 
1042
  if ( comments_open() || get_comments_number() ) {
1043
  add_filter( 'deprecated_file_trigger_error', '__return_false' );
@@ -1128,7 +1026,6 @@ class LP_Template_Course extends LP_Abstract_Template {
1128
  public function course_extra_boxes_position_control() {
1129
  $course = LP_Course::get_course( get_the_ID() );
1130
  $user = learn_press_get_current_user();
1131
-
1132
  if ( ! $user || ! $course ) {
1133
  return;
1134
  }
@@ -1137,13 +1034,13 @@ class LP_Template_Course extends LP_Abstract_Template {
1137
  if ( $enrolled ) {
1138
  remove_action(
1139
  'learn-press/course-content-summary',
1140
- LP()->template( 'course' )->func( 'course_extra_boxes' ),
1141
  40
1142
  );
1143
  } else {
1144
  remove_action(
1145
  'learn-press/course-content-summary',
1146
- LP()->template( 'course' )->func( 'course_extra_boxes' ),
1147
  70
1148
  );
1149
  }
8
  * @since 3.x.x
9
  */
10
  class LP_Template_Course extends LP_Abstract_Template {
 
11
  /**
12
  * @var LP_Course
13
  */
58
  *
59
  * @throws Exception
60
  */
61
+ public function button_retry( $course ) {
62
+ $user = learn_press_get_current_user();
63
+ if ( empty( $course ) ) {
64
+ $course = learn_press_get_course();
65
+ }
66
 
67
  if ( ! $user || ! $course ) {
68
  return;
174
  *
175
  * @editor tungnx
176
  * @modify 4.1.3.1
 
177
  * @throws Exception
178
+ * @version 4.0.1
179
  */
180
+ public function course_purchase_button( $course ) {
181
  $can_show = true;
182
+ if ( empty( $course ) ) {
183
+ $course = learn_press_get_course();
184
+ }
185
+ $user = learn_press_get_current_user();
186
 
187
  try {
188
  if ( ! $user || ! $course ) {
229
  * @throws Exception
230
  * @version 4.0.2
231
  */
232
+ public function course_enroll_button( $course ) {
233
  $can_show = true;
234
  $user = learn_press_get_current_user();
235
+ if ( empty( $course ) ) {
236
+ $course = learn_press_get_course();
237
+ }
238
 
239
  try {
240
  if ( ! $course || ! $user ) {
337
  );
338
  }
339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  /**
341
  * Show template "continue" button con single course
342
  *
346
  * @version 4.0.2
347
  * @since 4.0.0
348
  */
349
+ public function course_continue_button( $course ) {
350
  $can_show = true;
351
  $user = learn_press_get_current_user();
352
+ if ( empty( $course ) ) {
353
+ $course = learn_press_get_course();
354
+ }
355
 
356
  try {
357
  if ( ! $user || ! $course ) {
393
  learn_press_get_template( 'single-course/buttons/continue.php', $args );
394
  }
395
 
396
+ public function course_finish_button( $course ) {
397
+ $user = learn_press_get_current_user();
398
+ if ( empty( $course ) ) {
399
+ $course = learn_press_get_course();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  }
401
 
 
 
 
 
 
 
 
402
  if ( ! $course ) {
403
  return;
404
  }
430
  * @editor tungnx
431
  * @modify 4.1.3
432
  */
433
+ public function course_external_button( $course ) {
434
+ if ( empty( $course ) ) {
435
+ $course = learn_press_get_course();
436
+ }
437
+
438
+ $user = learn_press_get_current_user();
439
 
440
  if ( ! $course ) {
441
  return;
543
  $section_id = LP_Section_DB::getInstance()->get_section_id_by_item_id( absint( $item_id ) );
544
  }
545
  ?>
546
+ <div class="learnpress-course-curriculum" data-section="<?php echo esc_attr( $section_id ?? '' ); ?>"
547
+ data-id="<?php echo esc_attr( $item_id ?? '' ); ?>">
548
  <ul class="lp-skeleton-animation">
549
  <li style="width: 100%; height: 50px"></li>
550
  <li style="width: 100%; height: 20px"></li>
602
 
603
  public function course_item_content() {
604
  $course = learn_press_get_course();
605
+ if ( ! $course ) {
606
+ return;
607
+ }
608
 
609
+ $item = LP_Global::course_item();
 
 
 
 
610
 
611
  /**
612
  * Fix only for WPBakery load style inline
625
  }
626
  // End
627
 
 
 
 
 
 
 
628
  $timestamp_remaining = $course->timestamp_remaining_duration();
 
629
  if ( $timestamp_remaining > 0 ) {
630
  echo '<input type="hidden" name="lp-course-timestamp-remaining" value="' . esc_attr( $timestamp_remaining ) . '">';
631
  }
640
  }
641
  }
642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  public function item_lesson_title() {
644
  $item = LP_Global::course_item();
645
  $format = $item->get_format();
668
  learn_press_get_template( 'content-lesson/content.php', array( 'lesson' => $item ) );
669
  }
670
 
671
+ /**
672
+ * @depecated 4.1.7.2
673
+ */
674
  public function item_quiz_content() {
675
  $item = LP_Global::course_item();
676
 
677
  learn_press_get_template( 'content-quiz/js.php' );
678
  }
679
 
680
+ /**
681
+ * @depecated 4.1.7.2
682
+ */
683
  public function item_lesson_content_blocked() {
684
  $item = LP_Global::course_item();
685
 
692
  public function item_lesson_complete_button() {
693
  $user = learn_press_get_current_user();
694
  $course = learn_press_get_course();
695
+ if ( ! $course ) {
 
 
696
  return;
697
  }
698
 
699
+ try {
700
+ $item = LP_Global::course_item();
701
+ if ( ! $user || ! $user->is_course_in_progress( $course->get_id() ) ) {
702
+ return;
703
+ }
704
 
705
+ // The complete button is not displayed when the course is locked --hungkv--
706
+ if ( $user->can_view_content_course( $course->get_id() )->key === LP_BLOCK_COURSE_DURATION_EXPIRE ) {
707
+ return;
708
+ }
709
+
710
+ learn_press_get_template(
711
+ 'content-lesson/button-complete.php',
712
+ array(
713
+ 'user' => $user,
714
+ 'course' => $course,
715
+ 'item' => $item,
716
+ )
717
+ );
718
+ } catch ( Throwable $e ) {
719
+ error_log( $e->getMessage() );
720
+ }
721
  }
722
 
723
  /**
842
  }
843
  }
844
 
845
+ public function sidebar() { }
 
846
 
847
  public function course_featured_review() {
848
  $review_content = get_post_meta( $this->course->get_id(), '_lp_featured_review', true );
870
  );
871
  }
872
 
873
+ /**
874
+ * @depecated 4.1.7.2
875
+ */
876
+ /*public function instructor_socials() {
877
  $instructor = $this->course->get_instructor();
878
  $socials = $instructor->get_profile_socials( $instructor->get_id() );
879
 
880
  foreach ( $socials as $social ) {
881
  echo wp_kses_post( $social );
882
  }
883
+ }*/
884
 
885
  public function has_sidebar() {
886
  $actions = array(
935
  }
936
 
937
  public function course_comment_template() {
938
+ global $post;
939
 
940
  if ( comments_open() || get_comments_number() ) {
941
  add_filter( 'deprecated_file_trigger_error', '__return_false' );
1026
  public function course_extra_boxes_position_control() {
1027
  $course = LP_Course::get_course( get_the_ID() );
1028
  $user = learn_press_get_current_user();
 
1029
  if ( ! $user || ! $course ) {
1030
  return;
1031
  }
1034
  if ( $enrolled ) {
1035
  remove_action(
1036
  'learn-press/course-content-summary',
1037
+ LearnPress::instance()->template( 'course' )->func( 'course_extra_boxes' ),
1038
  40
1039
  );
1040
  } else {
1041
  remove_action(
1042
  'learn-press/course-content-summary',
1043
+ LearnPress::instance()->template( 'course' )->func( 'course_extra_boxes' ),
1044
  70
1045
  );
1046
  }
inc/user-item/class-lp-user-item-course.php CHANGED
@@ -908,6 +908,8 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
908
  }
909
 
910
  /**
 
 
911
  * @param int $item_id
912
  *
913
  * @return bool|LP_User_Item
908
  }
909
 
910
  /**
911
+ * Get item user attend on course by item_id.
912
+ *
913
  * @param int $item_id
914
  *
915
  * @return bool|LP_User_Item
inc/user-item/class-lp-user-item-quiz.php CHANGED
@@ -155,19 +155,6 @@ class LP_User_Item_Quiz extends LP_User_Item {
155
  return ! empty( $statuses[ $status ] ) ? $statuses[ $status ] : __( 'Not Started', 'learnpress' );
156
  }
157
 
158
- /**
159
- * Get current question ID (quiz).
160
- *
161
- * @param string $return - Optional.
162
- *
163
- * @return int|LP_Question
164
- */
165
- public function get_current_question( $return = '' ) {
166
- _deprecated_function( sprintf( '%s::%s', __CLASS__, __FUNCTION__ ), '4.0.0' );
167
-
168
- learn_press_error_log( sprintf( 'Deprecated %s::%s', __CLASS__, __FUNCTION__ ) );
169
- }
170
-
171
  /**
172
  * Get ID of the course that this item assigned to.
173
  *
155
  return ! empty( $statuses[ $status ] ) ? $statuses[ $status ] : __( 'Not Started', 'learnpress' );
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  /**
159
  * Get ID of the course that this item assigned to.
160
  *
inc/user-item/class-lp-user-item.php CHANGED
@@ -781,11 +781,6 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
781
  $this->_changes = array();
782
  }
783
 
784
- /*$data_course = $this->get_parent();
785
- if ( $data_course ) {
786
- $data_course->calculate_course_results();
787
- }*/
788
-
789
  return $return;
790
  }
791
 
@@ -838,47 +833,6 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
838
  return $interval;
839
  }
840
 
841
- /*public function get_history() {
842
- return LP_Object_Cache::get(
843
- sprintf(
844
- 'course-item-%s-%s-%s',
845
- $this->get_user_id(),
846
- $this->get_course( 'id' ),
847
- $this->get_id()
848
- ),
849
- 'learn-press/user-course-items'
850
- );
851
- }*/
852
-
853
- /**
854
- * @editor tungnx
855
- * @modify 4.1.2
856
- * @reason comment - not use
857
- */
858
- /*
859
- public function count_history() {
860
- if ( $items = $this->get_history() ) {
861
- return sizeof( $items );
862
- }
863
-
864
- return 0;
865
- }*/
866
-
867
- /**
868
- * @editor tungnx
869
- * @modify 4.1.2
870
- * @reason comment - not use
871
- */
872
- /*
873
- public function remove_user_items_history( $keep = 10 ) {
874
- learn_press_remove_user_items_history(
875
- $this->get_item_id(),
876
- $this->get_course( 'id' ),
877
- $this->get_user_id(),
878
- $keep
879
- );
880
- }*/
881
-
882
  /**
883
  * Return number of seconds has exceeded from the expiration time to now.
884
  * If less than or equals to 0 that means the time is exceeded.
@@ -1004,43 +958,6 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
1004
  return true;
1005
  }
1006
 
1007
- /**
1008
- * @editor tungnx
1009
- * @modify 4.1.2
1010
- * @reason comment - not use
1011
- */
1012
- /*
1013
- public function delete_meta_data( $include = '', $exclude = '' ) {
1014
- global $wpdb;
1015
-
1016
- $where = '';
1017
- if ( $include ) {
1018
- settype( $include, 'array' );
1019
- $format = array_fill( 0, sizeof( $include ), '%s' );
1020
- $where .= $wpdb->prepare( ' AND meta_key IN(' . join( ',', $format ) . ')', $include );
1021
- }
1022
-
1023
- if ( $exclude ) {
1024
- settype( $exclude, 'array' );
1025
- $format = array_fill( 0, sizeof( $exclude ), '%s' );
1026
- $where .= $wpdb->prepare( ' AND meta_key IN(' . join( ',', $format ) . ')', $exclude );
1027
- }
1028
-
1029
- $query = $wpdb->prepare(
1030
- "
1031
- DELETE FROM {$wpdb->learnpress_user_itemmeta}
1032
- WHERE learnpress_user_item_id = %d
1033
- {$where}
1034
- ",
1035
- $this->get_user_item_id()
1036
- );
1037
-
1038
- $wpdb->query( $query );
1039
-
1040
- $this->_meta_data = array();
1041
- update_meta_cache( 'learnpress_user_item', $this->get_user_item_id() );
1042
- }*/
1043
-
1044
  /**
1045
  * Get post type of item.
1046
  *
781
  $this->_changes = array();
782
  }
783
 
 
 
 
 
 
784
  return $return;
785
  }
786
 
833
  return $interval;
834
  }
835
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  /**
837
  * Return number of seconds has exceeded from the expiration time to now.
838
  * If less than or equals to 0 that means the time is exceeded.
958
  return true;
959
  }
960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
961
  /**
962
  * Get post type of item.
963
  *
inc/user/abstract-lp-user.php CHANGED
@@ -337,26 +337,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
337
  return $records;
338
  }
339
 
340
- /**
341
- * Count number of rows for an item in user-items
342
- *
343
- * @param int $item_id
344
- * @param int $course_id
345
- *
346
- * @return int
347
- * @editor tungnx
348
- * @modify 4.1.3 - comment - not user
349
- */
350
- /*public function count_item_archive( $item_id, $course_id = 0 ) {
351
- $count = 0;
352
-
353
- if ( $items = $this->get_item_archive( $item_id, $course_id ) ) {
354
- $count = sizeof( $items );
355
- }
356
-
357
- return $count;
358
- }*/
359
-
360
  /**
361
  * Check quiz can retake?
362
  *
@@ -486,151 +466,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
486
  return apply_filters( 'learn-press/user-item-status', $status, $item_id, $this->get_id(), $course_id );
487
  }
488
 
489
- /**
490
- * To rewrite get_item_status on abstract-lp-user.
491
- *
492
- * @throws Exception
493
- * @author tungnx
494
- */
495
- /*public function getItemStatus( $item_id, $course_id ) {
496
- $status = LP_User_Items_DB::getInstance()->get_item_status( $item_id, $course_id );
497
-
498
- return $status;
499
- }*/
500
-
501
- /**
502
- * Update viewing item data into database.
503
- *
504
- * @param int $item_id
505
- * @param int $course_id
506
- *
507
- * @return bool
508
- * @since 3.0.0
509
- * @version 4.0.1
510
- * @depecated 4.1.6.9
511
- */
512
- /*public function maybe_update_item( $item_id, $course_id ) {
513
- $return = false;
514
-
515
- try {
516
- $course_data = $this->get_course_data( $course_id );
517
-
518
- if ( $course_data ) {
519
- $item = $course_data->get_item( $item_id );
520
-
521
- if ( ! $item ) {
522
- $item = LP_User_Item::get_item_object( $item_id );
523
-
524
- if ( ! $item ) {
525
- return $return;
526
- }
527
-
528
- if ( $item instanceof LP_User_Item_Quiz ) {
529
- return $return;
530
- }
531
-
532
- $item->set_ref_id( $course_id );
533
- $item->set_parent_id( $course_data->get_user_item_id() );
534
-
535
- $return = $item->update();
536
- }
537
- }
538
- } catch ( Throwable $e ) {
539
- error_log( $e->getMessage() );
540
- }
541
-
542
- return $return;
543
- }*/
544
-
545
- /**
546
- * Get item user has accessed in last time.
547
- *
548
- * @param int $course_id
549
- * @param bool $permalink - Optional. TRUE will return permalink instead of ID.
550
- *
551
- * @return mixed
552
- * @depecated 4.1.6.9
553
- */
554
- public function get_current_item( $course_id, $permalink = false ) {
555
- _deprecated_function( __FUNCTION__, '4.1.6.9' );
556
- return 0;
557
- /*$course_data = $this->get_course_data( $course_id );
558
- if ( ! $course_data ) {
559
- return false;
560
- }
561
-
562
- $course = learn_press_get_course( $course_id );
563
- $id = learn_press_get_user_item_meta( $course_data->get_user_item_id(), '_current_item' );
564
- if ( ! $id || $this->has_completed_item( $id, $course_id ) ) {
565
- $items = $course->get_items( '', false );
566
- if ( $items ) {
567
- foreach ( $items as $item_id ) {
568
- if ( ! $this->has_completed_item( $item_id, $course_id ) ) {
569
- $id = $item_id;
570
- break;
571
- }
572
- }
573
-
574
- if ( ! $id ) {
575
- $id = reset( $items );
576
- }
577
- }
578
-
579
- if ( $id ) {
580
- learn_press_update_user_item_meta( $course_data->get_user_item_id(), '_current_item', $id );
581
- }
582
- }
583
-
584
- if ( $permalink && $id ) {
585
- return apply_filters(
586
- 'learn-press/current-course-item-permalink',
587
- $course->get_item_link( $id ),
588
- $course_id,
589
- $this->get_id()
590
- );
591
- } else {
592
- return apply_filters( 'learn-press/current-course-item', $id, $course_id, $this->get_id() );
593
- }*/
594
- }
595
-
596
- /**
597
- * Get current question's ID/Permalink inside quiz.
598
- *
599
- * @param int $quiz_id
600
- * @param int $course_id
601
- * @param bool $permalink
602
- *
603
- * @return bool|int|string
604
- * @depecated 4.1.6.9
605
- */
606
- /*public function get_current_question( $quiz_id, $course_id, $permalink = false ) {
607
- _deprecated_function( sprintf( '%s::%s', __CLASS__, __FUNCTION__ ), '4.0.0' );
608
- }*/
609
-
610
- /**
611
- * Get previous Question
612
- *
613
- * @param null $quiz_id
614
- * @param int $course_id
615
- * @param false $permalink
616
- * @depecated 4.1.6.9
617
- */
618
- /*public function get_prev_question( $quiz_id = null, $course_id = 0, $permalink = false ) {
619
- _deprecated_function( sprintf( '%s::%s', __CLASS__, __FUNCTION__ ), '4.0.0' );
620
- }*/
621
-
622
- /**
623
- * Get next Question
624
- *
625
- * @param null $quiz_id
626
- * @param int $course_id
627
- * @param false $permalink
628
- * @depecated 4.1.6.9
629
- */
630
- /*public function get_next_question( $quiz_id = null, $course_id = 0, $permalink = false ) {
631
- _deprecated_function( sprintf( '%s::%s', __CLASS__, __FUNCTION__ ), '4.0.0' );
632
- }*/
633
-
634
  /**
635
  * Checks if has status of a quiz for user
636
  *
@@ -690,38 +525,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
690
  return $result;
691
  }
692
 
693
- /**
694
- * Mark question that user has checked.
695
- *
696
- * @param int $question_id
697
- * @param int $quiz_id
698
- * @param int $course_id
699
- *
700
- * @return WP_Error|mixed
701
- * @since 3.0.0
702
- * @editor tungnx
703
- * @modify 4.1.4.1 - comment - not use
704
- */
705
- /*public function check_question( $question_id, $quiz_id, $course_id ) {
706
- if ( ! $course = learn_press_get_course( $course_id ) ) {
707
- return false;
708
- }
709
-
710
- if ( ! $course->has_item( $quiz_id ) ) {
711
- return false;
712
- }
713
-
714
- $quiz = $course->get_item( $quiz_id );
715
-
716
- if ( ! $quiz->has_question( $question_id ) ) {
717
- return false;
718
- }
719
-
720
- $quiz_data = $this->get_item_data( $quiz_id, $course_id );
721
-
722
- return $quiz_data->check_question( $question_id );
723
- }*/
724
-
725
  /**
726
  * Mark question that user has checked.
727
  *
@@ -763,51 +566,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
763
  return $remain;
764
  }
765
 
766
- /**
767
- * Return true if check answer is enabled.
768
- *
769
- * @param int $quiz_id
770
- * @param int $course_id
771
- *
772
- * @return bool
773
- * @deprecated 4.1.4.1
774
- */
775
- /*public function can_check_answer( $quiz_id, $course_id = 0 ) {
776
- _deprecated_function( __FUNCTION__, '4.1.4.1' );
777
- if ( ! $course_id ) {
778
- $course_id = get_the_ID();
779
- }
780
-
781
- if ( $quiz_data = $this->get_item_data( $quiz_id, $course_id ) ) {
782
- return $quiz_data->can_check_answer();
783
- }
784
-
785
- return false;
786
- }*/
787
-
788
- /**
789
- * Return true if check answer is enabled.
790
- *
791
- * @param int $quiz_id
792
- * @param int $course_id
793
- *
794
- * @return bool
795
- * @depecated 4.1.6.9
796
- */
797
- /*public function can_hint_answer( $quiz_id, $course_id = 0 ) {
798
-
799
- if ( ! $course_id ) {
800
- $course_id = get_the_ID();
801
- }
802
-
803
- if ( $quiz_data = $this->get_item_data( $quiz_id, $course_id ) ) {
804
- return $quiz_data->can_hint_answer();
805
- }
806
-
807
- return false;
808
- }*/
809
-
810
-
811
  public function get_quiz_last_results( $quiz_id ) {
812
  $results = $this->get_course_info( $quiz_id );
813
  if ( $results ) {
@@ -930,15 +688,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
930
  return false;
931
  }
932
 
933
- /**
934
- * @depecated 4.1.6.9.1
935
- */
936
- /*public function get_completed_items( $course_id ) {
937
- $this->_curd->get_user_items( $this->get_id(), $course_id );
938
-
939
- return $this->_curd->get_user_completed_items( $this->get_id(), $course_id );
940
- }*/
941
-
942
  /**
943
  * Finish course
944
  *
@@ -1092,46 +841,44 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1092
  *
1093
  * @param int $lesson_id
1094
  * @param int $course_id
1095
- * @param bool $return_wp_error
1096
  *
1097
  * @return bool|WP_Error
1098
  */
1099
- public function complete_lesson( $lesson_id, $course_id = 0, $return_wp_error = true ) {
 
 
1100
  try {
1101
- $course_id = $this->_get_course( $course_id );
 
 
 
1102
 
1103
  $course_data = $this->get_course_data( $course_id );
1104
-
1105
- $result = false;
 
1106
 
1107
  /**
1108
  * If user has stared a lesson, get user lesson information
1109
  */
1110
  $item = $course_data->get_item( $lesson_id );
1111
- if ( $item ) {
1112
- if ( $item->is_completed() ) {
1113
- throw new Exception(
1114
- __( 'You have already completed this lesson.', 'learnpress' ),
1115
- LP_COMPLETE_ITEM_FAIL
1116
- );
1117
- }
1118
 
1119
- $item->set_end_time( current_time( 'mysql', 1 ) );
1120
- $item->set_status( 'completed' );
1121
- $item->set_graduation( 'passed' );
1122
 
1123
- $updated = $item->update();
 
 
1124
 
1125
- if ( is_wp_error( $updated ) ) {
1126
- return $return_wp_error ? $updated : false;
1127
- } else {
1128
- $result = true;
1129
- }
1130
- }
1131
 
1132
  do_action( 'learn-press/user-completed-lesson', $lesson_id, $course_id, $this->get_id() );
1133
- } catch ( Exception $ex ) {
1134
- $result = $return_wp_error ? new WP_Error( $ex->getCode(), $ex->getMessage() ) : false;
1135
  }
1136
 
1137
  return $result;
@@ -1208,214 +955,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1208
  return apply_filters( 'learn-press/user-course-status', $status, $course_id, $this->get_id() );
1209
  }
1210
 
1211
- /**
1212
- * Controls what this user can do with a course.
1213
- *
1214
- * 0 => No accessible
1215
- * 10 => Normal users (like not logged in)
1216
- * 20 => Author of course
1217
- * 30 => Admin site
1218
- * 35 => No require enrollment
1219
- * 40 => Ordered but not completed
1220
- * 50 => Order is completed but not enrolled
1221
- * 60 => User has already enrolled course
1222
- * 70 => User has already finished course
1223
- *
1224
- * @param int $course_id
1225
- *
1226
- * @return int
1227
- * @since 3.1.0
1228
- * @editor tungnx
1229
- * @modify 4.1.3 - comment - not use
1230
- */
1231
- /*public function get_course_access_level( $course_id ) {
1232
- $access_level = LP_Object_Cache::get(
1233
- 'course-' . $course_id . '-' . $this->get_id(),
1234
- 'learn-press/course-access-levels'
1235
- );
1236
-
1237
- if ( false === $access_level ) {
1238
- $course = learn_press_get_course( $course_id );
1239
-
1240
- if ( ! $course ) {
1241
- $access_level = LP_COURSE_ACCESS_LEVEL_0;
1242
- } elseif ( $this->is_admin() ) {
1243
- $access_level = LP_COURSE_ACCESS_LEVEL_30;
1244
- } elseif ( $this->is_author_of( $course_id ) ) {
1245
- $access_level = LP_COURSE_ACCESS_LEVEL_20;
1246
- } else {
1247
- $access_level = LP_COURSE_ACCESS_LEVEL_10;
1248
- }
1249
-
1250
- // Default level
1251
- $access_level = apply_filters(
1252
- 'learn-press/course-access-level-default',
1253
- $access_level,
1254
- $course_id,
1255
- $this->get_id()
1256
- );
1257
- $course_data = $this->get_course_data( $course_id );
1258
-
1259
- if ( $course_data && $course_data->get_user_item_id() ) {
1260
- // if ( $course_data->get_access_level() >= 50 ) {
1261
- switch ( $course_data->get_status() ) {
1262
- case 'completed':
1263
- case 'failed':
1264
- $access_level = LP_COURSE_ACCESS_LEVEL_60;
1265
- break;
1266
- case 'in-progress':
1267
- case 'enrolled':
1268
- $access_level = LP_COURSE_ACCESS_LEVEL_70;
1269
- break;
1270
- }
1271
- // }
1272
- } else {
1273
- $order = $this->get_course_order( $course_id );
1274
-
1275
- if ( $order ) {
1276
- switch ( $order->get_status() ) {
1277
- case 'completed':
1278
- $access_level = LP_COURSE_ACCESS_LEVEL_50;
1279
- break;
1280
- default:
1281
- $access_level = LP_COURSE_ACCESS_LEVEL_40;
1282
- }
1283
- }
1284
- }
1285
-
1286
- LP_Object_Cache::set(
1287
- 'course-' . $course_id . '-' . $this->get_id(),
1288
- $access_level,
1289
- 'learn-press/course-access-levels'
1290
- );
1291
- }
1292
-
1293
- return apply_filters( 'learn-press/course-access-level', $access_level, $course_id, $this->get_id() );
1294
- }*/
1295
-
1296
- /**
1297
- * @editor tungnx
1298
- * @reason comment - not use
1299
- * @modify 4.1.2
1300
- */
1301
- /*public function get_item_access_level( $item_id, $course_id ) {
1302
- $access_level = 0;
1303
-
1304
- if ( $course = learn_press_get_course( $course_id ) ) {
1305
- if ( $course->has_item( $item_id ) ) {
1306
- if ( 10 < $this->get_course_access_level( $course_id ) ) {
1307
- $access_level = 10;
1308
- } else {
1309
- $item = $course->get_item( $item_id );
1310
- if ( $item->is_preview() ) {
1311
- $access_level = 10;
1312
- }
1313
- }
1314
- }
1315
- }
1316
-
1317
- return apply_filters(
1318
- 'learn-press/course-item-access-level',
1319
- $access_level,
1320
- $item_id,
1321
- $course_id,
1322
- $this->get_id()
1323
- );
1324
- }*/
1325
-
1326
- /**
1327
- * Set new access-level of an user with a course.
1328
- *
1329
- * @param int $access_level
1330
- * @param int $course_id
1331
- *
1332
- * @return mixed
1333
- * @since 3.1.0
1334
- * @editor tungnx
1335
- * @reason comment - not use
1336
- * @modify 4.1.2
1337
- */
1338
- /*public function set_course_access_level( $access_level, $course_id ) {
1339
- if ( $access_level !== $this->get_course_access_level( $course_id ) ) {
1340
- LP_Object_Cache::set(
1341
- 'course-' . $course_id . '-' . $this->get_id(),
1342
- $access_level,
1343
- 'learn-press/course-access-levels'
1344
- );
1345
- }
1346
-
1347
- return $access_level;
1348
- }*/
1349
-
1350
- /**
1351
- * Check if user have an access-level.
1352
- * Consider the passed access-level is max level user have.
1353
- *
1354
- * @param int[] $access_level
1355
- * @param int $course_id
1356
- * @param string $compare
1357
- *
1358
- * @return bool
1359
- * @since 3.1.0
1360
- * @editor tungnx
1361
- * @modify 4.1.3 - not - use
1362
- */
1363
- /*public function has_course_access_level( $access_level, $course_id, $compare = '<=' ) {
1364
- $user_access_level = $this->get_course_access_level( $course_id );
1365
-
1366
- switch ( $compare ) {
1367
- case 'any':
1368
- settype( $access_level, 'array' );
1369
- $has = in_array( $user_access_level, $access_level );
1370
- break;
1371
- default:
1372
- $has = version_compare( $user_access_level, $access_level );
1373
- }
1374
-
1375
- return $has;
1376
- }*/
1377
-
1378
- /**
1379
- * Check if user has an access-level with a course.
1380
- *
1381
- * @param int $access_level
1382
- * @param int $course_id
1383
- *
1384
- * @return bool
1385
- * @since 3.1.0
1386
- * @editor tungnx
1387
- * @modify 4.1.2
1388
- * @reason comment - not use
1389
- */
1390
- /*public function is_access_level( $access_level, $course_id ) {
1391
- $user_access_level = $this->get_course_access_level( $course_id );
1392
-
1393
- return $user_access_level === $access_level;
1394
- }*/
1395
-
1396
- /**
1397
- * Check if user is already ordered a course.
1398
- *
1399
- * @param int $course_id
1400
- *
1401
- * @return mixed|LP_Order
1402
- * @editor tungnx
1403
- * @modify 4.1.3 - comment - not use
1404
- */
1405
- /*public function has_ordered_course( $course_id ) {
1406
- $return = apply_filters(
1407
- 'learn-press/user-has-ordered-course',
1408
- $this->get_course_order( $course_id ),
1409
- $course_id,
1410
- $this->get_id()
1411
- );
1412
-
1413
- // Deprecated since 3.0.0
1414
- $return = apply_filters( 'learn_press_user_has_ordered_course', $return, $course_id, $this->get_id() );
1415
-
1416
- return $return;
1417
- }*/
1418
-
1419
  /**
1420
  * Get order status of a course.
1421
  *
@@ -1520,140 +1059,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1520
  return $lp_order;
1521
  }
1522
 
1523
- /**
1524
- * Enroll this user to a course.
1525
- *
1526
- * @param int $course_id
1527
- * @param int $order_id - Optional. An user can be enrolled to a course
1528
- *
1529
- * @return bool|WP_Error
1530
- * @throws Exception
1531
- * @since 3.3.0
1532
- * @editor tungnx
1533
- * @version 3.3.1
1534
- * @modify 4.1.3 - comment - not use
1535
- */
1536
- // public function enroll_course( int $course_id = 0, int $order_id = 0 ) {
1537
- // $lp_user_items_db = LP_User_Items_DB::getInstance();
1538
- //
1539
- // try {
1540
- // /*$user_item_api = new LP_User_Item_CURD();
1541
- // $find_query = array(
1542
- // 'item_id' => $course_id,
1543
- // 'user_id' => $this->get_id(),
1544
- // );
1545
- //
1546
- // if ( $order_id ) {
1547
- // $find_query['ref_id'] = $order_id;
1548
- // }*/
1549
- //
1550
- // $filter = new LP_User_Items_Filter();
1551
- // $filter->user_id = get_current_user_id();
1552
- // $filter->item_id = $course_id;
1553
- // $course_item = $lp_user_items_db->get_last_user_course( $filter );
1554
- //
1555
- // if ( ! $course_item ) {
1556
- // $course_item = LP_User_Item::get_empty_item();
1557
- // } else {
1558
- // $course_item = (array) $course_item;
1559
- // }
1560
- //
1561
- // $user_id = $this->get_id();
1562
- //
1563
- // $course_item['user_id'] = $user_id;
1564
- // $course_item['item_id'] = $course_id;
1565
- // $course_item['item_type'] = learn_press_get_post_type( $course_id );
1566
- // $course_item['ref_id'] = $order_id;
1567
- // $course_item['ref_type'] = ( $order_id != 0 ) ? learn_press_get_post_type( $order_id ) : '';
1568
- // $course_item['start_time'] = current_time( 'mysql', true );
1569
- // $course_item['access_level'] = 50;
1570
- //
1571
- // /**
1572
- // * @editor tungnx
1573
- // * @fixed: case no auto enroll
1574
- // */
1575
- // if ( 'yes' == LP_Settings::get_option( 'auto_enroll' ) ) {
1576
- // $course_item['graduation'] = 'in-progress';
1577
- // }
1578
- //
1579
- // $user_course = new LP_User_Item_Course( $course_item );
1580
- // $user_course->set_status( LP_COURSE_PURCHASED );
1581
- //
1582
- // if ( ! $user_course->update( true ) ) {
1583
- // throw new Exception( __( 'Update user item error.', 'learnpress' ) );
1584
- // }
1585
- //
1586
- // /*$user_id = is_user_logged_in() ? $this->get_id() : 0;
1587
- //
1588
- // global $wpdb;
1589
- // $query = $wpdb->prepare(
1590
- // "
1591
- // UPDATE {$wpdb->learnpress_user_items}
1592
- // SET access_level = %d
1593
- // WHERE user_id = %d
1594
- // AND item_id = %d
1595
- // AND user_item_id NOT IN(%d)
1596
- // ",
1597
- // 0,
1598
- // $user_id,
1599
- // $course_id,
1600
- // $user_course->get_user_item_id()
1601
- // );
1602
- // $wpdb->query( $query );*/
1603
- //
1604
- // $return = $user_course->get_user_item_id();
1605
- // } catch ( Exception $ex ) {
1606
- // error_log( $ex->getMessage() );
1607
- // return false;
1608
- // }
1609
- //
1610
- // return $return;
1611
- // }
1612
-
1613
- /**
1614
- * Enroll this user to a course.
1615
- *
1616
- * @param int $course_id
1617
- * @param int $order_id
1618
- * @param bool $force - Optional. Force create db record for preview quiz case
1619
- * @param bool $wp_error - Optional. TRUE will return WP_Error object if there is an error.
1620
- * @editor tungnx - comment - not use
1621
- * @return bool|mixed|WP_Error
1622
- */
1623
- /*public function enroll( $course_id, $order_id, $force = false, $wp_error = false ) {
1624
- global $wpdb;
1625
-
1626
- _deprecated_function( __FUNCTION__, '4.1.0' );
1627
-
1628
- try {
1629
- $course = learn_press_get_course( $course_id );
1630
- $user_id = $this->get_id();
1631
-
1632
- if ( $course->is_required_enroll() && ! $force ) {
1633
- $order = learn_press_get_order( $order_id );
1634
-
1635
- if ( ! $order ) {
1636
- throw new Exception( __( 'Failed to enroll course.', 'learnpress' ), 10000 );
1637
- }
1638
-
1639
- if ( ! $this->can_enroll_course( $course_id ) ) {
1640
- throw new Exception( __( 'Failed to enroll course.', 'learnpress' ), 10001 );
1641
- }
1642
-
1643
- if ( ! $this->get_id() ) {
1644
- throw new Exception( __( 'Please login to enroll course.', 'learnpress' ), 10002 );
1645
- }
1646
- }
1647
-
1648
- $return = $this->enroll_course( $course_id, $order_id, false, $wp_error );
1649
-
1650
- return $return;
1651
-
1652
- } catch ( Exception $ex ) {
1653
- return new WP_Error( $ex->getCode(), $ex->getMessage() );
1654
- }
1655
- }*/
1656
-
1657
  /**
1658
  * @param $question_id
1659
  *
@@ -1726,35 +1131,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1726
  return $answered ? array_key_exists( $question_id, $answered ) : false;
1727
  }
1728
 
1729
- /**
1730
- * @param array $args
1731
- *
1732
- * @return LP_Query_List_Table
1733
- * @editor tungnx
1734
- * @deprecated 4.1.6
1735
- */
1736
- /*public function get_purchased_courses( array $args = array() ): LP_Query_List_Table {
1737
- $filter = new LP_User_Items_Filter();
1738
- $filter->fields = array( 'item_id' );
1739
- $filter->user_id = $this->get_id();
1740
- $filter->status = $args['status'] ?? '';
1741
- $filter->page = $args['paged'] ?? 1;
1742
- $filter->limit = $args['limit'] ?? $filter->limit;
1743
- $total_rows = 0;
1744
- $result_courses = LP_User_Item_Course::get_user_courses( $filter, $total_rows );
1745
-
1746
- $course_ids = LP_Course::get_course_ids( $result_courses, 'item_id' );
1747
-
1748
- $courses = array(
1749
- 'total' => $total_rows,
1750
- 'paged' => $filter->page,
1751
- 'limit' => $filter->limit,
1752
- 'items' => $course_ids,
1753
- );
1754
-
1755
- return new LP_Query_List_Table( $courses );
1756
- }*/
1757
-
1758
  /**
1759
  * @return array
1760
  */
@@ -1884,36 +1260,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1884
  return apply_filters( 'learn-press/user-profile-socials', $socials, $this->get_id(), $this );
1885
  }
1886
 
1887
- /**
1888
- * Check if user can access to a course.
1889
- *
1890
- * @param int $course_id
1891
- *
1892
- * @return mixed
1893
- * @editor tungnx
1894
- * @modify 4.1.3 - comment - not use
1895
- */
1896
- /*public function can_access_course( $course_id ) {
1897
-
1898
- $accessible = $this->has_course_access_level(
1899
- array(
1900
- LP_COURSE_ACCESS_LEVEL_60,
1901
- LP_COURSE_ACCESS_LEVEL_70,
1902
- ),
1903
- $course_id,
1904
- 'any'
1905
- );
1906
-
1907
- $accessible = apply_filters(
1908
- 'learn-press/user-can-access-course',
1909
- $accessible,
1910
- $course_id,
1911
- $this->get_id()
1912
- );
1913
-
1914
- return $accessible;
1915
- }*/
1916
-
1917
  /**
1918
  * Check course of user has graduation is in-progress
1919
  *
@@ -1940,11 +1286,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1940
  public function can_do_quiz( $quiz_id, $course_id = 0 ) {
1941
  $course = learn_press_get_course( $course_id );
1942
 
1943
- if ( $course->is_required_enroll() ) {
1944
- $can = $this->has_course_status(
1945
- $course_id,
1946
- array( 'enrolled' )
1947
- ) && ! $this->has_started_quiz( $quiz_id, $course_id );
1948
  } else {
1949
  $can = ! $this->has_started_quiz( $quiz_id, $course_id );
1950
  }
@@ -1952,26 +1295,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1952
  return apply_filters( 'learn_press_user_can_do_quiz', $can, $quiz_id, $this->get_id(), $course_id );
1953
  }
1954
 
1955
- /**
1956
- * @depecated 4.1.6.9.2
1957
- */
1958
- /*public function evaluate_course_results( $course_id ) {
1959
- $user_course = $this->get_course_data( $course_id );
1960
-
1961
- return isset( $user_course ) ? $user_course->get_results( 'result' ) : 0;
1962
- }*/
1963
-
1964
- /**
1965
- * @editor tungnx
1966
- * @modify 4.1.4.1 - comment - not use
1967
- */
1968
- /*public function has_reached_passing_condition( $course_id ) {
1969
- $course = learn_press_get_course( $course_id );
1970
- $result = $this->evaluate_course_results( $course_id );
1971
-
1972
- return $return = $result >= $course->get_passing_condition();
1973
- }*/
1974
-
1975
  /**
1976
  * Check if all items in course completed.
1977
  *
337
  return $records;
338
  }
339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  /**
341
  * Check quiz can retake?
342
  *
466
  return apply_filters( 'learn-press/user-item-status', $status, $item_id, $this->get_id(), $course_id );
467
  }
468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  /**
470
  * Checks if has status of a quiz for user
471
  *
525
  return $result;
526
  }
527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  /**
529
  * Mark question that user has checked.
530
  *
566
  return $remain;
567
  }
568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  public function get_quiz_last_results( $quiz_id ) {
570
  $results = $this->get_course_info( $quiz_id );
571
  if ( $results ) {
688
  return false;
689
  }
690
 
 
 
 
 
 
 
 
 
 
691
  /**
692
  * Finish course
693
  *
841
  *
842
  * @param int $lesson_id
843
  * @param int $course_id
 
844
  *
845
  * @return bool|WP_Error
846
  */
847
+ public function complete_lesson( $lesson_id = 0, $course_id = 0 ) {
848
+ $result = true;
849
+
850
  try {
851
+ $course = learn_press_get_course( $course_id );
852
+ if ( ! $course ) {
853
+ throw new Exception( __( 'Invalid course', 'learnpress' ) );
854
+ }
855
 
856
  $course_data = $this->get_course_data( $course_id );
857
+ if ( ! $course_data ) {
858
+ throw new Exception( __( 'You must enroll course!', 'learnpress' ) );
859
+ }
860
 
861
  /**
862
  * If user has stared a lesson, get user lesson information
863
  */
864
  $item = $course_data->get_item( $lesson_id );
865
+ if ( ! $item ) {
866
+ throw new Exception( __( 'Invalid lesson', 'learnpress' ) );
867
+ }
 
 
 
 
868
 
869
+ if ( $item->is_completed() ) {
870
+ throw new Exception( __( 'You have already completed this lesson.', 'learnpress' ) );
871
+ }
872
 
873
+ $item->set_end_time( time() );
874
+ $item->set_status( 'completed' );
875
+ $item->set_graduation( 'passed' );
876
 
877
+ $updated = $item->update();
 
 
 
 
 
878
 
879
  do_action( 'learn-press/user-completed-lesson', $lesson_id, $course_id, $this->get_id() );
880
+ } catch ( Throwable $e ) {
881
+ $result = new WP_Error( 'error_lesson_complete', $e->getMessage() );
882
  }
883
 
884
  return $result;
955
  return apply_filters( 'learn-press/user-course-status', $status, $course_id, $this->get_id() );
956
  }
957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
  /**
959
  * Get order status of a course.
960
  *
1059
  return $lp_order;
1060
  }
1061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
  /**
1063
  * @param $question_id
1064
  *
1131
  return $answered ? array_key_exists( $question_id, $answered ) : false;
1132
  }
1133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
  /**
1135
  * @return array
1136
  */
1260
  return apply_filters( 'learn-press/user-profile-socials', $socials, $this->get_id(), $this );
1261
  }
1262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1263
  /**
1264
  * Check course of user has graduation is in-progress
1265
  *
1286
  public function can_do_quiz( $quiz_id, $course_id = 0 ) {
1287
  $course = learn_press_get_course( $course_id );
1288
 
1289
+ if ( ! $course->is_no_required_enroll() ) {
1290
+ $can = $this->has_course_status( $course_id, array( 'enrolled' ) ) && ! $this->has_started_quiz( $quiz_id, $course_id );
 
 
 
1291
  } else {
1292
  $can = ! $this->has_started_quiz( $quiz_id, $course_id );
1293
  }
1295
  return apply_filters( 'learn_press_user_can_do_quiz', $can, $quiz_id, $this->get_id(), $course_id );
1296
  }
1297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1298
  /**
1299
  * Check if all items in course completed.
1300
  *
inc/user/class-lp-profile-tabs.php CHANGED
@@ -228,7 +228,12 @@ class LP_Profile_Tabs extends LP_Array_Access {
228
  }
229
  }
230
 
231
- $args = array_map( '_learn_press_urlencode', $args );
 
 
 
 
 
232
  $profile_link = trailingslashit( learn_press_get_page_link( 'profile' ) );
233
 
234
  if ( $profile_link ) {
228
  }
229
  }
230
 
231
+ /*$args = array_map(
232
+ function ( $string ) {
233
+ return preg_replace( '/\s/', '+', $string );
234
+ },
235
+ $args
236
+ );*/
237
  $profile_link = trailingslashit( learn_press_get_page_link( 'profile' ) );
238
 
239
  if ( $profile_link ) {
inc/user/class-lp-profile.php CHANGED
@@ -95,7 +95,7 @@ if ( ! class_exists( 'LP_Profile' ) ) {
95
  * requesting from user profile.
96
  */
97
  foreach ( $this->_default_actions as $action => $message ) {
98
- LP_Request_Handler::register( 'save-profile-' . $action, array( $this, 'save' ) );
99
  }
100
  }
101
 
95
  * requesting from user profile.
96
  */
97
  foreach ( $this->_default_actions as $action => $message ) {
98
+ LP_Request::register( 'save-profile-' . $action, array( $this, 'save' ) );
99
  }
100
  }
101
 
inc/user/lp-user-functions.php CHANGED
@@ -74,9 +74,13 @@ function learn_press_get_user_item_id( $user_id, $item_id, $course_id = 0 /* add
74
  *
75
  * @return int
76
  */
77
- function learn_press_get_current_user_id() {
78
  $user = learn_press_get_current_user();
79
 
 
 
 
 
80
  return $user->get_id();
81
  }
82
 
@@ -114,19 +118,19 @@ if ( ! function_exists( 'learn_press_get_user' ) ) {
114
  */
115
  function learn_press_get_user( $user_id, $current = false, $force_new = false ) {
116
  $is_guest = false;
117
- if ( ! is_null( LP()->session ) && $user_id != LP()->session->guest_user_id ) {
118
  if ( $current && ! get_user_by( 'id', $user_id ) ) {
119
  $user_id = get_current_user_id();
120
  }
121
  }
122
 
123
- if ( ! $user_id && isset( LP()->session ) ) {
124
- if ( ! LP()->session->guest_user_id ) {
125
- LP()->session->set_customer_session_cookie( 1 );
126
- LP()->session->guest_user_id = time();
127
  }
128
 
129
- $user_id = LP()->session->guest_user_id;
130
  $is_guest = true;
131
  }
132
 
@@ -1013,114 +1017,6 @@ function learn_press_get_user_option( $name, $id = 0 ) {
1013
  return false;
1014
  }
1015
 
1016
- /**
1017
- * Check and update user information from request in user profile page
1018
- */
1019
- function learn_press_update_user_profile() {
1020
-
1021
- if ( ! LP()->is_request( 'post' ) ) {
1022
- return;
1023
- }
1024
- $nonce = learn_press_get_request( 'profile-nonce' );
1025
-
1026
- if ( ! wp_verify_nonce( $nonce, 'learn-press-update-user-profile-' . get_current_user_id() ) ) {
1027
- return;
1028
- }
1029
- $section = learn_press_get_request( 'lp-profile-section' );
1030
-
1031
- do_action( 'learn_press_update_user_profile_' . $section );
1032
- do_action( 'learn_press_update_user_profile', $section );
1033
- }
1034
-
1035
- // add_action( 'init', 'learn_press_update_user_profile' );
1036
-
1037
- // /**
1038
- // * Update user avatar
1039
- // */
1040
- // function learn_press_update_user_profile_avatar() {
1041
- // $user_id = get_current_user_id();
1042
- // $data = learn_press_get_request( 'lp-user-avatar-crop' );
1043
-
1044
- // if ( ! $user_id ) {
1045
- // return new WP_Error( 2, 'User is invalid!' );
1046
- // }
1047
-
1048
- // $upload_dir = learn_press_user_profile_picture_upload_dir();
1049
-
1050
- // if ( learn_press_get_request( 'lp-user-avatar-custom' ) != 'yes' ) {
1051
- // delete_user_meta( get_current_user_id(), '_lp_profile_picture' );
1052
-
1053
- // return false;
1054
- // }
1055
-
1056
- // $path_img = get_user_meta( $user_id, '_lp_profile_picture', true );
1057
-
1058
- // $path = $upload_dir['basedir'] . $path_img;
1059
-
1060
- // if ( ! file_exists( $path ) ) {
1061
- // return false;
1062
- // }
1063
-
1064
- // $filetype = wp_check_filetype( $path );
1065
-
1066
- // if ( 'jpeg' == $filetype['ext'] ) {
1067
- // $im = imagecreatefromjpeg( $path );
1068
- // } elseif ( 'png' == $filetype['ext'] ) {
1069
- // $im = imagecreatefrompng( $path );
1070
- // }
1071
-
1072
- // if ( ! isset( $im ) ) {
1073
- // return false;
1074
- // }
1075
-
1076
- // $points = explode( ',', $data['points'] );
1077
- // $im_crop = imagecreatetruecolor( $data['width'], $data['height'] );
1078
-
1079
- // if ( ! $im ) {
1080
- // return false;
1081
- // }
1082
-
1083
- // $dst_x = 0;
1084
- // $dst_y = 0;
1085
- // $dst_w = $data['width'];
1086
- // $dst_h = $data['height'];
1087
- // $src_x = $points[0];
1088
- // $src_y = $points[1];
1089
- // $src_w = $points[2] - $points[0];
1090
- // $src_h = $points[3] - $points[1];
1091
-
1092
- // imagecopyresampled( $im_crop, $im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
1093
-
1094
- // $newname = md5( $user_id . microtime( true ) );
1095
- // $output = dirname( $path );
1096
-
1097
- // if ( 'jpeg' == $filetype['ext'] ) {
1098
- // $newname .= '.jpeg';
1099
- // $output .= '/' . $newname;
1100
- // imagejpeg( $im_crop, $output );
1101
- // } elseif ( 'png' == $filetype['ext'] ) {
1102
- // $newname .= '.png';
1103
- // $output .= '/' . $newname;
1104
- // imagepng( $im_crop, $output );
1105
- // }
1106
-
1107
- // $new_avatar = false;
1108
-
1109
- // if ( file_exists( $output ) ) {
1110
- // $new_avatar = preg_replace( '!^/!', '', $upload_dir['subdir'] ) . '/' . $newname;
1111
- // update_user_meta( $user_id, '_lp_profile_picture', '/' . $new_avatar );
1112
- // update_user_meta( $user_id, '_lp_profile_picture_changed', 'yes' );
1113
-
1114
- // $new_avatar = $upload_dir['baseurl'] . '/' . $new_avatar;
1115
- // }
1116
-
1117
- // @unlink( $path );
1118
-
1119
- // return $new_avatar;
1120
- // }
1121
-
1122
- // add_action( 'learn_press_update_user_profile_avatar', 'learn_press_update_user_profile_avatar' );
1123
-
1124
  /**
1125
  * Update user basic information.
1126
  *
@@ -1389,7 +1285,13 @@ function learn_press_user_profile_link( $user_id = 0, $tab = null ) {
1389
  unset( $args['user'] );
1390
  }
1391
  }
1392
- $args = array_map( '_learn_press_urlencode', $args );
 
 
 
 
 
 
1393
  $profile_link = trailingslashit( learn_press_get_page_link( 'profile' ) );
1394
  if ( $profile_link ) {
1395
  if ( get_option( 'permalink_structure' ) /*&& learn_press_get_page_id( 'profile' )*/ ) {
@@ -1444,7 +1346,7 @@ function learn_press_get_user_distraction() {
1444
  if ( is_user_logged_in() ) {
1445
  return get_user_option( 'distraction_mode', get_current_user_id() );
1446
  } else {
1447
- return LP()->session->distraction_mode;
1448
  }
1449
  }
1450
 
74
  *
75
  * @return int
76
  */
77
+ function learn_press_get_current_user_id(): int {
78
  $user = learn_press_get_current_user();
79
 
80
+ if ( ! $user ) {
81
+ return 0;
82
+ }
83
+
84
  return $user->get_id();
85
  }
86
 
118
  */
119
  function learn_press_get_user( $user_id, $current = false, $force_new = false ) {
120
  $is_guest = false;
121
+ if ( ! is_null( LearnPress::instance()->session ) && $user_id != LearnPress::instance()->session->guest_user_id ) {
122
  if ( $current && ! get_user_by( 'id', $user_id ) ) {
123
  $user_id = get_current_user_id();
124
  }
125
  }
126
 
127
+ if ( ! $user_id && isset( LearnPress::instance()->session ) ) {
128
+ if ( ! LearnPress::instance()->session->guest_user_id ) {
129
+ LearnPress::instance()->session->set_customer_session_cookie( 1 );
130
+ LearnPress::instance()->session->guest_user_id = time();
131
  }
132
 
133
+ $user_id = LearnPress::instance()->session->guest_user_id;
134
  $is_guest = true;
135
  }
136
 
1017
  return false;
1018
  }
1019
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1020
  /**
1021
  * Update user basic information.
1022
  *
1285
  unset( $args['user'] );
1286
  }
1287
  }
1288
+
1289
+ /*$args = array_map(
1290
+ function ( $string ) {
1291
+ return preg_replace( '/\s/', '+', $string );
1292
+ },
1293
+ $args
1294
+ );*/
1295
  $profile_link = trailingslashit( learn_press_get_page_link( 'profile' ) );
1296
  if ( $profile_link ) {
1297
  if ( get_option( 'permalink_structure' ) /*&& learn_press_get_page_id( 'profile' )*/ ) {
1346
  if ( is_user_logged_in() ) {
1347
  return get_user_option( 'distraction_mode', get_current_user_id() );
1348
  } else {
1349
+ return LearnPress::instance()->session->distraction_mode;
1350
  }
1351
  }
1352
 
inc/widgets/course-extra.php CHANGED
@@ -82,13 +82,13 @@ if ( ! class_exists( 'LP_Widget_Course_Extra' ) ) {
82
  <?php
83
  switch ( $instance['type'] ) {
84
  case 'key_features':
85
- LP()->template( 'course' )->course_extra_key_features( $course_id );
86
  break;
87
  case 'target_audience':
88
- LP()->template( 'course' )->course_extra_target_audiences( $course_id );
89
  break;
90
  case 'requirements':
91
- LP()->template( 'course' )->course_extra_requirements( $course_id );
92
  break;
93
  }
94
  ?>
82
  <?php
83
  switch ( $instance['type'] ) {
84
  case 'key_features':
85
+ LearnPress::instance()->template( 'course' )->course_extra_key_features( $course_id );
86
  break;
87
  case 'target_audience':
88
+ LearnPress::instance()->template( 'course' )->course_extra_target_audiences( $course_id );
89
  break;
90
  case 'requirements':
91
+ LearnPress::instance()->template( 'course' )->course_extra_requirements( $course_id );
92
  break;
93
  }
94
  ?>
languages/learnpress.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the LearnPress plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: LearnPress 4.1.6.9.4-beta-2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/lp-doing\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-08-29T09:58:18+03:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: learnpress\n"
@@ -162,18 +162,18 @@ msgstr ""
162
 
163
  #: config/settings/course.php:138
164
  #: inc/admin/settings/class-lp-settings-advanced.php:72
165
- #: inc/course/lp-course-functions.php:449
166
  #: inc/custom-post-types/lesson.php:158
167
- #: inc/lp-template-functions.php:1009
168
  msgid "Lesson"
169
  msgstr ""
170
 
171
  #: config/settings/course.php:146
172
  #: inc/admin/settings/class-lp-settings-advanced.php:79
173
- #: inc/course/lp-course-functions.php:450
174
  #: inc/custom-post-types/question.php:320
175
  #: inc/custom-post-types/quiz.php:87
176
- #: inc/lp-template-functions.php:999
177
  #: templates/profile/tabs/quizzes.php:54
178
  msgid "Quiz"
179
  msgstr ""
@@ -265,7 +265,7 @@ msgstr ""
265
 
266
  #: config/settings/general.php:105
267
  #: inc/admin/settings/class-lp-settings-advanced.php:56
268
- #: inc/admin/views/addons/html-themes.php:35
269
  msgid "Other"
270
  msgstr ""
271
 
@@ -432,7 +432,7 @@ msgstr ""
432
  #: inc/admin/class-lp-admin.php:249
433
  #: inc/admin/views/meta-boxes/fields/date.php:39
434
  #: inc/class-lp-assets.php:73
435
- #: inc/lp-core-functions.php:3039
436
  #: inc/order/class-lp-order.php:954
437
  #: assets/js/dist/frontend/quiz.min.js:44
438
  msgid "Cancel"
@@ -478,9 +478,9 @@ msgstr ""
478
  #: inc/admin/settings/class-lp-settings-profile.php:150
479
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:21
480
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:28
481
- #: inc/class-lp-page-controller.php:284
 
482
  #: inc/custom-post-types/course.php:107
483
- #: inc/custom-post-types/course.php:109
484
  #: inc/lp-template-functions.php:312
485
  #: inc/settings/class-lp-settings-courses.php:16
486
  #: inc/user/class-lp-profile.php:246
@@ -586,24 +586,24 @@ msgstr ""
586
  msgid "Edit"
587
  msgstr ""
588
 
589
- #: inc/admin/class-lp-install-sample-data.php:190
590
  msgid "No data sample."
591
  msgstr ""
592
 
593
- #: inc/admin/class-lp-install-sample-data.php:211
594
  msgid "Delete sample data successfully!"
595
  msgstr ""
596
 
597
- #: inc/admin/class-lp-install-sample-data.php:357
598
  msgid "Sample course"
599
  msgstr ""
600
 
601
- #: inc/admin/class-lp-install-sample-data.php:705
602
  msgctxt "install-sample-course"
603
  msgid "[TRUE] - "
604
  msgstr ""
605
 
606
- #: inc/admin/class-lp-install-sample-data.php:713
607
  msgctxt "install-sample-course"
608
  msgid " [TRUE] - "
609
  msgstr ""
@@ -630,13 +630,13 @@ msgstr ""
630
 
631
  #: inc/admin/class-lp-modal-search-items.php:183
632
  #: inc/admin/class-lp-modal-search-users.php:141
633
- #: inc/lp-core-functions.php:659
634
  msgid "<"
635
  msgstr ""
636
 
637
  #: inc/admin/class-lp-modal-search-items.php:184
638
  #: inc/admin/class-lp-modal-search-users.php:142
639
- #: inc/lp-core-functions.php:660
640
  msgid ">"
641
  msgstr ""
642
 
@@ -716,7 +716,7 @@ msgstr ""
716
 
717
  #: inc/admin/class-lp-plugin-install-list-table.php:483
718
  #: inc/class-lp-datetime.php:209
719
- #: inc/custom-post-types/order.php:758
720
  #: inc/order/class-lp-order.php:150
721
  #: inc/user-item/class-lp-user-item.php:240
722
  msgid "%s ago"
@@ -774,32 +774,32 @@ msgctxt "static-page"
774
  msgid "LP Terms and Conditions"
775
  msgstr ""
776
 
777
- #: inc/admin/class-lp-setup-wizard.php:216
778
  msgid "Welcome"
779
  msgstr ""
780
 
781
- #: inc/admin/class-lp-setup-wizard.php:218
782
  msgid "Run Setup Wizard"
783
  msgstr ""
784
 
785
- #: inc/admin/class-lp-setup-wizard.php:221
786
  msgid "Pages"
787
  msgstr ""
788
 
789
- #: inc/admin/class-lp-setup-wizard.php:231
790
  #: inc/admin/meta-box/fields/payment-order.php:7
791
  #: inc/admin/views/setup/steps/payment.php:16
792
  #: templates/checkout/payment.php:25
793
  msgid "Payment"
794
  msgstr ""
795
 
796
- #: inc/admin/class-lp-setup-wizard.php:239
797
  #: inc/admin/views/setup/content.php:67
798
  #: inc/admin/views/setup/steps/finish.php:12
799
  msgid "Finish"
800
  msgstr ""
801
 
802
- #: inc/admin/class-lp-setup-wizard.php:356
803
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:92
804
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:96
805
  msgid "PayPal"
@@ -871,7 +871,7 @@ msgid "Buy Now"
871
  msgstr ""
872
 
873
  #: inc/admin/lp-admin-actions.php:222
874
- #: inc/custom-post-types/course.php:495
875
  msgid "Categories"
876
  msgstr ""
877
 
@@ -1001,8 +1001,8 @@ msgstr ""
1001
  #: inc/admin/views/statistics/general.php:8
1002
  #: inc/admin/views/statistics/orders.php:8
1003
  #: inc/admin/views/statistics/users.php:8
1004
- #: inc/custom-post-types/course.php:474
1005
- #: inc/custom-post-types/course.php:491
1006
  msgid "Students"
1007
  msgstr ""
1008
 
@@ -1028,15 +1028,15 @@ msgstr ""
1028
 
1029
  #: inc/admin/lp-admin-functions.php:1243
1030
  #: inc/admin/lp-admin-functions.php:2317
1031
- #: inc/course/abstract-course.php:721
1032
- #: inc/course/abstract-course.php:750
1033
  #: templates/order/order-details.php:43
1034
  msgid "Free"
1035
  msgstr ""
1036
 
1037
  #: inc/admin/lp-admin-functions.php:1444
1038
  #: inc/user-item/class-lp-user-item-quiz.php:146
1039
- #: inc/user-item/class-lp-user-item.php:806
1040
  #: templates/content-lesson/button-complete.php:37
1041
  msgid "Completed"
1042
  msgstr ""
@@ -1182,7 +1182,7 @@ msgid "ID"
1182
  msgstr ""
1183
 
1184
  #: inc/admin/meta-box/fields/payment-order.php:10
1185
- #: inc/emails/class-lp-email.php:1030
1186
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:315
1187
  msgid "Enable/Disable"
1188
  msgstr ""
@@ -1262,7 +1262,7 @@ msgid "This section lets you customize the LearnPress emails"
1262
  msgstr ""
1263
 
1264
  #: inc/admin/settings/class-lp-settings-emails.php:136
1265
- #: inc/emails/class-lp-email.php:1062
1266
  msgid "Content type"
1267
  msgstr ""
1268
 
@@ -1332,23 +1332,23 @@ msgid "Enable default fields"
1332
  msgstr ""
1333
 
1334
  #: inc/admin/settings/class-lp-settings-profile.php:89
1335
- #: inc/user/lp-user-functions.php:1946
1336
- #: inc/user/lp-user-functions.php:1948
1337
  #: templates/profile/tabs/settings/basic-information.php:33
1338
  msgid "First name"
1339
  msgstr ""
1340
 
1341
  #: inc/admin/settings/class-lp-settings-profile.php:96
1342
- #: inc/user/lp-user-functions.php:1959
1343
- #: inc/user/lp-user-functions.php:1961
1344
  #: templates/profile/tabs/settings/basic-information.php:39
1345
  msgid "Last name"
1346
  msgstr ""
1347
 
1348
  #: inc/admin/settings/class-lp-settings-profile.php:103
1349
  #: inc/admin/settings/class-lp-settings-profile.php:115
1350
- #: inc/user/lp-user-functions.php:1972
1351
- #: inc/user/lp-user-functions.php:1974
1352
  #: templates/profile/tabs/settings/basic-information.php:45
1353
  msgid "Display name"
1354
  msgstr ""
@@ -1417,9 +1417,9 @@ msgstr ""
1417
  #: inc/admin/settings/class-lp-settings-profile.php:166
1418
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:22
1419
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:29
1420
- #: inc/custom-post-types/order.php:819
1421
- #: inc/custom-post-types/order.php:820
1422
  #: inc/custom-post-types/order.php:824
 
1423
  #: inc/user/class-lp-profile.php:260
1424
  msgid "Orders"
1425
  msgstr ""
@@ -1434,7 +1434,7 @@ msgstr ""
1434
  #: inc/admin/settings/class-lp-settings-profile.php:188
1435
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:18
1436
  #: inc/user/class-lp-profile.php:274
1437
- #: learnpress.php:479
1438
  msgid "Settings"
1439
  msgstr ""
1440
 
@@ -1493,7 +1493,7 @@ msgid "Reset Password"
1493
  msgstr ""
1494
 
1495
  #: inc/admin/sub-menus/class-lp-submenu-addons.php:14
1496
- #: learnpress.php:481
1497
  msgid "Add-ons"
1498
  msgstr ""
1499
 
@@ -1501,19 +1501,19 @@ msgstr ""
1501
  msgid "LearnPress Add-ons"
1502
  msgstr ""
1503
 
1504
- #: inc/admin/sub-menus/class-lp-submenu-addons.php:25
1505
  msgid "Get more (%d)"
1506
  msgstr ""
1507
 
1508
- #: inc/admin/sub-menus/class-lp-submenu-addons.php:26
1509
  msgid "Installed (%d)"
1510
  msgstr ""
1511
 
1512
- #: inc/admin/sub-menus/class-lp-submenu-addons.php:27
1513
  msgid "Themes (%d)"
1514
  msgstr ""
1515
 
1516
- #: inc/admin/sub-menus/class-lp-submenu-addons.php:55
1517
  msgid "Search..."
1518
  msgstr ""
1519
 
@@ -1569,28 +1569,23 @@ msgstr ""
1569
  msgid "Installed add-ons"
1570
  msgstr ""
1571
 
1572
- #: inc/admin/views/addons/html-plugins-more.php:16
1573
- #: inc/admin/views/addons/html-themes.php:16
1574
- msgid "Last checked %1$s. <a href=\"%2$s\">Check again</a>"
1575
- msgstr ""
1576
-
1577
- #: inc/admin/views/addons/html-plugins-more.php:27
1578
  msgid "There is no available add-ons."
1579
  msgstr ""
1580
 
1581
- #: inc/admin/views/addons/html-plugins-more.php:35
1582
  msgid "Free add-ons"
1583
  msgstr ""
1584
 
1585
- #: inc/admin/views/addons/html-plugins-more.php:40
1586
  msgid "Premium add-ons"
1587
  msgstr ""
1588
 
1589
- #: inc/admin/views/addons/html-themes.php:25
1590
  msgid "No related themes."
1591
  msgstr ""
1592
 
1593
- #: inc/admin/views/addons/html-themes.php:31
1594
  msgid "Education Support"
1595
  msgstr ""
1596
 
@@ -1611,7 +1606,7 @@ msgstr ""
1611
 
1612
  #: inc/admin/views/course/modal-choose-items.php:54
1613
  #: inc/admin/views/quiz/modal-choose-items.php:52
1614
- #: inc/custom-post-types/course.php:76
1615
  #: inc/custom-post-types/quiz.php:170
1616
  msgid "Selected items"
1617
  msgstr ""
@@ -1746,9 +1741,9 @@ msgid "Assessment"
1746
  msgstr ""
1747
 
1748
  #: inc/admin/views/meta-boxes/course/settings.php:50
1749
- #: inc/admin/views/meta-boxes/course/settings.php:367
1750
- #: inc/custom-post-types/course.php:472
1751
- #: inc/custom-post-types/course.php:489
1752
  #: inc/custom-post-types/lesson.php:221
1753
  #: inc/custom-post-types/question.php:319
1754
  #: inc/custom-post-types/quiz.php:236
@@ -1870,90 +1865,90 @@ msgstr ""
1870
  msgid "Normally use for offline classes, Ex: link to a contact page. Format: https://google.com"
1871
  msgstr ""
1872
 
1873
- #: inc/admin/views/meta-boxes/course/settings.php:288
1874
  msgid "Regular price"
1875
  msgstr ""
1876
 
1877
- #: inc/admin/views/meta-boxes/course/settings.php:289
1878
  msgid "Set a regular price (<strong>%s</strong>). Leave it blank for <strong>Free</strong>."
1879
  msgstr ""
1880
 
1881
- #: inc/admin/views/meta-boxes/course/settings.php:302
1882
  msgid "Sale price"
1883
  msgstr ""
1884
 
1885
- #: inc/admin/views/meta-boxes/course/settings.php:303
1886
  msgid "Schedule"
1887
  msgstr ""
1888
 
1889
- #: inc/admin/views/meta-boxes/course/settings.php:316
1890
  msgid "Sale start dates"
1891
  msgstr ""
1892
 
1893
- #: inc/admin/views/meta-boxes/course/settings.php:321
1894
  msgctxt "placeholder"
1895
  msgid "From&hellip;"
1896
  msgstr ""
1897
 
1898
- #: inc/admin/views/meta-boxes/course/settings.php:325
1899
  msgid "Sale end dates"
1900
  msgstr ""
1901
 
1902
- #: inc/admin/views/meta-boxes/course/settings.php:330
1903
  msgctxt "placeholder"
1904
  msgid "To&hellip;"
1905
  msgstr ""
1906
 
1907
- #: inc/admin/views/meta-boxes/course/settings.php:335
1908
  msgid "No enroll requirement"
1909
  msgstr ""
1910
 
1911
- #: inc/admin/views/meta-boxes/course/settings.php:336
1912
  msgid "Students can see the content of all course items and do the quiz without login."
1913
  msgstr ""
1914
 
1915
- #: inc/admin/views/meta-boxes/course/settings.php:385
1916
  msgid "The method to assess the result of a student for a course."
1917
  msgstr ""
1918
 
1919
- #: inc/admin/views/meta-boxes/course/settings.php:388
1920
  msgid "<br /><strong>Note! </strong>No final quiz in course, please add a final quiz"
1921
  msgstr ""
1922
 
1923
- #: inc/admin/views/meta-boxes/course/settings.php:410
1924
  #: inc/rest-api/v1/admin/class-lp-admin-rest-course-controller.php:81
1925
  msgid "Edit: %s"
1926
  msgstr ""
1927
 
1928
- #: inc/admin/views/meta-boxes/course/settings.php:421
1929
  msgid "Evaluation"
1930
  msgstr ""
1931
 
1932
- #: inc/admin/views/meta-boxes/course/settings.php:429
1933
  #: inc/admin/views/meta-boxes/quiz/settings.php:29
1934
  msgid "Passing Grade(%)"
1935
  msgstr ""
1936
 
1937
- #: inc/admin/views/meta-boxes/course/settings.php:430
1938
  msgid "The condition that must be achieved to finish the course."
1939
  msgstr ""
1940
 
1941
- #: inc/admin/views/meta-boxes/course/settings.php:451
1942
- #: inc/templates/class-lp-template-course.php:283
1943
- #: inc/templates/class-lp-template-course.php:906
1944
  #: inc/widgets/course-extra.php:35
1945
  msgid "Requirements"
1946
  msgstr ""
1947
 
1948
- #: inc/admin/views/meta-boxes/course/settings.php:456
1949
  msgid "Target Audience"
1950
  msgstr ""
1951
 
1952
- #: inc/admin/views/meta-boxes/course/settings.php:461
1953
  msgid "Key Features"
1954
  msgstr ""
1955
 
1956
- #: inc/admin/views/meta-boxes/course/settings.php:466
1957
  #: inc/lp-template-functions.php:80
1958
  msgid "FAQs"
1959
  msgstr ""
@@ -1975,8 +1970,8 @@ msgstr ""
1975
 
1976
  #: inc/admin/views/meta-boxes/fields/extra-faq.php:41
1977
  #: inc/admin/views/meta-boxes/fields/extra-faq.php:61
1978
- #: inc/custom-post-types/course.php:473
1979
- #: inc/custom-post-types/course.php:490
1980
  #: inc/external-plugin/elementor/widgets/become-a-teacher.php:26
1981
  #: inc/external-plugin/elementor/widgets/list-courses.php:32
1982
  msgid "Content"
@@ -2005,7 +2000,7 @@ msgstr ""
2005
  #: inc/custom-post-types/abstract.php:960
2006
  #: inc/custom-post-types/lesson.php:130
2007
  #: inc/custom-post-types/lesson.php:230
2008
- #: inc/lp-template-functions.php:1012
2009
  #: templates/loop/single-course/loop-section-item.php:32
2010
  #: templates/single-course/section/item-meta.php:32
2011
  msgid "Preview"
@@ -2050,7 +2045,7 @@ msgstr ""
2050
 
2051
  #: inc/admin/views/meta-boxes/order/content-tab-preview-exports-invoice.php:72
2052
  #: inc/admin/views/meta-boxes/order/details.php:155
2053
- #: inc/custom-post-types/course.php:79
2054
  #: templates/checkout/order-received.php:60
2055
  msgid "Item"
2056
  msgstr ""
@@ -2076,7 +2071,7 @@ msgstr ""
2076
 
2077
  #: inc/admin/views/meta-boxes/order/content-tab-preview-exports-invoice.php:106
2078
  #: inc/admin/views/meta-boxes/order/details.php:158
2079
- #: inc/custom-post-types/order.php:666
2080
  #: templates/checkout/order-received.php:107
2081
  #: templates/checkout/review-order.php:103
2082
  #: templates/emails/order-items-table.php:118
@@ -2208,7 +2203,7 @@ msgstr ""
2208
  #: inc/admin/views/meta-boxes/question/settings.php:17
2209
  #: inc/admin/views/quiz/question-meta.php:28
2210
  #: assets/js/dist/frontend/quiz.min.js:76
2211
- #: assets/js/dist/frontend/quiz.min.js:206
2212
  msgid "Points"
2213
  msgstr ""
2214
 
@@ -2403,7 +2398,7 @@ msgstr ""
2403
  #: inc/custom-post-types/quiz.php:238
2404
  #: inc/custom-post-types/quiz.php:464
2405
  #: assets/js/dist/frontend/quiz.min.js:21
2406
- #: assets/js/dist/frontend/quiz.min.js:210
2407
  msgid "Questions"
2408
  msgstr ""
2409
 
@@ -2424,7 +2419,7 @@ msgid "Add option"
2424
  msgstr ""
2425
 
2426
  #: inc/admin/views/setup/content.php:50
2427
- #: inc/custom-post-types/course.php:75
2428
  #: inc/custom-post-types/quiz.php:169
2429
  msgid "Back"
2430
  msgstr ""
@@ -2634,7 +2629,7 @@ msgid "Sale by"
2634
  msgstr ""
2635
 
2636
  #: inc/admin/views/statistics/orders.php:47
2637
- #: inc/custom-post-types/order.php:665
2638
  #: templates/checkout/order-received.php:94
2639
  #: templates/profile/tabs/orders/list.php:32
2640
  #: templates/profile/tabs/quizzes.php:57
@@ -2642,7 +2637,7 @@ msgid "Date"
2642
  msgstr ""
2643
 
2644
  #: inc/admin/views/statistics/orders.php:49
2645
- #: inc/custom-post-types/course.php:166
2646
  msgid "Course Category"
2647
  msgstr ""
2648
 
@@ -2708,20 +2703,20 @@ msgstr ""
2708
  msgid "Course list of user enrolled"
2709
  msgstr ""
2710
 
2711
- #: inc/background-process/class-lp-background-query-items.php:156
2712
- #: inc/background-process/class-lp-background-query-items.php:210
2713
  msgid "There is no items found!"
2714
  msgstr ""
2715
 
2716
- #: inc/background-process/class-lp-background-query-items.php:161
2717
  msgid "WP query plugins error!"
2718
  msgstr ""
2719
 
2720
- #: inc/background-process/class-lp-background-query-items.php:164
2721
  msgid "WP query plugins empty!"
2722
  msgstr ""
2723
 
2724
- #: inc/background-process/class-lp-background-query-items.php:260
2725
  msgid "There is no item found!"
2726
  msgstr ""
2727
 
@@ -2745,98 +2740,110 @@ msgstr ""
2745
  msgid "No theme is defined for this template."
2746
  msgstr ""
2747
 
2748
- #: inc/cart/class-lp-cart.php:120
2749
  msgid "Get cart should not be called before the wp_loaded action."
2750
  msgstr ""
2751
 
2752
- #: inc/cart/class-lp-cart.php:152
2753
  msgid "Sorry! This course is not purchasable."
2754
  msgstr ""
2755
 
2756
- #: inc/cart/class-lp-cart.php:156
2757
  msgid "Sorry! The number of enrolled students has reached limit"
2758
  msgstr ""
2759
 
2760
- #: inc/cart/class-lp-cart.php:310
2761
  msgid "%s has been removed from your cart because it can no longer be purchased."
2762
  msgstr ""
2763
 
2764
- #: inc/cart/class-lp-cart.php:492
2765
  msgid "Checkout page hasn't been setup"
2766
  msgstr ""
2767
 
2768
- #: inc/class-lp-ajax.php:131
2769
  msgid "The order %s has been successfully recovered."
2770
  msgstr ""
2771
 
2772
- #: inc/class-lp-ajax.php:159
2773
  msgid "Your email is already exists. Continue with this email?"
2774
  msgstr ""
2775
 
2776
- #: inc/class-lp-ajax.php:166
2777
  msgid "Create new account with this email? Account information will be sent to this email."
2778
  msgstr ""
2779
 
2780
- #: inc/class-lp-ajax.php:225
2781
  msgid "Access denied!"
2782
  msgstr ""
2783
 
2784
- #: inc/class-lp-ajax.php:242
2785
  msgid "You have finished this course \"%s\""
2786
  msgstr ""
2787
 
2788
- #: inc/class-lp-ajax.php:245
2789
  msgid "Error! You cannot finish this course. Please contact your administrator for more information."
2790
  msgstr ""
2791
 
2792
- #: inc/class-lp-ajax.php:280
2793
  msgid "Error! Invalid lesson or failed security check."
2794
  msgstr ""
2795
 
2796
- #: inc/class-lp-ajax.php:296
 
 
 
 
 
 
 
 
 
 
 
 
2797
  msgid "Congrats! You have completed \"%s\"."
2798
  msgstr ""
2799
 
2800
  #: inc/class-lp-assets.php:72
2801
- #: inc/lp-core-functions.php:3038
2802
  #: assets/js/dist/frontend/quiz.min.js:41
2803
  msgid "OK"
2804
  msgstr ""
2805
 
2806
  #: inc/class-lp-assets.php:74
2807
- #: inc/lp-core-functions.php:3040
2808
  #: templates/global/lp-modal-overlay.php:24
2809
  msgid "Yes"
2810
  msgstr ""
2811
 
2812
  #: inc/class-lp-assets.php:75
2813
- #: inc/lp-core-functions.php:3041
2814
  #: templates/global/lp-modal-overlay.php:23
2815
  msgid "No"
2816
  msgstr ""
2817
 
2818
- #: inc/class-lp-assets.php:85
2819
- #: inc/class-lp-assets.php:92
2820
  #: inc/external-plugin/elementor/widgets/become-a-teacher.php:62
2821
  #: inc/shortcodes/class-lp-shortcode-become-a-teacher.php:89
2822
  msgid "Processing"
2823
  msgstr ""
2824
 
2825
- #: inc/class-lp-assets.php:86
2826
- #: inc/class-lp-assets.php:93
2827
  msgid "Redirecting"
2828
  msgstr ""
2829
 
2830
- #: inc/class-lp-assets.php:87
2831
  #: inc/class-lp-checkout.php:626
2832
  msgid "Invalid field"
2833
  msgstr ""
2834
 
2835
- #: inc/class-lp-assets.php:88
2836
  msgid "Unknown error"
2837
  msgstr ""
2838
 
2839
- #: inc/class-lp-assets.php:89
2840
  #: templates/checkout/payment.php:70
2841
  msgid "Place order"
2842
  msgstr ""
@@ -2955,7 +2962,6 @@ msgid "No payment method is selected"
2955
  msgstr ""
2956
 
2957
  #: inc/class-lp-checkout.php:686
2958
- #: templates/checkout/empty-cart.php:16
2959
  msgid "Your cart is currently empty."
2960
  msgstr ""
2961
 
@@ -2964,14 +2970,14 @@ msgid "Type item buy invalid!"
2964
  msgstr ""
2965
 
2966
  #: inc/class-lp-forms-handler.php:30
2967
- #: inc/class-lp-forms-handler.php:231
2968
- #: inc/curds/class-lp-user-curd.php:2137
2969
  msgid "Please enter a valid account username."
2970
  msgstr ""
2971
 
2972
  #: inc/class-lp-forms-handler.php:37
2973
- #: inc/class-lp-forms-handler.php:221
2974
- #: inc/curds/class-lp-user-curd.php:2127
2975
  msgid "Please provide a valid email address."
2976
  msgstr ""
2977
 
@@ -2991,99 +2997,99 @@ msgstr ""
2991
  msgid "Username is required"
2992
  msgstr ""
2993
 
2994
- #: inc/class-lp-forms-handler.php:173
2995
  msgid "I need become an instructor"
2996
  msgstr ""
2997
 
2998
- #: inc/class-lp-forms-handler.php:188
2999
  msgid " was successfully created!"
3000
  msgstr ""
3001
 
3002
- #: inc/class-lp-forms-handler.php:191
3003
  msgid "Your request become an instructor has been sent. We will get back to you soon!"
3004
  msgstr ""
3005
 
3006
- #: inc/class-lp-forms-handler.php:225
3007
  msgid "An account is already registered with your email address."
3008
  msgstr ""
3009
 
3010
- #: inc/class-lp-forms-handler.php:235
3011
- #: inc/curds/class-lp-user-curd.php:2141
3012
  msgid "An account is already registered with that username. Please choose another."
3013
  msgstr ""
3014
 
3015
- #: inc/class-lp-forms-handler.php:243
3016
  msgid "Please enter an account password."
3017
  msgstr ""
3018
 
3019
- #: inc/class-lp-forms-handler.php:247
3020
  msgid "Password is too short!"
3021
  msgstr ""
3022
 
3023
- #: inc/class-lp-forms-handler.php:251
3024
  msgid "Password can not have spacing!"
3025
  msgstr ""
3026
 
3027
- #: inc/class-lp-forms-handler.php:255
3028
  msgid "Please enter confirm password."
3029
  msgstr ""
3030
 
3031
- #: inc/class-lp-forms-handler.php:259
3032
  msgid "Confirmation password incorrect!."
3033
  msgstr ""
3034
 
3035
- #: inc/class-lp-forms-handler.php:267
3036
- #: inc/class-lp-forms-handler.php:334
3037
  msgid " is required field."
3038
  msgstr ""
3039
 
3040
- #: inc/class-lp-forms-handler.php:312
3041
  msgid "Email is required"
3042
  msgstr ""
3043
 
3044
- #: inc/class-lp-forms-handler.php:316
3045
  msgid "Display name is required"
3046
  msgstr ""
3047
 
3048
- #: inc/class-lp-forms-handler.php:320
3049
- #: inc/class-lp-forms-handler.php:324
3050
  msgid "Display name cannot be changed to email address due to privacy concern."
3051
  msgstr ""
3052
 
3053
- #: inc/class-lp-forms-handler.php:326
3054
  msgid "This email address is already registered."
3055
  msgstr ""
3056
 
3057
- #: inc/class-lp-forms-handler.php:358
3058
  msgid "Enter a username or email address."
3059
  msgstr ""
3060
 
3061
- #: inc/class-lp-forms-handler.php:378
3062
- #: inc/class-lp-forms-handler.php:382
3063
  msgid "Invalid username or email."
3064
  msgstr ""
3065
 
3066
- #: inc/class-lp-forms-handler.php:393
3067
  msgid "Password reset is not allowed for this user."
3068
  msgstr ""
3069
 
3070
- #: inc/class-lp-page-controller.php:173
3071
- #: inc/course/lp-course-functions.php:176
3072
  msgctxt "slug"
3073
  msgid "uncategorized"
3074
  msgstr ""
3075
 
3076
- #: inc/class-lp-page-controller.php:282
3077
  #: inc/lp-template-functions.php:310
3078
  msgid "Course Search Results"
3079
  msgstr ""
3080
 
3081
- #: inc/class-lp-page-controller.php:351
3082
  msgid "No payment method is available."
3083
  msgstr ""
3084
 
3085
  #: inc/class-lp-query-list-table.php:27
3086
- #: inc/custom-post-types/course.php:73
3087
  msgid "item"
3088
  msgstr ""
3089
 
@@ -3136,27 +3142,27 @@ msgctxt "no course thumbnail"
3136
  msgid "course thumbnail"
3137
  msgstr ""
3138
 
3139
- #: inc/class-lp-widget.php:250
3140
  msgid "There is no options for this widget."
3141
  msgstr ""
3142
 
3143
- #: inc/course/abstract-course.php:830
3144
- #: inc/course/abstract-course.php:850
3145
  #: inc/lesson/class-lp-lesson.php:104
3146
  #: inc/quiz/class-lp-quiz.php:637
3147
  msgid "The function %s doesn't exist"
3148
  msgstr ""
3149
 
3150
- #: inc/course/abstract-course.php:1318
3151
  msgid "This course will end within next %s"
3152
  msgstr ""
3153
 
3154
- #: inc/course/abstract-course.php:1346
3155
  msgctxt "External Link button text"
3156
  msgid "More Info"
3157
  msgstr ""
3158
 
3159
- #: inc/course/abstract-course.php:1383
3160
  msgid "Tags: "
3161
  msgstr ""
3162
 
@@ -3180,12 +3186,12 @@ msgctxt "course item status title"
3180
  msgid "Unread"
3181
  msgstr ""
3182
 
3183
- #: inc/course/lp-course-functions.php:759
3184
  msgid "Edit this item"
3185
  msgstr ""
3186
 
3187
- #: inc/course/lp-course-functions.php:970
3188
- #: inc/lp-core-functions.php:2415
3189
  #: inc/templates/class-lp-template-profile.php:103
3190
  #: inc/user-item/class-lp-user-item-quiz.php:147
3191
  #: inc/user/class-lp-profile.php:874
@@ -3194,8 +3200,8 @@ msgstr ""
3194
  msgid "Passed"
3195
  msgstr ""
3196
 
3197
- #: inc/course/lp-course-functions.php:973
3198
- #: inc/lp-core-functions.php:2418
3199
  #: inc/templates/class-lp-template-profile.php:104
3200
  #: inc/user-item/class-lp-user-item-quiz.php:148
3201
  #: inc/user/class-lp-profile.php:875
@@ -3204,8 +3210,8 @@ msgstr ""
3204
  msgid "Failed"
3205
  msgstr ""
3206
 
3207
- #: inc/course/lp-course-functions.php:976
3208
- #: inc/lp-core-functions.php:2421
3209
  #: inc/lp-deprecated.php:385
3210
  #: inc/templates/class-lp-template-profile.php:101
3211
  #: inc/user-item/class-lp-user-item-quiz.php:144
@@ -3213,27 +3219,27 @@ msgstr ""
3213
  msgid "In Progress"
3214
  msgstr ""
3215
 
3216
- #: inc/course/lp-course-functions.php:1054
3217
  msgid "lessons completed per total number of lessons."
3218
  msgstr ""
3219
 
3220
- #: inc/course/lp-course-functions.php:1057
3221
  msgid "quizzes passed per total number of quizzes."
3222
  msgstr ""
3223
 
3224
- #: inc/course/lp-course-functions.php:1060
3225
  msgid "Final Quiz"
3226
  msgstr ""
3227
 
3228
- #: inc/course/lp-course-functions.php:1063
3229
  msgid "correct answers per total number of questions."
3230
  msgstr ""
3231
 
3232
- #: inc/course/lp-course-functions.php:1066
3233
  msgid "score achieved per total score of the questions."
3234
  msgstr ""
3235
 
3236
- #: inc/course/lp-course-functions.php:1075
3237
  msgid "Require"
3238
  msgstr ""
3239
 
@@ -3274,23 +3280,12 @@ msgstr ""
3274
  msgid "Question does not exist."
3275
  msgstr ""
3276
 
3277
- #: inc/curds/class-lp-question-curd.php:150
3278
- msgid "<p>Op! ID not found</p>"
3279
- msgstr ""
3280
-
3281
- #: inc/curds/class-lp-question-curd.php:154
3282
- msgid "<p>Op! The question does not exist</p>"
3283
  msgstr ""
3284
 
3285
- #: inc/curds/class-lp-question-curd.php:159
3286
- msgid "<p>Sorry! You don't have permission to duplicate this question</p>"
3287
- msgstr ""
3288
-
3289
- #: inc/curds/class-lp-question-curd.php:169
3290
- msgid "<p>Sorry! Failed to duplicate question!</p>"
3291
- msgstr ""
3292
-
3293
- #: inc/curds/class-lp-question-curd.php:233
3294
  msgid "Invalid question with ID \"%d\"."
3295
  msgstr ""
3296
 
@@ -3302,25 +3297,25 @@ msgstr ""
3302
  msgid "Invalid quiz with ID \"%d\"."
3303
  msgstr ""
3304
 
3305
- #: inc/curds/class-lp-user-curd.php:1930
3306
  msgid "No item in Order"
3307
  msgstr ""
3308
 
3309
- #: inc/curds/class-lp-user-curd.php:2062
3310
  #: inc/user/class-lp-user.php:736
3311
  msgid "quiz"
3312
  msgstr ""
3313
 
3314
- #: inc/curds/class-lp-user-curd.php:2063
3315
  #: inc/user/class-lp-user.php:737
3316
  msgid "quizzes"
3317
  msgstr ""
3318
 
3319
- #: inc/curds/class-lp-user-curd.php:2131
3320
  msgid "An account is already registered with your email address. Please log in."
3321
  msgstr ""
3322
 
3323
- #: inc/curds/class-lp-user-curd.php:2153
3324
  msgid "Failed to create user"
3325
  msgstr ""
3326
 
@@ -3397,200 +3392,200 @@ msgstr ""
3397
  msgid "draft updated."
3398
  msgstr ""
3399
 
3400
- #: inc/custom-post-types/course.php:74
3401
  msgid "Create a new"
3402
  msgstr ""
3403
 
3404
- #: inc/custom-post-types/course.php:77
3405
  msgid "Do you want to remove item \"{{ITEM_NAME}}\" to trash?"
3406
  msgstr ""
3407
 
3408
- #: inc/custom-post-types/course.php:80
3409
  msgid "Items"
3410
  msgstr ""
3411
 
3412
- #: inc/custom-post-types/course.php:82
3413
  msgid "Course sale price must less than the regular price"
3414
  msgstr ""
3415
 
3416
- #: inc/custom-post-types/course.php:83
3417
  msgid "Course price must greater than the sale price"
3418
  msgstr ""
3419
 
3420
- #: inc/custom-post-types/course.php:84
3421
  msgid "Sale start date must before sale end date"
3422
  msgstr ""
3423
 
3424
- #: inc/custom-post-types/course.php:85
3425
  msgid "Sale end date must after sale start date"
3426
  msgstr ""
3427
 
3428
- #: inc/custom-post-types/course.php:86
3429
  msgid "Invalid date"
3430
  msgstr ""
3431
 
3432
- #: inc/custom-post-types/course.php:105
3433
  msgctxt "Post Type General Name"
3434
  msgid "Courses"
3435
  msgstr ""
3436
 
3437
- #: inc/custom-post-types/course.php:106
3438
  msgctxt "Post Type Singular Name"
3439
  msgid "Course"
3440
  msgstr ""
3441
 
3442
- #: inc/custom-post-types/course.php:108
3443
  msgid "Parent Item:"
3444
  msgstr ""
3445
 
3446
- #: inc/custom-post-types/course.php:110
3447
  msgid "View Course"
3448
  msgstr ""
3449
 
3450
- #: inc/custom-post-types/course.php:111
3451
  msgid "Add New Course"
3452
  msgstr ""
3453
 
3454
- #: inc/custom-post-types/course.php:112
3455
  #: inc/custom-post-types/lesson.php:162
3456
- #: inc/custom-post-types/order.php:826
3457
  #: inc/custom-post-types/question.php:211
3458
  msgid "Add New"
3459
  msgstr ""
3460
 
3461
- #: inc/custom-post-types/course.php:113
3462
  msgid "Edit Course"
3463
  msgstr ""
3464
 
3465
- #: inc/custom-post-types/course.php:114
3466
  msgid "Update Course"
3467
  msgstr ""
3468
 
3469
- #: inc/custom-post-types/course.php:115
3470
  msgid "Search Courses"
3471
  msgstr ""
3472
 
3473
- #: inc/custom-post-types/course.php:116
3474
  msgid "You haven't had any courses yet. Click <a href=\"%s\">Add new</a> to start"
3475
  msgstr ""
3476
 
3477
- #: inc/custom-post-types/course.php:117
3478
  msgid "No course found in Trash"
3479
  msgstr ""
3480
 
3481
- #: inc/custom-post-types/course.php:120
3482
  #: inc/settings/class-lp-settings-courses.php:32
3483
  msgctxt "slug"
3484
  msgid "courses"
3485
  msgstr ""
3486
 
 
3487
  #: inc/custom-post-types/course.php:163
3488
- #: inc/custom-post-types/course.php:165
3489
  msgid "Course Categories"
3490
  msgstr ""
3491
 
3492
- #: inc/custom-post-types/course.php:167
3493
  #: templates/single-course/meta/category.php:15
3494
  msgid "Category"
3495
  msgstr ""
3496
 
3497
- #: inc/custom-post-types/course.php:168
3498
  msgid "Add New Course Category"
3499
  msgstr ""
3500
 
3501
- #: inc/custom-post-types/course.php:169
3502
  msgid "All Categories"
3503
  msgstr ""
3504
 
3505
- #: inc/custom-post-types/course.php:181
3506
  msgctxt "slug"
3507
  msgid "course-category"
3508
  msgstr ""
3509
 
3510
- #: inc/custom-post-types/course.php:195
3511
- #: inc/custom-post-types/course.php:209
3512
  msgid "Course Tags"
3513
  msgstr ""
3514
 
3515
- #: inc/custom-post-types/course.php:196
3516
  #: inc/custom-post-types/question.php:184
3517
  #: inc/custom-post-types/question.php:185
3518
  msgid "Tag"
3519
  msgstr ""
3520
 
3521
- #: inc/custom-post-types/course.php:197
3522
  msgid "Search Course Tags"
3523
  msgstr ""
3524
 
3525
- #: inc/custom-post-types/course.php:198
3526
  msgid "Popular Course Tags"
3527
  msgstr ""
3528
 
3529
- #: inc/custom-post-types/course.php:199
3530
  msgid "All Course Tags"
3531
  msgstr ""
3532
 
3533
- #: inc/custom-post-types/course.php:202
3534
  msgid "Edit Course Tag"
3535
  msgstr ""
3536
 
3537
- #: inc/custom-post-types/course.php:203
3538
  msgid "Update Course Tag"
3539
  msgstr ""
3540
 
3541
- #: inc/custom-post-types/course.php:204
3542
  msgid "Add New Course Tag"
3543
  msgstr ""
3544
 
3545
- #: inc/custom-post-types/course.php:205
3546
  msgid "New Course Tag Name"
3547
  msgstr ""
3548
 
3549
- #: inc/custom-post-types/course.php:206
3550
  msgid "Separate tags with commas"
3551
  msgstr ""
3552
 
3553
- #: inc/custom-post-types/course.php:207
3554
  msgid "Add or remove tags"
3555
  msgstr ""
3556
 
3557
- #: inc/custom-post-types/course.php:208
3558
  msgid "Choose from the most used tags"
3559
  msgstr ""
3560
 
3561
- #: inc/custom-post-types/course.php:219
3562
  msgctxt "slug"
3563
  msgid "course-tag"
3564
  msgstr ""
3565
 
3566
- #: inc/custom-post-types/course.php:475
3567
- #: inc/custom-post-types/course.php:492
3568
  #: templates/emails/order-items-table.php:87
3569
  msgid "Price"
3570
  msgstr ""
3571
 
3572
- #: inc/custom-post-types/course.php:481
3573
- #: inc/custom-post-types/course.php:484
3574
  msgid "Thumbnail"
3575
  msgstr ""
3576
 
3577
- #: inc/custom-post-types/course.php:526
3578
  msgid "<strong>%d</strong> section"
3579
  msgid_plural "<strong>%d</strong> sections"
3580
  msgstr[0] ""
3581
  msgstr[1] ""
3582
 
3583
- #: inc/custom-post-types/course.php:540
3584
  msgid "<strong>%d</strong> "
3585
  msgid_plural "<strong>%d</strong> "
3586
  msgstr[0] ""
3587
  msgstr[1] ""
3588
 
3589
- #: inc/custom-post-types/course.php:551
3590
  msgid "No content"
3591
  msgstr ""
3592
 
3593
- #: inc/custom-post-types/course.php:569
3594
  #: inc/lp-template-functions.php:67
3595
  msgid "Curriculum"
3596
  msgstr ""
@@ -3654,36 +3649,36 @@ msgstr ""
3654
  msgid "Assigned"
3655
  msgstr ""
3656
 
3657
- #: inc/custom-post-types/order.php:378
3658
  msgid "Order number, course name etc..."
3659
  msgstr ""
3660
 
3661
- #: inc/custom-post-types/order.php:577
3662
- #: inc/custom-post-types/order.php:825
3663
  msgid "View Order"
3664
  msgstr ""
3665
 
3666
- #: inc/custom-post-types/order.php:593
3667
  msgid "View child orders"
3668
  msgstr ""
3669
 
3670
- #: inc/custom-post-types/order.php:662
3671
- #: inc/custom-post-types/order.php:821
3672
  #: templates/profile/tabs/orders/list.php:29
3673
  msgid "Order"
3674
  msgstr ""
3675
 
3676
- #: inc/custom-post-types/order.php:663
3677
  msgid "Student"
3678
  msgstr ""
3679
 
3680
- #: inc/custom-post-types/order.php:664
3681
  #: inc/lp-deprecated.php:354
3682
- #: inc/user-item/class-lp-user-item.php:805
3683
  msgid "Purchased"
3684
  msgstr ""
3685
 
3686
- #: inc/custom-post-types/order.php:667
3687
  #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1330
3688
  #: templates/emails/order-items-table.php:72
3689
  #: templates/emails/plain/order-items-table.php:58
@@ -3691,67 +3686,67 @@ msgstr ""
3691
  msgid "Status"
3692
  msgstr ""
3693
 
3694
- #: inc/custom-post-types/order.php:717
3695
  #: inc/order/class-lp-order.php:458
3696
  msgid "(Guest)"
3697
  msgstr ""
3698
 
3699
- #: inc/custom-post-types/order.php:773
3700
  #: templates/checkout/order-received.php:71
3701
  msgid "Course does not exist"
3702
  msgstr ""
3703
 
3704
- #: inc/custom-post-types/order.php:775
3705
  msgid "Deleted"
3706
  msgstr ""
3707
 
3708
- #: inc/custom-post-types/order.php:791
3709
  #: templates/checkout/order-received.php:88
3710
  msgid "(No item)"
3711
  msgstr ""
3712
 
3713
- #: inc/custom-post-types/order.php:801
3714
  msgid "Pay via <strong>%s</strong>"
3715
  msgstr ""
3716
 
3717
- #: inc/custom-post-types/order.php:822
3718
  msgid "Add New Order"
3719
  msgstr ""
3720
 
3721
- #: inc/custom-post-types/order.php:823
3722
- #: inc/custom-post-types/order.php:990
3723
  #: templates/order/order-details.php:20
3724
  msgid "Order Details"
3725
  msgstr ""
3726
 
3727
- #: inc/custom-post-types/order.php:827
3728
  msgid "Update Order"
3729
  msgstr ""
3730
 
3731
- #: inc/custom-post-types/order.php:828
3732
  msgid "Search Orders"
3733
  msgstr ""
3734
 
3735
- #: inc/custom-post-types/order.php:829
3736
  msgid "No order found"
3737
  msgstr ""
3738
 
3739
- #: inc/custom-post-types/order.php:830
3740
  msgid "No order found in Trash"
3741
  msgstr ""
3742
 
3743
- #: inc/custom-post-types/order.php:998
3744
  msgid "Order Actions"
3745
  msgstr ""
3746
 
3747
- #: inc/custom-post-types/order.php:1006
3748
  msgid "Order Exports"
3749
  msgstr ""
3750
 
3751
  #: inc/custom-post-types/question.php:127
3752
  #: assets/js/dist/frontend/quiz.min.js:207
3753
  #: assets/js/dist/frontend/quiz.min.js:78
3754
- #: assets/js/dist/frontend/quiz.min.js:214
3755
  msgid "Correct"
3756
  msgstr ""
3757
 
@@ -3857,8 +3852,8 @@ msgid "Do you want to move question \"{{QUESTION_NAME}}\" to trash?"
3857
  msgstr ""
3858
 
3859
  #: inc/custom-post-types/quiz.php:286
3860
- #: inc/templates/class-lp-template-course.php:97
3861
- #: inc/templates/class-lp-template-course.php:102
3862
  msgid "%d question"
3863
  msgid_plural "%d questions"
3864
  msgstr[0] ""
@@ -3991,19 +3986,19 @@ msgstr ""
3991
  msgid "New user order"
3992
  msgstr ""
3993
 
3994
- #: inc/emails/class-lp-email.php:1039
3995
  msgid "Recipient(s)"
3996
  msgstr ""
3997
 
3998
- #: inc/emails/class-lp-email.php:1043
3999
  msgid "Separate other recipients by comma."
4000
  msgstr ""
4001
 
4002
- #: inc/emails/class-lp-email.php:1048
4003
  msgid "Subject"
4004
  msgstr ""
4005
 
4006
- #: inc/emails/class-lp-email.php:1055
4007
  msgid "Email heading"
4008
  msgstr ""
4009
 
@@ -4506,8 +4501,8 @@ msgid "Course is not exists."
4506
  msgstr ""
4507
 
4508
  #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:347
4509
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:434
4510
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:597
4511
  msgid "Error: Can't add Course to cart."
4512
  msgstr ""
4513
 
@@ -4829,31 +4824,6 @@ msgstr ""
4829
  msgid "Expiration time"
4830
  msgstr ""
4831
 
4832
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1368
4833
- msgid "Limit result set to courses assigned a specific category ID."
4834
- msgstr ""
4835
-
4836
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1374
4837
- msgid "Limit result set to courses assigned a specific tag ID."
4838
- msgstr ""
4839
-
4840
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1380
4841
- msgid "Filter by course to in-progress, passed, failed."
4842
- msgstr ""
4843
-
4844
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1387
4845
- #: inc/jwt/rest-api/version1/class-lp-rest-posts-controller.php:610
4846
- msgid "Get item learned by user."
4847
- msgstr ""
4848
-
4849
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1393
4850
- msgid "Get item popularity."
4851
- msgstr ""
4852
-
4853
- #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1398
4854
- msgid "Disable some fields schema."
4855
- msgstr ""
4856
-
4857
  #: inc/jwt/rest-api/version1/class-lp-rest-lessons-v1-controller.php:201
4858
  msgid "Error: No lesson available!."
4859
  msgstr ""
@@ -5002,6 +4972,10 @@ msgstr ""
5002
  msgid "Ensure result set excludes posts assigned to specific authors."
5003
  msgstr ""
5004
 
 
 
 
 
5005
  #: inc/jwt/rest-api/version1/class-lp-rest-posts-controller.php:618
5006
  msgid "Limit result set to those of particular parent IDs."
5007
  msgstr ""
@@ -5165,820 +5139,820 @@ msgstr ""
5165
  msgid "Your password has been updated, Please login again to continue!"
5166
  msgstr ""
5167
 
5168
- #: inc/lp-core-functions.php:743
5169
  msgid "Minute(s)"
5170
  msgstr ""
5171
 
5172
- #: inc/lp-core-functions.php:744
5173
  msgid "Hour(s)"
5174
  msgstr ""
5175
 
5176
- #: inc/lp-core-functions.php:745
5177
  msgid "Day(s)"
5178
  msgstr ""
5179
 
5180
- #: inc/lp-core-functions.php:746
5181
  msgid "Week(s)"
5182
  msgstr ""
5183
 
5184
- #: inc/lp-core-functions.php:892
5185
  msgid "Left"
5186
  msgstr ""
5187
 
5188
- #: inc/lp-core-functions.php:893
5189
  msgid "Right"
5190
  msgstr ""
5191
 
5192
- #: inc/lp-core-functions.php:894
5193
  msgid "Left with space"
5194
  msgstr ""
5195
 
5196
- #: inc/lp-core-functions.php:895
5197
  msgid "Right with space"
5198
  msgstr ""
5199
 
5200
- #: inc/lp-core-functions.php:954
5201
  msgid "Afghan afghani"
5202
  msgstr ""
5203
 
5204
- #: inc/lp-core-functions.php:955
5205
  msgid "Albanian lek"
5206
  msgstr ""
5207
 
5208
- #: inc/lp-core-functions.php:956
5209
  msgid "Algerian dinar"
5210
  msgstr ""
5211
 
5212
- #: inc/lp-core-functions.php:957
5213
  msgid "Euro"
5214
  msgstr ""
5215
 
5216
- #: inc/lp-core-functions.php:958
5217
  msgid "Angolan kwanza"
5218
  msgstr ""
5219
 
5220
- #: inc/lp-core-functions.php:959
5221
  msgid "East Caribbean dollar"
5222
  msgstr ""
5223
 
5224
- #: inc/lp-core-functions.php:960
5225
  msgid "Argentine peso"
5226
  msgstr ""
5227
 
5228
- #: inc/lp-core-functions.php:961
5229
  msgid "Armenian dram"
5230
  msgstr ""
5231
 
5232
- #: inc/lp-core-functions.php:962
5233
  msgid "Aruban florin"
5234
  msgstr ""
5235
 
5236
- #: inc/lp-core-functions.php:963
5237
  msgid "Australian dollar"
5238
  msgstr ""
5239
 
5240
- #: inc/lp-core-functions.php:964
5241
  msgid "Azerbaijani manat"
5242
  msgstr ""
5243
 
5244
- #: inc/lp-core-functions.php:965
5245
  msgid "Bahamian dollar"
5246
  msgstr ""
5247
 
5248
- #: inc/lp-core-functions.php:966
5249
  msgid "Bahraini dinar"
5250
  msgstr ""
5251
 
5252
- #: inc/lp-core-functions.php:967
5253
  msgid "Bangladeshi taka"
5254
  msgstr ""
5255
 
5256
- #: inc/lp-core-functions.php:968
5257
  msgid "Barbadian dollar"
5258
  msgstr ""
5259
 
5260
- #: inc/lp-core-functions.php:969
5261
  msgid "Belarusian ruble"
5262
  msgstr ""
5263
 
5264
- #: inc/lp-core-functions.php:970
5265
  msgid "Belizean dollar"
5266
  msgstr ""
5267
 
5268
- #: inc/lp-core-functions.php:971
5269
  msgid "West African CFA franc"
5270
  msgstr ""
5271
 
5272
- #: inc/lp-core-functions.php:972
5273
  msgid "Bermudian dollar"
5274
  msgstr ""
5275
 
5276
- #: inc/lp-core-functions.php:973
5277
  msgid "Bhutanese ngultrum"
5278
  msgstr ""
5279
 
5280
- #: inc/lp-core-functions.php:974
5281
  msgid "Bolivian boliviano"
5282
  msgstr ""
5283
 
5284
- #: inc/lp-core-functions.php:975
5285
  msgid "US dollar"
5286
  msgstr ""
5287
 
5288
- #: inc/lp-core-functions.php:976
5289
  msgid "Bosnia and Herzegovina convertible mark"
5290
  msgstr ""
5291
 
5292
- #: inc/lp-core-functions.php:977
5293
  msgid "Botswana pula"
5294
  msgstr ""
5295
 
5296
- #: inc/lp-core-functions.php:978
5297
  msgid "Brazilian real"
5298
  msgstr ""
5299
 
5300
- #: inc/lp-core-functions.php:979
5301
  msgid "Brunei dollar"
5302
  msgstr ""
5303
 
5304
- #: inc/lp-core-functions.php:980
5305
  msgid "Bulgarian lev"
5306
  msgstr ""
5307
 
5308
- #: inc/lp-core-functions.php:981
5309
  msgid "Burmese kyat"
5310
  msgstr ""
5311
 
5312
- #: inc/lp-core-functions.php:982
5313
  msgid "Burundian franc"
5314
  msgstr ""
5315
 
5316
- #: inc/lp-core-functions.php:983
5317
  msgid "Cambodian riel"
5318
  msgstr ""
5319
 
5320
- #: inc/lp-core-functions.php:984
5321
  msgid "Central African CFA franc"
5322
  msgstr ""
5323
 
5324
- #: inc/lp-core-functions.php:985
5325
  msgid "Canadian dollar"
5326
  msgstr ""
5327
 
5328
- #: inc/lp-core-functions.php:986
5329
  msgid "Cape Verdean escudo"
5330
  msgstr ""
5331
 
5332
- #: inc/lp-core-functions.php:987
5333
  msgid "Cayman Islands dollar"
5334
  msgstr ""
5335
 
5336
- #: inc/lp-core-functions.php:988
5337
  msgid "Chilean peso"
5338
  msgstr ""
5339
 
5340
- #: inc/lp-core-functions.php:989
5341
  msgid "Chinese renminbi"
5342
  msgstr ""
5343
 
5344
- #: inc/lp-core-functions.php:990
5345
  msgid "Colombian peso"
5346
  msgstr ""
5347
 
5348
- #: inc/lp-core-functions.php:991
5349
  msgid "Comorian franc"
5350
  msgstr ""
5351
 
5352
- #: inc/lp-core-functions.php:992
5353
  msgid "Congolese franc"
5354
  msgstr ""
5355
 
5356
- #: inc/lp-core-functions.php:993
5357
  msgid "New Zealand dollar"
5358
  msgstr ""
5359
 
5360
- #: inc/lp-core-functions.php:994
5361
  msgid "Costa Rican colón"
5362
  msgstr ""
5363
 
5364
- #: inc/lp-core-functions.php:995
5365
  msgid "Croatian kuna"
5366
  msgstr ""
5367
 
5368
- #: inc/lp-core-functions.php:996
5369
  msgid "Cuban peso"
5370
  msgstr ""
5371
 
5372
- #: inc/lp-core-functions.php:997
5373
  msgid "Netherlands Antilles guilder"
5374
  msgstr ""
5375
 
5376
- #: inc/lp-core-functions.php:998
5377
  msgid "Czech koruna"
5378
  msgstr ""
5379
 
5380
- #: inc/lp-core-functions.php:999
5381
  msgid "Danish krone"
5382
  msgstr ""
5383
 
5384
- #: inc/lp-core-functions.php:1000
5385
  msgid "Djiboutian franc"
5386
  msgstr ""
5387
 
5388
- #: inc/lp-core-functions.php:1001
5389
  msgid "Dominican peso"
5390
  msgstr ""
5391
 
5392
- #: inc/lp-core-functions.php:1002
5393
  msgid "Egyptian pound"
5394
  msgstr ""
5395
 
5396
- #: inc/lp-core-functions.php:1003
5397
  msgid "Salvadoran colón"
5398
  msgstr ""
5399
 
5400
- #: inc/lp-core-functions.php:1004
5401
  msgid "Eritrean nakfa"
5402
  msgstr ""
5403
 
5404
- #: inc/lp-core-functions.php:1005
5405
  msgid "Ethiopian birr"
5406
  msgstr ""
5407
 
5408
- #: inc/lp-core-functions.php:1006
5409
  msgid "Falkland Islands pound"
5410
  msgstr ""
5411
 
5412
- #: inc/lp-core-functions.php:1007
5413
  msgid "Fijian dollar"
5414
  msgstr ""
5415
 
5416
- #: inc/lp-core-functions.php:1008
5417
  msgid "CFP franc"
5418
  msgstr ""
5419
 
5420
- #: inc/lp-core-functions.php:1009
5421
  msgid "Gambian dalasi"
5422
  msgstr ""
5423
 
5424
- #: inc/lp-core-functions.php:1010
5425
  msgid "Georgian lari"
5426
  msgstr ""
5427
 
5428
- #: inc/lp-core-functions.php:1011
5429
  msgid "Ghanian cedi"
5430
  msgstr ""
5431
 
5432
- #: inc/lp-core-functions.php:1012
5433
  msgid "Gibraltar pound"
5434
  msgstr ""
5435
 
5436
- #: inc/lp-core-functions.php:1013
5437
  msgid "Guatemalan quetzal"
5438
  msgstr ""
5439
 
5440
- #: inc/lp-core-functions.php:1014
5441
  msgid "British pound"
5442
  msgstr ""
5443
 
5444
- #: inc/lp-core-functions.php:1015
5445
  msgid "Guinean franc"
5446
  msgstr ""
5447
 
5448
- #: inc/lp-core-functions.php:1016
5449
  msgid "Guyanese dollar"
5450
  msgstr ""
5451
 
5452
- #: inc/lp-core-functions.php:1017
5453
  msgid "Haitian gourde"
5454
  msgstr ""
5455
 
5456
- #: inc/lp-core-functions.php:1018
5457
  msgid "Honduran lempira"
5458
  msgstr ""
5459
 
5460
- #: inc/lp-core-functions.php:1019
5461
  msgid "Hong Kong dollar"
5462
  msgstr ""
5463
 
5464
- #: inc/lp-core-functions.php:1020
5465
  msgid "Hungarian forint"
5466
  msgstr ""
5467
 
5468
- #: inc/lp-core-functions.php:1021
5469
  msgid "Icelandic króna"
5470
  msgstr ""
5471
 
5472
- #: inc/lp-core-functions.php:1022
5473
  msgid "Indian rupee"
5474
  msgstr ""
5475
 
5476
- #: inc/lp-core-functions.php:1023
5477
  msgid "Indonesian rupiah"
5478
  msgstr ""
5479
 
5480
- #: inc/lp-core-functions.php:1024
5481
  msgid "Iranian rial"
5482
  msgstr ""
5483
 
5484
- #: inc/lp-core-functions.php:1025
5485
  msgid "Iraqi dinar"
5486
  msgstr ""
5487
 
5488
- #: inc/lp-core-functions.php:1026
5489
  msgid "Israeli new sheqel"
5490
  msgstr ""
5491
 
5492
- #: inc/lp-core-functions.php:1027
5493
  msgid "Jamaican dollar"
5494
  msgstr ""
5495
 
5496
- #: inc/lp-core-functions.php:1028
5497
  msgid "Japanese yen "
5498
  msgstr ""
5499
 
5500
- #: inc/lp-core-functions.php:1029
5501
  msgid "Jordanian dinar"
5502
  msgstr ""
5503
 
5504
- #: inc/lp-core-functions.php:1030
5505
  msgid "Kazakhstani tenge"
5506
  msgstr ""
5507
 
5508
- #: inc/lp-core-functions.php:1031
5509
  msgid "Kenyan shilling"
5510
  msgstr ""
5511
 
5512
- #: inc/lp-core-functions.php:1032
5513
  msgid "North Korean won"
5514
  msgstr ""
5515
 
5516
- #: inc/lp-core-functions.php:1033
5517
  msgid "Kuwaiti dinar"
5518
  msgstr ""
5519
 
5520
- #: inc/lp-core-functions.php:1034
5521
  msgid "Kyrgyzstani som"
5522
  msgstr ""
5523
 
5524
- #: inc/lp-core-functions.php:1035
5525
  msgid "South Korean won"
5526
  msgstr ""
5527
 
5528
- #: inc/lp-core-functions.php:1036
5529
  msgid "Lao kip"
5530
  msgstr ""
5531
 
5532
- #: inc/lp-core-functions.php:1037
5533
  msgid "Latvian lats"
5534
  msgstr ""
5535
 
5536
- #: inc/lp-core-functions.php:1038
5537
  msgid "Lebanese pound"
5538
  msgstr ""
5539
 
5540
- #: inc/lp-core-functions.php:1039
5541
  msgid "Lesotho loti"
5542
  msgstr ""
5543
 
5544
- #: inc/lp-core-functions.php:1040
5545
  msgid "Liberian dollar"
5546
  msgstr ""
5547
 
5548
- #: inc/lp-core-functions.php:1041
5549
- #: inc/lp-core-functions.php:1112
5550
  msgid "Libyan dinar"
5551
  msgstr ""
5552
 
5553
- #: inc/lp-core-functions.php:1042
5554
  msgid "Swiss franc"
5555
  msgstr ""
5556
 
5557
- #: inc/lp-core-functions.php:1043
5558
  msgid "Lithuanian litas"
5559
  msgstr ""
5560
 
5561
- #: inc/lp-core-functions.php:1044
5562
  msgid "Macanese pataca"
5563
  msgstr ""
5564
 
5565
- #: inc/lp-core-functions.php:1045
5566
  msgid "Macedonian denar"
5567
  msgstr ""
5568
 
5569
- #: inc/lp-core-functions.php:1046
5570
  msgid "Malagasy ariary"
5571
  msgstr ""
5572
 
5573
- #: inc/lp-core-functions.php:1047
5574
  msgid "Malawian kwacha"
5575
  msgstr ""
5576
 
5577
- #: inc/lp-core-functions.php:1048
5578
  msgid "Malaysian ringgit"
5579
  msgstr ""
5580
 
5581
- #: inc/lp-core-functions.php:1049
5582
  msgid "Maldivian rufiyaa"
5583
  msgstr ""
5584
 
5585
- #: inc/lp-core-functions.php:1050
5586
  msgid "Mauritanian ouguiya"
5587
  msgstr ""
5588
 
5589
- #: inc/lp-core-functions.php:1051
5590
  msgid "Mauritian rupee"
5591
  msgstr ""
5592
 
5593
- #: inc/lp-core-functions.php:1052
5594
  msgid "Mexican peso"
5595
  msgstr ""
5596
 
5597
- #: inc/lp-core-functions.php:1053
5598
  msgid "Moldovan leu"
5599
  msgstr ""
5600
 
5601
- #: inc/lp-core-functions.php:1054
5602
  msgid "Mongolian tugrik"
5603
  msgstr ""
5604
 
5605
- #: inc/lp-core-functions.php:1055
5606
  msgid "Moroccan dirham"
5607
  msgstr ""
5608
 
5609
- #: inc/lp-core-functions.php:1056
5610
  msgid "Mozambican metical"
5611
  msgstr ""
5612
 
5613
- #: inc/lp-core-functions.php:1057
5614
  msgid "Namibian dollar"
5615
  msgstr ""
5616
 
5617
- #: inc/lp-core-functions.php:1058
5618
  msgid "Nepalese rupee"
5619
  msgstr ""
5620
 
5621
- #: inc/lp-core-functions.php:1059
5622
  msgid "Nicaraguan córdoba"
5623
  msgstr ""
5624
 
5625
- #: inc/lp-core-functions.php:1060
5626
  msgid "Nigerian naira"
5627
  msgstr ""
5628
 
5629
- #: inc/lp-core-functions.php:1061
5630
  msgid "Norwegian krone"
5631
  msgstr ""
5632
 
5633
- #: inc/lp-core-functions.php:1062
5634
  msgid "Omani rial"
5635
  msgstr ""
5636
 
5637
- #: inc/lp-core-functions.php:1063
5638
  msgid "Pakistani rupee"
5639
  msgstr ""
5640
 
5641
- #: inc/lp-core-functions.php:1064
5642
  msgid "Panamanian balboa"
5643
  msgstr ""
5644
 
5645
- #: inc/lp-core-functions.php:1065
5646
  msgid "Papua New Guinea kina"
5647
  msgstr ""
5648
 
5649
- #: inc/lp-core-functions.php:1066
5650
  msgid "Paraguayan guarani"
5651
  msgstr ""
5652
 
5653
- #: inc/lp-core-functions.php:1067
5654
  msgid "Peruvian nuevo sol"
5655
  msgstr ""
5656
 
5657
- #: inc/lp-core-functions.php:1068
5658
  msgid "Philippine peso"
5659
  msgstr ""
5660
 
5661
- #: inc/lp-core-functions.php:1069
5662
  msgid "Polish zloty"
5663
  msgstr ""
5664
 
5665
- #: inc/lp-core-functions.php:1070
5666
  msgid "Qatari riyal"
5667
  msgstr ""
5668
 
5669
- #: inc/lp-core-functions.php:1071
5670
  msgid "Romanian leu"
5671
  msgstr ""
5672
 
5673
- #: inc/lp-core-functions.php:1072
5674
  msgid "Russian ruble"
5675
  msgstr ""
5676
 
5677
- #: inc/lp-core-functions.php:1073
5678
  msgid "Rwandan franc"
5679
  msgstr ""
5680
 
5681
- #: inc/lp-core-functions.php:1074
5682
  msgid "Samoan tālā"
5683
  msgstr ""
5684
 
5685
- #: inc/lp-core-functions.php:1075
5686
  msgid "São Tomé and Príncipe dobra"
5687
  msgstr ""
5688
 
5689
- #: inc/lp-core-functions.php:1076
5690
  msgid "Saudi riyal"
5691
  msgstr ""
5692
 
5693
- #: inc/lp-core-functions.php:1077
5694
  msgid "Serbian dinar"
5695
  msgstr ""
5696
 
5697
- #: inc/lp-core-functions.php:1078
5698
  msgid "Seychellois rupee"
5699
  msgstr ""
5700
 
5701
- #: inc/lp-core-functions.php:1079
5702
  msgid "Sierra Leonean leone"
5703
  msgstr ""
5704
 
5705
- #: inc/lp-core-functions.php:1080
5706
  msgid "Singapore dollar"
5707
  msgstr ""
5708
 
5709
- #: inc/lp-core-functions.php:1081
5710
  msgid "Solomon Islands dollar"
5711
  msgstr ""
5712
 
5713
- #: inc/lp-core-functions.php:1082
5714
  msgid "Somali shilling"
5715
  msgstr ""
5716
 
5717
- #: inc/lp-core-functions.php:1083
5718
  msgid "South African rand"
5719
  msgstr ""
5720
 
5721
- #: inc/lp-core-functions.php:1084
5722
  msgid "Sri Lankan rupee"
5723
  msgstr ""
5724
 
5725
- #: inc/lp-core-functions.php:1085
5726
  msgid "St. Helena pound"
5727
  msgstr ""
5728
 
5729
- #: inc/lp-core-functions.php:1086
5730
  msgid "Sudanese pound"
5731
  msgstr ""
5732
 
5733
- #: inc/lp-core-functions.php:1087
5734
  msgid "Surinamese dollar"
5735
  msgstr ""
5736
 
5737
- #: inc/lp-core-functions.php:1088
5738
  msgid "Swazi lilangeni"
5739
  msgstr ""
5740
 
5741
- #: inc/lp-core-functions.php:1089
5742
  msgid "Swedish krona"
5743
  msgstr ""
5744
 
5745
- #: inc/lp-core-functions.php:1090
5746
  msgid "Syrian pound"
5747
  msgstr ""
5748
 
5749
- #: inc/lp-core-functions.php:1091
5750
  msgid "New Taiwan dollar"
5751
  msgstr ""
5752
 
5753
- #: inc/lp-core-functions.php:1092
5754
  msgid "Tajikistani somoni"
5755
  msgstr ""
5756
 
5757
- #: inc/lp-core-functions.php:1093
5758
  msgid "Tanzanian shilling"
5759
  msgstr ""
5760
 
5761
- #: inc/lp-core-functions.php:1094
5762
  msgid "Thai baht "
5763
  msgstr ""
5764
 
5765
- #: inc/lp-core-functions.php:1095
5766
  msgid "Tongan pa’anga"
5767
  msgstr ""
5768
 
5769
- #: inc/lp-core-functions.php:1096
5770
  msgid "Trinidad and Tobago dollar"
5771
  msgstr ""
5772
 
5773
- #: inc/lp-core-functions.php:1097
5774
  msgid "Tunisian dinar"
5775
  msgstr ""
5776
 
5777
- #: inc/lp-core-functions.php:1098
5778
  msgid "Turkish lira"
5779
  msgstr ""
5780
 
5781
- #: inc/lp-core-functions.php:1099
5782
  msgid "Turkmenistani manat"
5783
  msgstr ""
5784
 
5785
- #: inc/lp-core-functions.php:1100
5786
  msgid "Ugandan shilling"
5787
  msgstr ""
5788
 
5789
- #: inc/lp-core-functions.php:1101
5790
  msgid "Ukrainian hryvnia"
5791
  msgstr ""
5792
 
5793
- #: inc/lp-core-functions.php:1102
5794
  msgid "United Arab Emirates dirham"
5795
  msgstr ""
5796
 
5797
- #: inc/lp-core-functions.php:1103
5798
  msgid "Uruguayan peso"
5799
  msgstr ""
5800
 
5801
- #: inc/lp-core-functions.php:1104
5802
  msgid "Uzbekistani som"
5803
  msgstr ""
5804
 
5805
- #: inc/lp-core-functions.php:1105
5806
  msgid "Vanuatu vatu"
5807
  msgstr ""
5808
 
5809
- #: inc/lp-core-functions.php:1106
5810
  msgid "Venezuelan bolivar"
5811
  msgstr ""
5812
 
5813
- #: inc/lp-core-functions.php:1107
5814
  msgid "Vietnamese dong"
5815
  msgstr ""
5816
 
5817
- #: inc/lp-core-functions.php:1108
5818
  msgid "Yemeni rial"
5819
  msgstr ""
5820
 
5821
- #: inc/lp-core-functions.php:1109
5822
  msgid "Zambian kwacha"
5823
  msgstr ""
5824
 
5825
- #: inc/lp-core-functions.php:1110
5826
  msgid "Zimbabwean dollar"
5827
  msgstr ""
5828
 
5829
- #: inc/lp-core-functions.php:1111
5830
  msgid "Jersey pound"
5831
  msgstr ""
5832
 
5833
- #: inc/lp-core-functions.php:1422
5834
- #: inc/lp-template-functions.php:1554
5835
  msgid "%s week"
5836
  msgid_plural "%s weeks"
5837
  msgstr[0] ""
5838
  msgstr[1] ""
5839
 
5840
- #: inc/lp-core-functions.php:1426
5841
- #: inc/lp-template-functions.php:1550
5842
  msgid "%s day"
5843
  msgid_plural "%s days"
5844
  msgstr[0] ""
5845
  msgstr[1] ""
5846
 
5847
- #: inc/lp-core-functions.php:1431
5848
- #: inc/lp-template-functions.php:1545
5849
  msgid "%s hour"
5850
  msgid_plural "%s hours"
5851
  msgstr[0] ""
5852
  msgstr[1] ""
5853
 
5854
- #: inc/lp-core-functions.php:1435
5855
- #: inc/lp-template-functions.php:1539
5856
  msgid "%s minute"
5857
  msgid_plural "%s minutes"
5858
  msgstr[0] ""
5859
  msgstr[1] ""
5860
 
5861
- #: inc/lp-core-functions.php:2216
5862
  msgid "Cart"
5863
  msgstr ""
5864
 
5865
- #: inc/lp-core-functions.php:2220
5866
  msgid "Enable cart"
5867
  msgstr ""
5868
 
5869
- #: inc/lp-core-functions.php:2221
5870
  msgid "Check this option to enable user purchase multiple courses at one time."
5871
  msgstr ""
5872
 
5873
- #: inc/lp-core-functions.php:2230
5874
  msgid "Add to cart redirect"
5875
  msgstr ""
5876
 
5877
- #: inc/lp-core-functions.php:2231
5878
  msgid "Redirect to checkout immediately after adding course to cart."
5879
  msgstr ""
5880
 
5881
- #: inc/lp-core-functions.php:2237
5882
  msgid "AJAX add to cart"
5883
  msgstr ""
5884
 
5885
- #: inc/lp-core-functions.php:2238
5886
  msgid "Using AJAX to add course to cart."
5887
  msgstr ""
5888
 
5889
- #: inc/lp-core-functions.php:2244
5890
  msgid "Cart page"
5891
  msgstr ""
5892
 
5893
- #: inc/lp-core-functions.php:2615
5894
  msgctxt "static-page-name"
5895
  msgid "Checkout"
5896
  msgstr ""
5897
 
5898
- #: inc/lp-core-functions.php:2616
5899
  msgctxt "static-page-name"
5900
  msgid "Courses"
5901
  msgstr ""
5902
 
5903
- #: inc/lp-core-functions.php:2617
5904
  msgctxt "static-page-name"
5905
  msgid "Profile"
5906
  msgstr ""
5907
 
5908
- #: inc/lp-core-functions.php:2618
5909
  msgctxt "static-page-name"
5910
  msgid "Become a Teacher"
5911
  msgstr ""
5912
 
5913
- #: inc/lp-core-functions.php:3302
5914
  msgid "Loading..."
5915
  msgstr ""
5916
 
5917
- #: inc/lp-core-functions.php:3305
5918
  msgid "Get Passing Grade"
5919
  msgstr ""
5920
 
5921
- #: inc/lp-core-functions.php:3310
5922
  msgid "Evaluate by the number of lessons completed per total number of lessons."
5923
  msgstr ""
5924
 
5925
- #: inc/lp-core-functions.php:3311
5926
  msgid "E.g: Course has 10 lessons and user completed 5 lessons then the result = 5/10 (50.%)"
5927
  msgstr ""
5928
 
5929
- #: inc/lp-core-functions.php:3313
5930
  msgid "Evaluate by result of final quiz in the course. You have to add a quiz to the end of the course."
5931
  msgstr ""
5932
 
5933
- #: inc/lp-core-functions.php:3319
5934
  msgid "Evaluate by the number of quizzes passed per total number of quizzes."
5935
  msgstr ""
5936
 
5937
- #: inc/lp-core-functions.php:3320
5938
  msgid "E.g: The course has 10 quizzes and the user passed 5 quizzes then the result = 5/10 (50%)."
5939
  msgstr ""
5940
 
5941
- #: inc/lp-core-functions.php:3327
5942
  msgid "Evaluate by total number of correct answers per total number of questions."
5943
  msgstr ""
5944
 
5945
- #: inc/lp-core-functions.php:3328
5946
  msgid "E.g: Course has 10 questions. User correct 5 questions. Result is 5/10 (50%)."
5947
  msgstr ""
5948
 
5949
- #: inc/lp-core-functions.php:3333
5950
  msgid "Evaluate by total score achieved per total score of the questions."
5951
  msgstr ""
5952
 
5953
- #: inc/lp-core-functions.php:3339
5954
  msgid "Evaluate via lessons"
5955
  msgstr ""
5956
 
5957
- #: inc/lp-core-functions.php:3343
5958
  msgid "Evaluate via results of the final quiz"
5959
  msgstr ""
5960
 
5961
- #: inc/lp-core-functions.php:3347
5962
  msgid "Evaluate via quizzes passed"
5963
  msgstr ""
5964
 
5965
- #: inc/lp-core-functions.php:3351
5966
  msgid "Evaluate via questions"
5967
  msgstr ""
5968
 
5969
- #: inc/lp-core-functions.php:3355
5970
  msgid "Evaluate via mark"
5971
  msgstr ""
5972
 
5973
- #: inc/lp-core-functions.php:3672
5974
  msgid "Heads up, Please backup before upgrade!"
5975
  msgstr ""
5976
 
5977
- #: inc/lp-core-functions.php:3675
5978
  msgid "The latest update includes some substantial changes across different areas of the plugin. We highly recommend you backup your site before upgrading, and make sure you first update in a staging environment"
5979
  msgstr ""
5980
 
5981
- #: inc/lp-core-functions.php:3676
5982
  msgid "Learners require WordPress version "
5983
  msgstr ""
5984
 
@@ -5989,7 +5963,7 @@ msgstr ""
5989
  #: inc/lp-deprecated.php:355
5990
  #: inc/lp-deprecated.php:386
5991
  #: inc/templates/class-lp-template-profile.php:102
5992
- #: inc/user-item/class-lp-user-item.php:808
5993
  #: inc/user/class-lp-profile.php:873
5994
  #: inc/user/class-lp-profile.php:907
5995
  msgid "Finished"
@@ -6042,42 +6016,42 @@ msgstr ""
6042
  msgid "Overview"
6043
  msgstr ""
6044
 
6045
- #: inc/lp-template-functions.php:1003
6046
- #: inc/lp-template-functions.php:1189
6047
- #: inc/templates/class-lp-template-course.php:131
6048
  msgid "Final"
6049
  msgstr ""
6050
 
6051
- #: inc/lp-template-functions.php:1428
6052
  msgid "Course Sidebar"
6053
  msgstr ""
6054
 
6055
- #: inc/lp-template-functions.php:1430
6056
  msgid "Widgets in this area will be shown in single course"
6057
  msgstr ""
6058
 
6059
- #: inc/lp-template-functions.php:1439
6060
  msgid "All Courses"
6061
  msgstr ""
6062
 
6063
- #: inc/lp-template-functions.php:1441
6064
  msgid "Widgets in this area will be shown in all courses page"
6065
  msgstr ""
6066
 
6067
- #: inc/lp-template-functions.php:1578
6068
- #: inc/lp-template-functions.php:1587
6069
  msgid "All levels"
6070
  msgstr ""
6071
 
6072
- #: inc/lp-template-functions.php:1588
6073
  msgid "Beginner"
6074
  msgstr ""
6075
 
6076
- #: inc/lp-template-functions.php:1589
6077
  msgid "Intermediate"
6078
  msgstr ""
6079
 
6080
- #: inc/lp-template-functions.php:1590
6081
  msgid "Expert"
6082
  msgstr ""
6083
 
@@ -6316,76 +6290,78 @@ msgstr ""
6316
  msgid "Showing %1$s of %2$s results"
6317
  msgstr ""
6318
 
6319
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:380
6320
  msgid "Error: No course available!."
6321
  msgstr ""
6322
 
6323
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:388
6324
  msgid "Invalid course!"
6325
  msgstr ""
6326
 
6327
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:394
6328
  msgid "Error: Cannot enroll course."
6329
  msgstr ""
6330
 
6331
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:415
6332
  msgid "Error: Can't Enroll course."
6333
  msgstr ""
6334
 
6335
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:455
6336
  msgid "Congrats! You enroll course successfully. Redirecting..."
6337
  msgstr ""
6338
 
6339
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:473
6340
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:612
6341
  msgid "Error: Please setup page for checkout."
6342
  msgstr ""
6343
 
6344
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:478
6345
  msgid "Redirecting..."
6346
  msgstr ""
6347
 
6348
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:508
6349
  msgid "Error: Invalid Course ID."
6350
  msgstr ""
6351
 
6352
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:514
6353
  msgid "Error: No Course available."
6354
  msgstr ""
6355
 
6356
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:520
6357
  msgid "Error: Cannot purchase course!."
6358
  msgstr ""
6359
 
6360
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:558
6361
  msgid "Reset Course progress"
6362
  msgstr ""
6363
 
6364
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:564
6365
  msgid "Continue Course progress"
6366
  msgstr ""
6367
 
6368
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:572
6369
  msgid "Repurchase Options"
6370
  msgstr ""
6371
 
6372
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:619
6373
  msgid "\"%s\" has been added to your cart."
6374
  msgstr ""
6375
 
6376
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:644
6377
  msgid "Invalid params"
6378
  msgstr ""
6379
 
6380
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:650
 
 
6381
  msgid "Invalid course"
6382
  msgstr ""
6383
 
6384
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:662
6385
  msgid "You can't retry course"
6386
  msgstr ""
6387
 
6388
- #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:688
6389
  msgid "Now you can learn this course"
6390
  msgstr ""
6391
 
@@ -6510,39 +6486,39 @@ msgstr ""
6510
  msgid "You can't viewing user profile"
6511
  msgstr ""
6512
 
6513
- #: inc/templates/class-lp-template-course.php:306
6514
  #: inc/widgets/course-extra.php:33
6515
  msgid "Key features"
6516
  msgstr ""
6517
 
6518
- #: inc/templates/class-lp-template-course.php:329
6519
- #: inc/templates/class-lp-template-course.php:914
6520
  msgid "Target audiences"
6521
  msgstr ""
6522
 
6523
- #: inc/templates/class-lp-template-course.php:874
6524
  msgid "%d lesson"
6525
  msgid_plural "%d lessons"
6526
  msgstr[0] ""
6527
  msgstr[1] ""
6528
 
6529
- #: inc/templates/class-lp-template-course.php:878
6530
  msgid "%d quiz"
6531
  msgid_plural "%d quizzes"
6532
  msgstr[0] ""
6533
  msgstr[1] ""
6534
 
6535
- #: inc/templates/class-lp-template-course.php:882
6536
  msgid "%d student"
6537
  msgid_plural "%d students"
6538
  msgstr[0] ""
6539
  msgstr[1] ""
6540
 
6541
- #: inc/templates/class-lp-template-course.php:910
6542
  msgid "Features"
6543
  msgstr ""
6544
 
6545
- #: inc/templates/class-lp-template-course.php:1007
6546
  msgid "View More"
6547
  msgstr ""
6548
 
@@ -6550,38 +6526,46 @@ msgstr ""
6550
  msgid "Not Started"
6551
  msgstr ""
6552
 
6553
- #: inc/user-item/class-lp-user-item-quiz.php:760
6554
  msgid "Question is invalid!"
6555
  msgstr ""
6556
 
6557
- #: inc/user-item/class-lp-user-item-quiz.php:765
6558
  msgid "Cannot check answer the question."
6559
  msgstr ""
6560
 
6561
- #: inc/user-item/class-lp-user-item.php:804
6562
  #: templates/profile/tabs/courses.php:33
6563
  msgid "Enrolled"
6564
  msgstr ""
6565
 
6566
- #: inc/user-item/class-lp-user-item.php:807
6567
  msgid "Started"
6568
  msgstr ""
6569
 
6570
- #: inc/user-item/class-lp-user-item.php:815
6571
  msgid "Not Enrolled"
6572
  msgstr ""
6573
 
6574
- #: inc/user/abstract-lp-user.php:760
6575
  msgid "You can not hint question."
6576
  msgstr ""
6577
 
6578
- #: inc/user/abstract-lp-user.php:872
6579
- #: inc/user/abstract-lp-user.php:1030
6580
- #: inc/user/abstract-lp-user.php:1042
6581
  msgid "The role %s for user doesn't exist"
6582
  msgstr ""
6583
 
6584
- #: inc/user/abstract-lp-user.php:1114
 
 
 
 
 
 
 
 
6585
  msgid "You have already completed this lesson."
6586
  msgstr ""
6587
 
@@ -6747,63 +6731,63 @@ msgstr ""
6747
  msgid "%1$s::%2$s - Your Quiz can't retake."
6748
  msgstr ""
6749
 
6750
- #: inc/user/lp-user-functions.php:374
6751
  msgid "Want to become an instructor?"
6752
  msgstr ""
6753
 
6754
- #: inc/user/lp-user-functions.php:892
6755
  msgid "Please login to enroll this course"
6756
  msgstr ""
6757
 
6758
- #: inc/user/lp-user-functions.php:910
6759
  msgid "You have already finished course"
6760
  msgstr ""
6761
 
6762
- #: inc/user/lp-user-functions.php:913
6763
  msgid "You have already enrolled in this course"
6764
  msgstr ""
6765
 
6766
- #: inc/user/lp-user-functions.php:1194
6767
  msgid "Old password incorrect!"
6768
  msgstr ""
6769
 
6770
- #: inc/user/lp-user-functions.php:1200
6771
  msgid "Confirmation password incorrect!"
6772
  msgstr ""
6773
 
6774
- #: inc/user/lp-user-functions.php:1487
6775
  msgid "Invalid item id."
6776
  msgstr ""
6777
 
6778
- #: inc/user/lp-user-functions.php:1520
6779
  msgid "Invalid item data."
6780
  msgstr ""
6781
 
6782
- #: inc/user/lp-user-functions.php:1694
6783
  msgid "Invalid Course ID."
6784
  msgstr ""
6785
 
6786
- #: inc/user/lp-user-functions.php:1714
6787
  msgid "Invalid Quiz"
6788
  msgstr ""
6789
 
6790
- #: inc/user/lp-user-functions.php:2117
6791
  msgid "Facebook Profile"
6792
  msgstr ""
6793
 
6794
- #: inc/user/lp-user-functions.php:2120
6795
  msgid "Twitter Profile"
6796
  msgstr ""
6797
 
6798
- #: inc/user/lp-user-functions.php:2123
6799
  msgid "Google Profile"
6800
  msgstr ""
6801
 
6802
- #: inc/user/lp-user-functions.php:2126
6803
  msgid "Youtube Channel"
6804
  msgstr ""
6805
 
6806
- #: inc/user/lp-user-functions.php:2129
6807
  msgid "Linkedin Profile"
6808
  msgstr ""
6809
 
@@ -6959,11 +6943,11 @@ msgstr ""
6959
  msgid "Recent Courses"
6960
  msgstr ""
6961
 
6962
- #: learnpress.php:480
6963
  msgid "Documentation"
6964
  msgstr ""
6965
 
6966
- #: learnpress.php:492
6967
  msgid "LearnPress plugin base directory must be <strong>learnpress/learnpres.php</strong> (case sensitive) to ensure all functions work properly and fully operational (currently <strong>%s</strong>)"
6968
  msgstr ""
6969
 
@@ -7336,7 +7320,7 @@ msgstr ""
7336
 
7337
  #: templates/profile/tabs/quizzes.php:56
7338
  #: assets/js/dist/frontend/quiz.min.js:22
7339
- #: assets/js/dist/frontend/quiz.min.js:202
7340
  msgid "Time spent"
7341
  msgstr ""
7342
 
@@ -7632,15 +7616,15 @@ msgstr ""
7632
  msgid "Questions:"
7633
  msgstr ""
7634
 
7635
- #: assets/js/dist/frontend/quiz.min.js:184
7636
  msgid "Your Result"
7637
  msgstr ""
7638
 
7639
- #: assets/js/dist/frontend/quiz.min.js:218
7640
  msgid "Wrong"
7641
  msgstr ""
7642
 
7643
- #: assets/js/dist/frontend/quiz.min.js:222
7644
  msgid "Skipped"
7645
  msgstr ""
7646
 
2
  # This file is distributed under the same license as the LearnPress plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LearnPress 4.1.7.2-beta-4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/lp-doing\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-10-03T11:01:40+03:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: learnpress\n"
162
 
163
  #: config/settings/course.php:138
164
  #: inc/admin/settings/class-lp-settings-advanced.php:72
165
+ #: inc/course/lp-course-functions.php:450
166
  #: inc/custom-post-types/lesson.php:158
167
+ #: inc/lp-template-functions.php:1004
168
  msgid "Lesson"
169
  msgstr ""
170
 
171
  #: config/settings/course.php:146
172
  #: inc/admin/settings/class-lp-settings-advanced.php:79
173
+ #: inc/course/lp-course-functions.php:451
174
  #: inc/custom-post-types/question.php:320
175
  #: inc/custom-post-types/quiz.php:87
176
+ #: inc/lp-template-functions.php:994
177
  #: templates/profile/tabs/quizzes.php:54
178
  msgid "Quiz"
179
  msgstr ""
265
 
266
  #: config/settings/general.php:105
267
  #: inc/admin/settings/class-lp-settings-advanced.php:56
268
+ #: inc/admin/views/addons/html-themes.php:28
269
  msgid "Other"
270
  msgstr ""
271
 
432
  #: inc/admin/class-lp-admin.php:249
433
  #: inc/admin/views/meta-boxes/fields/date.php:39
434
  #: inc/class-lp-assets.php:73
435
+ #: inc/lp-core-functions.php:2771
436
  #: inc/order/class-lp-order.php:954
437
  #: assets/js/dist/frontend/quiz.min.js:44
438
  msgid "Cancel"
478
  #: inc/admin/settings/class-lp-settings-profile.php:150
479
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:21
480
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:28
481
+ #: inc/class-lp-page-controller.php:247
482
+ #: inc/custom-post-types/course.php:105
483
  #: inc/custom-post-types/course.php:107
 
484
  #: inc/lp-template-functions.php:312
485
  #: inc/settings/class-lp-settings-courses.php:16
486
  #: inc/user/class-lp-profile.php:246
586
  msgid "Edit"
587
  msgstr ""
588
 
589
+ #: inc/admin/class-lp-install-sample-data.php:187
590
  msgid "No data sample."
591
  msgstr ""
592
 
593
+ #: inc/admin/class-lp-install-sample-data.php:208
594
  msgid "Delete sample data successfully!"
595
  msgstr ""
596
 
597
+ #: inc/admin/class-lp-install-sample-data.php:354
598
  msgid "Sample course"
599
  msgstr ""
600
 
601
+ #: inc/admin/class-lp-install-sample-data.php:702
602
  msgctxt "install-sample-course"
603
  msgid "[TRUE] - "
604
  msgstr ""
605
 
606
+ #: inc/admin/class-lp-install-sample-data.php:710
607
  msgctxt "install-sample-course"
608
  msgid " [TRUE] - "
609
  msgstr ""
630
 
631
  #: inc/admin/class-lp-modal-search-items.php:183
632
  #: inc/admin/class-lp-modal-search-users.php:141
633
+ #: inc/lp-core-functions.php:648
634
  msgid "<"
635
  msgstr ""
636
 
637
  #: inc/admin/class-lp-modal-search-items.php:184
638
  #: inc/admin/class-lp-modal-search-users.php:142
639
+ #: inc/lp-core-functions.php:649
640
  msgid ">"
641
  msgstr ""
642
 
716
 
717
  #: inc/admin/class-lp-plugin-install-list-table.php:483
718
  #: inc/class-lp-datetime.php:209
719
+ #: inc/custom-post-types/order.php:762
720
  #: inc/order/class-lp-order.php:150
721
  #: inc/user-item/class-lp-user-item.php:240
722
  msgid "%s ago"
774
  msgid "LP Terms and Conditions"
775
  msgstr ""
776
 
777
+ #: inc/admin/class-lp-setup-wizard.php:214
778
  msgid "Welcome"
779
  msgstr ""
780
 
781
+ #: inc/admin/class-lp-setup-wizard.php:216
782
  msgid "Run Setup Wizard"
783
  msgstr ""
784
 
785
+ #: inc/admin/class-lp-setup-wizard.php:219
786
  msgid "Pages"
787
  msgstr ""
788
 
789
+ #: inc/admin/class-lp-setup-wizard.php:229
790
  #: inc/admin/meta-box/fields/payment-order.php:7
791
  #: inc/admin/views/setup/steps/payment.php:16
792
  #: templates/checkout/payment.php:25
793
  msgid "Payment"
794
  msgstr ""
795
 
796
+ #: inc/admin/class-lp-setup-wizard.php:237
797
  #: inc/admin/views/setup/content.php:67
798
  #: inc/admin/views/setup/steps/finish.php:12
799
  msgid "Finish"
800
  msgstr ""
801
 
802
+ #: inc/admin/class-lp-setup-wizard.php:354
803
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:92
804
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:96
805
  msgid "PayPal"
871
  msgstr ""
872
 
873
  #: inc/admin/lp-admin-actions.php:222
874
+ #: inc/custom-post-types/course.php:485
875
  msgid "Categories"
876
  msgstr ""
877
 
1001
  #: inc/admin/views/statistics/general.php:8
1002
  #: inc/admin/views/statistics/orders.php:8
1003
  #: inc/admin/views/statistics/users.php:8
1004
+ #: inc/custom-post-types/course.php:464
1005
+ #: inc/custom-post-types/course.php:481
1006
  msgid "Students"
1007
  msgstr ""
1008
 
1028
 
1029
  #: inc/admin/lp-admin-functions.php:1243
1030
  #: inc/admin/lp-admin-functions.php:2317
1031
+ #: inc/course/abstract-course.php:663
1032
+ #: inc/course/abstract-course.php:692
1033
  #: templates/order/order-details.php:43
1034
  msgid "Free"
1035
  msgstr ""
1036
 
1037
  #: inc/admin/lp-admin-functions.php:1444
1038
  #: inc/user-item/class-lp-user-item-quiz.php:146
1039
+ #: inc/user-item/class-lp-user-item.php:801
1040
  #: templates/content-lesson/button-complete.php:37
1041
  msgid "Completed"
1042
  msgstr ""
1182
  msgstr ""
1183
 
1184
  #: inc/admin/meta-box/fields/payment-order.php:10
1185
+ #: inc/emails/class-lp-email.php:856
1186
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:315
1187
  msgid "Enable/Disable"
1188
  msgstr ""
1262
  msgstr ""
1263
 
1264
  #: inc/admin/settings/class-lp-settings-emails.php:136
1265
+ #: inc/emails/class-lp-email.php:888
1266
  msgid "Content type"
1267
  msgstr ""
1268
 
1332
  msgstr ""
1333
 
1334
  #: inc/admin/settings/class-lp-settings-profile.php:89
1335
+ #: inc/user/lp-user-functions.php:1848
1336
+ #: inc/user/lp-user-functions.php:1850
1337
  #: templates/profile/tabs/settings/basic-information.php:33
1338
  msgid "First name"
1339
  msgstr ""
1340
 
1341
  #: inc/admin/settings/class-lp-settings-profile.php:96
1342
+ #: inc/user/lp-user-functions.php:1861
1343
+ #: inc/user/lp-user-functions.php:1863
1344
  #: templates/profile/tabs/settings/basic-information.php:39
1345
  msgid "Last name"
1346
  msgstr ""
1347
 
1348
  #: inc/admin/settings/class-lp-settings-profile.php:103
1349
  #: inc/admin/settings/class-lp-settings-profile.php:115
1350
+ #: inc/user/lp-user-functions.php:1874
1351
+ #: inc/user/lp-user-functions.php:1876
1352
  #: templates/profile/tabs/settings/basic-information.php:45
1353
  msgid "Display name"
1354
  msgstr ""
1417
  #: inc/admin/settings/class-lp-settings-profile.php:166
1418
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:22
1419
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:29
1420
+ #: inc/custom-post-types/order.php:823
 
1421
  #: inc/custom-post-types/order.php:824
1422
+ #: inc/custom-post-types/order.php:828
1423
  #: inc/user/class-lp-profile.php:260
1424
  msgid "Orders"
1425
  msgstr ""
1434
  #: inc/admin/settings/class-lp-settings-profile.php:188
1435
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:18
1436
  #: inc/user/class-lp-profile.php:274
1437
+ #: learnpress.php:484
1438
  msgid "Settings"
1439
  msgstr ""
1440
 
1493
  msgstr ""
1494
 
1495
  #: inc/admin/sub-menus/class-lp-submenu-addons.php:14
1496
+ #: learnpress.php:486
1497
  msgid "Add-ons"
1498
  msgstr ""
1499
 
1501
  msgid "LearnPress Add-ons"
1502
  msgstr ""
1503
 
1504
+ #: inc/admin/sub-menus/class-lp-submenu-addons.php:33
1505
  msgid "Get more (%d)"
1506
  msgstr ""
1507
 
1508
+ #: inc/admin/sub-menus/class-lp-submenu-addons.php:34
1509
  msgid "Installed (%d)"
1510
  msgstr ""
1511
 
1512
+ #: inc/admin/sub-menus/class-lp-submenu-addons.php:35
1513
  msgid "Themes (%d)"
1514
  msgstr ""
1515
 
1516
+ #: inc/admin/sub-menus/class-lp-submenu-addons.php:63
1517
  msgid "Search..."
1518
  msgstr ""
1519
 
1569
  msgid "Installed add-ons"
1570
  msgstr ""
1571
 
1572
+ #: inc/admin/views/addons/html-plugins-more.php:18
 
 
 
 
 
1573
  msgid "There is no available add-ons."
1574
  msgstr ""
1575
 
1576
+ #: inc/admin/views/addons/html-plugins-more.php:26
1577
  msgid "Free add-ons"
1578
  msgstr ""
1579
 
1580
+ #: inc/admin/views/addons/html-plugins-more.php:31
1581
  msgid "Premium add-ons"
1582
  msgstr ""
1583
 
1584
+ #: inc/admin/views/addons/html-themes.php:18
1585
  msgid "No related themes."
1586
  msgstr ""
1587
 
1588
+ #: inc/admin/views/addons/html-themes.php:24
1589
  msgid "Education Support"
1590
  msgstr ""
1591
 
1606
 
1607
  #: inc/admin/views/course/modal-choose-items.php:54
1608
  #: inc/admin/views/quiz/modal-choose-items.php:52
1609
+ #: inc/custom-post-types/course.php:74
1610
  #: inc/custom-post-types/quiz.php:170
1611
  msgid "Selected items"
1612
  msgstr ""
1741
  msgstr ""
1742
 
1743
  #: inc/admin/views/meta-boxes/course/settings.php:50
1744
+ #: inc/admin/views/meta-boxes/course/settings.php:286
1745
+ #: inc/custom-post-types/course.php:462
1746
+ #: inc/custom-post-types/course.php:479
1747
  #: inc/custom-post-types/lesson.php:221
1748
  #: inc/custom-post-types/question.php:319
1749
  #: inc/custom-post-types/quiz.php:236
1865
  msgid "Normally use for offline classes, Ex: link to a contact page. Format: https://google.com"
1866
  msgstr ""
1867
 
1868
+ #: inc/admin/views/meta-boxes/course/settings.php:207
1869
  msgid "Regular price"
1870
  msgstr ""
1871
 
1872
+ #: inc/admin/views/meta-boxes/course/settings.php:208
1873
  msgid "Set a regular price (<strong>%s</strong>). Leave it blank for <strong>Free</strong>."
1874
  msgstr ""
1875
 
1876
+ #: inc/admin/views/meta-boxes/course/settings.php:221
1877
  msgid "Sale price"
1878
  msgstr ""
1879
 
1880
+ #: inc/admin/views/meta-boxes/course/settings.php:222
1881
  msgid "Schedule"
1882
  msgstr ""
1883
 
1884
+ #: inc/admin/views/meta-boxes/course/settings.php:235
1885
  msgid "Sale start dates"
1886
  msgstr ""
1887
 
1888
+ #: inc/admin/views/meta-boxes/course/settings.php:240
1889
  msgctxt "placeholder"
1890
  msgid "From&hellip;"
1891
  msgstr ""
1892
 
1893
+ #: inc/admin/views/meta-boxes/course/settings.php:244
1894
  msgid "Sale end dates"
1895
  msgstr ""
1896
 
1897
+ #: inc/admin/views/meta-boxes/course/settings.php:249
1898
  msgctxt "placeholder"
1899
  msgid "To&hellip;"
1900
  msgstr ""
1901
 
1902
+ #: inc/admin/views/meta-boxes/course/settings.php:254
1903
  msgid "No enroll requirement"
1904
  msgstr ""
1905
 
1906
+ #: inc/admin/views/meta-boxes/course/settings.php:255
1907
  msgid "Students can see the content of all course items and do the quiz without login."
1908
  msgstr ""
1909
 
1910
+ #: inc/admin/views/meta-boxes/course/settings.php:304
1911
  msgid "The method to assess the result of a student for a course."
1912
  msgstr ""
1913
 
1914
+ #: inc/admin/views/meta-boxes/course/settings.php:307
1915
  msgid "<br /><strong>Note! </strong>No final quiz in course, please add a final quiz"
1916
  msgstr ""
1917
 
1918
+ #: inc/admin/views/meta-boxes/course/settings.php:329
1919
  #: inc/rest-api/v1/admin/class-lp-admin-rest-course-controller.php:81
1920
  msgid "Edit: %s"
1921
  msgstr ""
1922
 
1923
+ #: inc/admin/views/meta-boxes/course/settings.php:340
1924
  msgid "Evaluation"
1925
  msgstr ""
1926
 
1927
+ #: inc/admin/views/meta-boxes/course/settings.php:348
1928
  #: inc/admin/views/meta-boxes/quiz/settings.php:29
1929
  msgid "Passing Grade(%)"
1930
  msgstr ""
1931
 
1932
+ #: inc/admin/views/meta-boxes/course/settings.php:349
1933
  msgid "The condition that must be achieved to finish the course."
1934
  msgstr ""
1935
 
1936
+ #: inc/admin/views/meta-boxes/course/settings.php:370
1937
+ #: inc/templates/class-lp-template-course.php:288
1938
+ #: inc/templates/class-lp-template-course.php:802
1939
  #: inc/widgets/course-extra.php:35
1940
  msgid "Requirements"
1941
  msgstr ""
1942
 
1943
+ #: inc/admin/views/meta-boxes/course/settings.php:375
1944
  msgid "Target Audience"
1945
  msgstr ""
1946
 
1947
+ #: inc/admin/views/meta-boxes/course/settings.php:380
1948
  msgid "Key Features"
1949
  msgstr ""
1950
 
1951
+ #: inc/admin/views/meta-boxes/course/settings.php:385
1952
  #: inc/lp-template-functions.php:80
1953
  msgid "FAQs"
1954
  msgstr ""
1970
 
1971
  #: inc/admin/views/meta-boxes/fields/extra-faq.php:41
1972
  #: inc/admin/views/meta-boxes/fields/extra-faq.php:61
1973
+ #: inc/custom-post-types/course.php:463
1974
+ #: inc/custom-post-types/course.php:480
1975
  #: inc/external-plugin/elementor/widgets/become-a-teacher.php:26
1976
  #: inc/external-plugin/elementor/widgets/list-courses.php:32
1977
  msgid "Content"
2000
  #: inc/custom-post-types/abstract.php:960
2001
  #: inc/custom-post-types/lesson.php:130
2002
  #: inc/custom-post-types/lesson.php:230
2003
+ #: inc/lp-template-functions.php:1007
2004
  #: templates/loop/single-course/loop-section-item.php:32
2005
  #: templates/single-course/section/item-meta.php:32
2006
  msgid "Preview"
2045
 
2046
  #: inc/admin/views/meta-boxes/order/content-tab-preview-exports-invoice.php:72
2047
  #: inc/admin/views/meta-boxes/order/details.php:155
2048
+ #: inc/custom-post-types/course.php:77
2049
  #: templates/checkout/order-received.php:60
2050
  msgid "Item"
2051
  msgstr ""
2071
 
2072
  #: inc/admin/views/meta-boxes/order/content-tab-preview-exports-invoice.php:106
2073
  #: inc/admin/views/meta-boxes/order/details.php:158
2074
+ #: inc/custom-post-types/order.php:670
2075
  #: templates/checkout/order-received.php:107
2076
  #: templates/checkout/review-order.php:103
2077
  #: templates/emails/order-items-table.php:118
2203
  #: inc/admin/views/meta-boxes/question/settings.php:17
2204
  #: inc/admin/views/quiz/question-meta.php:28
2205
  #: assets/js/dist/frontend/quiz.min.js:76
2206
+ #: assets/js/dist/frontend/quiz.min.js:198
2207
  msgid "Points"
2208
  msgstr ""
2209
 
2398
  #: inc/custom-post-types/quiz.php:238
2399
  #: inc/custom-post-types/quiz.php:464
2400
  #: assets/js/dist/frontend/quiz.min.js:21
2401
+ #: assets/js/dist/frontend/quiz.min.js:202
2402
  msgid "Questions"
2403
  msgstr ""
2404
 
2419
  msgstr ""
2420
 
2421
  #: inc/admin/views/setup/content.php:50
2422
+ #: inc/custom-post-types/course.php:73
2423
  #: inc/custom-post-types/quiz.php:169
2424
  msgid "Back"
2425
  msgstr ""
2629
  msgstr ""
2630
 
2631
  #: inc/admin/views/statistics/orders.php:47
2632
+ #: inc/custom-post-types/order.php:669
2633
  #: templates/checkout/order-received.php:94
2634
  #: templates/profile/tabs/orders/list.php:32
2635
  #: templates/profile/tabs/quizzes.php:57
2637
  msgstr ""
2638
 
2639
  #: inc/admin/views/statistics/orders.php:49
2640
+ #: inc/custom-post-types/course.php:164
2641
  msgid "Course Category"
2642
  msgstr ""
2643
 
2703
  msgid "Course list of user enrolled"
2704
  msgstr ""
2705
 
2706
+ #: inc/background-process/class-lp-background-query-items.php:128
2707
+ #: inc/background-process/class-lp-background-query-items.php:182
2708
  msgid "There is no items found!"
2709
  msgstr ""
2710
 
2711
+ #: inc/background-process/class-lp-background-query-items.php:133
2712
  msgid "WP query plugins error!"
2713
  msgstr ""
2714
 
2715
+ #: inc/background-process/class-lp-background-query-items.php:136
2716
  msgid "WP query plugins empty!"
2717
  msgstr ""
2718
 
2719
+ #: inc/background-process/class-lp-background-query-items.php:232
2720
  msgid "There is no item found!"
2721
  msgstr ""
2722
 
2740
  msgid "No theme is defined for this template."
2741
  msgstr ""
2742
 
2743
+ #: inc/cart/class-lp-cart.php:131
2744
  msgid "Get cart should not be called before the wp_loaded action."
2745
  msgstr ""
2746
 
2747
+ #: inc/cart/class-lp-cart.php:163
2748
  msgid "Sorry! This course is not purchasable."
2749
  msgstr ""
2750
 
2751
+ #: inc/cart/class-lp-cart.php:167
2752
  msgid "Sorry! The number of enrolled students has reached limit"
2753
  msgstr ""
2754
 
2755
+ #: inc/cart/class-lp-cart.php:327
2756
  msgid "%s has been removed from your cart because it can no longer be purchased."
2757
  msgstr ""
2758
 
2759
+ #: inc/cart/class-lp-cart.php:508
2760
  msgid "Checkout page hasn't been setup"
2761
  msgstr ""
2762
 
2763
+ #: inc/class-lp-ajax.php:85
2764
  msgid "The order %s has been successfully recovered."
2765
  msgstr ""
2766
 
2767
+ #: inc/class-lp-ajax.php:113
2768
  msgid "Your email is already exists. Continue with this email?"
2769
  msgstr ""
2770
 
2771
+ #: inc/class-lp-ajax.php:120
2772
  msgid "Create new account with this email? Account information will be sent to this email."
2773
  msgstr ""
2774
 
2775
+ #: inc/class-lp-ajax.php:146
2776
  msgid "Access denied!"
2777
  msgstr ""
2778
 
2779
+ #: inc/class-lp-ajax.php:163
2780
  msgid "You have finished this course \"%s\""
2781
  msgstr ""
2782
 
2783
+ #: inc/class-lp-ajax.php:166
2784
  msgid "Error! You cannot finish this course. Please contact your administrator for more information."
2785
  msgstr ""
2786
 
2787
+ #: inc/class-lp-ajax.php:193
2788
  msgid "Error! Invalid lesson or failed security check."
2789
  msgstr ""
2790
 
2791
+ #: inc/class-lp-ajax.php:198
2792
+ msgid "Error! Invalid lesson."
2793
+ msgstr ""
2794
+
2795
+ #: inc/class-lp-ajax.php:203
2796
+ msgid "Please login."
2797
+ msgstr ""
2798
+
2799
+ #: inc/class-lp-ajax.php:208
2800
+ msgid "Course is invalid!."
2801
+ msgstr ""
2802
+
2803
+ #: inc/class-lp-ajax.php:225
2804
  msgid "Congrats! You have completed \"%s\"."
2805
  msgstr ""
2806
 
2807
  #: inc/class-lp-assets.php:72
2808
+ #: inc/lp-core-functions.php:2770
2809
  #: assets/js/dist/frontend/quiz.min.js:41
2810
  msgid "OK"
2811
  msgstr ""
2812
 
2813
  #: inc/class-lp-assets.php:74
2814
+ #: inc/lp-core-functions.php:2772
2815
  #: templates/global/lp-modal-overlay.php:24
2816
  msgid "Yes"
2817
  msgstr ""
2818
 
2819
  #: inc/class-lp-assets.php:75
2820
+ #: inc/lp-core-functions.php:2773
2821
  #: templates/global/lp-modal-overlay.php:23
2822
  msgid "No"
2823
  msgstr ""
2824
 
2825
+ #: inc/class-lp-assets.php:86
2826
+ #: inc/class-lp-assets.php:93
2827
  #: inc/external-plugin/elementor/widgets/become-a-teacher.php:62
2828
  #: inc/shortcodes/class-lp-shortcode-become-a-teacher.php:89
2829
  msgid "Processing"
2830
  msgstr ""
2831
 
2832
+ #: inc/class-lp-assets.php:87
2833
+ #: inc/class-lp-assets.php:94
2834
  msgid "Redirecting"
2835
  msgstr ""
2836
 
2837
+ #: inc/class-lp-assets.php:88
2838
  #: inc/class-lp-checkout.php:626
2839
  msgid "Invalid field"
2840
  msgstr ""
2841
 
2842
+ #: inc/class-lp-assets.php:89
2843
  msgid "Unknown error"
2844
  msgstr ""
2845
 
2846
+ #: inc/class-lp-assets.php:90
2847
  #: templates/checkout/payment.php:70
2848
  msgid "Place order"
2849
  msgstr ""
2962
  msgstr ""
2963
 
2964
  #: inc/class-lp-checkout.php:686
 
2965
  msgid "Your cart is currently empty."
2966
  msgstr ""
2967
 
2970
  msgstr ""
2971
 
2972
  #: inc/class-lp-forms-handler.php:30
2973
+ #: inc/class-lp-forms-handler.php:232
2974
+ #: inc/curds/class-lp-user-curd.php:2138
2975
  msgid "Please enter a valid account username."
2976
  msgstr ""
2977
 
2978
  #: inc/class-lp-forms-handler.php:37
2979
+ #: inc/class-lp-forms-handler.php:222
2980
+ #: inc/curds/class-lp-user-curd.php:2128
2981
  msgid "Please provide a valid email address."
2982
  msgstr ""
2983
 
2997
  msgid "Username is required"
2998
  msgstr ""
2999
 
3000
+ #: inc/class-lp-forms-handler.php:171
3001
  msgid "I need become an instructor"
3002
  msgstr ""
3003
 
3004
+ #: inc/class-lp-forms-handler.php:186
3005
  msgid " was successfully created!"
3006
  msgstr ""
3007
 
3008
+ #: inc/class-lp-forms-handler.php:189
3009
  msgid "Your request become an instructor has been sent. We will get back to you soon!"
3010
  msgstr ""
3011
 
3012
+ #: inc/class-lp-forms-handler.php:226
3013
  msgid "An account is already registered with your email address."
3014
  msgstr ""
3015
 
3016
+ #: inc/class-lp-forms-handler.php:236
3017
+ #: inc/curds/class-lp-user-curd.php:2142
3018
  msgid "An account is already registered with that username. Please choose another."
3019
  msgstr ""
3020
 
3021
+ #: inc/class-lp-forms-handler.php:244
3022
  msgid "Please enter an account password."
3023
  msgstr ""
3024
 
3025
+ #: inc/class-lp-forms-handler.php:248
3026
  msgid "Password is too short!"
3027
  msgstr ""
3028
 
3029
+ #: inc/class-lp-forms-handler.php:252
3030
  msgid "Password can not have spacing!"
3031
  msgstr ""
3032
 
3033
+ #: inc/class-lp-forms-handler.php:256
3034
  msgid "Please enter confirm password."
3035
  msgstr ""
3036
 
3037
+ #: inc/class-lp-forms-handler.php:260
3038
  msgid "Confirmation password incorrect!."
3039
  msgstr ""
3040
 
3041
+ #: inc/class-lp-forms-handler.php:268
3042
+ #: inc/class-lp-forms-handler.php:335
3043
  msgid " is required field."
3044
  msgstr ""
3045
 
3046
+ #: inc/class-lp-forms-handler.php:313
3047
  msgid "Email is required"
3048
  msgstr ""
3049
 
3050
+ #: inc/class-lp-forms-handler.php:317
3051
  msgid "Display name is required"
3052
  msgstr ""
3053
 
3054
+ #: inc/class-lp-forms-handler.php:321
3055
+ #: inc/class-lp-forms-handler.php:325
3056
  msgid "Display name cannot be changed to email address due to privacy concern."
3057
  msgstr ""
3058
 
3059
+ #: inc/class-lp-forms-handler.php:327
3060
  msgid "This email address is already registered."
3061
  msgstr ""
3062
 
3063
+ #: inc/class-lp-forms-handler.php:359
3064
  msgid "Enter a username or email address."
3065
  msgstr ""
3066
 
3067
+ #: inc/class-lp-forms-handler.php:379
3068
+ #: inc/class-lp-forms-handler.php:383
3069
  msgid "Invalid username or email."
3070
  msgstr ""
3071
 
3072
+ #: inc/class-lp-forms-handler.php:394
3073
  msgid "Password reset is not allowed for this user."
3074
  msgstr ""
3075
 
3076
+ #: inc/class-lp-page-controller.php:136
3077
+ #: inc/course/lp-course-functions.php:177
3078
  msgctxt "slug"
3079
  msgid "uncategorized"
3080
  msgstr ""
3081
 
3082
+ #: inc/class-lp-page-controller.php:245
3083
  #: inc/lp-template-functions.php:310
3084
  msgid "Course Search Results"
3085
  msgstr ""
3086
 
3087
+ #: inc/class-lp-page-controller.php:315
3088
  msgid "No payment method is available."
3089
  msgstr ""
3090
 
3091
  #: inc/class-lp-query-list-table.php:27
3092
+ #: inc/custom-post-types/course.php:71
3093
  msgid "item"
3094
  msgstr ""
3095
 
3142
  msgid "course thumbnail"
3143
  msgstr ""
3144
 
3145
+ #: inc/class-lp-widget.php:247
3146
  msgid "There is no options for this widget."
3147
  msgstr ""
3148
 
3149
+ #: inc/course/abstract-course.php:772
3150
+ #: inc/course/abstract-course.php:792
3151
  #: inc/lesson/class-lp-lesson.php:104
3152
  #: inc/quiz/class-lp-quiz.php:637
3153
  msgid "The function %s doesn't exist"
3154
  msgstr ""
3155
 
3156
+ #: inc/course/abstract-course.php:1257
3157
  msgid "This course will end within next %s"
3158
  msgstr ""
3159
 
3160
+ #: inc/course/abstract-course.php:1285
3161
  msgctxt "External Link button text"
3162
  msgid "More Info"
3163
  msgstr ""
3164
 
3165
+ #: inc/course/abstract-course.php:1322
3166
  msgid "Tags: "
3167
  msgstr ""
3168
 
3186
  msgid "Unread"
3187
  msgstr ""
3188
 
3189
+ #: inc/course/lp-course-functions.php:760
3190
  msgid "Edit this item"
3191
  msgstr ""
3192
 
3193
+ #: inc/course/lp-course-functions.php:971
3194
+ #: inc/lp-core-functions.php:2410
3195
  #: inc/templates/class-lp-template-profile.php:103
3196
  #: inc/user-item/class-lp-user-item-quiz.php:147
3197
  #: inc/user/class-lp-profile.php:874
3200
  msgid "Passed"
3201
  msgstr ""
3202
 
3203
+ #: inc/course/lp-course-functions.php:974
3204
+ #: inc/lp-core-functions.php:2413
3205
  #: inc/templates/class-lp-template-profile.php:104
3206
  #: inc/user-item/class-lp-user-item-quiz.php:148
3207
  #: inc/user/class-lp-profile.php:875
3210
  msgid "Failed"
3211
  msgstr ""
3212
 
3213
+ #: inc/course/lp-course-functions.php:977
3214
+ #: inc/lp-core-functions.php:2416
3215
  #: inc/lp-deprecated.php:385
3216
  #: inc/templates/class-lp-template-profile.php:101
3217
  #: inc/user-item/class-lp-user-item-quiz.php:144
3219
  msgid "In Progress"
3220
  msgstr ""
3221
 
3222
+ #: inc/course/lp-course-functions.php:1055
3223
  msgid "lessons completed per total number of lessons."
3224
  msgstr ""
3225
 
3226
+ #: inc/course/lp-course-functions.php:1058
3227
  msgid "quizzes passed per total number of quizzes."
3228
  msgstr ""
3229
 
3230
+ #: inc/course/lp-course-functions.php:1061
3231
  msgid "Final Quiz"
3232
  msgstr ""
3233
 
3234
+ #: inc/course/lp-course-functions.php:1064
3235
  msgid "correct answers per total number of questions."
3236
  msgstr ""
3237
 
3238
+ #: inc/course/lp-course-functions.php:1067
3239
  msgid "score achieved per total score of the questions."
3240
  msgstr ""
3241
 
3242
+ #: inc/course/lp-course-functions.php:1076
3243
  msgid "Require"
3244
  msgstr ""
3245
 
3280
  msgid "Question does not exist."
3281
  msgstr ""
3282
 
3283
+ #: inc/curds/class-lp-question-curd.php:228
3284
+ #: inc/curds/class-lp-question-curd.php:240
3285
+ msgid "Failed to duplicate answer"
 
 
 
3286
  msgstr ""
3287
 
3288
+ #: inc/curds/class-lp-question-curd.php:283
 
 
 
 
 
 
 
 
3289
  msgid "Invalid question with ID \"%d\"."
3290
  msgstr ""
3291
 
3297
  msgid "Invalid quiz with ID \"%d\"."
3298
  msgstr ""
3299
 
3300
+ #: inc/curds/class-lp-user-curd.php:1931
3301
  msgid "No item in Order"
3302
  msgstr ""
3303
 
3304
+ #: inc/curds/class-lp-user-curd.php:2063
3305
  #: inc/user/class-lp-user.php:736
3306
  msgid "quiz"
3307
  msgstr ""
3308
 
3309
+ #: inc/curds/class-lp-user-curd.php:2064
3310
  #: inc/user/class-lp-user.php:737
3311
  msgid "quizzes"
3312
  msgstr ""
3313
 
3314
+ #: inc/curds/class-lp-user-curd.php:2132
3315
  msgid "An account is already registered with your email address. Please log in."
3316
  msgstr ""
3317
 
3318
+ #: inc/curds/class-lp-user-curd.php:2154
3319
  msgid "Failed to create user"
3320
  msgstr ""
3321
 
3392
  msgid "draft updated."
3393
  msgstr ""
3394
 
3395
+ #: inc/custom-post-types/course.php:72
3396
  msgid "Create a new"
3397
  msgstr ""
3398
 
3399
+ #: inc/custom-post-types/course.php:75
3400
  msgid "Do you want to remove item \"{{ITEM_NAME}}\" to trash?"
3401
  msgstr ""
3402
 
3403
+ #: inc/custom-post-types/course.php:78
3404
  msgid "Items"
3405
  msgstr ""
3406
 
3407
+ #: inc/custom-post-types/course.php:80
3408
  msgid "Course sale price must less than the regular price"
3409
  msgstr ""
3410
 
3411
+ #: inc/custom-post-types/course.php:81
3412
  msgid "Course price must greater than the sale price"
3413
  msgstr ""
3414
 
3415
+ #: inc/custom-post-types/course.php:82
3416
  msgid "Sale start date must before sale end date"
3417
  msgstr ""
3418
 
3419
+ #: inc/custom-post-types/course.php:83
3420
  msgid "Sale end date must after sale start date"
3421
  msgstr ""
3422
 
3423
+ #: inc/custom-post-types/course.php:84
3424
  msgid "Invalid date"
3425
  msgstr ""
3426
 
3427
+ #: inc/custom-post-types/course.php:103
3428
  msgctxt "Post Type General Name"
3429
  msgid "Courses"
3430
  msgstr ""
3431
 
3432
+ #: inc/custom-post-types/course.php:104
3433
  msgctxt "Post Type Singular Name"
3434
  msgid "Course"
3435
  msgstr ""
3436
 
3437
+ #: inc/custom-post-types/course.php:106
3438
  msgid "Parent Item:"
3439
  msgstr ""
3440
 
3441
+ #: inc/custom-post-types/course.php:108
3442
  msgid "View Course"
3443
  msgstr ""
3444
 
3445
+ #: inc/custom-post-types/course.php:109
3446
  msgid "Add New Course"
3447
  msgstr ""
3448
 
3449
+ #: inc/custom-post-types/course.php:110
3450
  #: inc/custom-post-types/lesson.php:162
3451
+ #: inc/custom-post-types/order.php:830
3452
  #: inc/custom-post-types/question.php:211
3453
  msgid "Add New"
3454
  msgstr ""
3455
 
3456
+ #: inc/custom-post-types/course.php:111
3457
  msgid "Edit Course"
3458
  msgstr ""
3459
 
3460
+ #: inc/custom-post-types/course.php:112
3461
  msgid "Update Course"
3462
  msgstr ""
3463
 
3464
+ #: inc/custom-post-types/course.php:113
3465
  msgid "Search Courses"
3466
  msgstr ""
3467
 
3468
+ #: inc/custom-post-types/course.php:114
3469
  msgid "You haven't had any courses yet. Click <a href=\"%s\">Add new</a> to start"
3470
  msgstr ""
3471
 
3472
+ #: inc/custom-post-types/course.php:115
3473
  msgid "No course found in Trash"
3474
  msgstr ""
3475
 
3476
+ #: inc/custom-post-types/course.php:118
3477
  #: inc/settings/class-lp-settings-courses.php:32
3478
  msgctxt "slug"
3479
  msgid "courses"
3480
  msgstr ""
3481
 
3482
+ #: inc/custom-post-types/course.php:161
3483
  #: inc/custom-post-types/course.php:163
 
3484
  msgid "Course Categories"
3485
  msgstr ""
3486
 
3487
+ #: inc/custom-post-types/course.php:165
3488
  #: templates/single-course/meta/category.php:15
3489
  msgid "Category"
3490
  msgstr ""
3491
 
3492
+ #: inc/custom-post-types/course.php:166
3493
  msgid "Add New Course Category"
3494
  msgstr ""
3495
 
3496
+ #: inc/custom-post-types/course.php:167
3497
  msgid "All Categories"
3498
  msgstr ""
3499
 
3500
+ #: inc/custom-post-types/course.php:179
3501
  msgctxt "slug"
3502
  msgid "course-category"
3503
  msgstr ""
3504
 
3505
+ #: inc/custom-post-types/course.php:193
3506
+ #: inc/custom-post-types/course.php:207
3507
  msgid "Course Tags"
3508
  msgstr ""
3509
 
3510
+ #: inc/custom-post-types/course.php:194
3511
  #: inc/custom-post-types/question.php:184
3512
  #: inc/custom-post-types/question.php:185
3513
  msgid "Tag"
3514
  msgstr ""
3515
 
3516
+ #: inc/custom-post-types/course.php:195
3517
  msgid "Search Course Tags"
3518
  msgstr ""
3519
 
3520
+ #: inc/custom-post-types/course.php:196
3521
  msgid "Popular Course Tags"
3522
  msgstr ""
3523
 
3524
+ #: inc/custom-post-types/course.php:197
3525
  msgid "All Course Tags"
3526
  msgstr ""
3527
 
3528
+ #: inc/custom-post-types/course.php:200
3529
  msgid "Edit Course Tag"
3530
  msgstr ""
3531
 
3532
+ #: inc/custom-post-types/course.php:201
3533
  msgid "Update Course Tag"
3534
  msgstr ""
3535
 
3536
+ #: inc/custom-post-types/course.php:202
3537
  msgid "Add New Course Tag"
3538
  msgstr ""
3539
 
3540
+ #: inc/custom-post-types/course.php:203
3541
  msgid "New Course Tag Name"
3542
  msgstr ""
3543
 
3544
+ #: inc/custom-post-types/course.php:204
3545
  msgid "Separate tags with commas"
3546
  msgstr ""
3547
 
3548
+ #: inc/custom-post-types/course.php:205
3549
  msgid "Add or remove tags"
3550
  msgstr ""
3551
 
3552
+ #: inc/custom-post-types/course.php:206
3553
  msgid "Choose from the most used tags"
3554
  msgstr ""
3555
 
3556
+ #: inc/custom-post-types/course.php:217
3557
  msgctxt "slug"
3558
  msgid "course-tag"
3559
  msgstr ""
3560
 
3561
+ #: inc/custom-post-types/course.php:465
3562
+ #: inc/custom-post-types/course.php:482
3563
  #: templates/emails/order-items-table.php:87
3564
  msgid "Price"
3565
  msgstr ""
3566
 
3567
+ #: inc/custom-post-types/course.php:471
3568
+ #: inc/custom-post-types/course.php:474
3569
  msgid "Thumbnail"
3570
  msgstr ""
3571
 
3572
+ #: inc/custom-post-types/course.php:516
3573
  msgid "<strong>%d</strong> section"
3574
  msgid_plural "<strong>%d</strong> sections"
3575
  msgstr[0] ""
3576
  msgstr[1] ""
3577
 
3578
+ #: inc/custom-post-types/course.php:530
3579
  msgid "<strong>%d</strong> "
3580
  msgid_plural "<strong>%d</strong> "
3581
  msgstr[0] ""
3582
  msgstr[1] ""
3583
 
3584
+ #: inc/custom-post-types/course.php:541
3585
  msgid "No content"
3586
  msgstr ""
3587
 
3588
+ #: inc/custom-post-types/course.php:559
3589
  #: inc/lp-template-functions.php:67
3590
  msgid "Curriculum"
3591
  msgstr ""
3649
  msgid "Assigned"
3650
  msgstr ""
3651
 
3652
+ #: inc/custom-post-types/order.php:382
3653
  msgid "Order number, course name etc..."
3654
  msgstr ""
3655
 
3656
+ #: inc/custom-post-types/order.php:581
3657
+ #: inc/custom-post-types/order.php:829
3658
  msgid "View Order"
3659
  msgstr ""
3660
 
3661
+ #: inc/custom-post-types/order.php:597
3662
  msgid "View child orders"
3663
  msgstr ""
3664
 
3665
+ #: inc/custom-post-types/order.php:666
3666
+ #: inc/custom-post-types/order.php:825
3667
  #: templates/profile/tabs/orders/list.php:29
3668
  msgid "Order"
3669
  msgstr ""
3670
 
3671
+ #: inc/custom-post-types/order.php:667
3672
  msgid "Student"
3673
  msgstr ""
3674
 
3675
+ #: inc/custom-post-types/order.php:668
3676
  #: inc/lp-deprecated.php:354
3677
+ #: inc/user-item/class-lp-user-item.php:800
3678
  msgid "Purchased"
3679
  msgstr ""
3680
 
3681
+ #: inc/custom-post-types/order.php:671
3682
  #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:1330
3683
  #: templates/emails/order-items-table.php:72
3684
  #: templates/emails/plain/order-items-table.php:58
3686
  msgid "Status"
3687
  msgstr ""
3688
 
3689
+ #: inc/custom-post-types/order.php:721
3690
  #: inc/order/class-lp-order.php:458
3691
  msgid "(Guest)"
3692
  msgstr ""
3693
 
3694
+ #: inc/custom-post-types/order.php:777
3695
  #: templates/checkout/order-received.php:71
3696
  msgid "Course does not exist"
3697
  msgstr ""
3698
 
3699
+ #: inc/custom-post-types/order.php:779
3700
  msgid "Deleted"
3701
  msgstr ""
3702
 
3703
+ #: inc/custom-post-types/order.php:795
3704
  #: templates/checkout/order-received.php:88
3705
  msgid "(No item)"
3706
  msgstr ""
3707
 
3708
+ #: inc/custom-post-types/order.php:805
3709
  msgid "Pay via <strong>%s</strong>"
3710
  msgstr ""
3711
 
3712
+ #: inc/custom-post-types/order.php:826
3713
  msgid "Add New Order"
3714
  msgstr ""
3715
 
3716
+ #: inc/custom-post-types/order.php:827
3717
+ #: inc/custom-post-types/order.php:994
3718
  #: templates/order/order-details.php:20
3719
  msgid "Order Details"
3720
  msgstr ""
3721
 
3722
+ #: inc/custom-post-types/order.php:831
3723
  msgid "Update Order"
3724
  msgstr ""
3725
 
3726
+ #: inc/custom-post-types/order.php:832
3727
  msgid "Search Orders"
3728
  msgstr ""
3729
 
3730
+ #: inc/custom-post-types/order.php:833
3731
  msgid "No order found"
3732
  msgstr ""
3733
 
3734
+ #: inc/custom-post-types/order.php:834
3735
  msgid "No order found in Trash"
3736
  msgstr ""
3737
 
3738
+ #: inc/custom-post-types/order.php:1002
3739
  msgid "Order Actions"
3740
  msgstr ""
3741
 
3742
+ #: inc/custom-post-types/order.php:1010
3743
  msgid "Order Exports"
3744
  msgstr ""
3745
 
3746
  #: inc/custom-post-types/question.php:127
3747
  #: assets/js/dist/frontend/quiz.min.js:207
3748
  #: assets/js/dist/frontend/quiz.min.js:78
3749
+ #: assets/js/dist/frontend/quiz.min.js:206
3750
  msgid "Correct"
3751
  msgstr ""
3752
 
3852
  msgstr ""
3853
 
3854
  #: inc/custom-post-types/quiz.php:286
3855
+ #: inc/templates/class-lp-template-course.php:98
3856
+ #: inc/templates/class-lp-template-course.php:103
3857
  msgid "%d question"
3858
  msgid_plural "%d questions"
3859
  msgstr[0] ""
3986
  msgid "New user order"
3987
  msgstr ""
3988
 
3989
+ #: inc/emails/class-lp-email.php:865
3990
  msgid "Recipient(s)"
3991
  msgstr ""
3992
 
3993
+ #: inc/emails/class-lp-email.php:869
3994
  msgid "Separate other recipients by comma."
3995
  msgstr ""
3996
 
3997
+ #: inc/emails/class-lp-email.php:874
3998
  msgid "Subject"
3999
  msgstr ""
4000
 
4001
+ #: inc/emails/class-lp-email.php:881
4002
  msgid "Email heading"
4003
  msgstr ""
4004
 
4501
  msgstr ""
4502
 
4503
  #: inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php:347
4504
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:340
4505
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:488
4506
  msgid "Error: Can't add Course to cart."
4507
  msgstr ""
4508
 
4824
  msgid "Expiration time"
4825
  msgstr ""
4826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4827
  #: inc/jwt/rest-api/version1/class-lp-rest-lessons-v1-controller.php:201
4828
  msgid "Error: No lesson available!."
4829
  msgstr ""
4972
  msgid "Ensure result set excludes posts assigned to specific authors."
4973
  msgstr ""
4974
 
4975
+ #: inc/jwt/rest-api/version1/class-lp-rest-posts-controller.php:610
4976
+ msgid "Get item learned by user."
4977
+ msgstr ""
4978
+
4979
  #: inc/jwt/rest-api/version1/class-lp-rest-posts-controller.php:618
4980
  msgid "Limit result set to those of particular parent IDs."
4981
  msgstr ""
5139
  msgid "Your password has been updated, Please login again to continue!"
5140
  msgstr ""
5141
 
5142
+ #: inc/lp-core-functions.php:732
5143
  msgid "Minute(s)"
5144
  msgstr ""
5145
 
5146
+ #: inc/lp-core-functions.php:733
5147
  msgid "Hour(s)"
5148
  msgstr ""
5149
 
5150
+ #: inc/lp-core-functions.php:734
5151
  msgid "Day(s)"
5152
  msgstr ""
5153
 
5154
+ #: inc/lp-core-functions.php:735
5155
  msgid "Week(s)"
5156
  msgstr ""
5157
 
5158
+ #: inc/lp-core-functions.php:873
5159
  msgid "Left"
5160
  msgstr ""
5161
 
5162
+ #: inc/lp-core-functions.php:874
5163
  msgid "Right"
5164
  msgstr ""
5165
 
5166
+ #: inc/lp-core-functions.php:875
5167
  msgid "Left with space"
5168
  msgstr ""
5169
 
5170
+ #: inc/lp-core-functions.php:876
5171
  msgid "Right with space"
5172
  msgstr ""
5173
 
5174
+ #: inc/lp-core-functions.php:935
5175
  msgid "Afghan afghani"
5176
  msgstr ""
5177
 
5178
+ #: inc/lp-core-functions.php:936
5179
  msgid "Albanian lek"
5180
  msgstr ""
5181
 
5182
+ #: inc/lp-core-functions.php:937
5183
  msgid "Algerian dinar"
5184
  msgstr ""
5185
 
5186
+ #: inc/lp-core-functions.php:938
5187
  msgid "Euro"
5188
  msgstr ""
5189
 
5190
+ #: inc/lp-core-functions.php:939
5191
  msgid "Angolan kwanza"
5192
  msgstr ""
5193
 
5194
+ #: inc/lp-core-functions.php:940
5195
  msgid "East Caribbean dollar"
5196
  msgstr ""
5197
 
5198
+ #: inc/lp-core-functions.php:941
5199
  msgid "Argentine peso"
5200
  msgstr ""
5201
 
5202
+ #: inc/lp-core-functions.php:942
5203
  msgid "Armenian dram"
5204
  msgstr ""
5205
 
5206
+ #: inc/lp-core-functions.php:943
5207
  msgid "Aruban florin"
5208
  msgstr ""
5209
 
5210
+ #: inc/lp-core-functions.php:944
5211
  msgid "Australian dollar"
5212
  msgstr ""
5213
 
5214
+ #: inc/lp-core-functions.php:945
5215
  msgid "Azerbaijani manat"
5216
  msgstr ""
5217
 
5218
+ #: inc/lp-core-functions.php:946
5219
  msgid "Bahamian dollar"
5220
  msgstr ""
5221
 
5222
+ #: inc/lp-core-functions.php:947
5223
  msgid "Bahraini dinar"
5224
  msgstr ""
5225
 
5226
+ #: inc/lp-core-functions.php:948
5227
  msgid "Bangladeshi taka"
5228
  msgstr ""
5229
 
5230
+ #: inc/lp-core-functions.php:949
5231
  msgid "Barbadian dollar"
5232
  msgstr ""
5233
 
5234
+ #: inc/lp-core-functions.php:950
5235
  msgid "Belarusian ruble"
5236
  msgstr ""
5237
 
5238
+ #: inc/lp-core-functions.php:951
5239
  msgid "Belizean dollar"
5240
  msgstr ""
5241
 
5242
+ #: inc/lp-core-functions.php:952
5243
  msgid "West African CFA franc"
5244
  msgstr ""
5245
 
5246
+ #: inc/lp-core-functions.php:953
5247
  msgid "Bermudian dollar"
5248
  msgstr ""
5249
 
5250
+ #: inc/lp-core-functions.php:954
5251
  msgid "Bhutanese ngultrum"
5252
  msgstr ""
5253
 
5254
+ #: inc/lp-core-functions.php:955
5255
  msgid "Bolivian boliviano"
5256
  msgstr ""
5257
 
5258
+ #: inc/lp-core-functions.php:956
5259
  msgid "US dollar"
5260
  msgstr ""
5261
 
5262
+ #: inc/lp-core-functions.php:957
5263
  msgid "Bosnia and Herzegovina convertible mark"
5264
  msgstr ""
5265
 
5266
+ #: inc/lp-core-functions.php:958
5267
  msgid "Botswana pula"
5268
  msgstr ""
5269
 
5270
+ #: inc/lp-core-functions.php:959
5271
  msgid "Brazilian real"
5272
  msgstr ""
5273
 
5274
+ #: inc/lp-core-functions.php:960
5275
  msgid "Brunei dollar"
5276
  msgstr ""
5277
 
5278
+ #: inc/lp-core-functions.php:961
5279
  msgid "Bulgarian lev"
5280
  msgstr ""
5281
 
5282
+ #: inc/lp-core-functions.php:962
5283
  msgid "Burmese kyat"
5284
  msgstr ""
5285
 
5286
+ #: inc/lp-core-functions.php:963
5287
  msgid "Burundian franc"
5288
  msgstr ""
5289
 
5290
+ #: inc/lp-core-functions.php:964
5291
  msgid "Cambodian riel"
5292
  msgstr ""
5293
 
5294
+ #: inc/lp-core-functions.php:965
5295
  msgid "Central African CFA franc"
5296
  msgstr ""
5297
 
5298
+ #: inc/lp-core-functions.php:966
5299
  msgid "Canadian dollar"
5300
  msgstr ""
5301
 
5302
+ #: inc/lp-core-functions.php:967
5303
  msgid "Cape Verdean escudo"
5304
  msgstr ""
5305
 
5306
+ #: inc/lp-core-functions.php:968
5307
  msgid "Cayman Islands dollar"
5308
  msgstr ""
5309
 
5310
+ #: inc/lp-core-functions.php:969
5311
  msgid "Chilean peso"
5312
  msgstr ""
5313
 
5314
+ #: inc/lp-core-functions.php:970
5315
  msgid "Chinese renminbi"
5316
  msgstr ""
5317
 
5318
+ #: inc/lp-core-functions.php:971
5319
  msgid "Colombian peso"
5320
  msgstr ""
5321
 
5322
+ #: inc/lp-core-functions.php:972
5323
  msgid "Comorian franc"
5324
  msgstr ""
5325
 
5326
+ #: inc/lp-core-functions.php:973
5327
  msgid "Congolese franc"
5328
  msgstr ""
5329
 
5330
+ #: inc/lp-core-functions.php:974
5331
  msgid "New Zealand dollar"
5332
  msgstr ""
5333
 
5334
+ #: inc/lp-core-functions.php:975
5335
  msgid "Costa Rican colón"
5336
  msgstr ""
5337
 
5338
+ #: inc/lp-core-functions.php:976
5339
  msgid "Croatian kuna"
5340
  msgstr ""
5341
 
5342
+ #: inc/lp-core-functions.php:977
5343
  msgid "Cuban peso"
5344
  msgstr ""
5345
 
5346
+ #: inc/lp-core-functions.php:978
5347
  msgid "Netherlands Antilles guilder"
5348
  msgstr ""
5349
 
5350
+ #: inc/lp-core-functions.php:979
5351
  msgid "Czech koruna"
5352
  msgstr ""
5353
 
5354
+ #: inc/lp-core-functions.php:980
5355
  msgid "Danish krone"
5356
  msgstr ""
5357
 
5358
+ #: inc/lp-core-functions.php:981
5359
  msgid "Djiboutian franc"
5360
  msgstr ""
5361
 
5362
+ #: inc/lp-core-functions.php:982
5363
  msgid "Dominican peso"
5364
  msgstr ""
5365
 
5366
+ #: inc/lp-core-functions.php:983
5367
  msgid "Egyptian pound"
5368
  msgstr ""
5369
 
5370
+ #: inc/lp-core-functions.php:984
5371
  msgid "Salvadoran colón"
5372
  msgstr ""
5373
 
5374
+ #: inc/lp-core-functions.php:985
5375
  msgid "Eritrean nakfa"
5376
  msgstr ""
5377
 
5378
+ #: inc/lp-core-functions.php:986
5379
  msgid "Ethiopian birr"
5380
  msgstr ""
5381
 
5382
+ #: inc/lp-core-functions.php:987
5383
  msgid "Falkland Islands pound"
5384
  msgstr ""
5385
 
5386
+ #: inc/lp-core-functions.php:988
5387
  msgid "Fijian dollar"
5388
  msgstr ""
5389
 
5390
+ #: inc/lp-core-functions.php:989
5391
  msgid "CFP franc"
5392
  msgstr ""
5393
 
5394
+ #: inc/lp-core-functions.php:990
5395
  msgid "Gambian dalasi"
5396
  msgstr ""
5397
 
5398
+ #: inc/lp-core-functions.php:991
5399
  msgid "Georgian lari"
5400
  msgstr ""
5401
 
5402
+ #: inc/lp-core-functions.php:992
5403
  msgid "Ghanian cedi"
5404
  msgstr ""
5405
 
5406
+ #: inc/lp-core-functions.php:993
5407
  msgid "Gibraltar pound"
5408
  msgstr ""
5409
 
5410
+ #: inc/lp-core-functions.php:994
5411
  msgid "Guatemalan quetzal"
5412
  msgstr ""
5413
 
5414
+ #: inc/lp-core-functions.php:995
5415
  msgid "British pound"
5416
  msgstr ""
5417
 
5418
+ #: inc/lp-core-functions.php:996
5419
  msgid "Guinean franc"
5420
  msgstr ""
5421
 
5422
+ #: inc/lp-core-functions.php:997
5423
  msgid "Guyanese dollar"
5424
  msgstr ""
5425
 
5426
+ #: inc/lp-core-functions.php:998
5427
  msgid "Haitian gourde"
5428
  msgstr ""
5429
 
5430
+ #: inc/lp-core-functions.php:999
5431
  msgid "Honduran lempira"
5432
  msgstr ""
5433
 
5434
+ #: inc/lp-core-functions.php:1000
5435
  msgid "Hong Kong dollar"
5436
  msgstr ""
5437
 
5438
+ #: inc/lp-core-functions.php:1001
5439
  msgid "Hungarian forint"
5440
  msgstr ""
5441
 
5442
+ #: inc/lp-core-functions.php:1002
5443
  msgid "Icelandic króna"
5444
  msgstr ""
5445
 
5446
+ #: inc/lp-core-functions.php:1003
5447
  msgid "Indian rupee"
5448
  msgstr ""
5449
 
5450
+ #: inc/lp-core-functions.php:1004
5451
  msgid "Indonesian rupiah"
5452
  msgstr ""
5453
 
5454
+ #: inc/lp-core-functions.php:1005
5455
  msgid "Iranian rial"
5456
  msgstr ""
5457
 
5458
+ #: inc/lp-core-functions.php:1006
5459
  msgid "Iraqi dinar"
5460
  msgstr ""
5461
 
5462
+ #: inc/lp-core-functions.php:1007
5463
  msgid "Israeli new sheqel"
5464
  msgstr ""
5465
 
5466
+ #: inc/lp-core-functions.php:1008
5467
  msgid "Jamaican dollar"
5468
  msgstr ""
5469
 
5470
+ #: inc/lp-core-functions.php:1009
5471
  msgid "Japanese yen "
5472
  msgstr ""
5473
 
5474
+ #: inc/lp-core-functions.php:1010
5475
  msgid "Jordanian dinar"
5476
  msgstr ""
5477
 
5478
+ #: inc/lp-core-functions.php:1011
5479
  msgid "Kazakhstani tenge"
5480
  msgstr ""
5481
 
5482
+ #: inc/lp-core-functions.php:1012
5483
  msgid "Kenyan shilling"
5484
  msgstr ""
5485
 
5486
+ #: inc/lp-core-functions.php:1013
5487
  msgid "North Korean won"
5488
  msgstr ""
5489
 
5490
+ #: inc/lp-core-functions.php:1014
5491
  msgid "Kuwaiti dinar"
5492
  msgstr ""
5493
 
5494
+ #: inc/lp-core-functions.php:1015
5495
  msgid "Kyrgyzstani som"
5496
  msgstr ""
5497
 
5498
+ #: inc/lp-core-functions.php:1016
5499
  msgid "South Korean won"
5500
  msgstr ""
5501
 
5502
+ #: inc/lp-core-functions.php:1017
5503
  msgid "Lao kip"
5504
  msgstr ""
5505
 
5506
+ #: inc/lp-core-functions.php:1018
5507
  msgid "Latvian lats"
5508
  msgstr ""
5509
 
5510
+ #: inc/lp-core-functions.php:1019
5511
  msgid "Lebanese pound"
5512
  msgstr ""
5513
 
5514
+ #: inc/lp-core-functions.php:1020
5515
  msgid "Lesotho loti"
5516
  msgstr ""
5517
 
5518
+ #: inc/lp-core-functions.php:1021
5519
  msgid "Liberian dollar"
5520
  msgstr ""
5521
 
5522
+ #: inc/lp-core-functions.php:1022
5523
+ #: inc/lp-core-functions.php:1093
5524
  msgid "Libyan dinar"
5525
  msgstr ""
5526
 
5527
+ #: inc/lp-core-functions.php:1023
5528
  msgid "Swiss franc"
5529
  msgstr ""
5530
 
5531
+ #: inc/lp-core-functions.php:1024
5532
  msgid "Lithuanian litas"
5533
  msgstr ""
5534
 
5535
+ #: inc/lp-core-functions.php:1025
5536
  msgid "Macanese pataca"
5537
  msgstr ""
5538
 
5539
+ #: inc/lp-core-functions.php:1026
5540
  msgid "Macedonian denar"
5541
  msgstr ""
5542
 
5543
+ #: inc/lp-core-functions.php:1027
5544
  msgid "Malagasy ariary"
5545
  msgstr ""
5546
 
5547
+ #: inc/lp-core-functions.php:1028
5548
  msgid "Malawian kwacha"
5549
  msgstr ""
5550
 
5551
+ #: inc/lp-core-functions.php:1029
5552
  msgid "Malaysian ringgit"
5553
  msgstr ""
5554
 
5555
+ #: inc/lp-core-functions.php:1030
5556
  msgid "Maldivian rufiyaa"
5557
  msgstr ""
5558
 
5559
+ #: inc/lp-core-functions.php:1031
5560
  msgid "Mauritanian ouguiya"
5561
  msgstr ""
5562
 
5563
+ #: inc/lp-core-functions.php:1032
5564
  msgid "Mauritian rupee"
5565
  msgstr ""
5566
 
5567
+ #: inc/lp-core-functions.php:1033
5568
  msgid "Mexican peso"
5569
  msgstr ""
5570
 
5571
+ #: inc/lp-core-functions.php:1034
5572
  msgid "Moldovan leu"
5573
  msgstr ""
5574
 
5575
+ #: inc/lp-core-functions.php:1035
5576
  msgid "Mongolian tugrik"
5577
  msgstr ""
5578
 
5579
+ #: inc/lp-core-functions.php:1036
5580
  msgid "Moroccan dirham"
5581
  msgstr ""
5582
 
5583
+ #: inc/lp-core-functions.php:1037
5584
  msgid "Mozambican metical"
5585
  msgstr ""
5586
 
5587
+ #: inc/lp-core-functions.php:1038
5588
  msgid "Namibian dollar"
5589
  msgstr ""
5590
 
5591
+ #: inc/lp-core-functions.php:1039
5592
  msgid "Nepalese rupee"
5593
  msgstr ""
5594
 
5595
+ #: inc/lp-core-functions.php:1040
5596
  msgid "Nicaraguan córdoba"
5597
  msgstr ""
5598
 
5599
+ #: inc/lp-core-functions.php:1041
5600
  msgid "Nigerian naira"
5601
  msgstr ""
5602
 
5603
+ #: inc/lp-core-functions.php:1042
5604
  msgid "Norwegian krone"
5605
  msgstr ""
5606
 
5607
+ #: inc/lp-core-functions.php:1043
5608
  msgid "Omani rial"
5609
  msgstr ""
5610
 
5611
+ #: inc/lp-core-functions.php:1044
5612
  msgid "Pakistani rupee"
5613
  msgstr ""
5614
 
5615
+ #: inc/lp-core-functions.php:1045
5616
  msgid "Panamanian balboa"
5617
  msgstr ""
5618
 
5619
+ #: inc/lp-core-functions.php:1046
5620
  msgid "Papua New Guinea kina"
5621
  msgstr ""
5622
 
5623
+ #: inc/lp-core-functions.php:1047
5624
  msgid "Paraguayan guarani"
5625
  msgstr ""
5626
 
5627
+ #: inc/lp-core-functions.php:1048
5628
  msgid "Peruvian nuevo sol"
5629
  msgstr ""
5630
 
5631
+ #: inc/lp-core-functions.php:1049
5632
  msgid "Philippine peso"
5633
  msgstr ""
5634
 
5635
+ #: inc/lp-core-functions.php:1050
5636
  msgid "Polish zloty"
5637
  msgstr ""
5638
 
5639
+ #: inc/lp-core-functions.php:1051
5640
  msgid "Qatari riyal"
5641
  msgstr ""
5642
 
5643
+ #: inc/lp-core-functions.php:1052
5644
  msgid "Romanian leu"
5645
  msgstr ""
5646
 
5647
+ #: inc/lp-core-functions.php:1053
5648
  msgid "Russian ruble"
5649
  msgstr ""
5650
 
5651
+ #: inc/lp-core-functions.php:1054
5652
  msgid "Rwandan franc"
5653
  msgstr ""
5654
 
5655
+ #: inc/lp-core-functions.php:1055
5656
  msgid "Samoan tālā"
5657
  msgstr ""
5658
 
5659
+ #: inc/lp-core-functions.php:1056
5660
  msgid "São Tomé and Príncipe dobra"
5661
  msgstr ""
5662
 
5663
+ #: inc/lp-core-functions.php:1057
5664
  msgid "Saudi riyal"
5665
  msgstr ""
5666
 
5667
+ #: inc/lp-core-functions.php:1058
5668
  msgid "Serbian dinar"
5669
  msgstr ""
5670
 
5671
+ #: inc/lp-core-functions.php:1059
5672
  msgid "Seychellois rupee"
5673
  msgstr ""
5674
 
5675
+ #: inc/lp-core-functions.php:1060
5676
  msgid "Sierra Leonean leone"
5677
  msgstr ""
5678
 
5679
+ #: inc/lp-core-functions.php:1061
5680
  msgid "Singapore dollar"
5681
  msgstr ""
5682
 
5683
+ #: inc/lp-core-functions.php:1062
5684
  msgid "Solomon Islands dollar"
5685
  msgstr ""
5686
 
5687
+ #: inc/lp-core-functions.php:1063
5688
  msgid "Somali shilling"
5689
  msgstr ""
5690
 
5691
+ #: inc/lp-core-functions.php:1064
5692
  msgid "South African rand"
5693
  msgstr ""
5694
 
5695
+ #: inc/lp-core-functions.php:1065
5696
  msgid "Sri Lankan rupee"
5697
  msgstr ""
5698
 
5699
+ #: inc/lp-core-functions.php:1066
5700
  msgid "St. Helena pound"
5701
  msgstr ""
5702
 
5703
+ #: inc/lp-core-functions.php:1067
5704
  msgid "Sudanese pound"
5705
  msgstr ""
5706
 
5707
+ #: inc/lp-core-functions.php:1068
5708
  msgid "Surinamese dollar"
5709
  msgstr ""
5710
 
5711
+ #: inc/lp-core-functions.php:1069
5712
  msgid "Swazi lilangeni"
5713
  msgstr ""
5714
 
5715
+ #: inc/lp-core-functions.php:1070
5716
  msgid "Swedish krona"
5717
  msgstr ""
5718
 
5719
+ #: inc/lp-core-functions.php:1071
5720
  msgid "Syrian pound"
5721
  msgstr ""
5722
 
5723
+ #: inc/lp-core-functions.php:1072
5724
  msgid "New Taiwan dollar"
5725
  msgstr ""
5726
 
5727
+ #: inc/lp-core-functions.php:1073
5728
  msgid "Tajikistani somoni"
5729
  msgstr ""
5730
 
5731
+ #: inc/lp-core-functions.php:1074
5732
  msgid "Tanzanian shilling"
5733
  msgstr ""
5734
 
5735
+ #: inc/lp-core-functions.php:1075
5736
  msgid "Thai baht "
5737
  msgstr ""
5738
 
5739
+ #: inc/lp-core-functions.php:1076
5740
  msgid "Tongan pa’anga"
5741
  msgstr ""
5742
 
5743
+ #: inc/lp-core-functions.php:1077
5744
  msgid "Trinidad and Tobago dollar"
5745
  msgstr ""
5746
 
5747
+ #: inc/lp-core-functions.php:1078
5748
  msgid "Tunisian dinar"
5749
  msgstr ""
5750
 
5751
+ #: inc/lp-core-functions.php:1079
5752
  msgid "Turkish lira"
5753
  msgstr ""
5754
 
5755
+ #: inc/lp-core-functions.php:1080
5756
  msgid "Turkmenistani manat"
5757
  msgstr ""
5758
 
5759
+ #: inc/lp-core-functions.php:1081
5760
  msgid "Ugandan shilling"
5761
  msgstr ""
5762
 
5763
+ #: inc/lp-core-functions.php:1082
5764
  msgid "Ukrainian hryvnia"
5765
  msgstr ""
5766
 
5767
+ #: inc/lp-core-functions.php:1083
5768
  msgid "United Arab Emirates dirham"
5769
  msgstr ""
5770
 
5771
+ #: inc/lp-core-functions.php:1084
5772
  msgid "Uruguayan peso"
5773
  msgstr ""
5774
 
5775
+ #: inc/lp-core-functions.php:1085
5776
  msgid "Uzbekistani som"
5777
  msgstr ""
5778
 
5779
+ #: inc/lp-core-functions.php:1086
5780
  msgid "Vanuatu vatu"
5781
  msgstr ""
5782
 
5783
+ #: inc/lp-core-functions.php:1087
5784
  msgid "Venezuelan bolivar"
5785
  msgstr ""
5786
 
5787
+ #: inc/lp-core-functions.php:1088
5788
  msgid "Vietnamese dong"
5789
  msgstr ""
5790
 
5791
+ #: inc/lp-core-functions.php:1089
5792
  msgid "Yemeni rial"
5793
  msgstr ""
5794
 
5795
+ #: inc/lp-core-functions.php:1090
5796
  msgid "Zambian kwacha"
5797
  msgstr ""
5798
 
5799
+ #: inc/lp-core-functions.php:1091
5800
  msgid "Zimbabwean dollar"
5801
  msgstr ""
5802
 
5803
+ #: inc/lp-core-functions.php:1092
5804
  msgid "Jersey pound"
5805
  msgstr ""
5806
 
5807
+ #: inc/lp-core-functions.php:1403
5808
+ #: inc/lp-template-functions.php:1546
5809
  msgid "%s week"
5810
  msgid_plural "%s weeks"
5811
  msgstr[0] ""
5812
  msgstr[1] ""
5813
 
5814
+ #: inc/lp-core-functions.php:1407
5815
+ #: inc/lp-template-functions.php:1542
5816
  msgid "%s day"
5817
  msgid_plural "%s days"
5818
  msgstr[0] ""
5819
  msgstr[1] ""
5820
 
5821
+ #: inc/lp-core-functions.php:1412
5822
+ #: inc/lp-template-functions.php:1537
5823
  msgid "%s hour"
5824
  msgid_plural "%s hours"
5825
  msgstr[0] ""
5826
  msgstr[1] ""
5827
 
5828
+ #: inc/lp-core-functions.php:1416
5829
+ #: inc/lp-template-functions.php:1531
5830
  msgid "%s minute"
5831
  msgid_plural "%s minutes"
5832
  msgstr[0] ""
5833
  msgstr[1] ""
5834
 
5835
+ #: inc/lp-core-functions.php:2210
5836
  msgid "Cart"
5837
  msgstr ""
5838
 
5839
+ #: inc/lp-core-functions.php:2214
5840
  msgid "Enable cart"
5841
  msgstr ""
5842
 
5843
+ #: inc/lp-core-functions.php:2215
5844
  msgid "Check this option to enable user purchase multiple courses at one time."
5845
  msgstr ""
5846
 
5847
+ #: inc/lp-core-functions.php:2224
5848
  msgid "Add to cart redirect"
5849
  msgstr ""
5850
 
5851
+ #: inc/lp-core-functions.php:2225
5852
  msgid "Redirect to checkout immediately after adding course to cart."
5853
  msgstr ""
5854
 
5855
+ #: inc/lp-core-functions.php:2231
5856
  msgid "AJAX add to cart"
5857
  msgstr ""
5858
 
5859
+ #: inc/lp-core-functions.php:2232
5860
  msgid "Using AJAX to add course to cart."
5861
  msgstr ""
5862
 
5863
+ #: inc/lp-core-functions.php:2238
5864
  msgid "Cart page"
5865
  msgstr ""
5866
 
5867
+ #: inc/lp-core-functions.php:2588
5868
  msgctxt "static-page-name"
5869
  msgid "Checkout"
5870
  msgstr ""
5871
 
5872
+ #: inc/lp-core-functions.php:2589
5873
  msgctxt "static-page-name"
5874
  msgid "Courses"
5875
  msgstr ""
5876
 
5877
+ #: inc/lp-core-functions.php:2590
5878
  msgctxt "static-page-name"
5879
  msgid "Profile"
5880
  msgstr ""
5881
 
5882
+ #: inc/lp-core-functions.php:2591
5883
  msgctxt "static-page-name"
5884
  msgid "Become a Teacher"
5885
  msgstr ""
5886
 
5887
+ #: inc/lp-core-functions.php:2976
5888
  msgid "Loading..."
5889
  msgstr ""
5890
 
5891
+ #: inc/lp-core-functions.php:2979
5892
  msgid "Get Passing Grade"
5893
  msgstr ""
5894
 
5895
+ #: inc/lp-core-functions.php:2984
5896
  msgid "Evaluate by the number of lessons completed per total number of lessons."
5897
  msgstr ""
5898
 
5899
+ #: inc/lp-core-functions.php:2985
5900
  msgid "E.g: Course has 10 lessons and user completed 5 lessons then the result = 5/10 (50.%)"
5901
  msgstr ""
5902
 
5903
+ #: inc/lp-core-functions.php:2987
5904
  msgid "Evaluate by result of final quiz in the course. You have to add a quiz to the end of the course."
5905
  msgstr ""
5906
 
5907
+ #: inc/lp-core-functions.php:2993
5908
  msgid "Evaluate by the number of quizzes passed per total number of quizzes."
5909
  msgstr ""
5910
 
5911
+ #: inc/lp-core-functions.php:2994
5912
  msgid "E.g: The course has 10 quizzes and the user passed 5 quizzes then the result = 5/10 (50%)."
5913
  msgstr ""
5914
 
5915
+ #: inc/lp-core-functions.php:3001
5916
  msgid "Evaluate by total number of correct answers per total number of questions."
5917
  msgstr ""
5918
 
5919
+ #: inc/lp-core-functions.php:3002
5920
  msgid "E.g: Course has 10 questions. User correct 5 questions. Result is 5/10 (50%)."
5921
  msgstr ""
5922
 
5923
+ #: inc/lp-core-functions.php:3007
5924
  msgid "Evaluate by total score achieved per total score of the questions."
5925
  msgstr ""
5926
 
5927
+ #: inc/lp-core-functions.php:3013
5928
  msgid "Evaluate via lessons"
5929
  msgstr ""
5930
 
5931
+ #: inc/lp-core-functions.php:3017
5932
  msgid "Evaluate via results of the final quiz"
5933
  msgstr ""
5934
 
5935
+ #: inc/lp-core-functions.php:3021
5936
  msgid "Evaluate via quizzes passed"
5937
  msgstr ""
5938
 
5939
+ #: inc/lp-core-functions.php:3025
5940
  msgid "Evaluate via questions"
5941
  msgstr ""
5942
 
5943
+ #: inc/lp-core-functions.php:3029
5944
  msgid "Evaluate via mark"
5945
  msgstr ""
5946
 
5947
+ #: inc/lp-core-functions.php:3192
5948
  msgid "Heads up, Please backup before upgrade!"
5949
  msgstr ""
5950
 
5951
+ #: inc/lp-core-functions.php:3195
5952
  msgid "The latest update includes some substantial changes across different areas of the plugin. We highly recommend you backup your site before upgrading, and make sure you first update in a staging environment"
5953
  msgstr ""
5954
 
5955
+ #: inc/lp-core-functions.php:3196
5956
  msgid "Learners require WordPress version "
5957
  msgstr ""
5958
 
5963
  #: inc/lp-deprecated.php:355
5964
  #: inc/lp-deprecated.php:386
5965
  #: inc/templates/class-lp-template-profile.php:102
5966
+ #: inc/user-item/class-lp-user-item.php:803
5967
  #: inc/user/class-lp-profile.php:873
5968
  #: inc/user/class-lp-profile.php:907
5969
  msgid "Finished"
6016
  msgid "Overview"
6017
  msgstr ""
6018
 
6019
+ #: inc/lp-template-functions.php:998
6020
+ #: inc/lp-template-functions.php:1184
6021
+ #: inc/templates/class-lp-template-course.php:132
6022
  msgid "Final"
6023
  msgstr ""
6024
 
6025
+ #: inc/lp-template-functions.php:1420
6026
  msgid "Course Sidebar"
6027
  msgstr ""
6028
 
6029
+ #: inc/lp-template-functions.php:1422
6030
  msgid "Widgets in this area will be shown in single course"
6031
  msgstr ""
6032
 
6033
+ #: inc/lp-template-functions.php:1431
6034
  msgid "All Courses"
6035
  msgstr ""
6036
 
6037
+ #: inc/lp-template-functions.php:1433
6038
  msgid "Widgets in this area will be shown in all courses page"
6039
  msgstr ""
6040
 
6041
+ #: inc/lp-template-functions.php:1570
6042
+ #: inc/lp-template-functions.php:1579
6043
  msgid "All levels"
6044
  msgstr ""
6045
 
6046
+ #: inc/lp-template-functions.php:1580
6047
  msgid "Beginner"
6048
  msgstr ""
6049
 
6050
+ #: inc/lp-template-functions.php:1581
6051
  msgid "Intermediate"
6052
  msgstr ""
6053
 
6054
+ #: inc/lp-template-functions.php:1582
6055
  msgid "Expert"
6056
  msgstr ""
6057
 
6290
  msgid "Showing %1$s of %2$s results"
6291
  msgstr ""
6292
 
6293
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:286
6294
  msgid "Error: No course available!."
6295
  msgstr ""
6296
 
6297
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:294
6298
  msgid "Invalid course!"
6299
  msgstr ""
6300
 
6301
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:300
6302
  msgid "Error: Cannot enroll course."
6303
  msgstr ""
6304
 
6305
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:321
6306
  msgid "Error: Can't Enroll course."
6307
  msgstr ""
6308
 
6309
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:361
6310
  msgid "Congrats! You enroll course successfully. Redirecting..."
6311
  msgstr ""
6312
 
6313
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:379
6314
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:503
6315
  msgid "Error: Please setup page for checkout."
6316
  msgstr ""
6317
 
6318
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:384
6319
  msgid "Redirecting..."
6320
  msgstr ""
6321
 
6322
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:414
6323
  msgid "Error: Invalid Course ID."
6324
  msgstr ""
6325
 
6326
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:420
6327
  msgid "Error: No Course available."
6328
  msgstr ""
6329
 
6330
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:426
6331
  msgid "Error: Cannot purchase course!."
6332
  msgstr ""
6333
 
6334
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:449
6335
  msgid "Reset Course progress"
6336
  msgstr ""
6337
 
6338
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:455
6339
  msgid "Continue Course progress"
6340
  msgstr ""
6341
 
6342
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:463
6343
  msgid "Repurchase Options"
6344
  msgstr ""
6345
 
6346
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:510
6347
  msgid "\"%s\" has been added to your cart."
6348
  msgstr ""
6349
 
6350
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:535
6351
  msgid "Invalid params"
6352
  msgstr ""
6353
 
6354
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:541
6355
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:671
6356
+ #: inc/user/abstract-lp-user.php:853
6357
  msgid "Invalid course"
6358
  msgstr ""
6359
 
6360
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:553
6361
  msgid "You can't retry course"
6362
  msgstr ""
6363
 
6364
+ #: inc/rest-api/v1/frontend/class-lp-rest-courses-controller.php:579
6365
  msgid "Now you can learn this course"
6366
  msgstr ""
6367
 
6486
  msgid "You can't viewing user profile"
6487
  msgstr ""
6488
 
6489
+ #: inc/templates/class-lp-template-course.php:311
6490
  #: inc/widgets/course-extra.php:33
6491
  msgid "Key features"
6492
  msgstr ""
6493
 
6494
+ #: inc/templates/class-lp-template-course.php:334
6495
+ #: inc/templates/class-lp-template-course.php:810
6496
  msgid "Target audiences"
6497
  msgstr ""
6498
 
6499
+ #: inc/templates/class-lp-template-course.php:770
6500
  msgid "%d lesson"
6501
  msgid_plural "%d lessons"
6502
  msgstr[0] ""
6503
  msgstr[1] ""
6504
 
6505
+ #: inc/templates/class-lp-template-course.php:774
6506
  msgid "%d quiz"
6507
  msgid_plural "%d quizzes"
6508
  msgstr[0] ""
6509
  msgstr[1] ""
6510
 
6511
+ #: inc/templates/class-lp-template-course.php:778
6512
  msgid "%d student"
6513
  msgid_plural "%d students"
6514
  msgstr[0] ""
6515
  msgstr[1] ""
6516
 
6517
+ #: inc/templates/class-lp-template-course.php:806
6518
  msgid "Features"
6519
  msgstr ""
6520
 
6521
+ #: inc/templates/class-lp-template-course.php:905
6522
  msgid "View More"
6523
  msgstr ""
6524
 
6526
  msgid "Not Started"
6527
  msgstr ""
6528
 
6529
+ #: inc/user-item/class-lp-user-item-quiz.php:747
6530
  msgid "Question is invalid!"
6531
  msgstr ""
6532
 
6533
+ #: inc/user-item/class-lp-user-item-quiz.php:752
6534
  msgid "Cannot check answer the question."
6535
  msgstr ""
6536
 
6537
+ #: inc/user-item/class-lp-user-item.php:799
6538
  #: templates/profile/tabs/courses.php:33
6539
  msgid "Enrolled"
6540
  msgstr ""
6541
 
6542
+ #: inc/user-item/class-lp-user-item.php:802
6543
  msgid "Started"
6544
  msgstr ""
6545
 
6546
+ #: inc/user-item/class-lp-user-item.php:810
6547
  msgid "Not Enrolled"
6548
  msgstr ""
6549
 
6550
+ #: inc/user/abstract-lp-user.php:563
6551
  msgid "You can not hint question."
6552
  msgstr ""
6553
 
6554
+ #: inc/user/abstract-lp-user.php:630
6555
+ #: inc/user/abstract-lp-user.php:779
6556
+ #: inc/user/abstract-lp-user.php:791
6557
  msgid "The role %s for user doesn't exist"
6558
  msgstr ""
6559
 
6560
+ #: inc/user/abstract-lp-user.php:858
6561
+ msgid "You must enroll course!"
6562
+ msgstr ""
6563
+
6564
+ #: inc/user/abstract-lp-user.php:866
6565
+ msgid "Invalid lesson"
6566
+ msgstr ""
6567
+
6568
+ #: inc/user/abstract-lp-user.php:870
6569
  msgid "You have already completed this lesson."
6570
  msgstr ""
6571
 
6731
  msgid "%1$s::%2$s - Your Quiz can't retake."
6732
  msgstr ""
6733
 
6734
+ #: inc/user/lp-user-functions.php:378
6735
  msgid "Want to become an instructor?"
6736
  msgstr ""
6737
 
6738
+ #: inc/user/lp-user-functions.php:896
6739
  msgid "Please login to enroll this course"
6740
  msgstr ""
6741
 
6742
+ #: inc/user/lp-user-functions.php:914
6743
  msgid "You have already finished course"
6744
  msgstr ""
6745
 
6746
+ #: inc/user/lp-user-functions.php:917
6747
  msgid "You have already enrolled in this course"
6748
  msgstr ""
6749
 
6750
+ #: inc/user/lp-user-functions.php:1090
6751
  msgid "Old password incorrect!"
6752
  msgstr ""
6753
 
6754
+ #: inc/user/lp-user-functions.php:1096
6755
  msgid "Confirmation password incorrect!"
6756
  msgstr ""
6757
 
6758
+ #: inc/user/lp-user-functions.php:1389
6759
  msgid "Invalid item id."
6760
  msgstr ""
6761
 
6762
+ #: inc/user/lp-user-functions.php:1422
6763
  msgid "Invalid item data."
6764
  msgstr ""
6765
 
6766
+ #: inc/user/lp-user-functions.php:1596
6767
  msgid "Invalid Course ID."
6768
  msgstr ""
6769
 
6770
+ #: inc/user/lp-user-functions.php:1616
6771
  msgid "Invalid Quiz"
6772
  msgstr ""
6773
 
6774
+ #: inc/user/lp-user-functions.php:2016
6775
  msgid "Facebook Profile"
6776
  msgstr ""
6777
 
6778
+ #: inc/user/lp-user-functions.php:2019
6779
  msgid "Twitter Profile"
6780
  msgstr ""
6781
 
6782
+ #: inc/user/lp-user-functions.php:2022
6783
  msgid "Google Profile"
6784
  msgstr ""
6785
 
6786
+ #: inc/user/lp-user-functions.php:2025
6787
  msgid "Youtube Channel"
6788
  msgstr ""
6789
 
6790
+ #: inc/user/lp-user-functions.php:2028
6791
  msgid "Linkedin Profile"
6792
  msgstr ""
6793
 
6943
  msgid "Recent Courses"
6944
  msgstr ""
6945
 
6946
+ #: learnpress.php:485
6947
  msgid "Documentation"
6948
  msgstr ""
6949
 
6950
+ #: learnpress.php:497
6951
  msgid "LearnPress plugin base directory must be <strong>learnpress/learnpres.php</strong> (case sensitive) to ensure all functions work properly and fully operational (currently <strong>%s</strong>)"
6952
  msgstr ""
6953
 
7320
 
7321
  #: templates/profile/tabs/quizzes.php:56
7322
  #: assets/js/dist/frontend/quiz.min.js:22
7323
+ #: assets/js/dist/frontend/quiz.min.js:194
7324
  msgid "Time spent"
7325
  msgstr ""
7326
 
7616
  msgid "Questions:"
7617
  msgstr ""
7618
 
7619
+ #: assets/js/dist/frontend/quiz.min.js:176
7620
  msgid "Your Result"
7621
  msgstr ""
7622
 
7623
+ #: assets/js/dist/frontend/quiz.min.js:210
7624
  msgid "Wrong"
7625
  msgstr ""
7626
 
7627
+ #: assets/js/dist/frontend/quiz.min.js:214
7628
  msgid "Skipped"
7629
  msgstr ""
7630
 
learnpress.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://thimpress.com/learnpress
5
  * Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  * Author: ThimPress
7
- * Version: 4.1.7.1
8
  * Author URI: http://thimpress.com
9
  * Requires at least: 5.6
10
  * Tested up to: 6.0
@@ -850,38 +850,12 @@ if ( ! class_exists( 'LearnPress' ) ) {
850
  */
851
  public function mu_plugin() {
852
  try {
853
- $name = 'class-lp-mu-plugin.php';
854
- $can_copy = false;
855
-
856
- // replace the old file
857
- $mu_plugin_file = LP_PLUGIN_PATH . '/mu-plugin/' . $name;
858
-
859
- if ( defined( 'WPMU_PLUGIN_DIR' ) ) {
860
- $mu_plugins_path = WPMU_PLUGIN_DIR;
861
- } else {
862
- $mu_plugins_path = WP_CONTENT_DIR . '/' . 'mu-plugins';
863
- }
864
-
865
- if ( ! file_exists( $mu_plugins_path ) ) {
866
- mkdir( $mu_plugins_path, 0755, true );
867
- }
868
-
869
  $mu_plugin_file_path = $mu_plugins_path . '/' . $name;
870
-
871
- // add mu file
872
- if ( file_exists( $mu_plugins_path ) ) {
873
- if ( file_exists( $mu_plugin_file_path ) ) {
874
- if ( LP_MU_Plugin::$version < $this->mu_file_version ) {
875
- $can_copy = true;
876
- }
877
- } else {
878
- $can_copy = true;
879
- }
880
- }
881
-
882
- if ( $can_copy ) {
883
- //update_option( 'learnpress_mu_plugin_version', $this->mu_file_version );
884
- LP_WP_Filesystem::instance()->copy( $mu_plugin_file, $mu_plugin_file_path );
885
  }
886
  } catch ( Throwable $e ) {
887
  error_log( $e->getMessage() );
@@ -905,4 +879,4 @@ function LP() {
905
  * Done! entry point of the plugin
906
  * Create new instance of LearnPress and put it to global
907
  */
908
- $GLOBALS['LearnPress'] = LP();
4
  * Plugin URI: http://thimpress.com/learnpress
5
  * Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  * Author: ThimPress
7
+ * Version: 4.1.7.2
8
  * Author URI: http://thimpress.com
9
  * Requires at least: 5.6
10
  * Tested up to: 6.0
850
  */
851
  public function mu_plugin() {
852
  try {
853
+ // Remove file mu plugin create on version 4.1.7.
854
+ $name = 'class-lp-mu-plugin.php';
855
+ $mu_plugins_path = WPMU_PLUGIN_DIR;
 
 
 
 
 
 
 
 
 
 
 
 
 
856
  $mu_plugin_file_path = $mu_plugins_path . '/' . $name;
857
+ if ( file_exists( $mu_plugin_file_path ) ) {
858
+ LP_WP_Filesystem::instance()->lp_filesystem->delete( $mu_plugin_file_path );
 
 
 
 
 
 
 
 
 
 
 
 
 
859
  }
860
  } catch ( Throwable $e ) {
861
  error_log( $e->getMessage() );
879
  * Done! entry point of the plugin
880
  * Create new instance of LearnPress and put it to global
881
  */
882
+ $GLOBALS['LearnPress'] = LearnPress::instance();
mu-plugin/class-lp-mu-plugin.php CHANGED
@@ -97,21 +97,30 @@ class LP_MU_Plugin {
97
  $url_load_plugins = false;
98
  $urls_apply = [
99
  'wp-json/lp/v1/courses/archive-course' => [
100
- 'learnpress/learnpress.php' => [],
101
  'learnpress-woo-payment/learnpress-woo-payment.php' => [
102
  'woocommerce/woocommerce.php',
103
  ],
 
 
 
104
  ],
105
  'wp-json/lp/v1/profile/course-tab' => [
106
- 'learnpress/learnpress.php' => [],
107
  'learnpress-woo-payment/learnpress-woo-payment.php' => [
108
  'woocommerce/woocommerce.php',
109
  ],
 
 
 
110
  ],
111
  'wp-json/lp/v1/lazy-load/course-curriculum' => [
112
- 'learnpress/learnpress.php' => [],
113
  'learnpress-assignments/learnpress-assignments.php' => [],
114
- 'learnpress-h5p/learnpress-h5p.php' => [],
 
 
 
115
  ],
116
  'wp-json/lp/v1/lazy-load/course-progress' => [
117
  'learnpress/learnpress.php' => [],
97
  $url_load_plugins = false;
98
  $urls_apply = [
99
  'wp-json/lp/v1/courses/archive-course' => [
100
+ 'learnpress/learnpress.php' => [],
101
  'learnpress-woo-payment/learnpress-woo-payment.php' => [
102
  'woocommerce/woocommerce.php',
103
  ],
104
+ 'learnpress-wpml/learnpress-wpml.php' => [
105
+ 'sitepress-multilingual-cms/sitepress.php',
106
+ ],
107
  ],
108
  'wp-json/lp/v1/profile/course-tab' => [
109
+ 'learnpress/learnpress.php' => [],
110
  'learnpress-woo-payment/learnpress-woo-payment.php' => [
111
  'woocommerce/woocommerce.php',
112
  ],
113
+ 'learnpress-wpml/learnpress-wpml.php' => [
114
+ 'sitepress-multilingual-cms/sitepress.php',
115
+ ],
116
  ],
117
  'wp-json/lp/v1/lazy-load/course-curriculum' => [
118
+ 'learnpress/learnpress.php' => [],
119
  'learnpress-assignments/learnpress-assignments.php' => [],
120
+ 'learnpress-h5p/learnpress-h5p.php' => [],
121
+ 'learnpress-wpml/learnpress-wpml.php' => [
122
+ 'sitepress-multilingual-cms/sitepress.php',
123
+ ],
124
  ],
125
  'wp-json/lp/v1/lazy-load/course-progress' => [
126
  'learnpress/learnpress.php' => [],
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: elearning, education, course, lms, learning management system
5
  Requires at least: 5.6
6
  Tested up to: 6.0
7
  Requires PHP: 7.0
8
- Stable tag: 4.1.7.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -203,6 +203,15 @@ https://www.transifex.com/projects/p/learnpress/
203
 
204
  == Changelog ==
205
 
 
 
 
 
 
 
 
 
 
206
  = 4.1.7.1 (2022-09-16) =
207
  ~ Fixed: non-LP plugins causing errors.
208
 
5
  Requires at least: 5.6
6
  Tested up to: 6.0
7
  Requires PHP: 7.0
8
+ Stable tag: 4.1.7.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
203
 
204
  == Changelog ==
205
 
206
+ = 4.1.7.2 (2022-10-03) =
207
+ ~ Removed: delete file mu-plugin (Moved to the plugin Thim Optimize).
208
+ ~ Fixed: CVE-2022-3360 security.
209
+ ~ Fixed: error "Quiz is not auto submitted when the time is expired".
210
+ ~ Fixed: error "Completed item is not redirected to the next item".
211
+ ~ Modified: Shortcode button LP.
212
+ ~ Removed: delete shortcode 'learn_press_button_enroll'. We recommend using the shortcode 'learn_press_button_course' instead.
213
+ ~ Fixed: error "Email content on one line when you save".
214
+
215
  = 4.1.7.1 (2022-09-16) =
216
  ~ Fixed: non-LP plugins causing errors.
217
 
templates/archive-course.php CHANGED
@@ -40,7 +40,7 @@ $page_title = learn_press_page_title( false );
40
  * LP Hook
41
  */
42
  do_action( 'learn-press/before-courses-loop' );
43
- LP()->template( 'course' )->begin_courses_loop();
44
 
45
  if ( LP_Settings_Courses::is_ajax_load_courses() && ! LP_Settings_Courses::is_no_load_ajax_first_courses() ) {
46
  echo '<div class="lp-archive-course-skeleton" style="width:100%">';
@@ -55,7 +55,7 @@ $page_title = learn_press_page_title( false );
55
 
56
  endwhile;
57
  } else {
58
- LP()->template( 'course' )->no_courses_found();
59
  }
60
 
61
  if ( LP_Settings_Courses::is_ajax_load_courses() ) {
@@ -65,7 +65,7 @@ $page_title = learn_press_page_title( false );
65
  }
66
  }
67
 
68
- LP()->template( 'course' )->end_courses_loop();
69
  do_action( 'learn-press/after-courses-loop' );
70
 
71
 
40
  * LP Hook
41
  */
42
  do_action( 'learn-press/before-courses-loop' );
43
+ LearnPress::instance()->template( 'course' )->begin_courses_loop();
44
 
45
  if ( LP_Settings_Courses::is_ajax_load_courses() && ! LP_Settings_Courses::is_no_load_ajax_first_courses() ) {
46
  echo '<div class="lp-archive-course-skeleton" style="width:100%">';
55
 
56
  endwhile;
57
  } else {
58
+ LearnPress::instance()->template( 'course' )->no_courses_found();
59
  }
60
 
61
  if ( LP_Settings_Courses::is_ajax_load_courses() ) {
65
  }
66
  }
67
 
68
+ LearnPress::instance()->template( 'course' )->end_courses_loop();
69
  do_action( 'learn-press/after-courses-loop' );
70
 
71
 
templates/checkout/account-login.php CHANGED
@@ -47,7 +47,7 @@ if ( is_user_logged_in() ) {
47
  </p>
48
 
49
  <p class="lp-checkout-sign-up-link">
50
- <?php if ( LP()->checkout()->is_enable_register() ) : ?>
51
  <?php esc_html_e( 'Don\'t have an account?', 'learnpress' ); ?>
52
  <a href="javascript: void(0);">
53
  <label for="checkout-account-switch-to-register"><?php echo esc_html_x( 'Sign up', 'checkout sign up link', 'learnpress' ); ?></label>
47
  </p>
48
 
49
  <p class="lp-checkout-sign-up-link">
50
+ <?php if ( LearnPress::instance()->checkout()->is_enable_register() ) : ?>
51
  <?php esc_html_e( 'Don\'t have an account?', 'learnpress' ); ?>
52
  <a href="javascript: void(0);">
53
  <label for="checkout-account-switch-to-register"><?php echo esc_html_x( 'Sign up', 'checkout sign up link', 'learnpress' ); ?></label>
templates/checkout/account-register.php CHANGED
@@ -43,7 +43,7 @@ defined( 'ABSPATH' ) || exit();
43
  <?php wp_nonce_field( 'learn-press-checkout-register', 'learn-press-checkout-nonce' ); ?>
44
 
45
  <p class="lp-checkout-sign-in-link">
46
- <?php if ( LP()->checkout()->is_enable_login() ) : ?>
47
  <?php esc_html_e( 'Already had an account?', 'learnpress' ); ?>
48
  <a href="javascript: void(0);">
49
  <label for="checkout-account-switch-to-login"><?php esc_html_e( 'Sign in', 'learnpress' ); ?></label>
43
  <?php wp_nonce_field( 'learn-press-checkout-register', 'learn-press-checkout-nonce' ); ?>
44
 
45
  <p class="lp-checkout-sign-in-link">
46
+ <?php if ( LearnPress::instance()->checkout()->is_enable_login() ) : ?>
47
  <?php esc_html_e( 'Already had an account?', 'learnpress' ); ?>
48
  <a href="javascript: void(0);">
49
  <label for="checkout-account-switch-to-login"><?php esc_html_e( 'Sign in', 'learnpress' ); ?></label>
templates/checkout/empty-cart.php CHANGED
@@ -13,6 +13,6 @@ defined( 'ABSPATH' ) || exit();
13
 
14
  do_action( 'learn-press/before-empty-cart-message' );
15
 
16
- learn_press_display_message( esc_html__( 'Your cart is currently empty.', 'learnpress' ), 'error' );
17
 
18
  do_action( 'learn-press/after-empty-cart-message' );
13
 
14
  do_action( 'learn-press/before-empty-cart-message' );
15
 
16
+ //learn_press_display_message( esc_html__( 'Your cart is currently empty.', 'learnpress' ), 'error' );
17
 
18
  do_action( 'learn-press/after-empty-cart-message' );
templates/checkout/form.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  defined( 'ABSPATH' ) || exit();
13
 
14
- $checkout = LP()->checkout();
15
 
16
  learn_press_print_messages();
17
 
11
 
12
  defined( 'ABSPATH' ) || exit();
13
 
14
+ $checkout = LearnPress::instance()->checkout();
15
 
16
  learn_press_print_messages();
17
 
templates/checkout/guest-checkout-link.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  defined( 'ABSPATH' ) || exit;
11
 
12
- if ( ! LP()->checkout()->is_enable_guest_checkout() ) {
13
  return;
14
  }
15
 
9
 
10
  defined( 'ABSPATH' ) || exit;
11
 
12
+ if ( ! LearnPress::instance()->checkout()->is_enable_guest_checkout() ) {
13
  return;
14
  }
15
 
templates/checkout/guest-checkout.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  defined( 'ABSPATH' ) || exit();
13
 
14
- $checkout = LP()->checkout();
15
  $is_exists = $checkout->checkout_email_exists();
16
  ?>
17
 
@@ -31,20 +31,20 @@ $is_exists = $checkout->checkout_email_exists();
31
  $signup = '';
32
  $divider = '';
33
 
34
- if ( LP()->checkout()->is_enable_login() ) {
35
  $signin = sprintf( '<a href="javascript:void(0)"><label for="checkout-account-switch-to-login">%s</label></a>', esc_html( _x( 'Sign in', 'checkout sign in link', 'learnpress' ) ) );
36
  }
37
 
38
- if ( LP()->checkout()->is_enable_login() && LP()->checkout()->is_enable_register() ) {
39
  $divider = ',';
40
  }
41
 
42
- if ( LP()->checkout()->is_enable_register() ) {
43
  $signup = sprintf( '<a href="javascript:void(0)"><label for="checkout-account-switch-to-register">%s</label></a>', esc_html( _x( 'Sign up', 'checkout sign up link', 'learnpress' ) ) );
44
  }
45
  ?>
46
 
47
- <?php if ( LP()->checkout()->is_enable_login() || LP()->checkout()->is_enable_register() ) : ?>
48
  <div class="lp-guest-switch-login"><?php echo sprintf( __( 'Or you can %1$s%2$s %3$s now.', 'learnpress' ), $signin, $divider, $signup ); ?></div>
49
  <?php endif; ?>
50
  </li>
11
 
12
  defined( 'ABSPATH' ) || exit();
13
 
14
+ $checkout = LearnPress::instance()->checkout();
15
  $is_exists = $checkout->checkout_email_exists();
16
  ?>
17
 
31
  $signup = '';
32
  $divider = '';
33
 
34
+ if ( LearnPress::instance()->checkout()->is_enable_login() ) {
35
  $signin = sprintf( '<a href="javascript:void(0)"><label for="checkout-account-switch-to-login">%s</label></a>', esc_html( _x( 'Sign in', 'checkout sign in link', 'learnpress' ) ) );
36
  }
37
 
38
+ if ( LearnPress::instance()->checkout()->is_enable_login() && LearnPress::instance()->checkout()->is_enable_register() ) {
39
  $divider = ',';
40
  }
41
 
42
+ if ( LearnPress::instance()->checkout()->is_enable_register() ) {
43
  $signup = sprintf( '<a href="javascript:void(0)"><label for="checkout-account-switch-to-register">%s</label></a>', esc_html( _x( 'Sign up', 'checkout sign up link', 'learnpress' ) ) );
44
  }
45
  ?>
46
 
47
+ <?php if ( LearnPress::instance()->checkout()->is_enable_login() || LearnPress::instance()->checkout()->is_enable_register() ) : ?>
48
  <div class="lp-guest-switch-login"><?php echo sprintf( __( 'Or you can %1$s%2$s %3$s now.', 'learnpress' ), $signin, $divider, $signup ); ?></div>
49
  <?php endif; ?>
50
  </li>
templates/checkout/payment.php CHANGED
@@ -19,7 +19,7 @@ defined( 'ABSPATH' ) || exit();
19
  do_action( 'learn-press/before-payment-methods' );
20
 
21
  // Show payments if cart total > 0 and have at least one payment method.
22
- if ( LP()->cart && LP()->cart->needs_payment() && $available_gateways ) {
23
  ?>
24
  <h4>
25
  <?php esc_html_e( 'Payment', 'learnpress' ); ?>
19
  do_action( 'learn-press/before-payment-methods' );
20
 
21
  // Show payments if cart total > 0 and have at least one payment method.
22
+ if ( LearnPress::instance()->cart && LearnPress::instance()->cart->needs_payment() && $available_gateways ) {
23
  ?>
24
  <h4>
25
  <?php esc_html_e( 'Payment', 'learnpress' ); ?>
templates/shortcode/list-courses.php CHANGED
@@ -29,7 +29,7 @@ if ( ! isset( $query ) ) {
29
  */
30
  do_action( 'learn-press/shortcode/before-courses-loop' );
31
 
32
- LP()->template( 'course' )->begin_courses_loop();
33
 
34
  while ( $query->have_posts() ) :
35
  $query->the_post();
@@ -38,7 +38,7 @@ if ( ! isset( $query ) ) {
38
 
39
  endwhile;
40
 
41
- LP()->template( 'course' )->end_courses_loop();
42
 
43
  /**
44
  * LP Hook
29
  */
30
  do_action( 'learn-press/shortcode/before-courses-loop' );
31
 
32
+ LearnPress::instance()->template( 'course' )->begin_courses_loop();
33
 
34
  while ( $query->have_posts() ) :
35
  $query->the_post();
38
 
39
  endwhile;
40
 
41
+ LearnPress::instance()->template( 'course' )->end_courses_loop();
42
 
43
  /**
44
  * LP Hook
templates/single-course/buttons/purchase.php CHANGED
@@ -16,7 +16,7 @@ if ( ! isset( $course ) ) {
16
  }
17
 
18
  $classes_purchase = 'purchase-course';
19
- $classes_purchase .= ( LP()->checkout()->is_enable_guest_checkout() ) ? ' guest_checkout' : '';
20
 
21
  $classes_purchase = apply_filters( 'lp/btn/purchase/classes', $classes_purchase );
22
  ?>
16
  }
17
 
18
  $classes_purchase = 'purchase-course';
19
+ $classes_purchase .= ( LearnPress::instance()->checkout()->is_enable_guest_checkout() ) ? ' guest_checkout' : '';
20
 
21
  $classes_purchase = apply_filters( 'lp/btn/purchase/classes', $classes_purchase );
22
  ?>
templates/single-course/content-item/popup-content.php CHANGED
@@ -12,8 +12,8 @@
12
 
13
  <div id="popup-content">
14
  <?php
15
- LP()->template( 'course' )->course_content_item();
16
 
17
- LP()->template( 'course' )->course_item_comments();
18
  ?>
19
  </div>
12
 
13
  <div id="popup-content">
14
  <?php
15
+ LearnPress::instance()->template( 'course' )->course_content_item();
16
 
17
+ LearnPress::instance()->template( 'course' )->course_item_comments();
18
  ?>
19
  </div>
templates/single-course/content-item/popup-sidebar.php CHANGED
@@ -17,5 +17,5 @@ defined( 'ABSPATH' ) || exit;
17
  <button type="button" class="clear"></button>
18
  </form>
19
 
20
- <?php LP()->template( 'course' )->course_curriculum(); ?>
21
  </div>
17
  <button type="button" class="clear"></button>
18
  </form>
19
 
20
+ <?php LearnPress::instance()->template( 'course' )->course_curriculum(); ?>
21
  </div>
templates/single-course/meta-primary.php CHANGED
@@ -9,8 +9,8 @@
9
 
10
  defined( 'ABSPATH' ) or die;
11
 
12
- $has_meta_left = LP()->template()->has_content( 'learn-press/course-meta-primary-left' );
13
- $has_meta_right = LP()->template()->has_content( 'learn-press/course-meta-primary-right' );
14
 
15
  // Do not echo anything if there is no content hooked
16
  if ( ! $has_meta_left && ! $has_meta_right ) {
9
 
10
  defined( 'ABSPATH' ) or die;
11
 
12
+ $has_meta_left = LearnPress::instance()->template()->has_content( 'learn-press/course-meta-primary-left' );
13
+ $has_meta_right = LearnPress::instance()->template()->has_content( 'learn-press/course-meta-primary-right' );
14
 
15
  // Do not echo anything if there is no content hooked
16
  if ( ! $has_meta_left && ! $has_meta_right ) {
templates/{single-course/meta-secondary.php → single-cour} RENAMED
File without changes