text: // Sightglass.js
  // version: 0.7.2
  // author: Michael Richards
  // license: MIT
  (function(){function t(t,i,s,n){return new e(t,i,s,n)}function e(t,e,s,n){this.options=n||{},this.options.adapters=this.options.adapters||{},this.obj=t,this.keypath=e,this.callback=s,this.objectPath=[],this.parse(),i(this.target=this.realize())&&this.set(!0,this.key,this.target,this.callback)}function i(t){return"object"==typeof t&&null!==t}function s(t){throw new Error("[sightglass] "+t)}t.adapters={},e.tokenize=function(t,e,i){for(tokens=[],current={i:i,path:""},index=0;index<t.length;index++)chr=t.charAt(index),~e.indexOf(chr)?(tokens.push(current),current={i:chr,path:""}):current.path+=chr;return tokens.push(current),tokens},e.prototype.parse=function(){interfaces=this.interfaces(),interfaces.length||s("Must define at least one adapter interface."),~interfaces.indexOf(this.keypath[0])?(root=this.keypath[0],path=this.keypath.substr(1)):("undefined"==typeof(root=this.options.root||t.root)&&s("Must define a default root adapter."),path=this.keypath),this.tokens=e.tokenize(path,interfaces,root),this.key=this.tokens.pop()},e.prototype.realize=function(){return current=this.obj,unreached=!1,this.tokens.forEach(function(t,e){i(current)?("undefined"!=typeof this.objectPath[e]?current!==(prev=this.objectPath[e])&&(this.set(!1,t,prev,this.update.bind(this)),this.set(!0,t,current,this.update.bind(this)),this.objectPath[e]=current):(this.set(!0,t,current,this.update.bind(this)),this.objectPath[e]=current),current=this.get(t,current)):(unreached===!1&&(unreached=e),(prev=this.objectPath[e])&&this.set(!1,t,prev,this.update.bind(this)))},this),unreached!==!1&&this.objectPath.splice(unreached),current},e.prototype.update=function(){(next=this.realize())!==this.target&&(i(this.target)&&this.set(!1,this.key,this.target,this.callback),i(next)&&this.set(!0,this.key,next,this.callback),oldValue=this.value(),this.target=next,this.value()!==oldValue&&this.callback())},e.prototype.value=function(){return i(this.target)?this.get(this.key,this.target):void 0},e.prototype.setValue=function(t){i(this.target)&&this.adapter(this.key).set(this.target,this.key.path,t)},e.prototype.get=function(t,e){return this.adapter(t).get(e,t.path)},e.prototype.set=function(t,e,i,s){action=t?"observe":"unobserve",this.adapter(e)[action](i,e.path,s)},e.prototype.interfaces=function(){return interfaces=Object.keys(this.options.adapters),Object.keys(t.adapters).forEach(function(t){~interfaces.indexOf(t)||interfaces.push(t)}),interfaces},e.prototype.adapter=function(e){return this.options.adapters[e.i]||t.adapters[e.i]},e.prototype.unobserve=function(){this.tokens.forEach(function(t,e){(obj=this.objectPath[e])&&this.set(!1,t,obj,this.update.bind(this))},this),i(this.target)&&this.set(!1,this.key,this.target,this.callback)},"undefined"!=typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define([],function(){return t}):this.sightglass=t}).call(this);
  