Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated postinstall step

  • Loading branch information...
commit af5987b27c5d866a8a46f1404b4bacab52632601 1 parent e86257a
Kevin Malakoff authored
Showing with 75 additions and 3,568 deletions.
  1. +1 −1  Cakefile
  2. +1 −1  LICENSE
  3. +12 −3 README.md
  4. 0  easy-bake-config.yaml → easy-bake-config.yml
  5. +11 −11 knockback.js
  6. +2 −2 knockback.min.js
  7. +1 −1  src/knockback_collection_observable.coffee
  8. +2 −4 src/knockback_core.coffee
  9. +1 −1  src/knockback_default_wrapper.coffee
  10. +1 −1  src/knockback_formatted_observable.coffee
  11. +1 −1  src/knockback_localized_observable.coffee
  12. +1 −1  src/knockback_observable.coffee
  13. +1 −1  src/knockback_observables.coffee
  14. +1 −1  src/knockback_triggered_observable.coffee
  15. +1 −1  src/knockback_utils.coffee
  16. +1 −1  src/knockback_view_model.coffee
  17. +1 −1  test/_examples/contact.coffee
  18. +0 −1  test/all_tests.html
  19. +1 −1  test/backbone_modelref/test-latest.html
  20. +1 −1  test/backbone_modelref/test.coffee
  21. +2 −2 test/backbone_relational/test-latest.html
  22. +1 −1  test/backbone_relational/test.coffee
  23. +2 −2 test/interactive/test-latest.html
  24. +1 −1  test/interactive/test-legacy.html
  25. +1 −1  test/knockback_collection_observable/test-latest.html
  26. +1 −1  test/knockback_collection_observable/test.coffee
  27. +1 −1  test/knockback_formatted_observable/test-latest.html
  28. +1 −1  test/knockback_formatted_observable/test.coffee
  29. +1 −1  test/knockback_legacy/test-latest.html
  30. +1 −1  test/knockback_legacy/test.coffee
  31. +1 −1  test/knockback_localized_observable/test-latest.html
  32. +1 −1  test/knockback_localized_observable/test.coffee
  33. +2 −2 test/knockback_memory_management/test-latest.html
  34. +1 −1  test/knockback_memory_management/test.coffee
  35. +1 −1  test/knockback_observable/test-latest.html
  36. +1 −1  test/knockback_observable/test.coffee
  37. +1 −1  test/knockback_observables/test-latest.html
  38. +1 −1  test/knockback_observables/test.coffee
  39. +1 −1  test/knockback_triggered_observable/test-latest.html
  40. +1 −1  test/knockback_triggered_observable/test.coffee
  41. +1 −1  test/knockback_utils/test-latest.html
  42. +1 −1  test/knockback_utils/test.coffee
  43. +1 −1  test/knockback_view_model/test-latest.html
  44. +1 −1  test/knockback_view_model/test-latest.min.html
  45. +1 −1  test/knockback_view_model/test.coffee
  46. +3 −4 test/packaging/test-latest.html
  47. +0 −56 test/packaging/test-latest.min.html
  48. +2 −3 test/packaging/test-legacy.html
  49. +1 −1  vendor/backbone-0.5.0.js
  50. 0  vendor/{backbone-relational-0.5.0.js → backbone-relational-latest.js}
  51. 0  vendor/{knockout-2.1.0.debug.js → knockout-latest.js}
  52. +0 −3,441 vendor/knockout.js
