webicon
Version:
Icon library
2 lines • 25.1 kB
JavaScript
!function(t,n){"use strict";function e(t){function n(t,o){var r,c;if(!o){if(!e[t])throw r=new Error('Cannot found service provider "'+t+'"'),console.error(r),r;if(!i.hasOwnProperty(t))try{i[t]=new e[t](n)}catch(r){throw console.error(r),r}return i[t]}if(i.hasOwnProperty(t))throw r=new Error('Cannot override instantiated service "'+t+'"'),console.error(r),r;return"function"!=typeof o?void console.error('Provider "'+t+'" is not a function'):void(e.hasOwnProperty(t)?(c=e[t],e[t]=function(t){return new o(t,new c(t))}):e[t]=o)}var e={},i={};return Object.keys(o.providers).forEach(function(t){e[t]=o.providers[t]}),n.has=function(t){return e.hasOwnProperty(t)},n("ready",function(t){return function(n){"function"==typeof n?n(t):n&&console.error("Ready listener not a function")}}),t&&("function"==typeof t?t(n):console.error("Injector initializer not a function")),(r.listeners||[]).forEach(function(t){t(n)}),n}function o(t,n){var e,r;return r=o.providers=o.providers||{},"function"!=typeof n?void console.error('Provider "'+t+'" is not a function'):void(r.hasOwnProperty(t)?(e=r[t],r[t]=function(t){return new n(t,new e(t))}):r[t]=n)}function r(t){var n;n=r.listeners=r.listeners||[],"function"==typeof t?n.push(t):t&&console.error("Ready listener not a function")}o("AbstractCssClassIcon",function(t){function n(t,n){e.call(this,t),this.className=n}var e=t("AbstractIcon"),o=t("inherit");return o(n,e,{render:function(t){function n(){return t.attr("class").split(/\s+/)}function o(t){var e=n();return t=t||[],e.filter(function(n){return-1==t.indexOf(n)})}var r,i,c;return c=e.prototype.render.call(this,t),r=n(),t.addClass(this.className),i=o(r).join(" "),function(){t.removeClass(i),c&&c()}}})}),o("AbstractElementIcon",function(t){function n(t,n){e.call(this,t),this.element=n}var e=t("AbstractIcon"),o=t("inherit");return o(n,e,{cloneNode:function(){return this.element[0].cloneNode(!0)},render:function(t){var n;return n=e.prototype.render.call(this,t),t.append(this.cloneNode()),function(){for(;t.firstChild;)t.removeChild(t.firstChild);n&&n()}}})}),o("AbstractIcon",function(t){function n(t){this.iconClassName=t}return n.prototype={render:function(t){var n=this.iconClassName;return t.addClass(n),function(){t.removeClass(n)}}},n}),o("FontIcon",function(t){function n(t){var n="font-webicon";e.call(this,n,t)}var e=t("AbstractCssClassIcon"),o=t("inherit");return o(n,e)}),o("ImageIcon",function(t){function n(t){var n="image-webicon";t.attr({width:"100%",height:"100%"}),t.css({"pointer-events":"none",display:"inline-block"}),e.call(this,n,t)}var e=t("AbstractElementIcon"),o=t("inherit");return n.loadByUrl=function(e){var o,r,i=t("buildUrlParams"),c=t("nodeWrapper"),s=t("Promise"),u=e;return"object"==typeof e&&(u=e.url,o=i(e.params),o&&(u=[u,o].join("?"))),new s(function(t,e){r=c("<img>"),r.bind("load",function(){t(new n(r))}),r.bind("error",e),r.attr("src",u)})},o(n,e)}),o("SpriteIcon",function(t){function n(t){var n="sprite-webicon";e.call(this,n,t)}var e=t("AbstractCssClassIcon"),o=t("inherit");return o(n,e)}),o("SvgIcon",function(t){function n(n,o){var r,i,c,s,u,a,l,f,h,p,d="svg-webicon",v=t("nodeWrapper"),g=t("iconManager"),I=t("parseSvgOptions");if(o=I(o),["id","x","y"].forEach(function(t){n.removeAttr(t)}),h=n[0],"svg"!=h.tagName)if("symbol"==h.tagName){for(r=v('<svg xmlns="http://www.w3.org/2000/svg">'),i=r[0],c=h.attributes,a=0;a<c.length;a++)i.setAttribute(c[a].name,c[a].value);n=r.append(v(h).children())}else n=v('<svg xmlns="http://www.w3.org/2000/svg">').append(n);h=n[0],u={xmlns:"http://www.w3.org/2000/svg",version:"1.0"},Object.keys(u).forEach(function(t){h.getAttribute(t)||h.setAttribute(t,u[t])}),p=o.iconSize||g.getDefaultSvgIconSize(),c={fit:"",height:"100%",width:"100%",preserveAspectRatio:"xMidYMid meet",viewBox:h.getAttribute("viewBox")||o.viewBox},c.viewBox||(l=h.getAttribute("width"),f=h.getAttribute("height"),null!==l&&null!==f&&(c.viewBox="0 0 "+parseFloat(l)+" "+parseFloat(f))),c.viewBox=c.viewBox||"0 0 "+p+" "+p,Object.keys(c).forEach(function(t){h.setAttribute(t,c[t])}),s={"pointer-events":"none",display:"inline-block"},Object.keys(s).forEach(function(t){h.style[t]=s[t]}),this.iconSize=p,e.call(this,d,n)}var e=t("AbstractElementIcon"),o=t("inherit");return n.loadByUrl=function(e,o){var r=t("loadSvgByUrl");return r(e).then(function(t){return new n(t,o)})},o(n,e)}),o("AbstractCssClassIconSetScope",function(t){function n(t,n,r){o.call(this,t,r),this._classResolver=e(n)}function e(t){var n;return"function"==typeof t?t:(t=(t||"")+"",n=t.split(/[?%]/),function(t){return n.join(t)})}var o=t("AbstractScope"),r=t("inherit");return r(n,o,{_resolveCssClass:function(t,n){return this._classResolver(t,n)}})}),o("AbstractRemoteResourceScope",function(n){function e(t,n,e){r.call(this,t,e),this._urlResolver=o(n),this._preloadable=this.options.preloadable||"undefined"==typeof this.options.preloadable,this._cache=null,this._resource=null}function o(e){var o,r,i=n("mergeObjects"),c=null;return o&&"object"==typeof o?(o=e.url,c=e.params):o=e,r="function"==typeof o?o:function(){return o},function(){var n,e,o=null;return n=r.apply(null,Array.prototype.slice.call(arguments)),e=n,n&&"object"==typeof n&&(e=n.url,o=n.params),e=String(e||""),"//"===e.slice(0,2)&&(e=t.document.location.protocol+e),{url:e,params:i({},c||{},o||{})}}}var r=n("AbstractScope"),i=n("inherit");return i(e,r,{preload:function(t){return this._preloadable||t?this._getResource():null},_resolveUrl:function(t){return this._urlResolver(t)},_getResource:function(){var t,n=this;return this._cache?this._cache:(t=this._cache=this._loadResource(),t.then(function(t){n._resource=t},function(){n._cache=null}),t)},_loadResource:function(){var t=n("Promise");return t.reject()}})}),o("AbstractRemoteSvgResourceScope",function(t){function n(t,n,o){var i=r(o),c=this;e.call(this,t,n,o),Object.keys(i).forEach(function(t){c.options[t]=i[t]})}var e=t("AbstractRemoteResourceScope"),o=t("inherit"),r=t("parseSvgOptions");return o(n,e)}),o("AbstractScope",function(t){function n(t,n){n=n&&"object"==typeof n?n:{},this.id=t,this.options=n,this._iconIdParser=e(n.iconIdParser),this._iconIdResolver=e(n.iconIdResolver)}function e(t){return"function"==typeof t?t:function(t){return t}}return n.prototype={preload:function(){return null},hasIcon:function(){return!0},_parseIconId:function(t,n){return this._iconIdParser(t,n)},_resolveIconId:function(t){return this._iconIdResolver(t)}},n}),o("FontIconSetScope",function(t){function n(t,n,o){e.call(this,t,n,o)}var e=t("AbstractCssClassIconSetScope"),o=t("inherit");return o(n,e,{getIcon:function(n,e){var o=t("FontIcon");return new o(this._resolveCssClass(this._parseIconId(n,e),e))}})}),o("ImageIconScope",function(t){function n(t,n,o){e.call(this,t,n,o)}var e=t("AbstractRemoteResourceScope"),o=t("inherit");return o(n,e,{_loadResource:function(){var n=t("ImageIcon");return n.loadByUrl(this._resolveUrl())},hasIcon:function(t,n){return this._parseIconId(t,n)==this._resolveIconId(this.id)},getIcon:function(){return this._getResource()}})}),o("SpriteIconSetScope",function(t){function n(t,n,o){e.call(this,t,n,o)}var e=t("AbstractCssClassIconSetScope"),o=t("inherit");return o(n,e,{getIcon:function(n,e){var o=t("SpriteIcon");return new o(this._resolveCssClass(this._parseIconId(n,e),e))}})}),o("SvgCumulativeIconSetScope",function(t){function n(t,n,o){var r=10;e.call(this,t,n,o),this.waitDuration=this.options.waitDuration||r,this.waitPromise=null,this.waitIconIds=[]}var e=t("AbstractRemoteSvgResourceScope"),o=t("inherit");return o(n,e,{_loadResource:function(){var n=t("SvgIconSet");return n.loadByUrl(this._resolveUrl(this.waitIconIds),this.options)},preload:function(){return null},getIcon:function(n,e){var o=t("Promise"),r=t("timeout"),i=this;return n=this._parseIconId(n,e),this._resource&&this._resource.exists(n)?o.resolve(this._resource.getIconById(n)):(this.waitPromise?-1==this.waitIconIds.indexOf(n)&&this.waitIconIds.push(n):(this.waitIconIds=[n],this.waitPromise=r(this.waitDuration).then(function(){return i.waitPromise=null,i._resource?i._resource.mergeByUrl(i._resolveUrl(i._resource.notExists(i.waitIconIds)),i.options):i._getResource()})),this.waitPromise.then(function(t){var e=t.getIconById(n);return e?e:o.reject()}))}})}),o("SvgIconScope",function(t){function n(t,n,o){e.call(this,t,n,o)}var e=t("AbstractRemoteSvgResourceScope"),o=t("inherit");return o(n,e,{_loadResource:function(){var n=t("SvgIcon");return n.loadByUrl(this._resolveUrl(),this.options)},hasIcon:function(t,n){return this._parseIconId(t,n)==this._resolveIconId(this.id)},getIcon:function(){return this._getResource()}})}),o("SvgIconSetScope",function(t){function n(t,n,o){e.call(this,t,n,o)}var e=t("AbstractRemoteSvgResourceScope"),o=t("inherit");return o(n,e,{_loadResource:function(){var n=t("SvgIconSet");return n.loadByUrl(this._resolveUrl(),this.options)},hasIcon:function(t,n){return t=this._parseIconId(t,n),this._getResource().then(function(n){return n.exists(t)})},getIcon:function(n,e){var o=t("Promise");return n=this._parseIconId(n,e),this._getResource().then(function(t){var e=t.getIconById(n);return e?e:o.reject()})}})}),o("ScopeCollection",function(t){function n(){this.collection=[]}return n.prototype={add:function(n){var e=t("SvgCumulativeIconSetScope"),o=t("FontIconSetScope");n instanceof e||n instanceof o?this.collection.push(n):this.collection.unshift(n)},preload:function(n){var e=t("Promise"),o=[];return this.collection.forEach(function(t){var e;e=t.preload(n),e&&"object"==typeof e&&"function"==typeof e.then&&o.push(e)}),o.length>0?e.all(o.map(function(t){return t.then(null,function(){return null})})).then(function(){return null}):null},getIconScope:function(n,e){var o,r=t("Promise"),i=(t("SvgCumulativeIconSetScope"),this.collection);return o=r.all(i.map(function(t){return r.resolve(t.hasIcon(n,e)).then(function(n){return n?t:!1},function(){return!1})})),o.then(function(t){var n;for(n=0;n<t.length;n++)if(t[n])return t[n];return r.reject()})},getIcon:function(t,n){return this.getIconScope(t,n).then(function(e){return e.getIcon(t,n)})}},n}),o("SvgIconSet",function(t){function n(n,e){var o,r,i,c,s,u,a,l=t("log"),f=t("parseSvgOptions"),h=t("SvgIcon"),p=t("nodeWrapper");u="function"==typeof e.iconIdResolver?e.iconIdResolver:function(t){return t},a=f(e),this.icons={},s=a.viewBox||n[0].getAttribute("viewBox"),c=a.iconSize;try{for(r=n[0].querySelectorAll("[id]"),o=0;o<r.length;o++)i=r[o],this.icons[u(i.getAttribute("id"))]=new h(p(i.cloneNode(!0)),{iconSize:c,viewBox:s})}catch(d){l.warn(d)}this.iconSize=c,this.viewBox=s,this.iconIdResolver=u}return n.loadByUrl=function(e,o){var r=t("loadSvgByUrl");return r(e).then(function(t){return new n(t,o)})},n.prototype={notExists:function(t){var n=this.icons;return t.filter(function(t){return!n.hasOwnProperty(t)})},exists:function(t){return this.icons.hasOwnProperty(t)},getIconById:function(t){return this.icons.hasOwnProperty(t)?this.icons[t]:null},merge:function(t){var n=this,e=t.icons;return Object.keys(e).forEach(function(t){n.icons[t]=e[t]}),this},mergeByUrl:function(t,e){var o=this;return n.loadByUrl(t,e).then(function(t){return o.merge(t)})}},n}),o("iconManager",function(t){function n(){this._collections={},this._defaultCollectionId=null,this._defaultSvgIconSize=i}function e(n,e){var o=t("log"),r=t("Promise"),i='icon "'+n+'" not found';return e&&(i+=' in "'+e+'" icon set'),o.warn(i),r.reject(i)}function o(t,n){return function(){return e(t,n)}}var r=/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/i,i=24,c="__SINGLE_ICONS_COLLECTION";return n.prototype={addIcon:function(t,n,e){function o(t){return t.split("?")[0].split(/[/\\]/).slice(-1)[0].split(".").slice(-1)[0].toLowerCase()}var r,i=n;return"object"==typeof n&&(i=n.url),r=o("function"==typeof i?i():i+""),"svg"!=r&&r?this.addImageIcon(t,n):this.addSvgIcon(t,n,e)},addSvgIcon:function(n,e,o){var r=t("SvgIconScope");return this._getSingleIconsCollection().add(new r(n,e,o)),this},addImageIcon:function(n,e,o){var r=t("ImageIconScope");return this._getSingleIconsCollection().add(new r(n,e,o)),this},addSvgIconSet:function(n,e,o){var r,i=t("SvgCumulativeIconSetScope"),c=t("SvgIconSetScope");return o=o||{},r=o.cumulative?i:c,this._getCollection(n).add(new r(n,e,o)),this},addFontIconSet:function(n,e,o){var r=t("FontIconSetScope");return this._getCollection(n).add(new r(n,e,o)),this},addSpriteIconSet:function(n,e,o){var r=t("SpriteIconSetScope");return this._getCollection(n).add(new r(n,e,o)),this},addIconSetAlias:function(t,n){return this._collections.hasOwnProperty(n)||(this._collections[n]=this._getCollection(t)),this},setDefaultIconSet:function(t){return this._defaultCollectionId=t,this},setDefaultSvgIconSize:function(t){return this._defaultSvgIconSize=t,this},getDefaultSvgIconSize:function(){return this._defaultSvgIconSize},preload:function(n){var e,o=this,r=this._collections,i={},s=!1,u=!1,a=[],l={},f=t("Promise");return-1!=["string","number"].indexOf(typeof n)&&(n=[n]),n&&"object"==typeof n?((Array.isArray(n)?n:Object.keys(n)).forEach(function(t){i[String(t).toLowerCase()]=!0}),s=!0):n&&(u=!0),Object.keys(r).forEach(function(t){var n;n=r[t].preload(u||s&&i.hasOwnProperty(String(t).toLowerCase())),n&&"object"==typeof n&&"function"==typeof n.then&&(a.push(n),t!=c&&(l[t]=n.then(function(){return o._getCollection(t)})))}),e=f.all(a),e.iconSets=l,e},getIcon:function(t,n){var i,c,s,u;if(t=t||"",n=n||[],i=t.split(/\s+/).filter(function(t){return t}),t=i[0],Array.prototype.push.apply(n,i.slice(1)),r.test(t))return this.hasSingleIcon(t)||this.addIcon(t,t),this._getSingleIconsCollection().getIcon(t,n).then(null,o(t));if(s=t,u=null,c=t.indexOf(":"),-1!=c&&(u=t.slice(0,c),s=t.slice(c+1)),u){if(this.hasIconSet(u))return this._getCollection(u).getIcon(s,n).then(null,o(s,u))}else{if(this.hasSingleIcon(s,n))return this._getSingleIconsCollection().getIcon(s,n).then(null,o(s));if(this.hasDefaultIconSet())return this._getCollection(this._defaultCollectionId).getIcon(s,n).then(null,o(s,this._defaultCollectionId))}return e(t)},hasSingleIcon:function(t,n){return this._getSingleIconsCollection().collection.filter(function(e){return e.hasIcon(t,n)}).length>0},hasIconSet:function(t){return this._collections.hasOwnProperty(t)},hasDefaultIconSet:function(){return this._defaultCollectionId&&this.hasIconSet(this._defaultCollectionId)},_getCollection:function(n){var e=t("ScopeCollection");return this._collections.hasOwnProperty(n)||(this._collections[n]=new e),this._collections[n]},_getSingleIconsCollection:function(){return this._getCollection(c)}},new n}),o("inherit",function(t){return function(t,n,e,o){return t.prototype=Object.create(n.prototype,o||{}),Object.keys(e||{}).forEach(function(n){t.prototype[n]=e[n]}),t}}),o("initIconElement",function(n){function e(n,e){function o(e,o){function r(n,e){function o(n){var e=n.currentStyle?n.currentStyle:t.getComputedStyle(n);return"none"===e.display}var r,i,c,s=n.hasChildNodes();if(s)for(r=n.childNodes,i=0;i<r.length;i++)if(c=r[i],1===c.nodeType&&c.hasAttribute(e)&&!o(c))return!0;return!1}var i=n[0];i.hasAttribute(e)||r(i,e)||(o="string"==typeof o?o.trim():"",o.length&&n.attr(e,o))}function r(){var t=n.parent();return t.attr("aria-label")||t.text().trim()?!0:"BODY"!=t.prop("tagName")&&(t.parent().attr("aria-label")||t.parent().text().trim())?!0:!1}""==e||r()?o("aria-hidden","true"):(o("aria-label",e),o("role","img"))}return function(t,n,o){var r,i="webicon";n||"string"==typeof n||(o=String(o||"").split(":").slice(-1)[0].trim(),/[/\\.]/.test(o)?(r=o.split(/[/\\]/).slice(-1)[0].split("."),r.length>1&&(r=r.slice(0,-1)),n=r.join(".")):n=o.split(/\s/)[0]),e(t,n||""),t.hasClass(i)||t.addClass(i)}}),o("loadSvgByUrl",function(t){return function(n){var e=t("httpGet"),o=t("log"),r=t("Promise"),i=t("nodeWrapper"),c=n,s=null;return"object"==typeof n&&(c=n.url,s=n.params),e(c,s).then(function(t){var n=i("<div>").append(t.data),e=n.find("svg");return e.length>0?e:n.children().first()},function(t){var n="string"==typeof t?t:String(t.message||t.data||t.responseText||t.statusText);return o.warn(n),r.reject(n)})}}),o("parseSvgOptions",function(t){return function(t){if(t)switch(typeof t){case"number":t={iconSize:t};break;case"string":t={viewBox:t}}else t={};return{iconSize:t.iconSize,viewBox:t.viewBox}}}),o("publicApi",function(t){var n,e=t("iconManager"),o=t("ready");return n={icon:function(t,n,o){return e.addIcon(t,n,o),this},svgSet:function(t,n,o){return e.addSvgIconSet(t,n,o),this},font:function(t,n,o){return e.addFontIconSet(t,n,o),this},sprite:function(t,n,o){return e.addSpriteIconSet(t,n,o),this},sourceAlias:function(t,n){return e.addIconSetAlias(t,n),this},defaultSvgSetUrl:function(t,n){return e.addSvgIconSet(t,t,n).setDefaultIconSet(t),this},defaultSource:function(t){return e.setDefaultIconSet(t),this},defaultSvgIconSize:function(t){return e.setDefaultSvgIconSize(t),this},preload:function(t,n){var o;return"function"==typeof t&&(n=t,t=null),o=e.preload(t),n&&n(o),this},extension:o},n.iconSet=n.svgSet,n.defaultIconSetUrl=n.defaultSvgSetUrl,n.defaultSvgIconSetUrl=n.defaultSvgSetUrl,n.alias=n.sourceAlias,n["default"]=n.defaultSource,n}),r(function(n){var e,o,r,i=n("nodeWrapper");r='<style type="text/css">@charset "UTF-8";webicon,[webicon],[data-webicon],.webicon,.webicon{display:inline-block;}.svg-webicon svg{fill:currentColor;}</style>',e=i(t.document).find("head"),o=e.find("style")[0],o&&o.outerHTML==r||e.prepend(r)}),o("IconController",function(t){function n(n,e){var o=t("initIconElement");e=e||{},this._element=n,this.options=e,o(n,this._getAlt(),this._getIconId()),this._renderIcon()}return n.prototype={_getAlt:function(){var t=this._element,n=t.attr("alt"),e=t.data("alt");return""===n||""===e||""===this.options.alt?"":n||e||this.options.alt},_getIconId:function(){var t,n=this._element;return t=n.attr("webicon")||n.data("webicon"),t||"webicon"!=n[0].tagName.toLowerCase()||(t=n.attr("icon")||n.data("icon")),t||(t=n.attr("class").split(/\s+/).map(function(t){var n,e;return n=/^webicon[-:]([^;|,]+)[;|,]?(.*)$/i.exec(t),n&&n[1]?(e=[n[1]],n[2]&&Array.prototype.push.apply(e,n[2].split(/[;|,:]/)),e.join(" ")):null}).filter(function(t){return t})[0]),t||this.options.icon},_renderIcon:function(n){var e=t("iconManager"),o=this._element,r=this._renderedIconCleaner,i=this;n=n||this._getIconId(),n!=this._renderedIconId&&(r&&r(),this._renderedIconCleaner=null,n&&e.getIcon(n).then(function(t){i._renderedIconCleaner=t.render(o)}),this._renderedIconId=n)},refresh:function(t){var n;n=this.options.icon,this.options=t,this.options.icon=this.options.icon||n,this._renderIcon()}},n}),o("IconPlugin",function(t){var n=t("jQuery");return function(e){var o=t("configPerformer"),r=t("IconController"),i=t("IconsPlugin");return e=e||{},"string"==typeof e&&(e={icon:e}),o(e),i.bootstraped||i.cancelBootstrap(),this.each(function(){var t="__WEBICON_DATA",o=n(this),i=o.data(t),c={icon:e.icon+""};i?i.refresh(c):o.data(t,new r(o,c))})}}),o("IconsPlugin",function(t){function n(e){var o=t("configPerformer"),r=this,i="webicon,[webicon],[data-webicon],.webicon",c=!1;return r.is(i)&&(r.webicon(e),c=!0),r.find(i).webicon(c?null:e),n.bootstraped||(c||o(e),n.setBootstrapped()),r}return n.bootstraped=!1,n.cancelBootstrap=function(){n.bootstraped=!0},n.isBootstrapped=function(){return n.bootstraped},n.setBootstrapped=function(t){n.bootstraped="undefined"==typeof t?!0:t},n}),o("Promise",function(n){function e(t){var n;"function"==typeof t?(n=new o.Deferred,t(n.resolve,n.reject),this._jqPromise=n):this._jqPromise=t&&"object"==typeof t&&t.then?t._jqPromise?t._jqPromise:t:(new o.Deferred).resolve(t)}var o=n("jQuery");return t.Promise?t.Promise:(e.reject=function(t){return new e((new o.Deferred).reject(t))},e.resolve=function(t){return new e((new o.Deferred).resolve(t))},e.all=function(t){var n,r=[];return Array.isArray(t)?(n=t.map(function(t){return t&&"object"==typeof t&&t._jqPromise&&(t=t._jqPromise),t}),n.forEach(function(t,n){t.then(function(t){r[n]=t})}),new e(o.when.apply(o,n)).then(function(){return r})):e.reject()},e.prototype={then:function(t,n){var r;return r=this._jqPromise.then(t&&function(n){var e=t(n);return e&&"object"==typeof e&&e._jqPromise&&(e=e._jqPromise),e},n&&function(t){var e=n(t);return e&&"object"==typeof e&&e.then?e._jqPromise?e._jqPromise:e:"undefined"!=typeof e?(new o.Deferred).reject(e):void 0}),new e(r)}},e)}),r(function(n){var e=n("jQuery"),o=n("IconsPlugin");e(function(){var r=5,i=n("timeout");o.bootstraped||i(r).then(function(){o.bootstraped||e(t.document).webicons()})})}),o("buildUrlParams",function(t){return function(n){var e=t("jQuery");return e.param(n||{})}}),o("configPerformBaseStrategy",function(t){function n(){function t(n,e){return n=n||{},Array.isArray(n)?n.map(function(n){return t(n,e)}):("object"==typeof n&&(n.id||0===n.id||(n.id=e)),o(n,e))}var e,o,r=Array.prototype.slice.call(arguments);return o=r.pop(),r.length>1?Array.prototype.concat.apply([],r.map(function(t){return n(t,o)})):(e=r[0],e=e&&"object"==typeof e?Array.isArray(e)?Array.prototype.concat.apply([],e.map(t)):Array.prototype.concat.apply([],Object.keys(e).map(function(n){return t(e[n],n)})):"string"==typeof e||"number"==typeof e?[t(e)]:[],e.filter(function(t){return t}))}function e(t,n){return"object"!=typeof t&&(t={url:t,id:n}),t.url=t.url||t.uri,t.id&&t.url?t:null}function o(t,n){return"object"!=typeof t&&(t={className:t,id:n}),t.className=t.className||t.cssClass||t["class"],t.id&&t.className?t:null}function r(t){return"object"!=typeof t&&(t={iconSize:t}),t.iconSize=t.iconSize||t.size||t.svgIconSize,t.iconSize?t:null}function i(t){return"function"==typeof t?[t]:t&&"object"==typeof t?Array.isArray(t)?[t]:Object.keys(t).length>0&&!t.hasOwnProperty("force")&&!t.hasOwnProperty("names")&&!t.hasOwnProperty("fn")?[t]:[t.force||t.names||void 0,t.fn||void 0].filter(function(t){return"undefined"!=typeof t}):t?[!0]:[]}var c=t("publicApi"),s=t("iconManager");return function(t){var u,a,l,f,h={};u={},a=function(t,n){u[t]||(u[t]={}),u[t][n.id]||(u[t][n.id]=[]),u[t][n.id].push(n)},l=function(t){return function(n){a(t,n)}},n(t.icons,t.icon,e).forEach(l("icon")),n(t.svgSets,t.svgSet,t.iconSets,t.iconSet,e).forEach(l("svgSet")),n(t.fonts,t.font,o).forEach(l("font")),n(t.sprites,t.sprite,o).forEach(l("sprite")),["svgSet","font","sprite"].forEach(function(t){Object.keys(u[t]||{}).forEach(function(t){h.hasOwnProperty(t)||(h[t]=s.hasIconSet(t))})}),f={icon:function(t,n){s.hasSingleIcon(n.id)||(r(n),c.icon(n.id,n.url,n))},svgSet:function(t,n){h[n.id]||(r(n),c.svgSet(n.id,n.url,n),(n["default"]||n.defaultSource)&&c.defaultSource(n.id))}},f.font=f.sprite=function(t,n){h[n.id]||(c[t](n.id,n.className,n),(n["default"]||n.defaultSource)&&c.defaultSource(n.id))},Object.keys(u).forEach(function(t){Object.keys(u[t]||{}).forEach(function(n){u[t][n].forEach(function(n){f[t](t,n)})})}),n(t.defaultSvgSetUrl,t.defaultSvgIconSetUrl,t.defaultIconSetUrl,function(t){return"object"!=typeof t&&(t={url:t}),t.url=t.url||t.uri,t.url?t:null}).forEach(function(t){s.hasIconSet(t.url)||(r(t),c.defaultSvgSetUrl(t.url,t))}),n(t.alias,t.sourceAlias,function(t,n){return"object"!=typeof t&&(t={alias:n,id:t}),t.alias=t.alias||t.sourceAlias,t.alias?t:null}).forEach(function(t){s.hasIconSet(t.alias)||c.sourceAlias(t.id,t.alias)}),n(t["default"],t.defaultSource,function(t){return"object"!=typeof t&&(t={id:t}),t.id?t:null}).forEach(function(t){c.defaultSource(t.id)}),n(t.defaultSvgIconSize,r).forEach(function(t){c.defaultSvgIconSize(t.iconSize)}),t.preload&&c.preload.apply(c,i(t.preload))}}),o("configPerformer",function(t){function n(n){var o=t("publicApi");"function"==typeof n&&(n=n(o)),n=n||{},e.forEach(function(e){e(n,t)})}var e=[t("configPerformBaseStrategy")];return n.strategy=function(t){"function"==typeof t&&e.push(t)},n}),o("httpGet",function(t){var n={};return function(e,o){var r,i,c,s=t("jQuery"),u=t("Promise"),a=t("buildUrlParams"),l=[e];return o=o||{},i=a(o),i&&l.push(i),r=l.join("?"),n.hasOwnProperty(r)?n[r]:(n[r]=c=new u(function(t,n){s.ajax({url:e,data:o,dataType:"text",success:function(n){t({data:n})},error:n})}),c)}}),o("log",function(n){function e(n){return function(){var e=t.console,o=Array.prototype.slice.call(arguments);if(e[n].apply)e[n].apply(e,o);else switch(o.length){case 0:e[n]();break;default:o.forEach(function(t){e[n](t)})}}}var o={};return["log","info","warn","error"].forEach(function(t){o[t]=e(t)}),o}),o("mergeObjects",function(t){return function(){var n=t("jQuery"),e=Array.prototype.slice.call(arguments);switch(e.length){case 0:e.push({});case 1:e.push({})}return n.extend.apply(n,[!0].concat(e))}}),o("nodeWrapper",function(t){var n=t("jQuery");return n}),o("timeout",function(t){function n(n,e){var o,r,i=t("Promise");return"function"!=typeof n&&(e=n,n=function(){}),o=new i(function(t){r=t}),o.then(n),o._timeoutId=setTimeout(r,e),o}return n.cancel=function(t){t._timeoutId&&clearTimeout(t._timeoutId)},n});var i=e(function(t){t("jQuery",function(){return n})});n.fn.webicon=i("IconPlugin"),n.fn.webicon.extension=i("ready"),n.fn.webicons=i("IconsPlugin"),n.fn.webicons.extension=i("ready")}(window,window.jQuery);
//# sourceMappingURL=jquery-webicon-core.min.js.map