woocommerce/assets/js/selectWoo/selectWoo.full.min.js

16 lines
75 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
/*!
* SelectWoo 1.0.10
* https://github.com/woocommerce/selectWoo
*
* Released under the MIT license
* https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
*/
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(t){var e,n,p,s,r,h,f,g,m,y,v,i,o,w,a,a=(t&&t.fn&&t.fn.select2&&t.fn.select2.amd&&(u=t.fn.select2.amd),u&&u.requirejs||(u?n=u:u={},g={},m={},y={},v={},i=Object.prototype.hasOwnProperty,o=[].slice,w=/\.js$/,h=function(e,t){var n,i,o=c(e),s=o[0],t=t[1];return e=o[1],s&&(n=x(s=l(s,t))),s?e=n&&n.normalize?n.normalize(e,(i=t,function(e){return l(e,i)})):l(e,t):(s=(o=c(e=l(e,t)))[0],e=o[1],s&&(n=x(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},f={require:function(e){return b(e)},exports:function(e){var t=g[e];return void 0!==t?t:g[e]={}},module:function(e){return{id:e,uri:"",exports:g[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},s=function(e,t,n,i){var o,s,r,a,l,c=[],u=typeof n,d=A(i=i||e);if("undefined"==u||"function"==u){for(t=!t.length&&n.length?["require","exports","module"]:t,a=0;a<t.length;a+=1)if("require"===(s=(r=h(t[a],d)).f))c[a]=f.require(e);else if("exports"===s)c[a]=f.exports(e),l=!0;else if("module"===s)o=c[a]=f.module(e);else if(_(g,s)||_(m,s)||_(v,s))c[a]=x(s);else{if(!r.p)throw new Error(e+" missing "+s);r.p.load(r.n,b(i,!0),function(t){return function(e){g[t]=e}}(s),{}),c[a]=g[s]}u=n?n.apply(g[e],c):undefined,e&&(o&&o.exports!==p&&o.exports!==g[e]?g[e]=o.exports:u===p&&l||(g[e]=u))}else e&&(g[e]=n)},e=n=r=function(e,t,n,i,o){if("string"==typeof e)return f[e]?f[e](t):x(h(e,A(t)).f);if(!e.splice){if((y=e).deps&&r(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=p}return t=t||function(){},"function"==typeof n&&(n=i,i=o),i?s(p,e,t,n):setTimeout(function(){s(p,e,t,n)},4),r},r.config=function(e){return r(e)},e._defined=g,(a=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),_(g,e)||_(m,e)||(m[e]=[e,t,n])}).amd={jQuery:!0},u.requirejs=e,u.require=n,u.define=a),u.define("almond",function(){}),u.define("jquery",[],function(){var e=t||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),u.define("select2/utils",["jquery"],function(s){var e={};function c(e){var t,n=e.prototype,i=[];for(t in n){"function"==typeof n[t]&&"constructor"!==t&&i.push(t)}return i}e.Extend=function(e,t){var n,i={}.hasOwnProperty;function o(){this.constructor=e}for(n in t)i.call(t,n)&&(e[n]=t[n]);return o.prototype=t.prototype,e.prototype=new o,e.__super__=t.prototype,e},e.Decorate=function(i,o){var e=c(o),t=c(i);function s(){var e=Array.prototype.unshift,t=o.prototype.constructor.length,n=i.prototype.constructor;0<t&&(e.call(arguments,i.prototype.constructor),n=o.prototype.constructor),n.apply(this,arguments)}o.displayName=i.displayName,s.prototype=new function(){this.constructor=s};for(var n=0;n<t.length;n++){var r=t[n];s.prototype[r]=i.prototype[r]}for(var a=0;a<e.length;a++){var l=e[a];s.prototype[l]=function(e){var t=function(){};e in s.prototype&&(t=s.prototype[e]);var n=o.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}(l)}return s};var t=function(){this.listeners={}};return t.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},t.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},t.prototype.invoke=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n].apply(this,t)},e.Observable=t,e.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},e.bind=function(e,t){return function(){e.apply(t,argume
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
a=function(u){var d,p,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],h=Array.prototype.slice;if(u.event.fixHooks)for(var n=e.length;n;)u.event.fixHooks[e[--n]]=u.event.mouseHooks;var f=u.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;u.data(this,"mousewheel-line-height",f.getLineHeight(this)),u.data(this,"mousewheel-page-height",f.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;u.removeData(this,"mousewheel-line-height"),u.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=u(e),e=t["offsetParent"in u.fn?"offsetParent":"parent"]();return e.length||(e=u("body")),parseInt(e.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return u(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=h.call(arguments,1),o=0,s=0,r=0,a=0,l=0,c=0;if((e=u.event.fix(n)).type="mousewheel","detail"in n&&(r=-1*n.detail),"wheelDelta"in n&&(r=n.wheelDelta),"wheelDeltaY"in n&&(r=n.wheelDeltaY),"wheelDeltaX"in n&&(s=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(s=-1*r,r=0),o=0===r?s:r,"deltaY"in n&&(o=r=-1*n.deltaY),"deltaX"in n&&(s=n.deltaX,0===r&&(o=-1*s)),0!==r||0!==s)return 1===n.deltaMode?(o*=t=u.data(this,"mousewheel-line-height"),r*=t,s*=t):2===n.deltaMode&&(o*=t=u.data(this,"mousewheel-page-height"),r*=t,s*=t),a=Math.max(Math.abs(r),Math.abs(s)),(!p||a<p)&&m(n,p=a)&&(p/=40),m(n,a)&&(o/=40,s/=40,r/=40),o=Math[1<=o?"floor":"ceil"](o/p),s=Math[1<=s?"floor":"ceil"](s/p),r=Math[1<=r?"floor":"ceil"](r/p),f.settings.normalizeOffset&&this.getBoundingClientRect&&(a=this.getBoundingClientRect(),l=e.clientX-a.left,c=e.clientY-a.top),e.deltaX=s,e.deltaY=r,e.deltaFactor=p,e.offsetX=l,e.offsetY=c,e.deltaMode=0,i.unshift(e,o,s,r),d&&clearTimeout(d),d=setTimeout(g,200),(u.event.dispatch||u.event.handle).apply(this,i)}function g(){p=null}function m(e,t){return f.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}u.fn.extend({mousewheel:function(e){return e?this.on("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.off("mousewheel",e)}})},"function"==typeof u.define&&u.define.amd?u.define("jquery-mousewheel",["jquery"],a):"object"==typeof exports?module.exports=a:a(t),u.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(o,e,s,t){var r;return null==o.fn.selectWoo&&(r=["open","close","destroy"],o.fn.selectWoo=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=o.extend(!0,{},t);new s(o(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=o(this).data("select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1<o.inArray(t,r)?this:n}),null!=o.fn.select2&&null!=o.fn.select2.defaults&&(o.fn.selectWoo.defaults=o.fn.select2.defaults),null==o.fn.selectWoo.defaults&&(o.fn.selectWoo.defaults=t),o.fn.select2=o.fn.select2||o.fn.selectWoo,s}),{define:u.define,require:u.require});function _(e,t){return i.call(e,t)}function l(e,t){var n,i,o,s,r,a,l,c,u,d,p=t&&t.split("/"),h=y.map,f=h&&h["*"]||{};if(e){for(t=(e=e.split("/")).length-1,y.nodeIdCompat&&w.test(e[t])&&(e[t]=e[t].replace(w,"")),"."===e[0].charAt(0)&&p&&(e=p.slice(0,p.length-1).concat(e)),c=0;c<e.length;c++)"."===(d=e[c])?(e.splice(c,1),--c):".."===d&&(0===c||1===c&&".."===e[2]||".."===e[c-1]||0<c&&(e.splice(c-1,2),c-=2));e=e.join("/")}if((p||f)&&h){for(c=(n=e.split("/")).length;0<c;--c){if(i=n.slice(0,c).join("/"),p)for(u=p.length;0<u;--u)if(o=(o=h[p.slice(0,u).join("/")])&&o[i]){s=o,r=c;break}if(s)break;!a&&f&