{"version":3,"sources":["aheto/features-single/assets/js/cs_layout3.js"],"names":["$","window","addEventListener","jQuery","each","i","e","$img","attr","imgClass","imgURL","get","data","$svg","find","imgID","concat","removeAttr","makeid","this","document","id","length","result","characters","charactersLength","charAt","floor","next","css","replaceWith"],"mappings":"cAAA,SAAUA,EAAGC,GAgFTA,EAAOC,iBAAiB,OAxDxB,WACIC,OAAO,WAAPC,KAAuB,SAAAC,EAAAC,GACbC,IAAOJ,EAAMA,OAAnBG,GACcC,EAAKC,EAAKA,KAAxB,MACcC,EAAQD,EAAKA,KAA3B,SACYE,EAAQF,EAAKA,KAAA,kBAAyBA,EAAKA,KAAvD,OAKQL,OAAAQ,IACQD,EAFZ,SAAAE,GAMeC,IAAKL,EAALL,OAAAS,GAAPE,KAAA,YADiB,IAAVC,IAIAN,EAAPI,EAAoBL,KAAA,KAAaO,SAAb,IAAbN,IACPI,EAAOA,EAAKL,KAAK,QAAV,GAAAQ,OAAsBP,EAAtB,oBAYPI,EAAAA,EAAAI,WACoBJ,YAOdL,KAAV,YACkBK,EAAdL,KAAA,WACWU,EAAXV,KAAA,UAEAK,EAESL,KAFT,gBAAAQ,OAKJH,EAAAL,KAAA,UALI,KAAAQ,OAKJH,EAAAL,KAfY,WAuBrBN,EAAPY,KAAwB,kBAAxBV,KAAA,WAhFJJ,EAAAmB,MAiFmBC,IAhBWC,EA1D1B,SAAgBC,GAKZ,IALJ,IAASJ,EAAOI,GACRC,EACAC,iEAEAC,EAAmBD,EAAWF,OACzBjB,EAAI,EAAGA,EAAIiB,EAAQjB,IAAvBkB,GAAYC,EAAYE,OACfF,KAAAA,MAAWE,KAAAA,SACZC,IAGb,OAAOJ,EAgDoBL,CAAO,GAClBlB,EAAEmB,MAAMX,KAAK,KAAMa,GACnBrB,EAAEmB,MACGS,OACAC,IAAI,OAFT,QAAAb,OAEyBK,EAFzB,QAMJd,EAAKuB,YAAYjB,IAErB,WA3EhB,CAiFGV,OAAQF,OAAQmB","file":"cs_layout3.min.js","sourcesContent":["(function($, window, document, undefined) {\n \"use strict\";\n \n /**\n * Geneare random ID\n */\n\n function makeid(length) {\n var result = \"\";\n var characters =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n var charactersLength = characters.length;\n for (var i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * charactersLength)\n );\n }\n return result;\n }\n\n /*\n * Replace all SVG images with inline SVG\n */\n\n function replaceSVG() {\n jQuery(\"img.svg\").each((i, e) => {\n const $img = jQuery(e);\n const imgID = $img.attr(\"id\");\n const imgClass = $img.attr(\"class\");\n const imgURL = $img.attr(\"data-lazy-src\") || $img.attr(\"src\");\n\n jQuery.get(\n imgURL,\n data => {\n // Get the SVG tag, ignore the rest\n let $svg = jQuery(data).find(\"svg\");\n\n // Add replaced image's ID to the new SVG\n if (typeof imgID !== \"undefined\") {\n $svg = $svg.attr(\"id\", imgID);\n }\n // Add replaced image's classes to the new SVG\n if (typeof imgClass !== \"undefined\") {\n $svg = $svg.attr(\"class\", `${imgClass}replaced-svg`);\n }\n\n // Remove any invalid XML tags as per http://validator.w3.org\n $svg = $svg.removeAttr(\"xmlns:a\");\n\n // Check if the viewport is set, if the viewport is not set the SVG wont't scale.\n if (\n !$svg.attr(\"viewBox\") &&\n $svg.attr(\"height\") &&\n $svg.attr(\"width\")\n ) {\n $svg.attr(\n `viewBox 0 0 ${$svg.attr(\"height\")} ${$svg.attr(\n \"width\"\n )}`\n );\n }\n\n //add an unique id\n $svg.find(\"linearGradient\").each(function() {\n let $this = $(this);\n const id = makeid(4);\n $(this).attr(\"id\", id);\n $(this)\n .next()\n .css(\"fill\", `url(#${id})`);\n });\n\n // Replace image with new SVG\n $img.replaceWith($svg);\n },\n \"xml\"\n );\n });\n }\n\n window.addEventListener(\"load\", replaceSVG);\n})(jQuery, window, document);\n"]}