-
Notifications
You must be signed in to change notification settings - Fork 0
/
strollopia.min.js
3 lines (3 loc) · 52.1 KB
/
strollopia.min.js
1
2
3
/*! strollopia.js 2018-09-09 */
(function(){angular.module("StrollopiaJS.Config",[]),angular.module("StrollopiaJS.Utils.API",["StrollopiaJS.Config"]),angular.module("StrollopiaJS.Utils.AccessToken",["StrollopiaJS.Utils.API"]),angular.module("StrollopiaJS.Utils.Indicators",[]),angular.module("StrollopiaJS.Utils.i18n",["StrollopiaJS.Config"]),angular.module("StrollopiaJS.Utils.Routes",["ngRoute"]),angular.module("StrollopiaJS.Utils.Templates",[]),angular.module("StrollopiaJS.Utils.Form",[]),angular.module("StrollopiaJS.Utils.Interceptors",[]),angular.module("StrollopiaJS.Utils.MethodCallbacks",[]),angular.module("StrollopiaJS.Utils.Device",["ngCordova","StrollopiaJS.Utils.API"]),angular.module("StrollopiaJS.Utils.Storage",["ngStorage"]),angular.module("StrollopiaJS.Utils.Report",[]),angular.module("StrollopiaJS.Utils.FontDetect",[]),angular.module("StrollopiaJS.Utils.HTML",[]),angular.module("StrollopiaJS.Utils.Map",["ngStorage","StrollopiaJS.Utils.FontDetect"]),angular.module("StrollopiaJS.Utils.Data",["StrollopiaJS.Models","StrollopiaJS.Utils.Storage"]),angular.module("StrollopiaJS.Utils",["StrollopiaJS.Utils.API","StrollopiaJS.Utils.AccessToken","StrollopiaJS.Utils.Map","StrollopiaJS.Utils.i18n","StrollopiaJS.Utils.Routes","StrollopiaJS.Utils.Indicators","StrollopiaJS.Utils.Form","StrollopiaJS.Utils.Templates","StrollopiaJS.Utils.Interceptors","StrollopiaJS.Utils.MethodCallbacks","StrollopiaJS.Utils.Device","StrollopiaJS.Utils.FontDetect","StrollopiaJS.Utils.Report","StrollopiaJS.Utils.HTML","StrollopiaJS.Utils.Storage","StrollopiaJS.Utils.Data"]),angular.module("StrollopiaJS.Models",["ngCachedResource","StrollopiaJS.Utils.API","StrollopiaJS.Utils.Indicators","StrollopiaJS.Utils.Interceptors","StrollopiaJS.Utils.MethodCallbacks"]),angular.module("StrollopiaJS.Filters",[]),angular.module("StrollopiaJS.Directives",["StrollopiaJS.Utils.Templates","StrollopiaJS.Utils.Indicators","StrollopiaJS.Utils.i18n","ngAudio"]),angular.module("StrollopiaJS.Cordova",["ngStorage","StrollopiaJS.Utils.Device"]),angular.module("StrollopiaJS",["StrollopiaJS.Utils","StrollopiaJS.Models","StrollopiaJS.Directives","StrollopiaJS.Filters","StrollopiaJS.Cordova"])}).call(this),function(){angular.module("StrollopiaJS.Config").provider("StrollopiaConfig",function(){var a;return a={},{configure:function(b){return b(a)},$get:function(){return{get:function(b){return a[b]}}}}})}.call(this),function(){angular.module("StrollopiaJS.Cordova").factory("sjsNotification",["sendPush","$timeout","$cordovaDevice","$localStorage","CurrentDevice",function(a,b,c,d,e){var f;return f={notificationParams:{id:0},usePhonegap:function(){return void 0!==navigator.notification&&null!==navigator.notification},audioElementId:null,audioElement:null,beepAudioUrl:"assets/notification.mp3",debugStatements:!1,alert:function(a,b,c,d,e,f){return null==c&&(c="Alert"),null==d&&(d="Ok"),null==e&&(e=0),null==f&&(f=0),this.beep(e,f),this.usePhonegap()?navigator.notification.alert(a,b,c,d):alert(a),this.debugStatements?console.log("Alert: "+c+": "+a):void 0},addAudioElement:function(){var a;return this.usePhonegap()||null!==this.audioElementId?void 0:(a="notification-audio",$("body").append("<audio id='"+a+"' preload='auto'><source src='"+this.beepAudioUrl+"' type='audio/mp3'></audio>"),this.audioElementId=a,this.audioElement=document.getElementById(this.audioElementId))},beep:function(a,b){var c;return null==a&&(a=0),null==b&&(b=0),this.debugStatements&&console.log("Beep - using phonegap? "+this.usePhonegap()),this.usePhonegap()?(a>0&&navigator.notification.beep(a),b>0&&navigator.notification.vibrate(b)):(this.addAudioElement(),c=this.audioElement,a>0&&(c.load(),c.play())),this.debugStatements?console.log("Beep: audio: "+a+", vibration: "+b):void 0},localNotification:function(){return function(a,b){return null==b&&(b="Strollopia Local"),f.debugStatements&&console.warn("Local Notification: "+a),f.notificationParams.id++,e.useCordova()?window.plugin.notification.local.add({id:""+f.notificationParams.id,message:a}):f.browserNotification(a,b)}}(),pushNotification:function(b,c){return null==c&&(c="Strollopia Push"),f.debugStatements&&console.warn("Push Notification: "+b),e.useCordova()?a(b):f.browserNotification(b,c)},browserNotification:function(a,b){var c;return Notify&&Notify.isSupported?(Notify.needsPermission&&Notify.requestPermission(),c=new Notify(b,{body:a,timeout:5e3}),c.show()):void 0},browserNotificationRequestPermssion:function(){return!e.useCordova()&&Notify&&Notify.isSupported&&Notify.needsPermission?Notify.requestPermission():void 0},cancelAllLocalNotifications:function(a,b){var c,d;return null==a&&(a=null),null==b&&(b=null),null!=(null!=(c=window.plugin)&&null!=(d=c.notification)?d.local:void 0)?window.plugin.notification.local.cancelAll(a,b):void 0},confirm:function(a,b,c,d,e,f){return null==c&&(c="Confirm"),null==d&&(d="OK,Cancel"),null==e&&(e=0),null==f&&(f=0),this.beep(e,f),this.usePhonegap()?(this.debugStatements&&console.log("Using phonegap confirm: "+a+" / "+c+" / "+d),navigator.notification.confirm(a,b,c,d)):b(confirm(a)?1:2),this.debugStatements?console.log("Confirm: "+c+": "+a):void 0}},f.notificationParams=d.$default({sjsNotificationNotificationParams:f.notificationParams}).sjsNotificationNotificationParams,f}])}.call(this),function(){angular.module("StrollopiaJS.Directives").directive("sjsAudioPlayer",["ngAudio","$parse",function(a,b){return{restrict:"E",template:'<div class="audio-player">\n <a class="btn btn-default btn-xs play" ng-if="sound.paused" ng-click="sound.play()">\n <i class="glyphicon glyphicon-play"></i>\n </a>\n <a class="btn btn-default btn-xs pause" ng-if="!sound.paused" ng-click="sound.pause()">\n <i class="glyphicon glyphicon-pause"></i>\n </a>\n <a class="btn btn-primary btn-xs stop" ng-if="!sound.paused" ng-click="sound.stop()">\n <i class="glyphicon glyphicon-stop"></i>\n </a>\n</div>',link:function(c,d,e){var f;return f=b(e.src),c.$watch(function(){return f(c)},function(){var b;return(b=f(c))?(null!=c.sound&&c.sound.stop(),c.sound=a.load(b)):c.sound=void 0})}}}])}.call(this),function(){angular.module("StrollopiaJS.Directives").directive("sjsBase64FileModel",["$parse",function(a){return{link:function(b,c,d){var e,f;return e=a(d.sjsBase64FileModel),f=e.assign,c.bind("change",function(a){var c,d;return c=a.target.files.item(0),c?(d=new FileReader,d.onload=function(a){return b.$apply(function(){var d;return d=e(b),null==d&&(d={},f(b,d)),d.name=c.name,d.content=btoa(a.target.result)})},d.readAsBinaryString(c)):void 0})}}}]),angular.module("StrollopiaJS.Directives").directive("sjsDataUrlModel",["$parse",function(a){return{link:function(b,c,d){var e,f;return e=a(d.sjsDataUrlModel),f=e.assign,c.bind("change",function(a){var c,d;return c=a.target.files.item(0),c?(d=new FileReader,d.onload=function(a){return b.$apply(function(){var d;return d=e(b),null==d&&(d={},f(b,d)),d.name=c.name,d.content=a.target.result})},d.readAsDataURL(c)):void 0})}}}])}.call(this),function(){angular.module("StrollopiaJS.Directives").directive("sjsLoader",["TemplateLoader","Loader",function(a,b){var c;return c={restrict:"E",scope:!0,link:function(c,d,e){var f,g,h,i,j;f=function(a,b,d,f){var g;if(null==b&&(b=null),null==d&&(d=!1),null==f&&(f=!0),null==b&&(b=a),d&&!e[a])throw"Attribute "+attrname+" is required, but not found";return e[a]?(g=e[a],f&&(g=c.$eval(e[a])),c[b]=g):void 0},f("noneTemplate","statusNoneBind"),f("loadingTemplate","loadingBind"),f("failedTemplate","failedBind"),g={statusNoneBind:"sjs-loader/noneTemplate.tpl.html",loadingBind:"sjs-loader/loadingTemplate.tpl.html",failedBind:"sjs-loader/failedTemplate.tpl.html"};for(h in g)j=g[h],null==c[h]&&(c[h]=j);return i=function(){return b.isLoading()?a.bindTemplateToElement(d,c.loadingBind,c):b.failed()?a.bindTemplateToElement(d,c.failedBind,c):a.bindTemplateToElement(d,c.statusNoneBind,c)},c.$watch(function(){return b.status()},function(){return i()}),i()}}}])}.call(this),function(){angular.module("StrollopiaJS.Filters").filter("filterMultiple",["$filter",function(a){return function(b,c){var d;return d={data:b,filteredData:[],applyFilter:function(b,c){var d,e,f,g,h;if(d=[],0===this.filteredData.length&&(this.filteredData=this.data),b){if(e={},angular.isArray(b)){if(angular.isArray(b)&&b.length>0)for(f=g=0,h=b.length;h>=0?h>=g:g>=h;f=h>=0?++g:--g)angular.isDefined(b[f])&&(e[c]=b[f],d=d.concat(a("filter")(this.filteredData,e)))}else e[c]=b,d=d.concat(a("filter")(this.filteredData,e));if(d.length>0)return this.filteredData=d}}},c&&angular.forEach(c,function(a,b){return d.applyFilter(a,b)}),d.filteredData}}])}.call(this),function(){angular.module("StrollopiaJS.Models").factory("App",["BaseResource","$http","API","Map",function(a,b,c,d){var e;return e=a("app","/apps/:id",{},{mine:{method:"GET",url:a.url("/apps/mine"),isArray:!0},search:{method:"GET",url:a.url("/apps/search"),isArray:!0}}),e.prototype.$included_maps=function(a,b,c){var e;return angular.isObject(a)||(e=[{},a,b],a=e[0],b=e[1],c=e[2]),d.included_maps(angular.extend({app_id:this.id},a),b,c)},e.prototype.$add_included_map=function(a){return b.post(c.url("/apps/"+this.id+"/included_maps"),{included_map_id:a.id})},e.prototype.$remove_included_map=function(a){return b["delete"](c.url("/apps/"+this.id+"/included_maps/"+a.id))},e}])}.call(this),function(){angular.module("StrollopiaJS.Models").factory("BaseResource",["$cachedResource","API","LoaderInterceptor","$q","InterceptorChain","MethodCallbacks","$resource",function(a,b,c,d,e,f,g){var h;return h=function(b,i,j,k,l,m){var n,o,p,q,r,s,t,u,v,w,x,y,z,A;null==j&&(j={}),null==k&&(k={}),null==l&&(l=[]),null==m&&(m=!0),z=h.url(i),o=h.addRoot(b),s={id:"@id"},t={responseError:function(a){var b,c;return null!=(null!=a&&null!=(c=a.data)?c.errors:void 0)&&null!=a.config&&(null==(b=a.config).data&&(b.data={}),h.setErrorsFromRejection(a.config.data,a.data.errors)),d.reject(a)}},l.push(t),r={save:{method:"POST",transformRequest:o},update:{method:"PUT",transformRequest:o},query:{method:"GET",isArray:!0},get:{method:"GET"}};for(w in r)r[w].interceptor=new e(l);if(v=function(a,b){var c,d,e;d={};for(c in b)e=b[c],d[c]=e;for(c in a)e=a[c],d[c]=e;return d},p=v(k,r),this.loaderInterceptor=new c,p=e.modifyMethodByType(p,["GET"],this.loaderInterceptor,function(a){return this.loaderInterceptor.request(!1),a}),q=v(j,s),y=m?a(b,z,q,p):g(z,q,p),m)for(x in p)n=p[x],("POST"===(A=n.method)||"PUT"===A||"PATCH"===A)&&(u=function(a){return a.$promise["catch"](function(b){var c;return null!=(null!=b&&null!=(c=b.data)?c.errors:void 0)&&h.setErrorsFromRejection(a,b.data.errors),d.reject(b)})},f.after(y,x,u),f.after(y.prototype,"$"+x,u));return y.loaderInterceptor=this.loaderInterceptor,y.prototype.isNew=function(){return null==this.id},y.prototype.isCaching=function(){return m},y.isCaching=function(){return m},y.ignoreLoader=function(a){return null==a&&(a=!0),this.loaderInterceptor.setIgnore(a)},y.isIgnoringLoader=function(){return this.loaderInterceptor.ignore},y.root=b,y},h.setErrorsFromRejection=function(a,b){var c,d,e,f,g;for(null==a.$errors&&(a.$errors=[]),d=["validations","messages"],g=[],e=0,f=d.length;f>e;e++)c=d[e],null!=(null!=b?b[c]:void 0)?angular.isArray(b[c])?g.push(a.$errors=a.$errors.concat(b[c])):g.push(a.$errors.push(b[c])):g.push(void 0);return g},h.addRoot=function(a){return function(b){var c;return c={},c[a]=b,JSON.stringify(c)}},h.url=function(a){var c;return c=a.match(/^https?:\/\//)?a:b.url(a)},h}])}.call(this),function(){angular.module("StrollopiaJS.Models").factory("Checkpoint",["BaseResource",function(a){return a("checkpoint","/maps/:map_id/checkpoints/:id",{map_id:"@map_id"})}])}.call(this),function(){angular.module("StrollopiaJS.Models").factory("Map",["BaseResource","$http","API",function(a,b,c){var d;return d=a("map","/maps/:id",{},{mine:{method:"GET",url:a.url("/maps/mine"),isArray:!0},"public":{method:"GET",url:a.url("/maps/public"),isArray:!0},strollable:{method:"GET",url:a.url("/maps/strollable"),isArray:!0},accessible:{method:"GET",url:a.url("/maps/accessible"),isArray:!0},referenced_maps:{method:"GET",url:a.url("/maps/:id/referenced_maps"),isArray:!0},recent:{method:"GET",url:a.url("/maps/recent"),isArray:!0},search:{method:"GET",url:a.url("/maps/search"),isArray:!0},search_strollable:{method:"GET",url:a.url("/maps/search"),params:{strollable:!0},isArray:!0},strollable_near_point:{method:"GET",url:a.url("/maps/strollable_near_point"),params:{strollable:!0},isArray:!0},strollable_near_point_by_app_id:{method:"GET",url:a.url("/maps/strollable_near_point_by_app_id"),params:{strollable:!0},isArray:!0},published_strollable:{method:"GET",url:a.url("/maps/published_strollable"),isArray:!0},search_published_strollable:{method:"GET",url:a.url("/maps/search"),params:{published_strollable:!0},isArray:!0},published_strollable_near_point:{method:"GET",url:a.url("/maps/published_strollable_near_point"),params:{published_strollable:!0},isArray:!0},included_maps:{method:"GET",url:a.url("/apps/:app_id/included_maps"),isArray:!0}}),d.prototype.$referenced_maps=function(a,b,c){var e;return angular.isObject(a)||(e=[{},a,b],a=e[0],b=e[1],c=e[2]),d.referenced_maps(angular.extend({id:this.id},a),b,c)},d.prototype.$add_referenced_map=function(a){return b.post(c.url("/maps/"+this.id+"/referenced_maps"),{referenced_map_id:a.id})},d.prototype.$remove_referenced_map=function(a){return b["delete"](c.url("/maps/"+this.id+"/referenced_maps/"+a.id))},d}])}.call(this),function(){}.call(this),function(){angular.module("StrollopiaJS.Models").factory("SharedUser",["BaseResource",function(a){return function(b){var c;if(null==b&&(b=null),c=null,angular.isString(b)?c=b:angular.isObject(b)&&null!=b.root&&angular.isString(b.root)?c=b.root:angular.isFunction(b)&&null!=b.root&&angular.isString(b.root)&&(c=b.root),null==c)throw"Unable to decipher parent type of SharedUser. Usage: SharedUser('map').query(parent_id: id)";return a("shared_user","/"+c+"s/:parent_id/shared_users/:id",{parent_id:"@parent_id"},{},[],!1)}}])}.call(this),function(){}.call(this),function(){angular.module("StrollopiaJS.Models").factory("Template",["BaseResource",function(a){return a("template","/templates/:id",{},{mine:{method:"GET",url:a.url("/templates/mine"),isArray:!0},accessible:{method:"GET",url:a.url("/templates/accessible"),isArray:!0}})}])}.call(this),function(){angular.module("StrollopiaJS.Models").factory("User",["BaseResource",function(a){return a("user","/users/:id",{},{me:{method:"GET",url:a.url("/users/me")},accessible:{method:"GET",url:a.url("/users/accessible"),isArray:!0},search:{method:"GET",url:a.url("/users/search"),isArray:!0}})}])}.call(this),angular.module("StrollopiaJS.Directives").run(["$templateCache",function(a){"use strict";a.put("sjs-loader/failedTemplate.tpl.html",'<span class="loader-failed">Loading failed</span>')}]),angular.module("StrollopiaJS.Directives").run(["$templateCache",function(a){"use strict";a.put("sjs-loader/loadingTemplate.tpl.html",'<span class="loader-loading"><i class="fa fa-spinner fa-spin"></i>Loading...</span>')}]),angular.module("StrollopiaJS.Directives").run(["$templateCache",function(a){"use strict";a.put("sjs-loader/noneTemplate.tpl.html","")}]),function(){angular.module("StrollopiaJS.Utils.AccessToken").factory("AccessToken",["TokenStorage",function(a){var b;return b={set:function(b,c){return null==c&&(c=""),this.email=c,this.token=b,a.accessToken=this.token,a.emailAddress=this.email},clear:function(){return a.accessToken="",a.emailAddress="",b.token=a.accessToken,b.email=a.emailAddress}},b.token=a.accessToken,b.email=a.emailAddress,b}])}.call(this),function(){angular.module("StrollopiaJS.Utils.AccessToken").provider("AccessTokenRequestIntercepter",["$httpProvider",function(a){var b;return b=void 0,{activate:function(c){return b=c,a.interceptors.push("AccessTokenRequestIntercepter")},$get:["AccessToken","API","$q","$injector",function(a,c,d,e){var f;return f={},f.request=function(f){var g,h,i,j;return h=!f.url.match("^"+c.rootUrl()),j=f.url.match("^"+c.url("/(access_token|users)"))&&f.method.match(/post/i),i=f.url.match("^"+c.url("/users/reset_password"))&&f.method.match(/put/i),h||j||i?f:(g=a.token,null!=g&&""!==g?(f.params||(f.params={}),f.params.access_token=g,f):(null!=b&&e.invoke(b),d.reject("No access token")))},f}]}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.AccessToken").factory("fetchAccessToken",["$http","AccessToken","API",function(a,b,c){return function(d,e){return a.post(c.url("/access_token"),{credentials:{email:d,password:e}}).then(function(a){var c;return c=a.data.access_token,b.set(c,d),c})}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.AccessToken").factory("TokenStorage",function(){return localStorage})}.call(this),function(){angular.module("StrollopiaJS.Utils.API").factory("API",["StrollopiaConfig",function(a){return{rootUrl:function(){return a.get("apiRootUrl")||"https://api.strollopia.com"},url:function(a){return""+this.rootUrl()+"/"+a}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Data").factory("DataManager",["FetchData","$rootScope","Checkpoint","$q","$timeout",function(a,b,c,d,e){var f,g;return g={_mapById:{},_checkpointById:{},_checkpointLists:{},_onMapComplete:null,_onNewMapData:null,_onNewCheckpointData:null,_onError:null,_onMapError:null,_onCheckpointError:null,getMap:function(a){return null==f._mapById[a]&&(f._mapById[a]=f._updateMap(a)),f._mapById[a]},getCheckpointList:function(a){return null==f._checkpointLists[a]&&(f._checkpointLists[a]=f._updateCheckpointList(a)),f._checkpointLists[a]},getCheckpoint:function(a,b){return null==f._checkpointById[b]&&(f._checkpointById[b]=f._updateCheckpoint(a,b)),f._checkpointById[b]},haveMap:function(a){return null!=f._mapById[a]},haveCheckpoint:function(a,b){return null!=f._checkpointById[b]},findBySearch:function(b,c){var d;return null==c&&(c={}),d=a.searchPublishedStrollableMaps(b,c,f._onMapComplete,f._onError,f._newMapDataWrapper),d.$promise.then(f._setMaps),d.$httpPromise.then(f._setMaps),d},findMapsNearPoint:function(b,c,d){var e;return null==d&&(d={}),e=a.fetchPublishedStrollableNearPoint(b,c,d,f._onMapComplete,f._onError,f._newMapDataWrapper),e.$promise.then(f._setMaps),e.$httpPromise.then(f._setMaps),e},findAppMapsNearPoint:function(b,c,d,e){var g;return null==e&&(e={}),g=a.fetchStrollableNearPointByAppId(b,c,d,e,f._onMapComplete,f._onError,f._newMapDataWrapper),g.$promise.then(f._setMaps),g.$httpPromise.then(f._setMaps),g},loadAppMaps:function(b,c){var e,g;return null==c&&(c={}),g=d.defer(),e=a.fetchAppMaps(b,c,f._onMapComplete,f._onError,f._newMapDataWrapper),e.$promise.then(f._setMaps),e.$httpPromise.then(f._setMaps),e},setOnMapComplete:function(a){return f._onMapComplete=a},setOnNewMapData:function(a){return f._onNewMapData=a},setOnNewCheckpointData:function(a){return f._onNewCheckpointData=a},setOnError:function(a){return f._onError=a},setOnMapError:function(a){return f._onMapError=a},setOnCheckpointError:function(a){return f._onCheckpointError=a},updateCachedData:function(a,b){var c,e,g,h,i,j,k,l;if(null==b&&(b=!0),g=[],null==a){a=[],l=f._mapById;for(c in l)i=l[c],a.push(c)}for(j=0,k=a.length;k>j;j++)e=a[j],h=d.when(f._updateMap(e).$httpPromise),h=h.then(function(a){var c,d,e,g;if(b)for(g=a.checkpoints,d=0,e=g.length;e>d;d++)c=g[d],f._updateCheckpoint(a.id,c.id)}),g.push(h);return d.all(g)},_updateMap:function(b){var c,e;return c=d.defer(),e=a.fetchMap(b,f._onCompleteMapWrapper(c),f._mapRejectionCallback(b),f._newMapDataWrapper),e.$promise.then(f._setMap),e.$httpPromise.then(f._setMap,f._mapRejectionCallback(b)),e.$completePromise=c.promise,e.$completePromise.then(f._setMap,f._mapRejectionCallback(b)),e},_updateCheckpoint:function(a,b){var d;return d=c.get({map_id:a,id:b}),d.$promise.then(f._setCheckpoint).then(f._onNewCheckpointData),d.$httpPromise.then(function(b){return f._setCheckpoint(b),f._mergeCheckpointIntoMapById(a,b)},f._checkpointRejectionCallback(b)).then(f._onNewCheckpointData),d},_updateCheckpointList:function(a,b){var c,e,g,h,i,j,k;return null==b&&(b=!0),null==(k=f._checkpointLists)[a]&&(k[a]=new Array),e=f._checkpointLists[a],i=b?f._updateMap(a):f.getMap(a),c=d.defer(),e.$promise=c.promise,j=i.$promise?i.$promise:d.when(i),j.then(function(a){return f._setCheckpointList(a),c.resolve(e)}),h=d.defer(),e.$httpPromise=h.promise,g=i.$httpPromise?i.$httpPromise:d.when(i),g.then(function(a){return f._setCheckpointList(a),h.resolve(e)}),e},_setMaps:function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(f._setMap(b));return e},_setMap:function(a){var b,c;return null!=(null!=a?a.id:void 0)?(null==(b=f._mapById)[c=a.id]&&(b[c]={}),null==a.checkpoints&&(a.checkpoints=[]),null==f._mapById[a.id].checkpoints?f._copyObj(a,f._mapById[a.id]):f._copyObj(a,f._mapById[a.id],"checkpoints"),f._addPromises(f._mapById[a.id])):void 0},_setCheckpointList:function(a){var b,c,d,e,g,h;for(c=f._checkpointLists[a.id];c.length>0;)c.pop();for(d=null!=a.checkpoints?a.checkpoints:[],h=[],e=0,g=d.length;g>e;e++)b=d[e],c.push(b.id),b.content_fields?h.push(f._setCheckpoint(b)):h.push(void 0);return h},_setCheckpoint:function(a){var b,c;return null!=(null!=a?a.id:void 0)?(null==(b=f._checkpointById)[c=a.id]&&(b[c]={}),f._copyObj(a,f._checkpointById[a.id]),f._addPromises(f._checkpointById[a.id])):void 0},_mapRejectionCallback:function(a){return function(b){return f._mapById[a]&&delete f._mapById[a],angular.isFunction(f._onMapError)?f._onMapError(b,a):void 0}},_checkpointRejectionCallback:function(a){return function(b){return f._checkpointById[a]&&delete f._checkpointById[a],angular.isFunction(f._onCheckpointError)?f._onCheckpointError(b,a):void 0}},_addPromises:function(a){var b,c,e,f,g;for(c=["$promise","$httpPromise","$completePromise"],g=[],e=0,f=c.length;f>e;e++)b=c[e],g.push(a[b]=a[b]?a[b]:d.when(a));return g},_copyObj:function(a,b,c){var d,e,f;if(null==c&&(c=null),a!==b){if(null==b)return b=angular.copy(a);if(angular.isObject(a)){f=[];for(d in a)e=a[d],d!==c&&(b[d]&&b[d]!==a[d]?angular.isString(b[d])?f.push(b[d]=a[d]):f.push(angular.copy(a[d],b[d])):f.push(b[d]=angular.copy(a[d])));return f}return angular.copy(a,b)}},_mergeCheckpointIntoMapById:function(a,b){return f.getMap(a).$promise.then(function(a){return f._mergeCheckpointIntoMap(a,b)})},_mergeCheckpointIntoMap:function(a,b){var c,d,e,g,h,i,j,k;for(d=!1,k=a.checkpoints,e=i=0,j=k.length;j>i;e=++i)if(c=k[e],c.id===b.id){if(c===b){d=!0;break}for(g in c)h=c[g],null==b[g]&&(b[g]=h);f._copyObj(b,a.checkpoints[e]),d=!0}d||a.checkpoints.push(angular.copy(b))},_newMapDataWrapper:function(a,b){return f._setMap(a),angular.isFunction(f._onNewMapData)&&f._onNewMapData(a),f._mergeNewCheckpoints(f.getMap(a.id),b),f._updateCheckpointList(a.id,!1)},_mergeNewCheckpoints:function(a,b){var c,d,e;for(d=0,e=b.length;e>d;d++)c=b[d],f._mergeCheckpointIntoMap(a,c);return f._updateCheckpointList(a.id,!1)},_onCompleteMapWrapper:function(a){return function(b,c){return angular.isFunction(f._onMapComplete)&&f._onMapComplete(b,c),f._updateCheckpointList(b.id,!1),e(function(){return a.resolve(b)})}}},f=g,g}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Data").factory("fetchCheckpoints",["$q","Checkpoint",function(a,b){return function(c){var d,e,f,g,h;return e=a.defer(),f={},d=[],g=0,h=function(c){var i,j;if(!f[c.id])return f[c.id]=!0,g++,i=b.query({map_id:c.id}).$httpPromise,j=c.$referenced_maps().$httpPromise,i.then(function(a){return e.notify(a),d=d.concat(a)}),j=j.then(function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(h(b));return e}),a.all([i,j]).then(function(){return g--,g?void 0:e.resolve(d)},function(a){return e.reject(reason)})},h(c),e.promise}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Data").factory("FetchData",["Map","Checkpoint","fetchCheckpoints","App",function(a,b,c,d){var e;return e={_runFetch:function(a,b,c,d,e){var f=this;return null==c&&(c=null),null==d&&(d=null),null==e&&(e=null),a.$httpPromise.then(function(a){var g,h,i,j;if(b){for(j=[],h=0,i=a.length;i>h;h++)g=a[h],j.push(f.fetchCheckpoints(g,c,d,e));return j}return f.fetchCheckpoints(a,c,d,e)},function(){return null!=d?d():void 0}),a},fetchPublicMaps:function(b,c,d,e){var f;return null==b&&(b={}),null==c&&(c=null),null==d&&(d=null),null==e&&(e=null),f=a["public"](b),this._runFetch(f,!0,c,d,e)},fetchRecentMaps:function(b,c,d,e){var f;return null==b&&(b={}),null==c&&(c=null),null==d&&(d=null),null==e&&(e=null),f=a.recent(b),this._runFetch(f,!0,c,d,e)},searchMaps:function(b,c,d,e,f){var g;return null==c&&(c={}),null==d&&(d=null),null==e&&(e=null),null==f&&(f=null),c.q=b,g=a.search(c),this._runFetch(g,!0,d,e,f)},fetchMap:function(b,c,d,e){var f;return null==c&&(c=null),null==d&&(d=null),null==e&&(e=null),f=a.get({id:b}),this._runFetch(f,!1,c,d,e)},fetchAppMaps:function(b,c,d,e){var f;return null==c&&(c=null),null==d&&(d=null),null==e&&(e=null),f=a.included_maps({app_id:b}),this._runFetch(f,!0,c,d,e)},searchStrollableMaps:function(b,c,d,e,f){var g;return null==c&&(c={}),null==d&&(d=null),null==e&&(e=null),null==f&&(f=null),c.q=b,g=a.search_strollable(c),this._runFetch(g,!0,d,e,f)},fetchStrollableNearPoint:function(b,c,d,e,f,g){var h;return null==d&&(d={}),null==e&&(e=null),null==f&&(f=null),null==g&&(g=null),d.latitude=b,d.longitude=c,h=a.strollable_near_point(d),this._runFetch(h,!0,e,f,g)},fetchStrollableNearPointByAppId:function(b,c,d,e,f,g,h){var i;return null==e&&(e={}),null==f&&(f=null),null==g&&(g=null),null==h&&(h=null),e.latitude=b,e.longitude=c,e.app_id=d,i=a.strollable_near_point(e),this._runFetch(i,!0,f,g,h)},searchPublishedStrollableMaps:function(b,c,d,e,f){var g;return null==c&&(c={}),null==d&&(d=null),null==e&&(e=null),null==f&&(f=null),c.q=b,g=a.search_published_strollable(c),this._runFetch(g,!0,d,e,f)},fetchPublishedStrollableNearPoint:function(b,c,d,e,f,g){var h;return null==d&&(d={}),null==e&&(e=null),null==f&&(f=null),null==g&&(g=null),d.latitude=b,d.longitude=c,h=a.published_strollable_near_point(d),this._runFetch(h,!0,e,f,g)},fetchCheckpoints:function(a,b,d,e){return null==b&&(b=null),null==d&&(d=null),null==e&&(e=null),a.checkpoints=[],c(a).then(function(c){return"function"==typeof b?b(a,c):void 0},function(){return"function"==typeof d?d():void 0},function(b){var c,d,f;for(d=0,f=b.length;f>d;d++)c=b[d],a.checkpoints.push(c);return"function"==typeof e?e(a,b):void 0}),a.checkpoints}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Device").factory("DeviceTokenStorage",[function(){var a;return a="__push_device_token",{setDeviceToken:function(b){return localStorage.setItem(a,b)},getDeviceToken:function(){return localStorage.getItem(a)}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Device").factory("CurrentDevice",["$cordovaDevice",function(a){var b;return b={getUUID:function(){return b.useCordova()?a.getUUID():(new Fingerprint).get().toString()},useCordova:function(){return null!=window.device},getDevice:function(){var c,d,e,f,g,h,i,j,k;if(c={},b.useCordova())c={uuid:a.getUUID(),model:a.getModel(),platform:a.getPlatform(),version:a.getVersion()};else{for(h=b.getUUID(),e=navigator.product,i="",g=navigator.userAgent.toLowerCase(),g.match(/webkit/)?g.match(/chrome/)?e="chrome":g.match(/safari/)&&(e="safari"):g.match(/firefox/)?e="firefox":g.match(/opera/)&&(e="opera"),i=g.match(new RegExp(e+"/([[0-9]*.]*[0-9]*)")),i=i.length>1?i[1]:"Unknown",e.length>0&&(e=e[0].toUpperCase()+e.substr(1,e.length-1)),d=["iPhone","Android","Blackberry"],j=0,k=d.length;k>j;j++)f=d[j],g.match(new RegExp(f.toLowerCase()))&&(e+=" "+f);c={uuid:h,model:e,platform:navigator.platform,version:i}}return c}}}]),angular.module("StrollopiaJS.Utils.Device").factory("fetchCurrentDevice",["$http","API","$cordovaDevice","CurrentDevice",function(a,b,c,d){return function(){return a.get(b.url("devices/"+d.getUUID())).then(function(a){return a.data},function(c){var e;return 404===c.status?(e=d.getDevice(),a.post(b.url("/devices"),{device:e}).then(function(a){return e})):$q.reject(response)})}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Device").factory("registerForPush",["fetchCurrentDevice","$cordovaPush","$cordovaDevice","$http","API","DeviceTokenStorage",function(a,b,c,d,e,f){return function(g){var h;if(null!=(null!=(h=window.plugins)?h.pushNotification:void 0))return b.register(g).then(function(b){return f.setDeviceToken(b),a().then(function(a){return d.put(e.url("/devices/"+a.uuid),{device:{push_device_type:c.getPlatform().toLowerCase(),push_device_token:b}})})})}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Device").factory("sendPush",["fetchCurrentDevice","$http","API","DeviceTokenStorage",function(a,b,c,d){return function(e){return a().then(function(a){return b.post(c.url("devices/"+a.uuid+"/send_push"),{token:d.getDeviceToken(),message:e})})}}])}.call(this),function(){var a=function(){function a(a){var c=!1;for(var d in b){f.style.fontFamily=a+","+b[d],e.appendChild(f);var i=f.offsetWidth!=g[b[d]]||f.offsetHeight!=h[b[d]];e.removeChild(f),c=c||i}return c}var b=["monospace","sans-serif","serif"],c="mmmmmmmmmmlli",d="72px",e=document.getElementsByTagName("body")[0],f=document.createElement("span");f.style.fontSize=d,f.innerHTML=c;var g={},h={};for(var i in b)f.style.fontFamily=b[i],e.appendChild(f),g[b[i]]=f.offsetWidth,h[b[i]]=f.offsetHeight,e.removeChild(f);this.detect=a};angular.module("StrollopiaJS.Utils.FontDetect").service("FontDetector",function(){var b;return b=new a})}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsError",["sjsFormHelpers",function(a){return a.modelFieldDirective("sjsError",function(a,b,c,d,e){return c.$set("sjsErrorShow",""),c.$set("sjsErrorText","")})}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsErrorShow",["sjsFormHelpers",function(a){return a.modelFieldDirective("sjsErrorShow",function(a,b,c,d,e){return c.$set("ngShow",""+d+".$errors."+e)})}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsErrorText",["sjsFormHelpers",function(a){return a.modelFieldDirective("sjsErrorText",function(a,b,c,d,e){return c.$set("ngBind",""+d+".$errors."+e)})}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsField",[function(){return{controller:["$attrs",function(a){return this.field=a.sjsField,null}]}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").service("sjsFormHelpers",["$compile",function(a){return{modelFieldDirective:function(b,c){var d;return d="sjsNoRelink",{require:["^sjsModel","^sjsField"],link:function(e,f,g,h){var i,j;if(g[b]!==d)return j=h[0].model,i=h[1].field,c(e,f,g,j,i),g.$set(b,d),a(f)(e)}}}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsInput",["sjsFormHelpers",function(a){return a.modelFieldDirective("sjsInput",function(a,b,c,d,e){return c.$set("ngModel",""+d+"."+e)})}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Form").directive("sjsModel",[function(){return{controller:["$attrs",function(a){return this.model=a.sjsModel,null}]}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.HTML").factory("HtmlMangler",["$rootScope",function(a){var b;return b={linksToSystemBrowser:function(a,c){return null==a&&(a=""),null==c&&(c=!0),$(""+(a="")+" a").each(function(a){var d;return d=this.href,!c||b.linkIsExternal(d)?$(this).click(function(){return $(this).attr("href",null),window.open(d,"_system")}):void 0})},linkIsExternal:function(a){var b;return b=a.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/),angular.isString(b[1])&&b[1].length>0&&b[1].toLowerCase()!==location.protocol?!0:angular.isString(b[2])&&b[2].length>0&&b[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host?!0:!1}}}])}.call(this),function(){var a;a=window.i18n,window.i18n=void 0,angular.module("StrollopiaJS.Utils.i18n").factory("i18n",["StrollopiaConfig","$rootScope","$q",function(b,c,d){var e,f,g;return c.t=function(a){return a},e=d.defer(),f=function(){return a.init(b.get("i18n"),function(a){return c.$apply(function(){return c.t=a,e.resolve(a);
})})},f(),g=e.promise,function(b){return function(c,g){return null==g&&(g=!1),g&&(e=d.defer(),f(),b=e.promise),b.then(function(b){return c(b,a)})}}(g)}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Indicators").factory("Errors",["$rootScope",function(a){var b;return b={set:function(b){return a.errors=b},clear:function(){return a.errors=void 0},handleErrorResponse:function(a){return b.set(a.data.errors),a}},a.$on("$routeChangeSuccess",b.clear),b.clear(),b}])}.call(this),function(){var a;a={none:0,loading:1,failed:2},angular.module("StrollopiaJS.Utils.Indicators").factory("Loader",["$rootScope",function(b){var c;return c={loadingState:0,loadFailed:!1,reset:function(){return this.loadingState=0,this.loadFailed=!1},startLoad:function(){return null==this.loadingState&&(this.loadingState=0),this.loadingState++},endLoad:function(){return null==this.loadingState&&(this.loadingState=0),this.loadingState--},fail:function(a){return null==a&&(a=function(){}),this.loadFailed=!0,a()},failed:function(){return this.loadFailed},isLoading:function(){return!this.loadFailed&&this.loadingState>0},status:function(){return this.isLoading()||this.failed()?this.isLoading()&&!this.failed()?a.loading:a.failed:a.none}},null==b.Loader&&(b.Loader=c),b.Loader}])}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};angular.module("StrollopiaJS.Utils.Indicators").factory("LoaderInterceptor",["Loader","$q",function(b,c){var d;return d=function(){function d(){this.setIgnore=a(this.setIgnore,this),this.responseError=a(this.responseError,this),this.response=a(this.response,this),this.requestError=a(this.requestError,this),this.request=a(this.request,this)}return d.prototype.ignore=!1,d.prototype.request=function(a){return this.ignore||b.startLoad(),a||c.when(a)},d.prototype.requestError=function(a){return this.ignore||b.fail(),c.reject(a)},d.prototype.response=function(a){return this.ignore||b.endLoad(),a||c.when(a)},d.prototype.responseError=function(a){return this.ignore||b.fail(),c.reject(a)},d.prototype.setIgnore=function(a){return null==a&&(a=!0),this.ignore=a},d}(),b.reset(),d}])}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};angular.module("StrollopiaJS.Utils.Interceptors").factory("InterceptorChain",["$q",function(c){var d;return d=function(){function d(b){null==b&&(b=[]),this.runChain=a(this.runChain,this),this.responseError=a(this.responseError,this),this.response=a(this.response,this),this.requestError=a(this.requestError,this),this.request=a(this.request,this),this.addInterceptor=a(this.addInterceptor,this),this.addInterceptors=a(this.addInterceptors,this),this.requestInterceptors=[],this.responseInterceptors=[],this.addInterceptors(b)}return d.prototype.addInterceptors=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addInterceptor(b));return e},d.prototype.addInterceptor=function(a){return(a.request||a.requestError)&&this.requestInterceptors.push({success:a.request,error:a.requestError}),a.response||a.responseError?this.responseInterceptors.push({success:a.response,error:a.responseError}):void 0},d.prototype.request=function(a){return this.runChain(this.requestInterceptors,c.when(a))},d.prototype.requestError=function(a){return this.runChain(this.requestInterceptors,c.reject(a))},d.prototype.response=function(a){return this.runChain(this.responseInterceptors,c.when(a)).then(this.getResponseData,this.rejectResponse)},d.prototype.responseError=function(a){return this.runChain(this.responseInterceptors,c.reject(a)).then(this.getResponseData,this.rejectResponse)},d.prototype.runChain=function(a,b){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],b=b.then(c.success,c.error);return b},d.prototype.getResponseData=function(a){return a.resource},d.prototype.rejectResponse=function(a){return c.reject(a)},d.modifyMethodByType=function(a,c,e,f){var g,h,i,j;null==c&&(c=["GET"]),null==e&&(e=null),null==f&&(f=null);for(h in a)g=a[h],null!=g.method&&(j=g.method,b.call(c,j)>=0)&&(null!=f&&(null!=g.transformRequest?angular.isArray(g.transformRequest)?g.transformRequest.push(f):g.transformRequest=[g.transformRequest,f]:g.transformRequest=f),null!=e&&(i=new d,null==g.interceptor&&(g.interceptor=i),g.interceptor instanceof d||(i.addInterceptor(g.interceptor),g.interceptor=i),g.interceptor.addInterceptor(e)));return a},d}()}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("CustomMarkerPin",["$q","$timeout","$interval","FontDetector",function(a,b,c,d){var e;return e={defaultPinSettings:function(){return{color:"#E83A3A",fillOpacity:.9,strokeColor:"#222222",textColor:"#222222",doGradient:!0,scale:1,lineWidth:2,invert:!1,iconLibrary:"font-awesome",iconKey:"circle",brightnessThreshold:80}},componentToHex:function(a){var b,c;return b=a.toString(16),c=1===b.length?"0"+b:b,c.toUpperCase()},rgbToHex:function(a,b,c){return"#"+e.componentToHex(a)+e.componentToHex(b)+e.componentToHex(c)},hexToRgb:function(a){var b,c;return c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,a=a.replace(c,function(a,b,c,d){return b+b+c+c+d+d}),b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a),null!=b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null},colorToRgb:function(a){var b,c,d,f,g,h;return d=e.hexToRgb(a),null!=d?d:(c=document.createElement("div"),c.style.color=a,f=document.body.appendChild(c),b=window.getComputedStyle(c).color,document.body.removeChild(f),h=/(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})/,g=h.exec(b),null!=g?{r:parseInt(g[1]),g:parseInt(g[2]),b:parseInt(g[3])}:null)},invertRgb:function(a){var b;return b={},b.r=255-a.r,b.g=255-a.g,b.b=255-a.b,b},rgbString:function(a){return e.rgbaString(a)},rgbaString:function(a,b){return null==b&&(b=1),"rgba("+a.r+","+a.g+","+a.b+","+b+")"},brightnessOfRgb:function(a){return.2126*a.r+.7152*a.g+.0722*a.b},getDimensions:function(a,b){var c,d,f;return null==a&&(a=1),null==b&&(b=2),c=e.getContextSetup(),a/=c.scaleModifier,f=2*c.translateX*a+b,d=2*c.translateY*a+1.4*b,f=Math.round(f),d=Math.round(d),{size:{width:f,height:d},anchor:{x:f/2,y:d}}},_merge:function(a,b){var c;for(c in a)null==b[c]&&(b[c]=a[c]);return b},getCustomPinURLPromise:function(f){var g,h,i;return null==f&&(f={}),g=a.defer(),f=this._merge(e.defaultPinSettings(),f),h=e.getFontName(f.iconLibrary),i=c(function(){var a;return null!=window.strollopiaDebugStatements&&console.debug("Checking: font '"+h+"' available?"),a=d.detect(h),null!=window.strollopiaDebugStatements&&console.debug(a),a?c.cancel(i):void 0},10,1e3),i["finally"](function(){return b(function(){return g.resolve(e.getCustomPinURL(f))},1e3)}),g.promise},getCustomPinURL:function(a){var b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F;if(null==a&&(a={}),a=this._merge(e.defaultPinSettings(),a),h=e.getContextSetup(),A=h.translateX,B=h.translateY,v=h.scaleModifier,m=h.fontSize,l=h.fontNudge,F=h.workCanvasWidth,E=h.workCanvasWidth,D=document.createElement("canvas"),D.width=F,D.height=E,D.style.display="none",g=D.getContext("2d"),u=a.scale/v,s=a.lineWidth,f=e.colorToRgb(a.color),t=e.colorToRgb(a.strokeColor),x=e.colorToRgb(a.textColor),r=e.invertRgb(x),null==f||null==t||null==x)throw"Invalid color for Custom Marker Pin";return a.invert&&(f=e.invertRgb(f)),k=e.rgbaString(f,a.fillOpacity),w=e.rgbString(t),y=e.rgbString(x),e.brightnessOfRgb(f)<a.brightnessThreshold&&(y=e.rgbString(r)),j=.5,g.save(),g.translate(s/2,B*u+s/2),g.scale(u,u),g.translate(A,B),g.lineCap="butt",g.lineJoin="miter",g.miterLimit=4,g.save(),a.doGradient?(n=g.createLinearGradient(0,-B,0,0),n.addColorStop(.2,k),i={r:Math.round(f.r*j),g:Math.round(f.g*j),b:Math.round(f.b*j)},n.addColorStop(1,e.rgbaString(i,a.fillOpacity)),g.fillStyle=n):g.fillStyle=k,g.strokeStyle=w,g.lineWidth=s/u,h.drawPin(g),g.restore(),g.restore(),g.save(),g.translate(s/2,B*u+s/2),g.scale(u,u),g.translate(A,B),g.font=m+("px "+e.getFontName(a.iconLibrary)),g.fillStyle=y,p=$(e.getIconElementText("iconCreationElement",a.iconLibrary,a.iconKey)),$("body").append(p),o=document.getElementById("iconCreationElement"),C=window.getComputedStyle(o,":before").content,C=C.replace(/"/g,""),$("#iconCreationElement").remove(),z=g.measureText(C),g.fillText(C,-(z.width/2),-B-l),g.restore(),b=document.createElement("canvas"),d=2*A*u+s,c=2*B*u+1.4*s,b.width=d,b.height=c,q=g.getImageData(0,0,d,c),b.getContext("2d").putImageData(q,0,0),b.toDataURL("image/png")},getContextSetup:function(a){var b;return null==a&&(a="MAP_PIN"),b={translateX:51,translateY:83,scaleModifier:6,fontSize:64,fontNudge:8,workCanvasWidth:220,workCanvasHeight:350,drawPin:function(a){return a.beginPath(),a.moveTo(0,-165),a.bezierCurveTo(-27.618,-165,-50,-143.034,-50,-115.946),a.bezierCurveTo(-50,-88.849,0,0,0,0),a.bezierCurveTo(0,0,50,-88.849,50,-115.946),a.bezierCurveTo(50,-143.034,27.605,-165,0,-165),a.closePath(),a.fill(),a.stroke()}}},getFontName:function(a){switch(a){case"font-awesome":return"FontAwesome";default:return""}},getIconElementText:function(a,b,c){var d;return d=function(){switch(b){case"font-awesome":return d="fa fa";default:return""}}(),"<i id='"+a+"' class='"+d+"-"+c+"'></i>"}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("DistanceChecker",["GeoMath","$rootScope",function(a,b){var c;return c={_checkpoints:{},_lastFoundPoint:null,_nextCheckpointsListId:0,addCheckpoints:function(a,b,c){return null==b&&(b=null),null==c&&(c={}),null==c.radiusKey&&(c.radiusKey="radius"),null==c.locationKey&&(c.locationKey=null),null==b&&(b=this._nextCheckpointsListId,this._nextCheckpointsListId++),c.checkpoints=a,this._checkpoints[b]=c},removeCheckpoints:function(a){return delete this._checkpoints[a]},totalCheckpointsToCheck:function(){var a,b,c,d;b=0,d=this._checkpoints;for(c in d)a=d[c],b+=a.checkpoints.length;return b},isChecking:function(a){return null!=this._checkpoints[a]},_makeDistanceObj:function(a,b,c){return{distance:a,bearing:b,point:c}},getEventName:function(){return"strollopiajs.utils.map.distanceCheck"},_testDistance:function(a,b,c,d){return c<Math.sqrt(.5)*d?!0:b>a?!0:!1},closestRadius:function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q;h=Number.MAX_VALUE,k={latitude:b,longitude:c},p=this._checkpoints;for(f in p)for(d=p[f],g=d.locationKey,m=d.radiusKey,q=d.checkpoints,n=0,o=q.length;o>n;n++)i=q[n],j=null!=g?i[g]:i,e=a.calculateDistance(j,k),l=i[m],h>e-l&&(h=e-l);return h},check:function(c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;null==e&&(e=null),null==f&&(f=null),null==g&&(g=!1),q={latitude:c,longitude:d},s=null,k=[],t=null,r=null,n=null,A=this._checkpoints;for(l in A)if(i=A[l],null==e||l===e)for(m=i.locationKey,v=i.radiusKey,B=i.checkpoints,y=0,z=B.length;z>y;y++)o=B[y],p=null!=m?o[m]:o,j=a.calculateDistance(p,q),h=a.calculateBearing(p,q),u=o[v],u>=j&&(k.push(this._makeDistanceObj(j,h,o)),(null==s||this._testDistance(j,r,u,t))&&(null!=s&&null!=f&&(x=f(o),x&&(n=s)),s=this._makeDistanceObj(j,h,o),t=u,r=j,this._lastFoundPoint=o)),null!=s&&angular.equals(s.point,o)||(n=this._checkIfValidNextPoint(n,j,h,o,f));return w={primaryPoint:s,nextPoint:n,foundPoints:k},g&&b.$broadcast(this.getEventName,w),w},getClosestPointInArray:function(b,c,d,e,f,g){var h,i,j,k,l,m,n,o;for(null==e&&(e=null),null==f&&(f=null),null==g&&(g=!1),j=null,m={latitude:b,longitude:c},n=0,o=d.length;o>n;n++)k=d[n],l=null!=e?k[e]:k,i=a.calculateDistance(l,m),h=a.calculateBearing(l,m),g&&(k.distance=i,k.bearing=h),j=this._checkIfValidNextPoint(j,i,h,k,f);return j},_checkIfValidNextPoint:function(a,b,c,d,e){var f;return null==e&&(e=null),(null==a||b<a.distance)&&(f=!0,null!=e&&(f=e(d)),f&&(a=this._makeDistanceObj(b,c,d))),a}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("GeoMath",function(){var a,b;return b=6371e3,a={calculateDistance:function(a,c){var d,e,f,g,h,i;return this.convertFromGoogle([a,c]),f=this.toRad(a.latitude-c.latitude),g=this.toRad(a.longitude-c.longitude),h=this.toRad(c.latitude),i=this.toRad(a.latitude),d=Math.sin(f/2)*Math.sin(f/2)+Math.sin(g/2)*Math.sin(g/2)*Math.cos(h)*Math.cos(i),e=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),parseInt(b*e)},calculateBearing:function(a,b){var c,d,e,f,g,h,i;return this.convertFromGoogle([a,b]),d=this.toRad(a.latitude-b.latitude),e=this.toRad(a.longitude-b.longitude),f=this.toRad(b.latitude),g=this.toRad(a.latitude),i=Math.sin(e)*Math.cos(g),h=Math.cos(f)*Math.sin(g)-Math.sin(f)*Math.cos(g)*Math.cos(e),c=this.toDeg(Math.atan2(i,h)),c=(c+360)%360},projectOut:function(a,c,d){var e,f,g,h;return this.convertFromGoogle([a]),e=this.toRad(a.latitude),g=this.toRad(a.longitude),d=this.toRad(d),f=Math.asin(Math.sin(e)*Math.cos(c/b)+Math.cos(e)*Math.sin(c/b)*Math.cos(d)),h=g+Math.atan2(Math.sin(d)*Math.sin(c/b)*Math.cos(e),Math.cos(c/b)-Math.sin(e)*Math.sin(f)),{latitude:this.toDeg(f),longitude:this.toDeg(h)}},convertFromGoogle:function(a){return a.forEach(function(a){return"undefined"!=typeof a.lat&&"undefined"!=typeof a.lng?(a.latitude=a.lat(),a.longitude=a.lng()):void 0})},toRad:function(a){return a*Math.PI/180},toDeg:function(a){return 180*a/Math.PI}}})}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("Geocoder",["$localStorage","$q","$timeout","$rootScope","$http",function(a,b,c,d,e){var f,g,h,i,j,k,l;return k=a.geocodedLocations?JSON.parse(a.geocodedLocations):{},l=[],i=250,f="https://maps.googleapis.com/maps/api/geocode/json",h={OK:"OK",ZERO_RESULTS:"ZERO_RESULTS",REQUEST_DENIED:"REQUEST_DENIED",OVER_QUERY_LIMIT:"OVER_QUERY_LIMIT"},j=function(){var b;return b=l[0],e.get(f,{params:b.config}).then(function(e){var f,g,m,n,o,p;switch(f=e.data,o=f.results,p=f.status,n=b.config.address,p){case h.OK:m={lat:o[0].geometry.location.lat,lng:o[0].geometry.location.lng,formattedAddress:o[0].formatted_address},k[n]=m,a.geocodedLocations=JSON.stringify(k),l.shift(),b.d.resolve(m);break;case h.ZERO_RESULTS:l.shift(),b.d.reject({type:"zero",message:"Zero results for geocoding address "+n});break;case h.OVER_QUERY_LIMIT:b.executedAfterPause&&(l.shift(),b.d.reject({type:"busy",message:"Geocoding server is busy can not process address "+n}));break;case h.REQUEST_DENIED:l.shift(),b.d.reject({type:"denied",message:"Request denied for geocoding address "+n});break;default:l.shift(),b.d.reject({type:"invalid",message:"Invalid request for geocoding: status="+p+", address="+n})}return l.length&&(p===h.OVER_QUERY_LIMIT?(g=l[0],g.executedAfterPause=!0,c(j,i)):c(j,0)),d.$$phase?void 0:d.$apply()})},g={googleGeocodeAPIUrl:f,geocode:function(a,c,d){var e,f;return null==c&&(c=!1),null==d&&(d=""),e={address:a,key:d,sensor:c},f=b.defer(),null!=k[a]?f.resolve(k[a]):(l.push({config:e,d:f}),1===l.length&&j()),f.promise},reverseGeocode:function(a,c,d){var e,f,g;return null==d&&(d=""),g=""+a+","+c,e={latlng:g,key:d},f=b.defer(),null!=k[g]?f.resolve(k[g]):(l.push({config:e,d:f}),1===l.length&&j()),f.promise}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("MapCategories",function(){var a,b;return a=["Art & Architecure","Educational","Entertainment","Food & Drink","Historical","Hidden Gems","For Kids","Nature","Just for Fun"],b={_categories:[],_categoriesWithSize:{},_categoriesWithMapIds:{},_mapIds:{},addCategory:function(a,b){var c,d;return null==b&&(b=null),null==(c=this._categoriesWithSize)[a]&&(c[a]=0),null!=b&&(this._mapIds[b]||(this._mapIds[b]=!0,this._categoriesWithSize[a]++,(d=this._categoriesWithMapIds)[a]||(d[a]=[]),this._categoriesWithMapIds[a].push(b))),-1===this._categories.indexOf(a)?(this._categories.push(a),this._categories.sort()):void 0},getCategories:function(){return this._categories},getCategoriesWithSize:function(){return this._categoriesWithSize},getCategoriesWithMapIds:function(){return this._categoriesWithMapIds},reset:function(){return this._categories.length=0,angular.copy({},this._categoriesWithSize),angular.copy({},this._categoriesWithMapIds),angular.copy({},this._mapIds)},addDefaultCategories:function(){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addCategory(b));return e}}})}.call(this),function(){angular.module("StrollopiaJS.Utils.Map").factory("MapImage",function(){var a;return a={colorList:["red","green","blue","orange","purple","yellow"],colorIndex:0,maxMarkers:20,getNextColor:function(a){return null!=a?a:this.colorList[this.colorIndex++%this.colorList.length]},getImageUrl:function(a,b,c,d,e,f,g){var h,i,j,k,l,m,n;for(null==b&&(b=256),null==c&&(c=256),null==d&&(d=null),null==e&&(e=null),null==f&&(f="roadmap"),null==g&&(g=null),l=null!=d?"&zoom="+d:"",h="",null!=e&&(h=null!=e.latitude&&null!=e.longitude?"¢er="+e.latitude+","+e.longitude:"¢er="+encodeURIComponent(e)),k="",j=0,m=0,n=a.length;n>m&&(i=a[m],null!=i.latitude&&null!=i.longitude&&(k+="&markers=color:"+this.getNextColor(g)+"|"+i.latitude+","+i.longitude),!(++j>=this.maxMarkers));m++);return"http://maps.googleapis.com/maps/api/staticmap?size="+b+"x"+c+"&sensor=false"+l+h+k},resetColor:function(){var a;return a=0},getMarkerIconUrl:function(a){var b;return null==a&&(a=null),null==a&&(a=this.getNextColor()),b={},"#"===a[0]?(a=a.slice(1,+a.length+1||9e9),"http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|"+a):"http://maps.google.com/intl/en_us/mapfiles/ms/micons/"+a+"-dot.png"},getMarkerShadowUrl:function(){return"http://chart.apis.google.com/chart?chst=d_map_pin_shadow"}}})}.call(this),function(){angular.module("StrollopiaJS.Utils.MethodCallbacks").factory("MethodCallbacks",function(){var a;return a=function(a,b,c){var d;if(d=a[b],null==d)throw new Error('No such method: "'+b+'"');if(!angular.isFunction(d))throw new Error('Attribute "'+b+'" is not a method');return c(d)},{after:function(b,c,d,e){return void 0===e&&(e=d,d=!1),b[c]=a(b,c,function(a){return function(){var b,c;return c=a.apply(this,arguments),b=e.call(this,c),d?b:c}})},before:function(b,c,d,e){return void 0===e&&(e=d,d=!1),b[c]=a(b,c,function(a){return function(){var b,c;return c=e.apply(this,arguments),b=d?c:arguments,a.apply(this,b)}})}}})}.call(this),function(){angular.module("StrollopiaJS.Utils.Report").factory("GetReports",["API","$http",function(a,b){return{getMapReport:function(c,d,e,f,g,h,i){return b.get(a.url("/maps/"+c+"/report_for_date_range"),{params:{from_year:d,from_month:e,from_day:f,to_year:g,to_month:h,to_day:i}})},getCheckpointReport:function(c,d,e,f,g,h,i,j){return b.get(a.url("/maps/"+c+"/checkpoints/"+d+"/report_for_date_range"),{params:{from_year:e,from_month:f,from_day:g,to_year:h,to_month:i,to_day:j}})},getFeedbackReport:function(c,d,e,f,g,h,i){return b.get(a.url("/maps/"+c+"/feedback_for_date_range"),{params:{from_year:d,from_month:e,from_day:f,to_year:g,to_month:h,to_day:i}})}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Report").factory("SendCheckin",["API","$http",function(a,b){return{sendCheckin:function(c){return b.post(a.url("/checkins"),{checkin:c})},sendCheckins:function(c){return b.post(a.url("/checkins/create_many"),{checkins:c})}}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Routes").factory("escapeRegExp",function(){return function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}})}.call(this),function(){angular.module("StrollopiaJS.Utils.Routes").factory("Routes",["$route","escapeRegExp",function(a,b){var c,d,e,f,g,h,i;c={},d={},e=function(a,c,d){return function(e){var f,g,h,i,j,k,l,m;for(e||(e={}),i=a,m=c.keys,k=0,l=m.length;l>k;k++){if(g=m[k],f=g.name,!e[f]&&!g.optional)throw"Required parameter :"+f+" missing";j=e[f]||"",h=new RegExp(":"+b(f)+"\\??","g"),i=i.replace(h,j)}return d&&(i="/#"+i),i}},i=a.routes;for(g in i)h=i[g],f=h.helperName,f&&(c[""+f+"_path"]=e(g,h,!0),d[""+f+"_path"]=e(g,h,!1));return c.nohash=d,c}])}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};angular.module("StrollopiaJS.Utils.Storage").service("SmartCache",["$localStorage","$interval",function(b,c){var d,e;return d=3e4,e=function(){function e(e,f,g){var h,i,j,k,l=this;this.storageKey=e,this.objectToCache=f,this.saveIntervalMs=null!=g?g:d,this.cache=a(this.cache,this),h=angular.copy(this.objectToCache),i={},i[this.storageKey]=h,this.cachedData=b.$default(i)[this.storageKey];for(j in h)k=h[j],null==this.cachedData[j]&&(this.cachedData[j]=angular.copy(h[j]));angular.copy(this.cachedData,this.objectToCache),this.saveIntervalMs>0&&c(this.cache,this.saveIntervalMs),document.addEventListener("pause",function(){return l.cache(!0)},!1),window.addEventListener("beforeunload",function(){return l.cache(!0)},!1)}return e.prototype.cachedData={},e.prototype.cache=function(a){return null==a&&(a=!1),angular.copy(this.objectToCache,this.cachedData),a?b.$force(this.storageKey):void 0},e}(),function(a,b,c){return new e(a,b,c)}}])}.call(this),function(){angular.module("StrollopiaJS.Utils.Templates").factory("TemplateLoader",["$http","$templateCache","$q","$compile",function(a,b,c,d){var e;return e={fetchTemplate:function(d){var e;return e=null,""===b.get(d)&&(e=c.when("")),c.when(e||b.get(d)||a.get(d)).then(function(a){var c;return angular.isObject(a)?(c=a.data,b.put(d,c),c):a})},bindTemplateToElement:function(a,b,c){return null==c&&(c=null),a.attr("sjs-template",b),this.fetchTemplate(b).then(function(e){return a.attr("sjs-template")===b?(a.html(e),d(a.contents())(c)):void 0})}}}])}.call(this);