"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),u=r(31478),c=r(67557);function a(e,t,r,n,i,o,u){try{var c=e[o](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function u(e){a(o,n,i,u,c,"next",e)}function c(e){a(o,n,i,u,c,"throw",e)}u(void 0)}))}}function s(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=[],u=!0,c=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{u||null==r.return||r.return()}finally{if(c)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(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)?f(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 f(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=(0,n.useRef)(null),a=(0,n.useRef)(null),f=s((0,n.useState)(),2),m=f[0],d=f[1],h=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)(l(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(h).then(d).catch(u.p);case 2:case"end":return e.stop()}}),e)}))),[]),(0,n.useEffect)((function(){var e;if(m&&(null===(e=r.current)||void 0===e||e.submit(),m.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},a.current),null==n||n.classList.remove("aspect-ratio"),null==n||n.attributes.removeNamedItem("style")}}),[m]),m?(0,c.jsxs)("div",{className:"lti-consumer",children:[(0,c.jsx)("form",{ref:r,action:m.url,method:"POST",encType:"application/x-www-form-urlencoded",target:"lti_iframe_".concat(t),children:Object.entries(m.content_parameters).map((function(e){var t=s(e,2),r=t[0],n=t[1];return(0,c.jsx)("input",{type:"hidden",name:r,value:n},r)}))}),(0,c.jsx)("iframe",{ref:a,name:"lti_iframe_".concat(t),title:m.url,src:m.url,allow:"microphone *; camera *; midi *; geolocation *; encrypted-media *; fullscreen *",allowFullScreen:!0})]}):(0,c.jsx)("div",{className:"lti-consumer"})}},3787:function(e,t,r){r.d(t,{b:function(){return i}});var n=r(89526),i=function(e,t){return(0,n.useEffect)((function(){var t=e();return function(){t.then((function(e){return e&&e()}))}}),t)}}}]);
//# sourceMappingURL=75913.4f4eb49d3dc5af92a293.index.js.map