@pie-element/inline-dropdown 10.1.2-next.0 → 10.1.2-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/index.js +15 -15
- package/dist/author/inline-dropdown-toolbar.js +36 -37
- package/dist/author/main.js +92 -97
- package/dist/author/markupUtils.js +1 -1
- package/dist/browser/{Close-CMvmRhfL.js → Close-ihSzAQyP.js} +2159 -2143
- package/dist/browser/Close-ihSzAQyP.js.map +1 -0
- package/dist/browser/author/index.js +6136 -6742
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +78 -97
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +19 -19
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/dist-CAsDMEWi.js +133 -0
- package/dist/browser/dist-CAsDMEWi.js.map +1 -0
- package/dist/controller/index.d.ts +1 -1
- package/dist/controller/index.js +36 -38
- package/dist/controller/utils.js +1 -1
- package/dist/delivery/inline-dropdown.js +22 -22
- package/dist/index.iife.js +34 -34
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +13 -10
- package/dist/browser/Close-CMvmRhfL.js.map +0 -1
- package/dist/browser/isEmpty-BAznrYT5.js +0 -433
- package/dist/browser/isEmpty-BAznrYT5.js.map +0 -1
- package/dist/browser/reduce-2sGcZtv4.js +0 -446
- package/dist/browser/reduce-2sGcZtv4.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseExtremum.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGt.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js +0 -26
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castFunction.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_escapeHtmlChar.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js +0 -18
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/escape.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/forEach.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/map.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/max.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/property.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
|
@@ -1,36 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i, n as a, r as o, t as s, y as c } from "../reduce-2sGcZtv4.js";
|
|
3
|
-
//#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/forEach.js
|
|
4
|
-
function l(e, n) {
|
|
5
|
-
return (t(e) ? c : o)(e, a(n));
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js
|
|
9
|
-
function u(e, t) {
|
|
10
|
-
var r = -1, i = n(e) ? Array(e.length) : [];
|
|
11
|
-
return o(e, function(e, n, a) {
|
|
12
|
-
i[++r] = t(e, n, a);
|
|
13
|
-
}), i;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/map.js
|
|
17
|
-
function d(n, r) {
|
|
18
|
-
return (t(n) ? e : u)(n, i(r, 3));
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
1
|
+
import { l as e, o as t, r as n, s as r } from "../dist-CAsDMEWi.js";
|
|
21
2
|
//#region ../../shared/controller-utils/dist/index.js
|
|
22
|
-
var
|
|
3
|
+
var i = Object.defineProperty, a = (e, t) => {
|
|
23
4
|
let n = {};
|
|
24
|
-
for (var r in e)
|
|
5
|
+
for (var r in e) i(n, r, {
|
|
25
6
|
get: e[r],
|
|
26
7
|
enumerable: !0
|
|
27
8
|
});
|
|
28
|
-
return t ||
|
|
9
|
+
return t || i(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
29
10
|
};
|
|
30
|
-
function
|
|
11
|
+
function o(e) {
|
|
31
12
|
return Array.isArray(e) ? e.filter((e) => e != null) : [];
|
|
32
13
|
}
|
|
33
|
-
function
|
|
14
|
+
function s(e) {
|
|
34
15
|
let t = [...e];
|
|
35
16
|
for (let e = t.length - 1; e > 0; e--) {
|
|
36
17
|
let n = Math.floor(Math.random() * (e + 1));
|
|
@@ -38,36 +19,36 @@ function h(e) {
|
|
|
38
19
|
}
|
|
39
20
|
return t;
|
|
40
21
|
}
|
|
41
|
-
function
|
|
22
|
+
function c(e) {
|
|
42
23
|
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
|
|
43
24
|
}
|
|
44
|
-
async function
|
|
45
|
-
let i =
|
|
25
|
+
async function l(e, t, n, r = "value") {
|
|
26
|
+
let i = o(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);
|
|
46
27
|
if (!t) {
|
|
47
28
|
console.warn("Unable to save shuffled choices because there's no session.");
|
|
48
29
|
return;
|
|
49
30
|
}
|
|
50
|
-
if (!
|
|
51
|
-
let a =
|
|
31
|
+
if (!c(i)) return o(i.map((t) => e.find((e) => e[r] === t)));
|
|
32
|
+
let a = s(e);
|
|
52
33
|
if (n && typeof n == "function") try {
|
|
53
|
-
let e =
|
|
54
|
-
|
|
34
|
+
let e = o(a.map((e) => e[r]));
|
|
35
|
+
c(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(a)}, key: ${r}`) : t.id && t.element && await n(t.id, t.element, { shuffledValues: e });
|
|
55
36
|
} catch (e) {
|
|
56
37
|
console.warn("Unable to save shuffled order for choices"), console.error(e);
|
|
57
38
|
}
|
|
58
39
|
else console.warn("Unable to save shuffled choices, shuffle will happen every time.");
|
|
59
40
|
return a;
|
|
60
41
|
}
|
|
61
|
-
function
|
|
42
|
+
function u(e, t, n) {
|
|
62
43
|
return !!(e.lockChoiceOrder || n["@pie-element"]?.lockChoiceOrder || (n.role ?? "student") === "instructor");
|
|
63
44
|
}
|
|
64
|
-
var
|
|
65
|
-
function
|
|
45
|
+
var d = /* @__PURE__ */ a({ enabled: () => f });
|
|
46
|
+
function f(e, t, n) {
|
|
66
47
|
return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == "boolean" ? n : !0;
|
|
67
48
|
}
|
|
68
49
|
//#endregion
|
|
69
50
|
//#region src/controller/defaults.ts
|
|
70
|
-
var
|
|
51
|
+
var p = {
|
|
71
52
|
alternateResponse: {},
|
|
72
53
|
choiceRationaleEnabled: !0,
|
|
73
54
|
choices: {},
|
|
@@ -84,77 +65,77 @@ var x = {
|
|
|
84
65
|
teacherInstructions: "",
|
|
85
66
|
teacherInstructionsEnabled: !0,
|
|
86
67
|
toolbarEditorPosition: "bottom"
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
let
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
e.correct && (
|
|
68
|
+
}, m = ({ choices: t, alternateResponse: n }) => {
|
|
69
|
+
n ||= {};
|
|
70
|
+
let r = {};
|
|
71
|
+
return e(t, (e, t) => {
|
|
72
|
+
r[t] || (r[t] = []), e && e.forEach((e) => {
|
|
73
|
+
e.correct && (r[t].push(e.value), n[t] && (r[t] = [...r[t], ...n[t]]));
|
|
93
74
|
});
|
|
94
|
-
}),
|
|
95
|
-
},
|
|
96
|
-
...
|
|
75
|
+
}), r;
|
|
76
|
+
}, h = (e) => e ? "correct" : "incorrect", g = (e) => ({
|
|
77
|
+
...p,
|
|
97
78
|
...e
|
|
98
79
|
});
|
|
99
|
-
async function
|
|
100
|
-
let
|
|
101
|
-
if (
|
|
102
|
-
let e =
|
|
103
|
-
for (let
|
|
104
|
-
let
|
|
105
|
-
let
|
|
106
|
-
return e.feedback[n] =
|
|
80
|
+
async function _(e, i, a, o) {
|
|
81
|
+
let s = g(e), { value: c = {} } = i || {}, d = n(s.choices, (e, t, n) => (e[n] = r(t, (e) => e), e), {}), f = {};
|
|
82
|
+
if (a.mode === "evaluate") {
|
|
83
|
+
let e = m(s), t = Object.keys(e).length, r = 0;
|
|
84
|
+
for (let i = 0; i < t; i++) {
|
|
85
|
+
let a = n(e, (e, t, n) => {
|
|
86
|
+
let r = c && c[n] || "", a = t[i] || "", o = r && a && a === r;
|
|
87
|
+
return e.feedback[n] = h(o), o && (e.correctResponses += 1), e;
|
|
107
88
|
}, {
|
|
108
89
|
correctResponses: 0,
|
|
109
90
|
feedback: {}
|
|
110
91
|
});
|
|
111
|
-
if (
|
|
92
|
+
if (a.correctResponses >= r && (r = a.correctResponses, f = a.feedback), a.correctResponses === t) break;
|
|
112
93
|
}
|
|
113
94
|
}
|
|
114
|
-
if (!
|
|
115
|
-
let e = {}, n = Object.keys(
|
|
95
|
+
if (!u(s, i, a)) {
|
|
96
|
+
let e = {}, n = Object.keys(d), r = (t) => (n, r, i) => new Promise((n) => {
|
|
116
97
|
e[t] = i.shuffledValues, n();
|
|
117
|
-
}),
|
|
118
|
-
for (
|
|
119
|
-
let e = n[
|
|
120
|
-
|
|
98
|
+
}), a;
|
|
99
|
+
for (a = 0; a < n.length; a++) {
|
|
100
|
+
let e = n[a], t = i?.shuffledValues?.[e];
|
|
101
|
+
d[e] = await l(d[e], { shuffledValues: Array.isArray(t) ? t : [] }, r(e), "value");
|
|
121
102
|
}
|
|
122
|
-
|
|
103
|
+
t(e) || i && o && typeof o == "function" && o(i.id, i.element, { shuffledValues: e }).catch((e) => {
|
|
123
104
|
console.error("update session failed", e);
|
|
124
105
|
});
|
|
125
106
|
}
|
|
126
|
-
let
|
|
107
|
+
let p = null, _ = null, y = (Object.keys(d) || []).reduce((e, t) => (e[t] = (d[t] || []).map((e) => ({
|
|
127
108
|
...e,
|
|
128
109
|
rationale: null
|
|
129
110
|
})), e), {});
|
|
130
|
-
return
|
|
131
|
-
disabled:
|
|
132
|
-
mode:
|
|
133
|
-
prompt:
|
|
134
|
-
displayType:
|
|
135
|
-
markup:
|
|
136
|
-
choices:
|
|
137
|
-
feedback:
|
|
138
|
-
responseCorrect:
|
|
139
|
-
rationale:
|
|
140
|
-
teacherInstructions:
|
|
141
|
-
language:
|
|
142
|
-
extraCSSRules:
|
|
111
|
+
return a.role === "instructor" && (a.mode === "view" || a.mode === "evaluate") ? (_ = s.rationaleEnabled ? s.rationale : null, p = s.teacherInstructionsEnabled ? s.teacherInstructions : null, d = s.choiceRationaleEnabled ? s.choices : y) : (_ = null, p = null, d = y), {
|
|
112
|
+
disabled: a.mode !== "gather",
|
|
113
|
+
mode: a.mode,
|
|
114
|
+
prompt: s.promptEnabled ? s.prompt : null,
|
|
115
|
+
displayType: s.displayType,
|
|
116
|
+
markup: s.markup,
|
|
117
|
+
choices: d,
|
|
118
|
+
feedback: f,
|
|
119
|
+
responseCorrect: a.mode === "evaluate" ? v(s, i) === 1 : void 0,
|
|
120
|
+
rationale: _,
|
|
121
|
+
teacherInstructions: p,
|
|
122
|
+
language: s.language,
|
|
123
|
+
extraCSSRules: s.extraCSSRules
|
|
143
124
|
};
|
|
144
125
|
}
|
|
145
|
-
var
|
|
146
|
-
let { value:
|
|
147
|
-
for (let e = 0; e <
|
|
148
|
-
let t =
|
|
149
|
-
let a =
|
|
126
|
+
var v = (e, t) => {
|
|
127
|
+
let { value: r = {} } = t || {}, i = e && e.choices ? Object.keys(e.choices).length : 0, a = m(e), o = 0;
|
|
128
|
+
for (let e = 0; e < i; e++) {
|
|
129
|
+
let t = n(a, (t, n, i) => {
|
|
130
|
+
let a = r && r[i] || "", o = n[e] || "";
|
|
150
131
|
return o && a && o === a ? t : t - 1;
|
|
151
|
-
},
|
|
152
|
-
if (t >
|
|
132
|
+
}, i);
|
|
133
|
+
if (t > o && (o = t), t === i) break;
|
|
153
134
|
}
|
|
154
|
-
let
|
|
155
|
-
return parseFloat(
|
|
156
|
-
},
|
|
157
|
-
let r = [], { value: i = {} } = t || {}, a =
|
|
135
|
+
let s = (o / i).toFixed(2);
|
|
136
|
+
return parseFloat(s);
|
|
137
|
+
}, y = (e, t, n) => {
|
|
138
|
+
let r = [], { value: i = {} } = t || {}, a = m(e), o = Object.keys(a), s = o.length;
|
|
158
139
|
if (r.push(`${s} dropdown response area(s) defined in this question.`), i && Object.keys(i).length > 0) {
|
|
159
140
|
let e = Object.entries(i).filter(([e, t]) => t && t.trim()).length;
|
|
160
141
|
r.push(`Student selected options in ${e} out of ${s} dropdown(s).`), o.forEach((e) => {
|
|
@@ -162,29 +143,29 @@ var E = (e, t) => {
|
|
|
162
143
|
t.trim() ? r.push(`Dropdown ${parseInt(e) + 1}: student selected '${t}' (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`) : r.push(`Dropdown ${parseInt(e) + 1}: no selection made (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`);
|
|
163
144
|
});
|
|
164
145
|
} else r.push("Student did not make any selections in the dropdowns.");
|
|
165
|
-
let c =
|
|
146
|
+
let c = d.enabled(e, n);
|
|
166
147
|
r.push(`Scoring method: ${c ? "partial scoring" : "all-or-nothing scoring"}.`);
|
|
167
|
-
let l =
|
|
148
|
+
let l = v(e, t);
|
|
168
149
|
return r.push(`Final score: ${l}.`), r;
|
|
169
150
|
};
|
|
170
|
-
function
|
|
151
|
+
function b(e, n, r = {}) {
|
|
171
152
|
return new Promise((i) => {
|
|
172
|
-
if (!
|
|
153
|
+
if (!n || t(n)) i({
|
|
173
154
|
score: 0,
|
|
174
155
|
empty: !0,
|
|
175
156
|
traceLog: ["Student did not make any selections in the dropdowns. Score is 0."]
|
|
176
157
|
});
|
|
177
158
|
else {
|
|
178
|
-
let
|
|
159
|
+
let t = y(e, n, r), a = v(e, n);
|
|
179
160
|
i({
|
|
180
|
-
score:
|
|
161
|
+
score: d.enabled(e, r) ? a : Math.floor(a),
|
|
181
162
|
empty: !1,
|
|
182
|
-
traceLog:
|
|
163
|
+
traceLog: t
|
|
183
164
|
});
|
|
184
165
|
}
|
|
185
166
|
});
|
|
186
167
|
}
|
|
187
|
-
var
|
|
168
|
+
var x = (e, t) => new Promise((n) => {
|
|
188
169
|
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
189
170
|
let { choices: t } = e, r = {};
|
|
190
171
|
t && Object.keys(t).forEach((e, n) => {
|
|
@@ -195,14 +176,14 @@ var k = (e, t) => new Promise((n) => {
|
|
|
195
176
|
value: r
|
|
196
177
|
});
|
|
197
178
|
} else n(null);
|
|
198
|
-
}),
|
|
179
|
+
}), S = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), C = (e = {}, t = {}) => {
|
|
199
180
|
let { markup: n, choices: r } = e, { maxResponseAreas: i, maxResponseAreaChoices: a } = t, o = {};
|
|
200
181
|
[
|
|
201
182
|
"teacherInstructions",
|
|
202
183
|
"prompt",
|
|
203
184
|
"rationale"
|
|
204
185
|
].forEach((n) => {
|
|
205
|
-
t[n]?.required && !
|
|
186
|
+
t[n]?.required && !S(e[n]) && (o[n] = "This field is required.");
|
|
206
187
|
});
|
|
207
188
|
let s = ((n || "").match(/\{\{(\d+)\}\}/g) || []).length;
|
|
208
189
|
return s > i ? o.responseAreasError = `No more than ${i} response areas should be defined.` : s < 1 && (o.responseAreasError = "There should be defined at least 1 response area."), (Object.keys(r) || []).forEach((e) => {
|
|
@@ -210,6 +191,6 @@ var k = (e, t) => new Promise((n) => {
|
|
|
210
191
|
}), o;
|
|
211
192
|
};
|
|
212
193
|
//#endregion
|
|
213
|
-
export {
|
|
194
|
+
export { x as createCorrectResponseSession, y as getLogTrace, v as getScore, _ as model, g as normalize, b as outcome, C as validate };
|
|
214
195
|
|
|
215
196
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/forEach.js","../../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js","../../../../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/map.js","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["import arrayEach from './_arrayEach.js';\nimport baseEach from './_baseEach.js';\nimport castFunction from './_castFunction.js';\nimport isArray from './isArray.js';\n\n/**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, castFunction(iteratee));\n}\n\nexport default forEach;\n","import baseEach from './_baseEach.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nexport default baseMap;\n","import arrayMap from './_arrayMap.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseMap from './_baseMap.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nexport default map;\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { forEach } from 'lodash-es';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty, map, reduce } from 'lodash-es';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;AAmCA,SAAS,EAAQ,GAAY,GAAU;CAErC,QADW,EAAQ,CAAU,IAAI,IAAY,GACjC,GAAY,EAAa,CAAQ,CAAC;AAChD;;;AC3BA,SAAS,EAAQ,GAAY,GAAU;CACrC,IAAI,IAAQ,IACR,IAAS,EAAY,CAAU,IAAI,MAAM,EAAW,MAAM,IAAI,CAAC;CAKnE,OAHA,EAAS,GAAY,SAAS,GAAO,GAAK,GAAY;EACpD,EAAO,EAAE,KAAS,EAAS,GAAO,GAAK,CAAU;CACnD,CAAC,GACM;AACT;;;AC4BA,SAAS,EAAI,GAAY,GAAU;CAEjC,QADW,EAAQ,CAAU,IAAI,IAAW,GAChC,GAAY,EAAa,GAAU,CAAC,CAAC;AACnD;;;ACjDA,IAAI,IAAI,OAAO,gBAAgB,KAAK,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAO,KAAK,EAAE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAG;AAC5D;AAGA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,KAAK,IAAI,IAAI,CAAC;AACzD;AACA,SAAS,EAAE,GAAG;CACb,IAAI,IAAI,CAAC,GAAG,CAAC;CACb,KAAK,IAAI,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,KAAK;EACtC,IAAI,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,EAAE;EAC1C,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE;CAC3B;CACA,OA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ACxD,IAAM,EAAE,eAAY,GACd,IAAQ,CAAC;EAUf,AARI,KACF,OAAO,KAAK,CAAO,EAAE,SAAS,GAAK,MAAM;GACvC,IAAM,IAAiB,EAAQ,MAAQ,EAAQ,GAAK,QAAQ,MAAM,EAAE,OAAO;GAE3E,EAAM,KAAK,KAAkB,EAAe,GAAG;EACjD,CAAC,GAGH,EAAQ;GACN,IAAI;GACJ;EACF,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAOG,KAAc,OAAU,KAAQ,IAAI,QAAQ,sCAAsC,EAAE,GAE7E,KAAY,IAAQ,CAAC,GAAG,IAAS,CAAC,MAAM;CACnD,IAAM,EAAE,WAAQ,eAAY,GACtB,EAAE,qBAAkB,8BAA2B,GAC/C,IAAS,CAAC;CAEhB;EAAC;EAAuB;EAAU;CAAW,EAAE,SAAS,MAAU;EAChE,AAAI,EAAO,IAAQ,YAAY,CAAC,EAAW,EAAM,EAAM,MACrD,EAAO,KAAS;CAEpB,CAAC;CAED,IAAM,MAAsB,KAAU,IAAI,MAAM,gBAAgB,KAAK,CAAC,GAAG;CAczE,OAZI,IAAoB,IACtB,EAAO,qBAAqB,gBAAgB,EAAiB,sCACpD,IAAoB,MAC7B,EAAO,qBAAqB,uDAG7B,OAAO,KAAK,CAAO,KAAK,CAAC,GAAG,SAAS,MAAc;EAClD,AAAI,EAAQ,MAAc,EAAQ,GAAW,SAAS,MACpD,EAAO,2BAA2B,gBAAgB,EAAuB;CAE7E,CAAC,GAEM;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { forEach } from '@pie-element/shared-lodash';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/inline-dropdown/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAI,IAAI,OAAO,gBAAgB,KAAK,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,C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B,uDAG7B,OAAO,KAAK,CAAO,KAAK,CAAC,GAAG,SAAS,MAAc;EAClD,AAAI,EAAQ,MAAc,EAAQ,GAAW,SAAS,MACpD,EAAO,2BAA2B,gBAAgB,EAAuB;CAE7E,CAAC,GAEM;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ft as e, L as t, Nt as n, Rt as r, S as i, a, d as o, f as s, ft as c, ht as l, i as u, j as d, k as f, m as p, n as m, o as h, p as g, pt as _, t as v, v as y, w as b } from "../Close-ihSzAQyP.js";
|
|
2
|
+
import { _ as x, o as S } from "../dist-CAsDMEWi.js";
|
|
3
3
|
import C, { useRef as w } from "react";
|
|
4
4
|
import { createRoot as T } from "react-dom/client";
|
|
5
5
|
import E from "react-dom";
|
|
@@ -34,7 +34,7 @@ var te = class e extends CustomEvent {
|
|
|
34
34
|
}
|
|
35
35
|
}), this.component = t, this.complete = n;
|
|
36
36
|
}
|
|
37
|
-
}, k = /* @__PURE__ */ r(
|
|
37
|
+
}, k = /* @__PURE__ */ r(n(), 1), re = "height ease-in 300ms, opacity ease-in 300ms", ie = l("div")(() => ({
|
|
38
38
|
position: "relative",
|
|
39
39
|
height: 0,
|
|
40
40
|
overflow: "hidden",
|
|
@@ -2186,8 +2186,8 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
|
|
|
2186
2186
|
containerRef: k.default.oneOfType([k.default.func, k.default.shape({ current: k.default.instanceOf(Element) })])
|
|
2187
2187
|
};
|
|
2188
2188
|
componentDidMount() {
|
|
2189
|
-
let
|
|
2190
|
-
|
|
2189
|
+
let t = this.props.containerRef || this.internalContainerRef;
|
|
2190
|
+
t.current && typeof e == "function" && e(t.current);
|
|
2191
2191
|
}
|
|
2192
2192
|
handleChange = (e, t) => {
|
|
2193
2193
|
let n = {
|
|
@@ -2238,7 +2238,7 @@ var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:ma
|
|
|
2238
2238
|
renderChildren: t(this.props)
|
|
2239
2239
|
});
|
|
2240
2240
|
}
|
|
2241
|
-
}, sn =
|
|
2241
|
+
}, sn = t(/*#__PURE__*/ D("path", { d: "m7 10 5 5 5-5z" }), "ArrowDropDown"), cn = t(/*#__PURE__*/ D("path", { d: "m7 14 5-5 5 5z" }), "ArrowDropUp");
|
|
2242
2242
|
//#endregion
|
|
2243
2243
|
//#region ../../lib-react/mask-markup/dist/components/dropdown.js
|
|
2244
2244
|
function J(e) {
|
|
@@ -2384,17 +2384,17 @@ var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.
|
|
|
2384
2384
|
componentDidMount() {
|
|
2385
2385
|
this.hiddenRef.current && this.state.menuWidth === null && this.setState({ menuWidth: this.hiddenRef.current.clientWidth });
|
|
2386
2386
|
}
|
|
2387
|
-
componentDidUpdate(
|
|
2387
|
+
componentDidUpdate(t, n) {
|
|
2388
2388
|
let r = this.hiddenRef.current;
|
|
2389
|
-
if (!
|
|
2390
|
-
if (!
|
|
2391
|
-
let
|
|
2392
|
-
|
|
2389
|
+
if (!n.anchorEl && this.state.anchorEl && this.elementRefs.forEach((t) => {
|
|
2390
|
+
if (!t) return;
|
|
2391
|
+
let n = t.querySelector("[data-latex], [data-raw]"), r = t.querySelector("mjx-container"), i = t.querySelector("[data-math-handled=\"true\"]");
|
|
2392
|
+
n && (!i || !r) && e(t);
|
|
2393
2393
|
}), r) {
|
|
2394
|
-
let
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
}),
|
|
2394
|
+
let t = r.clientWidth;
|
|
2395
|
+
t !== this.state.menuWidth && (this.elementRefs.forEach((t) => {
|
|
2396
|
+
t && e(t);
|
|
2397
|
+
}), e(r), this.setState({ menuWidth: t }));
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
2400
|
handleClick = (e) => {
|
|
@@ -2606,7 +2606,7 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
|
|
|
2606
2606
|
S(e.feedback) && this.setState({ showCorrectAnswer: !1 });
|
|
2607
2607
|
}
|
|
2608
2608
|
componentDidUpdate() {
|
|
2609
|
-
|
|
2609
|
+
e(E.findDOMNode(this));
|
|
2610
2610
|
}
|
|
2611
2611
|
toggleShowCorrect = () => {
|
|
2612
2612
|
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
@@ -2675,7 +2675,7 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
|
|
|
2675
2675
|
}
|
|
2676
2676
|
_render = () => {
|
|
2677
2677
|
if (this._model && this._session) {
|
|
2678
|
-
let
|
|
2678
|
+
let t = C.createElement(Nn, {
|
|
2679
2679
|
model: this._model,
|
|
2680
2680
|
prompt: this._model.prompt,
|
|
2681
2681
|
rationale: this._model.rationale,
|
|
@@ -2690,8 +2690,8 @@ var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt"
|
|
|
2690
2690
|
language: this._model.language,
|
|
2691
2691
|
onChange: this.changeSession
|
|
2692
2692
|
});
|
|
2693
|
-
this.setLangAttribute(), this._root ||= T(this), this._root.render(
|
|
2694
|
-
|
|
2693
|
+
this.setLangAttribute(), this._root ||= T(this), this._root.render(t), queueMicrotask(() => {
|
|
2694
|
+
e(this);
|
|
2695
2695
|
});
|
|
2696
2696
|
}
|
|
2697
2697
|
};
|