diff --git a/js/h5p-hub-sharing.js b/js/h5p-hub-sharing.js index f1bd021..f54b771 100644 --- a/js/h5p-hub-sharing.js +++ b/js/h5p-hub-sharing.js @@ -51,4 +51,4 @@ var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0 Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. -*/!function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpClassLists=function(){0};var r={},o={};t.add=function(e,t){return n=e.classList,a="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(a,e),n.add(e)}));var n,a},t.remove=function(e,t){return n=e.classList,a="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(a,e),0===a[e]&&n.remove(e)}));var n,a}},function(e,t,n){"use strict";var r,o=n(29),a=(r=o)&&r.__esModule?r:{default:r};var i=void 0,l=void 0,u=[];function s(){0!==u.length&&u[u.length-1].focusContent()}a.default.subscribe((function(e,t){i&&l||((i=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),i.style.position="absolute",i.style.opacity="0",i.setAttribute("tabindex","0"),i.addEventListener("focus",s),(l=i.cloneNode()).addEventListener("focus",s)),(u=t).length>0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==l&&document.body.appendChild(l)):(i.parentElement&&i.parentElement.removeChild(i),l.parentElement&&l.parentElement.removeChild(l))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function a(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function i(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,i=null,l=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?i="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(i="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?l="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(l="UNSAFE_componentWillUpdate"),null!==n||null!==i||null!==l){var u=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==i?"\n "+i:"")+(null!==l?"\n "+l:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=a;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return i})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){var r=n(17);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=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){},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),o=n.n(r),a=n(7),i=n.n(a),l=o.a.createContext(),u=o.a.createContext(),s=n(2),c=n.n(s),f=n(3),d=n.n(f),p=n(1),h=n.n(p),m=(n(45),function(e){var t=e.children,n=e.name,r=e.onClick,a=e.variant,i=e.color,l=e.enabled,u=e.id,s=[];return n&&s.push("h5p-hub-"+n),a&&s.push("h5p-hub-"+a),i&&s.push("h5p-hub-"+i),o.a.createElement("button",{id:u,type:"button",className:s.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:h.a.oneOfType([h.a.string,h.a.object]),name:h.a.string,onClick:h.a.func.isRequired,variant:h.a.string,color:h.a.string,enabled:h.a.bool,id:h.a.string};var v=m;n(46);function g(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 y(e){for(var t=1;tn&&(a.completed=!0),[n>0?o.a.createElement(b,{key:"connector-".concat(n)}):null,o.a.cloneElement(e,y(y({key:"step-".concat(n)},a),e.props))]}));return o.a.createElement("div",{className:"h5p-hub-stepper","aria-hidden":!0},a)};w.propTypes={activeStep:h.a.number.isRequired,children:h.a.array.isRequired,completed:h.a.bool};var E=w,k=(n(47),function(e){var t=e.active,n=e.label,r=e.index,a=e.completed,i=["h5p-hub-step"];return t&&i.push("h5p-hub-active"),a&&i.push("h5p-hub-completed"),o.a.createElement("div",{className:i.join(" ")},o.a.createElement("div",{className:"h5p-hub-step-icon"},a?o.a.createElement("i",{className:"h5p-hub-icon-check"}):r+1),o.a.createElement("div",{className:"h5p-hub-step-label"},n))});k.propTypes={active:h.a.bool,label:h.a.string.isRequired,index:h.a.number.isRequired,completed:h.a.bool};var x=k,C=(n(48),function(e){var t=e.label,n=e.description,r=e.mandatory,a=e.children,i=e.link,l=e.className;return o.a.createElement("div",{className:"h5p-hub-form-element ".concat(r?"h5p-hub-mandatory":""," ").concat(l||"")},o.a.createElement("label",{htmlFor:a.props.id},t),o.a.createElement("div",{className:"h5p-hub-details-row"},n&&o.a.createElement("div",{className:"h5p-hub-description"},n),i&&o.a.createElement("button",{className:"h5p-hub-link-button",onClick:i.onClick},i.linkText)),a)});C.propTypes={label:h.a.string.isRequired,description:h.a.string,mandatory:h.a.bool,children:h.a.shape(),link:h.a.shape({onClick:h.a.func.isRequired,linkText:h.a.string.isRequired}),className:h.a.string};var S=C,T=(n(49),function(e){var t=e.selected,n=e.options,r=e.onChange,a=e.allowNone;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"h5p-hub-icon-arrow-down"}),o.a.createElement("select",{value:t,onChange:r,disabled:0===n.length},function(e,t){var n=o.a.createElement("option",{value:"",key:"-"},"-");if(e.length>0){var r=t?[n]:[];return r=r.concat(e.map((function(e,t){return e.licenses?o.a.createElement("optgroup",{key:"optgroup-"+t,label:e.translation},e.licenses.map((function(e){return o.a.createElement("option",{value:e.id,key:e.id},e.name)}))):o.a.createElement("option",{value:e.id,key:e.id},e.name)})))}return n}(n,a)))});T.prototypes={selected:h.a.string,options:h.a.array,onchange:h.a.func.isRequired,allowNone:h.a.bool},T.defaultProps={allowNone:!1};var O=T,_=n(12),N=n.n(_);function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}function q(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function B(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var V=!1,W=o.a.createContext(null),H=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus="entering"):o="entered":o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}q(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?"entering"!==n&&"entered"!==n&&(t="entering"):"entering"!==n&&"entered"!==n||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),"entering"===t?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[i.a.findDOMNode(this),r],a=o[0],l=o[1],u=this.getTimeouts(),s=r?u.appear:u.enter;!e&&!n||V?this.safeSetState({status:"entered"},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:"entering"},(function(){t.props.onEntering(a,l),t.onTransitionEnd(s,(function(){t.safeSetState({status:"entered"},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:i.a.findDOMNode(this);t&&!V?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:i.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,z(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.a.createElement(W.Provider,{value:null},"function"==typeof n?n(e,r):o.a.cloneElement(o.a.Children.only(n),r))},t}(o.a.Component);function $(){}H.contextType=W,H.propTypes={},H.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:$,onEntering:$,onEntered:$,onExit:$,onExiting:$,onExited:$},H.UNMOUNTED="unmounted",H.EXITED="exited",H.ENTERING="entering",H.ENTERED="entered",H.EXITING="exiting";var Q=H,K=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=B(n.className,r):n.setAttribute("class",B(n.className&&n.className.baseVal||"",r)));var n,r}))},Y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o1&&a.current[0!==r?r-1:1]&&a.current[0!==r?r-1:1].focus(),n(t.filter((function(t){return t.id!==e.id})).map((function(e){return e.id})))};return t.length>0?o.a.createElement("ul",{className:"h5p-hub-chips-list"},t.map((function(e,t){return o.a.createElement("li",{key:e.id},o.a.createElement("span",{className:"h5p-hub-sr-only"},e.name),o.a.createElement("button",{ref:function(e){return a.current[t]=e},"aria-label":D(r.removeChip,{":chip":e.name}),onClick:function(){return u(e)},onKeyDown:function(e){return i(e)}},e.name,o.a.createElement("div",{className:"h5p-hub-icon-close"})))}))):null});pe.propTypes={chips:h.a.array.isRequired,setChips:h.a.func.isRequired};var he=pe,me=(n(84),function(e){var t=e.chips,n=e.setKeywords,r=e.setTempKeywords,a=o.a.useRef(null),i=o.a.useContext(l),u=o.a.useState(!1),s=d()(u,2),c=s[0],f=s[1],p=o.a.useState(""),h=d()(p,2),m=h[0],v=h[1],g=o.a.useState(!1),y=d()(g,2),b=y[0],w=y[1],E=o.a.useState(""),k=d()(E,2),x=k[0],C=k[1],S=o.a.useState(!1),T=d()(S,2),O=T[0],_=T[1],N=function(e,n,r){for(var o=e.split(","),a=[],l=!1,u=function(e){var n=o[e].trim(),r=t.filter((function(e){return e.toLowerCase()===n.toLowerCase()})).length>0;r?l=!0:r||""===n||-1!==a.indexOf(n)||a.push(n)},s=0;s0&&N(x,r,!1)},value:x,onChange:function(e){C(e.target.value)}}),o.a.createElement("button",{disabled:x.length<1,className:"h5p-hub-add-button ".concat(x.length<1?"disabled":""),onClick:function(){N(x,P,!0),a.current&&a.current.focus()},dangerouslySetInnerHTML:{__html:"+ ".concat(i.add)},onFocus:function(){return _(!0)},onBlur:function(){return _(!1)}})),o.a.createElement(ee,{text:m,open:c&&(b||O),className:"h5p-hub-tip-keywords"}))});me.propTypes={chips:h.a.array.isRequired,setKeywords:h.a.func.isRequired,setTempKeywords:h.a.func.isRequired};var ve=me,ge=(n(85),function(e){var t=e.src;if(!t)return null;var n=Object(r.useMemo)((function(){var e=new Image;return e.src=t,e}),[t]),a={backgroundImage:"url('".concat(n.src,"')")};return o.a.createElement("span",{className:"h5p-hub-image-preview",style:a})});ge.propTypes={src:h.a.string};var ye=ge,be=(n(86),function(e){var t=e.onFile,n=e.clearImage,r=e.img,a=e.ariaLabel,i=e.removeImageLabel,l=o.a.createRef(),u=function(){t({}),l.current.value=null,n&&n()};return o.a.createElement("div",{className:"h5p-hub-image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?l.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&u()},"aria-label":a},r&&r.src&&o.a.createElement(o.a.Fragment,null,o.a.createElement(ye,{src:r.src}),o.a.createElement("button",{className:"h5p-hub-icon-close","aria-label":i,onKeyDown:function(e){-1!==["Enter","Space"].indexOf(e.key)&&(e.stopPropagation(),u())},onClick:u,tabIndex:"0"})),o.a.createElement("div",{className:"h5p-hub-image-upload ".concat(r&&r.src?"h5p-hub-image-selected":"")},o.a.createElement("input",{tabIndex:"-1",ref:l,type:"file",accept:".png,.jpg,.jpeg,.jfif,.pjpeg,.pjp",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});be.propTypes={onFile:h.a.func.isRequired,clearImage:h.a.func,img:h.a.object,ariaLabel:h.a.string.isRequired,removeImageLabel:h.a.string.isRequired};var we=be,Ee=(n(87),n(8)),ke=n.n(Ee),xe=n(9),Ce=n.n(xe),Se=n(4),Te=n.n(Se),Oe=n(32),_e=n.n(Oe),Ne=n(33),Pe=n.n(Ne),Re=n(13),De=n.n(Re),je=(n(90),o.a.forwardRef((function(e,t){var n=e.id,r=e.errorMessage,a=e.label,i=e.checked,u=e.filter,s=e.onChecked,c=e.focused,f=e.checkboxChildren,d=e.navigateToChildren,p=e.parent,h=e.tabIndex,m=e.children,v=o.a.useContext(l);return o.a.createElement("li",{ref:t,id:"h5p-hub-"+n,key:u+n,className:"h5p-hub-discipline-element ".concat(c?"h5p-hub-highlighted":""," ").concat(f?"h5p-hub-parent":""),onClick:function(){return f?d(n,f):{}},tabIndex:h||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(s(u,n,!i),e.preventDefault())}},o.a.createElement("div",{className:"h5p-hub-content",key:"label"+n},o.a.createElement("button",{onClick:function(e){return function(e,t,n,r){r.stopPropagation(),s(e,t,n,p)}(u,n,!i,e)},dangerouslySetInnerHTML:{__html:"+ ".concat(v.add)}}),o.a.createElement("div",{className:"h5p-hub-label-text"},m||a),o.a.createElement(ee,{text:r||"",open:null!=r,className:"h5p-hub-checkbox-error-tip"})))})));je.displayName="DiscipineElement",je.propTypes={id:h.a.string.isRequired,errorMessage:h.a.string,label:h.a.string.isRequired,onChecked:h.a.func.isRequired,checked:h.a.bool.isRequired,filter:h.a.string.isRequired,focused:h.a.bool,children:h.a.any,checkboxChildren:h.a.array,navigateToChildren:h.a.func,parent:h.a.string,tabIndex:h.a.string};var Ie=je,Le=function(e,t){return-1!==t.indexOf(e)},Me=function(e,t,n){return e?e.filter((function(e){return Le(e.id,t)&&-1===n.indexOf(e.id)})).length:0},Ae=(n(91),o.a.forwardRef((function(e,t){var n=e.items,a=e.errors,i=e.onChecked,l=e.checkedParents,u=e.checked,s=e.filter,c=e.focused,f=e.navigateToChildren,d=e.parent,p=e.listRefId,h=e.getDescendants,m=e.tabIndex,v=e.inSearch,g=e.navigateDirection,y=e.setNavigateDirection;return Object(r.useEffect)((function(){setTimeout((function(){y("")}),350)}),[n]),console.log(g),o.a.createElement("ul",{className:"h5p-hub-checkbox-list ".concat(g?"h5p-hub-animate-in-".concat(g):""),role:"group","aria-labelledby":s.name,ref:t&&t[p]},n.map((function(e){return o.a.createElement(Ie,{key:d+e.id,errorMessage:a&&a[e.id],id:e.id,label:e.name,checked:Le(e.id,u),filter:s,onChecked:i,focused:c==e.id,checkboxChildren:v?null:e.children,navigateToChildren:f,parent:d,descendantsChecked:e.children&&Me(h(e),u,l),ref:t&&t[e.id],tabIndex:m})})))})));Ae.displayName="CheckboxList",Ae.propTypes={items:h.a.array,errors:h.a.object,onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,navigateToChildren:h.a.func,parent:h.a.string,listRefId:h.a.string,tabIndex:h.a.string,inSearch:h.a.bool,navigateDirection:h.a.string,setNavigateDirection:h.a.func};var Fe=Ae,Ue=(n(92),o.a.forwardRef((function(e,t){var n=e.onChecked,r=e.checkedParents,a=e.checked,i=e.filter,l=e.focused,u=e.parent,s=e.listRefId,c=e.getDescendants,f=e.tabIndex,d=e.categoryList,p=e.searchValue,h=e.categoryRefId,m=e.dictionary,v=e.errors,g=function(e){return e.map((function(e){return o.a.createElement("div",{key:u+e.id},o.a.createElement(Ie,{key:u+e.id,errorMessage:v&&v[e.id],id:e.id,label:e.name,checked:Le(e.id,a),filter:i,onChecked:n,focused:l==e.id,parent:u,descendantsChecked:e.children&&Me(c(e),a,r),ref:t&&t[e.id],tabIndex:f},p.length>1&&function(e,t){for(var n=[],r=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:0;i.push(o.a.createElement("span",{key:"checkbox-span-"+a,className:"h5p-hub-non-bold"},e.slice(t,t+r))),n[a+1]?i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"h5p-hub-bold"},e.slice(t+r,n[a+1]))):i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"h5p-hub-bold"},e.slice(t+r))),a+=1})),i.map((function(e){return e}))}(e.name,p)))}))};return o.a.createElement("ul",{className:"h5p-hub-checkbox-list",role:"group","aria-labelledby":i.name,ref:t&&t[s]},d.map((function(e){return o.a.createElement("div",{key:"headers-"+e.id,className:e.noLine?"":"h5p-hub-bottom-line"},o.a.createElement("div",null,null!==e.catNoParent?g([e.catNoParent]):null),e.children&&o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{key:e,ref:t[h+e.id],className:"h5p-hub-category-header"},m.in," ",e.name),g(e.children)))})))})));Ue.displayName="CategoryList",Ue.propTypes={onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,parent:h.a.string,listRefId:h.a.string.isRequired,tabIndex:h.a.string,categoryRefId:h.a.string.isRequired,checkedParents:h.a.array,getDescendants:h.a.func.isRequired,categoryList:h.a.array.isRequired,searchValue:h.a.string.isRequired,dictionary:h.a.object.isRequired,errors:h.a.object};var ze=Ue,qe=(n(93),o.a.forwardRef((function(e,t){var n=e.value,r=e.onSearch,a=e.onNavigateVertical,i=e.onSelect,l=e.placeholder,u=e.onClick,s=e.onNavigateSideway,c=e.onFocus,f=e.inSearch,d=e.dictionary,p=e.handleClearSearch,h=e.closeDropdown;return o.a.createElement("div",{onMouseDown:u,className:"h5p-hub-search-button",role:"button","aria-label":d.dropdownButton},o.a.createElement("div",{className:"h5p-hub-search-field",role:"search"},o.a.createElement("input",{id:"h5p-hub-filter-search-bar",type:"text",value:n,"aria-label":l,placeholder:l,ref:t,onKeyDown:function(e){return function(e){switch(e.key){case"ArrowUp":a(-1),e.preventDefault();break;case"ArrowDown":a(1),e.preventDefault();break;case"ArrowRight":f||(s(1),e.preventDefault());break;case"ArrowLeft":f||(s(-1),e.preventDefault());break;case"Enter":i(),e.preventDefault();break;case"Escape":h(),e.preventDefault()}}(e)},onChange:function(e){var t=e.target;r(t.value)},onFocus:c,autoComplete:"off"}),o.a.createElement("div",{className:"h5p-hub-icon-arrow"})),n.length>0&&o.a.createElement("button",{onClick:p,className:"h5p-hub-clear-button"}))})));qe.displayName="SearchField",qe.propTypes={value:h.a.string,onSearch:h.a.func.isRequired,onNavigateVertical:h.a.func.isRequired,onNavigateSideway:h.a.func.isRequired,onSelect:h.a.func.isRequired,placeholder:h.a.string.isRequired,onClick:h.a.func.isRequired,onFocus:h.a.func,inSearch:h.a.bool,handleClearSearch:h.a.func.isRequired},qe.defaultProps={onNavigateVertical:function(){},onNavigateSideway:function(){},onSelect:function(){}};var Be=qe;n(94);function Ve(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return We(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return We(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t.push({id:o.id,name:o.name,children:i,catNoParent:a?o:null}):a&&t.push({id:o.id,name:o.name,catNoParent:o})}for(var l=0;l0){l=r.checkboxRefs[r.categoryRefId+r.state.categoryList[0].id].current.offsetHeight;var s,c=0,f=Ve(r.state.categoryList);try{for(f.s();!(s=f.n()).done;){var d=s.value;if(d.catNoParent&&(c+=1),c>t)break;d.children&&(c+=d.children.length),u+=1}}catch(e){f.e(e)}finally{f.f()}}var p=i+(t+1)*o+u*l-a;r.checkboxRefs[r.listRefId].current.scrollTop=p}})),c()(Te()(r),"handleNavigateSideway",(function(e){r.state.dropdownOpen&&-1==e&&r.state.parent?r.navigateToParent():r.state.dropdownOpen&&1==e&&r.state.focused&&r.getCheckboxFromId(r.state.focused,r.parents)&&r.navigateToChildren(r.state.focused,r.getCheckboxFromId(r.state.focused,r.parents).children)})),c()(Te()(r),"navigateToChildren",(function(e,t){r.setState({checkboxElements:t,parent:[].concat(de()(r.state.parent),[e]),navigateDirection:"right"}),r.searchRef.current.focus()})),c()(Te()(r),"navigateToParent",(function(){var e=r.state.parent[r.state.parent.length-2],t=r.getCheckboxFromId(e,r.parents)&&r.getCheckboxFromId(e,r.parents).children,n=r.state.parent,o=n.pop();r.setState({parent:n,checkboxElements:t||r.props.items.sort(r.compare),focused:o,navigateDirection:"left"}),r.searchRef.current.focus()})),c()(Te()(r),"compare",(function(e,t){var n=e.name.toUpperCase(),r=t.name.toUpperCase();return nr?1:void 0})),c()(Te()(r),"getDescendants",(function(e){if(null===e)return[];for(var t=[],n=[e];n.length>0;){var r=n.pop();r&&r.children&&(t.concat(r.children),r.children.forEach((function(e){t.push(e),n.push(e)})))}return t})),c()(Te()(r),"setParentsAndLeafs",(function(e){for(var t=0;t0:-1!=this.props.checked.indexOf(e)||-1!==this.state.checkedParents.indexOf(e)}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"h5p-hub-search-filter",ref:this.selfRef},o.a.createElement(Be,{ref:this.searchRef,value:this.state.searchValue,onSearch:this.handleOnSearch,placeholder:this.props.dictionary.searchPlaceholder,onClick:this.handleSearchClick,onNavigateVertical:this.handleNavigateVertical,onSelect:function(){return e.handleChecked(e.props.filter,e.state.focused,!e.checkedOf(e.state.focused),e.state.parent[e.state.parent.length-1])},onNavigateSideway:this.handleNavigateSideway,onFocus:this.handleSearchFocus,inSearch:this.state.inSearch,dictionary:this.props.dictionary,closeDropdown:this.closeDropdown,handleClearSearch:this.handleClearSearch}),this.state.parent.length>0&&this.state.dropdownOpen&&o.a.createElement("div",{className:"h5p-hub-navigate-parent"},o.a.createElement("button",{onClick:this.navigateToParent}),this.getCheckboxFromId(this.state.parent[this.state.parent.length-1],this.parents).name),this.state.dropdownOpen&&this.props.items&&(!this.props.category||this.state.searchValue.length<2)&&o.a.createElement(Fe,{onChecked:this.handleChecked,items:this.state.checkboxElements,errors:this.props.errors,checked:this.props.checked,checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,navigateToChildren:this.navigateToChildren,parent:this.state.parent[this.state.parent.length-1],ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",inSearch:this.state.inSearch,navigateDirection:this.state.navigateDirection,setNavigateDirection:function(t){return e.setState({navigateDirection:t})}}),this.state.dropdownOpen&&this.props.items&&this.props.category&&(this.state.categoryList.length>0||this.state.categoryList.topCategories)&&this.state.inSearch&&o.a.createElement(ze,{onChecked:this.handleChecked,checked:this.props.checked,checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",categoryList:this.state.categoryList,searchValue:this.state.searchValue,categoryRefId:this.categoryRefId,dictionary:this.props.dictionary,errors:this.props.errors}))}}]),n}(o.a.Component);Ke.propTypes={items:h.a.array,errors:h.a.object,handleChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,dictionary:h.a.object.isRequired,category:h.a.bool,dropdownAlwaysOpen:h.a.bool,setFocus:h.a.bool};var Ye=Ke,Xe=function(e){var t=e.disciplines,n=e.errors,a=e.setDisciplines,i=Object(r.useContext)(u),s=Object(r.useContext)(l),c=o.a.useState(!1),f=d()(c,2),p=f[0],h=f[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(he,{chips:t.map((function(e){return{id:e,name:i.getDiscipline(e).name}})),setChips:function(e){a(e),0===e.length&&h((function(e){return!e}))}}),o.a.createElement(Ye,{items:i.disciplines,errors:n,handleChecked:function(e,n,r){Array.isArray(n)&&null!==n&&r?a(t.filter((function(e){return-1===n.indexOf(e)})).concat(n)):null!=n&&r&&a([].concat(de()(t),[n]))},checked:t,filter:"discipline",dictionary:s.discipline,category:!0,dropdownAlwaysOpen:!1,setFocus:p}))};Xe.propTypes={disciplines:h.a.array.isRequired,errors:h.a.object,setDisciplines:h.a.func.isRequired};var Ge=Xe;function Je(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 Ze(e){for(var t=1;t0;){var r=n.pop();r&&r.children&&(t.push(r),r.children.forEach((function(e){n.push(e)})))}return t}(m.disciplines)):[];!function(e,t,n,r,o){var a=new FormData;a.append("_token",t),a.append("title",n.title),a.append("license",n.license),null!==n.licenseVersion&&a.append("license_version",n.licenseVersion),a.append("language",n.language),a.append("level",n.level),n.disciplines.forEach((function(e){a.append("disciplines[]",e)})),n.keywords.forEach((function(e){a.append("keywords[]",e)})),a.append("age",n.age),a.append("summary",n.shortDescription),a.append("description",n.longDescription),void 0!==n.icon.file&&a.append("icon",n.icon.file),n.remove_icon&&a.append("remove_icon",1),n.screenshots.forEach((function(e){e.file&&a.append("screenshots[]",e.file),a.append("screenshot_alt_texts[]",e.alt)})),n.remove_screenshots.forEach((function(e){a.append("remove_screenshots[]",e)})),N.a.post(e,a,{headers:{"Content-Type":"multipart/form-data"},timeout:1e4}).then(r).catch(o)}(n,f,mt(mt({},ue),{},{disciplines:t},oe),(function(e){var t=e.data;t.success?(O(!0),V(!1)):(U(t.message||null),I(!0),V(!1))}),(function(){U(null),I(!0),V(!1)}))}else k((function(e){return e+1}))},enabled:he&&!B,id:B?"h5p-hub-share-in-process":""},B?o.a.createElement("span",null,g.pleaseWait):g[fe.nextButton.label])),o.a.createElement("div",{className:"h5p-hub-sharing-note"},o.a.createElement("i",{className:"h5p-hub-icon-info"}),g.sharingNote))))))}yt.propTypes={title:h.a.string.isRequired,publishURL:h.a.string.isRequired,returnURL:h.a.string,contentType:h.a.string.isRequired,language:h.a.string.isRequired};var bt=yt;function wt(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 Et(e){for(var t=1;t0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==l&&document.body.appendChild(l)):(i.parentElement&&i.parentElement.removeChild(i),l.parentElement&&l.parentElement.removeChild(l))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function a(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function i(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,i=null,l=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?i="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(i="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?l="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(l="UNSAFE_componentWillUpdate"),null!==n||null!==i||null!==l){var u=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==i?"\n "+i:"")+(null!==l?"\n "+l:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=a;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return i})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){var r=n(17);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=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){},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),o=n.n(r),a=n(7),i=n.n(a),l=o.a.createContext(),u=o.a.createContext(),s=n(2),c=n.n(s),f=n(3),d=n.n(f),p=n(1),h=n.n(p),m=(n(45),function(e){var t=e.children,n=e.name,r=e.onClick,a=e.variant,i=e.color,l=e.enabled,u=e.id,s=[];return n&&s.push("h5p-hub-"+n),a&&s.push("h5p-hub-"+a),i&&s.push("h5p-hub-"+i),o.a.createElement("button",{id:u,type:"button",className:s.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:h.a.oneOfType([h.a.string,h.a.object]),name:h.a.string,onClick:h.a.func.isRequired,variant:h.a.string,color:h.a.string,enabled:h.a.bool,id:h.a.string};var v=m;n(46);function g(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 y(e){for(var t=1;tn&&(a.completed=!0),[n>0?o.a.createElement(b,{key:"connector-".concat(n)}):null,o.a.cloneElement(e,y(y({key:"step-".concat(n)},a),e.props))]}));return o.a.createElement("div",{className:"h5p-hub-stepper","aria-hidden":!0},a)};w.propTypes={activeStep:h.a.number.isRequired,children:h.a.array.isRequired,completed:h.a.bool};var E=w,k=(n(47),function(e){var t=e.active,n=e.label,r=e.index,a=e.completed,i=["h5p-hub-step"];return t&&i.push("h5p-hub-active"),a&&i.push("h5p-hub-completed"),o.a.createElement("div",{className:i.join(" ")},o.a.createElement("div",{className:"h5p-hub-step-icon"},a?o.a.createElement("i",{className:"h5p-hub-icon-check"}):r+1),o.a.createElement("div",{className:"h5p-hub-step-label"},n))});k.propTypes={active:h.a.bool,label:h.a.string.isRequired,index:h.a.number.isRequired,completed:h.a.bool};var x=k,C=(n(48),function(e){var t=e.label,n=e.description,r=e.mandatory,a=e.children,i=e.link,l=e.className;return o.a.createElement("div",{className:"h5p-hub-form-element ".concat(r?"h5p-hub-mandatory":""," ").concat(l||"")},o.a.createElement("label",{htmlFor:a.props.id},t),o.a.createElement("div",{className:"h5p-hub-details-row"},n&&o.a.createElement("div",{className:"h5p-hub-description"},n),i&&o.a.createElement("button",{className:"h5p-hub-link-button",onClick:i.onClick},i.linkText)),a)});C.propTypes={label:h.a.string.isRequired,description:h.a.string,mandatory:h.a.bool,children:h.a.shape(),link:h.a.shape({onClick:h.a.func.isRequired,linkText:h.a.string.isRequired}),className:h.a.string};var S=C,T=(n(49),function(e){var t=e.selected,n=e.options,r=e.onChange,a=e.allowNone;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"h5p-hub-icon-arrow-down"}),o.a.createElement("select",{value:t,onChange:r,disabled:0===n.length},function(e,t){var n=o.a.createElement("option",{value:"",key:"-"},"-");if(e.length>0){var r=t?[n]:[];return r=r.concat(e.map((function(e,t){return e.licenses?o.a.createElement("optgroup",{key:"optgroup-"+t,label:e.translation},e.licenses.map((function(e){return o.a.createElement("option",{value:e.id,key:e.id},e.name)}))):o.a.createElement("option",{value:e.id,key:e.id},e.name)})))}return n}(n,a)))});T.prototypes={selected:h.a.string,options:h.a.array,onchange:h.a.func.isRequired,allowNone:h.a.bool},T.defaultProps={allowNone:!1};var O=T,_=n(12),N=n.n(_);function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}function q(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function B(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var V=!1,W=o.a.createContext(null),H=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus="entering"):o="entered":o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}q(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?"entering"!==n&&"entered"!==n&&(t="entering"):"entering"!==n&&"entered"!==n||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),"entering"===t?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[i.a.findDOMNode(this),r],a=o[0],l=o[1],u=this.getTimeouts(),s=r?u.appear:u.enter;!e&&!n||V?this.safeSetState({status:"entered"},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:"entering"},(function(){t.props.onEntering(a,l),t.onTransitionEnd(s,(function(){t.safeSetState({status:"entered"},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:i.a.findDOMNode(this);t&&!V?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:i.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,z(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.a.createElement(W.Provider,{value:null},"function"==typeof n?n(e,r):o.a.cloneElement(o.a.Children.only(n),r))},t}(o.a.Component);function $(){}H.contextType=W,H.propTypes={},H.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:$,onEntering:$,onEntered:$,onExit:$,onExiting:$,onExited:$},H.UNMOUNTED="unmounted",H.EXITED="exited",H.ENTERING="entering",H.ENTERED="entered",H.EXITING="exiting";var Q=H,K=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=B(n.className,r):n.setAttribute("class",B(n.className&&n.className.baseVal||"",r)));var n,r}))},Y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o1&&a.current[0!==r?r-1:1]&&a.current[0!==r?r-1:1].focus(),n(t.filter((function(t){return t.id!==e.id})).map((function(e){return e.id})))};return t.length>0?o.a.createElement("ul",{className:"h5p-hub-chips-list"},t.map((function(e,t){return o.a.createElement("li",{key:e.id},o.a.createElement("span",{className:"h5p-hub-sr-only"},e.name),o.a.createElement("button",{ref:function(e){return a.current[t]=e},"aria-label":D(r.removeChip,{":chip":e.name}),onClick:function(){return u(e)},onKeyDown:function(e){return i(e)}},e.name,o.a.createElement("div",{className:"h5p-hub-icon-close"})))}))):null});pe.propTypes={chips:h.a.array.isRequired,setChips:h.a.func.isRequired};var he=pe,me=(n(84),function(e){var t=e.chips,n=e.setKeywords,r=e.setTempKeywords,a=o.a.useRef(null),i=o.a.useContext(l),u=o.a.useState(!1),s=d()(u,2),c=s[0],f=s[1],p=o.a.useState(""),h=d()(p,2),m=h[0],v=h[1],g=o.a.useState(!1),y=d()(g,2),b=y[0],w=y[1],E=o.a.useState(""),k=d()(E,2),x=k[0],C=k[1],S=o.a.useState(!1),T=d()(S,2),O=T[0],_=T[1],N=function(e,n,r){for(var o=e.split(","),a=[],l=!1,u=function(e){var n=o[e].trim(),r=t.filter((function(e){return e.toLowerCase()===n.toLowerCase()})).length>0;r?l=!0:r||""===n||-1!==a.indexOf(n)||a.push(n)},s=0;s0&&N(x,r,!1)},value:x,onChange:function(e){C(e.target.value)}}),o.a.createElement("button",{disabled:x.length<1,className:"h5p-hub-add-button ".concat(x.length<1?"disabled":""),onClick:function(){N(x,P,!0),a.current&&a.current.focus()},dangerouslySetInnerHTML:{__html:"+ ".concat(i.add)},onFocus:function(){return _(!0)},onBlur:function(){return _(!1)}})),o.a.createElement(ee,{text:m,open:c&&(b||O),className:"h5p-hub-tip-keywords"}))});me.propTypes={chips:h.a.array.isRequired,setKeywords:h.a.func.isRequired,setTempKeywords:h.a.func.isRequired};var ve=me,ge=(n(85),function(e){var t=e.src;if(!t)return null;var n=Object(r.useMemo)((function(){var e=new Image;return e.src=t,e}),[t]),a={backgroundImage:"url('".concat(n.src,"')")};return o.a.createElement("span",{className:"h5p-hub-image-preview",style:a})});ge.propTypes={src:h.a.string};var ye=ge,be=(n(86),function(e){var t=e.onFile,n=e.clearImage,r=e.img,a=e.ariaLabel,i=e.removeImageLabel,l=o.a.createRef(),u=function(){t({}),l.current.value=null,n&&n()};return o.a.createElement("div",{className:"h5p-hub-image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?l.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&u()},"aria-label":a},r&&r.src&&o.a.createElement(o.a.Fragment,null,o.a.createElement(ye,{src:r.src}),o.a.createElement("button",{className:"h5p-hub-icon-close","aria-label":i,onKeyDown:function(e){-1!==["Enter","Space"].indexOf(e.key)&&(e.stopPropagation(),u())},onClick:u,tabIndex:"0"})),o.a.createElement("div",{className:"h5p-hub-image-upload ".concat(r&&r.src?"h5p-hub-image-selected":"")},o.a.createElement("input",{tabIndex:"-1",ref:l,type:"file",accept:".png,.jpg,.jpeg,.jfif,.pjpeg,.pjp",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});be.propTypes={onFile:h.a.func.isRequired,clearImage:h.a.func,img:h.a.object,ariaLabel:h.a.string.isRequired,removeImageLabel:h.a.string.isRequired};var we=be,Ee=(n(87),n(8)),ke=n.n(Ee),xe=n(9),Ce=n.n(xe),Se=n(4),Te=n.n(Se),Oe=n(32),_e=n.n(Oe),Ne=n(33),Pe=n.n(Ne),Re=n(13),De=n.n(Re),je=(n(90),o.a.forwardRef((function(e,t){var n=e.id,r=e.errorMessage,a=e.label,i=e.checked,u=e.filter,s=e.onChecked,c=e.focused,f=e.checkboxChildren,d=e.navigateToChildren,p=e.parent,h=e.tabIndex,m=e.children,v=o.a.useContext(l);return o.a.createElement("li",{ref:t,id:"h5p-hub-"+n,key:u+n,className:"h5p-hub-discipline-element ".concat(c?"h5p-hub-highlighted":""," ").concat(f?"h5p-hub-parent":""),onClick:function(){return f?d(n,f):{}},tabIndex:h||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(s(u,n,!i),e.preventDefault())}},o.a.createElement("div",{className:"h5p-hub-content",key:"label"+n},o.a.createElement("button",{onClick:function(e){return function(e,t,n,r){r.stopPropagation(),s(e,t,n,p)}(u,n,!i,e)},dangerouslySetInnerHTML:{__html:"+ ".concat(v.add)}}),o.a.createElement("div",{className:"h5p-hub-label-text"},m||a),o.a.createElement(ee,{text:r||"",open:null!=r,className:"h5p-hub-checkbox-error-tip"})))})));je.displayName="DiscipineElement",je.propTypes={id:h.a.string.isRequired,errorMessage:h.a.string,label:h.a.string.isRequired,onChecked:h.a.func.isRequired,checked:h.a.bool.isRequired,filter:h.a.string.isRequired,focused:h.a.bool,children:h.a.any,checkboxChildren:h.a.array,navigateToChildren:h.a.func,parent:h.a.string,tabIndex:h.a.string};var Ie=je,Le=function(e,t){return-1!==t.indexOf(e)},Me=function(e,t,n){return e?e.filter((function(e){return Le(e.id,t)&&-1===n.indexOf(e.id)})).length:0},Ae=(n(91),o.a.forwardRef((function(e,t){var n=e.items,a=e.errors,i=e.onChecked,l=e.checkedParents,u=e.checked,s=e.filter,c=e.focused,f=e.navigateToChildren,d=e.parent,p=e.listRefId,h=e.getDescendants,m=e.tabIndex,v=e.inSearch,g=e.navigateDirection,y=e.setNavigateDirection;return Object(r.useEffect)((function(){setTimeout((function(){y("")}),350)}),[n]),o.a.createElement("ul",{className:"h5p-hub-checkbox-list ".concat(g?"h5p-hub-animate-in-".concat(g):""),role:"group","aria-labelledby":s.name,ref:t&&t[p]},n.map((function(e){return o.a.createElement(Ie,{key:d+e.id,errorMessage:a&&a[e.id],id:e.id,label:e.name,checked:Le(e.id,u),filter:s,onChecked:i,focused:c==e.id,checkboxChildren:v?null:e.children,navigateToChildren:f,parent:d,descendantsChecked:e.children&&Me(h(e),u,l),ref:t&&t[e.id],tabIndex:m})})))})));Ae.displayName="CheckboxList",Ae.propTypes={items:h.a.array,errors:h.a.object,onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,navigateToChildren:h.a.func,parent:h.a.string,listRefId:h.a.string,tabIndex:h.a.string,inSearch:h.a.bool,navigateDirection:h.a.string,setNavigateDirection:h.a.func};var Fe=Ae,Ue=(n(92),o.a.forwardRef((function(e,t){var n=e.onChecked,r=e.checkedParents,a=e.checked,i=e.filter,l=e.focused,u=e.parent,s=e.listRefId,c=e.getDescendants,f=e.tabIndex,d=e.categoryList,p=e.searchValue,h=e.categoryRefId,m=e.dictionary,v=e.errors,g=function(e){return e.map((function(e){return o.a.createElement("div",{key:u+e.id},o.a.createElement(Ie,{key:u+e.id,errorMessage:v&&v[e.id],id:e.id,label:e.name,checked:Le(e.id,a),filter:i,onChecked:n,focused:l==e.id,parent:u,descendantsChecked:e.children&&Me(c(e),a,r),ref:t&&t[e.id],tabIndex:f},p.length>1&&function(e,t){for(var n=[],r=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:0;i.push(o.a.createElement("span",{key:"checkbox-span-"+a,className:"h5p-hub-non-bold"},e.slice(t,t+r))),n[a+1]?i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"h5p-hub-bold"},e.slice(t+r,n[a+1]))):i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"h5p-hub-bold"},e.slice(t+r))),a+=1})),i.map((function(e){return e}))}(e.name,p)))}))};return o.a.createElement("ul",{className:"h5p-hub-checkbox-list",role:"group","aria-labelledby":i.name,ref:t&&t[s]},d.map((function(e){return o.a.createElement("div",{key:"headers-"+e.id,className:e.noLine?"":"h5p-hub-bottom-line"},o.a.createElement("div",null,null!==e.catNoParent?g([e.catNoParent]):null),e.children&&o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{key:e,ref:t[h+e.id],className:"h5p-hub-category-header"},m.in," ",e.name),g(e.children)))})))})));Ue.displayName="CategoryList",Ue.propTypes={onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,parent:h.a.string,listRefId:h.a.string.isRequired,tabIndex:h.a.string,categoryRefId:h.a.string.isRequired,checkedParents:h.a.array,getDescendants:h.a.func.isRequired,categoryList:h.a.array.isRequired,searchValue:h.a.string.isRequired,dictionary:h.a.object.isRequired,errors:h.a.object};var ze=Ue,qe=(n(93),o.a.forwardRef((function(e,t){var n=e.value,r=e.onSearch,a=e.onNavigateVertical,i=e.onSelect,l=e.placeholder,u=e.onClick,s=e.onNavigateSideway,c=e.onFocus,f=e.inSearch,d=e.dictionary,p=e.handleClearSearch,h=e.closeDropdown;return o.a.createElement("div",{onMouseDown:u,className:"h5p-hub-search-button",role:"button","aria-label":d.dropdownButton},o.a.createElement("div",{className:"h5p-hub-search-field",role:"search"},o.a.createElement("input",{id:"h5p-hub-filter-search-bar",type:"text",value:n,"aria-label":l,placeholder:l,ref:t,onKeyDown:function(e){return function(e){switch(e.key){case"ArrowUp":a(-1),e.preventDefault();break;case"ArrowDown":a(1),e.preventDefault();break;case"ArrowRight":f||(s(1),e.preventDefault());break;case"ArrowLeft":f||(s(-1),e.preventDefault());break;case"Enter":i(),e.preventDefault();break;case"Escape":h(),e.preventDefault()}}(e)},onChange:function(e){var t=e.target;r(t.value)},onFocus:c,autoComplete:"off"}),o.a.createElement("div",{className:"h5p-hub-icon-arrow"})),n.length>0&&o.a.createElement("button",{onClick:p,className:"h5p-hub-clear-button"}))})));qe.displayName="SearchField",qe.propTypes={value:h.a.string,onSearch:h.a.func.isRequired,onNavigateVertical:h.a.func.isRequired,onNavigateSideway:h.a.func.isRequired,onSelect:h.a.func.isRequired,placeholder:h.a.string.isRequired,onClick:h.a.func.isRequired,onFocus:h.a.func,inSearch:h.a.bool,handleClearSearch:h.a.func.isRequired},qe.defaultProps={onNavigateVertical:function(){},onNavigateSideway:function(){},onSelect:function(){}};var Be=qe;n(94);function Ve(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return We(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return We(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t.push({id:o.id,name:o.name,children:i,catNoParent:a?o:null}):a&&t.push({id:o.id,name:o.name,catNoParent:o})}for(var l=0;l0){l=r.checkboxRefs[r.categoryRefId+r.state.categoryList[0].id].current.offsetHeight;var s,c=0,f=Ve(r.state.categoryList);try{for(f.s();!(s=f.n()).done;){var d=s.value;if(d.catNoParent&&(c+=1),c>t)break;d.children&&(c+=d.children.length),u+=1}}catch(e){f.e(e)}finally{f.f()}}var p=i+(t+1)*o+u*l-a;r.checkboxRefs[r.listRefId].current.scrollTop=p}})),c()(Te()(r),"handleNavigateSideway",(function(e){r.state.dropdownOpen&&-1==e&&r.state.parent?r.navigateToParent():r.state.dropdownOpen&&1==e&&r.state.focused&&r.getCheckboxFromId(r.state.focused,r.parents)&&r.navigateToChildren(r.state.focused,r.getCheckboxFromId(r.state.focused,r.parents).children)})),c()(Te()(r),"navigateToChildren",(function(e,t){r.setState({checkboxElements:t,parent:[].concat(de()(r.state.parent),[e]),navigateDirection:"right"}),r.searchRef.current.focus()})),c()(Te()(r),"navigateToParent",(function(){var e=r.state.parent[r.state.parent.length-2],t=r.getCheckboxFromId(e,r.parents)&&r.getCheckboxFromId(e,r.parents).children,n=r.state.parent,o=n.pop();r.setState({parent:n,checkboxElements:t||r.props.items.sort(r.compare),focused:o,navigateDirection:"left"}),r.searchRef.current.focus()})),c()(Te()(r),"compare",(function(e,t){var n=e.name.toUpperCase(),r=t.name.toUpperCase();return nr?1:void 0})),c()(Te()(r),"getDescendants",(function(e){if(null===e)return[];for(var t=[],n=[e];n.length>0;){var r=n.pop();r&&r.children&&(t.concat(r.children),r.children.forEach((function(e){t.push(e),n.push(e)})))}return t})),c()(Te()(r),"setParentsAndLeafs",(function(e){for(var t=0;t0:-1!=this.props.checked.indexOf(e)||-1!==this.state.checkedParents.indexOf(e)}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"h5p-hub-search-filter",ref:this.selfRef},o.a.createElement(Be,{ref:this.searchRef,value:this.state.searchValue,onSearch:this.handleOnSearch,placeholder:this.props.dictionary.searchPlaceholder,onClick:this.handleSearchClick,onNavigateVertical:this.handleNavigateVertical,onSelect:function(){return e.handleChecked(e.props.filter,e.state.focused,!e.checkedOf(e.state.focused),e.state.parent[e.state.parent.length-1])},onNavigateSideway:this.handleNavigateSideway,onFocus:this.handleSearchFocus,inSearch:this.state.inSearch,dictionary:this.props.dictionary,closeDropdown:this.closeDropdown,handleClearSearch:this.handleClearSearch}),this.state.parent.length>0&&this.state.dropdownOpen&&o.a.createElement("div",{className:"h5p-hub-navigate-parent"},o.a.createElement("button",{onClick:this.navigateToParent}),this.getCheckboxFromId(this.state.parent[this.state.parent.length-1],this.parents).name),this.state.dropdownOpen&&this.props.items&&(!this.props.category||this.state.searchValue.length<2)&&o.a.createElement(Fe,{onChecked:this.handleChecked,items:this.state.checkboxElements,errors:this.props.errors,checked:this.props.checked,checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,navigateToChildren:this.navigateToChildren,parent:this.state.parent[this.state.parent.length-1],ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",inSearch:this.state.inSearch,navigateDirection:this.state.navigateDirection,setNavigateDirection:function(t){return e.setState({navigateDirection:t})}}),this.state.dropdownOpen&&this.props.items&&this.props.category&&(this.state.categoryList.length>0||this.state.categoryList.topCategories)&&this.state.inSearch&&o.a.createElement(ze,{onChecked:this.handleChecked,checked:this.props.checked,checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",categoryList:this.state.categoryList,searchValue:this.state.searchValue,categoryRefId:this.categoryRefId,dictionary:this.props.dictionary,errors:this.props.errors}))}}]),n}(o.a.Component);Ke.propTypes={items:h.a.array,errors:h.a.object,handleChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,dictionary:h.a.object.isRequired,category:h.a.bool,dropdownAlwaysOpen:h.a.bool,setFocus:h.a.bool};var Ye=Ke,Xe=function(e){var t=e.disciplines,n=e.errors,a=e.setDisciplines,i=Object(r.useContext)(u),s=Object(r.useContext)(l),c=o.a.useState(!1),f=d()(c,2),p=f[0],h=f[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(he,{chips:t.map((function(e){return{id:e,name:i.getDiscipline(e).name}})),setChips:function(e){a(e),0===e.length&&h((function(e){return!e}))}}),o.a.createElement(Ye,{items:i.disciplines,errors:n,handleChecked:function(e,n,r){Array.isArray(n)&&null!==n&&r?a(t.filter((function(e){return-1===n.indexOf(e)})).concat(n)):null!=n&&r&&a([].concat(de()(t),[n]))},checked:t,filter:"discipline",dictionary:s.discipline,category:!0,dropdownAlwaysOpen:!1,setFocus:p}))};Xe.propTypes={disciplines:h.a.array.isRequired,errors:h.a.object,setDisciplines:h.a.func.isRequired};var Ge=Xe;function Je(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 Ze(e){for(var t=1;t0;){var r=n.pop();r&&r.children&&(t.push(r),r.children.forEach((function(e){n.push(e)})))}return t}(m.disciplines)):[];!function(e,t,n,r,o){var a=new FormData;a.append("_token",t),a.append("title",n.title),a.append("license",n.license),null!==n.licenseVersion&&a.append("license_version",n.licenseVersion),a.append("language",n.language),a.append("level",n.level),n.disciplines.forEach((function(e){a.append("disciplines[]",e)})),n.keywords.forEach((function(e){a.append("keywords[]",e)})),a.append("age",n.age),a.append("summary",n.shortDescription),a.append("description",n.longDescription),void 0!==n.icon.file&&a.append("icon",n.icon.file),n.remove_icon&&a.append("remove_icon",1),n.screenshots.forEach((function(e){e.file&&a.append("screenshots[]",e.file),a.append("screenshot_alt_texts[]",e.alt)})),n.remove_screenshots.forEach((function(e){a.append("remove_screenshots[]",e)})),N.a.post(e,a,{headers:{"Content-Type":"multipart/form-data"},timeout:1e4}).then(r).catch(o)}(n,f,mt(mt({},ue),{},{disciplines:t},oe),(function(e){var t=e.data;t.success?(O(!0),V(!1)):(U(t.message||null),I(!0),V(!1))}),(function(){U(null),I(!0),V(!1)}))}else k((function(e){return e+1}))},enabled:he&&!B,id:B?"h5p-hub-share-in-process":""},B?o.a.createElement("span",null,g.pleaseWait):g[fe.nextButton.label])),o.a.createElement("div",{className:"h5p-hub-sharing-note"},o.a.createElement("i",{className:"h5p-hub-icon-info"}),g.sharingNote))))))}yt.propTypes={title:h.a.string.isRequired,publishURL:h.a.string.isRequired,returnURL:h.a.string,contentType:h.a.string.isRequired,language:h.a.string.isRequired};var bt=yt;function wt(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 Et(e){for(var t=1;t