function SidebarTeachablesHelpManager(n,t,i){var r=this;r.Visible=ko.observable(n);r.HelpArticle=ko.observable(null);r.HelpArticleLoading=ko.observable(!1);r.WalkthroughsAvailable=function(){return!!window.inline_manual_player};r.PageTitle=ko.computed(function(){return r.Visible()?r.HelpArticle()!=null?r.HelpArticle().Title:"Help":"Help"});r.ToggleVisible=function(){r.Visible(!r.Visible());r.SaveHelpVisibilityToServer()};r.TurnOffHelp=function(){r.Visible(!1);r.SaveHelpVisibilityToServer()};r.SaveHelpVisibilityToServer=function(){var n=t.apiPartyDisplaySettings+"/Help/"+(r.Visible()?"true":"false");return $.ajax(n,{data:{},type:"post",contentType:"application/json; charset=utf-8'",error:function(){}})};r.ShowHelpArticle=function(n,t){r.HelpArticleLoading()||(r.HelpArticle()==null||r.HelpArticle().Id!==n)&&(r.HelpArticleLoading(!0),i.get("/api/FreshdeskApi/Article?id="+n).then(function(i){i.Url=t?"https://help.iugo.co.nz/support/solutions/articles/"+n+"-"+t:null;r.HelpArticle(i);r.HelpArticleLoading(!1)}).fail(function(n){console.log(n);r.HelpArticleLoading(!1)}))};r.HideHelpArticle=function(){r.HelpArticle(null)};r.StartWalkthrough=function(n){!window.inline_manual_player||window.inline_manual_player.activateTopic(n)};ko.postbox.subscribe("show-help-article",function(n){r.ShowHelpArticle(n.articleId,n.articleSlug)});window.sidebar_article_ready=!0}function getSeriesIndex(){return"/Store/StoreFront/Index"}function getQueryStringParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t==null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function queryStringCategoryIdVariable(){return"cat"}function queryStringCategoryId(){return getQueryStringParameterByName(queryStringCategoryIdVariable)}function queryStringAuthorIdVariable(){return"aut"}function queryStringAuthorId(){return GetQueryStringParameterByName(queryStringAuthorIdVariable)}function queryStringOrderByIdVariable(){return"orderBy"}function queryStringOrderById(){return getQueryStringParameterByName(queryStringOrderByIdVariable)}var Client;!function(n){var t=function(t,i){var r,u;this.element=n(t);this.picker=n('<div class="slider"><div class="slider-track"><div class="slider-selection"><\/div><div class="slider-handle"><\/div><div class="slider-handle"><\/div><\/div><div class="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div><\/div>').insertBefore(this.element).append(this.element);this.id=this.element.data("slider-id")||i.id;this.id&&(this.picker[0].id=this.id);r=this.element.data("slider-tooltip")||i.tooltip;this.tooltip=this.picker.find(".tooltip");this.tooltipInner=this.tooltip.find("div.tooltip-inner");this.orientation=this.element.data("slider-orientation")||i.orientation;switch(this.orientation){case"vertical":this.picker.addClass("slider-vertical");this.stylePos="top";this.mousePos="pageY";this.sizePos="offsetHeight";this.tooltip.addClass("right")[0].style.left="100%";break;default:this.picker.addClass("slider-horizontal").css("width",this.element.outerWidth());this.orientation="horizontal";this.stylePos="left";this.mousePos="pageX";this.sizePos="offsetWidth";this.tooltip.addClass("top")[0].style.top=-this.tooltip.outerHeight()-14+"px"}this.min=this.element.data("slider-min")||i.min;this.max=this.element.data("slider-max")||i.max;this.step=this.element.data("slider-step")||i.step;this.value=this.element.data("slider-value")||i.value;this.value[1]&&(this.range=!0);this.selection=this.element.data("slider-selection")||i.selection;this.selectionEl=this.picker.find(".slider-selection");this.selection==="none"&&this.selectionEl.addClass("hide");this.selectionElStyle=this.selectionEl[0].style;this.handle1=this.picker.find(".slider-handle:first");this.handle1Stype=this.handle1[0].style;this.handle2=this.picker.find(".slider-handle:last");this.handle2Stype=this.handle2[0].style;u=this.element.data("slider-handle")||i.handle;switch(u){case"round":this.handle1.addClass("round");this.handle2.addClass("round");break;case"triangle":this.handle1.addClass("triangle");this.handle2.addClass("triangle")}if(this.range?(this.value[0]=Math.max(this.min,Math.min(this.max,this.value[0])),this.value[1]=Math.max(this.min,Math.min(this.max,this.value[1]))):(this.value=[Math.max(this.min,Math.min(this.max,this.value))],this.handle2.addClass("hide"),this.value[1]=this.selection=="after"?this.max:this.min),this.diff=this.max-this.min,this.percentage=[(this.value[0]-this.min)*100/this.diff,(this.value[1]-this.min)*100/this.diff,this.step*100/this.diff],this.offset=this.picker.offset(),this.size=this.picker[0][this.sizePos],this.formater=i.formater,this.layout(),this.touchCapable)this.picker.on({touchstart:n.proxy(this.mousedown,this)});else this.picker.on({mousedown:n.proxy(this.mousedown,this)});if(r==="show")this.picker.on({mouseenter:n.proxy(this.showTooltip,this),mouseleave:n.proxy(this.hideTooltip,this)});else this.tooltip.addClass("hide")};t.prototype={constructor:t,over:!1,inDrag:!1,showTooltip:function(){this.tooltip.addClass("in");this.over=!0},hideTooltip:function(){this.inDrag===!1&&this.tooltip.removeClass("in");this.over=!1},layout:function(){this.handle1Stype[this.stylePos]=this.percentage[0]+"%";this.handle2Stype[this.stylePos]=this.percentage[1]+"%";this.orientation=="vertical"?(this.selectionElStyle.top=Math.min(this.percentage[0],this.percentage[1])+"%",this.selectionElStyle.height=Math.abs(this.percentage[0]-this.percentage[1])+"%"):(this.selectionElStyle.left=Math.min(this.percentage[0],this.percentage[1])+"%",this.selectionElStyle.width=Math.abs(this.percentage[0]-this.percentage[1])+"%");this.range?(this.tooltipInner.text(this.formater(this.value[0])+" : "+this.formater(this.value[1])),this.tooltip[0].style[this.stylePos]=this.size*(this.percentage[0]+(this.percentage[1]-this.percentage[0])/2)/100-(this.orientation==="vertical"?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px"):(this.tooltipInner.text(this.formater(this.value[0])),this.tooltip[0].style[this.stylePos]=this.size*this.percentage[0]/100-(this.orientation==="vertical"?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px")},mousedown:function(t){var i,u,f,r;if(this.touchCapable&&t.type==="touchstart"&&(t=t.originalEvent),this.offset=this.picker.offset(),this.size=this.picker[0][this.sizePos],i=this.getPercentage(t),this.range?(u=Math.abs(this.percentage[0]-i),f=Math.abs(this.percentage[1]-i),this.dragged=u<f?0:1):this.dragged=0,this.percentage[this.dragged]=i,this.layout(),this.touchCapable)n(document).on({touchmove:n.proxy(this.mousemove,this),touchend:n.proxy(this.mouseup,this)});else n(document).on({mousemove:n.proxy(this.mousemove,this),mouseup:n.proxy(this.mouseup,this)});return this.inDrag=!0,r=this.calculateValue(),this.element.trigger({type:"slideStart",value:r}).trigger({type:"slide",value:r}),!1},mousemove:function(n){var t,i;return this.touchCapable&&n.type==="touchmove"&&(n=n.originalEvent),t=this.getPercentage(n),this.range&&(this.dragged===0&&this.percentage[1]<t?(this.percentage[0]=this.percentage[1],this.dragged=1):this.dragged===1&&this.percentage[0]>t&&(this.percentage[1]=this.percentage[0],this.dragged=0)),this.percentage[this.dragged]=t,this.layout(),i=this.calculateValue(),this.element.trigger({type:"slide",value:i}).data("value",i).prop("value",i),!1},mouseup:function(){this.touchCapable?n(document).off({touchmove:this.mousemove,touchend:this.mouseup}):n(document).off({mousemove:this.mousemove,mouseup:this.mouseup});this.inDrag=!1;this.over==!1&&this.hideTooltip();this.element;var t=this.calculateValue();return this.element.trigger({type:"slideStop",value:t}).data("value",t).prop("value",t),!1},calculateValue:function(){var n;return this.range?(n=[this.min+Math.round(this.diff*this.percentage[0]/100/this.step)*this.step,this.min+Math.round(this.diff*this.percentage[1]/100/this.step)*this.step],this.value=n):(n=this.min+Math.round(this.diff*this.percentage[0]/100/this.step)*this.step,this.value=[n,this.value[1]]),n},getPercentage:function(n){this.touchCapable&&(n=n.touches[0]);var t=(n[this.mousePos]-this.offset[this.stylePos])*100/this.size;return t=Math.round(t/this.percentage[2])*this.percentage[2],Math.max(0,Math.min(100,t))},getValue:function(){return this.range?this.value:this.value[0]},setValue:function(n){this.value=n;this.range?(this.value[0]=Math.max(this.min,Math.min(this.max,this.value[0])),this.value[1]=Math.max(this.min,Math.min(this.max,this.value[1]))):(this.value=[Math.max(this.min,Math.min(this.max,this.value))],this.handle2.addClass("hide"),this.value[1]=this.selection=="after"?this.max:this.min);this.diff=this.max-this.min;this.percentage=[(this.value[0]-this.min)*100/this.diff,(this.value[1]-this.min)*100/this.diff,this.step*100/this.diff];this.layout()}};n.fn.slider=function(i,r){return this.each(function(){var f=n(this),u=f.data("slider"),e=typeof i=="object"&&i;u||f.data("slider",u=new t(this,n.extend({},n.fn.slider.defaults,e)));typeof i=="string"&&u[i](r)})};n.fn.slider.defaults={min:0,max:10,step:1,orientation:"horizontal",value:5,selection:"before",tooltip:"show",handle:"round",formater:function(n){return n}};n.fn.slider.Constructor=t}(window.jQuery);var ApprovalOfferPageForm=function(n){var t=this;n.Response===0&&(n.Response=undefined);ko.utils.extend(t,ko.mapping.fromJS(n))},ApprovalOfferPage=function(n,t){var i=this;console.log(n);ko.utils.extend(i,new Store(n,t,{}));i.WasViewed=ko.observable(n.ApprovalOffer.DateViewed!=null);i.IsViewed=ko.observable(n.ApprovalOffer.DateViewed!=null);i.ProductPreviews=ko.observableArray([]);i.showProductPreviews=function(r){var f=".product-preview-gallery-mobile",u=_.find(n.ApprovalOffer.Products,function(n){return n.Id===r}),e;if(u){if(u.PrivateProductPreviews&&u.PrivateProductPreviews.length>0)i.ProductPreviews(u.PrivateProductPreviews);else if(u.ProductPreviews&&u.ProductPreviews.length>0)i.ProductPreviews(u.ProductPreviews);else{common.NotifyWithDuration("No previews available for this product",5e3);return}e={delegate:"a",type:"image",preload:[0,2],gallery:{enabled:!0}};$(f).magnificPopup(e);$(f).magnificPopup("open");i.IsViewed()||t.MarkApprovalOfferAsViewed(n.ApprovalOffer.Id).then(function(){i.IsViewed(!0)})}};i.AddAllToCart=function(){return i.AddMultipleProductPrices(n.ApprovalOffer.ProductPriceIds).then(function(){window.location=n.CartUrl})};i.Feedback=ko.observable(n.ApprovalOffer.Comment?n.ApprovalOffer.Comment:"");i.HasFeedback=ko.observable(!!n.ApprovalOffer.Comment);i.SubmitFeedback=function(){t.SaveApprovalOfferFeedback(n.ApprovalOffer.Id,i.Feedback()).then(function(){i.HasFeedback(!0);common.Notify("Your feedback has been submitted")})}},ApprovalPageForm=function(n){var t=this;n.Response===0&&(n.Response=undefined);ko.utils.extend(t,ko.mapping.fromJS(n));t.PasswordConfirm=ko.observable("");t.KeepingProducts=ko.computed(function(){return t.Response()=="1"?t.Products():_.filter(t.Products(),function(n){return n.IsKeepingBook()})});t.ReturningProducts=ko.computed(function(){return t.Response()=="2"?t.Products():_.filter(t.Products(),function(n){return!n.IsKeepingBook()})});t.ChangingProducts=ko.computed(function(){return _.filter(t.Products(),function(n){return n.IsAddingEbook()})});t.Response.subscribe(function(n){(n=="1"||n=="3"||n=="21")&&_.each(t.Products(),function(n){n.IsKeepingBook(!0);n.IsAddingEbook(!1)});n=="2"&&_.each(t.Products(),function(n){n.IsKeepingBook(!1);n.IsAddingEbook(!1)})});t.OrderHasParty=ko.computed(function(){return t.HasParty()||t.HasRespondingParty()});t.CanAddEbook=ko.computed(function(){return _.some(t.Products(),function(n){return n.ComboUpgradePrice()>0})});t.EbookPrice=ko.computed(function(){var n=_.filter(t.Products(),function(n){return n.ComboUpgradePrice()>0});return n.length===0?0:n[0].ComboUpgradePrice()});t.ShowRegistrationFlow=ko.computed(function(){return t.ChangingProducts().length>0&&!t.OrderHasParty()});t.ExpectedProductReturnDate(moment());t.ExpectedInvoicePaymentDate(moment(t.InvoiceDueDate()));t.ExtensionDate(moment().add(7,"days").format("YYYY-MM-DD"));t.CardExpiryMonth(undefined);t.CardExpiryYear(undefined);t.CalculateBookPriceDifference=function(n){return n.IsKeepingBook()&&!n.IsAddingEbook()?0:n.IsKeepingBook()&&n.IsAddingEbook()?n.ComboPrice()-n.OriginalPrice():!n.IsKeepingBook()&&n.IsAddingEbook()?n.EbookPrice()-n.OriginalPrice():!n.IsKeepingBook()&&!n.IsAddingEbook()?-n.OriginalPrice():0};t.UpdatedInvoiceTotal=ko.computed(function(){var n=_.map(t.Products(),function(n){return t.CalculateBookPriceDifference(n)});return t.OriginalInvoiceTotal()+_.sum(n)});t.InvoiceTotal=ko.computed(function(){var i=t.UpdatedInvoiceTotal(),n=t.OriginalInvoiceTotal();switch(t.Response()){case"1":case"3":case"21":n=i;break;case"2":n=0}return n});t.SetSchoolInvoicing=function(n){t.IsSchoolInvoicing(n)};t.ConfigureValidation=function(){ko.validation.init({registerExtenders:!0,insertMessages:!0,messagesOnModified:!0,errorElementClass:"has-error",errorMessageClass:"help-block",decorateElement:!0,decorateInputElement:!0,decorateElementOnModified:!0},!0);t.Response.extend({required:{message:"*"}});t.ResponderName.extend({required:{message:"Required"}});t.ExpectedInvoicePaymentDate.extend({required:{message:"Required",onlyIf:function(){return t.IsSchoolInvoicing()}}});t.ExpectedProductReturnDate.extend({required:{message:"Required",onlyIf:function(){return t.Response()=="2"||t.Response()=="3"}}});t.CardNumber.extend({required:{message:"Required",onlyIf:function(){return!t.IsSchoolInvoicing()}},minLength:15,maxLength:19});t.NameOnCard.extend({required:{message:"Required",onlyIf:function(){return!t.IsSchoolInvoicing()}}});t.CardExpiryMonth.extend({required:{message:"Required",onlyIf:function(){return!t.IsSchoolInvoicing()}},number:!0,minLength:1,maxLength:2,min:1,max:12});t.CardExpiryYear.extend({required:{message:"Required",onlyIf:function(){return!t.IsSchoolInvoicing()}},number:!0,minLength:1,maxLength:5,min:(new Date).getFullYear()});t.EmailAddress.extend({required:{message:"Required",onlyIf:function(){return t.ShowRegistrationFlow()}}});t.Password.extend({required:{message:"Required",onlyIf:function(){return t.ShowRegistrationFlow()}}});t.FirstName.extend({required:{message:"Required",onlyIf:function(){return t.ShowRegistrationFlow()&&!t.EmailExists()}}});t.LastName.extend({required:{message:"Required",onlyIf:function(){return t.ShowRegistrationFlow()&&!t.EmailExists()}}});t.PasswordConfirm.extend({required:{message:"Required",onlyIf:function(){return t.ShowRegistrationFlow()&&!t.EmailExists()}}});t.PasswordConfirm.extend({mustEqual:{params:t.Password,onlyIf:function(){return t.ShowRegistrationFlow()&&!t.EmailExists()}}})};t.GetObject=function(){var n=ko.mapping.toJS(t);return n.ExpectedInvoicePaymentDate=moment(n.ExpectedInvoicePaymentDate).format("YYYY-MM-DD"),n.ExpectedProductReturnDate=moment(n.ExpectedProductReturnDate).format("YYYY-MM-DD"),n.CardNumber&&(n.CardNumber=n.CardNumber.replace(/\s/g,"")),n}},ApprovalPage=function(n,t){var i=this;ko.utils.extend(i,new Store(n,t,{}));i.FormData=ko.validatedObservable(new ApprovalPageForm(n.ApprovalOrder));i.FormData().ConfigureValidation();i.ShowPaymentError=ko.observable(!1);i.PaymentErrorDetails=ko.observable("");i.Processing=ko.observable(!1);i.Submitted=ko.observable(!1);i.CanSubmit=ko.computed(function(){return i.FormData.errors().length===0});i.ScrollToTop=function(){$("#top").scrollintoview()};i.Submit=function(){if(i.ShowPaymentError(!1),i.FormData.errors&&i.FormData.errors().length>0){i.FormData.errors.showAllMessages();return}i.Processing(!0);i.ScrollToTop();var n=i.FormData().GetObject(),r=function(){i.Processing(!1);i.Submitted(!0)},u=function(n){if(console.log(n),i.Processing(!1),n.responseJSON){var t=n.responseJSON;console.log(t);t.HasError?(i.PaymentErrorDetails(t.ErrorMessage),i.ShowPaymentError(!0)):common.ProcessAjaxError(n)}else common.ProcessAjaxError(n)};t.SaveApprovalResponse(n).then(r,u)};i.ShowEmailError=ko.observable(!1);i.ShowLoginPanel=ko.observable(!1);i.ShowRegisterPanel=ko.observable(!1);i.CheckEmail=function(){var n=i.FormData().EmailAddress(),r=function(n){i.FormData().EmailExists(!!n);i.ShowLoginPanel(!!n);i.ShowRegisterPanel(!n)};t.UserSearch(n).then(r)}},Author=function(n){var t=this;ko.utils.extend(t,n);t.last=ko.observable(!1);t.Url=ko.computed(function(){return"/Store/Author/Detail/"+t.Code});t.DisplayName=ko.computed(function(){return t.FirstName+" "+t.LastName})},AuthorDetailPage=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i))},AuthorDetails=function(n){var t=this;ko.utils.extend(t,new Author(n));t.PromotionTextParagraph=n.PromotionTextParagraph},AuthorList=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i))},Basket=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i));r.id=n.Id;r.basketLines=ko.observableArray();r.wishlist=ko.observable(null);r.BasketTotalsBreakdownModel=ko.observable(ko.mapping.fromJS(n.BasketTotalsBreakdownModel));r.DisplayQuickAdd=ko.observable(!0);r.QuickAddSearchTerm=ko.observable();r.QuickAddSearchRun=ko.observable(!1);r.QuickAddSearchResult=ko.observable(null);r.QuickAddMatchedOnCode=ko.observable(!1);r.QuickAddMatchedOnIsbn=ko.observable(!1);r.ToggleDisplayQuickAdd=function(){r.DisplayQuickAdd(!r.DisplayQuickAdd())};r.QuickAddSearch=function(){t.QuickAddSearch(r.QuickAddSearchTerm()).then(function(n){common.FacebookEvent("Search");r.QuickAddSearchRun(!0);r.QuickAddSearchResult(n)},common.ProcessAjaxError)};r.QuickAddToBasket=function(n){common.FacebookEvent("AddToCart");r.SaveBasketLineSpecific(n.Id,1);r.QuickAddSearchTerm(null);r.QuickAddSearchResult(null);r.QuickAddSearchRun(!1)};r.RefreshWishlist=function(){t.GetWishlist(r.storeSession().id).then(function(n){r.SetWishList(n)},common.ProcessAjaxError)};r.SetWishList=function(n){r.wishlist(new ProductListScroller(n,i.page,i.of,"Your Wishlist","wishlist"));r.SetWorkingWidth()};r.RefreshWishlist=function(){t.GetWishlist(r.storeSession().id).then(function(n){r.SetWishList(n)},common.ProcessAjaxError)};r.SetWorkingWidth=function(){r.wishlist()&&r.wishlist().SetWorkingWidth()};r.WishlistHasItemsWithNoPrices=ko.computed(function(){if(!r.wishlist()||r.wishlist().products().length===0)return!1;var n=ko.utils.arrayFilter(r.wishlist().products(),function(n){return n.ProductPrices().length>0});return n.length===0});r.PopulateBasketLines=function(n){var t,i;if(r.basketLines.removeAll(),n&&n.length!==0)for(t=0;t<n.length;t++)i=new BasketLine(n[t]),i.Basket=r,r.basketLines.push(i)};r.UpdateQuantity=function(n){r.SaveBasketLineSpecific(n.productPrice().Id,n.quantity());n.quantity()<=0&&r.DeleteBasketLineFromUI(n)};r.SubTotal=ko.computed(function(){for(var i,t=0,n=0;n<r.basketLines().length;n++)i=r.basketLines()[n],t+=i.subtotal();return t.toFixed(2)});r.TotalItems=ko.computed(function(){for(var i,t=0,n=0;n<r.basketLines().length;n++)i=r.basketLines()[n],t+=parseInt(i.quantity());return t});r.DeleteBasketLine=function(n){n.quantity(0)};r.DeleteBasketLineFromUI=function(n){r.basketLines.remove(n)};r.MoveBasketLine=function(n){r.SaveWishlistItem(n.product);n.quantity(0)};r.PopulateBasketLines(n.BasketLineViewModels);r.RefreshBasketLines=function(){console.log("REfreshBasketLines");t.GetBasket(r.storeSession().id).then(function(n){r.PopulateBasketLines(n)},common.ProcessAjaxError);t.GetPromoMessage(r.storeSession().id).then(function(n){r.storeSession().promoMessages(n)},common.ProcessAjaxError);r.RefreshPriceBreakdown()};r.RefreshPriceBreakdown=function(){t.GetPriceBreakdown(r.storeSession().id).then(function(n){r.BasketTotalsBreakdownModel(ko.mapping.fromJS(n))},common.ProcessAjaxError)};r.SetPostBasketChange(r.RefreshBasketLines);r.SetPostWishlistChange(r.RefreshWishlist);r.SetWishList(n.Wishlist);r.CheckoutStageManager=new CheckoutStageManager;r.CheckoutStageManager.SetStageBasket();r.RefreshPriceBreakdown=function(){t.GetPriceBreakdown(r.storeSession().id).then(function(n){r.BasketTotalsBreakdownModel(ko.mapping.fromJS(n))})};r.PromoCodeManager=new PromoCodeManager(t,r.storeSession,r.BasketTotalsBreakdownModel(),r.RefreshPriceBreakdown)},BasketLine=function(n){var t=this;t.id=n.Id;t.product=new Product(n.Product);t.productPrice=ko.observable(new ProductPrice(n.ProductPrice));t.quantity=ko.observable(n.Quantity);t.promotional=ko.observable(n.Promotional);t.promocode=ko.observable(n.PromoCode);t.allowQuantityEdit=ko.observable(!n.Product.IsSubscription);t.Basket=null;t.subtotal=ko.computed(function(){return t.productPrice().Price*parseInt("0"+t.quantity(),10)});t.quantity.subscribe(function(){t.Basket.UpdateQuantity(t)});n.ProductCode&&(t.product.Code=n.ProductCode)},BasketLineSetter=function(){var n=this;n.StoreSessionId=null;n.ProductPriceId=null;n.Quantity=null},BasketLogin=function(n,t,i,r){var u=this,f=Client.Common;ko.utils.extend(u,new Store(n,t,i));u.checking=ko.observable(!1);u.basketLines=ko.observableArray();u.BasketTotalsBreakdownModel=ko.observable(ko.mapping.fromJS(n.BasketTotalsBreakdownModel));u.CountryOptions=ko.observableArray(n.CountryOptions);u.PopulateBasketLines=function(n){var t,i;if(u.basketLines.removeAll(),n!==null&&n!==undefined&&n.length!==0)for(t=0;t<n.length;t++)i=new BasketLine(n[t]),i.Basket=u,u.basketLines.push(i)};u.SubTotal=ko.computed(function(){for(var i,t=0,n=0;n<u.basketLines().length;n++)i=u.basketLines()[n],t+=i.subtotal();return t.toFixed(2)});u.TotalItems=ko.computed(function(){for(var i,t=0,n=0;n<u.basketLines().length;n++)i=u.basketLines()[n],t+=parseInt(i.quantity());return t});u.PopulateBasketLines(n.BasketLineViewModels);u.ShowLoginPanel=ko.observable(!1);u.ShowRegisterPanel=ko.observable(!1);u.ShowEmailError=ko.observable(!1);u.EmailAddress=ko.observable("");u.LoginPassword=ko.observable("");u.FirstName=ko.observable("");u.LastName=ko.observable("");u.RegisterPassword=ko.observable("");u.ConfirmPassword=ko.observable("");u.CountryId=ko.observable(n.MarketCountryId);u.CanLogin=ko.computed(function(){return u.EmailAddress().length&&u.LoginPassword().length});u.CanRegister=ko.computed(function(){return u.FirstName().length>0&&u.LastName().length>0&&u.EmailAddress().length>0&&u.RegisterPassword().length>0&&u.ConfirmPassword().length>0});u.PasswordResetManager=new PasswordResetManager(t.urls.apiAccount,r);u.EmailAddress.subscribe(function(n){u.PasswordResetManager.EmailAddress(n)});u.CheckEmail=function(){u.UserSearch(u.EmailAddress())};u.UserSearch=function(n){u.ShowEmailError(!1);var i=f.validateEmail(u.EmailAddress());if(!i){u.ShowEmailError(!0);return}u.checking(!0);t.UserSearch(n).then(function(n){n?(u.ShowLoginPanel(!0),u.ShowRegisterPanel(!1)):(u.ShowLoginPanel(!1),u.ShowRegisterPanel(!0),f.facebookEvent("CompleteRegistration"));setTimeout(function(){u.checking(!1)},300)})};u.PopulateOnReload=function(){n.LoginData&&n.LoginData.LoginEmailAddress&&(u.EmailAddress(n.LoginData.LoginEmailAddress),u.ShowLoginPanel(!0));n.RegisterData&&n.RegisterData.RegisterEmailAddress&&(u.EmailAddress(n.RegisterData.RegisterEmailAddress),u.FirstName(n.RegisterData.FirstName),u.LastName(n.RegisterData.LastName),u.ShowRegisterPanel(!0))};u.PopulateOnReload()};$(document).ready(function(){$(".CategoryMenuItemClickToggle").on("click",function(n){n.preventDefault();var t=$(n.target),i=t.closest(".CategoryMenuItem");return t.hasClass("glyphicon-chevron-down")?(t.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"),i.children(".CategoryMenuItemSubCategories").slideDown()):(t.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down"),i.children(".CategoryMenuItemSubCategories").slideUp()),!1})});var CategoryByProductPage=function(n,t,i){var r=this;n.QueryResult==null&&(n.QueryResult={TotalCount:0,Skip:0,Take:20,Query:{},Results:[]});ko.utils.extend(r,new Store(n,t,i));this.StoreSearch.filterMode(!0);r.items=ko.observableArray();r.initialised=ko.observable(!1);r.allowFurtherLoad=ko.observable(!0);r.loadingFurther=ko.observable(!1);r.totalCount=ko.observable(n.QueryResult.TotalCount);r.skip=ko.observable(n.QueryResult.Skip);r.take=ko.observable(n.QueryResult.Take);r.scrolled=function(){};r.showing=ko.computed(function(){var n=r.totalCount(),t=r.items().length;return n===0?"No results":"Showing 1-"+t+" of "+n+" results"});r.PopulateNext=function(){r.loadingFurther(!0);r.PopulateProductList(!0)};r.PopulateProductList=function(i,u){i===!0&&r.skip(r.skip()+r.take());u===!0&&(r.skip(0),r.take(20));var f=r.GetBaseQuery();f.CategoryOrBelowId=n.QueryResult.Query.CategoryOrBelowId;f.CategoryExactId=n.QueryResult.Query.CategoryExactId;f.ProductOrderByOptionId=n.QueryResult.Query.ProductOrderByOptionId;f.FilterProductTheme=r.StoreSearch.filterProductTheme();f.FilterProductTopic=r.StoreSearch.filterProductTopic();f.FilterProductResourceType=r.StoreSearch.filterProductResourceType();f.FromAge=r.StoreSearch.fromAge();f.ToAge=r.StoreSearch.toAge();t.PopulateProducts(f).then(function(n){u===!0&&r.items([]);r.PopulateProductData(n.QueryResult?n.QueryResult:n)},common.ProcessAjaxError)};r.PopulateProductData=function(n){var t=$.map(n.Results,function(n){return new Product(n)});r.AddProduct(t);r.UpdateForQueryResult(n);r.loadingFurther(!1);r.initialised(!0)};r.GetBaseQuery=function(){var n=new ProductQuery;return n.take=r.take(),n.skip=r.skip(),n};r.UpdateForQueryResult=function(n){r.totalCount(n.TotalCount);r.take(n.Take);r.skip(n.Skip);r.allowFurtherLoad(r.items().length<r.totalCount())};r.AddProduct=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=r.items().length+1,i.Hydrate(),r.items.push(i)};r.PopulateProductData(n.QueryResult);r.FilterProductList=function(){r.PopulateProductList(!1,!0)};ko.postbox.subscribe("age.ranges.changed",r.FilterProductList);ko.postbox.subscribe("product.attributes.changed",r.FilterProductList)},CategoryBySeriesPage=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i));r.series=ko.observableArray();r.expandedSeries=ko.observable();r.initialised=ko.observable(!1);r.allowFurtherLoad=ko.observable(!0);r.loadingFurther=ko.observable(!1);r.totalCount=ko.observable(n.QueryResult?n.QueryResult.TotalCount:0);r.skip=ko.observable(n.QueryResult?n.QueryResult.Skip:0);r.take=ko.observable(n.QueryResult?n.QueryResult.Take:20);r.scrolled=function(){};r.showing=ko.computed(function(){var n=r.totalCount(),t=r.series().length;return n===0?"No results":"Showing 1-"+t+" of "+n+" results"});r.PopulateProducts=function(){t.PopulateProducts(query).then(function(n){var t=$.map(n.Results,function(n){return new Product(n)});r.AddProducts(t)},common.ProcessAjaxError)};r.AddProducts=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=r.products().length+1,r.products.push(i)};r.PopulateSeriesNext=function(){r.loadingFurther(!0);r.PopulateSeries(!0)};r.PopulateSeries=function(i){i===!0&&r.skip(r.skip()+r.take());var u=r.GetBaseQuery();u.Section=n.QueryResult.Query.Section;u.CategoryOrBelowId=n.QueryResult.Query.CategoryOrBelowId;u.CategoryExactId=n.QueryResult.Query.CategoryExactId;console.log("seriesQuery",u);t.PopulateSeries(u).then(function(n){console.log(n);r.PopulateSeriesData(n)},common.ProcessAjaxError)};r.PopulateSeriesData=function(n){var t=$.map(n?n.Results:[],function(n){return new Series(n)});r.AddSeries(t);r.UpdateForQueryResult(n);r.loadingFurther(!1);r.initialised(!0)};r.GetBaseQuery=function(){var n=new SeriesQuery;return n.take=r.take(),n.skip=r.skip(),n};r.UpdateForQueryResult=function(n){n&&(r.totalCount(n.TotalCount),r.take(n.Take),r.skip(n.Skip));r.allowFurtherLoad(r.series().length<r.totalCount())};r.AddSeries=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=r.series().length+1,r.series.push(i)};r.ToggleSeries=function(n){r.expandedSeries()&&n.index!==r.expandedSeries().index&&r.expandedSeries().contractProducts();r.expandedSeries(n);n.IsHydrated()?n.toggleDisplayProducts():t.GetProductsForSeries(r.storeSession().id,n.Id).then(function(t){var r=new ProductListScroller(t,i.page,i.of,"Titles in Series",n.Id);n.PopulateProductsSliderAndExpand(r)},common.ProcessAjaxError)};r.PopulateSeriesData(n.QueryResult)},FilteredProductListPage=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i));this.StoreSearch.filterMode(!0);n.QueryResult&&n.QueryResult.Query&&(n.QueryResult.Query.LearningAreaId||n.LearningArea&&n.LearningArea.Id)&&(this.StoreSearch.allowYearFilter(!0),this.StoreSearch.allowSubjectFilter(!0));n.QueryResult&&n.QueryResult.Query&&n.QueryResult.Query.ThemeId&&this.StoreSearch.allowYearFilter(!0);r.items=ko.observableArray();r.initialised=ko.observable(!1);r.allowFurtherLoad=ko.observable(!0);r.loading=ko.observable(!1);r.loadingFurther=ko.observable(!1);r.totalCount=ko.observable(n.QueryResult?n.QueryResult.TotalCount:0);r.skip=ko.observable(n.QueryResult?n.QueryResult.Skip:0);r.take=ko.observable(n.QueryResult?n.QueryResult.Take:20);r.scrolled=function(){};r.showing=ko.computed(function(){var n=r.totalCount(),t=r.items().length;return n===0?"No results":"Showing 1-"+t+" of "+n+" results"});r.PopulateNext=function(){r.loadingFurther(!0);r.PopulateProductList(!0)};r.GetQuery=function(){var t=r.GetBaseQuery();return t.LearningAreaId=n.QueryResult.Query.LearningAreaId,t.ThemeId=n.QueryResult.Query.ThemeId,t.Year=n.QueryResult.Query.Year,t.FilterProductTheme=r.StoreSearch.filterProductTheme(),t.FilterProductTopic=r.StoreSearch.filterProductTopic(),t.FilterProductResourceType=r.StoreSearch.filterProductResourceType(),t.FilterProductLevel=r.StoreSearch.filterProductLevel(),t.FromAge=r.StoreSearch.fromAge(),t.ToAge=r.StoreSearch.toAge(),r.StoreSearch.filterKeywords()&&r.StoreSearch.filterKeywords().length>0&&(t.ProductKeywords=r.StoreSearch.filterKeywords()),t};r.PopulateProductList=function(n,i){n===!0&&r.skip(r.skip()+r.take());i===!0&&(r.skip(0),r.take(20));var u=r.GetQuery();i&&r.loading(!0);t.PopulateProducts(u).then(function(n){i===!0&&(r.items([]),r.loading(!1));r.PopulateProductData(n)},common.ProcessAjaxError);r.SaveFilters(u)};r.PopulateProductData=function(n){if(r.loadingFurther(!1),r.initialised(!0),n&&n.Results&&n.Results.length>0){var t=$.map(n.Results,function(n){return new Product(n)});r.AddProduct(t);r.UpdateForQueryResult(n)}else r.UpdateForQueryResult(n),r.allowFurtherLoad(!1)};r.SaveFilters=function(i){t.SaveFilters(n.StoreSession.Id,i.FromAge,i.ToAge,i.FilterProductResourceType,i.FilterProductLevel,i.FilterProductTheme).then(function(){},function(){console.log("Error saving filters")})};ko.postbox.subscribe("filters.cleared",function(){t.SaveFilters(n.StoreSession.Id,0,18,[],[],[]).then(function(){},function(){console.log("Error saving filters")})});r.GetBaseQuery=function(){var n=new ProductQuery;return n.take=r.take(),n.skip=r.skip(),n};r.UpdateForQueryResult=function(n){r.totalCount(n.TotalCount);r.take(n.Take);r.skip(n.Skip);r.allowFurtherLoad(r.items().length<r.totalCount())};r.AddProduct=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=r.items().length+1,i.Hydrate(),r.items.push(i)};r.hideYearFilter=function(){r.StoreSearch.allowYearFilter(!1)};r.allowSubjectFilter=function(){r.StoreSearch.allowSubjectFilter(!0)};r.UpdateQueryString=function(){var n=new URL(window.location.href);n.searchParams.set("level",r.StoreSearch.filterProductLevel().join(","));n.searchParams.set("theme",r.StoreSearch.filterProductTheme().join(","));n.searchParams.set("topic",r.StoreSearch.filterProductTopic().join(","));n.searchParams.set("resourceType",r.StoreSearch.filterProductResourceType().join(","));n.searchParams.set("fromAge",r.StoreSearch.fromAge());n.searchParams.set("toAge",r.StoreSearch.toAge());n.searchParams.set("filterText",r.StoreSearch.filterKeywords()?r.StoreSearch.filterKeywords():"");history.pushState(null,null,n.href)};r.FilterProductList=function(){r.UpdateQueryString();r.PopulateProductList(!1,!0)};ko.postbox.subscribe("age.ranges.changed",r.FilterProductList);ko.postbox.subscribe("product.attributes.changed",r.FilterProductList);n.MarketName==="iUgo Australia"&&(this.StoreSearch.allowYearFilter(!1),r.StoreSearch.ageRange([0,18]));r.StoreSearch.HasInvalidFilters()||r.StoreSearch.HasFilters()?r.PopulateProductList(!1,!0):r.PopulateProductData(n.QueryResult)},InvoicePageForm=function(n){var t=this;n.Response===0&&(n.Response=undefined);ko.utils.extend(t,ko.mapping.fromJS(n));t.OrderHasParty=ko.computed(function(){return t.HasParty()||t.HasRespondingParty()});t.CardExpiryMonth(undefined);t.CardExpiryYear(undefined);t.ConfigureValidation=function(){ko.validation.init({registerExtenders:!0,insertMessages:!0,messagesOnModified:!0,errorElementClass:"has-error",errorMessageClass:"help-block",decorateElement:!0,decorateInputElement:!0,decorateElementOnModified:!0},!0);t.ResponderName.extend({required:{message:"Required"}});t.CardNumber.extend({required:{message:"Required"},minLength:15,maxLength:19});t.NameOnCard.extend({required:{message:"Required"}});t.CardExpiryMonth.extend({required:{message:"Required"},number:!0,minLength:1,maxLength:2,min:1,max:12});t.CardExpiryYear.extend({required:{message:"Required"},number:!0,minLength:1,maxLength:5,min:(new Date).getFullYear()})};t.GetObject=function(){var n=ko.mapping.toJS(t);return n.CardNumber&&(n.CardNumber=n.CardNumber.replace(/\s/g,"")),n}},InvoicePage=function(n,t){var i=this;ko.utils.extend(i,new Store(n,t,{}));i.FormData=ko.validatedObservable(new InvoicePageForm(n.InvoiceOrder));i.FormData().ConfigureValidation();i.ShowPaymentError=ko.observable(!1);i.PaymentErrorDetails=ko.observable("");i.Processing=ko.observable(!1);i.Submitted=ko.observable(!1);i.CanSubmit=ko.computed(function(){return i.FormData.errors().length===0});i.ScrollToTop=function(){$("#top").scrollintoview()};i.Submit=function(){if(i.ShowPaymentError(!1),i.FormData.errors&&i.FormData.errors().length>0){i.FormData.errors.showAllMessages();return}i.Processing(!0);i.ScrollToTop();var n=i.FormData().GetObject(),r=function(){i.Processing(!1);i.Submitted(!0)},u=function(n){if(console.log(n),i.Processing(!1),n.responseJSON){var t=n.responseJSON;console.log(t);t.HasError?(i.PaymentErrorDetails(t.ErrorMessage),i.ShowPaymentError(!0)):common.ProcessAjaxError(n)}else common.ProcessAjaxError(n)};t.SaveInvoiceResponse(n).then(r,u)}},LandingPageData=function(n){var t=this;ko.utils.extend(t,new StoreBase(n));t.title=null;t.featured=ko.observable(new n(n.Featured));t.topSelling=ko.observable(new n(n.TopSelling));t.newReleases=ko.observable(new n(n.NewReleases))},Media=function(n){var t=this;t.id=n.Id;t.name=n.Name;t.description=n.Description},PartyInterestManager=function(n){var t=this,i=n.urls.apiPartyInterests;t.SelectedYears=ko.observableArray([]);t.SelectedInterestIds=ko.observableArray([]);t.OtherInterests=ko.observable("");t.DaysSinceLastModified=ko.observable(0);t.HasDataAlready=ko.observable(!1);t.ShowOtherInterestInput=ko.observable(!1);t.Loaded=ko.observable(!1);t.Processing=ko.observable(!1);t.Submitted=ko.observable(!1);t.SuccessfullyUpdated=ko.observable(!1);t.Visible=ko.computed(function(){return t.Loaded()&&(!t.HasDataAlready()||t.DaysSinceLastModified()>365)});t.ScrollToTop=function(){$("#sidebarInterestGatherer").scrollintoview()};t.SubjectOptions=[{Id:3,Name:"Mathematics"},{Id:24,Name:"English"},{Id:4,Name:"Science"},{Id:37,Name:"SOLO Taxonomy"}];t.RoleOptions=[{Id:47,Name:"Beginning Teacher"},{Id:48,Name:"Teacher"},{Id:50,Name:"Head of Department"},{Id:29,Name:"Assistant/Deputy Principal"},{Id:7,Name:"Head Teacher/Principal"},{Id:46,Name:"Parent"},{Id:45,Name:"Student"}];t.EarlyChildhoodOptions=[{Id:31,Name:"ECE"}];t.YearOptions=[{From:1,To:3,Name:"Year 1-3"},{From:4,To:6,Name:"Year 4-6"},{From:7,To:8,Name:"Year 7-8"},{From:9,To:10,Name:"Year 9-10"}];t.derivedYearFrom=ko.computed(function(){var i=_.map(t.SelectedYears(),function(n){return n.From}),n=i.sort(function(n,t){return n-t});return n.length?n[0]:0});t.derivedYearTo=ko.computed(function(){var i=_.map(t.SelectedYears(),function(n){return n.To}),n=i.sort(function(n,t){return t-n});return n.length?n[0]:0});t.CanUpdate=ko.computed(function(){return t.SelectedInterestIds().length>0||t.OtherInterests().length>0||t.derivedYearFrom()>0||t.derivedYearTo()>0});t.PopulateYearOptions=function(n,i,r){(i!==0||r!==0)&&_.each(n,function(n){n.From>=i&&n.To<=r&&t.SelectedYears.push(n)})};t.UpdateData=ko.computed(function(){return{Interests:t.SelectedInterestIds(),OtherInterests:t.OtherInterests(),YearFrom:t.derivedYearFrom(),YearTo:t.derivedYearTo()}});t.Update=function(){if(t.Submitted(!0),t.CanUpdate()){t.Processing(!0);t.ScrollToTop();var n=t.UpdateData();$.ajax(i,{data:JSON.stringify(n),type:"post",contentType:"application/json; charset=utf-8'"}).then(function(){t.Processing(!1);t.SuccessfullyUpdated(!0)},function(n){t.Processing(!1);common.ProcessAjaxError(n)})}};t.Initialize=function(){$.ajax(i,{type:"GET",contentType:"application/json; charset=utf-8'"}).then(function(n){n&&(n.Interests&&n.Interests.length&&(t.HasDataAlready(!0),t.SelectedInterestIds(n.Interests),t.OtherInterests(n.OtherInterests)),n.YearFrom>0&&n.YearTo>0&&(t.HasDataAlready(!0),t.PopulateYearOptions(t.YearOptions,n.YearFrom,n.YearTo)),t.DaysSinceLastModified(n.DaysSinceLastModified),t.Loaded(!0))},function(n){common.ProcessAjaxError(n)})};t.Initialize()},Product=function(n){var t=this;ko.utils.extend(t,new StoreItem(n));t.Authors=ko.observableArray();t.ProductPrices=ko.observableArray();t.IsInWishlist=ko.observable(n.IsInWishlist);t.IsHydrated=!1;t.HasSpecialPrice=ko.computed(function(){var n=ko.utils.arrayFilter(t.ProductPrices(),function(n){return n.IsSpecial});return n.length>0});t.PopulateAuthors=function(n){var i,r;if(n!=null&&n.length!==0)for(i=0;i<n.length;i++)r=new Author(n[i]),r.last(i===n.length-1),t.Authors.push(r)};t.PopulateAuthors(n.Authors);t.Hydrate=function(){t.IsHydrated!==!0&&(t.PopulateProductPrices(n.ProductPrices),t.IsHydrated=!0)};t.PopulateProductPrices=function(n){var i,r;if(n!=null&&n.length!==0)for(t.ProductPrices([]),i=0;i<n.length;i++)r=new ProductPrice(n[i]),t.ProductPrices.push(r)};t.LowestPrice=ko.computed(function(){var t=_.map(n.ProductPrices,function(n){return n.Price});return _.min(t)});t.Hydrate()},ProductDetail=function(n,t,i){var r=this,u;ko.utils.extend(r,new Store(n,t,i));r.Promotion=ko.observable(null);r.WholeProducts=ko.observableArray([]);r.PartProducts=ko.observableArray([]);r.KitsetComponents=ko.observableArray([]);r.KitsetParents=ko.observableArray([]);r.WholeProductsFormatted=ko.computed(function(){var n=[];return _.each(r.WholeProducts(),function(t){_.each(t.ProductPrices,function(i){n.push({Id:i.Id,Name:t.Name,Code:t.Code,Media:i.Name=="Ebook"?"Ebook (single file)":i.Name,IsSpecial:i.IsSpecial,IsInFilebox:t.IsInFilebox,AvailableInLibrarySubscription:t.AvailableInLibrarySubscription,RegularPrice:i.RegularPrice,Price:i.Price})})}),n});r.KitsetParentsFormatted=ko.computed(function(){var n=[];return _.each(r.KitsetParents(),function(t){_.each(t.ProductPrices,function(i){n.push({Id:i.Id,Name:t.Name,Code:t.Code,Media:i.Name=="eResource"?"eResource collection (multiple files)":i.Name,IsSpecial:i.IsSpecial,RegularPrice:i.RegularPrice,Price:i.Price,IsInFilebox:t.IsInFilebox,AvailableInLibrarySubscription:t.AvailableInLibrarySubscription})})}),n});r.YouMayLikeProducts=ko.computed(function(){return _.flatten([r.WholeProductsFormatted(),r.KitsetParentsFormatted()])});r.AddPromoBasketLine=function(){r.Promotion()&&(r.SaveBasketLineSpecific(r.Promotion().ProductPriceId,1),t.SetPromoCode(n.StoreSession.Id,r.Promotion().PromoCode,!0))};u=n.ProductModel.Id;t.GetPromotion(u).then(function(n){n&&r.Promotion(n)});r.LoadKitsetComponents=function(n){t.GetKitsetComponentModels(n.Id).then(function(n){n&&n.length&&_.each(n,function(n){r.KitsetComponents.push(n)})})};t.GetDetailsExtension(u).then(function(n){n&&(n.WholeProducts.length&&r.WholeProducts(n.WholeProducts),n.PartProducts.length&&r.PartProducts(n.PartProducts),n.KitsetComponents.length&&r.KitsetComponents(n.KitsetComponents),n.KitsetParents.length&&(r.KitsetParents(n.KitsetParents),_.each(n.KitsetParents,r.LoadKitsetComponents)))});r.SelectedProduct=ko.observable(new Client.KnockoutProductStoreItemModel(n.ProductModel));r.SelectProduct=function(n){r.SelectedProduct().fromJs(n);r.ProductPreviews(n.ProductPreviews?n.ProductPreviews:[])};r.ProductPreviews=ko.observableArray(n.ProductModel?n.ProductModel.ProductPreviews:[]);r.HasProductPreviews=ko.computed(function(){return r.ProductPreviews().length>0});r.FirstPreviewImageUrl=ko.computed(function(){if(r.HasProductPreviews()){var n=r.ProductPreviews()[0];return n?n.ImageUrl:""}return""});r.showProductPreviews=function(n){var r=".product-preview-gallery",i,t,u;if(n&&(r+="-mobile"),!n)for(i=$(r+" img[data-src]"),t=0;t<i.length;t++)i[t].src=i[t].dataset?i[t].dataset.src:i[t].getAttribute(attr);u={delegate:"a",type:"image",gallery:{enabled:!0},zoom:{enabled:!0}};n&&(u.preload=[0,2]);$(r).magnificPopup(u);n&&$(r).magnificPopup("open")}},ProductList=function(n){var t=this;t.products=ko.observableArray();t.PopulateProducts=function(n){var i,r;if(n!=null&&n.length!=0)for(i=0;i<n.length;i++)r=new Product(n[i]),r.index=t.products().length+1,r.Hydrate(),t.products.push(r)};t.PopulateProducts(n)},ProductListPage=function(n,t,i){var r=this,u;ko.utils.extend(r,new Store(n,t,i));r.products=ko.observableArray();r.currentCategory=ko.observable();r.initialised=ko.observable(!1);r.totalCount=ko.observable(0);r.take=ko.observable(20);r.skip=ko.observable(0);r.allowFurtherLoad=ko.observable(!0);r.loadingFurther=ko.observable(!1);r.searchCategory=ko.observable(null);r.searchCategories=ko.observableArray(null);r.searchLearningArea=ko.observable(null);r.searchLearningAreas=ko.observableArray([]);r.productOrderByOptionId=ko.observable(r.QueryStringOrderBy()==null?0:r.QueryStringOrderBy());r.previousProductOrderByOptionId=ko.observable(0);r.scrolled=function(){};r.RefreshSearch=function(){$("form#search").submit()};r.SelectSearchCategory=function(n){r.searchCategory(n);r.RefreshSearch()};r.SelectSearchLearningArea=function(n){r.searchLearningArea(n);r.RefreshSearch()};r.SetSearchCategories=function(){var u=_.map(n.Categories,function(n){return{id:n.Id,name:n.Name}}),t;u.unshift({name:i.allCategories});r.searchCategories(u);t=_.map(n.LearningAreas,function(n){return{id:n.Id,name:n.Name}});t.unshift({name:i.allCategories});r.searchLearningAreas(t)};r.AddProducts=function(n){var t=[],i=n,u=_.some(n,function(n){return n.SeriesOrder>0});u&&(i=n.sort(function(n,t){return n.SeriesOrder-t.SeriesOrder}));_.each(i,function(n){n.index=r.products().length+1;var i=new Product(n);t.push(i)});r.products(t)};r.filteredProducts=ko.computed(function(){var n=r.products(),t,i,u,f,e;return r.StoreSearch.keywordsString()&&r.StoreSearch.keywordsString().length>2&&(t=r.StoreSearch.keywordsString().toLowerCase(),n=_.filter(n,function(n){return n.Name.toLowerCase().indexOf(t)>-1?!0:n.Subtitle.toLowerCase().indexOf(t)>-1?!0:n.Description.toLowerCase().indexOf(t)>-1?!0:!1})),i=r.StoreSearch.fromAge(),u=r.StoreSearch.toAge(),(i>0||u<18)&&(n=_.filter(n,function(n){return n.FromAge<=u&&n.ToAge>=i})),r.searchCategory&&r.searchCategory()&&r.searchCategory().id&&(f=r.searchCategory(),n=_.filter(n,function(n){return _.includes(n.CategoryIds,f.id)})),r.searchLearningArea&&r.searchLearningArea()&&r.searchLearningArea().id&&(e=r.searchLearningArea(),n=_.filter(n,function(n){return _.includes(n.LearningAreaIds,e.id)})),n});r.productGroups=ko.computed(function(){var t=_.map(n.LearningAreas,function(n){var t=_.filter(r.filteredProducts(),function(t){return _.includes(t.LearningAreaIds,n.Id)});return{Name:n.Name,Products:t}});return t.push({Name:"Other",Products:_.filter(r.filteredProducts(),function(n){for(var r,u,i=0;i<t.length;i++)if(r=t[i],u=_.some(r.Products,function(t){return t.Id===n.Id}),u===!0)return!1;return!0})}),_.filter(t,function(n){return n.Products.length>0})});r.showing=ko.computed(function(){var t=r.products().length,n=r.filteredProducts().length;return t===n?"Showing "+n+" titles":"Showing "+n+" of "+t+" titles"});r.SetSearchCategories();r.AddProducts(n.QueryResult.Results);u=function(){var n=r.QueryStringFromAge(),t=r.QueryStringToAge();n>0&&t<18&&r.StoreSearch.ageRange([n,t])};u();r.UpdateQueryString=function(){var n=new URL(window.location.href);n.searchParams.set("fromAge",r.StoreSearch.fromAge());n.searchParams.set("toAge",r.StoreSearch.toAge());history.pushState(null,null,n.href)};ko.postbox.subscribe("age.ranges.changed",r.UpdateQueryString)},ProductListScroller=function(n,t,i,r,u,f){var e=this,o;ko.utils.extend(e,new ProductList(n));e.Id=ko.observable(u);e.totalWidth=ko.observable(0);e.currentPage=ko.observable(1);e.workingWidthPx=ko.observable(0);e.title=r;e.url=f;e.hasUrl=!!f;o=170;e.GetProductScrollerWidth=function(){var t="productScroller"+e.Id(),n=document.getElementById(t);return n==null?null:n.offsetWidth};e.GetTallButtonContainerWidth=function(){var t="tallButton1Container"+e.Id(),n=document.getElementById(t);return n==null?null:n.offsetWidth};e.SetWorkingWidth=function(){var t=e.GetProductScrollerWidth(),n;t&&(n=e.GetTallButtonContainerWidth(),n)&&(e.workingWidthPx(Math.floor(t-n*2)-20),e.currentPage()>e.totalPages()&&e.currentPage(e.totalPages()))};e.Console=function(){var t="productScroller"+e.Id(),n=document.getElementById(t);console.log("GetProductScrollerWidth: "+e.GetProductScrollerWidth());console.log("productScroller.offsetWidth: "+(n?n.offsetWidth:"null"));console.log("workingWidthPx: "+e.workingWidthPx());console.log("itemsPerPage: "+e.itemsPerPage())};e.itemsPerPage=ko.computed(function(){var n=e.workingWidthPx()/o;return Math.floor(n)});e.totalPages=ko.computed(function(){var t=e.products().length/e.itemsPerPage(),n=Math.ceil(t);return n==0?1:n});e.currentIndex=ko.computed(function(){return(e.currentPage()-1)*e.itemsPerPage()});e.visibleProducts=ko.computed(function(){for(var r=e.itemsPerPage()>e.products().length?e.products().length:e.itemsPerPage(),t=[],n=e.currentIndex(),i=0;i<r;i++)n>=e.products().length||(t.push(e.products()[n]),n++);return t});e.pageDescription=ko.computed(function(){return t+" "+e.currentPage()+" "+i+" "+e.totalPages()});e.previousPage=function(){e.currentPage()===1?e.currentPage(e.totalPages()):e.currentPage(e.currentPage()-1)};e.nextPage=function(){e.currentPage()===e.totalPages()?e.currentPage(1):e.currentPage(e.currentPage()+1)};e.PopulateProducts=function(n){var t,i;if(n!=null&&n.length!=0)for(t=0;t<n.length;t++)i=new Product(n[t]),i.index=e.products().length+1,i.Hydrate(),e.products.push(i)}},ProductPrice=function(n){var t=this;ko.utils.extend(t,n);t.chosenQty=ko.observable(0)},ProductQuery=function(){var n=this;ko.utils.extend(n,new Query);n.ProductKeywords=null;n.ProductOrderByOptionId=0;n.FromAge=0;n.ToAge=0},ProductSearch=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i));r.StoreSearch.searchMode(!0);r.products=ko.observableArray();r.initialised=ko.observable(!1);r.totalCount=ko.observable(n.QueryResult.TotalCount);r.take=ko.observable(n.QueryResult.Take);r.skip=ko.observable(n.QueryResult.Skip);r.allowFurtherLoad=ko.observable(!0);r.loadingFurther=ko.observable(!1);r.productOrderByOptionId=ko.observable(r.QueryStringOrderBy()==null?0:r.QueryStringOrderBy());r.previousProductOrderByOptionId=ko.observable(0);r.scrolled=function(){};r.showing=ko.computed(function(){if(!r.initialised())return"";var n=r.totalCount(),t=r.products().length;return n===0?"No results":"Showing 1-"+t+" of "+n+" results"});r.AddProducts=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=r.products().length+1,i.Hydrate(),r.products.push(i)};r.PopulateProductsNext=function(){r.loadingFurther(!0);r.PopulateProducts(!0)};r.PopulateProducts=function(i,u){u===!0&&(r.initialised(!1),r.products.removeAll(),r.skip(0));i===!0&&r.skip(r.skip()+r.take());var f=r.GetBaseQuery();f.CategoryOrBelowId=n.QueryResult.Query.CategoryOrBelowId;f.FromAge=n.QueryResult.Query.FromAge;f.ToAge=n.QueryResult.Query.ToAge;f.FilterProductLevel=n.QueryResult.Query.FilterProductLevel;f.ProductKeywords=n.QueryResult.Query.ProductKeywords;f.ProductOrderByOptionId=r.productOrderByOptionId();t.PopulateProducts(f).then(function(n){r.PopulateProductData(n)},common.ProcessAjaxError)};r.PopulateProductData=function(n){var t=$.map(n.Results,function(n){return new Product(n)});r.AddProducts(t);r.UpdateForQueryResult(n);r.loadingFurther(!1);r.initialised(!0)};r.GetBaseQuery=function(){var n=new ProductQuery;return n.take=r.take(),n.skip=r.skip(),n};r.UpdateForQueryResult=function(n){r.take(n.Take);r.skip(n.Skip);n.TotalCount>0&&r.totalCount(n.TotalCount);r.allowFurtherLoad(r.products().length<r.totalCount())};r.StoreSearch.loading=!0;r.StoreSearch.HasInvalidFilters()||r.StoreSearch.HasFilters()?(r.StoreSearch.clearAllAttributeFilters(),n.MarketName.indexOf("Australia")>-1&&r.StoreSearch.SetFilterProductLevel(),r.PopulateProducts(!1,!0)):r.PopulateProductData(n.QueryResult);r.StoreSearch.loading=!1;setTimeout(function(){r.productOrderByOptionId.subscribe(function(){r.productOrderByOptionId()!==r.previousProductOrderByOptionId()&&(r.previousProductOrderByOptionId(r.productOrderByOptionId()),r.PopulateProducts(!1,!0))})},300)},ProductSlider={lazyLoad:function(){for(var t=$("img[data-src]"),n=0;n<t.length;n++)t[n].src=t[n].dataset?t[n].dataset.src:t[n].getAttribute(attr);for(t=$("img[data-lazy]"),n=0;n<t.length;n++)t[n].src=t[n].dataset?t[n].dataset.lazy:t[n].getAttribute(attr)},start:function(){var n={lazyLoad:"ondemand",dots:!1,infinite:!0,speed:300,slidesToShow:5,slidesToScroll:5,responsive:[{breakpoint:1600,settings:{slidesToShow:4,slidesToScroll:4}},{breakpoint:1300,settings:{slidesToShow:3,slidesToScroll:3}},{breakpoint:992,settings:{slidesToShow:4,slidesToScroll:4}},{breakpoint:780,settings:{slidesToShow:3,slidesToScroll:3}},{breakpoint:590,settings:{slidesToShow:2,slidesToScroll:2}},{breakpoint:430,settings:{slidesToShow:1,slidesToScroll:1}}]};$.each($(".product-scroller-frame"),function(t,i){var r=$(i),f=r.find(".product-scroller2")[0],e=r.find(".prevPage")[0],o=r.find(".nextPage")[0],u=$.extend({},n);u.prevArrow=e;u.nextArrow=o;$(f).slick(u)})}},PromoCodeManager=function(n,t,i,r){function f(){r&&r()}function e(){u.PromoCodes(ko.utils.arrayMap(i.PromoCodeDiscounts(),function(n){return n.Code()}))}var u=this;u.PromoCodes=ko.observableArray([]);u.PromoCodeEntry=ko.observable("");u.PromoMessages=t().promoMessages;u.PromoCodeErrorMessage=ko.observable(null);u.PromoCodeEntryVisible=ko.observable(!1);u.TogglePromoCodeEntryVisible=function(){u.PromoCodeEntryVisible(!u.PromoCodeEntryVisible())};u.PromoCodeEntryReady=ko.computed(function(){return u.PromoCodeEntry()!=null&&u.PromoCodeEntry().trim()!=""});u.PromoCodeAddAllowed=ko.computed(function(){return u.PromoCodes().length===0});u.ClearPromoCodeErrorMessage=function(){u.PromoCodeErrorMessage(null)};u.AddPromoCode=function(){if(u.PromoCodeEntryReady()){var i=function(){u.PromoCodes.push(u.PromoCodeEntry());u.PromoCodeErrorMessage(null);u.PromoCodeEntry("");f()},r=function(n){var t="Promo Code could not be added";n&&n.responseJSON&&n.responseJSON.ErrorMessage&&(t=n.responseJSON.ErrorMessage);u.PromoCodeErrorMessage(t)};n.SetPromoCode(t().id,u.PromoCodeEntry()).then(i,r)}};u.RemovePromoCode=function(i){var r=function(){u.PromoCodes.remove(i.Code());f()},e=function(n){var t="Promo Code could not be removed";n&&n.responseJSON&&n.responseJSON.ErrorMessage&&(t=n.responseJSON.ErrorMessage);u.PromoCodeErrorMessage(t)};n.RemovePromoCode(t().id,i.PromoCodeId()).then(r,e)};e()},PromotionPageForm=function(n){var t=this;ko.utils.extend(t,ko.mapping.fromJS(n));t.Name.extend({required:!0});t.Email.extend({required:!0,email:!0});t.NewSchoolName.extend({required:!0});t.AddressLine1.extend({required:!0});t.AddressLine2.extend({required:!1});t.AddressLine3.extend({required:!1});t.City.extend({required:!0});t.Postcode.extend({required:!0});t.SelectedSchool=ko.observable();t.SelectedSchoolAddress=ko.observable();t.Country=ko.observable();t.SetSchool=function(n){n&&n.Id?(t.SchoolId(n.Id),t.SchoolName(n.Name),t.NewSchoolName(n.Name)):(t.SchoolId(null),t.SchoolName(null))};t.SetAddress=function(n){if(n)for(var i in n)n.hasOwnProperty(i)&&t[i]&&n[i]&&t[i].call(t,n[i])};t.UpdateData=function(n){t.FirstName(n.FirstName);t.LastName(n.LastName);t.CountryId(n.CountryId);n.HasSchool&&(t.SchoolId(n.SchoolId),t.SchoolName(n.SchoolName),t.NewSchoolName(n.SchoolName))};t.ValidationMessages=ko.computed(function(){var n=[];return!!t.SchoolId()&&t.NewSchoolName()&&t.NewSchoolName().length>2?n:((!t.Email()||t.Email().length<2)&&n.push("You must enter an email address."),(!t.Name()||t.Name().length<2)&&n.push("You must enter a name."),(!t.NewSchoolName()||t.NewSchoolName().length<2)&&n.push("You must enter a school name."),(!t.AddressLine1()||t.AddressLine1().length<2)&&n.push("You must enter an address."),(!t.City()||t.City().length<2)&&n.push("You must enter a city/town."),(!t.Postcode()||t.Postcode().length<2)&&n.push("You must enter a postcode."),n)});t.IsValid=ko.computed(function(){return t.ValidationMessages().length===0});t.GetObject=function(){return ko.mapping.toJS(t)}},PromotionPage=function(n,t){var i=this;console.log(n);ko.utils.extend(i,new Store(n,t,{}));i.Form=new PromotionPageForm(n.ResponseDto);i.Submitted=ko.observable(!1);i.Completed=ko.observable(!1);i.ProductPreviews=ko.observableArray([]);i.AddressIsEditable=ko.observable(!1);i.ShowCantFindSchoolButton=ko.observable(!1);i.ShowSchoolAddressOverride=ko.observable(!1);i.ShowSchoolAddress=ko.computed(function(){return i.ShowSchoolAddressOverride()||i.Form.SelectedSchool()!=null});i.EditAddress=function(){i.AddressIsEditable(!0)};i.CantFindSchool=function(){i.ShowSchoolAddressOverride(!0);i.AddressIsEditable(!0)};i.showProductPreviews=function(t){var u=".product-preview-gallery-mobile",r=_.find(n.Promotion.Products,function(n){return n.Id===t}),f;if(r){if(r.ProductPreviews&&r.ProductPreviews.length>0)i.ProductPreviews(r.ProductPreviews);else{common.NotifyWithDuration("No previews available for this product",5e3);return}f={delegate:"a",type:"image",preload:[0,2],gallery:{enabled:!0}};$(u).magnificPopup(f);$(u).magnificPopup("open")}};i.SchoolSearch=function(n,r){n&&(n.length<2||t.SchoolSearchByCountry(n,i.Form.CountryId()).done(r))};i.LoadSchoolAddress=function(n){t.GetSchoolAddress(n).then(function(n){if(n&&n.length){var t=ko.utils.arrayFirst(n,function(n){return n.Type==="Delivery"});t&&i.Form.SetAddress(t)}})};i.Submit=function(){if(i.Submitted(!0),!i.Form.IsValid()){console.log("Form is not valid",i.Form.ValidationMessages());return}var r=i.Form.GetObject();t.SavePromotionResponse(n.Promotion.Id,r).then(function(){common.Notify("Your response has been submitted");i.Completed(!0)})};i.AddAllToCart=function(){return i.AddMultipleProductPrices(n.ProductPriceIds).then(function(){window.location=n.CartUrl})};i.Form.SelectedSchool.subscribe(function(n){i.Form.SetSchool(n);n&&n.Id?i.LoadSchoolAddress(n.Id):n&&i.CantFindSchool(!0)});n.ResponseDto&&n.ResponseDto.SchoolId&&n.ResponseDto.SchoolName&&i.Form.SelectedSchool({Id:n.ResponseDto.SchoolId,Name:n.ResponseDto.SchoolName})},Query=function(){var n=this;n.CategoryExactId=null;n.CategoryOrBelowId=null;n.AuthorId=null},Series=function(n){var t=this,i,r;ko.utils.extend(t,new StoreItem(n));t.products=ko.observableArray();t.ProductCount=ko.observable(n.ProductCount);t.url=n.Url;t.code=n.Code;t.displayProducts=ko.observable(!1);i="visuallyhidden";r="productExpander";t.productsCssClass=ko.observable(i);t.cssClass=ko.computed(function(){return t.displayProducts()?"expanded":""});t.PopulateProducts=function(n){var i,r;if(console.log("Populating products"),n!=null&&n.length!==0)for(i=0;i<n.length;i++)r=new Product(n[i]),r.index=t.products().length+1,t.products.push(r)};t.ProductsSlider=ko.observable(null);t.PopulateProductsSliderAndExpand=function(n){t.ProductsSlider(n);t.setDisplayProducts(!0);n.SetWorkingWidth()};t.SetWorkingWidth=function(){};t.productsHeight=ko.observable(0);t.IsHydrated=ko.observable(!1);t.contractProducts=function(){t.setDisplayProducts(!1)};t.toggleDisplayProducts=function(){t.setDisplayProducts(!t.displayProducts())};t.setDisplayProducts=function(n){t.Hydrate();t.displayProducts(n);n?t.productsCssClass(r):t.productsCssClass(i);var u=document.getElementById("products"+t.index);n?t.productsHeight(u.offsetHeight+200+"px"):t.productsHeight("")};t.Hydrate=function(){if(!t.IsHydrated()){for(var n=0;n<t.products().length;n++)t.products()[n].Hydrate();t.IsHydrated(!0)}}},SeriesQuery=function(){var n=this;ko.utils.extend(n,new Query)};var SiteSwitchManager=function(n,t){function r(){return $.ajax(t,{type:"get",cache:!1})}var i=this;i.MarketId=n.MarketId;i.MarketName=n.MarketName;i.SiteSwitchModalVisible=ko.observable(!1);i.SiteSwitchCountry=ko.observable("");i.SiteSwitchUrl=ko.observable("");i.SiteSwitchDefault=ko.observable(!1);i.SiteSwitchDisplayUrl=ko.computed(function(){if(i.SiteSwitchUrl().length===0)return"";var n=i.SiteSwitchUrl();return n.substring(n.indexOf("://")+3,n.lastIndexOf("/"))});i.ShowSiteSwitchModal=function(){i.SiteSwitchModalVisible(!0)};i.PromptSwitchToMarket=function(n){n&&(i.SiteSwitchCountry(n.CountryName),i.SiteSwitchUrl(n.Url),i.ShowSiteSwitchModal(!0))};i.GeolocateIP=function(){n.MarketId&&r().then(function(t){var r,u;t.Success?(r=ko.utils.arrayFirst(n.MarketUrls,function(n){return n.Id===t.MarketId}),r&&r.Id!==i.MarketId&&i.PromptSwitchToMarket(r,t.MarketName)):i.IsDefaultMarket||(u=ko.utils.arrayFirst(n.MarketUrls,function(n){return n.IsDefault}),u&&(i.SiteSwitchDefault(!0),i.PromptSwitchToMarket(u,"Rest of World")))})};i.GeolocateIP()},Store=function(n,t,i){var r=this;r.StoreSearch=new StoreSearch(n.Categories,n.Author,n.QueryResult,i,n);r.PartyInterests=new PartyInterestManager(t);r.TeachablesHelp=new SidebarTeachablesHelpManager(n.ShowHelpSidebar,t.urls,new AjaxService);ko.utils.extend(r,new StoreBase(n));r.PostBasketChange=null;r.PostWishlistChange=null;r.AddBasketLine=function(n){r.SaveBasketLineSpecific(n,1);setTimeout(function(){var n=$(".dropdown.dropup.open");n.children("aria-expanded[true]").attr("aria-expanded",!1);n.removeClass("open")},4e3)};r.AddMultipleProductPrices=function(n){return t.AddMultipleToCart(r.storeSession().id,n)};r.SaveBasketLine=function(n){n.chosenQty()<0||r.SaveBasketLineSpecific(n.Id,n.chosenQty())};r.AddProductToFilebox=function(n){var i=t.AddProductToFilebox(n);return i.then(function(){r.RefreshStoreSession();r.PostBasketChange&&r.PostBasketChange();common.NotifySuccess("Added to Filebox",3e3)},common.ProcessAjaxError),i};r.SaveBasketLineSpecific=function(n,i){if(i<0)return common.ResolvedPromise();var u=t.SaveBasketLineSpecific(r.storeSession().id,n,r.MarketId,i);return u.then(function(){common.FacebookEvent("AddToCart");r.RefreshStoreSession();r.PostBasketChange&&r.PostBasketChange();ko.postbox.publish("AddToCart")},common.ProcessAjaxError),u};r.DeleteBasket=function(){confirm(r.deletetionConfirmation)&&t.DeleteBasket(r.storeSession().id).then(function(){r.RefreshStoreSession();r.PostBasketChange&&r.PostBasketChange()},common.ProcessAjaxError)};r.ToggleWishlistItem=function(n){t.ToggleWishlistItem(r.storeSession().id,n).then(function(t){common.FacebookEvent("AddToWishlist");common.NotifyWithDuration(r.wishlistUpdated,3e3);r.RefreshStoreSession();r.PostWishlistChange&&r.PostWishlistChange();t.Data.IsInWishlist?($(".WishlistProduct-"+n).addClass("InWishlist"),$("#WishlistProduct-"+n).addClass("InWishlist")):($(".WishlistProduct-"+n).removeClass("InWishlist"),$("#WishlistProduct-"+n).removeClass("InWishlist"))},common.ProcessAjaxError)};r.SaveWishlistItem=function(n){t.SaveWishlistItem(r.storeSession().id,n.Id).then(function(){common.FacebookEvent("AddToWishlist");common.NotifyWithDuration(r.wishlistUpdated,3e3);r.RefreshStoreSession();r.PostWishlistChange&&r.PostWishlistChange()},common.ProcessAjaxError)};r.DeleteWishlistItem=function(n){t.DeleteWishlistItem(r.storeSession().id,n.Id).then(function(){r.RefreshStoreSession();r.PostWishlistChange&&r.PostWishlistChange()},common.ProcessAjaxError)};r.RefreshStoreSession=function(){t.RefreshStoreSession(r.storeSession().id).then(function(n){n.BasketLineCount!==r.storeSession().basketLineCount()&&(r.storeSession().basketLineCount(n.BasketLineCount),r.storeSession().basketLines(n.BasketLines));n.WishListCount!==r.storeSession().wishListCount()&&r.storeSession().wishListCount(n.WishListCount)},common.ProcessAjaxError)};r.SetPostBasketChange=function(n){r.PostBasketChange=n};r.SetPostWishlistChange=function(n){r.PostWishlistChange=n};r.qtyOptions=null;r.QtyOptions=ko.computed(function(){if(r.qtyOptions===null){r.qtyOptions=[];for(var n=1;n<=20;n++)r.qtyOptions.push(n)}return r.qtyOptions})},StoreBase=function(n){var t=this;t.StoreNavigation=new StoreNavigation;t.phraseWorking="Working...";t.phraseAll="All";t.phraseShowing="Showing";t.phraseOf="of";t.phraseResults="Results";t.phraseNoResults="No Results";t.deletetionConfirmation="Are you sure that you want to clear your cart?";t.allCategories="All Categories";t.basketUpdated="Cart Updated";t.wishlistUpdated="Wishlist Updated";t.MarketId=n.MarketId;t.MarketName=n.MarketName;t.IsDefaultMarket=n.IsDefaultMarket;t.MarketAllowsSchoolInvoicing=n.MarketAllowsSchoolInvoicing;t.CurrencySymbol=n.Currency?n.Currency.Symbol:"$";t.CurrencyCode=n.Currency?n.Currency.Code:"NZD";t.MarketsVisible=ko.observable(!1);t.CurriculumCode=n.CurriculumCode;t.CurriculumName=n.CurriculumName;t.CurriculaVisible=ko.observable(!0);t.MarketSwitchModalVisible=ko.observable(!1);t.CategoryMenuVisible=ko.observable(!0);t.ThemeMenuVisible=ko.observable(!1);t.IsHomePage=ko.observable(!1);t.IsMobileSize=ko.observable(!1);t.CartAddedModalVisible=ko.observable(!1);t.ToggleMarketsVisible=function(){t.MarketsVisible(!t.MarketsVisible())};t.ToggleCurriculaVisible=function(){t.CurriculaVisible(!t.CurriculaVisible())};t.ToggleCategoryMenuVisible=function(){t.CategoryMenuVisible(!t.CategoryMenuVisible())};t.ToggleThemeMenuVisible=function(){t.ThemeMenuVisible(!t.ThemeMenuVisible())};t.HideMarketOptions=function(){return t.MarketsVisible(!1),!1};t.MarketOptions=ko.computed(function(){return ko.utils.arrayFilter(n.MarketUrls,function(n){return n.Id!==t.MarketId})});t.ShowRestOfWorld=function(){t.MarketSwitchModalVisible(!0)};t.CompleteRestOfWorld=function(){var i=ko.utils.arrayFirst(n.MarketUrls,function(n){return n.IsDefault});!t.IsDefaultMarket&&i?window.location=i.Url:(t.MarketSwitchModalVisible(!1),t.MarketsVisible(!1))};t.HideCurriculumOptions=function(){return t.CurriculaVisible(!1),!1};t.CurriculumOptions=ko.computed(function(){return[{Name:"New Zealand Curriculum",Url:"/Store?curriculum=NZC"},{Name:"Australian Curriculum",Url:"/Store?curriculum=AU"},{Name:"Victorian Curriculum",Url:"/Store?curriculum=VIC"}]});t.storeSession=ko.observable(new StoreSession(n.StoreSession));t.QueryStringCategoryIdVariable="cat";t.QueryStringCategoryId=function(){return common.GetQueryStringParameterByName(t.QueryStringCategoryIdVariable)};t.QueryStringAuthorIdVariable="aut";t.QueryStringAuthorId=function(){return common.GetQueryStringParameterByName(t.QueryStringAuthorIdVariable)};t.QueryStringKeywordsVariable="keywords";t.QueryStringKeywords=function(){return common.GetQueryStringParameterByName(t.QueryStringKeywordsVariable)};t.QueryStringOrderByVariable="orderBy";t.QueryStringOrderBy=function(){return common.GetQueryStringParameterByName(t.QueryStringOrderByVariable)};t.QueryStringFromAgeVariable="fromAge";t.QueryStringFromAge=function(){return common.GetQueryStringParameterByName(t.QueryStringFromAgeVariable)};t.QueryStringToAgeVariable="toAge";t.QueryStringToAge=function(){return common.GetQueryStringParameterByName(t.QueryStringToAgeVariable)};t.SetWhetherMobile=function(){t.IsMobileSize($(window).width()<992)};t.Init=function(){t.SetWhetherMobile();setTimeout(function(){t.CategoryMenuVisible(!t.IsMobileSize()||t.IsHomePage())},300)};$(window).resize(function(){t.SetWhetherMobile();t.CategoryMenuVisible(!t.IsMobileSize())});t.Init();ko.postbox.subscribe("AddToCart",function(){t.IsMobileSize()?t.CartAddedModalVisible(!0):common.NotifyWithDuration(t.basketUpdated,4e3)})},StoreNavigation=function(){var n=this;n.expandLearningAreas=ko.observable(!1);n.expandYears=ko.observable(!1);n.expandThemes=ko.observable(!1);n.showLearningAreas=function(t){var i=t===!0?0:400;setTimeout(function(){n.expandLearningAreas(!0);n.expandYears(!1);n.expandThemes(!1);$(".dim").show()},i)};n.showYears=function(t){var i=t===!0?0:400;setTimeout(function(){n.expandLearningAreas(!1);n.expandYears(!0);n.expandThemes(!1);$(".dim").show()},i)};n.showThemes=function(t){var i=t===!0?0:400;setTimeout(function(){n.expandLearningAreas(!1);n.expandYears(!1);n.expandThemes(!0);$(".dim").show()},i)};n.closeAll=function(){n.expandLearningAreas(!1);n.expandYears(!1);n.expandThemes(!1);$(".dim").hide()}},StoreFront=function(n,t,i,r,u){var f=this;ko.utils.extend(f,new StoreQuery(n,t,i));f.series=ko.observableArray();f.expandedSeries=ko.observable();f.PopulateCategories=function(t){var r=$.map(t,function(n){return new Category(n)}),i;for(f.categories(r),i=0;i<f.categories().length;i++)f.categories()[i].SetPerentCategory(null);f.QueryStringCategoryId!==null?f.SetForSelectedCategory():f.SetForRoot();f.PopulateSeriesData(n.QueryResult)};f.PopulateProducts=function(){t.PopulateProducts(f.QueryStringCategoryId()).then(function(n){var t=$.map(n.Results,function(n){return new Product(n)});f.AddProducts(t)},common.ProcessAjaxError)};f.AddProducts=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=f.products().length+1,f.products.push(i)};f.PopulateSeriesNext=function(){f.loadingFurther(!0);f.PopulateSeries(!0)};f.PopulateSeries=function(n){var i,r,u;n===!0&&f.skip(f.skip()+f.take());i=f.GetBaseQuery();r=f.QueryStringCategoryId();r!==null?i.CategoryOrBelowId=r:(u=f.QueryStringAuthorId(),u!==null&&(i.AuthorId=u));t.PopulateSeries(i).then(function(n){f.PopulateSeriesData(n.QueryResult)},common.ProcessAjaxError)};f.PopulateSeriesData=function(n){var t=$.map(n.Results,function(n){return new Series(n)});f.AddSeries(t);f.UpdateForQueryResult(n);f.loadingFurther(!1);f.initialised(!0)};f.GetBaseQuery=function(){var n=new SeriesQuery;return n.take=f.take(),n.skip=f.skip(),n};f.UpdateForQueryResult=function(n){f.totalCount(n.TotalCount);f.take(n.Take);f.skip(n.Skip);f.allowFurtherLoad(f.series().length<f.totalCount());f.UpdateShowing()};f.UpdateShowing=function(){if(f.totalCount()==0)f.showing(f.phraseNoResults);else{var n=f.series().length;f.showing(f.phraseShowing+" 1-"+n+" "+f.phraseOf+" "+f.totalCount()+" "+f.phraseResults)}};f.AddSeries=function(n){for(var i,t=0;t<n.length;t++)i=n[t],i.index=f.series().length+1,f.series.push(i)};f.SetForRoot=function(){f.SetSubCategoryCrumbs(f.categories());f.title(f.phraseAll)};f.SetCurrentCategory=function(n){f.currentCategory(n);f.searchCategory(n)};f.SetForSelectedCategory=function(){var o=f.QueryStringCategoryId(),n=null,i,s,r,t,u,e;if(o!="")for(i=0;i<f.categories().length;i++)if(s=f.categories()[i],n=s.SearchForCategory(o),n!=null)break;if(n==null)f.SetForRoot();else{for(f.SetCurrentCategory(n),n.highlight(!0),n.ensureVisible(!0),f.title(n.name()),f.SetSubCategoryCrumbs(n.categories()),r=[],t=n;t!=null;)r.push(t),t=t.parentCategory();for(u=[],u.push(new Category({Name:f.phraseAll,Level:0})),e=r.length-1;e>=0;e--)u.push(r[e]);f.categoryCrumbs(u)}};f.SetSubCategoryCrumbs=function(n){for(var i,r=[],t=0;t<n.length;t++)i=n[t],i.first=t===0,r.push(i);f.subCategories(r)};f.ToggleSeries=function(n){f.expandedSeries()!=null&&n.index!==f.expandedSeries().index&&f.expandedSeries().contractProducts();f.expandedSeries(n);n.IsHydrated()?n.toggleDisplayProducts():t.GetProductsForSeries(f.storeSession().id,n.Id).then(function(t){var i=new ProductListScroller(t,r,u,"Titles in Series",n.Id);n.PopulateProductsSliderAndExpand(i)},common.ProcessAjaxError)};f.UpdateShowing();f.PopulateCategories(n.Categories);f.SetSearchCategories()},StoreItem=function(n){var t=this;ko.utils.extend(t,n);t.Url=ko.computed(function(){return"?prod="+t.Id})},StoreLandingPage=function(n,t,i,r){var u=this;ko.utils.extend(u,new Store(n,t,i));u.StoreSearch.filterMode(!0);u.title=null;u.MovieModal=ko.observable({ModalVisible:ko.observable(!1),VideoSlug:ko.observable(n.VideoCode),Title:ko.observable("iUgo Overview")});u.DisplayMovieModal=function(){u.MovieModal().ModalVisible(!0)};u.SiteSwitch=new SiteSwitchManager(n,r)},StorePage=function(n,t,i){var r=this;ko.utils.extend(r,new Store(n,t,i));r.title=null},StoreSearch=function(n,t,i,r,u){var f=this,e,h,s,o;f.QueryStringCategoryIdVariable="cat";f.QueryStringCategoryId=function(){return common.GetQueryStringParameterByName(f.QueryStringCategoryIdVariable)};f.QueryStringLearningAreaIdVariable="la";f.QueryStringLearningAreaId=function(){return common.GetQueryStringParameterByName(f.QueryStringLearningAreaIdVariable)};f.QueryStringKeywordsVariable="keywords";f.QueryStringKeywords=function(){return common.GetQueryStringParameterByName(f.QueryStringKeywordsVariable)};f.QueryStringOrderByVariable="orderBy";f.QueryStringOrderBy=function(){return common.GetQueryStringParameterByName(f.QueryStringOrderByVariable)};f.QueryStringFromAgeVariable="fromAge";f.QueryStringFromAge=function(){return common.GetQueryStringParameterByName(f.QueryStringFromAgeVariable)};f.QueryStringToAgeVariable="toAge";f.QueryStringToAge=function(){return common.GetQueryStringParameterByName(f.QueryStringToAgeVariable)};f.QueryStringResourceTypeVariable="resourceType";f.QueryStringResourceType=function(){return common.GetQueryStringParameterByName(f.QueryStringResourceTypeVariable)};f.QueryStringTopicVariable="topic";f.QueryStringTopic=function(){return common.GetQueryStringParameterByName(f.QueryStringTopicVariable)};f.QueryStringThemeVariable="theme";f.QueryStringTheme=function(){return common.GetQueryStringParameterByName(f.QueryStringThemeVariable)};f.QueryStringFilterProductLevelVariable="filterProductLevel";f.QueryStringFilterProductLevel=function(){return common.GetQueryStringParameterByName(f.QueryStringFilterProductLevelVariable)};f.QueryStringFilterTextVariable="filterText";f.QueryStringFilterText=function(){return common.GetQueryStringParameterByName(f.QueryStringFilterTextVariable)};e=function(n){var t=n-4;return t<1&&(t=1),t>13&&(t=13),t};h=function(n){var t=n+4;return t<0&&(t=0),t>18&&(t=18),t};f.loading=!0;f.searchMode=ko.observable(!1);f.filterMode=ko.observable(!1);f.showFilters=ko.observable(!0);f.allowYearFilter=ko.observable(!1);f.allowSubjectFilter=ko.observable(!1);f.allowKeywordFilter=ko.observable(!0);f.slidePanelVisible=ko.observable(!1);f.totalCount=ko.observable(0);f.take=ko.observable(20);f.skip=ko.observable(0);f.showing=ko.observable();f.author=ko.observable(t);f.ageRanges=ko.observableArray();f.allResourceTypes=ko.observableArray(u.AvailableResourceTypes);f.allThemes=ko.observableArray(u.AvailableThemes);f.allTopics=ko.observableArray(u.AvailableTopics);f.availableResourceTypes=ko.observableArray(u.AvailableResourceTypes);f.availableThemes=ko.observableArray(u.AvailableThemes);f.availableTopics=ko.observableArray(u.AvailableTopics);f.levels=ko.observableArray(u.Levels);f.learningArea=ko.observable(u.LearningArea);f.learningAreaLevels=ko.observable(u.LearningArea?_.orderBy(u.LearningArea.Levels,function(n){return n.Order}):[]);f.ageRange=ko.observable([0,18]);f.keywordsString=ko.observable(f.QueryStringKeywords());f.currentCategoryName=ko.observable(null);f.searchCategory=ko.observable(null);f.searchCategories=ko.observableArray(null);f.searchLearningArea=ko.observable(null);f.searchLearningAreas=ko.observableArray(null);f.filterProductTheme=ko.observableArray([]);f.filterProductTopic=ko.observableArray([]);f.filterProductResourceType=ko.observableArray([]);f.filterProductLevel=ko.observableArray([]);f.filterKeywords=ko.observable(f.QueryStringKeywords());f.isCategoryPage=ko.observable(!1);f.expandFilterAge=ko.observable(!0);f.expandFilterTheme=ko.observable(!0);f.expandFilterTopic=ko.observable(!0);f.expandFilterResourceType=ko.observable(!0);f.expandFilterLevel=ko.observable(!0);f.expandFilterLearningArea=ko.observable(!1);f.expandFilterKeywords=ko.observable(!0);f.toggleShowFilters=function(){f.showFilters(!f.showFilters())};f.toggleSlidePanelVisible=function(){f.slidePanelVisible(!f.slidePanelVisible())};f.fromAge=ko.computed(function(){return f.ageRange()[0]});f.toAge=ko.computed(function(){return f.ageRange()[1]});f.filterAgeDisplay=ko.computed(function(){return f.allowYearFilter()?u?f.fromAge()==0&&f.toAge()==18?[]:["Age "+f.fromAge()+"-"+f.toAge()]:[]:[]});f.filterThemeDisplay=ko.computed(function(){return!u||!u.Themes?[]:_.compact(_.map(f.filterProductTheme(),function(n){var t=_.find(u.Themes,function(t){return t.Id==n});return t?{Id:n,Name:t.Name}:null}))});f.filterTopicDisplay=ko.computed(function(){return u?_.compact(_.map(f.filterProductTopic(),function(n){var t=_.find(u.Topics,function(t){return t.Id==n});return t?{Id:n,Name:t.Name}:null})):[]});f.filterResourceTypeDisplay=ko.computed(function(){return u?_.compact(_.map(f.filterProductResourceType(),function(n){var t=_.find(u.ResourceTypes,function(t){return t.Id==n});return t?{Id:n,Name:t.Name}:null})):[]});f.filterLevelDisplay=ko.computed(function(){if(!u)return[];if(!u.LearningArea)return[];var n=_.flatten(_.flatMap(u.LearningArea.Levels,function(n){return _.compact([n,n.Children])}));return _.compact(_.map(f.filterProductLevel(),function(t){var i=_.find(n,function(n){return n.Id==t});return i?{Id:t,Name:i.Name}:null}))});f.toggleFilter=function(n){n(!n())};f.selectAllAgeFilter=function(){_.each(f.ageRanges(),function(n){n.selected(!0)})};f.clearAgeFilter=function(){_.each(f.ageRanges(),function(n){n.selected(!1)});f.ageRange([0,18])};f.clearThemeFilter=function(){f.filterProductTheme([])};f.clearTopicFilter=function(){f.filterProductTopic([])};f.clearResourceTypeFilter=function(){f.filterProductResourceType([])};f.clearLevelFilter=function(){f.filterProductLevel([])};f.clearKeywordFilter=function(){f.filterKeywords("")};f.clearAllAttributeFilters=function(){f.clearThemeFilter();f.clearTopicFilter();f.clearResourceTypeFilter();f.clearLevelFilter()};f.clearAllFilters=function(){f.loading=!0;ko.postbox.publish("filters.cleared");f.clearAllAttributeFilters();f.clearAgeFilter();f.clearKeywordFilter();f.loading=!1;setTimeout(f.RefreshSearch,500)};f.hasFilters=ko.computed(function(){var n=f.filterAgeDisplay().length+f.filterThemeDisplay().length+f.filterTopicDisplay().length+f.filterResourceTypeDisplay().length+f.filterLevelDisplay().length;return n>0||f.filterKeywords()&&f.filterKeywords().length>0});f.productOrderByOptionId=ko.observable(f.QueryStringOrderBy()?f.QueryStringOrderBy():0);f.previousProductOrderByOptionId=ko.observable(0);f.TrackSearch=function(){common.FacebookEvent("Search")};f.RefreshSearch=function(){f.searchMode()&&(f.TrackSearch(),setTimeout(function(){$("form#search").submit()},500))};f.SubmitSearch=function(){return f.TrackSearch(),!0};f.SelectSearchCategory=function(n){f.searchCategory(n)};f.SelectCurrentCategory=function(){f.searchCategory({id:u.CurrentCategory.Id,name:u.CurrentCategory.Name})};f.SelectSearchLearningArea=function(n){f.searchLearningArea(n);f.RefreshSearch()};f.SetSearchLearningAreas=function(){var t=_.map(u.LearningAreas,function(n){return{id:n.Id,name:n.Name}}),n,i;t.unshift({name:r.allCategories});f.searchLearningAreas(t);n=f.QueryStringLearningAreaId();n!==null&&n!==""&&(i=_.find(f.searchLearningAreas(),function(t){return t.id===n}),f.searchLearningArea(i))};f.SetSearchResourceTypes=function(){var n=f.QueryStringResourceType(),t;n!==null&&n!==""&&(t=_.map(n.split(","),function(n){return+n}),f.filterProductResourceType(t))};f.SetSearchTopics=function(){var n=f.QueryStringTopic(),t;n!==null&&n!==""&&(t=_.map(n.split(","),function(n){return+n}),f.filterProductTopic(t))};f.SetSearchTheme=function(){var n=f.QueryStringTheme(),t;n!==null&&n!==""&&(t=_.map(n.split(","),function(n){return+n}),f.filterProductTheme(t))};f.SetFilterText=function(){var n=f.QueryStringFilterText();n!==null&&n!==""&&f.filterKeywords(n)};f.SetFilterProductLevel=function(){var n=f.QueryStringFilterProductLevel(),t;n!==null&&n!==""&&(t=_.map(n.split(","),function(n){return n}),f.filterProductLevel(t))};f.searchLevelNames=ko.computed(function(){var n="Years",i=_.filter(f.levels(),function(n){return n.Name.indexOf("Level")>-1}),t;return(i.length>5&&(n="Levels"),f.filterProductLevel().length===0)?[n]:(t=_.filter(f.levels(),function(n){return _.includes(f.filterProductLevel(),n.Id)}),_.map(t,function(n){return n.Name}))});f.selectAllSearchLevels=function(){var n=_.map(f.levels(),function(n){return n.Id});f.filterProductLevel(n)};f.clearAllSearchLevels=function(){f.filterProductLevel([])};f.SetSearchCategories=function(){var e,i,t;n||(n=[]);e=_.map(n,function(n){return{id:n.Id,name:n.Name}});e.unshift({name:r.allCategories});f.searchCategories(e);i=f.QueryStringCategoryId();i!==null&&i!==""&&(t=_.find(f.searchCategories(),function(n){return n.id===i}),f.searchCategory(t),f.isCategoryPage(!0),t&&!u.CurrentCategory&&(u.CurrentCategory={Id:t.id,Name:t.name}));u.CurrentCategory&&(f.currentCategoryName(u.CurrentCategory.Name),f.SelectCurrentCategory(),f.isCategoryPage(!0))};s=!1;f.AgeRangesChanged=function(){var i,t,r,n;s!==!0&&o!==!0&&(s=!0,i=ko.utils.arrayFilter(f.ageRanges(),function(n){return n.selected()}),t=i[0],t?(r=i[i.length-1],ko.utils.arrayForEach(f.ageRanges(),function(n){n.from>t.from&&n.to<r.to&&!n.selected()&&n.selected(!0)}),n=[f.ageRange()[0],f.ageRange()[1]],n[0]!==t.from&&(n[0]=t.from),n[1]!==r.to&&(n[1]=r.to),(n[0]!=f.ageRange()[0]||n[1]!=f.ageRange()[1])&&f.ageRange(n)):f.ageRange([0,18]),s=!1)};o=!1;f.AgesChanged=function(n,t){var r,i,u;o!==!0&&(o=!0,n===0&&t===18?(r=_.filter(f.ageRanges(),function(n){return n.selected()}),i=r.length>f.ageRanges().length/2,ko.utils.arrayForEach(f.ageRanges(),function(n){n.selected()!==i&&n.selected(i)})):ko.utils.arrayForEach(f.ageRanges(),function(i){var r=i.from>=n&&i.to<=t;i.selected()!==r&&i.selected(r)}),u={fromAge:f.fromAge(),toAge:f.toAge()},ko.postbox.publish("age.ranges.changed",u),o=!1)};f.PopulateFilters=function(){i&&i.Query&&(f.filterProductTheme(_.map(i.Query.FilterProductTheme,function(n){return n.toString()})),f.filterProductTopic(_.map(i.Query.FilterProductTopic,function(n){return n.toString()})),f.filterProductResourceType(_.map(i.Query.FilterProductResourceType,function(n){return n.toString()})),f.filterProductLevel(_.map(i.Query.FilterProductLevel,function(n){return n.toString()})))};f.HasInvalidFilters=function(){var n=!1,i,t,o,r,s,e;return u.Themes?(i=_.map(u.Themes,function(n){return n.Id}),t=_.intersection(f.filterProductTheme(),i),t.length!=f.filterProductTheme().length&&(f.filterProductTheme(t),n=!0)):f.filterProductTheme().length>0&&(f.filterProductTheme([]),n=!0),u.Topics?(i=_.map(u.Topics,function(n){return n.Id}),t=_.intersection(f.filterProductTopic(),i),t.length!=f.filterProductTopic().length&&(f.filterProductTopic(t),n=!0)):f.filterProductTopic().length>0&&(f.filterProductTopic([]),n=!0),u.LearningArea?(o=_.reduce(u.LearningArea.Levels,function(n,t){return n.push(t.Id),n.push(_.map(t.Children,function(n){return n.Id})),_.flatten(n)},[]),r=_.intersection(f.filterProductLevel(),o),r.length!=f.filterProductLevel().length&&(f.filterProductLevel(r),n=!0)):f.filterProductLevel().length>0&&(f.filterProductLevel([]),n=!0),u.ResourceTypes?(s=_.map(u.ResourceTypes,function(n){return n.Id}),e=_.intersection(f.filterProductResourceType(),s),e.length!=f.filterProductResourceType().length&&(f.filterProductResourceType(e),n=!0)):f.filterProductResourceType().length>0&&(f.filterProductResourceType([]),n=!0),n};f.GetRangesForSection=function(n){var i=[],t;if(n==="Primary"){for(t=5;t<12;t++)i.push({from:t,to:t+1});return i}if(n==="Secondary"){for(t=12;t<16;t++)i.push({from:t,to:t+1});return i.push({from:16,to:18,name:"16-18"}),i}if(u.MarketName.indexOf("iUgo")>-1){for(t=5;t<14;t++)i.push({from:t,to:t,fromYear:e(t),toYear:e(t)});return i.push({from:14,to:18,fromYear:10,toYear:13,name:"14-18",yearName:"Year 10+"}),i}for(i.push({from:0,to:5}),t=5;t<14;t++)i.push({from:t,to:t+1,fromYear:e(t),toYear:e(t)});return i.push({from:14,to:18,fromYear:10,toYear:13,name:"14-18",yearName:"Year 10+"}),i};f.PopulateAgeRanges=function(){i&&i.Query&&f.ageRange([i.Query.FromAge,i.Query.ToAge]);var n=f.GetRangesForSection(u.Section);ko.utils.arrayForEach(n,function(n){n.selected=ko.observable(n.from>=f.fromAge()&&n.to<=f.toAge()&&!(f.fromAge()==0&&f.toAge()==18));n.name||(n.name=n.from+"-"+n.to,n.yearName="Year "+n.fromYear);n.selected.subscribe(function(){f.AgeRangesChanged()})});f.ageRanges(n)};f.hasAgeRangesSelected=ko.computed(function(){var n=ko.utils.arrayFilter(f.ageRanges(),function(n){return n.selected()});return n.length>0});f.selectedAgeRangeDescription=ko.computed(function(){return f.hasAgeRangesSelected()?f.fromAge()===0&&f.toAge()===18?r.allAges:r.ages+" "+f.fromAge()+"-"+f.toAge():r.allAges});f.selectedYearRangeDescription=ko.computed(function(){return f.hasAgeRangesSelected()?f.fromAge()===0&&f.toAge()===18?r.years:f.fromAge()===f.toAge()?"Year "+f.fromYear():r.years+" "+f.fromYear()+"-"+f.toYear():r.years});f.yearRanges=ko.computed(function(){return _.filter(f.ageRanges(),function(n){return!!n.fromYear&&!!n.toYear})});f.ProductAttributesChanged=function(){if(!f.loading)if(f.searchMode())setTimeout(f.RefreshSearch,10);else{var n={theme:f.filterProductTheme(),topic:f.filterProductTopic(),resourceType:f.filterProductResourceType(),level:f.filterProductLevel()};ko.postbox.publish("product.attributes.changed",n)}};f.ProductLevelChanged=function(){f.searchMode()||f.ProductAttributesChanged()};f.yearRange=ko.pureComputed({read:function(){return[e(f.fromAge()),e(f.toAge())]},write:function(n){var t=[h(n[0]),h(n[1])];f.ageRange(t)},owner:f});f.fromYear=ko.pureComputed(function(){return e(f.fromAge())});f.toYear=ko.pureComputed(function(){return e(f.toAge())});f.filterYearDisplay=ko.computed(function(){return u?f.fromAge()===0&&f.toAge()===18?[]:f.fromAge()===f.toAge()?["Year "+e(f.fromAge())]:["Year "+e(f.fromAge())+"-"+e(f.toAge())]:[]});f.PopulateFilters();f.PopulateAgeRanges();f.SetSearchCategories();f.SetSearchLearningAreas();f.SetSearchResourceTypes();f.SetSearchTopics();f.SetSearchTheme();f.SetFilterText();f.SetFilterProductLevel();f.filterProductTheme.subscribe(f.ProductAttributesChanged);f.filterProductResourceType.subscribe(f.ProductAttributesChanged);f.filterProductTopic.subscribe(f.ProductAttributesChanged);f.filterProductLevel.subscribe(f.ProductLevelChanged);f.filterKeywords.subscribe(function(){f.ProductAttributesChanged()});f.ageRange.subscribe(function(){f.AgesChanged(f.fromAge(),f.toAge())});f.HasFilters=ko.computed(function(){var n=f.filterProductTheme().length+f.filterProductResourceType().length+f.filterProductTopic().length+f.filterProductLevel().length;return n>0});f.loading=!1},StoreSession=function(n){var t=this;t.id=n.Id;t.basketLines=ko.observable(n.BasketLines);t.basketLineCount=ko.observable(n.BasketLineCount);t.wishListCount=ko.observable(n.WishListCount);t.promoMessages=ko.observableArray(n.PromoMessage);t.specialOfferId=ko.observable(n.SpecialOfferId);t.specialOfferCount=ko.observable(n.SpecialOfferCount);t.hasStoreCredit=ko.observable(n.HasStoreCredit);t.storeCreditAvailable=ko.observable(n.StoreCreditAvailable)};var SubscriptionProductDetail=function(n){var i=this,t,r;for(ko.utils.extend(i,new ProductDetail(n)),t=0;t<i.Product().productPrices().length;t++)r=i.Product().productPrices()[t],r.requiresDelivery=!1,r.chosenQty(1)},SubscriptionsPage=function(n){var t=this;ko.utils.extend(t,new Store(n));t.title=null;t.id=n.Id;t.products=ko.observableArray();t.categories=ko.observableArray();t.PopulateProducts=function(n){var r,i,u,f;if(n!=null&&n.length!=0)for(r=0;r<n.length;r++){for(i=new Product(n[r]),i.index=t.products().length+1,i.Hydrate(),u=0;u<i.productPrices().length;u++)f=i.productPrices()[u],f.requiresDelivery=!1,f.chosenQty(1);t.products.push(i)}};t.PopulateCategories=function(n){var r=$.map(n,function(n){return new Category(n)}),i;for(t.categories(r),i=0;i<t.categories().length;i++)t.categories()[i].SetPerentCategory(null)};t.PopulateCategories(n.Categories);t.PopulateProducts(n.Subscriptions)},WishlistItem=function(n){var t=this;t.id=n.Id;t.product=new Product(n.Product)},WishListItemSetter=function(){var n=this;n.StoreSessionId=null;n.ProductId=null},StoreService=function(n){var t=this,i;t.urls=n;i=new AjaxService;t.SaveBasketLineSpecific=function(t,i,r,u){var f={StoreSessionId:t,ProductPriceId:i,Quantity:u,MarketId:r};return $.ajax(n.apiBasketLine,{data:JSON.stringify(f),type:"post",contentType:"application/json; charset=utf-8'"})};t.AddMultipleToCart=function(t,i){var r=n.apiBasketLine+"?storeSessionId="+t+"&productPriceIds="+i.join(",");return $.ajax(r,{type:"post",contentType:"application/json; charset=utf-8'"})};t.GetBasket=function(t){return $.ajax(n.apiBasket+"?storeSessionId="+t,{type:"get",cache:!1})};t.AddProductToFilebox=function(t){var i=n.apiBasketLine+"/Filebox?productId="+t;return $.ajax(i,{type:"post",contentType:"application/json; charset=utf-8'"})};t.GetPriceBreakdown=function(t){return $.ajax(n.apiBasket+"/PriceBreakdown?storeSessionId="+t,{type:"get",cache:!1})};t.GetPromoMessage=function(t){return $.ajax(n.apiBasket+"/PromoMessage?storeSessionId="+t,{type:"get",cache:!1})};t.GetWishlist=function(t){return $.ajax(n.apiWishlist+"?storeSessionId="+t,{type:"get",cache:!1})};t.DeleteBasket=function(t){return $.ajax(n.apiBasket+"?storeSessionId="+t,{type:"delete"})};t.GetPromotion=function(t){return $.ajax(n.apiPromoCode+"/Product/"+t,{type:"get"})};t.GetDetailsExtension=function(t){return $.ajax(n.apiProductDetail+"?productId="+t,{type:"get"})};t.GetKitsetComponentModels=function(t){return $.ajax(n.apiProductDetail+"/KitsetComponentModels?productId="+t,{type:"get"})};t.ToggleWishlistItem=function(t,r){var u=n.apiWishlist+"?storeSessionId="+t+"&productId="+r;return i.post(u)};t.SaveWishlistItem=function(t,i){var r={StoreSessionId:t,ProductId:i};return $.ajax(n.apiWishlist,{data:JSON.stringify(r),type:"post",contentType:"application/json; charset=utf-8'"})};t.DeleteWishlistItem=function(t,i){var r={StoreSessionId:t,ProductId:i};return $.ajax(n.apiWishlist,{data:JSON.stringify(r),type:"delete",contentType:"application/json; charset=utf-8'"})};t.RefreshStoreSession=function(t){return $.ajax(n.apiStoreSession,{data:"id="+t,type:"get",cache:!1})};t.PopulateSeries=function(t){return $.ajax(n.apiSeriesSearch,{data:JSON.stringify(t),type:"post",contentType:"application/json; charset=utf-8'"})};t.QuickAddSearch=function(t){return $.ajax(n.apiProductSearch+"/QuickAddSearch?quickAddSearchTerm="+t,{type:"get",cache:!1})};t.GetProductsForSeries=function(t,i){return $.ajax(n.apiProductSearch+"/GetProductsForSeries?storeSessionId="+t+"&seriesId="+i,{type:"get",cache:!1})};t.PopulateProducts=function(t){return $.ajax(n.apiProductSearch,{data:JSON.stringify(t),type:"post",contentType:"application/json; charset=utf-8'"})};t.SaveFilters=function(t,i,r,u,f,e){var o=n.apiStoreSession+"?storeSessionId="+t+"&fromAge="+i+"&toAge="+r+"&resourceTypes="+u.join(",")+"&levels="+f.join(",")+"&themes="+e.join(",");return $.ajax(o,{type:"post",contentType:"application/json; charset=utf-8'"})};t.SchoolSearch=function(t,i){return $.ajax({type:"get",dataType:"json",url:n.apiSchool+"/Search",cache:!0,data:{query:t,marketId:i}})};t.SchoolSearchByCountry=function(t,i){return $.ajax({type:"get",dataType:"json",url:n.apiSchool+"/Search?query="+t+"&country=true&countryId="+i,cache:!0,data:{query:t,countryId:i,country:!0}})};t.SchoolSearchByLocation=function(t,i){return $.ajax({type:"get",dataType:"json",url:n.apiSchool+"/SearchByLocation?postcode="+t+"&city="+i,cache:!1})};t.GetSchool=function(t){return $.ajax({type:"get",dataType:"json",url:n.apiSchool+"/Search/"+t,cache:!0})};t.GetSchoolAddress=function(t){return $.ajax({type:"get",dataType:"json",url:n.apiSchoolAddress+"?schoolId="+t,cache:!0})};t.SetSchool=function(i,r){if(!r)return t.ClearSessionValue(i,"schoolId");var u=n.apiBasket+"?storeSessionId="+i+"&schoolId="+r;return $.ajax(u,{type:"post",error:common.ProcessAjaxError})};t.SetSchoolName=function(i,r){if(!r)return t.ClearSessionValue(i,"schoolName");var u=n.apiBasket+"?storeSessionId="+i+"&schoolName="+r;return $.ajax(u,{type:"post",error:common.ProcessAjaxError})};t.SetMarket=function(t,i){var r=n.apiBasket+"?storeSessionId="+t+"&marketId="+i;return $.ajax(r,{type:"post",error:common.ProcessAjaxError})};t.SetPromoCode=function(t,i,r){var u=n.apiBasket+"?storeSessionId="+t+"&promoCode="+i+"&force="+!!r;return $.ajax(u,{type:"post"})};t.RemovePromoCode=function(t,i){var r=n.apiBasket+"?storeSessionId="+t+"&promoCodeId="+i;return $.ajax(r,{type:"post"})};t.SaveApprovalResponse=function(t){var r=n.apiApprovalOrderResponse;return i.post(r,JSON.stringify(t))};t.SaveInvoiceResponse=function(t){var r=n.apiInvoiceOrderResponse;return i.post(r,JSON.stringify(t))};t.SavePromotionResponse=function(t,r){var u=n.apiPromotionResponse;return i.post(u,JSON.stringify(r))};t.SaveApprovalOfferFeedback=function(t,r){var u=n.apiApprovalOffer+"?offerId="+t+"&feedback="+encodeURIComponent(r);return i.post(u,{})};t.MarkApprovalOfferAsViewed=function(t){var r=n.apiApprovalOffer+"/Viewed?offerId="+t;return i.post(r,{})};t.UserSearch=function(t){return $.ajax({type:"get",dataType:"json",url:n.apiSignUp+"/Search",cache:!1,data:{email:t}})};t.GeolocateIP=function(){return $.ajax(n.apiGeolocation,{type:"get",cache:!1})}},Client;(function(n){var t=function(){function n(n){this.id=ko.observable();this.name=ko.observable();this.nameSlug=ko.observable();this.type=ko.observable();this.productCount=ko.observable();this.fromJs(n)}return n.prototype.fromJs=function(n){this.id(n.Id);this.name(n.Name);this.nameSlug(n.NameSlug);this.type(n.Type);this.productCount(n.ProductCount)},n.prototype.toJs=function(){return{Id:this.id(),Name:this.name(),NameSlug:this.nameSlug(),Type:this.type(),ProductCount:this.productCount()}},n}();n.KnockoutProductAttribute=t})(Client||(Client={})),function(n){var t=function(){function n(n){this.code=ko.observable();this.description=ko.observable();this.metadataDescription=ko.observable();this.imageUrl=ko.observable();this.name=ko.observable();this.hasBlurb=ko.observable();this.fromJs(n)}return n.prototype.fromJs=function(n){this.code(n.Code);this.description(n.Description);this.metadataDescription(n.MetadataDescription);this.imageUrl(n.ImageUrl);this.name(n.Name);this.hasBlurb(n.HasBlurb)},n.prototype.toJs=function(){return{Code:this.code(),Description:this.description(),MetadataDescription:this.metadataDescription(),ImageUrl:this.imageUrl(),Name:this.name(),HasBlurb:this.hasBlurb()}},n}();n.KnockoutAuthorStoreItemModel=t}(Client||(Client={})),function(n){var t=function(){function t(n){this.id=ko.observable();this.name=ko.observable();this.description=ko.observable();this.mediaPrefix=ko.observable();this.mediaDescription=ko.observable();this.order=ko.observable();this.priceWithoutGST=ko.observable();this.regularPriceWithoutGST=ko.observable();this.marketId=ko.observable();this.isDigital=ko.observable();this.requiresDelivery=ko.observable();this.isSpecial=ko.observable();this.schoolInvoicingAllowed=ko.observable();this.quantityPrices=ko.observableArray([]);this.price=ko.observable();this.regularPrice=ko.observable();this.fromJs(n)}return t.prototype.fromJs=function(t){this.id(t.Id);this.name(t.Name);this.description(t.Description);this.mediaPrefix(t.MediaPrefix);this.mediaDescription(t.MediaDescription);this.order(t.Order);this.priceWithoutGST(t.PriceWithoutGST);this.regularPriceWithoutGST(t.RegularPriceWithoutGST);this.marketId(t.MarketId);this.isDigital(t.IsDigital);this.requiresDelivery(t.RequiresDelivery);this.isSpecial(t.IsSpecial);this.schoolInvoicingAllowed(t.SchoolInvoicingAllowed);this.price(t.Price);this.regularPrice(t.RegularPrice);this.quantityPrices(t.QuantityPrices.map(function(t){return new n.KnockoutProductQuantityPriceStoreItemModel(t)}))},t.prototype.toJs=function(){return{Id:this.id(),Name:this.name(),Description:this.description(),MediaPrefix:this.mediaPrefix(),MediaDescription:this.mediaDescription(),Order:this.order(),PriceWithoutGST:this.priceWithoutGST(),RegularPriceWithoutGST:this.regularPriceWithoutGST(),MarketId:this.marketId(),IsDigital:this.isDigital(),RequiresDelivery:this.requiresDelivery(),IsSpecial:this.isSpecial(),SchoolInvoicingAllowed:this.schoolInvoicingAllowed(),Price:this.price(),RegularPrice:this.regularPrice(),QuantityPrices:this.quantityPrices().map(function(n){return n.toJs()})}},t}();n.KnockoutProductPriceStoreItemModel=t}(Client||(Client={})),function(n){var t=function(){function n(n){this.minimumQuantity=ko.observable();this.price=ko.observable();this.fromJs(n)}return n.prototype.fromJs=function(n){this.minimumQuantity(n.MinimumQuantity);this.price(n.Price)},n.prototype.toJs=function(){return{MinimumQuantity:this.minimumQuantity(),Price:this.price()}},n}();n.KnockoutProductQuantityPriceStoreItemModel=t}(Client||(Client={})),function(n){var t=function(){function t(n){this.id=ko.observable();this.marketId=ko.observable();this.code=ko.observable();this.name=ko.observable();this.subtitle=ko.observable();this.seriesDescription=ko.observable();this.description=ko.observable();this.metadataDescription=ko.observable();this.isbn=ko.observable();this.imageUrl=ko.observable();this.largeImageUrl=ko.observable();this.authors=ko.observableArray([]);this.productPrices=ko.observableArray([]);this.categoryIds=ko.observableArray([]);this.fromAge=ko.observable();this.toAge=ko.observable();this.fromYear=ko.observable();this.toYear=ko.observable();this.isInWishlist=ko.observable();this.isInFilebox=ko.observable();this.isSubscription=ko.observable();this.seriesOrder=ko.observable();this.resourceTypes=ko.observableArray([]);this.themes=ko.observableArray([]);this.topics=ko.observableArray([]);this.learningAreaIds=ko.observableArray([]);this.numberOfPages=ko.observable();this.datePublished=ko.observable();this.lowestPrice=ko.observable();this.isKitsetParent=ko.observable();this.isProductCatalogue=ko.observable();this.isFreebie=ko.observable();this.availableInLibrarySubscription=ko.observable();this.yearLevels=ko.observableArray([]);this.fromJs(n)}return t.prototype.fromJs=function(t){this.id(t.Id);this.marketId(t.MarketId);this.code(t.Code);this.name(t.Name);this.subtitle(t.Subtitle);this.seriesDescription(t.SeriesDescription);this.description(t.Description);this.metadataDescription(t.MetadataDescription);this.isbn(t.ISBN);this.imageUrl(t.ImageUrl);this.largeImageUrl(t.LargeImageUrl);this.categoryIds(t.CategoryIds);this.fromAge(t.FromAge);this.toAge(t.ToAge);this.fromYear(t.FromYear);this.toYear(t.ToYear);this.isInWishlist(t.IsInWishlist);this.isInFilebox(t.IsInFilebox);this.isSubscription(t.IsSubscription);this.seriesOrder(t.SeriesOrder);this.resourceTypes(t.ResourceTypes);this.themes(t.Themes);this.topics(t.Topics);this.learningAreaIds(t.LearningAreaIds);this.numberOfPages(t.NumberOfPages);this.datePublished(t.DatePublished);this.lowestPrice(t.LowestPrice);this.isKitsetParent(t.IsKitsetParent);this.isProductCatalogue(t.IsProductCatalogue);this.isFreebie(t.IsFreebie);this.availableInLibrarySubscription(t.AvailableInLibrarySubscription);this.yearLevels(t.YearLevels);this.authors(t.Authors.map(function(t){return new n.KnockoutAuthorStoreItemModel(t)}));this.productPrices(t.ProductPrices.map(function(t){return new n.KnockoutProductPriceStoreItemModel(t)}))},t.prototype.toJs=function(){return{Id:this.id(),MarketId:this.marketId(),Code:this.code(),Name:this.name(),Subtitle:this.subtitle(),SeriesDescription:this.seriesDescription(),Description:this.description(),MetadataDescription:this.metadataDescription(),ISBN:this.isbn(),ImageUrl:this.imageUrl(),LargeImageUrl:this.largeImageUrl(),CategoryIds:this.categoryIds(),FromAge:this.fromAge(),ToAge:this.toAge(),FromYear:this.fromYear(),ToYear:this.toYear(),IsInWishlist:this.isInWishlist(),IsInFilebox:this.isInFilebox(),IsSubscription:this.isSubscription(),SeriesOrder:this.seriesOrder(),ResourceTypes:this.resourceTypes(),Themes:this.themes(),Topics:this.topics(),LearningAreaIds:this.learningAreaIds(),NumberOfPages:this.numberOfPages(),DatePublished:this.datePublished(),LowestPrice:this.lowestPrice(),IsKitsetParent:this.isKitsetParent(),IsProductCatalogue:this.isProductCatalogue(),IsFreebie:this.isFreebie(),AvailableInLibrarySubscription:this.availableInLibrarySubscription(),YearLevels:this.yearLevels(),Authors:this.authors().map(function(n){return n.toJs()}),ProductPrices:this.productPrices().map(function(n){return n.toJs()})}},t}();n.KnockoutProductStoreItemModel=t}(Client||(Client={})),function(n){var t=function(){function t(n){this.id=ko.observable();this.marketId=ko.observable();this.code=ko.observable();this.name=ko.observable();this.subtitle=ko.observable();this.seriesDescription=ko.observable();this.description=ko.observable();this.metadataDescription=ko.observable();this.isbn=ko.observable();this.imageUrl=ko.observable();this.largeImageUrl=ko.observable();this.authors=ko.observableArray([]);this.productPrices=ko.observableArray([]);this.categoryIds=ko.observableArray([]);this.fromAge=ko.observable();this.toAge=ko.observable();this.fromYear=ko.observable();this.toYear=ko.observable();this.isInWishlist=ko.observable();this.isInFilebox=ko.observable();this.isSubscription=ko.observable();this.seriesOrder=ko.observable();this.resourceTypes=ko.observableArray([]);this.themes=ko.observableArray([]);this.topics=ko.observableArray([]);this.learningAreaIds=ko.observableArray([]);this.numberOfPages=ko.observable();this.datePublished=ko.observable();this.lowestPrice=ko.observable();this.isKitsetParent=ko.observable();this.isProductCatalogue=ko.observable();this.isFreebie=ko.observable();this.availableInLibrarySubscription=ko.observable();this.yearLevels=ko.observableArray([]);this.title=ko.observable();this.authorNames=ko.observable();this.seriesStoreItemViewModels=ko.observableArray([]);this.relatedProducts=ko.observableArray([]);this.productPreviews=ko.observableArray([]);this.authorsToDisplay=ko.observableArray([]);this.fromJs(n)}return t.prototype.fromJs=function(t){this.id(t.Id);this.marketId(t.MarketId);this.code(t.Code);this.name(t.Name);this.subtitle(t.Subtitle);this.seriesDescription(t.SeriesDescription);this.description(t.Description);this.metadataDescription(t.MetadataDescription);this.isbn(t.ISBN);this.imageUrl(t.ImageUrl);this.largeImageUrl(t.LargeImageUrl);this.categoryIds(t.CategoryIds);this.fromAge(t.FromAge);this.toAge(t.ToAge);this.fromYear(t.FromYear);this.toYear(t.ToYear);this.isInWishlist(t.IsInWishlist);this.isInFilebox(t.IsInFilebox);this.isSubscription(t.IsSubscription);this.seriesOrder(t.SeriesOrder);this.resourceTypes(t.ResourceTypes);this.themes(t.Themes);this.topics(t.Topics);this.learningAreaIds(t.LearningAreaIds);this.numberOfPages(t.NumberOfPages);this.datePublished(t.DatePublished);this.lowestPrice(t.LowestPrice);this.isKitsetParent(t.IsKitsetParent);this.isProductCatalogue(t.IsProductCatalogue);this.isFreebie(t.IsFreebie);this.availableInLibrarySubscription(t.AvailableInLibrarySubscription);this.yearLevels(t.YearLevels);this.authors(t.Authors.map(function(t){return new n.KnockoutAuthorStoreItemModel(t)}));this.productPrices(t.ProductPrices.map(function(t){return new n.KnockoutProductPriceStoreItemModel(t)}));this.title(t.Title);this.authorNames(t.AuthorNames);this.seriesStoreItemViewModels(t.SeriesStoreItemViewModels.map(function(t){return new n.KnockoutSeriesStoreItemModel(t)}));this.relatedProducts(t.RelatedProducts.map(function(t){return new n.KnockoutProductStoreItemModel(t)}));this.productPreviews(t.ProductPreviews.map(function(t){return new n.KnockoutProductPreviewStoreItemModel(t)}));this.authorsToDisplay(t.AuthorsToDisplay.map(function(t){return new n.KnockoutAuthorStoreItemModel(t)}))},t.prototype.toJs=function(){return{Id:this.id(),MarketId:this.marketId(),Code:this.code(),Name:this.name(),Subtitle:this.subtitle(),SeriesDescription:this.seriesDescription(),Description:this.description(),MetadataDescription:this.metadataDescription(),ISBN:this.isbn(),ImageUrl:this.imageUrl(),LargeImageUrl:this.largeImageUrl(),CategoryIds:this.categoryIds(),FromAge:this.fromAge(),ToAge:this.toAge(),FromYear:this.fromYear(),ToYear:this.toYear(),IsInWishlist:this.isInWishlist(),IsInFilebox:this.isInFilebox(),IsSubscription:this.isSubscription(),SeriesOrder:this.seriesOrder(),ResourceTypes:this.resourceTypes(),Themes:this.themes(),Topics:this.topics(),LearningAreaIds:this.learningAreaIds(),NumberOfPages:this.numberOfPages(),DatePublished:this.datePublished(),LowestPrice:this.lowestPrice(),IsKitsetParent:this.isKitsetParent(),IsProductCatalogue:this.isProductCatalogue(),IsFreebie:this.isFreebie(),AvailableInLibrarySubscription:this.availableInLibrarySubscription(),YearLevels:this.yearLevels(),Title:this.title(),AuthorNames:this.authorNames(),Authors:this.authors().map(function(n){return n.toJs()}),ProductPrices:this.productPrices().map(function(n){return n.toJs()}),SeriesStoreItemViewModels:this.seriesStoreItemViewModels().map(function(n){return n.toJs()}),RelatedProducts:this.relatedProducts().map(function(n){return n.toJs()}),ProductPreviews:this.productPreviews().map(function(n){return n.toJs()}),AuthorsToDisplay:this.authorsToDisplay().map(function(n){return n.toJs()})}},t}();n.KnockoutProductStoreItemDetailModel=t}(Client||(Client={})),function(n){var t=function(){function n(n){this.imageUrl=ko.observable();this.fromJs(n)}return n.prototype.fromJs=function(n){this.imageUrl(n.ImageUrl)},n.prototype.toJs=function(){return{ImageUrl:this.imageUrl()}},n}();n.KnockoutProductPreviewStoreItemModel=t}(Client||(Client={}))