@kbss-cvut/s-forms 0.9.1 → 0.9.2-beta-bfb894d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/media/MediaAssetViewer.d.ts +2 -1
- package/dist/components/media/icons/fullscreenIcon.d.ts +2 -0
- package/dist/s-forms.cjs +1 -1
- package/dist/s-forms.cjs.map +1 -1
- package/dist/s-forms.css +1 -1
- package/dist/s-forms.css.map +1 -1
- package/dist/s-forms.js +1 -1
- package/dist/s-forms.js.map +1 -1
- package/dist/s-forms.modern.js +1 -1
- package/dist/s-forms.modern.js.map +1 -1
- package/dist/s-forms.umd.js +1 -1
- package/dist/s-forms.umd.js.map +1 -1
- package/dist/util/MediaAssetViewerUtils.d.ts +58 -0
- package/package.json +1 -1
- package/dist/components/answer/OptimizedMenuList.d.ts +0 -5
- package/dist/components/answer/SelectAnswer.d.ts +0 -29
- package/dist/components/answer/TypeaheadAnswer.d.ts +0 -14
- package/dist/stories/TypeaheadAnswer.stories.d.ts +0 -3
package/dist/s-forms.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useMemo as t,useState as n,useEffect as o,useContext as s,useRef as r,useCallback as i,forwardRef as a,useImperativeHandle as l}from"react";import*as c from"jsonld-utils";import{IntlProvider as u,useIntl as d}from"react-intl";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.promise.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.sort.js";import*as m from"jsonld";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import p from"@kbss-cvut/tsort";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import{Form as h,FormGroup as E,FormControl as A,Alert as g,Accordion as S,Card as f,Button as v,OverlayTrigger as _,Tooltip as T,Col as N,Row as O,Badge as I,Overlay as C,FormText as b,Popover as R,ListGroup as L,ListGroupItem as y,ButtonToolbar as w,Nav as H,NavItem as D,NavLink as V,Modal as M}from"react-bootstrap";import"core-js/modules/es.object.assign.js";import U from"prop-types";import x from"react-dom";import"core-js/modules/es.regexp.to-string.js";import P from"react-datepicker";import{parse as q,format as k}from"date-fns";import F from"classnames";import z from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import j from"inputmask-core";import"core-js/modules/es.string.trim.js";import{IntelligentTreeSelect as Q}from"intelligent-tree-select/lib/components/IntelligentTreeSelect";import B from"intelligent-tree-select/lib/components/Option";import"intelligent-tree-select/lib/styles.css";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import W from"javascript-time-ago";import Y from"javascript-time-ago/locale/en";import X from"javascript-time-ago/locale/cs";import{motion as G}from"framer-motion";import{Rings as K}from"react-loader-spinner";import"core-js/modules/es.parse-int.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.parse-float.js";import"core-js/modules/es.string.split.js";import"video.js/dist/video-js.css";import"core-js/modules/es.array.reduce.js";import J from"video.js";function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},$.apply(null,arguments)}function Z(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}var ee;class te{}ee=te,te.COLUMN_COUNT=12,te.INPUT_LENGTH_THRESHOLD=50,te.DATETIME_NUMBER_FORMAT="x",te.EPOCH_MILLISECONDS="epoch-milliseconds",te.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",te.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",te.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",te.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",te.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",te.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",te.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",te.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",te.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",te.LAYOUT={FORM:"form",QUESTION_SECTION:"section",WIZARD_STEP:"wizard-step",DATE:"date",TIME:"time",DATETIME:"datetime",TEXT:"text",TEXTAREA:"textarea",CHECKBOX:"checkbox",QUESTION_TYPEAHEAD:"type-ahead",MASKED_INPUT:"masked-input",ANSWERABLE:"answerable",SPARQL:"sparql",TURTLE:"ttl",DISABLED:"disabled",HIDDEN:"hidden",COLLAPSED:"collapsed",EMPHASISED:"emphasised",EMPHASISE_ON_RELEVANT:"emphasise-on-relevant",CATEGORY:["category-1","category-2","category-3","category-4","category-5"]},te.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",te.VALUE_TYPE_CODE="code",te.VALUE_TYPE_TEXT="text",te.GENERATED_ROW_SIZE=1,te.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",te.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",te.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",te.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",te.HELP_DESCRIPTION="http://purl.org/dc/terms/description",te.SOURCE="http://purl.org/dc/terms/source",te.XSD={MAX_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxExclusive",MAX_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxInclusive",MIN_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#minExclusive",MIN_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#minInclusive",INT:"http://www.w3.org/2001/XMLSchema#int",INTEGER:"http://www.w3.org/2001/XMLSchema#integer",NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#negativeInteger",NON_NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonNegativeInteger",NON_POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonPositiveInteger",POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#positiveInteger",FLOAT:"http://www.w3.org/2001/XMLSchema#float",POSITIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#positiveFloat",NEGATIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#negativeFloat",BOOLEAN:"http://www.w3.org/2001/XMLSchema#boolean"},te.STEP="http://onto.fel.cvut.cz/ontologies/form/step",te.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",te.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",te.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",te.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",te.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",te.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",te.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",te.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",te.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",te.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",te.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",te.HAS_CORRECT_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-correct-answer-value",te.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",te.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",te.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",te.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",te.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",te.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",te.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",te.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",te.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",te.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",te.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",te.ASSET="http://onto.fel.cvut.cz/ontologies/form/media/asset",te.HAS_SOURCE="http://onto.fel.cvut.cz/ontologies/form/media/has-source",te.HAS_ANNOTATION="http://onto.fel.cvut.cz/ontologies/form/media/has-annotation",te.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",te.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",te.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",te.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",te.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",te.PREFIX="http://www.w3.org/ns/shacl#prefix",te.NAMESPACE="http://www.w3.org/ns/shacl#namespace",te.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",te.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",te.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",te.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",te.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",te.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",te.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",te.TIMESTAMP_FORMAT="http://onto.fel.cvut.cz/ontologies/form/timestamp-format",te.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",te.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",te.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",te.RDFS_LABEL=c.RDFS_LABEL,te.RDFS_COMMENT=c.RDFS_COMMENT,te.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,te.BROADER="http://www.w3.org/2004/02/skos/core#broader",te.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",te.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",te.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink",QUESTION_HINT:"questionHint"},te.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},te.DEFAULT_OPTIONS={icons:[{id:ee.ICONS.QUESTION_HELP,behavior:ee.ICON_BEHAVIOR.ENABLE},{id:ee.ICONS.QUESTION_COMMENTS,behavior:ee.ICON_BEHAVIOR.ON_HOVER},{id:ee.ICONS.QUESTION_LINK,behavior:ee.ICON_BEHAVIOR.ON_HOVER},{id:ee.ICONS.QUESTION_HINT,behavior:ee.ICON_BEHAVIOR.DISABLE}],enableOptionQuestionFeedback:!1},te.ANNOTATION={HAS_ANNOTATION_TYPE:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-annotation-type",HAS_START_TIME:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-start-time",HAS_END_TIME:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-end-time",HAS_GEOMETRY_POINTS:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-geometry-points",HAS_OPACITY:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-opacity",HAS_COLOR:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-color"},te.POLYLINE_ANNOTATION={IMPLICIT_TYPE_LABEL:"polyline",HAS_STROKE_WIDTH:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-stroke-width",HAS_FILL_COLOR:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-fill-color",DEFAULT_POLYLINE_ANNOTATION_STYLE:{color:"red",strokeWidth:2e-6,fillColor:"transparent",opacity:1}},te.TEXT_ANNOTATION={IMPLICIT_TYPE_LABEL:"text",HAS_FONT_SIZE:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-font-size",HAS_FONT_WEIGHT:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-font-weight",HAS_TEXT:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-text",DEFAULT_TEXT_ANNOTATION_STYLE:{text:"Hello world",color:"red",fontSizeInNormalizedPx:.05,fontWeight:"300",fontFamily:"sans-serif",fontColor:"red",opacity:1}},te.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},te.VALIDATION={SEVERITY:{ERROR:"error",WARNING:"warning"},DEFAULT_MESSAGE:{REQUIRED:"This field is required.",REQUIRED_ONLY_FOR_COMPLETENESS:"This field is required to complete the form.",INVALID:"This field is invalid.",CHECK:"This field must be checked.",LOWER_OR_EQUAL:"This field should be a number equal or lower to ",GREATER_OR_EQUAL:"This field must be greater or equal to "},CLASSNAME:{ERROR:"is-invalid",WARNING:"is-warning"}};var ne={"comment.form.placeholder":"Sem napište své komentáře (Ctrl+Enter pro potvrzení)","wizard.nav.tooltip":"Navigace na této kartě je zakázána, aby nedošlo k přehlédnutí důležitých otázek. K navigaci na tuto kartu použijte tlačítka související s formulářem.","wizard.next":"Další","wizard.previous":"Předchozí","section.expand":"Rozbalit","section.collapse":"Sbalit","validation.required":"Toto pole je povinné.","validation.required_only_for_completeness":"Toto pole je povinné pro vyplnění formuláře.","validation.invalid":"Toto pole je neplatné.","validation.check":"Toto pole musí být zkontrolováno.","validation.lower_or_equal":"Toto pole by mělo být číslo rovné nebo nižší než ","validation.greater_or_equal":"Toto pole musí být větší nebo rovno ","error.default_message":"Něco se pokazilo.","error.view_details":"Zobrazit podrobnosti o chybě","comment.unknownAuthor":"Neznámý autor"},oe={"comment.form.placeholder":"Write your comments here (Ctrl+Enter to confirm, Esc to cancel)","wizard.nav.tooltip":"Navigation to this tab is disabled to prevent overlooking important questions. Use form-related buttons to navigate to this tab instead.","wizard.next":"Next","wizard.previous":"Previous","section.expand":"Expand","section.collapse":"Collapse","validation.required":"This field is required.","validation.required_only_for_completeness":"This field is required to complete the form.","validation.invalid":"This field is invalid.","validation.check":"This field must be checked.","validation.lower_or_equal":"This field should be a number equal or lower to ","validation.greater_or_equal":"This field must be greater or equal to ","error.default_message":"Something went wrong.","error.view_details":"View Error Details","comment.unknownAuthor":"Unknown Author"};const se=/*#__PURE__*/e.createContext({}),re=({children:t,locale:n=navigator.language})=>{let o=oe;return n===te.LANG.cs.locale&&(o=ne),/*#__PURE__*/e.createElement(se.Provider,{value:{locale:n,lang:o}},/*#__PURE__*/e.createElement(u,{locale:n,messages:o},t))};var ie,ae={"@graph":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":"form","http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["wizard-step","section"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["textarea"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_answer":{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/answer","http://onto.fel.cvut.cz/ontologies/documentation/has_data_value":""}}]}]}]};class le{static generateForm(){return JSON.parse(JSON.stringify(ae))}}class ce{static getStringHash(e){let t=0;const n=e?e.length:0;if(0===n)return t;for(let o=0;o<n;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return t}static asArray(e){return e?e.constructor===Array?e:[e]:[]}static findQuestionById(e,t,n,o,s){if(n&&t["@id"]===e)return t;const r=ce.asArray(t[te.HAS_SUBQUESTION]);if(o)for(let t of r){let n=ce.findQuestionById(e,t,!0,!1,!1);if(n)return n}if(s)for(let t of r){let n=ce.findQuestionById(e,t,!1,!0,!0);if(n)return n}return null}static findKeyInObjects(e,t){for(let n=0;n<e.length;n++)for(let o=0;o<t.length;o++)if(e[n].hasOwnProperty(t[o]))return t[o];return null}static isOptionQuestionFeedbackEnabled(e){var t;return null!=(t=null==e?void 0:e.enableOptionQuestionFeedback)&&t}}class ue{static putObject(e,t){ue.objectMap[e]=t}static getObject(e){return ue.objectMap[e]}}ue.objectMap={};class de{static getFirstObject(e,t){const n=m.getValues(e,t);return 0===n.length?null:n[0]}static compareValues(e,t){return t="object"==typeof t?t:{"@value":t},!!((e="object"==typeof e?e:{"@value":e})&&e["@value"]&&t&&t["@value"]&&("string"==typeof e["@value"]?e["@value"]:JSON.stringify(e["@value"]))===("string"==typeof t["@value"]?t["@value"]:JSON.stringify(t["@value"])))||m.compareValues(e,t)}static toplogicalSort(e,t){let n;do{n=!1;for(let o=0;o<e.length;o++)for(let s=o;s<e.length;s++)if(e[o][t]&&("object"==typeof e[o][t]?e[o][t]["@id"]:e[o][t])===e[s]["@id"]){const t=e[o];e[o]=e[s],e[s]=t,n=!0;break}}while(n);return e}static orderPreservingToplogicalSort(e,t){const n=p(),o={};for(let s=0;s<e.length;s++){let r=e[s]["@id"];n.add(r),o[r]=e[s],ce.asArray(e[s][t]).map(e=>"object"==typeof e?e["@id"]:e).map(e=>[e,r]).forEach(e=>n.add(e))}let s=n.sort();for(let t=0;t<s.length;t++)e[t]=o[s[t]];return e}static getCompareLocalizedLabelFunction(e){return(t,n)=>{const o=c.getLocalized(t[c.RDFS_LABEL],e),s=c.getLocalized(n[c.RDFS_LABEL],e);return o<s?-1:o>s?1:0}}static orderByLocalizedLabels(e,t){return e.sort(de.getCompareLocalizedLabelFunction(t))}static checkId(e,t){if(void 0!==e)return e.constructor===Array?!!e.find(e=>e["@id"]===t):e.constructor===Object?e["@id"]===t:void 0}}class me{static isForm(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.FORM)}static isWizardStep(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.WIZARD_STEP)}static isSection(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.QUESTION_SECTION)}static isAnswerable(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.ANSWERABLE)}static isTypeahead(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.QUESTION_TYPEAHEAD)}static getPossibleValuesQuery(e){return c.getJsonAttValue(e,te.HAS_OPTIONS_QUERY)}static isDisabled(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DISABLED)}static isHidden(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.HIDDEN)}static isTextarea(e,t){return t&&t.length>te.INPUT_LENGTH_THRESHOLD&&!me.isTypeahead(e)||c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TEXTAREA)}static isText(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TEXT)}static isCalendar(e){return me.isDate(e)||me.isTime(e)||me.isDateTime(e)}static isDate(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DATE)}static isTime(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TIME)}static isDateTime(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DATETIME)}static isTimestamp(e){return c.hasValue(e,te.TIMESTAMP_FORMAT,te.EPOCH_MILLISECONDS)}static isCheckbox(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.CHECKBOX)}static isMaskedInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.MASKED_INPUT)}static isSparqlInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.SPARQL)}static isTurtleInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TURTLE)}static isCollapsed(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.COLLAPSED)}static isEmphasised(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.EMPHASISED)}static getCategory(e){return te.LAYOUT.CATEGORY.find(t=>c.hasValue(e,te.LAYOUT_CLASS,t))}static resolveValue(e){return e?e[te.HAS_OBJECT_VALUE]?e[te.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,te.HAS_DATA_VALUE):null}static resolveValueObject(e){return e?e[te.HAS_OBJECT_VALUE]?ce.asArray(e[te.HAS_OBJECT_VALUE])[0]:e[te.HAS_DATA_VALUE]?ce.asArray(e[te.HAS_DATA_VALUE])[0]:null:null}static isRelevant(e){if(!e[te.IS_RELEVANT_IF])return!0;for(let t of ce.asArray(e[te.IS_RELEVANT_IF]))if(!me.testCondition(t))return!1;return!0}static hasValidationLogic(e){return!!(e[te.REQUIRES_ANSWER]||e[te.REQUIRES_ANSWER_IF]||e[te.PATTERN]||this.containsXSDProperty(e))}static isValid(e){if(!1===e[te.HAS_VALID_ANSWER])return!1;for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(!1===this.isValid(t))return!1;return!0}static testOrCondition(e){const t=e[te.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(const e of this._getMappedObjectsArray(t))if(this.testCondition(e))return!0;return!1}static testCondition(e){const t=e[te.ACCEPTS_VALIDATION_VALUE],n=e[te.ACCEPTS_ANSWER_VALUE],o=e[te.ACCEPTS],s=e[te.HAS_TESTED_QUESTION];let r;if(e[te.HAS_SUB_CONDITION])return this.testOrCondition(e);if(t&&n&&console.warn("Support for validation and requirement constraints at same time is not implemented !"),o&&s){const e=ce.asArray(o);if(1!==e.length&&console.warn("Support for multiple accepts values is not implemented !"),e[0]["@id"]===te.ANSWERED_QUESTION){(n||t)&&console.warn("Support for accepted answer/validations values is not implemented !");for(const e of this._getMappedObjectsArray(s))if(!this.hasAnswer(e))return!1;return!0}console.warn("No support to accept question of type "+e[0]["@id"]+" !")}if(t&&s){const e=ce.asArray(t);(1!==e.length||!0!==e[0]&&"true"!==e[0])&&console.warn('Validation values other than "true" are not implemented !');for(const e of ce.asArray(s)){if(r=ue.getObject(e["@id"]),void 0===r)return console.warn("Questions is not loaded in an object map."),!0;if(!1===this.isValid(r))return!1}return!0}if(n&&s){r=ue.getObject(s["@id"]);for(const e of ce.asArray(n)){if(!r)return console.warn("Question is not defined."),!0;if(!r.hasOwnProperty(te.HAS_ANSWER))return!1;const t=m.getValues(r,te.HAS_ANSWER);if(0===t.length)return!1;const n=me.resolveValueObject(t[0]);if(n&&e&&n.hasOwnProperty("@value")&&e.hasOwnProperty("@id")&&n["@value"]==e["@id"])return!0;if(de.compareValues(n,e))return!0}}return!1}static _getMappedObjectsArray(e,t){return ce.asArray(e).map(e=>{const n=ue.getObject(e["@id"]);return void 0===n?(console.warn((t||"Object")+' "'+e["@id"]+'" is not loaded in an object map.'),null):n}).filter(function(e){return null!==e})}static hasAnswer(e){if(!e)return!1;if(e.hasOwnProperty(te.HAS_ANSWER)){const t=m.getValues(e,te.HAS_ANSWER);if(t.length){const e=me.resolveValueObject(t[0]);if(e&&(e["@value"]||e["@id"]))return!0}}for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.hasAnswer(t))return!0;return!1}static hasCorrectAnswer(e){if(!e)return!1;if(e.hasOwnProperty(te.HAS_CORRECT_ANSWER)){let t=m.getValues(e,te.HAS_CORRECT_ANSWER);if(Array.isArray(t)&&0!==t.length){t=t[0];const e=me.resolveValueObject(t);if(e&&(e["@value"]||e["@id"]))return!0}return!(!t["@value"]&&!t["@id"])}for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.hasCorrectAnswer(t))return!0;return!1}static getAnswerValue(e){if(!e)return null;if(e.hasOwnProperty(te.HAS_ANSWER)){const t=m.getValues(e,te.HAS_ANSWER);if(t.length){const e=me.resolveValueObject(t[0]);if(e&&(e["@value"]||e["@id"]))return e["@value"]||e["@id"]}}for(const t of ce.asArray(e[te.HAS_SUBQUESTION])){const e=me.getAnswerValue(t);if(e)return e}return null}static getCorrectAnswerValue(e){if(!e)return null;if(e.hasOwnProperty(te.HAS_CORRECT_ANSWER)){var t,n;let r=m.getValues(e,te.HAS_CORRECT_ANSWER);if(!r)return null;Array.isArray(r)&&(r=r[0]);let i=m.getValues(r,te.HAS_DATA_VALUE)||m.getValues(r,te.HAS_OBJECT_VALUE);if(i&&(!Array.isArray(i)||i.length>0)){var o;Array.isArray(i)&&(i=i[0]);const e=i[te.RDFS_LABEL];var s;return e?null!=(s=e["@value"])?s:e:null!=(o=i["@value"])?o:null}return null!=(t=null!=(n=r["@value"])?n:r[te.RDFS_LABEL])?t:null}for(const t of ce.asArray(e[te.HAS_SUBQUESTION])){const e=me.getCorrectAnswerValue(t);if(e)return e}return null}static resolveDateTimeFormat(e,t,n){const o=me.isDate(e),s=me.isTime(e),r=me.isDateTime(e);switch(!0){case o:return e[te.DATE_FORMAT]||n.dateFormat;case s:return e[te.TIME_FORMAT]||n.timeFormat;case r:return e[te.DATETIME_FORMAT]||n.dateTimeFormat;default:return null}}static dfsTraverseQuestionTree(e,t,n=(()=>{})){function o(e){t(e),ce.asArray(e[te.HAS_SUBQUESTION]).forEach(e=>{o(e)}),n(e)}e.forEach(e=>{o(e)})}static getFormSpecification(e){let t=-1;const n="..";let o="";return me.dfsTraverseQuestionTree(e,function(e){t+=1;const s=" ".repeat(t);let r="";e[te.REQUIRES_ANSWER]&&!e[te.USED_ONLY_FOR_COMPLETENESS]?r=s+n+"required: "+e[te.REQUIRES_ANSWER]+"\n":e[te.USED_ONLY_FOR_COMPLETENESS]&&(r=s+n+"required only for completeness: "+e[te.USED_ONLY_FOR_COMPLETENESS]+"\n"),o+=s+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",o+=e[te.HELP_DESCRIPTION]?s+n+"description: "+e[te.HELP_DESCRIPTION]+"\n":"",o+=r,o+=e[te.PATTERN]?s+n+"pattern: "+e[te.PATTERN]+"\n":"",o+=e[te.INPUT_MASK]?s+n+"mask: "+e[te.INPUT_MASK]+"\n":"",o+=e[te.XSD.MAX_INCLUSIVE]?s+n+"This field should be a number equal or lower to "+e[te.XSD.MAX_INCLUSIVE]+"\n":"",o+=e[te.XSD.MIN_INCLUSIVE]?s+n+"This field must be greater or equal to "+e[te.XSD.MIN_INCLUSIVE]+"\n":"",o+=e[te.HAS_VALIDATION_MESSAGE]?s+n+"validation-message: "+e[te.HAS_VALIDATION_MESSAGE]+"\n":"",o+="\n"},function(){t-=1}),o}static containsXSDProperty(e){const t=Object.keys(e),n=Object.values(te.XSD);for(const e of n)if(t.includes(e))return!0;return!1}static getInputMask(e){if(e[te.INPUT_MASK])return e[te.INPUT_MASK]}static hasMediaContentWithAnnotations(e){if(e[te.HAS_MEDIA_CONTENT])for(const t of ce.asArray(e[te.HAS_MEDIA_CONTENT]))if(t[te.HAS_ANNOTATION]&&ce.asArray(t[te.HAS_ANNOTATION]).length>0)return!0;return!1}static containsHints(e){if(e[te.HAS_SUBQUESTION])for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.containsHints(t))return!0;return this.hasCorrectAnswer(e)||this.hasMediaContentWithAnnotations(e)}}class pe{static log(e){console.log(e)}static warn(e){console.warn?console.warn(e):console.log("WARNING: "+e)}static error(e){console.error?console.error(e):console.log("ERROR: "+e)}}const he={root:{[te.HAS_LAYOUT_CLASS]:te.FORM},expandProperties:[te.HAS_SUBQUESTION,te.IS_RELEVANT_IF,te.HAS_ANSWER,te.HAS_DECLARED_PREFIX,te.HAS_OPTION,te.HAS_CORRECT_ANSWER,te.HAS_COMMENT,te.HAS_MEDIA_CONTENT,te.HAS_ANNOTATION]};class Ee{static customFrame(e,t,n){if(arguments.length<2)return m.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=he),m.flatten(e,null,null,(e,t)=>{})}static expandStructure(e){let t;const n={};e["@graph"].forEach(e=>{n[e["@id"]]=e,me.isForm(e)&&(t=e)});try{this._expandGraph(t,he,n)}catch(e){console.error("Error '"+e+"' occured, while trying to apply frame-ing with custom shape.")}return n}static _expandGraph(e,t,n){let o,s,r;t.expandProperties.forEach(i=>{if(e.hasOwnProperty(i)){e[i]=ce.asArray(e[i]),o=e[i];for(let e=0;e<o.length;e++)r=this._getId(o[e]),s=n[r],void 0!==s?(o[e]=s,this._expandGraph(s,t,n)):console.warn("object with @id "+r+" was not defined in input data.")}})}static _getId(e){return"string"==typeof e?e:e&&"object"==typeof e?e["@id"]:void 0}}ie=Ee,Ee.compressStructure=e=>{let t=[],n=new Set;return t=ie._compressGraph(e,t,n),t=t.sort((e,t)=>e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0),t},Ee._compressGraph=(e,t,n)=>(n.has(e["@id"])||(t.push(e),n.add(e["@id"])),he.expandProperties.forEach(o=>{if(e.hasOwnProperty(o)){const s=e[o];for(let r=0;r<s.length;r++){const i=s[r];void 0!==i&&(s[r]=i,t=ie._compressGraph(i,t,n),e[o][r]={"@id":i["@id"]})}}}),t);class Ae{static constructDefaultForm(e){const t=le.generateForm();return Ae._constructFormQuestions(t,e)}static async constructForm(e,t){let n,o;return m.flatten(e,{}).then(e=>{try{const[s,r]=Ae._constructFormQuestions(e,t);o=r,n={formQuestions:s}}catch(e){console.error("Error while constructing form questions from the provided structure:",e)}if(!o){const[e,s]=Ae.constructDefaultForm(t);o=s,n={formQuestions:e}}return[n,o]}).catch(e=>(console.error("Failed to flatten the JSON-LD structure. Expected to transform a nested JSON-LD document into a flattened array of node objects:",e),[n,o]))}static _constructFormQuestions(e,t){let n,o,s,r=[];if(void 0!==e["@graph"][0]["@id"]?(s=Ee.expandStructure(e),Object.keys(s).map(e=>{ue.putObject(e,s[e])})):console.warn("default form is constructed."),n=e["@graph"].find(e=>me.isForm(e)),o=n[te.HAS_SUBQUESTION],!o)throw pe.error("Could not find any questions in the received data."),"No questions in the form";return r=o.filter(e=>!(!me.isWizardStep(e)||me.isHidden(e))||(pe.warn("Item is not a wizard step: "+e),!1)),r.length||(pe.log("Could not find any wizard steps in the received data. Building form without steps"),n[te.HAS_SUBQUESTION].forEach(e=>r.push(e))),r.sort(de.getCompareLocalizedLabelFunction(t)),de.orderPreservingToplogicalSort(r,te.HAS_PRECEDING_QUESTION),[r,{root:n}]}}const ge=["validation","children","value"];class Se extends e.Component{constructor(e){super(e),this.state={cursorPosition:0}}focus(){x.findDOMNode(this.input).focus()}getInputDOMNode(){return x.findDOMNode(this.input)}componentDidUpdate(e,t,n){(this.fieldDidShrink(e)||this.fieldDidExpand(e))&&this.updateFieldCursorPosition()}fieldDidExpand(e){return"textarea"===this.props.type&&"textarea"!==e.type}fieldDidShrink(e){return"text"===this.props.type&&"text"!==e.type}updateFieldCursorPosition(){this.focus(),this.getInputDOMNode().setSelectionRange(this.state.cursorPosition,this.state.cursorPosition)}saveCursorPosition(e){this.props.onChange(e),this.setState({cursorPosition:e.target.selectionStart})}render(){switch(this.props.type){case"radio":return this._renderRadio();case"checkbox":return this._renderCheckbox();case"select":return this._renderSelect();case"textarea":return this._renderTextArea();default:return this._renderInput()}}_renderCheckbox(){/*#__PURE__*/return e.createElement(h.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),className:"mb-3"},/*#__PURE__*/e.createElement(h.Check,$({type:"checkbox",ref:e=>this.input=e},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)}_renderRadio(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Check,$({type:"radio",ref:e=>this.input=e},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)}_renderSelect(){const t=this.props,{validation:n,children:o,value:s}=t,r=Z(t,ge);/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(A,$({as:"select",value:s,className:n.classname,ref:e=>this.input=e},r),o),n.message)}_renderLabel(){return this.props.label?/*#__PURE__*/e.createElement(h.Label,null,this.props.label):null}_renderTextArea(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(A,$({ref:e=>this.input=e,as:"textarea"},this.props,{className:this.props.validation.classname,onChange:e=>this.saveCursorPosition(e)})),this.props.validation.message)}_renderInput(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(A,$({className:this.props.validation.classname,ref:e=>this.input=e,as:"input",placeholder:this.props.placeholder},this.props,{onChange:e=>this.saveCursorPosition(e)})),this.props.validation.message)}}Se.propTypes={type:U.string,label:U.object,value:U.any,onChange:U.func,help:U.string,validation:U.object,placeholder:U.string},Se.defaultProps={type:"text"};const fe=["children"],ve=/*#__PURE__*/e.createContext({}),_e={components:{inputComponent:Se},componentsOptions:{dateTimeAnswer:{dateFormat:"yyyy-MM-dd",timeFormat:"HH:mm",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},readOnly:!1},options:{intl:{locale:"en"},modalView:!1,modalProps:{},horizontalWizardNav:!0,wizardStepButtons:!0,enableWizardStepSkip:!0,startingStep:0,enableOptionQuestionFeedback:!1}},Te=n=>{let{children:o}=n,s=Z(n,fe);const r=t(()=>({inputComponent:s.components&&s.components.inputComponent||_e.components.inputComponent,componentsOptions:Object.assign({},_e.componentsOptions,s.componentsOptions),options:Object.assign({},_e.options,s.options),mapComponent:s.mapComponent}),[s]);/*#__PURE__*/return e.createElement(ve.Provider,{value:r},o)};Te.propTypes={children:U.element.isRequired,components:U.object,mapComponent:U.func,options:U.object};class Ne extends e.Component{constructor(e){super(e),this.state={hasError:!1,errorLabel:null,errorDetails:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({errorLabel:e,errorDetails:t})}render(){if(this.state.hasError){const{lang:t}=this.context;/*#__PURE__*/return e.createElement("div",{style:{padding:"20px"}},/*#__PURE__*/e.createElement(g,{variant:"danger"},/*#__PURE__*/e.createElement(g.Heading,null,t["error.default_message"]||"Something went wrong."),/*#__PURE__*/e.createElement("p",null,this.state.errorLabel&&this.state.errorLabel.toString())),/*#__PURE__*/e.createElement(S,null,/*#__PURE__*/e.createElement(f,null,/*#__PURE__*/e.createElement(f.Header,null,/*#__PURE__*/e.createElement(S,{as:v,variant:"link",eventKey:"0"},t["error.view_details"]||"View Error Details")),/*#__PURE__*/e.createElement(S.Collapse,{eventKey:"0"},/*#__PURE__*/e.createElement(f.Body,null,/*#__PURE__*/e.createElement("pre",{style:{whiteSpace:"pre-wrap"}},this.state.errorDetails&&this.state.errorDetails.componentStack))))))}return this.props.children}}Ne.contextType=se;const Oe=["children"],Ie=/*#__PURE__*/e.createContext({}),Ce=n=>{let{children:o}=n,s=Z(n,Oe),r=[];const i=async(e,t)=>{const n=r[e];if(n&&n.length)return n;const o=await s.fetchTypeAheadValues(t);return o.length?m.frame(o,{},{}).then(t=>{const n=t["@graph"];return r.push(Object.assign({},n,{[e]:n})),n}):(pe.warn(`No data received when loading options using id ${e}`),[])},a=e=>r[e]||[],l=t(()=>({loadFormOptions:i,getOptions:a}),[i,a]);/*#__PURE__*/return e.createElement(Ie.Provider,$({value:l},s),o)};Ce.propTypes={children:U.element.isRequired,fetchTypeAheadValues:U.func};const be={},Re=[],Le=/*#__PURE__*/e.createContext({}),ye=s=>{const[r,i]=n(s.data||be),[a,l]=n(s.formQuestions||Re);o(()=>{if(s.isFormValid){const e=me.isValid(r);s.isFormValid(e)}},[]),o(()=>{i(s.data||be)},[a]);const c=e=>{e&&i(Object.assign({},r,e))},u=(e,t)=>{if(!(!t||e<0||e>=a.length)){if("object"==typeof t){const n=[...a];n[e]=Object.assign({},n[e],t),l(n)}if(Array.isArray(t)&&l(t),s.isFormValid){const e=me.isValid(r);s.isFormValid(e)}}},d=()=>r,m=e=>null==e?a:a[e],p=t(()=>({updateData:c,updateFormQuestionsData:u,getData:d,getFormQuestionsData:m}),[m,d]);/*#__PURE__*/return e.createElement(Le.Provider,$({value:p},s),s.children)};ye.propTypes={children:U.element.isRequired,data:U.object.isRequired,formQuestions:U.array.isRequired,isFormValid:U.func};class we{static buildQuestionAnswerModel(e,t){const n={subQuestions:[]};let o;if(e&&(n.uri=e.root["@id"],n.origin=c.getJsonAttValue(e.root,te.HAS_QUESTION_ORIGIN,"@id")),t)for(let e=0;e<t.length;e++)o=we.processQuestionAnswerHierarchy(t[e]),o&&n.subQuestions.push(o);return n}static processQuestionAnswerHierarchy(e){return e?we._processQuestion(e):null}static _processQuestion(e){const t={};if(t.uri=e["@id"],t.origin=c.getJsonAttValue(e,te.HAS_QUESTION_ORIGIN,"@id"),e[te.HAS_SUBQUESTION]){t.subQuestions=[];for(let n=0;n<e[te.HAS_SUBQUESTION].length;n++)t.subQuestions.push(we._processQuestion(e[te.HAS_SUBQUESTION][n]))}if(e[te.HAS_ANSWER]){t.answers=[],Array.isArray(e[te.HAS_ANSWER])||(e[te.HAS_ANSWER]=[e[te.HAS_ANSWER]]);for(let n=0;n<e[te.HAS_ANSWER].length;n++)t.answers.push(we.processAnswer(e[te.HAS_ANSWER][n]))}if(e[te.HAS_COMMENT]){t.comments=[],Array.isArray(e[te.HAS_COMMENT])||(e[te.HAS_COMMENT]=[e[te.HAS_COMMENT]]);for(let n=0;n<e[te.HAS_COMMENT].length;n++)t.comments.push(we.processComment(e[te.HAS_COMMENT][n]))}return t}static processComment(e){const t={};return t.author=c.getJsonAttValue(e,te.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,te.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,te.HAS_TIMESTAMP,"@id"),t}static processAnswer(e){const t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,te.HAS_ANSWER_ORIGIN,"@id"),e[te.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,te.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,te.HAS_DATA_VALUE),t}static generateAnswer(e){const t={};return t[te.HAS_DATA_VALUE]="",t}}const He=t=>{const{inputComponent:n,componentsOptions:o}=s(ve);/*#__PURE__*/return e.createElement(n,{type:"checkbox",label:t.label,title:t.title,checked:!0===t.value||"true"===t.value,validation:t.validation,onChange:e=>{t.onChange(e.target.checked)},disabled:o.readOnly||me.isDisabled(t.question)})};He.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.bool]),onChange:U.func.isRequired,mouseHover:U.bool,validation:U.object};const De=t=>{const{componentsOptions:r}=s(ve),[i,a]=n(null),[l,c]=n(""),u=me.resolveDateTimeFormat(t.question,t.value,r.dateTimeAnswer),d=me.isDate(t.question),m=me.isTime(t.question),p=me.isTimestamp(t.question);o(()=>{const e=A(t.value);e?a(e):(a(null),c(`Invalid date value ${t.value} of question ${t.question["@id"]}.`),console.error(l))},[t.value,u]);const A=e=>{if(!e)return null;const t=p?new Date(e):q(e,u,new Date);return isNaN(t.getTime())?null:t};/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(P,{selected:i,placeholderText:u,onChange:e=>{a(e);const n=e?p?e.getTime():k(e,u):"";t.onChange(n)},showTimeSelect:!d,showTimeSelectOnly:m,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:u,className:F("form-control",t.validation.classname),disabled:r.readOnly||me.isDisabled(t.question)}),t.validation.message)};De.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const Ve=[te.XSD.INT,te.XSD.INTEGER,te.XSD.NON_NEGATIVE_INTEGER,te.XSD.NON_POSITIVE_INTEGER,te.XSD.NEGATIVE_INTEGER,te.XSD.POSITIVE_INTEGER,te.XSD.FLOAT,te.XSD.POSITIVE_FLOAT,te.XSD.NEGATIVE_FLOAT],Me={};Me[te.XSD.NON_NEGATIVE_INTEGER]={min:0},Me[te.XSD.NON_POSITIVE_INTEGER]={max:0},Me[te.XSD.NEGATIVE_INTEGER]={max:-1},Me[te.XSD.POSITIVE_INTEGER]={min:1};const Ue={"string-2":"prefixed",atom:"var"};class xe{static _resolveInputType(e,t){return me.isSparqlInput(e)||me.isTurtleInput(e)||me.isTextarea(e,t)?"textarea":xe._isNumeric(e)?"number":"text"}static _isNumeric(e){for(let t=0,n=Ve.length;t<n;t++)if(c.hasValue(e,te.HAS_DATATYPE,Ve[t]))return!0;return!1}static resolveInputProperties(e,t,n){let o={};switch(o.type=xe._resolveInputType(e,t),o.type){case"textarea":o.rows=5;break;case"number":o=Object.assign({},o,xe._resolveNumberRestrictions(e),this._resolveStepRestriction(e))}return o.disabled=n.readOnly||me.isDisabled(e),o}static _resolveStepRestriction(e){let t={};return void 0!==e[te.STEP]&&(t.step=c.getJsonAttValue(e,te.STEP)),t}static _resolveNumberRestrictions(e){let t={};return Object.getOwnPropertyNames(Me).forEach(n=>{c.hasValue(e,te.HAS_DATATYPE,n)&&(t=Object.assign({},t,Me[n]))}),void 0!==e[te.XSD.MIN_INCLUSIVE]&&(t.min=e[te.XSD.MIN_INCLUSIVE]),void 0!==e[te.XSD.MIN_EXCLUSIVE]&&(t.min=e[te.XSD.MIN_EXCLUSIVE]+1),void 0!==e[te.XSD.MAX_EXCLUSIVE]&&(t.max=e[te.XSD.MAX_EXCLUSIVE]-1),void 0!==e[te.XSD.MAX_INCLUSIVE]&&(t.max=e[te.XSD.MAX_INCLUSIVE]),t}static _preventCharacterInput(e,t){"number"!==xe._resolveInputType(t)||e.key>="0"&&e.key<="9"||["Backspace","Delete","ArrowLeft","ArrowRight","-","Minus","NumpadSubtract",".","Period"].includes(e.key)||e.preventDefault()}}const Pe=t=>{const{inputComponent:n,componentsOptions:o}=s(ve),r=t.question,i=t.answer;let a=t.value;return i[te.HAS_OBJECT_VALUE]&&i[te.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(a=c.getJsonAttValue(i[te.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(n,Object.assign({},xe.resolveInputProperties(r,a,o),{validation:t.validation,label:t.label,title:t.title,value:null==a?"":a,placeholder:me.getInputMask(r),onKeyPress:e=>xe._preventCharacterInput(e,r),onChange:e=>{t.onChange(e.target.value),(t.sparql||t.turtle)&&(void 0).hide()},onFocus:e=>{if(t.sparql){const n=z.fromTextArea(e.target);n.setValue(a),n.on("change",()=>{t.onChange(n.getValue())}),z.Autocompleters.prefixes.appendPrefixIfNeeded=function(e,n){if(!e.autocompleters.getTrie(n))return;if(!e.options.autocompleters||-1===e.options.autocompleters.indexOf(n))return;const o=e.getCursor(),s=e.getTokenAt(o);if("prefixed"===Ue[s.type]){const r=s.string.indexOf(":");if(-1!==r){const i=e.getPreviousNonWsToken(o.line,s).string.toUpperCase(),a=e.getTokenAt({line:o.line,ch:s.start});if("PREFIX"!==i&&("ws"===a.type||null==a.type)){const o=s.string.substring(0,r+1);if(null==e.getPrefixesFromQuery()[o.slice(0,-1)])if(t.question[te.HAS_DECLARED_PREFIX]&&t.question[te.HAS_DECLARED_PREFIX].filter(e=>e[te.PREFIX]===o.slice(0,-1)).length){const n=t.question[te.HAS_DECLARED_PREFIX].filter(e=>e[te.PREFIX]===o.slice(0,-1)),s={};s[n[0][te.PREFIX]]=n[0][te.NAMESPACE],e.addPrefixes(s)}else{const t=e.autocompleters.getTrie(n).autoComplete(o);t.length>0&&e.addPrefixes(t[0])}}}}}}else if(t.turtle){console.log("TTL");const n=z.fromTextArea(e.target);n.setValue(a),n.on("change",()=>{t.onChange(n.getValue())})}}}))};Pe.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const qe={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"};class ke{static mapMask(e){if(!e)return e;let t,n="";for(let o=0,s=e.length;o<s;o++)t=e.charAt(o),n+=qe[t]?qe[t]:t;return n}}const Fe=["size","placeholder"];function ze(e){let t,n,o,s;if(void 0!==e.selectionStart)t=e.selectionStart,n=e.selectionEnd;else try{e.focus(),o=e.createTextRange(),s=o.duplicate(),o.moveToBookmark(document.selection.createRange().getBookmark()),s.setEndPoint("EndToStart",o),t=s.text.length,n=t+o.text.length}catch(e){}return{start:t,end:n}}class je extends e.Component{constructor(e){super(e),this._updatePattern=e=>{this.mask.setPattern(ke.mapMask(e.mask),{value:this.mask.getRawValue(),selection:ze(this.input)})},this._updateMaskSelection=()=>{this.mask.selection=ze(this.input)},this._updateInputSelection=()=>{!function(e,t){let n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t.start,t.end)):(e.focus(),n=e.createTextRange(),n.collapse(!0),n.moveStart("character",t.start),n.moveEnd("character",t.end-t.start),n.select())}catch(e){}}(this.input,this.mask.selection)},this._onChange=e=>{const t=this.mask.getValue();if(e.target.value!==t){if(e.target.value.length<t.length){const n=t.length-e.target.value.length;this._updateMaskSelection(),this.mask.selection.end=this.mask.selection.start+n,this.mask.backspace()}const n=this._getDisplayValue();e.target.value=n,n&&this._updateInputSelection()}this.props.onChange&&this.props.onChange(e)},this._onKeyDown=e=>{if(function(e){return e.ctrlKey&&90===e.keyCode}(e))e.preventDefault(),this.mask.undo()&&(e.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e));else if(function(e){return e.ctrlKey&&89===e.keyCode}(e))e.preventDefault(),this.mask.redo()&&(e.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e));else if("Backspace"===e.key&&(e.preventDefault(),this._updateMaskSelection(),this.mask.backspace())){const t=this._getDisplayValue();e.target.value=t,t&&this._updateInputSelection(),this.props.onChange&&this.props.onChange(e)}},this._onKeyPress=e=>{e.metaKey||e.altKey||e.ctrlKey||"Enter"===e.key||(e.preventDefault(),this._updateMaskSelection(),this.mask.input(e.key)&&(e.target.value=this.mask.getValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e)))},this._onPaste=e=>{e.preventDefault(),this._updateMaskSelection(),this.mask.paste(e.clipboardData.getData("Text"))&&(e.target.value=this.mask.getValue(),setTimeout(this._updateInputSelection,0),this.props.onChange&&this.props.onChange(e))},this.mask=new j({pattern:ke.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"})}componentDidUpdate(e){e.mask!==this.props.mask&&this._updatePattern(this.props),e.mask!==this.props.mask&&e.value!==this.props.mask?this.mask.getValue()===this.mask.emptyValue?this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.value!==this.props.value&&this.mask.setValue(this.props.value),e.mask!==this.props.mask&&this.mask.selection.start&&this._updateInputSelection()}_getDisplayValue(){const e=this.mask.getValue();return e===this.mask.emptyValue?"":e}focus(){this.input.focus()}blur(){this.input.blur()}render(){const t=this.props,{size:n,placeholder:o}=t,s=Z(t,Fe),r=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},s,{ref:e=>{e&&(this.input=e.input?x.findDOMNode(e.input):e)},maxLength:r,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:o||this.mask.emptyValue,size:n||r,value:this._getDisplayValue(),type:"text"}))}}je.contextType=ve,je.propTypes={mask:U.string.isRequired},je.defaultProps={value:""};const Qe=t=>{const{componentsOptions:n}=s(ve),o=t.question,r=t.value,i=c.getJsonAttValue(o,te.INPUT_MASK);return i?/*#__PURE__*/e.createElement(je,{mask:i,value:r,label:t.label,title:t.title,placeholder:i,onChange:e=>t.onChange(e.target.value),disabled:n.readOnly||me.isDisabled(o),validation:t.validation}):(pe.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(Pe,t))};Qe.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const Be=(t,n="-- Select --")=>{const o=[...t].sort((e,t)=>{const n=c.getJsonAttValue(e,te.RDFS_LABEL),o=c.getJsonAttValue(t,te.RDFS_LABEL);return n<o?-1:n>o?1:0}).map((t,n)=>{const o=c.getJsonAttValue(t,te.RDFS_LABEL);/*#__PURE__*/return e.createElement("option",{value:o,key:`opt-${n}`},o)});return[/*#__PURE__*/e.createElement("option",{value:"",key:"opt-placeholder",disabled:!0,hidden:!0},n),...o]},We=({question:t,label:n,title:o,value:r,validation:i,onChange:a})=>{const{inputComponent:l,componentsOptions:c}=s(ve);/*#__PURE__*/return e.createElement(l,{type:"select",label:n,value:r,title:o,validation:i,onChange:e=>a(e.target.value),disabled:c.readOnly||me.isDisabled(t)},Be(t[te.HAS_OPTION]))};function Ye({size:t=17,className:n=""}){/*#__PURE__*/return e.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",className:n,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},/*#__PURE__*/e.createElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"}))}function Xe({size:t=17,className:n=""}){/*#__PURE__*/return e.createElement("svg",{width:t,height:t,viewBox:"0 0 50 50",className:n,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},/*#__PURE__*/e.createElement("path",{strokeWidth:3,stroke:"currentColor",d:"M 41.9375 8.625 C 41.273438 8.648438 40.664063 9 40.3125 9.5625 L 21.5 38.34375 L 9.3125 27.8125 C 8.789063 27.269531 8.003906 27.066406 7.28125 27.292969 C 6.5625 27.515625 6.027344 28.125 5.902344 28.867188 C 5.777344 29.613281 6.078125 30.363281 6.6875 30.8125 L 20.625 42.875 C 21.0625 43.246094 21.640625 43.410156 22.207031 43.328125 C 22.777344 43.242188 23.28125 42.917969 23.59375 42.4375 L 43.6875 11.75 C 44.117188 11.121094 44.152344 10.308594 43.78125 9.644531 C 43.410156 8.984375 42.695313 8.589844 41.9375 8.625 Z"}))}We.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object},Ye.propTypes={size:U.number,className:U.string},Xe.propTypes={size:U.number,className:U.string};const Ge=({status:t})=>"correct"===t?/*#__PURE__*/e.createElement(Xe,{className:"select-feedback-badge correct visible"}):"incorrect"===t?/*#__PURE__*/e.createElement(Ye,{className:"select-feedback-badge incorrect visible"}):null;Ge.displayName="SelectFeedbackBadge",Ge.propTypes={status:U.oneOf(["correct","incorrect",null])};const Ke="select-correct",Je="select-incorrect",$e=({question:t,label:i,title:a,value:l,validation:u,onChange:d,hintRevealed:m})=>{const{inputComponent:p,componentsOptions:h}=s(ve),E=r(null),[A,g]=n(null),[S,f]=n(null!=l?l:""),v=e=>{const n=((e,t)=>t?e.trim()===t.trim()?"correct":"incorrect":null)(e,me.getCorrectAnswerValue(t));var o,s,r,i;n&&(s="correct"===n,(o=null!=(r=null==(i=E.current)?void 0:i.querySelector("select"))?r:null)&&(o.classList.remove(Ke,Je),o.classList.add(s?Ke:Je)),g(n))};o(()=>{var e;if(!me.hasAnswer(t)||!l)return;const n=((e=[],t)=>{const n=((e=[],t)=>{var n;return null!=(n=e.find(e=>e["@id"]===t))?n:null})(e,t);return n?c.getJsonAttValue(n,te.RDFS_LABEL):t})(null!=(e=t[te.HAS_OPTION])?e:[],l);f(n),v(n)},[]);const _=()=>{const e=me.getCorrectAnswerValue(t);e&&(f(e),d(e),v(e))};return o(()=>{m&&_()},[m]),/*#__PURE__*/e.createElement("div",{ref:E,style:{position:"relative"}},/*#__PURE__*/e.createElement(p,{type:"select",label:i,value:S,title:a,validation:u,onChange:e=>{if(m)return void _();const t=e.target.value;f(t),d(t),v(t)},disabled:h.readOnly||me.isDisabled(t)},Be(t[te.HAS_OPTION])),/*#__PURE__*/e.createElement(Ge,{status:A}))};$e.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool};const Ze=t=>{const n=s(ve),o=ce.isOptionQuestionFeedbackEnabled(null==n?void 0:n.options);/*#__PURE__*/return e.createElement(o?$e:We,t)};Ze.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool,onRevealHint:U.func};const et=(e,t)=>{if(!e)return[];e=((e,t)=>void 0!==e&&e.length?(e.sort(de.getCompareLocalizedLabelFunction(t)),de.orderPreservingToplogicalSort(e,te.HAS_PRECEDING_VALUE),e):[])(e,t);const n={},o=[];for(let s of e){let e=c.getLocalized(s[te.RDFS_LABEL],t),r=c.getLocalized(s[te.RDFS_COMMENT],t);n[s["@id"]]={id:s["@id"],value:s["@id"],label:e,description:r,children:[]};for(let e of ce.asArray(s[te.BROADER]))o.push({type:"parent-child",parent:e["@id"],child:s["@id"]})}for(let e of o){var s;"parent-child"===e.type&&(null==(s=n[e.parent])||s.children.push(e.child))}return Object.values(n)},tt=(e,t)=>{if(!e)return null;const n=me.getCorrectAnswerValue(t);return n?e.trim()===n.trim()?"correct":"incorrect":null},nt={correct:"#d4edda",incorrect:"#f8d7da"},ot={"is-warning":{borderColor:"#dc9135",boxShadow:"0 0 0 0.2rem rgba(203,127,16,.25)"},"is-invalid":{borderColor:"#dc3545",boxShadow:"0 0 0 0.2rem rgba(220,53,69,.25)"}},st={correct:{borderColor:"#28a745",boxShadow:"0 0 0 0.2rem rgba(40,167,69,.25)"},incorrect:{borderColor:"#dc3545",boxShadow:"0 0 0 0.2rem rgba(220,53,69,.25)"}},rt=(e,t)=>{var n,o;return(({borderColor:e,boxShadow:t}={})=>({control:n=>Object.assign({},n,{border:e?`1px solid ${e}`:n.border,boxShadow:null!=t?t:n.boxShadow,"&:hover":{border:e?`1px solid ${e}`:n.border,boxShadow:null!=t?t:n.boxShadow}})}))(null!=(n=null!=(o=ot[null==e?void 0:e.classname])?o:st[t])?n:{})},it=({hintRevealed:t,correctValue:n,currentValue:o})=>s=>{var r,i,a;const l=(null==(r=s.label)?void 0:r.trim())===(null==n?void 0:n.trim()),c=(null==(i=s.label)?void 0:i.trim())===(null==o||null==(a=o.label)?void 0:a.trim());let u="transparent";return t&&l&&(u=nt.correct),c&&(u=l?nt.correct:nt.incorrect),/*#__PURE__*/e.createElement("div",{style:{backgroundColor:u}},/*#__PURE__*/e.createElement(B,s))},at=t=>{var s;const[r,i]=n(null),[a,l]=n(null),[c,u]=n(!1),d=me.getCorrectAnswerValue(t.question);return o(()=>{if(!t.optionsList.length)return;const e=t.optionsList.find(e=>e.id===t.value);e&&(i(e),l(tt(e.label,t.question)))},[t.optionsList]),/*#__PURE__*/e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,null,t.label),/*#__PURE__*/e.createElement(Q,{styles:rt(t.validation,a),valueKey:t.valueKey,labelKey:t.labelKey,valueRenderer:t=>((t,n)=>{var o;/*#__PURE__*/return e.createElement("div",{style:{backgroundColor:null!=(o=nt[t])?o:"transparent",padding:"2px 6px",borderRadius:"4px",display:"inline-block"}},n)})(a,t),optionRenderer:it({hintRevealed:t.hintRevealed,currentValue:r,correctValue:d}),value:r,options:t.optionsList,multi:!1,isSearchable:!0,isLoading:t.isLoading,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isMenuOpen:c,onChange:e=>{var n;const o=null!=(n=null==e?void 0:e.id)?n:null;i(null!=e?e:null),t.onChange(o),u(!1),l(tt(null==e?void 0:e.label,t.question))},titleKey:"description"}),null==(s=t.validation)?void 0:s.message)};at.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool.isRequired};const lt=t=>/*#__PURE__*/e.createElement(e.Fragment,null,t),ct=t=>{var n;/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,null,t.label),/*#__PURE__*/e.createElement(Q,{valueKey:t.valueKey,labelKey:t.labelKey,styles:rt(),value:t.optionsList.find(e=>e.id===t.value)||null,options:t.optionsList,multi:!1,isSearchable:!0,isLoading:t.isLoading,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,valueRenderer:!1===t.question[te.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?lt:null,isDisabled:t.isLoading||t.configurationContext.componentsOptions.readOnly||me.isDisabled(t.question),onChange:e=>{t.onChange(e?e.id:null)},titleKey:"description"}),null==(n=t.validation)?void 0:n.message)};at.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object};const ut=t=>{const r=d(),i=s(Ie),a=s(ve),l=ce.getStringHash(me.getPossibleValuesQuery(t.question)),[c,u]=n(!0),[m,p]=n(()=>et(t.options,r)),h=ce.isOptionQuestionFeedbackEnabled(null==a?void 0:a.options);o(()=>{let e=!1;return!t.question[te.HAS_OPTION]&&me.getPossibleValuesQuery(t.question)?async function(){try{const n=await i.loadFormOptions(l,me.getPossibleValuesQuery(t.question));e||(p(et(n,r)),u(!1))}catch(e){pe.error(`Typeahead: options loading failed for query hash ${l}`)}}():(p(et(t.question[te.HAS_OPTION],r)),u(!1)),()=>{e=!0}},[l,i,t.question,r]);const E=ce.findKeyInObjects(m,["name","value"]),A=ce.findKeyInObjects(m,["name","label"]),g=Object.assign({},t,{optionsList:m,valueKey:E,labelKey:A,isLoading:c,configurationContext:a});/*#__PURE__*/return e.createElement(h?at:ct,g)};ut.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool};const dt=({title:t})=>/*#__PURE__*/e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"})),mt=({title:t})=>/*#__PURE__*/e.createElement("svg",{className:"caret-square-down",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 10.547c0.172 0.328 0.141 0.734-0.078 1.031l-5 7c-0.187 0.266-0.484 0.422-0.812 0.422s-0.625-0.156-0.812-0.422l-5-7c-0.219-0.297-0.25-0.703-0.078-1.031 0.172-0.344 0.516-0.547 0.891-0.547h10c0.375 0 0.719 0.203 0.891 0.547zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"})),pt=()=>/*#__PURE__*/e.createElement("svg",{className:"info-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,"info-circle"),/*#__PURE__*/e.createElement("path",{d:"M16 21.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-1.5v-8c0-0.281-0.219-0.5-0.5-0.5h-5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h1.5v5h-1.5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h7c0.281 0 0.5-0.219 0.5-0.5zM14 7.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"})),ht=()=>/*#__PURE__*/e.createElement("svg",{className:"question-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("path",{d:"M14 21.5v-3c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v3c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM18 11c0-2.859-3-5-5.688-5-2.547 0-4.453 1.094-5.797 3.328-0.141 0.219-0.078 0.5 0.125 0.656l2.063 1.563c0.078 0.063 0.187 0.094 0.297 0.094 0.141 0 0.297-0.063 0.391-0.187 0.734-0.938 1.047-1.219 1.344-1.437 0.266-0.187 0.781-0.375 1.344-0.375 1 0 1.922 0.641 1.922 1.328 0 0.812-0.422 1.219-1.375 1.656-1.109 0.5-2.625 1.797-2.625 3.313v0.562c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5v0c0-0.359 0.453-1.125 1.188-1.547 1.188-0.672 2.812-1.578 2.812-3.953zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"})),Et=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("span",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement(_,{overlay:t.show?/*#__PURE__*/e.createElement(T,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||o},/*#__PURE__*/e.createElement("span",null,t.children)))};Et.propTypes={tooltipContent:U.oneOfType([U.object.isRequired,U.string.isRequired]),id:U.string.isRequired,overlayPlacement:U.string,absolutePosition:U.bool,show:U.bool},Et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};const At=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("div",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement(Et,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o,absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(ht,{className:t.iconClass})))};At.propTypes={text:U.string.isRequired,iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool},At.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};const gt=()=>/*#__PURE__*/e.createElement("svg",{className:"external-link-icon",width:"24",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M5,2 C5.55228,2 6,2.44772 6,3 C6,3.55228 5.55228,4 5,4 L4,4 L4,12 L12,12 L12,11 C12,10.4477 12.4477,10 13,10 C13.5523,10 14,10.4477 14,11 L14,12 C14,13.1046 13.1046,14 12,14 L4,14 C2.89543,14 2,13.1046 2,12 L2,4 C2,2.89543 2.89543,2 4,2 L5,2 Z M15,1 L15,5.99814453 C15,6.55043453 14.5523,6.99814453 14,6.99814453 C13.4477,6.99814453 13,6.55043453 13,5.99814453 L13,4.41419 L8.71571,8.69846 C8.32519,9.08899 7.69202,9.08899 7.3015,8.69846 C6.91097,8.30794 6.91097,7.67477 7.3015,7.28425 L11.5858,3 L9.99619141,3 C9.44391141,3 8.99619141,2.55228 8.99619141,2 C8.99619141,1.44772 9.44391141,1 9.99619141,1 L15,1 Z"})),St=t=>/*#__PURE__*/e.createElement(Et,{tooltipContent:t.url["@id"]||t.url,id:"url-tooltip",overlayPlacement:t.overlayPlacement},/*#__PURE__*/e.createElement("a",{href:t.url["@id"]||t.url,target:"_blank",className:t.iconClassContainer},/*#__PURE__*/e.createElement(gt,{className:t.iconClass})));St.propTypes={url:U.oneOfType([U.string.isRequired,U.object.isRequired]),iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool},St.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};const ft=()=>/*#__PURE__*/e.createElement("svg",{className:"question-comment",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",width:"24",height:"28"},/*#__PURE__*/e.createElement("path",{d:"M30,1.5c-16.542,0-30,12.112-30,27c0,5.204,1.646,10.245,4.768,14.604c-0.591,6.537-2.175,11.39-4.475,13.689 c-0.304,0.304-0.38,0.769-0.188,1.153C0.275,58.289,0.625,58.5,1,58.5c0.046,0,0.092-0.003,0.139-0.01 c0.405-0.057,9.813-1.411,16.618-5.339C21.621,54.71,25.737,55.5,30,55.5c16.542,0,30-12.112,30-27S46.542,1.5,30,1.5z M16,32.5 c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S18.206,32.5,16,32.5z M30,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4 S32.206,32.5,30,32.5z M44,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,32.5,44,32.5z"})),vt=()=>/*#__PURE__*/e.createElement("svg",{className:"recycle-bin-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",height:"15px",width:"15px",viewBox:"0 0 512 512"},/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("path",{d:"M331.636,69.818V0H180.364v69.818h-128v128h34.909V512h337.455V197.818h34.909v-128H331.636z M215.273,34.909h81.455\nv34.909h-81.455V34.909z M389.818,477.091H122.182V197.818h267.636V477.091z M424.727,162.909H87.273v-58.182h337.455V162.909z"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"168.727",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"308.364",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"238.545",y:"256",width:"34.909",height:"162.909"})))),_t=t=>{const{options:o}=s(ve),[r,i]=n(!1),[a,l]=n(!1),c=d();W.addLocale(X),W.addLocale(Y),W.setDefaultLocale(te.LANG.en.locale);const u=new W(c.locale),m=()=>{if(o&&o.users&&t.author){const e=o.users.find(e=>e.id===t.author["@id"]);if(e&&e.label)return e.label}return c.formatMessage({id:"comment.unknownAuthor"})},p=()=>{i(!r)};/*#__PURE__*/return e.createElement("div",{className:"comment-content",onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)}},/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col-auto comment-author",onMouseEnter:p,onMouseLeave:p},/*#__PURE__*/e.createElement(e.Fragment,null,r?/*#__PURE__*/e.createElement(e.Fragment,null,m(),/*#__PURE__*/e.createElement(St,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():c.formatMessage({id:"comment.unknownAuthor"})})):m())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},(()=>{const n=Number(t.timestamp),o=isNaN(n)?new Date(t.timestamp):new Date(n);/*#__PURE__*/return e.createElement(Et,{id:"exact-time-overlay",tooltipContent:new Intl.DateTimeFormat(c.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).format(new Date(o))},u.format(o))})()),a?/*#__PURE__*/e.createElement(G.div,{className:"comment-delete emphasise-on-relevant-icon",whileHover:{scale:1.2},whileTap:{scale:.9},onClick:()=>{t.onDeleteQuestionComment(t.index),t.onDeleteViewComment()}},/*#__PURE__*/e.createElement(vt,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};_t.propTypes={author:U.object,timestamp:U.string.isRequired,commentValue:U.string.isRequired,onDeleteQuestionComment:U.func.isRequired,onDeleteViewComment:U.func,index:U.number.isRequired};const Tt=({comments:t,onDeleteCommentClick:s})=>{const i=r(null),[a,l]=n(!1),u=()=>{l(!0),setTimeout(()=>{l(!1)},2e3)};return o(()=>{null!==i.current&&(i.current.scrollTop=i.current.scrollHeight)},[JSON.stringify(t)]),/*#__PURE__*/e.createElement("span",null,a?/*#__PURE__*/e.createElement("div",{className:"comment-delete"},/*#__PURE__*/e.createElement(K,{color:"#00BFFF",height:80,width:80}),/*#__PURE__*/e.createElement("p",null,"Deleting comment...")):/*#__PURE__*/e.createElement("div",{className:"comment-list-items",ref:i},t.map((t,n)=>/*#__PURE__*/e.createElement("div",{key:n,className:"comment-list-item"},/*#__PURE__*/e.createElement(_t,{commentValue:c.getJsonAttValue(t,te.HAS_COMMENT_VALUE),author:t[te.HAS_AUTHOR]?t[te.HAS_AUTHOR]:null,timestamp:c.getJsonAttValue(t,te.HAS_TIMESTAMP),onDeleteQuestionComment:s,onDeleteViewComment:u,index:n})))))},Nt=()=>/*#__PURE__*/e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},/*#__PURE__*/e.createElement("path",{d:"M6.185 4.843l11.927 7.157-11.927 7.157 2.982-7.157-2.982-7.157zm-4.185-4.843l5 12-5 12 20-12-20-12z"})),Ot="300px",It=t=>{const[s,i]=n(""),a=r(null),l=d();o(()=>{a.current.focus()},[]);const c=e=>{e.preventDefault(),t.onChange(s),i("")},u=()=>{const e=a.current;e.style.height="auto",m(e)},m=e=>{e.style.height=`${e.scrollHeight}px`,parseInt(e.style.height)>parseInt(Ot)&&(e.style.height=Ot)};/*#__PURE__*/return e.createElement(h,{onSubmit:c,onKeyUp:e=>{"Enter"===e.key&&e.ctrlKey&&s.trim()&&c(e)},onClick:e=>{e.stopPropagation()}},/*#__PURE__*/e.createElement(h.Group,{className:"m-2 position-relative",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(N,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(O,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(h.Control,{className:"comment-form-control",name:"comment",as:"textarea",placeholder:l.formatMessage({id:"comment.form.placeholder"}),required:!0,value:s,onChange:e=>{i(e.target.value)},ref:a,onKeyPress:u,onKeyDown:u}),/*#__PURE__*/e.createElement(v,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(Nt,null)))))))};It.propTypes={onChange:U.func.isRequired};const Ct=()=>/*#__PURE__*/e.createElement("svg",{className:"close-icon",width:"24px",height:"24px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"})),bt=t=>{const i=s(ve),a=r(null),l=r(null),c=r(null),[u,d]=n(!1),[m,p]=n("right");o(()=>{_(c.current)});const h=()=>{d(!1)},E=()=>{const e=t.question;return e[te.HAS_COMMENT]||(e[te.HAS_COMMENT]=[]),Array.isArray(e[te.HAS_COMMENT])||(e[te.HAS_COMMENT]=[e[te.HAS_COMMENT]]),e[te.HAS_COMMENT]},A=e=>{const n={};g(n,e),t.onChange(v(),n)},g=(e,t)=>{i.options.currentUser&&(e[te.HAS_AUTHOR]={"@id":i.options.currentUser}),e[te.HAS_COMMENT_VALUE]=t,e[te.HAS_TIMESTAMP]=Date.now().toString()},S=e=>{E().splice(e,1)},f=e=>{e.preventDefault(),e.stopPropagation()},v=()=>E().length,_=e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?p("left"):p("right"))};/*#__PURE__*/return e.createElement("div",{ref:c,onClick:f},/*#__PURE__*/e.createElement("span",{className:"comment-bubble",ref:a,onClick:e=>{f(e),d(!u)}},/*#__PURE__*/e.createElement(ft,null),v()>0?/*#__PURE__*/e.createElement(I,{className:"comment-badge",pill:!0,variant:"primary"},v()):null),/*#__PURE__*/e.createElement(G.div,{className:"overlay-comment",ref:l,drag:!0,dragConstraints:{top:-50,left:-50,right:50,bottom:50}},/*#__PURE__*/e.createElement(C,{target:a.current,show:u,placement:m,rootClose:!1,onHide:h,container:l},t=>/*#__PURE__*/e.createElement(T,$({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:e=>{(e=>{"Escape"===e.key&&h()})(e)}},/*#__PURE__*/e.createElement(G.div,{className:"close-comment-icon",onClick:h,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(Ct,null)),/*#__PURE__*/e.createElement(Tt,{comments:E(),onDeleteCommentClick:S}),/*#__PURE__*/e.createElement(It,{onChange:A}))))))};bt.propTypes={question:U.object.isRequired,onChange:U.func.isRequired};const Rt="M9 21h6v2H9zm3-21C7.03 0 3 4.03 3 9c0 3.04 1.53 5.73 3.86 7.36.74.52 1.14 1.35 1.14 2.24V19h8v-.4c0-.9.39-1.73 1.14-2.24C19.47 14.73 21 12.04 21 9c0-4.97-4.03-9-9-9z",Lt={x1:2,y1:2,x2:21,y2:19,stroke:"#f15050",strokeWidth:3,strokeLinecap:"round"},yt=()=>/*#__PURE__*/e.createElement("path",{d:Rt}),wt=()=>/*#__PURE__*/e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement("path",{d:Rt,opacity:.35}),/*#__PURE__*/e.createElement("line",Lt)),Ht=({title:t,enabled:n,className:o})=>/*#__PURE__*/e.createElement("svg",{className:"hint-icon"+(o?` ${o}`:""),xmlns:"http://www.w3.org/2000/svg",width:24,height:28,viewBox:"0 0 24 28","aria-label":t},/*#__PURE__*/e.createElement("title",null,t),/*#__PURE__*/e.createElement(n?yt:wt,null)),Dt=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("div",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement("span",{onClick:()=>t.onHintClick()},/*#__PURE__*/e.createElement(Et,{id:"hint-icon-tooltip",overlayPlacement:t.overlayPlacement||o,absolutePosition:t.absolutePosition,tooltipContent:t.text||t.revealed?"Hide a hint.":"Reveal a hint."},/*#__PURE__*/e.createElement(Ht,{className:t.iconClass,enabled:!t.revealed}))))};var Vt;Dt.propTypes={text:U.string,iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool,onHintClick:U.func,revealed:U.bool},Dt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,revealed:!1};class Mt{static renderIcons(t,n,o,s,r,i,a){let l;l=n.icons?n.icons:te.DEFAULT_OPTIONS.icons;let c=[];const u=this.renderQuestionHelp(t,n,o,s,r),d=this.renderQuestionComments(t,n,o,s,r),m=this.renderQuestionLink(t,n,o,s,r),p=this.renderQuestionHint(t,n,o,s,r,i,a);for(let t=0;t<l.length;t++)l[t].id===te.ICONS.QUESTION_COMMENTS&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},d)),l[t].id===te.ICONS.QUESTION_HELP&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},u)),l[t].id===te.ICONS.QUESTION_LINK&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},m)),l[t].id===te.ICONS.QUESTION_HINT&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},p));/*#__PURE__*/return e.createElement("ol",{className:"icon-list-items"},c)}static renderQuestionHelp(e,t,n,o,s){return this.getIconComponentFromName(te.ICONS.QUESTION_HELP,e,t,n,o,s)}static renderQuestionLink(e,t,n,o,s){return this.getIconComponentFromName(te.ICONS.QUESTION_LINK,e,t,n,o,s)}static renderQuestionHint(e,t,n,o,s,r,i){return this.getIconComponentFromName(te.ICONS.QUESTION_HINT,e,t,n,o,s,r,i)}static getIconComponentFromName(e,t,n,o,s,r,i,a){const l=this.getIconFromIconList(n.icons?n.icons:te.DEFAULT_OPTIONS.icons,e);return this.getIconComponent(l,t,n,o,s,r,i,a)}static getIconComponent(t,n,o,s,r,i,a,l){let u;if(t&&(t.behavior===te.ICON_BEHAVIOR.ON_HOVER||t.behavior===te.ICON_BEHAVIOR.ENABLE))return t.behavior===te.ICON_BEHAVIOR.ENABLE?(r=!0,u=""):u="emphasise-on-relevant-icon",t.id===te.ICONS.QUESTION_HELP&&n[te.HELP_DESCRIPTION]?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(At,{text:c.getLocalized(n[te.HELP_DESCRIPTION],i),absolutePosition:!1})):null:t.id===te.ICONS.QUESTION_LINK&&n[te.SOURCE]?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(St,{url:n[te.SOURCE]})):null:t.id===te.ICONS.QUESTION_COMMENTS?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(bt,{question:n,onChange:s})):null:t.id===te.ICONS.QUESTION_HINT&&o.enableOptionQuestionFeedback?me.isSection(n)||!me.containsHints(n)?null:r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(Dt,{absolutePosition:!1,onHintClick:l,revealed:a})):null:null}}Vt=Mt,Mt.renderQuestionComments=(e,t,n,o,s)=>Vt.getIconComponentFromName(te.ICONS.QUESTION_COMMENTS,e,t,n,o,s),Mt.getIconFromIconList=(e,t)=>e?e.find(e=>e.id===t):null;const Ut=t=>{const s=e.useContext(Ie),{options:r}=e.useContext(ve),[i,a]=n({severity:"",classname:"",message:null}),l=d();o(()=>{p()},[t.question]);const u=e=>{const n=Object.assign({},t.answer);m(n,e),t.onChange(t.index,n)},m=(e,n)=>{null===n?(e[te.HAS_OBJECT_VALUE]=null,e[te.HAS_DATA_VALUE]=null):t.answer[te.HAS_OBJECT_VALUE]||me.isTypeahead(t.question)?e[te.HAS_OBJECT_VALUE]={"@id":n}:e[te.HAS_DATA_VALUE]={"@value":n}},p=()=>{a({severity:"",classname:"",message:null}),!1===h[te.HAS_VALID_ANSWER]&&a(h[te.HAS_VALIDATION_SEVERITY]===te.VALIDATION.SEVERITY.WARNING?{severity:te.VALIDATION.SEVERITY.WARNING,classname:te.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(b,{className:te.VALIDATION.CLASSNAME.WARNING},h[te.HAS_VALIDATION_MESSAGE])}:{severity:te.VALIDATION.SEVERITY.ERROR,classname:te.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(b,{className:te.VALIDATION.CLASSNAME.ERROR},h[te.HAS_VALIDATION_MESSAGE])})},h=t.question,E=me.resolveValue(t.answer),A=(n=>{const o=c.getLocalized(n[te.RDFS_LABEL],l);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,Mt.renderIcons(t.question,r,t.onCommentChange,t.showIcon,l,t.hintRevealed,t.onHintReveal))})(h),g=c.getLocalized(h[te.RDFS_COMMENT],l);let S;var f;return S=me.isTypeahead(h)?((n,o,r)=>{const a=ce.getStringHash(me.getPossibleValuesQuery(t.question)),l=s.getOptions(a)||[];/*#__PURE__*/return e.createElement(ut,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:u,options:l,validation:i,hintRevealed:t.hintRevealed,onHintReveal:t.onHintReveal})})(E,A,g):(f=h)[te.HAS_OPTION]&&0!==f[te.HAS_OPTION].length?((n,o,s)=>/*#__PURE__*/e.createElement(Ze,{question:t.question,label:o,title:s,value:n,onChange:u,validation:i,hintRevealed:t.hintRevealed,onHintReveal:t.onHintReveal}))(E,A,g):me.isCalendar(h)?((n,o,s)=>/*#__PURE__*/e.createElement(De,{question:t.question,value:n,title:s,label:o,onChange:u,validation:i}))(E,A,g):me.isCheckbox(h)?((n,o,s)=>/*#__PURE__*/e.createElement(He,{label:o,title:s,value:n,onChange:u,question:t.question,validation:i}))(E,A,g):me.isMaskedInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Qe,{label:o,title:s,value:n,onChange:u,question:t.question,answer:t.answer,validation:i}))(E,A,g):me.isSparqlInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,sparql:!0,validation:i}))(E,A,g):me.isTurtleInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,turtle:!0,validation:i}))(E,A,g):((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,validation:i}))(E,A,g),S};Ut.propTypes={answer:U.object.isRequired,question:U.object.isRequired,onChange:U.func.isRequired,onCommentChange:U.func.isRequired,index:U.number,icons:U.object,hintRevealed:U.bool,onHintReveal:U.func};const xt=(e,t)=>{const n=[Qt,jt,qt,Ft,kt,zt];return()=>{if(me.hasValidationLogic(e,t)){const o=me.getAnswerValue(e);return Pt(e,t,o,n)}}},Pt=(e,t,n,o)=>{const s={};for(const n of o){const o=n(e,t);if(!o.isValid)return s[te.HAS_VALID_ANSWER]=!1,s[te.HAS_VALIDATION_MESSAGE]=o.message,s[te.HAS_VALIDATION_SEVERITY]=o.validationSeverity,s;if(!1===s[te.HAS_VALID_ANSWER])break}return s[te.HAS_VALID_ANSWER]=!0,s[te.HAS_VALIDATION_MESSAGE]="",s[te.HAS_VALIDATION_SEVERITY]="",s},qt=(e,t)=>{const n=me.getAnswerValue(e);return n&&n.length>0&&e[te.PATTERN]&&!new RegExp(e[te.PATTERN]).test(n)&&me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},kt=(e,t)=>!e[te.REQUIRES_ANSWER]||e[te.USED_ONLY_FOR_COMPLETENESS]||me.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})},Ft=(e,t)=>me.isCheckbox(e)&&e[te.REQUIRES_ANSWER]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0},zt=(e,t)=>e[te.REQUIRES_ANSWER]&&e[te.USED_ONLY_FOR_COMPLETENESS]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.WARNING,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0},jt=(e,t)=>{if(e[te.XSD.MIN_INCLUSIVE]){const n=me.getAnswerValue(e);if(n&&n.length>0){const o=e[te.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},Qt=(e,t)=>{const n=me.getAnswerValue(e);if(e[te.XSD.MAX_INCLUSIVE]&&n&&n.length>0){const o=e[te.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}};class Bt extends e.Component{constructor(e){super(e),this.state={prefixes:e.prefixes}}render(){const t=/*#__PURE__*/e.createElement(R,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(L,null,this.state.prefixes.sort((e,t)=>e[te.PREFIX]<t[te.PREFIX]?-1:1).map(t=>/*#__PURE__*/e.createElement(y,{key:t[te.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[te.PREFIX]),": ",t[te.NAMESPACE]))));/*#__PURE__*/return e.createElement(_,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))}}Bt.propTypes={prefixes:U.array.isRequired,children:U.element.isRequired,iconClass:U.string},Bt.defaultProps={iconClass:""};class Wt{static getMediaKindFromSource(e){if(!e)return;const t=e.toLowerCase();return t.includes("m3u8")?{kind:"video",type:"application/x-mpegURL"}:t.includes("mp4")?{kind:"video",type:"video/mp4"}:t.includes("webm")?{kind:"video",type:"video/webm"}:t.includes("mov")?{kind:"video",type:"video/quicktime"}:/\b(png|jpg|jpeg|webp|gif|bmp)\b/.test(t)?{kind:"image",type:null}:{kind:"iframe",type:null}}static denormalizePointsFromStringToString(e,t,n){return e.trim().split(/\s+/).map(e=>{const[o,s]=e.split(",").map(Number);return`${o*t},${s*n}`}).join(" ")}static getArrayPointsFromString(e){return e.trim().split(/\s+/).map(e=>e.split(",").map(Number))}static stripExpandedLiterals(e){if(Array.isArray(e))return e.map(Wt.stripExpandedLiterals);if(e&&"object"==typeof e){if(Object.prototype.hasOwnProperty.call(e,"@value")&&Object.keys(e).length<=2)return Wt.castLiteral(e["@value"],e["@type"]);const t={};for(const n in e)t[n]=Wt.stripExpandedLiterals(e[n]);return t}return e}static castLiteral(e,t){return t?t.includes("#decimal")?parseFloat(e):t.includes("#integer")?parseInt(e,10):t.includes("#boolean")?!0===e||"true"===e:e:e}static normalizeMediaContents(e,t){return e?(Array.isArray(e)?e:[e]).map(e=>"string"==typeof e?{[t]:e}:e):[]}}const Yt=({type:e,containerRef:t})=>{const s=(e=>{const[t,s]=n(null);return o(()=>{const t=null==e?void 0:e.current;if(!t)return;const n=t.querySelector("img");if(!n)return;const o=()=>s((e=>{const t=null==e?void 0:e.current;if(!t)return null;const n=t.querySelector("img");if(!n)return null;const o=t.getBoundingClientRect();return{width:o.width,height:o.height,intrinsicWidth:n.naturalWidth||o.width,intrinsicHeight:n.naturalHeight||o.height,top:0,left:0}})(e));return n.complete?o():n.addEventListener("load",o),window.addEventListener("resize",o),()=>{n.removeEventListener("load",o),window.removeEventListener("resize",o)}},[e]),t})("image"===e?t:null),r=(e=>{const[t,s]=n(null);return o(()=>{const t=null==e?void 0:e.current;if(!t)return;const n=()=>s((e=>{const t=e.videoWidth(),n=e.videoHeight();if(!t||!n)return null;const o=e.el(),s=o.clientWidth,r=o.clientHeight,i=t/n;let a,l,c,u;return s/r>i?(l=r,a=l*i,u=(s-a)/2,c=0):(a=s,l=a/i,c=(r-l)/2,u=0),{width:a,height:l,intrinsicWidth:t,intrinsicHeight:n,top:c,left:u}})(t));return t.on("loadedmetadata",n),t.on("resize",n),t.on("fullscreenchange",n),window.addEventListener("resize",n),()=>{t.off("loadedmetadata",n),t.off("resize",n),t.off("fullscreenchange",n),window.removeEventListener("resize",n)}},[e]),t})("video"===e?t:null);return"image"===e?s:"video"===e?r:null},Xt={[te.POLYLINE_ANNOTATION.IMPLICIT_TYPE_LABEL]:(e,t,n,o)=>{var s,r,i;const a=te.POLYLINE_ANNOTATION.DEFAULT_POLYLINE_ANNOTATION_STYLE;return Object.assign({},o,{geometry:{points:Wt.denormalizePointsFromStringToString(e[te.ANNOTATION.HAS_GEOMETRY_POINTS],t,n)},style:{stroke:null!=(s=e[te.ANNOTATION.HAS_COLOR])?s:a.color,strokeWidth:(null!=(r=e[te.POLYLINE_ANNOTATION.HAS_STROKE_WIDTH])?r:a.strokeWidth)*t,fill:null!=(i=e[te.POLYLINE_ANNOTATION.HAS_FILL_COLOR])?i:a.fillColor}})},[te.TEXT_ANNOTATION.IMPLICIT_TYPE_LABEL]:(e,t,n,o)=>{var s,r,i,a;const l=e[te.ANNOTATION.HAS_GEOMETRY_POINTS],c=te.TEXT_ANNOTATION.DEFAULT_TEXT_ANNOTATION_STYLE,[[u,d]]=Wt.getArrayPointsFromString(l);return Object.assign({},o,{geometry:{x:u*t,y:d*n},style:{fontSize:(null!=(s=e[te.TEXT_ANNOTATION.HAS_FONT_SIZE])?s:c.fontSizeInNormalizedPx)*n,fontWeight:null!=(r=e[te.TEXT_ANNOTATION.HAS_FONT_WEIGHT])?r:c.fontWeight,fontFamily:c.fontFamily,color:null!=(i=e[te.ANNOTATION.HAS_COLOR])?i:c.color},payload:{text:null!=(a=e[te.TEXT_ANNOTATION.HAS_TEXT])?a:c.text}})}},Gt={polyline:({points:t,stroke:n,strokeWidth:o,fill:s,opacity:r})=>/*#__PURE__*/e.createElement("polyline",{points:t,stroke:n,strokeWidth:o,fill:s,opacity:r}),text:({text:t,fontFamily:n="Arial",fontWeight:o=400,opacity:s=1,fontSize:r,x:i,y:a,color:l="#00ff00",lineHeight:c=1.15})=>{const u=(null!=t?t:"").split(/\r?\n/),d=r*c,m=a-.2*r;/*#__PURE__*/return e.createElement("text",{fill:l,fontSize:`${r}px`,fontFamily:n,fontWeight:o,textAnchor:"start",opacity:s},u.map((t,n)=>/*#__PURE__*/e.createElement("tspan",{key:n,x:i,y:m+n*d,dominantBaseline:"hanging"},t||" ")))}},Kt=({annotations:s=[],surface:r,currentTime:i,showAnnotations:a})=>{const l=null==r?void 0:r.intrinsicWidth,c=null==r?void 0:r.intrinsicHeight,[u,d]=n("");o(()=>{if(!a)return;d("annotation-overlay-revealed");const e=setTimeout(()=>d(""),700);return()=>clearTimeout(e)},[a]);const m=(({annotations:e=[],width:n,height:o,currentTime:s})=>t(()=>n&&o&&e.length?e.filter(e=>((e,t)=>{if(null==t)return!0;const n=e[te.ANNOTATION.HAS_START_TIME],o=e[te.ANNOTATION.HAS_END_TIME];return!(null!=n&&t<n||null!=o&&t>o)})(e,s)).map(e=>((e,t,n)=>{const o=Xt[e[te.ANNOTATION.HAS_ANNOTATION_TYPE]];if(!o)return null;const s=(e=>{var t;const n=e[te.ANNOTATION.HAS_ANNOTATION_TYPE],o=e[te.ANNOTATION.HAS_OPACITY];return{id:null!=(t=e.id)?t:`uuid-${Date.now()}-${Math.random().toString(16).slice(2)}`,type:n,opacity:null!=o?o:1}})(e);return o(e,t,n,s)})(e,n,o)).filter(Boolean):[],[e,n,o,s]))({annotations:s,width:l,height:c,currentTime:i}),p=t(()=>`0 0 ${l} ${c}`,[l,c]);return l&&c&&m.length?a?/*#__PURE__*/e.createElement("svg",{viewBox:p,className:`annotation-overlay ${u}`},m.map(t=>{const n=Gt[t.type];return n?/*#__PURE__*/e.createElement(n,$({key:t.id},t.geometry,t.style,t.payload,{opacity:t.opacity})):null})):/*#__PURE__*/e.createElement(e.Fragment,null):null},Jt=/*#__PURE__*/a(({children:t,fullscreen:n=!1},o)=>/*#__PURE__*/e.createElement("div",{ref:o,className:"media-container "+(n?"fullscreen":"")},t)),$t={video:({type:s,src:i,autoplay:a=!1,muted:l=!0,controls:c=!0,responsive:u=!0,aspectRatio:d="16:9",annotations:m=[],showAnnotations:p,onFullScreen:h})=>{const E=r(null),[A,g]=n(0),S=(({videoRef:e,options:t,onReady:n,onFullScreen:s,onTimeUpdate:i,showAnnotations:a,annotations:l=[]})=>{const c=r(null);return o(()=>{const e=c.current;if(!e||!a)return;const t=l.reduce((e,t)=>{const n=t[te.ANNOTATION.HAS_START_TIME];return null!=n&&(null==e||n<e.startTime)?{annotation:t,startTime:n}:e},null);t&&(e.currentTime(t.startTime),e.pause())},[a]),o(()=>{if(!e.current)return;const o=J(e.current,t,function(){((e,t)=>{const{onFullScreen:n}=t;n&&((e,t)=>{var n;const o=e.controlBar,s=null!=(n=o.getChild("remainingTimeDisplay"))?n:o.getChild("fullscreenToggle"),r=s?o.children().indexOf(s):o.children().length,i=o.addChild("button",{},r+1).el();i.innerHTML="⛶",i.style.fontSize="20px",i.onclick=()=>t(e)})(e,n)})(o,{onFullScreen:s}),null==n||n(o)});return c.current=o,i&&o.on("timeupdate",()=>i(o.currentTime())),()=>{o&&!o.isDisposed()&&o.dispose()}},[e,t,n,s,i]),c})({videoRef:E,options:t(()=>({autoplay:a,muted:l,controls:c,responsive:u,aspectRatio:d,controlBar:{fullscreenToggle:!1,pictureInPictureToggle:!1},userActions:{doubleClick:!1},sources:[{src:i,type:s}]}),[a,l,c,u,d,i,s]),onFullScreen:h,onTimeUpdate:g,annotations:m,showAnnotations:p}),f=Yt({type:"video",containerRef:S});/*#__PURE__*/return e.createElement("div",{className:"video-wrapper",style:{position:"relative"}},/*#__PURE__*/e.createElement("video",{ref:E,className:"video-js vjs-big-play-centered"}),f&&/*#__PURE__*/e.createElement(Kt,{annotations:m,showAnnotations:p,surface:f,currentTime:A}))},image:({src:t,annotations:n,onFullScreen:o,showAnnotations:s})=>{const i=r(null),a=Yt({type:"image",containerRef:i});/*#__PURE__*/return e.createElement("div",{className:"media-image-container"},/*#__PURE__*/e.createElement("div",{ref:i,className:"media-image-wrapper"},/*#__PURE__*/e.createElement("img",{src:t,alt:"Beautiful Image"}),/*#__PURE__*/e.createElement(Kt,{annotations:n,showAnnotations:s,surface:a,currentTime:null})),/*#__PURE__*/e.createElement("button",{className:"media-fullscreen-button",onClick:o},"⛶"))}},Zt=({src:t,allowFullScreen:n})=>/*#__PURE__*/e.createElement("div",{className:"media-iframe-container"},/*#__PURE__*/e.createElement("div",{className:"media-iframe-wrapper"},/*#__PURE__*/e.createElement("iframe",{src:t,title:"Embedded content",allowFullScreen:n}))),en=({src:t,annotations:s=[],allowFullScreen:a,showAnnotations:l=!0})=>{const c=r(null),{isFullscreen:u,toggle:d}=(e=>{const[t,s]=n(!1);return o(()=>{const e=()=>s(Boolean(document.fullscreenElement));return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),{isFullscreen:t,toggle:i(()=>{e.current&&(document.fullscreenElement?document.exitFullscreen():e.current.requestFullscreen())},[e])}})(c);if(!t)return null;const{kind:m}=Wt.getMediaKindFromSource(t);/*#__PURE__*/return e.createElement(Jt,{ref:c,fullscreen:u},/*#__PURE__*/e.createElement($t[m]||Zt,{src:t,annotations:s,allowFullScreen:a,onFullScreen:d,showAnnotations:l}))},tn=({question:t,displayAnnotations:n})=>{const o=Wt.stripExpandedLiterals(t),s=Wt.normalizeMediaContents(o[te.HAS_MEDIA_CONTENT],te.HAS_SOURCE);return s.length>0?/*#__PURE__*/e.createElement("div",{className:"col-6 "},s.map((t,o)=>{var s;/*#__PURE__*/return e.createElement("div",{key:o,className:"embed-responsive-21by9 media-content-video-container mb-3"},/*#__PURE__*/e.createElement(en,{src:t[te.HAS_SOURCE],allowFullScreen:!0,annotations:null!=(s=t[te.HAS_ANNOTATION])?s:[],showAnnotations:n}))})):/*#__PURE__*/e.createElement(e.Fragment,null)};class nn extends e.Component{constructor(e){super(e),this.handleHintReveal=e=>{this.setState(e&&"boolean"==typeof e?{hintRevealed:e}:{hintRevealed:!this.state.hintRevealed})},this.handleAnswerChange=(e,t)=>{if(me.isSection(this.props.question)){let e=!!me.resolveValue(t);this.setState({expanded:e})}this._handleChange(te.HAS_ANSWER,e,t)},this.handleSubQuestionChange=(e,t)=>{this._handleChange(te.HAS_SUBQUESTION,e,t)},this.handleCommentChange=(e,t)=>{this._handleChange(te.HAS_COMMENT,e,t)},this._toggleCollapse=()=>{this.props.collapsible&&this.setState({expanded:!this.state.expanded})},this._onEnterHandler=()=>{this.setState({showIcon:!0})},this._onLeaveHandler=()=>{this.setState({showIcon:!1})},this._getHeaderClassName=()=>{const e=this.props.question,t=this.props.collapsible;let n=[];return n.push(nn.getEmphasizedOnRelevantClass(e),"question-header"),me.isWizardStep(e)&&n.push("wizard-step bg-primary text-white"),me.isEmphasised(e)&&n.push(nn.getEmphasizedClass(e)),me.isSection(e)&&n.push("section-background"),t&&n.push("cursor-pointer"),this.isDebugged(e)&&n.push("show-irrelevant"),n},ue.putObject(e.question["@id"],e.question),this.state={validator:{},expanded:!me.isCollapsed(e.question),showIcon:!1,hintRevealed:!1}}componentDidMount(){this.setState({validator:xt(this.props.question,this.props.intl)})}componentDidUpdate(){const e=this.props.question,t=this.context.options.startingQuestionId,n=e[te.HAS_SUBQUESTION].find(e=>e["@id"]===t);if(me.isSection(e)&&me.isAnswerable(e)){const e=this._getFirstAnswerValue();if(this.context.options.debugMode)return null;if(n)return null;this.state.expanded&&!e&&this.setState({expanded:!1})}}_handleChange(e,t,n){let o=Object.assign({},this.props.question);if(o[e][t]=n,e===te.HAS_ANSWER){const e=this.state.validator(n);o=Object.assign({},o,e)}ue.putObject(o["@id"],o),this.props.onChange(this.props.index,o)}isDebugged(e){const t=this.context.options.startingQuestionId;return!me.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!ce.findQuestionById(t,e,!0,!1,!1))}render(){const t=this.props.question,n=this.renderQuestion(t);return this.isDebugged(t)?/*#__PURE__*/e.createElement("div",{className:"show-irrelevant"},n):me.isHidden(t)?null:me.isRelevant(t)?n:null}renderQuestion(t){if(me.isAnswerable(t)&&!me.isSection(t))/*#__PURE__*/return e.createElement("div",{id:t["@id"]},/*#__PURE__*/e.createElement("div",{className:"panel-title answerable-question"},this.renderAnswers()),/*#__PURE__*/e.createElement("div",{className:"answerable-subquestions"},this.renderSubQuestions()));if(me.isAnswerable(t))return this.renderAnswerableSection();if(me.isSection(t)){const{collapsible:n,withoutCard:o}=this.props,s=nn._getQuestionCategoryClass(t);if(o)/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent());const r=c.getLocalized(t[c.RDFS_LABEL],this.props.intl),i=/*#__PURE__*/e.createElement(f.Body,{className:F("p-3",s)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(S,{activeKey:this.state.expanded?r:void 0,className:"mb-3"},/*#__PURE__*/e.createElement(S.Item,{eventKey:r},/*#__PURE__*/e.createElement(f,{className:""},/*#__PURE__*/e.createElement(S.Button,{as:f.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"d-inline",id:t["@id"]},n&&!me.isWizardStep(t)&&this._renderCollapseToggle(),r),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(S.Body,{className:"p-0"},n?i:/*#__PURE__*/e.createElement(e.Fragment,null,i))))))}/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent())}_renderQuestionContent(){let t=[];return this.state.expanded&&t.push(/*#__PURE__*/e.createElement(tn,{key:this.props.question["@id"]+"-media",question:this.props.question,displayAnnotations:this.state.hintRevealed})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t}renderQuestionIcons(){return Mt.renderIcons(this.props.question,this.context.options,this.handleCommentChange,this.state.showIcon,this.props.intl,this.state.hintRevealed,this.handleHintReveal)}renderAnswerableSection(){const t=this.props.question,n=this.props.collapsible,o=nn._getQuestionCategoryClass(t);let s=this.getShowIrrelevantClassname(t);const r=/*#__PURE__*/e.createElement(f.Body,{className:F("p-3",o)},this.renderSubQuestions(s)),i=this._getHeaderClassName();return this.state.expanded&&i.push("text-primary"),/*#__PURE__*/e.createElement(S,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(f,{className:"mb-3"},/*#__PURE__*/e.createElement(f.Header,{onClick:this._toggleCollapse,className:i},this.renderAnswers()),n?/*#__PURE__*/e.createElement(S.Collapse,{className:s,eventKey:t["@id"]},r):{cardBody:r}))}getShowIrrelevantClassname(e){return!this.context.options.debugMode&&!de.checkId(e[te.HAS_SUBQUESTION],this.context.options.startingQuestionId)||me.hasAnswer(e)?"":"show-irrelevant"}renderAnswers(){const t=this.props.question,n=[],o=this._getAnswers();let s;for(let r=0,i=o.length;r<i;r++)me.isTextarea(t,me.resolveValue(o[r]))||me.isSparqlInput(t)||me.isTurtleInput(t),s=F("answer",nn._getQuestionCategoryClass(t),nn.getEmphasizedOnRelevantClass(t)),n.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+r,className:s,id:t["@id"],onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,"data-question-origin":Ee._getId(t[te.HAS_QUESTION_ORIGIN]),onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(Ut,{index:r,answer:o[r],question:t,onChange:this.handleAnswerChange,onCommentChange:this.handleCommentChange,showIcon:this.state.showIcon,hintRevealed:this.state.hintRevealed,onHintReveal:this.handleHintReveal})),this._renderUnits(),this._renderPrefixes()));return n}_getAnswers(){const e=this.props.question;return e[te.HAS_ANSWER]||(e[te.HAS_ANSWER]=[]),Array.isArray(e[te.HAS_ANSWER])||(e[te.HAS_ANSWER]=[e[te.HAS_ANSWER]]),0===e[te.HAS_ANSWER].length&&(e[te.HAS_ANSWER]=me.isSection(e)&&!me.isAnswerable(e)?[]:[we.generateAnswer(e)]),e[te.HAS_ANSWER]}_getAnswerWidthStyle(){const e=Number(this.props.question[te.HAS_INITIAL_INPUT_LENGTH]);return e?{flexGrow:0,maxWidth:"none",width:`calc(${e}ch + 1.5rem + 2px)`}:{}}static _getAnswerClass(e,t){return t?"col-12":1===te.GENERATED_ROW_SIZE?"col-6":"col-"+te.COLUMN_COUNT/te.GENERATED_ROW_SIZE}static _getQuestionCategoryClass(e){const t=me.getCategory(e);return t?"question-"+t:""}static getEmphasizedClass(e){return me.isEmphasised(e)?"bg-warning":""}static getEmphasizedOnRelevantClass(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.EMPHASISE_ON_RELEVANT)?"emphasise-on-relevant":""}_renderCollapseToggle(){const t=this.props.intl.formatMessage(this.state.expanded?{id:"section.collapse"}:{id:"section.expand"});/*#__PURE__*/return e.createElement("span",{onClick:this._toggleCollapse,title:t},/*#__PURE__*/e.createElement(this.state.expanded?dt:mt,{title:t}))}_renderPrefixes(){const t=this.props.question;return t[te.HAS_DECLARED_PREFIX]&&t[te.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(Bt,{prefixes:t[te.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(pt,null)):null}_renderUnits(){const t=this.props.question;return t[te.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[te.HAS_UNIT]):null}renderSubQuestions(t){const n=[],o=this._getSubQuestions(),s=this.context.options.debugMode,r=this.context.options.startingQuestionId;for(let i=0;i<o.length;i++){let a=o[i],l=this.context.mapComponent(a,nn),c=null;(s||"show-irrelevant"!==t||ce.findQuestionById(r,a,!0,!1,!1))&&(c=/*#__PURE__*/e.createElement(l,{key:"sub-question-"+i,question:a,onChange:this.handleSubQuestionChange,index:i,intl:this.props.intl})),n.push(c)}return n}_getSubQuestions(){const e=this.props.question;return e[te.HAS_SUBQUESTION]||(e[te.HAS_SUBQUESTION]=[]),Array.isArray(e[te.HAS_SUBQUESTION])||(e[te.HAS_SUBQUESTION]=[e[te.HAS_SUBQUESTION]]),de.orderByLocalizedLabels(e[te.HAS_SUBQUESTION],this.props.intl),de.orderPreservingToplogicalSort(e[te.HAS_SUBQUESTION],te.HAS_PRECEDING_QUESTION),e[te.HAS_SUBQUESTION]}_getFirstAnswerValue(){return me.resolveValue(this._getAnswers()[0])}}nn.contextType=ve,nn.propTypes={question:U.object.isRequired,onChange:U.func.isRequired,index:U.number,withoutCard:U.bool,collapsible:U.bool},nn.defaultProps={withoutCard:!1,collapsible:!0};const on=t=>{const{updateFormQuestionsData:n,getFormQuestionsData:o}=s(Le),r=d(),i=o([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(nn,{question:i,onChange:(e,o)=>{n(t.index||e,Object.assign({},t.question,o))},collapsible:me.isAnswerable(i),intl:r}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(w,{className:"m-3 float-end"},!t.isFirstStep&&/*#__PURE__*/e.createElement(v,{className:"me-2",onClick:()=>{t.onPreviousStep()},variant:"primary",size:"sm"},r.formatMessage({id:"wizard.previous"})),!t.isLastStep&&/*#__PURE__*/e.createElement(v,{onClick:()=>{n(t.index,o()),t.onNextStep()},variant:"primary",size:"sm"},r.formatMessage({id:"wizard.next"}))))};on.propTypes={options:U.object.isRequired,question:U.object.isRequired,index:U.number.isRequired,onNextStep:U.func,onPreviousStep:U.func,mapComponent:U.func,isFirstStep:U.bool,isLastStep:U.bool};const sn=({steps:t,onNavigate:n,currentStep:o})=>{const{options:r}=s(ve),i=d();/*#__PURE__*/return e.createElement(f.Header,null,/*#__PURE__*/e.createElement(H,{variant:"tabs",activeKey:o,onSelect:e=>n(parseInt(e))},t.map((t,n)=>/*#__PURE__*/e.createElement(Et,{id:"step-disabled",tooltipContent:i.formatMessage({id:"wizard.nav.tooltip"}),show:!r.enableWizardStepSkip},/*#__PURE__*/e.createElement(D,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(V,{eventKey:n,active:n===o?"active":"",hidden:!r.debugMode&&!me.isRelevant(t),disabled:!r.enableWizardStepSkip,className:F([r.debugMode&&!me.isRelevant(t)?"show-irrelevant":nn.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],i)))))))};sn.propTypes={currentStep:U.number.isRequired,steps:U.array.isRequired,onNavigate:U.func.isRequired};const rn=({steps:t,onNavigate:n,currentStep:o})=>{const{options:r}=s(ve),i=d();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(L,null,t.map((t,s)=>/*#__PURE__*/e.createElement(Et,{id:"step-disabled",tooltipContent:i.formatMessage({id:"wizard.nav.tooltip"}),show:!r.enableWizardStepSkip},/*#__PURE__*/e.createElement(y,{hidden:!r.debugMode&&!me.isRelevant(t),key:"nav"+s,onClick:()=>n(s),id:"wizard-nav-"+s,action:!0,active:s===o?"active":"",disabled:!r.enableWizardStepSkip,variant:"default",className:F([r.debugMode&&!me.isRelevant(t)?"show-irrelevant":nn.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],d()))))))};function an({id:e,dataAttributes:t=[],scrollOptions:n={behavior:"smooth"},highlightClass:s="text-danger"}){o(()=>{let o=null;if(e&&(o=document.getElementById(e)),!o&&Object.keys(t).length>0){const e=Object.entries(t).map(([e,t])=>`[data-${e}="${t}"]`).join("");o=document.querySelector(e)}o&&(o.scrollIntoView(n),s&&o.classList.add(s))},[e,t,n,s])}rn.propTypes={currentStep:U.number.isRequired,steps:U.array.isRequired,onNavigate:U.func.isRequired};const ln=(e,t,n)=>{console.log(n,e,t);const o=(n,s)=>n?Ee._getId(n[e])===t?s:ce.asArray(n[te.HAS_SUBQUESTION]).findIndex((e,t)=>-1!==o(e,t)):-1;return n.findIndex((e,t)=>-1!==o(e,t))},cn=()=>{const t=e.useContext(Le),{options:n,mapComponent:o}=e.useContext(ve);let s=0;n.startingQuestionId?(s=ln("@id",n.startingQuestionId,t.getFormQuestionsData()),-1===s&&(console.warn(`Question with id ${n.startingQuestionId} not found!`),s=0)):n.startingQuestionOrigin?(s=ln(te.HAS_QUESTION_ORIGIN,n.startingQuestionOrigin,t.getFormQuestionsData()),-1===s&&(console.warn(`Question with question origin ${n.startingQuestionOrigin} not found!`),s=0)):n.startingStep&&(s=n.startingStep<t.getFormQuestionsData().length?n.startingStep:0);const[r,i]=e.useState(s);an({id:n.startingQuestionId,dataAttributes:{"question-origin":[n.startingQuestionOrigin]}});const a=()=>{const e=t.getFormQuestionsData();r!==e.length-1&&(e[r+1].visited=!0,i(e=>e+1))},l=()=>{0!==r&&i(e=>e-1)},c=e=>{const o=t.getFormQuestionsData();e===r||e>=o.length||e>r&&!o[e].visited&&!n.enableWizardStepSkip||i(e)};let u=null;t.getFormQuestionsData().length>1&&(u=(()=>{const o=t.getFormQuestionsData();/*#__PURE__*/return e.createElement(n.horizontalWizardNav?sn:rn,{currentStep:r,steps:o,onNavigate:c})})());const d=n.horizontalWizardNav;/*#__PURE__*/return e.createElement(f,{className:d?"":"flex-row p-3"},u,/*#__PURE__*/e.createElement("div",{className:d?"card-body p-3":u?"col-10 p-0 pl-3":"col-12 p-0"},(()=>{const s=t.getFormQuestionsData()[r];let i=o(s,on);/*#__PURE__*/return e.createElement(i,{options:n,key:"step"+r,question:s,onNextStep:a,onPreviousStep:l,mapComponent:o,index:r,isFirstStep:0===r,isLastStep:r===t.getFormQuestionsData().length-1})})()))},un=/*#__PURE__*/e.forwardRef((t,n)=>{const{options:o}=e.useContext(ve);/*#__PURE__*/return e.createElement(M,$({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(M.Header,{closeButton:!0},/*#__PURE__*/e.createElement(M.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(M.Body,{className:"overflow-hidden p-0"},t.children))});var dn;un.propTypes={children:U.element.isRequired};class mn{}dn=mn,mn.updateQuestionValidation=(e,t,n,o)=>{const s=xt(t,o)();s&&(e[n]=Object.assign({},t,s));for(const t of e)dn.updateSubQuestionsValidation(t,o)},mn.updateSubQuestionsValidation=(e,t)=>{const n=ce.asArray(e[te.HAS_SUBQUESTION]);for(let e=0;e<n.length;e++)dn.updateQuestionValidation(n,n[e],e,t)};const pn=()=>{const t=d(),{updateFormQuestionsData:n,getFormQuestionsData:o}=s(Le),{options:r,mapComponent:i}=e.useContext(ve);an({id:r.startingQuestionId,dataAttributes:{"question-origin":[r.startingQuestionOrigin]}});const a=o();/*#__PURE__*/return e.createElement(f,{className:"p-3"},a.map((o,s)=>((o,s)=>{let r=i(o,nn);/*#__PURE__*/return e.createElement(r,{key:o["@id"],question:o,onChange:(e,t)=>((e,t,o)=>{n(t,Object.assign({},e,o))})(o,e,t),index:s,intl:t})})(o,s)))},hn=/*#__PURE__*/a((t,n)=>{const{getFormQuestionsData:o,updateFormQuestionsData:r,getData:i}=s(Le),a=d();l(n,()=>({validateForm:u,getFormSpecification:m,getFormQuestionsData:o,getFormData:c}),[]);const c=()=>{const e=i(),t=o();return we.buildQuestionAnswerModel(e,t)},u=()=>{const e=o();for(let t=0;t<e.length;t++)mn.updateQuestionValidation(e,e[t],t,a);r(null,e)},m=()=>{const e=o();return me.getFormSpecification(e)},{modalView:p}=t,h=o();if(!h.length)/*#__PURE__*/return e.createElement(f,{className:"p-3 font-italic"},"There are no questions available...");const E=h.every(e=>!me.isWizardStep(e)),A=/*#__PURE__*/e.createElement(E?pn:cn,null);return p?/*#__PURE__*/e.createElement(un,null,A):A}),En=/*#__PURE__*/a((t,s)=>{const[r,i]=n(!0),[a,l]=n(null),[c,u]=n(null),m=d();if(o(()=>{(async()=>{const[e,n]=await Ae.constructForm(t.form,m);e.formQuestions.some(e=>me.isWizardStep(e))&&(e.formQuestions[0].visited=!0),l(e),u(n),i(!1)})()},[t.form,m]),r)return t.loader||/*#__PURE__*/e.createElement(f,{className:"p-3 font-italic"},"Loading SForms...");const p=((e,t)=>(n,o)=>{if(!e)return o;for(let{component:o,mapRule:s}of e)if(s(n,t))return o;return o})(t.componentMapRules,c);/*#__PURE__*/return e.createElement(Te,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:p,options:t.options},/*#__PURE__*/e.createElement(Ne,null,/*#__PURE__*/e.createElement(Ce,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(ye,{data:c,formQuestions:a.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(hn,{ref:s,modalView:t.options&&t.options.modalView,mapComponent:p})))))});En.propTypes={form:U.object.isRequired,options:U.object.isRequired,componentMapRules:U.array,components:U.object,componentsOptions:U.object,fetchTypeAheadValues:U.func,isFormValid:U.func,loader:U.element};const An=/*#__PURE__*/a((t,n)=>{var o;/*#__PURE__*/return e.createElement(re,{locale:null==(o=t.options)||null==(o=o.intl)?void 0:o.locale},/*#__PURE__*/e.createElement(En,$({ref:n},t)))});An.propTypes={form:U.object.isRequired,options:U.object.isRequired,componentMapRules:U.array,components:U.object,componentsOptions:U.object,fetchTypeAheadValues:U.func,isFormValid:U.func,loader:U.element,enableOptionQuestionFeedback:U.bool};export{Ut as Answer,ve as ConfigurationContext,te as Constants,Le as FormQuestionsContext,me as FormUtils,At as HelpIcon,re as IntlContextProvider,Ee as JsonLdFramingUtils,ue as JsonLdObjectMap,de as JsonLdObjectUtils,nn as Question,Mt as QuestionStatic,on as WizardStep,An as default};
|
|
1
|
+
import e,{useMemo as t,useState as n,useEffect as o,useContext as s,useRef as r,useCallback as i,forwardRef as a,useImperativeHandle as l}from"react";import*as c from"jsonld-utils";import{IntlProvider as u,useIntl as d}from"react-intl";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.promise.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.sort.js";import*as m from"jsonld";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import p from"@kbss-cvut/tsort";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import{Form as h,FormGroup as E,FormControl as g,Alert as A,Accordion as S,Card as v,Button as f,OverlayTrigger as _,Tooltip as T,Col as N,Row as I,Badge as O,Overlay as C,FormText as b,Popover as y,ListGroup as w,ListGroupItem as R,ButtonToolbar as L,Nav as H,NavItem as D,NavLink as V,Modal as M}from"react-bootstrap";import"core-js/modules/es.object.assign.js";import U from"prop-types";import x from"react-dom";import"core-js/modules/es.regexp.to-string.js";import P from"react-datepicker";import{parse as q,format as k}from"date-fns";import F from"classnames";import z from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import j from"inputmask-core";import"core-js/modules/es.string.trim.js";import{IntelligentTreeSelect as Q}from"intelligent-tree-select/lib/components/IntelligentTreeSelect";import B from"intelligent-tree-select/lib/components/Option";import"intelligent-tree-select/lib/styles.css";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import W from"javascript-time-ago";import Y from"javascript-time-ago/locale/en";import X from"javascript-time-ago/locale/cs";import{motion as G}from"framer-motion";import{Rings as K}from"react-loader-spinner";import"core-js/modules/es.parse-int.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.parse-float.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.string.starts-with.js";import"video.js/dist/video-js.css";import"core-js/modules/es.array.reduce.js";import J from"video.js";function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},$.apply(null,arguments)}function Z(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}var ee;class te{}ee=te,te.COLUMN_COUNT=12,te.INPUT_LENGTH_THRESHOLD=50,te.DATETIME_NUMBER_FORMAT="x",te.EPOCH_MILLISECONDS="epoch-milliseconds",te.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",te.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",te.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",te.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",te.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",te.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",te.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",te.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",te.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",te.LAYOUT={FORM:"form",QUESTION_SECTION:"section",WIZARD_STEP:"wizard-step",DATE:"date",TIME:"time",DATETIME:"datetime",TEXT:"text",TEXTAREA:"textarea",CHECKBOX:"checkbox",QUESTION_TYPEAHEAD:"type-ahead",MASKED_INPUT:"masked-input",ANSWERABLE:"answerable",SPARQL:"sparql",TURTLE:"ttl",DISABLED:"disabled",HIDDEN:"hidden",COLLAPSED:"collapsed",EMPHASISED:"emphasised",EMPHASISE_ON_RELEVANT:"emphasise-on-relevant",CATEGORY:["category-1","category-2","category-3","category-4","category-5"]},te.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",te.VALUE_TYPE_CODE="code",te.VALUE_TYPE_TEXT="text",te.GENERATED_ROW_SIZE=1,te.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",te.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",te.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",te.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",te.HELP_DESCRIPTION="http://purl.org/dc/terms/description",te.SOURCE="http://purl.org/dc/terms/source",te.XSD={MAX_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxExclusive",MAX_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxInclusive",MIN_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#minExclusive",MIN_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#minInclusive",INT:"http://www.w3.org/2001/XMLSchema#int",INTEGER:"http://www.w3.org/2001/XMLSchema#integer",NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#negativeInteger",NON_NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonNegativeInteger",NON_POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonPositiveInteger",POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#positiveInteger",FLOAT:"http://www.w3.org/2001/XMLSchema#float",POSITIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#positiveFloat",NEGATIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#negativeFloat",BOOLEAN:"http://www.w3.org/2001/XMLSchema#boolean"},te.STEP="http://onto.fel.cvut.cz/ontologies/form/step",te.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",te.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",te.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",te.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",te.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",te.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",te.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",te.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",te.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",te.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",te.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",te.HAS_CORRECT_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-correct-answer-value",te.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",te.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",te.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",te.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",te.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",te.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",te.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",te.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",te.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",te.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",te.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",te.ASSET="http://onto.fel.cvut.cz/ontologies/form/media/asset",te.HAS_SOURCE="http://onto.fel.cvut.cz/ontologies/form/media/has-source",te.HAS_ANNOTATION="http://onto.fel.cvut.cz/ontologies/form/media/has-annotation",te.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",te.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",te.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",te.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",te.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",te.PREFIX="http://www.w3.org/ns/shacl#prefix",te.NAMESPACE="http://www.w3.org/ns/shacl#namespace",te.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",te.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",te.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",te.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",te.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",te.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",te.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",te.TIMESTAMP_FORMAT="http://onto.fel.cvut.cz/ontologies/form/timestamp-format",te.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",te.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",te.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",te.RDFS_LABEL=c.RDFS_LABEL,te.RDFS_COMMENT=c.RDFS_COMMENT,te.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,te.BROADER="http://www.w3.org/2004/02/skos/core#broader",te.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",te.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",te.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink",QUESTION_HINT:"questionHint"},te.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},te.DEFAULT_OPTIONS={icons:[{id:ee.ICONS.QUESTION_HELP,behavior:ee.ICON_BEHAVIOR.ENABLE},{id:ee.ICONS.QUESTION_COMMENTS,behavior:ee.ICON_BEHAVIOR.ON_HOVER},{id:ee.ICONS.QUESTION_LINK,behavior:ee.ICON_BEHAVIOR.ON_HOVER},{id:ee.ICONS.QUESTION_HINT,behavior:ee.ICON_BEHAVIOR.DISABLE}],enableOptionQuestionFeedback:!1},te.ANNOTATION={HAS_ANNOTATION_TYPE:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-annotation-type",HAS_START_TIME:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-start-time",HAS_END_TIME:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-end-time",HAS_GEOMETRY_POINTS:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-geometry-points",HAS_OPACITY:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-opacity",HAS_COLOR:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-color"},te.POLYLINE_ANNOTATION={IMPLICIT_TYPE_LABEL:"polyline",HAS_STROKE_WIDTH:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-stroke-width",HAS_FILL_COLOR:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-fill-color",DEFAULT_POLYLINE_ANNOTATION_STYLE:{color:"red",strokeWidth:2e-6,fillColor:"transparent",opacity:1}},te.TEXT_ANNOTATION={IMPLICIT_TYPE_LABEL:"text",HAS_FONT_SIZE:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-font-size",HAS_FONT_WEIGHT:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-font-weight",HAS_TEXT:"http://onto.fel.cvut.cz/ontologies/form/media/annotation/has-text",DEFAULT_TEXT_ANNOTATION_STYLE:{text:"Hello world",color:"red",fontSizeInNormalizedPx:.05,fontWeight:"300",fontFamily:"sans-serif",fontColor:"red",opacity:1}},te.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},te.VALIDATION={SEVERITY:{ERROR:"error",WARNING:"warning"},DEFAULT_MESSAGE:{REQUIRED:"This field is required.",REQUIRED_ONLY_FOR_COMPLETENESS:"This field is required to complete the form.",INVALID:"This field is invalid.",CHECK:"This field must be checked.",LOWER_OR_EQUAL:"This field should be a number equal or lower to ",GREATER_OR_EQUAL:"This field must be greater or equal to "},CLASSNAME:{ERROR:"is-invalid",WARNING:"is-warning"}};var ne={"comment.form.placeholder":"Sem napište své komentáře (Ctrl+Enter pro potvrzení)","wizard.nav.tooltip":"Navigace na této kartě je zakázána, aby nedošlo k přehlédnutí důležitých otázek. K navigaci na tuto kartu použijte tlačítka související s formulářem.","wizard.next":"Další","wizard.previous":"Předchozí","section.expand":"Rozbalit","section.collapse":"Sbalit","validation.required":"Toto pole je povinné.","validation.required_only_for_completeness":"Toto pole je povinné pro vyplnění formuláře.","validation.invalid":"Toto pole je neplatné.","validation.check":"Toto pole musí být zkontrolováno.","validation.lower_or_equal":"Toto pole by mělo být číslo rovné nebo nižší než ","validation.greater_or_equal":"Toto pole musí být větší nebo rovno ","error.default_message":"Něco se pokazilo.","error.view_details":"Zobrazit podrobnosti o chybě","comment.unknownAuthor":"Neznámý autor"},oe={"comment.form.placeholder":"Write your comments here (Ctrl+Enter to confirm, Esc to cancel)","wizard.nav.tooltip":"Navigation to this tab is disabled to prevent overlooking important questions. Use form-related buttons to navigate to this tab instead.","wizard.next":"Next","wizard.previous":"Previous","section.expand":"Expand","section.collapse":"Collapse","validation.required":"This field is required.","validation.required_only_for_completeness":"This field is required to complete the form.","validation.invalid":"This field is invalid.","validation.check":"This field must be checked.","validation.lower_or_equal":"This field should be a number equal or lower to ","validation.greater_or_equal":"This field must be greater or equal to ","error.default_message":"Something went wrong.","error.view_details":"View Error Details","comment.unknownAuthor":"Unknown Author"};const se=/*#__PURE__*/e.createContext({}),re=({children:t,locale:n=navigator.language})=>{let o=oe;return n===te.LANG.cs.locale&&(o=ne),/*#__PURE__*/e.createElement(se.Provider,{value:{locale:n,lang:o}},/*#__PURE__*/e.createElement(u,{locale:n,messages:o},t))};var ie,ae={"@graph":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":"form","http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["wizard-step","section"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["textarea"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_answer":{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/answer","http://onto.fel.cvut.cz/ontologies/documentation/has_data_value":""}}]}]}]};class le{static generateForm(){return JSON.parse(JSON.stringify(ae))}}class ce{static getStringHash(e){let t=0;const n=e?e.length:0;if(0===n)return t;for(let o=0;o<n;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return t}static asArray(e){return e?e.constructor===Array?e:[e]:[]}static findQuestionById(e,t,n,o,s){if(n&&t["@id"]===e)return t;const r=ce.asArray(t[te.HAS_SUBQUESTION]);if(o)for(let t of r){let n=ce.findQuestionById(e,t,!0,!1,!1);if(n)return n}if(s)for(let t of r){let n=ce.findQuestionById(e,t,!1,!0,!0);if(n)return n}return null}static findKeyInObjects(e,t){for(let n=0;n<e.length;n++)for(let o=0;o<t.length;o++)if(e[n].hasOwnProperty(t[o]))return t[o];return null}static isOptionQuestionFeedbackEnabled(e){var t;return null!=(t=null==e?void 0:e.enableOptionQuestionFeedback)&&t}}class ue{static putObject(e,t){ue.objectMap[e]=t}static getObject(e){return ue.objectMap[e]}}ue.objectMap={};class de{static getFirstObject(e,t){const n=m.getValues(e,t);return 0===n.length?null:n[0]}static compareValues(e,t){return t="object"==typeof t?t:{"@value":t},!!((e="object"==typeof e?e:{"@value":e})&&e["@value"]&&t&&t["@value"]&&("string"==typeof e["@value"]?e["@value"]:JSON.stringify(e["@value"]))===("string"==typeof t["@value"]?t["@value"]:JSON.stringify(t["@value"])))||m.compareValues(e,t)}static toplogicalSort(e,t){let n;do{n=!1;for(let o=0;o<e.length;o++)for(let s=o;s<e.length;s++)if(e[o][t]&&("object"==typeof e[o][t]?e[o][t]["@id"]:e[o][t])===e[s]["@id"]){const t=e[o];e[o]=e[s],e[s]=t,n=!0;break}}while(n);return e}static orderPreservingToplogicalSort(e,t){const n=p(),o={};for(let s=0;s<e.length;s++){let r=e[s]["@id"];n.add(r),o[r]=e[s],ce.asArray(e[s][t]).map(e=>"object"==typeof e?e["@id"]:e).map(e=>[e,r]).forEach(e=>n.add(e))}let s=n.sort();for(let t=0;t<s.length;t++)e[t]=o[s[t]];return e}static getCompareLocalizedLabelFunction(e){return(t,n)=>{const o=c.getLocalized(t[c.RDFS_LABEL],e),s=c.getLocalized(n[c.RDFS_LABEL],e);return o<s?-1:o>s?1:0}}static orderByLocalizedLabels(e,t){return e.sort(de.getCompareLocalizedLabelFunction(t))}static checkId(e,t){if(void 0!==e)return e.constructor===Array?!!e.find(e=>e["@id"]===t):e.constructor===Object?e["@id"]===t:void 0}}class me{static isForm(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.FORM)}static isWizardStep(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.WIZARD_STEP)}static isSection(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.QUESTION_SECTION)}static isAnswerable(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.ANSWERABLE)}static isTypeahead(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.QUESTION_TYPEAHEAD)}static getPossibleValuesQuery(e){return c.getJsonAttValue(e,te.HAS_OPTIONS_QUERY)}static isDisabled(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DISABLED)}static isHidden(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.HIDDEN)}static isTextarea(e,t){return t&&t.length>te.INPUT_LENGTH_THRESHOLD&&!me.isTypeahead(e)||c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TEXTAREA)}static isText(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TEXT)}static isCalendar(e){return me.isDate(e)||me.isTime(e)||me.isDateTime(e)}static isDate(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DATE)}static isTime(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TIME)}static isDateTime(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.DATETIME)}static isTimestamp(e){return c.hasValue(e,te.TIMESTAMP_FORMAT,te.EPOCH_MILLISECONDS)}static isCheckbox(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.CHECKBOX)}static isMaskedInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.MASKED_INPUT)}static isSparqlInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.SPARQL)}static isTurtleInput(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.TURTLE)}static isCollapsed(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.COLLAPSED)}static isEmphasised(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.EMPHASISED)}static getCategory(e){return te.LAYOUT.CATEGORY.find(t=>c.hasValue(e,te.LAYOUT_CLASS,t))}static resolveValue(e){return e?e[te.HAS_OBJECT_VALUE]?e[te.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,te.HAS_DATA_VALUE):null}static resolveValueObject(e){return e?e[te.HAS_OBJECT_VALUE]?ce.asArray(e[te.HAS_OBJECT_VALUE])[0]:e[te.HAS_DATA_VALUE]?ce.asArray(e[te.HAS_DATA_VALUE])[0]:null:null}static isRelevant(e){if(!e[te.IS_RELEVANT_IF])return!0;for(let t of ce.asArray(e[te.IS_RELEVANT_IF]))if(!me.testCondition(t))return!1;return!0}static hasValidationLogic(e){return!!(e[te.REQUIRES_ANSWER]||e[te.REQUIRES_ANSWER_IF]||e[te.PATTERN]||this.containsXSDProperty(e))}static isValid(e){if(!1===e[te.HAS_VALID_ANSWER])return!1;for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(!1===this.isValid(t))return!1;return!0}static testOrCondition(e){const t=e[te.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(const e of this._getMappedObjectsArray(t))if(this.testCondition(e))return!0;return!1}static testCondition(e){const t=e[te.ACCEPTS_VALIDATION_VALUE],n=e[te.ACCEPTS_ANSWER_VALUE],o=e[te.ACCEPTS],s=e[te.HAS_TESTED_QUESTION];let r;if(e[te.HAS_SUB_CONDITION])return this.testOrCondition(e);if(t&&n&&console.warn("Support for validation and requirement constraints at same time is not implemented !"),o&&s){const e=ce.asArray(o);if(1!==e.length&&console.warn("Support for multiple accepts values is not implemented !"),e[0]["@id"]===te.ANSWERED_QUESTION){(n||t)&&console.warn("Support for accepted answer/validations values is not implemented !");for(const e of this._getMappedObjectsArray(s))if(!this.hasAnswer(e))return!1;return!0}console.warn("No support to accept question of type "+e[0]["@id"]+" !")}if(t&&s){const e=ce.asArray(t);(1!==e.length||!0!==e[0]&&"true"!==e[0])&&console.warn('Validation values other than "true" are not implemented !');for(const e of ce.asArray(s)){if(r=ue.getObject(e["@id"]),void 0===r)return console.warn("Questions is not loaded in an object map."),!0;if(!1===this.isValid(r))return!1}return!0}if(n&&s){r=ue.getObject(s["@id"]);for(const e of ce.asArray(n)){if(!r)return console.warn("Question is not defined."),!0;if(!r.hasOwnProperty(te.HAS_ANSWER))return!1;const t=m.getValues(r,te.HAS_ANSWER);if(0===t.length)return!1;const n=me.resolveValueObject(t[0]);if(n&&e&&n.hasOwnProperty("@value")&&e.hasOwnProperty("@id")&&n["@value"]==e["@id"])return!0;if(de.compareValues(n,e))return!0}}return!1}static _getMappedObjectsArray(e,t){return ce.asArray(e).map(e=>{const n=ue.getObject(e["@id"]);return void 0===n?(console.warn((t||"Object")+' "'+e["@id"]+'" is not loaded in an object map.'),null):n}).filter(function(e){return null!==e})}static hasAnswer(e){if(!e)return!1;if(e.hasOwnProperty(te.HAS_ANSWER)){const t=m.getValues(e,te.HAS_ANSWER);if(t.length){const e=me.resolveValueObject(t[0]);if(e&&(e["@value"]||e["@id"]))return!0}}for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.hasAnswer(t))return!0;return!1}static hasCorrectAnswer(e){if(!e)return!1;if(e.hasOwnProperty(te.HAS_CORRECT_ANSWER)){let t=m.getValues(e,te.HAS_CORRECT_ANSWER);if(Array.isArray(t)&&0!==t.length){t=t[0];const e=me.resolveValueObject(t);if(e&&(e["@value"]||e["@id"]))return!0}return!(!t["@value"]&&!t["@id"])}for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.hasCorrectAnswer(t))return!0;return!1}static getAnswerValue(e){if(!e)return null;if(e.hasOwnProperty(te.HAS_ANSWER)){const t=m.getValues(e,te.HAS_ANSWER);if(t.length){const e=me.resolveValueObject(t[0]);if(e&&(e["@value"]||e["@id"]))return e["@value"]||e["@id"]}}for(const t of ce.asArray(e[te.HAS_SUBQUESTION])){const e=me.getAnswerValue(t);if(e)return e}return null}static getCorrectAnswerValue(e){if(!e)return null;if(e.hasOwnProperty(te.HAS_CORRECT_ANSWER)){var t,n;let r=m.getValues(e,te.HAS_CORRECT_ANSWER);if(!r)return null;Array.isArray(r)&&(r=r[0]);let i=m.getValues(r,te.HAS_DATA_VALUE)||m.getValues(r,te.HAS_OBJECT_VALUE);if(i&&(!Array.isArray(i)||i.length>0)){var o;Array.isArray(i)&&(i=i[0]);const e=i[te.RDFS_LABEL];var s;return e?null!=(s=e["@value"])?s:e:null!=(o=i["@value"])?o:null}return null!=(t=null!=(n=r["@value"])?n:r[te.RDFS_LABEL])?t:null}for(const t of ce.asArray(e[te.HAS_SUBQUESTION])){const e=me.getCorrectAnswerValue(t);if(e)return e}return null}static resolveDateTimeFormat(e,t,n){const o=me.isDate(e),s=me.isTime(e),r=me.isDateTime(e);switch(!0){case o:return e[te.DATE_FORMAT]||n.dateFormat;case s:return e[te.TIME_FORMAT]||n.timeFormat;case r:return e[te.DATETIME_FORMAT]||n.dateTimeFormat;default:return null}}static dfsTraverseQuestionTree(e,t,n=(()=>{})){function o(e){t(e),ce.asArray(e[te.HAS_SUBQUESTION]).forEach(e=>{o(e)}),n(e)}e.forEach(e=>{o(e)})}static getFormSpecification(e){let t=-1;const n="..";let o="";return me.dfsTraverseQuestionTree(e,function(e){t+=1;const s=" ".repeat(t);let r="";e[te.REQUIRES_ANSWER]&&!e[te.USED_ONLY_FOR_COMPLETENESS]?r=s+n+"required: "+e[te.REQUIRES_ANSWER]+"\n":e[te.USED_ONLY_FOR_COMPLETENESS]&&(r=s+n+"required only for completeness: "+e[te.USED_ONLY_FOR_COMPLETENESS]+"\n"),o+=s+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",o+=e[te.HELP_DESCRIPTION]?s+n+"description: "+e[te.HELP_DESCRIPTION]+"\n":"",o+=r,o+=e[te.PATTERN]?s+n+"pattern: "+e[te.PATTERN]+"\n":"",o+=e[te.INPUT_MASK]?s+n+"mask: "+e[te.INPUT_MASK]+"\n":"",o+=e[te.XSD.MAX_INCLUSIVE]?s+n+"This field should be a number equal or lower to "+e[te.XSD.MAX_INCLUSIVE]+"\n":"",o+=e[te.XSD.MIN_INCLUSIVE]?s+n+"This field must be greater or equal to "+e[te.XSD.MIN_INCLUSIVE]+"\n":"",o+=e[te.HAS_VALIDATION_MESSAGE]?s+n+"validation-message: "+e[te.HAS_VALIDATION_MESSAGE]+"\n":"",o+="\n"},function(){t-=1}),o}static containsXSDProperty(e){const t=Object.keys(e),n=Object.values(te.XSD);for(const e of n)if(t.includes(e))return!0;return!1}static getInputMask(e){if(e[te.INPUT_MASK])return e[te.INPUT_MASK]}static hasMediaContentWithAnnotations(e){if(e[te.HAS_MEDIA_CONTENT])for(const t of ce.asArray(e[te.HAS_MEDIA_CONTENT]))if(t[te.HAS_ANNOTATION]&&ce.asArray(t[te.HAS_ANNOTATION]).length>0)return!0;return!1}static containsHints(e){if(e[te.HAS_SUBQUESTION])for(const t of ce.asArray(e[te.HAS_SUBQUESTION]))if(me.containsHints(t))return!0;return this.hasCorrectAnswer(e)||this.hasMediaContentWithAnnotations(e)}}class pe{static log(e){console.log(e)}static warn(e){console.warn?console.warn(e):console.log("WARNING: "+e)}static error(e){console.error?console.error(e):console.log("ERROR: "+e)}}const he={root:{[te.HAS_LAYOUT_CLASS]:te.FORM},expandProperties:[te.HAS_SUBQUESTION,te.IS_RELEVANT_IF,te.HAS_ANSWER,te.HAS_DECLARED_PREFIX,te.HAS_OPTION,te.HAS_CORRECT_ANSWER,te.HAS_COMMENT,te.HAS_MEDIA_CONTENT,te.HAS_ANNOTATION]};class Ee{static customFrame(e,t,n){if(arguments.length<2)return m.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=he),m.flatten(e,null,null,(e,t)=>{})}static expandStructure(e){let t;const n={};e["@graph"].forEach(e=>{n[e["@id"]]=e,me.isForm(e)&&(t=e)});try{this._expandGraph(t,he,n)}catch(e){console.error("Error '"+e+"' occured, while trying to apply frame-ing with custom shape.")}return n}static _expandGraph(e,t,n){let o,s,r;t.expandProperties.forEach(i=>{if(e.hasOwnProperty(i)){e[i]=ce.asArray(e[i]),o=e[i];for(let e=0;e<o.length;e++)r=this._getId(o[e]),s=n[r],void 0!==s?(o[e]=s,this._expandGraph(s,t,n)):console.warn("object with @id "+r+" was not defined in input data.")}})}static _getId(e){return"string"==typeof e?e:e&&"object"==typeof e?e["@id"]:void 0}}ie=Ee,Ee.compressStructure=e=>{let t=[],n=new Set;return t=ie._compressGraph(e,t,n),t=t.sort((e,t)=>e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0),t},Ee._compressGraph=(e,t,n)=>(n.has(e["@id"])||(t.push(e),n.add(e["@id"])),he.expandProperties.forEach(o=>{if(e.hasOwnProperty(o)){const s=e[o];for(let r=0;r<s.length;r++){const i=s[r];void 0!==i&&(s[r]=i,t=ie._compressGraph(i,t,n),e[o][r]={"@id":i["@id"]})}}}),t);class ge{static constructDefaultForm(e){const t=le.generateForm();return ge._constructFormQuestions(t,e)}static async constructForm(e,t){let n,o;return m.flatten(e,{}).then(e=>{try{const[s,r]=ge._constructFormQuestions(e,t);o=r,n={formQuestions:s}}catch(e){console.error("Error while constructing form questions from the provided structure:",e)}if(!o){const[e,s]=ge.constructDefaultForm(t);o=s,n={formQuestions:e}}return[n,o]}).catch(e=>(console.error("Failed to flatten the JSON-LD structure. Expected to transform a nested JSON-LD document into a flattened array of node objects:",e),[n,o]))}static _constructFormQuestions(e,t){let n,o,s,r=[];if(void 0!==e["@graph"][0]["@id"]?(s=Ee.expandStructure(e),Object.keys(s).map(e=>{ue.putObject(e,s[e])})):console.warn("default form is constructed."),n=e["@graph"].find(e=>me.isForm(e)),o=n[te.HAS_SUBQUESTION],!o)throw pe.error("Could not find any questions in the received data."),"No questions in the form";return r=o.filter(e=>!(!me.isWizardStep(e)||me.isHidden(e))||(pe.warn("Item is not a wizard step: "+e),!1)),r.length||(pe.log("Could not find any wizard steps in the received data. Building form without steps"),n[te.HAS_SUBQUESTION].forEach(e=>r.push(e))),r.sort(de.getCompareLocalizedLabelFunction(t)),de.orderPreservingToplogicalSort(r,te.HAS_PRECEDING_QUESTION),[r,{root:n}]}}const Ae=["validation","children","value"];class Se extends e.Component{constructor(e){super(e),this.state={cursorPosition:0}}focus(){x.findDOMNode(this.input).focus()}getInputDOMNode(){return x.findDOMNode(this.input)}componentDidUpdate(e,t,n){(this.fieldDidShrink(e)||this.fieldDidExpand(e))&&this.updateFieldCursorPosition()}fieldDidExpand(e){return"textarea"===this.props.type&&"textarea"!==e.type}fieldDidShrink(e){return"text"===this.props.type&&"text"!==e.type}updateFieldCursorPosition(){this.focus(),this.getInputDOMNode().setSelectionRange(this.state.cursorPosition,this.state.cursorPosition)}saveCursorPosition(e){this.props.onChange(e),this.setState({cursorPosition:e.target.selectionStart})}render(){switch(this.props.type){case"radio":return this._renderRadio();case"checkbox":return this._renderCheckbox();case"select":return this._renderSelect();case"textarea":return this._renderTextArea();default:return this._renderInput()}}_renderCheckbox(){/*#__PURE__*/return e.createElement(h.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),className:"mb-3"},/*#__PURE__*/e.createElement(h.Check,$({type:"checkbox",ref:e=>this.input=e},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)}_renderRadio(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Check,$({type:"radio",ref:e=>this.input=e},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)}_renderSelect(){const t=this.props,{validation:n,children:o,value:s}=t,r=Z(t,Ae);/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(g,$({as:"select",value:s,className:n.classname,ref:e=>this.input=e},r),o),n.message)}_renderLabel(){return this.props.label?/*#__PURE__*/e.createElement(h.Label,null,this.props.label):null}_renderTextArea(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(g,$({ref:e=>this.input=e,as:"textarea"},this.props,{className:this.props.validation.classname,onChange:e=>this.saveCursorPosition(e)})),this.props.validation.message)}_renderInput(){/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(g,$({className:this.props.validation.classname,ref:e=>this.input=e,as:"input",placeholder:this.props.placeholder},this.props,{onChange:e=>this.saveCursorPosition(e)})),this.props.validation.message)}}Se.propTypes={type:U.string,label:U.object,value:U.any,onChange:U.func,help:U.string,validation:U.object,placeholder:U.string},Se.defaultProps={type:"text"};const ve=["children"],fe=/*#__PURE__*/e.createContext({}),_e={components:{inputComponent:Se},componentsOptions:{dateTimeAnswer:{dateFormat:"yyyy-MM-dd",timeFormat:"HH:mm",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},readOnly:!1},options:{intl:{locale:"en"},modalView:!1,modalProps:{},horizontalWizardNav:!0,wizardStepButtons:!0,enableWizardStepSkip:!0,startingStep:0,enableOptionQuestionFeedback:!1}},Te=n=>{let{children:o}=n,s=Z(n,ve);const r=t(()=>({inputComponent:s.components&&s.components.inputComponent||_e.components.inputComponent,componentsOptions:Object.assign({},_e.componentsOptions,s.componentsOptions),options:Object.assign({},_e.options,s.options),mapComponent:s.mapComponent}),[s]);/*#__PURE__*/return e.createElement(fe.Provider,{value:r},o)};Te.propTypes={children:U.element.isRequired,components:U.object,mapComponent:U.func,options:U.object};class Ne extends e.Component{constructor(e){super(e),this.state={hasError:!1,errorLabel:null,errorDetails:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({errorLabel:e,errorDetails:t})}render(){if(this.state.hasError){const{lang:t}=this.context;/*#__PURE__*/return e.createElement("div",{style:{padding:"20px"}},/*#__PURE__*/e.createElement(A,{variant:"danger"},/*#__PURE__*/e.createElement(A.Heading,null,t["error.default_message"]||"Something went wrong."),/*#__PURE__*/e.createElement("p",null,this.state.errorLabel&&this.state.errorLabel.toString())),/*#__PURE__*/e.createElement(S,null,/*#__PURE__*/e.createElement(v,null,/*#__PURE__*/e.createElement(v.Header,null,/*#__PURE__*/e.createElement(S,{as:f,variant:"link",eventKey:"0"},t["error.view_details"]||"View Error Details")),/*#__PURE__*/e.createElement(S.Collapse,{eventKey:"0"},/*#__PURE__*/e.createElement(v.Body,null,/*#__PURE__*/e.createElement("pre",{style:{whiteSpace:"pre-wrap"}},this.state.errorDetails&&this.state.errorDetails.componentStack))))))}return this.props.children}}Ne.contextType=se;const Ie=["children"],Oe=/*#__PURE__*/e.createContext({}),Ce=n=>{let{children:o}=n,s=Z(n,Ie),r=[];const i=async(e,t)=>{const n=r[e];if(n&&n.length)return n;const o=await s.fetchTypeAheadValues(t);return o.length?m.frame(o,{},{}).then(t=>{const n=t["@graph"];return r.push(Object.assign({},n,{[e]:n})),n}):(pe.warn(`No data received when loading options using id ${e}`),[])},a=e=>r[e]||[],l=t(()=>({loadFormOptions:i,getOptions:a}),[i,a]);/*#__PURE__*/return e.createElement(Oe.Provider,$({value:l},s),o)};Ce.propTypes={children:U.element.isRequired,fetchTypeAheadValues:U.func};const be={},ye=[],we=/*#__PURE__*/e.createContext({}),Re=s=>{const[r,i]=n(s.data||be),[a,l]=n(s.formQuestions||ye);o(()=>{if(s.isFormValid){const e=me.isValid(r);s.isFormValid(e)}},[]),o(()=>{i(s.data||be)},[a]);const c=e=>{e&&i(Object.assign({},r,e))},u=(e,t)=>{if(!(!t||e<0||e>=a.length)){if("object"==typeof t){const n=[...a];n[e]=Object.assign({},n[e],t),l(n)}if(Array.isArray(t)&&l(t),s.isFormValid){const e=me.isValid(r);s.isFormValid(e)}}},d=()=>r,m=e=>null==e?a:a[e],p=t(()=>({updateData:c,updateFormQuestionsData:u,getData:d,getFormQuestionsData:m}),[m,d]);/*#__PURE__*/return e.createElement(we.Provider,$({value:p},s),s.children)};Re.propTypes={children:U.element.isRequired,data:U.object.isRequired,formQuestions:U.array.isRequired,isFormValid:U.func};class Le{static buildQuestionAnswerModel(e,t){const n={subQuestions:[]};let o;if(e&&(n.uri=e.root["@id"],n.origin=c.getJsonAttValue(e.root,te.HAS_QUESTION_ORIGIN,"@id")),t)for(let e=0;e<t.length;e++)o=Le.processQuestionAnswerHierarchy(t[e]),o&&n.subQuestions.push(o);return n}static processQuestionAnswerHierarchy(e){return e?Le._processQuestion(e):null}static _processQuestion(e){const t={};if(t.uri=e["@id"],t.origin=c.getJsonAttValue(e,te.HAS_QUESTION_ORIGIN,"@id"),e[te.HAS_SUBQUESTION]){t.subQuestions=[];for(let n=0;n<e[te.HAS_SUBQUESTION].length;n++)t.subQuestions.push(Le._processQuestion(e[te.HAS_SUBQUESTION][n]))}if(e[te.HAS_ANSWER]){t.answers=[],Array.isArray(e[te.HAS_ANSWER])||(e[te.HAS_ANSWER]=[e[te.HAS_ANSWER]]);for(let n=0;n<e[te.HAS_ANSWER].length;n++)t.answers.push(Le.processAnswer(e[te.HAS_ANSWER][n]))}if(e[te.HAS_COMMENT]){t.comments=[],Array.isArray(e[te.HAS_COMMENT])||(e[te.HAS_COMMENT]=[e[te.HAS_COMMENT]]);for(let n=0;n<e[te.HAS_COMMENT].length;n++)t.comments.push(Le.processComment(e[te.HAS_COMMENT][n]))}return t}static processComment(e){const t={};return t.author=c.getJsonAttValue(e,te.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,te.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,te.HAS_TIMESTAMP,"@id"),t}static processAnswer(e){const t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,te.HAS_ANSWER_ORIGIN,"@id"),e[te.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,te.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,te.HAS_DATA_VALUE),t}static generateAnswer(e){const t={};return t[te.HAS_DATA_VALUE]="",t}}const He=t=>{const{inputComponent:n,componentsOptions:o}=s(fe);/*#__PURE__*/return e.createElement(n,{type:"checkbox",label:t.label,title:t.title,checked:!0===t.value||"true"===t.value,validation:t.validation,onChange:e=>{t.onChange(e.target.checked)},disabled:o.readOnly||me.isDisabled(t.question)})};He.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.bool]),onChange:U.func.isRequired,mouseHover:U.bool,validation:U.object};const De=t=>{const{componentsOptions:r}=s(fe),[i,a]=n(null),[l,c]=n(""),u=me.resolveDateTimeFormat(t.question,t.value,r.dateTimeAnswer),d=me.isDate(t.question),m=me.isTime(t.question),p=me.isTimestamp(t.question);o(()=>{const e=g(t.value);e?a(e):(a(null),c(`Invalid date value ${t.value} of question ${t.question["@id"]}.`),console.error(l))},[t.value,u]);const g=e=>{if(!e)return null;const t=p?new Date(e):q(e,u,new Date);return isNaN(t.getTime())?null:t};/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(P,{selected:i,placeholderText:u,onChange:e=>{a(e);const n=e?p?e.getTime():k(e,u):"";t.onChange(n)},showTimeSelect:!d,showTimeSelectOnly:m,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:u,className:F("form-control",t.validation.classname),disabled:r.readOnly||me.isDisabled(t.question)}),t.validation.message)};De.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const Ve=[te.XSD.INT,te.XSD.INTEGER,te.XSD.NON_NEGATIVE_INTEGER,te.XSD.NON_POSITIVE_INTEGER,te.XSD.NEGATIVE_INTEGER,te.XSD.POSITIVE_INTEGER,te.XSD.FLOAT,te.XSD.POSITIVE_FLOAT,te.XSD.NEGATIVE_FLOAT],Me={};Me[te.XSD.NON_NEGATIVE_INTEGER]={min:0},Me[te.XSD.NON_POSITIVE_INTEGER]={max:0},Me[te.XSD.NEGATIVE_INTEGER]={max:-1},Me[te.XSD.POSITIVE_INTEGER]={min:1};const Ue={"string-2":"prefixed",atom:"var"};class xe{static _resolveInputType(e,t){return me.isSparqlInput(e)||me.isTurtleInput(e)||me.isTextarea(e,t)?"textarea":xe._isNumeric(e)?"number":"text"}static _isNumeric(e){for(let t=0,n=Ve.length;t<n;t++)if(c.hasValue(e,te.HAS_DATATYPE,Ve[t]))return!0;return!1}static resolveInputProperties(e,t,n){let o={};switch(o.type=xe._resolveInputType(e,t),o.type){case"textarea":o.rows=5;break;case"number":o=Object.assign({},o,xe._resolveNumberRestrictions(e),this._resolveStepRestriction(e))}return o.disabled=n.readOnly||me.isDisabled(e),o}static _resolveStepRestriction(e){let t={};return void 0!==e[te.STEP]&&(t.step=c.getJsonAttValue(e,te.STEP)),t}static _resolveNumberRestrictions(e){let t={};return Object.getOwnPropertyNames(Me).forEach(n=>{c.hasValue(e,te.HAS_DATATYPE,n)&&(t=Object.assign({},t,Me[n]))}),void 0!==e[te.XSD.MIN_INCLUSIVE]&&(t.min=e[te.XSD.MIN_INCLUSIVE]),void 0!==e[te.XSD.MIN_EXCLUSIVE]&&(t.min=e[te.XSD.MIN_EXCLUSIVE]+1),void 0!==e[te.XSD.MAX_EXCLUSIVE]&&(t.max=e[te.XSD.MAX_EXCLUSIVE]-1),void 0!==e[te.XSD.MAX_INCLUSIVE]&&(t.max=e[te.XSD.MAX_INCLUSIVE]),t}static _preventCharacterInput(e,t){"number"!==xe._resolveInputType(t)||e.key>="0"&&e.key<="9"||["Backspace","Delete","ArrowLeft","ArrowRight","-","Minus","NumpadSubtract",".","Period"].includes(e.key)||e.preventDefault()}}const Pe=t=>{const{inputComponent:n,componentsOptions:o}=s(fe),r=t.question,i=t.answer;let a=t.value;return i[te.HAS_OBJECT_VALUE]&&i[te.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(a=c.getJsonAttValue(i[te.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(n,Object.assign({},xe.resolveInputProperties(r,a,o),{validation:t.validation,label:t.label,title:t.title,value:null==a?"":a,placeholder:me.getInputMask(r),onKeyPress:e=>xe._preventCharacterInput(e,r),onChange:e=>{t.onChange(e.target.value),(t.sparql||t.turtle)&&(void 0).hide()},onFocus:e=>{if(t.sparql){const n=z.fromTextArea(e.target);n.setValue(a),n.on("change",()=>{t.onChange(n.getValue())}),z.Autocompleters.prefixes.appendPrefixIfNeeded=function(e,n){if(!e.autocompleters.getTrie(n))return;if(!e.options.autocompleters||-1===e.options.autocompleters.indexOf(n))return;const o=e.getCursor(),s=e.getTokenAt(o);if("prefixed"===Ue[s.type]){const r=s.string.indexOf(":");if(-1!==r){const i=e.getPreviousNonWsToken(o.line,s).string.toUpperCase(),a=e.getTokenAt({line:o.line,ch:s.start});if("PREFIX"!==i&&("ws"===a.type||null==a.type)){const o=s.string.substring(0,r+1);if(null==e.getPrefixesFromQuery()[o.slice(0,-1)])if(t.question[te.HAS_DECLARED_PREFIX]&&t.question[te.HAS_DECLARED_PREFIX].filter(e=>e[te.PREFIX]===o.slice(0,-1)).length){const n=t.question[te.HAS_DECLARED_PREFIX].filter(e=>e[te.PREFIX]===o.slice(0,-1)),s={};s[n[0][te.PREFIX]]=n[0][te.NAMESPACE],e.addPrefixes(s)}else{const t=e.autocompleters.getTrie(n).autoComplete(o);t.length>0&&e.addPrefixes(t[0])}}}}}}else if(t.turtle){console.log("TTL");const n=z.fromTextArea(e.target);n.setValue(a),n.on("change",()=>{t.onChange(n.getValue())})}}}))};Pe.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const qe={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"};class ke{static mapMask(e){if(!e)return e;let t,n="";for(let o=0,s=e.length;o<s;o++)t=e.charAt(o),n+=qe[t]?qe[t]:t;return n}}const Fe=["size","placeholder"];function ze(e){let t,n,o,s;if(void 0!==e.selectionStart)t=e.selectionStart,n=e.selectionEnd;else try{e.focus(),o=e.createTextRange(),s=o.duplicate(),o.moveToBookmark(document.selection.createRange().getBookmark()),s.setEndPoint("EndToStart",o),t=s.text.length,n=t+o.text.length}catch(e){}return{start:t,end:n}}class je extends e.Component{constructor(e){super(e),this._updatePattern=e=>{this.mask.setPattern(ke.mapMask(e.mask),{value:this.mask.getRawValue(),selection:ze(this.input)})},this._updateMaskSelection=()=>{this.mask.selection=ze(this.input)},this._updateInputSelection=()=>{!function(e,t){let n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t.start,t.end)):(e.focus(),n=e.createTextRange(),n.collapse(!0),n.moveStart("character",t.start),n.moveEnd("character",t.end-t.start),n.select())}catch(e){}}(this.input,this.mask.selection)},this._onChange=e=>{const t=this.mask.getValue();if(e.target.value!==t){if(e.target.value.length<t.length){const n=t.length-e.target.value.length;this._updateMaskSelection(),this.mask.selection.end=this.mask.selection.start+n,this.mask.backspace()}const n=this._getDisplayValue();e.target.value=n,n&&this._updateInputSelection()}this.props.onChange&&this.props.onChange(e)},this._onKeyDown=e=>{if(function(e){return e.ctrlKey&&90===e.keyCode}(e))e.preventDefault(),this.mask.undo()&&(e.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e));else if(function(e){return e.ctrlKey&&89===e.keyCode}(e))e.preventDefault(),this.mask.redo()&&(e.target.value=this._getDisplayValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e));else if("Backspace"===e.key&&(e.preventDefault(),this._updateMaskSelection(),this.mask.backspace())){const t=this._getDisplayValue();e.target.value=t,t&&this._updateInputSelection(),this.props.onChange&&this.props.onChange(e)}},this._onKeyPress=e=>{e.metaKey||e.altKey||e.ctrlKey||"Enter"===e.key||(e.preventDefault(),this._updateMaskSelection(),this.mask.input(e.key)&&(e.target.value=this.mask.getValue(),this._updateInputSelection(),this.props.onChange&&this.props.onChange(e)))},this._onPaste=e=>{e.preventDefault(),this._updateMaskSelection(),this.mask.paste(e.clipboardData.getData("Text"))&&(e.target.value=this.mask.getValue(),setTimeout(this._updateInputSelection,0),this.props.onChange&&this.props.onChange(e))},this.mask=new j({pattern:ke.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"})}componentDidUpdate(e){e.mask!==this.props.mask&&this._updatePattern(this.props),e.mask!==this.props.mask&&e.value!==this.props.mask?this.mask.getValue()===this.mask.emptyValue?this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(ke.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.value!==this.props.value&&this.mask.setValue(this.props.value),e.mask!==this.props.mask&&this.mask.selection.start&&this._updateInputSelection()}_getDisplayValue(){const e=this.mask.getValue();return e===this.mask.emptyValue?"":e}focus(){this.input.focus()}blur(){this.input.blur()}render(){const t=this.props,{size:n,placeholder:o}=t,s=Z(t,Fe),r=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},s,{ref:e=>{e&&(this.input=e.input?x.findDOMNode(e.input):e)},maxLength:r,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:o||this.mask.emptyValue,size:n||r,value:this._getDisplayValue(),type:"text"}))}}je.contextType=fe,je.propTypes={mask:U.string.isRequired},je.defaultProps={value:""};const Qe=t=>{const{componentsOptions:n}=s(fe),o=t.question,r=t.value,i=c.getJsonAttValue(o,te.INPUT_MASK);return i?/*#__PURE__*/e.createElement(je,{mask:i,value:r,label:t.label,title:t.title,placeholder:i,onChange:e=>t.onChange(e.target.value),disabled:n.readOnly||me.isDisabled(o),validation:t.validation}):(pe.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(Pe,t))};Qe.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.oneOfType([U.string,U.number]),onChange:U.func.isRequired,validation:U.object};const Be=(t,n="-- Select --")=>{const o=[...t].sort((e,t)=>{const n=c.getJsonAttValue(e,te.RDFS_LABEL),o=c.getJsonAttValue(t,te.RDFS_LABEL);return n<o?-1:n>o?1:0}).map((t,n)=>{const o=c.getJsonAttValue(t,te.RDFS_LABEL);/*#__PURE__*/return e.createElement("option",{value:o,key:`opt-${n}`},o)});return[/*#__PURE__*/e.createElement("option",{value:"",key:"opt-placeholder",disabled:!0,hidden:!0},n),...o]},We=({question:t,label:n,title:o,value:r,validation:i,onChange:a})=>{const{inputComponent:l,componentsOptions:c}=s(fe);/*#__PURE__*/return e.createElement(l,{type:"select",label:n,value:r,title:o,validation:i,onChange:e=>a(e.target.value),disabled:c.readOnly||me.isDisabled(t)},Be(t[te.HAS_OPTION]))};function Ye({size:t=17,className:n=""}){/*#__PURE__*/return e.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",className:n,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},/*#__PURE__*/e.createElement("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"}))}function Xe({size:t=17,className:n=""}){/*#__PURE__*/return e.createElement("svg",{width:t,height:t,viewBox:"0 0 50 50",className:n,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},/*#__PURE__*/e.createElement("path",{strokeWidth:3,stroke:"currentColor",d:"M 41.9375 8.625 C 41.273438 8.648438 40.664063 9 40.3125 9.5625 L 21.5 38.34375 L 9.3125 27.8125 C 8.789063 27.269531 8.003906 27.066406 7.28125 27.292969 C 6.5625 27.515625 6.027344 28.125 5.902344 28.867188 C 5.777344 29.613281 6.078125 30.363281 6.6875 30.8125 L 20.625 42.875 C 21.0625 43.246094 21.640625 43.410156 22.207031 43.328125 C 22.777344 43.242188 23.28125 42.917969 23.59375 42.4375 L 43.6875 11.75 C 44.117188 11.121094 44.152344 10.308594 43.78125 9.644531 C 43.410156 8.984375 42.695313 8.589844 41.9375 8.625 Z"}))}We.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object},Ye.propTypes={size:U.number,className:U.string},Xe.propTypes={size:U.number,className:U.string};const Ge=({status:t})=>"correct"===t?/*#__PURE__*/e.createElement(Xe,{className:"select-feedback-badge correct visible"}):"incorrect"===t?/*#__PURE__*/e.createElement(Ye,{className:"select-feedback-badge incorrect visible"}):null;Ge.displayName="SelectFeedbackBadge",Ge.propTypes={status:U.oneOf(["correct","incorrect",null])};const Ke="select-correct",Je="select-incorrect",$e=({question:t,label:i,title:a,value:l,validation:u,onChange:d,hintRevealed:m})=>{const{inputComponent:p,componentsOptions:h}=s(fe),E=r(null),[g,A]=n(null),[S,v]=n(null!=l?l:""),f=e=>{const n=((e,t)=>t?e.trim()===t.trim()?"correct":"incorrect":null)(e,me.getCorrectAnswerValue(t));var o,s,r,i;n&&(s="correct"===n,(o=null!=(r=null==(i=E.current)?void 0:i.querySelector("select"))?r:null)&&(o.classList.remove(Ke,Je),o.classList.add(s?Ke:Je)),A(n))};o(()=>{var e;if(!me.hasAnswer(t)||!l)return;const n=((e=[],t)=>{const n=((e=[],t)=>{var n;return null!=(n=e.find(e=>e["@id"]===t))?n:null})(e,t);return n?c.getJsonAttValue(n,te.RDFS_LABEL):t})(null!=(e=t[te.HAS_OPTION])?e:[],l);v(n),f(n)},[]);const _=()=>{const e=me.getCorrectAnswerValue(t);e&&(v(e),d(e),f(e))};return o(()=>{m&&_()},[m]),/*#__PURE__*/e.createElement("div",{ref:E,style:{position:"relative"}},/*#__PURE__*/e.createElement(p,{type:"select",label:i,value:S,title:a,validation:u,onChange:e=>{if(m)return void _();const t=e.target.value;v(t),d(t),f(t)},disabled:h.readOnly||me.isDisabled(t)},Be(t[te.HAS_OPTION])),/*#__PURE__*/e.createElement(Ge,{status:g}))};$e.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool};const Ze=t=>{const n=s(fe),o=ce.isOptionQuestionFeedbackEnabled(null==n?void 0:n.options);/*#__PURE__*/return e.createElement(o?$e:We,t)};Ze.propTypes={question:U.object.isRequired,label:U.object.isRequired,title:U.string,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool,onRevealHint:U.func};const et=(e,t)=>{if(!e)return[];e=((e,t)=>void 0!==e&&e.length?(e.sort(de.getCompareLocalizedLabelFunction(t)),de.orderPreservingToplogicalSort(e,te.HAS_PRECEDING_VALUE),e):[])(e,t);const n={},o=[];for(let s of e){let e=c.getLocalized(s[te.RDFS_LABEL],t),r=c.getLocalized(s[te.RDFS_COMMENT],t);n[s["@id"]]={id:s["@id"],value:s["@id"],label:e,description:r,children:[]};for(let e of ce.asArray(s[te.BROADER]))o.push({type:"parent-child",parent:e["@id"],child:s["@id"]})}for(let e of o){var s;"parent-child"===e.type&&(null==(s=n[e.parent])||s.children.push(e.child))}return Object.values(n)},tt=(e,t)=>{if(!e)return null;const n=me.getCorrectAnswerValue(t);return n?e.trim()===n.trim()?"correct":"incorrect":null},nt={correct:"#d4edda",incorrect:"#f8d7da"},ot={"is-warning":{borderColor:"#dc9135",boxShadow:"0 0 0 0.2rem rgba(203,127,16,.25)"},"is-invalid":{borderColor:"#dc3545",boxShadow:"0 0 0 0.2rem rgba(220,53,69,.25)"}},st={correct:{borderColor:"#28a745",boxShadow:"0 0 0 0.2rem rgba(40,167,69,.25)"},incorrect:{borderColor:"#dc3545",boxShadow:"0 0 0 0.2rem rgba(220,53,69,.25)"}},rt=(e,t)=>{var n,o;return(({borderColor:e,boxShadow:t}={})=>({control:n=>Object.assign({},n,{border:e?`1px solid ${e}`:n.border,boxShadow:null!=t?t:n.boxShadow,"&:hover":{border:e?`1px solid ${e}`:n.border,boxShadow:null!=t?t:n.boxShadow}})}))(null!=(n=null!=(o=ot[null==e?void 0:e.classname])?o:st[t])?n:{})},it=({hintRevealed:t,correctValue:n,currentValue:o})=>s=>{var r,i,a;const l=(null==(r=s.label)?void 0:r.trim())===(null==n?void 0:n.trim()),c=(null==(i=s.label)?void 0:i.trim())===(null==o||null==(a=o.label)?void 0:a.trim());let u="transparent";return t&&l&&(u=nt.correct),c&&(u=l?nt.correct:nt.incorrect),/*#__PURE__*/e.createElement("div",{style:{backgroundColor:u}},/*#__PURE__*/e.createElement(B,s))},at=t=>{var s;const[r,i]=n(null),[a,l]=n(null),[c,u]=n(!1),d=me.getCorrectAnswerValue(t.question);return o(()=>{if(!t.optionsList.length)return;const e=t.optionsList.find(e=>e.id===t.value);e&&(i(e),l(tt(e.label,t.question)))},[t.optionsList]),/*#__PURE__*/e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,null,t.label),/*#__PURE__*/e.createElement(Q,{styles:rt(t.validation,a),valueKey:t.valueKey,labelKey:t.labelKey,valueRenderer:t=>((t,n)=>{var o;/*#__PURE__*/return e.createElement("div",{style:{backgroundColor:null!=(o=nt[t])?o:"transparent",padding:"2px 6px",borderRadius:"4px",display:"inline-block"}},n)})(a,t),optionRenderer:it({hintRevealed:t.hintRevealed,currentValue:r,correctValue:d}),value:r,options:t.optionsList,multi:!1,isSearchable:!0,isLoading:t.isLoading,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isMenuOpen:c,onChange:e=>{var n;const o=null!=(n=null==e?void 0:e.id)?n:null;i(null!=e?e:null),t.onChange(o),u(!1),l(tt(null==e?void 0:e.label,t.question))},titleKey:"description"}),null==(s=t.validation)?void 0:s.message)};at.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool.isRequired};const lt=t=>/*#__PURE__*/e.createElement(e.Fragment,null,t),ct=t=>{var n;/*#__PURE__*/return e.createElement(E,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(h.Label,null,t.label),/*#__PURE__*/e.createElement(Q,{valueKey:t.valueKey,labelKey:t.labelKey,styles:rt(),value:t.optionsList.find(e=>e.id===t.value)||null,options:t.optionsList,multi:!1,isSearchable:!0,isLoading:t.isLoading,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,valueRenderer:!1===t.question[te.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?lt:null,isDisabled:t.isLoading||t.configurationContext.componentsOptions.readOnly||me.isDisabled(t.question),onChange:e=>{t.onChange(e?e.id:null)},titleKey:"description"}),null==(n=t.validation)?void 0:n.message)};at.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object};const ut=t=>{const r=d(),i=s(Oe),a=s(fe),l=ce.getStringHash(me.getPossibleValuesQuery(t.question)),[c,u]=n(!0),[m,p]=n(()=>et(t.options,r)),h=ce.isOptionQuestionFeedbackEnabled(null==a?void 0:a.options);o(()=>{let e=!1;return!t.question[te.HAS_OPTION]&&me.getPossibleValuesQuery(t.question)?async function(){try{const n=await i.loadFormOptions(l,me.getPossibleValuesQuery(t.question));e||(p(et(n,r)),u(!1))}catch(e){pe.error(`Typeahead: options loading failed for query hash ${l}`)}}():(p(et(t.question[te.HAS_OPTION],r)),u(!1)),()=>{e=!0}},[l,i,t.question,r]);const E=ce.findKeyInObjects(m,["name","value"]),g=ce.findKeyInObjects(m,["name","label"]),A=Object.assign({},t,{optionsList:m,valueKey:E,labelKey:g,isLoading:c,configurationContext:a});/*#__PURE__*/return e.createElement(h?at:ct,A)};ut.propTypes={question:U.object.isRequired,answer:U.object.isRequired,label:U.oneOfType([U.string,U.object]).isRequired,value:U.string,onChange:U.func.isRequired,validation:U.object,hintRevealed:U.bool};const dt=({title:t})=>/*#__PURE__*/e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"})),mt=({title:t})=>/*#__PURE__*/e.createElement("svg",{className:"caret-square-down",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 10.547c0.172 0.328 0.141 0.734-0.078 1.031l-5 7c-0.187 0.266-0.484 0.422-0.812 0.422s-0.625-0.156-0.812-0.422l-5-7c-0.219-0.297-0.25-0.703-0.078-1.031 0.172-0.344 0.516-0.547 0.891-0.547h10c0.375 0 0.719 0.203 0.891 0.547zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"})),pt=()=>/*#__PURE__*/e.createElement("svg",{className:"info-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,"info-circle"),/*#__PURE__*/e.createElement("path",{d:"M16 21.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-1.5v-8c0-0.281-0.219-0.5-0.5-0.5h-5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h1.5v5h-1.5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h7c0.281 0 0.5-0.219 0.5-0.5zM14 7.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"})),ht=()=>/*#__PURE__*/e.createElement("svg",{className:"question-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("path",{d:"M14 21.5v-3c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v3c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM18 11c0-2.859-3-5-5.688-5-2.547 0-4.453 1.094-5.797 3.328-0.141 0.219-0.078 0.5 0.125 0.656l2.063 1.563c0.078 0.063 0.187 0.094 0.297 0.094 0.141 0 0.297-0.063 0.391-0.187 0.734-0.938 1.047-1.219 1.344-1.437 0.266-0.187 0.781-0.375 1.344-0.375 1 0 1.922 0.641 1.922 1.328 0 0.812-0.422 1.219-1.375 1.656-1.109 0.5-2.625 1.797-2.625 3.313v0.562c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5v0c0-0.359 0.453-1.125 1.188-1.547 1.188-0.672 2.812-1.578 2.812-3.953zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"})),Et=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("span",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement(_,{overlay:t.show?/*#__PURE__*/e.createElement(T,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||o},/*#__PURE__*/e.createElement("span",null,t.children)))};Et.propTypes={tooltipContent:U.oneOfType([U.object.isRequired,U.string.isRequired]),id:U.string.isRequired,overlayPlacement:U.string,absolutePosition:U.bool,show:U.bool},Et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};const gt=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("div",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement(Et,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o,absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(ht,{className:t.iconClass})))};gt.propTypes={text:U.string.isRequired,iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool},gt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};const At=()=>/*#__PURE__*/e.createElement("svg",{className:"external-link-icon",width:"24",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M5,2 C5.55228,2 6,2.44772 6,3 C6,3.55228 5.55228,4 5,4 L4,4 L4,12 L12,12 L12,11 C12,10.4477 12.4477,10 13,10 C13.5523,10 14,10.4477 14,11 L14,12 C14,13.1046 13.1046,14 12,14 L4,14 C2.89543,14 2,13.1046 2,12 L2,4 C2,2.89543 2.89543,2 4,2 L5,2 Z M15,1 L15,5.99814453 C15,6.55043453 14.5523,6.99814453 14,6.99814453 C13.4477,6.99814453 13,6.55043453 13,5.99814453 L13,4.41419 L8.71571,8.69846 C8.32519,9.08899 7.69202,9.08899 7.3015,8.69846 C6.91097,8.30794 6.91097,7.67477 7.3015,7.28425 L11.5858,3 L9.99619141,3 C9.44391141,3 8.99619141,2.55228 8.99619141,2 C8.99619141,1.44772 9.44391141,1 9.99619141,1 L15,1 Z"})),St=t=>/*#__PURE__*/e.createElement(Et,{tooltipContent:t.url["@id"]||t.url,id:"url-tooltip",overlayPlacement:t.overlayPlacement},/*#__PURE__*/e.createElement("a",{href:t.url["@id"]||t.url,target:"_blank",className:t.iconClassContainer},/*#__PURE__*/e.createElement(At,{className:t.iconClass})));St.propTypes={url:U.oneOfType([U.string.isRequired,U.object.isRequired]),iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool},St.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};const vt=()=>/*#__PURE__*/e.createElement("svg",{className:"question-comment",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",width:"24",height:"28"},/*#__PURE__*/e.createElement("path",{d:"M30,1.5c-16.542,0-30,12.112-30,27c0,5.204,1.646,10.245,4.768,14.604c-0.591,6.537-2.175,11.39-4.475,13.689 c-0.304,0.304-0.38,0.769-0.188,1.153C0.275,58.289,0.625,58.5,1,58.5c0.046,0,0.092-0.003,0.139-0.01 c0.405-0.057,9.813-1.411,16.618-5.339C21.621,54.71,25.737,55.5,30,55.5c16.542,0,30-12.112,30-27S46.542,1.5,30,1.5z M16,32.5 c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S18.206,32.5,16,32.5z M30,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4 S32.206,32.5,30,32.5z M44,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,32.5,44,32.5z"})),ft=()=>/*#__PURE__*/e.createElement("svg",{className:"recycle-bin-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",height:"15px",width:"15px",viewBox:"0 0 512 512"},/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("path",{d:"M331.636,69.818V0H180.364v69.818h-128v128h34.909V512h337.455V197.818h34.909v-128H331.636z M215.273,34.909h81.455\nv34.909h-81.455V34.909z M389.818,477.091H122.182V197.818h267.636V477.091z M424.727,162.909H87.273v-58.182h337.455V162.909z"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"168.727",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"308.364",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"238.545",y:"256",width:"34.909",height:"162.909"})))),_t=t=>{const{options:o}=s(fe),[r,i]=n(!1),[a,l]=n(!1),c=d();W.addLocale(X),W.addLocale(Y),W.setDefaultLocale(te.LANG.en.locale);const u=new W(c.locale),m=()=>{if(o&&o.users&&t.author){const e=o.users.find(e=>e.id===t.author["@id"]);if(e&&e.label)return e.label}return c.formatMessage({id:"comment.unknownAuthor"})},p=()=>{i(!r)};/*#__PURE__*/return e.createElement("div",{className:"comment-content",onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)}},/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col-auto comment-author",onMouseEnter:p,onMouseLeave:p},/*#__PURE__*/e.createElement(e.Fragment,null,r?/*#__PURE__*/e.createElement(e.Fragment,null,m(),/*#__PURE__*/e.createElement(St,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():c.formatMessage({id:"comment.unknownAuthor"})})):m())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},(()=>{const n=Number(t.timestamp),o=isNaN(n)?new Date(t.timestamp):new Date(n);/*#__PURE__*/return e.createElement(Et,{id:"exact-time-overlay",tooltipContent:new Intl.DateTimeFormat(c.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).format(new Date(o))},u.format(o))})()),a?/*#__PURE__*/e.createElement(G.div,{className:"comment-delete emphasise-on-relevant-icon",whileHover:{scale:1.2},whileTap:{scale:.9},onClick:()=>{t.onDeleteQuestionComment(t.index),t.onDeleteViewComment()}},/*#__PURE__*/e.createElement(ft,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};_t.propTypes={author:U.object,timestamp:U.string.isRequired,commentValue:U.string.isRequired,onDeleteQuestionComment:U.func.isRequired,onDeleteViewComment:U.func,index:U.number.isRequired};const Tt=({comments:t,onDeleteCommentClick:s})=>{const i=r(null),[a,l]=n(!1),u=()=>{l(!0),setTimeout(()=>{l(!1)},2e3)};return o(()=>{null!==i.current&&(i.current.scrollTop=i.current.scrollHeight)},[JSON.stringify(t)]),/*#__PURE__*/e.createElement("span",null,a?/*#__PURE__*/e.createElement("div",{className:"comment-delete"},/*#__PURE__*/e.createElement(K,{color:"#00BFFF",height:80,width:80}),/*#__PURE__*/e.createElement("p",null,"Deleting comment...")):/*#__PURE__*/e.createElement("div",{className:"comment-list-items",ref:i},t.map((t,n)=>/*#__PURE__*/e.createElement("div",{key:n,className:"comment-list-item"},/*#__PURE__*/e.createElement(_t,{commentValue:c.getJsonAttValue(t,te.HAS_COMMENT_VALUE),author:t[te.HAS_AUTHOR]?t[te.HAS_AUTHOR]:null,timestamp:c.getJsonAttValue(t,te.HAS_TIMESTAMP),onDeleteQuestionComment:s,onDeleteViewComment:u,index:n})))))},Nt=()=>/*#__PURE__*/e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},/*#__PURE__*/e.createElement("path",{d:"M6.185 4.843l11.927 7.157-11.927 7.157 2.982-7.157-2.982-7.157zm-4.185-4.843l5 12-5 12 20-12-20-12z"})),It="300px",Ot=t=>{const[s,i]=n(""),a=r(null),l=d();o(()=>{a.current.focus()},[]);const c=e=>{e.preventDefault(),t.onChange(s),i("")},u=()=>{const e=a.current;e.style.height="auto",m(e)},m=e=>{e.style.height=`${e.scrollHeight}px`,parseInt(e.style.height)>parseInt(It)&&(e.style.height=It)};/*#__PURE__*/return e.createElement(h,{onSubmit:c,onKeyUp:e=>{"Enter"===e.key&&e.ctrlKey&&s.trim()&&c(e)},onClick:e=>{e.stopPropagation()}},/*#__PURE__*/e.createElement(h.Group,{className:"m-2 position-relative",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(N,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(I,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(h.Control,{className:"comment-form-control",name:"comment",as:"textarea",placeholder:l.formatMessage({id:"comment.form.placeholder"}),required:!0,value:s,onChange:e=>{i(e.target.value)},ref:a,onKeyPress:u,onKeyDown:u}),/*#__PURE__*/e.createElement(f,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(Nt,null)))))))};Ot.propTypes={onChange:U.func.isRequired};const Ct=()=>/*#__PURE__*/e.createElement("svg",{className:"close-icon",width:"24px",height:"24px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"})),bt=t=>{const i=s(fe),a=r(null),l=r(null),c=r(null),[u,d]=n(!1),[m,p]=n("right");o(()=>{_(c.current)});const h=()=>{d(!1)},E=()=>{const e=t.question;return e[te.HAS_COMMENT]||(e[te.HAS_COMMENT]=[]),Array.isArray(e[te.HAS_COMMENT])||(e[te.HAS_COMMENT]=[e[te.HAS_COMMENT]]),e[te.HAS_COMMENT]},g=e=>{const n={};A(n,e),t.onChange(f(),n)},A=(e,t)=>{i.options.currentUser&&(e[te.HAS_AUTHOR]={"@id":i.options.currentUser}),e[te.HAS_COMMENT_VALUE]=t,e[te.HAS_TIMESTAMP]=Date.now().toString()},S=e=>{E().splice(e,1)},v=e=>{e.preventDefault(),e.stopPropagation()},f=()=>E().length,_=e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?p("left"):p("right"))};/*#__PURE__*/return e.createElement("div",{ref:c,onClick:v},/*#__PURE__*/e.createElement("span",{className:"comment-bubble",ref:a,onClick:e=>{v(e),d(!u)}},/*#__PURE__*/e.createElement(vt,null),f()>0?/*#__PURE__*/e.createElement(O,{className:"comment-badge",pill:!0,variant:"primary"},f()):null),/*#__PURE__*/e.createElement(G.div,{className:"overlay-comment",ref:l,drag:!0,dragConstraints:{top:-50,left:-50,right:50,bottom:50}},/*#__PURE__*/e.createElement(C,{target:a.current,show:u,placement:m,rootClose:!1,onHide:h,container:l},t=>/*#__PURE__*/e.createElement(T,$({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:e=>{(e=>{"Escape"===e.key&&h()})(e)}},/*#__PURE__*/e.createElement(G.div,{className:"close-comment-icon",onClick:h,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(Ct,null)),/*#__PURE__*/e.createElement(Tt,{comments:E(),onDeleteCommentClick:S}),/*#__PURE__*/e.createElement(Ot,{onChange:g}))))))};bt.propTypes={question:U.object.isRequired,onChange:U.func.isRequired};const yt="M9 21h6v2H9zm3-21C7.03 0 3 4.03 3 9c0 3.04 1.53 5.73 3.86 7.36.74.52 1.14 1.35 1.14 2.24V19h8v-.4c0-.9.39-1.73 1.14-2.24C19.47 14.73 21 12.04 21 9c0-4.97-4.03-9-9-9z",wt={x1:2,y1:2,x2:21,y2:19,stroke:"#f15050",strokeWidth:3,strokeLinecap:"round"},Rt=()=>/*#__PURE__*/e.createElement("path",{d:yt}),Lt=()=>/*#__PURE__*/e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement("path",{d:yt,opacity:.35}),/*#__PURE__*/e.createElement("line",wt)),Ht=({title:t,enabled:n,className:o})=>/*#__PURE__*/e.createElement("svg",{className:"hint-icon"+(o?` ${o}`:""),xmlns:"http://www.w3.org/2000/svg",width:24,height:28,viewBox:"0 0 24 28","aria-label":t},/*#__PURE__*/e.createElement("title",null,t),/*#__PURE__*/e.createElement(n?Rt:Lt,null)),Dt=t=>{const[o,s]=n("right");/*#__PURE__*/return e.createElement("div",{ref:e=>(e=>{e&&(e.getBoundingClientRect().x>window.innerWidth/2?s("left"):s("right"))})(e)},/*#__PURE__*/e.createElement("span",{onClick:()=>t.onHintClick()},/*#__PURE__*/e.createElement(Et,{id:"hint-icon-tooltip",overlayPlacement:t.overlayPlacement||o,absolutePosition:t.absolutePosition,tooltipContent:t.text||t.revealed?"Hide a hint.":"Reveal a hint."},/*#__PURE__*/e.createElement(Ht,{className:t.iconClass,enabled:!t.revealed}))))};var Vt;Dt.propTypes={text:U.string,iconClassContainer:U.string,iconClass:U.string,overlayPlacement:U.string,absolutePosition:U.bool,onHintClick:U.func,revealed:U.bool},Dt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,revealed:!1};class Mt{static renderIcons(t,n,o,s,r,i,a){let l;l=n.icons?n.icons:te.DEFAULT_OPTIONS.icons;let c=[];const u=this.renderQuestionHelp(t,n,o,s,r),d=this.renderQuestionComments(t,n,o,s,r),m=this.renderQuestionLink(t,n,o,s,r),p=this.renderQuestionHint(t,n,o,s,r,i,a);for(let t=0;t<l.length;t++)l[t].id===te.ICONS.QUESTION_COMMENTS&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},d)),l[t].id===te.ICONS.QUESTION_HELP&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},u)),l[t].id===te.ICONS.QUESTION_LINK&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},m)),l[t].id===te.ICONS.QUESTION_HINT&&c.push(/*#__PURE__*/e.createElement("li",{key:t,className:"icon-list-item"},p));/*#__PURE__*/return e.createElement("ol",{className:"icon-list-items"},c)}static renderQuestionHelp(e,t,n,o,s){return this.getIconComponentFromName(te.ICONS.QUESTION_HELP,e,t,n,o,s)}static renderQuestionLink(e,t,n,o,s){return this.getIconComponentFromName(te.ICONS.QUESTION_LINK,e,t,n,o,s)}static renderQuestionHint(e,t,n,o,s,r,i){return this.getIconComponentFromName(te.ICONS.QUESTION_HINT,e,t,n,o,s,r,i)}static getIconComponentFromName(e,t,n,o,s,r,i,a){const l=this.getIconFromIconList(n.icons?n.icons:te.DEFAULT_OPTIONS.icons,e);return this.getIconComponent(l,t,n,o,s,r,i,a)}static getIconComponent(t,n,o,s,r,i,a,l){let u;if(t&&(t.behavior===te.ICON_BEHAVIOR.ON_HOVER||t.behavior===te.ICON_BEHAVIOR.ENABLE))return t.behavior===te.ICON_BEHAVIOR.ENABLE?(r=!0,u=""):u="emphasise-on-relevant-icon",t.id===te.ICONS.QUESTION_HELP&&n[te.HELP_DESCRIPTION]?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(gt,{text:c.getLocalized(n[te.HELP_DESCRIPTION],i),absolutePosition:!1})):null:t.id===te.ICONS.QUESTION_LINK&&n[te.SOURCE]?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(St,{url:n[te.SOURCE]})):null:t.id===te.ICONS.QUESTION_COMMENTS?r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(bt,{question:n,onChange:s})):null:t.id===te.ICONS.QUESTION_HINT&&o.enableOptionQuestionFeedback?me.isSection(n)||!me.containsHints(n)?null:r?/*#__PURE__*/e.createElement("div",{className:u},/*#__PURE__*/e.createElement(Dt,{absolutePosition:!1,onHintClick:l,revealed:a})):null:null}}Vt=Mt,Mt.renderQuestionComments=(e,t,n,o,s)=>Vt.getIconComponentFromName(te.ICONS.QUESTION_COMMENTS,e,t,n,o,s),Mt.getIconFromIconList=(e,t)=>e?e.find(e=>e.id===t):null;const Ut=t=>{const s=e.useContext(Oe),{options:r}=e.useContext(fe),[i,a]=n({severity:"",classname:"",message:null}),l=d();o(()=>{p()},[t.question]);const u=e=>{const n=Object.assign({},t.answer);m(n,e),t.onChange(t.index,n)},m=(e,n)=>{null===n?(e[te.HAS_OBJECT_VALUE]=null,e[te.HAS_DATA_VALUE]=null):t.answer[te.HAS_OBJECT_VALUE]||me.isTypeahead(t.question)?e[te.HAS_OBJECT_VALUE]={"@id":n}:e[te.HAS_DATA_VALUE]={"@value":n}},p=()=>{a({severity:"",classname:"",message:null}),!1===h[te.HAS_VALID_ANSWER]&&a(h[te.HAS_VALIDATION_SEVERITY]===te.VALIDATION.SEVERITY.WARNING?{severity:te.VALIDATION.SEVERITY.WARNING,classname:te.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(b,{className:te.VALIDATION.CLASSNAME.WARNING},h[te.HAS_VALIDATION_MESSAGE])}:{severity:te.VALIDATION.SEVERITY.ERROR,classname:te.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(b,{className:te.VALIDATION.CLASSNAME.ERROR},h[te.HAS_VALIDATION_MESSAGE])})},h=t.question,E=me.resolveValue(t.answer),g=(n=>{const o=c.getLocalized(n[te.RDFS_LABEL],l);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,Mt.renderIcons(t.question,r,t.onCommentChange,t.showIcon,l,t.hintRevealed,t.onHintReveal))})(h),A=c.getLocalized(h[te.RDFS_COMMENT],l);let S;var v;return S=me.isTypeahead(h)?((n,o,r)=>{const a=ce.getStringHash(me.getPossibleValuesQuery(t.question)),l=s.getOptions(a)||[];/*#__PURE__*/return e.createElement(ut,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:u,options:l,validation:i,hintRevealed:t.hintRevealed,onHintReveal:t.onHintReveal})})(E,g,A):(v=h)[te.HAS_OPTION]&&0!==v[te.HAS_OPTION].length?((n,o,s)=>/*#__PURE__*/e.createElement(Ze,{question:t.question,label:o,title:s,value:n,onChange:u,validation:i,hintRevealed:t.hintRevealed,onHintReveal:t.onHintReveal}))(E,g,A):me.isCalendar(h)?((n,o,s)=>/*#__PURE__*/e.createElement(De,{question:t.question,value:n,title:s,label:o,onChange:u,validation:i}))(E,g,A):me.isCheckbox(h)?((n,o,s)=>/*#__PURE__*/e.createElement(He,{label:o,title:s,value:n,onChange:u,question:t.question,validation:i}))(E,g,A):me.isMaskedInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Qe,{label:o,title:s,value:n,onChange:u,question:t.question,answer:t.answer,validation:i}))(E,g,A):me.isSparqlInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,sparql:!0,validation:i}))(E,g,A):me.isTurtleInput(h)?((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,turtle:!0,validation:i}))(E,g,A):((n,o,s)=>/*#__PURE__*/e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:s,value:n,onChange:u,validation:i}))(E,g,A),S};Ut.propTypes={answer:U.object.isRequired,question:U.object.isRequired,onChange:U.func.isRequired,onCommentChange:U.func.isRequired,index:U.number,icons:U.object,hintRevealed:U.bool,onHintReveal:U.func};const xt=(e,t)=>{const n=[Qt,jt,qt,Ft,kt,zt];return()=>{if(me.hasValidationLogic(e,t)){const o=me.getAnswerValue(e);return Pt(e,t,o,n)}}},Pt=(e,t,n,o)=>{const s={};for(const n of o){const o=n(e,t);if(!o.isValid)return s[te.HAS_VALID_ANSWER]=!1,s[te.HAS_VALIDATION_MESSAGE]=o.message,s[te.HAS_VALIDATION_SEVERITY]=o.validationSeverity,s;if(!1===s[te.HAS_VALID_ANSWER])break}return s[te.HAS_VALID_ANSWER]=!0,s[te.HAS_VALIDATION_MESSAGE]="",s[te.HAS_VALIDATION_SEVERITY]="",s},qt=(e,t)=>{const n=me.getAnswerValue(e);return n&&n.length>0&&e[te.PATTERN]&&!new RegExp(e[te.PATTERN]).test(n)&&me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},kt=(e,t)=>!e[te.REQUIRES_ANSWER]||e[te.USED_ONLY_FOR_COMPLETENESS]||me.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})},Ft=(e,t)=>me.isCheckbox(e)&&e[te.REQUIRES_ANSWER]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0},zt=(e,t)=>e[te.REQUIRES_ANSWER]&&e[te.USED_ONLY_FOR_COMPLETENESS]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.WARNING,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0},jt=(e,t)=>{if(e[te.XSD.MIN_INCLUSIVE]){const n=me.getAnswerValue(e);if(n&&n.length>0){const o=e[te.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},Qt=(e,t)=>{const n=me.getAnswerValue(e);if(e[te.XSD.MAX_INCLUSIVE]&&n&&n.length>0){const o=e[te.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:te.VALIDATION.SEVERITY.ERROR,message:e[te.HAS_VALIDATION_MESSAGE]?e[te.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}};class Bt extends e.Component{constructor(e){super(e),this.state={prefixes:e.prefixes}}render(){const t=/*#__PURE__*/e.createElement(y,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(w,null,this.state.prefixes.sort((e,t)=>e[te.PREFIX]<t[te.PREFIX]?-1:1).map(t=>/*#__PURE__*/e.createElement(R,{key:t[te.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[te.PREFIX]),": ",t[te.NAMESPACE]))));/*#__PURE__*/return e.createElement(_,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))}}Bt.propTypes={prefixes:U.array.isRequired,children:U.element.isRequired,iconClass:U.string},Bt.defaultProps={iconClass:""};class Wt{static getMediaKindFromSource(e){if(!e)return;const t=e.toLowerCase();return t.includes("m3u8")?{kind:"video",type:"application/x-mpegURL"}:t.includes("mp4")?{kind:"video",type:"video/mp4"}:t.includes("webm")?{kind:"video",type:"video/webm"}:t.includes("mov")?{kind:"video",type:"video/quicktime"}:/\b(png|jpg|jpeg|webp|gif|bmp)\b/.test(t)?{kind:"image",type:null}:{kind:"iframe",type:null}}static getMediaKindFromId(e){if(!e||"string"!=typeof e)return null;const t=e.toLowerCase();return/\/video\//.test(t)?{kind:"video",type:null}:/\/image\//.test(t)?{kind:"image",type:null}:null}static getMediaKind(e,t){var n;const o=Wt.getMediaKindFromSource(e);return o&&"iframe"!==o.kind?o:null!=(n=Wt.getMediaKindFromId(t))?n:o}static getMediaKindFromContentType(e){if(!e)return null;const t=e.toLowerCase();return t.includes("mpegurl")?{kind:"video",type:"application/x-mpegURL"}:t.startsWith("image/")?{kind:"image",type:null}:t.startsWith("video/")?{kind:"video",type:t.split(";")[0].trim()}:null}static async probeContentType(e){try{const t=await fetch(e,{method:"HEAD",credentials:"include"});return t.ok?t.headers.get("Content-Type"):null}catch(e){return null}}static probeIsImage(e){return new Promise(t=>{if("undefined"==typeof Image)return void t(!1);const n=new Image;n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e})}static async resolveMediaKind(e,t){const n=Wt.getMediaKind(e,t);if(n&&"video"===n.kind&&!n.type){var o;const t=Wt.getMediaKindFromContentType(await Wt.probeContentType(e));return{kind:"video",type:null!=(o=null==t?void 0:t.type)?o:"video/mp4"}}return n&&"iframe"!==n.kind?n:Wt.getMediaKindFromContentType(await Wt.probeContentType(e))||(await Wt.probeIsImage(e)?{kind:"image",type:null}:n)}static denormalizePointsFromStringToString(e,t,n){return e.trim().split(/\s+/).map(e=>{const[o,s]=e.split(",").map(Number);return`${o*t},${s*n}`}).join(" ")}static getArrayPointsFromString(e){return e.trim().split(/\s+/).map(e=>e.split(",").map(Number))}static stripExpandedLiterals(e){if(Array.isArray(e))return e.map(Wt.stripExpandedLiterals);if(e&&"object"==typeof e){if(Object.prototype.hasOwnProperty.call(e,"@value")&&Object.keys(e).length<=2)return Wt.castLiteral(e["@value"],e["@type"]);const t={};for(const n in e)t[n]=Wt.stripExpandedLiterals(e[n]);return t}return e}static castLiteral(e,t){return t?t.includes("#decimal")?parseFloat(e):t.includes("#integer")?parseInt(e,10):t.includes("#boolean")?!0===e||"true"===e:e:e}static normalizeMediaContents(e,t){return e?(Array.isArray(e)?e:[e]).map(e=>"string"==typeof e?{[t]:e}:e):[]}}const Yt="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",Xt=`<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="${Yt}"/></svg>`,Gt=t=>/*#__PURE__*/e.createElement("svg",$({viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true"},t),/*#__PURE__*/e.createElement("path",{d:Yt})),Kt=({type:e,containerRef:t})=>{const s=(e=>{const[t,s]=n(null);return o(()=>{const t=null==e?void 0:e.current;if(!t)return;const n=t.querySelector("img");if(!n)return;const o=()=>s((e=>{const t=null==e?void 0:e.current;if(!t)return null;const n=t.querySelector("img");if(!n)return null;const o=t.getBoundingClientRect();return{width:o.width,height:o.height,intrinsicWidth:n.naturalWidth||o.width,intrinsicHeight:n.naturalHeight||o.height,top:0,left:0}})(e));return n.complete?o():n.addEventListener("load",o),window.addEventListener("resize",o),()=>{n.removeEventListener("load",o),window.removeEventListener("resize",o)}},[e]),t})("image"===e?t:null),r=(e=>{const[t,s]=n(null);return o(()=>{const t=null==e?void 0:e.current;if(!t)return;const n=()=>s((e=>{const t=e.videoWidth(),n=e.videoHeight();if(!t||!n)return null;const o=e.el(),s=o.clientWidth,r=o.clientHeight,i=t/n;let a,l,c,u;return s/r>i?(l=r,a=l*i,u=(s-a)/2,c=0):(a=s,l=a/i,c=(r-l)/2,u=0),{width:a,height:l,intrinsicWidth:t,intrinsicHeight:n,top:c,left:u}})(t));return t.on("loadedmetadata",n),t.on("resize",n),t.on("fullscreenchange",n),window.addEventListener("resize",n),()=>{t.off("loadedmetadata",n),t.off("resize",n),t.off("fullscreenchange",n),window.removeEventListener("resize",n)}},[e]),t})("video"===e?t:null);return"image"===e?s:"video"===e?r:null},Jt={[te.POLYLINE_ANNOTATION.IMPLICIT_TYPE_LABEL]:(e,t,n,o)=>{var s,r,i;const a=te.POLYLINE_ANNOTATION.DEFAULT_POLYLINE_ANNOTATION_STYLE;return Object.assign({},o,{geometry:{points:Wt.denormalizePointsFromStringToString(e[te.ANNOTATION.HAS_GEOMETRY_POINTS],t,n)},style:{stroke:null!=(s=e[te.ANNOTATION.HAS_COLOR])?s:a.color,strokeWidth:(null!=(r=e[te.POLYLINE_ANNOTATION.HAS_STROKE_WIDTH])?r:a.strokeWidth)*t,fill:null!=(i=e[te.POLYLINE_ANNOTATION.HAS_FILL_COLOR])?i:a.fillColor}})},[te.TEXT_ANNOTATION.IMPLICIT_TYPE_LABEL]:(e,t,n,o)=>{var s,r,i,a;const l=e[te.ANNOTATION.HAS_GEOMETRY_POINTS],c=te.TEXT_ANNOTATION.DEFAULT_TEXT_ANNOTATION_STYLE,[[u,d]]=Wt.getArrayPointsFromString(l);return Object.assign({},o,{geometry:{x:u*t,y:d*n},style:{fontSize:(null!=(s=e[te.TEXT_ANNOTATION.HAS_FONT_SIZE])?s:c.fontSizeInNormalizedPx)*n,fontWeight:null!=(r=e[te.TEXT_ANNOTATION.HAS_FONT_WEIGHT])?r:c.fontWeight,fontFamily:c.fontFamily,color:null!=(i=e[te.ANNOTATION.HAS_COLOR])?i:c.color},payload:{text:null!=(a=e[te.TEXT_ANNOTATION.HAS_TEXT])?a:c.text}})}},$t={polyline:({points:t,stroke:n,strokeWidth:o,fill:s,opacity:r})=>/*#__PURE__*/e.createElement("polyline",{points:t,stroke:n,strokeWidth:o,fill:s,opacity:r}),text:({text:t,fontFamily:n="Arial",fontWeight:o=400,opacity:s=1,fontSize:r,x:i,y:a,color:l="#00ff00",lineHeight:c=1.15})=>{const u=(null!=t?t:"").split(/\r?\n/),d=r*c,m=a-.2*r;/*#__PURE__*/return e.createElement("text",{fill:l,fontSize:`${r}px`,fontFamily:n,fontWeight:o,textAnchor:"start",opacity:s},u.map((t,n)=>/*#__PURE__*/e.createElement("tspan",{key:n,x:i,y:m+n*d,dominantBaseline:"hanging"},t||" ")))}},Zt=({annotations:s=[],surface:r,currentTime:i,showAnnotations:a})=>{const l=null==r?void 0:r.intrinsicWidth,c=null==r?void 0:r.intrinsicHeight,[u,d]=n("");o(()=>{if(!a)return;d("annotation-overlay-revealed");const e=setTimeout(()=>d(""),700);return()=>clearTimeout(e)},[a]);const m=(({annotations:e=[],width:n,height:o,currentTime:s})=>t(()=>n&&o&&e.length?e.filter(e=>((e,t)=>{if(null==t)return!0;const n=e[te.ANNOTATION.HAS_START_TIME],o=e[te.ANNOTATION.HAS_END_TIME];return!(null!=n&&t<n||null!=o&&t>o)})(e,s)).map(e=>((e,t,n)=>{const o=Jt[e[te.ANNOTATION.HAS_ANNOTATION_TYPE]];if(!o)return null;const s=(e=>{var t;const n=e[te.ANNOTATION.HAS_ANNOTATION_TYPE],o=e[te.ANNOTATION.HAS_OPACITY];return{id:null!=(t=e.id)?t:`uuid-${Date.now()}-${Math.random().toString(16).slice(2)}`,type:n,opacity:null!=o?o:1}})(e);return o(e,t,n,s)})(e,n,o)).filter(Boolean):[],[e,n,o,s]))({annotations:s,width:l,height:c,currentTime:i}),p=t(()=>`0 0 ${l} ${c}`,[l,c]);return l&&c&&m.length?a?/*#__PURE__*/e.createElement("svg",{viewBox:p,className:`annotation-overlay ${u}`},m.map(t=>{const n=$t[t.type];return n?/*#__PURE__*/e.createElement(n,$({key:t.id},t.geometry,t.style,t.payload,{opacity:t.opacity})):null})):/*#__PURE__*/e.createElement(e.Fragment,null):null},en=/*#__PURE__*/a(({children:t,fullscreen:n=!1},o)=>/*#__PURE__*/e.createElement("div",{ref:o,className:"media-container "+(n?"fullscreen":"")},t)),tn={video:({type:s,src:i,autoplay:a=!1,muted:l=!0,controls:c=!0,responsive:u=!0,aspectRatio:d="16:9",annotations:m=[],showAnnotations:p,onFullScreen:h})=>{const E=r(null),[g,A]=n(0),S=(({videoRef:e,options:t,onReady:n,onFullScreen:s,onTimeUpdate:i,showAnnotations:a,annotations:l=[]})=>{const c=r(null);return o(()=>{const e=c.current;if(!e||!a)return;const t=l.reduce((e,t)=>{const n=t[te.ANNOTATION.HAS_START_TIME];return null!=n&&(null==e||n<e.startTime)?{annotation:t,startTime:n}:e},null);t&&(e.currentTime(t.startTime),e.pause())},[a]),o(()=>{if(!e.current)return;const o=J(e.current,t,function(){((e,t)=>{const{onFullScreen:n}=t;n&&((e,t)=>{var n;const o=e.controlBar,s=null!=(n=o.getChild("remainingTimeDisplay"))?n:o.getChild("fullscreenToggle"),r=s?o.children().indexOf(s):o.children().length,i=o.addChild("button",{},r+1).el();i.innerHTML=Xt,i.setAttribute("aria-label","Fullscreen"),i.onclick=()=>t(e)})(e,n)})(o,{onFullScreen:s}),null==n||n(o)});return c.current=o,i&&o.on("timeupdate",()=>i(o.currentTime())),()=>{o&&!o.isDisposed()&&o.dispose()}},[e,t,n,s,i]),c})({videoRef:E,options:t(()=>({autoplay:a,muted:l,controls:c,responsive:u,aspectRatio:d,controlBar:{fullscreenToggle:!1,pictureInPictureToggle:!1},userActions:{doubleClick:!1},sources:[{src:i,type:s}]}),[a,l,c,u,d,i,s]),onFullScreen:h,onTimeUpdate:A,annotations:m,showAnnotations:p}),v=Kt({type:"video",containerRef:S});/*#__PURE__*/return e.createElement("div",{className:"video-wrapper",style:{position:"relative"}},/*#__PURE__*/e.createElement("video",{ref:E,className:"video-js vjs-big-play-centered"}),v&&/*#__PURE__*/e.createElement(Zt,{annotations:m,showAnnotations:p,surface:v,currentTime:g}))},image:({src:t,annotations:n,onFullScreen:o,showAnnotations:s})=>{const i=r(null),a=Kt({type:"image",containerRef:i});/*#__PURE__*/return e.createElement("div",{className:"media-image-container"},/*#__PURE__*/e.createElement("div",{ref:i,className:"media-image-wrapper"},/*#__PURE__*/e.createElement("img",{src:t,alt:"Beautiful Image"}),/*#__PURE__*/e.createElement(Zt,{annotations:n,showAnnotations:s,surface:a,currentTime:null})),/*#__PURE__*/e.createElement("button",{className:"media-fullscreen-button",onClick:o,"aria-label":"Fullscreen"},/*#__PURE__*/e.createElement(Gt,null)))}},nn=e=>e&&"iframe"!==e.kind&&!("video"===e.kind&&!e.type),on=({src:t,allowFullScreen:n})=>/*#__PURE__*/e.createElement("div",{className:"media-iframe-container"},/*#__PURE__*/e.createElement("div",{className:"media-iframe-wrapper"},/*#__PURE__*/e.createElement("iframe",{src:t,title:"Embedded content",allowFullScreen:n}))),sn=({src:t,mediaId:s,annotations:a=[],allowFullScreen:l,showAnnotations:c=!0})=>{const u=r(null),{isFullscreen:d,toggle:m}=(e=>{const[t,s]=n(!1);return o(()=>{const e=()=>s(Boolean(document.fullscreenElement));return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),{isFullscreen:t,toggle:i(()=>{e.current&&(document.fullscreenElement?document.exitFullscreen():e.current.requestFullscreen())},[e])}})(u),[p,h]=n(()=>{const e=Wt.getMediaKind(t,s);return nn(e)?e:null});if(o(()=>{let e=!1;const n=Wt.getMediaKind(t,s);if(!nn(n))return h(null),Wt.resolveMediaKind(t,s).then(t=>{e||h(null!=t?t:{kind:"iframe",type:null})}),()=>{e=!0};h(n)},[t,s]),!t)return null;const E=p?tn[p.kind]||on:null;/*#__PURE__*/return e.createElement(en,{ref:u,fullscreen:d},E&&/*#__PURE__*/e.createElement(E,{src:t,type:p.type,annotations:a,allowFullScreen:l,onFullScreen:m,showAnnotations:c}))},rn=({question:t,displayAnnotations:n})=>{const o=Wt.stripExpandedLiterals(t),s=Wt.normalizeMediaContents(o[te.HAS_MEDIA_CONTENT],te.HAS_SOURCE);return s.length>0?/*#__PURE__*/e.createElement("div",{className:"col-6 "},s.map((t,o)=>{var s;/*#__PURE__*/return e.createElement("div",{key:o,className:"embed-responsive-21by9 media-content-video-container mb-3"},/*#__PURE__*/e.createElement(sn,{src:t[te.HAS_SOURCE],mediaId:t["@id"],allowFullScreen:!0,annotations:null!=(s=t[te.HAS_ANNOTATION])?s:[],showAnnotations:n}))})):/*#__PURE__*/e.createElement(e.Fragment,null)};class an extends e.Component{constructor(e){super(e),this.handleHintReveal=e=>{this.setState(e&&"boolean"==typeof e?{hintRevealed:e}:{hintRevealed:!this.state.hintRevealed})},this.handleAnswerChange=(e,t)=>{if(me.isSection(this.props.question)){let e=!!me.resolveValue(t);this.setState({expanded:e})}this._handleChange(te.HAS_ANSWER,e,t)},this.handleSubQuestionChange=(e,t)=>{this._handleChange(te.HAS_SUBQUESTION,e,t)},this.handleCommentChange=(e,t)=>{this._handleChange(te.HAS_COMMENT,e,t)},this._toggleCollapse=()=>{this.props.collapsible&&this.setState({expanded:!this.state.expanded})},this._onEnterHandler=()=>{this.setState({showIcon:!0})},this._onLeaveHandler=()=>{this.setState({showIcon:!1})},this._getHeaderClassName=()=>{const e=this.props.question,t=this.props.collapsible;let n=[];return n.push(an.getEmphasizedOnRelevantClass(e),"question-header"),me.isWizardStep(e)&&n.push("wizard-step bg-primary text-white"),me.isEmphasised(e)&&n.push(an.getEmphasizedClass(e)),me.isSection(e)&&n.push("section-background"),t&&n.push("cursor-pointer"),this.isDebugged(e)&&n.push("show-irrelevant"),n},ue.putObject(e.question["@id"],e.question),this.state={validator:{},expanded:!me.isCollapsed(e.question),showIcon:!1,hintRevealed:!1}}componentDidMount(){this.setState({validator:xt(this.props.question,this.props.intl)})}componentDidUpdate(){const e=this.props.question,t=this.context.options.startingQuestionId,n=e[te.HAS_SUBQUESTION].find(e=>e["@id"]===t);if(me.isSection(e)&&me.isAnswerable(e)){const e=this._getFirstAnswerValue();if(this.context.options.debugMode)return null;if(n)return null;this.state.expanded&&!e&&this.setState({expanded:!1})}}_handleChange(e,t,n){let o=Object.assign({},this.props.question);if(o[e][t]=n,e===te.HAS_ANSWER){const e=this.state.validator(n);o=Object.assign({},o,e)}ue.putObject(o["@id"],o),this.props.onChange(this.props.index,o)}isDebugged(e){const t=this.context.options.startingQuestionId;return!me.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!ce.findQuestionById(t,e,!0,!1,!1))}render(){const t=this.props.question,n=this.renderQuestion(t);return this.isDebugged(t)?/*#__PURE__*/e.createElement("div",{className:"show-irrelevant"},n):me.isHidden(t)?null:me.isRelevant(t)?n:null}renderQuestion(t){if(me.isAnswerable(t)&&!me.isSection(t))/*#__PURE__*/return e.createElement("div",{id:t["@id"]},/*#__PURE__*/e.createElement("div",{className:"panel-title answerable-question"},this.renderAnswers()),/*#__PURE__*/e.createElement("div",{className:"answerable-subquestions"},this.renderSubQuestions()));if(me.isAnswerable(t))return this.renderAnswerableSection();if(me.isSection(t)){const{collapsible:n,withoutCard:o}=this.props,s=an._getQuestionCategoryClass(t);if(o)/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent());const r=c.getLocalized(t[c.RDFS_LABEL],this.props.intl),i=/*#__PURE__*/e.createElement(v.Body,{className:F("p-3",s)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(S,{activeKey:this.state.expanded?r:void 0,className:"mb-3"},/*#__PURE__*/e.createElement(S.Item,{eventKey:r},/*#__PURE__*/e.createElement(v,{className:""},/*#__PURE__*/e.createElement(S.Button,{as:v.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"d-inline",id:t["@id"]},n&&!me.isWizardStep(t)&&this._renderCollapseToggle(),r),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(S.Body,{className:"p-0"},n?i:/*#__PURE__*/e.createElement(e.Fragment,null,i))))))}/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent())}_renderQuestionContent(){let t=[];return this.state.expanded&&t.push(/*#__PURE__*/e.createElement(rn,{key:this.props.question["@id"]+"-media",question:this.props.question,displayAnnotations:this.state.hintRevealed})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t}renderQuestionIcons(){return Mt.renderIcons(this.props.question,this.context.options,this.handleCommentChange,this.state.showIcon,this.props.intl,this.state.hintRevealed,this.handleHintReveal)}renderAnswerableSection(){const t=this.props.question,n=this.props.collapsible,o=an._getQuestionCategoryClass(t);let s=this.getShowIrrelevantClassname(t);const r=/*#__PURE__*/e.createElement(v.Body,{className:F("p-3",o)},this.renderSubQuestions(s)),i=this._getHeaderClassName();return this.state.expanded&&i.push("text-primary"),/*#__PURE__*/e.createElement(S,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(v,{className:"mb-3"},/*#__PURE__*/e.createElement(v.Header,{onClick:this._toggleCollapse,className:i},this.renderAnswers()),n?/*#__PURE__*/e.createElement(S.Collapse,{className:s,eventKey:t["@id"]},r):{cardBody:r}))}getShowIrrelevantClassname(e){return!this.context.options.debugMode&&!de.checkId(e[te.HAS_SUBQUESTION],this.context.options.startingQuestionId)||me.hasAnswer(e)?"":"show-irrelevant"}renderAnswers(){const t=this.props.question,n=[],o=this._getAnswers();let s;for(let r=0,i=o.length;r<i;r++)me.isTextarea(t,me.resolveValue(o[r]))||me.isSparqlInput(t)||me.isTurtleInput(t),s=F("answer",an._getQuestionCategoryClass(t),an.getEmphasizedOnRelevantClass(t)),n.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+r,className:s,id:t["@id"],onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,"data-question-origin":Ee._getId(t[te.HAS_QUESTION_ORIGIN]),onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(Ut,{index:r,answer:o[r],question:t,onChange:this.handleAnswerChange,onCommentChange:this.handleCommentChange,showIcon:this.state.showIcon,hintRevealed:this.state.hintRevealed,onHintReveal:this.handleHintReveal})),this._renderUnits(),this._renderPrefixes()));return n}_getAnswers(){const e=this.props.question;return e[te.HAS_ANSWER]||(e[te.HAS_ANSWER]=[]),Array.isArray(e[te.HAS_ANSWER])||(e[te.HAS_ANSWER]=[e[te.HAS_ANSWER]]),0===e[te.HAS_ANSWER].length&&(e[te.HAS_ANSWER]=me.isSection(e)&&!me.isAnswerable(e)?[]:[Le.generateAnswer(e)]),e[te.HAS_ANSWER]}_getAnswerWidthStyle(){const e=Number(this.props.question[te.HAS_INITIAL_INPUT_LENGTH]);return e?{flexGrow:0,maxWidth:"none",width:`calc(${e}ch + 1.5rem + 2px)`}:{}}static _getAnswerClass(e,t){return t?"col-12":1===te.GENERATED_ROW_SIZE?"col-6":"col-"+te.COLUMN_COUNT/te.GENERATED_ROW_SIZE}static _getQuestionCategoryClass(e){const t=me.getCategory(e);return t?"question-"+t:""}static getEmphasizedClass(e){return me.isEmphasised(e)?"bg-warning":""}static getEmphasizedOnRelevantClass(e){return c.hasValue(e,te.LAYOUT_CLASS,te.LAYOUT.EMPHASISE_ON_RELEVANT)?"emphasise-on-relevant":""}_renderCollapseToggle(){const t=this.props.intl.formatMessage(this.state.expanded?{id:"section.collapse"}:{id:"section.expand"});/*#__PURE__*/return e.createElement("span",{onClick:this._toggleCollapse,title:t},/*#__PURE__*/e.createElement(this.state.expanded?dt:mt,{title:t}))}_renderPrefixes(){const t=this.props.question;return t[te.HAS_DECLARED_PREFIX]&&t[te.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(Bt,{prefixes:t[te.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(pt,null)):null}_renderUnits(){const t=this.props.question;return t[te.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[te.HAS_UNIT]):null}renderSubQuestions(t){const n=[],o=this._getSubQuestions(),s=this.context.options.debugMode,r=this.context.options.startingQuestionId;for(let i=0;i<o.length;i++){let a=o[i],l=this.context.mapComponent(a,an),c=null;(s||"show-irrelevant"!==t||ce.findQuestionById(r,a,!0,!1,!1))&&(c=/*#__PURE__*/e.createElement(l,{key:"sub-question-"+i,question:a,onChange:this.handleSubQuestionChange,index:i,intl:this.props.intl})),n.push(c)}return n}_getSubQuestions(){const e=this.props.question;return e[te.HAS_SUBQUESTION]||(e[te.HAS_SUBQUESTION]=[]),Array.isArray(e[te.HAS_SUBQUESTION])||(e[te.HAS_SUBQUESTION]=[e[te.HAS_SUBQUESTION]]),de.orderByLocalizedLabels(e[te.HAS_SUBQUESTION],this.props.intl),de.orderPreservingToplogicalSort(e[te.HAS_SUBQUESTION],te.HAS_PRECEDING_QUESTION),e[te.HAS_SUBQUESTION]}_getFirstAnswerValue(){return me.resolveValue(this._getAnswers()[0])}}an.contextType=fe,an.propTypes={question:U.object.isRequired,onChange:U.func.isRequired,index:U.number,withoutCard:U.bool,collapsible:U.bool},an.defaultProps={withoutCard:!1,collapsible:!0};const ln=t=>{const{updateFormQuestionsData:n,getFormQuestionsData:o}=s(we),r=d(),i=o([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(an,{question:i,onChange:(e,o)=>{n(t.index||e,Object.assign({},t.question,o))},collapsible:me.isAnswerable(i),intl:r}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(L,{className:"m-3 float-end"},!t.isFirstStep&&/*#__PURE__*/e.createElement(f,{className:"me-2",onClick:()=>{t.onPreviousStep()},variant:"primary",size:"sm"},r.formatMessage({id:"wizard.previous"})),!t.isLastStep&&/*#__PURE__*/e.createElement(f,{onClick:()=>{n(t.index,o()),t.onNextStep()},variant:"primary",size:"sm"},r.formatMessage({id:"wizard.next"}))))};ln.propTypes={options:U.object.isRequired,question:U.object.isRequired,index:U.number.isRequired,onNextStep:U.func,onPreviousStep:U.func,mapComponent:U.func,isFirstStep:U.bool,isLastStep:U.bool};const cn=({steps:t,onNavigate:n,currentStep:o})=>{const{options:r}=s(fe),i=d();/*#__PURE__*/return e.createElement(v.Header,null,/*#__PURE__*/e.createElement(H,{variant:"tabs",activeKey:o,onSelect:e=>n(parseInt(e))},t.map((t,n)=>/*#__PURE__*/e.createElement(Et,{id:"step-disabled",tooltipContent:i.formatMessage({id:"wizard.nav.tooltip"}),show:!r.enableWizardStepSkip},/*#__PURE__*/e.createElement(D,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(V,{eventKey:n,active:n===o?"active":"",hidden:!r.debugMode&&!me.isRelevant(t),disabled:!r.enableWizardStepSkip,className:F([r.debugMode&&!me.isRelevant(t)?"show-irrelevant":an.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],i)))))))};cn.propTypes={currentStep:U.number.isRequired,steps:U.array.isRequired,onNavigate:U.func.isRequired};const un=({steps:t,onNavigate:n,currentStep:o})=>{const{options:r}=s(fe),i=d();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(w,null,t.map((t,s)=>/*#__PURE__*/e.createElement(Et,{id:"step-disabled",tooltipContent:i.formatMessage({id:"wizard.nav.tooltip"}),show:!r.enableWizardStepSkip},/*#__PURE__*/e.createElement(R,{hidden:!r.debugMode&&!me.isRelevant(t),key:"nav"+s,onClick:()=>n(s),id:"wizard-nav-"+s,action:!0,active:s===o?"active":"",disabled:!r.enableWizardStepSkip,variant:"default",className:F([r.debugMode&&!me.isRelevant(t)?"show-irrelevant":an.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],d()))))))};function dn({id:e,dataAttributes:t=[],scrollOptions:n={behavior:"smooth"},highlightClass:s="text-danger"}){o(()=>{let o=null;if(e&&(o=document.getElementById(e)),!o&&Object.keys(t).length>0){const e=Object.entries(t).map(([e,t])=>`[data-${e}="${t}"]`).join("");o=document.querySelector(e)}o&&(o.scrollIntoView(n),s&&o.classList.add(s))},[e,t,n,s])}un.propTypes={currentStep:U.number.isRequired,steps:U.array.isRequired,onNavigate:U.func.isRequired};const mn=(e,t,n)=>{console.log(n,e,t);const o=(n,s)=>n?Ee._getId(n[e])===t?s:ce.asArray(n[te.HAS_SUBQUESTION]).findIndex((e,t)=>-1!==o(e,t)):-1;return n.findIndex((e,t)=>-1!==o(e,t))},pn=()=>{const t=e.useContext(we),{options:n,mapComponent:o}=e.useContext(fe);let s=0;n.startingQuestionId?(s=mn("@id",n.startingQuestionId,t.getFormQuestionsData()),-1===s&&(console.warn(`Question with id ${n.startingQuestionId} not found!`),s=0)):n.startingQuestionOrigin?(s=mn(te.HAS_QUESTION_ORIGIN,n.startingQuestionOrigin,t.getFormQuestionsData()),-1===s&&(console.warn(`Question with question origin ${n.startingQuestionOrigin} not found!`),s=0)):n.startingStep&&(s=n.startingStep<t.getFormQuestionsData().length?n.startingStep:0);const[r,i]=e.useState(s);dn({id:n.startingQuestionId,dataAttributes:{"question-origin":[n.startingQuestionOrigin]}});const a=()=>{const e=t.getFormQuestionsData();r!==e.length-1&&(e[r+1].visited=!0,i(e=>e+1))},l=()=>{0!==r&&i(e=>e-1)},c=e=>{const o=t.getFormQuestionsData();e===r||e>=o.length||e>r&&!o[e].visited&&!n.enableWizardStepSkip||i(e)};let u=null;t.getFormQuestionsData().length>1&&(u=(()=>{const o=t.getFormQuestionsData();/*#__PURE__*/return e.createElement(n.horizontalWizardNav?cn:un,{currentStep:r,steps:o,onNavigate:c})})());const d=n.horizontalWizardNav;/*#__PURE__*/return e.createElement(v,{className:d?"":"flex-row p-3"},u,/*#__PURE__*/e.createElement("div",{className:d?"card-body p-3":u?"col-10 p-0 pl-3":"col-12 p-0"},(()=>{const s=t.getFormQuestionsData()[r];let i=o(s,ln);/*#__PURE__*/return e.createElement(i,{options:n,key:"step"+r,question:s,onNextStep:a,onPreviousStep:l,mapComponent:o,index:r,isFirstStep:0===r,isLastStep:r===t.getFormQuestionsData().length-1})})()))},hn=/*#__PURE__*/e.forwardRef((t,n)=>{const{options:o}=e.useContext(fe);/*#__PURE__*/return e.createElement(M,$({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(M.Header,{closeButton:!0},/*#__PURE__*/e.createElement(M.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(M.Body,{className:"overflow-hidden p-0"},t.children))});var En;hn.propTypes={children:U.element.isRequired};class gn{}En=gn,gn.updateQuestionValidation=(e,t,n,o)=>{const s=xt(t,o)();s&&(e[n]=Object.assign({},t,s));for(const t of e)En.updateSubQuestionsValidation(t,o)},gn.updateSubQuestionsValidation=(e,t)=>{const n=ce.asArray(e[te.HAS_SUBQUESTION]);for(let e=0;e<n.length;e++)En.updateQuestionValidation(n,n[e],e,t)};const An=()=>{const t=d(),{updateFormQuestionsData:n,getFormQuestionsData:o}=s(we),{options:r,mapComponent:i}=e.useContext(fe);dn({id:r.startingQuestionId,dataAttributes:{"question-origin":[r.startingQuestionOrigin]}});const a=o();/*#__PURE__*/return e.createElement(v,{className:"p-3"},a.map((o,s)=>((o,s)=>{let r=i(o,an);/*#__PURE__*/return e.createElement(r,{key:o["@id"],question:o,onChange:(e,t)=>((e,t,o)=>{n(t,Object.assign({},e,o))})(o,e,t),index:s,intl:t})})(o,s)))},Sn=/*#__PURE__*/a((t,n)=>{const{getFormQuestionsData:o,updateFormQuestionsData:r,getData:i}=s(we),a=d();l(n,()=>({validateForm:u,getFormSpecification:m,getFormQuestionsData:o,getFormData:c}),[]);const c=()=>{const e=i(),t=o();return Le.buildQuestionAnswerModel(e,t)},u=()=>{const e=o();for(let t=0;t<e.length;t++)gn.updateQuestionValidation(e,e[t],t,a);r(null,e)},m=()=>{const e=o();return me.getFormSpecification(e)},{modalView:p}=t,h=o();if(!h.length)/*#__PURE__*/return e.createElement(v,{className:"p-3 font-italic"},"There are no questions available...");const E=h.every(e=>!me.isWizardStep(e)),g=/*#__PURE__*/e.createElement(E?An:pn,null);return p?/*#__PURE__*/e.createElement(hn,null,g):g}),vn=/*#__PURE__*/a((t,s)=>{const[r,i]=n(!0),[a,l]=n(null),[c,u]=n(null),m=d();if(o(()=>{(async()=>{const[e,n]=await ge.constructForm(t.form,m);e.formQuestions.some(e=>me.isWizardStep(e))&&(e.formQuestions[0].visited=!0),l(e),u(n),i(!1)})()},[t.form,m]),r)return t.loader||/*#__PURE__*/e.createElement(v,{className:"p-3 font-italic"},"Loading SForms...");const p=((e,t)=>(n,o)=>{if(!e)return o;for(let{component:o,mapRule:s}of e)if(s(n,t))return o;return o})(t.componentMapRules,c);/*#__PURE__*/return e.createElement(Te,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:p,options:t.options},/*#__PURE__*/e.createElement(Ne,null,/*#__PURE__*/e.createElement(Ce,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(Re,{data:c,formQuestions:a.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Sn,{ref:s,modalView:t.options&&t.options.modalView,mapComponent:p})))))});vn.propTypes={form:U.object.isRequired,options:U.object.isRequired,componentMapRules:U.array,components:U.object,componentsOptions:U.object,fetchTypeAheadValues:U.func,isFormValid:U.func,loader:U.element};const fn=/*#__PURE__*/a((t,n)=>{var o;/*#__PURE__*/return e.createElement(re,{locale:null==(o=t.options)||null==(o=o.intl)?void 0:o.locale},/*#__PURE__*/e.createElement(vn,$({ref:n},t)))});fn.propTypes={form:U.object.isRequired,options:U.object.isRequired,componentMapRules:U.array,components:U.object,componentsOptions:U.object,fetchTypeAheadValues:U.func,isFormValid:U.func,loader:U.element,enableOptionQuestionFeedback:U.bool};export{Ut as Answer,fe as ConfigurationContext,te as Constants,we as FormQuestionsContext,me as FormUtils,gt as HelpIcon,re as IntlContextProvider,Ee as JsonLdFramingUtils,ue as JsonLdObjectMap,de as JsonLdObjectUtils,an as Question,Mt as QuestionStatic,ln as WizardStep,fn as default};
|
|
2
2
|
//# sourceMappingURL=s-forms.modern.js.map
|