iwmlib/3rdparty/optimal-select.min.js

2 lines
10 KiB
JavaScript
Raw Permalink Normal View History

2019-03-21 09:57:27 +01:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,r){"use strict";function n(e){for(var t=e.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return r}function o(e){return e&&e.replace(/['"`\\\/:\?&!#$%^()[\]{|}*+;,.<=>@~]/g,"\\$&").replace(/\n/g,"A")}Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=n,t.escapeValue=o},function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.root,n=void 0===r?document:r,o=[];e.forEach(function(e,t){for(var r=[];e!==n;)e=e.parentNode,r.unshift(e);o[t]=r}),o.sort(function(e,t){return e.length-t.length});for(var u=o.shift(),i=null,l=function(){var e=u[a],t=o.some(function(t){return!t.some(function(t){return t===e})});return t?"break":void(i=e)},a=0,c=u.length;a<c;a++){var f=l();if("break"===f)break}return i}function o(e){var t={classes:[],attributes:{},tag:null};return e.forEach(function(e){var r=t.classes,n=t.attributes,o=t.tag;if(void 0!==r){var u=e.getAttribute("class");u?(u=u.trim().split(" "),r.length?(r=r.filter(function(e){return u.some(function(t){return t===e})}),r.length?t.classes=r:delete t.classes):t.classes=u):delete t.classes}if(void 0!==n&&!function(){var r=e.attributes,o=Object.keys(r).reduce(function(e,t){var n=r[t],o=n.name;return n&&"class"!==o&&(e[o]=n.value),e},{}),u=Object.keys(o),i=Object.keys(n);u.length?i.length?(n=i.reduce(function(e,t){var r=n[t];return r===o[t]&&(e[t]=r),e},{}),Object.keys(n).length?t.attributes=n:delete t.attributes):t.attributes=o:delete t.attributes}(),void 0!==o){var i=e.tagName.toLowerCase();o?i!==o&&delete t.tag:t.tag=i}}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=n,t.getCommonProperties=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Array.isArray(t)||(t=t.length?(0,c.convertNodeList)(t):[t]),!t.length||t.some(function(e){return 1!==e.nodeType}))throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing "elements")');var n=(0,a.default)(t[0],r),o=e.replace(/> /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(o.length<2)return u("",e,"",t);for(var i=[o.pop()];o.length>1;){var l=o.pop(),f=o.join(" "),s=i.join(" "),d=f+" "+s,p=document.querySelectorAll(d);p.length!==t.length&&i.unshift(u(f,l,s,t))}return i.unshift(o[0]),o=i,o[0]=u("",o[0],o.slice(1).join(" "),t),o[o.length-1]=u(o.slice(0,-1).join(" "),o[o.length-1],"",t),n&&delete!0,o.join(" ").replace(/>/g,"> ").trim()}function u(e,t,r,n){if(e.length&&(e+=" "),r.length&&(r=" "+r),/\[*\]/.test(t)){var o=t.replace(/=.*$/,"]"),u=""+e+o+r,l=document.querySelectorAll(u);if(i(l,n))t=o;else for(var a=document.querySelectorAll(""+e+o),c=function(){var o=a[f];if(n.some(function(e){return o.contains(e)})){var c=o.tagName.toLowerCase();return u=""+e+c+r,l=document.querySelectorAll(u),i(l,n)&&(t=c),"break"}},f=0,s=a.length;f<s;f++){var u,l,d=c();if("break"===d)break}}if(/>/.test(t)){var p=t.replace(/>/,""),u=""+e+p+r,l=document.querySelectorAll(u);i(l,n)&&(t=p)}if(/:nth-child/.test(t)){var v=t.replace(/nth-child/g,"nth-of-type"),u=""+e+v+r,l=document.querySelectorAll(u);i(l,n)&&(t=v)}if(/\.\S+\.\S+/.test(t)){for(var y=t.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});y.length;){var g=t.replace(y.sh
//# sourceMappingURL=optimal-select.min.js.map