WordPress/wp-includes/js/customize-base.min.js

1 line
6.6 KiB
JavaScript
Raw Normal View History

window.wp=window.wp||{},function(a,b){var c,d,e,f,g=Array.prototype.slice;d=function(a,b){var c=f(this,a,b);return c.extend=this.extend,c},e=function(){},f=function(a,c,d){var f;return f=c&&c.hasOwnProperty("constructor")?c.constructor:function(){var b=a.apply(this,arguments);return b},b.extend(f,a),e.prototype=a.prototype,f.prototype=new e,c&&b.extend(f.prototype,c),d&&b.extend(f,d),f.prototype.constructor=f,f.__super__=a.prototype,f},c={},c.Class=function(a,d,e){var f,g=arguments;return a&&d&&c.Class.applicator===a&&(g=d,b.extend(this,e||{})),f=this,this.instance&&(f=function(){return f.instance.apply(f,arguments)},b.extend(f,this)),f.initialize.apply(f,g),f},c.Class.applicator={},c.Class.prototype.initialize=function(){},c.Class.prototype.extended=function(a){for(var b=this;"undefined"!=typeof b.constructor;){if(b.constructor===a)return!0;if("undefined"==typeof b.constructor.__super__)return!1;b=b.constructor.__super__}return!1},c.Class.extend=d,c.Events={trigger:function(a){return this.topics&&this.topics[a]&&this.topics[a].fireWith(this,g.call(arguments,1)),this},bind:function(a){return this.topics=this.topics||{},this.topics[a]=this.topics[a]||b.Callbacks(),this.topics[a].add.apply(this.topics[a],g.call(arguments,1)),this},unbind:function(a){return this.topics&&this.topics[a]&&this.topics[a].remove.apply(this.topics[a],g.call(arguments,1)),this}},c.Value=c.Class.extend({initialize:function(a,c){this._value=a,this.callbacks=b.Callbacks(),b.extend(this,c||{}),this.set=b.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(a){var b=this._value;return a=this._setter.apply(this,arguments),a=this.validate(a),null===a||this._value===a?this:(this._value=a,this.callbacks.fireWith(this,[a,b]),this)},_setter:function(a){return a},setter:function(a){var b=this.get();return this._setter=a,this._value=null,this.set(b),this},resetSetter:function(){return this._setter=this.constructor.prototype._setter,this.set(this.get()),this},validate:function(a){return a},bind:function(){return this.callbacks.add.apply(this.callbacks,arguments),this},unbind:function(){return this.callbacks.remove.apply(this.callbacks,arguments),this},link:function(){var a=this.set;return b.each(arguments,function(){this.bind(a)}),this},unlink:function(){var a=this.set;return b.each(arguments,function(){this.unbind(a)}),this},sync:function(){var a=this;return b.each(arguments,function(){a.link(this),this.link(a)}),this},unsync:function(){var a=this;return b.each(arguments,function(){a.unlink(this),this.unlink(a)}),this}}),c.Values=c.Class.extend({defaultConstructor:c.Value,initialize:function(a){b.extend(this,a||{}),this._value={},this._deferreds={}},instance:function(a){return 1===arguments.length?this.value(a):this.when.apply(this,arguments)},value:function(a){return this._value[a]},has:function(a){return"undefined"!=typeof this._value[a]},add:function(a,b){return this.has(a)?this.value(a):(this._value[a]=b,b.parent=this,b.extended(c.Value)&&b.bind(this._change),this.trigger("add",b),this._deferreds[a]&&this._deferreds[a].resolve(),this._value[a])},create:function(a){return this.add(a,new this.defaultConstructor(c.Class.applicator,g.call(arguments,1)))},each:function(a,c){c="undefined"==typeof c?this:c,b.each(this._value,function(b,d){a.call(c,d,b)})},remove:function(a){var b;this.has(a)&&(b=this.value(a),this.trigger("remove",b),b.extended(c.Value)&&b.unbind(this._change),delete b.parent),delete this._value[a],delete this._deferreds[a]},when:function(){var a=this,c=g.call(arguments),d=b.Deferred();return b.isFunction(c[c.length-1])&&d.done(c.pop()),b.when.apply(b,b.map(c,function(c){return a.has(c)?void 0:a._deferreds[c]=a._deferreds[c]||b.Deferred()})).done(function(){var e=b.map(c,function(b){return a(b)});return e.length!==c.length?void a.when.apply(a,c).done(function(){d.resolveWith(a,e)}):void d.resolveWith(a,e)}),d.promise()},_change:function(){this.parent.trigger("change",this)}}),b.extend(c.Values.prototype,c.Events),c.ensure=function(a){return"st