"use strict";(self.webpackChunkrichie_education=self.webpackChunkrichie_education||[]).push([[75913],{75913:function(e,t,r){r.r(t),r(32390),r(10853),r(35054),r(73214),r(96900),r(26364),r(86632),r(61928),r(54883),r(45007),r(68995),r(18821),r(54994),r(4845),r(39275);var n=r(89526),i=r(25002),o=r(3787),a=r(19898);function c(e,t,r,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,i)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){c(o,n,i,a,u,"next",e)}function u(e){c(o,n,i,a,u,"throw",e)}a(void 0)}))}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(c)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}t.default=function(e){var t=e.id,r=n.useRef(null),c=n.useRef(null),s=l((0,n.useState)(),2),f=s[0],m=s[1],d=function(e){if(!e.ok)throw new Error("Failed to retrieve LTI consumer context at placeholder ".concat(t));return e.json()};return(0,o.b)(u(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("/api/v1.0/plugins/lti-consumer/".concat(t,"/context/")).then(d).then(m).catch(a.p);case 2:case"end":return e.stop()}}),e)}))),[]),(0,n.useEffect)((function(){var e;if(f&&(null===(e=r.current)||void 0===e||e.submit(),f.is_automatic_resizing)){var t,n=null===(t=r.current)||void 0===t?void 0:t.closest(".richie-react--lti-consumer");(0,i.iframeResizer)({minHeight:null==n?void 0:n.clientHeight},c.current),null==n||n.classList.remove("aspect-ratio"),null==n||n.attributes.removeNamedItem("style")}}),[f]),f?n.createElement("div",{className:"lti-consumer"},n.createElement("form",{ref:r,action:f.url,method:"POST",encType:"application/x-www-form-urlencoded",target:"lti_iframe_".concat(t)},Object.entries(f.content_parameters).map((function(e){var t=l(e,2),r=t[0],i=t[1];return n.createElement("input",{key:r,type:"hidden",name:r,value:i})}))),n.createElement("iframe",{ref:c,name:"lti_iframe_".concat(t),title:f.url,src:f.url,allow:"microphone *; camera *; midi *; geolocation *; encrypted-media *; fullscreen *",allowFullScreen:!0})):n.createElement("div",{className:"lti-consumer"})}}}]);
//# sourceMappingURL=75913.e894b2552334d7259027.index.js.map