\n - You only need to enter this encryption password once as long as you stay signed in. \n - It is important so that no one other than you and the people you are communicating with can access the content of your messages. \n - By default the content of your messages is fully encrypted. For heightened security you may wish to go to your app settings and turn off push notifications in order to disallow metadata from being tracked. \n
\n Transactions are non-refundable. \n You will be notified when your post reaches the requested number of views. \n The amount of time this will take depends on site activity, so don\'t worry if you don\'t hear from us for a while; we will keep it in circulation until it reaches the goal!\n
\n
\n \n
\n
\n You will be notified if you post is accepted or rejected by {{data.destination}}. Once they accept, this post will not be able to be deleted.\n
\n - You only need to enter this encryption password once as long as you stay signed in. \n - It is important so that no one other than you and the people you are communicating with can access the content of your messages. \n - By default the content of your messages is fully encrypted. For heightened security you may wish to go to your app settings and turn off push notifications in order to disallow metadata from being tracked. \n
\n Transactions are non-refundable. \n You will be notified when your post reaches the requested number of views. \n The amount of time this will take depends on site activity, so don\'t worry if you don\'t hear from us for a while; we will keep it in circulation until it reaches the goal!\n
\n
\n \n
\n
\n You will be notified if you post is accepted or rejected by {{data.destination}}. Once they accept, this post will not be able to be deleted.\n
')),crypt.setPrivateKey(n.get("private-key")),crypt.decrypt(r.message,function(n){e.message=t("linky")(n),i.html(o.getTrustedHtml(e.message))})}}};return e.$inject=["$rootScope","$filter","storage","$compile","$sce"],e}),define("directives/imageCache",["angular"],function(){"use strict";var e=function(){return{restrict:"A",link:function(){}}};return e.$inject=["$ionicPlatform"],e}),define("directives/thumbs",["angular"],function(e){"use strict";var t=function(t,n){return{restrict:"A",link:function(t,i,o){var r=o.$observe("thumbs",function(t){t.indexOf(n.get("user_guid"))>-1?e.element(i).addClass("selected"):e.element(i).removeClass("selected")});t.$on("$destroy",function(){r()})}}};return t.$inject=["$rootScope","storage"],t}),define("directives/playVideo",["angular"],function(){"use strict";var e=function(e,t,n,i,o,r,a,s,c,l){return{restrict:"AE",link:function(e,t,n){e.showVideo=!1;var a=n.$observe("playsrc",function(t){e.srcFull=i.trustAsResourceUrl(t),a()});e.play=function(){if(l.playing&&("android"==device.platform||"Android"==device.platform))return!1;l.playing=!0,e.$digest(),("android"==device.platform||"Android"==device.platform||"amazon-fireos"==device.platform)&&StatusBar.hide(),o.show({template:"Loading..."}),r(function(){o.hide()},5e3),e.showVideo=!0,("android"==device.platform||"Android"==device.platform)&&(e.showVideo=!1,e.$apply());var n=t[0].querySelector("#video");n.src=e.srcFull,console.log("video src == "+n.src),console.log("trying to play:: "+n.src),n.load(),n.play(),"iOS"==device.platform?n.webkitEnterFullscreen():n.webkitRequestFullscreen(),n.onplaying=function(){o.hide()},n.onerror=function(){o.hide(),l.playing=!1,alert("Sorry, there was a problem playing this video. Please try again in a few minutes.")},n.addEventListener("webkitendfullscreen",function(){n.pause(),e.showVideo=!1,l.playing=!1,e.$apply(),console.log("ended full screen"),StatusBar.show()}),n.addEventListener("webkitfullscreenchange",function(){e.showVideo=!1,e.$apply(),document.webkitIsFullScreen||(n.pause(),l.playing=!1,StatusBar.show())}),n.addEventListener("ended",function(){n.pause(),e.showVideo=!1,l.playing=!1,e.$apply(),StatusBar.show()},!1)},t.on("click",e.play),e.$on("$destroy",function(){t.off("click",e.play)})}}};return e.$inject=["$ionicScrollDelegate","$interval","Client","$sce","$ionicLoading","$timeout","$ionicGesture","$ionicPosition","$ionicPlatform","$rootScope"],e}),define("directives/subscribe",["angular"],function(e){"use strict";var t=function(t,n,i,o,r,a){return{restrict:"A",link:function(t,s){var c=s.find("i");t.entity.subscribed&&e.element(c).addClass("selected");var l=0;o.on("dragright",function(){if(l+=1,r(function(){l=0},600),l>2){if(a.show({template:''}),r(function(){a.hide()},1e3),t.entity.subscribed)return console.log("already subscribed"),!0;t.entity.subscribed=!0,e.element(c).addClass("selected"),console.log("posting to api/v1/subscribe/"+t.entity.guid),n.post("api/v1/subscribe/"+t.entity.guid,{},function(t){e.element(c).addClass("selected"),i.put("entities.cb",Date.now()),console.log(t)},function(t){e.element(c).removeClass("selected"),console.log("error",t)})}},s);var u=0;o.on("dragleft",function(){u+=1,r(function(){u=0},600),u>2&&(console.log(t.view),"swipe"==t.view&&s.remove())},s)}}};return t.$inject=["$rootScope","Client","Cacher","$ionicGesture","$timeout","$ionicLoading"],t}),define("directives/swipe",["angular"],function(){"use strict";var e=function(e,t,n,i){return{restrict:"A",scope:{swipeOnLeft:"&swipeOnLeft",swipeOnRight:"&swipeOnRight",swipeOnUp:"&swipeOnUp",swipeOnDown:"&swipeOnDown"},link:function(e,t,n){t.css("transform","translate3d(0px, 0px, 0)"),t.css("webkitTransform","translate3d(0px, 0px, 0)"),i.on("dragstart",function(e){e.preventDefault();{var t=320,n=window.innerWidth/2+1*(t/2);Math.abs(n-e.gesture.touches[0].pageX)}},t),i.on("drag",function(i){i.preventDefault(),ionic.requestAnimationFrame(function(){var o=i.gesture.deltaX/-1e3,r=Math.atan(o),a=.8*i.gesture.deltaX,s=.8*i.gesture.deltaY;if(e.$eval(n.swipeDisableVertical)){if(!(-15>a||a>15))return!1;if("android"==device.platform||"Android"==device.platform)return!1}e.$eval(n.swipeDisableVertical)&&(s=0),ionic.requestAnimationFrame(function(){t.css("transform","translate3d("+a+"px, "+s+"px, 0) rotate("+(r||0)+"rad)"),t.css("webkitTransform","translate3d("+a+"px, "+s+"px, 0) rotate("+(r||0)+"rad)")}),t.css("z-index",99999999)})},t),i.on("dragend",function(i){ionic.requestAnimationFrame(function(){t.css("webkitTransform","translate3d(0, 0, 0)"),t.css("transform","translate3d(0, 0, 0)");var o=100,r=-100,a=-140,s=140;return i.gesture.deltaX>o?(e.swipeOnRight(),!0):i.gesture.deltaXs?(e.swipeOnDown(),!0):void 0})},t)}}};return e.$inject=["$rootScope","Client","Cacher","$ionicGesture","$timeout","$ionicLoading","$compile"],e}),define("directives/walletCounter",["angular"],function(){"use strict";var e=function(e,t,n,i){return{restrict:"E",template:"{{$root.points}}",scope:{},link:function(){t(function(){i.getCount()})}}};return e.$inject=["$rootScope","$timeout","Client","wallet"],e}),define("directives/directives",["require","angular","services/services","directives/activityView","directives/remindView","directives/ownerBriefView","directives/decrypt","directives/imageCache","directives/thumbs","directives/playVideo","directives/subscribe","directives/swipe","directives/walletCounter"],function(e){"use strict";var t=e("angular"),n=(e("services/services"),t.module("app.directives",["app.services"]));return n.directive("activityView",e("directives/activityView")),n.directive("remindView",e("directives/remindView")),n.directive("ownerBriefView",e("directives/ownerBriefView")),n.directive("decrypt",e("directives/decrypt")),n.directive("imageCache",e("directives/imageCache")),n.directive("thumbs",e("directives/thumbs")),n.directive("playVideo",e("directives/playVideo")),n.directive("subscribe",e("directives/subscribe")),n.directive("swipe",e("directives/swipe")),n.directive("walletCounter",e("directives/walletCounter")),n}),define("controllers/LoadingCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){navigator.splashscreen.hide();var l=a(function(){t.go(r.get("access_token")&&r.get("loggedin")?"tab.newsfeed":"login")},100);intents.onIntent(function(){a.cancel(l),t.go("tab.capture"),c.registerBackButtonAction(function(){navigator.app.exitApp()},501)}),s.register()}return e.$inject=["$scope","$state","OAuth","Client","$ionicPopup","storage","$timeout","push","$ionicPlatform"],e}),define("controllers/TutorialCtrl",[],function(){"use strict";function e(e,t){e.entity={guid:"not-real",type:"username",name:"Albert Einstein",avatar_url:"http://content8.flixster.com/rtactor/42/23/42230_pro.jpg"},e.slideHasChanged=function(e){8==e&&t.go("tab.newsfeed")},e.news=[{guid:63,user:"Mark Harding",message:"Welcome to the Minds app!"},{guid:421,user:"Johnny Lagrange",message:"Share your videos, photos & status."}]}return e.$inject=["$scope","$state","storage"],e}),define("controllers/TabsCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){t.logout=function(){o.remove("loggedin"),o.remove("access_token"),o.remove("private-key"),n.go("login")},t.onTabSelect=function(e){return e==n.current.name?(n.go(e,{},{reload:!0}),!0):void n.go(e)},r.listen("chat",function(t){e.newChat="minds-yellow",e.$apply(),t.changeState&&"tab.chat"!=n.current.name&&n.go("tab.chat")}),r.listen("notification",function(t){e.newNotification="minds-yellow",e.$apply(),t.changeState&&"tab.notifications"!=n.current.name&&n.go("tab.notifications")}),s.init(),a.registerBackButtonAction(function(){return e.playing?(document.webkitExitFullscreen(),!1):void("tab.newsfeed"==n.current.name||"login"==n.current.name?navigator.app.exitApp():c.goBack())},100),document.addEventListener("memorywarning",function(){console.log("memory warning received"),c.clearCache()})}return e.$inject=["$rootScope","$scope","$state","$ionicPopover","storage","push","$ionicPlatform","analytics","$ionicHistory"],e}),define("controllers/LoginCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){cordova.plugins.Keyboard.disableScroll(!0),a.get("access_token")&&a.get("loggedin")&&n.go("tab.newsfeed"),console.log(a.get("access_token")),console.log(a.get("loggedin")),t.inprogress=!1,t.login=function(){return t.inprogress?!1:(c.show({template:""}),t.inprogress=!0,void i.login(t.username,t.password,function(i){if(c.hide(),i)s.register(),e.user_guid=a.get("user_guid"),o.get("api/v1/channel/me",{},function(e){a.set("city",e.channel.city)},function(){}),n.go("tutorial");else{var l=r.alert({title:"Ooops..",template:"We couldn't log you in. Please check your credentials and try again."});l.then(function(){})}t.inprogress=!1},function(){c.hide(),t.inprogress=!1}))}}return e.$inject=["$rootScope","$scope","$state","OAuth","Client","$ionicPopup","storage","push","$ionicLoading"],e}),define("controllers/RegisterCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l){t.data={referrer:""},t.inprogress=!1,t.toTutorial=function(){n.go("tutorial")},t.register=function(){return t.inprogress?!1:t.data.username?t.data.password?t.data.email?(t.inprogress=!0,l.show({template:"Please wait a moment..."}),void o.post("api/v1/register",{username:t.data.username,password:t.data.password,email:t.data.email,referrer:t.data.referrer},function(n){if(l.hide(),"error"==n.status){t.inprogress=!1;{r.alert({title:"Ooops..",template:n.message})}return!1}l.show({template:"Logging in..."}),i.login(t.data.username,t.data.password,function(n){if(l.hide(),n)e.user_guid=a.get("user_guid"),s.register(),c.fromTemplateUrl("templates/modals/avatar.html",{scope:t,animation:"slide-in-up"}).then(function(e){t.modal=e,t.modal.show()}),c.fromTemplateUrl("templates/modals/optional.html",{scope:t,animation:"slide-in-up"}).then(function(e){t.modal2=e});else{var i=r.alert({title:"Ooops..",template:"We couldn't log you in. Please check your credentials and try again."});i.then(function(){})}t.inprogress=!1},function(){l.hide(),t.inprogress=!1})},function(){t.inprogress=!1,l.hide();r.alert({title:"Ooops..",template:"Something went wrong.. Try again later."})})):(r.alert({title:"Ooops..",template:"You need to enter an email address"}),!1):(r.alert({title:"Ooops..",template:"You need to enter a password"}),!1):(r.alert({title:"Ooops..",template:"You need to enter a username"}),!1)},t.searching=!1,t.searchUsers=function(){t.searching=!0,"@"!=t.data.referrer.charAt(0)&&0!==t.data.referrer.length&&(t.data.referrer="@"+t.data.referrer);var e=t.data.referrer;"@"==e.charAt(0)&&(e=e.substr(1)),o.get("search",{q:e,type:"user",view:"json",limit:5},function(e){t.results=e.user[0]}),console.log("changing"),t.data.referrer||(t.searching=!1)},t.selectReferrer=function(e){t.searching=!1,t.data.referrer="@"+e.username}}return e.$inject=["$rootScope","$scope","$state","OAuth","Client","$ionicPopup","storage","push","$ionicModal","$ionicLoading"],e}),define("controllers/newsfeed/NewsfeedCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f,p,h){var m=e.$on("$stateChangeStart",function(e,n,i,o){n.name==o.name&&(a.scrollTop(),t.refresh())});t.$on("$destroy",function(){m()}),"tab.newsfeed"==n.current.name&&(e.$on("newsfeed:updated",function(){a.scrollTop(),t.refresh()}),e.$on("newsfeed:boost",function(n,i){n.stopPropagation(),i&&t.boost({guid:i,owner_guid:e.user_guid})})),e.newsfeedItems=[],t.newsfeedItems=[],t.next="",t.hasMoreData=!0,t.cachebreaker=0,t.loadMore=function(){f(function(){return console.log("==== loading more ===="),t.hasMoreData?void o.all({limit:12,offset:t.next,cachebreaker:t.cachebreaker},function(e){if(!e.activity)return t.hasMoreData=!1,t.$broadcast("scroll.infiniteScrollComplete"),!1;if(t.newsfeedItems.length>60)a.scrollTop(),t.newsfeedItems=e.activity;else for(var n in e.activity)t.newsfeedItems.push(e.activity[n]);t.next=e["load-next"],console.log("next is:: "+t.next),t.$broadcast("scroll.infiniteScrollComplete"),t.hasMoreData=!0},function(){t.hasMoreData=!1,t.$broadcast("scroll.infiniteScrollComplete")}):(console.log("==== canceling no more data ===="),void t.$broadcast("scroll.infiniteScrollComplete"))})},t.hasMore=function(){return!0},t.refresh=function(){console.log("=== refreshing ==="),t.hasMoreData=!0,o.all({limit:12,offset:"",cache_break:Date.now()},function(e){t.newsfeedItems=e.activity,t.next=e["load-next"],t.cachebreaker=Date.now(),s.put("newsfeed.cachebreaker",Date.now()),t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete")},function(){t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete")})},t.thumbsUp=function(n){e.points=e.points+1,t.ChannelItems&&(t.newsfeedItems=t.ChannelItems),t.activity&&(t.newsfeedItems[0]=t.activity),t.newsfeedItems.forEach(function(t,i,o){if(t.guid==n){o[i].hasOwnProperty("thumbs:up:user_guids")&&o[i]["thumbs:up:user_guids"]||(o[i]["thumbs:up:user_guids"]=[]);for(var r in o[i]["thumbs:up:user_guids"])if(o[i]["thumbs:up:user_guids"][r]===l.get("user_guid"))return delete o[i]["thumbs:up:user_guids"][r],o[i]["thumbs:up:count"]=o[i]["thumbs:up:count"]-1,e.points=e.points-2,!0;o[i]["thumbs:up:user_guids"][1]=l.get("user_guid"),o[i]["thumbs:up:count"]=o[i]["thumbs:up:count"]+1}}),c.put("api/v1/thumbs/"+n+"/up",{},function(){},function(){alert("failed..")}),d.show({template:''}),f(function(){d.hide()},1e3)},t.thumbsDown=function(n){e.points=e.points+1,t.ChannelItems&&(t.newsfeedItems=t.ChannelItems),t.activity&&(t.newsfeedItems[0]=t.activity),t.newsfeedItems.forEach(function(t,i,o){if(t.guid==n){o[i].hasOwnProperty("thumbs:down:user_guids")&&o[i]["thumbs:down:user_guids"]||(o[i]["thumbs:down:user_guids"]=[]);for(var r in o[i]["thumbs:down:user_guids"])if(o[i]["thumbs:down:user_guids"][r]===l.get("user_guid"))return delete o[i]["thumbs:down:user_guids"][r],o[i]["thumbs:down:count"]=o[i]["thumbs:down:count"]-1,e.points=e.points-2,!0;o[i]["thumbs:down:user_guids"][1]=l.get("user_guid"),o[i]["thumbs:down:count"]=o[i]["thumbs:down:count"]+1}}),c.put("api/v1/thumbs/"+n+"/down",{},function(){},function(){alert("failed..")}),d.show({template:''}),f(function(){d.hide()},1e3)},t.commentsData={},t.loadComments=function(e,n){t.comments.show(n),t.commentsData={};var i;i=e.entity_guid?e.entity_guid:e.guid,c.get("api/v1/comments/"+i,{cachebreaker:Date.now},function(e){console.log("success for "+i),console.log(e),t.commentsData=e.comments},function(){console.log("error")})},t.remind=function(n){c.post("api/v1/newsfeed/remind/"+n.guid,{},function(){},function(){alert("failed..")}),t.newsfeedItems.forEach(function(e,t,i){e.guid==n.guid&&(i[t].reminds=i[t].reminds+1)}),t.ChannelItems&&t.ChannelItems.forEach(function(e,t,i){e.guid==n.guid&&(i[t].reminds=i[t].reminds+1)}),t.activity&&(t.activity.reminds=t.activity.reminds+1),e.points=e.points+1,d.show({template:''}),f(function(){d.hide()},1e3)},t.remove=function(e){console.log("api/v1/newsfeed/"+e),c["delete"]("api/v1/newsfeed/"+e,{cachebreaker:Date.now},function(n){"success"==n.status&&(t.newsfeedItems.forEach(function(t,n,i){t.guid==e&&(console.log("removed"),i.splice(n,1))}),t.ChannelItems&&t.ChannelItems.forEach(function(t,n,i){t.guid==e&&(console.log("removed"),i.splice(n,1))}))},function(){console.log("error")})},t.loadNotifications=function(){n.go("tab.more-notifications",{},{reload:!0})};var g;t.openUrl=function(e){f.cancel(g),g=f(function(){window.open(e,"_blank","location=yes")},300)},t.boost=function(e){h.fromTemplateUrl("templates/newsfeed/boost.html",{scope:t,animation:"slide-in-up"}).then(function(n){t.modal=n,t.guid=e.guid,t.owner_guid=e.owner_guid,t.modal.show()})},t.openActions=function(n){var i=n.guid,o=[{text:"Share"},{text:"Report this"}];n.custom_data&&n.custom_data[0]&&n.custom_data[0].src&&o.push({text:"Download"}),p.show({buttons:o,destructiveText:"Delete",destructiveButtonClicked:function(){return n.p2p_boosted?(d.show({template:"Sorry, you can not delete a boosted post."}),f(function(){d.hide()},1e3),!1):n.owner_guid!=e.user_guid?(d.show({template:"Sorry, you can not delete posts that are not yourss."}),f(function(){d.hide()},1e3),!1):(confirm("are you sure?")&&t.remove(i),!0)},cancelText:"Cancel",cancel:function(){},buttonClicked:function(t){switch(t){case 0:window.plugins.socialsharing.share("via minds",null,null,e.node_url+"newsfeed/"+i);break;case 1:window.location.href="mailto:report@minds.com?subject=Report "+i+"&body=This content violates the terms and conditions";break;case 2:window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(e){var t=new FileTransfer;console.log(e.root.toURL()),e.root.getDirectory("minds",{create:!0,exclusive:!1},function(){},function(){}),t.download(n.custom_data[0].src,e.root.toURL()+"minds/"+i+".jpg",function(e){console.log("download complete: "+e.toURL())},function(e){console.log("download error source "+e.source),console.log("download error target "+e.target),console.log("upload error code"+e.code)},!1)})}return!0}})}}return e.$inject=["$rootScope","$scope","$state","$stateParams","NewsfeedAPI","$filter","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$timeout","$ionicActionSheet","$ionicModal","$ionicPlatform"],e}),define("controllers/newsfeed/NewsfeedCompoerCtrl",[],function(){"use strict";function e(e,t,n){e.post=function(){n.post({message:e.message},function(){t.go("tab.newsfeed")},function(){alert("there was an error and we couldn't save!")})}}return e.$inject=["$scope","$state","NewsfeedAPI"],e}),define("controllers/newsfeed/NewsfeedViewCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a){t.guid="",t.cb=Date.now(),t.activity={},t.comments=[],t.comment={},t.comment.body="",t.init=function(){i.get("api/v1/newsfeed/single/"+n.guid,{},function(e){t.activity=e.activity,t.guid=t.activity.entity_guid?t.activity.entity_guid:t.activity.guid,t.offset="",t.hasMore=!0,t.getComments()})},t.init(),t.inprogress=!1,t.getComments=function(){return t.inprogress?!1:(t.inprogress=!0,void i.get("api/v1/comments/"+t.guid,{cb:t.cb,limit:12,offset:t.offset},function(e){return t.inprogress=!1,e.comments&&0!==e.comments.length?(t.comments=t.comments.concat(e.comments),t.offset=e["load-next"],console.log(t.offset),null==t.offset&&(t.hasMore=!1),void t.$broadcast("scroll.infiniteScrollComplete")):(t.hasMore=!1,!1)},function(){t.inprogress=!1}))},t.submit=function(){t.comment.body&&(o.show({template:''}),i.post("api/v1/comments/"+t.guid,{comment:encodeURIComponent(t.comment.body)},function(e){o.hide(),t.comments.push(e.comment),t.cb=Date.now()},function(){}),t.comment.body="")},t.removeComment=function(n){var o=n.guid;return n.owner_guid!=e.user_guid?!1:void r.show({buttons:[],destructiveText:"Delete",destructiveButtonClicked:function(){return confirm("are you sure?")&&(i["delete"]("api/v1/comments/"+o,function(){}),t.comments.forEach(function(e,t,n){e.guid==o&&(console.log("removed"),n.splice(t,1))})),!0},cancelText:"Cancel",cancel:function(){}})},t.back=function(){a.goBack()}}return e.$inject=["$rootScope","$scope","$stateParams","Client","$ionicLoading","$ionicActionSheet","$ionicHistory"],e}),define("controllers/newsfeed/NewsfeedBoostCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){t.data={destination:"",points:null,impressions:0,rate:1,step:1},t.$watch("data.points",function(){t.data.impressions=""===t.data.destination?Math.round(t.data.points*t.data.rate):t.data.points},!0),s.get("api/v1/boost/rates",{cb:Date.now()},function(e){t.data.rate=e.rate}),t.boost=function(){if(t.data.points%1!==0)return t.data.points=Math.round(t.data.points),o.show({template:"Sorry, you must enter a whole point."}),a(function(){o.hide()},800),!1;if(0===t.data.points||!t.data.points)return t.data.points=1,o.show({template:"Sorry, you must enter a whole point."}),a(function(){o.hide()},800),!1;if(""===t.data.destination&&(0===t.data.impressions||0===Math.round(t.data.impressions)))return o.show({template:"Sorry, you must have at least 1 impression."}),a(function(){o.hide()},800),!1;o.show({template:"Please wait a moment."});var e=c.defer();return s.get("api/v1/wallet/count",{cb:Date.now()},function(i){if(o.hide(),i.countBuy points",type:"button-positive",onTap:function(){n.go("tab.newsfeed-wallet-deposit"),t.modal.remove()}},{text:"Close."}]}),e.resolve(!1);if(t.data.points>i.cap)return r.alert({title:"Ooops!",subTitle:"Sorry, there is a limit on how many points can be spent. ",buttons:[{text:"Lower rate?",type:"button-positive",onTap:function(){t.data.points=i.cap-1}},{text:"Close."}]}),e.resolve(!1);if(t.data.pointsIncrease?",type:"button-positive",onTap:function(){t.data.points=i.min}},{text:"Close."}]}),e.resolve(!1);if(i.count>=t.data.points){o.show({template:"Requesting Boost..."});var c="api/v1/boost/newsfeed/"+t.guid+"/"+t.owner_guid;t.data.destination&&(c="api/v1/boost/channel/"+t.guid+"/"+t.owner_guid),s.post(c,{impressions:t.data.impressions,destination:"@"==t.data.destination.charAt(0)?t.data.destination.substr(1):t.data.destination},function(n){return"success"==n.status?(o.hide(),t.modal.remove(),o.show({template:"Boost request submitted."}),a(function(){o.hide()},500),e.resolve(!0)):(o.hide(),o.show({template:"Sorry, something went wrong."}),a(function(){o.hide()},500),e.resolve(!1))},function(){return o.hide(),o.show({template:"Sorry, something went wrong."}),a(function(){o.hide()},500),e.resolve(!1)})}},function(){return e.resolve(!1)}),e.promise},t.searching=!1,t.results=[],t.changeDestination=function(e){t.searching=!0,"@"!=t.data.destination.charAt(0)&&0!==t.data.destination.length&&(t.data.destination="@"+t.data.destination),13==e.keyCode&&(t.searching=!1);var n=t.data.destination;"@"==n.charAt(0)&&(n=n.substr(1)),s.get("search",{q:n,type:"user",view:"json",limit:5},function(e){t.results=e.user[0]}),console.log("changing"),t.data.destination||(t.searching=!1)},t.selectDestination=function(e){t.searching=!1,t.data.destination="@"+e.username,t.nextStep()
-},t.nextStep=function(){t.data.step=2},t.purchase=function(){n.go("tab.newsfeed-wallet-deposit"),t.modal.remove()}}return e.$inject=["$rootScope","$scope","$state","$stateParams","$ionicLoading","$ionicPopup","$timeout","Client","$q"],e}),define("controllers/gatherings/ChatCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){t.conversations=[],t.next="",t.hasMoreData=!0,t.cb=Date.now(),t.$on("$ionicView.beforeEnter",function(){return o.get("private-key")?(e.newChat=!1,void t.refresh()):(n.go("tab.chat-setup"),!1)}),r.listen("chat",function(){console.log("new message!"),"tab.chat"==n.current.name&&(t.cb=Date.now(),e.newChat=!1,t.refresh(),c.scrollTop())}),t.inprogress=!1,t.loadMore=function(e){return t.inprogress||!o.get("private-key")?!1:(t.inprogress=!0,void i.get("api/v1/conversations",{limit:12,offset:t.next,cb:t.cb},function(n){return n.conversations?(t.hasMoreData=!0,t.conversations=e?n.conversations:t.conversations.concat(n.conversations),t.next=n["load-next"],t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete"),void(t.inprogress=!1)):(t.hasMoreData=!1,!1)},function(){t.inprogress=!0}))},t.search={},t.doSearch=function(){return t.search.query?(console.log("doing search for "+t.search.query),void i.get("search",{q:t.search.query,type:"user",view:"json"},function(e){t.conversations=e.user[0]})):(t.refresh(),!0)},t.$on("$stateChangeSuccess",function(){console.log("state changed..")}),t.refresh=function(){t.search={},t.inprogress=!1,t.next="",t.previous="",t.cb=Date.now(),t.hasMoreData=!0,t.loadMore(!0)},t.subscribe=function(e){t.conversations[e].subscribed=!0,t.conversations[e].subscriber?window.location.href="#/tab/gatherings/conversations/"+t.conversations[e].guid+"/"+t.conversations[e].name:s.alert({title:"Subscribed",template:"You can chat with "+t.conversations[e].name+" when they subscribe to you too"}),i.post("api/v1/subscribe/"+t.conversations[e].guid,{},function(){},function(){})},t.invite=function(){i.get("api/v1/channel/"+e.user_guid,{},function(t){window.plugins.socialsharing.share("Hey! If you install the Minds app and tag me @"+t.channel.username+" we both get 100 points! \n\n","Join Minds and we both get 100 points to go viral!",null,e.node_url)},function(){})}}return e.$inject=["$rootScope","$scope","$state","Client","storage","push","$ionicModal","$ionicPopup","$ionicScrollDelegate"],e}),define("controllers/gatherings/ChatConversationCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f){function p(){a.scrollBottom()}function h(){i.go("tab.chat")}window.cordova&&(cordova.plugins.Keyboard.disableScroll(!1),cordova.plugins.Keyboard.close()),t.guid=n.username,t.name=n.name,t.messages=[],t.next="",t.previous="",t.hasMoreData=!0,t.publickeys={},t.inProgress=!1;var m=!0;if(t.loadMore=function(){t.inProgress=!0,console.log("loading messages from:"+t.next),o.get("api/v1/conversations/"+n.username,{limit:6,offset:t.next,cachebreak:Date.now()},function(n){if(e.newChat=!1,t.inProgress=!1,t.publickeys=n.publickeys,!t.publickeys[t.guid])return u.alert({title:"Sorry!",template:t.name+" has not yet configured their encrypted chat yet."}),i.go("tab.chat"),!0;if(!n.messages)return t.hasMoreData=!1,!1;t.hasMoreData=!0;var o;o=0===t.messages.length?!0:!1,t.messages=n.messages.concat(t.messages),console.log("------ MESSAGES ARE LOADED ------"),t.next=n["load-previous"],t.previous=n["load-next"],t.$broadcast("scroll.refreshComplete"),o&&s(function(){a.scrollBottom()},1e3),m=!0},function(){t.inProgress=!1})},t.loadMore(),!r.get("push-token")){var g=function(){return m?(console.log("checking for new messages.."),m=!1,void o.get("api/v1/conversations/"+n.username,{limit:1e3,start:t.previous,cachebreak:Date.now()},function(e){e&&e.messages&&(t.messages=t.messages.concat(e.messages),t.previous=e["load-next"],a.scrollBottom()),m=!0,clearTimeout(t.timeout),t.timeout=setTimeout(g,5e3)},function(){m=!0,console.log("polling for new messages failed")})):!1};t.timeout=setTimeout(g,5e3)}var v=l.listen("chat",function(){console.log("think you got a new message"),o.get("api/v1/conversations/"+n.username,{limit:1e3,start:t.previous,cachebreak:Date.now()},function(n){e.newChat=!1,n&&n.messages&&(t.messages=t.messages.concat(n.messages),t.previous=n["load-next"],a.scrollBottom())},function(){})});window.addEventListener("native.keyboardshow",function(){"tab.chat-conversation"==i.current.name&&a.scrollBottom()}),t.send=function(){if(!t.message)return u.alert({title:"Oooops...",template:"You need to enter a message before you can send."}),!1;if(t.message.length>180)return u.alert({title:"Oooops...",template:"Your message is too long. It must be less than 180 characters"}),!1;c.show({template:"Sending..."});var e=f.defer(),i={};for(var r in t.publickeys)!function(n){crypt.setPublicKey(t.publickeys[n]),crypt.encrypt(t.message,function(o){i[n]=encodeURIComponent(o),i.length==t.publickeys.length&&e.resolve(!0)})}(r);var s=!1;e.promise.then(function(){var e={};for(var r in i)e["message:"+r]=i[r];o.post("api/v1/conversations/"+n.username,e,function(e){s||(t.messages.push(e.message),t.previous=e.message.guid,s=!0),t.message="",c.hide(),a.scrollBottom()},function(e){c.hide(),alert("sorry, your message could not be sent"),console.log(e)})})},s(function(){window.addEventListener("native.keyboardhide",p),document.addEventListener("pause",h)},100),t.$on("$destroy",function(){clearTimeout(t.timeout),l.unlisten("chat",v),window.removeEventListener("native.keyboardhide",p),document.removeEventListener("pause",h)})}return e.$inject=["$rootScope","$scope","$stateParams","$state","Client","storage","$ionicScrollDelegate","$timeout","$ionicLoading","push","$ionicPopup","$ionicModal","$q"],e}),define("controllers/gatherings/ChatSetupCtrl",[],function(){"use strict";function e(e,t,n,i,o){e.configured=!1,e.data={},n.get("api/v1/channel/me",{},function(t){t.channel.chat&&(e.configured=!0)}),e.unlock=function(){n.get("api/v1/keys",{password:e.data.password,new_password:"abc123"},function(e){e.key?(o.set("private-key",e.key),t.go("tab.chat")):i.alert({title:"Ooops..",template:"We couldn't unlock your chat. Please check your password is correct."})},function(){})},e.setup=function(){return e.data.password?e.data.password!=e.data.password2?(i.alert({title:"Ooops..",template:"Your passwords must match."}),!1):void n.post("api/v1/keys/setup",{password:e.data.password},function(e){e.key?(o.set("private-key",e.key),t.go("tab.chat")):i.alert({title:"Ooops..",template:"We couldn't unlock your chat. Please check your password is correct."})},function(){}):(i.alert({title:"Ooops..",template:"You must enter a password."}),!1)}}return e.$inject=["$scope","$state","Client","$ionicPopup","storage"],e}),define("controllers/channels/ChannelCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l){if(void 0===i.username)return n.go("tab.newsfeed"),!1;t.loaded=!1,t.next="",t.ChannelItems=[];var u;t.cb=Date.now();var d=e.$on("$stateChangeSuccess",function(e,n,i,o){"tab.newsfeed-channel-edit"==o.name&&(t.cb=Date.now(),t.init()),"tab.newsfeed-channel"==o.name&&u&&s.cancel(u)});t.$on("$destroy",function(){u&&s.cancel(u),d()}),t.init=function(){console.log("init called"),o.get("api/v1/channel/"+i.username,{cb:t.cb},function(i){return"error"==i.status?(n.go("tab.newsfeed"),!0):(t.channel=i.channel,e.guid==t.channel.guid&&(l.set("city",t.channel.city),l.set("coordinates",t.channel.coordinates)),0===t.ChannelItems.length&&c(function(){t.loadMore()}),void(i.channel.carousels&&(r.update(),u=s(function(){r.$getByHandle("channel-banners").slide(0)},3e3*i.channel.carousels.length))))},function(){})},t.init(),t.loadMore=function(){return t.channel?(console.log("getting a users feed"),void o.get("api/v1/newsfeed/personal/"+t.channel.guid,{limit:6,offset:t.next,cb:Date.now()},function(e){return t.loaded=!0,e.activity?(console.log("found users feed, loading it"),t.hasMoreData=!0,t.ChannelItems=t.ChannelItems.concat(e.activity),t.next=e["load-next"],t.$broadcast("scroll.infiniteScrollComplete"),void t.$broadcast("scroll.refreshComplete")):(console.log("users feed not found"),t.$broadcast("scroll.refreshComplete"),t.hasMoreData=!1,!1)},function(){t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete")})):!1},t.channelRefresh=function(){return t.channel?(t.next="",void t.loadMore()):!1},t.subscribe=function(e){t.channel.subscribed=!0,t.channel.subscribers_count=t.channel.subscribers_count+1,o.post("api/v1/subscribe/"+e.guid,{},function(){},function(){t.channel.subscribed=!1,t.channel.subscribers_count=t.channel.subscribers_count-1})},t.unSubscribe=function(e){t.channel.subscribed=!1,t.channel.subscribers_count=t.channel.subscribers_count-1,o["delete"]("api/v1/subscribe/"+e.guid,{},function(){},function(){t.channel.subscribed=!0,t.channel.subscribers_count=t.channel.subscribers_count+1})}}return e.$inject=["$rootScope","$scope","$state","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate","$interval","$timeout","storage"],e}),define("controllers/channels/ChannelEditCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f,p,h){t.cb=Date.now();var m;i.guid||(i.guid=e.user_guid),o.get("api/v1/channel/"+i.guid,{cb:t.cb},function(e){t.channel=e.channel},function(){}),t.update=function(e){return t.channel.name?void o.post("api/v1/channel/info",t.channel,function(){c.show({template:''}),l(function(){c.hide()},1e3),e&&n.go("tab.newsfeed-channel",{username:"me",refresh:!0})},function(){}):(p.alert({title:"Oooops...",template:"Your need a name!"}),!1)},t.cities=[],t.autoSearchLocation=function(){l.cancel(m),m=l(function(){o.get("api/v1/geolocation/list",{q:t.channel.city},function(e){t.cities=e.results,console.log(t.cities)},function(){})},300)},t.selectSuggestedLocation=function(e){t.cities=[],t.channel.coordinates=e.lat+","+e.lon,e.address.city&&(t.channel.city=e.address.city),e.address.town&&(t.channel.city=e.address.town),r.set("city",t.channel.city),r.set("coordinates",t.channel.coordinates)},t.changeAvatar=function(){function n(n){var i=document.getElementById("avatar");i.src=n,c.show({template:"Uploading..."});var o=new FileTransfer,a=new FileUploadOptions;a.headers={Authorization:"Bearer "+r.get("access_token")},console.log(n),o.upload(n,encodeURI(e.node_url+"api/v1/channel/avatar"),function(){c.hide(),e.globalCB=Date.now(),e.$apply(),t.channel.cb=Date.now()},function(e){c.hide(),console.log("error"),console.log(e)},a)}function i(){}navigator.camera.getPicture(n,i,{quality:50,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,correctOrientation:!0})},t.addBanner=function(){t.channel.carousels?p.alert({title:"Warning!",subTitle:"Adding a new banner will replace all existing banners on your channel.",buttons:[{text:"Close"},{text:"Replace",type:"button-positive",onTap:function(){t.selectBanner()}}]}):t.selectBanner()},t.selectBanner=function(){function t(t){var n=new FileTransfer,i=new FileUploadOptions;i.headers={Authorization:"Bearer "+r.get("access_token")},console.log(t),n.upload(t,encodeURI(e.node_url+"api/v1/channel/banner"),function(){e.globalCB=Date.now()},function(e){console.log("error"),console.log(e)},i)}function n(){}navigator.camera.getPicture(t,n,{quality:50,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,correctOrientation:!0})},t.changeGender=function(e){t.channel.gender=e,t.$apply()},t.invite=function(){window.plugins.socialsharing.share("Hey! If you install the Minds app and tag me @"+t.channel.username+" we both get 100 points! \n\n","Join Minds and we both get 100 points to go viral!",null,e.node_url)},t.disable=function(){var e=h.defer();return p.alert({title:"Are you sure?",buttons:[{text:"No!"},{text:"Yes",type:"button-positive",onTap:function(){c.show({template:""}),o["delete"]("api/v1/channel",{},function(){c.hide(),t.logout()},function(){alert("sorry, we could not delete")}),e.resolve(!0)}}]}),e.promise},t.logout=function(){o.post("api/v1/logout",{},function(){},function(){}),r.remove("loggedin"),r.remove("user_guid"),r.remove("access_token"),r.remove("private-key"),r.remove("push-token"),ionic.Platform.exitApp(),f.clearCache(),n.go("login")}}return e.$inject=["$rootScope","$scope","$state","$stateParams","Client","storage","$ionicSlideBoxDelegate","$ionicScrollDelegate","$ionicLoading","$timeout","$window","$ionicModal","$ionicHistory","$ionicPopup","$q"],e}),define("controllers/channels/ChannelSubscribersCtrl",[],function(){"use strict";function e(e,t,n){e.next="",e.subscribers=[],e.guid=t.guid,e.inprogress=!1,e.loadMore=function(){return e.inprogress?!1:(e.inprogress=!0,void n.get("api/v1/subscribe/subscribers/"+t.guid,{limit:6,offset:e.next},function(n){return console.log(n),console.log("api/v1/subscribe/subscribers/"+t.guid),n.users&&n["load-next"]?(console.log("found users feed, loading it"),e.hasMoreData=!0,e.subscribers=e.subscribers.concat(n.users),e.next=n["load-next"],e.$broadcast("scroll.infiniteScrollComplete"),e.$broadcast("scroll.refreshComplete"),void(e.inprogress=!1)):(e.$broadcast("scroll.refreshComplete"),e.hasMoreData=!1,!1)},function(){e.inprogress=!1}))},e.loadMore()}return e.$inject=["$scope","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate"],e}),define("controllers/channels/ChannelSubscriptionsCtrl",[],function(){"use strict";function e(e,t,n){e.next="",e.subscriptions=[],e.guid=t.guid,e.inprogress=!1,e.loadMore=function(){return e.inprogress?!1:(e.inprogress=!0,console.log(e.next),console.log(t.guid),void n.get("api/v1/subscribe/subscriptions/"+t.guid,{limit:6,offset:e.next},function(t){return t.users.length&&t["load-next"]?(console.log("found users feed, loading it"),e.hasMoreData=!0,e.subscriptions=e.subscriptions.concat(t.users),e.next=t["load-next"],e.$broadcast("scroll.infiniteScrollComplete"),e.$broadcast("scroll.refreshComplete"),void(e.inprogress=!1)):(e.$broadcast("scroll.refreshComplete"),e.hasMoreData=!1,!1)},function(){e.inprogress=!1}))},e.loadMore()}return e.$inject=["$scope","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate"],e}),define("controllers/capture/CaptureCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u){e.captured=!1,e.progress=0,e.form={album_title:"Mobile",license:"attribution-cc"},e.type,e.video=function(){e.type="video",navigator.device.capture.captureVideo(function(t){e.captured=!0,e.$apply();var n,i,o;for(n=0,o=t.length;o>n;n+=1){var r=t[n];i=r.fullPath,e.upload(i,"video")}},function(){console.log("capture failed")},{limit:1,duration:360,saveToPhotoAlbum:!0})},e.photo=function(){e.type="image",navigator.device.capture.captureImage(function(t){e.captured=!0,e.$apply();var n,i,o;for(n=0,o=t.length;o>n;n+=1)i=t[n].fullPath,e.upload(i,"image")},function(){console.log("capture failed")},{limit:1,correctOrientation:!0,encodingType:0,destinationType:Camera.DestinationType.FILE_URI,allowEdit:!0,saveToPhotoAlbum:!0})},e.library=function(){navigator.camera.getPicture(function(t){e.captured=!0,e.$apply();for(var n=!1,i=["images","document/image",".jpg",".JPG",".jpeg",".JPEG",".png",".PNG",".bmp",".BMP",".gif",".GIF"],o=0;o-1){e.upload(t,"image"),e.type="image",n=!0;break}n||(e.upload(t,"video"),e.type="video")},function(){console.log("capture failed")},{correctOrientation:!0,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,mediaType:2})},e.reset=function(){e.captured=!1,e.guid=!1},e.upload=function(t,n){var o=new FileTransfer,r=new FileUploadOptions;r.httpMethod="image"==n?"PUT":"POST",r.headers={Authorization:"Bearer "+a.get("access_token")},console.log(t),o.upload(t,encodeURI(i.node_url+"api/v1/archive/"+n),function(t){if(t.response){var n=JSON.parse(t.response);e.guid=n.guid,e.$apply()}},function(e){console.log("error"),console.log(e)},r),o.onprogress=function(t){e.progress=Math.floor(t.loaded/t.total*100),e.$apply()}},e.save=function(){s.show({template:"Please wait a moment..."}),o.post("api/v1/archive/"+e.guid,e.form,function(t){n.go("tab.newsfeed",{},{reload:!0}),e.$emit("newsfeed:updated"),e.$emit("newsfeed:boost",t.activity_guid),e.reset(),s.hide()},function(){c.alert({title:"Error",template:"Saving failed."}),e.reset(),s.hide()})},e.postStatus=function(){if(!e.form.status)return c.alert({title:"Ooopss.",template:"You need to enter status before you can post."}),!1;s.show({template:"
Please wait...
"});var t={message:e.form.status,facebook:e.form.facebook,twitter:e.form.twitter};e.form.meta&&(t={message:encodeURIComponent(e.form.status),title:e.form.meta.title,description:encodeURIComponent(e.form.meta.description),thumbnail:encodeURIComponent(e.form.thumbnail),url:e.form.meta.canonical,facebook:e.form.facebook,twitter:e.form.twitter}),o.post("api/v1/newsfeed",t,function(t){s.hide(),e.modal.remove(),e.$emit("newsfeed:boost",t.guid),e.$emit("newsfeed:updated"),n.go("tab.newsfeed",{},{reload:!0})},function(){s.hide()})},window.intents&&"function"==typeof window.intents.onIntent&&intents.onIntent(function(t){"text"==t.type&&(e.activity(),e.form.status=t.data,e.getStatusPreview())}),e.activity=function(){l.fromTemplateUrl("templates/capture/status.html",{scope:e,animation:"slide-in-up"}).then(function(t){e.modal=t,e.modal.show()})},e.$on("modal.removed",function(){e.form={},intents.onIntent(function(){navigator.app.exitApp()})}),e.getStatusPreview=function(){var t=e.form.status,n=t.match(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi);if(n){var i;i=n instanceof Array?n[0]:n,i.length&&(e.form.url=i,i=i.replace("http://",""),i=i.replace("https://",""),u({method:"GET",url:"https://iframely.com/iframely",params:{uri:i},cache:!0}).success(function(t){console.log(t),e.form.meta=t.meta;for(var n=0;n-1&&(console.log(t.links[n]),e.form.thumbnail=t.links[n].href)}).error(function(e){console.log(e)}))}},e.fb=function(){return e.form.facebook?void(e.form.facebook=!1):void facebookConnectPlugin.getLoginStatus(function(t){return"connected"!=t.status?(facebookConnectPlugin.login(["public_profile"],function(){facebookConnectPlugin.login(["publish_actions"],function(){facebookConnectPlugin.getAccessToken(function(t){e.form.facebook=t,e.$apply()},function(e){alert("Could not get access token: "+e)})},function(){})},function(e){alert("error "+e)}),!0):(e.form.facebook=t.authResponse.accessToken,void e.$apply())},function(){e.fb()})},e.twitter=function(){if(e.form.twitter)return void(e.form.twitter=!1);if(!a.get("twitter")){var t=window.open(i.node_url+"plugin/social/authorize/twitter?access_token="+a.get("access_token")+"&client_id="+r.client_id,"_blank","location=yes");t.addEventListener("loadstart",function(n){var r=n.url;if(r.indexOf(i.node_url+"plugin/social/redirect")>-1){t.close();var a=r.split("?");o.get("plugin/social/redirect/twitter?"+a[1],{},function(t){e.form.twitter=t.oauth_token+"&&"+t.oauth_token_secret})}})}}}return e.$inject=["$scope","$stateParams","$state","$rootScope","Client","OAuth","storage","$ionicLoading","$ionicPopup","$ionicModal","$http","$timeout","$sanitize"],e}),define("controllers/notifications/NotificationsCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f){t.next="",t.hasMoreData=!0,t.cachebreaker=Date.now(),t.inprogress=!1,t.notificationItems=[],t.$on("$ionicView.beforeEnter",function(){e.newNotification=!1,t.notificationItems.length>0&&t.refresh()}),f.listen("notification",function(){"tab.notifications"==n.current.name&&(e.newNotification=!1,t.refresh())}),t.loadMore=function(){return console.log("==== loading more notifications ===="),t.inprogress?!1:(t.inprogress=!0,t.hasMoreData?void r.get("api/v1/notifications",{limit:12,offset:t.next,cachebreaker:t.cachebreaker},function(e){return t.inprogress=!1,e.notifications?(t.hasMoreData=!0,t.notificationItems=t.notificationItems.concat(e.notifications),o.put("notification.items",t.notificationItems),t.next=e["load-next"],o.put("notification.next",t.next),void t.$broadcast("scroll.infiniteScrollComplete")):(t.hasMoreData=!1,t.$broadcast("scroll.infiniteScrollComplete"),!1)},function(){t.inprogress=!1,t.$broadcast("scroll.infiniteScrollComplete")}):void(t.inprogress=!1))},t.refresh=function(){return t.inprogress?!1:(t.inprogress=!0,e.newNotification=!1,void r.get("api/v1/notifications",{limit:12,offset:"",cache_break:Date.now()},function(e){t.notificationItems=e.notifications,o.put("notification.items",t.notificationItems),t.next=e["load-next"],o.put("notification.cachebreaker",Date.now),t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete"),t.inprogress=!1,t.hasMoreData=!0},function(){t.inprogress=!1}))},t.subscribe=function(e){d(function(){for(var n=0;n'}),d(function(){c.hide()},300),e.fromObj.subscriber&&e.fromObj.subscribed&&u.alert({title:"Match!",subTitle:e.fromObj.name+" subscribed to you too!",buttons:[{text:"Send Message",type:"button-positive",onTap:function(){window.location.href="#/tab/gatherings/conversations/"+e.fromObj.guid+"/"+e.fromObj.name}},{text:"Continue..."}]})},t.goToChannel=function(e){n.go("tab.newsfeed-channel",{username:e})},t.loadBoostReview=function(e){t.guid=e,l.fromTemplateUrl("templates/wallet/review_boost.html",{scope:t,animation:"slide-in-up"}).then(function(n){t.modal=n,t.guid=e,t.modal.show()})}}return e.$inject=["$rootScope","$scope","$state","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicModal","$ionicPopup","$timeout","push"],e}),define("controllers/notifications/NotificationsEntityCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l){console.log("guid is... "+n.guid),cordova.plugins.Keyboard.disableScroll(!0),t.guid="",t.cb=Date.now(),t.offset="",t.hasMore=!1,t.comments=[],t.comment={},t.comment.body="",t.init=function(){r.get("api/v1/entities/entity/"+n.guid,{cb:t.cb},function(e){t.entity=e.entity,t.activity=e.entity,t.guid=t.entity.guid,t.entity.entity_guid&&(t.guid=t.entity.entity_guid),t.hasMore=!0,t.offset="",t.cb=Date.now(),t.comments=[],t.getComments()},function(e){console.log(e)})},t.init(),t.inprogress=!1,t.getComments=function(){return t.inprogress?!1:(t.inprogress=!0,void r.get("api/v1/comments/"+t.guid,{cb:t.cb,limit:12,offset:t.offset},function(e){return t.inprogress=!1,e.comments&&0!==e.comments.length?(t.comments=t.comments.concat(e.comments),t.offset=e["load-next"],null==t.offset&&(t.hasMore=!1),void t.$broadcast("scroll.infiniteScrollComplete")):(t.hasMore=!1,!1)},function(){t.inprogress=!1}))},t.submit=function(){t.comment.body&&(r.post("api/v1/comments/"+t.guid,{comment:encodeURIComponent(t.comment.body)},function(e){t.comments.push(e.comment),t.offset=e.guid},function(){}),t.comment.body="")},t.removeComment=function(n){var i=n.guid;return n.owner_guid!=e.user_guid?!1:void l.show({buttons:[],destructiveText:"Delete",destructiveButtonClicked:function(){return confirm("are you sure?")&&(r["delete"]("api/v1/comments/"+i,function(){}),t.comments.forEach(function(e,t,n){e.guid==i&&(console.log("removed"),n.splice(t,1))})),!0},cancelText:"Cancel",cancel:function(){}})},t.openUrl=function(e){var t;$timeout.cancel(t),t=$timeout(function(){window.open(e,"_blank","location=yes")},300)},t.pass=function(){r.post("api/v1/entities/suggested/pass/"+t.entity.guid,{},function(){},function(){}),t.entity["thumbs:pass:count"]=1},t.down=function(){r.put("api/v1/thumbs/"+t.entity.guid+"/down",{},function(){},function(){});for(var e in t.entity["thumbs:down:user_guids"])if(t.entity["thumbs:down:user_guids"][e]===a.get("user_guid"))return delete t.entity["thumbs:down:user_guids"][e],t.entity["thumbs:down:count"]=t.entity["thumbs:down:count"]-1,!0;t.entity["thumbs:down:count"]=t.entity["thumbs:down:count"]?t.entity["thumbs:down:count"]+1:1,t.entity["thumbs:down:user_guids"][1]=a.get("user_guid")},t.up=function(){r.put("api/v1/thumbs/"+t.entity.guid+"/up",{},function(){},function(){});for(var e in t.entity["thumbs:up:user_guids"])if(t.entity["thumbs:up:user_guids"][e]===a.get("user_guid"))return delete t.entity["thumbs:up:user_guids"][e],t.entity["thumbs:up:count"]=t.entity["thumbs:up:count"]-1,!0;t.entity["thumbs:up:count"]=t.entity["thumbs:up:count"]?t.entity["thumbs:up:count"]+1:1,t.entity["thumbs:up:user_guids"][1]=a.get("user_guid")}}return e.$inject=["$rootScope","$scope","$stateParams","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicActionSheet"],e}),define("controllers/notifications/NotificationsP2PReviewCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u){t.cb=Date.now(),t.init=function(){r.get("api/v1/boost/p2p",{cb:t.cb},function(e){t.review=e.boosts,t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete")},function(){t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete")})},t.init(),t.refresh=function(){t.cb=Date.now(),t.init()},t.$on("modal.removed",function(){t.refresh()}),t.loadBoostReview=function(e){t.guid=e,u.fromTemplateUrl("templates/wallet/review_boost.html",{scope:t,animation:"slide-in-up"}).then(function(n){t.modal=n,t.guid=e,t.modal.show()})}}return e.$inject=["$rootScope","$scope","$stateParams","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicActionSheet","$ionicModal"],e}),define("controllers/discover/DiscoverCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d){var f,p,h,m;e.entities=[],e.next=i.get("entities.next")?i.get("entities.next"):"",e.query={string:""},e.passed=[],e.acted=[],e.offset=0,e.city=d.get("city"),e.nearby=e.city?!0:!1,e.hasNearby=!0,e.location={distance:{name:"25 miles",miles:25}},e.hasMoreData=!0,e.cachebreaker=i.get("entities.cb")?i.get("entities.cb"):Date.now(),e.filter="suggested",e.type="channel",e.view="list",e.infinite=!0,e.setNearby=function(t){e.nearby=t,e.cachebreaker=Date.now(),e.entities=[],e.load()},e.distanceChanged=function(){e.nearby=!0,e.entities=[],e.load()},e.changeFilter=function(t){"suggested"==t?(e.view="swipe",e.infinite=!1,e.cachebreaker=Date.now()):e.view="list",e.query.string="",e.filter=t,e.entities=[],e.passed=[],e.next="",r.scrollTop(),e.load()},e.changeType=function(t){return"search"==e.filter?(e.type=t,e.search(),!0):(e.query.string="",e.type=t,e.entities=[],e.next="",r.scrollTop(),void e.load())},e.load=function(){return console.log("load triggered"),l.cancel(p),h&&h.cancel(),m&&m.cancel(),"search"==e.filter?void e.search():void(p=l(function(){var t,i;"channel"!=e.type?(t=e.type,i="object"):(t="",i="user"),console.log("loading entities..."),h=n.get("api/v1/entities/"+e.filter+"/"+i+"/"+t,{limit:16,offset:e.next,cachebreaker:e.cachebreaker,skip:e.offset,coordinates:d.get("coordinates")?d.get("coordinates"):!1,nearby:e.nearby,distance:e.location.distance.miles},function(t){return t.entities&&0!==t.entities.length?(e.hasMoreData=!0,e.entities=0===e.entities.length?t.entities:e.entities.concat(t.entities),e.next=t["load-next"],"suggested"==e.filter?e.cachebreaker=Date.now():"trending"==e.filter&&(e.next=e.entities.length),void e.$broadcast("scroll.infiniteScrollComplete")):(e.nearby&&(e.nearby=!1,e.hasNearby=!1,e.cachebreaker=Date.now(),e.load()),e.hasMoreData=!1,!1)},function(){})},600))},e.load(),e.refresh=function(){e.next="";var t,o;"channel"!=e.type?(t=e.type,o="object"):(t="",o="user"),i.put("entities.cb",Date.now()),n.get("api/v1/entities/"+e.filter,{type:o,subtype:t,limit:24,offset:e.next,cachebreaker:Date.now()},function(t){e.entities=t.entities,i.put("entities.data",e.entities),e.next=t["load-next"],e.$broadcast("scroll.infiniteScrollComplete")},function(){})},e.search=function(){l.cancel(f),l.cancel(p),m&&m.cancel(),h&&h.cancel(),e.next="",e.filter="search";var t,o;"channel"!=e.type?(t=e.type,o="object"):(t="",o="user"),f=l(function(){e.query.string.length>2&&(e.entities=[],m=n.get("search",{type:o,subtype:t,q:e.query.string,limit:24,offset:e.next,cachebreaker:Date.now(),view:"json"},function(n){r.scrollTop(),"user"==o?(e.entities=n[o][0],console.log(e.entities)):e.entities=n[o][t],i.put("entities.data",e.entities),e.next=n["load-next"],e.$broadcast("scroll.infiniteScrollComplete")},function(){}))},600)},e.pop=function(t){e.entities.forEach(function(n,i,o){n.guid==t.guid&&(o.splice(i,1),e.passed.push(t))}),e.entities.length<3&&(console.log("loading new..."),i.put("entities.cb",Date.now()),e.offset=3,e.load())},e.ignore=function(t){e.pop(t),n.post("api/v1/entities/suggested/pass/"+t.guid,{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300)},e.subscribe=function(t){"search"!=e.filter&&e.pop(t),console.log("api/v1/subscribe/"+t.guid),t.subscribed?(n["delete"]("api/v1/subscribe/"+t.guid,{},function(){},function(){}),t.subscribed=!1):(n.post("api/v1/subscribe/"+t.guid,{},function(){},function(){}),t.subscribed=!0),e.entities.forEach(function(e,n,i){e.guid==t.guid&&(i[n].subscribed=t.subscribed?!1:!0)}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),t.subscriber&&t.subscribed&&o.alert({title:"Match!",subTitle:t.name+" subscribed to you too!",buttons:[{text:"Send Message",type:"button-positive",onTap:function(){window.location.href="#/tab/gatherings/conversations/"+t.guid+"/"+t.name}},{text:"Continue..."}]})},e.pass=function(t){e.pop(t),n.post("api/v1/entities/suggested/pass/"+t.guid,{},function(){},function(){}),e.acted(t),a.show({template:'pass'}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.down=function(t){e.pop(t),n.put("api/v1/thumbs/"+t.guid+"/down",{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.up=function(t){e.pop(t),n.put("api/v1/thumbs/"+t.guid+"/up",{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.boost=function(t){s.fromTemplateUrl("templates/wallet/boost.html",{scope:e,animation:"slide-in-up"}).then(function(n){e.modal=n,e.type="suggested",e.entity=t,e.modal.show()})},e.acted=function(e){e.boosted&&n.post("api/v1/entities/suggested/acted/"+e.guid,{},function(){},function(){})},e.openActions=function(e){c.show({buttons:[{text:"Share"},{text:"Report this"}],cancelText:"Cancel",cancel:function(){},buttonClicked:function(t){switch(t){case 0:a.show({template:"
Copied to clipboard
"}),l(function(){a.hide()},1e3);break;case 1:window.location.href="mailto:report@minds.com?subject=Report "+e.guid+"&body=This content violates the terms and conditions"}return!0}})}}return e.$inject=["$scope","$stateParams","Client","Cacher","$ionicPopup","$ionicScrollDelegate","$ionicLoading","$ionicModal","$ionicActionSheet","$timeout","$q","storage"],e}),define("controllers/wallet/WalletCtrl",[],function(){"use strict";function e(e,t,n){n.get("api/v1/wallet/count",{cb:Date.now()},function(t){e.points=t.count,e.satoshi=t.satoshi,e.btc=t.btc,e.usd=t.usd,e.boost_rate=t.boost_rate},function(){}),e.transactions=[],e.hasMoreData=!0,e.next="",e.loadMore=function(){console.log("==== loading more transactions ===="),e.hasMoreData&&n.get("api/v1/wallet/transactions",{limit:12,offset:e.next,cachebreaker:Date.now()},function(t){return t.transactions?(e.hasMoreData=!0,e.transactions=e.transactions.concat(t.transactions),e.next=t["load-next"],void e.$broadcast("scroll.infiniteScrollComplete")):(e.hasMoreData=!1,e.$broadcast("scroll.infiniteScrollComplete"),!1)
+},t.nextStep=function(){t.data.step=2},t.purchase=function(){n.go("tab.newsfeed-wallet-deposit"),t.modal.remove()}}return e.$inject=["$rootScope","$scope","$state","$stateParams","$ionicLoading","$ionicPopup","$timeout","Client","$q"],e}),define("controllers/gatherings/ChatCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){t.conversations=[],t.next="",t.hasMoreData=!0,t.cb=Date.now(),t.$on("$ionicView.beforeEnter",function(){return o.get("private-key")?(e.newChat=!1,void t.refresh()):(n.go("tab.chat-setup"),!1)}),r.listen("chat",function(){console.log("new message!"),"tab.chat"==n.current.name&&(t.cb=Date.now(),e.newChat=!1,t.refresh(),c.scrollTop())}),t.inprogress=!1,t.loadMore=function(e){return t.inprogress||!o.get("private-key")?!1:(t.inprogress=!0,void i.get("api/v1/conversations",{limit:12,offset:t.next,cb:t.cb},function(n){return n.conversations?(t.hasMoreData=!0,t.conversations=e?n.conversations:t.conversations.concat(n.conversations),t.next=n["load-next"],t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete"),void(t.inprogress=!1)):(t.hasMoreData=!1,!1)},function(){t.inprogress=!0}))},t.search={},t.doSearch=function(){return t.search.query?(console.log("doing search for "+t.search.query),void i.get("search",{q:t.search.query,type:"user",view:"json"},function(e){t.conversations=e.user[0]})):(t.refresh(),!0)},t.$on("$stateChangeSuccess",function(){console.log("state changed..")}),t.refresh=function(){t.search={},t.inprogress=!1,t.next="",t.previous="",t.cb=Date.now(),t.hasMoreData=!0,t.loadMore(!0)},t.subscribe=function(e){t.conversations[e].subscribed=!0,t.conversations[e].subscriber?window.location.href="#/tab/gatherings/conversations/"+t.conversations[e].guid+"/"+t.conversations[e].name:s.alert({title:"Subscribed",template:"You can chat with "+t.conversations[e].name+" when they subscribe to you too"}),i.post("api/v1/subscribe/"+t.conversations[e].guid,{},function(){},function(){})},t.invite=function(){i.get("api/v1/channel/"+e.user_guid,{},function(t){window.plugins.socialsharing.share("Hey! If you install the Minds app and tag me @"+t.channel.username+" we both get 100 points! \n\n","Join Minds and we both get 100 points to go viral!",null,e.node_url)},function(){})}}return e.$inject=["$rootScope","$scope","$state","Client","storage","push","$ionicModal","$ionicPopup","$ionicScrollDelegate"],e}),define("controllers/gatherings/ChatConversationCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f){function p(){a.scrollBottom()}function h(){i.go("tab.chat")}window.cordova&&(cordova.plugins.Keyboard.disableScroll(!1),cordova.plugins.Keyboard.close()),t.guid=n.username,t.name=n.name,t.messages=[],t.next="",t.previous="",t.hasMoreData=!0,t.publickeys={},t.inProgress=!1;var m=!0;if(t.loadMore=function(){t.inProgress=!0,console.log("loading messages from:"+t.next),o.get("api/v1/conversations/"+n.username,{limit:6,offset:t.next,cachebreak:Date.now()},function(n){if(e.newChat=!1,t.inProgress=!1,t.publickeys=n.publickeys,!t.publickeys[t.guid])return u.alert({title:"Sorry!",template:t.name+" has not yet configured their encrypted chat yet."}),i.go("tab.chat"),!0;if(!n.messages)return t.hasMoreData=!1,!1;t.hasMoreData=!0;var o;o=0===t.messages.length?!0:!1,t.messages=n.messages.concat(t.messages),console.log("------ MESSAGES ARE LOADED ------"),t.next=n["load-previous"],t.previous=n["load-next"],t.$broadcast("scroll.refreshComplete"),o&&s(function(){a.scrollBottom()},1e3),m=!0},function(){t.inProgress=!1})},t.loadMore(),!r.get("push-token")){var g=function(){return m?(console.log("checking for new messages.."),m=!1,void o.get("api/v1/conversations/"+n.username,{limit:1e3,start:t.previous,cachebreak:Date.now()},function(e){e&&e.messages&&(t.messages=t.messages.concat(e.messages),t.previous=e["load-next"],a.scrollBottom()),m=!0,clearTimeout(t.timeout),t.timeout=setTimeout(g,5e3)},function(){m=!0,console.log("polling for new messages failed")})):!1};t.timeout=setTimeout(g,5e3)}var v=l.listen("chat",function(){console.log("think you got a new message"),o.get("api/v1/conversations/"+n.username,{limit:1e3,start:t.previous,cachebreak:Date.now()},function(n){e.newChat=!1,n&&n.messages&&(t.messages=t.messages.concat(n.messages),t.previous=n["load-next"],a.scrollBottom())},function(){})});window.addEventListener("native.keyboardshow",function(){"tab.chat-conversation"==i.current.name&&a.scrollBottom()}),t.send=function(){if(!t.message)return u.alert({title:"Oooops...",template:"You need to enter a message before you can send."}),!1;if(t.message.length>180)return u.alert({title:"Oooops...",template:"Your message is too long. It must be less than 180 characters"}),!1;c.show({template:"Sending..."});var e=f.defer(),i={};for(var r in t.publickeys)!function(n){crypt.setPublicKey(t.publickeys[n]),crypt.encrypt(t.message,function(o){i[n]=encodeURIComponent(o),i.length==t.publickeys.length&&e.resolve(!0)})}(r);var s=!1;e.promise.then(function(){var e={};for(var r in i)e["message:"+r]=i[r];o.post("api/v1/conversations/"+n.username,e,function(e){s||(t.messages.push(e.message),t.previous=e.message.guid,s=!0),t.message="",c.hide(),a.scrollBottom()},function(e){c.hide(),alert("sorry, your message could not be sent"),console.log(e)})})},s(function(){window.addEventListener("native.keyboardhide",p),document.addEventListener("pause",h)},100),t.$on("$destroy",function(){clearTimeout(t.timeout),l.unlisten("chat",v),window.removeEventListener("native.keyboardhide",p),document.removeEventListener("pause",h)})}return e.$inject=["$rootScope","$scope","$stateParams","$state","Client","storage","$ionicScrollDelegate","$timeout","$ionicLoading","push","$ionicPopup","$ionicModal","$q"],e}),define("controllers/gatherings/ChatSetupCtrl",[],function(){"use strict";function e(e,t,n,i,o){e.configured=!1,e.data={},n.get("api/v1/channel/me",{},function(t){t.channel.chat&&(e.configured=!0)}),e.unlock=function(){n.get("api/v1/keys",{password:e.data.password,new_password:"abc123"},function(e){e.key?(o.set("private-key",e.key),t.go("tab.chat")):i.alert({title:"Ooops..",template:"We couldn't unlock your chat. Please check your password is correct."})},function(){})},e.setup=function(){return e.data.password?e.data.password!=e.data.password2?(i.alert({title:"Ooops..",template:"Your passwords must match."}),!1):void n.post("api/v1/keys/setup",{password:e.data.password},function(e){e.key?(o.set("private-key",e.key),t.go("tab.chat")):i.alert({title:"Ooops..",template:"We couldn't unlock your chat. Please check your password is correct."})},function(){}):(i.alert({title:"Ooops..",template:"You must enter a password."}),!1)}}return e.$inject=["$scope","$state","Client","$ionicPopup","storage"],e}),define("controllers/channels/ChannelCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l){if(void 0===i.username)return n.go("tab.newsfeed"),!1;t.loaded=!1,t.next="",t.ChannelItems=[];var u;t.cb=Date.now();var d=e.$on("$stateChangeSuccess",function(e,n,i,o){"tab.newsfeed-channel-edit"==o.name&&(t.cb=Date.now(),t.init()),"tab.newsfeed-channel"==o.name&&u&&s.cancel(u)});t.$on("$destroy",function(){u&&s.cancel(u),d()}),t.init=function(){console.log("init called"),o.get("api/v1/channel/"+i.username,{cb:t.cb},function(i){return"error"==i.status?(n.go("tab.newsfeed"),!0):(t.channel=i.channel,e.guid==t.channel.guid&&(l.set("city",t.channel.city),l.set("coordinates",t.channel.coordinates)),0===t.ChannelItems.length&&c(function(){t.loadMore()}),void(i.channel.carousels&&(r.update(),u=s(function(){r.$getByHandle("channel-banners").slide(0)},3e3*i.channel.carousels.length))))},function(){})},t.init(),t.loadMore=function(){return t.channel?(console.log("getting a users feed"),void o.get("api/v1/newsfeed/personal/"+t.channel.guid,{limit:6,offset:t.next,cb:Date.now()},function(e){return t.loaded=!0,e.activity?(console.log("found users feed, loading it"),t.hasMoreData=!0,t.ChannelItems=t.ChannelItems.concat(e.activity),t.next=e["load-next"],t.$broadcast("scroll.infiniteScrollComplete"),void t.$broadcast("scroll.refreshComplete")):(console.log("users feed not found"),t.$broadcast("scroll.refreshComplete"),t.hasMoreData=!1,!1)},function(){t.$broadcast("scroll.infiniteScrollComplete"),t.$broadcast("scroll.refreshComplete")})):!1},t.channelRefresh=function(){return t.channel?(t.next="",void t.loadMore()):!1},t.subscribe=function(e){t.channel.subscribed=!0,t.channel.subscribers_count=t.channel.subscribers_count+1,o.post("api/v1/subscribe/"+e.guid,{},function(){},function(){t.channel.subscribed=!1,t.channel.subscribers_count=t.channel.subscribers_count-1})},t.unSubscribe=function(e){t.channel.subscribed=!1,t.channel.subscribers_count=t.channel.subscribers_count-1,o["delete"]("api/v1/subscribe/"+e.guid,{},function(){},function(){t.channel.subscribed=!0,t.channel.subscribers_count=t.channel.subscribers_count+1})}}return e.$inject=["$rootScope","$scope","$state","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate","$interval","$timeout","storage"],e}),define("controllers/channels/ChannelEditCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f,p,h){t.cb=Date.now();var m;i.guid||(i.guid=e.user_guid),o.get("api/v1/channel/"+i.guid,{cb:t.cb},function(e){t.channel=e.channel},function(){}),t.update=function(e){return t.channel.name?void o.post("api/v1/channel/info",t.channel,function(){c.show({template:''}),l(function(){c.hide()},1e3),e&&n.go("tab.newsfeed-channel",{username:"me",refresh:!0})},function(){}):(p.alert({title:"Oooops...",template:"Your need a name!"}),!1)},t.cities=[],t.autoSearchLocation=function(){l.cancel(m),m=l(function(){o.get("api/v1/geolocation/list",{q:t.channel.city},function(e){t.cities=e.results,console.log(t.cities)},function(){})},300)},t.selectSuggestedLocation=function(e){t.cities=[],t.channel.coordinates=e.lat+","+e.lon,e.address.city&&(t.channel.city=e.address.city),e.address.town&&(t.channel.city=e.address.town),r.set("city",t.channel.city),r.set("coordinates",t.channel.coordinates)},t.changeAvatar=function(){function n(n){var i=document.getElementById("avatar");i.src=n,c.show({template:"Uploading..."});var o=new FileTransfer,a=new FileUploadOptions;a.headers={Authorization:"Bearer "+r.get("access_token")},console.log(n),o.upload(n,encodeURI(e.node_url+"api/v1/channel/avatar"),function(){c.hide(),e.globalCB=Date.now(),e.$apply(),t.channel.cb=Date.now()},function(e){c.hide(),console.log("error"),console.log(e)},a)}function i(){}navigator.camera.getPicture(n,i,{quality:50,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,correctOrientation:!0})},t.addBanner=function(){t.channel.carousels?p.alert({title:"Warning!",subTitle:"Adding a new banner will replace all existing banners on your channel.",buttons:[{text:"Close"},{text:"Replace",type:"button-positive",onTap:function(){t.selectBanner()}}]}):t.selectBanner()},t.selectBanner=function(){function t(t){var n=new FileTransfer,i=new FileUploadOptions;i.headers={Authorization:"Bearer "+r.get("access_token")},console.log(t),n.upload(t,encodeURI(e.node_url+"api/v1/channel/banner"),function(){e.globalCB=Date.now()},function(e){console.log("error"),console.log(e)},i)}function n(){}navigator.camera.getPicture(t,n,{quality:50,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,correctOrientation:!0})},t.changeGender=function(e){t.channel.gender=e,t.$apply()},t.invite=function(){window.plugins.socialsharing.share("Hey! If you install the Minds app and tag me @"+t.channel.username+" we both get 100 points! \n\n","Join Minds and we both get 100 points to go viral!",null,e.node_url)},t.disable=function(){var e=h.defer();return p.alert({title:"Are you sure?",buttons:[{text:"No!"},{text:"Yes",type:"button-positive",onTap:function(){c.show({template:""}),o["delete"]("api/v1/channel",{},function(){c.hide(),t.logout()},function(){alert("sorry, we could not delete")}),e.resolve(!0)}}]}),e.promise},t.logout=function(){o.post("api/v1/logout",{},function(){},function(){}),r.remove("loggedin"),r.remove("user_guid"),r.remove("access_token"),r.remove("private-key"),r.remove("push-token"),ionic.Platform.exitApp(),f.clearCache(),n.go("login")}}return e.$inject=["$rootScope","$scope","$state","$stateParams","Client","storage","$ionicSlideBoxDelegate","$ionicScrollDelegate","$ionicLoading","$timeout","$window","$ionicModal","$ionicHistory","$ionicPopup","$q"],e}),define("controllers/channels/ChannelSubscribersCtrl",[],function(){"use strict";function e(e,t,n){e.next="",e.subscribers=[],e.guid=t.guid,e.inprogress=!1,e.loadMore=function(){return e.inprogress?!1:(e.inprogress=!0,void n.get("api/v1/subscribe/subscribers/"+t.guid,{limit:6,offset:e.next},function(n){return console.log(n),console.log("api/v1/subscribe/subscribers/"+t.guid),n.users&&n["load-next"]?(console.log("found users feed, loading it"),e.hasMoreData=!0,e.subscribers=e.subscribers.concat(n.users),e.next=n["load-next"],e.$broadcast("scroll.infiniteScrollComplete"),e.$broadcast("scroll.refreshComplete"),void(e.inprogress=!1)):(e.$broadcast("scroll.refreshComplete"),e.hasMoreData=!1,!1)},function(){e.inprogress=!1}))},e.loadMore()}return e.$inject=["$scope","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate"],e}),define("controllers/channels/ChannelSubscriptionsCtrl",[],function(){"use strict";function e(e,t,n){e.next="",e.subscriptions=[],e.guid=t.guid,e.inprogress=!1,e.loadMore=function(){return e.inprogress?!1:(e.inprogress=!0,console.log(e.next),console.log(t.guid),void n.get("api/v1/subscribe/subscriptions/"+t.guid,{limit:6,offset:e.next},function(t){return t.users.length&&t["load-next"]?(console.log("found users feed, loading it"),e.hasMoreData=!0,e.subscriptions=e.subscriptions.concat(t.users),e.next=t["load-next"],e.$broadcast("scroll.infiniteScrollComplete"),e.$broadcast("scroll.refreshComplete"),void(e.inprogress=!1)):(e.$broadcast("scroll.refreshComplete"),e.hasMoreData=!1,!1)},function(){e.inprogress=!1}))},e.loadMore()}return e.$inject=["$scope","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate"],e}),define("controllers/capture/CaptureCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u){e.captured=!1,e.progress=0,e.form={album_title:"Mobile",license:"attribution-cc"},e.type,e.video=function(){e.type="video",navigator.device.capture.captureVideo(function(t){e.captured=!0,e.$apply();var n,i,o;for(n=0,o=t.length;o>n;n+=1){var r=t[n];i=r.fullPath,e.upload(i,"video")}},function(){console.log("capture failed")},{limit:1,duration:360,saveToPhotoAlbum:!0})},e.photo=function(){e.type="image",navigator.device.capture.captureImage(function(t){e.captured=!0,e.$apply();var n,i,o;for(n=0,o=t.length;o>n;n+=1)i=t[n].fullPath,e.upload(i,"image")},function(){console.log("capture failed")},{limit:1,correctOrientation:!0,encodingType:0,destinationType:Camera.DestinationType.FILE_URI,allowEdit:!0,saveToPhotoAlbum:!0})},e.library=function(){navigator.camera.getPicture(function(t){e.captured=!0,e.$apply();for(var n=!1,i=["images","document/image",".jpg",".JPG",".jpeg",".JPEG",".png",".PNG",".bmp",".BMP",".gif",".GIF"],o=0;o-1){e.upload(t,"image"),e.type="image",n=!0;break}n||(e.upload(t,"video"),e.type="video")},function(){console.log("capture failed")},{correctOrientation:!0,destinationType:Camera.DestinationType.FILE_URI,sourceType:0,mediaType:2})},e.reset=function(){e.captured=!1,e.guid=!1},e.upload=function(t,n){var o=new FileTransfer,r=new FileUploadOptions;r.httpMethod="image"==n?"PUT":"POST",r.headers={Authorization:"Bearer "+a.get("access_token")},console.log(t),o.upload(t,encodeURI(i.node_url+"api/v1/archive/"+n),function(t){if(t.response){var n=JSON.parse(t.response);e.guid=n.guid,e.$apply()}},function(e){console.log("error"),console.log(e)},r),o.onprogress=function(t){e.progress=Math.floor(t.loaded/t.total*100),e.$apply()}},e.save=function(){s.show({template:"Please wait a moment..."}),o.post("api/v1/archive/"+e.guid,e.form,function(t){n.go("tab.newsfeed",{},{reload:!0}),e.$emit("newsfeed:updated"),e.$emit("newsfeed:boost",t.activity_guid),e.reset(),s.hide()},function(){c.alert({title:"Error",template:"Saving failed."}),e.reset(),s.hide()})},e.postStatus=function(){if(!e.form.status)return c.alert({title:"Ooopss.",template:"You need to enter status before you can post."}),!1;s.show({template:"
Please wait...
"});var t={message:e.form.status,facebook:e.form.facebook,twitter:e.form.twitter};e.form.meta&&(t={message:encodeURIComponent(e.form.status),title:encodeURIComponent(e.form.meta.title),description:encodeURIComponent(e.form.meta.description),thumbnail:encodeURIComponent(e.form.thumbnail),url:encodeURIComponent(e.form.meta.canonical),facebook:e.form.facebook,twitter:e.form.twitter}),o.post("api/v1/newsfeed",t,function(t){s.hide(),e.modal.remove(),e.$emit("newsfeed:boost",t.guid),e.$emit("newsfeed:updated"),n.go("tab.newsfeed",{},{reload:!0})},function(){s.hide()})},window.intents&&"function"==typeof window.intents.onIntent&&intents.onIntent(function(t){"text"==t.type&&(e.activity(),e.form.status=t.data,e.getStatusPreview())}),e.activity=function(){l.fromTemplateUrl("templates/capture/status.html",{scope:e,animation:"slide-in-up"}).then(function(t){e.modal=t,e.modal.show()})},e.$on("modal.removed",function(){e.form={},intents.onIntent(function(){navigator.app.exitApp()})}),e.getStatusPreview=function(){var t=e.form.status,n=t.match(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi);if(n){var i;i=n instanceof Array?n[0]:n,i.length&&(e.form.url=i,i=i.replace("http://",""),i=i.replace("https://",""),u({method:"GET",url:"https://iframely.com/iframely",params:{uri:i},cache:!0}).success(function(t){console.log(t),e.form.meta=t.meta;for(var n=0;n-1&&(console.log(t.links[n]),e.form.thumbnail=t.links[n].href)}).error(function(e){console.log(e)}))}},e.fb=function(){return e.form.facebook?void(e.form.facebook=!1):void facebookConnectPlugin.getLoginStatus(function(t){return"connected"!=t.status?(facebookConnectPlugin.login(["public_profile"],function(){facebookConnectPlugin.login(["publish_actions"],function(){facebookConnectPlugin.getAccessToken(function(t){e.form.facebook=t,e.$apply()},function(e){alert("Could not get access token: "+e)})},function(){})},function(e){alert("error "+e)}),!0):(e.form.facebook=t.authResponse.accessToken,void e.$apply())},function(){e.fb()})},e.twitter=function(){if(e.form.twitter)return void(e.form.twitter=!1);if(!a.get("twitter")){var t=window.open(i.node_url+"plugin/social/authorize/twitter?access_token="+a.get("access_token")+"&client_id="+r.client_id,"_blank","location=yes");t.addEventListener("loadstart",function(n){var r=n.url;if(r.indexOf(i.node_url+"plugin/social/redirect")>-1){t.close();var a=r.split("?");o.get("plugin/social/redirect/twitter?"+a[1],{},function(t){e.form.twitter=t.oauth_token+"&&"+t.oauth_token_secret})}})}}}return e.$inject=["$scope","$stateParams","$state","$rootScope","Client","OAuth","storage","$ionicLoading","$ionicPopup","$ionicModal","$http","$timeout","$sanitize"],e}),define("controllers/notifications/NotificationsCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d,f){t.next="",t.hasMoreData=!0,t.cachebreaker=Date.now(),t.inprogress=!1,t.notificationItems=[];var p=e.$on("$stateChangeStart",function(e,n,o,r){n.name==r.name&&(i.scrollTop(),t.refresh())});f.listen("notification",function(){"tab.notifications"==n.current.name&&(e.newNotification=!1,t.refresh())}),t.loadMore=function(){return console.log("==== loading more notifications ===="),t.inprogress?!1:(t.inprogress=!0,t.hasMoreData?void r.get("api/v1/notifications",{limit:12,offset:t.next,cachebreaker:t.cachebreaker},function(e){return t.inprogress=!1,e.notifications?(t.hasMoreData=!0,t.notificationItems=t.notificationItems.concat(e.notifications),o.put("notification.items",t.notificationItems),t.next=e["load-next"],o.put("notification.next",t.next),void t.$broadcast("scroll.infiniteScrollComplete")):(t.hasMoreData=!1,t.$broadcast("scroll.infiniteScrollComplete"),!1)},function(){t.inprogress=!1,t.$broadcast("scroll.infiniteScrollComplete")}):void(t.inprogress=!1))},t.refresh=function(){return t.inprogress?!1:(t.inprogress=!0,e.newNotification=!1,void r.get("api/v1/notifications",{limit:12,offset:"",cache_break:Date.now()},function(e){t.notificationItems=e.notifications,o.put("notification.items",t.notificationItems),t.next=e["load-next"],o.put("notification.cachebreaker",Date.now),t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete"),t.inprogress=!1,t.hasMoreData=!0},function(){t.inprogress=!1}))},t.subscribe=function(e){d(function(){for(var n=0;n'}),d(function(){c.hide()},300),e.fromObj.subscriber&&e.fromObj.subscribed&&u.alert({title:"Match!",subTitle:e.fromObj.name+" subscribed to you too!",buttons:[{text:"Send Message",type:"button-positive",onTap:function(){window.location.href="#/tab/gatherings/conversations/"+e.fromObj.guid+"/"+e.fromObj.name}},{text:"Continue..."}]})},t.goToChannel=function(e){n.go("tab.newsfeed-channel",{username:e})},t.loadBoostReview=function(e){t.guid=e,l.fromTemplateUrl("templates/wallet/review_boost.html",{scope:t,animation:"slide-in-up"}).then(function(n){t.modal=n,t.guid=e,t.modal.show()})},t.$on("$destroy",function(){p()})}return e.$inject=["$rootScope","$scope","$state","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicModal","$ionicPopup","$timeout","push"],e}),define("controllers/notifications/NotificationsEntityCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l){console.log("guid is... "+n.guid),cordova.plugins.Keyboard.disableScroll(!0),t.guid="",t.cb=Date.now(),t.offset="",t.hasMore=!1,t.comments=[],t.comment={},t.comment.body="",t.init=function(){r.get("api/v1/entities/entity/"+n.guid,{cb:t.cb},function(e){t.entity=e.entity,t.activity=e.entity,t.guid=t.entity.guid,t.entity.entity_guid&&(t.guid=t.entity.entity_guid),t.hasMore=!0,t.offset="",t.cb=Date.now(),t.comments=[],t.getComments()},function(e){console.log(e)})},t.init(),t.inprogress=!1,t.getComments=function(){return t.inprogress?!1:(t.inprogress=!0,void r.get("api/v1/comments/"+t.guid,{cb:t.cb,limit:12,offset:t.offset},function(e){return t.inprogress=!1,e.comments&&0!==e.comments.length?(t.comments=t.comments.concat(e.comments),t.offset=e["load-next"],null==t.offset&&(t.hasMore=!1),void t.$broadcast("scroll.infiniteScrollComplete")):(t.hasMore=!1,!1)},function(){t.inprogress=!1}))},t.submit=function(){t.comment.body&&(r.post("api/v1/comments/"+t.guid,{comment:encodeURIComponent(t.comment.body)},function(e){t.comments.push(e.comment),t.offset=e.guid},function(){}),t.comment.body="")},t.removeComment=function(n){var i=n.guid;return n.owner_guid!=e.user_guid?!1:void l.show({buttons:[],destructiveText:"Delete",destructiveButtonClicked:function(){return confirm("are you sure?")&&(r["delete"]("api/v1/comments/"+i,function(){}),t.comments.forEach(function(e,t,n){e.guid==i&&(console.log("removed"),n.splice(t,1))})),!0},cancelText:"Cancel",cancel:function(){}})},t.openUrl=function(e){var t;$timeout.cancel(t),t=$timeout(function(){window.open(e,"_blank","location=yes")},300)},t.pass=function(){r.post("api/v1/entities/suggested/pass/"+t.entity.guid,{},function(){},function(){}),t.entity["thumbs:pass:count"]=1},t.down=function(){r.put("api/v1/thumbs/"+t.entity.guid+"/down",{},function(){},function(){});for(var e in t.entity["thumbs:down:user_guids"])if(t.entity["thumbs:down:user_guids"][e]===a.get("user_guid"))return delete t.entity["thumbs:down:user_guids"][e],t.entity["thumbs:down:count"]=t.entity["thumbs:down:count"]-1,!0;t.entity["thumbs:down:count"]=t.entity["thumbs:down:count"]?t.entity["thumbs:down:count"]+1:1,t.entity["thumbs:down:user_guids"][1]=a.get("user_guid")},t.up=function(){r.put("api/v1/thumbs/"+t.entity.guid+"/up",{},function(){},function(){});for(var e in t.entity["thumbs:up:user_guids"])if(t.entity["thumbs:up:user_guids"][e]===a.get("user_guid"))return delete t.entity["thumbs:up:user_guids"][e],t.entity["thumbs:up:count"]=t.entity["thumbs:up:count"]-1,!0;t.entity["thumbs:up:count"]=t.entity["thumbs:up:count"]?t.entity["thumbs:up:count"]+1:1,t.entity["thumbs:up:user_guids"][1]=a.get("user_guid")}}return e.$inject=["$rootScope","$scope","$stateParams","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicActionSheet"],e}),define("controllers/notifications/NotificationsP2PReviewCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u){t.cb=Date.now(),t.init=function(){r.get("api/v1/boost/p2p",{cb:t.cb},function(e){t.review=e.boosts,t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete")},function(){t.$broadcast("scroll.refreshComplete"),t.$broadcast("scroll.infiniteScrollComplete")})},t.init(),t.refresh=function(){t.cb=Date.now(),t.init()},t.$on("modal.removed",function(){t.refresh()}),t.loadBoostReview=function(e){t.guid=e,u.fromTemplateUrl("templates/wallet/review_boost.html",{scope:t,animation:"slide-in-up"}).then(function(n){t.modal=n,t.guid=e,t.modal.show()})}}return e.$inject=["$rootScope","$scope","$stateParams","$ionicScrollDelegate","Cacher","Client","storage","$ionicPopover","$ionicLoading","$ionicActionSheet","$ionicModal"],e}),define("controllers/discover/DiscoverCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c,l,u,d){var f,p,h,m;e.entities=[],e.next=i.get("entities.next")?i.get("entities.next"):"",e.query={string:""},e.passed=[],e.acted=[],e.offset=0,e.city=d.get("city"),e.nearby=e.city?!0:!1,e.hasNearby=!0,e.location={distance:{name:"25 miles",miles:25}},e.hasMoreData=!0,e.cachebreaker=i.get("entities.cb")?i.get("entities.cb"):Date.now(),e.filter="suggested",e.type="channel",e.view="list",e.infinite=!0,e.setNearby=function(t){e.nearby=t,e.cachebreaker=Date.now(),e.entities=[],e.load()},e.distanceChanged=function(){e.nearby=!0,e.entities=[],e.load()},e.changeFilter=function(t){"suggested"==t?(e.view="swipe",e.infinite=!1,e.cachebreaker=Date.now()):e.view="list",e.query.string="",e.filter=t,e.entities=[],e.passed=[],e.next="",r.scrollTop(),e.load()},e.changeType=function(t){return"search"==e.filter?(e.type=t,e.search(),!0):(e.query.string="",e.type=t,e.entities=[],e.next="",r.scrollTop(),void e.load())},e.load=function(){return console.log("load triggered"),l.cancel(p),h&&h.cancel(),m&&m.cancel(),"search"==e.filter?void e.search():void(p=l(function(){var t,i;"channel"!=e.type?(t=e.type,i="object"):(t="",i="user"),console.log("loading entities..."),h=n.get("api/v1/entities/"+e.filter+"/"+i+"/"+t,{limit:16,offset:e.next,cachebreaker:e.cachebreaker,skip:e.offset,coordinates:d.get("coordinates")?d.get("coordinates"):!1,nearby:e.nearby,distance:e.location.distance.miles},function(t){return t.entities&&0!==t.entities.length?(e.hasMoreData=!0,e.entities=0===e.entities.length?t.entities:e.entities.concat(t.entities),e.next=t["load-next"],"suggested"==e.filter?e.cachebreaker=Date.now():"trending"==e.filter&&(e.next=e.entities.length),void e.$broadcast("scroll.infiniteScrollComplete")):(e.nearby&&(e.nearby=!1,e.hasNearby=!1,e.cachebreaker=Date.now(),e.load()),e.hasMoreData=!1,!1)},function(){})},600))},e.load(),e.refresh=function(){e.next="";var t,o;"channel"!=e.type?(t=e.type,o="object"):(t="",o="user"),i.put("entities.cb",Date.now()),n.get("api/v1/entities/"+e.filter,{type:o,subtype:t,limit:24,offset:e.next,cachebreaker:Date.now()},function(t){e.entities=t.entities,i.put("entities.data",e.entities),e.next=t["load-next"],e.$broadcast("scroll.infiniteScrollComplete")},function(){})},e.search=function(){l.cancel(f),l.cancel(p),m&&m.cancel(),h&&h.cancel(),e.next="",e.filter="search";var t,o;"channel"!=e.type?(t=e.type,o="object"):(t="",o="user"),f=l(function(){e.query.string.length>2&&(e.entities=[],m=n.get("search",{type:o,subtype:t,q:e.query.string,limit:24,offset:e.next,cachebreaker:Date.now(),view:"json"},function(n){r.scrollTop(),"user"==o?(e.entities=n[o][0],console.log(e.entities)):e.entities=n[o][t],i.put("entities.data",e.entities),e.next=n["load-next"],e.$broadcast("scroll.infiniteScrollComplete")},function(){}))},600)},e.pop=function(t){e.entities.forEach(function(n,i,o){n.guid==t.guid&&(o.splice(i,1),e.passed.push(t))}),e.entities.length<3&&(console.log("loading new..."),i.put("entities.cb",Date.now()),e.offset=3,e.load())},e.ignore=function(t){e.pop(t),n.post("api/v1/entities/suggested/pass/"+t.guid,{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300)},e.subscribe=function(t){"search"!=e.filter&&e.pop(t),console.log("api/v1/subscribe/"+t.guid),t.subscribed?(n["delete"]("api/v1/subscribe/"+t.guid,{},function(){},function(){}),t.subscribed=!1):(n.post("api/v1/subscribe/"+t.guid,{},function(){},function(){}),t.subscribed=!0),e.entities.forEach(function(e,n,i){e.guid==t.guid&&(i[n].subscribed=t.subscribed?!1:!0)}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),t.subscriber&&t.subscribed&&o.alert({title:"Match!",subTitle:t.name+" subscribed to you too!",buttons:[{text:"Send Message",type:"button-positive",onTap:function(){window.location.href="#/tab/gatherings/conversations/"+t.guid+"/"+t.name}},{text:"Continue..."}]})},e.pass=function(t){e.pop(t),n.post("api/v1/entities/suggested/pass/"+t.guid,{},function(){},function(){}),e.acted(t),a.show({template:'pass'}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.down=function(t){e.pop(t),n.put("api/v1/thumbs/"+t.guid+"/down",{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.up=function(t){e.pop(t),n.put("api/v1/thumbs/"+t.guid+"/up",{},function(){},function(){}),e.acted(t),a.show({template:''}),l(function(){a.hide()},300),e.cachebreaker=Date.now()},e.boost=function(t){s.fromTemplateUrl("templates/wallet/boost.html",{scope:e,animation:"slide-in-up"}).then(function(n){e.modal=n,e.type="suggested",e.entity=t,e.modal.show()})},e.acted=function(e){e.boosted&&n.post("api/v1/entities/suggested/acted/"+e.guid,{},function(){},function(){})},e.openActions=function(e){c.show({buttons:[{text:"Share"},{text:"Report this"}],cancelText:"Cancel",cancel:function(){},buttonClicked:function(t){switch(t){case 0:a.show({template:"
Copied to clipboard
"}),l(function(){a.hide()},1e3);break;case 1:window.location.href="mailto:report@minds.com?subject=Report "+e.guid+"&body=This content violates the terms and conditions"}return!0}})}}return e.$inject=["$scope","$stateParams","Client","Cacher","$ionicPopup","$ionicScrollDelegate","$ionicLoading","$ionicModal","$ionicActionSheet","$timeout","$q","storage"],e}),define("controllers/wallet/WalletCtrl",[],function(){"use strict";function e(e,t,n){n.get("api/v1/wallet/count",{cb:Date.now()},function(t){e.points=t.count,e.satoshi=t.satoshi,e.btc=t.btc,e.usd=t.usd,e.boost_rate=t.boost_rate},function(){}),e.transactions=[],e.hasMoreData=!0,e.next="",e.loadMore=function(){console.log("==== loading more transactions ===="),e.hasMoreData&&n.get("api/v1/wallet/transactions",{limit:12,offset:e.next,cachebreaker:Date.now()},function(t){return t.transactions?(e.hasMoreData=!0,e.transactions=e.transactions.concat(t.transactions),e.next=t["load-next"],void e.$broadcast("scroll.infiniteScrollComplete")):(e.hasMoreData=!1,e.$broadcast("scroll.infiniteScrollComplete"),!1)
},function(){})}}return e.$inject=["$scope","$stateParams","Client","$ionicSlideBoxDelegate","$ionicScrollDelegate"],e}),define("controllers/wallet/WalletDepositCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a){e.step="quote",e.data={points:1e3,usd:"---"},e.card={},i.post("api/v1/wallet/quote",{points:e.points},function(t){e.usd=t.usd},function(){}),e.$watch("data.points",function(){e.data.usd="...",a(function(){i.post("api/v1/wallet/quote",{points:e.data.points},function(t){e.data.usd=t.usd},function(){})},500)},!0),e.changeStep=function(t){e.step=t},e.process=function(){e.card.points=e.data.points,console.log(e.card),i.post("api/v1/wallet/charge",e.card,function(t){return t.id?(e.step="complete",!0):void alert("Sorry, we had trouble processing your card. Please check your details and try again.")},function(){})},e.proccessPaypal=function(){var n={PayPalEnvironmentProduction:"ATAByBA7wVln5oky2XKkglEoH7k0DJmZVOz3S-DGJYkrNrHcIjZCdX1HHLwH",PayPalEnvironmentSandbox:"AaUOIRC8rTb2jXZtnUvjMXWH1BH-5spBnL2kILF2AEPygMxvWOqME3e06hnj"};PayPalMobile.init(n,function(){var n={defaultUserEmail:null,defaultUserPhoneCountryCode:null,defaultUserPhoneNumber:null,merchantName:"Minds",merchantPrivacyPolicyURL:null,merchantUserAgreementURL:null,acceptCreditCards:!0,payPalShippingAddressOption:0,rememberUser:!0,languageOrLocale:null,disableBlurWhenBackgrounding:!1,presentingInPopover:!1,forceDefaultsInSandbox:!1,sandboxUserPassword:null,sandboxUserPin:null},r={subtotal:String(e.data.usd),shipping:"0.00",tax:"0.00",amount:String(e.data.usd),currency:"USD",shortDescription:"Points purchase",intent:"Auth"};PayPalMobile.prepareToRender("PayPalEnvironmentProduction",n,function(){PayPalMobile.renderSinglePaymentUI(r,function(n){o.show({template:"
Applying points...
"}),console.log("SUCCESS!!"),console.log(n),i.post("api/v1/wallet/paypal/confirm",{id:n.response.authorization_id,points:e.data.points},function(e){console.log(e),o.hide(),"success"==e.status&&t.go("tab.newsfeed-wallet")},function(){o.hide()})},function(){console.log("canceled paypal")})})})}}return e.$inject=["$scope","$state","$stateParams","Client","$ionicLoading","$ionicScrollDelegate","$timeout"],e}),define("controllers/wallet/BoostCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s,c){t.data={points:null,impressions:0,rate:1},t.$watch("data.points",function(){t.data.impressions=t.data.points*t.data.rate},!0),s.get("api/v1/boost/rates",{cb:Date.now(),referrer:"discovery"},function(e){t.data.rate=e.rate}),t.boost=function(){if(t.data.points%1!==0)return t.data.points=Math.round(t.data.points),o.show({template:"Sorry, you must enter a whole point."}),a(function(){o.hide()},800),!1;if(0===t.data.points)return t.data.points=1,o.show({template:"Sorry, you must enter a whole point."}),a(function(){o.hide()},800),!1;if(0===t.data.impressions||0===Math.round(t.data.impressions))return o.show({template:"Sorry, you must have at least 1 impression."}),a(function(){o.hide()},800),!1;o.show({template:"Please wait a moment."});var e=c.defer();return s.get("api/v1/wallet/count",{cb:Date.now(),referrer:"discovery"},function(i){return o.hide(),i.countBuy points",type:"button-positive",onTap:function(){n.go("tab.newsfeed-wallet-deposit"),t.modal.remove()}},{text:"Close."}]}),e.resolve(!1)):t.data.points>i.cap?(r.alert({title:"Ooops!",subTitle:"Sorry, there is a limit on how many points can be spent. ",buttons:[{text:"Lower rate",type:"button-positive",onTap:function(){t.data.points=i.cap-1}},{text:"Close."}]}),e.resolve(!1)):t.data.pointsIncrease?",type:"button-positive",onTap:function(){t.data.points=i.min}},{text:"Close."}]}),e.resolve(!1)):void(i.count>=t.data.points&&(o.show({template:"Requesting Boost..."}),s.post("api/v1/boost/"+t.type+"/"+t.entity.guid+"/"+t.entity.owner_guid,{impressions:t.data.impressions},function(n){return o.hide(),"success"==n.status?(t.modal.remove(),o.show({template:"Boost request submitted."}),a(function(){o.hide()},500),e.resolve(!0)):(o.hide(),o.show({template:"Sorry, something went wrong."}),a(function(){o.hide()},500),e.resolve(!1))},function(){return o.hide(),o.show({template:"Sorry, something went wrong."}),a(function(){o.hide()},500),e.resolve(!1)})))},function(){return e.resolve(!1)}),e.promise}}return e.$inject=["$rootScope","$scope","$state","$stateParams","$ionicLoading","$ionicPopup","$timeout","Client","$q"],e}),define("controllers/wallet/BoostReviewCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s){o.show(),s.get("api/v1/boost/"+t.guid,{cb:Date.now()},function(e){return"error"==e.status?(o.hide(),void t.modal.remove()):(o.hide(),t.entity=e.entity,t.activity=t.entity,void(t.points=e.points))},function(){o.hide(),t.modal.remove()}),t.accept=function(){t.modal.remove(),t.refresh(),s.put("api/v1/boost/"+t.guid,{cb:Date.now()},function(){},function(){})},t.reject=function(){t.modal.remove(),t.refresh(),s["delete"]("api/v1/boost/"+t.guid,{cb:Date.now()},function(){},function(){})}}return e.$inject=["$rootScope","$scope","$state","$stateParams","$ionicLoading","$ionicPopup","$timeout","Client"],e}),define("controllers/invite/InviteCtrl",[],function(){"use strict";function e(e,t,n,i,o,r,a,s){t.contacts=[],t.selected=[],navigator.contacts.pickContact(function(e){s.confirm({title:"Invite",template:"Are you sure you want to invite "+e.name.formatted+"?"}).then(function(n){n?(r.post("api/v1/invite",{contact:e},function(){},function(){}),t.modal.remove(),o.show({template:"
Invited "+e.name.formatted+"
"}),a(function(){o.hide()},1e3)):t.modal.remove()})},function(e){console.log("Error: "+e)}),t.isSelected=function(e){for(var n=0;ninviting...'}),r.post("api/v1/invite",{contacts:t.selected},function(){t.modal.remove(),o.hide()},function(){t.modal.remove(),o.hide()})}}return e.$inject=["$rootScope","$scope","$state","$stateParams","$ionicLoading","Client","$timeout","$ionicPopup"],e}),define("controllers/controllers",["require","angular","services/services","config","controllers/LoadingCtrl","controllers/TutorialCtrl","controllers/TabsCtrl","controllers/LoginCtrl","controllers/RegisterCtrl","controllers/newsfeed/NewsfeedCtrl","controllers/newsfeed/NewsfeedCompoerCtrl","controllers/newsfeed/NewsfeedViewCtrl","controllers/newsfeed/NewsfeedBoostCtrl","controllers/gatherings/ChatCtrl","controllers/gatherings/ChatConversationCtrl","controllers/gatherings/ChatSetupCtrl","controllers/channels/ChannelCtrl","controllers/channels/ChannelEditCtrl","controllers/channels/ChannelSubscribersCtrl","controllers/channels/ChannelSubscriptionsCtrl","controllers/capture/CaptureCtrl","controllers/notifications/NotificationsCtrl","controllers/notifications/NotificationsEntityCtrl","controllers/notifications/NotificationsP2PReviewCtrl","controllers/discover/DiscoverCtrl","controllers/wallet/WalletCtrl","controllers/wallet/WalletDepositCtrl","controllers/wallet/BoostCtrl","controllers/wallet/BoostReviewCtrl","controllers/invite/InviteCtrl"],function(e){"use strict";var t=e("angular"),n=(e("services/services"),e("config"),t.module("app.controllers",["app.services","app.config"]));return n.controller("LoadingCtrl",e("controllers/LoadingCtrl")),n.controller("TutorialCtrl",e("controllers/TutorialCtrl")),n.controller("TabsCtrl",e("controllers/TabsCtrl")),n.controller("LoginCtrl",e("controllers/LoginCtrl")),n.controller("RegisterCtrl",e("controllers/RegisterCtrl")),n.controller("NewsfeedCtrl",e("controllers/newsfeed/NewsfeedCtrl")),n.controller("NewsfeedComposerCtrl",e("controllers/newsfeed/NewsfeedCompoerCtrl")),n.controller("NewsfeedViewCtrl",e("controllers/newsfeed/NewsfeedViewCtrl")),n.controller("NewsfeedBoostCtrl",e("controllers/newsfeed/NewsfeedBoostCtrl")),n.controller("ChatCtrl",e("controllers/gatherings/ChatCtrl")),n.controller("ChatConversationCtrl",e("controllers/gatherings/ChatConversationCtrl")),n.controller("ChatSetupCtrl",e("controllers/gatherings/ChatSetupCtrl")),n.controller("ChannelCtrl",e("controllers/channels/ChannelCtrl")),n.controller("ChannelEditCtrl",e("controllers/channels/ChannelEditCtrl")),n.controller("ChannelSubscribersCtrl",e("controllers/channels/ChannelSubscribersCtrl")),n.controller("ChannelSubscriptionsCtrl",e("controllers/channels/ChannelSubscriptionsCtrl")),n.controller("CaptureCtrl",e("controllers/capture/CaptureCtrl")),n.controller("NotificationsCtrl",e("controllers/notifications/NotificationsCtrl")),n.controller("NotificationsEntityCtrl",e("controllers/notifications/NotificationsEntityCtrl")),n.controller("NotificationsP2PReviewCtrl",e("controllers/notifications/NotificationsP2PReviewCtrl")),n.controller("DiscoverCtrl",e("controllers/discover/DiscoverCtrl")),n.controller("WalletCtrl",e("controllers/wallet/WalletCtrl")),n.controller("WalletDepositCtrl",e("controllers/wallet/WalletDepositCtrl")),n.controller("BoostCtrl",e("controllers/wallet/BoostCtrl")),n.controller("BoostReviewCtrl",e("controllers/wallet/BoostReviewCtrl")),n.controller("InviteCtrl",e("controllers/invite/InviteCtrl")),n.run(["$rootScope","NODE_URL","storage","$timeout",function(e,t,n,i){e.node_url=t,e.user_guid=n.get("user_guid"),e.points="...",e.globalCB=Date.now();var o;document.onclick=function(e){e=e||window.event;var t=e.target||e.srcElement;return"A"==t.tagName&&t.href.indexOf("http")>=0?(i.cancel(o),o=i(function(){window.open(t.href,"_blank","location=yes")},300),!1):void 0}}]),window.addEventListener("keypress",function(e){13==e.keyCode&&cordova.plugins.Keyboard.close()},!1),n}),function(e,t,n){"use strict";function i(e,t,n){if(!e)throw ngMinErr("areq",t||"?",n||"required");return e}function o(e,t){return e||t?e?t?(M(e)&&(e=e.join(" ")),M(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function r(e){var t={};return e&&(e.to||e.from)&&(t.to=e.to,t.from=e.from),t}function a(e,t,n){var i="";return e=M(e)?e:e&&N(e)&&e.length?e.split(/\s+/):[],P(e,function(e,o){e&&00?" ":"",i+=n?t+e:e+t)}),i}function s(e){if(e instanceof L)switch(e.length){case 0:return[];case 1:if(1===e[0].nodeType)return e;break;default:return L(c(e))}return 1===e.nodeType?L(e):void 0}function c(e){if(!e[0])return e;for(var t=0;t=0)&&(n=w(n)),0===n&&(n=null),i[t]=n}}),i}function w(e){var t=0;return e=e.split(/\s*,\s*/),P(e,function(e){"s"==e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),e=parseFloat(e)||0,t=t?Math.max(e,t):e}),t}function y(e){return 0===e||null!=e}function _(e,t){var n=E,i=e+"s";return t?n+="Duration":i+=" linear all",[n,i]}function S(e,t){var n=t?"-"+t+"s":"";return x(e,[U,n]),[U,n]}function C(e,t){var n=t?"paused":"",i=I+"PlayState";return x(e,[i,n]),[i,n]}function x(e,t){e.style[t[0]]=t[1]}function k(){var e=Object.create(null);return{flush:function(){e=Object.create(null)},count:function(t){return(t=e[t])?t.total:0},get:function(t){return(t=e[t])&&t.value},put:function(t,n){e[t]?e[t].total++:e[t]={total:1,value:n}}}}var E,T,I,D,A=t.noop,O=t.extend,L=t.element,P=t.forEach,M=t.isArray,N=t.isString,V=t.isObject,R=t.isUndefined,B=t.isDefined,F=t.isFunction,j=t.isElement;e.ontransitionend===n&&e.onwebkittransitionend!==n?(E="WebkitTransition",T="webkitTransitionEnd transitionend"):(E="transition",T="transitionend"),e.onanimationend===n&&e.onwebkitanimationend!==n?(I="WebkitAnimation",D="webkitAnimationEnd animationend"):(I="animation",D="animationend");var z=I+"Delay",H=I+"Duration",U=E+"Delay";e=E+"Duration";var q={transitionDuration:e,transitionDelay:U,transitionProperty:E+"Property",animationDuration:H,animationDelay:z,animationIterationCount:I+"IterationCount"},G={transitionDuration:e,transitionDelay:U,animationDuration:H,animationDelay:z};t.module("ngAnimate",[]).directive("ngAnimateChildren",[function(){return function(e,n,i){e=i.ngAnimateChildren,t.isString(e)&&0===e.length?n.data("$$ngAnimateChildren",!0):i.$observe("ngAnimateChildren",function(e){n.data("$$ngAnimateChildren","on"===e||"true"===e)})}}]).factory("$$rAFMutex",["$$rAF",function(e){return function(){var t=!1;return e(function(){t=!0}),function(n){t?n():e(n)}}}]).factory("$$rAFScheduler",["$$rAF",function(e){function t(e){o.push([].concat(e)),n()}function n(){if(o.length){for(var t=[],r=0;r=0;n--){var i=t[n];if(r.has(i)&&(i=r.get(i)(e)))return i}}function S(t,n){t.from&&t.to?(e(t.from.element).setHost(n),e(t.to.element).setHost(n)):e(t.element).setHost(n)}function C(){var t=e(d);!t||"leave"===g&&v.$$domOperationFired||t.end()}function x(e){d.off("$destroy",C),d.removeData("$$animationRunner"),l(d,v),p(d,v),v.domOperation(),I&&n.removeClass(d,I),d.removeClass("ng-animate"),E.complete(!e)}v=f(v);var k=0<=["enter","move","leave"].indexOf(g),E=new a({end:function(){x()},cancel:function(){x(!0)}});if(!t.length)return x(),E;d.data("$$animationRunner",E);var T=o(d.attr("class"),o(v.addClass,v.removeClass)),I=v.tempClasses;I&&(T+=" "+I,v.tempClasses=null);var D;return k||(D=u,u+=1),c.push({element:d,classes:T,event:g,classBasedIndex:D,structural:k,options:v,beforeStart:function(){d.addClass("ng-animate"),I&&n.addClass(d,I)},close:x}),d.on("$destroy",C),1=W&&t>=Y&&(B=!0,d())}if(!V){var a,c=[],l=function(e){if(B)R&&e&&(R=!1,d());else if(R=!e,ct.animationDuration)if(e=C(N,R),R)K.push(e);else{var t=K,n=t.indexOf(e);e>=0&&t.splice(n,1)}},u=st>0&&(ct.transitionDuration&&0===at.transitionDuration||ct.animationDuration&&0===at.animationDuration)&&Math.max(at.animationDelay,at.transitionDelay);u?s(e,Math.floor(u*st*1e3),!1):e(),j.resume=function(){l(!0)},j.pause=function(){l(!1)}}}var N=b(t);n=f(n);var V,R,B,F,j,q,W,Y,X,K=[],Z=t.attr("class"),J=r(n);if(0===n.duration||!l.animations&&!l.transitions)return O();var Q=n.event&&M(n.event)?n.event.join(" "):n.event,et="",tt="";Q&&n.structural?et=a(Q,"ng-",!0):Q&&(et=Q),n.addClass&&(tt+=a(n.addClass,"-add")),n.removeClass&&(tt.length&&(tt+=" "),tt+=a(n.removeClass,"-remove")),n.applyClassesEarly&&tt.length&&(A(t,n),tt="");var nt=[et,tt].join(" ").trim(),it=Z+" "+nt,ot=a(nt,"-active"),Z=J.to&&0=0&&b[r]!=i;r--);if(r>=0){for(o=b.length-1;o>=r;o--)n.end&&n.end(b[o]);b.length=r}}"string"!=typeof e&&(e=null===e||"undefined"==typeof e?"":""+e);var r,s,c,b=[],$=e;for(b.last=function(){return b[b.length-1]};e;){if(c="",s=!0,b.last()&&C[b.last()]?(e=e.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*"+b.last()+"[^>]*>","i"),function(e,t){return t=t.replace(m,"$1").replace(v,"$1"),n.chars&&n.chars(a(t)),""}),o("",b.last())):(0===e.indexOf("",r)===r&&(n.comment&&n.comment(e.substring(4,r)),e=e.substring(r+3),s=!1)):g.test(e)?(r=e.match(g))&&(e=e.replace(r[0],""),s=!1):h.test(e)?(r=e.match(d))&&(e=e.substring(r[0].length),r[0].replace(d,o),s=!1):p.test(e)&&((r=e.match(u))?(r[4]&&(e=e.substring(r[0].length),r[0].replace(u,i)),s=!1):(c+="<",e=e.substring(1))),s&&(r=e.indexOf("<"),c+=0>r?e:e.substring(0,r),e=0>r?"":e.substring(r),n.chars&&n.chars(a(c)))),e==$)throw l("badparse",e);$=e}o()}function a(e){return e?(T.innerHTML=e.replace(//g,">")}function c(e,n){var i=!1,o=t.bind(e,e.push);return{start:function(e,r,a){e=t.lowercase(e),!i&&C[e]&&(i=e),i||!0!==x[e]||(o("<"),o(e),t.forEach(r,function(i,r){var a=t.lowercase(r),c="img"===e&&"src"===a||"background"===a;!0!==E[a]||!0===k[a]&&!n(i,c)||(o(" "),o(r),o('="'),o(s(i)),o('"'))}),o(a?"/>":">"))},end:function(e){e=t.lowercase(e),i||!0!==x[e]||(o(""),o(e),o(">")),e==i&&(i=!1)},chars:function(e){i||o(s(e))}}}var l=t.$$minErr("$sanitize"),u=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,d=/^<\/\s*([\w:-]+)[^>]*>/,f=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,p=/^,h=/^<\//,m=/\x3c!--(.*?)--\x3e/g,g=/]*?)>/i,v=/"\u201d\u2019]/i,o=/^mailto:/i;return function(r,a){function s(e){e&&p.push(i(e))}function c(e,n){p.push("'),s(n),p.push("")}if(!r)return r;for(var l,u,d,f=r,p=[];l=f.match(n);)u=l[0],l[2]||l[4]||(u=(l[3]?"http://":"mailto:")+u),d=l.index,s(f.substr(0,d)),c(u,l[0].replace(o,"")),f=f.substring(d+l[0].length);return s(f),e(p.join(""))}}])}(window,window.angular),define("angularSanitize",["angular"],function(){}),function(){function e(e,t,n,i,o,r){function a(i,a,s,c,l){function d(){R.resizeRequiresRefresh($.__clientWidth,$.__clientHeight)&&g()}function f(){var e;return e={dataLength:0,width:0,height:0,resizeRequiresRefresh:function(t,n){var i=e.dataLength&&t&&n&&(t!==e.width||n!==e.height);return e.width=t,e.height=n,!!i},dataChangeRequiresRefresh:function(t){var n=t.length>0||t.length'),$.options.scrollingX&&e.addClass("horizontal"),e.append(n),$.__content.appendChild(e[0])}return e}function m(){M?v(M,I):I.computed=!0,N?v(N,D):D.computed=!0}function g(){var e=O.length>0;if(e&&(I.computed||D.computed)&&b(),e&&I.computed){if(I.value=A.height,!I.value)throw new Error('collection-repeat tried to compute the height of repeated elements "'+S+'", but was unable to. Please provide the "item-height" attribute. http://ionicframework.com/docs/api/directive/collectionRepeat/')}else!I.dynamic&&I.getValue&&(I.value=I.getValue());if(e&&D.computed){if(D.value=A.width,!D.value)throw new Error('collection-repeat tried to compute the width of repeated elements "'+S+'", but was unable to. Please provide the "item-width" attribute. http://ionicframework.com/docs/api/directive/collectionRepeat/')}else!D.dynamic&&D.getValue&&(D.value=D.getValue());p().refreshLayout()}function v(e,n){if(e){var i;try{i=t(e)}catch(o){e.trim().match(/\d+(px|%)$/)&&(e='"'+e+'"'),i=t(e)}var r=e.replace(/(\'|\"|px|%)/g,"").trim(),a=r.length&&!/([a-zA-Z]|\$|:|\?)/.test(r);if(n.attrValue=e,a){var s=parseInt(i());if(e.indexOf("%")>-1){var c=s/100;n.getValue=n===I?function(){return Math.floor(c*$.__clientHeight)}:function(){return Math.floor(c*$.__clientWidth)}}else n.value=s}else n.dynamic=!0,n.getValue=n===I?function(e,t){var n=i(e,t);return n.charAt&&"%"===n.charAt(n.length-1)?Math.floor(parseInt(n)/100*$.__clientHeight):parseInt(n)}:function(e,t){var n=i(e,t);return n.charAt&&"%"===n.charAt(n.length-1)?Math.floor(parseInt(n)/100*$.__clientWidth):parseInt(n)}}}function b(){F||l(j=i.$new(),function(e){e[0].removeAttribute("collection-repeat"),F=e[0]}),j[k]=(T(i)||[])[0],o.$$phase||j.$digest(),y.appendChild(F);var e=n.getComputedStyle(F);A.width=parseInt(e.width),A.height=parseInt(e.height),y.removeChild(F)}var $=c.scrollView,w=a[0],y=angular.element('