@project-sunbird/collection-editor-react 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -533,7 +533,7 @@ to {
533
533
  `);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
534
534
  `),a=o===-1?-1:i.indexOf(`
535
535
  `,o+1),c=a===-1?"":i.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
536
- `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=gn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Li.assertOptions(n,{silentJSONParsing:St.transitional(St.boolean),forcedJSONParsing:St.transitional(St.boolean),clarifyTimeoutError:St.transitional(St.boolean),legacyInterceptorReqResOrdering:St.transitional(St.boolean),advertiseZstdAcceptEncoding:St.transitional(St.boolean),validateStatusUndefinedResolves:St.transitional(St.boolean)},!1),s!=null&&(L.isFunction(s)?r.paramsSerializer={serialize:s}:Li.assertOptions(s,{encode:St.function,serialize:St.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Li.assertOptions(r,{baseUrl:St.spelling("baseURL"),withXsrfToken:St.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&L.merge(i.common,i[r.method]);i&&L.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete i[b]}),r.headers=kt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const v=r.transitional||Ol;v&&v.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,m;if(!c){const b=[eu.bind(this),void 0];for(b.unshift(...a),b.push(...u),m=b.length,d=Promise.resolve(r);f<m;)d=d.then(b[f++],b[f++]);return d}m=a.length;let p=r;for(;f<m;){const b=a[f++],h=a[f++];try{p=b(p)}catch(v){h.call(this,v);break}}try{d=eu.call(this,p)}catch(b){return Promise.reject(b)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=gn(this.defaults,t);const r=ch(t.baseURL,t.url,t.allowAbsoluteUrls,t);return sh(r,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){hn.prototype[t]=function(r,n){return this.request(gn(n||{},{method:t,url:r,data:n&&L.hasOwnProp(n,"data")?n.data:void 0}))}});L.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(gn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}hn.prototype[t]=r(),t!=="query"&&(hn.prototype[t+"Form"]=r(!0))});let Yx=class hh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new si(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new hh(function(s){t=s}),cancel:t}}};function Zx(e){return function(r){return e.apply(null,r)}}function Xx(e){return L.isObject(e)&&e.isAxiosError===!0}const Ha={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ha).forEach(([e,t])=>{Ha[t]=e});function ph(e){const t=new hn(e),r=Vf(hn.prototype.request,t);return L.extend(r,hn.prototype,t,{allOwnKeys:!0}),L.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ph(gn(e,s))},r}const rt=ph(ni);rt.Axios=hn;rt.CanceledError=si;rt.CancelToken=Yx;rt.isCancel=ah;rt.VERSION=jl;rt.toFormData=xo;rt.AxiosError=J;rt.Cancel=rt.CanceledError;rt.all=function(t){return Promise.all(t)};rt.spread=Zx;rt.isAxiosError=Xx;rt.mergeConfig=gn;rt.AxiosHeaders=kt;rt.formToJSON=e=>oh(L.isHTMLForm(e)?new FormData(e):e);rt.getAdapter=fh.getAdapter;rt.HttpStatusCode=Ha;rt.default=rt;const{Axios:zq,AxiosError:Vq,CanceledError:Hq,isCancel:Qq,CancelToken:Wq,VERSION:Gq,all:Kq,Cancel:Yq,isAxiosError:Zq,spread:Xq,toFormData:Jq,AxiosHeaders:e$,HttpStatusCode:t$,formToJSON:r$,getAdapter:n$,mergeConfig:s$,create:i$}=rt;let Qa="";function mh(e){Qa=e}const Fe=rt.create({timeout:3e4});function Jx(e,t){if(!e||typeof t!="string"||!t.trim())return e;const r=t.trim().replace(/\/+$/,""),n=r.startsWith("/")?r:`/${r}`;return e.replace(/^\/(action|api|portal)(?=\/|$)/,n)}Fe.interceptors.request.use(async e=>{var s,i,o;const{useEditorStore:t}=await Promise.resolve().then(()=>ub),r=t.getState(),n=(s=r.editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),e.url=Jx(e.url,(o=(i=r.editorConfig)==null?void 0:i.config)==null?void 0:o.apiSlug),Qa&&(e.baseURL=Qa),e});const gh="/portal";async function vh(e){var n,s,i,o,a,c,u;const t=await Fe.get(`${gh}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const d=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((u=t.data)==null?void 0:u.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${d}`)}return r}async function e0(e){var r,n;return e.length?((n=(r=(await Fe.post(`${gh}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function Eo(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(u=>Eo(u,n)):[],c=i==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent"||i==="application/vnd.sunbird.questionset"&&a.length>0;return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:c,children:a,metadata:r,parent:t}}async function yh(e){var s,i,o,a,c,u,d;const t=await Fe.get(`/action/collection/v1/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Eo(r);return{content:r,rootNode:n}}async function t0(e){const t=await vh(e),r=Eo(t);return{content:t,rootNode:r}}async function r0(e,t,r,n){var i;return((i=(await Fe.patch("/action/collection/v1/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function n0(e,t=""){await Fe.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function bh(e){var n,s,i,o,a,c,u;const t=await Fe.get(`/action/course/v1/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.content;if(!r||!r.identifier){const d=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((u=t.data)==null?void 0:u.responseCode)||`No course returned for "${e}"`;throw new Error(`Unable to load course hierarchy: ${d}`)}return r}async function s0(e){var r,n;return(n=(r=(await Fe.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function i0(e){await Fe.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function o0(e,t){await Fe.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function a0(e,t){await Fe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const l0="application/vnd.sunbird.questionset";function Ch(e){let t=!1,r=!0;function n(s){for(const i of s){const o=i.children??[];if(o.length>0){n(o);continue}t=!0,i.objectType==="QuestionSet"&&i.mimeType===l0||(r=!1)}}return n(e.children??[]),t&&r}const ru=new Map;async function Sh(e){const t=ru.get(e);if(t)return t;const r=await bh(e),{children:n,...s}=r??{},i={qualifies:Ch(r),meta:s};return ru.set(e,i),i}async function _h(e){return(await Sh(e)).qualifies}async function c0(e){var n;const t=e.children??[],r=[];for(let s=0;s<t.length;s++){const i=t[s],o=i.children??[],a=[];for(const c of o){let u=!!((n=c.metadata)!=null&&n.isAssessmentCourse);if(!u){if((c.children??[]).length>0)u=Ch(c);else if(o.length===1&&(s===0||s===t.length-1))try{u=await _h(c.identifier)}catch(d){console.error("[lpStructure] assessment-course check failed on load:",d)}}a.push({...c,isFolder:!1,children:[],metadata:{...c.metadata??{},...u?{isAssessmentCourse:!0}:{}}})}r.push({...i,children:a})}return{...e,children:r}}function lt(e){var r,n;const t=(e==null?void 0:e.children)??[];return t.length===1&&!!((n=(r=t[0])==null?void 0:r.metadata)!=null&&n.isAssessmentCourse)}function u0(e,t,r){return r?e===0?"pre":e===t-1?"post":"levelAssessment":"content"}function d0(e,t){const r=e.findIndex(s=>s.id===t);return r===-1?null:Bs(e,r)?{role:r===0?"pre":"post",levelNumber:null}:{role:"level",levelNumber:e.slice(0,r+1).filter((s,i)=>!Bs(e,i)).length}}function Ms(e,t){return t==="pre"?e.length>0&&lt(e[0]):e.length>1&&lt(e[e.length-1])}function Bs(e,t){const r=u0(t,e.length,lt(e[t]));return r==="pre"||r==="post"}function Wa(e,t){const r=t?e.findIndex(n=>n.id===t.id):-1;return r!==-1&&Bs(e,r)}function f0(e){return Ms(e,"pre")?Ms(e,"post")?null:"post":"pre"}function h0(e,t,r){if(t<0||t>=e.length)return!1;const n=lt(e[0])?e[0]:null,s=e.length>1&&lt(e[e.length-1])?e[e.length-1]:null;if(!n&&!s)return!0;const i=[...e],[o]=i.splice(t,1);return i.splice(r,0,o),!(n&&i[0]!==n||s&&i[i.length-1]!==s)}function nu(e,t,r){return r?!1:t?!((e==null?void 0:e.children)??[]).some(s=>{var i;return!!((i=s.metadata)!=null&&i.isAssessmentCourse)}):!0}function vn(e){return Array.isArray(e)?e.map(String):e?[String(e)]:[]}function wh(e,t){var n,s;return e?((n=t[e.id])==null?void 0:n.framework)??((s=e.metadata)==null?void 0:s.framework):void 0}function xh(e,t){return!!wh(e,t)}function Th(e,t){if(!e||!t)return[];const r=new Set,n=e.children??[];return n.forEach((s,i)=>{var o,a;Bs(n,i)?vn((o=s.children[0].metadata)==null?void 0:o[t]).forEach(c=>r.add(c)):vn((a=s.metadata)==null?void 0:a[t]).forEach(c=>r.add(c))}),Array.from(r)}function p0(e,t,r){var u,d;if(!e||!t)return null;const n=Th(e,t),s=((u=r[e.id])==null?void 0:u[t])??((d=e.metadata)==null?void 0:d[t]),i=vn(s),o=[...n].sort(),a=[...i].sort();return o.length===a.length&&o.every((f,m)=>f===a[m])?null:n}function m0(e,t,r){if(!e||!t||r.length===0)return[];const n=e.children??[];return n.filter((s,i)=>{var a;return Bs(n,i)?!1:vn((a=s.metadata)==null?void 0:a[t]).some(c=>!r.includes(c))})}function Eh(e,t,r){var s;if(!e||!r||t.length===0)return[];const n=new Set;for(const i of e.children??[])vn((s=i.metadata)==null?void 0:s[r]).forEach(o=>n.add(o));return t.filter(i=>!n.has(i))}const Ah=new Set(["adaptive"]);function Rl(e,t,r,n={}){var b,h,v,y;const s=[];if(!e)return s;const i=((b=n[e.id])==null?void 0:b.policy)??((h=e.metadata)==null?void 0:h.policy);i||s.push({code:"policyMissing",message:"Set a consumption policy for this path."});const o=e.children??[],a=o[0],c=o.length>1?o[o.length-1]:void 0,u=lt(a),d=lt(c);!u&&i&&Ah.has(i)&&s.push({code:"priorAssessmentRequired",message:"A Prior Assessment is required for the Adaptive policy."}),[[a,"Prior Assessment"],[c,"Outcome Assessment"]].forEach(([C,S])=>{var x,T;if(!C)return;const _=C.children??[];(_.length!==1||!((T=(x=_[0])==null?void 0:x.metadata)!=null&&T.isAssessmentCourse))&&s.push({code:"slotNotPure",nodeId:C.id,message:`${S} must contain exactly one question-set-only course.`})});const f=new Set,m=(C,S)=>{f.has(C)&&s.push({code:"duplicateCourse",nodeId:S,message:"A course appears more than once in this path."}),f.add(C)},p=o.slice(u?1:0,o.length-(d?1:0));u&&m(a.children[0].id,a.id),d&&m(c.children[0].id,c.id);for(const C of p){const S=C.children??[],_=S.length===0;_&&s.push({code:"emptyLevel",nodeId:C.id,message:`"${C.name}" has no courses yet.`});const x=t?vn((v=C.metadata)==null?void 0:v[t]):[];if(x.length===0)_||s.push({code:"levelMissingSkills",nodeId:C.id,message:`"${C.name}" needs at least one skill selected.`});else{if(r.length>0){const D=x.filter(E=>!r.includes(E));D.length>0&&s.push({code:"levelSkillsOutOfScope",nodeId:C.id,message:`"${C.name}" has skills outside the current scope: ${D.join(", ")}.`})}const T=Eh(C,x,t);T.length>0&&s.push({code:"levelSkillsUncovered",nodeId:C.id,message:`"${C.name}" has no course covering: ${T.join(", ")}.`})}for(const T of S)m(T.id,C.id),(t?vn((y=T.metadata)==null?void 0:y[t]):[]).length===0&&s.push({code:"courseMissingSkillTag",nodeId:T.id,message:`"${T.name}" has no skill tag.`})}return s}async function g0(e){const t=[],r=(e==null?void 0:e.children)??[],n=r[0],s=r.length>1?r[r.length-1]:void 0;for(const[i,o]of[[n,"Prior Assessment"],[s,"Outcome Assessment"]]){if(!i||!lt(i))continue;const a=i.children[0].id;await _h(a)||t.push({code:"slotCourseChanged",nodeId:i.id,message:`${o}'s course is no longer question-set-only — pick a different course.`})}return t}function Nt(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function kh(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=kh(s.children,t,r+1);if(i>=0)return i}}return-1}const su=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Ih(e,t,r,n){return e.map(s=>{if(s.id===t){const i=r.metadata??{},o=n!=null&&n.length?new Set([...su,...n]):su,a={};for(const c of o)c in r&&(a[c]=r[c]);return{...s,...r,metadata:{...s.metadata??{},...a,...i}}}return s.children&&s.children.length>0?{...s,children:Ih(s.children,t,r,n)}:s})}function Oi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:Oi(n.children,t,r)}:n)}function Dh(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]];return i.splice(n,0,r),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Dh(s.children,t,r,n)}:s})}function Ga(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Ga(r.children,t):[]}))}function Ka(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Ka(s.children,t,r,n)}:s})}function Lh(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?Lh(r.children,t):[]}})}function v0(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function y0(e,t){const r=Nt(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Nt(e,s.parent):void 0;return n}const re=ei((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Nt(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};K.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),yr.getState().setActiveAssessmentSlot(null),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n,s)=>{if(e(i=>({treeData:Ih(i.treeData,r,n,s),treeCache:{...i.treeCache,[r]:{...i.treeCache[r]??{},...n}}})),t().selectedNodeId===r){const i=Nt(t().treeData,r);e(o=>({activeNodeMeta:{...(i==null?void 0:i.metadata)??{},...o.treeCache[r]??{}}}))}t().markDirty()},addNode:(r,n)=>{var m,p,b;const s=t(),i=K.getState().editorProfile,o=((p=(m=K.getState().editorConfig)==null?void 0:m.config)==null?void 0:p.maxDepth)??i.maxDepth,a=kh(s.treeData,r);if(a>=o)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${o}). parentDepth=${a}`),"";const c="temp-"+Math.random().toString(36).slice(2),u={id:c,identifier:c,name:i.defaultUnitName,isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:c,name:i.defaultUnitName,contentType:i.unitContentType,primaryCategory:i.unitPrimaryCategory,visibility:"Parent"}},d=((b=Nt(s.treeData,r))==null?void 0:b.children)??[],f=i.derivedRoles&&Ms(d,"post");return e(h=>({treeData:f?Dh(h.treeData,r,u,d.length-1):Oi(h.treeData,r,u),treeCache:{...h.treeCache,[c]:{...u.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(c),0),c},deleteNode:r=>{var s;const n=(s=t().treeData[0])==null?void 0:s.id;r!==n&&e(i=>({treeData:Ga(i.treeData,r),selectedNodeId:i.selectedNodeId===r?null:i.selectedNodeId}))},reorderChildren:(r,n,s)=>{var a;const i=K.getState().editorProfile,o=(a=t().treeData[0])==null?void 0:a.id;if(i.derivedRoles&&r===o){const c=Nt(t().treeData,r);if(c!=null&&c.children&&!h0(c.children,n,s))return}e(c=>({treeData:Ka(c.treeData,r,n,s)}))},moveNode:(r,n,s)=>{var u,d,f;const i=K.getState().editorProfile,o=Nt(t().treeData,r),a=Nt(t().treeData,s);if(!(a!=null&&a.isFolder))return;const c=(u=t().treeData[0])==null?void 0:u.id;if(!(i.derivedRoles&&(o!=null&&o.isFolder)&&s!==c)){if(i.derivedRoles&&o&&!o.isFolder){const m=!!((d=o.metadata)!=null&&d.isAssessmentCourse),p=((f=t().treeData[0])==null?void 0:f.children)??[];if(!nu(a,m,Wa(p,a)))return}e(m=>{const p=Nt(m.treeData,r);if(!p)return m;let b=Ga(m.treeData,r);return b=Oi(b,s,{...p,parent:s}),{treeData:b}}),t().markDirty()}},addResource:(r,n,s)=>{var b,h,v,y,C,S;const i=K.getState().editorConfig,o=K.getState().editorProfile,a=(b=t().treeData[0])==null?void 0:b.id,c=!!(s!=null&&s.isAssessmentCourse);if(o.derivedRoles&&n===a){if(!c||Nt(t().treeData,r.identifier))return!1;const _=t().treeData[0],x=(_==null?void 0:_.children)??[],T=(s==null?void 0:s.slot)??f0(x);if(!T||Ms(x,T))return!1;const D=t().addNode(a,"unit");if(!D)return!1;const{learningPath:E}=kl.getState().labelConfig;if(t().updateNode(D,{name:T==="pre"?E.priorAssessmentLabel:E.outcomeAssessmentLabel}),T==="pre"){const j=(((v=(h=t().treeData[0])==null?void 0:h.children)==null?void 0:v.length)??1)-1;e(P=>({treeData:Ka(P.treeData,a,j,0)}))}return t().addResource(r,D,s)}if(!(((y=i==null?void 0:i.config)==null?void 0:y.allowContentUnderRoot)??!1)&&n===a||Nt(t().treeData,r.identifier))return!1;const d=Nt(t().treeData,n);if(!(d!=null&&d.isFolder))return!1;if(o.derivedRoles){const _=((C=t().treeData[0])==null?void 0:C.children)??[];if(!nu(d,c,Wa(_,d)))return!1}const f=((S=i==null?void 0:i.config)==null?void 0:S.maxContentsLimit)??1200;if(v0(t().treeData)>=f)return!1;const p={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:{...r,...c?{isAssessmentCourse:!0}:{}}};return e(_=>({treeData:Oi(_.treeData,n,p)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=K.getState();r==="edit"&&n(!0)},pruneCoursesByFramework:r=>{let n=0;return e(s=>{const i=s.treeData[0];if(!i)return s;const o=[];for(const a of i.children??[]){const c=lt(a),u=(a.children??[]).filter(d=>{var p;if(d.isFolder)return!0;const f=(p=d.metadata)==null?void 0:p.framework,m=!f||(Array.isArray(f)?f.includes(r):f===r);return m||n++,m});c&&u.length===0||o.push(u.length===(a.children??[]).length?a:{...a,children:u})}return n===0?s:{treeData:[{...i,children:o}]}}),n>0&&t().markDirty(),n},clearLevelSkills:r=>{if(!r)return 0;let n=0;return e(s=>{const i=s.treeData[0];if(!i)return s;const o={...s.treeCache},a=(i.children??[]).map(c=>{var m,p;if(!(((m=c.metadata)==null?void 0:m[r])!==void 0||((p=o[c.id])==null?void 0:p[r])!==void 0))return c;n++;const{[r]:d,...f}=c.metadata??{};if(o[c.id]){const{[r]:b,...h}=o[c.id];o[c.id]=h}return{...c,metadata:f}});return n===0?s:{treeData:[{...i,children:a}],treeCache:o}}),n>0&&t().markDirty(),n},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Lh(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const u=r[a]??a,{isNew:d,...f}=c;i[u]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Nt(t().treeData,r),getChildrenOf:r=>{const n=Nt(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>y0(t().treeData,r)})),b0="_spin_1ah4d_9",C0={spin:b0};function oe(){return kl(e=>e.labelConfig)}const S0=({size:e=16,color:t="currentColor"})=>{const r=oe();return l.jsx("svg",{className:C0.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":r.spinner.loading,role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})})},Re=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(S0,{size:14}):null,i]}),Oh=({size:e=16,...t})=>l.jsxs("svg",{width:e,height:e,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[l.jsx("circle",{cx:"58",cy:"12",r:"4",stroke:"currentColor",strokeWidth:"4"}),l.jsx("circle",{cx:"8",cy:"58",r:"4",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{d:"M52 12 H24 A12 12 0 0 0 24 36 H40 A12 12 0 0 1 40 60 H12",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]});async function iu(e){var r,n;return(n=(r=(await Fe.get(`/action/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function _0(e){var r,n;return((n=(r=(await Fe.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Ao(e,t){const r=Jn({queryKey:["framework",e],queryFn:()=>iu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Jn({queryKey:["framework",n],queryFn:()=>iu(n),enabled:!!n,staleTime:300*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function Nh(e){if(!(e!=null&&e.length))return null;const t=e.reduce((r,n)=>(n.index??-1/0)>(r.index??-1/0)?n:r);return{code:t.code,terms:t.terms??[]}}function w0(e){var n,s,i,o;const t=(n=e==null?void 0:e.children)==null?void 0:n[0];if(!lt(t))return;const r=(o=(i=(s=t==null?void 0:t.children)==null?void 0:s[0])==null?void 0:i.metadata)==null?void 0:o.framework;return Array.isArray(r)?r[0]:r}function lr(){var i;const e=K(o=>o.editorConfig),t=K(o=>o.contentFramework),r=re(o=>o.treeData),n=w0(r[0])??t??((i=e==null?void 0:e.context)==null?void 0:i.framework),{organisationFramework:s}=Ao(n);return Nh(s==null?void 0:s.categories)}function x0(e,t,r){var u,d,f,m;const n={scope:((t==null?void 0:t.terms)??[]).map(p=>p.name),source:"manual"};if(!t)return n;const s=(u=e==null?void 0:e.children)==null?void 0:u[0];if(!lt(s))return n;const i=(d=s==null?void 0:s.children)==null?void 0:d[0];if(!i)return n;const a=((f=r[i.id])==null?void 0:f[t.code])??((m=i.metadata)==null?void 0:m[t.code]);return{scope:Array.isArray(a)?a:a?[a]:[],source:"prior"}}function ii(){const e=lr(),t=re(n=>n.treeData),r=re(n=>n.treeCache);return g.useMemo(()=>x0(t[0],e,r),[t,e,r])}const T0="_overlay_kdzmi_1",E0="_modal_kdzmi_15",A0="_modalHeader_kdzmi_27",k0="_modalHeaderClose_kdzmi_37",I0="_modalBody_kdzmi_55",D0="_modalFooter_kdzmi_62",L0="_checkRow_kdzmi_69",O0="_formGroup_kdzmi_112",N0="_textarea_kdzmi_123",j0="_sliderGroup_kdzmi_144",P0="_sliderValue_kdzmi_156",R0="_sliderLabels_kdzmi_164",F0="_sectionTitle_kdzmi_172",Ae={overlay:T0,modal:E0,modalHeader:A0,modalHeaderClose:k0,modalBody:I0,modalFooter:D0,checkRow:L0,formGroup:O0,textarea:N0,sliderGroup:j0,sliderValue:P0,sliderLabels:R0,sectionTitle:F0},M0=({objectType:e,onConfirm:t,onCancel:r})=>{const n=oe(),s=re(b=>b.treeData[0]),i=re(b=>b.treeCache),o=lr(),{scope:a}=ii(),[c,u]=g.useState(null),d=Rl(s,o==null?void 0:o.code,a,i);g.useEffect(()=>{let b=!1;return u(null),g0(s).then(h=>{b||u(h)}),()=>{b=!0}},[s]);const f=c===null,m=[...d,...c??[]],p=!f&&m.length===0;return l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",e]}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:m.length===0?l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:f?n.learningPath.verifyingAssessmentCourses:`${n.publishChecklist.confirmPublishPrefix} ${e}?`}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ae.sectionTitle,children:n.learningPath.resolveBeforePublishing}),l.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13,lineHeight:1.6},children:m.map((b,h)=>l.jsx("li",{children:b.message},`${b.code}-${b.nodeId??h}`))})]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),l.jsx(Re,{variant:"primary",onClick:t,disabled:!p,children:n.publishChecklist.yesButton})]})]})})},B0=({contentId:e,onConfirm:t,onCancel:r})=>{const n=oe(),s=K(m=>{var p,b;return(b=(p=m.editorConfig)==null?void 0:p.config)==null?void 0:b.objectType})||"Content",i=K(m=>m.editorProfile.key==="learningPath"),o=K(m=>m.publishChecklist)??[],[a,c]=g.useState({}),u=o.every(m=>a[m.code]),d=o.length===0||u,f=()=>{t()};return i?l.jsx(M0,{objectType:s,onConfirm:t,onCancel:r}):l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",s]}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:o.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:[n.publishChecklist.confirmPublishPrefix," ",s,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ae.sectionTitle,children:n.publishChecklist.checklistInstructions}),o.map(m=>l.jsxs("label",{className:Ae.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!a[m.code],onChange:p=>c(b=>({...b,[m.code]:p.target.checked}))}),l.jsx("span",{children:m.label})]},m.code))]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),l.jsx(Re,{variant:"primary",onClick:f,disabled:!d,children:n.publishChecklist.yesButton})]})]})})},q0=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const s=oe(),[i,o]=g.useState(""),[a,c]=g.useState(7),u=t==="approve",d=u?s.qualityParamsModal.reviewQualityTitle:s.qualityParamsModal.rejectContentTitle,f=!u&&i.trim().length===0,m=()=>{u?r(i.trim(),a):r(i.trim())};return l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:n,"aria-label":s.qualityParamsModal.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:u?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ae.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:s.qualityParamsModal.qualityScoreLabel}),l.jsxs("div",{className:Ae.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:a,onChange:p=>c(Number(p.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":a}),l.jsx("span",{className:Ae.sliderValue,children:a})]}),l.jsxs("div",{className:Ae.sliderLabels,children:[l.jsx("span",{children:s.qualityParamsModal.scorePoorLabel}),l.jsx("span",{children:s.qualityParamsModal.scoreExcellentLabel})]})]}),l.jsxs("div",{className:Ae.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:[s.qualityParamsModal.commentLabel," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:s.qualityParamsModal.optionalLabel})]}),l.jsx("textarea",{id:"quality-comment",className:Ae.textarea,placeholder:s.qualityParamsModal.commentPlaceholder,value:i,onChange:p=>o(p.target.value),rows:4})]})]}):l.jsxs("div",{className:Ae.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:[s.qualityParamsModal.rejectionReasonLabel," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Ae.textarea,placeholder:s.qualityParamsModal.rejectReasonPlaceholder,value:i,onChange:p=>o(p.target.value),rows:5,required:!0,"aria-required":"true"}),i.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:s.qualityParamsModal.rejectionRequiredMessage})]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:n,children:s.qualityParamsModal.cancelButton}),l.jsx(Re,{variant:u?"primary":"danger",onClick:m,disabled:f,children:u?s.qualityParamsModal.approveButton:s.qualityParamsModal.rejectButton})]})]})})},$0=({message:e,onConfirm:t,onCancel:r})=>{const n=oe();return xr.createPortal(l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"confirm-dialog-title",children:n.confirmDialog.title}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.confirmDialog.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:e})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.confirmDialog.cancelButton}),l.jsx(Re,{variant:"danger",onClick:t,children:n.confirmDialog.confirmButton})]})]})}),document.body)},jh=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function U0(e,t={}){var c,u,d,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:jh,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(d=(u=(await Fe.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:u.result)==null?void 0:d.response)==null?void 0:f.content)??[]}async function z0(e){var r,n,s;return e.length?((s=(n=(r=(await Fe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:jh,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function V0(e){var r,n;return((n=(r=(await Fe.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const H0="_container_1hnn8_1",Q0="_header_1hnn8_13",W0="_title_1hnn8_22",G0="_closeBtn_1hnn8_29",K0="_body_1hnn8_45",Y0="_label_1hnn8_54",Z0="_searchSection_1hnn8_62",X0="_searchRow_1hnn8_68",J0="_searchInput_1hnn8_74",eT="_searchSpinner_1hnn8_89",tT="_resultsList_1hnn8_105",rT="_resultItem_1hnn8_118",nT="_userInfo_1hnn8_133",sT="_userName_1hnn8_141",iT="_userEmail_1hnn8_150",oT="_userOrg_1hnn8_158",aT="_noResults_1hnn8_167",lT="_collabSection_1hnn8_174",cT="_sectionTitle_1hnn8_179",uT="_badge_1hnn8_189",dT="_emptyCollab_1hnn8_203",fT="_collabList_1hnn8_214",hT="_collabItem_1hnn8_223",pT="_userAvatar_1hnn8_237",mT="_error_1hnn8_251",gT="_success_1hnn8_257",vT="_footer_1hnn8_263",Pe={container:H0,header:Q0,title:W0,closeBtn:G0,body:K0,label:Y0,searchSection:Z0,searchRow:X0,searchInput:J0,searchSpinner:eT,resultsList:tT,resultItem:rT,userInfo:nT,userName:sT,userEmail:iT,userOrg:oT,noResults:aT,collabSection:lT,sectionTitle:cT,badge:uT,emptyCollab:dT,collabList:fT,collabItem:hT,userAvatar:pT,error:mT,success:gT,footer:vT},yT=({contentId:e,onClose:t})=>{var j,P;const r=oe(),n=K(O=>O.editorConfig),s=(j=n==null?void 0:n.context)==null?void 0:j.channel,i=(P=n==null?void 0:n.config)==null?void 0:P.objectType,[o,a]=g.useState(""),[c,u]=g.useState([]),[d,f]=g.useState(!1),[m,p]=g.useState([]),[b,h]=g.useState(!1),[v,y]=g.useState(""),[C,S]=g.useState(!1),_=g.useRef(null);g.useEffect(()=>{let O=!1;return(async()=>{try{const N=await s0(e),R=(N==null?void 0:N.collaborators)??[];if(!R.length)return;const M=await z0(R);if(O)return;const $=R.map(ee=>M.find(H=>H.identifier===ee)??{identifier:ee,firstName:ee});p($)}catch{}})(),()=>{O=!0}},[e]),g.useEffect(()=>{_.current&&clearTimeout(_.current);const O=o.trim();if(O.length<2){u([]);return}return _.current=setTimeout(async()=>{f(!0);try{const N=await U0(O,{rootOrgId:s,objectType:i}),R=new Set(m.map(M=>M.identifier));u(N.filter(M=>!R.has(M.identifier)))}catch{u([])}finally{f(!1)}},300),()=>{_.current&&clearTimeout(_.current)}},[o,m,s,i]);const x=g.useCallback(O=>{p(N=>N.find(R=>R.identifier===O.identifier)?N:[...N,O]),u(N=>N.filter(R=>R.identifier!==O.identifier)),S(!1)},[]),T=g.useCallback(O=>{p(N=>N.filter(R=>R.identifier!==O)),S(!1)},[]),D=g.useCallback(async()=>{h(!0),y(""),S(!1);try{await a0(e,m.map(O=>O.identifier)),S(!0)}catch{y(r.manageCollaborators.saveFailed)}finally{h(!1)}},[e,m,r.manageCollaborators.saveFailed]),E=O=>`${O.firstName}${O.lastName?` ${O.lastName}`:""}`;return l.jsxs("div",{className:Pe.container,children:[l.jsxs("div",{className:Pe.header,children:[l.jsx("h2",{className:Pe.title,children:r.manageCollaborators.title}),l.jsx("button",{className:Pe.closeBtn,onClick:t,"aria-label":r.manageCollaborators.closeAriaLabel,children:l.jsx(br,{size:18})})]}),l.jsxs("div",{className:Pe.body,children:[l.jsxs("div",{className:Pe.searchSection,children:[l.jsx("label",{className:Pe.label,htmlFor:"collab-search",children:r.manageCollaborators.searchUsersLabel}),l.jsxs("div",{className:Pe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Pe.searchInput,placeholder:r.manageCollaborators.searchPlaceholder,value:o,onChange:O=>a(O.target.value)}),d&&l.jsx("span",{className:Pe.searchSpinner,"aria-label":r.manageCollaborators.searchingAriaLabel})]}),c.length>0&&l.jsx("ul",{className:Pe.resultsList,role:"listbox","aria-label":r.manageCollaborators.searchResultsAriaLabel,children:c.map(O=>{var N,R,M,$;return l.jsxs("li",{className:Pe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Pe.userInfo,children:[l.jsx("span",{className:Pe.userName,children:E(O)}),O.email&&l.jsx("span",{className:Pe.userEmail,children:O.email}),(((R=(N=O.organisations)==null?void 0:N[0])==null?void 0:R.orgName)??O.rootOrgName)&&l.jsx("span",{className:Pe.userOrg,children:(($=(M=O.organisations)==null?void 0:M[0])==null?void 0:$.orgName)??O.rootOrgName})]}),l.jsx(Re,{variant:"primary",size:"sm",onClick:()=>x(O),children:r.manageCollaborators.add})]},O.identifier)})}),o.trim().length>=2&&!d&&c.length===0&&l.jsx("p",{className:Pe.noResults,children:r.manageCollaborators.noUsersFound})]}),l.jsxs("div",{className:Pe.collabSection,children:[l.jsxs("h3",{className:Pe.sectionTitle,children:[r.manageCollaborators.currentCollaborators,m.length>0&&l.jsx("span",{className:Pe.badge,children:m.length})]}),m.length===0?l.jsx("p",{className:Pe.emptyCollab,children:r.manageCollaborators.noCollaboratorsYet}):l.jsx("ul",{className:Pe.collabList,children:m.map(O=>{var N,R,M,$;return l.jsxs("li",{className:Pe.collabItem,children:[l.jsx("div",{className:Pe.userAvatar,"aria-hidden":"true",children:E(O).charAt(0).toUpperCase()}),l.jsxs("div",{className:Pe.userInfo,children:[l.jsx("span",{className:Pe.userName,children:E(O)}),O.email&&l.jsx("span",{className:Pe.userEmail,children:O.email}),(((R=(N=O.organisations)==null?void 0:N[0])==null?void 0:R.orgName)??O.rootOrgName)&&l.jsx("span",{className:Pe.userOrg,children:(($=(M=O.organisations)==null?void 0:M[0])==null?void 0:$.orgName)??O.rootOrgName})]}),l.jsx(Re,{variant:"danger",size:"sm",onClick:()=>T(O.identifier),children:r.manageCollaborators.remove})]},O.identifier)})})]}),v&&l.jsx("p",{className:Pe.error,role:"alert",children:v}),C&&l.jsx("p",{className:Pe.success,role:"status",children:r.manageCollaborators.saveSuccess})]}),l.jsxs("div",{className:Pe.footer,children:[l.jsx(Re,{variant:"ghost",onClick:t,disabled:b,children:r.manageCollaborators.cancel}),l.jsx(Re,{variant:"primary",isLoading:b,onClick:D,children:r.manageCollaborators.save})]})]})};async function bT(e){return(await Fe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function CT(e,t){var s;const n=((s=(await Fe.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function ST(e){var n;const r=((n=(await Fe.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const _T="_topbar_c3y0z_1",wT="_left_c3y0z_15",xT="_right_c3y0z_23",TT="_backBtn_c3y0z_30",ET="_title_c3y0z_49",AT="_profileBadge_c3y0z_61",kT="_statusChip_c3y0z_76",IT="_savedIndicator_c3y0z_88",DT="_unsaved_c3y0z_98",LT="_iconBtn_c3y0z_103",OT="_iconBtnLabel_c3y0z_130",NT="_qrDropdown_c3y0z_134",jT="_qrMenu_c3y0z_138",PT="_reviewBtns_c3y0z_173",RT="_sourcingBtns_c3y0z_182",FT="_modalOverlay_c3y0z_191",MT="_sbOverlay_c3y0z_201",BT="_sbModal_c3y0z_211",qT="_sbModalHeader_c3y0z_222",$T="_sbModalTitle_c3y0z_230",UT="_sbModalClose_c3y0z_237",zT="_sbModalBody_c3y0z_250",VT="_sbLabel_c3y0z_257",HT="_sbTextarea_c3y0z_264",QT="_sbError_c3y0z_281",WT="_sbModalFooter_c3y0z_288",_e={topbar:_T,left:wT,right:xT,backBtn:TT,title:ET,profileBadge:AT,statusChip:kT,savedIndicator:IT,unsaved:DT,iconBtn:LT,iconBtnLabel:OT,qrDropdown:NT,qrMenu:jT,reviewBtns:PT,sourcingBtns:RT,modalOverlay:FT,sbOverlay:MT,sbModal:BT,sbModalHeader:qT,sbModalTitle:$T,sbModalClose:UT,sbModalBody:zT,sbLabel:VT,sbTextarea:HT,sbError:QT,sbModalFooter:WT};function GT(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function KT(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}const YT=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const a=oe(),[c,u]=g.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:_e.sbModalTitle,children:e}),l.jsx("button",{className:_e.sbModalClose,onClick:o,"aria-label":a.reviewCommentModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsxs("div",{className:_e.sbModalBody,children:[l.jsxs("label",{className:_e.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:_e.sbTextarea,placeholder:r,value:c,onChange:f=>u(f.target.value),rows:4,required:!0,"aria-required":"true"}),c.trim().length===0&&l.jsx("p",{className:_e.sbError,children:a.reviewCommentModal.fillCommentsError})]}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:o,children:a.reviewCommentModal.cancelButton}),l.jsx(Re,{variant:s,onClick:()=>i(c.trim()),disabled:c.trim().length===0,children:n})]})]})})},ZT=({onConfirm:e,onCancel:t})=>{const r=oe(),[n,s]=g.useState(!1),i=K(m=>m.editorProfile.key==="learningPath"),o=re(m=>m.treeData[0]),a=re(m=>m.treeCache),c=lr(),{scope:u}=ii(),d=i?Rl(o,c==null?void 0:c.code,u,a):[],f=d.length>0;return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:_e.sbModalTitle,children:r.confirmReviewModal.title}),l.jsx("button",{className:_e.sbModalClose,onClick:t,"aria-label":r.confirmReviewModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsx("div",{className:_e.sbModalBody,children:f?l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:600},children:r.learningPath.resolveBeforeSendingForReview}),l.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13,lineHeight:1.6},children:d.map((m,p)=>l.jsx("li",{children:m.message},`${m.code}-${m.nodeId??p}`))})]}):l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:n,onChange:m=>s(m.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:[r.confirmReviewModal.agreementTextPart1," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:r.confirmReviewModal.creativeCommonsLinkText})," ",r.confirmReviewModal.agreementTextPart2," ",l.jsx("strong",{children:r.confirmReviewModal.contentPolicyText}),r.confirmReviewModal.agreementTextPart3]})]})}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:t,children:r.confirmReviewModal.cancelButton}),!f&&l.jsx(Re,{variant:"primary",onClick:e,disabled:!n,children:r.confirmReviewModal.submitButton})]})]})})},XT=({onConfirm:e,onCancel:t})=>{const r=oe(),[n,s]=g.useState(""),i=parseInt(n,10),o=!isNaN(i)&&i>=2&&i<=250;return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:_e.sbModalTitle,children:r.generateQRModal.title}),l.jsx("button",{className:_e.sbModalClose,onClick:t,"aria-label":r.generateQRModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsxs("div",{className:_e.sbModalBody,children:[l.jsxs("label",{className:_e.sbLabel,htmlFor:"qr-count",children:[r.generateQRModal.numberOfCodesLabel," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:_e.sbTextarea,style:{resize:"none",height:"40px"},placeholder:r.generateQRModal.countPlaceholder,value:n,onChange:a=>s(a.target.value)}),n&&!o&&l.jsx("p",{className:_e.sbError,children:r.generateQRModal.countRangeError})]}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:t,children:r.generateQRModal.cancelButton}),l.jsx(Re,{variant:"primary",onClick:()=>e(i),disabled:!o,children:r.generateQRModal.generateButton})]})]})})},JT=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var be,me;const o=oe(),c=re(le=>le.treeData)[0],u=(c==null?void 0:c.name)??o.contextualEditor.untitledPlaceholder,d=KT(((be=c==null?void 0:c.metadata)==null?void 0:be.status)??(c==null?void 0:c.status),o.topbar.draftStatusFallback),f=K(le=>{var ve,Te,Y,ce;return((Te=(ve=le.editorConfig)==null?void 0:ve.context)==null?void 0:Te.contentId)??((ce=(Y=le.editorConfig)==null?void 0:Y.context)==null?void 0:ce.identifier)??""}),{activeModal:m,modalData:p,closeModal:b,openModal:h}=yr(),v=K(le=>le.buttonLoaders),y=K(le=>le.categoryMeta),C=K(le=>le.editorProfile),S=C.key==="learningPath",_=C.features.dialcodes&&(!y||y.schemaDefaults.generateDIALCodes!=="No"),[x,T]=g.useState(!1),[D,E]=g.useState(!1),[j,P]=g.useState(!1),O=g.useRef(null),[N,R]=g.useState(!1);g.useEffect(()=>{if(!j)return;const le=ve=>{var Te;(Te=O.current)!=null&&Te.contains(ve.target)||P(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[j]);const[M,$]=g.useState(!1),[ee,H]=g.useState(!1),{updateNode:te}=re(),de=(me=c==null?void 0:c.metadata)==null?void 0:me.qrCodeProcessId,fe=g.useCallback(async le=>{if(f){R(!1),$(!0);try{const{processId:ve,reservedDialcodes:Te}=await CT(f,le);ve&&c&&te(c.id,{qrCodeProcessId:ve,reservedDialcodes:Te}),Se.success(o.topbar.qrGenerationStartedToast)}catch{Se.error(o.topbar.qrGenerationFailedToast)}finally{$(!1)}}},[f,c,te,o]),pe=g.useCallback(async()=>{if(!de){Se.error(o.topbar.qrCodesNotGeneratedToast);return}H(!0);try{const le=await ST(de);if(le.status==="in-process"){Se(o.topbar.qrGenerationInProgressToast,{icon:l.jsx(Bn,{size:16})});return}const ve=le.url;if(!ve){Se.error(o.topbar.qrCodesNotReadyToast);return}const Te=await fetch(ve).then(We=>We.blob()),Y=await new Promise(We=>{const tt=new FileReader;tt.onloadend=()=>We(tt.result),tt.readAsDataURL(Te)}),ce=(c==null?void 0:c.metadata)??{},Q=We=>Array.isArray(We)?We.join("_"):typeof We=="string"?We:"",Ce=[f,Q(ce.medium),Q(ce.gradeLevel),Q(ce.subject)].filter(Boolean),qe=new Date().toISOString().replace(/[:.]/g,"-"),et=`${Ce.join("_")}_${qe}.zip`,$e=document.createElement("a");$e.href=Y,$e.download=et,$e.style.display="none",document.body.appendChild($e),$e.click(),document.body.removeChild($e),Se.success(o.topbar.qrCodesDownloadedToast)}catch{Se.error(o.topbar.qrCodesDownloadFailedToast)}finally{H(!1)}},[de,c,f,o]),ae=e==="edit",we=e==="review",ye=e==="sourcingreview",F=e==="read",B=g.useCallback((le,ve)=>{i({action:le,data:ve})},[i]),Z=g.useCallback(()=>{b(),B("publish")},[b,B]),he=g.useCallback((le,ve)=>{const Te=p==null?void 0:p.action;b(),Te==="approve"?B("sourcingApprove",{comment:le,score:ve}):B("reject",{comment:le})},[b,B,p]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:_e.topbar,role:"banner",children:[l.jsxs("div",{className:_e.left,children:[l.jsx("button",{className:_e.backBtn,onClick:()=>B("back"),"aria-label":o.topbar.backAriaLabel,type:"button",children:l.jsx(wl,{size:18})}),l.jsx("h1",{className:_e.title,title:u,children:u}),S&&l.jsxs("span",{className:_e.profileBadge,children:[l.jsx(Oh,{size:13,"aria-hidden":"true"}),o.learningPath.profileBadgeLabel]}),l.jsx("span",{className:`sbx-chip ${_e.statusChip}`,"aria-label":`${o.topbar.statusAriaLabelPrefix} ${d}`,children:d})]}),l.jsxs("div",{className:_e.right,children:[t?l.jsx("span",{className:_e.savedIndicator,"aria-live":"polite",children:o.topbar.savingIndicator}):r&&ae?l.jsx("span",{className:`${_e.savedIndicator} ${_e.unsaved}`,"aria-live":"polite",children:o.topbar.unsavedIndicator}):n?l.jsxs("span",{className:_e.savedIndicator,"aria-live":"polite",children:[l.jsx(bn,{size:14,"aria-hidden":"true"}),o.topbar.savedIndicatorPrefix," ",GT(n)]}):null,!F&&!we&&!ye&&d!=="Review"&&l.jsx("span",{title:s?void 0:o.topbar.fillRequiredFieldsTooltip,children:l.jsx(Re,{variant:"ghost",size:"sm",onClick:()=>B("saveCollection"),disabled:!s,children:o.topbar.saveAsDraftButton})}),ae&&l.jsxs(l.Fragment,{children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:v.saveCollection,isLoading:v.saveCollection,children:[l.jsx(qy,{size:14,"aria-hidden":"true"})," ",o.topbar.sendForReviewButton]}),C.features.collaborators&&l.jsx("button",{className:_e.iconBtn,onClick:()=>h("manageCollaborators"),"aria-label":o.topbar.collaboratorsLabel,title:o.topbar.collaboratorsLabel,type:"button",children:l.jsx(Wy,{size:16,"aria-hidden":"true"})}),_&&l.jsxs("div",{className:_e.qrDropdown,ref:O,children:[l.jsxs("button",{className:_e.iconBtn,onClick:()=>P(le=>!le),"aria-label":o.topbar.qrCodesLabel,title:o.topbar.qrCodesLabel,type:"button","aria-haspopup":"true","aria-expanded":j,children:[l.jsx(Ac,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:_e.iconBtnLabel,children:o.topbar.qrCodesLabel}),l.jsx(Cn,{size:14,style:{marginLeft:2},"aria-hidden":"true"})]}),j&&l.jsxs("div",{className:_e.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{P(!1),R(!0)},disabled:M,children:[l.jsx(Ac,{size:14}),M?o.topbar.generatingEllipsis:o.topbar.generateQrCodesMenuItem]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{P(!1),pe()},disabled:ee||!de,children:[l.jsx(Ey,{size:14}),ee?o.topbar.downloadingEllipsis:o.topbar.downloadQrCodesMenuItem]})]})]})]}),we&&l.jsxs("div",{className:_e.reviewBtns,children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("publishChecklist"),disabled:v.publishCollection,isLoading:v.publishCollection,children:[l.jsx(Pf,{size:14,"aria-hidden":"true"})," ",o.topbar.publishButton]}),l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>T(!0),disabled:v.rejectCollection,isLoading:v.rejectCollection,children:[l.jsx(kc,{size:14,"aria-hidden":"true"})," ",o.topbar.requestForChangesButton]})]}),ye&&l.jsxs("div",{className:_e.sourcingBtns,children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"approve"}),children:[l.jsx(Uy,{size:14,"aria-hidden":"true"})," ",o.topbar.approveButton]}),l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"reject"}),children:[l.jsx(kc,{size:14,"aria-hidden":"true"})," ",o.topbar.requestForChangesButton]})]})]})]}),m==="publishChecklist"&&l.jsx(B0,{contentId:f,onConfirm:Z,onCancel:b}),m==="qualityParams"&&l.jsx(q0,{contentId:f,action:(p==null?void 0:p.action)??"reject",onConfirm:he,onCancel:b}),m==="manageCollaborators"&&l.jsx("div",{className:_e.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(yT,{contentId:f,onClose:b})}),m==="confirmDelete"&&l.jsx($0,{message:(p==null?void 0:p.message)??"",onConfirm:()=>{const le=p==null?void 0:p.onConfirm;b(),le==null||le()},onCancel:b}),D&&l.jsx(ZT,{onConfirm:()=>{E(!1),B("sendForReview")},onCancel:()=>E(!1)}),x&&l.jsx(YT,{titleText:o.topbar.requestChangesTitle,labelText:o.topbar.changesRequestedLabel,placeholderText:o.topbar.describeChangesPlaceholder,submitLabel:o.topbar.requestForChangesButton,submitVariant:"primary",onConfirm:le=>{T(!1),B("reject",{comment:le})},onCancel:()=>T(!1)}),N&&l.jsx(XT,{onConfirm:fe,onCancel:()=>R(!1)})]})},e1=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>{const s=oe();return xr.createPortal(l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:s.unsavedChangesModal.title}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":s.unsavedChangesModal.closeAriaLabel,disabled:n,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:s.unsavedChangesModal.bodyMessage})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,disabled:n,children:s.unsavedChangesModal.cancelButton}),l.jsx(Re,{variant:"danger",onClick:t,disabled:n,children:s.unsavedChangesModal.discardButton}),l.jsx(Re,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:s.unsavedChangesModal.saveButton})]})]})}),document.body)};var t1=El();const Ph=g.createContext(null);function Ft(){const e=g.useContext(Ph);if(e===null)throw new Error("No Tree Api Provided");return e}const Rh=g.createContext(null);function r1(){const e=g.useContext(Rh);if(e===null)throw new Error("Provide a NodesContext");return e}const Fh=g.createContext(null);function n1(){const e=g.useContext(Fh);if(e===null)throw new Error("Provide a DnDContext");return e}const Mh=g.createContext(0);function Bh(){g.useContext(Mh)}function Ni(e,t,r){return Math.max(Math.min(e,r),t)}function qh(e){return e&&e.isLeaf}function $h(e){return e&&e.isInternal&&!e.isOpen}function Uh(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const zh=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Vh=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function Fl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=Fl(r,t);if(n)return n}return null}function eo(e,t){if(t(e),e.children)for(let r of e.children)eo(r,t)}function Hh(e){const t=Wh(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=s1(t,n);break}r==null||r.focus()}function Qh(e){const t=Wh(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=i1(t,n);break}r==null||r.focus()}function s1(e,t){return t+1<e.length?e[t+1]:e[0]}function i1(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Wh(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function xs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function Rn(e){return typeof e=="string"?e:e.id}function o1(e,...t){if(e)return e(...t)}function Gh(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Kh(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function Yh(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const a1=Object.freeze(Object.defineProperty({__proto__:null,access:xs,bound:Ni,dfs:Fl,focusNextElement:Hh,focusPrevElement:Qh,getInsertIndex:Kh,getInsertParentId:Yh,identify:Rn,indexOf:Vh,isClosed:$h,isDescendant:zh,isItem:qh,isOpenWithEmptyChildren:Uh,safeRun:o1,waitFor:Gh,walk:eo},Symbol.toStringTag,{value:"Module"})),l1={display:"flex",alignItems:"center",zIndex:1},c1={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},u1={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},d1=g.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},l1),s),children:[l.jsx("div",{style:Object.assign({},u1)}),l.jsx("div",{style:Object.assign({},c1)})]})});function f1({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function h1(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(m1,Object.assign({},e)):l.jsx(p1,Object.assign({},e))]})}function p1(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function m1({node:e}){const t=g.useRef();return g.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const qs="__REACT_ARBORIST_INTERNAL_ROOT__";function ou(e){var t;function r(i,o,a){const c=e.accessId(i),u=new $s({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new $s({tree:e,id:qs,data:{id:qs},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class $s{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===qs}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new $s(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Ko(e){return{type:"EDIT",id:e}}function g1(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function En(e){return{type:"FOCUS",id:e}}function v1(){return{type:"TREE_BLUR"}}function y1(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Ya={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function au(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function b1(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:au(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:au(e.unfiltered,t)}):e}const rs=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},Ir={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:Rn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(Rn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(Rn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:Rn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:Rn(e)})};function C1(e=rs().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const ns={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function S1(e=rs().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return rs().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const _1={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},w1=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},x1=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Zh({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(T1,{isDragging:s,children:[l.jsx(E1,{offset:e,children:l.jsx(k1,{id:r,dragIds:n})}),l.jsx(A1,{mouse:t,count:n.length})]})}const T1=g.memo(function(t){return t.isDragging?l.jsx("div",{style:_1,children:t.children}):null});function E1(e){return l.jsx("div",{className:"row preview",style:w1(e.offset),children:e.children})}function A1(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:x1(r),children:t}):null}const k1=g.memo(function(t){const r=Ft(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Za(){return Za=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Za.apply(null,arguments)}function lu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){return Xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xa(e,t)}function I1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xa(e,t)}var cu=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function D1(e,t){return!!(e===t||cu(e)&&cu(t))}function L1(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!D1(e[r],t[r]))return!1;return!0}function Yo(e,t){t===void 0&&(t=L1);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var O1=typeof performance=="object"&&typeof performance.now=="function",uu=O1?function(){return performance.now()}:function(){return Date.now()};function du(e){cancelAnimationFrame(e.id)}function N1(e,t){var r=uu();function n(){uu()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Zo=-1;function fu(e){if(e===void 0&&(e=!1),Zo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Zo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Zo}var An=null;function hu(e){if(e===void 0&&(e=!1),An===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?An="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?An="negative":An="positive-ascending"),document.body.removeChild(t),An}return An}process.env.NODE_ENV;var j1=150,P1=function(t,r){return t},ji=null,Pi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ji=new WeakSet,Pi=new WeakSet);function Xh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=(function(f){I1(m,f);function m(b){var h;return h=f.call(this,b)||this,h._instanceProps=c(h.props,lu(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:lu(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Yo(function(v,y,C,S){return h.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:y,visibleStartIndex:C,visibleStopIndex:S})}),h._callOnScroll=void 0,h._callOnScroll=Yo(function(v,y,C){return h.props.onScroll({scrollDirection:v,scrollOffset:y,scrollUpdateWasRequested:C})}),h._getItemStyle=void 0,h._getItemStyle=function(v){var y=h.props,C=y.direction,S=y.itemSize,_=y.layout,x=h._getItemStyleCache(u&&S,u&&_,u&&C),T;if(x.hasOwnProperty(v))T=x[v];else{var D=r(h.props,v,h._instanceProps),E=s(h.props,v,h._instanceProps),j=C==="horizontal"||_==="horizontal",P=C==="rtl",O=j?D:0;x[v]=T={position:"absolute",left:P?void 0:O,right:P?O:void 0,top:j?0:D,height:j?"100%":E,width:j?E:"100%"}}return T},h._getItemStyleCache=void 0,h._getItemStyleCache=Yo(function(v,y,C){return{}}),h._onScrollHorizontal=function(v){var y=v.currentTarget,C=y.clientWidth,S=y.scrollLeft,_=y.scrollWidth;h.setState(function(x){if(x.scrollOffset===S)return null;var T=h.props.direction,D=S;if(T==="rtl")switch(hu()){case"negative":D=-S;break;case"positive-descending":D=_-C-S;break}return D=Math.max(0,Math.min(D,_-C)),{isScrolling:!0,scrollDirection:x.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(v){var y=v.currentTarget,C=y.clientHeight,S=y.scrollHeight,_=y.scrollTop;h.setState(function(x){if(x.scrollOffset===_)return null;var T=Math.max(0,Math.min(_,S-C));return{isScrolling:!0,scrollDirection:x.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(v){var y=h.props.outerRef;h._outerRef=v,typeof y=="function"?y(v):y!=null&&typeof y=="object"&&y.hasOwnProperty("current")&&(y.current=v)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&du(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=N1(h._resetIsScrolling,j1)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,v){return R1(h,v),d(h),null};var p=m.prototype;return p.scrollTo=function(h){h=Math.max(0,h),this.setState(function(v){return v.scrollOffset===h?null:{scrollDirection:v.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},p.scrollToItem=function(h,v){v===void 0&&(v="auto");var y=this.props,C=y.itemCount,S=y.layout,_=this.state.scrollOffset;h=Math.max(0,Math.min(h,C-1));var x=0;if(this._outerRef){var T=this._outerRef;S==="vertical"?x=T.scrollWidth>T.clientWidth?fu():0:x=T.scrollHeight>T.clientHeight?fu():0}this.scrollTo(i(this.props,h,v,_,this._instanceProps,x))},p.componentDidMount=function(){var h=this.props,v=h.direction,y=h.initialScrollOffset,C=h.layout;if(typeof y=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||C==="horizontal"?S.scrollLeft=y:S.scrollTop=y}this._callPropsCallbacks()},p.componentDidUpdate=function(){var h=this.props,v=h.direction,y=h.layout,C=this.state,S=C.scrollOffset,_=C.scrollUpdateWasRequested;if(_&&this._outerRef!=null){var x=this._outerRef;if(v==="horizontal"||y==="horizontal")if(v==="rtl")switch(hu()){case"negative":x.scrollLeft=-S;break;case"positive-ascending":x.scrollLeft=S;break;default:var T=x.clientWidth,D=x.scrollWidth;x.scrollLeft=D-T-S;break}else x.scrollLeft=S;else x.scrollTop=S}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&du(this._resetIsScrollingTimeoutId)},p.render=function(){var h=this.props,v=h.children,y=h.className,C=h.direction,S=h.height,_=h.innerRef,x=h.innerElementType,T=h.innerTagName,D=h.itemCount,E=h.itemData,j=h.itemKey,P=j===void 0?P1:j,O=h.layout,N=h.outerElementType,R=h.outerTagName,M=h.style,$=h.useIsScrolling,ee=h.width,H=this.state.isScrolling,te=C==="horizontal"||O==="horizontal",de=te?this._onScrollHorizontal:this._onScrollVertical,fe=this._getRangeToRender(),pe=fe[0],ae=fe[1],we=[];if(D>0)for(var ye=pe;ye<=ae;ye++)we.push(g.createElement(v,{data:E,key:P(ye,E),index:ye,isScrolling:$?H:void 0,style:this._getItemStyle(ye)}));var F=n(this.props,this._instanceProps);return g.createElement(N||R||"div",{className:y,onScroll:de,ref:this._outerRefSetter,style:Za({position:"relative",height:S,width:ee,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:C},M)},g.createElement(x||T||"div",{children:we,ref:_,style:{height:te?"100%":F,pointerEvents:H?"none":void 0,width:te?F:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var v=this._getRangeToRender(),y=v[0],C=v[1],S=v[2],_=v[3];this._callOnItemsRendered(y,C,S,_)}}if(typeof this.props.onScroll=="function"){var x=this.state,T=x.scrollDirection,D=x.scrollOffset,E=x.scrollUpdateWasRequested;this._callOnScroll(T,D,E)}},p._getRangeToRender=function(){var h=this.props,v=h.itemCount,y=h.overscanCount,C=this.state,S=C.isScrolling,_=C.scrollDirection,x=C.scrollOffset;if(v===0)return[0,0,0,0];var T=o(this.props,x,this._instanceProps),D=a(this.props,T,x,this._instanceProps),E=!S||_==="backward"?Math.max(1,y):1,j=!S||_==="forward"?Math.max(1,y):1;return[Math.max(0,T-E),Math.max(0,Math.min(v-1,D+j)),T,D]},m})(g.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var R1=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Pi&&!Pi.has(d)&&(Pi.add(d),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":ji&&!ji.has(d)&&(ji.add(d),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},F1=50,Fn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},M1=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Jh(t,r,i,0,n):B1(t,r,Math.max(0,i),n)},Jh=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Fn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},B1=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Fn(t,n,r).offset<s;)n+=o,o*=2;return Jh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},pu=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var u=n-o-1,d=u*i;return a+d},q1=Xh({getItemOffset:function(t,r,n){return Fn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:pu,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",m=f?d:c,p=Fn(t,r,i),b=pu(t,i),h=Math.max(0,Math.min(b-m,p.offset)),v=Math.max(0,p.offset-m+p.size+o);switch(n==="smart"&&(s>=v-m&&s<=h+m?n="auto":n="center"),n){case"start":return h;case"end":return v;case"center":return Math.round(v+(h-v)/2);case"auto":default:return s>=v&&s<=h?s:s<v?v:h}},getStartIndexForOffset:function(t,r,n){return M1(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,m=Fn(t,r,s),p=n+f,b=m.offset+m.size,h=r;h<a-1&&b<p;)h++,b+=Fn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||F1,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),$1=Xh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.itemCount,d=t.itemSize,f=t.layout,m=t.width,p=a==="horizontal"||f==="horizontal",b=p?m:c,h=Math.max(0,u*d-b),v=Math.min(h,r*d),y=Math.max(0,r*d-b+d+o);switch(n==="smart"&&(s>=y-b&&s<=v+b?n="auto":n="center"),n){case"start":return v;case"end":return y;case"center":{var C=Math.round(y+(v-y)/2);return C<Math.ceil(b/2)?0:C>h+Math.floor(b/2)?h:C}case"auto":default:return s>=y&&s<=v?s:s<y?y:v}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,m=d?u:i,p=Math.ceil((m+n-f)/a);return Math.max(0,Math.min(o-1,r+p-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function U1(){var e,t;const r=Ft(),s=n1().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var z1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const V1=g.forwardRef(function(t,r){const{children:n}=t,s=z1(t,["children"]),i=Ft();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(H1,{}),n]}))}),H1=()=>{const e=Ft();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(U1,{})})};var Q1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const W1=g.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=Q1(t,["style"]);const u=Ft(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+f}px`})},c))});var ep=g.createContext({dragDropManager:void 0}),Xt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Xt||(Xt={}));function xe(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var Ml="dnd-core/INIT_COORDS",ko="dnd-core/BEGIN_DRAG",Bl="dnd-core/PUBLISH_DRAG_SOURCE",Io="dnd-core/HOVER",Do="dnd-core/DROP",Lo="dnd-core/END_DRAG";function mu(e,t){return{type:Ml,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ri(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ri=function(r){return typeof r}:Ri=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ri(e)}function G1(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function K1(e,t){return e.filter(function(r){return r!==t})}function tp(e){return Ri(e)==="object"}function Y1(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function Z1(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var X1={type:Ml,payload:{clientOffset:null,sourceClientOffset:null}};function J1(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(mu(o)),eE(r,c,u);var d=nE(r,c);if(d===null){e.dispatch(X1);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");tE(a),f=a(d)}e.dispatch(mu(o,f));var m=u.getSource(d),p=m.beginDrag(c,d);if(p!=null){rE(p),u.pinSource(d);var b=u.getSourceType(d);return{type:ko,payload:{itemType:b,item:p,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function eE(e,t,r){xe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){xe(r.getSource(n),"Expected sourceIds to be registered.")})}function tE(e){xe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function rE(e){xe(tp(e),"Item must be an object.")}function nE(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function sE(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Bl}}}function Ja(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function iE(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;oE(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();aE(i,o,a);var c=o.getItemType();return lE(i,a,c),cE(i,o,a),{type:Io,payload:{targetIds:i,clientOffset:s||null}}}}function oE(e){xe(Array.isArray(e),"Expected targetIds to be an array.")}function aE(e,t,r){xe(t.isDragging(),"Cannot call hover while not dragging."),xe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];xe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);xe(i,"Expected targetIds to be registered.")}}function lE(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ja(i,r)||e.splice(n,1)}}function cE(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function gu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(r),!0).forEach(function(n){uE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dE(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();fE(n);var i=mE(n);i.forEach(function(o,a){var c=hE(o,a,s,n),u={type:Do,payload:{dropResult:vu(vu({},r),c)}};e.dispatch(u)})}}function fE(e){xe(e.isDragging(),"Cannot call drop while not dragging."),xe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function hE(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return pE(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function pE(e){xe(typeof e>"u"||tp(e),"Drop result must either be an object or undefined.")}function mE(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function gE(e){return function(){var r=e.getMonitor(),n=e.getRegistry();vE(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Lo}}}function vE(e){xe(e.isDragging(),"Cannot call endDrag while not dragging.")}function yE(e){return{beginDrag:J1(e),publishDragSource:sE(e),hover:iE(e),drop:dE(e),endDrag:gE(e)}}function bE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function SE(e,t,r){return t&&CE(e.prototype,t),e}function gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _E=(function(){function e(t,r){var n=this;bE(this,e),gs(this,"store",void 0),gs(this,"monitor",void 0),gs(this,"backend",void 0),gs(this,"isSetUp",!1),gs(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return SE(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=yE(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e})();function Qt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var yu=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),bu=function(){return Math.random().toString(36).substring(7).split("").join(".")},Cu={INIT:"@@redux/INIT"+bu(),REPLACE:"@@redux/REPLACE"+bu()};function wE(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xE(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(AE(e))return"date";if(EE(e))return"error";var r=TE(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function TE(e){return typeof e.constructor=="function"?e.constructor.name:null}function EE(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function AE(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function kn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xE(e)),t}function rp(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Qt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(1):"Expected the enhancer to be a function. Instead, received: '"+kn(r)+"'");return r(rp)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(2):"Expected the root reducer to be a function. Instead, received: '"+kn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(4):"Expected the listener to be a function. Instead, received: '"+kn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var v=!0;return u(),a.push(h),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u();var C=a.indexOf(h);a.splice(C,1),o=null}}}function m(h){if(!wE(h))throw new Error(process.env.NODE_ENV==="production"?Qt(7):"Actions must be plain objects. Instead, the actual type was: '"+kn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Qt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var v=o=a,y=0;y<v.length;y++){var C=v[y];C()}return h}function p(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(10):"Expected the nextReducer to be a function. Instead, received: '"+kn(h));s=h,m({type:Cu.REPLACE})}function b(){var h,v=f;return h={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?Qt(11):"Expected the observer to be an object. Instead, received: '"+kn(C)+"'");function S(){C.next&&C.next(d())}S();var _=v(S);return{unsubscribe:_}}},h[yu]=function(){return this},h}return m({type:Cu.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:p},n[yu]=b,n}var kE=function(t,r){return t===r};function IE(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function DE(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kE;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Su(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function _u(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(r),!0).forEach(function(n){LE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Su(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wu={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function OE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wu,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ml:case ko:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Io:return IE(e.clientOffset,r.clientOffset)?e:_u(_u({},e),{},{clientOffset:r.clientOffset});case Lo:case Do:return wu;default:return e}}var ql="dnd-core/ADD_SOURCE",$l="dnd-core/ADD_TARGET",Ul="dnd-core/REMOVE_SOURCE",Oo="dnd-core/REMOVE_TARGET";function NE(e){return{type:ql,payload:{sourceId:e}}}function jE(e){return{type:$l,payload:{targetId:e}}}function PE(e){return{type:Ul,payload:{sourceId:e}}}function RE(e){return{type:Oo,payload:{targetId:e}}}function xu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(r),!0).forEach(function(n){FE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ME={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function BE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ME,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ko:return Wt(Wt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Bl:return Wt(Wt({},e),{},{isSourcePublic:!0});case Io:return Wt(Wt({},e),{},{targetIds:r.targetIds});case Oo:return e.targetIds.indexOf(r.targetId)===-1?e:Wt(Wt({},e),{},{targetIds:K1(e.targetIds,r.targetId)});case Do:return Wt(Wt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Lo:return Wt(Wt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function qE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ql:case $l:return e+1;case Ul:case Oo:return e-1;default:return e}}var to=[],zl=[];to.__IS_NONE__=!0;zl.__IS_ALL__=!0;function $E(e,t){if(e===to)return!1;if(e===zl||typeof t>"u")return!0;var r=Z1(t,e);return r.length>0}function UE(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Io:break;case ql:case $l:case Oo:case Ul:return to;case ko:case Bl:case Lo:case Do:default:return zl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=Y1(n,i),a=o.length>0||!DE(n,i);if(!a)return to;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function zE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Tu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Eu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(r),!0).forEach(function(n){VE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function HE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:UE(e.dirtyHandlerIds,{type:t.type,payload:Eu(Eu({},t.payload),{},{prevTargetIds:G1(e,"dragOperation.targetIds",[])})}),dragOffset:OE(e.dragOffset,t),refCount:qE(e.refCount,t),dragOperation:BE(e.dragOperation,t),stateId:zE(e.stateId)}}function QE(e,t){return{x:e.x+t.x,y:e.y+t.y}}function np(e,t){return{x:e.x-t.x,y:e.y-t.y}}function WE(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:np(QE(t,n),r)}function GE(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:np(t,r)}function KE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ZE(e,t,r){return t&&YE(e.prototype,t),e}function Au(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var XE=(function(){function e(t,r){KE(this,e),Au(this,"store",void 0),Au(this,"registry",void 0),this.store=t,this.registry=r}return ZE(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;xe(typeof r=="function","listener must be a function."),xe(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!$E(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;xe(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return xe(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(xe(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ja(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(xe(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!Ja(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return WE(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return GE(this.store.getState().dragOffset)}}]),e})(),JE=0;function eA(){return JE++}function Fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fi=function(r){return typeof r}:Fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Fi(e)}function tA(e){xe(typeof e.canDrag=="function","Expected canDrag to be a function."),xe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),xe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function rA(e){xe(typeof e.canDrop=="function","Expected canDrop to be a function."),xe(typeof e.hover=="function","Expected hover to be a function."),xe(typeof e.drop=="function","Expected beginDrag to be a function.")}function el(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return el(r,!1)});return}xe(typeof e=="string"||Fi(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const ku=typeof global<"u"?global:self,sp=ku.MutationObserver||ku.WebKitMutationObserver;function ip(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function nA(e){let t=1;const r=new sp(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const sA=typeof sp=="function"?nA:ip;class iA{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=sA(this.flush),this.requestErrorThrow=ip(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class oA{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class aA{create(t){const r=this.freeTasks,n=r.length?r.pop():new oA(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const op=new iA,lA=new aA(op.registerPendingError);function cA(e){op.enqueueTask(lA.create(e))}function uA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fA(e,t,r){return t&&dA(e.prototype,t),e}function In(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hA(e,t){return vA(e)||gA(e,t)||mA(e,t)||pA()}function pA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
536
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=gn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Li.assertOptions(n,{silentJSONParsing:St.transitional(St.boolean),forcedJSONParsing:St.transitional(St.boolean),clarifyTimeoutError:St.transitional(St.boolean),legacyInterceptorReqResOrdering:St.transitional(St.boolean),advertiseZstdAcceptEncoding:St.transitional(St.boolean),validateStatusUndefinedResolves:St.transitional(St.boolean)},!1),s!=null&&(L.isFunction(s)?r.paramsSerializer={serialize:s}:Li.assertOptions(s,{encode:St.function,serialize:St.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Li.assertOptions(r,{baseUrl:St.spelling("baseURL"),withXsrfToken:St.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&L.merge(i.common,i[r.method]);i&&L.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete i[b]}),r.headers=kt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const v=r.transitional||Ol;v&&v.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,m;if(!c){const b=[eu.bind(this),void 0];for(b.unshift(...a),b.push(...u),m=b.length,d=Promise.resolve(r);f<m;)d=d.then(b[f++],b[f++]);return d}m=a.length;let p=r;for(;f<m;){const b=a[f++],h=a[f++];try{p=b(p)}catch(v){h.call(this,v);break}}try{d=eu.call(this,p)}catch(b){return Promise.reject(b)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=gn(this.defaults,t);const r=ch(t.baseURL,t.url,t.allowAbsoluteUrls,t);return sh(r,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){hn.prototype[t]=function(r,n){return this.request(gn(n||{},{method:t,url:r,data:n&&L.hasOwnProp(n,"data")?n.data:void 0}))}});L.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(gn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}hn.prototype[t]=r(),t!=="query"&&(hn.prototype[t+"Form"]=r(!0))});let Yx=class hh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new si(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new hh(function(s){t=s}),cancel:t}}};function Zx(e){return function(r){return e.apply(null,r)}}function Xx(e){return L.isObject(e)&&e.isAxiosError===!0}const Ha={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ha).forEach(([e,t])=>{Ha[t]=e});function ph(e){const t=new hn(e),r=Vf(hn.prototype.request,t);return L.extend(r,hn.prototype,t,{allOwnKeys:!0}),L.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ph(gn(e,s))},r}const rt=ph(ni);rt.Axios=hn;rt.CanceledError=si;rt.CancelToken=Yx;rt.isCancel=ah;rt.VERSION=jl;rt.toFormData=xo;rt.AxiosError=J;rt.Cancel=rt.CanceledError;rt.all=function(t){return Promise.all(t)};rt.spread=Zx;rt.isAxiosError=Xx;rt.mergeConfig=gn;rt.AxiosHeaders=kt;rt.formToJSON=e=>oh(L.isHTMLForm(e)?new FormData(e):e);rt.getAdapter=fh.getAdapter;rt.HttpStatusCode=Ha;rt.default=rt;const{Axios:zq,AxiosError:Vq,CanceledError:Hq,isCancel:Qq,CancelToken:Wq,VERSION:Gq,all:Kq,Cancel:Yq,isAxiosError:Zq,spread:Xq,toFormData:Jq,AxiosHeaders:e$,HttpStatusCode:t$,formToJSON:r$,getAdapter:n$,mergeConfig:s$,create:i$}=rt;let Qa="";function mh(e){Qa=e}const Fe=rt.create({timeout:3e4});function Jx(e,t){if(!e||typeof t!="string"||!t.trim())return e;const r=t.trim().replace(/\/+$/,""),n=r.startsWith("/")?r:`/${r}`;return e.replace(/^\/(action|api|portal)(?=\/|$)/,n)}Fe.interceptors.request.use(async e=>{var s,i,o;const{useEditorStore:t}=await Promise.resolve().then(()=>ub),r=t.getState(),n=(s=r.editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),e.url=Jx(e.url,(o=(i=r.editorConfig)==null?void 0:i.config)==null?void 0:o.apiSlug),Qa&&(e.baseURL=Qa),e});const gh="/portal";async function vh(e){var n,s,i,o,a,c,u;const t=await Fe.get(`${gh}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const d=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((u=t.data)==null?void 0:u.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${d}`)}return r}async function e0(e){var r,n;return e.length?((n=(r=(await Fe.post(`${gh}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function Eo(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(u=>Eo(u,n)):[],c=i==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent"||i==="application/vnd.sunbird.questionset"&&a.length>0;return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:c,children:a,metadata:r,parent:t}}async function yh(e){var s,i,o,a,c,u,d;const t=await Fe.get(`/action/collection/v1/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Eo(r);return{content:r,rootNode:n}}async function t0(e){const t=await vh(e),r=Eo(t);return{content:t,rootNode:r}}async function r0(e,t,r,n){var i;return((i=(await Fe.patch("/action/collection/v1/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function n0(e,t=""){await Fe.post(`/action/collection/v1/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function bh(e){var n,s,i,o,a,c,u;const t=await Fe.get(`/action/course/v1/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.content;if(!r||!r.identifier){const d=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((u=t.data)==null?void 0:u.responseCode)||`No course returned for "${e}"`;throw new Error(`Unable to load course hierarchy: ${d}`)}return r}async function s0(e){var r,n;return(n=(r=(await Fe.get(`/action/collection/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function i0(e){await Fe.post(`/action/collection/v1/review/${e}`,{request:{content:{}}})}async function o0(e,t){await Fe.post(`/action/collection/v1/reject/${e}`,{request:{content:{rejectComment:t}}})}async function a0(e,t){await Fe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const l0="application/vnd.sunbird.questionset";function Ch(e){let t=!1,r=!0;function n(s){for(const i of s){const o=i.children??[];if(o.length>0){n(o);continue}t=!0,i.objectType==="QuestionSet"&&i.mimeType===l0||(r=!1)}}return n(e.children??[]),t&&r}const ru=new Map;async function Sh(e){const t=ru.get(e);if(t)return t;const r=await bh(e),{children:n,...s}=r??{},i={qualifies:Ch(r),meta:s};return ru.set(e,i),i}async function _h(e){return(await Sh(e)).qualifies}async function c0(e){var n;const t=e.children??[],r=[];for(let s=0;s<t.length;s++){const i=t[s],o=i.children??[],a=[];for(const c of o){let u=!!((n=c.metadata)!=null&&n.isAssessmentCourse);if(!u){if((c.children??[]).length>0)u=Ch(c);else if(o.length===1&&(s===0||s===t.length-1))try{u=await _h(c.identifier)}catch(d){console.error("[lpStructure] assessment-course check failed on load:",d)}}a.push({...c,isFolder:!1,children:[],metadata:{...c.metadata??{},...u?{isAssessmentCourse:!0}:{}}})}r.push({...i,children:a})}return{...e,children:r}}function lt(e){var r,n;const t=(e==null?void 0:e.children)??[];return t.length===1&&!!((n=(r=t[0])==null?void 0:r.metadata)!=null&&n.isAssessmentCourse)}function u0(e,t,r){return r?e===0?"pre":e===t-1?"post":"levelAssessment":"content"}function d0(e,t){const r=e.findIndex(s=>s.id===t);return r===-1?null:Bs(e,r)?{role:r===0?"pre":"post",levelNumber:null}:{role:"level",levelNumber:e.slice(0,r+1).filter((s,i)=>!Bs(e,i)).length}}function Ms(e,t){return t==="pre"?e.length>0&&lt(e[0]):e.length>1&&lt(e[e.length-1])}function Bs(e,t){const r=u0(t,e.length,lt(e[t]));return r==="pre"||r==="post"}function Wa(e,t){const r=t?e.findIndex(n=>n.id===t.id):-1;return r!==-1&&Bs(e,r)}function f0(e){return Ms(e,"pre")?Ms(e,"post")?null:"post":"pre"}function h0(e,t,r){if(t<0||t>=e.length)return!1;const n=lt(e[0])?e[0]:null,s=e.length>1&&lt(e[e.length-1])?e[e.length-1]:null;if(!n&&!s)return!0;const i=[...e],[o]=i.splice(t,1);return i.splice(r,0,o),!(n&&i[0]!==n||s&&i[i.length-1]!==s)}function nu(e,t,r){return r?!1:t?!((e==null?void 0:e.children)??[]).some(s=>{var i;return!!((i=s.metadata)!=null&&i.isAssessmentCourse)}):!0}function vn(e){return Array.isArray(e)?e.map(String):e?[String(e)]:[]}function wh(e,t){var n,s;return e?((n=t[e.id])==null?void 0:n.framework)??((s=e.metadata)==null?void 0:s.framework):void 0}function xh(e,t){return!!wh(e,t)}function Th(e,t){if(!e||!t)return[];const r=new Set,n=e.children??[];return n.forEach((s,i)=>{var o,a;Bs(n,i)?vn((o=s.children[0].metadata)==null?void 0:o[t]).forEach(c=>r.add(c)):vn((a=s.metadata)==null?void 0:a[t]).forEach(c=>r.add(c))}),Array.from(r)}function p0(e,t,r){var u,d;if(!e||!t)return null;const n=Th(e,t),s=((u=r[e.id])==null?void 0:u[t])??((d=e.metadata)==null?void 0:d[t]),i=vn(s),o=[...n].sort(),a=[...i].sort();return o.length===a.length&&o.every((f,m)=>f===a[m])?null:n}function m0(e,t,r){if(!e||!t||r.length===0)return[];const n=e.children??[];return n.filter((s,i)=>{var a;return Bs(n,i)?!1:vn((a=s.metadata)==null?void 0:a[t]).some(c=>!r.includes(c))})}function Eh(e,t,r){var s;if(!e||!r||t.length===0)return[];const n=new Set;for(const i of e.children??[])vn((s=i.metadata)==null?void 0:s[r]).forEach(o=>n.add(o));return t.filter(i=>!n.has(i))}const Ah=new Set(["adaptive"]);function Rl(e,t,r,n={}){var b,h,v,y;const s=[];if(!e)return s;const i=((b=n[e.id])==null?void 0:b.policy)??((h=e.metadata)==null?void 0:h.policy);i||s.push({code:"policyMissing",message:"Set a consumption policy for this path."});const o=e.children??[],a=o[0],c=o.length>1?o[o.length-1]:void 0,u=lt(a),d=lt(c);!u&&i&&Ah.has(i)&&s.push({code:"priorAssessmentRequired",message:"A Prior Assessment is required for the Adaptive policy."}),[[a,"Prior Assessment"],[c,"Outcome Assessment"]].forEach(([C,S])=>{var x,T;if(!C)return;const _=C.children??[];(_.length!==1||!((T=(x=_[0])==null?void 0:x.metadata)!=null&&T.isAssessmentCourse))&&s.push({code:"slotNotPure",nodeId:C.id,message:`${S} must contain exactly one question-set-only course.`})});const f=new Set,m=(C,S)=>{f.has(C)&&s.push({code:"duplicateCourse",nodeId:S,message:"A course appears more than once in this path."}),f.add(C)},p=o.slice(u?1:0,o.length-(d?1:0));u&&m(a.children[0].id,a.id),d&&m(c.children[0].id,c.id);for(const C of p){const S=C.children??[],_=S.length===0;_&&s.push({code:"emptyLevel",nodeId:C.id,message:`"${C.name}" has no courses yet.`});const x=t?vn((v=C.metadata)==null?void 0:v[t]):[];if(x.length===0)_||s.push({code:"levelMissingSkills",nodeId:C.id,message:`"${C.name}" needs at least one skill selected.`});else{if(r.length>0){const D=x.filter(E=>!r.includes(E));D.length>0&&s.push({code:"levelSkillsOutOfScope",nodeId:C.id,message:`"${C.name}" has skills outside the current scope: ${D.join(", ")}.`})}const T=Eh(C,x,t);T.length>0&&s.push({code:"levelSkillsUncovered",nodeId:C.id,message:`"${C.name}" has no course covering: ${T.join(", ")}.`})}for(const T of S)m(T.id,C.id),(t?vn((y=T.metadata)==null?void 0:y[t]):[]).length===0&&s.push({code:"courseMissingSkillTag",nodeId:T.id,message:`"${T.name}" has no skill tag.`})}return s}async function g0(e){const t=[],r=(e==null?void 0:e.children)??[],n=r[0],s=r.length>1?r[r.length-1]:void 0;for(const[i,o]of[[n,"Prior Assessment"],[s,"Outcome Assessment"]]){if(!i||!lt(i))continue;const a=i.children[0].id;await _h(a)||t.push({code:"slotCourseChanged",nodeId:i.id,message:`${o}'s course is no longer question-set-only — pick a different course.`})}return t}function Nt(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function kh(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=kh(s.children,t,r+1);if(i>=0)return i}}return-1}const su=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Ih(e,t,r,n){return e.map(s=>{if(s.id===t){const i=r.metadata??{},o=n!=null&&n.length?new Set([...su,...n]):su,a={};for(const c of o)c in r&&(a[c]=r[c]);return{...s,...r,metadata:{...s.metadata??{},...a,...i}}}return s.children&&s.children.length>0?{...s,children:Ih(s.children,t,r,n)}:s})}function Oi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:Oi(n.children,t,r)}:n)}function Dh(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]];return i.splice(n,0,r),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Dh(s.children,t,r,n)}:s})}function Ga(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Ga(r.children,t):[]}))}function Ka(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Ka(s.children,t,r,n)}:s})}function Lh(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?Lh(r.children,t):[]}})}function v0(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function y0(e,t){const r=Nt(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Nt(e,s.parent):void 0;return n}const re=ei((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Nt(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};K.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),yr.getState().setActiveAssessmentSlot(null),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n,s)=>{if(e(i=>({treeData:Ih(i.treeData,r,n,s),treeCache:{...i.treeCache,[r]:{...i.treeCache[r]??{},...n}}})),t().selectedNodeId===r){const i=Nt(t().treeData,r);e(o=>({activeNodeMeta:{...(i==null?void 0:i.metadata)??{},...o.treeCache[r]??{}}}))}t().markDirty()},addNode:(r,n)=>{var m,p,b;const s=t(),i=K.getState().editorProfile,o=((p=(m=K.getState().editorConfig)==null?void 0:m.config)==null?void 0:p.maxDepth)??i.maxDepth,a=kh(s.treeData,r);if(a>=o)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${o}). parentDepth=${a}`),"";const c="temp-"+Math.random().toString(36).slice(2),u={id:c,identifier:c,name:i.defaultUnitName,isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:c,name:i.defaultUnitName,contentType:i.unitContentType,primaryCategory:i.unitPrimaryCategory,visibility:"Parent"}},d=((b=Nt(s.treeData,r))==null?void 0:b.children)??[],f=i.derivedRoles&&Ms(d,"post");return e(h=>({treeData:f?Dh(h.treeData,r,u,d.length-1):Oi(h.treeData,r,u),treeCache:{...h.treeCache,[c]:{...u.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(c),0),c},deleteNode:r=>{var s;const n=(s=t().treeData[0])==null?void 0:s.id;r!==n&&e(i=>({treeData:Ga(i.treeData,r),selectedNodeId:i.selectedNodeId===r?null:i.selectedNodeId}))},reorderChildren:(r,n,s)=>{var a;const i=K.getState().editorProfile,o=(a=t().treeData[0])==null?void 0:a.id;if(i.derivedRoles&&r===o){const c=Nt(t().treeData,r);if(c!=null&&c.children&&!h0(c.children,n,s))return}e(c=>({treeData:Ka(c.treeData,r,n,s)}))},moveNode:(r,n,s)=>{var u,d,f;const i=K.getState().editorProfile,o=Nt(t().treeData,r),a=Nt(t().treeData,s);if(!(a!=null&&a.isFolder))return;const c=(u=t().treeData[0])==null?void 0:u.id;if(!(i.derivedRoles&&(o!=null&&o.isFolder)&&s!==c)){if(i.derivedRoles&&o&&!o.isFolder){const m=!!((d=o.metadata)!=null&&d.isAssessmentCourse),p=((f=t().treeData[0])==null?void 0:f.children)??[];if(!nu(a,m,Wa(p,a)))return}e(m=>{const p=Nt(m.treeData,r);if(!p)return m;let b=Ga(m.treeData,r);return b=Oi(b,s,{...p,parent:s}),{treeData:b}}),t().markDirty()}},addResource:(r,n,s)=>{var b,h,v,y,C,S;const i=K.getState().editorConfig,o=K.getState().editorProfile,a=(b=t().treeData[0])==null?void 0:b.id,c=!!(s!=null&&s.isAssessmentCourse);if(o.derivedRoles&&n===a){if(!c||Nt(t().treeData,r.identifier))return!1;const _=t().treeData[0],x=(_==null?void 0:_.children)??[],T=(s==null?void 0:s.slot)??f0(x);if(!T||Ms(x,T))return!1;const D=t().addNode(a,"unit");if(!D)return!1;const{learningPath:E}=kl.getState().labelConfig;if(t().updateNode(D,{name:T==="pre"?E.priorAssessmentLabel:E.outcomeAssessmentLabel}),T==="pre"){const j=(((v=(h=t().treeData[0])==null?void 0:h.children)==null?void 0:v.length)??1)-1;e(P=>({treeData:Ka(P.treeData,a,j,0)}))}return t().addResource(r,D,s)}if(!(((y=i==null?void 0:i.config)==null?void 0:y.allowContentUnderRoot)??!1)&&n===a||Nt(t().treeData,r.identifier))return!1;const d=Nt(t().treeData,n);if(!(d!=null&&d.isFolder))return!1;if(o.derivedRoles){const _=((C=t().treeData[0])==null?void 0:C.children)??[];if(!nu(d,c,Wa(_,d)))return!1}const f=((S=i==null?void 0:i.config)==null?void 0:S.maxContentsLimit)??1200;if(v0(t().treeData)>=f)return!1;const p={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:{...r,...c?{isAssessmentCourse:!0}:{}}};return e(_=>({treeData:Oi(_.treeData,n,p)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=K.getState();r==="edit"&&n(!0)},pruneCoursesByFramework:r=>{let n=0;return e(s=>{const i=s.treeData[0];if(!i)return s;const o=[];for(const a of i.children??[]){const c=lt(a),u=(a.children??[]).filter(d=>{var p;if(d.isFolder)return!0;const f=(p=d.metadata)==null?void 0:p.framework,m=!f||(Array.isArray(f)?f.includes(r):f===r);return m||n++,m});c&&u.length===0||o.push(u.length===(a.children??[]).length?a:{...a,children:u})}return n===0?s:{treeData:[{...i,children:o}]}}),n>0&&t().markDirty(),n},clearLevelSkills:r=>{if(!r)return 0;let n=0;return e(s=>{const i=s.treeData[0];if(!i)return s;const o={...s.treeCache},a=(i.children??[]).map(c=>{var m,p;if(!(((m=c.metadata)==null?void 0:m[r])!==void 0||((p=o[c.id])==null?void 0:p[r])!==void 0))return c;n++;const{[r]:d,...f}=c.metadata??{};if(o[c.id]){const{[r]:b,...h}=o[c.id];o[c.id]=h}return{...c,metadata:f}});return n===0?s:{treeData:[{...i,children:a}],treeCache:o}}),n>0&&t().markDirty(),n},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Lh(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const u=r[a]??a,{isNew:d,...f}=c;i[u]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Nt(t().treeData,r),getChildrenOf:r=>{const n=Nt(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>y0(t().treeData,r)})),b0="_spin_1ah4d_9",C0={spin:b0};function oe(){return kl(e=>e.labelConfig)}const S0=({size:e=16,color:t="currentColor"})=>{const r=oe();return l.jsx("svg",{className:C0.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":r.spinner.loading,role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})})},Re=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(S0,{size:14}):null,i]}),Oh=({size:e=16,...t})=>l.jsxs("svg",{width:e,height:e,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[l.jsx("circle",{cx:"58",cy:"12",r:"4",stroke:"currentColor",strokeWidth:"4"}),l.jsx("circle",{cx:"8",cy:"58",r:"4",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{d:"M52 12 H24 A12 12 0 0 0 24 36 H40 A12 12 0 0 1 40 60 H12",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]});async function iu(e){var r,n;return(n=(r=(await Fe.get(`/action/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function _0(e){var r,n;return((n=(r=(await Fe.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Ao(e,t){const r=Jn({queryKey:["framework",e],queryFn:()=>iu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Jn({queryKey:["framework",n],queryFn:()=>iu(n),enabled:!!n,staleTime:300*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function Nh(e){if(!(e!=null&&e.length))return null;const t=e.reduce((r,n)=>(n.index??-1/0)>(r.index??-1/0)?n:r);return{code:t.code,terms:t.terms??[]}}function w0(e){var n,s,i,o;const t=(n=e==null?void 0:e.children)==null?void 0:n[0];if(!lt(t))return;const r=(o=(i=(s=t==null?void 0:t.children)==null?void 0:s[0])==null?void 0:i.metadata)==null?void 0:o.framework;return Array.isArray(r)?r[0]:r}function lr(){var i;const e=K(o=>o.editorConfig),t=K(o=>o.contentFramework),r=re(o=>o.treeData),n=w0(r[0])??t??((i=e==null?void 0:e.context)==null?void 0:i.framework),{organisationFramework:s}=Ao(n);return Nh(s==null?void 0:s.categories)}function x0(e,t,r){var u,d,f,m;const n={scope:((t==null?void 0:t.terms)??[]).map(p=>p.name),source:"manual"};if(!t)return n;const s=(u=e==null?void 0:e.children)==null?void 0:u[0];if(!lt(s))return n;const i=(d=s==null?void 0:s.children)==null?void 0:d[0];if(!i)return n;const a=((f=r[i.id])==null?void 0:f[t.code])??((m=i.metadata)==null?void 0:m[t.code]);return{scope:Array.isArray(a)?a:a?[a]:[],source:"prior"}}function ii(){const e=lr(),t=re(n=>n.treeData),r=re(n=>n.treeCache);return g.useMemo(()=>x0(t[0],e,r),[t,e,r])}const T0="_overlay_kdzmi_1",E0="_modal_kdzmi_15",A0="_modalHeader_kdzmi_27",k0="_modalHeaderClose_kdzmi_37",I0="_modalBody_kdzmi_55",D0="_modalFooter_kdzmi_62",L0="_checkRow_kdzmi_69",O0="_formGroup_kdzmi_112",N0="_textarea_kdzmi_123",j0="_sliderGroup_kdzmi_144",P0="_sliderValue_kdzmi_156",R0="_sliderLabels_kdzmi_164",F0="_sectionTitle_kdzmi_172",Ae={overlay:T0,modal:E0,modalHeader:A0,modalHeaderClose:k0,modalBody:I0,modalFooter:D0,checkRow:L0,formGroup:O0,textarea:N0,sliderGroup:j0,sliderValue:P0,sliderLabels:R0,sectionTitle:F0},M0=({objectType:e,onConfirm:t,onCancel:r})=>{const n=oe(),s=re(b=>b.treeData[0]),i=re(b=>b.treeCache),o=lr(),{scope:a}=ii(),[c,u]=g.useState(null),d=Rl(s,o==null?void 0:o.code,a,i);g.useEffect(()=>{let b=!1;return u(null),g0(s).then(h=>{b||u(h)}),()=>{b=!0}},[s]);const f=c===null,m=[...d,...c??[]],p=!f&&m.length===0;return l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",e]}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:m.length===0?l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:f?n.learningPath.verifyingAssessmentCourses:`${n.publishChecklist.confirmPublishPrefix} ${e}?`}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ae.sectionTitle,children:n.learningPath.resolveBeforePublishing}),l.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13,lineHeight:1.6},children:m.map((b,h)=>l.jsx("li",{children:b.message},`${b.code}-${b.nodeId??h}`))})]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),l.jsx(Re,{variant:"primary",onClick:t,disabled:!p,children:n.publishChecklist.yesButton})]})]})})},B0=({contentId:e,onConfirm:t,onCancel:r})=>{const n=oe(),s=K(m=>{var p,b;return(b=(p=m.editorConfig)==null?void 0:p.config)==null?void 0:b.objectType})||"Content",i=K(m=>m.editorProfile.key==="learningPath"),o=K(m=>m.publishChecklist)??[],[a,c]=g.useState({}),u=o.every(m=>a[m.code]),d=o.length===0||u,f=()=>{t()};return i?l.jsx(M0,{objectType:s,onConfirm:t,onCancel:r}):l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",s]}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:o.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:[n.publishChecklist.confirmPublishPrefix," ",s,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ae.sectionTitle,children:n.publishChecklist.checklistInstructions}),o.map(m=>l.jsxs("label",{className:Ae.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!a[m.code],onChange:p=>c(b=>({...b,[m.code]:p.target.checked}))}),l.jsx("span",{children:m.label})]},m.code))]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),l.jsx(Re,{variant:"primary",onClick:f,disabled:!d,children:n.publishChecklist.yesButton})]})]})})},q0=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const s=oe(),[i,o]=g.useState(""),[a,c]=g.useState(7),u=t==="approve",d=u?s.qualityParamsModal.reviewQualityTitle:s.qualityParamsModal.rejectContentTitle,f=!u&&i.trim().length===0,m=()=>{u?r(i.trim(),a):r(i.trim())};return l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:n,"aria-label":s.qualityParamsModal.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:u?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ae.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:s.qualityParamsModal.qualityScoreLabel}),l.jsxs("div",{className:Ae.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:a,onChange:p=>c(Number(p.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":a}),l.jsx("span",{className:Ae.sliderValue,children:a})]}),l.jsxs("div",{className:Ae.sliderLabels,children:[l.jsx("span",{children:s.qualityParamsModal.scorePoorLabel}),l.jsx("span",{children:s.qualityParamsModal.scoreExcellentLabel})]})]}),l.jsxs("div",{className:Ae.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:[s.qualityParamsModal.commentLabel," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:s.qualityParamsModal.optionalLabel})]}),l.jsx("textarea",{id:"quality-comment",className:Ae.textarea,placeholder:s.qualityParamsModal.commentPlaceholder,value:i,onChange:p=>o(p.target.value),rows:4})]})]}):l.jsxs("div",{className:Ae.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:[s.qualityParamsModal.rejectionReasonLabel," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Ae.textarea,placeholder:s.qualityParamsModal.rejectReasonPlaceholder,value:i,onChange:p=>o(p.target.value),rows:5,required:!0,"aria-required":"true"}),i.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:s.qualityParamsModal.rejectionRequiredMessage})]})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:n,children:s.qualityParamsModal.cancelButton}),l.jsx(Re,{variant:u?"primary":"danger",onClick:m,disabled:f,children:u?s.qualityParamsModal.approveButton:s.qualityParamsModal.rejectButton})]})]})})},$0=({message:e,onConfirm:t,onCancel:r})=>{const n=oe();return xr.createPortal(l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"confirm-dialog-title",children:n.confirmDialog.title}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":n.confirmDialog.closeAriaLabel,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:e})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,children:n.confirmDialog.cancelButton}),l.jsx(Re,{variant:"danger",onClick:t,children:n.confirmDialog.confirmButton})]})]})}),document.body)},jh=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function U0(e,t={}){var c,u,d,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:jh,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(d=(u=(await Fe.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:u.result)==null?void 0:d.response)==null?void 0:f.content)??[]}async function z0(e){var r,n,s;return e.length?((s=(n=(r=(await Fe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:jh,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function V0(e){var r,n;return((n=(r=(await Fe.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const H0="_container_1hnn8_1",Q0="_header_1hnn8_13",W0="_title_1hnn8_22",G0="_closeBtn_1hnn8_29",K0="_body_1hnn8_45",Y0="_label_1hnn8_54",Z0="_searchSection_1hnn8_62",X0="_searchRow_1hnn8_68",J0="_searchInput_1hnn8_74",eT="_searchSpinner_1hnn8_89",tT="_resultsList_1hnn8_105",rT="_resultItem_1hnn8_118",nT="_userInfo_1hnn8_133",sT="_userName_1hnn8_141",iT="_userEmail_1hnn8_150",oT="_userOrg_1hnn8_158",aT="_noResults_1hnn8_167",lT="_collabSection_1hnn8_174",cT="_sectionTitle_1hnn8_179",uT="_badge_1hnn8_189",dT="_emptyCollab_1hnn8_203",fT="_collabList_1hnn8_214",hT="_collabItem_1hnn8_223",pT="_userAvatar_1hnn8_237",mT="_error_1hnn8_251",gT="_success_1hnn8_257",vT="_footer_1hnn8_263",Pe={container:H0,header:Q0,title:W0,closeBtn:G0,body:K0,label:Y0,searchSection:Z0,searchRow:X0,searchInput:J0,searchSpinner:eT,resultsList:tT,resultItem:rT,userInfo:nT,userName:sT,userEmail:iT,userOrg:oT,noResults:aT,collabSection:lT,sectionTitle:cT,badge:uT,emptyCollab:dT,collabList:fT,collabItem:hT,userAvatar:pT,error:mT,success:gT,footer:vT},yT=({contentId:e,onClose:t})=>{var j,P;const r=oe(),n=K(O=>O.editorConfig),s=(j=n==null?void 0:n.context)==null?void 0:j.channel,i=(P=n==null?void 0:n.config)==null?void 0:P.objectType,[o,a]=g.useState(""),[c,u]=g.useState([]),[d,f]=g.useState(!1),[m,p]=g.useState([]),[b,h]=g.useState(!1),[v,y]=g.useState(""),[C,S]=g.useState(!1),_=g.useRef(null);g.useEffect(()=>{let O=!1;return(async()=>{try{const N=await s0(e),R=(N==null?void 0:N.collaborators)??[];if(!R.length)return;const M=await z0(R);if(O)return;const $=R.map(ee=>M.find(H=>H.identifier===ee)??{identifier:ee,firstName:ee});p($)}catch{}})(),()=>{O=!0}},[e]),g.useEffect(()=>{_.current&&clearTimeout(_.current);const O=o.trim();if(O.length<2){u([]);return}return _.current=setTimeout(async()=>{f(!0);try{const N=await U0(O,{rootOrgId:s,objectType:i}),R=new Set(m.map(M=>M.identifier));u(N.filter(M=>!R.has(M.identifier)))}catch{u([])}finally{f(!1)}},300),()=>{_.current&&clearTimeout(_.current)}},[o,m,s,i]);const x=g.useCallback(O=>{p(N=>N.find(R=>R.identifier===O.identifier)?N:[...N,O]),u(N=>N.filter(R=>R.identifier!==O.identifier)),S(!1)},[]),T=g.useCallback(O=>{p(N=>N.filter(R=>R.identifier!==O)),S(!1)},[]),D=g.useCallback(async()=>{h(!0),y(""),S(!1);try{await a0(e,m.map(O=>O.identifier)),S(!0)}catch{y(r.manageCollaborators.saveFailed)}finally{h(!1)}},[e,m,r.manageCollaborators.saveFailed]),E=O=>`${O.firstName}${O.lastName?` ${O.lastName}`:""}`;return l.jsxs("div",{className:Pe.container,children:[l.jsxs("div",{className:Pe.header,children:[l.jsx("h2",{className:Pe.title,children:r.manageCollaborators.title}),l.jsx("button",{className:Pe.closeBtn,onClick:t,"aria-label":r.manageCollaborators.closeAriaLabel,children:l.jsx(br,{size:18})})]}),l.jsxs("div",{className:Pe.body,children:[l.jsxs("div",{className:Pe.searchSection,children:[l.jsx("label",{className:Pe.label,htmlFor:"collab-search",children:r.manageCollaborators.searchUsersLabel}),l.jsxs("div",{className:Pe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Pe.searchInput,placeholder:r.manageCollaborators.searchPlaceholder,value:o,onChange:O=>a(O.target.value)}),d&&l.jsx("span",{className:Pe.searchSpinner,"aria-label":r.manageCollaborators.searchingAriaLabel})]}),c.length>0&&l.jsx("ul",{className:Pe.resultsList,role:"listbox","aria-label":r.manageCollaborators.searchResultsAriaLabel,children:c.map(O=>{var N,R,M,$;return l.jsxs("li",{className:Pe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Pe.userInfo,children:[l.jsx("span",{className:Pe.userName,children:E(O)}),O.email&&l.jsx("span",{className:Pe.userEmail,children:O.email}),(((R=(N=O.organisations)==null?void 0:N[0])==null?void 0:R.orgName)??O.rootOrgName)&&l.jsx("span",{className:Pe.userOrg,children:(($=(M=O.organisations)==null?void 0:M[0])==null?void 0:$.orgName)??O.rootOrgName})]}),l.jsx(Re,{variant:"primary",size:"sm",onClick:()=>x(O),children:r.manageCollaborators.add})]},O.identifier)})}),o.trim().length>=2&&!d&&c.length===0&&l.jsx("p",{className:Pe.noResults,children:r.manageCollaborators.noUsersFound})]}),l.jsxs("div",{className:Pe.collabSection,children:[l.jsxs("h3",{className:Pe.sectionTitle,children:[r.manageCollaborators.currentCollaborators,m.length>0&&l.jsx("span",{className:Pe.badge,children:m.length})]}),m.length===0?l.jsx("p",{className:Pe.emptyCollab,children:r.manageCollaborators.noCollaboratorsYet}):l.jsx("ul",{className:Pe.collabList,children:m.map(O=>{var N,R,M,$;return l.jsxs("li",{className:Pe.collabItem,children:[l.jsx("div",{className:Pe.userAvatar,"aria-hidden":"true",children:E(O).charAt(0).toUpperCase()}),l.jsxs("div",{className:Pe.userInfo,children:[l.jsx("span",{className:Pe.userName,children:E(O)}),O.email&&l.jsx("span",{className:Pe.userEmail,children:O.email}),(((R=(N=O.organisations)==null?void 0:N[0])==null?void 0:R.orgName)??O.rootOrgName)&&l.jsx("span",{className:Pe.userOrg,children:(($=(M=O.organisations)==null?void 0:M[0])==null?void 0:$.orgName)??O.rootOrgName})]}),l.jsx(Re,{variant:"danger",size:"sm",onClick:()=>T(O.identifier),children:r.manageCollaborators.remove})]},O.identifier)})})]}),v&&l.jsx("p",{className:Pe.error,role:"alert",children:v}),C&&l.jsx("p",{className:Pe.success,role:"status",children:r.manageCollaborators.saveSuccess})]}),l.jsxs("div",{className:Pe.footer,children:[l.jsx(Re,{variant:"ghost",onClick:t,disabled:b,children:r.manageCollaborators.cancel}),l.jsx(Re,{variant:"primary",isLoading:b,onClick:D,children:r.manageCollaborators.save})]})]})};async function bT(e){return(await Fe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function CT(e,t){var s;const n=((s=(await Fe.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function ST(e){var n;const r=((n=(await Fe.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const _T="_topbar_c3y0z_1",wT="_left_c3y0z_15",xT="_right_c3y0z_23",TT="_backBtn_c3y0z_30",ET="_title_c3y0z_49",AT="_profileBadge_c3y0z_61",kT="_statusChip_c3y0z_76",IT="_savedIndicator_c3y0z_88",DT="_unsaved_c3y0z_98",LT="_iconBtn_c3y0z_103",OT="_iconBtnLabel_c3y0z_130",NT="_qrDropdown_c3y0z_134",jT="_qrMenu_c3y0z_138",PT="_reviewBtns_c3y0z_173",RT="_sourcingBtns_c3y0z_182",FT="_modalOverlay_c3y0z_191",MT="_sbOverlay_c3y0z_201",BT="_sbModal_c3y0z_211",qT="_sbModalHeader_c3y0z_222",$T="_sbModalTitle_c3y0z_230",UT="_sbModalClose_c3y0z_237",zT="_sbModalBody_c3y0z_250",VT="_sbLabel_c3y0z_257",HT="_sbTextarea_c3y0z_264",QT="_sbError_c3y0z_281",WT="_sbModalFooter_c3y0z_288",_e={topbar:_T,left:wT,right:xT,backBtn:TT,title:ET,profileBadge:AT,statusChip:kT,savedIndicator:IT,unsaved:DT,iconBtn:LT,iconBtnLabel:OT,qrDropdown:NT,qrMenu:jT,reviewBtns:PT,sourcingBtns:RT,modalOverlay:FT,sbOverlay:MT,sbModal:BT,sbModalHeader:qT,sbModalTitle:$T,sbModalClose:UT,sbModalBody:zT,sbLabel:VT,sbTextarea:HT,sbError:QT,sbModalFooter:WT};function GT(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function KT(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}const YT=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const a=oe(),[c,u]=g.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:_e.sbModalTitle,children:e}),l.jsx("button",{className:_e.sbModalClose,onClick:o,"aria-label":a.reviewCommentModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsxs("div",{className:_e.sbModalBody,children:[l.jsxs("label",{className:_e.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:_e.sbTextarea,placeholder:r,value:c,onChange:f=>u(f.target.value),rows:4,required:!0,"aria-required":"true"}),c.trim().length===0&&l.jsx("p",{className:_e.sbError,children:a.reviewCommentModal.fillCommentsError})]}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:o,children:a.reviewCommentModal.cancelButton}),l.jsx(Re,{variant:s,onClick:()=>i(c.trim()),disabled:c.trim().length===0,children:n})]})]})})},ZT=({onConfirm:e,onCancel:t})=>{const r=oe(),[n,s]=g.useState(!1),i=K(m=>m.editorProfile.key==="learningPath"),o=re(m=>m.treeData[0]),a=re(m=>m.treeCache),c=lr(),{scope:u}=ii(),d=i?Rl(o,c==null?void 0:c.code,u,a):[],f=d.length>0;return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:_e.sbModalTitle,children:r.confirmReviewModal.title}),l.jsx("button",{className:_e.sbModalClose,onClick:t,"aria-label":r.confirmReviewModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsx("div",{className:_e.sbModalBody,children:f?l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:"0 0 8px",fontSize:13,fontWeight:600},children:r.learningPath.resolveBeforeSendingForReview}),l.jsx("ul",{style:{margin:0,paddingLeft:18,fontSize:13,lineHeight:1.6},children:d.map((m,p)=>l.jsx("li",{children:m.message},`${m.code}-${m.nodeId??p}`))})]}):l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:n,onChange:m=>s(m.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:[r.confirmReviewModal.agreementTextPart1," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:r.confirmReviewModal.creativeCommonsLinkText})," ",r.confirmReviewModal.agreementTextPart2," ",l.jsx("strong",{children:r.confirmReviewModal.contentPolicyText}),r.confirmReviewModal.agreementTextPart3]})]})}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:t,children:r.confirmReviewModal.cancelButton}),!f&&l.jsx(Re,{variant:"primary",onClick:e,disabled:!n,children:r.confirmReviewModal.submitButton})]})]})})},XT=({onConfirm:e,onCancel:t})=>{const r=oe(),[n,s]=g.useState(""),i=parseInt(n,10),o=!isNaN(i)&&i>=2&&i<=250;return l.jsx("div",{className:_e.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:_e.sbModal,children:[l.jsxs("div",{className:_e.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:_e.sbModalTitle,children:r.generateQRModal.title}),l.jsx("button",{className:_e.sbModalClose,onClick:t,"aria-label":r.generateQRModal.closeAriaLabel,type:"button",children:"×"})]}),l.jsxs("div",{className:_e.sbModalBody,children:[l.jsxs("label",{className:_e.sbLabel,htmlFor:"qr-count",children:[r.generateQRModal.numberOfCodesLabel," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:_e.sbTextarea,style:{resize:"none",height:"40px"},placeholder:r.generateQRModal.countPlaceholder,value:n,onChange:a=>s(a.target.value)}),n&&!o&&l.jsx("p",{className:_e.sbError,children:r.generateQRModal.countRangeError})]}),l.jsxs("div",{className:_e.sbModalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:t,children:r.generateQRModal.cancelButton}),l.jsx(Re,{variant:"primary",onClick:()=>e(i),disabled:!o,children:r.generateQRModal.generateButton})]})]})})},JT=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var be,me;const o=oe(),c=re(le=>le.treeData)[0],u=(c==null?void 0:c.name)??o.contextualEditor.untitledPlaceholder,d=KT(((be=c==null?void 0:c.metadata)==null?void 0:be.status)??(c==null?void 0:c.status),o.topbar.draftStatusFallback),f=K(le=>{var ve,Te,Y,ce;return((Te=(ve=le.editorConfig)==null?void 0:ve.context)==null?void 0:Te.contentId)??((ce=(Y=le.editorConfig)==null?void 0:Y.context)==null?void 0:ce.identifier)??""}),{activeModal:m,modalData:p,closeModal:b,openModal:h}=yr(),v=K(le=>le.buttonLoaders),y=K(le=>le.categoryMeta),C=K(le=>le.editorProfile),S=C.key==="learningPath",_=C.features.dialcodes&&(!y||y.schemaDefaults.generateDIALCodes!=="No"),[x,T]=g.useState(!1),[D,E]=g.useState(!1),[j,P]=g.useState(!1),O=g.useRef(null),[N,R]=g.useState(!1);g.useEffect(()=>{if(!j)return;const le=ve=>{var Te;(Te=O.current)!=null&&Te.contains(ve.target)||P(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[j]);const[M,$]=g.useState(!1),[ee,H]=g.useState(!1),{updateNode:te}=re(),de=(me=c==null?void 0:c.metadata)==null?void 0:me.qrCodeProcessId,fe=g.useCallback(async le=>{if(f){R(!1),$(!0);try{const{processId:ve,reservedDialcodes:Te}=await CT(f,le);ve&&c&&te(c.id,{qrCodeProcessId:ve,reservedDialcodes:Te}),Se.success(o.topbar.qrGenerationStartedToast)}catch{Se.error(o.topbar.qrGenerationFailedToast)}finally{$(!1)}}},[f,c,te,o]),pe=g.useCallback(async()=>{if(!de){Se.error(o.topbar.qrCodesNotGeneratedToast);return}H(!0);try{const le=await ST(de);if(le.status==="in-process"){Se(o.topbar.qrGenerationInProgressToast,{icon:l.jsx(Bn,{size:16})});return}const ve=le.url;if(!ve){Se.error(o.topbar.qrCodesNotReadyToast);return}const Te=await fetch(ve).then(We=>We.blob()),Y=await new Promise(We=>{const tt=new FileReader;tt.onloadend=()=>We(tt.result),tt.readAsDataURL(Te)}),ce=(c==null?void 0:c.metadata)??{},Q=We=>Array.isArray(We)?We.join("_"):typeof We=="string"?We:"",Ce=[f,Q(ce.medium),Q(ce.gradeLevel),Q(ce.subject)].filter(Boolean),qe=new Date().toISOString().replace(/[:.]/g,"-"),et=`${Ce.join("_")}_${qe}.zip`,$e=document.createElement("a");$e.href=Y,$e.download=et,$e.style.display="none",document.body.appendChild($e),$e.click(),document.body.removeChild($e),Se.success(o.topbar.qrCodesDownloadedToast)}catch{Se.error(o.topbar.qrCodesDownloadFailedToast)}finally{H(!1)}},[de,c,f,o]),ae=e==="edit",we=e==="review",ye=e==="sourcingreview",F=e==="read",B=g.useCallback((le,ve)=>{i({action:le,data:ve})},[i]),Z=g.useCallback(()=>{b(),B("publish")},[b,B]),he=g.useCallback((le,ve)=>{const Te=p==null?void 0:p.action;b(),Te==="approve"?B("sourcingApprove",{comment:le,score:ve}):B("reject",{comment:le})},[b,B,p]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:_e.topbar,role:"banner",children:[l.jsxs("div",{className:_e.left,children:[l.jsx("button",{className:_e.backBtn,onClick:()=>B("back"),"aria-label":o.topbar.backAriaLabel,type:"button",children:l.jsx(wl,{size:18})}),l.jsx("h1",{className:_e.title,title:u,children:u}),S&&l.jsxs("span",{className:_e.profileBadge,children:[l.jsx(Oh,{size:13,"aria-hidden":"true"}),o.learningPath.profileBadgeLabel]}),l.jsx("span",{className:`sbx-chip ${_e.statusChip}`,"aria-label":`${o.topbar.statusAriaLabelPrefix} ${d}`,children:d})]}),l.jsxs("div",{className:_e.right,children:[t?l.jsx("span",{className:_e.savedIndicator,"aria-live":"polite",children:o.topbar.savingIndicator}):r&&ae?l.jsx("span",{className:`${_e.savedIndicator} ${_e.unsaved}`,"aria-live":"polite",children:o.topbar.unsavedIndicator}):n?l.jsxs("span",{className:_e.savedIndicator,"aria-live":"polite",children:[l.jsx(bn,{size:14,"aria-hidden":"true"}),o.topbar.savedIndicatorPrefix," ",GT(n)]}):null,!F&&!we&&!ye&&d!=="Review"&&l.jsx("span",{title:s?void 0:o.topbar.fillRequiredFieldsTooltip,children:l.jsx(Re,{variant:"ghost",size:"sm",onClick:()=>B("saveCollection"),disabled:!s,children:o.topbar.saveAsDraftButton})}),ae&&l.jsxs(l.Fragment,{children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:v.saveCollection,isLoading:v.saveCollection,children:[l.jsx(qy,{size:14,"aria-hidden":"true"})," ",o.topbar.sendForReviewButton]}),C.features.collaborators&&l.jsx("button",{className:_e.iconBtn,onClick:()=>h("manageCollaborators"),"aria-label":o.topbar.collaboratorsLabel,title:o.topbar.collaboratorsLabel,type:"button",children:l.jsx(Wy,{size:16,"aria-hidden":"true"})}),_&&l.jsxs("div",{className:_e.qrDropdown,ref:O,children:[l.jsxs("button",{className:_e.iconBtn,onClick:()=>P(le=>!le),"aria-label":o.topbar.qrCodesLabel,title:o.topbar.qrCodesLabel,type:"button","aria-haspopup":"true","aria-expanded":j,children:[l.jsx(Ac,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:_e.iconBtnLabel,children:o.topbar.qrCodesLabel}),l.jsx(Cn,{size:14,style:{marginLeft:2},"aria-hidden":"true"})]}),j&&l.jsxs("div",{className:_e.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{P(!1),R(!0)},disabled:M,children:[l.jsx(Ac,{size:14}),M?o.topbar.generatingEllipsis:o.topbar.generateQrCodesMenuItem]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{P(!1),pe()},disabled:ee||!de,children:[l.jsx(Ey,{size:14}),ee?o.topbar.downloadingEllipsis:o.topbar.downloadQrCodesMenuItem]})]})]})]}),we&&l.jsxs("div",{className:_e.reviewBtns,children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("publishChecklist"),disabled:v.publishCollection,isLoading:v.publishCollection,children:[l.jsx(Pf,{size:14,"aria-hidden":"true"})," ",o.topbar.publishButton]}),l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>T(!0),disabled:v.rejectCollection,isLoading:v.rejectCollection,children:[l.jsx(kc,{size:14,"aria-hidden":"true"})," ",o.topbar.requestForChangesButton]})]}),ye&&l.jsxs("div",{className:_e.sourcingBtns,children:[l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"approve"}),children:[l.jsx(Uy,{size:14,"aria-hidden":"true"})," ",o.topbar.approveButton]}),l.jsxs(Re,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"reject"}),children:[l.jsx(kc,{size:14,"aria-hidden":"true"})," ",o.topbar.requestForChangesButton]})]})]})]}),m==="publishChecklist"&&l.jsx(B0,{contentId:f,onConfirm:Z,onCancel:b}),m==="qualityParams"&&l.jsx(q0,{contentId:f,action:(p==null?void 0:p.action)??"reject",onConfirm:he,onCancel:b}),m==="manageCollaborators"&&l.jsx("div",{className:_e.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(yT,{contentId:f,onClose:b})}),m==="confirmDelete"&&l.jsx($0,{message:(p==null?void 0:p.message)??"",onConfirm:()=>{const le=p==null?void 0:p.onConfirm;b(),le==null||le()},onCancel:b}),D&&l.jsx(ZT,{onConfirm:()=>{E(!1),B("sendForReview")},onCancel:()=>E(!1)}),x&&l.jsx(YT,{titleText:o.topbar.requestChangesTitle,labelText:o.topbar.changesRequestedLabel,placeholderText:o.topbar.describeChangesPlaceholder,submitLabel:o.topbar.requestForChangesButton,submitVariant:"primary",onConfirm:le=>{T(!1),B("reject",{comment:le})},onCancel:()=>T(!1)}),N&&l.jsx(XT,{onConfirm:fe,onCancel:()=>R(!1)})]})},e1=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>{const s=oe();return xr.createPortal(l.jsx("div",{className:Ae.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ae.modal,children:[l.jsxs("div",{className:Ae.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:s.unsavedChangesModal.title}),l.jsx("button",{className:Ae.modalHeaderClose,onClick:r,"aria-label":s.unsavedChangesModal.closeAriaLabel,disabled:n,children:"×"})]}),l.jsx("div",{className:Ae.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:s.unsavedChangesModal.bodyMessage})}),l.jsxs("div",{className:Ae.modalFooter,children:[l.jsx(Re,{variant:"ghost",onClick:r,disabled:n,children:s.unsavedChangesModal.cancelButton}),l.jsx(Re,{variant:"danger",onClick:t,disabled:n,children:s.unsavedChangesModal.discardButton}),l.jsx(Re,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:s.unsavedChangesModal.saveButton})]})]})}),document.body)};var t1=El();const Ph=g.createContext(null);function Ft(){const e=g.useContext(Ph);if(e===null)throw new Error("No Tree Api Provided");return e}const Rh=g.createContext(null);function r1(){const e=g.useContext(Rh);if(e===null)throw new Error("Provide a NodesContext");return e}const Fh=g.createContext(null);function n1(){const e=g.useContext(Fh);if(e===null)throw new Error("Provide a DnDContext");return e}const Mh=g.createContext(0);function Bh(){g.useContext(Mh)}function Ni(e,t,r){return Math.max(Math.min(e,r),t)}function qh(e){return e&&e.isLeaf}function $h(e){return e&&e.isInternal&&!e.isOpen}function Uh(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const zh=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Vh=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function Fl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=Fl(r,t);if(n)return n}return null}function eo(e,t){if(t(e),e.children)for(let r of e.children)eo(r,t)}function Hh(e){const t=Wh(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=s1(t,n);break}r==null||r.focus()}function Qh(e){const t=Wh(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=i1(t,n);break}r==null||r.focus()}function s1(e,t){return t+1<e.length?e[t+1]:e[0]}function i1(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Wh(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function xs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function Rn(e){return typeof e=="string"?e:e.id}function o1(e,...t){if(e)return e(...t)}function Gh(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Kh(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function Yh(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const a1=Object.freeze(Object.defineProperty({__proto__:null,access:xs,bound:Ni,dfs:Fl,focusNextElement:Hh,focusPrevElement:Qh,getInsertIndex:Kh,getInsertParentId:Yh,identify:Rn,indexOf:Vh,isClosed:$h,isDescendant:zh,isItem:qh,isOpenWithEmptyChildren:Uh,safeRun:o1,waitFor:Gh,walk:eo},Symbol.toStringTag,{value:"Module"})),l1={display:"flex",alignItems:"center",zIndex:1},c1={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},u1={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},d1=g.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},l1),s),children:[l.jsx("div",{style:Object.assign({},u1)}),l.jsx("div",{style:Object.assign({},c1)})]})});function f1({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function h1(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(m1,Object.assign({},e)):l.jsx(p1,Object.assign({},e))]})}function p1(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function m1({node:e}){const t=g.useRef();return g.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const qs="__REACT_ARBORIST_INTERNAL_ROOT__";function ou(e){var t;function r(i,o,a){const c=e.accessId(i),u=new $s({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new $s({tree:e,id:qs,data:{id:qs},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class $s{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===qs}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new $s(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Ko(e){return{type:"EDIT",id:e}}function g1(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function En(e){return{type:"FOCUS",id:e}}function v1(){return{type:"TREE_BLUR"}}function y1(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Ya={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function au(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function b1(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:au(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:au(e.unfiltered,t)}):e}const rs=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},Ir={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:Rn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(Rn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(Rn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:Rn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:Rn(e)})};function C1(e=rs().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const ns={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function S1(e=rs().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return rs().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const _1={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},w1=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},x1=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Zh({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(T1,{isDragging:s,children:[l.jsx(E1,{offset:e,children:l.jsx(k1,{id:r,dragIds:n})}),l.jsx(A1,{mouse:t,count:n.length})]})}const T1=g.memo(function(t){return t.isDragging?l.jsx("div",{style:_1,children:t.children}):null});function E1(e){return l.jsx("div",{className:"row preview",style:w1(e.offset),children:e.children})}function A1(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:x1(r),children:t}):null}const k1=g.memo(function(t){const r=Ft(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Za(){return Za=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Za.apply(null,arguments)}function lu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){return Xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xa(e,t)}function I1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xa(e,t)}var cu=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function D1(e,t){return!!(e===t||cu(e)&&cu(t))}function L1(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!D1(e[r],t[r]))return!1;return!0}function Yo(e,t){t===void 0&&(t=L1);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var O1=typeof performance=="object"&&typeof performance.now=="function",uu=O1?function(){return performance.now()}:function(){return Date.now()};function du(e){cancelAnimationFrame(e.id)}function N1(e,t){var r=uu();function n(){uu()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Zo=-1;function fu(e){if(e===void 0&&(e=!1),Zo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Zo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Zo}var An=null;function hu(e){if(e===void 0&&(e=!1),An===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?An="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?An="negative":An="positive-ascending"),document.body.removeChild(t),An}return An}process.env.NODE_ENV;var j1=150,P1=function(t,r){return t},ji=null,Pi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ji=new WeakSet,Pi=new WeakSet);function Xh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=(function(f){I1(m,f);function m(b){var h;return h=f.call(this,b)||this,h._instanceProps=c(h.props,lu(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:lu(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Yo(function(v,y,C,S){return h.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:y,visibleStartIndex:C,visibleStopIndex:S})}),h._callOnScroll=void 0,h._callOnScroll=Yo(function(v,y,C){return h.props.onScroll({scrollDirection:v,scrollOffset:y,scrollUpdateWasRequested:C})}),h._getItemStyle=void 0,h._getItemStyle=function(v){var y=h.props,C=y.direction,S=y.itemSize,_=y.layout,x=h._getItemStyleCache(u&&S,u&&_,u&&C),T;if(x.hasOwnProperty(v))T=x[v];else{var D=r(h.props,v,h._instanceProps),E=s(h.props,v,h._instanceProps),j=C==="horizontal"||_==="horizontal",P=C==="rtl",O=j?D:0;x[v]=T={position:"absolute",left:P?void 0:O,right:P?O:void 0,top:j?0:D,height:j?"100%":E,width:j?E:"100%"}}return T},h._getItemStyleCache=void 0,h._getItemStyleCache=Yo(function(v,y,C){return{}}),h._onScrollHorizontal=function(v){var y=v.currentTarget,C=y.clientWidth,S=y.scrollLeft,_=y.scrollWidth;h.setState(function(x){if(x.scrollOffset===S)return null;var T=h.props.direction,D=S;if(T==="rtl")switch(hu()){case"negative":D=-S;break;case"positive-descending":D=_-C-S;break}return D=Math.max(0,Math.min(D,_-C)),{isScrolling:!0,scrollDirection:x.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(v){var y=v.currentTarget,C=y.clientHeight,S=y.scrollHeight,_=y.scrollTop;h.setState(function(x){if(x.scrollOffset===_)return null;var T=Math.max(0,Math.min(_,S-C));return{isScrolling:!0,scrollDirection:x.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(v){var y=h.props.outerRef;h._outerRef=v,typeof y=="function"?y(v):y!=null&&typeof y=="object"&&y.hasOwnProperty("current")&&(y.current=v)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&du(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=N1(h._resetIsScrolling,j1)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,v){return R1(h,v),d(h),null};var p=m.prototype;return p.scrollTo=function(h){h=Math.max(0,h),this.setState(function(v){return v.scrollOffset===h?null:{scrollDirection:v.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},p.scrollToItem=function(h,v){v===void 0&&(v="auto");var y=this.props,C=y.itemCount,S=y.layout,_=this.state.scrollOffset;h=Math.max(0,Math.min(h,C-1));var x=0;if(this._outerRef){var T=this._outerRef;S==="vertical"?x=T.scrollWidth>T.clientWidth?fu():0:x=T.scrollHeight>T.clientHeight?fu():0}this.scrollTo(i(this.props,h,v,_,this._instanceProps,x))},p.componentDidMount=function(){var h=this.props,v=h.direction,y=h.initialScrollOffset,C=h.layout;if(typeof y=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||C==="horizontal"?S.scrollLeft=y:S.scrollTop=y}this._callPropsCallbacks()},p.componentDidUpdate=function(){var h=this.props,v=h.direction,y=h.layout,C=this.state,S=C.scrollOffset,_=C.scrollUpdateWasRequested;if(_&&this._outerRef!=null){var x=this._outerRef;if(v==="horizontal"||y==="horizontal")if(v==="rtl")switch(hu()){case"negative":x.scrollLeft=-S;break;case"positive-ascending":x.scrollLeft=S;break;default:var T=x.clientWidth,D=x.scrollWidth;x.scrollLeft=D-T-S;break}else x.scrollLeft=S;else x.scrollTop=S}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&du(this._resetIsScrollingTimeoutId)},p.render=function(){var h=this.props,v=h.children,y=h.className,C=h.direction,S=h.height,_=h.innerRef,x=h.innerElementType,T=h.innerTagName,D=h.itemCount,E=h.itemData,j=h.itemKey,P=j===void 0?P1:j,O=h.layout,N=h.outerElementType,R=h.outerTagName,M=h.style,$=h.useIsScrolling,ee=h.width,H=this.state.isScrolling,te=C==="horizontal"||O==="horizontal",de=te?this._onScrollHorizontal:this._onScrollVertical,fe=this._getRangeToRender(),pe=fe[0],ae=fe[1],we=[];if(D>0)for(var ye=pe;ye<=ae;ye++)we.push(g.createElement(v,{data:E,key:P(ye,E),index:ye,isScrolling:$?H:void 0,style:this._getItemStyle(ye)}));var F=n(this.props,this._instanceProps);return g.createElement(N||R||"div",{className:y,onScroll:de,ref:this._outerRefSetter,style:Za({position:"relative",height:S,width:ee,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:C},M)},g.createElement(x||T||"div",{children:we,ref:_,style:{height:te?"100%":F,pointerEvents:H?"none":void 0,width:te?F:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var v=this._getRangeToRender(),y=v[0],C=v[1],S=v[2],_=v[3];this._callOnItemsRendered(y,C,S,_)}}if(typeof this.props.onScroll=="function"){var x=this.state,T=x.scrollDirection,D=x.scrollOffset,E=x.scrollUpdateWasRequested;this._callOnScroll(T,D,E)}},p._getRangeToRender=function(){var h=this.props,v=h.itemCount,y=h.overscanCount,C=this.state,S=C.isScrolling,_=C.scrollDirection,x=C.scrollOffset;if(v===0)return[0,0,0,0];var T=o(this.props,x,this._instanceProps),D=a(this.props,T,x,this._instanceProps),E=!S||_==="backward"?Math.max(1,y):1,j=!S||_==="forward"?Math.max(1,y):1;return[Math.max(0,T-E),Math.max(0,Math.min(v-1,D+j)),T,D]},m})(g.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var R1=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Pi&&!Pi.has(d)&&(Pi.add(d),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":ji&&!ji.has(d)&&(ji.add(d),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},F1=50,Fn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},M1=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Jh(t,r,i,0,n):B1(t,r,Math.max(0,i),n)},Jh=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Fn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},B1=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Fn(t,n,r).offset<s;)n+=o,o*=2;return Jh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},pu=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var u=n-o-1,d=u*i;return a+d},q1=Xh({getItemOffset:function(t,r,n){return Fn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:pu,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",m=f?d:c,p=Fn(t,r,i),b=pu(t,i),h=Math.max(0,Math.min(b-m,p.offset)),v=Math.max(0,p.offset-m+p.size+o);switch(n==="smart"&&(s>=v-m&&s<=h+m?n="auto":n="center"),n){case"start":return h;case"end":return v;case"center":return Math.round(v+(h-v)/2);case"auto":default:return s>=v&&s<=h?s:s<v?v:h}},getStartIndexForOffset:function(t,r,n){return M1(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,m=Fn(t,r,s),p=n+f,b=m.offset+m.size,h=r;h<a-1&&b<p;)h++,b+=Fn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||F1,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),$1=Xh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.itemCount,d=t.itemSize,f=t.layout,m=t.width,p=a==="horizontal"||f==="horizontal",b=p?m:c,h=Math.max(0,u*d-b),v=Math.min(h,r*d),y=Math.max(0,r*d-b+d+o);switch(n==="smart"&&(s>=y-b&&s<=v+b?n="auto":n="center"),n){case"start":return v;case"end":return y;case"center":{var C=Math.round(y+(v-y)/2);return C<Math.ceil(b/2)?0:C>h+Math.floor(b/2)?h:C}case"auto":default:return s>=y&&s<=v?s:s<y?y:v}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,m=d?u:i,p=Math.ceil((m+n-f)/a);return Math.max(0,Math.min(o-1,r+p-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function U1(){var e,t;const r=Ft(),s=n1().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var z1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const V1=g.forwardRef(function(t,r){const{children:n}=t,s=z1(t,["children"]),i=Ft();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(H1,{}),n]}))}),H1=()=>{const e=Ft();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(U1,{})})};var Q1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const W1=g.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=Q1(t,["style"]);const u=Ft(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+f}px`})},c))});var ep=g.createContext({dragDropManager:void 0}),Xt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Xt||(Xt={}));function xe(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var Ml="dnd-core/INIT_COORDS",ko="dnd-core/BEGIN_DRAG",Bl="dnd-core/PUBLISH_DRAG_SOURCE",Io="dnd-core/HOVER",Do="dnd-core/DROP",Lo="dnd-core/END_DRAG";function mu(e,t){return{type:Ml,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ri(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ri=function(r){return typeof r}:Ri=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ri(e)}function G1(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function K1(e,t){return e.filter(function(r){return r!==t})}function tp(e){return Ri(e)==="object"}function Y1(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function Z1(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var X1={type:Ml,payload:{clientOffset:null,sourceClientOffset:null}};function J1(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(mu(o)),eE(r,c,u);var d=nE(r,c);if(d===null){e.dispatch(X1);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");tE(a),f=a(d)}e.dispatch(mu(o,f));var m=u.getSource(d),p=m.beginDrag(c,d);if(p!=null){rE(p),u.pinSource(d);var b=u.getSourceType(d);return{type:ko,payload:{itemType:b,item:p,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function eE(e,t,r){xe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){xe(r.getSource(n),"Expected sourceIds to be registered.")})}function tE(e){xe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function rE(e){xe(tp(e),"Item must be an object.")}function nE(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function sE(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Bl}}}function Ja(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function iE(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;oE(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();aE(i,o,a);var c=o.getItemType();return lE(i,a,c),cE(i,o,a),{type:Io,payload:{targetIds:i,clientOffset:s||null}}}}function oE(e){xe(Array.isArray(e),"Expected targetIds to be an array.")}function aE(e,t,r){xe(t.isDragging(),"Cannot call hover while not dragging."),xe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];xe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);xe(i,"Expected targetIds to be registered.")}}function lE(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ja(i,r)||e.splice(n,1)}}function cE(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function gu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(r),!0).forEach(function(n){uE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dE(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();fE(n);var i=mE(n);i.forEach(function(o,a){var c=hE(o,a,s,n),u={type:Do,payload:{dropResult:vu(vu({},r),c)}};e.dispatch(u)})}}function fE(e){xe(e.isDragging(),"Cannot call drop while not dragging."),xe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function hE(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return pE(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function pE(e){xe(typeof e>"u"||tp(e),"Drop result must either be an object or undefined.")}function mE(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function gE(e){return function(){var r=e.getMonitor(),n=e.getRegistry();vE(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Lo}}}function vE(e){xe(e.isDragging(),"Cannot call endDrag while not dragging.")}function yE(e){return{beginDrag:J1(e),publishDragSource:sE(e),hover:iE(e),drop:dE(e),endDrag:gE(e)}}function bE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function SE(e,t,r){return t&&CE(e.prototype,t),e}function gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _E=(function(){function e(t,r){var n=this;bE(this,e),gs(this,"store",void 0),gs(this,"monitor",void 0),gs(this,"backend",void 0),gs(this,"isSetUp",!1),gs(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return SE(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=yE(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e})();function Qt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var yu=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),bu=function(){return Math.random().toString(36).substring(7).split("").join(".")},Cu={INIT:"@@redux/INIT"+bu(),REPLACE:"@@redux/REPLACE"+bu()};function wE(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xE(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(AE(e))return"date";if(EE(e))return"error";var r=TE(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function TE(e){return typeof e.constructor=="function"?e.constructor.name:null}function EE(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function AE(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function kn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xE(e)),t}function rp(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Qt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(1):"Expected the enhancer to be a function. Instead, received: '"+kn(r)+"'");return r(rp)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(2):"Expected the root reducer to be a function. Instead, received: '"+kn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(4):"Expected the listener to be a function. Instead, received: '"+kn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var v=!0;return u(),a.push(h),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u();var C=a.indexOf(h);a.splice(C,1),o=null}}}function m(h){if(!wE(h))throw new Error(process.env.NODE_ENV==="production"?Qt(7):"Actions must be plain objects. Instead, the actual type was: '"+kn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Qt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Qt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var v=o=a,y=0;y<v.length;y++){var C=v[y];C()}return h}function p(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Qt(10):"Expected the nextReducer to be a function. Instead, received: '"+kn(h));s=h,m({type:Cu.REPLACE})}function b(){var h,v=f;return h={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?Qt(11):"Expected the observer to be an object. Instead, received: '"+kn(C)+"'");function S(){C.next&&C.next(d())}S();var _=v(S);return{unsubscribe:_}}},h[yu]=function(){return this},h}return m({type:Cu.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:p},n[yu]=b,n}var kE=function(t,r){return t===r};function IE(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function DE(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kE;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Su(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function _u(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(r),!0).forEach(function(n){LE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Su(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wu={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function OE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wu,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ml:case ko:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Io:return IE(e.clientOffset,r.clientOffset)?e:_u(_u({},e),{},{clientOffset:r.clientOffset});case Lo:case Do:return wu;default:return e}}var ql="dnd-core/ADD_SOURCE",$l="dnd-core/ADD_TARGET",Ul="dnd-core/REMOVE_SOURCE",Oo="dnd-core/REMOVE_TARGET";function NE(e){return{type:ql,payload:{sourceId:e}}}function jE(e){return{type:$l,payload:{targetId:e}}}function PE(e){return{type:Ul,payload:{sourceId:e}}}function RE(e){return{type:Oo,payload:{targetId:e}}}function xu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(r),!0).forEach(function(n){FE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ME={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function BE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ME,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ko:return Wt(Wt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Bl:return Wt(Wt({},e),{},{isSourcePublic:!0});case Io:return Wt(Wt({},e),{},{targetIds:r.targetIds});case Oo:return e.targetIds.indexOf(r.targetId)===-1?e:Wt(Wt({},e),{},{targetIds:K1(e.targetIds,r.targetId)});case Do:return Wt(Wt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Lo:return Wt(Wt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function qE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ql:case $l:return e+1;case Ul:case Oo:return e-1;default:return e}}var to=[],zl=[];to.__IS_NONE__=!0;zl.__IS_ALL__=!0;function $E(e,t){if(e===to)return!1;if(e===zl||typeof t>"u")return!0;var r=Z1(t,e);return r.length>0}function UE(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Io:break;case ql:case $l:case Oo:case Ul:return to;case ko:case Bl:case Lo:case Do:default:return zl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=Y1(n,i),a=o.length>0||!DE(n,i);if(!a)return to;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function zE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Tu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Eu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(r),!0).forEach(function(n){VE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function HE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:UE(e.dirtyHandlerIds,{type:t.type,payload:Eu(Eu({},t.payload),{},{prevTargetIds:G1(e,"dragOperation.targetIds",[])})}),dragOffset:OE(e.dragOffset,t),refCount:qE(e.refCount,t),dragOperation:BE(e.dragOperation,t),stateId:zE(e.stateId)}}function QE(e,t){return{x:e.x+t.x,y:e.y+t.y}}function np(e,t){return{x:e.x-t.x,y:e.y-t.y}}function WE(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:np(QE(t,n),r)}function GE(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:np(t,r)}function KE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ZE(e,t,r){return t&&YE(e.prototype,t),e}function Au(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var XE=(function(){function e(t,r){KE(this,e),Au(this,"store",void 0),Au(this,"registry",void 0),this.store=t,this.registry=r}return ZE(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;xe(typeof r=="function","listener must be a function."),xe(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!$E(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;xe(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return xe(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(xe(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ja(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(xe(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!Ja(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return WE(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return GE(this.store.getState().dragOffset)}}]),e})(),JE=0;function eA(){return JE++}function Fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fi=function(r){return typeof r}:Fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Fi(e)}function tA(e){xe(typeof e.canDrag=="function","Expected canDrag to be a function."),xe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),xe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function rA(e){xe(typeof e.canDrop=="function","Expected canDrop to be a function."),xe(typeof e.hover=="function","Expected hover to be a function."),xe(typeof e.drop=="function","Expected beginDrag to be a function.")}function el(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return el(r,!1)});return}xe(typeof e=="string"||Fi(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const ku=typeof global<"u"?global:self,sp=ku.MutationObserver||ku.WebKitMutationObserver;function ip(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function nA(e){let t=1;const r=new sp(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const sA=typeof sp=="function"?nA:ip;class iA{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=sA(this.flush),this.requestErrorThrow=ip(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class oA{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class aA{create(t){const r=this.freeTasks,n=r.length?r.pop():new oA(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const op=new iA,lA=new aA(op.registerPendingError);function cA(e){op.enqueueTask(lA.create(e))}function uA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fA(e,t,r){return t&&dA(e.prototype,t),e}function In(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hA(e,t){return vA(e)||gA(e,t)||mA(e,t)||pA()}function pA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
537
537
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mA(e,t){if(e){if(typeof e=="string")return Iu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Iu(e,t)}}function Iu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gA(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function vA(e){if(Array.isArray(e))return e}function yA(e){var t=eA().toString();switch(e){case Xt.SOURCE:return"S".concat(t);case Xt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Du(e){switch(e[0]){case"S":return Xt.SOURCE;case"T":return Xt.TARGET;default:xe(!1,"Cannot parse handler ID: ".concat(e))}}function Lu(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=hA(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var bA=(function(){function e(t){uA(this,e),In(this,"types",new Map),In(this,"dragSources",new Map),In(this,"dropTargets",new Map),In(this,"pinnedSourceId",null),In(this,"pinnedSource",null),In(this,"store",void 0),this.store=t}return fA(e,[{key:"addSource",value:function(r,n){el(r),tA(n);var s=this.addHandler(Xt.SOURCE,r,n);return this.store.dispatch(NE(s)),s}},{key:"addTarget",value:function(r,n){el(r,!0),rA(n);var s=this.addHandler(Xt.TARGET,r,n);return this.store.dispatch(jE(s)),s}},{key:"containsHandler",value:function(r){return Lu(this.dragSources,r)||Lu(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;xe(this.isSourceId(r),"Expected a valid source ID.");var s=n&&r===this.pinnedSourceId,i=s?this.pinnedSource:this.dragSources.get(r);return i}},{key:"getTarget",value:function(r){return xe(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return xe(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return xe(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Du(r);return n===Xt.SOURCE}},{key:"isTargetId",value:function(r){var n=Du(r);return n===Xt.TARGET}},{key:"removeSource",value:function(r){var n=this;xe(this.getSource(r),"Expected an existing source."),this.store.dispatch(PE(r)),cA(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){xe(this.getTarget(r),"Expected an existing target."),this.store.dispatch(RE(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);xe(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){xe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=yA(r);return this.types.set(i,n),r===Xt.SOURCE?this.dragSources.set(i,s):r===Xt.TARGET&&this.dropTargets.set(i,s),i}}]),e})();function CA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=SA(n),i=new XE(s,new bA(s)),o=new _E(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function SA(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return rp(HE,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var _A=["children"];function wA(e,t){return AA(e)||EA(e,t)||TA(e,t)||xA()}function xA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
538
538
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TA(e,t){if(e){if(typeof e=="string")return Ou(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ou(e,t)}}function Ou(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function EA(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function AA(e){if(Array.isArray(e))return e}function kA(e,t){if(e==null)return{};var r=IA(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function IA(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Nu=0,Mi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),DA=g.memo(function(t){var r=t.children,n=kA(t,_A),s=LA(n),i=wA(s,2),o=i[0],a=i[1];return g.useEffect(function(){if(a){var c=ap();return++Nu,function(){--Nu===0&&(c[Mi]=null)}}},[]),l.jsx(ep.Provider,Object.assign({value:o},{children:r}),void 0)});function LA(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=OA(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function OA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ap(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Mi]||(s[Mi]={dragDropManager:CA(e,t,r,n)}),s[Mi]}function ap(){return typeof global<"u"?global:window}function NA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function PA(e,t,r){return t&&jA(e.prototype,t),e}function ju(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Xo=!1,Jo=!1,RA=(function(){function e(t){NA(this,e),ju(this,"internalMonitor",void 0),ju(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return PA(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){xe(!Xo,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;xe(!Jo,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Jo=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Jo=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e})();function FA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function BA(e,t,r){return t&&MA(e.prototype,t),e}function Pu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ea=!1,qA=(function(){function e(t){FA(this,e),Pu(this,"internalMonitor",void 0),Pu(this,"targetId",null),this.internalMonitor=t.getMonitor()}return BA(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;xe(!ea,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return ea=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ea=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e})();function $A(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function UA(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!g.isValidElement(t)){var n=t;return e(n,r),n}var s=t;$A(s);var i=r?function(o){return e(o,r)}:e;return zA(s,i)}}function lp(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=UA(n);t[r]=function(){return s}}}),t}function Ru(e,t){typeof e=="function"?e(t):e.current=t}function zA(e,t){var r=e.ref;return xe(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?g.cloneElement(e,{ref:function(s){Ru(r,s),Ru(t,s)}}):g.cloneElement(e,{ref:t})}function Bi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Bi=function(r){return typeof r}:Bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Bi(e)}function tl(e){return e!==null&&Bi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function rl(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var u=i[c];if(!a(u))return!1;var d=e[u],f=t[u];if(s=void 0,s===!1||s===void 0&&d!==f)return!1}return!0}function VA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function QA(e,t,r){return t&&HA(e.prototype,t),e}function _t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var WA=(function(){function e(t){var r=this;VA(this,e),_t(this,"hooks",lp({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,tl(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,tl(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),_t(this,"handlerId",null),_t(this,"dragSourceRef",null),_t(this,"dragSourceNode",void 0),_t(this,"dragSourceOptionsInternal",null),_t(this,"dragSourceUnsubscribe",void 0),_t(this,"dragPreviewRef",null),_t(this,"dragPreviewNode",void 0),_t(this,"dragPreviewOptionsInternal",null),_t(this,"dragPreviewUnsubscribe",void 0),_t(this,"lastConnectedHandlerId",null),_t(this,"lastConnectedDragSource",null),_t(this,"lastConnectedDragSourceOptions",null),_t(this,"lastConnectedDragPreview",null),_t(this,"lastConnectedDragPreviewOptions",null),_t(this,"backend",void 0),this.backend=t}return QA(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!rl(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!rl(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e})();function GA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function YA(e,t,r){return t&&KA(e.prototype,t),e}function dr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZA=(function(){function e(t){var r=this;GA(this,e),dr(this,"hooks",lp({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,tl(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),dr(this,"handlerId",null),dr(this,"dropTargetRef",null),dr(this,"dropTargetNode",void 0),dr(this,"dropTargetOptionsInternal",null),dr(this,"unsubscribeDropTarget",void 0),dr(this,"lastConnectedHandlerId",null),dr(this,"lastConnectedDropTarget",null),dr(this,"lastConnectedDropTargetOptions",null),dr(this,"backend",void 0),this.backend=t}return YA(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!rl(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e})();function XA(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function JA(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var yn=typeof window<"u"?g.useLayoutEffect:g.useEffect;function qi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qi=function(r){return typeof r}:qi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qi(e)}function ek(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tk(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rk(e,t,r){return t&&tk(e.prototype,t),e}function ta(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nk=(function(){function e(t,r,n){ek(this,e),ta(this,"spec",void 0),ta(this,"monitor",void 0),ta(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return rk(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return qi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e})();function sk(e,t,r){var n=g.useMemo(function(){return new nk(e,t,r)},[t,r]);return g.useEffect(function(){n.spec=e},[e]),n}function _n(){var e=g.useContext(ep),t=e.dragDropManager;return xe(t!=null,"Expected drag drop context"),t}function ik(e){return g.useMemo(function(){var t=e.type;return xe(t!=null,"spec.type must be defined"),t},[e])}function ok(e,t){return uk(e)||ck(e,t)||lk(e,t)||ak()}function ak(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
539
539
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lk(e,t){if(e){if(typeof e=="string")return Fu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fu(e,t)}}function Fu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ck(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function uk(e){if(Array.isArray(e))return e}function dk(e,t,r){var n=_n(),s=sk(e,t,r),i=ik(e);yn(function(){if(i!=null){var a=JA(i,s,n),c=ok(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d}},[n,t,r,s,i])}function fk(e){return gk(e)||mk(e)||pk(e)||hk()}function hk(){throw new TypeError(`Invalid attempt to spread non-iterable instance.