iwmlib/dist/iwmlib.3rdparty.min.js

1 line
1.2 MiB
JavaScript
Raw Normal View History

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