Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-m

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-m - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

4

angular-m.min.js
/**
* Angular-based model library for use in MVC framework design
* @version v1.1.6
* @version v1.1.7
* @link https://github.com/dlhdesign/angular-m
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="angular-m"),function(a,b,c){"use strict";function d(a){return y(arguments,function(b){b!==a&&y(b,function(b,c){a[c]=b})}),a}function e(a){var b=[];return r(a)===!1?b:Object.keys?Object.keys(a):(y(a,function(a,c){b.push(c)}),b)}function f(a,b){var c=a.length>>>0,d=Number(arguments[2])||0;if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function g(a,b,c){var d={};return p(b)&&(b=b.split(",")),(o(b)||s(b)&&b.length>0)&&y(a,function(e,f){var g=!1;o(b)?g=b.call(c||a,f,e):b.indexOf(f)>-1&&(g=!0),g===!0?d[f]=a[f]:g!==!1&&(d[f]=g)}),d}function h(a,b){var c=s(a),d=c?[]:{};return y(a,function(a,e){b(a,e)&&(d[c?d.length:e]=a)}),d}function i(a,b){var c=s(a)?[]:{};return y(a,function(a,d){c[d]=b.call(this,a,d)}),c}function j(a,b,c){function d(a,d,e){var f=c.defer(),g=v(navigator.onLine)?navigator.onLine:!0;return a=a||{},a.method=a.method||j.read,g===!1?(e(k),f.reject(k)):b(a).success(function(a){o(d)&&d(a),f.resolve(a)}).error(function(a){o(e)&&e(a),f.reject(a)}),f}function e(a,b,c){return a=a||{},a.method=j.read,this.call(a,b,c)}function f(a,b,c){return a=a||{},a.method=j.update,this.call(a,b,c)}function g(a,b,c){return a=a||{},a.method=j.change,this.call(a,b,c)}function h(a,b,c){return a=a||{},a.method=j.create,this.call(a,b,c)}function i(a,b,c){return a=a||{},a.method=j["delete"],this.call(a,b,c)}var j={read:"GET",update:"PUT",change:"PATCH",create:"POST","delete":"DELETE"},k={online:!1};return{METHODS:j,call:d,read:e,update:f,change:g,create:h,"delete":i,readList:e,updateList:f,changeList:g,createList:h,deleteList:i}}function k(){function a(a,b){for(var c=this,d=0;d<c.$$cbQueue.length;d++)c.$$cbQueue[d].idx<=a&&((c.$$cbQueue[d].type<3&&c.$$finals[a]&&c.$$finals[a].resolved===!0||c.$$cbQueue[d].type>1&&c.$$cbQueue[d].type<4&&c.$$finals[a]&&c.$$finals[a].rejected===!0||4===c.$$cbQueue[d].type&&(!c.$$finals[a]||!c.$$finals[a].resolved&&!c.$$finals[a].rejected))&&c.$$cbQueue[d].cb.call(c,b),(c.$$finals[a].resolved||c.$$finals[a].rejected)&&(c.$$cbQueue.splice(d,1),d--))}function b(){}var c=!1,d=/xy/.test(function(){return"xy"})?/\b_super\b/:/.*/;return b.prototype={$type:"Base",init:function(a,b){var c=this;return c.$$arguments=z(arguments),c.$$cbQueue=[],c.$$cbQueueIdx=1,c.$$finals=[],c.$$listeners={},c.$errors={},c},clone:function(){var a=this,b=new a.constructor(null,!0);return b.$$arguments=z(a.$$arguments),a.trigger("cloned",b),b},isFinal:function(a){var b=this;return a=a||b.$$cbQueueIdx,b.$$finals[a]?!(!b.$$finals[a].resolved&&!b.$$finals[a].rejected):!1},resolve:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.$loaded=!0,d.$success=!0,d.$failed=!1,delete d.$busy,d.isFinal(b)||(d.$$finals[b]={resolved:!0,data:c},a.call(d,b,c),d.trigger("resolved",c)),d},reject:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.$loaded=!0,d.$success=!1,d.$failed=!0,delete d.$busy,d.isFinal(b)||(d.$$finals[b]={rejected:!0,data:c},a.call(d,b,c),d.trigger("rejected",c)),d},notify:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.isFinal(b)||(a.call(d,b,c),d.trigger("notified",c)),d},unfinalize:function(){var a=this;return a.$loaded=!1,delete a.$success,delete a.$failed,a.trigger("unfinalized"),++a.$$cbQueueIdx},then:function(b,c,d){var e=this;return o(b)&&e.$$cbQueue.push({type:1,cb:b,idx:e.$$cbQueueIdx}),o(c)&&e.$$cbQueue.push({type:3,cb:c,idx:e.$$cbQueueIdx}),o(d)&&e.$$cbQueue.push({type:4,cb:d,idx:e.$$cbQueueIdx}),e.$$finals[e.$$cbQueueIdx]&&a.call(e,e.$$cbQueueIdx,e.$$finals[e.$$cbQueueIdx].data),e},always:function(b){var c=this;return o(b)&&c.$$cbQueue.push({type:2,cb:b,idx:c.$$cbQueueIdx}),c.$$finals[c.$$cbQueueIdx]&&a.call(c,c.$$cbQueueIdx,c.$$finals[c.$$cbQueueIdx].data),c},success:function(a){return this.then(a)},fail:function(a){return this.then(null,a)},progress:function(a){return this.then(null,null,a)},bind:function(a,b){var c=this;return p(a)&&o(b)&&(c.$$listeners[a]=c.$$listeners[a]||[],c.$$listeners[a].push(b)),c},unbind:function(a,b){var c=this;return p(a)&&s(c.$$listeners[a])&&c.$$listeners[a].length>0&&(o(b)?c.$$listeners[a]=h(c.$$listeners[a],function(a){return a!==b}):delete c.$$listeners[a]),c},one:function(a,b){var c,d=this;return p(a)&&o(b)&&(c=function(){b.call(this,arguments),d.unbind(a,c)},d.bind(a,c)),d},trigger:function(a,b){var c=this,d=!0;return p(a)&&s(c.$$listeners[a])&&c.$$listeners[a].length>0&&y(c.$$listeners[a],function(e){d=e.call(c,b,a)&&d}),d}},b.extend=function e(a){function b(a,b){function c(){return a.apply(this,b)}return c.prototype=a.prototype,new c}function f(a,b,c){return function(){var d,e=this._super;return this._super=c[a],d=b.apply(this,arguments),o(e)?this._super=e:delete this._super,d}}function g(){return this.constructor!==g?b(g,arguments):!c&&o(this.init)?this.init.apply(this,arguments):void 0}var h,i,j=this.prototype;c=!0,h=new this,c=!1,a.$type||(a.$type="Class"),o(h.$preExtend)&&(a=h.$preExtend(a));for(i in a)a.hasOwnProperty(i)&&(o(a[i])&&o(j[i])&&d.test(a[i])?h[i]=f(i,a[i],j):h[i]=a[i]);return g.prototype=h,Object.defineProperty?Object.defineProperty(g.prototype,"constructor",{enumerable:!1,value:g}):g.prototype.constructor=g,g.extend=e,g},b}function l(a,b){function h(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/_([a-z])/g,function(a,b){return b.toUpperCase()})}function i(a){return a.charAt(0).toUpperCase()+a.slice(1).replace(/[a-z]([A-Z])/g,function(b,c,d){return a.charAt(d+1)+" "+c.toUpperCase()}).replace(/_([a-z])/g,function(a,b){return" "+b.toUpperCase()})}function j(a,b,c){var d=this;d.$errors[a]=d.$errors[a]||{},d.$errors[a][b]=c,d[a].$errors[b]=c}function k(a,b){var c,d,e,g=this,h=!0;return(b.required===!0||o(b.required)===!0&&b.required.call(g,a)===!0)&&(u(a)||x(a)||0===a.length?(j.call(g,b.methodName,"required",!0),h=!1):j.call(g,b.methodName,"required",!1)),y(b.equalsTargets,function(b){var c;o(g[b])&&A(g[b](),a)?(j.call(g,b,"equals",!1),y(g[b].$errors,function(a){c=a&&c}),g[b].$valid=!c,g[b].$invalid=c,g.trigger("validated."+b,!1)):(j.call(g,b,"equals",!0),g[b].$valid=!1,g[b].$invalid=!0,g.trigger("validated."+b,!0))}),u(a)===!1&&x(a)===!1&&(f(["st","nu","ob","ar","bo","dt"],b.type)>-1&&(j.call(g,b.methodName,"type",!1),("st"===b.type&&!p(a)||"nu"===b.type&&!q(a)||"ob"===b.type&&!r(a)||"ar"===b.type&&!s(a)||"bo"===b.type&&!v(a)||"dt"===b.type&&!t(new Date(a)))&&(j.call(g,b.methodName,"type",!0),h=!1)),(q(b.min)||"dt"===b.type&&t(b.min))&&(("st"===b.type||"ar"===b.type)&&a.length>=b.min?j.call(g,b.methodName,"min",!1):(!b.type||"nu"===b.type)&&parseFloat(a)>=b.min?j.call(g,b.methodName,"min",!1):"dt"===b.type&&new Date(a)>=new Date(b.min)?j.call(g,b.methodName,"min",!1):(j.call(g,b.methodName,"min",!0),h=!1)),(q(b.max)||"dt"===b.type&&t(b.max))&&(("st"===b.type||"ar"===b.type)&&a.length<=b.max?j.call(g,b.methodName,"max",!1):(!b.type||"nu"===b.type)&&parseFloat(a)<=b.max?j.call(g,b.methodName,"max",!1):"dt"===b.type&&new Date(a)<=new Date(b.max)?j.call(g,b.methodName,"max",!1):(j.call(g,b.methodName,"max",!0),h=!1)),p(b.equals)?o(g[b.equals])&&A(g[b.equals](),a)?(j.call(g,b.methodName,"equals",!1),j.call(g,b.equals,"equals",!1),g.trigger("validated."+b.equals,!1)):(j.call(g,b.methodName,"equals",!0),j.call(g,b.equals,"equals",!0),g.trigger("validated."+b.equals,!0),h=!1):s(b.equals)&&(e=!1,y(b.equals,function(b){o(g[b])&&(A(g[b](),a)?(e=!0,j.call(g,b,"equals",!1),g.trigger("validated."+b,!1)):(j.call(g,b,"equals",!0),g.trigger("validated."+b,!0)))}),j.call(g,b.methodName,"equals",!e),h=h&&e),p(b.notEquals)?o(g[b.notEquals])&&!A(g[b.notEquals](),a)?(j.call(g,b.methodName,"notEquals",!1),j.call(g,b.notEquals,"notEquals",!1),g.trigger("validated."+b.notEquals,!1)):(j.call(g,b.methodName,"notEquals",!0),j.call(g,b.notEquals,"notEquals",!0),g.trigger("validated."+b.notEquals,!0),h=!1):s(b.notEquals)&&(notEquals=!1,y(b.notEquals,function(b){o(g[b])&&(A(g[b](),a)?(notEquals=!0,j.call(g,b,"notEquals",!0),g.trigger("validated."+b,!0)):(j.call(g,b,"notEquals",!1),g.trigger("validated."+b,!1)))}),j.call(g,b.methodName,"notEquals",!notEquals),h=h&&notEquals)),w(b.matches)&&(c=b.matches.test(a)||u(a)||x(a)||0===a.length,j.call(g,b.methodName,"matches",!c),h=c&&h),u(b.limit)===!1&&x(b.limit)===!1&&(u(a)||x(a)||0===a.length?j.call(g,b.methodName,"limit",!1):s(b.limit)||r(b.limit)?(d=!1,y(b.limit,function(b){d=r(b)!==!0||x(b.value)||u(b.value)?d||A(b,a):d||A(b.value,a)}),j.call(g,b.methodName,"limit",!d),h=d&&h):(p(b.limit)||q(b.limit)||v(b.limit))&&(d=A(b.limit,a),j.call(g,b.methodName,"limit",!d),h=d&&h)),h}var l=function(){},m=function(){};return l=a.extend({$type:"Singleton",$preExtend:function(a){return r(this.fields)&&(a.fields=d({},this.fields,a.fields),y(a.fields,function(b,c){b===!1&&delete a.fields[c]})),a},init:function(a,b){var d=this._super.apply(this,arguments),e={};return d.$$merged=d.$$data=a||!1,d.$$setData={},d.$$defaults={},d.$loaded=a?!0:!1,d.$dirty=!1,d.$pristine=!0,d.$busy=!1,d.$valid=!0,d.$invalid=!1,d.$$fieldConfig=!1,d.each(function(a){function b(){var b,e=a.key;if(a.$$getterCacheSet===!0)return a.$$getterCache;if(a.getter){if(b=a.getter.call(d,a),b===c)return b}else{for(e=e.split("."),b=d.get()[e.shift()];e.length>0;){if(r(b)===!1)return null;b=b[e.shift()]}null!==b&&b!==c||a["default"]===c||(b=a["default"]),o(a.mutateGet)===!0&&(b=a.mutateGet.call(d,b,a))}return a.$$getterCacheSet=!0,a.$$getterCache=b,b}function f(b){var c,e,f=a.key;if(a.readonly===!0)throw new Error(a.methodName+" is read-only.");if(d.$$merged=!1,d.$loaded=!0,d.$dirty=!0,d.$pristine=!1,this.$dirty=!0,this.$pristine=!1,a.$$getterCacheSet=!1,delete a.$$getterCache,a.setter)return a.setter.call(d,b,a),d;for(f=f.split("."),e=d.$$setData;f.length>1;)c=f.shift(),e=e[c]=r(e[c])===!0?e[c]:{};return o(a.mutateSet)===!0&&(b=a.mutateSet.call(d,b,a)),e[f[0]]=b,d}var g,h,l;if(a.getter!==c&&!o(a.getter))throw new Error('Singleton Init Error: "getter" must be undefined/null or a function');if(a.setter!==c&&!o(a.setter))throw new Error('Singleton Init Error: "setter" must be undefined/null or a function');if(d[a.methodName]=function(c){return arguments.length?f.call(d[a.methodName],c):b.call(d[a.methodName])},d[a.methodName].$label=a.label||i(a.configKey),a.label=d[a.methodName].$label,d[a.methodName].$errors={},d[a.methodName].$parent=d,d[a.methodName].$config=a,d[a.methodName].valid=function(b,c){var f=!0,g=0;if((b===m||0===arguments.length)&&(b=d[a.methodName]()),o(a.validator)&&(f=a.validator.call(d,b,a),j.call(d,a.methodName,"validator",!f)),!a.equalsTargets&&e[a.methodName]&&(a.equalsTargets=e[a.methodName]),f=k.call(d,b,a)&&f,this.$valid!==f&&f===!0&&!c)for(;g<d.$$fieldConfig.length&&(d.$$fieldConfig[g].methodName===a.methodName||(d.$valid=d[d.$$fieldConfig[g].methodName].valid(m,!0),d.$invalid=!d.$valid,d.$valid!==!1));g++);return this.$valid=f,this.$invalid=!f,d.trigger("validated."+a.methodName,f),f},s(a.equals)?y(a.equals,function(b){e[b]=e[b]||[],e[b].push(a.methodName)}):p(a.equals)&&(e[a.equals]=e[a.equals]||[],e[a.equals].push(a.methodName)),a["default"]!==c){for(g=a.key.split("."),l=d.$$defaults;g.length>1;)h=g.shift(),l=l[h]=r(l[h])===!0?l[h]:{};l[g[0]]=a["default"]}})},get:function(){var a=this;return a.$$merged!==!1?a.$$merged:(a.$$merged=d({},a.$$defaults,a.$$data,a.$$setData),a.$$merged)},set:function(a){var b=this;return b.$$merged=!1,b.$dirty=!0,b.$pristine=!1,b.$$setData=z(a),b.$loaded=b.$loaded||e(a).length>0,b.clearCache(),b},clearCache:function(){var a=this;return a.$$merged!==!1&&(a.$$merged=!1,a.each(function(a){a.$$getterCacheSet=!1,delete a.$$getterCache})),a},each:function(a){var b=this;return r(b.fields)&&b.$$fieldConfig===!1&&(b.$$fieldConfig=[],y(b.fields,function(a,c){var d=o(a)?a.apply(b,arguments):r(a)?z(a):{};d.key=d.key||c,d.configKey=c,d.methodName=d.methodName||h(c),b.$$fieldConfig.push(d)})),s(b.$$fieldConfig)===!0&&b.$$fieldConfig.length>0&&y(b.$$fieldConfig,function(c){a.call(b,c)}),b},pick:function(a){var b=this,c={},d=[];return s(b.$$fieldConfig)===!0&&b.$$fieldConfig.length>0&&(o(a)?y(b.$$fieldConfig,function(c){a.call(b,c)===!0&&d.push(c.key)}):d=a,c=g(b.get(),d)),c},validate:function(){var a=this;return a.$valid=!0,a.each(function(b){a.$valid=a[b.methodName].valid(m,!0)&&a.$valid}),a.$invalid=!a.$valid,a.trigger("validated",a.$valid),a.$valid},cancel:function(){var a=this;return a.$dirty&&(a.$dirty=!1,a.$pristine=!0,a.clearCache(),a.$$setData={}),a},finalize:function(a){var b=this;return(a||b.$dirty)&&(b.$dirty=!1,b.$pristine=!0,b.$$data=a||b.get(),b.$$setData={},b.trigger("finalized",a)),b},clone:function(){var a=this,b=a._super.apply(a,arguments);return b.$$data=z(a.$$data),e(a.$$setData).length>0&&b.set(a.$$setData),b.$loaded=a.$loaded,b.$parent=a.$parent,b},resolve:function(){var a=this;return a.clearCache(),a._super.apply(a,arguments)},reject:function(){var a=this;return a.clearCache(),a._super.apply(a,arguments)},refresh:function(){var a=this;return a.$$lastReadData?a.read(a.$$lastReadData):a.read()},readService:!1,read:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.read(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.readService)?(d.$busy=!0,d.$$lastReadData=a||{},c=d.readService(a,function(a){delete d.$errors.read,d.finalize(a),d.resolve(b),d.trigger("read",a)},function(a){d.$errors.read=a,d.reject(b)}),c===!1&&(d.$errors.read=!0,d.reject(b))):(d.$errors.read=!0,d.reject(b)),d)},updateService:!1,update:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.update(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.updateService)){if(d.$busy=!0,0===arguments.length&&d.$dirty===!0&&(a=d.pick(function(a){return a.updateable!==!1})),0===e(a).length)return delete d.$errors.update,d.resolve(b);c=d.updateService(a,function(a){delete d.$errors.update,d.finalize(a),d.resolve(b),d.trigger("updated",a)},function(a){d.$errors.update=a,d.reject(b)}),c===!1&&(d.$errors.update=!0,d.reject(b))}else d.$errors.update=!0,d.reject(b);return d},changeService:!1,change:function(a,b){var c,d,f=this;if(f.$busy===!0)return f.always(function(){f.change(a,b)}),b=f.unfinalize(),f;if(b=b||f.unfinalize(),o(f.changeService)){if(f.$busy=!0,0===arguments.length&&f.$dirty===!0&&s(f.$$fieldConfig)===!0&&f.$$fieldConfig.length>0&&(c=g(f.$$fieldConfig,function(a){return a.updateable!==!1},f),a=g(f.$$setData,c)),0===e(a).length)return delete f.$errors.change,f.resolve(b);d=f.changeService(a,function(a){delete f.$errors.change,f.finalize(a),f.resolve(b),f.trigger("changed",a)},function(a){f.$errors.change=a,f.reject(b)}),d===!1&&(f.$errors.change=!0,f.reject(b))}else f.$errors.change=!0,f.reject(b);return f},uploadService:!1,upload:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.upload(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.uploadService)?(d.$busy=!0,c=d.uploadService(a,function(a){delete d.$errors.upload,d.finalize(a),d.resolve(b),d.trigger("uploaded",a)},function(a){d.$errors.upload=a,d.reject(b)}),c===!1&&(d.$errors.upload=!0,d.reject(b))):(d.$errors.upload=!0,d.reject(b)),d)},createService:!1,create:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.create(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.createService)){if(d.$busy=!0,0===arguments.length&&d.$dirty===!0&&(a=d.pick(function(a){return a.createable!==!1})),0===e(a).length)return delete d.$errors.create,d.resolve(b);c=d.createService(a,function(a){delete d.$errors.create,d.finalize(a),d.resolve(b),d.trigger("created",a)},function(a){d.$errors.create=a,d.reject(b)}),c===!1&&(d.$errors.create=!0,d.reject(b))}else d.$errors.create=!0,d.reject(b);return d},deleteService:!1,"delete":function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d["delete"](a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.deleteService)?(d.$busy=!0,c=d.deleteService(a,function(a){delete d.$errors["delete"],d.finalize(a||{}),d.resolve(b),d.trigger("deleted",a)},function(a){d.$errors["delete"]=a,d.reject(b)}),c===!1&&(d.$errors["delete"]=!0,d.reject(b))):(d.$errors["delete"]=!0,d.reject(b)),d)}})}function m(a,b){function d(){var a=this;a.$allSelected=!1,a.$noneSelected=!0,a.$selectedCount===a.length&&a.length>0&&(a.$allSelected=!0),a.$selectedCount>0&&(a.$noneSelected=!1)}function e(a,b){var d,e;if(p(a)&&a.length>0){for(a=a.split(".");a.length>0;)if(e=a.shift(),o(b[e])===!0)d=b[e]();else{if(r(d)===!1)return c;d=b[e]}return d}return c}var f=function(){},j=/^\s+([+-]?)(.*)\s+$/;return f=a.extend({$type:"Collection",childModel:b,init:function(a,b){var c=this._super.apply(this,arguments);c.$$data=a||[],c.$$addData=[],c.length=c.$$data.length,c.$loaded=c.length>0,c.$$origData=null,c.$selected=[],c.$selectedCount=0,c.$allSelected=!1,c.$noneSelected=!0,c.$busy=!1},each:function(a){var b=this;return o(a)===!0&&y(b.get(),a),b},map:function(a){return o(a)===!0?i(this.get(),a):[]},get:function(){var a=this;return a.$$modeled?a.$$modeled:(a.$$modeled=new Array(a.length),y(a.$$data,function(b,c){var e=new a.childModel(b);e.$parent=a,e.select=function(b,e){return this.$selected=b,a.$selected[c]=b,b?a.$selectedCount++:a.$selectedCount--,e!==!0&&d.call(a),this},a.$$modeled[c]=e}),a.$$modeled)},pluck:function(a){var b=this,c=new Array(b.length);return s(a)===!1&&(a=[a]),b.each(function(b,d){y(a,function(a){o(b[a])&&(c[d]=c[d]||{},c[d][a]=b[a]())})}),c},set:function(a){var b=this.end(!0);return b.$$data=a,b.length=b.$$data.length,b.$loaded=b.$loaded||b.length>0,b.$$modeled=null,b.$$filter&&b.filter(b.$$filter),b.$$sort&&b.sort(b.$$sort),b},add:function(a){var c=this,e=[];if(u(a)||null===a)e.push({});else if(a instanceof c.childModel)e.push(a);else if(a instanceof b)e.push(a.get());else if(a instanceof f)e=e.concat(a.get());else if(s(a)===!0)y(a,function(a,b){e.push(b)});else{if(r(a)!==!0)throw new Error("Invalid object added to Collection: "+a);e.push(a)}return y(e,function(a,f){a instanceof c.childModel==!1&&(a instanceof b&&(a=a.get()),a=new c.childModel(a),a.$parent=c,a.select=function(a,b){this.$selected=a,c.$selected[f]=a,a?c.$selectedCount++:c.$selectedCount--,b!==!0&&d.call(c)},e[f]=a)}),c.$$addData=e,a instanceof f||s(a)===!0?e:e[0]},filter:function(a){var b=this,c=[];if(b.$$data.length>0)if(o(a)===!0)b.$$filter=a,b.$$origData=b.$$origData||z(b.$$data),b.$$data=h(b.get(),a),b.length=b.$$data.length,b.$$modeled=null;else{if(r(a)!==!0)throw new Error("Invalid filter value provided: "+h);keys(a).length>0&&(b.$$filter=a,b.$$origData=b.$$origData||z(b.$$data),h(b.get(),function(b){var d=!0;g(a,function(a,c){var e;return e=o(b[c])===!0?b[c]():b[c],d=s(e)===!0?d&&e.indexOf(a)>-1:d&&A(e,a),d===!1?(b.select(!1),d):void 0}),d===!0&&c.push(b.get())}),b.$$data=c,b.length=b.$$data.length,b.$$modeled=null,d.call(b))}else b.$$filter=a;return b},sort:function(a,b){function c(a,c){var d=a;return o(a)===!1&&(a=function(a,f){return a=e(d,a),f=e(d,f),r(a)&&(a=JSON.stringify(a)),r(f)&&(f=JSON.stringify(f)),b!==!0&&(a=(""+a).toLowerCase(),f=(""+f).toLowerCase()),c?a>f?-1:f>a?1:0:a>f?1:f>a?-1:0}),a}function d(a,b){return a=c(a,b),a.next=function(a,b){var e=this;return a=c(a,b),d(function(b,c){return e(b,c)||a(b,c)})},a}var f,g,h=this;if(h.length>0){if(p(a)===!0&&(a=a.split()),o(a)===!0)h.$$sort=a,h.$$origData=h.$$origData||z(h.$$data),h.$$modeled=h.get().sort(a);else{if(!(s(a)===!0&&a.length>0))throw new Error("Invalid sort value provided: "+a);for(h.$$origData=h.$$origData||z(h.$$data),f=a.reverse().length;--f;){if(a[f]=a[f].exec(j),3!==a[f].length)throw new Error("Invalid sort value provided: "+a[f]);g?g.next(a[f][2],"-"===a[f][1]?!0:!1):g=d(a[f][2],"-"===a[f][1]?!0:!1)}h.$$modeled=h.get().sort(g)}h.$$data=new Array(h.length),h.each(function(a,b){h.$$data[b]=a.get()})}else h.$$sort=a;return h},end:function(a){var b=this;return null!==b.$$origData&&(b.select(!1),b.$$data=z(b.$$origData),b.$$addData=[],b.$$modeled=null,b.length=b.$$data.length,b.$$origData=null,a!==!0&&(delete b.$$sort,delete b.$$filter)),b},unique:function(a){var b=this,d={},f=[];return p(a)&&a.length>0&&b.each(function(b){var g=e(a,b);s(g)===!0?y(g,function(a){r(a)===!0&&(a=JSON.stringify(a)),d[a.toString()]===c&&(d[a.toString()]=!0,f.push(a))}):(r(g)===!0&&(g=JSON.stringify(g)),null!==g&&g!==c&&d[g.toString()]===c&&(d[g.toString()]=!0,f.push(g)))}),f},select:function(a,b){var c=this;return a===!0?(c.$selected=new Array(c.length),c.$selectedCount=0,c.each(function(a){a.select(!0,!0)})):a===!1?(c.each(function(a){a.select(!1,!0)}),c.$selected=[],c.$selectedCount=0):q(a)===!0&&c.get()[a].select(b),d.call(c),c},clone:function(){var a=this,b=a._super.apply(a,arguments);return b.$$data=z(a.$$data),b.$$addData=z(a.$$addData),b.$$origData=z(a.$$origData),b.length=a.length,b.$loaded=b.$loaded,b.$selected=a.$selected,b.$selectedCount=a.$selectedCount,b.$allSelected=a.$allSelected,b.$noneSelected=a.$noneSelected,b},refresh:function(){var a=this;return a.$$lastReadData?a.read(a.$$lastReadData):a.read()},readService:!1,read:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.read(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.readService)&&(d.$busy=!0,d.$$lastReadData=a||{},c=d.readService(a,function(a){delete d.$errors.read,d.set(a),d.resolve(b)},function(a){d.$errors.read=a,d.reject(b)}),c===!1&&(d.$errors.read=!0,d.reject(b))),d)},updateService:!1,update:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.update(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.updateService)){if(d.$busy=!0,0===arguments.length)return delete d.$errors.update,d.resolve(b);c=d.updateService(a,function(a){delete d.$errors.update,d.resolve(b)},function(a){d.$errors.update=a,d.reject(b)}),c===!1&&(d.$errors.update=!0,d.reject(b))}else d.$errors.update=!0,d.reject(b);return d}})}function n(){return{restrict:"E",require:"?ngModel",link:function(a,b,c,d){function e(){y(g.$errors,function(a,b){d.$setValidity(b,!a)})}function f(a){return g.valid(a),a}var g=a.$eval(c.ngModel);o(g)&&r(g.$config)&&r(g.$parent)&&(g.$parent.bind("validated."+g.$config.methodName,e),d.$parsers.unshift(f),d.$formatters.unshift(f))}}}var o=b.isFunction,p=b.isString,q=b.isNumber,r=b.isObject,s=b.isArray,t=b.isDate,u=b.isUndefined,v=function(a){return a===!0||a===!1?!0:!1},w=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)?!0:!1},x=function(a){return null===a},y=b.forEach,z=(b.extend,b.copy),A=b.equals;b.module("angular-m",[]),b.module("angular-m.http",[]).service("$mhttp",["$rootScope","$http","$q",j]);var B={email:/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])+$/i,phone:/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/,latLong:/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,zip:/^\d{5}(?:[-\s]\d{4})?$/,timeZone:/^GMT\s[+-]\d{2}:\d{2}$/,timeStr:/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/};b.module("angular-m").constant("REGEX",B),b.module("angular-m").factory("Base",k),b.module("angular-m").factory("Singleton",["Base","REGEX",l]),b.module("angular-m").factory("Collection",["Base","Singleton",m]),b.module("angular-m.inputs",[]).directive("input",n).directive("select",n).directive("textarea",n)}(window,window.angular);
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="angular-m"),function(a,b,c){"use strict";function d(a){return y(arguments,function(b){b!==a&&y(b,function(b,c){a[c]=b})}),a}function e(a){var b=[];return r(a)===!1?b:Object.keys?Object.keys(a):(y(a,function(a,c){b.push(c)}),b)}function f(a,b){var c=a.length>>>0,d=Number(arguments[2])||0;if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function g(a,b,c){var d={};return p(b)&&(b=b.split(",")),(o(b)||s(b)&&b.length>0)&&y(a,function(e,f){var g=!1;o(b)?g=b.call(c||a,f,e):b.indexOf(f)>-1&&(g=!0),g===!0?d[f]=a[f]:g!==!1&&(d[f]=g)}),d}function h(a,b){var c=s(a),d=c?[]:{};return y(a,function(a,e){b(a,e)&&(d[c?d.length:e]=a)}),d}function i(a,b){var c=s(a)?[]:{};return y(a,function(a,d){c[d]=b.call(this,a,d)}),c}function j(a,b,c){function d(a,d,e){var f=c.defer(),g=v(navigator.onLine)?navigator.onLine:!0;return a=a||{},a.method=a.method||j.read,g===!1?(e(k),f.reject(k)):b(a).success(function(a){o(d)&&d(a),f.resolve(a)}).error(function(a){o(e)&&e(a),f.reject(a)}),f}function e(a,b,c){return a=a||{},a.method=j.read,this.call(a,b,c)}function f(a,b,c){return a=a||{},a.method=j.update,this.call(a,b,c)}function g(a,b,c){return a=a||{},a.method=j.change,this.call(a,b,c)}function h(a,b,c){return a=a||{},a.method=j.create,this.call(a,b,c)}function i(a,b,c){return a=a||{},a.method=j["delete"],this.call(a,b,c)}var j={read:"GET",update:"PUT",change:"PATCH",create:"POST","delete":"DELETE"},k={online:!1};return{METHODS:j,call:d,read:e,update:f,change:g,create:h,"delete":i,readList:e,updateList:f,changeList:g,createList:h,deleteList:i}}function k(){function a(a,b){for(var c=this,d=0;d<c.$$cbQueue.length;d++)c.$$cbQueue[d].idx<=a&&((c.$$cbQueue[d].type<3&&c.$$finals[a]&&c.$$finals[a].resolved===!0||c.$$cbQueue[d].type>1&&c.$$cbQueue[d].type<4&&c.$$finals[a]&&c.$$finals[a].rejected===!0||4===c.$$cbQueue[d].type&&(!c.$$finals[a]||!c.$$finals[a].resolved&&!c.$$finals[a].rejected))&&c.$$cbQueue[d].cb.call(c,b),(c.$$finals[a].resolved||c.$$finals[a].rejected)&&(c.$$cbQueue.splice(d,1),d--))}function b(){}var c=!1,d=/xy/.test(function(){return"xy"})?/\b_super\b/:/.*/;return b.prototype={$type:"Base",init:function(a,b){var c=this;return c.$$arguments=z(arguments),c.$$cbQueue=[],c.$$cbQueueIdx=1,c.$$finals=[],c.$$listeners={},c.$errors={},c},clone:function(){var a=this,b=new a.constructor(null,!0);return b.$$arguments=z(a.$$arguments),a.trigger("cloned",b),b},isFinal:function(a){var b=this;return a=a||b.$$cbQueueIdx,b.$$finals[a]?!(!b.$$finals[a].resolved&&!b.$$finals[a].rejected):!1},resolve:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.$loaded=!0,d.$success=!0,d.$failed=!1,delete d.$busy,d.isFinal(b)||(d.$$finals[b]={resolved:!0,data:c},a.call(d,b,c),d.trigger("resolved",c)),d},reject:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.$loaded=!0,d.$success=!1,d.$failed=!0,delete d.$busy,d.isFinal(b)||(d.$$finals[b]={rejected:!0,data:c},a.call(d,b,c),d.trigger("rejected",c)),d},notify:function(b,c){var d=this;return b=b||d.$$cbQueueIdx,d.isFinal(b)||(a.call(d,b,c),d.trigger("notified",c)),d},unfinalize:function(){var a=this;return a.$loaded=!1,delete a.$success,delete a.$failed,a.trigger("unfinalized"),++a.$$cbQueueIdx},then:function(b,c,d){var e=this;return o(b)&&e.$$cbQueue.push({type:1,cb:b,idx:e.$$cbQueueIdx}),o(c)&&e.$$cbQueue.push({type:3,cb:c,idx:e.$$cbQueueIdx}),o(d)&&e.$$cbQueue.push({type:4,cb:d,idx:e.$$cbQueueIdx}),e.$$finals[e.$$cbQueueIdx]&&a.call(e,e.$$cbQueueIdx,e.$$finals[e.$$cbQueueIdx].data),e},always:function(b){var c=this;return o(b)&&c.$$cbQueue.push({type:2,cb:b,idx:c.$$cbQueueIdx}),c.$$finals[c.$$cbQueueIdx]&&a.call(c,c.$$cbQueueIdx,c.$$finals[c.$$cbQueueIdx].data),c},success:function(a){return this.then(a)},fail:function(a){return this.then(null,a)},progress:function(a){return this.then(null,null,a)},bind:function(a,b){var c=this;return p(a)&&o(b)&&(c.$$listeners[a]=c.$$listeners[a]||[],c.$$listeners[a].push(b)),c},unbind:function(a,b){var c=this;return p(a)&&s(c.$$listeners[a])&&c.$$listeners[a].length>0&&(o(b)?c.$$listeners[a]=h(c.$$listeners[a],function(a){return a!==b}):delete c.$$listeners[a]),c},one:function(a,b){var c,d=this;return p(a)&&o(b)&&(c=function(){b.call(this,arguments),d.unbind(a,c)},d.bind(a,c)),d},trigger:function(a,b){var c=this,d=!0;return p(a)&&s(c.$$listeners[a])&&c.$$listeners[a].length>0&&y(c.$$listeners[a],function(e){d=e.call(c,b,a)&&d}),d}},b.extend=function e(a){function b(a,b){function c(){return a.apply(this,b)}return c.prototype=a.prototype,new c}function f(a,b,c){return function(){var d,e=this._super;return this._super=c[a],d=b.apply(this,arguments),o(e)?this._super=e:delete this._super,d}}function g(){return this.constructor!==g?b(g,arguments):!c&&o(this.init)?this.init.apply(this,arguments):void 0}var h,i,j=this.prototype;c=!0,h=new this,c=!1,a.$type||(a.$type="Class"),o(h.$preExtend)&&(a=h.$preExtend(a));for(i in a)a.hasOwnProperty(i)&&(o(a[i])&&o(j[i])&&d.test(a[i])?h[i]=f(i,a[i],j):h[i]=a[i]);return g.prototype=h,Object.defineProperty?Object.defineProperty(g.prototype,"constructor",{enumerable:!1,value:g}):g.prototype.constructor=g,g.extend=e,g},b}function l(a,b){function h(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/_([a-z])/g,function(a,b){return b.toUpperCase()})}function i(a){return a.charAt(0).toUpperCase()+a.slice(1).replace(/[a-z]([A-Z])/g,function(b,c,d){return a.charAt(d+1)+" "+c.toUpperCase()}).replace(/_([a-z])/g,function(a,b){return" "+b.toUpperCase()})}function j(a,b,c){var d=this;d.$errors[a]=d.$errors[a]||{},d.$errors[a][b]=c,d[a].$errors[b]=c}function k(a,b){var c,d,e,g=this,h=!0;return(b.required===!0||o(b.required)===!0&&b.required.call(g,a)===!0)&&(u(a)||x(a)||0===a.length?(j.call(g,b.methodName,"required",!0),h=!1):j.call(g,b.methodName,"required",!1)),y(b.equalsTargets,function(b){var c;o(g[b])&&A(g[b](),a)?(j.call(g,b,"equals",!1),y(g[b].$errors,function(a){c=a&&c}),g[b].$valid=!c,g[b].$invalid=c,g.trigger("validated."+b,!1)):(j.call(g,b,"equals",!0),g[b].$valid=!1,g[b].$invalid=!0,g.trigger("validated."+b,!0))}),u(a)===!1&&x(a)===!1&&(f(["st","nu","ob","ar","bo","dt"],b.type)>-1&&(j.call(g,b.methodName,"type",!1),("st"===b.type&&!p(a)||"nu"===b.type&&!q(a)||"ob"===b.type&&!r(a)||"ar"===b.type&&!s(a)||"bo"===b.type&&!v(a)||"dt"===b.type&&!t(new Date(a)))&&(j.call(g,b.methodName,"type",!0),h=!1)),(q(b.min)||"dt"===b.type&&t(b.min))&&(("st"===b.type||"ar"===b.type)&&a.length>=b.min?j.call(g,b.methodName,"min",!1):(!b.type||"nu"===b.type)&&parseFloat(a)>=b.min?j.call(g,b.methodName,"min",!1):"dt"===b.type&&new Date(a)>=new Date(b.min)?j.call(g,b.methodName,"min",!1):(j.call(g,b.methodName,"min",!0),h=!1)),(q(b.max)||"dt"===b.type&&t(b.max))&&(("st"===b.type||"ar"===b.type)&&a.length<=b.max?j.call(g,b.methodName,"max",!1):(!b.type||"nu"===b.type)&&parseFloat(a)<=b.max?j.call(g,b.methodName,"max",!1):"dt"===b.type&&new Date(a)<=new Date(b.max)?j.call(g,b.methodName,"max",!1):(j.call(g,b.methodName,"max",!0),h=!1)),p(b.equals)?o(g[b.equals])&&A(g[b.equals](),a)?(j.call(g,b.methodName,"equals",!1),j.call(g,b.equals,"equals",!1),g.trigger("validated."+b.equals,!1)):(j.call(g,b.methodName,"equals",!0),j.call(g,b.equals,"equals",!0),g.trigger("validated."+b.equals,!0),h=!1):s(b.equals)&&(e=!1,y(b.equals,function(b){o(g[b])&&(A(g[b](),a)?(e=!0,j.call(g,b,"equals",!1),g.trigger("validated."+b,!1)):(j.call(g,b,"equals",!0),g.trigger("validated."+b,!0)))}),j.call(g,b.methodName,"equals",!e),h=h&&e),p(b.notEquals)?o(g[b.notEquals])&&!A(g[b.notEquals](),a)?(j.call(g,b.methodName,"notEquals",!1),j.call(g,b.notEquals,"notEquals",!1),g.trigger("validated."+b.notEquals,!1)):(j.call(g,b.methodName,"notEquals",!0),j.call(g,b.notEquals,"notEquals",!0),g.trigger("validated."+b.notEquals,!0),h=!1):s(b.notEquals)&&(notEquals=!1,y(b.notEquals,function(b){o(g[b])&&(A(g[b](),a)?(notEquals=!0,j.call(g,b,"notEquals",!0),g.trigger("validated."+b,!0)):(j.call(g,b,"notEquals",!1),g.trigger("validated."+b,!1)))}),j.call(g,b.methodName,"notEquals",!notEquals),h=h&&notEquals)),w(b.matches)&&(c=b.matches.test(a)||u(a)||x(a)||0===a.length,j.call(g,b.methodName,"matches",!c),h=c&&h),u(b.limit)===!1&&x(b.limit)===!1&&(u(a)||x(a)||0===a.length?j.call(g,b.methodName,"limit",!1):s(b.limit)||r(b.limit)?(d=!1,y(b.limit,function(b){d=r(b)!==!0||x(b.value)||u(b.value)?d||A(b,a):d||A(b.value,a)}),j.call(g,b.methodName,"limit",!d),h=d&&h):(p(b.limit)||q(b.limit)||v(b.limit))&&(d=A(b.limit,a),j.call(g,b.methodName,"limit",!d),h=d&&h)),h}var l=function(){},m=function(){};return l=a.extend({$type:"Singleton",$preExtend:function(a){return r(this.fields)&&(a.fields=d({},this.fields,a.fields),y(a.fields,function(b,c){b===!1&&delete a.fields[c]})),a},init:function(a,b){var d=this._super.apply(this,arguments),e={};return d.$$merged=d.$$data=a||!1,d.$$setData={},d.$$defaults={},d.$loaded=a?!0:!1,d.$dirty=!1,d.$pristine=!0,d.$busy=!1,d.$valid=!0,d.$invalid=!1,d.$$fieldConfig=!1,d.each(function(a){function b(){var b,e=a.key;if(a.$$getterCacheSet===!0)return a.$$getterCache;if(a.getter){if(b=a.getter.call(d,a),b===c)return b}else{for(e=e.split("."),b=d.get()[e.shift()];e.length>0;){if(r(b)===!1)return null;b=b[e.shift()]}null!==b&&b!==c||a["default"]===c||(b=a["default"]),o(a.mutateGet)===!0&&(b=a.mutateGet.call(d,b,a))}return a.$$getterCacheSet=!0,a.$$getterCache=b,b}function f(b){var c,e,f=a.key;if(a.readonly===!0)throw new Error(a.methodName+" is read-only.");if(d.$$merged=!1,d.$loaded=!0,d.$dirty=!0,d.$pristine=!1,this.$dirty=!0,this.$pristine=!1,a.$$getterCacheSet=!1,delete a.$$getterCache,a.setter)return a.setter.call(d,b,a),d;for(f=f.split("."),e=d.$$setData;f.length>1;)c=f.shift(),e=e[c]=r(e[c])===!0?e[c]:{};return o(a.mutateSet)===!0&&(b=a.mutateSet.call(d,b,a)),e[f[0]]=b,d}var g,h,l;if(a.getter!==c&&!o(a.getter))throw new Error('Singleton Init Error: "getter" must be undefined/null or a function');if(a.setter!==c&&!o(a.setter))throw new Error('Singleton Init Error: "setter" must be undefined/null or a function');if(d[a.methodName]=function(c){return arguments.length?f.call(d[a.methodName],c):b.call(d[a.methodName])},d[a.methodName].$label=a.label||i(a.configKey),a.label=d[a.methodName].$label,d[a.methodName].$errors={},d[a.methodName].$parent=d,d[a.methodName].$config=a,d[a.methodName].valid=function(b,c){var f=!0,g=0;if((b===m||0===arguments.length)&&(b=d[a.methodName]()),o(a.validator)&&(f=a.validator.call(d,b,a),j.call(d,a.methodName,"validator",!f)),!a.equalsTargets&&e[a.methodName]&&(a.equalsTargets=e[a.methodName]),f=k.call(d,b,a)&&f,this.$valid!==f&&f===!0&&!c)for(;g<d.$$fieldConfig.length&&(d.$$fieldConfig[g].methodName===a.methodName||(d.$valid=d[d.$$fieldConfig[g].methodName].valid(m,!0),d.$invalid=!d.$valid,d.$valid!==!1));g++);return this.$valid=f,this.$invalid=!f,d.trigger("validated."+a.methodName,f),f},s(a.equals)?y(a.equals,function(b){e[b]=e[b]||[],e[b].push(a.methodName)}):p(a.equals)&&(e[a.equals]=e[a.equals]||[],e[a.equals].push(a.methodName)),a["default"]!==c){for(g=a.key.split("."),l=d.$$defaults;g.length>1;)h=g.shift(),l=l[h]=r(l[h])===!0?l[h]:{};l[g[0]]=a["default"]}})},get:function(){var a=this;return a.$$merged!==!1?a.$$merged:(a.$$merged=d({},a.$$defaults,a.$$data,a.$$setData),a.$$merged)},set:function(a){var b=this;return b.$$merged=!1,b.$dirty=!0,b.$pristine=!1,b.$$setData=z(a),b.$loaded=b.$loaded||e(a).length>0,b.clearCache(),b},clearCache:function(){var a=this;return a.$$merged!==!1&&(a.$$merged=!1,a.each(function(a){a.$$getterCacheSet=!1,delete a.$$getterCache})),a},each:function(a){var b=this;return r(b.fields)&&b.$$fieldConfig===!1&&(b.$$fieldConfig=[],y(b.fields,function(a,c){var d=o(a)?a.apply(b,arguments):r(a)?z(a):{};d.key=d.key||c,d.configKey=c,d.methodName=d.methodName||h(c),b.$$fieldConfig.push(d)})),s(b.$$fieldConfig)===!0&&b.$$fieldConfig.length>0&&y(b.$$fieldConfig,function(c){a.call(b,c)}),b},pick:function(a){var b=this,c={},d=[];return s(b.$$fieldConfig)===!0&&b.$$fieldConfig.length>0&&(o(a)?y(b.$$fieldConfig,function(c){a.call(b,c)===!0&&d.push(c.key)}):d=a,c=g(b.get(),d)),c},validate:function(){var a=this;return a.$valid=!0,a.each(function(b){a.$valid=a[b.methodName].valid(m,!0)&&a.$valid}),a.$invalid=!a.$valid,a.trigger("validated",a.$valid),a.$valid},cancel:function(){var a=this;return a.$dirty&&(a.$dirty=!1,a.$pristine=!0,a.clearCache(),a.$$setData={}),a},finalize:function(a){var b=this;return(a||b.$dirty)&&(b.$dirty=!1,b.$pristine=!0,b.$$data=a||b.get(),b.$$setData={},b.trigger("finalized",a)),b},clone:function(){var a=this,b=a._super.apply(a,arguments);return b.$$data=z(a.$$data),e(a.$$setData).length>0&&b.set(a.$$setData),b.$loaded=a.$loaded,b.$parent=a.$parent,b},resolve:function(){var a=this;return a.clearCache(),a._super.apply(a,arguments)},reject:function(){var a=this;return a.clearCache(),a._super.apply(a,arguments)},refresh:function(){var a=this;return a.$$lastReadData?a.read(a.$$lastReadData):a.read()},readService:!1,read:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.read(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.readService)?(d.$busy=!0,d.$$lastReadData=a||{},c=d.readService(a,function(a){delete d.$errors.read,d.finalize(a),d.resolve(b),d.trigger("read",a)},function(a){d.$errors.read=a,d.reject(b)}),c===!1&&(d.$errors.read=!0,d.reject(b))):(d.$errors.read=!0,d.reject(b)),d)},updateService:!1,update:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.update(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.updateService)){if(d.$busy=!0,0===arguments.length&&d.$dirty===!0&&(a=d.pick(function(a){return a.updateable!==!1})),0===e(a).length)return delete d.$errors.update,d.resolve(b);c=d.updateService(a,function(a){delete d.$errors.update,d.finalize(a),d.resolve(b),d.trigger("updated",a)},function(a){d.$errors.update=a,d.reject(b)}),c===!1&&(d.$errors.update=!0,d.reject(b))}else d.$errors.update=!0,d.reject(b);return d},changeService:!1,change:function(a,b){var c,d,f=this;if(f.$busy===!0)return f.always(function(){f.change(a,b)}),b=f.unfinalize(),f;if(b=b||f.unfinalize(),o(f.changeService)){if(f.$busy=!0,0===arguments.length&&f.$dirty===!0&&s(f.$$fieldConfig)===!0&&f.$$fieldConfig.length>0&&(c=g(f.$$fieldConfig,function(a){return a.updateable!==!1},f),a=g(f.$$setData,c)),0===e(a).length)return delete f.$errors.change,f.resolve(b);d=f.changeService(a,function(a){delete f.$errors.change,f.finalize(a),f.resolve(b),f.trigger("changed",a)},function(a){f.$errors.change=a,f.reject(b)}),d===!1&&(f.$errors.change=!0,f.reject(b))}else f.$errors.change=!0,f.reject(b);return f},uploadService:!1,upload:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.upload(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.uploadService)?(d.$busy=!0,c=d.uploadService(a,function(a){delete d.$errors.upload,d.finalize(a),d.resolve(b),d.trigger("uploaded",a)},function(a){d.$errors.upload=a,d.reject(b)}),c===!1&&(d.$errors.upload=!0,d.reject(b))):(d.$errors.upload=!0,d.reject(b)),d)},createService:!1,create:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.create(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.createService)){if(d.$busy=!0,0===arguments.length&&d.$dirty===!0&&(a=d.pick(function(a){return a.createable!==!1})),0===e(a).length)return delete d.$errors.create,d.resolve(b);c=d.createService(a,function(a){delete d.$errors.create,d.finalize(a),d.resolve(b),d.trigger("created",a)},function(a){d.$errors.create=a,d.reject(b)}),c===!1&&(d.$errors.create=!0,d.reject(b))}else d.$errors.create=!0,d.reject(b);return d},deleteService:!1,"delete":function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d["delete"](a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.deleteService)?(d.$busy=!0,c=d.deleteService(a,function(a){delete d.$errors["delete"],d.finalize(a||{}),d.resolve(b),d.trigger("deleted",a)},function(a){d.$errors["delete"]=a,d.reject(b)}),c===!1&&(d.$errors["delete"]=!0,d.reject(b))):(d.$errors["delete"]=!0,d.reject(b)),d)}})}function m(a,b){function d(){var a=this;a.$allSelected=!1,a.$noneSelected=!0,a.$selectedCount===a.length&&a.length>0&&(a.$allSelected=!0),a.$selectedCount>0&&(a.$noneSelected=!1)}function e(a,b){var d,e;if(p(a)&&a.length>0){for(a=a.split(".");a.length>0;)if(e=a.shift(),o(b[e])===!0)d=b[e]();else{if(r(d)===!1)return c;d=b[e]}return d}return c}var f=function(){},j=/^\s+([+-]?)(.*)\s+$/;return f=a.extend({$type:"Collection",childModel:b,init:function(a,b){var c=this._super.apply(this,arguments);c.$$data=a||[],c.$$addData=[],c.length=c.$$data.length,c.$loaded=c.length>0,c.$$origData=null,c.$selected=[],c.$selectedCount=0,c.$allSelected=!1,c.$noneSelected=!0,c.$busy=!1},each:function(a){var b=this;return o(a)===!0&&y(b.get(),a),b},map:function(a){return o(a)===!0?i(this.get(),a):[]},get:function(){var a=this;return a.$$modeled?a.$$modeled:(a.$$modeled=new Array(a.length),y(a.$$data,function(b,c){var e=new a.childModel(b);e.$parent=a,e.select=function(b,e){return this.$selected=b,a.$selected[c]=b,b?a.$selectedCount++:a.$selectedCount--,e!==!0&&d.call(a),this},a.$$modeled[c]=e}),a.$$modeled)},pluck:function(a){var b=this,c=new Array(b.length);return s(a)===!1&&(a=[a]),b.each(function(b,d){y(a,function(a){o(b[a])&&(c[d]=c[d]||{},c[d][a]=b[a]())})}),c},set:function(a){var b=this.end(!0);return b.$$data=a,b.length=b.$$data.length,b.$loaded=b.$loaded||b.length>0,b.$$modeled=null,b.$$filter&&b.filter(b.$$filter),b.$$sort&&b.sort(b.$$sort),b},add:function(a){var c=this,e=[];if(u(a)||null===a)e.push({});else if(a instanceof c.childModel)e.push(a);else if(a instanceof b)e.push(a.get());else if(a instanceof f)e=e.concat(a.get());else if(s(a)===!0)y(a,function(a,b){e.push(b)});else{if(r(a)!==!0)throw new Error("Invalid object added to Collection: "+a);e.push(a)}return y(e,function(a,f){a instanceof c.childModel==!1&&(a instanceof b&&(a=a.get()),a=new c.childModel(a),a.$parent=c,a.select=function(a,b){this.$selected=a,c.$selected[f]=a,a?c.$selectedCount++:c.$selectedCount--,b!==!0&&d.call(c)},e[f]=a)}),c.$$addData=e,a instanceof f||s(a)===!0?e:e[0]},finalize:function(a){var b=this;return b.$$addData.length>0&&(b.set(b.$$data.concat(b.$$addData)),b.$loaded=!1,b.trigger("finalized",a)),b},filter:function(a){var b=this,c=[];if(b.$$data.length>0)if(o(a)===!0)b.$$filter=a,b.$$origData=b.$$origData||z(b.$$data),b.$$data=h(b.get(),a),b.length=b.$$data.length,b.$$modeled=null;else{if(r(a)!==!0)throw new Error("Invalid filter value provided: "+h);keys(a).length>0&&(b.$$filter=a,b.$$origData=b.$$origData||z(b.$$data),h(b.get(),function(b){var d=!0;g(a,function(a,c){var e;return e=o(b[c])===!0?b[c]():b[c],d=s(e)===!0?d&&e.indexOf(a)>-1:d&&A(e,a),d===!1?(b.select(!1),d):void 0}),d===!0&&c.push(b.get())}),b.$$data=c,b.length=b.$$data.length,b.$$modeled=null,d.call(b))}else b.$$filter=a;return b},sort:function(a,b){function c(a,c){var d=a;return o(a)===!1&&(a=function(a,f){return a=e(d,a),f=e(d,f),r(a)&&(a=JSON.stringify(a)),r(f)&&(f=JSON.stringify(f)),b!==!0&&(a=(""+a).toLowerCase(),f=(""+f).toLowerCase()),c?a>f?-1:f>a?1:0:a>f?1:f>a?-1:0}),a}function d(a,b){return a=c(a,b),a.next=function(a,b){var e=this;return a=c(a,b),d(function(b,c){return e(b,c)||a(b,c)})},a}var f,g,h=this;if(h.length>0){if(p(a)===!0&&(a=a.split()),o(a)===!0)h.$$sort=a,h.$$origData=h.$$origData||z(h.$$data),h.$$modeled=h.get().sort(a);else{if(!(s(a)===!0&&a.length>0))throw new Error("Invalid sort value provided: "+a);for(h.$$origData=h.$$origData||z(h.$$data),f=a.reverse().length;--f;){if(a[f]=a[f].exec(j),3!==a[f].length)throw new Error("Invalid sort value provided: "+a[f]);g?g.next(a[f][2],"-"===a[f][1]?!0:!1):g=d(a[f][2],"-"===a[f][1]?!0:!1)}h.$$modeled=h.get().sort(g)}h.$$data=new Array(h.length),h.each(function(a,b){h.$$data[b]=a.get()})}else h.$$sort=a;return h},end:function(a){var b=this;return null!==b.$$origData&&(b.select(!1),b.$$data=z(b.$$origData),b.$$addData=[],b.$$modeled=null,b.length=b.$$data.length,b.$$origData=null,a!==!0&&(delete b.$$sort,delete b.$$filter)),b},unique:function(a){var b=this,d={},f=[];return p(a)&&a.length>0&&b.each(function(b){var g=e(a,b);s(g)===!0?y(g,function(a){r(a)===!0&&(a=JSON.stringify(a)),d[a.toString()]===c&&(d[a.toString()]=!0,f.push(a))}):(r(g)===!0&&(g=JSON.stringify(g)),null!==g&&g!==c&&d[g.toString()]===c&&(d[g.toString()]=!0,f.push(g)))}),f},select:function(a,b){var c=this;return a===!0?(c.$selected=new Array(c.length),c.$selectedCount=0,c.each(function(a){a.select(!0,!0)})):a===!1?(c.each(function(a){a.select(!1,!0)}),c.$selected=[],c.$selectedCount=0):q(a)===!0&&c.get()[a].select(b),d.call(c),c},clone:function(){var a=this,b=a._super.apply(a,arguments);return b.$$data=z(a.$$data),b.$$addData=z(a.$$addData),b.$$origData=z(a.$$origData),b.length=a.length,b.$loaded=b.$loaded,b.$selected=a.$selected,b.$selectedCount=a.$selectedCount,b.$allSelected=a.$allSelected,b.$noneSelected=a.$noneSelected,b},refresh:function(){var a=this;return a.$$lastReadData?a.read(a.$$lastReadData):a.read()},readService:!1,read:function(a,b){var c,d=this;return d.$busy===!0?(d.always(function(){d.read(a,b)}),b=d.unfinalize(),d):(b=b||d.unfinalize(),o(d.readService)&&(d.$busy=!0,d.$$lastReadData=a||{},c=d.readService(a,function(a){delete d.$errors.read,d.set(a),d.resolve(b)},function(a){d.$errors.read=a,d.reject(b)}),c===!1&&(d.$errors.read=!0,d.reject(b))),d)},updateService:!1,update:function(a,b){var c,d=this;if(d.$busy===!0)return d.always(function(){d.update(a,b)}),b=d.unfinalize(),d;if(b=b||d.unfinalize(),o(d.updateService)){if(d.$busy=!0,0===arguments.length)return delete d.$errors.update,d.resolve(b);c=d.updateService(a,function(a){delete d.$errors.update,d.resolve(b)},function(a){d.$errors.update=a,d.reject(b)}),c===!1&&(d.$errors.update=!0,d.reject(b))}else d.$errors.update=!0,d.reject(b);return d}})}function n(){return{restrict:"E",require:"?ngModel",link:function(a,b,c,d){function e(){y(g.$errors,function(a,b){d.$setValidity(b,!a)})}function f(a){return g.valid(a),a}var g=a.$eval(c.ngModel);o(g)&&r(g.$config)&&r(g.$parent)&&(g.$parent.bind("validated."+g.$config.methodName,e),d.$parsers.unshift(f),d.$formatters.unshift(f))}}}var o=b.isFunction,p=b.isString,q=b.isNumber,r=b.isObject,s=b.isArray,t=b.isDate,u=b.isUndefined,v=function(a){return a===!0||a===!1?!0:!1},w=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)?!0:!1},x=function(a){return null===a},y=b.forEach,z=(b.extend,b.copy),A=b.equals;b.module("angular-m",[]),b.module("angular-m.http",[]).service("$mhttp",["$rootScope","$http","$q",j]);var B={email:/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])+$/i,phone:/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/,latLong:/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,zip:/^\d{5}(?:[-\s]\d{4})?$/,timeZone:/^GMT\s[+-]\d{2}:\d{2}$/,timeStr:/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/};b.module("angular-m").constant("REGEX",B),b.module("angular-m").factory("Base",k),b.module("angular-m").factory("Singleton",["Base","REGEX",l]),b.module("angular-m").factory("Collection",["Base","Singleton",m]),b.module("angular-m.inputs",[]).directive("input",n).directive("select",n).directive("textarea",n)}(window,window.angular);
{
"name": "angular-m",
"description": "Angular-based model library for use in MVC framework design",
"version": "1.1.6",
"version": "1.1.7",
"homepage": "https://github.com/dlhdesign/angular-m",

@@ -6,0 +6,0 @@ "author": "David Hutchings",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc