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

1 line
1.2 MiB
JavaScript
Raw Normal View History

2020-02-04 16:48:36 +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(r){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=i,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=function(e){for(var t=e.length,r=new Array(t),i=0;i<t;i++)r[i]=e[i];return r},t.escapeValue=function(e){return e&&e.replace(/['"`\\/:\?&!#$%^()[\]{|}*+;,.<=>@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).root,i=void 0===t?document:t,n=[];e.forEach(function(e,t){for(var r=[];e!==i;)e=e.parentNode,r.unshift(e);n[t]=r}),n.sort(function(e,t){return e.length-t.length});for(var r=n.shift(),o=null,a=function(){var t=r[s],e=n.some(function(e){return!e.some(function(e){return e===t})});if(e)return"break";o=t},s=0,l=r.length;s<l;s++){var u=a();if("break"===u)break}return o},t.getCommonProperties=function(e){var h={classes:[],attributes:{},tag:null};return e.forEach(function(e){var n,i,t,r,o=h.classes,a=h.attributes,s=h.tag;if(void 0!==o){var l=e.getAttribute("class");l?(l=l.trim().split(" "),o.length?(o=o.filter(function(t){return l.some(function(e){return e===t})})).length?h.classes=o:delete h.classes:h.classes=l):delete h.classes}if(void 0!==a&&(n=e.attributes,i=Object.keys(n).reduce(function(e,t){var r=n[t],i=r.name;return r&&"class"!==i&&(e[i]=r.value),e},{}),t=Object.keys(i),r=Object.keys(a),t.length?r.length?(a=r.reduce(function(e,t){var r=a[t];return r===i[t]&&(e[t]=r),e},{}),Object.keys(a).length?h.attributes=a:delete h.attributes):h.attributes=i:delete h.attributes),void 0!==s){var u=e.tagName.toLowerCase();s?u!==s&&delete h.tag:h.tag=u}}),h}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};Array.isArray(t)||(t=t.length?(0,c.convertNodeList)(t):[t]);if(!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")');(0,h.default)(t[0],r);var i=e.replace(/> /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);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!==t.length&&n.unshift(f(a,o,s,t))}n.unshift(i[0]),(i=n)[0]=f("",i[0],i.slice(1).join(" "),t),i[i.length-1]=f(i.slice(0,-1).join(" "),i[i.length-1],"",t);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 e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(g(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[l];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,g(document.querySelectorAll(a),o)&&(i=e),"break"}},l=0,u=s.length;l<u;l++){if("break"===t())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(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var p=i.replace(f.shift(),""