2  Cakefile
View
@@ -1,2 +1,2 @@
easybake = require('easy-bake')
-(new easybake.Oven('easy-bake-config.yaml')).publishTasks()
+(new easybake.Oven('easy-bake-config.yml')).publishTasks()
2  LICENSE
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Kevin Malakoff
+Copyright (c) 2011, 2012 Kevin Malakoff
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
15 README.md
View
@@ -18,10 +18,19 @@ You can get the library here:
* [Development version][1]
* [Production version][2]
+**NOTE: there are breaking changes in 0.15.+** Please see the [release notes][http://kmalakoff.github.com/knockback/release_notes.html] for details.
+
+### Dependencies
+
+* [Backbone.js][3]
+* [Underscore.js][4]
+* [Knockout.js][5]
+
[1]: https://raw.github.com/kmalakoff/knockback/0.15.3/knockback.js
[2]: https://raw.github.com/kmalakoff/knockback/0.15.3/knockback.min.js
-
-**NOTE: there are breaking changes in 0.15.+** Please see the [release notes][http://kmalakoff.github.com/knockback/release_notes.html] for details.
+[3]: http://backbonejs.org/
+[4]: http://underscorejs.org/
+[5]: http://knockoutjs.com/
Why Write Knockback.js?
-----------------------
@@ -113,7 +122,7 @@ Building, Running and Testing the library
###Installing:
1. install node.js: http://nodejs.org
-2. install node packages: (sudo) 'npm install'
+2. install node packages: 'npm install'
###Commands:
0  easy-bake-config.yaml → easy-bake-config.yml
View
File renamed without changes
22 knockback.js
View
@@ -2,7 +2,7 @@
/*
knockback.js 0.15.3
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -16,7 +16,7 @@
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
- _ = !this._ && (typeof require !== 'undefined') ? require('underscore') : this._;
+ _ = !this._ && (typeof require !== 'undefined') ? require('underscore')._ : this._;
Backbone = !this.Backbone && (typeof require !== 'undefined') ? require('backbone') : this.Backbone;
@@ -37,7 +37,7 @@
/*
knockback_utils.js 0.15.3
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -365,7 +365,7 @@
/*
knockback_collection_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.CollectionObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -780,7 +780,7 @@
/*
knockback_default_wrapper.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.DefaultWrapper is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -835,7 +835,7 @@
/*
knockback_formatted_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.FormattedObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -964,7 +964,7 @@
/*
knockback_localized_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.LocalizedObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -1109,7 +1109,7 @@
/*
knockback_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -1359,7 +1359,7 @@
/*
knockback_observables.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observables is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -1466,7 +1466,7 @@
/*
knockback_triggered_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -1907,7 +1907,7 @@
/*
knockback_view_model.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
4 knockback.min.js
View
@@ -2,10 +2,10 @@
/*
knockback.js 0.15.3
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
Dependencies: Knockout.js, Backbone.js, and Underscore.js.
Optional dependency: Backbone.ModelRef.js.
-*/(function(){var Backbone,Knockback,kb,ko,_,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};_=!this._&&typeof require!="undefined"?require("underscore"):this._,Backbone=!this.Backbone&&typeof require!="undefined"?require("backbone"):this.Backbone,ko=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko,Knockback=kb=this.Knockback=this.kb=typeof exports!="undefined"?exports:{},kb.VERSION="0.15.3",kb.locale_manager=void 0,kb.stats={collection_observables:0,view_models:0},kb.stats_on=!1,kb.utils={},kb.utils.legacyWarning=function(identifier,remove_version,message){var _base;return kb._legacy_warnings||(kb._legacy_warnings={}),(_base=kb._legacy_warnings)[identifier]||(_base[identifier]=0),kb._legacy_warnings[identifier]++,console.warn("warning: '"+identifier+"' has been deprecated (will be removed in Knockback "+remove_version+"). "+message+".")},kb.utils.wrappedObservable=function(instance,observable){if(arguments.length===1){if(!(instance&&instance.__kb&&instance.__kb.observable))throw"Knockback: instance is not wrapping an observable";return instance.__kb.observable}if(!instance)throw"Knockback: no instance for wrapping a observable";return instance.__kb||(instance.__kb={}),instance.__kb.observable&&instance.__kb.observable.__kb&&(instance.__kb.observable.__kb.instance=null),instance.__kb.observable=observable,observable&&(observable.__kb||(observable.__kb={}),observable.__kb.instance=instance),observable},kb.wrappedObservable=function(instance){return kb.utils.legacyWarning("kb.wrappedObservable","0.16.0","Please use kb.utils.wrappedObservable instead"),kb.utils.wrappedObservable(instance)},kb.utils.observableInstanceOf=function(observable,type){return observable?!observable.__kb||!observable.__kb.instance?!1:observable.__kb.instance instanceof type:!1},kb.utils.wrappedModel=function(view_model,model){if(arguments.length===1)return view_model&&view_model.__kb&&view_model.__kb.hasOwnProperty("model")?view_model.__kb.model:view_model;if(!view_model)throw"Knockback: no view_model for wrapping a model";return view_model.__kb||(view_model.__kb={}),view_model.__kb.model=model,model},kb.viewModelGetModel=kb.vmModel=function(view_model){return kb.utils.legacyWarning("kb.vmModel","0.16.0","Please use kb.utils.wrappedModel instead"),kb.utils.wrappedModel(view_model)},kb.utils.setToDefault=function(obj){var key,observable,_results;if(!obj)return;if(ko.isObservable(obj))return typeof obj.setToDefault=="function"?obj.setToDefault():void 0;if(_.isObject(obj)){_results=[];for(key in obj)observable=obj[key],_results.push(observable&&key!=="__kb"?kb.utils.setToDefault(observable):void 0);return _results}},kb.vmSetToDefault=function(view_model){return kb.utils.legacyWarning("kb.vmSetToDefault","0.16.0","Please use kb.utils.release instead"),kb.utils.setToDefault(view_model)},kb.utils.release=function(obj,keys_only){var key,value;if(!obj)return!1;if(!keys_only&&(ko.isObservable(obj)||obj instanceof kb.Observables||typeof obj.release=="function"||typeof obj.destroy=="function"))return obj.release?obj.release():obj.destroy?obj.destroy():obj.dispose&&obj.dispose(),!0;if(_.isObject(obj)&&typeof obj!="function"){for(key in obj){value=obj[key];if(!value||key==="__kb")continue;kb.utils.release(value)&&(obj[key]=null)}return!0}return!1},kb.vmRelease=function(view_model){return kb.utils.legacyWarning("kb.vmRelease","0.16.0","Please use kb.utils.release instead"),kb.utils.release(view_model)},kb.vmReleaseObservable=function(observable){return kb.utils.legacyWarning("kb.vmReleaseObservable","0.16.0","Please use kb.utils.release instead"),kb.utils.release(observable)},kb.utils.optionsCreateClear=function(options){return delete options.create,delete options.children,delete options.view_model,delete options.view_model_create},kb.utils.optionsCreateOverride=function(options,create_options){return kb.utils.optionsCreateClear(options),_.extend(options,create_options)},kb.RefCountable=function(){function RefCountable(){this.__kb||(this.__kb={}),this.__kb.ref_count=1}return RefCountable.extend=Backbone.Model.extend,RefCountable.prototype.__destroy=function(){},RefCountable.prototype.retain=function(){if(this.__kb.ref_count<=0)throw"RefCountable: ref_count is corrupt: "+this.__kb.ref_count;return this.__kb.ref_count++,this},RefCountable.prototype.release=function(){if(this.__kb.ref_count<=0)throw"RefCountable: ref_count is corrupt: "+this.__kb.ref_count;return this.__kb.ref_count--,this.__kb.ref_count||this.__destroy(),this},RefCountable.prototype.refCount=function(){return this.__kb.ref_count},RefCountable}(),kb.Store=function(){function Store(){this.keys=[],this.values=[]}return Store.prototype.destroy=function(){var index,value,_ref,_ref1;this.keys=null,_ref=this.values;for(index in _ref){value=_ref[index];if(!kb.utils.observableInstanceOf(value,kb.CollectionObservable))continue;this.values[index]=null;while(value.refCount()>0)value.release()}_ref1=this.values;for(index in _ref1){value=_ref1[index];if(!value)continue;this.values[index]=null;if(value instanceof kb.RefCountable)while(value.refCount()>0)value.release();else kb.utils.release(value)}return this.values=null},Store.prototype.registerValue=function(key,value){var index;return value instanceof kb.RefCountable&&value.retain(),index=_.indexOf(this.keys,key),index>=0?this.values[index]=value:(this.keys.push(key),this.values.push(value)),value},Store.prototype.resolveValue=function(key,create_fn,args){var index,value;index=_.indexOf(this.keys,key);if(index>=0){if(this.values[index]){if(!(this.values[index]instanceof kb.RefCountable&&this.values[index].refCount()<=0))return this.values[index]instanceof kb.RefCountable?this.values[index].retain():this.values[index];this.values[index]=null}}else index=this.keys.length,this.keys.push(key),this.values.push(void 0);return value=create_fn.apply(null,Array.prototype.slice.call(arguments,2)),this.keys[index]!==key?this.registerValue(key,value):this.values[index]||(value instanceof kb.RefCountable&&value.retain(),this.values[index]=value),value},Store.prototype.releaseValue=function(value){var index;if(value instanceof kb.RefCountable){value.release();if(value.refCount()>0)return;index=_.indexOf(this.values,value);if(index>=0)return this.values[index]=0;return}return},Store.prototype.addResolverToOptions=function(options,key){return _.extend(options,{store:this,store_key:key})},Store.resolveFromOptions=function(options,value){if(!options.store||!options.store_key)return;return options.store.registerValue(options.store_key,value)},Store}(),kb.CollectionObservable=function(_super){function CollectionObservable(collection,options){var bind_model_changes,observable,_this=this;options==null&&(options={});if(!collection)throw"CollectionObservable: collection is missing";CollectionObservable.__super__.constructor.apply(this,arguments),kb.stats_on&&kb.stats.collection_observables++,ko.isObservable(options)&&options.hasOwnProperty("indexOf")?(kb.utils.legacyWarning("kb.collectionObservable with an external ko.observableArray","0.16.0","Please use the kb.collectionObservable directly instead of passing a ko.observableArray"),observable=kb.utils.wrappedObservable(this,options),options=arguments[2]||{},bind_model_changes=!0):observable=kb.utils.wrappedObservable(this,ko.observableArray([])),options.store_skip_resolve||kb.Store.resolveFromOptions(options,kb.utils.wrappedObservable(this)),options.store?this.__kb.store=options.store:(this.__kb.store=new kb.Store,this.__kb.store_is_owned=!0);if(options.hasOwnProperty("view_model")){if(!options.view_model)throw"kb.CollectionObservable: options.view_model is empty";this.view_model_create_fn=options.view_model,this.view_model_create_with_new=!0}else if(options.hasOwnProperty("view_model_constructor")){if(!options.view_model_constructor)throw"kb.CollectionObservable: options.view_model_constructor is empty";kb.utils.legacyWarning("kb.collectionObservable option view_model_constructor","0.16.0","Please use view_model option instead"),this.view_model_create_fn=options.view_model_constructor,this.view_model_create_with_new=!0}else if(options.hasOwnProperty("view_model_create")){if(!options.view_model_create)throw"kb.CollectionObservable: options.view_model_create is empty";this.view_model_create_fn=options.view_model_create}else if(options.hasOwnProperty("create")){if(!options.create)throw"kb.CollectionObservable: options.create is empty";this.view_model_create_fn=options.create}return this.sort_attribute=options.sort_attribute,this.sorted_index=options.sorted_index,this.__kb._onCollectionReset=_.bind(this._onCollectionReset,this),this.__kb._onCollectionResort=_.bind(this._onCollectionResort,this),this.__kb._onModelAdd=_.bind(this._onModelAdd,this),this.__kb._onModelRemove=_.bind(this._onModelRemove,this),this.__kb._onModelChange=_.bind(this._onModelChange,this),bind_model_changes&&collection&&collection.bind("change",function(){return kb.utils.wrappedObservable(_this).valueHasMutated()}),observable.retain=_.bind(this.retain,this),observable.refCount=_.bind(this.refCount,this),observable.release=_.bind(this.release,this),observable.collection=_.bind(this.collection,this),observable.viewModelByModel=_.bind(this.viewModelByModel,this),observable.sortedIndex=_.bind(this.sortedIndex,this),observable.sortAttribute=_.bind(this.sortAttribute,this),observable.hasViewModels=_.bind(this.hasViewModels,this),observable.bind=_.bind(this.bind,this),observable.unbind=_.bind(this.unbind,this),observable.trigger=_.bind(this.trigger,this),this.collection(collection,{silent:!0,defer:options.defer}),observable}return __extends(CollectionObservable,_super),CollectionObservable.prototype.__destroy=function(){this.collection(null),this.hasViewModels()&&this.__kb.store_is_owned&&(this.__kb.store.destroy(),this.__kb.store=null),this.view_model_create_fn=null,this.__kb.collection=null,kb.utils.wrappedObservable(this,null),CollectionObservable.__super__.__destroy.apply(this,arguments);if(kb.stats_on)return kb.stats.collection_observables--},CollectionObservable.prototype.retain=function(){return CollectionObservable.__super__.retain.apply(this,arguments),kb.utils.wrappedObservable(this)},CollectionObservable.prototype.release=function(){var observable;return observable=kb.utils.wrappedObservable(this),CollectionObservable.__super__.release.apply(this,arguments),observable},CollectionObservable.prototype.collection=function(collection,options){var observable,_base,_base1;observable=kb.utils.wrappedObservable(this);if(arguments.length===0)return observable(),this.__kb.collection;if(collection===this.__kb.collection)return;this.__kb.collection&&(this._clear(),this._collectionUnbind(this.__kb.collection),typeof (_base=this.__kb.collection).release=="function"&&_base.release(),this.__kb.collection=null),this.__kb.collection=collection;if(this.__kb.collection)return typeof (_base1=this.__kb.collection).retain=="function"&&_base1.retain(),this._collectionBind(this.__kb.collection),this.sortedIndex(this.sorted_index,this.sort_attribute,options)},CollectionObservable.prototype.sortedIndex=function(sorted_index,sort_attribute,options){var _resync,_this=this;return options==null&&(options={}),sorted_index?(this.sorted_index=sorted_index,this.sort_attribute=sort_attribute):sort_attribute?(this.sort_attribute=sort_attribute,this.sorted_index=this._sortAttributeFn(sort_attribute)):(this.sort_attribute=null,this.sorted_index=null),_resync=function(){var observable;observable=kb.utils.wrappedObservable(_this);if(_this.__kb.collection.models.length===0&&observable().length===0)return;_this._collectionResync(!0);if(!options.silent)return _this.trigger("resort",observable())},options.defer?_.defer(_resync):_resync(),this},CollectionObservable.prototype.sortAttribute=function(sort_attribute,sorted_index,silent){return this.sortedIndex(sorted_index,sort_attribute,silent)},CollectionObservable.prototype.viewModelByModel=function(model){var id_attribute,observable;return this.hasViewModels()?(observable=kb.utils.wrappedObservable(this),id_attribute=model.hasOwnProperty(model.idAttribute)?model.idAttribute:"cid",_.find(observable(),function(test){return test.__kb.model[id_attribute]===model[id_attribute]})):null},CollectionObservable.prototype.hasViewModels=function(){return!!this.view_model_create_fn},CollectionObservable.prototype._collectionBind=function(collection){var event,_i,_j,_len,_len1,_ref,_ref1;if(!collection)return;collection.bind("reset",this.__kb._onCollectionReset),this.sorted_index||collection.bind("resort",this.__kb._onCollectionResort),_ref=["new","add"];for(_i=0,_len=_ref.length;_i<_len;_i++)event=_ref[_i],collection.bind(event,this.__kb._onModelAdd);_ref1=["remove","destroy"];for(_j=0,_len1=_ref1.length;_j<_len1;_j++)event=_ref1[_j],collection.bind(event,this.__kb._onModelRemove);return collection.bind("change",this.__kb._onModelChange)},CollectionObservable.prototype._collectionUnbind=function(collection){var event,_i,_j,_len,_len1,_ref,_ref1;if(!collection)return;collection.unbind("reset",this.__kb._onCollectionReset),this.sorted_index||collection.unbind("resort",this.__kb._onCollectionResort),_ref=["new","add"];for(_i=0,_len=_ref.length;_i<_len;_i++)event=_ref[_i],collection.unbind(event,this.__kb._onModelAdd);_ref1=["remove","destroy"];for(_j=0,_len1=_ref1.length;_j<_len1;_j++)event=_ref1[_j],collection.unbind(event,this.__kb._onModelRemove);return collection.unbind("change",this.__kb._onModelChange)},CollectionObservable.prototype._onCollectionReset=function(){return this._collectionResync()},CollectionObservable.prototype._onCollectionResort=function(model_or_models){var observable;if(this.sorted_index)throw"CollectionObservable: collection sorted_index unexpected";return _.isArray(model_or_models)?(observable=kb.utils.wrappedObservable(this),this.trigger("resort",observable())):this._onModelResort(model_or_models)},CollectionObservable.prototype._onModelAdd=function(model){var add_index,observable,target;return target=this.hasViewModels()?this._createTarget(model):model,observable=kb.utils.wrappedObservable(this),this.sorted_index?add_index=this.sorted_index(observable(),target):add_index=this.__kb.collection.indexOf(model),observable.splice(add_index,0,target),this.trigger("add",target,observable())},CollectionObservable.prototype._onModelRemove=function(model){var observable,target;target=this.hasViewModels()?this.viewModelByModel(model):model;if(!target)return;observable=kb.utils.wrappedObservable(this),observable.remove(target),this.trigger("remove",target,observable);if(this.hasViewModels())return this.__kb.store.releaseValue(target)},CollectionObservable.prototype._onModelChange=function(model){if(this.sorted_index&&(!this.sort_attribute||model.hasChanged(this.sort_attribute)))return this._onModelResort(model)},CollectionObservable.prototype._onModelResort=function(model){var new_index,observable,previous_index,sorted_targets,target;observable=kb.utils.wrappedObservable(this),target=this.hasViewModels()?this.viewModelByModel(model):model,previous_index=observable.indexOf(target),this.sorted_index?(sorted_targets=_.clone(observable()),sorted_targets.splice(previous_index,1),new_index=this.sorted_index(sorted_targets,target)):new_index=this.__kb.collection.indexOf(model);if(previous_index===new_index)return;return observable.splice(previous_index,1),observable.splice(new_index,0,target),this.trigger("resort",target,observable(),new_index)},CollectionObservable.prototype._clear=function(silent){var observable,target,targets,_i,_len,_results;observable=kb.utils.wrappedObservable(this),silent||this.trigger("remove",observable()),targets=observable.removeAll();if(this.hasViewModels()){_results=[];for(_i=0,_len=targets.length;_i<_len;_i++)target=targets[_i],_results.push(this.__kb.store.releaseValue(target));return _results}},CollectionObservable.prototype._collectionResync=function(silent){var add_index,model,observable,target,targets,_i,_len,_ref,_this=this;this._clear(silent),observable=kb.utils.wrappedObservable(this);if(this.sorted_index){targets=[],_ref=this.__kb.collection.models;for(_i=0,_len=_ref.length;_i<_len;_i++)model=_ref[_i],target=this._createTarget(model),add_index=this.sorted_index(targets,target),targets.splice(add_index,0,target)}else targets=this.hasViewModels()?_.map(this.__kb.collection.models,function(model){return _this._createTarget(model)}):_.clone(this.__kb.collection.models);observable(targets);if(!silent)return this.trigger("add",observable())},CollectionObservable.prototype._sortAttributeFn=function(sort_attribute){return this.hasViewModels()?function(view_models,model){return _.sortedIndex(view_models,model,function(test){return kb.utils.wrappedModel(test).get(sort_attribute)})}:function(models,model){return _.sortedIndex(models,model,function(test){return test.get(sort_attribute)})}},CollectionObservable.prototype._createTarget=function(model){var create_fn,_this=this;return create_fn=function(){var observable,options,view_model;return options=_this.__kb.store.addResolverToOptions({},model),observable=kb.utils.wrappedObservable(_this),view_model=_this.view_model_create_with_new?new _this.view_model_create_fn(model,options,observable):_this.view_model_create_fn(model,options,observable),kb.utils.wrappedModel(view_model,model),view_model},this.hasViewModels()?this.__kb.store.resolveValue(model,create_fn):model},CollectionObservable}(kb.RefCountable),__extends(kb.CollectionObservable.prototype,Backbone.Events),kb.collectionObservable=function(collection,options,legacy){return new kb.CollectionObservable(collection,options,legacy)},kb.sortedIndexWrapAttr=kb.siwa=function(attribute_name,wrapper_constructor){return function(models,model){return _.sortedIndex(models,model,function(test){return new wrapper_constructor(kb.utils.wrappedModel(test).get(attribute_name))})}},kb.DefaultWrapper=function(){function DefaultWrapper(target_observable,default_value_observable){var observable,_this=this;return this.default_value_observable=default_value_observable,this.__kb={},observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:function(){var current_default,current_target;return current_target=ko.utils.unwrapObservable(target_observable()),current_default=ko.utils.unwrapObservable(_this.default_value_observable),current_target?current_target:current_default},write:function(value){return target_observable(value)}})),observable.destroy=_.bind(this.destroy,this),observable.setToDefault=_.bind(this.setToDefault,this),observable}return DefaultWrapper.prototype.destroy=function(){return kb.utils.wrappedObservable(this,null),this.default_value=null},DefaultWrapper.prototype.setToDefault=function(){var observable;return observable=kb.utils.wrappedObservable(this),observable(this.default_value_observable)},DefaultWrapper}(),kb.defaultWrapper=function(target,default_value){return new kb.DefaultWrapper(target,default_value)},kb.toFormattedString=function(format){var arg,args,index,parameter_index,result,value;result=format.slice(),args=Array.prototype.slice.call(arguments,1);for(index in args){arg=args[index],value=ko.utils.unwrapObservable(arg),value||(value=""),parameter_index=format.indexOf("{"+index+"}");while(parameter_index>=0)result=result.replace("{"+index+"}",value),parameter_index=format.indexOf("{"+index+"}",parameter_index+1)}return result},kb.parseFormattedString=function(string,format){var count,format_indices_to_matched_indices,index,match_index,matches,parameter_count,parameter_index,positions,regex,regex_string,results,sorted_positions,_i,_results;regex_string=format.slice(),index=0,parameter_count=0,positions={};while(regex_string.search("\\{"+index+"\\}")>=0){parameter_index=format.indexOf("{"+index+"}");while(parameter_index>=0)regex_string=regex_string.replace("{"+index+"}","(.*)"),positions[parameter_index]=index,parameter_count++,parameter_index=format.indexOf("{"+index+"}",parameter_index+1);index++}count=index,regex=new RegExp(regex_string),matches=regex.exec(string),matches&&matches.shift();if(!matches||matches.length!==parameter_count)return _.map(function(){_results=[];for(var _i=1;1<=count?_i<=count:_i>=count;1<=count?_i++:_i--)_results.push(_i);return _results}.apply(this),function(){return""});sorted_positions=_.sortBy(_.keys(positions),function(parameter_index,format_index){return parseInt(parameter_index,10)}),format_indices_to_matched_indices={};for(match_index in sorted_positions){parameter_index=sorted_positions[match_index],index=positions[parameter_index];if(format_indices_to_matched_indices.hasOwnProperty(index))continue;format_indices_to_matched_indices[index]=match_index}results=[],index=0;while(index<count)results.push(matches[format_indices_to_matched_indices[index]]),index++;return results},kb.FormattedObservable=function(){function FormattedObservable(format,args){var observable,observable_args;return this.__kb={},_.isArray(args)?(format=format,observable_args=args):observable_args=Array.prototype.slice.call(arguments,1),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:function(){var arg,_i,_len;args=[ko.utils.unwrapObservable(format)];for(_i=0,_len=observable_args.length;_i<_len;_i++)arg=observable_args[_i],args.push(ko.utils.unwrapObservable(arg));return kb.toFormattedString.apply(null,args)},write:function(value){var index,matches,max_count,_results;matches=kb.parseFormattedString(value,ko.utils.unwrapObservable(format)),max_count=Math.min(observable_args.length,matches.length),index=0,_results=[];while(index<max_count)observable_args[index](matches[index]),_results.push(index++);return _results}})),observable}return FormattedObservable.prototype.destroy=function(){return kb.utils.wrappedObservable(this,null)},FormattedObservable}(),kb.formattedObservable=function(format,args){return new kb.FormattedObservable(format,Array.prototype.slice.call(arguments,1))},kb.LocalizedObservable=function(){function LocalizedObservable(value,options,view_model){var observable;this.value=value,this.options=options!=null?options:{},this.view_model=view_model!=null?view_model:{};if(!this.options.read&&!this.read)throw"LocalizedObservable: options.read is missing";if(this.options.read&&this.read)throw"LocalizedObservable: options.read and read class function exist. You need to choose one.";if(this.options.write&&this.write)throw"LocalizedObservable: options.write and write class function exist. You need to choose one.";if(!kb.locale_manager)throw"LocalizedObservable: kb.locale_manager is not defined";this.__kb={},this.__kb._onLocaleChange=_.bind(this._onLocaleChange,this),this.value&&(value=ko.utils.unwrapObservable(this.value)),this.__kb.value_observable=ko.observable(value?this.read.call(this,value,null):this._getDefaultValue());if(this.write&&typeof this.write!="function")throw"LocalizedObservable: options.write is not a function for read_write model attribute";return observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this._onGetValue,this),write:this.write?_.bind(this._onSetValue,this):function(){throw"kb.LocalizedObservable: value is read only"},owner:this.view_model})),observable.destroy=_.bind(this.destroy,this),observable.observedValue=_.bind(this.observedValue,this),observable.setToDefault=_.bind(this.setToDefault,this),observable.resetToCurrent=_.bind(this.resetToCurrent,this),kb.locale_manager.bind("change",this.__kb._onLocaleChange),observable}return LocalizedObservable.extend=Backbone.Model.extend,LocalizedObservable.prototype.destroy=function(){return kb.locale_manager.unbind("change",this.__kb._onLocaleChange),this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.options={},this.view_model=null,this.__kb=null},LocalizedObservable.prototype.setToDefault=function(){var current_value,default_value;if(!this["default"])return;return default_value=this._getDefaultValue(),current_value=this.__kb.value_observable(),current_value!==default_value?this._onSetValue(default_value):this.__kb.value_observable.valueHasMutated()},LocalizedObservable.prototype.resetToCurrent=function(){return this.__kb.value_observable(null),this._onSetValue(this._getCurrentValue())},LocalizedObservable.prototype.observedValue=function(value){return arguments.length===0?this.value:(this.value=value,this._onLocaleChange(),this)},LocalizedObservable.prototype._getDefaultValue=function(){return this["default"]?typeof this["default"]=="function"?this["default"]():this["default"]:""},LocalizedObservable.prototype._getCurrentValue=function(){var observable;return observable=kb.utils.wrappedObservable(this),!this.value||!observable?this._getDefaultValue():this.read.call(this,ko.utils.unwrapObservable(this.value))},LocalizedObservable.prototype._onGetValue=function(){return this.value&&ko.utils.unwrapObservable(this.value),this.__kb.value_observable()},LocalizedObservable.prototype._onSetValue=function(value){this.write.call(this,value,ko.utils.unwrapObservable(this.value)),value=this.read.call(this,ko.utils.unwrapObservable(this.value)),this.__kb.value_observable(value);if(this.options.onChange)return this.options.onChange(value)},LocalizedObservable.prototype._onLocaleChange=function(){var value;value=this.read.call(this,ko.utils.unwrapObservable(this.value)),this.__kb.value_observable(value);if(this.options.onChange)return this.options.onChange(value)},LocalizedObservable}(),kb.localizedObservable=function(value,options,view_model){return new kb.LocalizedObservable(value,options,view_model)},kb.Observable=function(){function Observable(model,mapping_info,view_model){var observable,_this=this;this.model=model,this.mapping_info=mapping_info,this.view_model=view_model!=null?view_model:{};if(!this.model)throw"Observable: model is missing";if(!this.mapping_info)throw"Observable: mapping_info is missing";if(_.isString(this.mapping_info)||ko.isObservable(this.mapping_info))this.mapping_info={key:this.mapping_info};if(!this.mapping_info.key)throw"Observable: mapping_info.key is missing";return this.__kb={},this.__kb._onModelChange=_.bind(this._onModelChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),this.mapping_info.hasOwnProperty("write")&&_.isBoolean(this.mapping_info.write)&&(this.mapping_info=_.clone(this.mapping_info),this.mapping_info.read_only=!this.mapping_info.write),Backbone.ModelRef&&this.model instanceof Backbone.ModelRef&&(this.model_ref=this.model,this.model_ref.retain(),this.model_ref.bind("loaded",this.__kb._onModelLoaded),this.model_ref.bind("unloaded",this.__kb._onModelUnloaded),this.model=this.model_ref.getModel()),this.__kb.value_observable=ko.observable(),this.mapping_info.localizer&&(this.__kb.localizer=new this.mapping_info.localizer(this._getCurrentValue())),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this._onGetValue,this),write:this.mapping_info.read_only?function(){throw"kb.Observable: "+_this.mapping_info.key+" is read only"}:_.bind(this._onSetValue,this),owner:this.view_model})),observable.destroy=_.bind(this.destroy,this),observable.setToDefault=_.bind(this.setToDefault,this),(!this.model_ref||this.model_ref.isLoaded())&&this.model.bind("change",this.__kb._onModelChange),observable}return Observable.prototype.destroy=function(){return this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.model&&this.__kb._onModelUnloaded(this.model),this.model_ref&&(this.model_ref.unbind("loaded",this.__kb._onModelLoaded),this.model_ref.unbind("unloaded",this.__kb._onModelUnloaded),this.model_ref.release(),this.model_ref=null),this.mapping_info=null,this.view_model=null,this.__kb=null},Observable.prototype.setToDefault=function(){var value;return value=this._getDefaultValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),this.__kb.value_observable(value)},Observable.prototype._getDefaultValue=function(){return this.mapping_info.hasOwnProperty("default")?typeof this.mapping_info["default"]=="function"?this.mapping_info["default"]():this.mapping_info["default"]:""},Observable.prototype._getCurrentValue=function(){var arg,args,key,_i,_len,_ref;if(!this.model)return this._getDefaultValue();key=ko.utils.unwrapObservable(this.mapping_info.key),args=[key];if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],args.push(ko.utils.unwrapObservable(arg))}else args.push(ko.utils.unwrapObservable(this.mapping_info.args));return this.mapping_info.read?this.mapping_info.read.apply(this.view_model,args):this.model.get.apply(this.model,args)},Observable.prototype._onGetValue=function(){var arg,value,_i,_len,_ref;this.__kb.value_observable(),ko.utils.unwrapObservable(this.mapping_info.key);if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],ko.utils.unwrapObservable(arg)}else ko.utils.unwrapObservable(this.mapping_info.args);return value=this._getCurrentValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),value},Observable.prototype._onSetValue=function(value){var arg,args,set_info,_i,_len,_ref;this.__kb.localizer&&(this.__kb.localizer(value),value=this.__kb.localizer.observedValue());if(this.model){set_info={},set_info[ko.utils.unwrapObservable(this.mapping_info.key)]=value,args=typeof this.mapping_info.write=="function"?[value]:[set_info];if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],args.push(ko.utils.unwrapObservable(arg))}else args.push(ko.utils.unwrapObservable(this.mapping_info.args));typeof this.mapping_info.write=="function"?this.mapping_info.write.apply(this.view_model,args):this.model.set.apply(this.model,args)}return this.__kb.localizer?this.__kb.value_observable(this.__kb.localizer()):this.__kb.value_observable(value)},Observable.prototype._modelBind=function(model){if(!model)return;model.bind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.bind("add",this.__kb._onModelChange),model.bind("remove",this.__kb._onModelChange),model.bind("update",this.__kb._onModelChange)},Observable.prototype._modelUnbind=function(model){if(!model)return;model.unbind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.unbind("add",this.__kb._onModelChange),model.unbind("remove",this.__kb._onModelChange),model.unbind("update",this.__kb._onModelChange)},Observable.prototype._onModelLoaded=function(model){return this.model=model,this._modelBind(model),this._updateValue()},Observable.prototype._onModelUnloaded=function(model){return this.__kb.localizer&&this.__kb.localizer.destroy&&(this.__kb.localizer.destroy(),this.__kb.localizer=null),this._modelUnbind(model),this.model=null},Observable.prototype._onModelChange=function(){if(this.model&&this.model.hasChanged&&!this.model.hasChanged(ko.utils.unwrapObservable(this.mapping_info.key)))return;return this._updateValue()},Observable.prototype._updateValue=function(){var value;return value=this._getCurrentValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),this.__kb.value_observable(value)},Observable}(),kb.observable=function(model,mapping_info,view_model){return new kb.Observable(model,mapping_info,view_model)},kb.Observables=function(){function Observables(model,mappings_info,view_model,options_or_read_only){var is_string,key,mapping_info,property_name,read_only,_i,_len,_ref,_ref1;if(!model)throw"Observables: model is missing";if(!mappings_info||!_.isObject(mappings_info)&&!_.isArray(mappings_info))throw"Observables: mappings_info is missing";this.__kb||(this.__kb={}),this.__kb.model=model;if(_.isArray(mappings_info)){this.__kb.mappings_info={};for(_i=0,_len=mappings_info.length;_i<_len;_i++)key=mappings_info[_i],this.__kb.mappings_info[key]={}}else this.__kb.mappings_info=mappings_info;this.__kb.view_model=_.isUndefined(view_model)?this:view_model,!_.isUndefined(options_or_read_only)&&options_or_read_only.hasOwnProperty("write")&&(kb.utils.legacyWarning("kb.Observables option.write","0.16.0","Now default is writable so only supply read_only as required"),options_or_read_only.read_only=!options_or_read_only.write,delete options_or_read_only.write);if(!_.isUndefined(options_or_read_only)){read_only=_.isBoolean(options_or_read_only)?options_or_read_only:options_or_read_only.read_only,_ref=this.__kb.mappings_info;for(property_name in _ref)mapping_info=_ref[property_name],is_string=_.isString(mapping_info),is_string?mapping_info=_.isUndefined(read_only)?{key:mapping_info}:{key:mapping_info,read_only:read_only}:!_.isUndefined(read_only)&&!mapping_info.hasOwnProperty("read_only")&&!mapping_info.hasOwnProperty("write")&&(mapping_info.read_only=read_only),mapping_info.hasOwnProperty("key")||(mapping_info.key=property_name),this[property_name]=this.__kb.view_model[property_name]=kb.observable(this.__kb.model,mapping_info,this.__kb.view_model)}else{_ref1=this.__kb.mappings_info;for(property_name in _ref1)mapping_info=_ref1[property_name],mapping_info.hasOwnProperty("write")&&kb.utils.legacyWarning("kb.Observables option.write","0.16.0","Now default is writable so only supply read_only as required"),mapping_info.hasOwnProperty("key")||(mapping_info.key=property_name),this[property_name]=this.__kb.view_model[property_name]=kb.observable(this.__kb.model,mapping_info,this.__kb.view_model)}}return Observables.prototype.destroy=function(){var mapping_info,property_name,_ref;_ref=this.__kb.mappings_info;for(property_name in _ref)mapping_info=_ref[property_name],this.__kb.view_model[property_name]&&this.__kb.view_model[property_name].destroy(),this.__kb.view_model[property_name]=null,this[property_name]=null;return this.__kb.view_model=null,this.__kb.mappings_info=null,this.__kb.model=null},Observables.prototype.setToDefault=function(){var mapping_info,property_name,_ref,_results;_ref=this.__kb.mappings_info,_results=[];for(property_name in _ref)mapping_info=_ref[property_name],_results.push(this.__kb.view_model[property_name].setToDefault());return _results},Observables}(),kb.observables=function(model,mappings_info,view_model,options){return new kb.Observables(model,mappings_info,view_model,options)},kb.TriggeredObservable=function(){function TriggeredObservable(model,event_name){var observable;this.model=model,this.event_name=event_name;if(!this.model)throw"Observable: model is missing";if(!this.event_name)throw"Observable: event_name is missing";return this.__kb={},this.__kb._onValueChange=_.bind(this._onValueChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),Backbone.ModelRef&&this.model instanceof Backbone.ModelRef&&(this.model_ref=this.model,this.model_ref.retain(),this.model_ref.bind("loaded",this.__kb._onModelLoaded),this.model_ref.bind("unloaded",this.__kb._onModelUnloaded),this.model=this.model_ref.getModel()),this.__kb.value_observable=ko.observable(),observable=kb.utils.wrappedObservable(this,ko.dependentObservable(_.bind(this._onGetValue,this))),observable.destroy=_.bind(this.destroy,this),(!this.model_ref||this.model_ref.isLoaded())&&this._onModelLoaded(this.model),observable}return TriggeredObservable.prototype.destroy=function(){return kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.__kb.value_observable=null,this.model&&this._onModelUnloaded(this.model),this.model_ref&&(this.model_ref.unbind("loaded",this.__kb._onModelLoaded),this.model_ref.unbind("unloaded",this.__kb._onModelUnloaded),this.model_ref.release(),this.model_ref=null),this.options=null,this.view_model=null,this.__kb=null},TriggeredObservable.prototype._onGetValue=function(){return this.__kb.value_observable()},TriggeredObservable.prototype._onModelLoaded=function(model){return this.model=model,this.model.bind(this.event_name,this.__kb._onValueChange),this._onValueChange()},TriggeredObservable.prototype._onModelUnloaded=function(){return this.__kb.localizer&&this.__kb.localizer.destroy&&(this.__kb.localizer.destroy(),this.__kb.localizer=null),this.model.unbind(this.event_name,this.__kb._onValueChange),this.model=null},TriggeredObservable.prototype._onValueChange=function(){var current_value;return current_value=this.__kb.value_observable(),current_value!==this.model?this.__kb.value_observable(this.model):this.__kb.value_observable.valueHasMutated()},TriggeredObservable}(),kb.triggeredObservable=function(model,event_name){return new kb.TriggeredObservable(model,event_name)},kb.AttributeConnector=function(){function AttributeConnector(model,key,options){var observable;return this.key=key,this.options=options!=null?options:{},kb.utils.wrappedModel(this,model),this.options=_.clone(this.options),this.__kb.value_observable=ko.observable(),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this.read,this),write:_.bind(this.write,this)})),observable.destroy=_.bind(this.destroy,this),observable.model=_.bind(this.model,this),observable.update=_.bind(this.update,this),this.__kb.initializing=!0,this.update(),this.__kb.initializing=!1,observable}return AttributeConnector.prototype.destroy=function(){return this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null)},AttributeConnector.prototype.read=function(){return this.__kb.value_observable()},AttributeConnector.prototype.write=function(value){var model,set_info;model=kb.utils.wrappedModel(this);if(!model)return;if(!this.options.read_only)return set_info={},set_info[this.key]=value,model.set(set_info);if(!this.__kb.initializing)throw"Cannot write a value to a dependentObservable unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."},AttributeConnector.prototype.model=function(new_model){var model;model=kb.utils.wrappedModel(this);if(arguments.length===0)return model;if(model===new_model)return;return kb.utils.wrappedModel(this,new_model),this.update()},AttributeConnector.inferType=function(model,key){var relation,value;return value=model.get(key),value?value instanceof Backbone.Collection?"collection":value instanceof Backbone.Model||Backbone.ModelRef&&value instanceof Backbone.ModelRef?"model":"simple":Backbone.RelationalModel&&model instanceof Backbone.RelationalModel?(relation=_.find(model.getRelations(),function(test){return test.key===key}),relation?relation.collectionKey?"collection":"model":"simple"):"simple"},AttributeConnector.createByType=function(type,model,key,options){var attribute_options;switch(type){case"collection":return attribute_options=options?_.clone(options):{},options.view_model||options.view_model_create||options.children||options.create||(attribute_options.view_model=kb.ViewModel),options.store&&options.store.addResolverToOptions(attribute_options,model.get(key)),kb.collectionAttributeConnector(model,key,attribute_options);case"model":return attribute_options=options?_.clone(options):{},attribute_options.options||(attribute_options.options={}),options.view_model||options.view_model_create||options.children||options.create||(attribute_options.view_model=kb.ViewModel),options.store&&options.store.addResolverToOptions(attribute_options.options,model.get(key)),kb.viewModelAttributeConnector(model,key,attribute_options);default:return kb.simpleAttributeConnector(model,key,options)}},AttributeConnector.createOrUpdate=function(attribute_connector,model,key,options){var attribute_options,value;if(attribute_connector)return kb.utils.observableInstanceOf(attribute_connector,kb.AttributeConnector)&&(attribute_connector.model()!==model?attribute_connector.model(model):attribute_connector.update()),attribute_connector;if(!model)return kb.simpleAttributeConnector(model,key,options);if(options.hasOwnProperty("create")){if(!options.create)throw"kb.AttributeConnector: options.create is empty";return options.create(model,key,options.options||{})}value=model.get(key);if(options.hasOwnProperty("view_model")){if(!options.view_model)throw"kb.AttributeConnector: options.view_model is empty";return new options.view_model(value,options.options||{})}if(options.hasOwnProperty("view_model_create")){if(!options.view_model_create)throw"kb.AttributeConnector: options.view_model_create is empty";return options.view_model_create(value,options.options||{})}if(options.hasOwnProperty("children")){if(!options.children)throw"kb.AttributeConnector: options.children is empty";return typeof options.children=="function"?attribute_options={view_model:options.children}:attribute_options=options.children||{},kb.collectionAttributeConnector(model,key,attribute_options)}return this.createByType(this.inferType(model,key),model,key,options)},AttributeConnector}(),kb.SimpleAttributeConnector=function(_super){function SimpleAttributeConnector(){return SimpleAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(SimpleAttributeConnector,_super),SimpleAttributeConnector.prototype.destroy=function(){return this.current_value=null,SimpleAttributeConnector.__super__.destroy.apply(this,arguments)},SimpleAttributeConnector.prototype.update=function(){var current_value,model,value;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!_.isEqual(current_value,value))return this.__kb.value_observable(value)},SimpleAttributeConnector.prototype.write=function(value){var model;model=kb.utils.wrappedModel(this);if(!model){this.__kb.value_observable(value);return}return SimpleAttributeConnector.__super__.write.apply(this,arguments)},SimpleAttributeConnector}(kb.AttributeConnector),kb.simpleAttributeConnector=function(model,key,options){return new kb.SimpleAttributeConnector(model,key,options)},kb.CollectionAttributeConnector=function(_super){function CollectionAttributeConnector(){return CollectionAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(CollectionAttributeConnector,_super),CollectionAttributeConnector.prototype.destroy=function(){var current_value;return current_value=this.__kb.value_observable(),current_value&&typeof current_value.refCount=="function"&&current_value.refCount()>0&&current_value.release(),CollectionAttributeConnector.__super__.destroy.apply(this,arguments)},CollectionAttributeConnector.prototype.update=function(){var current_value,model,value,_this=this;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!current_value)return this.options.store?this.__kb.value_observable(this.options.store.resolveValue(value,function(){return kb.collectionObservable(value,_this.options)})):this.__kb.value_observable(kb.collectionObservable(value,this.options));if(current_value.collection()!==value)return current_value.collection(value),this.__kb.value_observable.valueHasMutated()},CollectionAttributeConnector.prototype.read=function(){var current_value;return current_value=this.__kb.value_observable(),current_value?current_value():void 0},CollectionAttributeConnector}(kb.AttributeConnector),kb.collectionAttributeConnector=function(model,key,options){return new kb.CollectionAttributeConnector(model,key,options)},kb.ViewModelAttributeConnector=function(_super){function ViewModelAttributeConnector(){return ViewModelAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(ViewModelAttributeConnector,_super),ViewModelAttributeConnector.prototype.destroy=function(){var current_value;return current_value=this.__kb.value_observable(),current_value&&typeof current_value.refCount=="function"&&current_value.refCount()>0&&current_value.release(),ViewModelAttributeConnector.__super__.destroy.apply(this,arguments)},ViewModelAttributeConnector.prototype.update=function(){var current_value,model,value,view_model_options,_this=this;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!current_value)return view_model_options=this.options.options?_.clone(this.options.options):{},view_model_options.store?this.__kb.value_observable(view_model_options.store.resolveValue(value,function(){return _this.options.view_model?new _this.options.view_model(value,view_model_options):_this.options.view_model_create(value,view_model_options)})):this.__kb.value_observable(this.options.view_model?new this.options.view_model(value,view_model_options):this.options.view_model_create(value,view_model_options));if(!current_value.model||typeof current_value.model!="function")throw"kb.viewModelAttributeConnector: unknown how to model a view model";if(current_value.model()!==value)return current_value.model(value),this.__kb.value_observable.valueHasMutated()},ViewModelAttributeConnector}(kb.AttributeConnector),kb.viewModelAttributeConnector=function(model,key,options){return new kb.ViewModelAttributeConnector(model,key,options)},kb.ViewModel=function(_super){function ViewModel(model,options){var key,missing,_i,_len;options==null&&(options={}),ViewModel.__super__.constructor.apply(this,arguments),kb.stats_on&&kb.stats.view_models++,options.store_skip_resolve||kb.Store.resolveFromOptions(options,this),options.store?this.__kb.store=options.store:(this.__kb.store=new kb.Store,this.__kb.store_is_owned=!0),this.__kb._onModelChange=_.bind(this._onModelChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),this.__kb.internals=options.internals,this.__kb.requires=options.requires,this.__kb.children=options.children,this.__kb.create=options.create,this.__kb.read_only=options.read_only,kb.utils.wrappedModel(this,model),Backbone.ModelRef&&model instanceof Backbone.ModelRef&&(this.__kb.model_ref=model,this.__kb.model_ref.retain(),kb.utils.wrappedModel(this,this.__kb.model_ref.getModel()),this.__kb.model_ref.bind("loaded",this.__kb._onModelLoaded),this.__kb.model_ref.bind("unloaded",this.__kb._onModelUnloaded)),this.__kb.model&&this._onModelLoaded(this.__kb.model);if(!this.__kb.internals&&!this.__kb.requires)return this;missing=_.union(this.__kb.internals?this.__kb.internals:[],this.__kb.requires?this.__kb.requires:[]);if(!this.__kb.model_ref||this.__kb.model_ref.isLoaded())missing=_.difference(missing,_.keys(this.__kb.model.attributes));for(_i=0,_len=missing.length;_i<_len;_i++)key=missing[_i],this._updateAttributeConnector(this.__kb.model,key)}return __extends(ViewModel,_super),ViewModel.prototype.__destroy=function(){var model;model=this.__kb.model,kb.utils.wrappedModel(this,null),this._modelUnbind(model),this.__kb.store_is_owned&&this.__kb.store.destroy(),this.__kb.store=null,kb.utils.release(this,!0),ViewModel.__super__.__destroy.apply(this,arguments);if(kb.stats_on)return kb.stats.view_models--},ViewModel.prototype.model=function(new_model){var model;model=kb.utils.wrappedModel(this);if(arguments.length===0)return model;if(new_model===model)return;model&&this._onModelUnloaded(model);if(new_model)return this._onModelLoaded(new_model)},ViewModel.prototype._modelBind=function(model){if(!model)return;model.bind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.bind("add",this.__kb._onModelChange),model.bind("remove",this.__kb._onModelChange),model.bind("update",this.__kb._onModelChange)},ViewModel.prototype._modelUnbind=function(model){if(!model)return;model.unbind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.unbind("add",this.__kb._onModelChange),model.unbind("remove",this.__kb._onModelChange),model.unbind("update",this.__kb._onModelChange)},ViewModel.prototype._onModelLoaded=function(model){var key,_results;kb.utils.wrappedModel(this,model),this._modelBind(model),_results=[];for(key in this.__kb.model.attributes)_results.push(this._updateAttributeConnector(this.__kb.model,key));return _results},ViewModel.prototype._onModelUnloaded=function(model){var key,_results;this._modelUnbind(model),kb.utils.wrappedModel(this,null),_results=[];for(key in model.attributes)_results.push(this._updateAttributeConnector(null,key));return _results},ViewModel.prototype._onModelChange=function(){var key,_results,_results1;if(this.__kb.model._changed){_results=[];for(key in this.__kb.model.attributes)_results.push(this.__kb.model.hasChanged(key)?this._updateAttributeConnector(this.__kb.model,key):void 0);return _results}if(this.__kb.model.changed){_results1=[];for(key in this.__kb.model.changed)_results1.push(this._updateAttributeConnector(this.__kb.model,key));return _results1}},ViewModel.prototype._updateAttributeConnector=function(model,key){var vm_key;return vm_key=this.__kb.internals&&_.contains(this.__kb.internals,key)?"_"+key:key,this[vm_key]=kb.AttributeConnector.createOrUpdate(this[vm_key],model,key,this._createOptions(key))},ViewModel.prototype._createOptions=function(key){var options;if(this.__kb.children){if(this.__kb.children.hasOwnProperty(key))return options=this.__kb.children[key],typeof options=="function"&&(options={view_model:options}),options.options={read_only:this.__kb.read_only,store:this.__kb.store},options;if(this.__kb.children.hasOwnProperty("create"))return{create:this.__kb.children.create,options:{read_only:this.__kb.read_only,store:this.__kb.store}}}else if(this.__kb.create)return{create:this.__kb.create,options:{read_only:this.__kb.read_only,store:this.__kb.store}};return{read_only:this.__kb.read_only,store:this.__kb.store}},ViewModel}(kb.RefCountable),kb.viewModel=function(model,options){return new kb.ViewModel(model,options)}}).call(this);
+*/(function(){var Backbone,Knockback,kb,ko,_,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};_=!this._&&typeof require!="undefined"?require("underscore")._:this._,Backbone=!this.Backbone&&typeof require!="undefined"?require("backbone"):this.Backbone,ko=!this.ko&&typeof require!="undefined"?require("knockout"):this.ko,Knockback=kb=this.Knockback=this.kb=typeof exports!="undefined"?exports:{},kb.VERSION="0.15.3",kb.locale_manager=void 0,kb.stats={collection_observables:0,view_models:0},kb.stats_on=!1,kb.utils={},kb.utils.legacyWarning=function(identifier,remove_version,message){var _base;return kb._legacy_warnings||(kb._legacy_warnings={}),(_base=kb._legacy_warnings)[identifier]||(_base[identifier]=0),kb._legacy_warnings[identifier]++,console.warn("warning: '"+identifier+"' has been deprecated (will be removed in Knockback "+remove_version+"). "+message+".")},kb.utils.wrappedObservable=function(instance,observable){if(arguments.length===1){if(!(instance&&instance.__kb&&instance.__kb.observable))throw"Knockback: instance is not wrapping an observable";return instance.__kb.observable}if(!instance)throw"Knockback: no instance for wrapping a observable";return instance.__kb||(instance.__kb={}),instance.__kb.observable&&instance.__kb.observable.__kb&&(instance.__kb.observable.__kb.instance=null),instance.__kb.observable=observable,observable&&(observable.__kb||(observable.__kb={}),observable.__kb.instance=instance),observable},kb.wrappedObservable=function(instance){return kb.utils.legacyWarning("kb.wrappedObservable","0.16.0","Please use kb.utils.wrappedObservable instead"),kb.utils.wrappedObservable(instance)},kb.utils.observableInstanceOf=function(observable,type){return observable?!observable.__kb||!observable.__kb.instance?!1:observable.__kb.instance instanceof type:!1},kb.utils.wrappedModel=function(view_model,model){if(arguments.length===1)return view_model&&view_model.__kb&&view_model.__kb.hasOwnProperty("model")?view_model.__kb.model:view_model;if(!view_model)throw"Knockback: no view_model for wrapping a model";return view_model.__kb||(view_model.__kb={}),view_model.__kb.model=model,model},kb.viewModelGetModel=kb.vmModel=function(view_model){return kb.utils.legacyWarning("kb.vmModel","0.16.0","Please use kb.utils.wrappedModel instead"),kb.utils.wrappedModel(view_model)},kb.utils.setToDefault=function(obj){var key,observable,_results;if(!obj)return;if(ko.isObservable(obj))return typeof obj.setToDefault=="function"?obj.setToDefault():void 0;if(_.isObject(obj)){_results=[];for(key in obj)observable=obj[key],_results.push(observable&&key!=="__kb"?kb.utils.setToDefault(observable):void 0);return _results}},kb.vmSetToDefault=function(view_model){return kb.utils.legacyWarning("kb.vmSetToDefault","0.16.0","Please use kb.utils.release instead"),kb.utils.setToDefault(view_model)},kb.utils.release=function(obj,keys_only){var key,value;if(!obj)return!1;if(!keys_only&&(ko.isObservable(obj)||obj instanceof kb.Observables||typeof obj.release=="function"||typeof obj.destroy=="function"))return obj.release?obj.release():obj.destroy?obj.destroy():obj.dispose&&obj.dispose(),!0;if(_.isObject(obj)&&typeof obj!="function"){for(key in obj){value=obj[key];if(!value||key==="__kb")continue;kb.utils.release(value)&&(obj[key]=null)}return!0}return!1},kb.vmRelease=function(view_model){return kb.utils.legacyWarning("kb.vmRelease","0.16.0","Please use kb.utils.release instead"),kb.utils.release(view_model)},kb.vmReleaseObservable=function(observable){return kb.utils.legacyWarning("kb.vmReleaseObservable","0.16.0","Please use kb.utils.release instead"),kb.utils.release(observable)},kb.utils.optionsCreateClear=function(options){return delete options.create,delete options.children,delete options.view_model,delete options.view_model_create},kb.utils.optionsCreateOverride=function(options,create_options){return kb.utils.optionsCreateClear(options),_.extend(options,create_options)},kb.RefCountable=function(){function RefCountable(){this.__kb||(this.__kb={}),this.__kb.ref_count=1}return RefCountable.extend=Backbone.Model.extend,RefCountable.prototype.__destroy=function(){},RefCountable.prototype.retain=function(){if(this.__kb.ref_count<=0)throw"RefCountable: ref_count is corrupt: "+this.__kb.ref_count;return this.__kb.ref_count++,this},RefCountable.prototype.release=function(){if(this.__kb.ref_count<=0)throw"RefCountable: ref_count is corrupt: "+this.__kb.ref_count;return this.__kb.ref_count--,this.__kb.ref_count||this.__destroy(),this},RefCountable.prototype.refCount=function(){return this.__kb.ref_count},RefCountable}(),kb.Store=function(){function Store(){this.keys=[],this.values=[]}return Store.prototype.destroy=function(){var index,value,_ref,_ref1;this.keys=null,_ref=this.values;for(index in _ref){value=_ref[index];if(!kb.utils.observableInstanceOf(value,kb.CollectionObservable))continue;this.values[index]=null;while(value.refCount()>0)value.release()}_ref1=this.values;for(index in _ref1){value=_ref1[index];if(!value)continue;this.values[index]=null;if(value instanceof kb.RefCountable)while(value.refCount()>0)value.release();else kb.utils.release(value)}return this.values=null},Store.prototype.registerValue=function(key,value){var index;return value instanceof kb.RefCountable&&value.retain(),index=_.indexOf(this.keys,key),index>=0?this.values[index]=value:(this.keys.push(key),this.values.push(value)),value},Store.prototype.resolveValue=function(key,create_fn,args){var index,value;index=_.indexOf(this.keys,key);if(index>=0){if(this.values[index]){if(!(this.values[index]instanceof kb.RefCountable&&this.values[index].refCount()<=0))return this.values[index]instanceof kb.RefCountable?this.values[index].retain():this.values[index];this.values[index]=null}}else index=this.keys.length,this.keys.push(key),this.values.push(void 0);return value=create_fn.apply(null,Array.prototype.slice.call(arguments,2)),this.keys[index]!==key?this.registerValue(key,value):this.values[index]||(value instanceof kb.RefCountable&&value.retain(),this.values[index]=value),value},Store.prototype.releaseValue=function(value){var index;if(value instanceof kb.RefCountable){value.release();if(value.refCount()>0)return;index=_.indexOf(this.values,value);if(index>=0)return this.values[index]=0;return}return},Store.prototype.addResolverToOptions=function(options,key){return _.extend(options,{store:this,store_key:key})},Store.resolveFromOptions=function(options,value){if(!options.store||!options.store_key)return;return options.store.registerValue(options.store_key,value)},Store}(),kb.CollectionObservable=function(_super){function CollectionObservable(collection,options){var bind_model_changes,observable,_this=this;options==null&&(options={});if(!collection)throw"CollectionObservable: collection is missing";CollectionObservable.__super__.constructor.apply(this,arguments),kb.stats_on&&kb.stats.collection_observables++,ko.isObservable(options)&&options.hasOwnProperty("indexOf")?(kb.utils.legacyWarning("kb.collectionObservable with an external ko.observableArray","0.16.0","Please use the kb.collectionObservable directly instead of passing a ko.observableArray"),observable=kb.utils.wrappedObservable(this,options),options=arguments[2]||{},bind_model_changes=!0):observable=kb.utils.wrappedObservable(this,ko.observableArray([])),options.store_skip_resolve||kb.Store.resolveFromOptions(options,kb.utils.wrappedObservable(this)),options.store?this.__kb.store=options.store:(this.__kb.store=new kb.Store,this.__kb.store_is_owned=!0);if(options.hasOwnProperty("view_model")){if(!options.view_model)throw"kb.CollectionObservable: options.view_model is empty";this.view_model_create_fn=options.view_model,this.view_model_create_with_new=!0}else if(options.hasOwnProperty("view_model_constructor")){if(!options.view_model_constructor)throw"kb.CollectionObservable: options.view_model_constructor is empty";kb.utils.legacyWarning("kb.collectionObservable option view_model_constructor","0.16.0","Please use view_model option instead"),this.view_model_create_fn=options.view_model_constructor,this.view_model_create_with_new=!0}else if(options.hasOwnProperty("view_model_create")){if(!options.view_model_create)throw"kb.CollectionObservable: options.view_model_create is empty";this.view_model_create_fn=options.view_model_create}else if(options.hasOwnProperty("create")){if(!options.create)throw"kb.CollectionObservable: options.create is empty";this.view_model_create_fn=options.create}return this.sort_attribute=options.sort_attribute,this.sorted_index=options.sorted_index,this.__kb._onCollectionReset=_.bind(this._onCollectionReset,this),this.__kb._onCollectionResort=_.bind(this._onCollectionResort,this),this.__kb._onModelAdd=_.bind(this._onModelAdd,this),this.__kb._onModelRemove=_.bind(this._onModelRemove,this),this.__kb._onModelChange=_.bind(this._onModelChange,this),bind_model_changes&&collection&&collection.bind("change",function(){return kb.utils.wrappedObservable(_this).valueHasMutated()}),observable.retain=_.bind(this.retain,this),observable.refCount=_.bind(this.refCount,this),observable.release=_.bind(this.release,this),observable.collection=_.bind(this.collection,this),observable.viewModelByModel=_.bind(this.viewModelByModel,this),observable.sortedIndex=_.bind(this.sortedIndex,this),observable.sortAttribute=_.bind(this.sortAttribute,this),observable.hasViewModels=_.bind(this.hasViewModels,this),observable.bind=_.bind(this.bind,this),observable.unbind=_.bind(this.unbind,this),observable.trigger=_.bind(this.trigger,this),this.collection(collection,{silent:!0,defer:options.defer}),observable}return __extends(CollectionObservable,_super),CollectionObservable.prototype.__destroy=function(){this.collection(null),this.hasViewModels()&&this.__kb.store_is_owned&&(this.__kb.store.destroy(),this.__kb.store=null),this.view_model_create_fn=null,this.__kb.collection=null,kb.utils.wrappedObservable(this,null),CollectionObservable.__super__.__destroy.apply(this,arguments);if(kb.stats_on)return kb.stats.collection_observables--},CollectionObservable.prototype.retain=function(){return CollectionObservable.__super__.retain.apply(this,arguments),kb.utils.wrappedObservable(this)},CollectionObservable.prototype.release=function(){var observable;return observable=kb.utils.wrappedObservable(this),CollectionObservable.__super__.release.apply(this,arguments),observable},CollectionObservable.prototype.collection=function(collection,options){var observable,_base,_base1;observable=kb.utils.wrappedObservable(this);if(arguments.length===0)return observable(),this.__kb.collection;if(collection===this.__kb.collection)return;this.__kb.collection&&(this._clear(),this._collectionUnbind(this.__kb.collection),typeof (_base=this.__kb.collection).release=="function"&&_base.release(),this.__kb.collection=null),this.__kb.collection=collection;if(this.__kb.collection)return typeof (_base1=this.__kb.collection).retain=="function"&&_base1.retain(),this._collectionBind(this.__kb.collection),this.sortedIndex(this.sorted_index,this.sort_attribute,options)},CollectionObservable.prototype.sortedIndex=function(sorted_index,sort_attribute,options){var _resync,_this=this;return options==null&&(options={}),sorted_index?(this.sorted_index=sorted_index,this.sort_attribute=sort_attribute):sort_attribute?(this.sort_attribute=sort_attribute,this.sorted_index=this._sortAttributeFn(sort_attribute)):(this.sort_attribute=null,this.sorted_index=null),_resync=function(){var observable;observable=kb.utils.wrappedObservable(_this);if(_this.__kb.collection.models.length===0&&observable().length===0)return;_this._collectionResync(!0);if(!options.silent)return _this.trigger("resort",observable())},options.defer?_.defer(_resync):_resync(),this},CollectionObservable.prototype.sortAttribute=function(sort_attribute,sorted_index,silent){return this.sortedIndex(sorted_index,sort_attribute,silent)},CollectionObservable.prototype.viewModelByModel=function(model){var id_attribute,observable;return this.hasViewModels()?(observable=kb.utils.wrappedObservable(this),id_attribute=model.hasOwnProperty(model.idAttribute)?model.idAttribute:"cid",_.find(observable(),function(test){return test.__kb.model[id_attribute]===model[id_attribute]})):null},CollectionObservable.prototype.hasViewModels=function(){return!!this.view_model_create_fn},CollectionObservable.prototype._collectionBind=function(collection){var event,_i,_j,_len,_len1,_ref,_ref1;if(!collection)return;collection.bind("reset",this.__kb._onCollectionReset),this.sorted_index||collection.bind("resort",this.__kb._onCollectionResort),_ref=["new","add"];for(_i=0,_len=_ref.length;_i<_len;_i++)event=_ref[_i],collection.bind(event,this.__kb._onModelAdd);_ref1=["remove","destroy"];for(_j=0,_len1=_ref1.length;_j<_len1;_j++)event=_ref1[_j],collection.bind(event,this.__kb._onModelRemove);return collection.bind("change",this.__kb._onModelChange)},CollectionObservable.prototype._collectionUnbind=function(collection){var event,_i,_j,_len,_len1,_ref,_ref1;if(!collection)return;collection.unbind("reset",this.__kb._onCollectionReset),this.sorted_index||collection.unbind("resort",this.__kb._onCollectionResort),_ref=["new","add"];for(_i=0,_len=_ref.length;_i<_len;_i++)event=_ref[_i],collection.unbind(event,this.__kb._onModelAdd);_ref1=["remove","destroy"];for(_j=0,_len1=_ref1.length;_j<_len1;_j++)event=_ref1[_j],collection.unbind(event,this.__kb._onModelRemove);return collection.unbind("change",this.__kb._onModelChange)},CollectionObservable.prototype._onCollectionReset=function(){return this._collectionResync()},CollectionObservable.prototype._onCollectionResort=function(model_or_models){var observable;if(this.sorted_index)throw"CollectionObservable: collection sorted_index unexpected";return _.isArray(model_or_models)?(observable=kb.utils.wrappedObservable(this),this.trigger("resort",observable())):this._onModelResort(model_or_models)},CollectionObservable.prototype._onModelAdd=function(model){var add_index,observable,target;return target=this.hasViewModels()?this._createTarget(model):model,observable=kb.utils.wrappedObservable(this),this.sorted_index?add_index=this.sorted_index(observable(),target):add_index=this.__kb.collection.indexOf(model),observable.splice(add_index,0,target),this.trigger("add",target,observable())},CollectionObservable.prototype._onModelRemove=function(model){var observable,target;target=this.hasViewModels()?this.viewModelByModel(model):model;if(!target)return;observable=kb.utils.wrappedObservable(this),observable.remove(target),this.trigger("remove",target,observable);if(this.hasViewModels())return this.__kb.store.releaseValue(target)},CollectionObservable.prototype._onModelChange=function(model){if(this.sorted_index&&(!this.sort_attribute||model.hasChanged(this.sort_attribute)))return this._onModelResort(model)},CollectionObservable.prototype._onModelResort=function(model){var new_index,observable,previous_index,sorted_targets,target;observable=kb.utils.wrappedObservable(this),target=this.hasViewModels()?this.viewModelByModel(model):model,previous_index=observable.indexOf(target),this.sorted_index?(sorted_targets=_.clone(observable()),sorted_targets.splice(previous_index,1),new_index=this.sorted_index(sorted_targets,target)):new_index=this.__kb.collection.indexOf(model);if(previous_index===new_index)return;return observable.splice(previous_index,1),observable.splice(new_index,0,target),this.trigger("resort",target,observable(),new_index)},CollectionObservable.prototype._clear=function(silent){var observable,target,targets,_i,_len,_results;observable=kb.utils.wrappedObservable(this),silent||this.trigger("remove",observable()),targets=observable.removeAll();if(this.hasViewModels()){_results=[];for(_i=0,_len=targets.length;_i<_len;_i++)target=targets[_i],_results.push(this.__kb.store.releaseValue(target));return _results}},CollectionObservable.prototype._collectionResync=function(silent){var add_index,model,observable,target,targets,_i,_len,_ref,_this=this;this._clear(silent),observable=kb.utils.wrappedObservable(this);if(this.sorted_index){targets=[],_ref=this.__kb.collection.models;for(_i=0,_len=_ref.length;_i<_len;_i++)model=_ref[_i],target=this._createTarget(model),add_index=this.sorted_index(targets,target),targets.splice(add_index,0,target)}else targets=this.hasViewModels()?_.map(this.__kb.collection.models,function(model){return _this._createTarget(model)}):_.clone(this.__kb.collection.models);observable(targets);if(!silent)return this.trigger("add",observable())},CollectionObservable.prototype._sortAttributeFn=function(sort_attribute){return this.hasViewModels()?function(view_models,model){return _.sortedIndex(view_models,model,function(test){return kb.utils.wrappedModel(test).get(sort_attribute)})}:function(models,model){return _.sortedIndex(models,model,function(test){return test.get(sort_attribute)})}},CollectionObservable.prototype._createTarget=function(model){var create_fn,_this=this;return create_fn=function(){var observable,options,view_model;return options=_this.__kb.store.addResolverToOptions({},model),observable=kb.utils.wrappedObservable(_this),view_model=_this.view_model_create_with_new?new _this.view_model_create_fn(model,options,observable):_this.view_model_create_fn(model,options,observable),kb.utils.wrappedModel(view_model,model),view_model},this.hasViewModels()?this.__kb.store.resolveValue(model,create_fn):model},CollectionObservable}(kb.RefCountable),__extends(kb.CollectionObservable.prototype,Backbone.Events),kb.collectionObservable=function(collection,options,legacy){return new kb.CollectionObservable(collection,options,legacy)},kb.sortedIndexWrapAttr=kb.siwa=function(attribute_name,wrapper_constructor){return function(models,model){return _.sortedIndex(models,model,function(test){return new wrapper_constructor(kb.utils.wrappedModel(test).get(attribute_name))})}},kb.DefaultWrapper=function(){function DefaultWrapper(target_observable,default_value_observable){var observable,_this=this;return this.default_value_observable=default_value_observable,this.__kb={},observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:function(){var current_default,current_target;return current_target=ko.utils.unwrapObservable(target_observable()),current_default=ko.utils.unwrapObservable(_this.default_value_observable),current_target?current_target:current_default},write:function(value){return target_observable(value)}})),observable.destroy=_.bind(this.destroy,this),observable.setToDefault=_.bind(this.setToDefault,this),observable}return DefaultWrapper.prototype.destroy=function(){return kb.utils.wrappedObservable(this,null),this.default_value=null},DefaultWrapper.prototype.setToDefault=function(){var observable;return observable=kb.utils.wrappedObservable(this),observable(this.default_value_observable)},DefaultWrapper}(),kb.defaultWrapper=function(target,default_value){return new kb.DefaultWrapper(target,default_value)},kb.toFormattedString=function(format){var arg,args,index,parameter_index,result,value;result=format.slice(),args=Array.prototype.slice.call(arguments,1);for(index in args){arg=args[index],value=ko.utils.unwrapObservable(arg),value||(value=""),parameter_index=format.indexOf("{"+index+"}");while(parameter_index>=0)result=result.replace("{"+index+"}",value),parameter_index=format.indexOf("{"+index+"}",parameter_index+1)}return result},kb.parseFormattedString=function(string,format){var count,format_indices_to_matched_indices,index,match_index,matches,parameter_count,parameter_index,positions,regex,regex_string,results,sorted_positions,_i,_results;regex_string=format.slice(),index=0,parameter_count=0,positions={};while(regex_string.search("\\{"+index+"\\}")>=0){parameter_index=format.indexOf("{"+index+"}");while(parameter_index>=0)regex_string=regex_string.replace("{"+index+"}","(.*)"),positions[parameter_index]=index,parameter_count++,parameter_index=format.indexOf("{"+index+"}",parameter_index+1);index++}count=index,regex=new RegExp(regex_string),matches=regex.exec(string),matches&&matches.shift();if(!matches||matches.length!==parameter_count)return _.map(function(){_results=[];for(var _i=1;1<=count?_i<=count:_i>=count;1<=count?_i++:_i--)_results.push(_i);return _results}.apply(this),function(){return""});sorted_positions=_.sortBy(_.keys(positions),function(parameter_index,format_index){return parseInt(parameter_index,10)}),format_indices_to_matched_indices={};for(match_index in sorted_positions){parameter_index=sorted_positions[match_index],index=positions[parameter_index];if(format_indices_to_matched_indices.hasOwnProperty(index))continue;format_indices_to_matched_indices[index]=match_index}results=[],index=0;while(index<count)results.push(matches[format_indices_to_matched_indices[index]]),index++;return results},kb.FormattedObservable=function(){function FormattedObservable(format,args){var observable,observable_args;return this.__kb={},_.isArray(args)?(format=format,observable_args=args):observable_args=Array.prototype.slice.call(arguments,1),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:function(){var arg,_i,_len;args=[ko.utils.unwrapObservable(format)];for(_i=0,_len=observable_args.length;_i<_len;_i++)arg=observable_args[_i],args.push(ko.utils.unwrapObservable(arg));return kb.toFormattedString.apply(null,args)},write:function(value){var index,matches,max_count,_results;matches=kb.parseFormattedString(value,ko.utils.unwrapObservable(format)),max_count=Math.min(observable_args.length,matches.length),index=0,_results=[];while(index<max_count)observable_args[index](matches[index]),_results.push(index++);return _results}})),observable}return FormattedObservable.prototype.destroy=function(){return kb.utils.wrappedObservable(this,null)},FormattedObservable}(),kb.formattedObservable=function(format,args){return new kb.FormattedObservable(format,Array.prototype.slice.call(arguments,1))},kb.LocalizedObservable=function(){function LocalizedObservable(value,options,view_model){var observable;this.value=value,this.options=options!=null?options:{},this.view_model=view_model!=null?view_model:{};if(!this.options.read&&!this.read)throw"LocalizedObservable: options.read is missing";if(this.options.read&&this.read)throw"LocalizedObservable: options.read and read class function exist. You need to choose one.";if(this.options.write&&this.write)throw"LocalizedObservable: options.write and write class function exist. You need to choose one.";if(!kb.locale_manager)throw"LocalizedObservable: kb.locale_manager is not defined";this.__kb={},this.__kb._onLocaleChange=_.bind(this._onLocaleChange,this),this.value&&(value=ko.utils.unwrapObservable(this.value)),this.__kb.value_observable=ko.observable(value?this.read.call(this,value,null):this._getDefaultValue());if(this.write&&typeof this.write!="function")throw"LocalizedObservable: options.write is not a function for read_write model attribute";return observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this._onGetValue,this),write:this.write?_.bind(this._onSetValue,this):function(){throw"kb.LocalizedObservable: value is read only"},owner:this.view_model})),observable.destroy=_.bind(this.destroy,this),observable.observedValue=_.bind(this.observedValue,this),observable.setToDefault=_.bind(this.setToDefault,this),observable.resetToCurrent=_.bind(this.resetToCurrent,this),kb.locale_manager.bind("change",this.__kb._onLocaleChange),observable}return LocalizedObservable.extend=Backbone.Model.extend,LocalizedObservable.prototype.destroy=function(){return kb.locale_manager.unbind("change",this.__kb._onLocaleChange),this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.options={},this.view_model=null,this.__kb=null},LocalizedObservable.prototype.setToDefault=function(){var current_value,default_value;if(!this["default"])return;return default_value=this._getDefaultValue(),current_value=this.__kb.value_observable(),current_value!==default_value?this._onSetValue(default_value):this.__kb.value_observable.valueHasMutated()},LocalizedObservable.prototype.resetToCurrent=function(){return this.__kb.value_observable(null),this._onSetValue(this._getCurrentValue())},LocalizedObservable.prototype.observedValue=function(value){return arguments.length===0?this.value:(this.value=value,this._onLocaleChange(),this)},LocalizedObservable.prototype._getDefaultValue=function(){return this["default"]?typeof this["default"]=="function"?this["default"]():this["default"]:""},LocalizedObservable.prototype._getCurrentValue=function(){var observable;return observable=kb.utils.wrappedObservable(this),!this.value||!observable?this._getDefaultValue():this.read.call(this,ko.utils.unwrapObservable(this.value))},LocalizedObservable.prototype._onGetValue=function(){return this.value&&ko.utils.unwrapObservable(this.value),this.__kb.value_observable()},LocalizedObservable.prototype._onSetValue=function(value){this.write.call(this,value,ko.utils.unwrapObservable(this.value)),value=this.read.call(this,ko.utils.unwrapObservable(this.value)),this.__kb.value_observable(value);if(this.options.onChange)return this.options.onChange(value)},LocalizedObservable.prototype._onLocaleChange=function(){var value;value=this.read.call(this,ko.utils.unwrapObservable(this.value)),this.__kb.value_observable(value);if(this.options.onChange)return this.options.onChange(value)},LocalizedObservable}(),kb.localizedObservable=function(value,options,view_model){return new kb.LocalizedObservable(value,options,view_model)},kb.Observable=function(){function Observable(model,mapping_info,view_model){var observable,_this=this;this.model=model,this.mapping_info=mapping_info,this.view_model=view_model!=null?view_model:{};if(!this.model)throw"Observable: model is missing";if(!this.mapping_info)throw"Observable: mapping_info is missing";if(_.isString(this.mapping_info)||ko.isObservable(this.mapping_info))this.mapping_info={key:this.mapping_info};if(!this.mapping_info.key)throw"Observable: mapping_info.key is missing";return this.__kb={},this.__kb._onModelChange=_.bind(this._onModelChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),this.mapping_info.hasOwnProperty("write")&&_.isBoolean(this.mapping_info.write)&&(this.mapping_info=_.clone(this.mapping_info),this.mapping_info.read_only=!this.mapping_info.write),Backbone.ModelRef&&this.model instanceof Backbone.ModelRef&&(this.model_ref=this.model,this.model_ref.retain(),this.model_ref.bind("loaded",this.__kb._onModelLoaded),this.model_ref.bind("unloaded",this.__kb._onModelUnloaded),this.model=this.model_ref.getModel()),this.__kb.value_observable=ko.observable(),this.mapping_info.localizer&&(this.__kb.localizer=new this.mapping_info.localizer(this._getCurrentValue())),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this._onGetValue,this),write:this.mapping_info.read_only?function(){throw"kb.Observable: "+_this.mapping_info.key+" is read only"}:_.bind(this._onSetValue,this),owner:this.view_model})),observable.destroy=_.bind(this.destroy,this),observable.setToDefault=_.bind(this.setToDefault,this),(!this.model_ref||this.model_ref.isLoaded())&&this.model.bind("change",this.__kb._onModelChange),observable}return Observable.prototype.destroy=function(){return this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.model&&this.__kb._onModelUnloaded(this.model),this.model_ref&&(this.model_ref.unbind("loaded",this.__kb._onModelLoaded),this.model_ref.unbind("unloaded",this.__kb._onModelUnloaded),this.model_ref.release(),this.model_ref=null),this.mapping_info=null,this.view_model=null,this.__kb=null},Observable.prototype.setToDefault=function(){var value;return value=this._getDefaultValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),this.__kb.value_observable(value)},Observable.prototype._getDefaultValue=function(){return this.mapping_info.hasOwnProperty("default")?typeof this.mapping_info["default"]=="function"?this.mapping_info["default"]():this.mapping_info["default"]:""},Observable.prototype._getCurrentValue=function(){var arg,args,key,_i,_len,_ref;if(!this.model)return this._getDefaultValue();key=ko.utils.unwrapObservable(this.mapping_info.key),args=[key];if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],args.push(ko.utils.unwrapObservable(arg))}else args.push(ko.utils.unwrapObservable(this.mapping_info.args));return this.mapping_info.read?this.mapping_info.read.apply(this.view_model,args):this.model.get.apply(this.model,args)},Observable.prototype._onGetValue=function(){var arg,value,_i,_len,_ref;this.__kb.value_observable(),ko.utils.unwrapObservable(this.mapping_info.key);if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],ko.utils.unwrapObservable(arg)}else ko.utils.unwrapObservable(this.mapping_info.args);return value=this._getCurrentValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),value},Observable.prototype._onSetValue=function(value){var arg,args,set_info,_i,_len,_ref;this.__kb.localizer&&(this.__kb.localizer(value),value=this.__kb.localizer.observedValue());if(this.model){set_info={},set_info[ko.utils.unwrapObservable(this.mapping_info.key)]=value,args=typeof this.mapping_info.write=="function"?[value]:[set_info];if(!_.isUndefined(this.mapping_info.args))if(_.isArray(this.mapping_info.args)){_ref=this.mapping_info.args;for(_i=0,_len=_ref.length;_i<_len;_i++)arg=_ref[_i],args.push(ko.utils.unwrapObservable(arg))}else args.push(ko.utils.unwrapObservable(this.mapping_info.args));typeof this.mapping_info.write=="function"?this.mapping_info.write.apply(this.view_model,args):this.model.set.apply(this.model,args)}return this.__kb.localizer?this.__kb.value_observable(this.__kb.localizer()):this.__kb.value_observable(value)},Observable.prototype._modelBind=function(model){if(!model)return;model.bind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.bind("add",this.__kb._onModelChange),model.bind("remove",this.__kb._onModelChange),model.bind("update",this.__kb._onModelChange)},Observable.prototype._modelUnbind=function(model){if(!model)return;model.unbind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.unbind("add",this.__kb._onModelChange),model.unbind("remove",this.__kb._onModelChange),model.unbind("update",this.__kb._onModelChange)},Observable.prototype._onModelLoaded=function(model){return this.model=model,this._modelBind(model),this._updateValue()},Observable.prototype._onModelUnloaded=function(model){return this.__kb.localizer&&this.__kb.localizer.destroy&&(this.__kb.localizer.destroy(),this.__kb.localizer=null),this._modelUnbind(model),this.model=null},Observable.prototype._onModelChange=function(){if(this.model&&this.model.hasChanged&&!this.model.hasChanged(ko.utils.unwrapObservable(this.mapping_info.key)))return;return this._updateValue()},Observable.prototype._updateValue=function(){var value;return value=this._getCurrentValue(),this.__kb.localizer&&(this.__kb.localizer.observedValue(value),value=this.__kb.localizer()),this.__kb.value_observable(value)},Observable}(),kb.observable=function(model,mapping_info,view_model){return new kb.Observable(model,mapping_info,view_model)},kb.Observables=function(){function Observables(model,mappings_info,view_model,options_or_read_only){var is_string,key,mapping_info,property_name,read_only,_i,_len,_ref,_ref1;if(!model)throw"Observables: model is missing";if(!mappings_info||!_.isObject(mappings_info)&&!_.isArray(mappings_info))throw"Observables: mappings_info is missing";this.__kb||(this.__kb={}),this.__kb.model=model;if(_.isArray(mappings_info)){this.__kb.mappings_info={};for(_i=0,_len=mappings_info.length;_i<_len;_i++)key=mappings_info[_i],this.__kb.mappings_info[key]={}}else this.__kb.mappings_info=mappings_info;this.__kb.view_model=_.isUndefined(view_model)?this:view_model,!_.isUndefined(options_or_read_only)&&options_or_read_only.hasOwnProperty("write")&&(kb.utils.legacyWarning("kb.Observables option.write","0.16.0","Now default is writable so only supply read_only as required"),options_or_read_only.read_only=!options_or_read_only.write,delete options_or_read_only.write);if(!_.isUndefined(options_or_read_only)){read_only=_.isBoolean(options_or_read_only)?options_or_read_only:options_or_read_only.read_only,_ref=this.__kb.mappings_info;for(property_name in _ref)mapping_info=_ref[property_name],is_string=_.isString(mapping_info),is_string?mapping_info=_.isUndefined(read_only)?{key:mapping_info}:{key:mapping_info,read_only:read_only}:!_.isUndefined(read_only)&&!mapping_info.hasOwnProperty("read_only")&&!mapping_info.hasOwnProperty("write")&&(mapping_info.read_only=read_only),mapping_info.hasOwnProperty("key")||(mapping_info.key=property_name),this[property_name]=this.__kb.view_model[property_name]=kb.observable(this.__kb.model,mapping_info,this.__kb.view_model)}else{_ref1=this.__kb.mappings_info;for(property_name in _ref1)mapping_info=_ref1[property_name],mapping_info.hasOwnProperty("write")&&kb.utils.legacyWarning("kb.Observables option.write","0.16.0","Now default is writable so only supply read_only as required"),mapping_info.hasOwnProperty("key")||(mapping_info.key=property_name),this[property_name]=this.__kb.view_model[property_name]=kb.observable(this.__kb.model,mapping_info,this.__kb.view_model)}}return Observables.prototype.destroy=function(){var mapping_info,property_name,_ref;_ref=this.__kb.mappings_info;for(property_name in _ref)mapping_info=_ref[property_name],this.__kb.view_model[property_name]&&this.__kb.view_model[property_name].destroy(),this.__kb.view_model[property_name]=null,this[property_name]=null;return this.__kb.view_model=null,this.__kb.mappings_info=null,this.__kb.model=null},Observables.prototype.setToDefault=function(){var mapping_info,property_name,_ref,_results;_ref=this.__kb.mappings_info,_results=[];for(property_name in _ref)mapping_info=_ref[property_name],_results.push(this.__kb.view_model[property_name].setToDefault());return _results},Observables}(),kb.observables=function(model,mappings_info,view_model,options){return new kb.Observables(model,mappings_info,view_model,options)},kb.TriggeredObservable=function(){function TriggeredObservable(model,event_name){var observable;this.model=model,this.event_name=event_name;if(!this.model)throw"Observable: model is missing";if(!this.event_name)throw"Observable: event_name is missing";return this.__kb={},this.__kb._onValueChange=_.bind(this._onValueChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),Backbone.ModelRef&&this.model instanceof Backbone.ModelRef&&(this.model_ref=this.model,this.model_ref.retain(),this.model_ref.bind("loaded",this.__kb._onModelLoaded),this.model_ref.bind("unloaded",this.__kb._onModelUnloaded),this.model=this.model_ref.getModel()),this.__kb.value_observable=ko.observable(),observable=kb.utils.wrappedObservable(this,ko.dependentObservable(_.bind(this._onGetValue,this))),observable.destroy=_.bind(this.destroy,this),(!this.model_ref||this.model_ref.isLoaded())&&this._onModelLoaded(this.model),observable}return TriggeredObservable.prototype.destroy=function(){return kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null),this.__kb.value_observable=null,this.model&&this._onModelUnloaded(this.model),this.model_ref&&(this.model_ref.unbind("loaded",this.__kb._onModelLoaded),this.model_ref.unbind("unloaded",this.__kb._onModelUnloaded),this.model_ref.release(),this.model_ref=null),this.options=null,this.view_model=null,this.__kb=null},TriggeredObservable.prototype._onGetValue=function(){return this.__kb.value_observable()},TriggeredObservable.prototype._onModelLoaded=function(model){return this.model=model,this.model.bind(this.event_name,this.__kb._onValueChange),this._onValueChange()},TriggeredObservable.prototype._onModelUnloaded=function(){return this.__kb.localizer&&this.__kb.localizer.destroy&&(this.__kb.localizer.destroy(),this.__kb.localizer=null),this.model.unbind(this.event_name,this.__kb._onValueChange),this.model=null},TriggeredObservable.prototype._onValueChange=function(){var current_value;return current_value=this.__kb.value_observable(),current_value!==this.model?this.__kb.value_observable(this.model):this.__kb.value_observable.valueHasMutated()},TriggeredObservable}(),kb.triggeredObservable=function(model,event_name){return new kb.TriggeredObservable(model,event_name)},kb.AttributeConnector=function(){function AttributeConnector(model,key,options){var observable;return this.key=key,this.options=options!=null?options:{},kb.utils.wrappedModel(this,model),this.options=_.clone(this.options),this.__kb.value_observable=ko.observable(),observable=kb.utils.wrappedObservable(this,ko.dependentObservable({read:_.bind(this.read,this),write:_.bind(this.write,this)})),observable.destroy=_.bind(this.destroy,this),observable.model=_.bind(this.model,this),observable.update=_.bind(this.update,this),this.__kb.initializing=!0,this.update(),this.__kb.initializing=!1,observable}return AttributeConnector.prototype.destroy=function(){return this.__kb.value_observable=null,kb.utils.wrappedObservable(this).dispose(),kb.utils.wrappedObservable(this,null)},AttributeConnector.prototype.read=function(){return this.__kb.value_observable()},AttributeConnector.prototype.write=function(value){var model,set_info;model=kb.utils.wrappedModel(this);if(!model)return;if(!this.options.read_only)return set_info={},set_info[this.key]=value,model.set(set_info);if(!this.__kb.initializing)throw"Cannot write a value to a dependentObservable unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."},AttributeConnector.prototype.model=function(new_model){var model;model=kb.utils.wrappedModel(this);if(arguments.length===0)return model;if(model===new_model)return;return kb.utils.wrappedModel(this,new_model),this.update()},AttributeConnector.inferType=function(model,key){var relation,value;return value=model.get(key),value?value instanceof Backbone.Collection?"collection":value instanceof Backbone.Model||Backbone.ModelRef&&value instanceof Backbone.ModelRef?"model":"simple":Backbone.RelationalModel&&model instanceof Backbone.RelationalModel?(relation=_.find(model.getRelations(),function(test){return test.key===key}),relation?relation.collectionKey?"collection":"model":"simple"):"simple"},AttributeConnector.createByType=function(type,model,key,options){var attribute_options;switch(type){case"collection":return attribute_options=options?_.clone(options):{},options.view_model||options.view_model_create||options.children||options.create||(attribute_options.view_model=kb.ViewModel),options.store&&options.store.addResolverToOptions(attribute_options,model.get(key)),kb.collectionAttributeConnector(model,key,attribute_options);case"model":return attribute_options=options?_.clone(options):{},attribute_options.options||(attribute_options.options={}),options.view_model||options.view_model_create||options.children||options.create||(attribute_options.view_model=kb.ViewModel),options.store&&options.store.addResolverToOptions(attribute_options.options,model.get(key)),kb.viewModelAttributeConnector(model,key,attribute_options);default:return kb.simpleAttributeConnector(model,key,options)}},AttributeConnector.createOrUpdate=function(attribute_connector,model,key,options){var attribute_options,value;if(attribute_connector)return kb.utils.observableInstanceOf(attribute_connector,kb.AttributeConnector)&&(attribute_connector.model()!==model?attribute_connector.model(model):attribute_connector.update()),attribute_connector;if(!model)return kb.simpleAttributeConnector(model,key,options);if(options.hasOwnProperty("create")){if(!options.create)throw"kb.AttributeConnector: options.create is empty";return options.create(model,key,options.options||{})}value=model.get(key);if(options.hasOwnProperty("view_model")){if(!options.view_model)throw"kb.AttributeConnector: options.view_model is empty";return new options.view_model(value,options.options||{})}if(options.hasOwnProperty("view_model_create")){if(!options.view_model_create)throw"kb.AttributeConnector: options.view_model_create is empty";return options.view_model_create(value,options.options||{})}if(options.hasOwnProperty("children")){if(!options.children)throw"kb.AttributeConnector: options.children is empty";return typeof options.children=="function"?attribute_options={view_model:options.children}:attribute_options=options.children||{},kb.collectionAttributeConnector(model,key,attribute_options)}return this.createByType(this.inferType(model,key),model,key,options)},AttributeConnector}(),kb.SimpleAttributeConnector=function(_super){function SimpleAttributeConnector(){return SimpleAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(SimpleAttributeConnector,_super),SimpleAttributeConnector.prototype.destroy=function(){return this.current_value=null,SimpleAttributeConnector.__super__.destroy.apply(this,arguments)},SimpleAttributeConnector.prototype.update=function(){var current_value,model,value;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!_.isEqual(current_value,value))return this.__kb.value_observable(value)},SimpleAttributeConnector.prototype.write=function(value){var model;model=kb.utils.wrappedModel(this);if(!model){this.__kb.value_observable(value);return}return SimpleAttributeConnector.__super__.write.apply(this,arguments)},SimpleAttributeConnector}(kb.AttributeConnector),kb.simpleAttributeConnector=function(model,key,options){return new kb.SimpleAttributeConnector(model,key,options)},kb.CollectionAttributeConnector=function(_super){function CollectionAttributeConnector(){return CollectionAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(CollectionAttributeConnector,_super),CollectionAttributeConnector.prototype.destroy=function(){var current_value;return current_value=this.__kb.value_observable(),current_value&&typeof current_value.refCount=="function"&&current_value.refCount()>0&&current_value.release(),CollectionAttributeConnector.__super__.destroy.apply(this,arguments)},CollectionAttributeConnector.prototype.update=function(){var current_value,model,value,_this=this;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!current_value)return this.options.store?this.__kb.value_observable(this.options.store.resolveValue(value,function(){return kb.collectionObservable(value,_this.options)})):this.__kb.value_observable(kb.collectionObservable(value,this.options));if(current_value.collection()!==value)return current_value.collection(value),this.__kb.value_observable.valueHasMutated()},CollectionAttributeConnector.prototype.read=function(){var current_value;return current_value=this.__kb.value_observable(),current_value?current_value():void 0},CollectionAttributeConnector}(kb.AttributeConnector),kb.collectionAttributeConnector=function(model,key,options){return new kb.CollectionAttributeConnector(model,key,options)},kb.ViewModelAttributeConnector=function(_super){function ViewModelAttributeConnector(){return ViewModelAttributeConnector.__super__.constructor.apply(this,arguments),kb.utils.wrappedObservable(this)}return __extends(ViewModelAttributeConnector,_super),ViewModelAttributeConnector.prototype.destroy=function(){var current_value;return current_value=this.__kb.value_observable(),current_value&&typeof current_value.refCount=="function"&&current_value.refCount()>0&&current_value.release(),ViewModelAttributeConnector.__super__.destroy.apply(this,arguments)},ViewModelAttributeConnector.prototype.update=function(){var current_value,model,value,view_model_options,_this=this;model=kb.utils.wrappedModel(this);if(!model)return;value=model.get(this.key),current_value=this.__kb.value_observable();if(!current_value)return view_model_options=this.options.options?_.clone(this.options.options):{},view_model_options.store?this.__kb.value_observable(view_model_options.store.resolveValue(value,function(){return _this.options.view_model?new _this.options.view_model(value,view_model_options):_this.options.view_model_create(value,view_model_options)})):this.__kb.value_observable(this.options.view_model?new this.options.view_model(value,view_model_options):this.options.view_model_create(value,view_model_options));if(!current_value.model||typeof current_value.model!="function")throw"kb.viewModelAttributeConnector: unknown how to model a view model";if(current_value.model()!==value)return current_value.model(value),this.__kb.value_observable.valueHasMutated()},ViewModelAttributeConnector}(kb.AttributeConnector),kb.viewModelAttributeConnector=function(model,key,options){return new kb.ViewModelAttributeConnector(model,key,options)},kb.ViewModel=function(_super){function ViewModel(model,options){var key,missing,_i,_len;options==null&&(options={}),ViewModel.__super__.constructor.apply(this,arguments),kb.stats_on&&kb.stats.view_models++,options.store_skip_resolve||kb.Store.resolveFromOptions(options,this),options.store?this.__kb.store=options.store:(this.__kb.store=new kb.Store,this.__kb.store_is_owned=!0),this.__kb._onModelChange=_.bind(this._onModelChange,this),this.__kb._onModelLoaded=_.bind(this._onModelLoaded,this),this.__kb._onModelUnloaded=_.bind(this._onModelUnloaded,this),this.__kb.internals=options.internals,this.__kb.requires=options.requires,this.__kb.children=options.children,this.__kb.create=options.create,this.__kb.read_only=options.read_only,kb.utils.wrappedModel(this,model),Backbone.ModelRef&&model instanceof Backbone.ModelRef&&(this.__kb.model_ref=model,this.__kb.model_ref.retain(),kb.utils.wrappedModel(this,this.__kb.model_ref.getModel()),this.__kb.model_ref.bind("loaded",this.__kb._onModelLoaded),this.__kb.model_ref.bind("unloaded",this.__kb._onModelUnloaded)),this.__kb.model&&this._onModelLoaded(this.__kb.model);if(!this.__kb.internals&&!this.__kb.requires)return this;missing=_.union(this.__kb.internals?this.__kb.internals:[],this.__kb.requires?this.__kb.requires:[]);if(!this.__kb.model_ref||this.__kb.model_ref.isLoaded())missing=_.difference(missing,_.keys(this.__kb.model.attributes));for(_i=0,_len=missing.length;_i<_len;_i++)key=missing[_i],this._updateAttributeConnector(this.__kb.model,key)}return __extends(ViewModel,_super),ViewModel.prototype.__destroy=function(){var model;model=this.__kb.model,kb.utils.wrappedModel(this,null),this._modelUnbind(model),this.__kb.store_is_owned&&this.__kb.store.destroy(),this.__kb.store=null,kb.utils.release(this,!0),ViewModel.__super__.__destroy.apply(this,arguments);if(kb.stats_on)return kb.stats.view_models--},ViewModel.prototype.model=function(new_model){var model;model=kb.utils.wrappedModel(this);if(arguments.length===0)return model;if(new_model===model)return;model&&this._onModelUnloaded(model);if(new_model)return this._onModelLoaded(new_model)},ViewModel.prototype._modelBind=function(model){if(!model)return;model.bind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.bind("add",this.__kb._onModelChange),model.bind("remove",this.__kb._onModelChange),model.bind("update",this.__kb._onModelChange)},ViewModel.prototype._modelUnbind=function(model){if(!model)return;model.unbind("change",this.__kb._onModelChange);if(Backbone.RelationalModel&&model instanceof Backbone.RelationalModel)return model.unbind("add",this.__kb._onModelChange),model.unbind("remove",this.__kb._onModelChange),model.unbind("update",this.__kb._onModelChange)},ViewModel.prototype._onModelLoaded=function(model){var key,_results;kb.utils.wrappedModel(this,model),this._modelBind(model),_results=[];for(key in this.__kb.model.attributes)_results.push(this._updateAttributeConnector(this.__kb.model,key));return _results},ViewModel.prototype._onModelUnloaded=function(model){var key,_results;this._modelUnbind(model),kb.utils.wrappedModel(this,null),_results=[];for(key in model.attributes)_results.push(this._updateAttributeConnector(null,key));return _results},ViewModel.prototype._onModelChange=function(){var key,_results,_results1;if(this.__kb.model._changed){_results=[];for(key in this.__kb.model.attributes)_results.push(this.__kb.model.hasChanged(key)?this._updateAttributeConnector(this.__kb.model,key):void 0);return _results}if(this.__kb.model.changed){_results1=[];for(key in this.__kb.model.changed)_results1.push(this._updateAttributeConnector(this.__kb.model,key));return _results1}},ViewModel.prototype._updateAttributeConnector=function(model,key){var vm_key;return vm_key=this.__kb.internals&&_.contains(this.__kb.internals,key)?"_"+key:key,this[vm_key]=kb.AttributeConnector.createOrUpdate(this[vm_key],model,key,this._createOptions(key))},ViewModel.prototype._createOptions=function(key){var options;if(this.__kb.children){if(this.__kb.children.hasOwnProperty(key))return options=this.__kb.children[key],typeof options=="function"&&(options={view_model:options}),options.options={read_only:this.__kb.read_only,store:this.__kb.store},options;if(this.__kb.children.hasOwnProperty("create"))return{create:this.__kb.children.create,options:{read_only:this.__kb.read_only,store:this.__kb.store}}}else if(this.__kb.create)return{create:this.__kb.create,options:{read_only:this.__kb.read_only,store:this.__kb.store}};return{read_only:this.__kb.read_only,store:this.__kb.store}},ViewModel}(kb.RefCountable),kb.viewModel=function(model,options){return new kb.ViewModel(model,options)}}).call(this);
2  src/knockback_collection_observable.coffee
View
@@ -1,6 +1,6 @@
###
knockback_collection_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.CollectionObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
6 src/knockback_core.coffee
View
@@ -1,6 +1,6 @@
###
knockback.js 0.15.3
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
@@ -9,14 +9,12 @@
###
# import Underscore, Backbone, and Knockout
-_ = if not @_ and (typeof(require) != 'undefined') then require('underscore') else @_
+_ = if not @_ and (typeof(require) != 'undefined') then require('underscore')._ else @_
Backbone = if not @Backbone and (typeof(require) != 'undefined') then require('backbone') else @Backbone
ko = if not @ko and (typeof(require) != 'undefined') then require('knockout') else @ko
# export or create Knockback namespace and kb alias
Knockback = kb = @Knockback = @kb = if (typeof(exports) != 'undefined') then exports else {}
-
-# Current version.
kb.VERSION = '0.15.3'
# Locale Manager - if you are using localization, set this property.
2  src/knockback_default_wrapper.coffee
View
@@ -1,6 +1,6 @@
###
knockback_default_wrapper.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.DefaultWrapper is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_formatted_observable.coffee
View
@@ -1,6 +1,6 @@
###
knockback_formatted_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.FormattedObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_localized_observable.coffee
View
@@ -1,6 +1,6 @@
###
knockback_localized_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.LocalizedObservable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_observable.coffee
View
@@ -1,6 +1,6 @@
###
knockback_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_observables.coffee
View
@@ -1,6 +1,6 @@
###
knockback_observables.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observables is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_triggered_observable.coffee
View
@@ -1,6 +1,6 @@
###
knockback_triggered_observable.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_utils.coffee
View
@@ -1,6 +1,6 @@
###
knockback_utils.js 0.15.3
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.js is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  src/knockback_view_model.coffee
View
@@ -1,6 +1,6 @@
###
knockback_view_model.js
- (c) 2011 Kevin Malakoff.
+ (c) 2011, 2012 Kevin Malakoff.
Knockback.Observable is freely distributable under the MIT license.
See the following for full license details:
https://github.com/kmalakoff/knockback/blob/master/LICENSE
2  test/_examples/contact.coffee
View
@@ -1,5 +1,5 @@
# import Underscore, Backbone, Knockout, and Knockback
-_ = if not @_ and (typeof(require) != 'undefined') then require('underscore') else @_
+_ = if not @_ and (typeof(require) != 'undefined') then require('underscore')._ else @_
Backbone = if not @Backbone and (typeof(require) != 'undefined') then require('backbone') else @Backbone
ko = if not @ko and (typeof(require) != 'undefined') then require('knockout') else @ko
kb = if not @kb and (typeof(require) != 'undefined') then require('knockback') else @kb
1  test/all_tests.html
View
@@ -33,7 +33,6 @@ <h1 class="qunit-header">Knockback.js - All Tests (Latest)</h1>
<iframe src="knockback_memory_management/test-latest.html" scrolling="auto" frameborder="0"></iframe>
<iframe src="knockback_legacy/test-latest.html" scrolling="auto" frameborder="0"></iframe>
<iframe src="packaging/test-latest.html" scrolling="auto" frameborder="0"></iframe>
- <iframe src="packaging/test-latest.min.html" scrolling="auto" frameborder="0"></iframe>
</div>
<div class="test-block">
<h1 class="qunit-header">Interactive Tests (Legacy)</h1>
2  test/backbone_modelref/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback with Backbone.ModelRef Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-modelref-latest.js"></script>
2  test/backbone_modelref/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback.js with Backbone.ModelRef.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
4 test/backbone_relational/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback with Backbone.Relational Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
@@ -11,7 +11,7 @@
<script type="text/javascript" src="../../knockback.js"></script>
<!-- HELPERS -->
- <script type="text/javascript" src="../../vendor/backbone-relational-0.5.0.js"></script>
+ <script type="text/javascript" src="../../vendor/backbone-relational-latest.js"></script>
<!-- TESTS -->
<link rel="stylesheet" href="../vendor/qunit/qunit.css" type="text/css" media="screen" />
2  test/backbone_relational/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback.js with Backbone-Relational.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
4 test/interactive/test-latest.html
View
@@ -6,10 +6,10 @@
<title>Knockback Interactive Tests</title>
<!-- HELPERS -->
<script type="text/javascript" src="../vendor/qunit/jquery.js"></script>
- <script type="text/javascript" src="../vendor/jquery.tmpl.js"></script>
+ <script type="text/javascript" src="../../vendor/jquery.tmpl.js"></script>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-modelref-latest.js"></script>
2  test/interactive/test-legacy.html
View
@@ -6,7 +6,7 @@
<title>Knockback Interactive Tests</title>
<!-- HELPERS -->
<script type="text/javascript" src="../vendor/qunit/jquery.js"></script>
- <script type="text/javascript" src="../vendor/jquery.tmpl.js"></script>
+ <script type="text/javascript" src="../../vendor/jquery.tmpl.js"></script>
<!-- LIBRARY DEPENDENCIES -->
<script type="text/javascript" src="../../vendor/knockout-1.2.1.debug.js"></script>
2  test/knockback_collection_observable/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.CollectionObservable Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_collection_observable/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_collection_observable.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_formatted_observable/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.FormattedObservable Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_formatted_observable/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_formatted_observable.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_legacy/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback Legacy Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_legacy/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback legacy.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_localized_observable/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.LocalizedObservable Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_localized_observable/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_localized_observable.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
4 test/knockback_memory_management/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback Memory Management Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
@@ -11,7 +11,7 @@
<script type="text/javascript" src="../../knockback.js"></script>
<!-- HELPERS -->
- <script type="text/javascript" src="../../vendor/backbone-relational-0.5.0.js"></script>
+ <script type="text/javascript" src="../../vendor/backbone-relational-latest.js"></script>
<!-- TESTS -->
<link rel="stylesheet" href="../vendor/qunit/qunit.css" type="text/css" media="screen" />
2  test/knockback_memory_management/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback.js memory management")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_observable/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.Observable Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_observable/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_observable.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_observables/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.Observables Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_observables/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_observables.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_triggered_observable/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.TriggeredObservable Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_triggered_observable/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_triggered_observable.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_utils/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback Utils Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_utils/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_core utils")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
2  test/knockback_view_model/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.ViewModel Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_view_model/test-latest.min.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback.ViewModel Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
2  test/knockback_view_model/test.coffee
View
@@ -2,7 +2,7 @@ $(document).ready( ->
module("knockback_view_model.js")
# import Underscore, Backbone, Knockout, and Knockback
- _ = if not window._ and (typeof(require) != 'undefined') then require('underscore') else window._
+ _ = if not window._ and (typeof(require) != 'undefined') then require('underscore')?._ else window._
Backbone = if not window.Backbone and (typeof(require) != 'undefined') then require('backbone') else window.Backbone
ko = if not window.ko and (typeof(require) != 'undefined') then require('knockout') else window.ko
kb = if not window.kb and (typeof(require) != 'undefined') then require('knockback') else window.kb
7 test/packaging/test-latest.html
View
@@ -3,7 +3,7 @@
<head>
<title>Knockback Packaging Test Suite</title>
<!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
+ <script type="text/javascript" src="../../vendor/knockout-latest.js"></script>
<script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
<script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
@@ -15,16 +15,15 @@
<!-- LIBRARY -->
<script type="text/javascript">
window.mock_requires = {};
- window.mock_requires['underscore'] = window._; delete window['_'];
+ window.mock_requires['underscore'] = {_: window._}; delete window['_'];
window.mock_requires['backbone'] = window.Backbone; delete window['Backbone'];
window.mock_requires['knockout'] = window.ko; delete window['ko'];
-
window.require = function(path) { return window.mock_requires[path]; };
window.exports = {};
</script>
<script type="text/javascript" src="../../knockback.js"></script>
<script type="text/javascript">
- window.mock_requires['knockback'] = window['exports']; delete window['exports']
+ window.mock_requires['knockback'] = window['exports']; delete window['exports']; delete window['kb']; delete window['Knockback']
</script>
<!-- HELPERS -->
56 test/packaging/test-latest.min.html
View
@@ -1,56 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Knockback Packaging Test Suite</title>
- <!-- LIBRARY DEPENDENCIES -->
- <script type="text/javascript" src="../../vendor/knockout-2.1.0.debug.js"></script>
- <script type="text/javascript" src="../../vendor/underscore-latest.js"></script>
- <script type="text/javascript" src="../../vendor/backbone-latest.js"></script>
-
- <!-- HELPERS -->
- <script type="text/javascript" src="../vendor/globalize/globalize.js"></script>
- <script type="text/javascript" src="../vendor/globalize/globalize.culture.en-GB.js"></script>
- <script type="text/javascript" src="../vendor/globalize/globalize.culture.fr-FR.js"></script>
-
- <!-- LIBRARY -->
- <script type="text/javascript">
- window.mock_requires = {};
- window.mock_requires['underscore'] = window._; delete window['_'];
- window.mock_requires['backbone'] = window.Backbone; delete window['Backbone'];
- window.mock_requires['knockout'] = window.ko; delete window['ko'];
-
- window.require = function(path) { return window.mock_requires[path]; };
- window.exports = {};
- </script>
- <script type="text/javascript" src="../../knockback.min.js"></script>
- <script type="text/javascript">
- window.mock_requires['knockback'] = window['exports']; delete window['exports']
- </script>
-
- <!-- HELPERS -->
- <script type="text/javascript">
- window.exports = {};
- </script>
- <script type="text/javascript" src="../../test/_examples/build/_examples.js"></script>
- <script type="text/javascript">
- window.mock_requires['knockback-examples'] = window['exports']; delete window['exports']
- </script>
-
- <!-- TESTS -->
- <link rel="stylesheet" href="../vendor/qunit/qunit.css" type="text/css" media="screen" />
- <script type="text/javascript" src="../vendor/qunit/jquery.js"></script>
- <script type="text/javascript" src="../vendor/qunit/qunit.js"></script>
- <script type="text/javascript" src="../vendor/qunit/jslitmus.js"></script>
- <script type="text/javascript" src="../knockback_observable/build/test.js"></script>
- <script type="text/javascript" src="../knockback_view_model/build/test.js"></script>
-</head>
-<body>
- <div>
- <h1 id="qunit-header">Knockback Packaging Test Suite</h1>
- <h2 id="qunit-banner"></h2>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"></ol>
- <br />
- </div>
-</body>
-</html>
5 test/packaging/test-legacy.html
View
@@ -15,16 +15,15 @@
<!-- LIBRARY -->
<script type="text/javascript">
window.mock_requires = {};
- window.mock_requires['underscore'] = window._; delete window['_'];
+ window.mock_requires['underscore'] = {_: window._}; delete window['_'];
window.mock_requires['backbone'] = window.Backbone; delete window['Backbone'];
window.mock_requires['knockout'] = window.ko; delete window['ko'];
-
window.require = function(path) { return window.mock_requires[path]; };
window.exports = {};
</script>
<script type="text/javascript" src="../../knockback.js"></script>
<script type="text/javascript">
- window.mock_requires['knockback'] = window['exports']; delete window['exports']
+ window.mock_requires['knockback'] = window['exports']; delete window['exports']; delete window['kb']; delete window['Knockback']
</script>
<!-- HELPERS -->
2  vendor/backbone-0.5.0.js
View
@@ -29,7 +29,7 @@
// Require Underscore, if we're on the server, and it's not already present.
var _ = root._;
- if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._;
+ if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._._;
// For Backbone's purposes, jQuery or Zepto owns the `$` variable.
var $ = root.jQuery || root.Zepto;
0  vendor/backbone-relational-0.5.0.js → vendor/backbone-relational-latest.js
View
File renamed without changes
0  vendor/knockout-2.1.0.debug.js → vendor/knockout-latest.js
View
File renamed without changes
3,441 vendor/knockout.js
View
0 additions, 3,441 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.