!function(e){vart,i,n;!function(e){functions(e,t){returny.call(e,t)}functiono(e,t){vari,n,s,o,l,r,a,c,d,u,h,_,p=t&&t.split("/"),g=v.map,m=g&&g["*"]||{};if(e){for(e=e.split("/"),l=e.length-1,v.nodeIdCompat&&S.test(e[l])&&(e[l]=e[l].replace(S,"")),"."===e[0].charAt(0)&&p&&(_=p.slice(0,p.length-1),e=_.concat(e)),d=0;d<e.length;d++)if("."===(h=e[d]))e.splice(d,1),d-=1;elseif(".."===h){if(0===d||1===d&&".."===e[2]||".."===e[d-1])continue;d>0&&(e.splice(d-1,2),d-=2)}e=e.join("/")}if((p||m)&&g){for(i=e.split("/"),d=i.length;d>0;d-=1){if(n=i.slice(0,d).join("/"),p)for(u=p.length;u>0;u-=1)if((s=g[p.slice(0,u).join("/")])&&(s=s[n])){o=s,r=d;break}if(o)break;!a&&m&&m[n]&&(a=m[n],c=d)}!o&&a&&(o=a,r=c),o&&(i.splice(0,r,o),e=i.join("/"))}returne}functionl(t,i){returnfunction(){varn=k.call(arguments,0);return"string"!=typeofn[0]&&1===n.length&&n.push(null),p.apply(e,n.concat([t,i]))}}functionr(e){returnfunction(t){returno(t,e)}}functiona(e){returnfunction(t){f[e]=t}}functionc(t){if(s(b,t)){vari=b[t];deleteb[t],w[t]=!0,_.apply(e,i)}if(!s(f,t)&&!s(w,t))thrownewError("No "+t);returnf[t]}functiond(e){vart,i=e?e.indexOf("!"):-1;returni>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}functionu(e){returne?d(e):[]}functionh(e){returnfunction(){returnv&&v.config&&v.config[e]||{}}}var_,p,g,m,f={},b={},v={},w={},y=Object.prototype.hasOwnProperty,k=[].slice,S=/\.js$/;g=function(e,t){vari,n=d(e),s=n[0],l=t[1];returne=n[1],s&&(s=o(s,l),i=c(s)),s?e=i&&i.normalize?i.normalize(e,r(l)):o(e,l):(e=o(e,l),n=d(e),s=n[0],e=n[1],s&&(i=c(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:i}},m={require:function(e){returnl(e)},exports:function(e){vart=f[e];returnvoid0!==t?t:f[e]={}},module:function(e){return{id:e,uri:"",exports:f[e],config:h(e)}}},_=function(t,i,n,o){varr,d,h,_,p,v,y,k=[],S=typeofn;if(o=o||t,v=u(o),"undefined"===S||"function"===S){for(i=!i.length&&n.length?["require","exports","module"]:i,p=0;p<i.length;p+=1)if(_=g(i[p],v),"require"===(d=_.f))k[p]=m.require(t);elseif("exports"===d)k[p]=m.exports(t),y=!0;elseif("module"===d)r=k[p]=m.module(t);elseif(s(f,d)||s(b,d)||s(w,d))k[p]=c(d);else{if(!_.p)thrownewError(t+" missing "+d);_.p.load(_.n,l(o,!0),a(d),{}),k[p]=f[d]}h=n?n.apply(f[t],k):void0,t&&(r&&r.exports!==e&&r.exports!==f[t]?f[t]=r.exports:h===e&&y||(f[t]=h))}elset&&(f[t]=n)},t=i=p=function(t,i,n,s,o){if("string"==typeoft)returnm[t]?m[t](i):c(g(t,u(i)).f);if(!t.splice){if(v=t,v.deps&&p(v.deps,v.callback),!i)return;i.splice?(t=i,i=n,n=null):t=e}returni=i||function(){},"function"==typeofn&&(n=s,s=o),s?_(e,t,i,n):setTimeout(function(){_(e,t,i,n)},4),p},p.config=function(e){returnp(e)},t._defined=f,n=function(e,t,i){if("string"!=typeofe)thrownewError("See almond README: incorrect module build, no module name");t.splice||(i=t,t=[]),s(f,e)||s(b,e)||(b[e]=[e,t,i])},n.amd={jQuery:!0}}(),n("vendor/almond",function(){}),window.llms=window.llms||{},void0!==window.wp&&void0!==window.wp.hooks?window.llms.hooks=window.wp.hooks:window.llms.hooks=function(e){functiont(n){if(i[n])returni[n].exports;vars=i[n]={i:n,l:!1,exports:{}};returne[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}vari={};returnt.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){vari=e&&e.__esModule?function(){returne.default}:function(){returne};returnt.d(i,"a",i),i},t.o=function(e,t){returnObject.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=209)}({209:function(e,t,i){"use strict";i.r(t);varn=function(e){return"string"!=typeofe||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},s=function(e){return"string"!=typeofe||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},o=function(e){returnfunction(t,i,o){varl=arguments.length>3&&void0!==arguments[3]?arguments[3]:10;if(s(t)&&n(i))if("function"==typeofo)if("number"==typeofl){varr={callback:o,priority:l,namespace:i};if(e[t]){for(vara=e[t].handlers,c=0;c<a.length&&!(a[c].priority>l);)c++;a.splice(c,0,r),(e.__current||[]).forEach(function(e){e.name===t&&e.currentIndex>=c&&e.currentIndex++})}elsee[t]={handlers:[r],runs:0};"hookAdded"!==t&&k("hookAdded",t,i,o,l)}elseconsole.error("If specified, the hook priority must be a number.");elseconsole.error("The hook callback must be a function.")}},l=function(e,t){returnfunction(i,o){if(s(i)&&(t||n(o))){if(!e[i])return0;varl=0;if(t)l=e[i].handlers.length,e[i]={runs:e[i].runs,handlers:[]};elsefor(varr=e[i].handlers,a=r.length-1;a>=0;a--)!function(t){r[t].namespace===o&&(r.splice(t,1),l++,(e.__current||[]).forEach(function(e){e.name===i&&e.currentIndex>=t&&e.currentIndex--}))}(a);return"hookRemoved"!==i&&k("hookRemoved",i,o),l}}},r=function(e){returnfunction(t){returntine}},a=function(e,t){returnfunction(i){e[i]||(e[i]={handlers:[],runs:0}),e[i].runs++;for(varn=e[i].handlers,s=arguments.length,o=newArray(s>1?s-1:0),l=1;l<s;l++)o[l-1]=arguments[l];if(!n||!n.length)returnt?o[0]:void0;varr={name:i,currentIndex:0};for(e.__current.push(r),e[i]||(e[i]={runs:0,handlers:[]});r.currentIndex<n.length;){vara=n[r.currentIndex].callback.apply(null,o);t&&(o[0]=a),r.currentIndex++}returne.__current.pop(),t?o[0]:void0}},c=function(e){returnfunction(){returne.__current&&e.__current.length?e.__current[e.__current.length-1].name:null}},d=function(e){returnfunction(t){returnvoid0===t?void0!==e.__current[0]:!!e.__current[0]&&t===e.__current[0].name}},u=function(e){returnfunction(t){if(s(t))returne[t]&&e[t].runs?e[t].runs:0}},h=function(){vare=Object.create(null),t=Object.create(null);returne.__current=[],t.__current=[],{addAction:o(e),addFilter:o(t),removeAction:l(e),removeFilter:l(t),hasAction:r(e),hasFilter:r(t),removeAllActions:l(e,!0),removeAllFilters:l(t,!0),doAction:a(e),applyFilters:a(t,!0),currentAction:c(e),currentFilter:c(t),doingAction:d(e),doingFilter:d(t),didAction:u(e),didFilter:u(t),actions:e,filters:t}};i.d(t,"addAction",function(){returnp}),i.d(t,"addFilter",function(){returng}),i.d(t,"removeAction",function(){returnm}),i.d(t,"removeFilter",function(){returnf}),i.d(t,"hasAction",function(){returnb}),i.d(t,"hasFilter",function(){returnv}),i.d(t,"removeAllActions",function(){returnw}),i.d(t,"removeAllFilters",function(){returny}),i.d(t,"doAction",function(){returnk}),i.d(t,"applyFilters",function(){returnS}),i.d(t,"currentAction",function(){returnx}),i.d(t,"currentFilter",function(){returnC}),i.d(t,"doingAction",function(){returnq}),i.d(t,"doingFilter",function(){returnM}),i.d(t,"didAction",function(){returnL}),i.d(t,"didFilter",function(){returnV}),i.d(t,"actions",function(){returnB}),i.d(t,"filters",function(){returnA}),i.d(t,"createHooks",function(){returnh});var_=h(),p=_.addAction,g=_.addFilter,m=_.removeAction,f=_.removeFilter,b=_.hasAction,v=_.hasFilter,w=_.removeAllActions,y=_.removeAllFilters,k=_.doAction,S=_.applyFilters,x=_.currentAction,C=_.currentFilter,q=_.doingAction,M=_.doingFilter,L=_.didAction,V=_.didFilter,B=_.actions,A=_.filters}}),n("vendor/wp-hooks",function(){}),n("underscore",[],function(){return_}),n("backbone",[],function(){returnBackbone}),n("jquery",[],function(){returnjQuery}),function(e,t){"function"==typeofn&&n.amd?n("vendor/backbone.collectionView",["underscore","backbone","jquery"],t):"undefined"!=typeofexports?module.exports=t(i("underscore"),i("backbone"),i("backbone").$):t(e._,e.Backbone,e.jQuery||e.Zepto||e.$)}(this,function(e,t,i){functionn(t){vari={};if(!e.isArray(t))thrownewError("Option declarations must be an array.");returne.each(t,function(t){varn,s,o;if(s=!1,o=void0,e.isString(t))n=t;else{if(!e.isObject(t))thrownewError("Each element in the option declarations array must be either a string or an object.");n=e.first(e.keys(t)),o=e.isFunction(t[n])?t[n]:e.clone(t[n])}"!"===n[n.length-1]&&(s=!0,n=n.slice(0,n.length-1)),i[n]=i[n]||{},i[n].required=s,e.isUndefined(o)||(i[n].defaultValue=o)}),i}vars=t.View,o=["collection","modelView","modelViewOptions","itemTemplate","itemTemplateFunction","detachedRendering"],l={background:"transparent",border:"none","box-shadow":"none"};returnt.CollectionView=t.View.extend({tagName:"ul",events:{"mousedown > li, tbody > tr > td":"_listItem_onMousedown","dblclick > li, tbody > tr > td":"_listItem_onDoubleClick",click:"_listBackground_onClick","click ul.collection-view, table.collection-view":"_listBackground_onClick",keydown:"_onKeydown"},spawnMessages:{focus:"focus"},passMessages:{"*":"."},initializationOptions:[{collection:null},{modelView:null},{modelViewOptions:{}},{itemTemplate:null},{itemTemplateFunction:null},{selectable:!0},{clickToSelect:!0},{selectableModelsFilter:null},{visibleModelsFilter:null},{sortableModelsFilter:null},{selectMultiple:!1},{clickToToggle:!1},{processKeyEvents:!0},{sortable:!1},{sortableOptions:null},{reuseModelViews:!0},{detachedRendering:!1},{emptyListCaption:null}],initialize:function(e){t.ViewOptions.add(this,"initializationOptions"),this.setOptions(e),this.collection||(this.collection=newt.Collection),this._hasBeenRendered=!1,this._isBackboneCourierAvailable()&&t.Courier.add(this),this.$el.data("view",this),this.$el.addClass("collection-view collection-list"),this.selectable&&this.$el.addClass("selectable"),this.selectable&&this.processKeyEvents&&this.$el.attr("tabindex",0),this.selectedItems=[],this._updateItemTemplate(),this.collection&&this._registerCollectionEvents(),this.viewManager=newChildViewContainer},_onOptionsChanged:function(t,i){varn=this,s=!1;e.each(e.keys(t),function(l){varr=t[l],a=i[l];switch(l){case"collection":r!==a&&(n.stopListening(a),n._registerCollectionEvents());break;case"selectMultiple":!r&&n.selectedItems.length>1&&n.setSelectedModel(e.first(n.selectedItems),{by:"cid"});break;case"selectable":!r&&n.selectedItems.length>0&&n.setSelectedModels([]),r&&this.processKeyEvents?n.$el.attr("tabindex",0):n.$el.removeAttr("tabindex",0);break;case"sortable":t.sortable?n._setupSortable():n.$el.sortable("destroy");break;case"selectableModelsFilter":n.reapplyFilter("selectableModels");break;case"sortableOptions":n.$el.sortable("destroy"),n._setupSortable();break;case"sortableModelsFilter":n.reapplyFilter("sortableModels");break;case"visibleModelsFilter":n.reapplyFilter("visibleModels");break;case"itemTemplate":n._updateItemTemplate();break;case"processKeyEvents":r&&this.selectable?n.$el.attr("tabindex",0):n.$el.removeAttr("tabindex",0);break;case"modelView":n.viewManager.each(function(e){n.viewManager.remove(e),e.remove()})}e.contains(o,l)&&(s=!0)}),this._hasBeenRendered&&s&&this.render()},setOption:function(e,t){vari={};i[e]=t,this.setOptions(i)},getSelectedModel:function(t){returnthis.selectedItems.length?e.first(this.getSelectedModels(t)):null},getSelectedModels:function(t){varn=this;t=e.extend({},{by:"model"},t);vars=t.by,o=[];switch(s){case"id":e.each(this.selectedItems,function(e){o.push(n.collection.get(e).id)});break;case"cid":o=o.concat(this.selectedItems);break;case"offset":varl=0;this._getVisibleItemEls().each(function(){i(this).is(".selected")&&o.push(l),l++});break;case"model":e.each(this.selectedItems,function(e){o.push(n.collection.get(e))});break;case"view":e.each(this.selectedItems,function(e){o.push(n.viewManager.findByModel(n.collection.get(e)))});break;default:thrownewError("Invalid referenceBy option: "+s)}returno},setSelectedModels:function(t,n){if(!e.isArray(t))throw"Invalid parameter value";if(this.selectable||!(t.length>0)){n=e.extend({},{silent:!1,by:"model"},n);vars=n.by,o=[];switch(s){case"cid":o=t;break;case"id":this.collection.each(function(i){e.contains(t,i.id)&&o.push(i.cid)});break;case"model":o=e.pluck(t,"cid");break;case"view":e.each(t,function(e){o.push(e.model.cid)});break;case"offset":varl=0;this._getVisibleItemEls().each(function(){varn=i(this);e.contains(t,l)&&o.push(n.attr("data-model-cid")),l++});break;default:thrownewError("Invalid referenceBy option: "+s)}varr=this.getSelectedModels(),a=e.clone(this.selectedItems);this.selectedItems=this._convertStringsToInts(o),this._validateSelection();varc=this.getSelectedModels();this._containSameElements(a,this.selectedItems)||(this._addSelectedClassToSelectedItems(a),n.silent||(this._isBackboneCourierAvailable()?this.spawn("selectionChanged",{selectedModels:c,oldSelectedModels:r}):this.trigger("selectionChanged",c,r)),this.updateDependentControls())}},setSelectedModel:function(e,t){e||0===e?this.setSelectedModels([e],t):this.setSelectedModels([],t)},getView:function(t,n){switch(n=e.extend({},{by:"model"},n),n.by){case"id":case"cid":vars=this.collection.get(t)||null;returns&&this.viewManager.findByModel(s);case"offset":varo=this._getVisibleItemEls();returni(o.get(t));case"model":returnthis.viewManager.findByModel(t);default:thrownewError("Invalid referenceBy option: "+referenceBy)}},render:function(){this._hasBeenRendered=!0,this.selectable&&this._saveSelection();vart;t=this._getContainerEl();vari=this.viewManager;this.viewManager=newChildViewContainer,i.each(function(e){this.reuseModelViews&&this.collection.get(e.model.cid)?e.$el.detach():e.remove()},this),t.empty();varn;this.detachedRendering&&(n=document.createDocumentFragment()),this.collection.each(function(s){varo=i.findByModelCid(s.cid);this.reuseModelViews&&!e.isUndefined(o)||(o=this._createNewModelView(s,this._getModelViewOptions(s))),this._insertAndRenderModelView(o,n||t)},this),this.detachedRendering&&t.append(n),this.sortable&&this._setupSortable(),this._showEmptyListCaptionIfAppropriate(),this._isBackboneCourierAvailable()?this.spawn("render"):this.trigger("render"),this.selectable&&(this._restoreSelection(),this.updateDependentControls()),this.forceRerenderOnNextSortEvent=!1},_showEmptyListCaptionIfAppropriate:function(){if(this._removeEmptyListCaption(),this.emptyListCaption){if(0===this._getVisibleItemEls().length){vart;t=e.isFunction(this.emptyListCaption)?this.emptyListCaption():this.emptyListCaption;varn,s=i("<var class='empty-list-caption'>"+t+"</var>");n=this._isRenderedAsList()?s.wrapAll("<li class='not-sortable'></li>").parent().css(l):s.wrapAll("<tr class='not-sortable'><td colspan='1000'></td></tr>").parent().parent().css(l),this._getContainerEl().append(n)}}},_removeEmptyListCaption:function(){this._isRenderedAsList()?this._getContainerEl().find("> li > var.empty-list-caption").parent().remove():this._getContainerEl().find("> tr > td > var.empty-list-caption").parent().parent().remove()},_insertAndRenderModelView:function(t,i,n){vars=this._wrapModelView(t);if(11===i.nodeType)i.appendChild(s.get(0));else{varo=i.children().length;!e.isUndefined(n)&&n>=0&&n<o?i.children().eq(n).before(s):(!e.isUndefined(n)&&n>o&&(this.forceRerenderOnNextSortEvent=!0),i.append(s))}this.viewManager.add(t),!1===t.render()&&(s.hide(),s.addClass("not-visible"));varl=!1;e.isFunction(this.visibleModelsFilter)&&(l=!this.visibleModelsFilter(t.model)),1===s.children().length?s.toggle(!l):t.$el.toggle(!l),s.toggleClass("not-visible",l),!l&&this.emptyListCaption&&this._removeEmptyListCaption()},updateDependentControls:function(){this._isBackboneCourierAvailable()?this.spawn("updateDependentControls",{selectedModels:this.getSelectedModels()}):this.trigger("updateDependentControls",this.getSelectedModels())},remove:function(){this.viewManager.each(function(e){e.remove()}),t.View.prototype.remove.apply(this,arguments)},reapplyFilter:function(t){vari=this;if(!e.contains(["selectableModels","sortableModels","visibleModels"],t))thrownewError("Invalid filter identifier supplied to reapplyFilter: "+t);switch(t){case"visibleModels":i.viewManager.each(function(e){vart=i.visibleModelsFilter&&!i.visibleModelsFilter.call(i,e.model);e.$el.toggleClass("not-visible",t),i._modelViewHasWrapperLI(e)?e.$el.closest("li").toggleClass("not-visible",t).toggle(!t):e.$el.toggle(!t)}),this._showEmptyListCaptionIfAppropriate();break;case"sortableModels":i.$el.sortable("destroy"),i.viewManager.each(function(e){vart=i.sortableModelsFilter&&!i.sortableModelsFilter.call(i,e.model);e.$el.toggleClass("not-sortable",t),i._modelViewHasWrapperLI(e)&&e.$el.closest("li").toggleClass("not-sortable",t)}),i._setupSortable();break;case"selectableModels":i.viewManager.each(function(e){vart=i.selectableModelsFilter&&!i.selectableModelsFilter.call(i,e.model);e.$el.toggleClass("not-selectable",t),i._modelViewHasWrapperLI(e)&&e.$el.closest("li").toggleClass("not-selectable",t)}),i._validateSelection()}},_removeModelView:function(e){this.selectable&&this._saveSelection(),this.viewManager.remove(e),this._modelViewHasWrapperLI(e)&&e.$el.parent().remove(),e.remove(),this.selectable&&this._restoreSelection(),this._showEmptyListCaptionIfAppropriate()},_validateSelectionAndRender:function(){this._validateSelection(),this.render()},_registerCollectionEvents:function(){this.listenTo(this.collection,"add",function(e){vart;this._hasBeenRendered&&(t=this._createNewModelView(e,this._getModelViewOptions(e)),this._insertAndRenderModelView(t,this._getContainerEl(),this.collection.indexOf(e))),this._isBackboneCourierAvailable()?this.spawn("add",t):this.trigger("add",t)}),this.listenTo(this.collection,"remove",function(e){vart;this._hasBeenRendered&&(t=this.viewManager.findByModelCid(e.cid),this._removeModelView(t)),this._isBackboneCourierAvailable()?this.spawn("remove"):this.trigger("remove")}),this.listenTo(this.collection,"reset",function(){this._hasBeenRendered&&this.render(),this._isBackboneCourierAvailable()?this.spawn("reset"):this.trigger("reset")}),this.listenTo(this.collection,"sort",function(e,t){this._hasBeenRendered&&(!0!==t.add||this.forceRerenderOnNextSortEvent)&&this.render(),this._isBackboneCourierAvailable()?this.spawn("sort"):this.trigger("sort")})},_getContainerEl:function(){if(this._isRenderedAsTable()){vare=this.$el.find("> tbody");if(e.length>0)returne}returnthis.$el},_getClickedItemId:function(e){vart=null,n=i(e.currentTarget);if(n.closest(".collection-view").get(0)===this.$el.get(0)){vars=n.closest("[data-model-cid]");returns.length>0&&(t=s.attr("data-model-cid"),i.isNumeric(t)&&(t=parseInt(t,10))),t}},_updateItemTemplate:function(){vart;if(this.itemTemplate){if(0===i(this.itemTemplate).length)throw"Could not find item template from selector: "+this.itemTemplate;t=i(this.itemTemplate).html()}elset=this.$(".item-template").html();t&&(this.itemTemplateFunction=e.template(t))},_validateSelection:function(){vart=e.pluck(this.collection.models,"cid");this.selectedItems=e.intersection(t,this.selectedItems),e.isFunction(this.selectableModelsFilter)&&(this.selectedItems=e.filter(this.selectedItems,function(e){returnthis.selectableModelsFilter.call(this,this.collection.get(e))},this))},_saveSelection:function(){if(!this.selectable)throw"Attempt to save selection on non-selectable list";this.savedSelection={items:e.clone(this.selectedItems),offset:this.getSelectedModel({by:"offset"})}},_restoreSelection:function(){if(!this.savedSelection)throw"Attempt to restore selection but no selection has been saved!";this.setSelectedModels([],{silent:!0}),this.savedSelection.items.length>0&&(this.setSelectedModels(this.savedSelection.items,{by:"cid",silent:!0}),0===this.selectedItems.length&&this.setSelectedModel(this.savedSelection.offset,{by:"offset"}),this.selectedItems.length!==this.savedSelection.items.length&&(this._isBackboneCourierAvailable()?this.spawn("selectionChanged",{selectedModels:this.getSelectedModels(),oldSelectedModels:[]}):this.trigger("selectionChanged",this.getSelectedModels(),[])))},_addSelectedClassToSelectedItems:function(t){e.isUndefined(t)&&(t=[]);vari=t;i=e.without(i,this.selectedItems),e.each(i,function(e){this._getContainerEl().find("[data-model-cid="+e+"]").removeClass("selected"),this._isRenderedAsList()&&this._getContainerEl().find("li[data-model-cid="+e+"] > *").removeClass("selected")},this);varn=this.selectedItems;n=e.without(n,t),e.each(n,function(e){this._getContainerEl().find("[data-model-cid="+e+"]").addClass("selected"),this._isRenderedAsList()&&this._getContainerEl().find("li[data-model-cid="+e+"] > *").addClass("selected")},this)},_reorderCollectionBasedOnHTML:function(){vare=this;this._getContainerEl().children().each(function(){vart=i(this).attr("data-model-cid");if(t){varn=e.collection.get(t);n&&(e.collection.remove(n,{silent:!0}),e.collection.add(n,{silent:!0,sort:!e.collection.comparator}))}}),this._isBackboneCourierAvailable()?this.spawn("reorder"):this.collection.trigger("reorder"),this.collection.comparator&&this.collection.sort()},_getModelViewConstructor:function(e){returnthis.modelView||s},_getModelViewOptions:function(t){vari=this.modelViewOptions;returne.isFunction(i)&&(i=i(t)),e.extend({model:t},i)},_createNewModelView:function(t,i){varn=this._getModelViewConstructor(t);if(e.isUndefined(n))throw"Could not find modelView constructor for model";vars=newn(i);returns.collectionListView=s.collectionView=this,s},_wrapModelView:function(t){vari,n=this;returnthis._isRenderedAsTable()?(i=t.$el,t.$el.attr("data-model-cid",t.model.cid)):this._isRenderedAsList()&&(t.$el.is("li")?(i=t.$el,t.$el.attr("data-model-cid",t.model.cid)):i=t.$el.wrapAll("<li data-model-cid='"+t.model.cid+"'></li>").parent()),e.isFunction(this.sortableModelsFilter)&&(this.sortableModelsFilter.call(n,t.model)||(i.addClass("not-sortable"),t.$el.addClass("not-selectable"))),e.isFunction(this.selectableModelsFilter)&&(this.selectableModelsFilter.call(n,t.model)||(i.addClass("not-selectable"),t.$el.addClass("not-selectable"))),i},_convertStringsToInts:function(t){returne.map(t,function(t){if(!e.isString(t))returnt;vari=parseInt(t,10);returni==t?i:t})},_containSameElements:function(t,i){returnt.length==i.length&&e.intersection(t,i).length==t.length},_isRenderedAsTable:function(){return"table"===this.$el.prop("tagName").toLowerCase()},_isRenderedAsList:function(){return!this._isRenderedAsTable()},_modelViewHasWrapperLI:function(e){returnthis._isRenderedAsList()&&!e.$el.is("li")},_getVisibleItemEls:function(){returnthis._getContainerEl().find("> [data-model-cid]:not(.not-visible)")},_charCodes:{upArrow:38,downArrow:40},_isBackboneCourierAvailable:function(){return!e.isUndefined(t.Courier)},_setupSortable:function(){vart=e.extend({axis:"y",distance:10,forcePlaceholderSize:!0,items:this._isRenderedAsTable()?"> tbody > tr:not(.not-sortable)":"> li:not(.not-sortable)",start:e.bind(this._sortStart,this),change:e.bind(this._sortChange,this),stop:e.bind(this._sortStop,this),receive:e.bind(this._receive,this),over:e.bind(this._over,this)},e.result(this,"sortableOptions"));this.$el=this.$el.sortable(t)},_sortStart:function(e,t){vari=this.collection.get(t.item.attr("data-model-cid"));this._isBackboneCourierAvailable()?this.spawn("sortStart",{modelBeingSorted:i}):this.trigger("sortStart",i)},_sortChange:function(e,t){vari=this.collection.get(t.item.attr("data-model-cid"));this._isBackboneCourierAvailable()?this.spawn("sortChange",{modelBeingSorted:i}):this.trigger("sortChange",i)},_sortStop:function(e,t){vari=this.collection.get(t.item.attr("data-model-cid")),n=this._getContainerEl(),s=n.children().index(t.item);-1==s&&i&&this.collection.remove(i),i&&(this._reorderCollectionBasedOnHTML(),this.updateDependentControls(),this._isBackboneCourierAvailable()?this.spawn("sortStop",{modelBeingSorted:i,newIndex:s}):this.trigger("sortStop",i,s))},_receive:function(e,t){vari=t.sender,n=i.data("view");if(n&&n.collection){vars=this._getContainerEl().children().index(t.item),o=n.collection.get(t.item.attr("data-model-cid"));n.collection.remove(o),this.collection.add(o,{at:s}),o.collection=this.collection,this.setSelectedModel(o)}},_over:function(e,t){this._getContainerEl().find("> var.empty-list-caption").hide()},_onKeydown:function(e){if(!this.processKeyEvents)return!0;vart=!1;if(1==this.getSelectedModels({by:"offset"}).length){vari=this.getSelectedModel({by:"offset"});e.which===this._charCodes.upArrow&&0!==i?(this.setSelectedModel(i-1,{by:"offset"}),t=!0):e.which===this._charCodes.downArrow&&i!==this.collection.length-1&&(this.setSelectedModel(i+1,{by:"offset"}),t=!0)}return!t},_listItem_onMousedown:function(t){vari=this._getClickedItemId(t);if(i){varn=this.collection.get(i);if(this._isBackboneCourierAvailable()){vars={clickedModel:n,metaKeyPressed:t.ctrlKey||t.metaKey};e.each(["preventDefault","stopPropagation","stopImmediatePropagation"],function(e){s[e]=function(){t[e]()}}),this.spawn("click",s)}elsethis.trigger("click",n)}if(this.selectable&&this.clickToSelect)if(i){if(e.isFunction(this.selectableModelsFilter)&&!this.selectableModelsFilter.call(this,this.collection.get(i)))return;if(this.selectMultiple&&t.shiftKey){varo=-1;this.selectedItems.length>0&&this.collection.find(function(t){returno++,e.contains(this.selectedItems,t.cid)},this);varl=-1;this.collection.find(function(e){returnl++,e.cid==i},this);for(varr=-1==o?l:o,a=Math.min(l,r),c=Math.max(l,r),d=[],u=a;u<=c;u++)d.push(this.collection.at(u).cid);if(this.setSelectedModels(d,{by:"cid"}),document.selection&&document.selection.empty)document.selection.empty();elseif(window.getSelection){varh=window.getSelection();h&&h.removeAllRanges&&h.removeAllRanges()}}else(this.selectMultiple||e.contains(this.selectedItems,i))&&(this.clickToToggle||t.metaKey||t.ctrlKey)?e.contains(this.selectedItems,i)?this.setSelectedModels(e.without(this.selectedItems,i),{by:"cid"}):this.setSelectedModels(e.union(this.selectedItems,[i]),{by:"cid"}):this.setSelectedModels([i],{by:"cid"})}elsethis.setSelectedModels([])},_listItem_onDoubleClick:function(e){vart=this._getClickedItemId(e);if(t){vari=this.collection.get(t);this._isBackboneCourierAvailable()?this.spawn("doubleClick",{clickedModel:i,metaKeyPressed:e.ctrlKey||e.metaKey}):this.trigger("doubleClick",i)}},_listBackground_onClick:function(e){this.selectable&&this.clickToSelect&&i(e.target).is(".collection-view")&&this.setSelectedModels([])}},{setDefaultModelViewConstructor:function(e){s=e}}),t.ViewOptions={},t.ViewOptions.add=function(t,i){e.isUndefined(i)&&(i="options"),t.setOptions=function(t){vars=this,o={},l={},r=e.result(this,i);if(!e.isUndefined(r)){vara=n(r);e.each(a,function(i,n){varr=i.required,a=i.defaultValue;if(r){if((!t||!e.contains(e.keys(t),n))&&e.isUndefined(s[n]))thrownewError('Required option "'+n+'" was not supplied.');if(t&&e.contains(e.keys(t),n)&&e.isUndefined(t[n]))thrownewError('Required option "'+n+'" can not be set to undefined.')}if(t&&nint&&!e.isUndefined(t[n])){varc=s[n],d=t[n];e.isUndefined(c)||c===d||(l[n]=c,o[n]=d),s[n]=d}elsee.isUndefined(s[n])&&(s[n]=a)})}e.keys(o).length>0&&(e.isFunction(s.onOptionsChanged)?s.onOptionsChanged(o,l):e.isFunction(s._onOptionsChanged)&&s._onOptionsChanged(o,l))},t.getOptions=function(){vart=e.result(this,i);if(e.isUndefined(t))return{};vars=n(t),o=e.keys(s);returne.pick(this,o)}},ChildViewContainer=function(e,t){vari=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,this.add,this)};t.extend(i.prototype,{add:function(e,t){vari=e.cid;this._views[i]=e,e.model&&(this._indexByModel[e.model.cid]=i),t&&(this._indexByCustom[t]=i),this._updateLength()},findByModel:function(e){returnthis.findByModelCid(e.cid)},findByModelCid:function(e){vart=this._indexByModel[e];returnthis.findByCid(t)},findByCustom:function(e){vart=this._indexByCustom[e];returnthis.findByCid(t)},findByIndex:function(e){returnt.values(this._views)[e]},findByCid:function(e){returnthis._views[e]},findIndexByCid:function(e){vari=-1;returnt.find(this._views,function(t){if(i++,t.model.cid==e)returnt})?i:-1},remove:function(e){vari=e.cid;e.model&&deletethis._indexByModel[e.model.cid],t.any(this._indexByCustom,function(e,t){if(e===i)returndeletethis._indexByCustom[t],!0},this),deletethis._views[i],this._updateLength()},call:function(e){this.apply(e,t.tail(arguments))},apply:function(e,i){t.each(this._views,function(n){t.isFunction(n[e])&&n[e].apply(n,i||[])})},_updateLength:function(){this.length=t.size(this._views)}});varn=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];returnt.each(n,function(e){i.prototype[e]=function(){vari=t.values(this._views),n=[i].concat(t.toArray(arguments));returnt[e].apply(t,n)}}),i}(0,e),t.CollectionView}),function(){vare=[],t=function(t){_.isEmpty(t._unsavedChanges)?e=_.filter(e,function(e){returnt.cid!=e.cid}):_.findWhere(e,{cid:t.cid})||e.push(t)},i=function(t){vari,n=_.rest(arguments),s=function(e,t){return_.isBoolean(t)?t:(_.isString(t)?e[t]:t).apply(e,n)};return_.each(e,function(e){!i&&s(e,e._unsavedConfig[t])&&(i=e._unsavedConfig.prompt)}),i};Backbone.History.prototype.navigate=_.wrap(Backbone.History.prototype.navigate,function(e,t,n){vars=i("unloadRouterPrompt",t,n);s?confirm(s+" \n\nAre you sure you want to leave this page?")&&e.call(this,t,n):e.call(this,t,n)}),window.onbeforeunload=function(e){returni("unloadWindowPrompt",e)},_.extend(Backbone.Model.prototype,{unsaved:{},_trackingChanges:!1,_originalAttrs:{},_unsavedChanges:{},startTracking:function(){returnthis._unsavedConfig=_.extend({},{prompt:"You have unsaved changes!",unloadRouterPrompt:!1,unloadWindowPrompt:!1},this.unsaved||{}),this._trackingChanges=!0,this._resetTracking(),this._triggerUnsavedChanges(),this},stopTracking:function(){returnthis._trackingChanges=!1,this._originalAttrs={},this._unsavedChanges={},this._triggerUnsavedChanges(),this},restartTracking:function(){returnthis._resetTracking(),this._triggerUnsavedChanges(),this},resetAttributes:function(){if(this._trackingChanges)returnthis.attributes=this._originalAttrs,this._resetTracking(),this._triggerUnsavedChanges(),this},unsavedAttributes:function(e){if(!e)return!_.isEmpty(this._unsavedChanges)&&_.clone(this._unsavedChanges);vart,i=!1,n=this._unsavedChanges;for(varsine)_.isEqual(n[s],t=e[s])||((i||(i={}))[s]=t);returni},_resetTracking:function(){this._originalAttrs=_.clone(this.attributes),this._unsavedChanges={}},_triggerUnsavedChanges:function(){this.trigger("unsavedChanges",!_.isEmpty(this._unsavedChanges),_.clone(this._unsavedChanges)),this.unsaved&&t(this)}}),Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(e,t,i,n){vars,o;returnnull==t?this:("object"==typeoft?(s=t,n=i):(s={})[t]=i,n||(n={}),o=e.call(this,s,n),this._trackingChanges&&!n.silent&&(_.each(s,_.bind(function(e,t){_.isEqual(this._originalAttrs[t],e)?deletethis._unsavedChanges[t]:this._unsavedChanges[t]=e},this)),this._triggerUnsavedChanges()),o)}),Backbone.sync=_.wrap(Backbone.sync,function(e,t,i,n){returnn||(n={}),"update"==t&&(n.success=_.wrap(n.success,_.bind(function(e,t,n,s){varo;returne&&(o=e.call(this,t,n,s)),i._trackingChanges&&(i._resetTracking(),i._triggerUnsavedChanges()),o},this))),e(t,i,n)})}(),n("vendor/backbone.trackit",function(){}),n("Models/Image",[],function(){returnBackbone.Model.extend({defaults:{enabled:"no",id:"",size:"full",src:""},initialize:function(){this.startTracking()}})}),n("Models/_Relationships",[],function(){return{relationship_defaults:{parent:{},children:{}},relationships:{},init_relationships:function(e){vart=this.get_relationships();t.parent&&e&&e.parent&&this.set_parent(e.parent),_.each(t.children,function(e,t){if(!e.conditional||!0===e.conditional(this)){vari,n=this.get(t);e.lookup?i=e.lookup(n):"model"===e.type?i=window.llms_builder.construct.get_model(e.class,n):"collection"===e.type&&(i=window.llms_builder.construct.get_collection(e.class,n)),this.set(t,i),"model"===e.type?this._maybe_set_parent_reference(i):"collection"===e.type&&(i.parent=this,i.each(function(e){this._maybe_set_parent_reference(e)},this))}},this)},get_child_props:function(){vare=[];return_.each(this.get_relationships().children,function(t,i){t.conditional&&!0!==t.conditional(this)||e.push(i)},this),e},get_parent:function(){vare=this.get_relationships();return!!e.parent&&e.parent.reference},get_relationships:function(){returne.extend(!0,this.relationships,this.relationship_defaults)},set_parent:function(e){this.relationships.parent.reference=e},_maybe_set_parent_reference:function(e){if(e&&e.get_relationships){vart=e.get_relationships();t.parent&&t.parent.model===this.get("type")&&e.set_parent(this)}}}}),n("Models/QuestionChoice",["Models/Image","Models/_Relationships"],function(e,t){returnBackbone.Model.extend(_.defaults({relationships:{parent:{model:"llms_question",type:"model"},children:{choice:{conditional:function(e){return"image"===e.get("choice_type")},class:"Image",model:"image",type:"model"}}},defaults:function(){return{id:_.uniqueId("temp_"),choice:"",choice_type:"text",correct:!1,marker:"A",question_id:"",type:"choice"}},initialize:function(e,t){this.startTracking(),this.init_relationships(t)},get_parent:function(){returnthis.collection.parent},get_trash_id:function(){returnthis.get("question_id")+":"+this.get("id")},is_selectable:function(){returnthis.get_parent().get("question_type").get_choice_selectable()}},t))}),n("Collections/QuestionChoices",["Models/QuestionChoice"],function(e){returnBackbone.Collection.extend({model:e,initialize:function(){this.on("reorder",this.update_order),this.on("add",this.update_order),this.on("remove",this.update_order),this.on("add",this.update_correct),this.on("remove",this.update_correct),this.on("correct-update",this.update_correct)},count_correct:function(){return_.size(this.get_correct())},get_correct:function(){returnthis.filter(function(e){returne.get("correct")})},update_correct:function(e){if(this.parent.get("question_type").get_choice_selectable()){vart=this.without(e),i=this.parent;if("no"===i.get("multi_choices")&&_.each(t,function(e){e.set("correct",!1)}),0===this.count_correct()&&i.get("points")>0){varn=1===this.size()?this.models:t;_.first(n).set("correct",!0)}}},update_order:function(){vare=this,t=this.parent;this.each(function(i){i.set("marker",t.get("question_type").get_choice_markers()[e.indexOf(i)])})}})}),n("Models/QuestionType",[],function(){returnBackbone.Model.extend({defaults:function(){return{choices:!1,clarifications:!0,default_choices:[],description:!0,icon:"question",id:"generic",image:!0,keywords:[],name:"Generic",placeholder:"",points:!0,video:!0}},get_keywords:function(){vare=this.get("name");return[e].concat(this.get("keywords")).concat(e.split(" "))},get_choice_markers:function(){returnthis._get_choice_option("markers")},get_choice_selectable:function(){returnthis._get_choice_option("selectable")},get_choice_type:function(){returnthis._get_choice_option("type")},get_min_choices:function(){returnthis._get_choice_option("min")},get_max_choices:function(){returnthis._get_choice_option("max")},get_multi_choices:function(){return!!this.get("choices")&&this._get_choice_option("multi")},_get_choice_option:function(e){vart=this.get("choices");return!(!t||!t[e])&&t[e]}})}),n("Models/_Utilities",[],function(){return{fields:[],get_edit_post_link:function(){returnthis.has_temp_id()?"":window.llms_builder.admin_url+"post.php?post="+this.get("id")+"&action=edit"},get_settings_fields:function(){vare=this.schema||{};returnwindow.llms_builder.schemas.get(e,this.get("type").replace("llms_",""),this)},has_temp_id:function(){return!_.isNumber(this.get("id"))&&0===this.get("id").indexOf("temp_")},init_custom_schema:function(){vare=_.filter(this.get_settings_fields(),function(e){returne.custom});_.each(e,function(e){_.each(_.flatten(e.fields),function(e){vart=[e.attribute],i=this.get("custom");e.switch_attribute&&t.push(e.switch_attribute),_.each(t,function(t){varn=e.attribute_prefix?e.attribute_prefix+t:t;i&&i[n]&&this.set(t,i[n][0])},this)},this)},this)}}}),n("Models/Question",["Models/Image","Collections/Questions","Collections/QuestionChoices","Models/QuestionType","Models/_Relationships","Models/_Utilities"],function(e,t,i,n,s,o){returnBackbone.Model.extend(_.defaults({relationships:{parent:{model:"llms_quiz",type:"model"},children:{choices:{class:"QuestionChoices",model:"choice",type:"collection"},image:{class:"Image",model:"image",type:"model"},questions:{class:"Questions",conditional:function(e){vart=e.get("question_type");return"group"===(_.isString(t)?t:t.get("id"))},model:"llms_question",type:"collection"},question_type:{class:"QuestionType",lookup:function(e){return_.isString(e)?window.llms_builder.questions.get(e):e},model:"question_type",type:"model"}}},defaults:function(){return{id:_.uniqueId("temp_"),choices:[],content:"",description_enabled:"no",image:{},multi_choices:"no",menu_order:1,points:1,question_type:"generic",questions:[],parent_id:"",title:"",type:"llms_question",video_enabled:"no",video_src:"",_expanded:!1}},initialize:function(e,t){vari=this;this.startTracking(),this.init_relationships(t),!1!==this.get("question_type").choices&&(this._ensure_min_choices(),this.listenTo(this.get("choices"),"remove",function(){setTimeout(function(){i._ensure_min_choices()},0)})),this.get("question_type").get("points")||this.set("points",0),_.delay(function(e){e.on("change:points",e.get_parent().update_points,e.get_parent())},1,this)},add_choice:function(e,t){vari=this.get("question_type").get_max_choices();if(!(this.get("choices").size()>=i)){e=e||{},t=t||{},e.choice_type=this.get("question_type").get_choice_type(),e.question_id=this.get("id"),t.parent=this;varn=this.get("choices").add(e,t);Backbone.pubSub.trigger("question-add-choice",n,this)}},before_save:function(e,t){return"full"===t&&(e.question_type=this.get("question_type").get("id")),e},get_parent:function(){vare=this.get_relationships();if(e.parent){if(this.collection&&this.collection.parent)returnthis.collection.parent;if(e.parent.reference)returne.parent.reference}return!1},get_l10n_type:function(e){returne?LLMS.l10n.translate("questions"):LLMS.l10n.translate("question")},get_type_index:function(){vare,t=this.get("question_type").get("id");returne=this.collection.filter(function(e){vari=e.get("question_type").get("id");return"content"!==t?"content"!==i:"content"===i}),e.indexOf(this)},get_type_iterator:function(){vare=this.get_type_index();if(-1===e)return"";if("content"===this.get("question_type").get("id")){return"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")[e]}returne+1},get_qid:function(){vare=this.get_parent_question(),t="";returne&&(t=e.get_qid()+"."),t+this.get_type_iterator()},get_parent_question:function(){return!!this.is_in_group()&&this.collection.parent},get_parent_quiz:function(){returnthis.get_parent()},get_points:function(){returnthis.get("question_type").get("points")?this.get("points"):0},get_points_percentage:function(){vare=this.get_parent().get("_points"),t=this.get("points");return0===e?"0%":(t/e*100).toFixed(2)+"%"},is_in_group:function(){return"question"===this.collection.parent.get("type")},_ensure_min_choices:function(){for(vare=this.get("choices");e.size()<this.get("question_type").get_min_choices();)this.add_choice()}},s,o))}),n("Collections/Questions",["Models/Question"],function(e){returnBackbone.Collection.extend({model:e,initialize:function(){this.on("reorder",this.update_order),this.on("add",this.update_order),this.on("remove",this.update_order),this.on("add",this.update_parent)},update_order:function(){vare=this;this.each(function(t){t.set("menu_order",e.indexOf(t)+1)})},update_parent:function(e){e.set("parent_id",this.parent.get("id"))}})}),n("Schemas/Quiz",[],function(){returnwindow.llms.hooks.applyFilters("llms_define_quiz_schema",{default:{title:LLMS.l10n.translate("General Settings"),toggleable:!0,fields:[[{attribute:"permalink",id:"permalink",type:"permalink"}],[{attribute:"content",id:"description",label:LLMS.l10n.translate("Description"),type:"editor"}],[{attribute:"passing_percent",id:"passing-percent",label:LLMS.l10n.translate("Passing Percentage"),min:0,max:100,tip:LLMS.l10n.translate("Minimum percentage of total points required to pass the quiz"),type:"number"},{attribute:"allowed_attempts",id:"allowed-attempts",label:LLMS.l10n.translate("Limit Attempts"),switch_attribute:"limit_attempts",tip:LLMS.l10n.translate("Limit the maximum number of times a student can take this quiz"),type:"switch-number"},{attribute:"time_limit",id:"time-limit",label:LLMS.l10n.translate("Time Limit"),min:1,max:360,switch_attribute:"limit_time",tip:LLMS.l10n.translate("Enforce a maximum number of minutes a student can spend on each attempt"),type:"switch-number"}],[{attribute:"show_correct_answer",id:"show-correct-answer",label:LLMS.l10n.translate("Show Correct Answers"),tip:LLMS.l10n.translate("When enabled, students will be shown the correct answer to any question they answered incorrectly."),type:"switch"},{attribute:"random_questions",id:"random-questions",label:LLMS.l10n.translate("Randomize Question Order"),tip:LLMS.l10n.translate("Display questions in a random order for each attempt. Content questions are locked into their defined positions."),type:"switch"}]]}})}),n("Models/Quiz",["Collections/Questions","Models/Lesson","Models/Question","Models/_Relationships","Models/_Utilities","Schemas/Quiz"],function(e,t,i,n,s,o){returnBackbone.Model.extend(_.defaults({relationships:{parent:{model:"lesson",type:"model"},children:{questions:{class:"Questions",model:"llms_question",type:"collection"}}},schema:o,defaults:function(){return{id:_.uniqueId("temp_"),title:LLMS.l10n.translate("New Quiz"),type:"llms_quiz",lesson_id:"",status:"draft",content:"",allowed_attempts:5,limit_attempts:"no",limit_time:"no",passing_percent:65,name:"",random_answers:"no",time_limit:30,show_correct_answer:"no",questions:[],_points:0,permalink:"",_show_settings:!1,_questions_loaded:!1}},initialize:function(){this.init_custom_schema(),this.startTracking(),this.init_relationships(),this.listenTo(this.get("questions"),"add",this.update_points),this.listenTo(this.get("questions"),"remove",this.update_points),this.set("_points",this.get_total_points()),this.on("change:status",function(){"publish"===this.get("status")&&this.get_parent().set("quiz_enabled","yes")}),window.llms.hooks.doAction("llms_quiz_model_init",this)},add_question:function(e){e.parent_id=this.get("id");vart=this.get("questions").add(e,{parent:this});Backbone.pubSub.trigger("quiz-add-question",t,this)},get_l10n_type:function(e){returne?LLMS.l10n.translate("quizzes"):LLMS.l10n.translate("quiz")},get_total_points:function(){vare=0;returnthis.get("questions").each(function(t){e+=t.get_points()}),e},load_questions:function(e){if(this.get("_questions_loaded"))e();else{vart=this;LLMS.Ajax.call({data:{action:"llms_builder",action_type:"lazy_load",course_id:window.llms_builder.CourseModel.get("id"),load_id:this.get("id")},error:function(t,i,n){console.log(t,i,n),window.llms_builder.debug.log("==== start load_questions error ====",t,i,n,"==== finish load_questions error ===="),e(!0)},success:function(i){i&&i.questions?(t.set("_questions_loaded",!0),i.questions&&_.each(i.questions,t.add_question,t),e()):e(!0)}})}},update_points:function(){this.set("_points",this.get_total_points())}},n,s))}),n("Schemas/Lesson",[],function(){returnwindow.llms.hooks.applyFilters("llms_define_lesson_schema",{default:{title:LLMS.l10n.translate("General Settings"),toggleable:!0,fields:[[{attribute:"permalink",id:"permalink",type:"permalink"}],[{attribute:"video_embed",id:"video-embed",label:LLMS.l10n.translate("Video Embed URL"),type:"video_embed"},{attribute:"audio_embed",id:"audio-embed",label:LLMS.l10n.translate("Audio Embed URL"),type:"audio_embed"}],[{attribute:"free_lesson",id:"free-lesson",label:LLMS.l10n.translate("Free Lesson"),tip:LLMS.l10n.translate("Free lessons can be accessed without enrollment."),type:"switch"},{attribute:"require_passing_grade",id:"require-passing-grade",label:LLMS.l10n.translate("Require Passing Grade on Quiz"),tip:LLMS.l10n.translate("When enabled, students must pass this lesson's quiz before the lesson can be completed."),type:"switch",condition:function(){return"yes"===this.get("quiz_enabled")}},{attribute:"require_assignment_passing_grade",id:"require-assignment-passing-grade",label:LLMS.l10n.translate("Require Passing Grade on Assignment"),tip:LLMS.l10n.translate("When enabled, students must pass this lesson's assignment before the lesson can be completed."),type:"switch",condition:function(){return"undefined"!==window.llms_builder.assignments&&"yes"===this.get("assignment_enabled")}},{attribute:"points",id:"points",label:LLMS.l10n.translate("Lesson Weight"),label_after:LLMS.l10n.translate("POINTS"),min:0,max:99,tip:LLMS.l10n.translate("Determines the weight of the lesson when calculating the overall grade of the course."),tip_position:"top-left",type:"number",condition:function(){return"yes"===this.get("quiz_enabled")||"undefined"!==window.llms_builder.assignments&&"yes"===this.get("assignment_enabled")}}],[{attribute:"prerequisite",condition:function(){return!1===this.is_first_in_course()},id:"prerequisite",label:LLMS.l10n.translate("Prerequisite"),switch_attribute:"has_prerequisite",type:"switch-select",options:function(){returnthis.get_available_prereq_options()}}],[{attribute:"drip_method",id:"drip-method",label:LLMS.l10n.translate("Drip Method"),switch_attribute:"drip_method",type:"select",options:function(){vare=[{key:"",val:LLMS.l10n.translate("None")},{key:"date",val:LLMS.l10n.translate("On a specific date")},{key:"enrollment",val:LLMS.l10n.translate("# of days after course enrollment")}];returnthis.get_course()&&this.get_course().get("start_date")&&e.push({key:"start",val:LLMS.l10n.translate("# of days after course start date")}),"yes"===this.get("has_prerequisite")&&e.push({key:"prerequisite",val:LLMS.l10n.translate("# of days after prerequisite lesson completion")}),e}},{attribute:"days_before_available",condition:function(){return-1!==["enrollment","start","prerequisite"].indexOf(this.get("drip_method"))},id:"days-before-available",label:LLMS.l10n.translate("# of days"),min:0,type:"number"},{attribute:"date_available",date_format:"Y-m-d",condition:function(){return"date"===this.get("drip_method")},id:"date-available",label:LLMS.l10n.translate("Date"),timepicker:"false",type:"datepicker"},{attribute:"time_available",condition:function(){return"date"===this.get("drip_method")},datepicker:"false",date_format:"h:i A",id:"time-available",label:LLMS.l10n.translate("Time"),type:"datepicker"}]]}})}),n("Models/Lesson",["Models/Quiz","Models/_Relationships","Models/_Utilities","Schemas/Lesson"],function(e,t,i,n){returnBackbone.Model.extend(_.defaults({relationships:{parents:{model:"section",type:"model"},children:{quiz:{class:"Quiz",conditional:function(e){return"yes"===e.get("quiz_enabled")||!_.isEmpty(e.get("quiz"))},model:"llms_quiz",type:"model"}}},schema:n,defaults:function(){return{id:_.uniqueId("temp_"),title:LLMS.l10n.translate("New Lesson"),type:"lesson",order:this.collection?this.collection.length+1:1,parent_course:window.llms_builder.course.id,parent_section:"",edit_url:"",view_url:"",content:"",audio_embed:"",has_prerequisite:"no",require_passing_grade:"yes",require_assignment_passing_grade:"yes",video_embed:"",free_lesson:"",points:1,assignment:{},assignment_enabled:"no",quiz:{},quiz_enabled:"no",_forceSync:!1}},initialize:function(){this.init_custom_schema(),this.startTracking(),this.maybe_init_assignments(),this.init_relationships();vare=this.get("quiz");_.isEmpty(e)||e.get("lesson_id")||e.set("lesson_id",this.get("id")),window.llms.hooks.doAction("llms_lesson_model_init",this)},get_course:function(){returnthis.get_parent().get_course()},get_l10n_type:function(e){returne?LLMS.l10n.translate("lessons"):LLMS.l10n.translate("lesson")},get_parent:function(){vare=this.get_relationships();returne.parent&&e.parent.reference?e.parent.reference:!(!this.collection||!this.collection.parent)&&this.collection.parent},get_points_percentage:function(){vare=this.get_course().get_total_points(),t=1*this.get("points");return_.isNumber(t)||(t=0),0===e?"0%":(t/e*100).toFixed(2)+"%"},get_available_prereq_options:function(){vare=this.get_parent().collection.indexOf(this.get_parent()),t=this.collection.indexOf(this),i=[];returnthis.get_course().get("sections").each(function(n,s){if(s<=e){varo={label:LLMS.l10n.replace("Section %1$d: %2$s",{"%1$d":n.get("order"),"%2$s":n.get("title")}),options:[]};n.get("lessons").each(function(i,n){(s!==e||n<t)&&o.options.push({key:i.get("id"),val:LLMS.l10n.replace("Lesson %1$d: %2$s",{"%1$d":i.get("order"),"%2$s":i.get("title")})})},this),i.push(o)}},this),i},add_quiz:function(e){e=e||{},e.lesson_id=this.id,e._questions_loaded=!0,e.title||(e.title=LLMS.l10n.replace("%1$s Quiz",{"%1$s":this.get("title")})),this.set("quiz",e),this.init_relationships();vart=this.get("quiz");returnthis.set("quiz_enabled","yes"),window.llms.hooks.doAction("llms_lesson_add_quiz",t,this),t},is_first_in_course:function(){if(!this.is_first_in_section())return!1;vare=this.get_parent();return!e.collection.indexOf(e)},is_last_in_course:function(){if(!this.is_last_in_section())return!1;vare=this.get_parent();return!(e.collection.indexOf(e)<e.collection.size()-1)},is_first_in_section:function(){return0===this.collection.indexOf(this)},is_last_in_section:function(){returnthis.collection.indexOf(this)===this.collection.size()-1},get_prev:function(e){returnthis.get_sibling("prev",e)},get_next:function(e){returnthis.get_sibling("next",e)},get_sibling:function(e,t){e="next"===e?e:"prev";vari="is_first_in_course",n=-1,s="last";if("next"===e&&(i="is_last_in_course","is_last_in_section",n=1,s="first"),this[i]())return!1;varo=this.collection.indexOf(this)+n,l=this.collection.at(o);if(this["next"===e?"is_last_in_section":"is_first_in_section"]()){for(varr=this.get_parent(),a=r["get_"+e](!1);a&&!a.get("lessons").size();)a=a["get_"+e](!1);if(!a||!a.get("lessons").size())return!1;l=a.get("lessons")[s]()}returnt&&t!==l.get("status")?l.get_sibling(e,t):l},maybe_init_assignments:function(){window.llms_builder.assignments&&(this.relationships.children.assignment={class:"Assignment",conditional:function(e){return"yes"===e.get("assignment_enabled")||!_.isEmpty(e.get("assignment"))},model:"llms_assignment",type:"model"})}},t,i))}),n("Collections/Lessons",["Models/Lesson"],function(e){returnBackbone.Collection.extend({model:e,initialize:function(){this.on("reorder",this.on_reorder),this.on("add",this.on_reorder),this.on("remove",this.on_reorder)},on_reorder:function(){this.update_order(),this.validate_prereqs()},update_order:function(){this.each(function(e){e.set("order",this.indexOf(e)+1)},this)},validate_prereqs:function(){this.each(function(e){if("yes"===e.get("has_prerequisite")){-1===_.pluck(_.flatten(_.pluck(e.get_available_prereq_options(),"options")),"key").indexOf(1*e.get("prerequisite"))&&e.set({prerequisite:0,has_prerequisite:"no"})}},this)}})}),n("Collections/QuestionTypes",["Models/QuestionType"],function(e){returnBackbone.Collection.extend({model:e,initialize:function(){this.on("add",this.comparator),this.on("remove",this.comparator)},comparator:function(e){returne.get("group").order}})}),n("Models/Section",["Collections/Lessons","Models/_Relationships"],function(e,t){returnBackbone.Model.extend(_.defaults({relationships:{parent:{model:"course",type:"model"},children:{lessons:{class:"Lessons",model:"lesson",type:"collection"}}},defaults:function(){return{id:_.uniqueId("temp_"),lessons:[],order:this.collection?this.collection.length+1:1,parent_course:window.llms_builder.course.id,title:LLMS.l10n.translate("New Section"),type:"section",_expanded:!1,_selected:!1}},initialize:function(){this.startTracking(),this.init_relationships()},add_lesson:function(e,t){returne=e||{},t=t||{},einstanceofBackbone.Model?(e.set("parent_section",this.get("id")),e.set_parent(this)):e.parent_section=this.get("id"),this.get("lessons").add(e,t)},get_l10n_type:function(e){returne?LLMS.l10n.translate("sections"):LLMS.l10n.translate("section")},get_next:function(e){returnthis._get_sibling("next",e)},get_course:function(){returnthis.get_parent()||this.set_parent(window.llms_builder.CourseModel),this.get_parent()},get_prev:function(e){returnthis._get_sibling("prev",e)},_get_sibling:function(e,t){t="undefined"===t||t;vari,n=this.collection.size()-1,s=this.collection.indexOf(this);if("next"===e?i=s+1:"prev"===e&&(i=s-1),i<=n||i>=0)returnthis.collection.at(i);if(t){if("next"===e)returnthis.collection.first();if("prev"===e)returnthis.collection.last()}return!1}},t))}),n("Collections/Sections",["Models/Section"],function(e){returnBackbone.Collection.extend({model:e,initialize:function(){this.on("reorder",this.update_order),this.on("add",this.update_order),this.on("remove",this.update_order)},update_order:function(){vare=this;this.each(function(t){t.set("order",e.indexOf(t)+1)})}})}),n("Collections/loader",["Collections/Lessons","Collections/QuestionChoices","Collections/Questions","Collections/QuestionTypes","Collections/Sections"],function(e,t,i,n,s){return{Lessons:e,QuestionChoices:t,Questions:i,QuestionTypes:n,Sections:s}}),n("Models/Abstract",["Models/_Relationships","Models/_Utilities"],function(e,t){returnBackbone.Model.extend(_.defaults({},e,t))}),n("Models/Course",["Collections/Sections","Models/_Relationships","Models/_Utilities"],function(e,t,i){returnBackbone.Model.extend(_.defaults({relationships:{children:{sections:{class:"Sections",model:"section",type:"collection"}}},defaults:function(){return{edit_url:"",sections:[],title:"New Course",type:"course",view_url:""}},initialize:function(){this.startTracking(),this.init_relationships(),Backbone.pubSub.on("add-new-section",this.add_section,this),Backbone.pubSub.on("add-new-lesson",this.add_lesson,this),Backbone.pubSub.on("lesson-search-select",this.add_existing_lesson,this)},add_existing_lesson:function(e){vart=e.data;"clone"===e.action?(deletet.id,t.quiz&&(t.quiz=_.prepareQuizObjectForCloning(t.quiz),t.quiz._questions_loaded=!0),window.llms_builder.assignments&&t.assignment&&(t.assignment=_.prepareAssignmentObjectForCloning(t.assignment))):t._forceSync=!0,deletet.order,deletet.parent_course,deletet.parent_section,t=_.prepareExistingPostObjectDataForAddingOrCloning(t),t=window.llms.hooks.applyFilters("llms_adding_existing_lesson_data",t,e.action,this),this.add_lesson(t)},add_lesson:function(e){e=e||{};vart,i={};e.parent_section?t=this.get("sections").get(e.parent_section):(t=this.get_selected_section())||(t=this.get("sections").last()),e._selected=!0,e.parent_course=this.get("id");varn=t.add_lesson(e,i);returnBackbone.pubSub.trigger("new-lesson-added",n),t.set("_expanded",!0),n},add_section:function(e){e=e||{};vart=this.get("sections"),i={},n=this.get_selected_section();n&&(i.at=t.indexOf(n)+1),t.add(e,i)},get_selected_section:function(){returnthis.get("sections").find(function(e){returne.get("_selected")})},get_total_points:function(){vare=0;returnthis.get("sections").each(function(t){t.get("lessons").each(function(t){vari=t.get("points");_.isNumber(i)||(i=0),e+=1*i})}),e}},t,i))}),n("Models/loader",["Models/Abstract","Models/Course","Models/Image","Models/Lesson","Models/Question","Models/QuestionChoice","Models/QuestionType","Models/Quiz","Models/Section"],function(e,t,i,n,s,o,l,r,a){return{Abstract:e,Course:t,Image:i,Lesson:n,Question:s,QuestionChoice:o,QuestionType:l,Quiz:r,Section:a}}),n("Views/_Detachable",[],function(){return{events:{'click a[href="#llms-detach-model"]':"detach_model"},detach_model:function(e){e&&(e.preventDefault(),e.stopPropagation());vart=LLMS.l10n.replace("Are you sure you want to detach this %s?",{"%s":this.model.get_l10n_type()});window.confirm(t)&&(this.model.collection&&this.model.collection.remove(this.model),Backbone.pubSub.trigger("model-detached",this.model),this.trigger("model-trashed",this.model))}}}),n("Views/_Editable",[],function(){return{media_lib:null,events:{"click .llms-add-image":"open_media_lib",'click a[href="#llms-edit-slug"]':"make_slug_editable",'click a[href="#llms-remove-image"]':"remove_image","change .llms-editable-select select":"on_select",'change .llms-switch input[type="checkbox"]':"toggle_switch","change .llms-editable-radio input":"on_radio_select","focusin .llms-input":"on_focus","focusout .llms-input":"on_blur","keydown .llms-input":"on_keydown",'input .llms-input[type="number"]':"on_blur","paste .llms-input[data-formatting]":"on_paste"},get_allowed_tags:function(e){returne.attr("data-formatting")?_.map(e.attr("data-formatting").split(","),function(e){returne.trim()}):["b","i","u","strong","em"]},get_content:function(e){return"INPUT"===e[0].tagName?e.val():e.attr("data-formatting")||e.hasClass("ql-editor")?_.stripFormatting(e.html(),this.get_allowed_tags(e)):e.text()},has_changed:function(t){vari=e(t.target);returni.attr("data-original-content")!==this.get_content(i)},is_valid:function(t){vari=this,n=e(t.target),s=this.get_content(n),o=n.attr("data-type");if((n.attr("required")||n.attr("data-required"))&&s.length<1)return!1;if("url"===o||"video"===o){if(!this._validate_url(this.get_content(n)))return!1}else"permalink"===o&&LLMS.Ajax.call({data:{action:"llms_builder",action_type:"get_permalink",course_id:window.llms_builder.CourseModel.get("id"),id:i.model.get("id"),title:i.model.get("title"),slug:s},beforeSend:function(){LLMS.Spinner.start(n.closest(".llms-editable-toggle-group"),"small")},success:function(e){e.permalink&&e.slug&&(i.model.set("permalink",e.permalink),i.model.set("name",e.slug),i.render())}});return!0},init_datepickers:function(){this.$el.find(".llms-editable-date input").each(function(){e(this).datetimepicker({format:e(this).attr("data-date-format")||"Y-m-d h:i A",datepicker:void0===e(this).attr("data-date-datepicker")||"true"==e(this).attr("data-date-datepicker"),timepicker:void0===e(this).attr("data-date-timepicker")||"true"==e(this).attr("data-date-timepicker"),onClose:function(e,t){t.blur()}})})},init_formatting_els:function(){vart=this;this.$el.find(".llms-input-formatting[data-formatting]").each(function(){vari=e(this).attr("data-formatting").split(","),n=e(this).attr("data-attribute"),s=newQuill(this,{modules:{toolbar:[i],keyboard:{bindings:{tab:{key:9,handler:function(e,t){return!0}},13:{key:13,handler:function(e,t){returns.root.blur(),!1}}}}},placeholder:e(this).attr("data-placeholder"),theme:"bubble"});s.on("text-change",function(i,o,l){t.model.set(n,t.get_content(e(s.root)))}),Backbone.pubSub.trigger("formatting-ed-init",s,e(this),t)})},init_selects:function(){this.$el.find(".llms-editable-select select").llmsSelect2({width:"100%"}).trigger("change")},on_blur:function(t){t.stopPropagation(),this.model.set("_has_focus",!1,{silent:!0});vari=this;e(t.target);this.has_changed(t)&&(i.is_valid(t)?this.save_edits(t):i.revert_edits(t))},on_focus:function(e){e.stopPropagation(),this.model.set("_has_focus",!0,{silent:!0})},on_paste:function(e){e.preventDefault(),e.stopPropagation();vart=(e.originalEvent||e).clipboardData.getData("text/plain");window.document.execCommand("insertText",!1,t)},on_select:function(t){vari,n=e(t.target),s=n.attr("multiple"),o=n.attr("name"),l=n.find("option:selected");s?(i=[],i=l.map(function(){returnthis.value}).get()):i=l[0].value,this.model.set(o,i)},on_radio_select:function(t){vari=e(t.target),n=i.attr("name"),s=i.val();this.model.set(n,s)},on_keydown:function(e){e.stopPropagation();vart=e.which||e.keyCode,i=e.shiftKey;switch(t){case13:i||(e.preventDefault(),e.target.blur());break;case27:e.preventDefault(),this.revert_edits(e),e.target.blur()}},open_media_lib:function(t){t.stopPropagation();vari=this,n=e(t.currentTarget);i.media_lib?i.media_lib.uploader.uploader.param("post_id"):(i.media_lib=wp.media.frames.file_frame=wp.media({title:LLMS.l10n.translate("Select an image"),button:{text:LLMS.l10n.translate("Use this image")},multiple:!1}),i.media_lib.on("select",function(){vare,t=n.attr("data-image-size"),s=i.media_lib.state().get("selection").first().toJSON(),o=i.model.get(n.attr("data-attribute"));e=t&&s.sizes[t]?s.sizes[t].url:s.url,o.set({id:s.id,src:e})})),i.media_lib.open()},remove_image:function(t){t.preventDefault(),this.model.get(e(t.currentTarget).attr("data-attribute")).set({id:"",src:""})},revert_edits:function(t){vari=e(t.target),n=i.attr("data-original-content");i.html(n)},save_edits:function(t){vari=e(t.target),n=this.get_content(i);this.model.set(i.attr("data-attribute"),n)},toggle_switch:function(t){t.stopPropagation();vari,n=e(t.target),s=n.attr("name"),o=n.attr("data-rerender");if(i=n.is(":checked")?n.attr("data-on")?n.attr("data-on"):"yes":n.attr("data-off")?n.attr("data-off"):"no",-1!==s.indexOf(".")){varl=s.split(".");"parent"===l[0]?this.model.get_parent().set(l[1],i):this.model.get(l[0]).set(l[1],i)}elsethis.model.set(s,i);if(this.trigger(s.replace(".","-")+"_toggle",i),!o||"yes"===o){varr=this;setTimeout(function(){r.render()},100)}},init_editor:function(t,i){i=i||{};varn=_.getEditor();n.remove(t),n.initialize(t,e.extend(!0,n.getDefaultSettings(),{mediaButtons:!0,tinymce:{toolbar1:"bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_adv",toolbar2:"formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",setup:_.bind(this.on_editor_ready,this)}},i))},make_slug_editable:function(t){vari=e(t.currentTarget),n=i.prevAll("a"),s=i.prev("input.permalink"),o=n.attr("href"),l=s.val(),r=o.replace(l,"");i.hide(),n.css({color:"#999","pointer-events":"none","text-decoration":"none"}),n.text(r.substring(0,r.length-1)),s.show().focus()},on_editor_ready:function(t){vari=this,n=e("#"+t.id),s=n.closest(".llms-editable-editor"),o=s.find(".llms-label"),l=n.attr("data-attribute");o.length&&o.prependTo(s.find(".wp-editor-tools")),t.on("change",function(e){i.model.set(l,_.getEditor().getContent(t.id))}),n.on("input",function(e){i.model.set(l,n.val())}),s.on("click",".quicktags-toolbar .ed_button",function(){setTimeout(function(){n.trigger("input")},10)})},_validate_url:function(e){vart=document.createElement("a");returnt.href=e,t.host&&t.host!==window.location.host}}}),n("Views/_Receivable",[],function(){return{_receive:function(e,t){if(t.sender.hasClass("ui-draggable")){vari=this._getContainerEl().children().index(t.helper);returnt.helper.remove(),voidthis.collection.add({},{at:i})}varn=t.sender,s=n.data("view");if(s&&s.collection){varo=this._getContainerEl().children().index(t.item),l=s.collection.get(t.item.attr("data-model-cid"));s.collection.remove(l),this.collection.add(l,{at:o}),l.collection=this.collection,this.setSelectedModel(l)}}}}),n("Views/_Shiftable",[],function(){return{maybe_hide_shiftable_buttons:function(){if(this.model.collection){vare=this.model.get("type");this.model.collection.first()===this.model?this.$el.find(".shift-up--"+e).hide():this.model.collection.last()===this.model&&this.$el.find(".shift-down--"+e).hide()}},shift:function(e,t){vari=this.model.collection;i.remove(this.model),i.add(this.model,{at:t}),i.trigger("reorder")},shift_down:function(e){e.preventDefault();vart=this.model.collection.indexOf(this.model);this.shift(t,t+1)},shift_up:function(e){e.preventDefault();vart=this.model.collection.indexOf(this.model);this.shift(t,t-1)}}}),n("Views/_Subview",[],function(){return{subscriptions:{},state:"",views:{},get_subview:function(e){return!!this.views[e]&&this.views[e]},events_subscribe:function(e){_.each(e,function(e,t){this.subscriptions[t]=e,Backbone.pubSub.on(t,e,this)},this)},events_unsubscribe:function(){_.each(this.subscriptions,function(e,t){Backbone.pubSub.off(t,e,this),deletethis.subscriptions[t]},this)},remove_subview:function(e){vart=this.get_subview(e);t&&t.instance&&(_.isEmpty(t.instance.views)||(t.instance.events_unsubscribe(),t.instance.remove_subviews()),t.instance.off(),t.instance.off(null,null,null),t.instance.remove(),t.instance.undelegateEvents(),t.instance=null)},remove_subviews:function(){_.each(this.views,function(e,t){this.remove_subview(t)},this)},render_subviews:function(e){e=e||{},_.each(this.views,function(t,i){this.state===t.state?this.render_subview(i,e):this.remove_subview(i)},this)},render_subview:function(e,t){vari=this.get_subview(e);i&&(this.remove_subview(e),i.instance||(i.instance=newi.class(t)),i.instance.render())},set_state:function(e){returnthis.state=e,this}}}),n("Views/_Trashable",[],function(){return{events:{'click a[href="#llms-trash-model"]':"trash_model"},trash_model:function(e){e&&(e.preventDefault(),e.stopPropagation());vart=LLMS.l10n.replace("Are you sure you want to move this %s to the trash?",{"%s":this.model.get_l10n_type()});window.confirm(t)&&(this.model.collection&&this.model.collection.remove(this.model),Backbone.pubSub.trigger("model-trashed",this.model),this.trigger("model-trashed",this.model))}}}),n("Views/_loader",["Views/_Detachable","Views/_Editable","Views/_Receivable","Views/_Shiftable","Views/_Subview","Views/_Trashable"],function(e,t,i,n,s,o){return{Detachable:e,Editable:t,Receivable:i,Shiftable:n,Subview:s,Trashable:o}}),n("Controllers/Construct",["Collections/loader","Models/loader","Views/_loader"],function(e,t,i){returnfunction(){functionn(e,t,i,n){returne[t]?newe[t](i,n):(console.log('"'+t+'" not found.'),!1)}returnthis.get_collection=function(t,i,s){returnn(e,t,i,s)},this.get_model=function(e,i,s){returnn(t,e,i,s)},this.extend_view=function(){for(vare=arguments[0],t=1;arguments[t];){varn=arguments[t];i[n]&&(e.events&&i[n].events&&(e.events=_.defaults(e.events,i[n].events)),e=_.defaults(e,i[n])),t++}returnBackbone.View.extend(e)},this.register_collection=function(t,i){e[t]=Backbone.Collection.extend(i)},this.register_model=function(e,i){t[e]=t.Abstract.extend(i)},this}}),n("Controllers/Debug",[],function(){returnfunction(e){vart=this,i=e.enabled||!1;this.disable=function(){t.log("LifterLMS Builder debugging disabled"),i=!1},this.enable=function(){i=!0,t.log("LifterLMS Builder debugging enabled")},this.log=function(){i&&_.each(arguments,function(e){console.log(e)})},this.toggle=function(){i?t.disable():t.enable()},i&&t.enable()}}),n("Controllers/Schemas",[],function(){returnfunction(e){vart=e;return_.each(t,function(e){_.each(e,function(e){e.custom=!0})}),this.get=function(e,i,n){returnt[i]&&(e=_.extend(e,t[i])),e},this}}),n("Controllers/Sync",[],function(){returnfunction(t,i){functionn(e,t){return"success"===e.status&&(e.message=[]),e.status="error","string"==typeoft&&(t=[t]),e.message=e.message.concat(t),e}functions(){vare={};e.changes=p.get_unsaved_changes(),e.has_unsaved_changes=p.has_unsaved_changes(e.changes),e.saving=p.saving,window.llms_builder.debug.log("==== start changes check ====",e,"==== finish changes check ===="),Backbone.pubSub.trigger("current-save-status",e)}functiono(){if(!p.saving){vare=p.get_unsaved_changes();p.has_unsaved_changes(e)&&(e.id=t.get("id"),LLMS.Ajax.call({data:{action:"llms_builder",action_type:"ajax_save",course_id:e.id,llms_builder:JSON.stringify(e)},beforeSend:function(){window.llms_builder.debug.log("==== start do_ajax_save before ====",e,"==== finish do_ajax_save before ===="),p.saving=!0,Backbone.pubSub.trigger("heartbeat-send",p)},error:function(e,t,i){window.llms_builder.debug.log("==== start do_ajax_save error ====",e,"==== finish do_ajax_save error ===="),p.saving=!1,Backbone.pubSub.trigger("heartbeat-tick",p,{status:"error",message:e.responseText+" ("+i+" "+t+")"})},success:function(e){e.llms_builder&&(window.llms_builder.debug.log("==== start do_ajax_save success ====",e,"==== finish do_ajax_save success ===="),e.llms_builder=d(e.llms_builder),e.llms_builder=h(e.llms_builder),p.saving=!1,Backbone.pubSub.trigger("heartbeat-tick",p,e.llms_builder))}}))}}functionl(e){vart,i={};if(e.get("_has_focus"))returni;a(e)||!0===e.get("_forceSync")?(i=_.clone(e.attributes),t="full"):(i=e.unsavedAttributes(),t="partial");varn=e.get_relationships?e.get_child_props():[];returni=_.omit(i,function(e,t){return0===t.indexOf("_")||-1!==n.indexOf(t)}),e.before_save&&(i=e.before_save(i,t)),i}functionr(e){vart;returneinstanceofBackbone.Model?(t=l(e),e.get_relationships&&_.each(e.get_child_props(),function(i){varn=r(e.get(i));_.isEmpty(n)||(t[i]=n)}),_.isEmpty(t)||(t.id=e.get("id"))):einstanceofBackbone.Collection&&(t=[],e.each(function(e){vari=r(e);_.isEmpty(i)||t.push(i)})),t}functiona(e){return!_.isNumber(e.id)&&0===e.id.indexOf("temp_")}functionc(e,t){Backbone.pubSub.trigger(e.get("type")+"-maybe-restart-tracking",e,t);vari=["id","orig_id"];e.get_relationships&&i.concat(e.get_child_props()),_.each(_.omit(t,i),function(t,i){_.isEqual(e.get(i),t)&&(deletee._unsavedChanges[i],e._originalAttrs[i]=t)}),e.unset("_forceSync")}functiond(e){vart={detach:b,trash:v};return_.each(t,function(t,i){if(e[i]){vars=[];_.each(e[i],function(e){e.error?s.push(e.error):t.remove(e.id)}),s.length&&_.extend(e,n(e,s))}}),e}functionu(e,t,i,s){if(!e[t])returne;if(i.get(t)instanceofBackbone.Model){varo=e[t];if(o.error)_.extend(s,n(s,o.error));else{varl=i.get(t);o.id!=o.orig_id&&(l.set("id",o.id),deletel._unsavedChanges.id),c(l,o),l.get_relationships&&_.each(l.get_child_props(),function(i){_.extend(e[t],u(e[t],i,l,s))})}}elsei.get(t)instanceofBackbone.Collection&&_.each(e[t],function(o,l){if(o.error)_.extend(s,n(s,o.error));else{varr=i.get(t).get(o.orig_id);o.id!=o.orig_id&&(r.set("id",o.id),deleter._unsavedChanges.id),c(r,o),r.get_relationships&&_.each(r.get_child_props(),function(i){_.extend(e[t],u(e[t][l],i,r,s))})}});returns}functionh(e){returne.updates?(e.updates&&(e=u(e.updates,"sections",t,e)),e):e}this.saving=!1;varp=this,g="yes"===window.llms_builder.autosave,m=null,f=i.check_interval_ms||1e4,b=newBackbone.Collection,v=newBackbone.Collection;returnthis.get_unsaved_changes=function(){return{detach:b.pluck("id"),trash:v.pluck("id"),updates:r(t)}},this.has_unsaved_changes=function(e){returnvoid0===e&&(e=p.get_unsaved_changes()),!!_.find(e,function(e){return!1===_.isEmpty(e)})},this.save_now=function(){g?wp.heartbeat.connectNow():o()},this.set_check_interval=function(e){f=e,m&&clearInterval(m),f&&(m=setInterval(s,f))},Backbone.pubSub.on("model-detached",function(e){a(e)||b.add(_.clone(e.attributes))}),Backbone.pubSub.on("model-trashed",function(e){if(!a(e)){vart=_.clone(e.attributes);e.get_trash_id&&(t.id=e.get_trash_id()),v.add(t)}}),e(document).on("heartbeat-send",function(e,i){if(g&&!p.saving){varn=p.get_unsaved_changes();p.has_unsaved_changes(n)&&(n.id=t.get("id"),p.saving=!0,i.llms_builder=JSON.stringify(n)),window.llms_builder.debug.log("==== start heartbeat-send ====",i,"==== finish heartbeat-send ===="),Backbone.pubSub.trigger("heartbeat-send",p)}}),e(document).on("heartbeat-tick",function(e,t){g&&t.llms_builder&&(window.llms_builder.debug.log("==== start heartbeat-tick ====",t,"==== finish heartbeat-tick ===="),t.llms_builder=d(t.llms_builder),t.llms_builder=h(t.llms_builder),p.saving=!1,Backbone.pubSub.trigger("heartbeat-tick",p,t.llms_builder))}),e(document).on("heartbeat-error",function(e,t){g&&(window.llms_builder.debug.log("==== start heartbeat-error ====",t,"==== finish heartbeat-error ===="),p.saving=!1,Backbone.pubSub.trigger("heartbeat-tick",p,{status:"error",message:t.responseText+" ("+t.status+" "+t.statusText+")"}))}),function(){void0===wp.heartbeat&&(window.llms_builder.debug.log("WordPress Heartbeat disabled. Autosaving is disabled!"),g=!1),f&&p.set_check_interval(f),e(window).on("beforeunload",function(){if(p.has_unsaved_changes())returns(),"Are you sure you want to abandon your changes?"})}(),this}}),n("Views/Lesson",["Views/_Detachable","Views/_Editable","Views/_Shiftable","Views/_Trashable"],function(e,t,i,n){returnBackbone.View.extend(_.defaults({attributes:function(){return{"data-id":this.model.id,"data-section-id":this.model.get("parent_section")}},className:"llms-builder-item llms-lesson",events:_.defaults({"click .edit-lesson":"open_lesson_editor","click .edit-quiz":"open_quiz_editor","click .edit-assignment":"open_assignment_editor","click .section-prev":"section_prev","click .section-next":"section_next","click .shift-up--lesson":"shift_up","click .shift-down--lesson":"shift_down"},e.events,t.events,n.events),id:function(){return"llms-lesson-"+this.model.id},tagName:"li",template:wp.template("llms-lesson-template"),initialize:function(){this.render(),this.listenTo(this.model,"change",this.render),Backbone.pubSub.on("lesson-selected",this.on_select,this),Backbone.pubSub.on("new-lesson-added",this.on_select,this)},render:function(){returnthis.$el.html(this.template(this.model)),this.maybe_hide_shiftable_buttons(),this.model.get("_selected")?this.$el.addClass("selected"):this.$el.removeClass("selected"),this},open_assignment_editor:function(e){e&&e.preventDefault(),Backbone.pubSub.trigger("lesson-selected",this.model,"assignment"),this.model.set("_selected",!0),this.set_hash("assignment")},open_lesson_editor:function(e){e&&e.preventDefault(),Backbone.pubSub.trigger("lesson-selected",this.model,"lesson"),this.model.set("_selected",!0),this.set_hash(!1)},open_quiz_editor:function(e){e&&e.preventDefault(),Backbone.pubSub.trigger("lesson-selected",this.model,"quiz"),this.model.set("_selected",!0),this.set_hash("quiz")},on_select:function(e){this.model.id!==e.id&&this.model.set("_selected",!1)},section_next:function(e){e.preventDefault(),this._move_to_section("next")},section_prev:function(e){e.preventDefault(),this._move_to_section("prev")},set_hash:function(e){vart="lesson:"+this.model.get("id");e&&(t+=":"+e),window.location.hash=t},_move_to_section:function(e){vart,i=this.model.collection;"next"===e?t=i.parent.get_next():"prev"===e&&(t=i.parent.get_prev()),t&&(i.remove(this.model),t.add_lesson(this.model),t.set("_expanded",!0))}},e,t,i,n))}),n("Views/LessonList",["Views/Lesson","Views/_Receivable"],function(t,i){returnBackbone.CollectionView.extend(_.defaults({className:"llms-lessons",modelView:t,selectable:!1,sortable:!0,sortableOptions:{axis:!1,connectWith:".llms-lessons",cursor:"move",handle:".drag-lesson",items:".llms-lesson",placeholder:"llms-lesson llms-sortable-placeholder"},sortable_start:function(t){e(".llms-lessons").addClass("dragging")},sortable_stop:function(t){e(".llms-lessons").removeClass("dragging")},_sortStop:function(e,t){vari=this.collection.get(t.item.attr("data-model-cid")),n=this._getContainerEl(),s=n.children().index(t.item);-1==s&&i&&this.collection.remove(i),this._reorderCollectionBasedOnHTML(),this.updateDependentControls(),this._isBackboneCourierAvailable()?this.spawn("sortStop",{modelBeingSorted:i,newIndex:s}):this.trigger("sortStop",i,s)}},i))}),n("Views/Section",["Views/LessonList","Views/_Editable","Views/_Shiftable","Views/_Trashable"],function(t,i,n,s){returnBackbone.View.extend(_.defaults({attributes:function(){return{"data-id":this.model.id}},className:"llms-builder-item llms-section",events:_.defaults({click:"select","click .expand":"expand","click .collapse":"collapse","click .shift-up--section":"shift_up","click .shift-down--section":"shift_down","mouseenter .llms-lessons":"on_mouseenter"},i.events,s.events),id:function(){return"llms-section-"+this.model.id},tagName:"li",template:wp.template("llms-section-template"),initialize:function(){this.render(),this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"change:_expanded",this.toggle_expanded),this.lessonListView.collection.on("add",this.on_lesson_add,this),this.dragTimeout=null,Backbone.pubSub.on("expand-all",this.expand,this),Backbone.pubSub.on("collapse-all",this.collapse,this)},render:function(){returnthis.$el.html(this.template(this.model.toJSON())),this.maybe_hide_shiftable_buttons(),this.lessonListView=newt({el:this.$el.find(".llms-lessons"),collection:this.model.get("lessons")}),this.lessonListView.render(),this.lessonListView.on("sortStart",this.lessonListView.sortable_start),this.lessonListView.on("sortStop",this.lessonListView.sortable_stop),this.lessonListView.on("selectionChanged",this.active_lesson_change,this),this.maybe_hide_trash_button(),this},active_lesson_change:function(e,t){Backbone.pubSub.trigger("active-lesson-change",{current:e,previous:t})},collapse:function(e,t){void0===t&&(t=!0),e&&(e.stopPropagation(),e.preventDefault()),this.$el.removeClass("expanded").find(".drag-expanded").removeClass("drag-expanded"),t&&this.model.set("_expanded",!1),Backbone.pubSub.trigger("section-toggle",this.model)},expand:function(e,t){void0===t&&(t=!0),e&&(e.stopPropagation(),e.preventDefault()),this.$el.addClass("expanded"),t&&this.model.set("_expanded",!0),Backbone.pubSub.trigger("section-toggle",this.model)},maybe_hide_trash_button:function(){vare=this.$el.find(".trash--section");this.model.get("lessons").isEmpty()?e.show():e.hide()},on_lesson_add:function(e){this.lessonListView.collection.trigger("reorder"),e.set("parent_section",this.model.get("id")),this.expand()},on_mouseenter:function(t){e(t.target).hasClass("dragging")&&(e(".drag-expanded").removeClass("drag-expanded"),e(t.target).addClass("drag-expanded"))},toggle_expanded:function(e,t){t?this.expand(null,!1):this.collapse(null,!1)}},i,n,s))}),n("Views/SectionList",["Views/Section","Views/_Receivable"],function(e,t){returnBackbone.CollectionView.extend(_.defaults({el:"#llms-sections",events:{"mousedown > li.llms-section > .llms-builder-header .llms-headline":"_listItem_onMousedown",click:"_listBackground_onClick","click ul.collection-view":"_listBackground_onClick",keydown:"_onKeydown"},modelView:e,processKeyEvents:!1,selectable:!0,sortable:!0,sortableOptions:{axis:!1,cursor:"move",handle:".drag-section",items:".llms-section",placeholder:"llms-section llms-sortable-placeholder"},sortable_start:function(e){this.$el.addClass("dragging")},sortable_stop:function(e){this.$el.removeClass("dragging")}},t))}),n("Views/Course",["Views/SectionList","Views/_Editable"],function(e,t){returnBackbone.View.extend(_.defaults({attributes:function(){return{"data-id":this.model.id}},el:"#llms-builder-main",tagName:"div",template:wp.template("llms-course-template"),initialize:function(){this.render(),this.sectionListView=newe({collection:this.model.get("sections")}),this.sectionListView.render(),this.sectionListView.on("sortStart",this.sectionListView.sortable_start),this.sectionListView.on("sortStop",this.sectionListView.sortable_stop),this.sectionListView.on("selectionChanged",this.active_section_change),this.listenTo(this.model.get("sections"),"add",this.on_section_add),Backbone.pubSub.on("section-toggle",this.on_section_toggle,this),Backbone.pubSub.on("expand-section",this.expand_section,this),Backbone.pubSub.on("lesson-selected",this.active_lesson_change,this)},render:function(){returnthis.$el.html(this.template(this.model)),this},active_lesson_change:function(e){vart=this.model.get("sections").get(e.get("parent_section"));this.sectionListView.setSelectedModel(t)},active_section_change:function(e,t){_.each(e,function(e){e.set("_selected",!0)}),_.each(t,function(e){e.set("_selected",!1)})},on_section_add:function(e){this.sectionListView.setSelectedModel(e)},on_section_toggle:function(e){vart=e.get("_expanded")?[e]:[];this.sectionListView.setSelectedModels(t)}},t))}),n("Views/SettingsFields",[],function(){returnBackbone.View.extend(_.defaults({events:{"click .llms-settings-group-toggle":"toggle_group"},fields:{},tagName:"div",template:wp.template("llms-settings-fields-template"),get_editor_fields:function(){return_.filter(this.fields,function(e){returnthis.is_editor_field(e.type)},this)},get_groups:function(){returnthis.model.get_settings_fields()},is_group_hidden:function(e){vart="llms-"+this.model.get("type")+"-settings-group--"+e;return"undefined"!==window.localStorage&&"hidden"===window.localStorage.getItem(t)},get_switch_attribute:function(e){returne.switch_attribute?e.switch_attribute:e.attribute},has_switch:function(e){return-1!==e.indexOf("switch")},is_default_field:function(e){return-1!==["audio_embed","datepicker","number","text","video_embed"].indexOf(e.replace("switch-",""))},is_editor_field:function(e){return-1!==["editor","switch-editor"].indexOf(e.replace("switch-",""))},is_switch_condition_met:function(e){returne.switch_on===this.model.get(e.switch_attribute)},render:function(){returnthis.$el.html(this.template(this)),_.each(this.get_editor_fields(),function(e){this.render_editor(e)},this),this},render_editor:function(t){vari=this,n=_.getEditor();if(void0===n)returnvoidconsole.error("Unable to access `wp.oldEditor` or `wp.editor`.");n.remove(t.id),t.settings.tinymce.setup=function(t){vars=e("#"+t.id),o=s.closest(".llms-editable-editor"),l=o.find(".llms-label"),r=s.attr("data-attribute");l.length&&l.prependTo(o.find(".wp-editor-tools")),t.on("change",function(e){i.model.set(r,n.getContent(t.id))}),s.on("input",function(e){i.model.set(r,s.val())}),o.on("click",".quicktags-toolbar .ed_button",function(){setTimeout(function(){s.trigger("input")},10)})},n.initialize(t.id,t.settings)},render_select_options:function(e,t){functioni(e,t){return'<option value="'+t+'"'+_.selected(t,s)+">"+e+"</option>"}varn="",s=this.model.get(t);return_.each(e,function(e,s){"string"==typeofe?n+=i(e,s):"object"==typeofe&&(e.label&&e.options?(n+='<optgroup label="'+e.label+'">',n+=this.render_select_options(e.options,t)):n+=i(e.val,e.key))},this),n},setup_field:function(t,i){varn={classes:[],id:_.uniqueId(t.attribute+"_"),input_type:"text",label:"",options:{},placeholder:"",tip:"",tip_position:"top-right",settings:{}};if(t.condition&&!1===_.bind(t.condition,this.model)())return!1;switch(t.type){case"audio_embed":n.classes.push("llms-editable-audio"),n.placeholder="https://",n.tip=LLMS.l10n.translate("Use SoundCloud or Spotify audio URLS."),n.input_type="url";break;case"datepicker":n.classes.push("llms-editable-date");break;case"editor":case"switch-editor":vars=t.settings||{};n.settings=e.extend(!0,_.getEditor().getDefaultSettings(),{mediaButtons:!0,tinymce:{toolbar1:"bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_adv",toolbar2:"formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help"}},s);break;case"number":case"switch-number":n.input_type="number";break;case"permalink":n.label=LLMS.l10n.translate("Permalink");break;case"video_embed":n.classes.push("llms-editable-video"),n.placeholder="https://",n.tip=LLMS.l10n.translate("Use YouTube, Vimeo, or Wistia video URLS."),n.input_type="url"}this.has_switch(t.type)&&(n.switch_on="yes",n.switch_off="no");varo=_.defaults(_.deepClone(t),n);if(_.isFunction(o.options)&&(o.options=_.bind(o.options,this.model)()),-1!==["radio","switch-radio"].indexOf(t.type)){varl=!1;_.each(t.options,function(e,t){-1===e.indexOf(".png")&&-1===e.indexOf(".jpg")||(o.options[t]='<span><img src="'+e+'"></span>',l=!0)}),l&&o.classes.push("has-images")}returno.classes.length&&(o.classes=" "+o.classes.join(" ")),this.fields[o.id]=o,o},should_rerender_on_toggle:function(e){return-1!==e.indexOf("switch-")?"yes":"no"},toggle_group:function(t){t.preventDefault();vari=e(t.currentTarget),n=i.closest(".llms-model-settings");if(n.toggleClass("hidden"),"undefined"!==window.localStorage){vars=n.attr("id");n.hasClass("hidden")?window.localStorage.setItem(s,"hidden"):window.localStorage.removeItem(s)}}}))}),n("Views/LessonEditor",["Views/_Detachable","Views/_Editable","Views/_Trashable","Views/_Subview","Views/SettingsFields"],function(e,t,i,n,s){returnBackbone.View.extend(_.defaults({state:"default",views:{settings:{class:s,instance:null,state:"default"}},el:"#llms-editor-lesson",events:_.defaults({},e.events,t.events,i.events),template:wp.template("llms-lesson-settings-template"),initialize:function(e){this.model=e.lesson;vart=window.llms.hooks.applyFilters("llms_lesson_rerender_change_events",["change:date_available","change:drip_method","change:time_available"]);_.each(t,function(e){this.listenTo(this.model,e,this.render)},this),this.listenTo(this.model,"change:points",this.render_points_percentage),this.listenTo(this.model,"change:has_prerequisite",function(e,t){"yes"===t&&this.$el.find('select[name="prerequisite"]').trigger("change")})},render:function(){returnthis.$el.html(this.template(this.model)),this.remove_subview("settings"),this.render_subview("settings",{el:"#llms-lesson-settings-fields",model:this.model}),this.init_datepickers(),this.init_selects(),this.render_points_percentage(),this},render_points_percentage:function(){this.$el.find("#llms-model-settings-field--points .llms-editable-input").addClass("tip--top-left").attr("data-tip",this.model.get_points_percentage())}},e,t,i,n,s))}),n("Views/Popover",[],function(){returnBackbone.View.extend({defaults:{placement:"auto",width:"auto",trigger:"manual",style:"light",animation:"pop",title:"",content:"",closeable:!1,backdrop:!1,onShow:function(e){},onHide:function(e){}},tagName:"div",initialize:function(t){this.$el.length&&(this.defaults.container=this.$el.parent()),this.args=_.defaults(t.args,this.defaults),e("body").hasClass("rtl")&&(-1!==this.args.placement.indexOf("left")?this.args.placement=this.args.placement.replace("left","right"):-1!==this.args.placement.indexOf("right")&&(this.args.placement=this.args.placement.replace("right","left"))),this.render()},render:function(){returnthis.$el.webuiPopover(this.args),this},hide:function(){returnthis.$el.webuiPopover("hide"),this},show:function(){returnthis.$el.webuiPopover("show"),this}})}),n("Views/PostSearch",[],function(){returnBackbone.View.extend({events:{"select2:select":"add_post"},tagName:"select",initialize:function(e){this.post_type=e.post_type,this.searching_message=e.searching_message||LLMS.l10n.translate("Searching...")},add_post:function(e){vart=this.$el.attr("data-post-type");Backbone.pubSub.trigger(t.replace("llms_","")+"-search-select",e.params.data,e),this.$el.val(null).trigger("change")},render:function(){vart=this;returnsetTimeout(function(){t.$el.llmsSelect2({ajax:{dataType:"JSON",delay:250,method:"POST",url:window.ajaxurl,data:function(e){return{action:"llms_builder",action_type:"search",course_id:window.llms_builder.course.id,post_type:t.post_type,term:e.term,page:e.page,_ajax_nonce:window.llms.ajax_nonce}}},dropdownParent:e(".wrap.lifterlms.llms-builder"),escapeMarkup:function(e){returne},placeholder:t.searching_message,templateResult:t.render_result,width:"100%"}),t.$el.attr("data-post-type",t.post_type)},0),this},render_result:function(t){vari=e('<div class="llms-existing-lesson-result" />');if(t.loading)returni.append(t.text);varn=e('<aside class="llms-existing-action" />'),s=e('<div class="llms-existing-info" />');returnicon="attach"===t.action?"paperclip":"clone",text="attach"===t.action?LLMS.l10n.translate("Attach"):LLMS.l10n.translate("Clone"),n.append('<i class="fa fa-'+icon+'" aria-hidden="true"></i><small>'+text+"</small>"),s.append("<h4>"+t.data.title+"</h4>"),s.append("<h5>"+LLMS.l10n.translate("ID")+": <em>"+t.data.id+"</em></h5>"),_.each(t.parents,function(e){s.append("<h5>"+e+"</em></h5>")}),i.append(n).append(s)}})}),n("Views/QuestionType",["Views/Popover","Views/PostSearch"],function(e,t){returnBackbone.View.extend({className:"llms-question-type",events:{"click .llms-add-question":"add_question"},id:function(){return"llms-question-type-"+this.model.id},tagName:"li",template:wp.template("llms-question-type-template"),initialize:function(){this.render()},render:function(){returnthis.$el.html(this.template(this.model)),this},add_question:function(){"existing"===this.model.get("id")?this.add_existing_question_click():this.add_new_question()},add_existing_question_click:function(){vari=newe({el:"#llms-add-question--existing",args:{backdrop:!0,closeable:!0,container:"#llms-builder-sidebar",dismissible:!0,placement:"top-left",width:"calc( 100% - 40px )",offsetLeft:250,offsetTop:60,title:LLMS.l10n.translate("Add Existing Question"),content:newt({post_type:"llms_question",searching_message:LLMS.l10n.translate("Search for existing questions...")}).render().$el}});i.show(),Backbone.pubSub.on("question-search-select",this.add_existing_question,this),Backbone.pubSub.on("question-search-select",function(e){i.hide(),Backbone.pubSub.off("question-search-select",this.add_existing_question,this)},this)},add_existing_question:function(e){vart=e.data;"clone"===e.action?t=_.prepareQuestionObjectForCloning(t):(t=_.prepareExistingPostObjectDataForAddingOrCloning(t),t._forceSync=!0),t._expanded=!0,this.quiz.add_question(t),this.quiz.trigger("new-question-added")},add_new_question:function(){this.quiz.add_question({_expanded:!0,choices:this.model.get("default_choices")?this.model.get("default_choices"):null,question_type:this.model}),this.quiz.trigger("new-question-added")}})}),n("Views/QuestionBank",["Views/QuestionType"],function(e){returnBackbone.CollectionView.extend({className:"llms-question",el:"#llms-question-bank",modelView:e,selectable:!1,sortable:!1})}),n("Views/QuestionChoice",["Views/_Editable"],function(e){returnBackbone.View.extend(_.defaults({className:"llms-question-choice",events:_.defaults({'change input[name="correct"]':"toggle_correct",'click .llms-action-icon[href="#llms-add-choice"]':"add_choice",'click .llms-action-icon[href="#llms-del-choice"]':"del_choice"},e.events),id:function(){return"llms-question-choice-"+this.model.id},tagName:"li",template:wp.template("llms-question-choice-template"),initialize:function(){this.render(),this.listenTo(this.model.collection,"add",this.maybe_disable_buttons),this.listenTo(this.model,"change",this.render),"image"===this.model.get("choice_type")&&this.listenTo(this.model.get("choice"),"change",this.render)},render:function(){returnthis.$el.html(this.template(this.model)),this},add_choice:function(e){e.stopPropagation(),e.preventDefault();vart=this.model.collection.indexOf(this.model);this.model.collection.parent.add_choice({},{at:t+1})},del_choice:function(e){e.preventDefault(),Backbone.pubSub.trigger("model-trashed",this.model),this.model.collection.remove(this.model)},toggle_correct:function(){vare=this.$el.find('input[name="correct"]').is(":checked");this.model.set("correct",e),this.model.collection.trigger("correct-update",this.model)}},e))}),n("Views/QuestionChoiceList",["Views/QuestionChoice"],function(e){returnBackbone.CollectionView.extend({className:"llms-quiz-questions",modelView:e,processKeyEvents:!1,selectable:!1,sortable:!0,sortableOptions:{axis:!1,cursor:"move",handle:".llms-choice-id",items:".llms-question-choice",placeholder:"llms-question-choice llms-sortable-placeholder"},sortable_start:function(e){this.$el.addClass("dragging")},sortable_stop:function(e){this.$el.removeClass("dragging")}})}),n("Views/Question",["Views/_Detachable","Views/_Editable","Views/QuestionChoiceList"],function(e,t,i){returnBackbone.View.extend(_.defaults({className:function(){return"llms-question qtype--"+this.model.get("question_type").get("id")},events:_.defaults({"click .clone--question":"clone","click .delete--question":"delete","click .expand--question":"expand","click .collapse--question":"collapse",'change input[name="question_points"]':"update_points"},e.events,t.events),id:function(){return"llms-question-"+this.model.id},tagName:"li",template:wp.template("llms-question-template"),initialize:function(){vare=["change:_expanded","change:menu_order"];_.each(e,function(e){this.listenTo(this.model,e,this.render)},this),this.listenTo(this.model.get("image"),"change",this.render),this.listenTo(this.model.get_parent(),"change:_points",this.render_points_percentage),this.on("multi_choices_toggle",this.multi_choices_toggle,this),Backbone.pubSub.on("del-question-choice",this.del_choice,this)},render:function(){if(this.$el.html(this.template(this.model)),this.model.get("question_type").get("choices")&&(this.choiceListView=newi({el:this.$el.find(".llms-question-choices"),collection:this.model.get("choices")}),this.choiceListView.render(),this.choiceListView.on("sortStart",this.choiceListView.sortable_start),this.choiceListView.on("sortStop",this.choiceListView.sortable_stop)),"group"===this.model.get("question_type").get("id")){vare=this;setTimeout(function(){e.questionListView=e.collectionListView.quiz.get_question_list({el:e.$el.find(".llms-quiz-questions"),collection:e.model.get("questions")}),e.questionListView.render(),e.questionListView.on("sortStart",e.questionListView.sortable_start),e.questionListView.on("sortStop",e.questionListView.sortable_stop)},1)}returnthis.model.get("description_enabled")&&this.init_editor("question-desc--"+this.model.get("id")),this.model.get("clarifications_enabled")&&this.init_editor("question-clarifications--"+this.model.get("id"),{mediaButtons:!1,tinymce:{toolbar1:"bold,italic,strikethrough,bullist,numlist,alignleft,aligncenter,alignright",toolbar2:"",setup:_.bind(this.on_editor_ready,this)}}),this.init_formatting_els(),this.init_selects(),this},render_points_percentage:function(){this.$el.find(".llms-question-points").attr("data-tip",this.model.get_points_percentage())},clone:function(e){e.stopPropagation(),e.preventDefault(),this.model.collection.add(this._get_question_clone(this.model))},_get_question_clone:function(e){vart=_.clone(e.attributes);returndeletet.id,t.parent_id=e.get("id"),t.question_type=e.get("question_type").get("id"),t.image=_.clone(e.get("image").attributes),e.get("choices")&&(t.choices=[],e.get("choices").each(function(e){vari=_.clone(e.attributes);deletei.id,deletei.question_id,t.choices.push(i)})),"group"===e.get("question_type").get("id")&&(t.questions=[],e.get("questions").each(function(e){t.questions.push(this._get_question_clone(e))},this)),t},collapse:function(e){e&&e.preventDefault(),this.model.set("_expanded",!1)},delete:function(e){e.preventDefault(),window.confirm(LLMS.l10n.translate("Are you sure you want to delete this question?"))&&(this.model.collection.remove(this.model),Backbone.pubSub.trigger("model-trashed",this.model))},expand:function(e){e&&e.preventDefault(),this.model.set("_expanded",!0)},multi_choices_toggle:function(e){"yes"!==e&&this.model.get("choices").update_correct(_.first(this.model.get("choices").get_correct()))},update_points:function(){this.model.set("points",1*this.$el.find('input[name="question_points"]').val())}},e,t))}),n("Views/QuestionList",["Views/Question"],function(t){returnBackbone.CollectionView.extend({className:"llms-quiz-questions",modelView:t,processKeyEvents:!1,selectable:!1,sortable:!0,sortableOptions:{axis:!1,connectWith:".llms-quiz-questions",cursor:"move",handle:".llms-data-stamp",items:".llms-question",placeholder:"llms-question llms-sortable-placeholder"},sortable_start:function(t){vari="group"===t.get("question_type").get("id")?".llms-editor-tab > .llms-quiz-questions":".llms-quiz-questions";e(i).addClass("dragging")},sortable_stop:function(){e(".llms-quiz-questions").removeClass("dragging")},_receive:function(t,i){if(t.stopPropagation(),i.item.hasClass("qtype--group")&&e(t.target).closest(".qtype--group").length)returnvoidi.sender.sortable("cancel");varn=i.sender,s=n.data("view");if(s&&s.collection){varo=this._getContainerEl().children().index(i.item),l=s.collection.get(i.item.attr("data-model-cid"));s.collection.remove(l),this.collection.add(l,{at:o}),l.collection=this.collection,this.setSelectedModel(l)}},_sortStart:function(e,t){vari=this.collection.get(t.item.attr("data-model-cid"));t.placeholder.addClass("qtype--"+i.get("question_type").get("id")),this._isBackboneCourierAvailable()?this.spawn("sortStart",{modelBeingSorted:i}):this.trigger("sortStart",i)},_sortStop:function(e,t){e.stopPropagation();vari=this.collection.get(t.item.attr("data-model-cid")),n=this._getContainerEl(),s=n.children().index(t.item);-1==s&&i&&this.collection.remove(i),this._reorderCollectionBasedOnHTML(),this.updateDependentControls(),this._isBackboneCourierAvailable()?this.spawn("sortStop",{modelBeingSorted:i,newIndex:s}):this.trigger("sortStop",i,s)}})}),n("Views/Quiz",["Models/Quiz","Views/Popover","Views/PostSearch","Views/QuestionBank","Views/QuestionList","Views/SettingsFields","Views/_Detachable","Views/_Editable","Views/_Subview","Views/_Trashable"],function(t,i,n,s,o,l,r,a,c,d){returnBackbone.View.extend(_.defaults({state:"default",views:{settings:{class:l,instance:null,state:"default"},bank:{class:s,instance:null,state:"default"},list:{class:o,instance:null,state:"default"}},el:"#llms-editor-quiz",events:_.defaults({"click #llms-existing-quiz":"add_existing_quiz_click","click #llms-new-quiz":"add_new_quiz","click #llms-show-question-bank":"show_tools","click .bulk-toggle":"bulk_toggle"},r.events,a.events,d.events),tagName:"div",template:wp.template("llms-quiz-template"),initialize:function(e){this.lesson=e.lesson,"yes"!==this.lesson.get("quiz_enabled")&&_.isEmpty(this.lesson.get("quiz"))||(this.model=this.lesson.get("quiz"),this.model.set_parent(this.lesson),this.listenTo(this.model,"change:_points",this.render_points)),this.on("model-trashed",this.on_trashed)},render:function(){if(this.$el.html(this.template(this.model)),this.model){LLMS.Spinner.start(this.$el),this.render_subview("settings",{el:"#llms-quiz-settings-fields",model:this.model}),this.init_datepickers(),this.init_selects(),this.render_subview("bank",{collection:window.llms_builder.questions});vare=null,t=null;this.get_subview("bank").instance.viewManager.each(function(i){i.quiz=this.model,t=i.model.get("group").name,e!==t&&(e=t,i.$el.before('<li class="llms-question-bank-header"><h4>'+t+"</h4></li>"))},this),this.model.load_questions(_.bind(function(e){if(e)returnalert(LLMS.l10n.translate("An error occurred while trying to load the questions. Please refresh the page and try again.")),this;LLMS.Spinner.stop(this.$el),this.render_subview("list",{el:"#llms-quiz-questions",collection:this.model.get("questions")});vart=this.get_subview("list").instance;t.quiz=this,t.collection.on("add",function(){t.collection.trigger("reorder")},this),t.on("sortStart",t.sortable_start),t.on("sortStop",t.sortable_stop)},this)),this.model.on("new-question-added",function(){vare=this.$el.find("#llms-quiz-questions");e.animate({scrollTop:e.prop("scrollHeight")},200)},this)}returnthis},render_points:function(e,t){this.$el.find("#llms-quiz-total-points").text(t)},bulk_toggle:function(t){vari="expand"===e(t.target).attr("data-action");this.model.get("questions").each(function(e){e.set("_expanded",i)})},add_new_quiz:function(){vare=this.lesson.get("quiz");_.isEmpty(e)?e=this.lesson.add_quiz():this.lesson.set("quiz_enabled","yes"),this.model=e,this.render()},add_existing_quiz:function(e){this.post_search_popover.hide();vart=e.data;"clone"===e.action?t=_.prepareQuizObjectForCloning(t):(t=_.prepareExistingPostObjectDataForAddingOrCloning(t),t._forceSync=!0),deletet.lesson_id,this.lesson.add_quiz(t),this.model=this.lesson.get("quiz"),this.render()},add_existing_quiz_click:function(e){e.preventDefault(),this.post_search_popover=newi({el:"#llms-existing-quiz",args:{backdrop:!0,closeable:!0,container:".wrap.lifterlms.llms-builder",dismissible:!0,placement:"left",width:480,title:LLMS.l10n.translate("Add Existing Quiz"),content:newn({post_type:"llms_quiz",searching_message:LLMS.l10n.translate("Search for existing quizzes...")}).render().$el,onHide:function(){Backbone.pubSub.off("quiz-search-select")}}}),this.post_search_popover.show(),Backbone.pubSub.once("quiz-search-select",this.add_existing_quiz,this)},on_trashed:function(e){this.lesson.set("quiz_enabled","no"),this.lesson.set("quiz",""),deletethis.model,this.render()},show_tools:function(){vare=newi({el:"#llms-show-question-bank",args:{backdrop:!0,closeable:!0,container:"#llms-builder-sidebar",dismissible:!0,placement:"top-left",width:"calc( 100% - 40px )",title:LLMS.l10n.translate("Add a Question"),url:"#llms-quiz-tools"}});e.show(),this.model.on("new-question-added",function(){e.hide()})},get_question_list:function(e){returnnewo(e)}},r,a,c,d,l))}),n("Views/Assignment",["Views/Popover","Views/PostSearch","Views/_Detachable","Views/_Editable","Views/_Trashable","Views/_Subview","Views/SettingsFields"],function(e,t,i,n,s,o,l){returnBackbone.View.extend(_.defaults({state:"default",views:{settings:{class:l,instance:null,state:"default"}},el:"#llms-editor-assignment",events:function(){vare=this.is_addon_available()?window.llms_builder.assignments.get_view_events():{};return_.defaults({"click #llms-existing-assignment":"add_existing_assignment_click","click #llms-new-assignment":"add_new_assignment"},i.events,n.events,s.events,e)},tagName:"div",template:wp.template("llms-assignment-template"),initialize:function(e){this.lesson=e.lesson,"yes"!==this.lesson.get("assignment_enabled")&&_.isEmpty(this.lesson.get("assignment"))||(this.model=this.lesson.get("assignment"),this.model.set_parent(this.lesson)),this.on("model-trashed",this.on_trashed)},render:function(){returnthis.$el.html(this.template(this.model)),this.model&&this.is_addon_available()&&(this.stopListening(this.model,"change:assignment_type",this.render),this.render_subview("settings",{el:"#llms-assignment-settings-fields",model:this.model}),this.init_selects(),window.llms_builder.assignments.render_editor(this),this.listenTo(this.model,"change:assignment_type",this.render)),this},add_new_assignment:function(){this.is_addon_available()?(this.model=window.llms_builder.assignments.get_assignment({title:LLMS.l10n.replace("%1$s Assignment",{"%1$s":this.lesson.get("title")}),lesson_id:this.lesson.get("id")}),this.lesson.set("assignment_enabled","yes"),this.lesson.set("assignment",this.model),this.render()):this.show_ad_popover("#llms-new-assignment")},add_existing_assignment:function(e){this.post_search_popover.hide();vart=e.data;"clone"===e.action?t=_.prepareAssignmentObjectForCloning(t):(t=_.prepareExistingPostObjectDataForAddingOrCloning(t),t._forceSync=!0),t.lesson_id=this.lesson.get("id"),t=window.llms_builder.construct.get_model("Assignment",t),this.lesson.set("assignment_enabled","yes"),this.lesson.set("assignment",t),this.model=t,this.render()},add_existing_assignment_click:function(i){i.preventDefault(),this.is_addon_available()?(this.post_search_popover=newe({el:"#llms-existing-assignment",args:{backdrop:!0,closeable:!0,container:".wrap.lifterlms.llms-builder",dismissible:!0,placement:"left",width:480,title:LLMS.l10n.translate("Add Existing Assignment"),content:newt({post_type:"llms_assignment",searching_message:LLMS.l10n.translate("Search for existing assignments...")}).render().$el,onHide:function(){Backbone.pubSub.off("assignment-search-select")}}}),this.post_search_popover.show(),Backbone.pubSub.once("assignment-search-select",this.add_existing_assignment,this)):this.show_ad_popover("#llms-existing-assignment")},is_addon_available:function(){returnwindow.llms_builder.assignments},on_trashed:function(e){this.lesson.set("assignment_enabled","no"),this.lesson.set("assignment",""),deletethis.model,this.render()},show_ad_popover:function(t){vari=LLMS.l10n.translate("Get Your Students Taking Action"),n=LLMS.l10n.translate("Get Assignments Now!");this.ad_popover=newe({el:t,args:{backdrop:!0,closeable:!0,container:".wrap.lifterlms.llms-builder",dismissible:!0,width:380,title:LLMS.l10n.translate("Unlock LifterLMS Assignments"),content:"<h3>"+i+'</h3><p>Great learning content is only half of teaching online. When your learners fully engage, they will take your content and move into action. Remove barriers for your learners by telling them what to do to apply what they just learned. Create graded assignments or simply give them a checklist of action items to complete before moving on.</p><br><p><a class="llms-button-primary" href="https://lifterlms.com/product/lifterlms-assignments?utm_source=LifterLMS%20Plugin&utm_medium=Assignment%20Builder%20Button&utm_campaign=Assignment%20Addon%20Upsell&utm_content=3.17.0" target="_blank">'+n+"</a></p>"}}),this.ad_popover.show()}},i,n,s,o,l))}),n("Views/Editor",["Views/LessonEditor","Views/Quiz","Views/Assignment","Views/_Subview"],function(t,i,n,s){returnBackbone.View.extend(_.defaults({state:"lesson",views:{lesson:{class:t,instance:null,state:"lesson"},assignment:{class:n,instance:null,state:"assignment"},quiz:{class:i,instance:null,state:"quiz"}},el:"#llms-editor",events:{'click .llms-editor-nav a[href="#llms-editor-close"]':"close_editor",'click .llms-editor-nav a:not([href="#llms-editor-close"])':"switch_tab"},tagName:"div",template:wp.template("llms-editor-template"),initialize:function(e){this.SidebarView=e.SidebarView,e.tab&&(this.state=e.tab)},render:function(e){returne=e||{},this.$el.html(this.template(this)),this.render_subviews(_.extend(e,{lesson:this.model})),this},close_editor:function(e){e.preventDefault(),Backbone.pubSub.trigger("sidebar-editor-close"),window.location.hash=""},switch_tab:function(t){t.preventDefault();vari=e(t.target),n=i.attr("data-view");this.$el.find(i.attr("href"));this.set_state(n).render(),this.set_hash(n)},set_hash:function(e){vart="lesson:"+this.model.get("id");"lesson"!==e&&(t+=":"+e),window.location.hash=t}},s))}),n("Views/Elements",["Models/Section","Views/Section","Models/Lesson","Views/Lesson","Views/Popover","Views/PostSearch"],function(t,i,n,s,o,l){returnBackbone.View.extend({el:"#llms-elements",events:{"click #llms-new-section":"add_new_section","click #llms-new-lesson":"add_new_lesson","click #llms-existing-lesson":"add_existing_lesson"},tagName:"div",template:wp.template("llms-elements-template"),initialize:function(e){this.SidebarView=e.SidebarView,this.listenTo(this.SidebarView.CourseView.model.get("sections"),"add",this.maybe_disable_buttons),this.listenTo(this.SidebarView.CourseView.model.get("sections"),"remove",this.maybe_disable_buttons)},render:function(){returnthis.$el.html(this.template()),this.draggable(),this.maybe_disable_buttons(),this},draggable:function(){e("#llms-new-section").draggable({appendTo:"#llms-sections",cancel:!1,connectToSortable:".llms-sections",helper:function(){returnnewi({model:newt}).render().$el},start:function(){e(".llms-sections").addClass("dragging")},stop:function(){e(".llms-sections").removeClass("dragging")}}),e("#llms-new-lesson").draggable({appendTo:"#llms-sections",cancel:!1,connectToSortable:".llms-lessons",helper:function(){returnnews({model:newn}).render().$el},start:function(){e(".llms-lessons").addClass("dragging")},stop:function(){e(".llms-lessons").removeClass("dragging"),e(".drag-expanded").removeClass(".drag-expanded")}})},add_new_section:function(e){e.preventDefault(),Backbone.pubSub.trigger("add-new-section")},add_new_lesson:function(e){e.preventDefault(),Backbone.pubSub.trigger("add-new-lesson")},add_existing_lesson:function(e){e.preventDefault();vart=newo({el:"#llms-existing-lesson",args:{backdrop:!0,closeable:!0,container:".wrap.lifterlms.llms-builder",dismissible:!0,placement:"left",width:480,title:LLMS.l10n.translate("Add Existing Lesson"),content:newl({post_type:"lesson",searching_message:LLMS.l10n.translate("Search for existing lessons...")}).render().$el}});t.show(),Backbone.pubSub.on("lesson-search-select",function(){t.hide()})},maybe_disable_buttons:function(){vart=e("#llms-new-lesson, #llms-existing-lesson");this.SidebarView.CourseView.model.get("sections").length?t.removeAttr("disabled"):t.attr("disabled","disabled")}})}),n("Views/Utilities",[],function(){returnBackbone.View.extend({el:"#llms-utilities",events:{"click #llms-collapse-all":"collapse_all","click #llms-expand-all":"expand_all"},tagName:"div",template:wp.template("llms-utilities-template"),initialize:function(){},render:function(){returnthis.$el.html(this.template()),this},collapse_all:function(e){e.preventDefault(),Backbone.pubSub.trigger("collapse-all")},expand_all:function(e){e.preventDefault(),Backbone.pubSub.trigger("expand-all")}})}),n("Views/Sidebar",["Views/Editor","Views/Elements","Views/Utilities","Views/_Subview"],function(t,i,n,s){returnBackbone.View.extend(_.defaults({state:"builder",views:{elements:{class:i,instance:null,state:"builder"},utilities:{class:n,instance:null,state:"builder"},editor:{class:t,instance:null,state:"editor"}},el:"#llms-builder-sidebar",events:{"click #llms-save-button":"save_now","click #llms-exit-button":"exit_now","click .llms-builder-error":"clear_errors"},tagName:"aside",template:wp.template("llms-sidebar-template"),initialize:function(t){this.CourseView=t.CourseView,this.render(),Backbone.pubSub.on("current-save-status",this.changes_made,this),Backbone.pubSub.on("heartbeat-send",this.heartbeat_send,this),Backbone.pubSub.on("heartbeat-tick",this.heartbeat_tick,this),Backbone.pubSub.on("lesson-selected",this.on_lesson_select,this),Backbone.pubSub.on("sidebar-editor-close",this.on_editor_close,this),this.$saveButton=e("#llms-save-button")},render:function(t){t=t||{},this.$el.html(this.template()),this.render_subviews(_.extend(t,{SidebarView:this}));vari=e(".wrap.lifterlms.llms-builder");return"builder"===this.state?i.removeClass("editor-active"):i.addClass("editor-active"),this.$saveButton=this.$el.find("#llms-save-button"),this},add_error:function(e){this.$el.find(".llms-builder-save").prepend(e)},clear_errors:function(){this.$el.find(".llms-builder-save .llms-builder-error").remove()},changes_made:function(e){e.saving||(e.has_unsaved_changes?(this.$saveButton.attr("data-status","unsaved"),this.$saveButton.removeAttr("disabled")):(this.$saveButton.attr("data-status","saved"),this.$saveButton.attr("disabled","disabled")))},exit_now:function(){window.location.href=window.llms_builder.CourseModel.get_edit_post_link()},heartbeat_send:function(e){e.saving&&(LLMS.Spinner.start(this.$saveButton.find("i"),"small"),this.$saveButton.attr({"data-status":"saving",disabled:"disabled"}))},heartbeat_tick:function(t,i){if(!t.saving){varn="saved";if(this.clear_errors(),"error"===i.status){n="error";vars=i.message,o=e('<ol class="llms-builder-error" />');"object"==typeofs?_.each(s,function(e){o.append("<li>"+e+"</li>")}):o=o.append("<li>"+s+"</li>"),this.add_error(o)}this.$saveButton.find(".llms-spinning").remove(),this.$saveButton.attr({"data-status":n,disabled:"disabled"})}},is_editor_active:function(){return"editor"===this.state},on_editor_close:function(){this.set_state("builder").render()},on_lesson_select:function(e,t){"editor"!==this.state?this.set_state("editor"):this.remove_subview("editor"),this.render({model:e,tab:t})},save_now:function(){window.llms_builder.sync.save_now()}},s))}),i(["vendor/wp-hooks","vendor/backbone.collectionView","vendor/backbone.trackit","Controllers/Construct","Controllers/Debug","Controllers/Schemas","Controllers/Sync","Models/loader","Views/Course","Views/Sidebar"],function(t,i,n,s,o,l,r,a,c,d){functionu(e,t){return_.isArray(t)&&-1!==t.indexOf(e)||e==t}window.llms_builder.debug=newo(window.llms_builder.debug),window.llms_builder.construct=news,window.llms_builder.schemas=newl(window.llms_builder.schemas),_.mixin({checked:function(e,t){returnu(e,t)?' checked="checked"':""},deepClone:function(e){vart=_.clone(e);return_.each(t,function(e,i){!_.isFunction(e)&&_.isObject(e)&&(t[i]=_.deepClone(e))}),t},getEditor:function(){if(void0!==wp.oldEditor){vare=wp.oldEditor;returnvoid0!==wp.editor&&void0!==wp.editor.getDefaultSettings&&(e.getDefaultSettings=wp.editor.getDefaultSettings),e}if(void0!==wp.editor&&void0!==wp.editor.autop)returnwp.editor},prepareQuizObjectForCloning:function(e){returndeletee.id,deletee.lesson_id,_.each(e.questions,function(e){e=_.prepareQuestionObjectForCloning(e)}),e=_.prepareExistingPostObjectDataForAddingOrCloning(e)},prepareQuestionObjectForCloning:function(e){returndeletee.id,deletee.parent_id,e.image&&_.isObject(e.image)&&(e.image._forceSync=!0),e.choices&&_.each(e.choices,function(e){deletee.question_id,deletee.id,"image"===e.choice_type&&_.isObject(e.choice)&&(e.choice._forceSync=!0)}),e=_.prepareExistingPostObjectDataForAddingOrCloning(e)},prepareAssignmentObjectForCloning:function(e){returndeletee.id,deletee.lesson_id,"tasklist"===e.assignment_type&&_.each(e.tasks,function(e){deletee.id,deletee.assignment_id}),e=_.prepareExistingPostObjectDataForAddingOrCloning(e)},prepareExistingPostObjectDataForAddingOrCloning:function(e){returne.author&&_.isObject(e.author)&&e.author.id&&(e.author=e.author.id),e},selected:function(e,t){returnu(e,t)?' selected="selected"':""},stripFormatting:function(t,i){i||(i=["b","i","u","strong","em"]);varn=e("<div>"+t+"</div>");returnn.find("*").not(i.join(",")).each(function(){e(this).replaceWith(this.innerHTML)}),n.html()}}),Backbone.pubSub=_.extend({},Backbone.Events),e(document).trigger("llms-builder-pre-init"),window.llms_builder.questions=window.llms_builder.construct.get_collection("QuestionTypes",window.llms_builder.questions);varh=window.llms_builder.construct.get_model("Course",window.llms_builder.course);window.llms_builder.CourseModel=h,window.llms_builder.sync=newr(h,window.llms_builder.sync);varp=newc({model:h}),g=newd({CourseView:p});if(e(document).trigger("llms-builder-init",{course:p,sidebar:g}),window.location.hash){varm=window.location.hash;if(-1===m.indexOf("#lesson:"))return;varf=m.replace("#lesson:","").split(":"),b=e("#llms-lesson-"+f[0]);b.length&&LLMS.wait_for(function(){returnvoid0!==_.getEditor()&&void0!==window.tinymce},function(){b.closest(".llms-builder-item.llms-section").find("a.llms-action-icon.expand").trigger("click");vart=f[1]?f[1]:"lesson";e("#llms-lesson-"+f[0]).find("a.llms-action-icon.edit-"+t).trigger("click")})}}),n("main",function(){})}(jQuery);//# sourceMappingURL=../maps/js/llms-builder.min.js.map