diff --git a/h5p.classes.php b/h5p.classes.php index 1833b71..082a425 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2889,10 +2889,11 @@ class H5PCore { * implementation is responsible for invoking this, eg using cron * * @param bool $fetchingDisabled + * @param bool $onlyRegister Only register site with H5P.org * * @return bool|object Returns endpoint data if found, otherwise FALSE */ - public function fetchLibrariesMetadata($fetchingDisabled = FALSE) { + public function fetchLibrariesMetadata($fetchingDisabled = FALSE, $onlyRegister = false) { // Gather data $uuid = $this->h5pF->getOption('site_uuid', ''); $platform = $this->h5pF->getPlatformInfo(); @@ -2930,12 +2931,17 @@ class H5PCore { $this->h5pF->setInfoMessage( $this->h5pF->t('Your site was successfully registered with the H5P Hub.') ); + $uuid = $json->uuid; // TODO: Uncomment when key is once again available in H5P Settings // $this->h5pF->setInfoMessage( // $this->h5pF->t('You have been provided a unique key that identifies you with the Hub when receiving new updates. The key is available for viewing in the "H5P Settings" page.') // ); } + if ($onlyRegister) { + return $uuid; + } + if ($this->h5pF->getOption('send_usage_statistics', TRUE)) { $siteData = array_merge( $registrationData, @@ -3774,7 +3780,7 @@ class H5PCore { $data, TRUE, NULL, TRUE, $headers, $files ); - if (empty($response['data'])) { + if (empty($response['data']) || $response['status'] === 403) { throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.')); } @@ -3804,10 +3810,10 @@ class H5PCore { $site_uuid = $this->h5pF->getOption('site_uuid', ''); $hub_secret = $this->h5pF->getOption('hub_secret', ''); if (empty($site_uuid)) { - throw new Exception($this->h5pF->t('Missing Site UUID. Please check your Hub registration.')); + $this->h5pF->setErrorMessage($this->h5pF->t('Missing Site UUID. Please check your Hub registration.')); } - if (empty($hub_secret)) { - throw new Exception($this->h5pF->t('Missing Hub Secret. Please check your Hub registration.')); + elseif (empty($hub_secret)) { + $this->h5pF->setErrorMessage($this->h5pF->t('Missing Hub Secret. Please check your Hub registration.')); } return 'Basic ' . base64_encode("$site_uuid:$hub_secret"); } @@ -3898,6 +3904,11 @@ class H5PCore { public function hubAccountInfo() { $siteUuid = $this->h5pF->getOption('site_uuid', null); $secret = $this->h5pF->getOption('hub_secret', null); + if (empty($siteUuid) && !empty($secret)) { + $this->h5pF->setErrorMessage($this->h5pF->t('H5P Hub secret is set without a site uuid. This may be fixed by restoring the site uuid or removing the hub secret and registering a new account with the content hub.')); + throw new Exception('Hub secret not set'); + } + if (empty($siteUuid) || empty($secret)) { return false; } @@ -3911,6 +3922,12 @@ class H5PCore { $accountInfo = $this->h5pF->fetchExternalData("{$url}/{$siteUuid}", null, true, null, true, $headers, array(), 'GET'); + if ($accountInfo['status'] === 401) { + // Unauthenticated, invalid hub secret and site uuid combination + $this->h5pF->setErrorMessage($this->h5pF->t('Hub account authentication info is invalid. This may be fixed by an admin by restoring the hub secret or register a new account with the content hub.')); + return false; + } + if ($accountInfo['status'] !== 200) { return false; } @@ -3940,12 +3957,16 @@ class H5PCore { $uuid = $this->h5pF->getOption('site_uuid', ''); if (empty($uuid)) { - return [ - 'message' => $this->h5pF->t('Site is missing a unique site uuid. The H5P Content Hub is disabled until this problem can be resolved. Please enable the H5P Hub through your site settings before trying again.'), - 'status_code' => 403, - 'error_code' => 'MISSING_SITE_UUID', - 'success' => FALSE, - ]; + // Attempt to fetch a new site uuid + $uuid = $this->fetchLibrariesMetadata(false, true); + if (!$uuid) { + return [ + 'message' => $this->h5pF->t('Site is missing a unique site uuid and was unable to set a new one. The H5P Content Hub is disabled until this problem can be resolved. Please make sure the H5P Hub is enabled in the H5P settings and try again later.'), + 'status_code' => 403, + 'error_code' => 'MISSING_SITE_UUID', + 'success' => FALSE, + ]; + } } $formData['site_uuid'] = $uuid; @@ -3986,7 +4007,7 @@ class H5PCore { if (isset($results->errors->site_uuid)) { return [ - 'message' => 'Site UUID is not unique.', + 'message' => 'Site UUID is not unique. This must be fixed by an admin by restoring the hub secret or remove the site uuid and register as a new account with the content hub.', 'status_code' => 403, 'error_code' => 'SITE_UUID_NOT_UNIQUE', 'success' => FALSE, @@ -4017,6 +4038,71 @@ class H5PCore { 'success' => TRUE, ]; } + + /** + * Get status of content from content hub + * + * @param string $hubContentId + * @param int $syncStatus + * + * @return false|int Returns a new H5PContentStatus if successful, else false + */ + public function getHubContentStatus($hubContentId, $syncStatus) { + $headers = array( + 'Authorization' => $this->hubGetAuthorizationHeader(), + 'Accept' => 'application/json', + ); + + $url = H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT); + $response = $this->h5pF->fetchExternalData("{$url}/{$hubContentId}/status", + null, true, null, true, $headers); + + if (isset($response['status']) && $response['status'] === 403) { + $msg = $this->h5pF->t('The request for content status was unauthorized. This could be because the content belongs to a different account, or your account is not setup properly.'); + $this->h5pF->setErrorMessage($msg); + return false; + } + if (empty($response) || $response['status'] !== 200) { + $msg = $this->h5pF->t('Could not get content hub sync status for content.'); + $this->h5pF->setErrorMessage($msg); + return false; + } + + $data = json_decode($response['data']); + + if (isset($data->messages)) { + // TODO: Is this the right place/way to display them? + + if (!empty($data->messages->info)) { + foreach ($data->messages->info as $info) { + $this->h5pF->setInfoMessage($info); + } + } + if (!empty($data->messages->error)) { + foreach ($data->messages->error as $error) { + $this->h5pF->setErrorMessage($error->message, $error->code); + } + } + } + + $contentStatus = intval($data->status); + // Content status updated + if ($contentStatus !== H5PContentStatus::STATUS_WAITING) { + $newState = H5PContentHubSyncStatus::SYNCED; + if ($contentStatus !== H5PContentStatus::STATUS_DOWNLOADED) { + $newState = H5PContentHubSyncStatus::FAILED; + } + else if (intval($syncStatus) !== $contentStatus) { + // Content status successfully transitioned to synced/downloaded + $successMsg = $this->h5pF->t('Content was successfully shared on the content hub.'); + $this->h5pF->setInfoMessage($successMsg); + } + + return $newState; + } + + return false; + } } /** diff --git a/js/h5p-hub-registration.js b/js/h5p-hub-registration.js index a0090e0..6c661b4 100644 --- a/js/h5p-hub-registration.js +++ b/js/h5p-hub-registration.js @@ -34,4 +34,4 @@ object-assign * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var r,i,o,a,l;if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,c=null,s=function(){if(null!==u)try{var e=t.unstable_now();u(!0,e),u=null}catch(e){throw setTimeout(s,0),e}},f=Date.now();t.unstable_now=function(){return Date.now()-f},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(s,0))},i=function(e,t){c=setTimeout(e,t)},o=function(){clearTimeout(c)},a=function(){return!1},l=t.unstable_forceFrameRate=function(){}}else{var d=window.performance,p=window.Date,m=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var v=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)t.unstable_now=function(){return d.now()};else{var g=p.now();t.unstable_now=function(){return p.now()-g}}var y=!1,b=null,w=-1,k=5,x=0;a=function(){return t.unstable_now()>=x},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0P(a,n))void 0!==u&&0>P(u,a)?(e[r]=u,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var N=[],O=[],R=1,z=null,I=3,D=!1,M=!1,L=!1;function F(e){for(var t=C(O);null!==t;){if(null===t.callback)_(O);else{if(!(t.startTime<=e))break;_(O),t.sortIndex=t.expirationTime,S(N,t)}t=C(O)}}function A(e){if(L=!1,F(e),!M)if(null!==C(N))M=!0,r(j);else{var t=C(O);null!==t&&i(A,t.startTime-e)}}function j(e,n){M=!1,L&&(L=!1,o()),D=!0;var r=I;try{for(F(n),z=C(N);null!==z&&(!(z.expirationTime>n)||e&&!a());){var l=z.callback;if(null!==l){z.callback=null,I=z.priorityLevel;var u=l(z.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?z.callback=u:z===C(N)&&_(N),F(n)}else _(N);z=C(N)}if(null!==z)var c=!0;else{var s=C(O);null!==s&&i(A,s.startTime-n),c=!1}return c}finally{z=null,I=r,D=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=l;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){M||D||(M=!0,r(j))},t.unstable_getCurrentPriorityLevel=function(){return I},t.unstable_getFirstCallbackNode=function(){return C(N)},t.unstable_next=function(e){switch(I){case 1:case 2:case 3:var t=3;break;default:t=I}var n=I;I=t;try{return e()}finally{I=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=I;I=e;try{return t()}finally{I=n}},t.unstable_scheduleCallback=function(e,n,a){var l=t.unstable_now();if("object"==typeof a&&null!==a){var u=a.delay;u="number"==typeof u&&0l?(e.sortIndex=u,S(O,e),null===C(N)&&e===C(O)&&(L?o():L=!0,i(A,u-l))):(e.sortIndex=a,S(N,e),M||D||(M=!0,r(j))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();F(e);var n=C(N);return n!==z&&null!==z&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTimee.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,a){var l=[];l.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),r.isString(i)&&l.push("path="+i),r.isString(o)&&l.push("domain="+o),!0===a&&l.push("secure"),document.cookie=l.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(15);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),o=n(16),a=n.n(o),l=i.a.createContext(),u=n(4),c=n.n(u),s=n(3),f=n.n(s),d=n(1),p=n.n(d),m=(n(30),function(e){var t=e.children,n=e.name,r=e.onClick,o=e.variant,a=e.color,l=e.enabled,u=e.id,c=[];return n&&c.push(n),o&&c.push(o),a&&c.push(a),i.a.createElement("button",{id:u,type:"button",className:c.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:p.a.oneOfType([p.a.string,p.a.object]),name:p.a.string,onClick:p.a.func.isRequired,variant:p.a.string,color:p.a.string,enabled:p.a.bool,id:p.a.string};var h=m,v=(n(31),function(e){var t=e.label,n=e.description,r=e.mandatory,o=e.children,a=e.link,l=e.className;return i.a.createElement("div",{className:"form-element ".concat(r?"mandatory":""," ").concat(l||"")},i.a.createElement("label",{htmlFor:o.props.id},t),i.a.createElement("div",{className:"details-row"},n&&i.a.createElement("div",{className:"description"},n),a&&i.a.createElement("button",{className:"link-button",onClick:a.onClick},a.linkText)),o)});v.propTypes={label:p.a.string.isRequired,description:p.a.string,mandatory:p.a.bool,children:p.a.shape(),link:p.a.shape({onClick:p.a.func.isRequired,linkText:p.a.string.isRequired}),className:p.a.string};var g=v,y=n(5),b=n.n(y),w=(p.a.shape({title:p.a.string.isRequired,license:p.a.string.isRequired,licenseVersion:p.a.string.isRequired,disciplines:p.a.array.isRequired,language:p.a.string.isRequired,level:p.a.string}),p.a.shape({keywords:p.a.array,shortDescription:p.a.string,longDescription:p.a.string,icon:p.a.object,screenshots:p.a.array}),n(48),n(49),n(50),n(51),function(e){var t=e.src,n=new Image;n.src=t;var r={backgroundImage:"url('".concat(n.src,"')")};return i.a.createElement("span",{className:"image-preview",style:r})});w.propTypes={src:p.a.string};var k=w,x=(n(52),function(e){var t=e.onFile,n=e.clearImage,r=e.img,o=e.ariaLabel,a=i.a.createRef(),l=function(){t({}),n&&n()};return i.a.createElement("div",{className:"image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?a.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&l()},"aria-label":o},r&&r.src&&i.a.createElement(i.a.Fragment,null,i.a.createElement(k,{src:r.src}),i.a.createElement("span",{className:"icon-close",onClick:l})),i.a.createElement("div",{className:"image-upload ".concat(r&&r.src?"image-selected":"")},i.a.createElement("input",{tabIndex:"-1",ref:a,type:"file",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});x.propTypes={onFile:p.a.func.isRequired,clearImage:p.a.func,img:p.a.object,ariaLabel:p.a.string.isRequired};var E=x,T=(n(53),function(e){var t=e.title,n=e.description,r=e.mainText;return i.a.createElement("div",{className:"text-field"},i.a.createElement("div",{className:"title"},t),i.a.createElement("div",{className:"description"},n),i.a.createElement("div",{className:"main-text"},r))});T.propTypes={text:p.a.string,description:p.a.string,mainText:p.a.string};n(54);var S=i.a.forwardRef((function(e,t){var n=e.id,r=e.label,o=e.checked,a=e.filter,l=e.onChecked,u=e.focused,c=e.checkboxChildren,s=e.navigateToChildren,f=e.parent,d=e.descendantsChecked,p=e.tabIndex,m=e.children;return i.a.createElement("li",{ref:t,id:n,key:a+n,className:"checkbox ".concat(o?"checked ":""," ").concat(u?"highlighted":""," ").concat(c?"parent":""),role:"checkbox","aria-checked":o,onClick:function(){return c?s(n,c):l(a,n,!o)},tabIndex:p||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(l(a,n,!o),e.preventDefault())}},i.a.createElement("div",{className:"content",key:"label"+n},i.a.createElement("div",{className:"icon",onClick:function(e){return c?function(e,t,n,r){r.stopPropagation(),l(e,t,n,f)}(a,n,!o,e):{}}}),i.a.createElement("div",{className:"label-text"},m||r,d>0&&" (".concat(d,")"))))}));S.propTypes={id:p.a.string.isRequired,label:p.a.string.isRequired,onChecked:p.a.func.isRequired,checked:p.a.bool.isRequired,filter:p.a.string.isRequired,focused:p.a.bool,children:p.a.any,checkboxChildren:p.a.array,navigateToChildren:p.a.func,parent:p.a.string,tabIndex:p.a.string,descendantsChecked:p.a.any};var C=S,_=(n(55),function(e){var t=e.severity,n=e.children;return i.a.createElement("div",{className:"message ".concat(t)},n)});_.propTypes={severity:p.a.string.isRequired,children:p.a.node};var P=_;function N(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 O(e){for(var t=1;t=x},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0P(a,n))void 0!==u&&0>P(u,a)?(e[r]=u,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var N=[],O=[],R=1,z=null,I=3,D=!1,M=!1,L=!1;function F(e){for(var t=C(O);null!==t;){if(null===t.callback)_(O);else{if(!(t.startTime<=e))break;_(O),t.sortIndex=t.expirationTime,S(N,t)}t=C(O)}}function A(e){if(L=!1,F(e),!M)if(null!==C(N))M=!0,r(j);else{var t=C(O);null!==t&&i(A,t.startTime-e)}}function j(e,n){M=!1,L&&(L=!1,o()),D=!0;var r=I;try{for(F(n),z=C(N);null!==z&&(!(z.expirationTime>n)||e&&!a());){var l=z.callback;if(null!==l){z.callback=null,I=z.priorityLevel;var u=l(z.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?z.callback=u:z===C(N)&&_(N),F(n)}else _(N);z=C(N)}if(null!==z)var c=!0;else{var s=C(O);null!==s&&i(A,s.startTime-n),c=!1}return c}finally{z=null,I=r,D=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=l;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){M||D||(M=!0,r(j))},t.unstable_getCurrentPriorityLevel=function(){return I},t.unstable_getFirstCallbackNode=function(){return C(N)},t.unstable_next=function(e){switch(I){case 1:case 2:case 3:var t=3;break;default:t=I}var n=I;I=t;try{return e()}finally{I=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=I;I=e;try{return t()}finally{I=n}},t.unstable_scheduleCallback=function(e,n,a){var l=t.unstable_now();if("object"==typeof a&&null!==a){var u=a.delay;u="number"==typeof u&&0l?(e.sortIndex=u,S(O,e),null===C(N)&&e===C(O)&&(L?o():L=!0,i(A,u-l))):(e.sortIndex=a,S(N,e),M||D||(M=!0,r(j))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();F(e);var n=C(N);return n!==z&&null!==z&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTimee.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,a){var l=[];l.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),r.isString(i)&&l.push("path="+i),r.isString(o)&&l.push("domain="+o),!0===a&&l.push("secure"),document.cookie=l.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(15);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),o=n(16),a=n.n(o),l=i.a.createContext(),u=n(4),c=n.n(u),s=n(3),f=n.n(s),d=n(1),p=n.n(d),m=(n(30),function(e){var t=e.children,n=e.name,r=e.onClick,o=e.variant,a=e.color,l=e.enabled,u=e.id,c=[];return n&&c.push(n),o&&c.push(o),a&&c.push(a),i.a.createElement("button",{id:u,type:"button",className:c.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:p.a.oneOfType([p.a.string,p.a.object]),name:p.a.string,onClick:p.a.func.isRequired,variant:p.a.string,color:p.a.string,enabled:p.a.bool,id:p.a.string};var h=m,v=(n(31),function(e){var t=e.label,n=e.description,r=e.mandatory,o=e.children,a=e.link,l=e.className;return i.a.createElement("div",{className:"form-element ".concat(r?"mandatory":""," ").concat(l||"")},i.a.createElement("label",{htmlFor:o.props.id},t),i.a.createElement("div",{className:"details-row"},n&&i.a.createElement("div",{className:"description"},n),a&&i.a.createElement("button",{className:"link-button",onClick:a.onClick},a.linkText)),o)});v.propTypes={label:p.a.string.isRequired,description:p.a.string,mandatory:p.a.bool,children:p.a.shape(),link:p.a.shape({onClick:p.a.func.isRequired,linkText:p.a.string.isRequired}),className:p.a.string};var g=v,y=n(5),b=n.n(y),w=(p.a.shape({title:p.a.string.isRequired,license:p.a.string.isRequired,licenseVersion:p.a.string.isRequired,disciplines:p.a.array.isRequired,language:p.a.string.isRequired,level:p.a.string}),p.a.shape({keywords:p.a.array,shortDescription:p.a.string,longDescription:p.a.string,icon:p.a.object,screenshots:p.a.array}),n(48),n(49),n(50),n(51),function(e){var t=e.src,n=new Image;n.src=t;var r={backgroundImage:"url('".concat(n.src,"')")};return i.a.createElement("span",{className:"image-preview",style:r})});w.propTypes={src:p.a.string};var k=w,x=(n(52),function(e){var t=e.onFile,n=e.clearImage,r=e.img,o=e.ariaLabel,a=i.a.createRef(),l=function(){t({}),n&&n()};return i.a.createElement("div",{className:"image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?a.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&l()},"aria-label":o},r&&r.src&&i.a.createElement(i.a.Fragment,null,i.a.createElement(k,{src:r.src}),i.a.createElement("span",{className:"icon-close",onClick:l})),i.a.createElement("div",{className:"image-upload ".concat(r&&r.src?"image-selected":"")},i.a.createElement("input",{tabIndex:"-1",ref:a,type:"file",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});x.propTypes={onFile:p.a.func.isRequired,clearImage:p.a.func,img:p.a.object,ariaLabel:p.a.string.isRequired};var E=x,T=(n(53),function(e){var t=e.title,n=e.description,r=e.mainText;return i.a.createElement("div",{className:"text-field"},i.a.createElement("div",{className:"title"},t),i.a.createElement("div",{className:"description"},n),i.a.createElement("div",{className:"main-text"},r))});T.propTypes={text:p.a.string,description:p.a.string,mainText:p.a.string};n(54);var S=i.a.forwardRef((function(e,t){var n=e.id,r=e.label,o=e.checked,a=e.filter,l=e.onChecked,u=e.focused,c=e.checkboxChildren,s=e.navigateToChildren,f=e.parent,d=e.descendantsChecked,p=e.tabIndex,m=e.children;return i.a.createElement("li",{ref:t,id:n,key:a+n,className:"checkbox ".concat(o?"checked ":""," ").concat(u?"highlighted":""," ").concat(c?"parent":""),role:"checkbox","aria-checked":o,onClick:function(){return c?s(n,c):l(a,n,!o)},tabIndex:p||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(l(a,n,!o),e.preventDefault())}},i.a.createElement("div",{className:"content",key:"label"+n},i.a.createElement("div",{className:"icon",onClick:function(e){return c?function(e,t,n,r){r.stopPropagation(),l(e,t,n,f)}(a,n,!o,e):{}}}),i.a.createElement("div",{className:"label-text"},m||r,d>0&&" (".concat(d,")"))))}));S.propTypes={id:p.a.string.isRequired,label:p.a.string.isRequired,onChecked:p.a.func.isRequired,checked:p.a.bool.isRequired,filter:p.a.string.isRequired,focused:p.a.bool,children:p.a.any,checkboxChildren:p.a.array,navigateToChildren:p.a.func,parent:p.a.string,tabIndex:p.a.string,descendantsChecked:p.a.any};var C=S,_=(n(55),function(e){var t=e.severity,n=e.children;return i.a.createElement("div",{className:"message ".concat(t)},n)});_.propTypes={severity:p.a.string.isRequired,children:p.a.node};var P=_;function N(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 O(e){for(var t=1;t