"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var assign_1 = require("./../../vendor/assign");
var snip = new Function("\n  (function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+\"=([^&]*)\")))?l[1]:null};g&&c(g,\"state\")&&(i=JSON.parse(decodeURIComponent(c(g,\"state\"))),\"mpeditor\"===i.action&&(b.sessionStorage.setItem(\"_mpcehash\",g),history.replaceState(i.desiredHash||\"\",e.title,j.pathname+j.search)))}catch(m){}var k,h;window['mixpanel']=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(\".\");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,\n  0)))}}var d=a;\"undefined\"!==typeof f?d=a[f]=[]:f=\"mixpanel\";d.people=d.people||[];d.toString=function(b){var a=\"mixpanel\";\"mixpanel\"!==f&&(a+=\".\"+f);b||(a+=\" (stub)\");return a};d.people.toString=function(){return d.toString(1)+\".people (stub)\"};k=\"disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user\".split(\" \");\n  for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;}})(document,window.mixpanel||[]);\n");
function mixpanelInit(mixpanelToken, component) {
    if (typeof window !== 'undefined') {
        if (!window['mixpanel']) {
            snip();
            var head = document.getElementsByTagName('head')[0];
            var script = document.createElement('script');
            script.async = true;
            script.type = 'text/javascript';
            script.src = 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
            head.appendChild(script);
            window['mixpanel'].init(mixpanelToken);
        }
        var metadata = (component._bytecode && component._bytecode.metadata) || {};
        window['mixpanel'].track('component:initialize', assign_1.default({
            platform: 'dom',
        }, metadata));
    }
}
exports.default = mixpanelInit;
//# sourceMappingURL=mixpanelInit.js.map