WordPress/wp-includes/js/backbone.min.js

2 lines
24 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
(n=>{var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,i){s.Backbone=n(s,i,t,e)});else if("undefined"!=typeof exports){var t,e=require("underscore");try{t=require("jquery")}catch(t){}n(s,exports,e,t)}else s.Backbone=n(s,{},s._,s.jQuery||s.Zepto||s.ender||s.$)})(function(t,h,b,e){function a(t,e,i,n,s){var r,o=0;if(i&&"object"==typeof i){void 0!==n&&"context"in s&&void 0===s.context&&(s.context=n);for(r=b.keys(i);o<r.length;o++)e=a(t,e,r[o],i[r[o]],s)}else if(i&&l.test(i))for(r=i.split(l);o<r.length;o++)e=t(e,r[o],n,s);else e=t(e,i,n,s);return e}function x(t,e,i){i=Math.min(Math.max(i,0),t.length);for(var n=Array(t.length-i),s=e.length,r=0;r<n.length;r++)n[r]=t[r+i];for(r=0;r<s;r++)t[r+i]=e[r];for(r=0;r<n.length;r++)t[r+s+i]=n[r]}function s(i,n,t,s){b.each(t,function(t,e){n[e]&&(i.prototype[e]=((n,t,s,r)=>{switch(t){case 1:return function(){return n[s](this[r])};case 2:return function(t){return n[s](this[r],t)};case 3:return function(t,e){return n[s](this[r],T(t,this),e)};case 4:return function(t,e,i){return n[s](this[r],T(t,this),e,i)};default:return function(){var t=u.call(arguments);return t.unshift(this[r]),n[s].apply(n,t)}}})(n,t,e,s))})}var o,i=t.Backbone,u=Array.prototype.slice,e=(h.VERSION="1.6.0",h.$=e,h.noConflict=function(){return t.Backbone=i,this},h.emulateHTTP=!1,h.emulateJSON=!1,h.Events={}),l=/\s+/,n=(e.on=function(t,e,i){return this._events=a(n,this._events||{},t,e,{context:i,ctx:this,listening:o}),o&&(((this._listeners||(this._listeners={}))[o.id]=o).interop=!1),this},e.listenTo=function(t,e,i){if(t){var n=t._listenId||(t._listenId=b.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),r=o=s[n],s=(r||(this._listenId||(this._listenId=b.uniqueId("l")),r=o=s[n]=new g(this,t)),c(t,e,i,this));if(o=void 0,s)throw s;r.interop&&r.on(e,i)}return this},function(t,e,i,n){var s,r;return i&&(e=t[e]||(t[e]=[]),s=n.context,r=n.ctx,(n=n.listening)&&n.count++,e.push({callback:i,context:s,ctx:s||r,listening:n})),t}),c=function(t,e,i,n){try{t.on(e,i,n)}catch(t){return t}},r=(e.off=function(t,e,i){return this._events&&(this._events=a(r,this._events,t,e,{context:i,listeners:this._listeners})),this},e.stopListening=function(t,e,i){var n=this._listeningTo;if(n){for(var s=t?[t._listenId]:b.keys(n),r=0;r<s.length;r++){var o=n[s[r]];if(!o)break;o.obj.off(e,i,this),o.interop&&o.off(e,i)}b.isEmpty(n)&&(this._listeningTo=void 0)}return this},function(t,e,i,n){if(t){var s,r=n.context,o=n.listeners,h=0;if(e||r||i){for(s=e?[e]:b.keys(t);h<s.length;h++){var a=t[e=s[h]];if(!a)break;for(var u=[],l=0;l<a.length;l++){var c=a[l];i&&i!==c.callback&&i!==c.callback._callback||r&&r!==c.context?u.push(c):(c=c.listening)&&c.off(e,i)}u.length?t[e]=u:delete t[e]}return t}for(s=b.keys(o);h<s.length;h++)o[s[h]].cleanup()}}),d=(e.once=function(t,e,i){var n=a(d,{},t,e,this.off.bind(this));return this.on(n,e="string"==typeof t&&null==i?void 0:e,i)},e.listenToOnce=function(t,e,i){e=a(d,{},e,i,this.stopListening.bind(this,t));return this.listenTo(t,e)},function(t,e,i,n){var s;return i&&((s=t[e]=b.once(function(){n(e,s),i.apply(this,arguments)}))._callback=i),t}),f=(e.trigger=function(t){if(this._events){for(var e=Math.max(0,arguments.length-1),i=Array(e),n=0;n<e;n++)i[n]=arguments[n+1];a(f,this._events,t,void 0,i)}return this},function(t,e,i,n){var s,r;return t&&(s=t[e],r=t.all,s&&(r=r&&r.slice()),s&&p(s,n),r)&&p(r,[e].concat(n)),t}),p=function(t,e){var i,n=-1,s=t.length,r=e[0],o=e[1],h=e[2];switch(e.length){case 0:for(;++n<s;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r);return;case 2:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o);return;case 3:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o,h);return;default:for(;++n<s;)(i=t[n]).callback.apply(i.ctx,e);return}},g=function(t,e){this.id=t._listenId,this.listener=t,this.obj=e,this.interop=!0,this.count=0,this._events=void 0},m=(g.prototype.on=e.on,g.prototype.off=function(t,e){t=this.interop?(this._events=a(r,thi