@pie-element/categorize 12.0.0-next.42 → 12.0.0-next.43
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/package.json +4 -4
- package/module/configure.js +0 -1
- package/module/controller.js +0 -7951
- package/module/demo.js +0 -382
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -420
- package/module/print.html +0 -18
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "12.0.0-next.
|
|
7
|
+
"version": "12.0.0-next.43+4249fa78f",
|
|
8
8
|
"description": "",
|
|
9
9
|
"author": "pie framework developers",
|
|
10
10
|
"license": "ISC",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"debug": "^4.1.1",
|
|
26
26
|
"lodash": "^4.17.15",
|
|
27
27
|
"prop-types": "^15.6.1",
|
|
28
|
-
"react": "18.
|
|
29
|
-
"react-dom": "18.
|
|
28
|
+
"react": "18.3.1",
|
|
29
|
+
"react-dom": "18.3.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "4249fa78fc423ef0a8c89002b8f937c42b3478ea",
|
|
32
32
|
"scripts": {
|
|
33
33
|
"postpublish": "../../scripts/postpublish"
|
|
34
34
|
},
|
package/module/configure.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_dll_react_dom as e,_dll_react as t,_dll_debug as n,_dll_lodash as o,_dll_prop_types as i,_dll_mui__material_styles as r,_dll_mui__material as s,_dll_mui__icons_material as a,_dll_pie_lib__render_ui as l}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as c}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";import{_dll_pie_lib__config_ui as d}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as u}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";import{_dll_pie_lib__drag as p}from"../../../@pie-lib/drag-module@^3.0.5/module/index.js";var h,g=e;h=g.createRoot,g.hydrateRoot;var m={};Object.defineProperty(m,"__esModule",{value:!0});class f extends CustomEvent{constructor(e,t=!1){super(f.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}f.TYPE="model.updated";var b=m.ModelUpdatedEvent=f;class v extends CustomEvent{constructor(e,t){super(v.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}v.TYPE="delete.image";var y=m.DeleteImageEvent=v;class C extends CustomEvent{constructor(e){super(C.TYPE,{bubbles:!0,detail:e}),this.handler=e}}C.TYPE="insert.image";var x=m.InsertImageEvent=C;class w extends CustomEvent{constructor(e,t){super(w.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}w.TYPE="delete.sound";var S=m.DeleteSoundEvent=w;class R extends CustomEvent{constructor(e){super(R.TYPE,{bubbles:!0,detail:e}),this.handler=e}}R.TYPE="insert.sound";var E=m.InsertSoundEvent=R;const _=(e={},t={})=>({...t,...e}),{useMemo:k}=t,{useLayoutEffect:A}=t,{useEffect:O}=t,{useRef:L}=t,{useCallback:P}=t,D="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function I(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function M(e){return"nodeType"in e}function N(e){var t,n;return e?I(e)?e:M(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function T(e){const{Document:t}=N(e);return e instanceof t}function j(e){return!I(e)&&e instanceof N(e).HTMLElement}function $(e){return e instanceof N(e).SVGElement}function F(e){return e?I(e)?e.document:M(e)?T(e)?e:j(e)||$(e)?e.ownerDocument:document:document:document}const z=D?A:O;function H(e){const t=L(e);return z(()=>{t.current=e}),P(function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return null==t.current?void 0:t.current(...n)},[])}function q(e,t){void 0===t&&(t=[e]);const n=L(e);return z(()=>{n.current!==e&&(n.current=e)},t),n}function B(e,t){const n=L();return k(()=>{const t=e(n.current);return n.current=t,t},[...t])}function V(e){const t=H(e),n=L(null),o=P(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,o]}function W(e){const t=L();return O(()=>{t.current=e},[e]),t.current}let U={};function K(e,t){return k(()=>{if(t)return t;const n=null==U[e]?0:U[e]+1;return U[e]=n,e+"-"+n},[e,t])}function Y(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.reduce((t,n)=>{const o=Object.entries(n);for(const[n,i]of o){const o=t[n];null!=o&&(t[n]=o+e*i)}return t},{...t})}}const J=Y(1),X=Y(-1);function G(e){if(!e)return!1;const{KeyboardEvent:t}=N(e.target);return t&&e instanceof t}function Q(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=N(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:o}=e;return t+" "+n+"ms "+o}}}),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=t,{useState:oe}=t,{useCallback:ie}=t,re={display:"none"};function se(e){let{id:t,value:n}=e;return ne.createElement("div",{id:t,style:re},n)}function ae(e){let{id:t,announcement:n,ariaLiveType:o="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":o,"aria-atomic":!0},n)}const le=t,{createContext:ce}=t,{useContext:de}=t,{useEffect:ue}=t,{useState:pe}=t,{useCallback:he}=t,{useMemo:ge}=t,{useRef:me}=t,{memo:fe}=t,{useReducer:be}=t,{cloneElement:ve}=t,{forwardRef:ye}=t,{createPortal:Ce}=e,{unstable_batchedUpdates:xe}=e,we=ce(null),Se={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 "},Re={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 Ee(e){let{announcements:t=Re,container:n,hiddenTextDescribedById:o,screenReaderInstructions:i=Se}=e;const{announce:r,announcement:s}=function(){const[e,t]=oe("");return{announce:ie(e=>{null!=e&&t(e)},[]),announcement:e}}(),a=K("DndLiveRegion"),[l,c]=pe(!1);if(ue(()=>{c(!0)},[]),function(e){const t=de(we);ue(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(ge(()=>({onDragStart(e){let{active:n}=e;r(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&r(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;r(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;r(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;r(t.onDragCancel({active:n,over:o}))}}),[r,t])),!l)return null;const d=le.createElement(le.Fragment,null,le.createElement(se,{id:o,value:i.draggable}),le.createElement(ae,{id:a,announcement:s}));return n?Ce(d,n):d}var _e;function ke(){}!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"}(_e||(_e={}));const Ae=Object.freeze({x:0,y:0});function Oe(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 Le(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Pe(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),r=Math.min(t.top+t.height,e.top+e.height),s=i-o,a=r-n;if(o<i&&n<r){const n=t.width*t.height,o=e.width*e.height,i=s*a;return Number((i/(n+o-i)).toFixed(4))}return 0}const De=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const i=[];for(const e of o){const{id:o}=e,r=n.get(o);if(r){const n=Pe(r,t);n>0&&i.push({id:o,data:{droppableContainer:e,value:n}})}}return i.sort(Le)};function Ie(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ae}const Me=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];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 Ne(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 Te={ignoreTransform:!1};function je(e,t){void 0===t&&(t=Te);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=N(e).getComputedStyle(e);t&&(n=function(e,t,n){const o=Ne(t);if(!o)return e;const{scaleX:i,scaleY:r,x:s,y:a}=o,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-r)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,u=r?e.height/r:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,o))}const{top:o,left:i,width:r,height:s,bottom:a,right:l}=n;return{top:o,left:i,width:r,height:s,bottom:a,right:l}}function $e(e){return je(e,{ignoreTransform:!0})}function Fe(e,t){const n=[];return e?function o(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(T(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!j(i)||$(i))return n;if(n.includes(i))return n;const r=N(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=N(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const o=t[e];return"string"==typeof o&&n.test(o)})}(i,r)&&n.push(i),function(e,t){return void 0===t&&(t=N(e).getComputedStyle(e)),"fixed"===t.position}(i,r)?n:o(i.parentNode)}(e):n}function ze(e){const[t]=Fe(e,1);return null!=t?t:null}function He(e){return D&&e?I(e)?e:M(e)?T(e)||e===F(e).scrollingElement?window:j(e)?e:null:null:null}function qe(e){return I(e)?e.scrollX:e.scrollLeft}function Be(e){return I(e)?e.scrollY:e.scrollTop}function Ve(e){return{x:qe(e),y:Be(e)}}var We;function Ue(e){return!(!D||!e)&&e===document.scrollingElement}function Ke(e){const t={x:0,y:0},n=Ue(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=o.y,isRight:e.scrollLeft>=o.x,maxScroll:o,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(We||(We={}));const Ye={x:.2,y:.2};function Je(e,t,n,o,i){let{top:r,left:s,right:a,bottom:l}=n;void 0===o&&(o=10),void 0===i&&(i=Ye);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=Ke(e),h={x:0,y:0},g={x:0,y:0},m=t.height*i.y,f=t.width*i.x;return!c&&r<=t.top+m?(h.y=We.Backward,g.y=o*Math.abs((t.top+m-r)/m)):!d&&l>=t.bottom-m&&(h.y=We.Forward,g.y=o*Math.abs((t.bottom-m-l)/m)),!p&&a>=t.right-f?(h.x=We.Forward,g.x=o*Math.abs((t.right-f-a)/f)):!u&&s<=t.left+f&&(h.x=We.Backward,g.x=o*Math.abs((t.left+f-s)/f)),{direction:h,speed:g}}function Xe(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:o,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ge(e){return e.reduce((e,t)=>J(e,Ve(t)),Ae)}function Qe(e,t){if(void 0===t&&(t=je),!e)return;const{top:n,left:o,bottom:i,right:r}=t(e);ze(e)&&(i<=0||r<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ze=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+qe(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Be(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=Fe(t),o=Ge(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Ze)for(const r of t)Object.defineProperty(this,r,{get:()=>{const t=i(n),s=o[e]-t;return this.rect[r]+s},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 o;null==(o=this.target)||o.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function nt(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t&&o>t.y}var ot,it;function rt(e){e.preventDefault()}function st(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"}(ot||(ot={})),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 at={start:[it.Space,it.Enter],cancel:[it.Esc],end:[it.Space,it.Enter,it.Tab]},lt=(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(F(t)),this.windowListeners=new tt(N(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ot.Resize,this.handleCancel),this.windowListeners.add(ot.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ot.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Qe(n),t(Ae)}handleKeyDown(e){if(G(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:i=at,coordinateGetter:r=lt,scrollBehavior:s="smooth"}=o,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:Ae;this.referenceCoordinates||(this.referenceCoordinates=c);const d=r(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=X(d,c),o={x:0,y:0},{scrollableAncestors:i}=n.current;for(const n of i){const i=e.code,{isTop:r,isRight:a,isLeft:l,isBottom:c,maxScroll:u,minScroll:p}=Ke(n),h=Xe(n),g={x:Math.min(i===it.Right?h.right-h.width/2:h.right,Math.max(i===it.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(i===it.Down?h.bottom-h.height/2:h.bottom,Math.max(i===it.Down?h.top:h.top+h.height/2,d.y))},m=i===it.Right&&!a||i===it.Left&&!l,f=i===it.Down&&!c||i===it.Up&&!r;if(m&&g.x!==d.x){const e=n.scrollLeft+t.x,r=i===it.Right&&e<=u.x||i===it.Left&&e>=p.x;if(r&&!t.y)return void n.scrollTo({left:e,behavior:s});o.x=r?n.scrollLeft-e:i===it.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,o.x&&n.scrollBy({left:-o.x,behavior:s});break}if(f&&g.y!==d.y){const e=n.scrollTop+t.y,r=i===it.Down&&e<=u.y||i===it.Up&&e>=p.y;if(r&&!t.x)return void n.scrollTo({top:e,behavior:s});o.y=r?n.scrollTop-e:i===it.Down?n.scrollTop-u.y:n.scrollTop-p.y,o.y&&n.scrollBy({top:-o.y,behavior:s});break}}this.handleMove(e,J(X(d,this.referenceCoordinates),o))}}}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:o=at,onActivation:i}=t,{active:r}=n;const{code:s}=e.nativeEvent;if(o.start.includes(s)){const t=r.activatorNode.current;return!(t&&e.target!==t||(e.preventDefault(),null==i||i({event:e.nativeEvent}),0))}return!1}}];class pt{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=N(e);return e instanceof t?e:F(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:r}=i;this.props=e,this.events=t,this.document=F(r),this.documentListeners=new tt(this.document),this.listeners=new tt(n),this.windowListeners=new tt(N(r)),this.initialCoordinates=null!=(o=Q(i))?o: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(ot.Resize,this.handleCancel),this.windowListeners.add(ot.DragStart,rt),this.windowListeners.add(ot.VisibilityChange,this.handleCancel),this.windowListeners.add(ot.ContextMenu,rt),this.documentListeners.add(ot.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:o}=this.props;o(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ot.Click,st,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ot.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:i}=this,{onMove:r,options:{activationConstraint:s}}=i;if(!o)return;const a=null!=(t=Q(e))?t:Ae,l=X(o,a);if(!n&&s){if(dt(s)){if(null!=s.tolerance&&nt(l,s.tolerance))return this.handleCancel();if(nt(l,s.distance))return this.handleStart()}return ut(s)&&nt(l,s.tolerance)?this.handleCancel():void this.handlePending(s,l)}e.cancelable&&e.preventDefault(),r(a)}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 ht={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class gt extends pt{constructor(e){const{event:t}=e,n=F(t.target);super(e,ht,n)}}gt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!(!n.isPrimary||0!==n.button||(null==o||o({event:n}),0))}}];const mt={move:{name:"mousemove"},end:{name:"mouseup"}};var ft;!function(e){e[e.RightClick=2]="RightClick"}(ft||(ft={})),class extends pt{constructor(e){super(e,mt,F(e.event.target))}}.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==ft.RightClick&&(null==o||o({event:n}),!0)}}];const bt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var vt,yt;function Ct(e){let{acceleration:t,activator:n=vt.Pointer,canScroll:o,draggingRect:i,enabled:r,interval:s=5,order:a=yt.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:p}=e;const h=function(e){let{delta:t,disabled:n}=e;const o=W(t);return B(e=>{if(n||!o||!e)return xt;const i=Math.sign(t.x-o.x),r=Math.sign(t.y-o.y);return{x:{[We.Backward]:e.x[We.Backward]||-1===i,[We.Forward]:e.x[We.Forward]||1===i},y:{[We.Backward]:e.y[We.Backward]||-1===r,[We.Forward]:e.y[We.Forward]||1===r}}},[n,t,o])}({delta:u,disabled:!r}),[g,m]=function(){const e=L(null);return[P((t,n)=>{e.current=setInterval(t,n)},[]),P(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),f=me({x:0,y:0}),b=me({x:0,y:0}),v=ge(()=>{switch(n){case vt.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vt.DraggableRect:return i}},[n,i,l]),y=me(null),C=he(()=>{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)},[]),x=ge(()=>a===yt.TreeOrder?[...c].reverse():c,[a,c]);ue(()=>{if(r&&c.length&&v){for(const e of x){if(!1===(null==o?void 0:o(e)))continue;const n=c.indexOf(e),i=d[n];if(!i)continue;const{direction:r,speed:a}=Je(e,i,v,t,p);for(const e of["x","y"])h[e][r[e]]||(a[e]=0,r[e]=0);if(a.x>0||a.y>0)return m(),y.current=e,g(C,s),f.current=a,void(b.current=r)}f.current={x:0,y:0},b.current={x:0,y:0},m()}else m()},[t,C,o,m,r,s,JSON.stringify(v),JSON.stringify(h),g,c,x,d,JSON.stringify(p)])}(class extends pt{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:o}=t;const{touches:i}=n;return!(i.length>1||(null==o||o({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 xt={x:{[We.Backward]:!1,[We.Forward]:!1},y:{[We.Backward]:!1,[We.Forward]:!1}};var wt,St;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(wt||(wt={})),(St||(St={})).Optimized="optimized";const Rt=new Map;function Et(e,t){return B(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function _t(e){let{callback:t,disabled:n}=e;const o=H(t),i=ge(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)},[n]);return ue(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function kt(e){return new et(je(e),e)}function At(e,t,n){void 0===t&&(t=kt);const[o,i]=pe(null);function r(){i(o=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=o?o:n)?i:null;const r=t(e);return JSON.stringify(o)===JSON.stringify(r)?o:r})}const s=function(e){let{callback:t,disabled:n}=e;const o=H(t),i=ge(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)},[o,n]);return ue(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:o}=n;if("childList"===t&&o instanceof HTMLElement&&o.contains(e)){r();break}}}}),a=_t({callback:r});return z(()=>{r(),e?(null==a||a.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==s||s.disconnect())},[e]),o}const Ot=[];function Lt(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?X(e,n.current):Ae}function Pt(e){return ge(()=>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 Dt=[];function It(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return j(t)?t:e}const Mt=[{sensor:gt,options:{}},{sensor:ct,options:{}}],Nt={current:{}},Tt={draggable:{measure:$e},droppable:{measure:$e,strategy:wt.WhileDragging,frequency:St.Optimized},dragOverlay:{measure:je}};class jt 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 $t={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ke},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tt,measureDroppableContainers:ke,windowRect:null,measuringScheduled:!1},Ft={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ke,draggableNodes:new Map,over:null,measureDroppableContainers:ke},zt=ce(Ft),Ht=ce($t);function qt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jt}}}function Bt(e,t){switch(t.type){case _e.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case _e.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 _e.DragEnd:case _e.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _e.RegisterDroppable:{const{element:n}=t,{id:o}=n,i=new jt(e.droppable.containers);return i.set(o,n),{...e,droppable:{...e.droppable,containers:i}}}case _e.SetDroppableDisabled:{const{id:n,key:o,disabled:i}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const s=new jt(e.droppable.containers);return s.set(n,{...r,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case _e.UnregisterDroppable:{const{id:n,key:o}=t,i=e.droppable.containers.get(n);if(!i||o!==i.key)return e;const r=new jt(e.droppable.containers);return r.delete(n),{...e,droppable:{...e.droppable,containers:r}}}default:return e}}function Vt(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:i}=de(zt),r=W(o),s=W(null==n?void 0:n.id);return ue(()=>{if(!t&&!o&&r&&null!=s){if(!G(r))return;if(document.activeElement===r.target)return;const e=i.get(s);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}}})}},[o,t,i,s,r]),null}function Wt(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...o}),n):n}const Ut=ce({...Ae,scaleX:1,scaleY:1});var Kt;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Kt||(Kt={})),fe(function(e){var t,n,o,i;let{id:r,accessibility:s,autoScroll:a=!0,children:l,sensors:c=Mt,collisionDetection:d=De,measuring:u,modifiers:p,...h}=e;const g=be(Bt,void 0,qt),[m,f]=g,[b,v]=function(){const[e]=pe(()=>new Set),t=he(t=>(e.add(t),()=>e.delete(t)),[e]);return[he(t=>{let{type:n,event:o}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,o)})},[e]),t]}(),[y,C]=pe(Kt.Uninitialized),x=y===Kt.Initialized,{draggable:{active:w,nodes:S,translate:R},droppable:{containers:E}}=m,_=null!=w?S.get(w):null,k=me({initial:null,translated:null}),A=ge(()=>{var e;return null!=w?{id:w,data:null!=(e=null==_?void 0:_.data)?e:Nt,rect:k}:null},[w,_]),O=me(null),[L,P]=pe(null),[I,M]=pe(null),T=q(h,Object.values(h)),$=K("DndDescribedBy",r),F=ge(()=>E.getEnabled(),[E]),H=ge(()=>({draggable:{...Tt.draggable,...null==W?void 0:W.draggable},droppable:{...Tt.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Tt.dragOverlay,...null==W?void 0:W.dragOverlay}}),[null==(W=u)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:U,measureDroppableContainers:Y,measuringScheduled:X}=function(e,t){let{dragging:n,dependencies:o,config:i}=t;const[r,s]=pe(null),{frequency:a,measure:l,strategy:c}=i,d=me(e),u=function(){switch(c){case wt.Always:return!1;case wt.BeforeDragging:return n;default:return!n}}(),p=q(u),h=he(function(e){void 0===e&&(e=[]),p.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),g=me(null),m=B(t=>{if(u&&!n)return Rt;if(!t||t===Rt||d.current!==e||null!=r){const t=new Map;for(let n of e){if(!n)continue;if(r&&r.length>0&&!r.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new et(l(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,r,n,u,l]);return ue(()=>{d.current=e},[e]),ue(()=>{u||h()},[n,u]),ue(()=>{r&&r.length>0&&s(null)},[JSON.stringify(r)]),ue(()=>{u||"number"!=typeof a||null!==g.current||(g.current=setTimeout(()=>{h(),g.current=null},a))},[a,u,h,...o]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:null!=r}}(F,{dragging:x,dependencies:[R.x,R.y],config:H.droppable}),G=function(e,t){const n=null!=t?e.get(t):void 0,o=n?n.node.current:null;return B(e=>{var n;return null==t?null:null!=(n=null!=o?o:e)?n:null},[o,t])}(S,w),Z=ge(()=>I?Q(I):null,[I]),ee=function(){const e=!1===(null==L?void 0:L.autoScrollEnabled),t="object"==typeof a?!1===a.enabled:!1===a,n=x&&!e&&!t;return"object"==typeof a?{...a,enabled:n}:{enabled:n}}(),te=function(e,t){return Et(e,t)}(G,H.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:i=!0}=e;const r=me(!1),{x:s,y:a}="boolean"==typeof i?{x:i,y:i}:i;z(()=>{if(!s&&!a||!t)return void(r.current=!1);if(r.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=Ie(n(e),o);if(s||(i.x=0),a||(i.y=0),r.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=ze(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,a,o,n])}({activeNode:null!=w?S.get(w):null,config:ee.layoutShiftCompensation,initialRect:te,measure:H.draggable.measure});const ne=At(G,H.draggable.measure,te),oe=At(G?G.parentElement:null),ie=me({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=E.getNodeFor(null==(t=ie.current.over)?void 0:t.id),se=function(e){let{measure:t}=e;const[n,o]=pe(null),i=_t({callback:he(e=>{for(const{target:n}of e)if(j(n)){o(e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o});break}},[t])}),r=he(e=>{const n=It(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),o(n?t(n):null)},[t,i]),[s,a]=V(r);return ge(()=>({nodeRef:s,rect:n,setRef:a}),[n,s,a])}({measure:H.dragOverlay.measure}),ae=null!=(n=se.nodeRef.current)?n:G,ce=x?null!=(o=se.rect)?o:ne:null,de=Boolean(se.nodeRef.current&&se.rect),fe=Ie(ve=de?null:ne,Et(ve));var ve;const ye=Pt(ae?N(ae):null),Ce=function(e){const t=me(e),n=B(n=>e?n&&n!==Ot&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fe(e):Ot,[e]);return ue(()=>{t.current=e},[e]),n}(x?null!=re?re:G:null),Se=function(e,t){void 0===t&&(t=je);const[n]=e,o=Pt(n?N(n):null),[i,r]=pe(Dt);function s(){r(()=>e.length?e.map(e=>Ue(e)?o:new et(t(e),e)):Dt)}const a=_t({callback:s});return z(()=>{null==a||a.disconnect(),s(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(Ce),Re=Wt(p,{transform:{x:R.x-fe.x,y:R.y-fe.y,scaleX:1,scaleY:1},activatorEvent:I,active:A,activeNodeRect:ne,containerNodeRect:oe,draggingNodeRect:ce,over:ie.current.over,overlayNodeRect:se.rect,scrollableAncestors:Ce,scrollableAncestorRects:Se,windowRect:ye}),ke=Z?J(Z,R):null,Oe=function(e){const[t,n]=pe(null),o=me(e),i=he(e=>{const t=He(e.target);t&&n(e=>e?(e.set(t,Ve(t)),new Map(e)):null)},[]);return ue(()=>{const t=o.current;if(e!==t){r(t);const s=e.map(e=>{const t=He(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Ve(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),o.current=e}return()=>{r(e),r(t)};function r(e){e.forEach(e=>{const t=He(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),ge(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>J(e,t),Ae):Ge(e):Ae,[e,t])}(Ce),Le=Lt(Oe),Pe=Lt(Oe,[ne]),Ne=J(Re,Le),Te=ce?Me(ce,Re):null,$e=A&&Te?d({active:A,collisionRect:Te,droppableRects:U,droppableContainers:F,pointerCoordinates:ke}):null,qe=function(e){if(!e||0===e.length)return null;const[t]=e;return t.id}($e),[Be,We]=pe(null),Ke=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(de?Re:J(Re,Pe),null!=(i=null==Be?void 0:Be.rect)?i:null,ne),Ye=me(null),Je=he((e,t)=>{let{sensor:n,options:o}=t;if(null==O.current)return;const i=S.get(O.current);if(!i)return;const r=e.nativeEvent,s=new n({active:O.current,activeNode:i,event:r,options:o,context:ie,onAbort(e){if(!S.get(e))return;const{onDragAbort:t}=T.current,n={id:e};null==t||t(n),b({type:"onDragAbort",event:n})},onPending(e,t,n,o){if(!S.get(e))return;const{onDragPending:i}=T.current,r={id:e,constraint:t,initialCoordinates:n,offset:o};null==i||i(r),b({type:"onDragPending",event:r})},onStart(e){const t=O.current;if(null==t)return;const n=S.get(t);if(!n)return;const{onDragStart:o}=T.current,i={activatorEvent:r,active:{id:t,data:n.data,rect:k}};xe(()=>{null==o||o(i),C(Kt.Initializing),f({type:_e.DragStart,initialCoordinates:e,active:t}),b({type:"onDragStart",event:i}),P(Ye.current),M(r)})},onMove(e){f({type:_e.DragMove,coordinates:e})},onEnd:a(_e.DragEnd),onCancel:a(_e.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=ie.current;let s=null;if(t&&i){const{cancelDrop:a}=T.current;s={activatorEvent:r,active:t,collisions:n,delta:i,over:o},e===_e.DragEnd&&"function"==typeof a&&await Promise.resolve(a(s))&&(e=_e.DragCancel)}O.current=null,xe(()=>{f({type:e}),C(Kt.Uninitialized),We(null),P(null),M(null),Ye.current=null;const t=e===_e.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=T.current[t];null==e||e(s),b({type:t,event:s})}})}}Ye.current=s},[S]),Xe=he((e,t)=>(n,o)=>{const i=n.nativeEvent,r=S.get(o);if(null!==O.current||!r||i.dndKit||i.defaultPrevented)return;const s={active:r};!0===e(n,t.options,s)&&(i.dndKit={capturedBy:t.sensor},O.current=o,Je(n,t))},[S,Je]),Qe=function(e,t){return ge(()=>e.reduce((e,n)=>{const{sensor:o}=n;return[...e,...o.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(c,Xe);!function(e){ue(()=>{if(!D)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),z(()=>{ne&&y===Kt.Initializing&&C(Kt.Initialized)},[ne,y]),ue(()=>{const{onDragMove:e}=T.current,{active:t,activatorEvent:n,collisions:o,over:i}=ie.current;if(!t||!n)return;const r={active:t,activatorEvent:n,collisions:o,delta:{x:Ne.x,y:Ne.y},over:i};xe(()=>{null==e||e(r),b({type:"onDragMove",event:r})})},[Ne.x,Ne.y]),ue(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:i}=ie.current;if(!e||null==O.current||!t||!i)return;const{onDragOver:r}=T.current,s=o.get(qe),a=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:a};xe(()=>{We(a),null==r||r(l),b({type:"onDragOver",event:l})})},[qe]),z(()=>{ie.current={activatorEvent:I,active:A,activeNode:G,collisionRect:Te,collisions:$e,droppableRects:U,draggableNodes:S,draggingNode:ae,draggingNodeRect:ce,droppableContainers:E,over:Be,scrollableAncestors:Ce,scrollAdjustedTranslate:Ne},k.current={initial:ce,translated:Te}},[A,G,$e,Te,S,ae,ce,U,E,Be,Ce,Ne]),Ct({...ee,delta:R,draggingRect:Te,pointerCoordinates:ke,scrollableAncestors:Ce,scrollableAncestorRects:Se});const Ze=ge(()=>({active:A,activeNode:G,activeNodeRect:ne,activatorEvent:I,collisions:$e,containerNodeRect:oe,dragOverlay:se,draggableNodes:S,droppableContainers:E,droppableRects:U,over:Be,measureDroppableContainers:Y,scrollableAncestors:Ce,scrollableAncestorRects:Se,measuringConfiguration:H,measuringScheduled:X,windowRect:ye}),[A,G,ne,I,$e,oe,se,S,E,U,Be,Y,Ce,Se,H,X,ye]),tt=ge(()=>({activatorEvent:I,activators:Qe,active:A,activeNodeRect:ne,ariaDescribedById:{draggable:$},dispatch:f,draggableNodes:S,over:Be,measureDroppableContainers:Y}),[I,Qe,A,ne,f,$,S,Be,Y]);return le.createElement(we.Provider,{value:v},le.createElement(zt.Provider,{value:tt},le.createElement(Ht.Provider,{value:Ze},le.createElement(Ut.Provider,{value:Ke},l)),le.createElement(Vt,{disabled:!1===(null==s?void 0:s.restoreFocus)})),le.createElement(Ee,{...s,hiddenTextDescribedById:$}))});const Yt=ce(null),Jt="button";const Xt={timeout:25};function Gt(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:i}=e;const r=K("Droppable"),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=de(zt),d=me({disabled:n}),u=me(!1),p=me(null),h=me(null),{disabled:g,updateMeasurementsFor:m,timeout:f}={...Xt,...i},b=q(null!=m?m:o),v=_t({callback:he(()=>{u.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),h.current=null},f)):u.current=!0},[f]),disabled:g||!s}),y=he((e,t)=>{v&&(t&&(v.unobserve(t),u.current=!1),e&&v.observe(e))},[v]),[C,x]=V(y),w=q(t);return ue(()=>{v&&C.current&&(v.disconnect(),u.current=!1,v.observe(C.current))},[C,v]),ue(()=>(a({type:_e.RegisterDroppable,element:{id:o,key:r,disabled:n,node:C,rect:p,data:w}}),()=>a({type:_e.UnregisterDroppable,key:r,id:o})),[o]),ue(()=>{n!==d.current.disabled&&(a({type:_e.SetDroppableDisabled,id:o,key:r,disabled:n}),d.current.disabled=n)},[o,r,n,a]),{active:s,rect:p,isOver:(null==l?void 0:l.id)===o,node:C,over:l,setNodeRef:x}}function Qt(e){let{animation:t,children:n}=e;const[o,i]=pe(null),[r,s]=pe(null),a=W(n);return n||o||!a||i(a),z(()=>{if(!r)return;const e=null==o?void 0:o.key,n=null==o?void 0:o.props.id;null!=e&&null!=n?Promise.resolve(t(n,r)).then(()=>{i(null)}):i(null)},[t,o,r]),le.createElement(le.Fragment,null,n,o?ve(o,{ref:s}):null)}const Zt={x:0,y:0,scaleX:1,scaleY:1};function en(e){let{children:t}=e;return le.createElement(zt.Provider,{value:Ft},le.createElement(Ut.Provider,{value:Zt},t))}const tn={position:"fixed",touchAction:"none"},nn=e=>G(e)?"transform 250ms ease":void 0,on=ye((e,t)=>{let{as:n,activatorEvent:o,adjustScale:i,children:r,className:s,rect:a,style:l,transform:c,transition:d=nn}=e;if(!a)return null;const u=i?c:{...c,scaleX:1,scaleY:1},p={...tn,width:a.width,height:a.height,top:a.top,left:a.left,transform:Z.Transform.toString(u),transformOrigin:i&&o?Oe(o,a):void 0,transition:"function"==typeof d?d(o):d,...l};return le.createElement(n,{className:s,style:p,ref:t},r)}),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:(sn={styles:{active:{opacity:"0"}}},e=>{let{active:t,dragOverlay:n}=e;const o={},{styles:i,className:r}=sn;if(null!=i&&i.active)for(const[e,n]of Object.entries(i.active))void 0!==n&&(o[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!=r&&r.active&&t.node.classList.add(r.active),null!=r&&r.dragOverlay&&n.node.classList.add(r.dragOverlay),function(){for(const[e,n]of Object.entries(o))t.node.style.setProperty(e,n);null!=r&&r.active&&t.node.classList.remove(r.active)}})};var sn;let an=0;const ln=le.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:o,style:i,transition:r,modifiers:s,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:p,containerNodeRect:h,draggableNodes:g,droppableContainers:m,dragOverlay:f,over:b,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:C,windowRect:x}=de(Ht),w=de(Ut),S=function(e){return ge(()=>{if(null!=e)return an++,an},[e])}(null==u?void 0:u.id),R=Wt(s,{activatorEvent:d,active:u,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:f.rect,over:b,overlayNodeRect:f.rect,scrollableAncestors:y,scrollableAncestorRects:C,transform:w,windowRect:x}),E=Et(p),_=function(e){let{config:t,draggableNodes:n,droppableContainers:o,measuringConfiguration:i}=e;return H((e,r)=>{if(null===t)return;const s=n.get(e);if(!s)return;const a=s.node.current;if(!a)return;const l=It(r);if(!l)return;const{transform:c}=N(r).getComputedStyle(r),d=Ne(c);if(!d)return;const u="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:o,keyframes:i}={...rn,...e};return e=>{let{active:r,dragOverlay:s,transform:a,...l}=e;if(!t)return;const c=s.rect.left-r.rect.left,d=s.rect.top-r.rect.top,u={scaleX:1!==a.scaleX?r.rect.width*a.scaleX/s.rect.width:1,scaleY:1!==a.scaleY?r.rect.height*a.scaleY/s.rect.height:1},p={x:a.x-c,y:a.y-d,...u},h=i({...l,active:r,dragOverlay:s,transform:{initial:a,final:p}}),[g]=h,m=h[h.length-1];if(JSON.stringify(g)===JSON.stringify(m))return;const f=null==o?void 0:o({active:r,dragOverlay:s,...l}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{b.onfinish=()=>{null==f||f(),e()}})}}(t);return Qe(a,i.draggable.measure),u({active:{id:e,data:s.data,node:a,rect:i.draggable.measure(a)},draggableNodes:n,dragOverlay:{node:r,rect:i.dragOverlay.measure(l)},droppableContainers:o,measuringConfiguration:i,transform:d})})}({config:o,draggableNodes:g,droppableContainers:m,measuringConfiguration:v}),k=E?f.setRef:void 0;return le.createElement(en,null,le.createElement(Qt,{animation:_},u&&S?le.createElement(on,{key:S,id:u.id,ref:k,as:a,activatorEvent:d,adjustScale:t,className:l,transition:r,rect:E,style:{zIndex:c,...i},transform:R},n):null))});n("@pie-lib:categorize:scoring");const cn=n,{clone:dn}=o,{remove:un}=o;function pn(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const hn=cn("@pie-lib:categorize"),gn=(e,t,n)=>(t=t||[]).reduce((t,o)=>{const i=n-t.count,r=mn(e,o,i);return t.out.push(r.array),t.count=t.count+(r.count||0),t},{out:[],count:0}).out,mn=(e,t,n)=>{if(t=t||[],0===n){const n=t.filter(t=>t!==e);return{array:n,count:t.length-n.length}}{const o=t.reduce((t,o)=>(o===e?t.count<n&&(t.count+=1,t.out.push(o)):t.out.push(o),t),{out:[],count:0});return{array:o.out,count:o.count}}},fn=(e,t,n)=>n.map(n=>n.category!==t?(n.choices=(n.choices||[]).filter(t=>t!==e.id),n):(n.choices=n.choices.reduce((t,n)=>(n.id===e.id?-1===t.findIndex(t=>t.id===e.id)&&t.push(n):t.push(n),t),[]),n)),bn=(e,t,n,o)=>(hn("[removeChoiceFromCategory] choiceIndex:",n),o.map(o=>{if(o.category===t){const t=dn(o.choices),i=t.findIndex((t,o)=>t===e&&o>=n);return-1!==i&&t.splice(i,1),{...o,choices:t}}return o})),vn=(e,t,n,o,i)=>(i||[]).map(e=>{if(pn([e,"optionalAccess",e=>e.category])===t){const t=(pn([e,"optionalAccess",e=>e.alternateResponses])||[]).map((e,t)=>t===o?((e||[]).splice(n,1),e):e);return{...e,alternateResponses:t}}return e}),yn=(e,t,n,o,i)=>(hn("[moveChoiceToCategory] choice: ",e,"from: ",t,"to: ",n,"answers: ",i),t===n?i:(t&&(i=bn(e,t,o,i)),-1===i.findIndex(e=>e.category===n)?(i.push({category:n,choices:[e]}),i):i.map(t=>t.category===n?(t.choices=t.choices||[],t.choices.push(e),t):t))),Cn=t,xn=i,{styled:wn}=r;function Sn(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Rn=wn(u)(({theme:e})=>({flex:"1",paddingBottom:e.spacing(1),maxWidth:"100%"})),En=wn("div")({display:"flex",justifyContent:"space-between"});class _n extends Cn.Component{static __initStatic(){this.propTypes={configuration:xn.object.isRequired,deleteFocusedEl:xn.func,disabled:xn.bool,focusedEl:xn.number,index:xn.number,label:xn.string,maxImageWidth:xn.object,maxImageHeight:xn.object,onChange:xn.func,onDelete:xn.func,imageSupport:xn.shape({add:xn.func.isRequired,delete:xn.func.isRequired}),uploadSoundSupport:xn.shape({add:xn.func.isRequired,delete:xn.func.isRequired}),toolbarOpts:xn.object,error:xn.string,spellCheck:xn.bool}}static __initStatic2(){this.defaultProps={}}constructor(e){super(e)}componentDidMount(){const{focusedEl:e,index:t}=this.props;e&&t&&e===t&&this.inputRef.focus("end",null,!0)}render(){const{onChange:e,configuration:t,label:n,deleteFocusedEl:o,disabled:i,imageSupport:r,toolbarOpts:s,spellCheck:a,error:l,maxImageWidth:c,maxImageHeight:d,uploadSoundSupport:u,mathMlOptions:p={}}=this.props,{headers:h,baseInputConfiguration:g}=t;return Cn.createElement(En,null,Cn.createElement(Rn,{imageSupport:r,disabled:i,ref:e=>this.inputRef=e,autoWidthToolbar:!0,label:"label",markup:n,onChange:e,pluginProps:_(Sn([h,"optionalAccess",e=>e.inputConfiguration]),g),toolbarOpts:s,spellCheck:a,error:l,maxImageWidth:c,maxImageHeight:d,uploadSoundSupport:u,languageCharactersProps:[{language:"spanish"},{language:"special"}],onDone:()=>{o&&o()},mathMlOptions:p}))}}_n.__initStatic(),_n.__initStatic2();const kn=t,An=i,{styled:On}=r,{Button:Ln}=s,Pn=On(Ln)(({theme:e})=>({height:e.spacing(4)}));class Dn extends kn.Component{static __initStatic(){this.propTypes={label:An.string,onClick:An.func,disabled:An.bool}}static __initStatic2(){this.defaultProps={label:"Add"}}render(){const{label:e,onClick:t,disabled:n}=this.props;return kn.createElement(Pn,{onClick:t,disabled:n,size:"small",variant:"contained",color:"primary"},e)}}Dn.__initStatic(),Dn.__initStatic2();const In=Dn,Mn=On(Ln)({margin:0,padding:0}),Nn=({label:e,onClick:t,disabled:n})=>kn.createElement(Mn,{onClick:t,size:"small",color:"primary",disabled:n},e),Tn=t,jn=i,{styled:$n}=r,{IconButton:Fn}=s,{RemoveCircleOutline:zn}=a,{HtmlAndMath:Hn}=l,{color:qn}=l,{DraggableChoice:Bn}=p;function Vn(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Wn=$n("div")({position:"relative",overflow:"auto"}),Un=$n(Fn)({position:"absolute",right:0,top:0,color:`${qn.tertiary()} !important`});class Kn extends Tn.Component{constructor(...e){super(...e),Kn.prototype.__init.call(this)}static __initStatic(){this.propTypes={alternateResponseIndex:jn.number,category:jn.object,choice:jn.object.isRequired,choiceIndex:jn.number,onDelete:jn.func}}static __initStatic2(){this.defaultProps={onDelete:()=>{}}}__init(){this.delete=()=>{const{onDelete:e,choice:t}=this.props;e(t)}}render(){const{alternateResponseIndex:e,category:t,choice:n,choiceIndex:o}=this.props,i=t&&t.id,r=void 0!==e?`${n.id}-${i}-${o}-alt-${e}`:`${n.id}-${i}-${o}`;return Tn.createElement(Wn,null,n?Tn.createElement(Bn,{alternateResponseIndex:e,category:t,choice:n,choiceIndex:o,onRemoveChoice:this.delete,type:"choice-preview",id:r,categoryId:i},Tn.createElement(Hn,{html:Vn([n,"optionalAccess",e=>e.content])})):null,Tn.createElement(Un,{"aria-label":"delete",onClick:this.delete,size:"large"},Tn.createElement(zn,null)))}}Kn.__initStatic(),Kn.__initStatic2();const Yn=t,Jn=i,{styled:Xn}=r,Gn=n,{uid:Qn}=p,{PlaceHolder:Zn}=p;Gn("@pie-element:categorize:configure");const eo=Xn("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.typography.fontSize-2,color:`rgba(${e.palette.common.black}, 0.4)`,width:"100%",height:"100%"})),to=()=>Yn.createElement(eo,null,"Drag your correct answers here"),no=Xn("div")({minHeight:"100px"}),oo=({alternateResponseIndex:e,category:t,choices:n,onDeleteChoice:o})=>Yn.createElement(Yn.Fragment,null,(n||[]).map((n,i)=>n&&Yn.createElement(Kn,{alternateResponseIndex:e,category:t,choice:n,key:i,choiceIndex:i,onDelete:e=>o(e,i)})));oo.propTypes={alternateResponseIndex:Jn.number,category:Jn.object,choices:Jn.array,onDeleteChoice:Jn.func};const io=({alternateResponseIndex:e,category:t,choices:n,onDeleteChoice:o,categoryId:i,isAlternate:r})=>{const{setNodeRef:s,isOver:a}=Gt({id:`${i}-${r?"alternate":"standard"}`,data:{accepts:["choice","choice-preview"],alternateResponseIndex:e,categoryId:i,type:r?"category-alternate":"category",id:i}});return Yn.createElement("div",{ref:s},Yn.createElement(no,null,Yn.createElement(Zn,{isOver:a,extraStyles:{width:"100%",minHeight:"100px",height:"auto"}},0===(n||[]).length?Yn.createElement(to,null):Yn.createElement(oo,{alternateResponseIndex:e,category:t,choices:n,onDeleteChoice:o}))))};io.propTypes={alternateResponseIndex:Jn.number,category:Jn.object,choices:Jn.array,onDeleteChoice:Jn.func,categoryId:Jn.string.isRequired,isAlternate:Jn.bool};var ro=Qn.withUid(io);const so=t,ao=i,{styled:lo}=r,{Card:co}=s,{CardActions:uo}=s,po=lo(co,{shouldForwardProp:e=>"isDuplicated"!==e})(({theme:e,isDuplicated:t})=>({minWidth:"196px",padding:e.spacing(1),overflow:"visible",...t&&{border:"1px solid red"}})),ho=lo(uo)(({theme:e})=>({padding:0,paddingBottom:0,paddingTop:e.spacing(1)})),go=lo("div")(({theme:e})=>({padding:e.spacing(2),"& p":{margin:0}})),mo=lo("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingBottom:e.spacing(1)}));class fo extends so.Component{constructor(...e){super(...e),fo.prototype.__init.call(this)}static __initStatic(){this.propTypes={alternateResponseIndex:ao.number,category:ao.object.isRequired,configuration:ao.object.isRequired,defaultImageMaxHeight:ao.number,defaultImageMaxWidth:ao.number,deleteFocusedEl:ao.func,focusedEl:ao.number,index:ao.number,error:ao.string,isDuplicated:ao.bool,maxImageWidth:ao.object,maxImageHeight:ao.object,onChange:ao.func,onDelete:ao.func,onDeleteChoice:ao.func,imageSupport:ao.shape({add:ao.func.isRequired,delete:ao.func.isRequired}),toolbarOpts:ao.object,spellCheck:ao.bool,uploadSoundSupport:ao.shape({add:ao.func.isRequired,delete:ao.func.isRequired}),isAlternate:ao.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.changeLabel=e=>{const{category:t,onChange:n}=this.props;t.label=e,n(t)}}render(){const{alternateResponseIndex:e,category:t,configuration:n,deleteFocusedEl:o,focusedEl:i,index:r,error:s,isDuplicated:a,onDelete:l,onDeleteChoice:c,imageSupport:d,spellCheck:u,toolbarOpts:p,maxImageWidth:h,maxImageHeight:g,uploadSoundSupport:m,mathMlOptions:f={}}=this.props,b=!!e||0===e;return so.createElement(po,{isDuplicated:a},so.createElement("span",null,b?so.createElement(go,{dangerouslySetInnerHTML:{__html:t.label}}):so.createElement(_n,{label:t.label,focusedEl:i,deleteFocusedEl:o,index:r,disabled:!!e||0===e,error:s,onChange:this.changeLabel,onDelete:l,imageSupport:d,toolbarOpts:p,spellCheck:u,maxImageWidth:h,maxImageHeight:g,uploadSoundSupport:m,mathMlOptions:f,configuration:n}),s&&so.createElement(mo,null,s)),so.createElement(ro,{alternateResponseIndex:e,category:t,choices:t.choices,onDeleteChoice:c,categoryId:t.id,extraStyles:{minHeight:"100px"},isAlternate:this.props.isAlternate}),l&&so.createElement(ho,null,so.createElement(Nn,{label:"delete",onClick:l})))}}fo.__initStatic(),fo.__initStatic2();const bo=t,vo=i,{Tooltip:yo}=s,{Typography:Co}=s,{styled:xo}=r,wo=xo("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",marginBottom:e.spacing(1)})),So=xo("div")({display:"flex",alignItems:"center"}),Ro=xo(yo)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}}));class Eo extends bo.Component{static __initStatic(){this.propTypes={buttonLabel:vo.string,onAdd:vo.func.isRequired,label:vo.string.isRequired,info:vo.any,buttonDisabled:vo.bool,variant:vo.string,tooltip:vo.string}}static __initStatic2(){this.defaultProps={}}render(){const{onAdd:e,label:t,buttonLabel:n,info:o,buttonDisabled:i,variant:r,tooltip:s}=this.props;return bo.createElement(wo,null,bo.createElement(So,null,bo.createElement(Co,{variant:r||"title"},t),o),bo.createElement(Ro,{title:s||"",enterTouchDelay:50,leaveTouchDelay:3e3},bo.createElement("span",null,bo.createElement(In,{onClick:e,label:n,disabled:i}))))}}function _o(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}Eo.__initStatic(),Eo.__initStatic2();const ko="Yes",Ao="Set Per Choice",Oo=e=>{const{correctResponse:t=[]}=e||{};return t.reduce((e,t)=>{const n=_o([t,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.length])||0,o=_o([t,"optionalAccess",e=>e.alternateResponses])||[],i=Math.max(n,(o||[]).reduce((e,t)=>Math.max(e,t.length),0));return i>e?i:e},0)},Lo=t,{styled:Po}=r,{InputContainer:Do}=l,Io=u;function Mo(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const No=Po(Do)(({theme:e})=>({paddingTop:e.spacing(2),width:"100%"})),To=({categoriesPerRow:e,configuration:t,disabled:n,markup:o,imageSupport:i,onChange:r,toolbarOpts:s,spellCheck:a,maxImageWidth:l,maxImageHeight:c,uploadSoundSupport:d,mathMlOptions:u={}})=>{const{rowLabels:p,baseInputConfiguration:h}=t;return Lo.createElement("div",{style:{gridColumn:`1/${e+1}`,width:"100%"}},Lo.createElement(No,{label:"Row Label"},Lo.createElement(Io,{disabled:n,markup:o,onChange:r,imageSupport:i,nonEmpty:!1,toolbarOpts:s,pluginProps:_(Mo([p,"optionalAccess",e=>e.inputConfiguration]),h),spellCheck:a,maxImageWidth:l,maxImageHeight:c,uploadSoundSupport:d,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:u})))},jo=t,$o=i,{styled:Fo}=r,{Info:zo}=a,{Tooltip:Ho}=s,{choiceUtils:qo}=d,Bo=Fo("div")(({theme:e})=>({marginBottom:e.spacing(3)})),Vo=Fo("div")(({theme:e})=>({display:"grid",gridRowGap:`${e.spacing(1)}px`,gridColumnGap:`${e.spacing(1)}px`})),Wo=Fo(Ho)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Uo=Fo("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(.5)}));class Ko extends jo.Component{constructor(...e){super(...e),Ko.prototype.__init.call(this),Ko.prototype.__init2.call(this),Ko.prototype.__init3.call(this),Ko.prototype.__init4.call(this),Ko.prototype.__init5.call(this),Ko.prototype.__init6.call(this),Ko.prototype.__init7.call(this)}static __initStatic(){this.propTypes={defaultImageMaxHeight:$o.number,defaultImageMaxWidth:$o.number,imageSupport:$o.shape({add:$o.func.isRequired,delete:$o.func.isRequired}),uploadSoundSupport:$o.shape({add:$o.func.isRequired,delete:$o.func.isRequired}),categories:$o.array,onModelChanged:$o.func,model:$o.object.isRequired,configuration:$o.object.isRequired,toolbarOpts:$o.object,spellCheck:$o.bool}}__init(){this.state={focusedEl:null}}__init2(){this.add=()=>{const{model:e,categories:t}=this.props,{categoriesPerRow:n,correctResponse:o,allowAlternateEnabled:i}=e,r=qo.firstAvailableIndex(e.categories.map(e=>e.id),1),s={id:r,label:"Category "+r},a=e.categories.length%n===0,l=[...e.rowLabels];a&&l.push(""),this.setState({focusedEl:t.length},()=>{this.props.onModelChanged({rowLabels:l,categories:e.categories.concat([s]),correctResponse:i?[...o,{category:r,choices:[],alternateResponses:[]}]:o})})}}__init3(){this.deleteFocusedEl=()=>{this.setState({focusedEl:null})}}__init4(){this.delete=e=>{const{model:t,onModelChanged:n}=this.props,o=t.categories.findIndex(t=>t.id===e.id);var i;-1!==o&&(t.categories.splice(o,1),t.correctResponse=(i=e.id,t.correctResponse.filter(e=>e.category!==i)),n(t))}}__init5(){this.change=e=>{const{categories:t}=this.props,n=t.findIndex(t=>t.id===e.id);-1!==n&&(t.splice(n,1,e),this.props.onModelChanged({categories:t}))}}__init6(){this.deleteChoiceFromCategory=(e,t,n)=>{const{model:o,onModelChanged:i}=this.props;i({correctResponse:bn(t.id,e.id,n,o.correctResponse)})}}__init7(){this.changeRowLabel=(e,t)=>{const{model:n}=this.props,{rowLabels:o}=n,i=[...o];i.length<t?i.push(e):i[t]=e,this.props.onModelChanged({rowLabels:i})}}render(){const{model:e,categories:t,imageSupport:n,uploadSoundSupport:o,toolbarOpts:i,spellCheck:r,configuration:s,defaultImageMaxHeight:a,defaultImageMaxWidth:l,mathMlOptions:c={}}=this.props,{categoriesPerRow:d,rowLabels:u,errors:p}=e,{associationError:h,categoriesError:g,categoriesErrors:m}=p||{},{maxCategories:f,maxImageWidth:b={},maxImageHeight:v={}}=s||{},y={gridTemplateColumns:`repeat(${d}, 1fr)`},C=(e=>{let{minChoices:t,maxChoices:n,maxCategories:o}=e||{};return t=t||1,"Validation requirements:\nThe choices content should not be empty and should be unique.\nThere should be at least 1 "+(o?`and at most ${o} `:"")+"category"+(o?"s":"")+" defined."+(t?`\nThere should be at least ${t} choices defined.`:"")+(n?`\nNo more than ${n} choices should be defined.`:"")+"\nAt least one token should be assigned to at least one category."})(s);return jo.createElement(Bo,null,jo.createElement(Eo,{label:"Categories",buttonLabel:"ADD A CATEGORY",onAdd:this.add,info:jo.createElement(Wo,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:C},jo.createElement(zo,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}})),buttonDisabled:f&&t&&f===t.length}),jo.createElement(Vo,{style:y},t.map((e,t)=>{const p=t%d===0,h=t/d;return jo.createElement(jo.Fragment,{key:t},p&&jo.createElement(To,{categoriesPerRow:d,disabled:!1,rowIndex:h,markup:u[h]||"",onChange:e=>this.changeRowLabel(e,h),imageSupport:n,toolbarOpts:i,spellCheck:r,maxImageWidth:b&&b.rowLabel||l,maxImageHeight:v&&v.rowLabel||a,uploadSoundSupport:o,mathMlOptions:c,configuration:s}),jo.createElement(fo,{imageSupport:n,focusedEl:this.state.focusedEl,deleteFocusedEl:this.deleteFocusedEl,index:t,category:e,error:m&&m[e.id],onChange:this.change,onDelete:()=>this.delete(e),toolbarOpts:i,spellCheck:r,onDeleteChoice:(t,n)=>this.deleteChoiceFromCategory(e,t,n),maxImageWidth:b&&b.categoryLabel||l,maxImageHeight:v&&v.categoryLabel||a,uploadSoundSupport:o,configuration:s,alternateResponseIndex:void 0}))})),h&&jo.createElement(Uo,null,h),g&&jo.createElement(Uo,null,g))}}Ko.__initStatic();const Yo=t,Jo=i,{styled:Xo}=r,Go=Xo("div")(({theme:e})=>({marginBottom:e.spacing(2.5)})),Qo=Xo("div")(({theme:e})=>({display:"grid",gridRowGap:`${e.spacing(1)}px`,gridColumnGap:`${e.spacing(1)}px`})),Zo=Xo("div")({gridColumn:"1 / 3"});class ei extends Yo.Component{constructor(...e){super(...e),ei.prototype.__init.call(this)}static __initStatic(){this.propTypes={altIndex:Jo.number.isRequired,configuration:Jo.object,imageSupport:Jo.shape({add:Jo.func.isRequired,delete:Jo.func.isRequired}),categories:Jo.array,onModelChanged:Jo.func,model:Jo.object.isRequired,uploadSoundSupport:Jo.shape({add:Jo.func.isRequired,delete:Jo.func.isRequired}),spellCheck:Jo.bool}}__init(){this.deleteChoiceFromCategory=(e,t,n)=>{const{model:o,altIndex:i,onModelChanged:r}=this.props;r({correctResponse:vn(t.id,e.id,n,i,o.correctResponse)})}}render(){const{altIndex:e,model:t,configuration:n,categories:o,imageSupport:i,spellCheck:r,uploadSoundSupport:s,mathMlOptions:a={}}=this.props,{categoriesPerRow:l,errors:c,rowLabels:d}=t,{duplicateAlternate:u}=c||{},p={gridTemplateColumns:`repeat(${l}, 1fr)`},h=!!u&&u.index===e;return Yo.createElement(Go,null,Yo.createElement(Qo,{style:p},o.map((t,o)=>{const c=o%l===0,p=o/l;return Yo.createElement(Yo.Fragment,{key:o},c&&Yo.createElement(Zo,{style:{gridColumn:`1/${l+1}`,width:"100%"},dangerouslySetInnerHTML:{__html:d[p]||""}}),Yo.createElement(fo,{key:o,alternateResponseIndex:e,imageSupport:i,isDuplicated:h&&u.category===t.id,category:t,spellCheck:r,onDeleteChoice:(e,n)=>this.deleteChoiceFromCategory(t,e,n),uploadSoundSupport:s,mathMlOptions:a,configuration:n,isAlternate:!0}))})))}}ei.__initStatic();const ti=t,ni=i,{styled:oi}=r,{Card:ii}=s,{CardActions:ri}=s,{DragHandle:si}=a,ai=n,{Checkbox:li}=d,{uid:ci}=p;ai("@pie-element:categorize:configure:choice");const di=oi(ii)(({theme:e})=>({minWidth:"196px",padding:e.spacing(1),overflow:"visible"})),ui=oi(ri)({padding:0,justifyContent:"space-between"}),pi=oi("span",{shouldForwardProp:e=>"draggable"!==e})(({draggable:e})=>({cursor:e?"move":"inherit"})),hi=oi("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingBottom:e.spacing(1)})),gi=({allowMultiplePlacements:e,configuration:t,choice:n,deleteFocusedEl:o,focusedEl:i,index:r,onDelete:s,onChange:a,correctResponseCount:l,lockChoiceOrder:c,imageSupport:d,spellCheck:u,toolbarOpts:p,error:h,maxImageWidth:g,maxImageHeight:m,uploadSoundSupport:f})=>{const b=(e=>{if(e.lockChoiceOrder)return!0;const t=e.choice.categoryCount||0;return 0===t||e.correctResponseCount<t})({choice:n,correctResponseCount:l,lockChoiceOrder:c}),{attributes:v,listeners:y,setNodeRef:C,isDragging:x}=function(e){let{id:t,data:n,disabled:o=!1,attributes:i}=e;const r=K("Draggable"),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=de(zt),{role:h=Jt,roleDescription:g="draggable",tabIndex:m=0}=null!=i?i:{},f=(null==l?void 0:l.id)===t,b=de(f?Ut:Yt),[v,y]=V(),[C,x]=V(),w=function(e,t){return ge(()=>e.reduce((e,n)=>{let{eventName:o,handler:i}=n;return e[o]=e=>{i(e,t)},e},{}),[e,t])}(s,t),S=q(n);return z(()=>(u.set(t,{id:t,key:r,node:v,activatorNode:C,data:S}),()=>{const e=u.get(t);e&&e.key===r&&u.delete(t)}),[u,t]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:ge(()=>({role:h,tabIndex:m,"aria-disabled":o,"aria-pressed":!(!f||h!==Jt)||void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[o,h,m,f,g,d.draggable]),isDragging:f,listeners:o?void 0:w,node:v,over:p,setNodeRef:y,setActivatorNodeRef:x,transform:b}}({id:`choice-${n.id}`,data:{id:n.id,index:r,type:"choice"},disabled:!b}),{setNodeRef:w}=Gt({id:`choice-drop-${n.id}`,data:{id:n.id,index:r,type:"choice"}}),S=(e=>e===Ao)(e);return ti.createElement(di,{ref:e=>{C(e),w(e)},style:{opacity:x?.5:1}},ti.createElement(ui,null,ti.createElement(pi,{draggable:b,...v,...y},ti.createElement(si,{color:b?"primary":"disabled"}))),ti.createElement(_n,{imageSupport:d,focusedEl:i,deleteFocusedEl:o,index:r,label:n.content,onChange:e=>{n.content=e,a(n)},onDelete:s,toolbarOpts:p,spellCheck:u,error:h,maxImageWidth:g,maxImageHeight:m,uploadSoundSupport:f,configuration:t}),h&&ti.createElement(hi,null,h),ti.createElement(ui,null,ti.createElement(Nn,{label:"delete",onClick:s}),S&&ti.createElement(li,{mini:!0,label:"Remove after placing",checked:1===n.categoryCount,onChange:()=>{1===n.categoryCount?n.categoryCount=0:n.categoryCount=1,a(n)}})))};gi.propTypes={allowMultiplePlacements:ni.string,configuration:ni.object.isRequired,choice:ni.object.isRequired,deleteFocusedEl:ni.func,focusedEl:ni.number,index:ni.number,lockChoiceOrder:ni.bool,maxImageHeight:ni.object,maxImageWidth:ni.object,onChange:ni.func.isRequired,onDelete:ni.func.isRequired,correctResponseCount:ni.number.isRequired,imageSupport:ni.shape({add:ni.func.isRequired,delete:ni.func.isRequired}),toolbarOpts:ni.object,error:ni.string,uploadSoundSupport:ni.shape({add:ni.func.isRequired,delete:ni.func.isRequired}),spellCheck:ni.bool,rearrangeChoices:ni.func};var mi=ci.withUid(gi);const fi=t,bi=i,{styled:vi}=r,{TextField:yi}=s,Ci=vi("div")(({theme:e})=>({paddingTop:e.spacing(1),marginBottom:e.spacing(1)})),xi=vi(yi)({width:"100%"});class wi extends fi.Component{constructor(...e){super(...e),wi.prototype.__init.call(this)}static __initStatic(){this.propTypes={config:bi.object,onModelChanged:bi.func,spellCheck:bi.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.changeLabel=({target:e})=>{this.props.onModelChanged({choicesLabel:e.value})}}render(){const{config:e,spellCheck:t}=this.props;return fi.createElement(Ci,null,fi.createElement(xi,{InputLabelProps:{shrink:!0},variant:"outlined",label:"Label",value:e.choicesLabel,onChange:this.changeLabel,spellCheck:t}))}}wi.__initStatic(),wi.__initStatic2();const Si=t,Ri=i,{styled:Ei}=r,{choiceUtils:_i}=d;function ki(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Ai=Ei("div")(({theme:e})=>({marginBottom:e.spacing(2.5)})),Oi=Ei("div")(({theme:e})=>({paddingTop:e.spacing(1),paddingBottom:e.spacing(1),display:"grid",gridRowGap:`${e.spacing(1)}px`,gridColumnGap:`${e.spacing(1)}px`})),Li=Ei("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(.5)}));class Pi extends Si.Component{constructor(...e){super(...e),Pi.prototype.__init.call(this),Pi.prototype.__init2.call(this),Pi.prototype.__init3.call(this),Pi.prototype.__init4.call(this),Pi.prototype.__init5.call(this),Pi.prototype.__init6.call(this)}static __initStatic(){this.propTypes={model:Ri.object.isRequired,configuration:Ri.object.isRequired,choices:Ri.array.isRequired,defaultImageMaxWidth:Ri.number,defaultImageMaxHeight:Ri.number,onModelChanged:Ri.func.isRequired,imageSupport:Ri.shape({add:Ri.func.isRequired,delete:Ri.func.isRequired}),uploadSoundSupport:Ri.shape({add:Ri.func.isRequired,delete:Ri.func.isRequired}),toolbarOpts:Ri.object,spellCheck:Ri.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.state={focusedEl:null}}__init2(){this.changeChoice=e=>{const{choices:t,onModelChanged:n}=this.props,o=t.findIndex(t=>t.id===e.id);-1!==o&&(t.splice(o,1,e),n({choices:t}))}}__init3(){this.allChoicesHaveCount=e=>{const{choices:t}=this.props;return Array.isArray(t)&&t.every(t=>t.categoryCount===e)}}__init4(){this.addChoice=()=>{const{onModelChanged:e,model:t,choices:n}=this.props;let{maxAnswerChoices:o}=t||{};if(o&&ki([t,"access",e=>e.choices,"optionalAccess",e=>e.length])>=o)return;const i=_i.firstAvailableIndex(t.choices.map(e=>e.id),1),r={id:i,content:"Choice "+i};this.setState({focusedEl:n.length},()=>{e({choices:t.choices.concat([r])})})}}__init5(){this.deleteFocusedEl=()=>{this.setState({focusedEl:null})}}__init6(){this.deleteChoice=e=>{const{model:t,onModelChanged:n}=this.props,o=t.choices.findIndex(t=>t.id===e.id);var i;-1!==o&&(t.choices.splice(o,1),t.correctResponse=(i=e.id,t.correctResponse.map(e=>{{const t=dn(e.choices);return un(t,e=>e===i),{...e,choices:t}}})),n(t))}}render(){const{focusedEl:e}=this.state,{choices:t,model:n,imageSupport:o,uploadSoundSupport:i,onModelChanged:r,spellCheck:s,toolbarOpts:a,configuration:l,defaultImageMaxWidth:c,defaultImageMaxHeight:d}=this.props,{errors:u,allowMultiplePlacementsEnabled:p,lockChoiceOrder:h,maxAnswerChoices:g}=n,{choicesError:m,choicesErrors:f}=u||{},{maxImageWidth:b={},maxImageHeight:v={}}=l||{},y={gridTemplateColumns:`repeat(${n.categoriesPerRow}, 1fr)`},C=g&&ki([t,"optionalAccess",e=>e.length])>=g?`Only ${g} allowed maximum`:"";return Si.createElement(Ai,null,Si.createElement(Eo,{label:"Choices",buttonLabel:"ADD A CHOICE",onAdd:this.addChoice,buttonDisabled:g&&t&&ki([t,"optionalAccess",e=>e.length])>=g,tooltip:C}),Si.createElement(wi,{config:n,onModelChanged:r,spellCheck:s}),Si.createElement(Oi,{style:y},t.map((t,n)=>Si.createElement(mi,{key:t.id,choice:t,focusedEl:e,deleteFocusedEl:this.deleteFocusedEl,correctResponseCount:t.correctResponseCount,allowMultiplePlacements:p,lockChoiceOrder:h,index:n,imageSupport:o,onChange:this.changeChoice,onDelete:()=>this.deleteChoice(t),toolbarOpts:a,spellCheck:s,error:f&&f[t.id],maxImageWidth:b&&b.choice||c,maxImageHeight:v&&v.choice||d,uploadSoundSupport:i,configuration:l}))),m&&Si.createElement(Li,null,m))}}Pi.__initStatic(),Pi.__initStatic2();const{cloneDeep:Di}=o,Ii=(e,t,n)=>e.alternateResponses&&0!==e.alternateResponses.length?(e.alternateResponses[n]||[]).map(e=>t.find(t=>t.id===e)):[];function Mi(e,t){return null!=e?e:t()}function Ni(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const Ti=e=>"string"==typeof e,ji=()=>{let e,t;const n=new Promise((n,o)=>{e=n,t=o});return n.resolve=e,n.reject=t,n},$i=e=>null==e?"":""+e,Fi=/###/g,zi=e=>e&&e.indexOf("###")>-1?e.replace(Fi,"."):e,Hi=e=>!e||Ti(e),qi=(e,t,n)=>{const o=Ti(t)?t.split("."):t;let i=0;for(;i<o.length-1;){if(Hi(e))return{};const t=zi(o[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Hi(e)?{}:{obj:e,k:zi(o[i])}},Bi=(e,t,n)=>{const{obj:o,k:i}=qi(e,t,Object);if(void 0!==o||1===t.length)return void(o[i]=n);let r=t[t.length-1],s=t.slice(0,t.length-1),a=qi(e,s,Object);for(;void 0===a.obj&&s.length;)r=`${s[s.length-1]}.${r}`,s=s.slice(0,s.length-1),a=qi(e,s,Object),Ni([a,"optionalAccess",e=>e.obj])&&void 0!==a.obj[`${a.k}.${r}`]&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=n},Vi=(e,t)=>{const{obj:n,k:o}=qi(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,o))return n[o]},Wi=(e,t,n)=>{for(const o in t)"__proto__"!==o&&"constructor"!==o&&(o in e?Ti(e[o])||e[o]instanceof String||Ti(t[o])||t[o]instanceof String?n&&(e[o]=t[o]):Wi(e[o],t[o],n):e[o]=t[o]);return e},Ui=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ki={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Yi=e=>Ti(e)?e.replace(/[&<>"'\/]/g,e=>Ki[e]):e,Ji=[" ",",","?","!",";"],Xi=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),Gi=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const o=t.split(n);let i=e;for(let e=0;e<o.length;){if(!i||"object"!=typeof i)return;let t,r="";for(let s=e;s<o.length;++s)if(s!==e&&(r+=n),r+=o[s],t=i[r],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&s<o.length-1)continue;e+=s-e+1;break}i=t}return i},Qi=e=>Ni([e,"optionalAccess",e=>e.replace,"call",e=>e("_","-")]),Zi={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){Ni([console,"optionalAccess",t=>t[e],"optionalAccess",e=>e.apply,"optionalCall",e=>e(console,t)])}};class er{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Zi,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,o){return o&&!this.debug?null:(Ti(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new er(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new er(this.logger,e)}}var tr=new er;class nr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let o=0;o<n;o++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,o])=>{for(let i=0;i<o;i++)n.apply(n,[e,...t])})}}class or extends nr{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,o={}){const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,r=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):Ti(n)&&i?s.push(...n.split(i)):s.push(n)));const a=Vi(this.data,s);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=s[0],t=s[1],n=s.slice(2).join(".")),!a&&r&&Ti(n)?Gi(Ni([this,"access",e=>e.data,"optionalAccess",t=>t[e],"optionalAccess",e=>e[t]]),n,i):a}addResource(e,t,n,o,i={silent:!1}){const r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let s=[e,t];n&&(s=s.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(s=e.split("."),o=t,t=s[1]),this.addNamespaces(t),Bi(this.data,s,o),i.silent||this.emit("added",e,t,n,o)}addResources(e,t,n,o={silent:!1}){for(const o in n)(Ti(n[o])||Array.isArray(n[o]))&&this.addResource(e,t,o,n[o],{silent:!0});o.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,o,i,r={silent:!1,skipCopy:!1}){let s=[e,t];e.indexOf(".")>-1&&(s=e.split("."),o=n,n=t,t=s[1]),this.addNamespaces(t);let a=Vi(this.data,s)||{};r.skipCopy||(n=JSON.parse(JSON.stringify(n))),o?Wi(a,n,i):a={...a,...n},Bi(this.data,s,a),r.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var ir={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,o,i){return e.forEach(e=>{t=Mi(Ni([this,"access",e=>e.processors,"access",t=>t[e],"optionalAccess",e=>e.process,"call",e=>e(t,n,o,i)]),()=>t)}),t}};const rr=Symbol("i18next/PATH_KEY");function sr(e,t){const{[rr]:n}=e(function(){const e=[],t=Object.create(null);let n;return t.get=(o,i)=>(Ni([n,"optionalAccess",e=>e.revoke,"optionalCall",e=>e()]),i===rr?e:(e.push(i),n=Proxy.revocable(o,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return n.join(Mi(Ni([t,"optionalAccess",e=>e.keySeparator]),()=>"."))}const ar={},lr=e=>!Ti(e)&&"boolean"!=typeof e&&"number"!=typeof e;class cr extends nr{constructor(e,t={}){var n,o;super(),n=e,o=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{n[e]&&(o[e]=n[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=tr.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(null==e)return!1;const o=this.resolve(e,n);if(void 0===Ni([o,"optionalAccess",e=>e.res]))return!1;const i=lr(o.res);return!1!==n.returnObjects||!i}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const r=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const o=Ji.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===o.length)return!0;const i=Xi.getRegExp(`(${o.map(e=>"?"===e?"\\?":e).join("|")})`);let r=!i.test(e);if(!r){const t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(r=!0)}return r})(e,n,o));if(r&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Ti(i)?[i]:i};const r=e.split(n);(n!==o||n===o&&this.options.ns.indexOf(r[0])>-1)&&(i=r.shift()),e=r.join(o)}return{key:e,namespaces:Ti(i)?[i]:i}}translate(e,t,n){let o="object"==typeof t?{...t}:t;if("object"!=typeof o&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof o&&(o={...o}),o||(o={}),null==e)return"";"function"==typeof e&&(e=sr(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const i=void 0!==o.returnDetails?o.returnDetails:this.options.returnDetails,r=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(e[e.length-1],o),l=a[a.length-1];let c=void 0!==o.nsSeparator?o.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const d=o.lng||this.language,u=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===Ni([d,"optionalAccess",e=>e.toLowerCase,"call",e=>e()]))return u?i?{res:`${l}${c}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:`${l}${c}${s}`:i?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:s;const p=this.resolve(e,o);let h=Ni([p,"optionalAccess",e=>e.res]);const g=Ni([p,"optionalAccess",e=>e.usedKey])||s,m=Ni([p,"optionalAccess",e=>e.exactUsedKey])||s,f=void 0!==o.joinArrays?o.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==o.count&&!Ti(o.count),y=cr.hasDefaultValue(o),C=v?this.pluralResolver.getSuffix(d,o.count,o):"",x=o.ordinal&&v?this.pluralResolver.getSuffix(d,o.count,{ordinal:!1}):"",w=v&&!o.ordinal&&0===o.count,S=w&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${C}`]||o[`defaultValue${x}`]||o.defaultValue;let R=h;b&&!h&&y&&(R=S);const E=lr(R),_=Object.prototype.toString.apply(R);if(!(b&&R&&E&&["[object Number]","[object Function]","[object RegExp]"].indexOf(_)<0)||Ti(f)&&Array.isArray(R))if(b&&Ti(f)&&Array.isArray(h))h=h.join(f),h&&(h=this.extendTranslation(h,e,o,n));else{let t=!1,i=!1;!this.isValidLookup(h)&&y&&(t=!0,h=S),this.isValidLookup(h)||(i=!0,h=s);const a=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&i?void 0:h,u=y&&S!==h&&this.options.updateMissing;if(i||t||u){if(this.logger.log(u?"updateKey":"missingKey",d,l,s,u?S:h),r){const e=this.resolve(s,{...o,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(o.lng||this.language):e.push(o.lng||this.language);const n=(e,t,n)=>{const i=y&&n!==h?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,i,u,o):Ni([this,"access",e=>e.backendConnector,"optionalAccess",e=>e.saveMissing])&&this.backendConnector.saveMissing(e,l,t,i,u,o),this.emit("missingKey",e,l,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,o);w&&o[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,o[`defaultValue${t}`]||S)})}):n(e,s,S))}h=this.extendTranslation(h,e,o,p,n),i&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${l}${c}${s}`),(i||t)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${s}`:s,t?h:void 0,o))}else{if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,R,{...o,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(p.res=e,p.usedParams=this.getUsedParamsDetails(o),p):e}if(r){const e=Array.isArray(R),t=e?[]:{},n=e?m:g;for(const e in R)if(Object.prototype.hasOwnProperty.call(R,e)){const i=`${n}${r}${e}`;t[e]=y&&!h?this.translate(i,{...o,defaultValue:lr(S)?S[e]:void 0,joinArrays:!1,ns:a}):this.translate(i,{...o,joinArrays:!1,ns:a}),t[e]===i&&(t[e]=R[e])}h=t}}return i?(p.res=h,p.usedParams=this.getUsedParamsDetails(o),p):h}extendTranslation(e,t,n,o,i){if(Ni([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.parse]))e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const r=Ti(e)&&(void 0!==Ni([n,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(r){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let a=n.replace&&!Ti(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),e=this.interpolator.interpolate(e,a,n.lng||this.language||o.usedLng,n),r){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&o&&o.res&&(n.lng=this.language||o.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>Ni([i,"optionalAccess",e=>e[0]])!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}const r=n.postProcess||this.options.postProcess,s=Ti(r)?[r]:r;return null!=e&&Ni([s,"optionalAccess",e=>e.length])&&!1!==n.applyPostProcessor&&(e=ir.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,o,i,r,s;return Ti(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(n))return;const a=this.extractFromKey(e,t),l=a.key;o=l;let c=a.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const d=void 0!==t.count&&!Ti(t.count),u=d&&!t.ordinal&&0===t.count,p=void 0!==t.context&&(Ti(t.context)||"number"==typeof t.context)&&""!==t.context,h=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(n)||(s=e,ar[`${h[0]}-${e}`]||!Ni([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||Ni([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(s)])||(ar[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${o}" for languages "${h.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(o=>{if(this.isValidLookup(n))return;r=o;const s=[l];if(Ni([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.addLookupKeys]))this.i18nFormat.addLookupKeys(s,l,o,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(o,t.count,t));const n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&0===e.indexOf(i)&&s.push(l+e.replace(i,this.options.pluralSeparator)),s.push(l+e),u&&s.push(l+n)),p){const o=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(o),d&&(t.ordinal&&0===e.indexOf(i)&&s.push(o+e.replace(i,this.options.pluralSeparator)),s.push(o+e),u&&s.push(o+n))}}let a;for(;a=s.pop();)this.isValidLookup(n)||(i=a,n=this.getResource(o,e,a,t))}))})}),{res:n,usedKey:o,exactUsedKey:i,usedLng:r,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n,o={}){return Ni([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.getResource])?this.i18nFormat.getResource(e,t,n,o):this.resourceStore.getResource(e,t,n,o)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Ti(e.replace);let o=n?e.replace:e;if(n&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!n){o={...o};for(const e of t)delete o[e]}return o}static hasDefaultValue(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}class dr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=tr.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Qi(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Qi(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Ti(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;const o=this.getLanguagePartFromCode(e);if(this.isSupportedCode(o))return t=o;t=this.options.supportedLngs.find(e=>e===o?e:e.indexOf("-")<0&&o.indexOf("-")<0?void 0:e.indexOf("-")>0&&o.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===o||0===e.indexOf(o)&&o.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Ti(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),o=[],i=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Ti(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):Ti(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{o.indexOf(e)<0&&i(this.formatLanguageCode(e))}),o}}const ur={zero:0,one:1,two:2,few:3,many:4,other:5},pr={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class hr{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=tr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=Qi("dev"===e?"en":e),o=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:n,type:o});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let r;try{r=new Intl.PluralRules(n,{type:o})}catch(n){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),pr;if(!e.match(/-|_/))return pr;const o=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(o,t)}return this.pluralRulesCache[i]=r,r}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),Ni([n,"optionalAccess",e=>e.resolvedOptions,"call",e=>e(),"access",e=>e.pluralCategories,"access",e=>e.length])>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>ur[e]-ur[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){const o=this.getRule(e,n);return o?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const gr=(e,t,n,o=".",i=!0)=>{let r=((e,t,n)=>{const o=Vi(e,n);return void 0!==o?o:Vi(t,n)})(e,t,n);return!r&&i&&Ti(n)&&(r=Gi(e,n,o),void 0===r&&(r=Gi(t,n,o))),r},mr=e=>e.replace(/\$/g,"$$$$");class fr{constructor(e={}){this.logger=tr.create("interpolator"),this.options=e,this.format=Ni([e,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.format])||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:o,prefix:i,prefixEscaped:r,suffix:s,suffixEscaped:a,formatSeparator:l,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:u,nestingPrefixEscaped:p,nestingSuffix:h,nestingSuffixEscaped:g,nestingOptionsSeparator:m,maxReplaces:f,alwaysFormat:b}=e.interpolation;this.escape=void 0!==t?t:Yi,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==o&&o,this.prefix=i?Ui(i):r||"{{",this.suffix=s?Ui(s):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=u?Ui(u):p||Ui("$t("),this.nestingSuffix=h?Ui(h):g||Ui(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>Ni([e,"optionalAccess",e=>e.source])===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,o){let i,r,s;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const i=gr(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...o,...t,interpolationkey:e}):i}const i=e.split(this.formatSeparator),r=i.shift().trim(),s=i.join(this.formatSeparator).trim();return this.format(gr(t,a,r,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...o,...t,interpolationkey:r})};this.resetRegExp();const c=Ni([o,"optionalAccess",e=>e.missingInterpolationHandler])||this.options.missingInterpolationHandler,d=void 0!==Ni([o,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>mr(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?mr(this.escape(e)):mr(e)}].forEach(t=>{for(s=0;i=t.regex.exec(e);){const n=i[1].trim();if(r=l(n),void 0===r)if("function"==typeof c){const t=c(e,i,o);r=Ti(t)?t:""}else if(o&&Object.prototype.hasOwnProperty.call(o,n))r="";else{if(d){r=i[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),r=""}else Ti(r)||this.useRawValueToEscape||(r=$i(r));const a=t.safeValue(r);if(e=e.replace(i[0],a),d?(t.regex.lastIndex+=r.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,t,n={}){let o,i,r;const s=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const o=e.split(new RegExp(`${n}[ ]*{`));let i=`{${o[1]}`;e=o[0],i=this.interpolate(i,r);const s=i.match(/'/g),a=i.match(/"/g);(Mi(Ni([s,"optionalAccess",e=>e.length]),()=>0)%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{r=JSON.parse(i),t&&(r={...t,...r})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let a=[];r={...n},r=r.replace&&!Ti(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const l=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(-1!==l&&(a=o[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),o[1]=o[1].slice(0,l)),i=t(s.call(this,o[1].trim(),r),r),i&&o[0]===e&&!Ti(i))return i;Ti(i)||(i=$i(i)),i||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),i=""),a.length&&(i=a.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:o[1].trim()}),i.trim())),e=e.replace(o[0],i),this.regexp.lastIndex=0}return e}}const br=e=>{const t={};return(n,o,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const s=o+JSON.stringify(r);let a=t[s];return a||(a=e(Qi(o),i),t[s]=a),a(n)}},vr=e=>(t,n,o)=>e(Qi(n),o)(t);class yr{constructor(e={}){this.logger=tr.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?br:vr;this.formats={number:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=br(t)}format(e,t,n,o={}){const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(e=>e.indexOf(")")>-1)){const e=i.findIndex(e=>e.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}const r=i.reduce((e,t)=>{const{formatName:i,formatOptions:r}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const o=e.split("(");t=o[0].toLowerCase().trim();const i=o[1].substring(0,o[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(e=>{if(e){const[t,...o]=e.split(":"),i=o.join(":").trim().replace(/^'+|'+$/g,""),r=t.trim();n[r]||(n[r]=i),"false"===i&&(n[r]=!1),"true"===i&&(n[r]=!0),isNaN(i)||(n[r]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[i]){let t=e;try{const s=Ni([o,"optionalAccess",e=>e.formatParams,"optionalAccess",e=>e[o.interpolationkey]])||{},a=s.locale||s.lng||o.locale||o.lng||n;t=this.formats[i](e,a,{...r,...o,...s})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e);return r}}class Cr extends nr{constructor(e,t,n,o={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=o,this.logger=tr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],Ni([this,"access",e=>e.backend,"optionalAccess",e=>e.init,"optionalCall",e=>e(n,o.backend,o)])}queueLoad(e,t,n,o){const i={},r={},s={},a={};return e.forEach(e=>{let o=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===r[s]&&(r[s]=!0):(this.state[s]=1,o=!1,void 0===r[s]&&(r[s]=!0),void 0===i[s]&&(i[s]=!0),void 0===a[t]&&(a[t]=!0)))}),o||(s[e]=!0)}),(Object.keys(i).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(r),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(a)}}loaded(e,t,n){const o=e.split("|"),i=o[0],r=o[1];t&&this.emit("failedLoading",i,r,t),!t&&n&&this.store.addResourceBundle(i,r,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:o,k:i}=qi(e,t,Object);o[i]=o[i]||[],o[i].push(n)})(n.loaded,[i],r),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,o=0,i=this.retryTimeout,r){if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:o,wait:i,callback:r});this.readingCalls++;const s=(s,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}s&&a&&o<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,o+1,2*i,r)},i):r(s,a)},a=this.backend[n].bind(this.backend);if(2!==a.length)return a(e,t,s);try{const n=a(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(e){s(e)}}prepareLoading(e,t,n={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Ti(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ti(t)&&(t=[t]);const i=this.queueLoad(e,t,n,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),o=n[0],i=n[1];this.read(o,i,"read",void 0,void 0,(n,r)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${o} failed`,n),!n&&r&&this.logger.log(`${t}loaded namespace ${i} for language ${o}`,r),this.loaded(e,n,r)})}saveMissing(e,t,n,o,i,r={},s=()=>{}){if(!Ni([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||Ni([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(t)])){if(null!=n&&""!==n){if(Ni([this,"access",e=>e.backend,"optionalAccess",e=>e.create])){const a={...r,isUpdate:i},l=this.backend.create.bind(this.backend);if(l.length<6)try{let i;i=5===l.length?l(e,t,n,o,a):l(e,t,n,o),i&&"function"==typeof i.then?i.then(e=>s(null,e)).catch(s):s(null,i)}catch(e){s(e)}else l(e,t,n,o,s,a)}e&&e[0]&&this.store.addResource(e[0],t,n,o)}}else this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const xr=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Ti(e[1])&&(t.defaultValue=e[1]),Ti(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),wr=e=>(Ti(e.ns)&&(e.ns=[e.ns]),Ti(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ti(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),Ni([e,"access",e=>e.supportedLngs,"optionalAccess",e=>e.indexOf,"optionalCall",e=>e("cimode")])<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),Sr=()=>{};class Rr extends nr{constructor(e={},t){var n;if(super(),this.options=wr(e),this.services={},this.logger=tr,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Ti(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=xr();var o;this.options={...n,...this.options,...wr(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||Ni([o=this,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||Ni([o,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||Ni([o,"optionalAccess",e=>e.options,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.backends])&&o.options.backend.backends.some(e=>Ni([e,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0||Ni([e,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0)||"undefined"!=typeof console&&void 0!==console.info&&console.info("🌐 i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙");const i=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?tr.init(i(this.modules.logger),this.options):tr.init(null,this.options),e=this.modules.formatter?this.modules.formatter:yr;const t=new dr(this.options);this.store=new or(this.options.resources,this.options);const o=this.services;o.logger=tr,o.resourceStore=this.store,o.languageUtils=t,o.pluralResolver=new hr(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(o.formatter=i(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new fr(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new Cr(i(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(o.languageDetector=i(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=i(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new cr(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Sr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const r=ji(),s=()=>{const e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),r.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),r}loadResources(e,t=Sr){let n=t;const o=Ti(e)?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===Ni([o,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])&&(!this.options.preload||0===this.options.preload.length))return n();const e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};o?t(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),Ni([this,"access",e=>e.options,"access",e=>e.preload,"optionalAccess",e=>e.forEach,"optionalCall",e=>e(e=>t(e))]),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){const o=ji();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Sr),this.services.backendConnector.reload(e,t,e=>{o.resolve(),n(e)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&ir.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=ji();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,r)=>{r?this.isLanguageChangingTo===e&&(o(r),this.translator.changeLanguage(r),this.isLanguageChangingTo=void 0,this.emit("languageChanged",r),this.logger.log("languageChanged",r)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},r=t=>{e||t||!this.services.languageDetector||(t=[]);const n=Ti(t)?t:t&&t[0],r=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(Ti(t)?[t]:t);r&&(this.language||o(r),this.translator.language||this.translator.changeLanguage(r),Ni([this,"access",e=>e.services,"access",e=>e.languageDetector,"optionalAccess",e=>e.cacheUserLanguage,"optionalCall",e=>e(r)])),this.loadResources(r,e=>{i(e,r)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),n}getFixedT(e,t,n){const o=(e,t,...i)=>{let r;r="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(i)):{...t},r.lng=r.lng||o.lng,r.lngs=r.lngs||o.lngs,r.ns=r.ns||o.ns,""!==r.keyPrefix&&(r.keyPrefix=r.keyPrefix||n||o.keyPrefix);const s=this.options.keySeparator||".";let a;return r.keyPrefix&&Array.isArray(e)?a=e.map(e=>("function"==typeof e&&(e=sr(e,{...this.options,...t})),`${r.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=sr(e,{...this.options,...t})),a=r.keyPrefix?`${r.keyPrefix}${s}${e}`:e),this.t(a,r)};return Ti(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(...e){return Ni([this,"access",e=>e.translator,"optionalAccess",e=>e.translate,"call",t=>t(...e)])}exists(...e){return Ni([this,"access",e=>e.translator,"optionalAccess",e=>e.exists,"call",t=>t(...e)])}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const r=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,r);if(void 0!==e)return e}return!(!this.hasResourceBundle(n,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!r(n,e)||o&&!r(i,e)))}loadNamespaces(e,t){const n=ji();return this.options.ns?(Ti(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=ji();Ti(e)&&(e=[e]);const o=this.options.preload||[],i=e.filter(e=>o.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=o.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(Ni([this,"access",e=>e.languages,"optionalAccess",e=>e.length])>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=Ni([this,"access",e=>e.services,"optionalAccess",e=>e.languageUtils])||new dr(xr());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const n=new Rr(e,t);return n.createInstance=Rr.createInstance,n}cloneInstance(e={},t=Sr){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},i=new Rr(o);if(void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e)),["store","services","language"].forEach(e=>{i[e]=this[e]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},n){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,o)=>(n[o]={...e[t][o]},n),e[t]),e),{});i.store=new or(e,o),i.services.resourceStore=i.store}if(e.interpolation){const t={...xr().interpolation,...this.options.interpolation,...e.interpolation},n={...o,interpolation:t};i.services.interpolator=new fr(n)}return i.translator=new cr(i.services,o),i.translator.on("*",(e,...t)=>{i.emit(e,...t)}),i.init(o,t),i.translator.options=o,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Er=Rr.createInstance();Er.createInstance,Er.dir,Er.init,Er.loadResources,Er.reloadResources,Er.use,Er.changeLanguage,Er.getFixedT,Er.t,Er.exists,Er.setDefaultNamespace,Er.hasLoadedNamespace,Er.loadNamespaces,Er.loadLanguages,Er.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{primaryCorrectWithAlternates:"Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",commonCorrectAnswerWithAlternates:"Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{primaryCorrectWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",commonCorrectAnswerWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var _r={translator:{...Er,t:(e,t)=>{const{lng:n}=t;switch(n){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return Er.t(e,{lng:n,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const kr=t,Ar=i,{styled:Or}=r,{FeedbackConfig:Lr}=d,{InputContainer:Pr}=d,{layout:Dr}=d,{settings:Ir}=d,{AlertDialog:Mr}=d,Nr=u,{DragProvider:Tr}=p,{uid:jr}=p,{renderMath:$r}=c;function Fr(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{translator:zr}=_r,{dropdown:Hr,Panel:qr,toggle:Br,radio:Vr,numberField:Wr}=Ir,{Provider:Ur}=jr;class Kr extends kr.Component{constructor(...e){super(...e),Kr.prototype.__init.call(this)}__init(){this.containerRef=kr.createRef()}componentDidMount(){this.containerRef.current&&setTimeout(()=>$r(this.containerRef.current),0)}render(){return kr.createElement("div",{ref:this.containerRef},this.props.children)}}const Yr=Or(Eo)(({theme:e})=>({marginBottom:e.spacing(2)})),Jr=Or(Pr)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Xr=Or("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class Gr extends kr.Component{static __initStatic(){this.propTypes={configuration:Ar.object,className:Ar.string,onConfigurationChanged:Ar.func,model:Ar.object.isRequired,onChange:Ar.func.isRequired,uid:Ar.string,imageSupport:Ar.shape({add:Ar.func.isRequired,delete:Ar.func.isRequired}),uploadSoundSupport:Ar.shape({add:Ar.func.isRequired,delete:Ar.func.isRequired})}}constructor(e){super(e),Gr.prototype.__init2.call(this),Gr.prototype.__init3.call(this),Gr.prototype.__init4.call(this),Gr.prototype.__init5.call(this),Gr.prototype.__init6.call(this),Gr.prototype.__init7.call(this),Gr.prototype.__init8.call(this),Gr.prototype.__init9.call(this),Gr.prototype.__init10.call(this),Gr.prototype.__init11.call(this),Gr.prototype.__init12.call(this),Gr.prototype.__init13.call(this),Gr.prototype.__init14.call(this),Gr.prototype.__init15.call(this),Gr.prototype.__init16.call(this),Gr.prototype.__init17.call(this),Gr.prototype.__init18.call(this),Gr.prototype.__init19.call(this),Gr.prototype.__init20.call(this),Gr.prototype.__init21.call(this),this.uid=e.uid||jr.generateId(),this.state={activeDragItem:null}}__init2(){this.updateModel=e=>{const{model:t,onChange:n}=this.props,o={...t,...e};var i;o.choices=o.choices.map(e=>({...e,categoryCount:this.checkAllowMultiplePlacements(o.allowMultiplePlacementsEnabled,e)})),o.correctResponse=(i=o.correctResponse||[],(o.choices||[]).reduce((e,t)=>{if(hn("choice: ----\x3e ",t.id,"categoryCount: ",t.categoryCount),void 0===t.categoryCount||0===t.categoryCount)return e;{const n=e.map(e=>e.choices);return gn(t.id,n,t.categoryCount).map((t,n)=>({category:e[n].category,alternateResponses:e[n].alternateResponses,choices:t}))}},i)),o.correctResponse=((e,t)=>(t=t||[]).reduce((e,t)=>{if(hn("choice: ----\x3e ",t.id,"categoryCount: ",t.categoryCount),void 0===t.categoryCount||0===t.categoryCount)return e;{let n={};e.forEach(e=>(e.alternateResponses||[]).forEach((e,t)=>{t in n||(n[t]=[]),n[t].push(e)}));const o=[];Object.keys(n).forEach(e=>{const i=gn(t.id,n[e],t.categoryCount);n[e]=i,n[e].forEach((e,t)=>{o[t]||(o[t]=[]),o[t].push(e)})});const i=e.map((e,t)=>({category:e.category,alternateResponses:o[t]||e.alternateResponses,choices:e.choices}));return i}},e))(o.correctResponse||[],o.choices),o.categories=o.categories.map(e=>({id:e.id,label:e.label})),o.choices=o.choices.map(e=>({id:e.id,content:e.content,categoryCount:e.categoryCount})),o.maxChoicesPerCategory=o.allowMaxChoicesPerCategory?o.maxChoicesPerCategory:0,n(o)}}__init3(){this.changeRationale=e=>{const{model:t,onChange:n}=this.props;n({...t,rationale:e})}}__init4(){this.changeTeacherInstructions=e=>{const{model:t,onChange:n}=this.props;n({...t,teacherInstructions:e})}}__init5(){this.changeFeedback=e=>{this.updateModel({feedback:e})}}__init6(){this.onAddAlternateResponse=()=>{const{model:{correctResponse:e}}=this.props;this.updateModel({correctResponse:(e||[]).map(e=>({...e,alternateResponses:[...e.alternateResponses||[],[]]}))})}}__init7(){this.onPromptChanged=e=>this.updateModel({prompt:e})}__init8(){this.onRemoveAlternateResponse=e=>{const{model:{correctResponse:t}}=this.props;this.updateModel({correctResponse:(t||[]).map(t=>({...t,alternateResponses:(t.alternateResponses||[]).filter((t,n)=>n!==e)}))})}}__init9(){this.countChoiceInCorrectResponse=e=>{const{model:t}=this.props;return((e,t)=>{const n=t.reduce((t,n)=>t+((e,t)=>(t||[]).filter(t=>t===e).length)(e,n.choices),0);return hn("[countInAnswer] choiceId:",e,t),n})(e.id,t.correctResponse)}}__init10(){this.checkAllowMultiplePlacements=(e,t)=>e===ko?0:"No"===e?1:t.categoryCount||0}__init11(){this.isAlertModalOpened=()=>{const{model:e}=this.props,{maxChoicesPerCategory:t=0}=e||{},n=Oo(e);return 0!==t&&n>t}}__init12(){this.onAlertModalCancel=()=>{const{model:e}=this.props,t=Oo(e);this.updateModel({maxChoicesPerCategory:t})}}__init13(){this.onDragStart=e=>{const{active:t}=e,n=t.data.current;this.setState({activeDragItem:n})}}__init14(){this.onDragEnd=e=>{const{active:t,over:n}=e;if(this.setState({activeDragItem:null}),!n||!t)return;const{model:o}=this.props,{allowAlternateEnabled:i}=o,r=t.data.current,s=n.data.current;if("choice-preview"===r.type&&"category"===s.type){const e=Fr([r,"access",e=>e.choice,"optionalAccess",e=>e.id])||("string"==typeof r.id?r.id.split("-")[0]:r.id);this.moveChoice(e,r.categoryId,s.id,r.choiceIndex||0)}if("choice"===r.type&&"category"===s.type&&this.addChoiceToCategory({id:r.id},s.id),"choice-preview"===r.type&&"category-alternate"===s.type){const e=s.alternateResponseIndex,t=Fr([r,"access",e=>e.choice,"optionalAccess",e=>e.id])||("string"==typeof r.id?r.id.split("-")[0]:r.id);this.moveChoiceInAlternate(t,r.categoryId,s.id,r.choiceIndex||0,e)}if(i&&"choice"===r.type&&"category-alternate"===s.type){const e=r.id,t=s.id,n=s.alternateResponseIndex;this.addChoiceToAlternateCategory({id:e},t,n)}}}__init15(){this.addChoiceToCategory=(e,t)=>{const{model:n}=this.props;let{choices:o=[],correctResponse:i=[],maxChoicesPerCategory:r=0}=n||{};const s=(o||[]).find(t=>t.id===e.id);let a=yn(e.id,void 0,t,0,i);0!==s.categoryCount&&(a=fn(e,t,a));const l=Oo(n);this.updateModel({correctResponse:a,maxChoicesPerCategory:0!==r&&r<l?r+1:r})}}__init16(){this.deleteChoiceFromCategory=(e,t,n)=>{const{model:o}=this.props,i=bn(t.id,e.id,n,o.correctResponse);this.updateModel({correctResponse:i})}}__init17(){this.moveChoice=(e,t,n,o)=>{const{model:i}=this.props;let{choices:r,correctResponse:s=[],maxChoicesPerCategory:a=0}=i||{};const l=(r||[]).find(t=>t.id===e);if(n===t||!l)return;0!==l.categoryCount?(s=yn(l.id,t,n,o,s),s=fn(l,n,s)):0===l.categoryCount&&(s=yn(l.id,void 0,n,0,s));const c=Oo(i);this.updateModel({correctResponse:s,maxChoicesPerCategory:0!==a&&a<c?a+1:a})}}__init18(){this.addChoiceToAlternateCategory=(e,t,n)=>{const{model:o}=this.props,{correctResponse:i,choices:r,maxChoicesPerCategory:s=0}=o,a=r.find(t=>t.id===e.id);i.forEach(o=>o.category===t?(o.alternateResponses=o.alternateResponses||[],void 0===o.alternateResponses[n]&&(o.alternateResponses[n]=[]),o.alternateResponses[n].push(e.id),a.categoryCount&&0!==a.categoryCount&&(o.alternateResponses[n]=o.alternateResponses[n].reduce((e,t)=>(t===a.id?-1===e.findIndex(e=>e===a.id)&&e.push(t):e.push(t),e),[])),o):o.alternateResponses[n]&&0!==a.categoryCount?(o.alternateResponses[n]=o.alternateResponses[n].filter(t=>t!==e.id),o):o);const l=Oo(o);this.updateModel({correctResponse:i,maxChoicesPerCategory:0!==s&&s<l?s+1:s})}}__init19(){this.moveChoiceInAlternate=(e,t,n,o,i)=>{const{model:r}=this.props;let{choices:s,correctResponse:a=[],maxChoicesPerCategory:l=0}=r||{};const c=(s||[]).find(t=>t.id===e);a=((e,t,n,o,i,r,s)=>(hn("[moveChoiceToAlternate] choice: ",e,"from: ",t,"to: ",n,"answers: ",i,"chocieIndex: ",o),t===n?i:i.map(o=>(o.category===n&&(0!==s&&o.alternateResponses&&(o.alternateResponses[r]=(o.alternateResponses[r]||[]).filter(t=>t!==e)),o.alternateResponses||(o.alternateResponses=[],o.alternateResponses[r]=[]),o.alternateResponses[r].push(e)),o.category===t&&0!==s&&o.alternateResponses&&o.alternateResponses[r]&&(o.alternateResponses[r]=o.alternateResponses[r].filter(t=>t!==e)),o))))(e,t,n,o,a,i,Fr([c,"optionalAccess",e=>e.categoryCount]));const d=Oo(r);this.updateModel({correctResponse:a,maxChoicesPerCategory:0!==l&&l<d?l+1:l})}}__init20(){this.deleteChoiceFromAlternateCategory=(e,t,n,o)=>{const{model:i}=this.props,r=vn(t.id,e.id,n,o,i.correctResponse);this.updateModel({correctResponse:r})}}__init21(){this.renderDragOverlay=()=>{const{activeDragItem:e}=this.state,{model:t,configuration:n}=this.props;if(!e)return null;if("choice"===e.type){const o=Fr([t,"access",e=>e.choices,"optionalAccess",e=>e.find,"call",t=>t(t=>t.id===e.id)]);return o?kr.createElement(mi,{choice:o,configuration:n}):null}if("choice-preview"===e.type&&void 0===e.alternateResponseIndex){const n=Fr([t,"access",e=>e.choices,"optionalAccess",e=>e.find,"call",t=>t(t=>t.id===e.id)]);return n?kr.createElement(Kn,{choice:n}):null}if("choice-preview"===e.type&&void 0!==e.alternateResponseIndex){const n=Fr([t,"access",e=>e.choices,"optionalAccess",e=>e.find,"call",t=>t(t=>t.id===e.id)]);return n?kr.createElement(Kn,{choice:n,alternateResponseIndex:e.alternateResponseIndex}):null}return null}}render(){const{configuration:e,imageSupport:t,model:n,uploadSoundSupport:o,onConfigurationChanged:i}=this.props,{allowAlternate:r={},allowMultiplePlacements:s={},baseInputConfiguration:a={},categoriesPerRow:l={},choicesPosition:c={},contentDimensions:d={},feedback:u={},lockChoiceOrder:p={},maxImageHeight:h={},maxImageWidth:g={},maxPlacements:m={},minCategoriesPerRow:f=1,partialScoring:b={},prompt:v={},rationale:y={},scoringType:C={},settingsPanelDisabled:x,spellCheck:w={},studentInstructions:S={},teacherInstructions:R={},withRubric:E={},mathMlOptions:k={},language:A={},languageChoices:O={},allowMaxAnswerChoices:L={}}=e||{},{allowAlternateEnabled:P,allowMaxChoicesPerCategory:D,errors:I,feedbackEnabled:M,maxChoicesPerCategory:N,promptEnabled:T,rationaleEnabled:j,spellCheckEnabled:$,teacherInstructionsEnabled:F,toolbarEditorPosition:z,extraCSSRules:H}=n||{},{prompt:q,rationale:B,teacherInstructions:V}=I||{},W={position:"top"===z?"top":"bottom"},U=n.config||{};U.choices=U.choices||{label:"",columns:2};const K=((e,t,n)=>Di(e).map(e=>{const o=n.find(t=>t.category===e.id);return o&&(e.choices=(o.choices||[]).map(e=>{const n=t.find(t=>t.id===e);if(n)return Object.assign({},{id:n.id,content:n.content})})),e}))(n.categories||[],n.choices||[],n.correctResponse||[]),Y=((e,t,n)=>{const o=n.reduce((e,t)=>t.alternateResponses&&t.alternateResponses.length>=e?t.alternateResponses.length:e,0);return new Array(o).fill(0).map((o,i)=>n.map((n,o)=>{const r=e[o];return{id:r.id,label:r.label,choices:Ii(n,t,i)}}))})(n.categories||[],n.choices||[],n.correctResponse||[]),J=n.choices.map(e=>(e.correctResponseCount=this.countChoiceInCorrectResponse(e),e.categoryCount=this.checkAllowMultiplePlacements(n.allowMultiplePlacementsEnabled,e),e)),X=g&&g.prompt,G=h&&h.prompt,Q={partialScoring:b.settings&&Br(b.label),lockChoiceOrder:p.settings&&Br(p.label),categoriesPerRow:l.settings&&Wr(l.label,{label:l.label,min:f,max:6}),choicesPosition:c.settings&&Vr(c.label,["below","above","left","right"]),allowMultiplePlacementsEnabled:s.settings&&Hr(s.label,[ko,"No",Ao]),maxAnswerChoices:L.settings&&Wr(L.label,{label:"",min:Fr([J,"optionalAccess",e=>e.length])||0,max:30}),allowMaxChoicesPerCategory:m.settings&&Br(m.label),maxChoicesPerCategory:!0===D&&Wr(m.label,{label:"",min:0,max:30}),promptEnabled:v.settings&&Br(v.label),feedbackEnabled:u.settings&&Br(u.label),allowAlternateEnabled:r.settings&&Br(r.label),"language.enabled":A.settings&&Br(A.label,!0),language:A.settings&&A.enabled&&Hr(O.label,O.options)},Z={teacherInstructionsEnabled:R.settings&&Br(R.label),studentInstructionsEnabled:S.settings&&Br(S.label),rationaleEnabled:y.settings&&Br(y.label),spellCheckEnabled:w.settings&&Br(w.label),scoringType:C.settings&&Vr(C.label,["auto","rubric"]),rubricEnabled:Fr([E,"optionalAccess",e=>e.settings])&&Br(Fr([E,"optionalAccess",e=>e.label]))},ee=this.isAlertModalOpened(),te=zr.t("translation:categorize:maxChoicesPerCategoryRestriction",{lng:n.language,maxChoicesPerCategory:N});return kr.createElement(Tr,{onDragStart:this.onDragStart,onDragEnd:this.onDragEnd},kr.createElement(Ur,{value:this.uid},kr.createElement(Dr.ConfigLayout,{extraCSSRules:H,dimensions:d,hideSettings:x,settings:kr.createElement(qr,{model:n,onChangeModel:this.updateModel,configuration:e,onChangeConfiguration:i,groups:{Settings:Q,Properties:Z},modal:kr.createElement(Mr,{title:"Warning",text:te,open:ee,onClose:this.onAlertModalCancel})})},F&&kr.createElement(Jr,{label:R.label},kr.createElement(Nr,{markup:n.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:t,error:V,nonEmpty:!1,toolbarOpts:W,pluginProps:_(Fr([R,"optionalAccess",e=>e.inputConfiguration]),a),spellCheck:$,maxImageWidth:g&&g.teacherInstructions||X,maxImageHeight:h&&h.teacherInstructions||G,uploadSoundSupport:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:k}),V&&kr.createElement(Xr,null,V)),T&&kr.createElement(Jr,{label:v.label},kr.createElement(Nr,{markup:n.prompt||"",onChange:this.onPromptChanged,imageSupport:t,error:q,nonEmpty:!1,disableUnderline:!0,toolbarOpts:W,pluginProps:_(Fr([v,"optionalAccess",e=>e.inputConfiguration]),a),spellCheck:$,maxImageWidth:g&&g.prompt,maxImageHeight:h&&h.prompt,uploadSoundSupport:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:k}),q&&kr.createElement(Xr,null,q)),kr.createElement(Ko,{imageSupport:t,uploadSoundSupport:o,model:n,categories:K||[],onModelChanged:this.updateModel,toolbarOpts:W,spellCheck:$,configuration:e,defaultImageMaxWidth:X,defaultImageMaxHeight:G,mathMlOptions:k}),kr.createElement(Pi,{imageSupport:t,uploadSoundSupport:o,choices:J,model:n,onModelChanged:this.updateModel,toolbarOpts:W,spellCheck:$,configuration:e,defaultImageMaxWidth:X,defaultImageMaxHeight:G}),P&&kr.createElement(Yr,{label:"Alternate Responses",buttonLabel:"ADD AN ALTERNATE RESPONSE",onAdd:this.onAddAlternateResponse}),P&&Y.map((i,r)=>kr.createElement(kr.Fragment,{key:r},kr.createElement(Yr,{variant:"subtitle1",label:"Alternate Response",buttonLabel:"REMOVE ALTERNATE RESPONSE",onAdd:()=>this.onRemoveAlternateResponse(r)}),kr.createElement(ei,{altIndex:r,imageSupport:t,model:n,configuration:e,categories:i,onModelChanged:this.updateModel,uploadSoundSupport:o,mathMlOptions:k}))),j&&kr.createElement(Jr,{label:y.label},kr.createElement(Nr,{markup:n.rationale||"",onChange:this.changeRationale,imageSupport:t,error:B,nonEmpty:!1,toolbarOpts:W,pluginProps:_(Fr([v,"optionalAccess",e=>e.inputConfiguration]),a),spellCheck:$,maxImageWidth:g&&g.rationale||X,maxImageHeight:h&&h.rationale||G,uploadSoundSupport:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:k}),B&&kr.createElement(Xr,null,B)),M&&kr.createElement(Lr,{feedback:n.feedback,onChange:this.changeFeedback,toolbarOpts:W})),kr.createElement(ln,null,kr.createElement(Kr,null,this.renderDragOverlay()))))}}Gr.__initStatic();const Qr=t,Zr=i;class es extends Qr.Component{static __initStatic(){this.propTypes={configuration:Zr.object,onConfigurationChanged:Zr.func,model:Zr.object.isRequired,onModelChanged:Zr.func.isRequired,imageSupport:Zr.object,uploadSoundSupport:Zr.object}}static __initStatic2(){this.defaultProps={}}render(){const{model:e,onModelChanged:t,configuration:n,onConfigurationChanged:o,imageSupport:i,uploadSoundSupport:r}=this.props;return Qr.createElement(Gr,{imageSupport:i,uploadSoundSupport:r,title:"Design",model:e,configuration:n,onChange:t,onConfigurationChanged:o})}}es.__initStatic(),es.__initStatic2();var ts={allowAlternateEnabled:!0,allowMaxChoicesPerCategory:!1,allowMultiplePlacementsEnabled:ko,alternates:[],categories:[],categoriesPerRow:2,choices:[],choicesLabel:"",choicesPosition:"below",correctResponse:[],feedbackEnabled:!1,lockChoiceOrder:!0,maxAnswerChoices:6,maxChoicesPerCategory:0,partialScoring:!0,promptEnabled:!0,rationaleEnabled:!0,rowLabels:[""],studentInstructionsEnabled:!0,teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",minRowHeight:"80px"},ns={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},feedback:{settings:!0,label:"Feedback",enabled:!0},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},choicesPosition:{settings:!0,label:"Choices Position"},allowMultiplePlacements:{settings:!0,label:"Allow Multiple Placements"},maxPlacements:{settings:!0,label:"Max choices per category"},allowAlternate:{settings:!0,label:"Allow Alternate Correct Answers"},categoriesPerRow:{settings:!0,label:"Categories per row"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},prompt:{settings:!0,label:"Prompt",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},rationale:{settings:!0,label:"Rationale",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},scoringType:{settings:!1,label:"Scoring Type"},settingsPanelDisabled:!1,studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},headers:{inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}}},rowLabels:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300,rowLabel:200,categoryLabel:260,choices:240},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,rowLabel:100,categoryLabel:100,choices:150},withRubric:{settings:!1,label:"Add Rubric"},minCategoriesPerRow:1,allowMaxAnswerChoices:{settings:!0,label:"Max answer choices"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const os=t,{renderMath:is}=c;function rs(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}class ss extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...ts,...e})}static __initStatic2(){this.disableAlternateResponses=e=>{let{correctResponse:t}=e||{};t=t||[];const n=t.map(e=>{const{alternateResponses:t,...n}=e;return n});return{...e,correctResponse:n,allowAlternateEnabled:!1}}}constructor(){super(),this._root=null,this._model=ss.createDefaultModel(),this._configuration=ns}set model(e){this._model=ss.createDefaultModel(e),e.choices&&e.choices.length>=e.maxAnswerChoices&&(this._model.maxAnswerChoices=e.choices.length,console.warn("Max Answer Choices can't be less than choices length!")),this.render()}set configuration(e){const t={...ns,...e};this._configuration=t,rs([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?rs([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=rs([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.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.render()}onModelChanged(e){this._model=e,this.render(),this.dispatchEvent(new b(this._model,!1))}onConfigurationChanged(e){this._configuration=e,this.render()}connectedCallback(){this.render()}insertImage(e){this.dispatchEvent(new x(e))}onDeleteImage(e,t){this.dispatchEvent(new y(e,t))}insertSound(e){this.dispatchEvent(new E(e))}onDeleteSound(e,t){this.dispatchEvent(new S(e,t))}render(){const e=os.createElement(es,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=h(this)),this._root.render(e),setTimeout(()=>{is(this)},0)}disconnectedCallback(){this._root&&this._root.unmount()}}ss.__initStatic(),ss.__initStatic2();export{ss as default};
|