@pie-element/placement-ordering 13.0.0-next.42 → 13.1.0-next.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/configure/lib/choice-editor.js +4 -5
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +0 -1
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/defaults.js +3 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design.js +5 -6
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/index.js +2 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +3 -4
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +8 -8
- package/controller/lib/index.js +9 -11
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/scoring.js +6 -6
- package/controller/lib/scoring.js.map +1 -1
- package/controller/package.json +5 -5
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/ordering.js +6 -9
- package/lib/ordering.js.map +1 -1
- package/lib/placement-ordering.js +8 -9
- package/lib/placement-ordering.js.map +1 -1
- package/lib/tile.js +41 -20
- package/lib/tile.js.map +1 -1
- package/package.json +14 -11
- package/module/configure.js +0 -1
- package/module/controller.js +0 -24482
- package/module/demo.js +0 -75
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -113
- package/module/print.html +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_uniqueId","_isEqual","_difference","_styles","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","alignSelf","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","includeTargets","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","DragProvider","onDragStart","onDragEnd","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport uniqueId from 'lodash/uniqueId';\nimport isEqual from 'lodash/isEqual';\nimport difference from 'lodash/difference';\nimport { styled } from '@mui/material/styles';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n }\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n };\n\n return (\n <DragProvider onDragStart={() => { }} onDragEnd={this.onDragEnd}>\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n className=\"toggle\"\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }} className=\"collapsible\">\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,KAAA,GAAAZ,OAAA;AAEA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,SAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAA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AM,EAAE,gBAAgB;QAAEC,OAAO,EAAE;MAAiB,CAAE;MAACC,SAAS,EAAC;IAAa,gBACzGjL,MAAA,CAAAmD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAAwK,aAAa;MAAC5B,MAAM,EAAEC;IAAU,CAAE,CAClB,CACpB,EAEA,CAACrF,cAAc,iBAAIlE,MAAA,CAAAmD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAAqL,QAAQ;MAAC3C,WAAW,EAAEA,WAAY;MAACI,QAAQ,EAAEA;IAAS,CAAE,CACrE,CACgB,CAChB,CAAC;EAEnB;AACF;AAACwC,OAAA,CAAAnI,iBAAA,GAAAA,iBAAA;AAAA,IAAAI,gBAAA,CAAAd,OAAA,EArTYU,iBAAiB,eACT;EACjBmC,eAAe,EAAEtC,kBAAS,CAACC,IAAI,CAACsI,UAAU;EAC1C7H,KAAK,EAAEV,kBAAS,CAACwI,MAAM,CAACD,UAAU;EAClC5H,OAAO,EAAEX,kBAAS,CAACyI,SAAS,CAAC,CAACzI,kBAAS,CAAC0I,KAAK,CAACH,UAAU,EAAEvI,kBAAS,CAACwI,MAAM,CAACD,UAAU,CAAC;AACxF,CAAC;AAAA,IAAAI,QAAA,GAAAL,OAAA,CAAA7I,OAAA,GAkTYU,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_lodashEs","_styles","_core","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","alignSelf","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","includeTargets","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","DragProvider","onDragStart","onDragEnd","collisionDetection","closestCenter","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { difference, isEqual, uniqueId } from 'lodash-es';\nimport { styled } from '@mui/material/styles';\nimport { closestCenter } from '@dnd-kit/core';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n };\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n };\n\n return (\n <DragProvider onDragStart={() => { }} onDragEnd={this.onDragEnd} collisionDetection={closestCenter}>\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,oBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AAEA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAEA,MAAM;EAAEe;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAEpD,MAAMC,0BAA0B,GAAG,IAAAC,cAAM,EAAC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M,EAAEC;IAAU,CAAE,CAClB,CACpB,EAEA,CAACrF,cAAc,iBAAIjE,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAAuL,QAAQ;MAAC7C,WAAW,EAAEA,WAAY;MAACI,QAAQ,EAAEA;IAAS,CAAE,CACrE,CACgB,CAChB,CAAC;EAEnB;AACF;AAAC0C,OAAA,CAAArI,iBAAA,GAAAA,iBAAA;AAAA,IAAAI,gBAAA,CAAAd,OAAA,EAvTYU,iBAAiB,eACT;EACjBmC,eAAe,EAAEtC,kBAAS,CAACC,IAAI,CAACwI,UAAU;EAC1C/H,KAAK,EAAEV,kBAAS,CAAC0I,MAAM,CAACD,UAAU;EAClC9H,OAAO,EAAEX,kBAAS,CAAC2I,SAAS,CAAC,CAAC3I,kBAAS,CAAC4I,KAAK,CAACH,UAAU,EAAEzI,kBAAS,CAAC0I,MAAM,CAACD,UAAU,CAAC;AACxF,CAAC;AAAA,IAAAI,QAAA,GAAAL,OAAA,CAAA/I,OAAA,GAoTYU,iBAAiB","ignoreList":[]}
|
package/lib/tile.js
CHANGED
|
@@ -44,39 +44,54 @@ const StyledTileContent = (0, _styles.styled)('div')(({
|
|
|
44
44
|
isOver,
|
|
45
45
|
disabled,
|
|
46
46
|
outcome,
|
|
47
|
-
label
|
|
47
|
+
label,
|
|
48
|
+
type
|
|
48
49
|
}) => ({
|
|
49
|
-
cursor: '
|
|
50
|
+
cursor: disabled ? 'not-allowed' : 'grab',
|
|
50
51
|
width: '100%',
|
|
51
52
|
height: '100%',
|
|
52
53
|
padding: '10px',
|
|
53
54
|
boxSizing: 'border-box',
|
|
54
55
|
overflow: 'hidden',
|
|
55
|
-
border: `1px solid ${theme.palette.grey[400]}
|
|
56
|
-
backgroundColor: _renderUi.color.background(),
|
|
57
|
-
transition: 'opacity
|
|
56
|
+
border: type === 'choice' ? `1px solid ${theme.palette.grey[400]}` : '1px solid transparent',
|
|
57
|
+
backgroundColor: type === 'choice' ? _renderUi.color.background() : 'transparent',
|
|
58
|
+
transition: type === 'choice' ? 'background-color 150ms ease, border-color 150ms ease, opacity 150ms ease' : 'none',
|
|
58
59
|
pointerEvents: 'none',
|
|
59
|
-
'
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
userSelect: 'none',
|
|
61
|
+
...(type === 'choice' && {
|
|
62
|
+
'&:hover': {
|
|
63
|
+
backgroundColor: disabled ? _renderUi.color.background() : _renderUi.color.secondary(),
|
|
64
|
+
borderColor: disabled ? theme.palette.grey[400] : theme.palette.primary.main,
|
|
65
|
+
transform: disabled ? 'none' : 'scale(1.02)'
|
|
66
|
+
}
|
|
65
67
|
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
// Apply conditional styles based on props (only if not empty spacing tile)
|
|
69
|
+
...(type === 'choice' && isOver && !disabled && {
|
|
70
|
+
opacity: 0.4,
|
|
71
|
+
backgroundColor: _renderUi.color.primaryLight(),
|
|
72
|
+
borderColor: theme.palette.primary.main,
|
|
73
|
+
borderStyle: 'dashed',
|
|
74
|
+
transform: 'scale(1.05)'
|
|
69
75
|
}),
|
|
70
|
-
...(disabled && {
|
|
76
|
+
...(type === 'choice' && isDragging && !disabled && {
|
|
77
|
+
opacity: 0.6,
|
|
78
|
+
backgroundColor: _renderUi.color.secondaryLight(),
|
|
79
|
+
transform: 'scale(1.05) rotate(2deg)',
|
|
80
|
+
boxShadow: '0 8px 16px rgba(0,0,0,0.2)',
|
|
81
|
+
cursor: 'grabbing'
|
|
82
|
+
}),
|
|
83
|
+
...(type === 'choice' && disabled && {
|
|
84
|
+
opacity: 0.6,
|
|
71
85
|
cursor: 'not-allowed',
|
|
72
86
|
'&:hover': {
|
|
73
|
-
backgroundColor: _renderUi.color.background()
|
|
87
|
+
backgroundColor: _renderUi.color.background(),
|
|
88
|
+
transform: 'none'
|
|
74
89
|
}
|
|
75
90
|
}),
|
|
76
|
-
...(outcome === 'incorrect' && {
|
|
91
|
+
...(type === 'choice' && outcome === 'incorrect' && {
|
|
77
92
|
border: `1px solid ${_renderUi.color.incorrect()}`
|
|
78
93
|
}),
|
|
79
|
-
...(outcome === 'correct' && {
|
|
94
|
+
...(type === 'choice' && outcome === 'correct' && {
|
|
80
95
|
border: `1px solid ${_renderUi.color.correct()}`
|
|
81
96
|
}),
|
|
82
97
|
...(!label && {
|
|
@@ -105,7 +120,9 @@ const TileContent = props => {
|
|
|
105
120
|
disabled: disabled
|
|
106
121
|
});
|
|
107
122
|
} else {
|
|
123
|
+
console.log('TileContent render, props: ', props);
|
|
108
124
|
return /*#__PURE__*/_react.default.createElement(StyledTileContent, {
|
|
125
|
+
type: type,
|
|
109
126
|
isDragging: isDragging,
|
|
110
127
|
isOver: isOver,
|
|
111
128
|
disabled: disabled,
|
|
@@ -186,10 +203,14 @@ const Tile = props => {
|
|
|
186
203
|
const style = {
|
|
187
204
|
transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,
|
|
188
205
|
boxSizing: 'border-box',
|
|
189
|
-
overflow: '
|
|
206
|
+
overflow: 'visible',
|
|
190
207
|
padding: 0,
|
|
191
208
|
margin: 0,
|
|
192
|
-
textAlign: 'center'
|
|
209
|
+
textAlign: 'center',
|
|
210
|
+
pointerEvents: 'auto',
|
|
211
|
+
cursor: disabled ? 'not-allowed' : isDragging ? 'grabbing' : 'grab',
|
|
212
|
+
zIndex: isDragging ? 1000 : 'auto',
|
|
213
|
+
willChange: isDragging ? 'transform' : 'auto'
|
|
193
214
|
};
|
|
194
215
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
195
216
|
ref: setRefs,
|
package/lib/tile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_core","_styles","_drag","_renderUi","log","debug","StyledNumberContainer","styled","theme","width","fontSize","typography","textAlign","color","palette","common","black","Holder","type","index","isOver","disabled","default","createElement","PlaceHolder","undefined","propTypes","PropTypes","string","number","bool","StyledTileContent","isDragging","outcome","label","cursor","height","padding","boxSizing","overflow","border","grey","backgroundColor","background","transition","pointerEvents","secondary","opacity","secondaryLight","incorrect","correct","TileContent","props","empty","guideIndex","dangerouslySetInnerHTML","__html","Tile","id","instanceId","draggable","attributes","listeners","setNodeRef","setDragRef","transform","useDraggable","data","value","setDropRef","dropIsOver","useDroppable","ref","React","useRef","useEffect","currentRef","current","handleTouchStart","e","preventDefault","addEventListener","passive","removeEventListener","setRefs","element","style","x","y","margin","_extends2","exports","any","_default"],"sources":["../src/tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\n\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:placement-ordering:tile');\n\nconst StyledNumberContainer = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: theme.typography.fontSize + 4,\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ type, index, isOver, disabled }) => (\n <PlaceHolder type={type} isOver={isOver} disabled={disabled}>\n {type === 'target' && index !== undefined && <StyledNumberContainer>{index}</StyledNumberContainer>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n type: PropTypes.string,\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n};\n\nconst StyledTileContent = styled('div')(({ theme, isDragging, isOver, disabled, outcome, label }) => ({\n cursor: 'pointer',\n width: '100%',\n height: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n border: `1px solid ${theme.palette.grey[400]}`,\n backgroundColor: color.background(),\n transition: 'opacity 200ms linear',\n pointerEvents: 'none',\n '&:hover': {\n backgroundColor: color.secondary(),\n },\n\n // Apply conditional styles based on props\n ...(isOver && !disabled && {\n opacity: 0.2,\n }),\n\n ...(isDragging && !disabled && {\n opacity: 0.5,\n backgroundColor: color.secondaryLight(),\n }),\n\n ...(disabled && {\n cursor: 'not-allowed',\n '&:hover': {\n backgroundColor: color.background(),\n },\n }),\n\n ...(outcome === 'incorrect' && {\n border: `1px solid ${color.incorrect()}`,\n }),\n\n ...(outcome === 'correct' && {\n border: `1px solid ${color.correct()}`,\n }),\n\n ...(!label && {\n border: 'none',\n '&:hover': {\n backgroundColor: 'unset',\n },\n }),\n}));\n\nconst TileContent = (props) => {\n const { type, isDragging, empty, isOver, label, disabled, outcome, guideIndex } = props;\n\n if (empty) {\n return <Holder type={type} index={guideIndex} isOver={isOver} disabled={disabled} />;\n } else {\n return (\n <StyledTileContent\n isDragging={isDragging}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n label={label}\n dangerouslySetInnerHTML={{ __html: label }}\n />\n );\n }\n};\n\nexport const Tile = (props) => {\n const {\n label,\n type,\n id,\n empty,\n disabled,\n outcome,\n index,\n guideIndex,\n instanceId,\n draggable,\n } = props;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n isDragging,\n } = useDraggable({\n id: `tile-${id}-${instanceId}`,\n data: {\n id,\n type,\n instanceId,\n value: label,\n index\n },\n disabled: !draggable || disabled,\n });\n\n const {\n setNodeRef: setDropRef,\n isOver: dropIsOver,\n } = useDroppable({\n id: `drop-tile-${id ? id : index}-${instanceId}`,\n data: {\n id,\n type,\n instanceId,\n value: label,\n index\n },\n });\n\n const ref = React.useRef(null);\n\n React.useEffect(() => {\n const currentRef = ref.current;\n\n const handleTouchStart = (e) => {\n e.preventDefault(); // Prevent the default touch event behavior\n };\n\n if (currentRef) {\n currentRef.addEventListener('touchstart', handleTouchStart, { passive: false });\n }\n\n return () => {\n if (currentRef) {\n currentRef.removeEventListener('touchstart', handleTouchStart);\n }\n };\n }, []);\n\n const setRefs = (element) => {\n ref.current = element;\n setDragRef(element);\n setDropRef(element);\n };\n\n log('[render], props: ', props);\n\n const style = {\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n boxSizing: 'border-box',\n overflow: 'hidden',\n padding: 0,\n margin: 0,\n textAlign: 'center',\n };\n\n return (\n <div\n ref={setRefs}\n style={style}\n {...(draggable && !disabled ? { ...listeners, ...attributes } : {})}\n >\n <TileContent\n label={label}\n id={id}\n empty={empty}\n index={index}\n guideIndex={guideIndex}\n isOver={dropIsOver}\n isDragging={isDragging}\n disabled={disabled}\n outcome={outcome}\n type={type}\n />\n </div>\n );\n};\n\nTile.propTypes = {\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.string,\n index: PropTypes.number,\n guideIndex: PropTypes.number,\n instanceId: PropTypes.any,\n draggable: PropTypes.bool,\n};\n\nexport default Tile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,sCAAsC,CAAC;AAEzD,MAAMC,qBAAqB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC1DC,KAAK,EAAE,MAAM;EACbC,QAAQ,EAAEF,KAAK,CAACG,UAAU,CAACD,QAAQ,GAAG,CAAC;EACvCE,SAAS,EAAE,QAAQ;EACnBC,KAAK,EAAE,QAAQL,KAAK,CAACM,OAAO,CAACC,MAAM,CAACC,KAAK;AAC3C,CAAC,CAAC,CAAC;AAEH,MAAMC,MAAM,GAAGA,CAA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ACZ,CACE,CAAC;AAEV,CAAC;AAACyE,OAAA,CAAAlC,IAAA,GAAAA,IAAA;AAEFA,IAAI,CAAC/B,SAAS,GAAG;EACfgC,EAAE,EAAE/B,kBAAS,CAACiE,GAAG;EACjB1D,KAAK,EAAEP,kBAAS,CAACC,MAAM;EACvBR,MAAM,EAAEO,kBAAS,CAACG,IAAI;EACtBZ,IAAI,EAAES,kBAAS,CAACC,MAAM;EACtByB,KAAK,EAAE1B,kBAAS,CAACG,IAAI;EACrBT,QAAQ,EAAEM,kBAAS,CAACG,IAAI;EACxBG,OAAO,EAAEN,kBAAS,CAACC,MAAM;EACzBT,KAAK,EAAEQ,kBAAS,CAACE,MAAM;EACvByB,UAAU,EAAE3B,kBAAS,CAACE,MAAM;EAC5B8B,UAAU,EAAEhC,kBAAS,CAACiE,GAAG;EACzBhC,SAAS,EAAEjC,kBAAS,CAACG;AACvB,CAAC;AAAC,IAAA+D,QAAA,GAAAF,OAAA,CAAArE,OAAA,GAEamC,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"tile.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_core","_styles","_drag","_renderUi","log","debug","StyledNumberContainer","styled","theme","width","fontSize","typography","textAlign","color","palette","common","black","Holder","type","index","isOver","disabled","default","createElement","PlaceHolder","undefined","propTypes","PropTypes","string","number","bool","StyledTileContent","isDragging","outcome","label","cursor","height","padding","boxSizing","overflow","border","grey","backgroundColor","background","transition","pointerEvents","userSelect","secondary","borderColor","primary","main","transform","opacity","primaryLight","borderStyle","secondaryLight","boxShadow","incorrect","correct","TileContent","props","empty","guideIndex","console","dangerouslySetInnerHTML","__html","Tile","id","instanceId","draggable","attributes","listeners","setNodeRef","setDragRef","useDraggable","data","value","setDropRef","dropIsOver","useDroppable","ref","React","useRef","useEffect","currentRef","current","handleTouchStart","e","preventDefault","addEventListener","passive","removeEventListener","setRefs","element","style","x","y","margin","zIndex","willChange","_extends2","exports","any","_default"],"sources":["../src/tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\n\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:placement-ordering:tile');\n\nconst StyledNumberContainer = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: theme.typography.fontSize + 4,\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ type, index, isOver, disabled }) => (\n <PlaceHolder type={type} isOver={isOver} disabled={disabled}>\n {type === 'target' && index !== undefined && <StyledNumberContainer>{index}</StyledNumberContainer>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n type: PropTypes.string,\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n};\n\nconst StyledTileContent = styled('div')(({ theme, isDragging, isOver, disabled, outcome, label, type }) => ({\n cursor: disabled ? 'not-allowed' : 'grab',\n width: '100%',\n height: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n border: (type === 'choice') ? `1px solid ${theme.palette.grey[400]}` : '1px solid transparent',\n backgroundColor: (type === 'choice') ? color.background() : 'transparent',\n transition: (type === 'choice') ? 'background-color 150ms ease, border-color 150ms ease, opacity 150ms ease' : 'none',\n pointerEvents: 'none',\n userSelect: 'none',\n\n ...((type === 'choice') && {\n '&:hover': {\n backgroundColor: disabled ? color.background() : color.secondary(),\n borderColor: disabled ? theme.palette.grey[400] : theme.palette.primary.main,\n transform: disabled ? 'none' : 'scale(1.02)',\n },\n }),\n\n // Apply conditional styles based on props (only if not empty spacing tile)\n ...((type === 'choice') && isOver && !disabled && {\n opacity: 0.4,\n backgroundColor: color.primaryLight(),\n borderColor: theme.palette.primary.main,\n borderStyle: 'dashed',\n transform: 'scale(1.05)',\n }),\n\n ...((type === 'choice') && isDragging && !disabled && {\n opacity: 0.6,\n backgroundColor: color.secondaryLight(),\n transform: 'scale(1.05) rotate(2deg)',\n boxShadow: '0 8px 16px rgba(0,0,0,0.2)',\n cursor: 'grabbing',\n }),\n\n ...((type === 'choice') && disabled && {\n opacity: 0.6,\n cursor: 'not-allowed',\n '&:hover': {\n backgroundColor: color.background(),\n transform: 'none',\n },\n }),\n\n ...((type === 'choice') && outcome === 'incorrect' && {\n border: `1px solid ${color.incorrect()}`,\n }),\n\n ...((type === 'choice') && outcome === 'correct' && {\n border: `1px solid ${color.correct()}`,\n }),\n\n ...(!label && {\n border: 'none',\n '&:hover': {\n backgroundColor: 'unset',\n },\n }),\n}));\n\nconst TileContent = (props) => {\n const { type, isDragging, empty, isOver, label, disabled, outcome, guideIndex } = props;\n\n if (empty) {\n return <Holder type={type} index={guideIndex} isOver={isOver} disabled={disabled} />;\n } else {\n console.log('TileContent render, props: ', props);\n return (\n <StyledTileContent\n type={type}\n isDragging={isDragging}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n label={label}\n dangerouslySetInnerHTML={{ __html: label }}\n />\n );\n }\n};\n\nexport const Tile = (props) => {\n const {\n label,\n type,\n id,\n empty,\n disabled,\n outcome,\n index,\n guideIndex,\n instanceId,\n draggable,\n } = props;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n isDragging,\n } = useDraggable({\n id: `tile-${id}-${instanceId}`,\n data: {\n id,\n type,\n instanceId,\n value: label,\n index\n },\n disabled: !draggable || disabled,\n });\n\n const {\n setNodeRef: setDropRef,\n isOver: dropIsOver,\n } = useDroppable({\n id: `drop-tile-${id ? id : index}-${instanceId}`,\n data: {\n id,\n type,\n instanceId,\n value: label,\n index\n },\n });\n\n const ref = React.useRef(null);\n\n React.useEffect(() => {\n const currentRef = ref.current;\n\n const handleTouchStart = (e) => {\n e.preventDefault(); // Prevent the default touch event behavior\n };\n\n if (currentRef) {\n currentRef.addEventListener('touchstart', handleTouchStart, { passive: false });\n }\n\n return () => {\n if (currentRef) {\n currentRef.removeEventListener('touchstart', handleTouchStart);\n }\n };\n }, []);\n\n const setRefs = (element) => {\n ref.current = element;\n setDragRef(element);\n setDropRef(element);\n };\n\n log('[render], props: ', props);\n\n const style = {\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n boxSizing: 'border-box',\n overflow: 'visible',\n padding: 0,\n margin: 0,\n textAlign: 'center',\n pointerEvents: 'auto',\n cursor: disabled ? 'not-allowed' : (isDragging ? 'grabbing' : 'grab'),\n zIndex: isDragging ? 1000 : 'auto',\n willChange: isDragging ? 'transform' : 'auto',\n };\n\n return (\n <div\n ref={setRefs}\n style={style}\n {...(draggable && !disabled ? { ...listeners, ...attributes } : {})}\n >\n <TileContent\n label={label}\n id={id}\n empty={empty}\n index={index}\n guideIndex={guideIndex}\n isOver={dropIsOver}\n isDragging={isDragging}\n disabled={disabled}\n outcome={outcome}\n type={type}\n />\n </div>\n );\n};\n\nTile.propTypes = {\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.string,\n index: PropTypes.number,\n guideIndex: PropTypes.number,\n instanceId: PropTypes.any,\n draggable: PropTypes.bool,\n};\n\nexport default Tile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,sCAAsC,CAAC;AAEzD,MAAMC,qBAAqB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC1DC,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EAAE,EAAEA,EAAG;IACPN,KAAK,EAAEA,KAAM;IACb1C,KAAK,EAAEA,KAAM;IACb2C,UAAU,EAAEA,UAAW;IACvB1C,MAAM,EAAE0D,UAAW;IACnB9C,UAAU,EAAEA,UAAW;IACvBX,QAAQ,EAAEA,QAAS;IACnBY,OAAO,EAAEA,OAAQ;IACjBf,IAAI,EAAEA;EAAK,CACZ,CACE,CAAC;AAEV,CAAC;AAACmF,OAAA,CAAAnC,IAAA,GAAAA,IAAA;AAEFA,IAAI,CAACxC,SAAS,GAAG;EACfyC,EAAE,EAAExC,kBAAS,CAAC2E,GAAG;EACjBpE,KAAK,EAAEP,kBAAS,CAACC,MAAM;EACvBR,MAAM,EAAEO,kBAAS,CAACG,IAAI;EACtBZ,IAAI,EAAES,kBAAS,CAACC,MAAM;EACtBiC,KAAK,EAAElC,kBAAS,CAACG,IAAI;EACrBT,QAAQ,EAAEM,kBAAS,CAACG,IAAI;EACxBG,OAAO,EAAEN,kBAAS,CAACC,MAAM;EACzBT,KAAK,EAAEQ,kBAAS,CAACE,MAAM;EACvBiC,UAAU,EAAEnC,kBAAS,CAACE,MAAM;EAC5BuC,UAAU,EAAEzC,kBAAS,CAAC2E,GAAG;EACzBjC,SAAS,EAAE1C,kBAAS,CAACG;AACvB,CAAC;AAAC,IAAAyE,QAAA,GAAAF,OAAA,CAAA/E,OAAA,GAEa4C,IAAI","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering",
|
|
3
|
-
"
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/pie-framework/pie-elements"
|
|
6
|
+
},
|
|
7
|
+
"version": "13.1.0-next.0+20d879b",
|
|
4
8
|
"description": "",
|
|
5
|
-
"repository": "pie-framework/pie-elements",
|
|
6
9
|
"publishConfig": {
|
|
7
10
|
"access": "public"
|
|
8
11
|
},
|
|
@@ -13,22 +16,22 @@
|
|
|
13
16
|
"@mui/icons-material": "^7.3.4",
|
|
14
17
|
"@mui/material": "^7.3.4",
|
|
15
18
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/correct-answer-toggle": "3.1.1-next.
|
|
17
|
-
"@pie-lib/drag": "3.1.1-next.
|
|
18
|
-
"@pie-lib/math-rendering": "4.1.1-next.
|
|
19
|
-
"@pie-lib/render-ui": "5.1.1-next.
|
|
20
|
-
"@pie-lib/translator": "3.1.1-next.
|
|
19
|
+
"@pie-lib/correct-answer-toggle": "3.1.1-next.1",
|
|
20
|
+
"@pie-lib/drag": "3.1.1-next.1",
|
|
21
|
+
"@pie-lib/math-rendering": "4.1.1-next.1",
|
|
22
|
+
"@pie-lib/render-ui": "5.1.1-next.1",
|
|
23
|
+
"@pie-lib/translator": "3.1.1-next.1",
|
|
21
24
|
"debug": "^4.1.1",
|
|
22
25
|
"decimal.js": "^10.0.0",
|
|
23
|
-
"lodash": "^4.17.23",
|
|
26
|
+
"lodash-es": "^4.17.23",
|
|
24
27
|
"prop-types": "^15.8.1",
|
|
25
|
-
"react": "18.
|
|
26
|
-
"react-dom": "18.
|
|
28
|
+
"react": "18.3.1",
|
|
29
|
+
"react-dom": "18.3.1",
|
|
27
30
|
"react-transition-group": "^4.4.5"
|
|
28
31
|
},
|
|
29
32
|
"author": "",
|
|
30
33
|
"license": "ISC",
|
|
31
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "20d879b8b8fa74decf5028d860d54cd09cbdf051",
|
|
32
35
|
"scripts": {
|
|
33
36
|
"postpublish": "../../scripts/postpublish"
|
|
34
37
|
},
|
package/module/configure.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_react_dom as t,_dll_prop_types as n,_dll_debug as r,_dll_mui__material as i,_dll_mui__icons_material as o,_dll_mui__material_styles as a,_dll_pie_lib__render_ui as l,_dll_lodash as s}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as d}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";import{_dll_pie_lib__drag as u}from"../../../@pie-lib/drag-module@^3.0.5/module/index.js";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var h={};Object.defineProperty(h,"__esModule",{value:!0});class g extends CustomEvent{constructor(e,t=!1){super(g.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}g.TYPE="model.updated";var p=h.ModelUpdatedEvent=g;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.image";var f=h.DeleteImageEvent=m;class b extends CustomEvent{constructor(e){super(b.TYPE,{bubbles:!0,detail:e}),this.handler=e}}b.TYPE="insert.image";var v=h.InsertImageEvent=b;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var w=h.DeleteSoundEvent=y;class C extends CustomEvent{constructor(e){super(C.TYPE,{bubbles:!0,detail:e}),this.handler=e}}C.TYPE="insert.sound";var x=h.InsertSoundEvent=C,E=function(e,t,n){if(e&&"object"==typeof e){if("string"==typeof t&&""!==t){var r=t.split(".");return r.reduce(function(e,t,i){return e[t]=e[t]||{},r.length==i+1&&(e[t]=n),e[t]},e)}return"number"==typeof t?(e[t]=n,e[t]):e}return e},S=function(e,t){return e&&"object"==typeof e?"string"==typeof t&&""!==t?t.split(".").reduce(function(e,t){return e&&e[t]},e):"number"==typeof t?e[t]:e:e},D={exports:{}};D.exports=function(){var e=[],t=[],n={},r={},i={};function o(e){return"string"==typeof e?new RegExp("^"+e+"$","i"):e}function a(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function l(e,t){return e.replace(t[0],function(n,r){var i,o,l=(i=t[1],o=arguments,i.replace(/\$(\d{1,2})/g,function(e,t){return o[t]||""}));return a(""===n?e[r-1]:n,l)})}function s(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var o=r[i];if(o[0].test(t))return l(t,o)}return t}function c(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?a(r,i):e.hasOwnProperty(i)?a(r,e[i]):s(i,r,n)}}function d(e,t,n,r){return function(r){var i=r.toLowerCase();return!!t.hasOwnProperty(i)||!e.hasOwnProperty(i)&&s(i,i,n)===i}}function u(e,t,n){return(n?t+" ":"")+(1===t?u.singular(e):u.plural(e))}return u.plural=c(i,r,e),u.isPlural=d(i,r,e),u.singular=c(r,i,t),u.isSingular=d(r,i,t),u.addPluralRule=function(t,n){e.push([o(t),n])},u.addSingularRule=function(e,n){t.push([o(e),n])},u.addUncountableRule=function(e){"string"!=typeof e?(u.addPluralRule(e,"$0"),u.addSingularRule(e,"$0")):n[e.toLowerCase()]=!0},u.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return u.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return u.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return u.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(u.addUncountableRule),u}();var R=D.exports;const{useMemo:$}=e,{useLayoutEffect:A}=e,{useEffect:T}=e,{useRef:I}=e,{useCallback:k}=e,_="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function L(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function P(e){return"nodeType"in e}function O(e){var t,n;return e?L(e)?e:P(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function M(e){const{Document:t}=O(e);return e instanceof t}function N(e){return!L(e)&&e instanceof O(e).HTMLElement}function j(e){return e instanceof O(e).SVGElement}function z(e){return e?L(e)?e.document:P(e)?M(e)?e:N(e)||j(e)?e.ownerDocument:document:document:document}const W=_?A:T;function B(e){const t=I(e);return W(()=>{t.current=e}),k(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function H(e,t){void 0===t&&(t=[e]);const n=I(e);return W(()=>{n.current!==e&&(n.current=e)},t),n}function F(e,t){const n=I();return $(()=>{const t=e(n.current);return n.current=t,t},[...t])}function q(e){const t=B(e),n=I(null),r=k(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function U(e){const t=I();return T(()=>{t.current=e},[e]),t.current}let Y={};function X(e,t){return $(()=>{if(t)return t;const n=null==Y[e]?0:Y[e]+1;return Y[e]=n,e+"-"+n},[e,t])}function K(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,i]of r){const r=t[n];null!=r&&(t[n]=r+e*i)}return t},{...t})}}const G=K(1),J=K(-1);function V(e){if(!e)return!1;const{KeyboardEvent:t}=O(e.target);return t&&e instanceof t}function Q(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=O(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Z=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Z.Translate.toString(e),Z.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ee="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function te(e){return e.matches(ee)?e:e.querySelector(ee)}const ne=e,{useState:re}=e,{useCallback:ie}=e,oe={display:"none"};function ae(e){let{id:t,value:n}=e;return ne.createElement("div",{id:t,style:oe},n)}function le(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return ne.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const se=e,{createContext:ce}=e,{useContext:de}=e,{useEffect:ue}=e,{useState:he}=e,{useCallback:ge}=e,{useMemo:pe}=e,{useRef:me}=e,{memo:fe}=e,{useReducer:be}=e,{cloneElement:ve}=e,{forwardRef:ye}=e,{createPortal:we}=t,{unstable_batchedUpdates:Ce}=t,xe=ce(null),Ee={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},Se={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function De(e){let{announcements:t=Se,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ee}=e;const{announce:o,announcement:a}=function(){const[e,t]=re("");return{announce:ie(e=>{null!=e&&t(e)},[]),announcement:e}}(),l=X("DndLiveRegion"),[s,c]=he(!1);if(ue(()=>{c(!0)},[]),function(e){const t=de(xe);ue(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(pe(()=>({onDragStart(e){let{active:n}=e;o(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&o(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;o(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;o(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;o(t.onDragCancel({active:n,over:r}))}}),[o,t])),!s)return null;const d=se.createElement(se.Fragment,null,se.createElement(ae,{id:r,value:i.draggable}),se.createElement(le,{id:l,announcement:a}));return n?we(d,n):d}var Re;function $e(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(Re||(Re={}));const Ae=Object.freeze({x:0,y:0});function Te(e,t){const n=Q(e);return n?(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%":"0 0"}function Ie(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ke(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,l=o-n;if(r<i&&n<o){const n=t.width*t.height,r=e.width*e.height,i=a*l;return Number((i/(n+r-i)).toFixed(4))}return 0}const _e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=ke(o,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Ie)};function Le(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ae}const Pe=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((e,t)=>({...e,top:e.top+1*t.y,bottom:e.bottom+1*t.y,left:e.left+1*t.x,right:e.right+1*t.x}),{...e})};function Oe(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const Me={ignoreTransform:!1};function Ne(e,t){void 0===t&&(t=Me);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=O(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=Oe(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:l}=r,s=e.left-a-(1-i)*parseFloat(n),c=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:i,width:o,height:a,bottom:l,right:s}=n;return{top:r,left:i,width:o,height:a,bottom:l,right:s}}function je(e){return Ne(e,{ignoreTransform:!0})}function ze(e,t){const n=[];return e?function r(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(M(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!N(i)||j(i))return n;if(n.includes(i))return n;const o=O(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=O(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(i,o)&&n.push(i),function(e,t){return void 0===t&&(t=O(e).getComputedStyle(e)),"fixed"===t.position}(i,o)?n:r(i.parentNode)}(e):n}function We(e){const[t]=ze(e,1);return null!=t?t:null}function Be(e){return _&&e?L(e)?e:P(e)?M(e)||e===z(e).scrollingElement?window:N(e)?e:null:null:null}function He(e){return L(e)?e.scrollX:e.scrollLeft}function Fe(e){return L(e)?e.scrollY:e.scrollTop}function qe(e){return{x:He(e),y:Fe(e)}}var Ue;function Ye(e){return!(!_||!e)&&e===document.scrollingElement}function Xe(e){const t={x:0,y:0},n=Ye(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Ue||(Ue={}));const Ke={x:.2,y:.2};function Ge(e,t,n,r,i){let{top:o,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===i&&(i=Ke);const{isTop:c,isBottom:d,isLeft:u,isRight:h}=Xe(e),g={x:0,y:0},p={x:0,y:0},m=t.height*i.y,f=t.width*i.x;return!c&&o<=t.top+m?(g.y=Ue.Backward,p.y=r*Math.abs((t.top+m-o)/m)):!d&&s>=t.bottom-m&&(g.y=Ue.Forward,p.y=r*Math.abs((t.bottom-m-s)/m)),!h&&l>=t.right-f?(g.x=Ue.Forward,p.x=r*Math.abs((t.right-f-l)/f)):!u&&a<=t.left+f&&(g.x=Ue.Backward,p.x=r*Math.abs((t.left+f-a)/f)),{direction:g,speed:p}}function Je(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ve(e){return e.reduce((e,t)=>G(e,qe(t)),Ae)}function Qe(e,t){if(void 0===t&&(t=Ne),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);We(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ze=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+He(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Fe(t),0)}]];class et{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ze(t),r=Ve(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Ze)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=i(n),a=r[e]-t;return this.rect[o]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tt{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function nt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var rt,it;function ot(e){e.preventDefault()}function at(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(rt||(rt={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(it||(it={}));const lt={start:[it.Space,it.Enter],cancel:[it.Esc],end:[it.Space,it.Enter,it.Tab]},st=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case it.Right:return{...n,x:n.x+25};case it.Left:return{...n,x:n.x-25};case it.Down:return{...n,y:n.y+25};case it.Up:return{...n,y:n.y-25}}};class ct{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new tt(z(t)),this.windowListeners=new tt(O(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rt.Resize,this.handleCancel),this.windowListeners.add(rt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(rt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Qe(n),t(Ae)}handleKeyDown(e){if(V(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:i=lt,coordinateGetter:o=st,scrollBehavior:a="smooth"}=r,{code:l}=e;if(i.end.includes(l))return void this.handleEnd(e);if(i.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:Ae;this.referenceCoordinates||(this.referenceCoordinates=c);const d=o(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=J(d,c),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(const n of i){const i=e.code,{isTop:o,isRight:l,isLeft:s,isBottom:c,maxScroll:u,minScroll:h}=Xe(n),g=Je(n),p={x:Math.min(i===it.Right?g.right-g.width/2:g.right,Math.max(i===it.Right?g.left:g.left+g.width/2,d.x)),y:Math.min(i===it.Down?g.bottom-g.height/2:g.bottom,Math.max(i===it.Down?g.top:g.top+g.height/2,d.y))},m=i===it.Right&&!l||i===it.Left&&!s,f=i===it.Down&&!c||i===it.Up&&!o;if(m&&p.x!==d.x){const e=n.scrollLeft+t.x,o=i===it.Right&&e<=u.x||i===it.Left&&e>=h.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=o?n.scrollLeft-e:i===it.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(f&&p.y!==d.y){const e=n.scrollTop+t.y,o=i===it.Down&&e<=u.y||i===it.Up&&e>=h.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=o?n.scrollTop-e:i===it.Down?n.scrollTop-u.y:n.scrollTop-h.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,G(J(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function dt(e){return Boolean(e&&"distance"in e)}function ut(e){return Boolean(e&&"delay"in e)}ct.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=lt,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=o.activatorNode.current;return!(t&&e.target!==t||(e.preventDefault(),null==i||i({event:e.nativeEvent}),0))}return!1}}];class ht{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=O(e);return e instanceof t?e:z(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:o}=i;this.props=e,this.events=t,this.document=z(o),this.documentListeners=new tt(this.document),this.listeners=new tt(n),this.windowListeners=new tt(O(o)),this.initialCoordinates=null!=(r=Q(i))?r:Ae,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(rt.Resize,this.handleCancel),this.windowListeners.add(rt.DragStart,ot),this.windowListeners.add(rt.VisibilityChange,this.handleCancel),this.windowListeners.add(rt.ContextMenu,ot),this.documentListeners.add(rt.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ut(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(dt(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(rt.Click,at,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rt.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!r)return;const l=null!=(t=Q(e))?t:Ae,s=J(r,l);if(!n&&a){if(dt(a)){if(null!=a.tolerance&&nt(s,a.tolerance))return this.handleCancel();if(nt(s,a.distance))return this.handleStart()}return ut(a)&&nt(s,a.tolerance)?this.handleCancel():void this.handlePending(a,s)}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===it.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const gt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class pt extends ht{constructor(e){const{event:t}=e,n=z(t.target);super(e,gt,n)}}pt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button||(null==r||r({event:n}),0))}}];const mt={move:{name:"mousemove"},end:{name:"mouseup"}};var ft;!function(e){e[e.RightClick=2]="RightClick"}(ft||(ft={})),class extends ht{constructor(e){super(e,mt,z(e.event.target))}}.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ft.RightClick&&(null==r||r({event:n}),!0)}}];const bt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var vt,yt;function wt(e){let{acceleration:t,activator:n=vt.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:l=yt.TreeOrder,pointerCoordinates:s,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:h}=e;const g=function(e){let{delta:t,disabled:n}=e;const r=U(t);return F(e=>{if(n||!r||!e)return Ct;const i=Math.sign(t.x-r.x),o=Math.sign(t.y-r.y);return{x:{[Ue.Backward]:e.x[Ue.Backward]||-1===i,[Ue.Forward]:e.x[Ue.Forward]||1===i},y:{[Ue.Backward]:e.y[Ue.Backward]||-1===o,[Ue.Forward]:e.y[Ue.Forward]||1===o}}},[n,t,r])}({delta:u,disabled:!o}),[p,m]=function(){const e=I(null);return[k((t,n)=>{e.current=setInterval(t,n)},[]),k(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),f=me({x:0,y:0}),b=me({x:0,y:0}),v=pe(()=>{switch(n){case vt.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case vt.DraggableRect:return i}},[n,i,s]),y=me(null),w=ge(()=>{const e=y.current;if(!e)return;const t=f.current.x*b.current.x,n=f.current.y*b.current.y;e.scrollBy(t,n)},[]),C=pe(()=>l===yt.TreeOrder?[...c].reverse():c,[l,c]);ue(()=>{if(o&&c.length&&v){for(const e of C){if(!1===(null==r?void 0:r(e)))continue;const n=c.indexOf(e),i=d[n];if(!i)continue;const{direction:o,speed:l}=Ge(e,i,v,t,h);for(const e of["x","y"])g[e][o[e]]||(l[e]=0,o[e]=0);if(l.x>0||l.y>0)return m(),y.current=e,p(w,a),f.current=l,void(b.current=o)}f.current={x:0,y:0},b.current={x:0,y:0},m()}else m()},[t,w,r,m,o,a,JSON.stringify(v),JSON.stringify(g),p,c,C,d,JSON.stringify(h)])}(class extends ht{constructor(e){super(e,bt)}static setup(){return window.addEventListener(bt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(bt.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return!(i.length>1||(null==r||r({event:n}),0))}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(vt||(vt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(yt||(yt={}));const Ct={x:{[Ue.Backward]:!1,[Ue.Forward]:!1},y:{[Ue.Backward]:!1,[Ue.Forward]:!1}};var xt,Et;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(xt||(xt={})),(Et||(Et={})).Optimized="optimized";const St=new Map;function Dt(e,t){return F(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function Rt(e){let{callback:t,disabled:n}=e;const r=B(t),i=pe(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return ue(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function $t(e){return new et(Ne(e),e)}function At(e,t,n){void 0===t&&(t=$t);const[r,i]=he(null);function o(){i(r=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=r?r:n)?i:null;const o=t(e);return JSON.stringify(r)===JSON.stringify(o)?r:o})}const a=function(e){let{callback:t,disabled:n}=e;const r=B(t),i=pe(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return ue(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),l=Rt({callback:o});return W(()=>{o(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())},[e]),r}const Tt=[];function It(e,t){void 0===t&&(t=[]);const n=me(null);return ue(()=>{n.current=null},t),ue(()=>{const t=e!==Ae;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?J(e,n.current):Ae}function kt(e){return pe(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const _t=[];function Lt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return N(t)?t:e}const Pt=[{sensor:pt,options:{}},{sensor:ct,options:{}}],Ot={current:{}},Mt={draggable:{measure:je},droppable:{measure:je,strategy:xt.WhileDragging,frequency:Et.Optimized},dragOverlay:{measure:Ne}};class Nt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const jt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$e},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mt,measureDroppableContainers:$e,windowRect:null,measuringScheduled:!1},zt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$e,draggableNodes:new Map,over:null,measureDroppableContainers:$e},Wt=ce(zt),Bt=ce(jt);function Ht(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nt}}}function Ft(e,t){switch(t.type){case Re.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Re.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Re.DragEnd:case Re.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Re.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Nt(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Re.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Nt(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Re.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Nt(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function qt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=de(Wt),o=U(r),a=U(null==n?void 0:n.id);return ue(()=>{if(!t&&!r&&o&&null!=a){if(!V(o))return;if(document.activeElement===o.target)return;const e=i.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=te(e);if(t){t.focus();break}}})}},[r,t,i,a,o]),null}function Ut(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}const Yt=ce({...Ae,scaleX:1,scaleY:1});var Xt;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Xt||(Xt={})),fe(function(e){var t,n,r,i;let{id:o,accessibility:a,autoScroll:l=!0,children:s,sensors:c=Pt,collisionDetection:d=_e,measuring:u,modifiers:h,...g}=e;const p=be(Ft,void 0,Ht),[m,f]=p,[b,v]=function(){const[e]=he(()=>new Set),t=ge(t=>(e.add(t),()=>e.delete(t)),[e]);return[ge(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[y,w]=he(Xt.Uninitialized),C=y===Xt.Initialized,{draggable:{active:x,nodes:E,translate:S},droppable:{containers:D}}=m,R=null!=x?E.get(x):null,$=me({initial:null,translated:null}),A=pe(()=>{var e;return null!=x?{id:x,data:null!=(e=null==R?void 0:R.data)?e:Ot,rect:$}:null},[x,R]),T=me(null),[I,k]=he(null),[L,P]=he(null),M=H(g,Object.values(g)),j=X("DndDescribedBy",o),z=pe(()=>D.getEnabled(),[D]),B=pe(()=>({draggable:{...Mt.draggable,...null==U?void 0:U.draggable},droppable:{...Mt.droppable,...null==U?void 0:U.droppable},dragOverlay:{...Mt.dragOverlay,...null==U?void 0:U.dragOverlay}}),[null==(U=u)?void 0:U.draggable,null==U?void 0:U.droppable,null==U?void 0:U.dragOverlay]);var U;const{droppableRects:Y,measureDroppableContainers:K,measuringScheduled:J}=function(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=he(null),{frequency:l,measure:s,strategy:c}=i,d=me(e),u=function(){switch(c){case xt.Always:return!1;case xt.BeforeDragging:return n;default:return!n}}(),h=H(u),g=ge(function(e){void 0===e&&(e=[]),h.current||a(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),p=me(null),m=F(t=>{if(u&&!n)return St;if(!t||t===St||d.current!==e||null!=o){const t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new et(s(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,u,s]);return ue(()=>{d.current=e},[e]),ue(()=>{u||g()},[n,u]),ue(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),ue(()=>{u||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{g(),p.current=null},l))},[l,u,g,...r]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:null!=o}}(z,{dragging:C,dependencies:[S.x,S.y],config:B.droppable}),V=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return F(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(E,x),Z=pe(()=>L?Q(L):null,[L]),ee=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=C&&!e&&!t;return"object"==typeof l?{...l,enabled:n}:{enabled:n}}(),te=function(e,t){return Dt(e,t)}(V,B.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=me(!1),{x:a,y:l}="boolean"==typeof i?{x:i,y:i}:i;W(()=>{if(!a&&!l||!t)return void(o.current=!1);if(o.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=Le(n(e),r);if(a||(i.x=0),l||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=We(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,a,l,r,n])}({activeNode:null!=x?E.get(x):null,config:ee.layoutShiftCompensation,initialRect:te,measure:B.draggable.measure});const ne=At(V,B.draggable.measure,te),re=At(V?V.parentElement:null),ie=me({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=D.getNodeFor(null==(t=ie.current.over)?void 0:t.id),ae=function(e){let{measure:t}=e;const[n,r]=he(null),i=Rt({callback:ge(e=>{for(const{target:n}of e)if(N(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),o=ge(e=>{const n=Lt(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]),[a,l]=q(o);return pe(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}({measure:B.dragOverlay.measure}),le=null!=(n=ae.nodeRef.current)?n:V,ce=C?null!=(r=ae.rect)?r:ne:null,de=Boolean(ae.nodeRef.current&&ae.rect),fe=Le(ve=de?null:ne,Dt(ve));var ve;const ye=kt(le?O(le):null),we=function(e){const t=me(e),n=F(n=>e?n&&n!==Tt&&e&&t.current&&e.parentNode===t.current.parentNode?n:ze(e):Tt,[e]);return ue(()=>{t.current=e},[e]),n}(C?null!=oe?oe:V:null),Ee=function(e,t){void 0===t&&(t=Ne);const[n]=e,r=kt(n?O(n):null),[i,o]=he(_t);function a(){o(()=>e.length?e.map(e=>Ye(e)?r:new et(t(e),e)):_t)}const l=Rt({callback:a});return W(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),i}(we),Se=Ut(h,{transform:{x:S.x-fe.x,y:S.y-fe.y,scaleX:1,scaleY:1},activatorEvent:L,active:A,activeNodeRect:ne,containerNodeRect:re,draggingNodeRect:ce,over:ie.current.over,overlayNodeRect:ae.rect,scrollableAncestors:we,scrollableAncestorRects:Ee,windowRect:ye}),$e=Z?G(Z,S):null,Te=function(e){const[t,n]=he(null),r=me(e),i=ge(e=>{const t=Be(e.target);t&&n(e=>e?(e.set(t,qe(t)),new Map(e)):null)},[]);return ue(()=>{const t=r.current;if(e!==t){o(t);const a=e.map(e=>{const t=Be(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,qe(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{const t=Be(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),pe(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>G(e,t),Ae):Ve(e):Ae,[e,t])}(we),Ie=It(Te),ke=It(Te,[ne]),Oe=G(Se,Ie),Me=ce?Pe(ce,Se):null,je=A&&Me?d({active:A,collisionRect:Me,droppableRects:Y,droppableContainers:z,pointerCoordinates:$e}):null,He=function(e){if(!e||0===e.length)return null;const[t]=e;return t.id}(je),[Fe,Ue]=he(null),Xe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(de?Se:G(Se,ke),null!=(i=null==Fe?void 0:Fe.rect)?i:null,ne),Ke=me(null),Ge=ge((e,t)=>{let{sensor:n,options:r}=t;if(null==T.current)return;const i=E.get(T.current);if(!i)return;const o=e.nativeEvent,a=new n({active:T.current,activeNode:i,event:o,options:r,context:ie,onAbort(e){if(!E.get(e))return;const{onDragAbort:t}=M.current,n={id:e};null==t||t(n),b({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!E.get(e))return;const{onDragPending:i}=M.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==i||i(o),b({type:"onDragPending",event:o})},onStart(e){const t=T.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:r}=M.current,i={activatorEvent:o,active:{id:t,data:n.data,rect:$}};Ce(()=>{null==r||r(i),w(Xt.Initializing),f({type:Re.DragStart,initialCoordinates:e,active:t}),b({type:"onDragStart",event:i}),k(Ke.current),P(o)})},onMove(e){f({type:Re.DragMove,coordinates:e})},onEnd:l(Re.DragEnd),onCancel:l(Re.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ie.current;let a=null;if(t&&i){const{cancelDrop:l}=M.current;a={activatorEvent:o,active:t,collisions:n,delta:i,over:r},e===Re.DragEnd&&"function"==typeof l&&await Promise.resolve(l(a))&&(e=Re.DragCancel)}T.current=null,Ce(()=>{f({type:e}),w(Xt.Uninitialized),Ue(null),k(null),P(null),Ke.current=null;const t=e===Re.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=M.current[t];null==e||e(a),b({type:t,event:a})}})}}Ke.current=a},[E]),Je=ge((e,t)=>(n,r)=>{const i=n.nativeEvent,o=E.get(r);if(null!==T.current||!o||i.dndKit||i.defaultPrevented)return;const a={active:o};!0===e(n,t.options,a)&&(i.dndKit={capturedBy:t.sensor},T.current=r,Ge(n,t))},[E,Ge]),Qe=function(e,t){return pe(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(c,Je);!function(e){ue(()=>{if(!_)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(c),W(()=>{ne&&y===Xt.Initializing&&w(Xt.Initialized)},[ne,y]),ue(()=>{const{onDragMove:e}=M.current,{active:t,activatorEvent:n,collisions:r,over:i}=ie.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:Oe.x,y:Oe.y},over:i};Ce(()=>{null==e||e(o),b({type:"onDragMove",event:o})})},[Oe.x,Oe.y]),ue(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ie.current;if(!e||null==T.current||!t||!i)return;const{onDragOver:o}=M.current,a=r.get(He),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:l};Ce(()=>{Ue(l),null==o||o(s),b({type:"onDragOver",event:s})})},[He]),W(()=>{ie.current={activatorEvent:L,active:A,activeNode:V,collisionRect:Me,collisions:je,droppableRects:Y,draggableNodes:E,draggingNode:le,draggingNodeRect:ce,droppableContainers:D,over:Fe,scrollableAncestors:we,scrollAdjustedTranslate:Oe},$.current={initial:ce,translated:Me}},[A,V,je,Me,E,le,ce,Y,D,Fe,we,Oe]),wt({...ee,delta:S,draggingRect:Me,pointerCoordinates:$e,scrollableAncestors:we,scrollableAncestorRects:Ee});const Ze=pe(()=>({active:A,activeNode:V,activeNodeRect:ne,activatorEvent:L,collisions:je,containerNodeRect:re,dragOverlay:ae,draggableNodes:E,droppableContainers:D,droppableRects:Y,over:Fe,measureDroppableContainers:K,scrollableAncestors:we,scrollableAncestorRects:Ee,measuringConfiguration:B,measuringScheduled:J,windowRect:ye}),[A,V,ne,L,je,re,ae,E,D,Y,Fe,K,we,Ee,B,J,ye]),tt=pe(()=>({activatorEvent:L,activators:Qe,active:A,activeNodeRect:ne,ariaDescribedById:{draggable:j},dispatch:f,draggableNodes:E,over:Fe,measureDroppableContainers:K}),[L,Qe,A,ne,f,j,E,Fe,K]);return se.createElement(xe.Provider,{value:v},se.createElement(Wt.Provider,{value:tt},se.createElement(Bt.Provider,{value:Ze},se.createElement(Yt.Provider,{value:Xe},s)),se.createElement(qt,{disabled:!1===(null==a?void 0:a.restoreFocus)})),se.createElement(De,{...a,hiddenTextDescribedById:j}))});const Kt=ce(null),Gt="button";const Jt={timeout:25};function Vt(e){let{animation:t,children:n}=e;const[r,i]=he(null),[o,a]=he(null),l=U(n);return n||r||!l||i(l),W(()=>{if(!o)return;const e=null==r?void 0:r.key,n=null==r?void 0:r.props.id;null!=e&&null!=n?Promise.resolve(t(n,o)).then(()=>{i(null)}):i(null)},[t,r,o]),se.createElement(se.Fragment,null,n,r?ve(r,{ref:a}):null)}const Qt={x:0,y:0,scaleX:1,scaleY:1};function Zt(e){let{children:t}=e;return se.createElement(Wt.Provider,{value:zt},se.createElement(Yt.Provider,{value:Qt},t))}const en={position:"fixed",touchAction:"none"},tn=e=>V(e)?"transform 250ms ease":void 0,nn=ye((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:l,style:s,transform:c,transition:d=tn}=e;if(!l)return null;const u=i?c:{...c,scaleX:1,scaleY:1},h={...en,width:l.width,height:l.height,top:l.top,left:l.left,transform:Z.Transform.toString(u),transformOrigin:i&&r?Te(r,l):void 0,transition:"function"==typeof d?d(r):d,...s};return se.createElement(n,{className:a,style:h,ref:t},o)}),rn={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Z.Transform.toString(t)},{transform:Z.Transform.toString(n)}]},sideEffects:(on={styles:{active:{opacity:"0"}}},e=>{let{active:t,dragOverlay:n}=e;const r={},{styles:i,className:o}=on;if(null!=i&&i.active)for(const[e,n]of Object.entries(i.active))void 0!==n&&(r[e]=t.node.style.getPropertyValue(e),t.node.style.setProperty(e,n));if(null!=i&&i.dragOverlay)for(const[e,t]of Object.entries(i.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return null!=o&&o.active&&t.node.classList.add(o.active),null!=o&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[e,n]of Object.entries(r))t.node.style.setProperty(e,n);null!=o&&o.active&&t.node.classList.remove(o.active)}})};var on;let an=0;se.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:l="div",className:s,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:h,containerNodeRect:g,draggableNodes:p,droppableContainers:m,dragOverlay:f,over:b,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:w,windowRect:C}=de(Bt),x=de(Yt),E=function(e){return pe(()=>{if(null!=e)return an++,an},[e])}(null==u?void 0:u.id),S=Ut(a,{activatorEvent:d,active:u,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:f.rect,over:b,overlayNodeRect:f.rect,scrollableAncestors:y,scrollableAncestorRects:w,transform:x,windowRect:C}),D=Dt(h),R=function(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return B((e,o)=>{if(null===t)return;const a=n.get(e);if(!a)return;const l=a.node.current;if(!l)return;const s=Lt(o);if(!s)return;const{transform:c}=O(o).getComputedStyle(o),d=Oe(c);if(!d)return;const u="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...rn,...e};return e=>{let{active:o,dragOverlay:a,transform:l,...s}=e;if(!t)return;const c=a.rect.left-o.rect.left,d=a.rect.top-o.rect.top,u={scaleX:1!==l.scaleX?o.rect.width*l.scaleX/a.rect.width:1,scaleY:1!==l.scaleY?o.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-c,y:l.y-d,...u},g=i({...s,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[p]=g,m=g[g.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const f=null==r?void 0:r({active:o,dragOverlay:a,...s}),b=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{b.onfinish=()=>{null==f||f(),e()}})}}(t);return Qe(l,i.draggable.measure),u({active:{id:e,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:i.dragOverlay.measure(s)},droppableContainers:r,measuringConfiguration:i,transform:d})})}({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:v}),$=D?f.setRef:void 0;return se.createElement(Zt,null,se.createElement(Vt,{animation:R},u&&E?se.createElement(nn,{key:E,id:u.id,ref:$,as:l,activatorEvent:d,adjustScale:t,className:s,transition:o,rect:D,style:{zIndex:c,...i},transform:S},n):null))});const ln=e,sn=n,cn=r,{CardActions:dn}=i,{IconButton:un}=i,{DragHandle:hn}=o,{RemoveCircle:gn}=o,{styled:pn}=a,{color:mn}=l,fn=d,{DEFAULT_PLUGINS:bn}=d;cn("@pie-element:placement-ordering:configure:choice-tile");const vn=pn("div")(({theme:e})=>({margin:`${e.spacing(1)}px 0`,backgroundColor:e.palette.background.paper,display:"flex",flexDirection:"column",cursor:"move"})),yn=pn(fn)(({theme:e,isTargetPrompt:t})=>({width:"80%",border:"none",borderRadius:"4px",...t&&{backgroundColor:e.palette.error.light}})),wn=pn("div")(()=>({display:"flex",justifyContent:"flex-end"})),Cn=pn(hn)(({theme:e})=>({color:e.palette.error[400]})),xn=pn("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,marginLeft:e.spacing(5),marginTop:e.spacing(1)})),En=pn(gn)(({theme:e})=>({fill:e.palette.error[500]})),Sn=pn(un)({color:`${mn.tertiary()} !important`}),Dn=e=>{const{choice:t,index:n,onChoiceChange:r,onDelete:i,imageSupport:o,spellCheck:a,toolbarOpts:l,pluginProps:s,maxImageWidth:c,maxImageHeight:d,error:u,mathMlOptions:h={}}=e,{label:g,editable:p,type:m}=t,f=`${m}-${t.id}`,b=`${m}-drop-${t.id}`,{attributes:v,listeners:y,setNodeRef:w,transform:C,isDragging:x}=function(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=X("Draggable"),{activators:a,activatorEvent:l,active:s,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:h}=de(Wt),{role:g=Gt,roleDescription:p="draggable",tabIndex:m=0}=null!=i?i:{},f=(null==s?void 0:s.id)===t,b=de(f?Yt:Kt),[v,y]=q(),[w,C]=q(),x=function(e,t){return pe(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}(a,t),E=H(n);return W(()=>(u.set(t,{id:t,key:o,node:v,activatorNode:w,data:E}),()=>{const e=u.get(t);e&&e.key===o&&u.delete(t)}),[u,t]),{active:s,activatorEvent:l,activeNodeRect:c,attributes:pe(()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!f||g!==Gt)||void 0,"aria-roledescription":p,"aria-describedby":d.draggable}),[r,g,m,f,p,d.draggable]),isDragging:f,listeners:r?void 0:x,node:v,over:h,setNodeRef:y,setActivatorNodeRef:C,transform:b}}({id:f,data:{id:t.id,index:n,type:m}}),{setNodeRef:E}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=X("Droppable"),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=de(Wt),d=me({disabled:n}),u=me(!1),h=me(null),g=me(null),{disabled:p,updateMeasurementsFor:m,timeout:f}={...Jt,...i},b=H(null!=m?m:r),v=Rt({callback:ge(()=>{u.current?(null!=g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},f)):u.current=!0},[f]),disabled:p||!a}),y=ge((e,t)=>{v&&(t&&(v.unobserve(t),u.current=!1),e&&v.observe(e))},[v]),[w,C]=q(y),x=H(t);return ue(()=>{v&&w.current&&(v.disconnect(),u.current=!1,v.observe(w.current))},[w,v]),ue(()=>(l({type:Re.RegisterDroppable,element:{id:r,key:o,disabled:n,node:w,rect:h,data:x}}),()=>l({type:Re.UnregisterDroppable,key:o,id:r})),[r]),ue(()=>{n!==d.current.disabled&&(l({type:Re.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,l]),{active:a,rect:h,isOver:(null==s?void 0:s.id)===r,node:w,over:s,setNodeRef:C}}({id:b,data:{id:t.id,index:n,type:m}}),S={transform:C?`translate3d(${C.x}px, ${C.y}px, 0)`:void 0,opacity:x?.5:1,width:"100%"},D=(bn||[]).filter(e=>"bulleted-list"!==e&&"numbered-list"!==e);return ln.createElement("div",{ref:E},ln.createElement("div",{ref:w,...y,...v},ln.createElement(vn,{style:S},ln.createElement("div",{style:{width:"100%",display:"flex"}},ln.createElement(dn,null,ln.createElement(Cn,null)),ln.createElement(yn,{disabled:!p,placeholder:"target"===m||g.includes("data-latex")?"":"Enter a choice",markup:g,imageSupport:o||void 0,onChange:e=>{t.label=e,r(t)},pluginProps:s,toolbarOpts:l,activePlugins:D,spellCheck:a,autoWidthToolbar:!0,maxImageWidth:c,maxImageHeight:d,languageCharactersProps:[{language:"spanish"},{language:"special"}],error:p&&u,mathMlOptions:h}),p&&ln.createElement(wn,null,ln.createElement(Sn,{onClick:i,size:"large"},ln.createElement(En,null)))),p&&u&&ln.createElement(xn,null,u))))};Dn.propTypes={id:sn.any,maxImageHeight:sn.object,maxImageWidth:sn.object,label:sn.string,isOver:sn.bool,type:sn.string,empty:sn.bool,disabled:sn.bool,outcome:sn.object,index:sn.number,imageSupport:sn.shape({add:sn.func.isRequired,delete:sn.func.isRequired}),choice:sn.object,choices:sn.array.isRequired,onChoiceChange:sn.func.isRequired,onDelete:sn.func.isRequired,toolbarOpts:sn.object,pluginProps:sn.object,choicesLabel:sn.string,error:sn.string,spellCheck:sn.bool,mathMlOptions:sn.object};const Rn=n,$n=e,An=r,{shuffle:Tn}=s,{isEqual:In}=s,{Button:kn}=i,{styled:_n}=a,{InputContainer:Ln}=l,{AlertDialog:Pn}=c;function On(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}An("@pie-element:placement-ordering:configure:choice-editor");const Mn=_n("div")({display:"flex",alignItems:"center",justifyContent:"space-between"}),Nn=_n(kn)(({theme:e})=>({marginTop:e.spacing(2.5),paddingLeft:e.spacing(1.5),paddingRight:e.spacing(1.5),"& .MuiButton-label":{transition:"opacity 200ms linear","&:hover":{opacity:.3}}})),jn=_n("div")({gridAutoFlow:"column",display:"grid",gridGap:"10px",alignItems:"center"}),zn=_n(Ln)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2)})),Wn=_n("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class Bn extends $n.Component{static __initStatic(){this.propTypes={correctResponse:Rn.array.isRequired,choices:Rn.array.isRequired,onChange:Rn.func.isRequired,imageSupport:Rn.shape({add:Rn.func.isRequired,delete:Rn.func.isRequired}),maxImageHeight:Rn.object,maxImageWidth:Rn.object,toolbarOpts:Rn.object,pluginProps:Rn.object,placementArea:Rn.bool,singularChoiceLabel:Rn.string,pluralChoiceLabel:Rn.string,choicesLabel:Rn.string,errors:Rn.object,spellCheck:Rn.bool}}__init(){this.state={warning:{open:!1}}}constructor(e){super(e),Bn.prototype.__init.call(this),this.onChoiceChange=e=>{const{choices:t,onChange:n,correctResponse:r}=this.props,i=t.findIndex(t=>t.id===e.id);t.splice(i,1,{...t[i],label:e.label}),n(t,r)},this.onDelete=e=>{const{choices:t,onChange:n,correctResponse:r,choicesLabel:i}=this.props;t&&3===t.length?this.setState({warning:{open:!0,text:`There have to be at least 3 ${i}.`}}):n(t.filter(t=>t.id!==e.id),r.filter(t=>t.id!==e.id))},this.addChoice=()=>{const{choices:e,correctResponse:t,onChange:n,choicesLabel:r}=this.props;if(e&&10===e.length)this.setState({warning:{open:!0,text:`There can be maximum 10 ${r}.`}});else{const r=function(e){let t=1;const n=e.map(e=>e.id);for(;n.includes(`c${t}`);)t++;return t}(e),i=`c${r}`,o={id:i,label:""},a={id:i,weight:0};n(e.concat([o]),t.concat([a]))}},this.shuffleChoices=()=>{const{onChange:e,choices:t,correctResponse:n,placementArea:r}=this.props;let i=Tn(t);!r&&In(i.map(e=>e.id),n.map(e=>e.id))?e(Tn(i),n):e(i,n)}}render(){const{correctResponse:e,choices:t,imageSupport:n,toolbarOpts:r,pluginProps:i,singularChoiceLabel:o,pluralChoiceLabel:a,choicesLabel:l,spellCheck:s,maxImageWidth:c,maxImageHeight:d,errors:u,mathMlOptions:h={},ordering:g}=this.props,{warning:p}=this.state,{choicesErrors:m,orderError:f}=u||{},b={gridTemplateColumns:"repeat(2, 1fr)",gridTemplateRows:`repeat(${t.length}, 1fr)`};return $n.createElement("div",null,$n.createElement(jn,{style:{gridTemplateColumns:"repeat(2, 1fr)"}},$n.createElement(zn,{label:`Student ${l||"Choices"}`}),$n.createElement(zn,{label:"Correct Order"})),$n.createElement(jn,{style:b},g.tiles.map((e,o)=>$n.createElement(Dn,{key:`${e.type}-${e.id}`,choice:e,index:o,imageSupport:n,onDelete:this.onDelete.bind(this,e),onChoiceChange:this.onChoiceChange,toolbarOpts:r,pluginProps:i,choices:t,choicesLabel:l,spellCheck:s,maxImageWidth:c,maxImageHeight:d,error:On([m,"optionalAccess",t=>t[e.id]])||f&&" "||null,mathMlOptions:h}))),f&&$n.createElement(Wn,null,f),$n.createElement(Mn,null,$n.createElement(Nn,{onClick:this.shuffleChoices,size:"small",variant:"contained"},`SHUFFLE ${a}`.toUpperCase()),$n.createElement(Nn,{onClick:this.addChoice,size:"small",variant:"contained"},`ADD ${o}`.toUpperCase())),$n.createElement(Pn,{open:p.open,title:"Warning",text:p.text,onConfirm:()=>this.setState({warning:{open:!1}})}))}}Bn.__initStatic();const{cloneDeep:Hn}=s;function Fn(e,t){return"target"===e.type?t.response.findIndex(t=>t.id===e.id):"choice"===e.type?t.choices.findIndex(t=>t.id===e.id):-1}function qn(e,t){const n=t.map((t,n)=>{const r=t&&t.id;return{type:"target",...e.find(e=>null!=r&&e.id===r),draggable:!0,index:n,editable:!1}});return e.map(e=>Object.assign({},e,{type:"choice",droppable:!1,draggable:!0,editable:!0})).concat(n)}const Un=e,Yn=n,Xn=r,{cloneDeep:Kn}=s,{isEmpty:Gn}=s,{styled:Jn}=a,{Info:Vn}=o,{Tooltip:Qn}=i,{FeedbackConfig:Zn}=c,{FormSection:er}=c,{InputContainer:tr}=c,{settings:nr}=c,{layout:rr}=c,ir=d,{DragProvider:or}=u;function ar(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}const lr=Xn("@pie-element:placement-ordering:design"),{Panel:sr,toggle:cr,radio:dr,dropdown:ur}=nr,hr=Jn(tr)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),gr=Jn("div")({display:"grid",gridAutoFlow:"column",gridAutoColumns:"1fr",gridGap:"8px"}),pr=Jn(er)(({theme:e})=>({marginTop:0,marginBottom:e.spacing(2.5)})),mr=Jn("div")({display:"inline-flex",position:"absolute"}),fr=Jn("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class br extends Un.Component{static __initStatic(){this.propTypes={uploadSoundSupport:Yn.object}}static __initStatic2(){this.defaultProps={}}constructor(e){super(e),br.prototype.__init.call(this),this.applyUpdate=e=>{const{model:t,onModelChanged:n}=this.props;n(e(Kn(t)))},this.changeHandler=(e,t)=>n=>{lr("[changeHandler] value: ",n);const r=t?S(n,t):n;this.applyUpdate(t=>(E(t,e,r),t))},this.onPromptChange=this.changeHandler("prompt"),this.onTeacherInstructionsChange=this.changeHandler("teacherInstructions"),this.onRationaleChange=this.changeHandler("rationale"),this.onChoiceAreaLabelChange=this.changeHandler("choiceLabel","target.value"),this.onAnswerAreaLabelChange=this.changeHandler("targetLabel","target.value"),this.onFeedbackChange=this.changeHandler("feedback"),this.onChoiceEditorChange=(e,t)=>{const{model:n,onModelChanged:r}=this.props,i=Kn(n);i.choices=e,i.correctResponse=t,r(i)}}componentDidMount(){const{model:e,onModelChanged:t}=this.props||{},{feedback:n}=e||{},r=Kn(e);n||(r.feedbackEnabled=!1,t(r))}__init(){this.onDragEnd=(e,t)=>{const{active:n,over:r}=e;if(!r||!n)return;const i=r.data.current,o=n.data.current,a=t.tiles.find(e=>e.id===o.id&&e.type===o.type),l=i,s={...a,index:Fn(a,t)},c={...l,index:Fn(l,t)},{response:d,choices:u}=function(e,t,n,r){const{type:i,index:o}=n,{type:a,index:l}=r;if("target"===i&&"target"===a){const n=Hn(e)||[],{movedItem:r,remainingItems:i}=n.reduce((e,t,n)=>(n===o?e.movedItem=t:e.remainingItems.push(t),e),{movedItem:null,remainingItems:[]});return{response:[...i.slice(0,l),r,...i.slice(l)],choices:t}}if("choice"===i&&"choice"===a){const i=Hn(t)||[],{movedItem:o,remainingItems:a,toIndex:l}=i.reduce((e,t,i)=>(t.id===n.id?e.movedItem=t:e.remainingItems.push(t),t.id===r.id&&(e.toIndex=i),e),{movedItem:null,remainingItems:[],toIndex:null});return{response:e,choices:[...a.slice(0,l),o,...a.slice(l)]}}return{response:e,choices:t}}(t.response,t.choices,s,c);this.onChoiceEditorChange(u,d)}}render(){const{model:e,imageSupport:t,uploadSoundSupport:n,onModelChanged:r,configuration:i,onConfigurationChanged:o}=this.props,{baseInputConfiguration:a={},choiceLabel:l={},choices:s={},contentDimensions:c={},feedback:d={},prompt:u={},placementArea:h={},maxImageWidth:g={},maxImageHeight:p={},numberedGuides:m={},orientation:f={},partialScoring:b={},rationale:v={},removeTilesAfterPlacing:y={},settingsPanelDisabled:w,studentInstructions:C={},spellCheck:x={},scoringType:E={},targetLabel:S={},teacherInstructions:D={},withRubric:$={},mathMlOptions:A={},language:T={},languageChoices:I={}}=i||{},{choiceLabelEnabled:k,errors:_,extraCSSRules:L,feedbackEnabled:P,promptEnabled:O,rationaleEnabled:M,spellCheckEnabled:N,teacherInstructionsEnabled:j,toolbarEditorPosition:z,correctResponse:W}=e||{},{prompt:B,rationale:H,teacherInstructions:F}=_||{},q={choices:e.choices,response:!W||Gn(W)?new Array(e.choices.length):W,tiles:qn(e.choices,W)},{singularLabel:U="",pluralLabel:Y=""}=ar([s,"optionalAccess",e=>e.label])&&(X=s.label,R.isPlural(X)?{singularLabel:R.singular(X),pluralLabel:X}:{singularLabel:X,pluralLabel:R(X)})||{};var X;const K=g&&g.prompt,G=p&&p.prompt,J=g&&e.placementArea?g.choicesWithPlacementArea:g.choicesWithoutPlacementArea||K,V=p&&p.choices||G,Q={position:"top"===z?"top":"bottom"},Z={choiceLabelEnabled:l.settings&&cr(l.label),placementArea:h.settings&&cr(h.label),numberedGuides:m.settings&&e.placementArea&&cr(m.label),orientation:f.settings&&dr(f.label,["vertical","horizontal"]),removeTilesAfterPlacing:y.settings&&cr(y.label),partialScoring:b.settings&&cr(b.label),feedbackEnabled:d.settings&&cr(d.label),"language.enabled":T.settings&&cr(T.label,!0),language:T.settings&&T.enabled&&ur(I.label,I.options)},ee={teacherInstructionsEnabled:D.settings&&cr(D.label),studentInstructionsEnabled:C.settings&&cr(C.label),rationaleEnabled:v.settings&&cr(v.label),promptEnabled:u.settings&&cr(u.label),spellCheckEnabled:x.settings&&cr(x.label),scoringType:E.settings&&dr(E.label,["auto","rubric"]),rubricEnabled:ar([$,"optionalAccess",e=>e.settings])&&cr(ar([$,"optionalAccess",e=>e.label]))},te=(e={})=>({...a,...e});return Un.createElement(or,{onDragEnd:e=>this.onDragEnd(e,q)},Un.createElement(rr.ConfigLayout,{extraCSSRules:L,dimensions:c,hideSettings:w,settings:Un.createElement(sr,{model:e,configuration:i,onChangeModel:e=>r(e),onChangeConfiguration:e=>o(e,!0),groups:{Settings:Z,Properties:ee}})},j&&Un.createElement(hr,{label:D.label},Un.createElement(ir,{className:"prompt",markup:e.teacherInstructions||"",onChange:this.onTeacherInstructionsChange,imageSupport:t,nonEmpty:!1,error:F,toolbarOpts:Q,pluginProps:te(ar([D,"optionalAccess",e=>e.inputConfiguration])),spellCheck:N,maxImageWidth:g&&g.teacherInstructions||K,maxImageHeight:p&&p.teacherInstructions||G,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:A}),F&&Un.createElement("div",{className:"errorText"},F)),O&&Un.createElement(hr,{label:u&&u.label},Un.createElement(ir,{className:"prompt",markup:e.prompt,onChange:this.onPromptChange,imageSupport:t,error:B,toolbarOpts:Q,pluginProps:te(ar([u,"optionalAccess",e=>e.inputConfiguration])),spellCheck:N,maxImageWidth:g&&g.prompt,maxImageHeight:p&&p.prompt,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:A}),B&&Un.createElement("div",{className:"errorText"},B)),Un.createElement(pr,{label:`Define ${Y}`,labelExtraStyle:{display:"inline-flex"}},Un.createElement(mr,null,Un.createElement(Qn,{slotProps:{tooltip:{sx:{fontSize:14,whiteSpace:"pre",maxWidth:"500px"}}},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:"Validation requirements:\nThere should be at least 3 tokens.\nThe tokens should not be empty and should be unique.\nThe correct ordering should not be identical to the initial ordering."},Un.createElement(Vn,{fontSize:"small",color:"primary",style:{marginLeft:"8px"}}))),Un.createElement(gr,null,k&&Un.createElement(hr,{label:l&&l.label&&`${U} label`},Un.createElement(ir,{...e.placementArea&&{autoWidthToolbar:!0},className:"prompt",markup:e.choiceLabel,onChange:this.onChoiceAreaLabelChange,toolbarOpts:Q,pluginProps:te(ar([l,"optionalAccess",e=>e.inputConfiguration])),spellCheck:N,maxImageWidth:J,maxImageHeight:V,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:A})),S.settings&&e.placementArea&&Un.createElement(hr,{label:S&&S.label&&S.label},Un.createElement(ir,{autoWidthToolbar:!0,className:"prompt",markup:e.targetLabel,onChange:this.onAnswerAreaLabelChange,toolbarOpts:Q,spellCheck:N,maxImageWidth:g&&g.choicesWithPlacementArea||K,maxImageHeight:V,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:A}))),s.settings&&Un.createElement(Bn,{correctResponse:W,choices:e.choices,onChange:this.onChoiceEditorChange,imageSupport:t,toolbarOpts:Q,pluginProps:te(ar([s,"optionalAccess",e=>e.inputConfiguration])),choicesLabel:s.label,placementArea:e.placementArea,singularChoiceLabel:U,pluralChoiceLabel:Y,spellCheck:N,maxImageWidth:J,maxImageHeight:V,errors:_||{},mathMlOptions:A,ordering:q})),M&&Un.createElement(hr,{label:v.label},Un.createElement(ir,{className:"prompt",markup:e.rationale||"",onChange:this.onRationaleChange,imageSupport:t,error:H,toolbarOpts:Q,pluginProps:te(ar([v,"optionalAccess",e=>e.inputConfiguration])),spellCheck:N,maxImageWidth:g&&g.rationale||K,maxImageHeight:p&&p.rationale||G,uploadSoundSupport:n,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:A}),H&&Un.createElement(fr,null,H)),P&&Un.createElement(Zn,{feedback:e.feedback,onChange:this.onFeedbackChange,imageSupport:t,toolbarOpts:Q})))}}br.__initStatic(),br.__initStatic2(),br.defaultProps={onModelChanged:()=>{},onConfigurationChanged:()=>{}},br.propTypes={model:Yn.object.isRequired,configuration:Yn.object.isRequired,onModelChanged:Yn.func,onConfigurationChanged:Yn.func,imageSupport:Yn.object};var vr,yr=t;vr=yr.createRoot,yr.hydrateRoot;var wr={choiceLabel:"",choiceLabelEnabled:!0,choices:[],correctResponse:[],feedbackEnabled:!1,numberedGuides:!1,orientation:"vertical",partialScoring:!0,placementArea:!1,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,removeTilesAfterPlacing:!0,scoringType:"auto",studentInstructionsEnabled:!0,targetLabel:"",teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom"},Cr={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choiceLabel:{settings:!0,label:"Choice label",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},choices:{settings:!0,label:"Choices",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0}}},feedback:{settings:!0,label:"Feedback",enabled:!0},prompt:{settings:!0,label:"Item Stem",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},numberedGuides:{settings:!0,label:"Numbered guides"},orientation:{settings:!0,label:"Orientation"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},placementArea:{settings:!0,label:"Placement Area"},rationale:{settings:!0,label:"Rationale",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},removeTilesAfterPlacing:{settings:!1,label:"Remove Tiles after placing"},settingsPanelDisabled:!1,scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},targetLabel:{settings:!0,label:"Target label"},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300,choicesWithPlacementArea:240,choicesWithoutPlacementArea:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:150},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const xr=e,{defaults:Er}=s;function Sr(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}const Dr=(e,t)=>({configuration:Er(e,Cr),model:t}),Rr=e=>e&&e.map(e=>void 0!==e.weight?{id:e.id,weight:e.weight}:{id:e.id||e,weight:0});class $r extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{let t=Rr(e.correctResponse)||(n=e.choices)&&n.map(e=>({id:e.id,weight:0}));var n;const r={...wr,...e};return t&&(r.correctResponse=t),r}}constructor(){super(),this._root=null,this._model=$r.createDefaultModel(),this._configuration=Cr,this.onModelChanged=(e,t)=>{this._model=e,this._rerender(),this.dispatchUpdate(t)},this.onConfigurationChanged=e=>{this._configuration=Dr(e).configuration,this.onModelChanged(this._model),this._rerender()},this.insertImage=e=>{this.dispatchEvent(new v(e))},this.deleteImage=(e,t)=>{this.dispatchEvent(new f(e,t))}}dispatchUpdate(e){this.dispatchEvent(new p(this._model,e))}set model(e){this._model=$r.createDefaultModel(e),this._rerender()}set configuration(e){const t=Dr(e,this._model);this.onModelChanged(t.model);const n={...Cr,...t.configuration};this._configuration=n,Sr([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Sr([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Sr([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._rerender()}insertSound(e){this.dispatchEvent(new x(e))}onDeleteSound(e,t){this.dispatchEvent(new w(e,t))}_rerender(){let e=xr.createElement(br,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,imageSupport:{add:this.insertImage,delete:this.deleteImage},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=vr(this)),this._root.render(e)}disconnectedCallback(){this._root&&this._root.unmount()}}$r.__initStatic();export{Rr as addWeightToCorrectResponse,$r as default};
|