text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("lit-element/lit-element.js"),require("@lrnwebcomponents/intersection-element/lib/IntersectionObserverMixin.js"),require("mobx"),require("@lrnwebcomponents/haxcms-elements/lib/core/haxcms-site-store.js")):"function"==typeof define&&define.amd?define(["lit-element/lit-element.js","@lrnwebcomponents/intersection-element/lib/IntersectionObserverMixin.js","mobx","@lrnwebcomponents/haxcms-elements/lib/core/haxcms-site-store.js"],t):t((e=e||self).litElement_js,e.IntersectionObserverMixin_js,e.mobx,e.haxcmsSiteStore_js)}(this,function(e,t,n,r){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r,o,i=f(e);if(t){var c=f(this).constructor;n=Reflect.construct(i,arguments,c)}else n=i.apply(this,arguments);return r=this,!(o=n)||"object"!=typeof o&&"function"!=typeof o?b(r):o}}function m(e,t,n){return(m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}var v=function(t){l(r,e.LitElement);var n=d(r);function r(){var e;return o(this,r),(e=n.call(this)).endpoint="",e.addEventListener("lrs-emitter",e._lrsEmitterHander.bind(b(e))),e}return c(r,null,[{key:"properties",get:function(){return{endpoint:{type:String}}}}]),c(r,[{key:"_lrsEmitterHander",value:function(e){this._enableProperties&&this.recordStatement(e)}},{key:"recordStatement",value:function(e){console.log("options:",e);var t={method:"POST",cors:"no-cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"\n          mutation($data: StatementCreateInput!) {\n            createStatement(data: $data) {\n              id\n            }\n          }\n        ",variables:{data:{data:Object.assign({},{actor:{name:this.getUserName()}},e)}}},"utf8")};try{fetch(this.endpoint,t).then(function(e){return e.json()}).then(function(e){})}catch(e){}}},{key:"getUserName",value:function(){var e=window.localStorage.getItem("lrs-name");if(!e){var t=this.makeGUID();window.localStorage.setItem("lrs-name",t)}return e}},{key:"makeGUID",value:function(){var e=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}}],[{key:"tag",get:function(){return"lrs-bridge"}}]),r}();window.customElements.define(v.tag,v);var h=function(n){l(i,t.IntersectionObserver(e.LitElement));var r=d(i);function i(){var e;return o(this,i),(e=r.call(this)).verb="",e.event="click",e.object="",e}return c(i,null,[{key:"haxProperties",get:function(){return{canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Lrs emitter",description:"Emit learning statements occuring in your app.",icon:"icons:android",color:"green",groups:["Emitter"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"elmsln",owner:"Penn State"}},settings:{configure:[{property:"verb",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"}],advanced:[]}}}},{key:"properties",get:function(){return u(u({},m(f(i),"properties",this)),{},{verb:{type:String},object:{type:String},event:{type:String}})}}]),c(i,[{key:"updated",value:function(e){var t=this;m(f(i.prototype),"updated",this)&&m(f(i.prototype),"updated",this).call(this,e),e.forEach(function(e,n){"elementVisible"==n&&t.elementVisible&&"view"==t.event&&t._viewEventHandler(),"click"==t.event&&t.addEventListener("click",t._clickEventHandler.bind(t))})}},{key:"_clickEventHandler",value:function(e){this.dispatchEvent(new CustomEvent("lrs-emitter",{bubbles:!0,cancelable:!0,detail:{verb:this.verb,object:this.object}}))}},{key:"_viewEventHandler",value:function(){this.dispatchEvent(new CustomEvent("lrs-emitter",{bubbles:!0,cancelable:!0,detail:{verb:this.verb,object:this.object}}))}}],[{key:"tag",get:function(){return"lrs-emitter"}}]),i}();window.customElements.define(h.tag,h);var y=function(e){l(i,v);var t=d(i);function i(){var e;return o(this,i),e=t.call(this),n.autorun(function(){e._locationChanged(n.toJS(r.store.location))}),e}return c(i,[{key:"_locationChanged",value:function(e){var t=function(e){return e.replace(/(^\/|\/$)/,"")},n="".concat(t(e.baseUrl),"/").concat(t(e.pathname));this.recordStatement({verb:{id:"viewed"},object:{id:n}})}}],[{key:"tag",get:function(){return"lrs-bridge-haxcms"}}]),i}();window.customElements.define(y.tag,y)});
  